From f353d23368b4d6859576783b82525b2662e08b34 Mon Sep 17 00:00:00 2001 From: Shuanglei Tao Date: Mon, 11 Nov 2024 15:24:18 +0800 Subject: [PATCH] Initial commit --- EPD/DEV_Config.c | 91 + EPD/DEV_Config.h | 56 + EPD/EPD_4in2.c | 582 + EPD/EPD_4in2.h | 108 + EPD/EPD_4in2_V2.c | 621 + EPD/EPD_4in2_V2.h | 56 + EPD/EPD_4in2b_V2.c | 221 + EPD/EPD_4in2b_V2.h | 47 + EPD/EPD_ble.c | 302 + EPD/EPD_ble.h | 136 + Keil/EPD.uvoptx | 948 ++ Keil/EPD.uvprojx | 1734 +++ .../Device/nRF51822_xxAB/arm_startup_nrf51.s | 255 + Keil/RTE/Device/nRF51822_xxAB/system_nrf51.c | 121 + Keil/RTE/_EPD/RTE_Components.h | 21 + Keil/RTE/_EPD_Debug/RTE_Components.h | 21 + Keil/RTE/_flash_softdevice/RTE_Components.h | 21 + LICENSE | 674 + .../ant_channel_config/ant_channel_config.c | 68 + .../ant_channel_config/ant_channel_config.h | 50 + .../ant/ant_encryption/ant_encrypt_config.c | 222 + .../ant/ant_encryption/ant_encrypt_config.h | 219 + .../ant_encrypt_negotiation_slave.c | 168 + .../ant_encrypt_negotiation_slave.h | 104 + .../ant/ant_key_manager/ant_key_manager.c | 35 + .../ant/ant_key_manager/ant_key_manager.h | 67 + .../config/ant_key_manager_config.h | 33 + .../ant/ant_profiles/ant_bpwr/ant_bpwr.c | 456 + .../ant/ant_profiles/ant_bpwr/ant_bpwr.h | 338 + .../ant_profiles/ant_bpwr/ant_bpwr_local.h | 65 + .../ant_bpwr/pages/ant_bpwr_common_data.c | 59 + .../ant_bpwr/pages/ant_bpwr_common_data.h | 63 + .../ant_bpwr/pages/ant_bpwr_page_1.c | 253 + .../ant_bpwr/pages/ant_bpwr_page_1.h | 100 + .../ant_bpwr/pages/ant_bpwr_page_16.c | 80 + .../ant_bpwr/pages/ant_bpwr_page_16.h | 75 + .../ant_bpwr/pages/ant_bpwr_page_17.c | 41 + .../ant_bpwr/pages/ant_bpwr_page_17.h | 53 + .../ant_bpwr/pages/ant_bpwr_page_18.c | 41 + .../ant_bpwr/pages/ant_bpwr_page_18.h | 41 + .../ant_bpwr/pages/ant_bpwr_page_torque.c | 76 + .../ant_bpwr/pages/ant_bpwr_page_torque.h | 70 + .../ant_bpwr/pages/ant_bpwr_pages.h | 33 + .../pages/logger/ant_bpwr_page_logger.h | 58 + .../ant_bpwr/simulator/ant_bpwr_simulator.c | 174 + .../ant_bpwr/simulator/ant_bpwr_simulator.h | 87 + .../simulator/ant_bpwr_simulator_local.h | 38 + .../ant_bpwr/utils/ant_bpwr_utils.h | 49 + components/ant/ant_profiles/ant_bsc/ant_bsc.c | 382 + components/ant/ant_profiles/ant_bsc/ant_bsc.h | 325 + .../ant/ant_profiles/ant_bsc/ant_bsc_local.h | 48 + .../ant_bsc/pages/ant_bsc_combined_page_0.c | 94 + .../ant_bsc/pages/ant_bsc_combined_page_0.h | 62 + .../ant_bsc/pages/ant_bsc_page_0.c | 70 + .../ant_bsc/pages/ant_bsc_page_0.h | 58 + .../ant_bsc/pages/ant_bsc_page_1.c | 55 + .../ant_bsc/pages/ant_bsc_page_1.h | 56 + .../ant_bsc/pages/ant_bsc_page_2.c | 56 + .../ant_bsc/pages/ant_bsc_page_2.h | 58 + .../ant_bsc/pages/ant_bsc_page_3.c | 53 + .../ant_bsc/pages/ant_bsc_page_3.h | 60 + .../ant_bsc/pages/ant_bsc_page_4.c | 64 + .../ant_bsc/pages/ant_bsc_page_4.h | 76 + .../ant_bsc/pages/ant_bsc_page_5.c | 56 + .../ant_bsc/pages/ant_bsc_page_5.h | 58 + .../ant_bsc/pages/ant_bsc_pages.h | 32 + .../pages/logger/ant_bsc_page_logger.h | 71 + .../ant_bsc/simulator/ant_bsc_simulator.c | 253 + .../ant_bsc/simulator/ant_bsc_simulator.h | 85 + .../simulator/ant_bsc_simulator_local.h | 44 + .../ant_bsc/utils/ant_bsc_utils.h | 91 + .../ant_request_controller.c | 194 + .../ant_request_controller.h | 121 + .../ant_common/pages/ant_common_page_70.c | 104 + .../ant_common/pages/ant_common_page_70.h | 99 + .../ant_common/pages/ant_common_page_80.c | 73 + .../ant_common/pages/ant_common_page_80.h | 84 + .../ant_common/pages/ant_common_page_81.c | 80 + .../ant_common/pages/ant_common_page_81.h | 75 + .../pages/logger/ant_common_page_logger.h | 26 + components/ant/ant_profiles/ant_hrm/ant_hrm.c | 310 + components/ant/ant_profiles/ant_hrm/ant_hrm.h | 254 + .../ant/ant_profiles/ant_hrm/ant_hrm_local.h | 40 + .../ant_hrm/pages/ant_hrm_page_0.c | 76 + .../ant_hrm/pages/ant_hrm_page_0.h | 62 + .../ant_hrm/pages/ant_hrm_page_1.c | 64 + .../ant_hrm/pages/ant_hrm_page_1.h | 58 + .../ant_hrm/pages/ant_hrm_page_2.c | 66 + .../ant_hrm/pages/ant_hrm_page_2.h | 60 + .../ant_hrm/pages/ant_hrm_page_3.c | 63 + .../ant_hrm/pages/ant_hrm_page_3.h | 62 + .../ant_hrm/pages/ant_hrm_page_4.c | 67 + .../ant_hrm/pages/ant_hrm_page_4.h | 60 + .../ant_hrm/pages/ant_hrm_pages.h | 30 + .../pages/logger/ant_hrm_page_logger.h | 57 + .../ant_hrm/simulator/ant_hrm_simulator.c | 117 + .../ant_hrm/simulator/ant_hrm_simulator.h | 95 + .../simulator/ant_hrm_simulator_local.h | 34 + .../ant_hrm/utils/ant_hrm_utils.h | 74 + components/ant/ant_profiles/ant_sdm/ant_sdm.c | 366 + components/ant/ant_profiles/ant_sdm/ant_sdm.h | 294 + .../ant/ant_profiles/ant_sdm/ant_sdm_local.h | 46 + .../ant_sdm/pages/ant_sdm_common_data.c | 65 + .../ant_sdm/pages/ant_sdm_common_data.h | 67 + .../ant_sdm/pages/ant_sdm_page_1.c | 108 + .../ant_sdm/pages/ant_sdm_page_1.h | 65 + .../ant_sdm/pages/ant_sdm_page_16.c | 68 + .../ant_sdm/pages/ant_sdm_page_16.h | 43 + .../ant_sdm/pages/ant_sdm_page_2.c | 91 + .../ant_sdm/pages/ant_sdm_page_2.h | 93 + .../ant_sdm/pages/ant_sdm_page_22.c | 89 + .../ant_sdm/pages/ant_sdm_page_22.h | 70 + .../ant_sdm/pages/ant_sdm_page_3.c | 52 + .../ant_sdm/pages/ant_sdm_page_3.h | 57 + .../ant_sdm/pages/ant_sdm_pages.h | 34 + .../pages/logger/ant_sdm_page_logger.h | 65 + .../ant_sdm/simulator/ant_sdm_simulator.c | 130 + .../ant_sdm/simulator/ant_sdm_simulator.h | 104 + .../simulator/ant_sdm_simulator_local.h | 36 + .../ant_sdm/utils/ant_sdm_utils.h | 77 + .../ant/ant_search_config/ant_search_config.c | 58 + .../ant/ant_search_config/ant_search_config.h | 82 + .../ant/ant_stack_config/ant_stack_config.c | 48 + .../ant/ant_stack_config/ant_stack_config.h | 45 + .../config/ant_stack_config_defs.h | 20 + .../ant_state_indicator/ant_state_indicator.c | 129 + .../ant_state_indicator/ant_state_indicator.h | 65 + .../ble/ble_advertising/ble_advertising.c | 553 + .../ble/ble_advertising/ble_advertising.h | 223 + .../ble/ble_db_discovery/ble_db_discovery.c | 902 ++ .../ble/ble_db_discovery/ble_db_discovery.h | 217 + .../ble_debug_assert_handler.c | 55 + .../ble_debug_assert_handler.h | 51 + components/ble/ble_dtm/ble_dtm.c | 643 + components/ble/ble_dtm/ble_dtm.h | 141 + components/ble/ble_error_log/ble_error_log.c | 58 + components/ble/ble_error_log/ble_error_log.h | 69 + components/ble/ble_racp/ble_racp.c | 56 + components/ble/ble_racp/ble_racp.h | 96 + .../ble_radio_notification.c | 59 + .../ble_radio_notification.h | 45 + .../ble/ble_services/ble_ancs_c/ble_ancs_c.c | 737 + .../ble/ble_services/ble_ancs_c/ble_ancs_c.h | 320 + .../ble/ble_services/ble_ans_c/ble_ans_c.c | 1049 ++ .../ble/ble_services/ble_ans_c/ble_ans_c.h | 352 + components/ble/ble_services/ble_bas/ble_bas.c | 316 + components/ble/ble_services/ble_bas/ble_bas.h | 133 + .../ble/ble_services/ble_bas_c/ble_bas_c.c | 321 + .../ble/ble_services/ble_bas_c/ble_bas_c.h | 169 + components/ble/ble_services/ble_bps/ble_bps.c | 439 + components/ble/ble_services/ble_bps/ble_bps.h | 161 + .../ble/ble_services/ble_cscs/ble_cscs.c | 443 + .../ble/ble_services/ble_cscs/ble_cscs.h | 161 + .../ble/ble_services/ble_cscs/ble_sc_ctrlpt.c | 634 + .../ble/ble_services/ble_cscs/ble_sc_ctrlpt.h | 211 + .../ble/ble_services/ble_cts_c/ble_cts_c.c | 332 + .../ble/ble_services/ble_cts_c/ble_cts_c.h | 169 + components/ble/ble_services/ble_dfu/ble_dfu.c | 666 + components/ble/ble_services/ble_dfu/ble_dfu.h | 239 + components/ble/ble_services/ble_dis/ble_dis.c | 277 + components/ble/ble_services/ble_dis/ble_dis.h | 98 + components/ble/ble_services/ble_gls/ble_gls.c | 1267 ++ components/ble/ble_services/ble_gls/ble_gls.h | 264 + .../ble/ble_services/ble_gls/ble_gls_db.c | 112 + .../ble/ble_services/ble_gls/ble_gls_db.h | 84 + .../ble/ble_services/ble_hids/ble_hids.c | 1380 ++ .../ble/ble_services/ble_hids/ble_hids.h | 314 + components/ble/ble_services/ble_hrs/ble_hrs.c | 440 + components/ble/ble_services/ble_hrs/ble_hrs.h | 192 + .../ble/ble_services/ble_hrs_c/ble_hrs_c.c | 290 + .../ble/ble_services/ble_hrs_c/ble_hrs_c.h | 170 + components/ble/ble_services/ble_hts/ble_hts.c | 428 + components/ble/ble_services/ble_hts/ble_hts.h | 160 + components/ble/ble_services/ble_ias/ble_ias.c | 173 + components/ble/ble_services/ble_ias/ble_ias.h | 113 + .../ble/ble_services/ble_ias_c/ble_ias_c.c | 250 + .../ble/ble_services/ble_ias_c/ble_ias_c.h | 121 + components/ble/ble_services/ble_lbs/ble_lbs.c | 242 + components/ble/ble_services/ble_lbs/ble_lbs.h | 104 + components/ble/ble_services/ble_lls/ble_lls.c | 214 + components/ble/ble_services/ble_lls/ble_lls.h | 116 + components/ble/ble_services/ble_nus/ble_nus.c | 313 + components/ble/ble_services/ble_nus/ble_nus.h | 114 + .../ble/ble_services/ble_nus_c/ble_nus_c.c | 228 + .../ble/ble_services/ble_nus_c/ble_nus_c.h | 167 + .../ble/ble_services/ble_rscs/ble_rscs.c | 385 + .../ble/ble_services/ble_rscs/ble_rscs.h | 144 + .../ble/ble_services/ble_rscs_c/ble_rscs_c.c | 308 + .../ble/ble_services/ble_rscs_c/ble_rscs_c.h | 89 + components/ble/ble_services/ble_tps/ble_tps.c | 139 + components/ble/ble_services/ble_tps/ble_tps.h | 86 + .../experimental_ble_lns/ble_lns.c | 1580 ++ .../experimental_ble_lns/ble_lns.h | 424 + components/ble/common/ble_advdata.c | 841 ++ components/ble/common/ble_advdata.h | 212 + components/ble/common/ble_conn_params.c | 323 + components/ble/common/ble_conn_params.h | 111 + components/ble/common/ble_conn_state.c | 394 + components/ble/common/ble_conn_state.h | 267 + components/ble/common/ble_date_time.h | 76 + components/ble/common/ble_gatt_db.h | 30 + components/ble/common/ble_sensor_location.h | 40 + components/ble/common/ble_srv_common.c | 197 + components/ble/common/ble_srv_common.h | 348 + .../config/device_manager_cnfg.h | 98 + .../ble/device_manager/device_manager.h | 888 ++ .../device_manager/device_manager_central.c | 2793 ++++ .../device_manager_peripheral.c | 2914 ++++ .../ble/peer_manager/gatt_cache_manager.c | 542 + .../ble/peer_manager/gatt_cache_manager.h | 184 + .../ble/peer_manager/gattc_cache_manager.c | 108 + .../ble/peer_manager/gattc_cache_manager.h | 83 + .../ble/peer_manager/gatts_cache_manager.c | 373 + .../ble/peer_manager/gatts_cache_manager.h | 184 + components/ble/peer_manager/id_manager.c | 730 + components/ble/peer_manager/id_manager.h | 213 + components/ble/peer_manager/peer_data.c | 145 + components/ble/peer_manager/peer_data.h | 53 + .../ble/peer_manager/peer_data_storage.c | 669 + .../ble/peer_manager/peer_data_storage.h | 350 + components/ble/peer_manager/peer_database.c | 748 + components/ble/peer_manager/peer_database.h | 334 + components/ble/peer_manager/peer_id.c | 111 + components/ble/peer_manager/peer_id.h | 92 + components/ble/peer_manager/peer_manager.c | 618 + components/ble/peer_manager/peer_manager.h | 475 + .../ble/peer_manager/peer_manager_types.h | 269 + components/ble/peer_manager/pm_buffer.c | 122 + components/ble/peer_manager/pm_buffer.h | 113 + components/ble/peer_manager/pm_mutex.c | 115 + components/ble/peer_manager/pm_mutex.h | 88 + .../ble/peer_manager/security_dispatcher.c | 833 ++ .../ble/peer_manager/security_dispatcher.h | 248 + .../ble/peer_manager/security_manager.c | 540 + .../ble/peer_manager/security_manager.h | 158 + components/device/compiler_abstraction.h | 126 + components/device/nrf.h | 60 + components/device/nrf51.h | 1285 ++ components/device/nrf51_bitfields.h | 6892 +++++++++ components/device/nrf51_deprecated.h | 438 + components/device/nrf51_to_nrf52.h | 935 ++ components/device/nrf52.h | 2070 +++ components/device/nrf52_bitfields.h | 12369 ++++++++++++++++ components/drivers_ext/adns2080/adns2080.c | 331 + components/drivers_ext/adns2080/adns2080.h | 281 + .../drivers_ext/cherry8x16/cherry8x16.c | 448 + .../drivers_ext/cherry8x16/cherry8x16.h | 83 + components/drivers_ext/ds1624/ds1624.c | 127 + components/drivers_ext/ds1624/ds1624.h | 77 + components/drivers_ext/mpu6050/mpu6050.c | 81 + components/drivers_ext/mpu6050/mpu6050.h | 74 + components/drivers_ext/nrf6350/nrf6350.c | 278 + components/drivers_ext/nrf6350/nrf6350.h | 118 + .../drivers_ext/segger_rtt/RTT_Syscalls_GCC.c | 98 + .../drivers_ext/segger_rtt/RTT_Syscalls_IAR.c | 95 + .../segger_rtt/RTT_Syscalls_KEIL.c | 338 + .../drivers_ext/segger_rtt/SEGGER_RTT.c | 1102 ++ .../drivers_ext/segger_rtt/SEGGER_RTT.h | 204 + .../drivers_ext/segger_rtt/SEGGER_RTT_Conf.h | 135 + .../segger_rtt/SEGGER_RTT_printf.c | 492 + .../synaptics_touchpad/synaptics_touchpad.c | 115 + .../synaptics_touchpad/synaptics_touchpad.h | 128 + components/drivers_nrf/ble_flash/ble_flash.c | 286 + components/drivers_nrf/ble_flash/ble_flash.h | 142 + components/drivers_nrf/clock/nrf_drv_clock.c | 458 + components/drivers_nrf/clock/nrf_drv_clock.h | 183 + .../drivers_nrf/common/nrf_drv_common.c | 31 + .../drivers_nrf/common/nrf_drv_common.h | 147 + .../drivers_nrf/common/nrf_drv_validation.h | 21 + .../drivers_nrf/config/nrf_drv_config.h | 341 + .../config/nrf_drv_config_validation.h | 62 + components/drivers_nrf/delay/nrf_delay.c | 26 + components/drivers_nrf/delay/nrf_delay.h | 242 + .../drivers_nrf/gpiote/nrf_drv_gpiote.c | 541 + .../drivers_nrf/gpiote/nrf_drv_gpiote.h | 305 + components/drivers_nrf/hal/nrf_adc.c | 78 + components/drivers_nrf/hal/nrf_adc.h | 324 + components/drivers_nrf/hal/nrf_clock.h | 367 + components/drivers_nrf/hal/nrf_ecb.c | 74 + components/drivers_nrf/hal/nrf_ecb.h | 66 + components/drivers_nrf/hal/nrf_egu.h | 286 + components/drivers_nrf/hal/nrf_gpio.h | 647 + components/drivers_nrf/hal/nrf_gpiote.h | 346 + components/drivers_nrf/hal/nrf_lpcomp.h | 367 + components/drivers_nrf/hal/nrf_nvmc.c | 117 + components/drivers_nrf/hal/nrf_nvmc.h | 90 + components/drivers_nrf/hal/nrf_ppi.h | 354 + components/drivers_nrf/hal/nrf_qdec.h | 468 + components/drivers_nrf/hal/nrf_rng.h | 211 + components/drivers_nrf/hal/nrf_rtc.h | 298 + components/drivers_nrf/hal/nrf_saadc.c | 31 + components/drivers_nrf/hal/nrf_saadc.h | 543 + components/drivers_nrf/hal/nrf_spi.h | 334 + components/drivers_nrf/hal/nrf_spim.h | 459 + components/drivers_nrf/hal/nrf_spis.h | 512 + components/drivers_nrf/hal/nrf_temp.h | 55 + components/drivers_nrf/hal/nrf_timer.h | 403 + components/drivers_nrf/hal/nrf_twi.h | 384 + components/drivers_nrf/hal/nrf_twis.h | 677 + components/drivers_nrf/hal/nrf_uart.h | 471 + components/drivers_nrf/hal/nrf_uarte.h | 508 + components/drivers_nrf/hal/nrf_wdt.h | 299 + .../drivers_nrf/lpcomp/nrf_drv_lpcomp.c | 132 + .../drivers_nrf/lpcomp/nrf_drv_lpcomp.h | 106 + .../drivers_nrf/nrf_soc_nosd/nrf_error.h | 48 + components/drivers_nrf/nrf_soc_nosd/nrf_soc.c | 102 + components/drivers_nrf/nrf_soc_nosd/nrf_soc.h | 158 + components/drivers_nrf/ppi/nrf_drv_ppi.c | 412 + components/drivers_nrf/ppi/nrf_drv_ppi.h | 271 + .../pstorage/config/pstorage_platform.h | 78 + components/drivers_nrf/pstorage/pstorage.c | 1572 ++ components/drivers_nrf/pstorage/pstorage.h | 381 + .../drivers_nrf/pstorage/pstorage_nosd.c | 525 + .../drivers_nrf/pstorage/pstorage_raw.c | 471 + components/drivers_nrf/qdec/nrf_drv_qdec.c | 168 + components/drivers_nrf/qdec/nrf_drv_qdec.h | 149 + .../drivers_nrf/radio_config/radio_config.c | 160 + .../drivers_nrf/radio_config/radio_config.h | 21 + components/drivers_nrf/rng/nrf_drv_rng.c | 219 + components/drivers_nrf/rng/nrf_drv_rng.h | 104 + components/drivers_nrf/rtc/nrf_drv_rtc.c | 278 + components/drivers_nrf/rtc/nrf_drv_rtc.h | 323 + .../drivers_nrf/sdio/config/sdio_config.h | 18 + components/drivers_nrf/sdio/sdio.c | 217 + components/drivers_nrf/sdio/sdio.h | 69 + .../drivers_nrf/spi_master/nrf_drv_spi.c | 506 + .../drivers_nrf/spi_master/nrf_drv_spi.h | 234 + .../drivers_nrf/spi_master/spi_5W_master.c | 604 + .../drivers_nrf/spi_master/spi_5W_master.h | 170 + .../drivers_nrf/spi_slave/nrf_drv_spis.c | 354 + .../drivers_nrf/spi_slave/nrf_drv_spis.h | 219 + components/drivers_nrf/swi/nrf_drv_swi.c | 326 + components/drivers_nrf/swi/nrf_drv_swi.h | 167 + components/drivers_nrf/timer/nrf_drv_timer.c | 361 + components/drivers_nrf/timer/nrf_drv_timer.h | 296 + .../deprecated/config/twi_master_config.h | 18 + .../twi_master/deprecated/twi_hw_master.c | 304 + .../twi_master/deprecated/twi_master.h | 101 + .../twi_master/deprecated/twi_sw_master.c | 492 + .../drivers_nrf/twi_master/nrf_drv_twi.c | 746 + .../drivers_nrf/twi_master/nrf_drv_twi.h | 227 + components/drivers_nrf/uart/nrf_drv_uart.c | 683 + components/drivers_nrf/uart/nrf_drv_uart.h | 269 + components/drivers_nrf/wdt/nrf_drv_wdt.c | 118 + components/drivers_nrf/wdt/nrf_drv_wdt.h | 121 + components/libraries/ant_fs/antfs.c | 2339 +++ components/libraries/ant_fs/antfs.h | 350 + components/libraries/ant_fs/crc.c | 55 + components/libraries/ant_fs/crc.h | 42 + components/libraries/ant_fs/defines.h | 60 + .../ble_transport/hci_mem_pool_internal.h | 32 + .../libraries/bootloader_dfu/bootloader.c | 387 + .../libraries/bootloader_dfu/bootloader.h | 97 + .../bootloader_dfu/bootloader_settings.c | 36 + .../bootloader_dfu/bootloader_settings.h | 35 + .../bootloader_dfu/bootloader_types.h | 59 + .../bootloader_dfu/bootloader_util.c | 152 + .../bootloader_dfu/bootloader_util.h | 38 + components/libraries/bootloader_dfu/dfu.h | 134 + .../bootloader_dfu/dfu_app_handler.c | 192 + .../bootloader_dfu/dfu_app_handler.h | 86 + .../bootloader_dfu/dfu_bank_internal.h | 87 + .../libraries/bootloader_dfu/dfu_ble_svc.h | 80 + .../bootloader_dfu/dfu_ble_svc_internal.h | 43 + .../libraries/bootloader_dfu/dfu_dual_bank.c | 869 ++ .../libraries/bootloader_dfu/dfu_init.h | 134 + .../bootloader_dfu/dfu_init_template.c | 155 + .../bootloader_dfu/dfu_single_bank.c | 818 + .../libraries/bootloader_dfu/dfu_transport.h | 40 + .../bootloader_dfu/dfu_transport_ble.c | 1109 ++ .../bootloader_dfu/dfu_transport_serial.c | 306 + .../libraries/bootloader_dfu/dfu_types.h | 147 + .../experimental/dfu_init_template_signing.c | 210 + .../bootloader_dfu/experimental/nrf_sec.h | 108 + .../hci_transport/hci_mem_pool_internal.h | 32 + .../hci_transport/hci_transport_config.h | 45 + components/libraries/button/app_button.c | 199 + components/libraries/button/app_button.h | 112 + components/libraries/console/console.c | 504 + components/libraries/console/console.h | 343 + components/libraries/crc16/crc16.c | 31 + components/libraries/crc16/crc16.h | 43 + .../experimental_section_vars/section_vars.h | 291 + components/libraries/fds/fds.c | 2070 +++ components/libraries/fds/fds.h | 546 + components/libraries/fds/fds_config.h | 45 + components/libraries/fds/fds_types_internal.h | 158 + components/libraries/fifo/app_fifo.c | 199 + components/libraries/fifo/app_fifo.h | 133 + components/libraries/fstorage/fstorage.c | 549 + components/libraries/fstorage/fstorage.h | 156 + .../libraries/fstorage/fstorage_config.h | 81 + components/libraries/fstorage/fstorage_nosd.c | 0 components/libraries/gpiote/app_gpiote.c | 268 + components/libraries/gpiote/app_gpiote.h | 219 + .../libraries/gpiote/app_gpiote_fast_detect.c | 539 + .../hci/config/hci_mem_pool_internal.h | 32 + .../hci/config/hci_transport_config.h | 40 + components/libraries/hci/hci_mem_pool.c | 235 + components/libraries/hci/hci_mem_pool.h | 132 + components/libraries/hci/hci_slip.c | 428 + components/libraries/hci/hci_slip.h | 129 + components/libraries/hci/hci_transport.c | 788 + components/libraries/hci/hci_transport.h | 220 + components/libraries/ic_info/nrf51_ic_info.c | 49 + components/libraries/ic_info/nrf_ic_info.h | 44 + .../libraries/led_softblink/led_softblink.c | 201 + .../libraries/led_softblink/led_softblink.h | 131 + .../libraries/low_power_pwm/low_power_pwm.c | 211 + .../libraries/low_power_pwm/low_power_pwm.h | 166 + components/libraries/mailbox/app_mailbox.c | 152 + components/libraries/mailbox/app_mailbox.h | 143 + .../libraries/mailbox/app_mailbox_local.h | 41 + .../libraries/mem_manager/mem_manager.c | 918 ++ .../libraries/mem_manager/mem_manager.h | 139 + components/libraries/pwm/app_pwm.c | 847 ++ components/libraries/pwm/app_pwm.h | 295 + .../libraries/scheduler/app_scheduler.c | 192 + .../libraries/scheduler/app_scheduler.h | 153 + .../scheduler/app_scheduler_serconn.c | 229 + components/libraries/sensorsim/sensorsim.c | 73 + components/libraries/sensorsim/sensorsim.h | 85 + components/libraries/sha256/sha256.c | 188 + components/libraries/sha256/sha256.h | 91 + .../libraries/simple_timer/app_simple_timer.c | 192 + .../libraries/simple_timer/app_simple_timer.h | 98 + components/libraries/slip/slip.c | 112 + components/libraries/slip/slip.h | 66 + components/libraries/timer/app_timer.c | 1124 ++ components/libraries/timer/app_timer.h | 277 + components/libraries/timer/app_timer_appsh.c | 34 + components/libraries/timer/app_timer_appsh.h | 44 + .../libraries/timer/app_timer_ble_gzll.c | 1124 ++ .../libraries/timer/app_timer_freertos.c | 230 + components/libraries/timer/app_timer_rtx.c | 235 + components/libraries/trace/app_trace.c | 83 + components/libraries/trace/app_trace.h | 55 + components/libraries/twi/app_twi.c | 354 + components/libraries/twi/app_twi.h | 290 + components/libraries/uart/app_uart.c | 128 + components/libraries/uart/app_uart.h | 227 + components/libraries/uart/app_uart_fifo.c | 192 + components/libraries/uart/retarget.c | 81 + components/libraries/util/app_error.c | 87 + components/libraries/util/app_error.h | 84 + components/libraries/util/app_util.h | 315 + components/libraries/util/app_util_bds.h | 411 + components/libraries/util/app_util_platform.c | 30 + components/libraries/util/app_util_platform.h | 129 + components/libraries/util/common.h | 38 + components/libraries/util/nordic_common.h | 107 + components/libraries/util/nrf_assert.c | 22 + components/libraries/util/nrf_assert.h | 59 + components/libraries/util/nrf_log.c | 380 + components/libraries/util/nrf_log.h | 518 + components/libraries/util/sdk_common.h | 38 + components/libraries/util/sdk_errors.h | 115 + components/libraries/util/sdk_mapped_flags.c | 161 + components/libraries/util/sdk_mapped_flags.h | 153 + components/libraries/util/sdk_os.h | 40 + components/libraries/util/sdk_resources.h | 51 + components/properitary_rf/esb/arm/esb_arm.lib | Bin 0 -> 80618 bytes .../esb/arm/esb_sd_resources_arm.lib | Bin 0 -> 81270 bytes components/properitary_rf/esb/gcc/esb_gcc.a | Bin 0 -> 50420 bytes .../esb/gcc/esb_sd_resources_gcc.a | Bin 0 -> 50420 bytes components/properitary_rf/esb/iar/esb_iar.a | Bin 0 -> 128574 bytes .../esb/iar/esb_sd_resource_iar.a | Bin 0 -> 129064 bytes components/properitary_rf/esb/nrf_esb.h | 714 + .../properitary_rf/esb/nrf_esb_constants.h | 141 + .../properitary_rf/esb/nrf_esb_resources.h | 30 + .../properitary_rf/gzll/arm/gzll_arm.lib | Bin 0 -> 145794 bytes .../gzll/arm/gzll_sd_resources_arm.lib | Bin 0 -> 146558 bytes .../gzll/config/nrf_gzp_config.h | 124 + components/properitary_rf/gzll/gcc/gzll_gcc.a | Bin 0 -> 53732 bytes .../gzll/gcc/gzll_sd_resources_gcc.a | Bin 0 -> 53732 bytes components/properitary_rf/gzll/iar/gzll_iar.a | Bin 0 -> 134116 bytes .../gzll/iar/gzll_sd_resource_iar.a | Bin 0 -> 134678 bytes components/properitary_rf/gzll/nrf_gzll.h | 896 ++ .../properitary_rf/gzll/nrf_gzll_constants.h | 165 + .../properitary_rf/gzll/nrf_gzll_resources.h | 30 + components/properitary_rf/gzll/nrf_gzp.c | 338 + components/properitary_rf/gzll/nrf_gzp.h | 630 + .../properitary_rf/gzll/nrf_gzp_device.c | 1118 ++ components/properitary_rf/gzll/nrf_gzp_host.c | 767 + .../properitary_rf/gzll/nrf_gzp_host_nrf51.c | 49 + .../application/codecs/common/ble_dtm_app.c | 73 + .../application/codecs/common/ble_dtm_app.h | 84 + .../application/codecs/common/ble_dtm_init.c | 56 + .../codecs/common/conn_systemreset.c | 42 + .../codecs/common/conn_systemreset.h | 43 + .../codecs/s110/middleware/app_mw_ble.c | 501 + .../codecs/s110/middleware/app_mw_ble_gap.c | 1286 ++ .../codecs/s110/middleware/app_mw_ble_gattc.c | 426 + .../codecs/s110/middleware/app_mw_ble_gatts.c | 571 + .../codecs/s110/middleware/app_mw_ble_l2cap.c | 165 + .../codecs/s110/middleware/app_mw_nrf_soc.c | 100 + .../s110/serializers/app_ble_gap_sec_keys.c | 74 + .../s110/serializers/app_ble_gap_sec_keys.h | 79 + .../s110/serializers/app_ble_user_mem.c | 74 + .../s110/serializers/app_ble_user_mem.h | 81 + .../codecs/s110/serializers/ble_app.h | 445 + .../codecs/s110/serializers/ble_enable.c | 50 + .../codecs/s110/serializers/ble_event.c | 238 + .../codecs/s110/serializers/ble_evt_app.h | 110 + .../s110/serializers/ble_evt_tx_complete.c | 49 + .../serializers/ble_evt_user_mem_release.c | 78 + .../serializers/ble_evt_user_mem_request.c | 52 + .../s110/serializers/ble_gap_address_get.c | 75 + .../s110/serializers/ble_gap_address_set.c | 56 + .../s110/serializers/ble_gap_adv_data_set.c | 52 + .../s110/serializers/ble_gap_adv_start.c | 72 + .../s110/serializers/ble_gap_adv_stop.c | 40 + .../codecs/s110/serializers/ble_gap_app.h | 1158 ++ .../s110/serializers/ble_gap_appearance_get.c | 70 + .../s110/serializers/ble_gap_appearance_set.c | 44 + .../s110/serializers/ble_gap_auth_key_reply.c | 76 + .../s110/serializers/ble_gap_authenticate.c | 52 + .../serializers/ble_gap_conn_param_update.c | 55 + .../s110/serializers/ble_gap_conn_sec_get.c | 74 + .../codecs/s110/serializers/ble_gap_connect.c | 54 + .../s110/serializers/ble_gap_connect_cancel.c | 42 + .../serializers/ble_gap_device_name_get.c | 84 + .../serializers/ble_gap_device_name_set.c | 66 + .../s110/serializers/ble_gap_disconnect.c | 45 + .../codecs/s110/serializers/ble_gap_encrypt.c | 68 + .../s110/serializers/ble_gap_evt_adv_report.c | 72 + .../codecs/s110/serializers/ble_gap_evt_app.h | 411 + .../ble_gap_evt_auth_key_request.c | 53 + .../serializers/ble_gap_evt_auth_status.c | 69 + .../ble_gap_evt_conn_param_update.c | 59 + .../ble_gap_evt_conn_param_update_request.c | 59 + .../serializers/ble_gap_evt_conn_sec_update.c | 57 + .../s110/serializers/ble_gap_evt_connected.c | 53 + .../serializers/ble_gap_evt_disconnected.c | 48 + .../serializers/ble_gap_evt_passkey_display.c | 57 + .../serializers/ble_gap_evt_rssi_changed.c | 53 + .../serializers/ble_gap_evt_scan_req_report.c | 58 + .../ble_gap_evt_sec_info_request.c | 55 + .../ble_gap_evt_sec_params_request.c | 56 + .../serializers/ble_gap_evt_sec_request.c | 59 + .../s110/serializers/ble_gap_evt_timeout.c | 52 + .../s110/serializers/ble_gap_ppcp_get.c | 68 + .../s110/serializers/ble_gap_ppcp_set.c | 54 + .../s110/serializers/ble_gap_rssi_get.c | 80 + .../s110/serializers/ble_gap_rssi_start.c | 53 + .../s110/serializers/ble_gap_rssi_stop.c | 45 + .../s110/serializers/ble_gap_scan_start.c | 45 + .../s110/serializers/ble_gap_scan_stop.c | 40 + .../s110/serializers/ble_gap_sec_info_reply.c | 78 + .../serializers/ble_gap_sec_params_reply.c | 87 + .../s110/serializers/ble_gap_tx_power_set.c | 45 + .../codecs/s110/serializers/ble_gattc_app.h | 406 + .../ble_gattc_char_value_by_uuid_read.c | 61 + .../serializers/ble_gattc_char_values_read.c | 48 + .../ble_gattc_characteristics_discover.c | 57 + .../ble_gattc_descriptors_discover.c | 53 + .../s110/serializers/ble_gattc_evt_app.h | 286 + .../serializers/ble_gattc_evt_char_disc_rsp.c | 103 + .../ble_gattc_evt_char_val_by_uuid_read_rsp.c | 78 + .../ble_gattc_evt_char_vals_read_rsp.c | 66 + .../serializers/ble_gattc_evt_desc_disc_rsp.c | 95 + .../s110/serializers/ble_gattc_evt_hvx.c | 66 + .../ble_gattc_evt_prim_srvc_disc_rsp.c | 78 + .../s110/serializers/ble_gattc_evt_read_rsp.c | 66 + .../serializers/ble_gattc_evt_rel_disc_rsp.c | 65 + .../s110/serializers/ble_gattc_evt_timeout.c | 75 + .../serializers/ble_gattc_evt_write_rsp.c | 66 + .../s110/serializers/ble_gattc_hv_confirm.c | 49 + .../ble_gattc_primary_services_discover.c | 59 + .../codecs/s110/serializers/ble_gattc_read.c | 47 + .../ble_gattc_relationships_discover.c | 57 + .../codecs/s110/serializers/ble_gattc_write.c | 68 + .../codecs/s110/serializers/ble_gatts_app.h | 554 + .../ble_gatts_characteristic_add.c | 89 + .../serializers/ble_gatts_descriptor_add.c | 91 + .../s110/serializers/ble_gatts_evt_app.h | 186 + .../s110/serializers/ble_gatts_evt_hvc.c | 51 + .../ble_gatts_evt_rw_authorize_request.c | 78 + .../serializers/ble_gatts_evt_sc_confirm.c | 49 + .../ble_gatts_evt_sys_attr_missing.c | 51 + .../s110/serializers/ble_gatts_evt_timeout.c | 50 + .../s110/serializers/ble_gatts_evt_write.c | 78 + .../codecs/s110/serializers/ble_gatts_hvx.c | 115 + .../s110/serializers/ble_gatts_include_add.c | 74 + .../ble_gatts_rw_authorize_reply.c | 57 + .../s110/serializers/ble_gatts_service_add.c | 83 + .../serializers/ble_gatts_service_changed.c | 55 + .../s110/serializers/ble_gatts_sys_attr_get.c | 113 + .../s110/serializers/ble_gatts_sys_attr_set.c | 65 + .../s110/serializers/ble_gatts_value_get.c | 126 + .../s110/serializers/ble_gatts_value_set.c | 84 + .../codecs/s110/serializers/ble_l2cap_app.h | 163 + .../s110/serializers/ble_l2cap_cid_register.c | 45 + .../serializers/ble_l2cap_cid_unregister.c | 45 + .../s110/serializers/ble_l2cap_evt_app.h | 61 + .../s110/serializers/ble_l2cap_evt_rx.c | 56 + .../codecs/s110/serializers/ble_l2cap_tx.c | 61 + .../codecs/s110/serializers/ble_opt_get.c | 126 + .../codecs/s110/serializers/ble_opt_set.c | 117 + .../serializers/ble_tx_buffer_count_get.c | 68 + .../s110/serializers/ble_user_mem_reply.c | 66 + .../codecs/s110/serializers/ble_uuid_decode.c | 84 + .../codecs/s110/serializers/ble_uuid_encode.c | 93 + .../codecs/s110/serializers/ble_uuid_vs_add.c | 83 + .../codecs/s110/serializers/ble_version_get.c | 73 + .../codecs/s110/serializers/nrf_soc_app.h | 90 + .../s110/serializers/power_system_off.c | 32 + .../codecs/s110/serializers/temp_get.c | 71 + .../codecs/s120/middleware/app_mw_ble.c | 501 + .../codecs/s120/middleware/app_mw_ble_gap.c | 1285 ++ .../codecs/s120/middleware/app_mw_ble_gattc.c | 426 + .../codecs/s120/middleware/app_mw_ble_gatts.c | 571 + .../codecs/s120/middleware/app_mw_ble_l2cap.c | 165 + .../codecs/s120/middleware/app_mw_nrf_soc.c | 100 + .../s120/serializers/app_ble_gap_sec_keys.c | 73 + .../s120/serializers/app_ble_gap_sec_keys.h | 81 + .../s120/serializers/app_ble_user_mem.c | 74 + .../s120/serializers/app_ble_user_mem.h | 81 + .../codecs/s120/serializers/ble_app.h | 445 + .../codecs/s120/serializers/ble_enable.c | 50 + .../codecs/s120/serializers/ble_event.c | 241 + .../codecs/s120/serializers/ble_evt_app.h | 111 + .../s120/serializers/ble_evt_tx_complete.c | 49 + .../serializers/ble_evt_user_mem_release.c | 79 + .../serializers/ble_evt_user_mem_request.c | 53 + .../s120/serializers/ble_gap_address_get.c | 75 + .../s120/serializers/ble_gap_address_set.c | 60 + .../s120/serializers/ble_gap_adv_data_set.c | 52 + .../s120/serializers/ble_gap_adv_start.c | 72 + .../s120/serializers/ble_gap_adv_stop.c | 40 + .../codecs/s120/serializers/ble_gap_app.h | 1159 ++ .../s120/serializers/ble_gap_appearance_get.c | 70 + .../s120/serializers/ble_gap_appearance_set.c | 44 + .../s120/serializers/ble_gap_auth_key_reply.c | 76 + .../s120/serializers/ble_gap_authenticate.c | 52 + .../serializers/ble_gap_conn_param_update.c | 55 + .../s120/serializers/ble_gap_conn_sec_get.c | 74 + .../codecs/s120/serializers/ble_gap_connect.c | 54 + .../s120/serializers/ble_gap_connect_cancel.c | 42 + .../serializers/ble_gap_device_name_get.c | 84 + .../serializers/ble_gap_device_name_set.c | 66 + .../s120/serializers/ble_gap_disconnect.c | 45 + .../codecs/s120/serializers/ble_gap_encrypt.c | 68 + .../s120/serializers/ble_gap_evt_adv_report.c | 72 + .../codecs/s120/serializers/ble_gap_evt_app.h | 409 + .../ble_gap_evt_auth_key_request.c | 53 + .../serializers/ble_gap_evt_auth_status.c | 69 + .../ble_gap_evt_conn_param_update.c | 59 + .../ble_gap_evt_conn_param_update_request.c | 59 + .../serializers/ble_gap_evt_conn_sec_update.c | 57 + .../s120/serializers/ble_gap_evt_connected.c | 53 + .../serializers/ble_gap_evt_disconnected.c | 48 + .../serializers/ble_gap_evt_passkey_display.c | 57 + .../serializers/ble_gap_evt_rssi_changed.c | 53 + .../serializers/ble_gap_evt_scan_req_report.c | 58 + .../ble_gap_evt_sec_info_request.c | 55 + .../ble_gap_evt_sec_params_request.c | 55 + .../serializers/ble_gap_evt_sec_request.c | 59 + .../s120/serializers/ble_gap_evt_timeout.c | 52 + .../s120/serializers/ble_gap_ppcp_get.c | 68 + .../s120/serializers/ble_gap_ppcp_set.c | 54 + .../s120/serializers/ble_gap_rssi_get.c | 80 + .../s120/serializers/ble_gap_rssi_start.c | 53 + .../s120/serializers/ble_gap_rssi_stop.c | 45 + .../s120/serializers/ble_gap_scan_start.c | 45 + .../s120/serializers/ble_gap_scan_stop.c | 40 + .../s120/serializers/ble_gap_sec_info_reply.c | 78 + .../serializers/ble_gap_sec_params_reply.c | 87 + .../s120/serializers/ble_gap_tx_power_set.c | 45 + .../codecs/s120/serializers/ble_gattc_app.h | 406 + .../ble_gattc_char_value_by_uuid_read.c | 61 + .../serializers/ble_gattc_char_values_read.c | 48 + .../ble_gattc_characteristics_discover.c | 57 + .../ble_gattc_descriptors_discover.c | 53 + .../s120/serializers/ble_gattc_evt_app.h | 286 + .../serializers/ble_gattc_evt_char_disc_rsp.c | 103 + .../ble_gattc_evt_char_val_by_uuid_read_rsp.c | 78 + .../ble_gattc_evt_char_vals_read_rsp.c | 66 + .../serializers/ble_gattc_evt_desc_disc_rsp.c | 95 + .../s120/serializers/ble_gattc_evt_hvx.c | 66 + .../ble_gattc_evt_prim_srvc_disc_rsp.c | 78 + .../s120/serializers/ble_gattc_evt_read_rsp.c | 66 + .../serializers/ble_gattc_evt_rel_disc_rsp.c | 65 + .../s120/serializers/ble_gattc_evt_timeout.c | 75 + .../serializers/ble_gattc_evt_write_rsp.c | 66 + .../s120/serializers/ble_gattc_hv_confirm.c | 49 + .../ble_gattc_primary_services_discover.c | 59 + .../codecs/s120/serializers/ble_gattc_read.c | 47 + .../ble_gattc_relationships_discover.c | 57 + .../codecs/s120/serializers/ble_gattc_write.c | 68 + .../codecs/s120/serializers/ble_gatts_app.h | 554 + .../ble_gatts_characteristic_add.c | 89 + .../serializers/ble_gatts_descriptor_add.c | 91 + .../s120/serializers/ble_gatts_evt_app.h | 186 + .../s120/serializers/ble_gatts_evt_hvc.c | 51 + .../ble_gatts_evt_rw_authorize_request.c | 78 + .../serializers/ble_gatts_evt_sc_confirm.c | 49 + .../ble_gatts_evt_sys_attr_missing.c | 51 + .../s120/serializers/ble_gatts_evt_timeout.c | 50 + .../s120/serializers/ble_gatts_evt_write.c | 78 + .../codecs/s120/serializers/ble_gatts_hvx.c | 115 + .../s120/serializers/ble_gatts_include_add.c | 74 + .../ble_gatts_rw_authorize_reply.c | 57 + .../s120/serializers/ble_gatts_service_add.c | 83 + .../serializers/ble_gatts_service_changed.c | 55 + .../s120/serializers/ble_gatts_sys_attr_get.c | 113 + .../s120/serializers/ble_gatts_sys_attr_set.c | 65 + .../s120/serializers/ble_gatts_value_get.c | 126 + .../s120/serializers/ble_gatts_value_set.c | 84 + .../codecs/s120/serializers/ble_l2cap_app.h | 163 + .../s120/serializers/ble_l2cap_cid_register.c | 45 + .../serializers/ble_l2cap_cid_unregister.c | 45 + .../s120/serializers/ble_l2cap_evt_app.h | 61 + .../s120/serializers/ble_l2cap_evt_rx.c | 56 + .../codecs/s120/serializers/ble_l2cap_tx.c | 61 + .../codecs/s120/serializers/ble_opt_get.c | 126 + .../codecs/s120/serializers/ble_opt_set.c | 117 + .../serializers/ble_tx_buffer_count_get.c | 68 + .../s120/serializers/ble_user_mem_reply.c | 65 + .../codecs/s120/serializers/ble_uuid_decode.c | 84 + .../codecs/s120/serializers/ble_uuid_encode.c | 93 + .../codecs/s120/serializers/ble_uuid_vs_add.c | 83 + .../codecs/s120/serializers/ble_version_get.c | 73 + .../codecs/s120/serializers/nrf_soc_app.h | 90 + .../s120/serializers/power_system_off.c | 32 + .../codecs/s120/serializers/temp_get.c | 71 + .../codecs/s130/middleware/app_mw_ble.c | 501 + .../codecs/s130/middleware/app_mw_ble_gap.c | 1285 ++ .../codecs/s130/middleware/app_mw_ble_gattc.c | 426 + .../codecs/s130/middleware/app_mw_ble_gatts.c | 571 + .../codecs/s130/middleware/app_mw_ble_l2cap.c | 165 + .../codecs/s130/middleware/app_mw_nrf_soc.c | 100 + .../s130/serializers/app_ble_gap_sec_keys.c | 73 + .../s130/serializers/app_ble_gap_sec_keys.h | 81 + .../s130/serializers/app_ble_user_mem.c | 74 + .../s130/serializers/app_ble_user_mem.h | 81 + .../codecs/s130/serializers/ble_app.h | 445 + .../codecs/s130/serializers/ble_enable.c | 50 + .../codecs/s130/serializers/ble_event.c | 241 + .../codecs/s130/serializers/ble_evt_app.h | 111 + .../s130/serializers/ble_evt_tx_complete.c | 49 + .../serializers/ble_evt_user_mem_release.c | 79 + .../serializers/ble_evt_user_mem_request.c | 53 + .../s130/serializers/ble_gap_address_get.c | 75 + .../s130/serializers/ble_gap_address_set.c | 60 + .../s130/serializers/ble_gap_adv_data_set.c | 52 + .../s130/serializers/ble_gap_adv_start.c | 72 + .../s130/serializers/ble_gap_adv_stop.c | 40 + .../codecs/s130/serializers/ble_gap_app.h | 1159 ++ .../s130/serializers/ble_gap_appearance_get.c | 70 + .../s130/serializers/ble_gap_appearance_set.c | 44 + .../s130/serializers/ble_gap_auth_key_reply.c | 76 + .../s130/serializers/ble_gap_authenticate.c | 52 + .../serializers/ble_gap_conn_param_update.c | 55 + .../s130/serializers/ble_gap_conn_sec_get.c | 74 + .../codecs/s130/serializers/ble_gap_connect.c | 54 + .../s130/serializers/ble_gap_connect_cancel.c | 42 + .../serializers/ble_gap_device_name_get.c | 84 + .../serializers/ble_gap_device_name_set.c | 66 + .../s130/serializers/ble_gap_disconnect.c | 45 + .../codecs/s130/serializers/ble_gap_encrypt.c | 68 + .../s130/serializers/ble_gap_evt_adv_report.c | 72 + .../codecs/s130/serializers/ble_gap_evt_app.h | 409 + .../ble_gap_evt_auth_key_request.c | 53 + .../serializers/ble_gap_evt_auth_status.c | 69 + .../ble_gap_evt_conn_param_update.c | 59 + .../ble_gap_evt_conn_param_update_request.c | 59 + .../serializers/ble_gap_evt_conn_sec_update.c | 57 + .../s130/serializers/ble_gap_evt_connected.c | 53 + .../serializers/ble_gap_evt_disconnected.c | 48 + .../serializers/ble_gap_evt_passkey_display.c | 57 + .../serializers/ble_gap_evt_rssi_changed.c | 53 + .../serializers/ble_gap_evt_scan_req_report.c | 58 + .../ble_gap_evt_sec_info_request.c | 55 + .../ble_gap_evt_sec_params_request.c | 55 + .../serializers/ble_gap_evt_sec_request.c | 59 + .../s130/serializers/ble_gap_evt_timeout.c | 52 + .../s130/serializers/ble_gap_ppcp_get.c | 68 + .../s130/serializers/ble_gap_ppcp_set.c | 54 + .../s130/serializers/ble_gap_rssi_get.c | 80 + .../s130/serializers/ble_gap_rssi_start.c | 53 + .../s130/serializers/ble_gap_rssi_stop.c | 45 + .../s130/serializers/ble_gap_scan_start.c | 45 + .../s130/serializers/ble_gap_scan_stop.c | 40 + .../s130/serializers/ble_gap_sec_info_reply.c | 78 + .../serializers/ble_gap_sec_params_reply.c | 87 + .../s130/serializers/ble_gap_tx_power_set.c | 45 + .../codecs/s130/serializers/ble_gattc_app.h | 406 + .../ble_gattc_char_value_by_uuid_read.c | 61 + .../serializers/ble_gattc_char_values_read.c | 48 + .../ble_gattc_characteristics_discover.c | 57 + .../ble_gattc_descriptors_discover.c | 53 + .../s130/serializers/ble_gattc_evt_app.h | 286 + .../serializers/ble_gattc_evt_char_disc_rsp.c | 103 + .../ble_gattc_evt_char_val_by_uuid_read_rsp.c | 78 + .../ble_gattc_evt_char_vals_read_rsp.c | 66 + .../serializers/ble_gattc_evt_desc_disc_rsp.c | 95 + .../s130/serializers/ble_gattc_evt_hvx.c | 66 + .../ble_gattc_evt_prim_srvc_disc_rsp.c | 78 + .../s130/serializers/ble_gattc_evt_read_rsp.c | 66 + .../serializers/ble_gattc_evt_rel_disc_rsp.c | 65 + .../s130/serializers/ble_gattc_evt_timeout.c | 75 + .../serializers/ble_gattc_evt_write_rsp.c | 66 + .../s130/serializers/ble_gattc_hv_confirm.c | 49 + .../ble_gattc_primary_services_discover.c | 59 + .../codecs/s130/serializers/ble_gattc_read.c | 47 + .../ble_gattc_relationships_discover.c | 57 + .../codecs/s130/serializers/ble_gattc_write.c | 68 + .../codecs/s130/serializers/ble_gatts_app.h | 554 + .../ble_gatts_characteristic_add.c | 89 + .../serializers/ble_gatts_descriptor_add.c | 91 + .../s130/serializers/ble_gatts_evt_app.h | 186 + .../s130/serializers/ble_gatts_evt_hvc.c | 51 + .../ble_gatts_evt_rw_authorize_request.c | 78 + .../serializers/ble_gatts_evt_sc_confirm.c | 49 + .../ble_gatts_evt_sys_attr_missing.c | 51 + .../s130/serializers/ble_gatts_evt_timeout.c | 50 + .../s130/serializers/ble_gatts_evt_write.c | 78 + .../codecs/s130/serializers/ble_gatts_hvx.c | 115 + .../s130/serializers/ble_gatts_include_add.c | 74 + .../ble_gatts_rw_authorize_reply.c | 57 + .../s130/serializers/ble_gatts_service_add.c | 83 + .../serializers/ble_gatts_service_changed.c | 55 + .../s130/serializers/ble_gatts_sys_attr_get.c | 113 + .../s130/serializers/ble_gatts_sys_attr_set.c | 65 + .../s130/serializers/ble_gatts_value_get.c | 126 + .../s130/serializers/ble_gatts_value_set.c | 84 + .../codecs/s130/serializers/ble_l2cap_app.h | 163 + .../s130/serializers/ble_l2cap_cid_register.c | 45 + .../serializers/ble_l2cap_cid_unregister.c | 45 + .../s130/serializers/ble_l2cap_evt_app.h | 61 + .../s130/serializers/ble_l2cap_evt_rx.c | 56 + .../codecs/s130/serializers/ble_l2cap_tx.c | 61 + .../codecs/s130/serializers/ble_opt_get.c | 126 + .../codecs/s130/serializers/ble_opt_set.c | 117 + .../serializers/ble_tx_buffer_count_get.c | 68 + .../s130/serializers/ble_user_mem_reply.c | 65 + .../codecs/s130/serializers/ble_uuid_decode.c | 84 + .../codecs/s130/serializers/ble_uuid_encode.c | 93 + .../codecs/s130/serializers/ble_uuid_vs_add.c | 83 + .../codecs/s130/serializers/ble_version_get.c | 73 + .../codecs/s130/serializers/nrf_soc_app.h | 90 + .../s130/serializers/power_system_off.c | 32 + .../codecs/s130/serializers/temp_get.c | 71 + .../application/hal/arm_startup_nrf51.s | 240 + .../application/hal/ser_app_hal.h | 76 + .../application/hal/ser_app_hal_nrf51.c | 91 + .../hal/ser_app_power_system_off.c | 35 + .../hal/ser_app_power_system_off.h | 24 + .../application/transport/ser_sd_transport.c | 259 + .../application/transport/ser_sd_transport.h | 153 + .../transport/ser_softdevice_handler.c | 176 + .../transport/ser_softdevice_handler.h | 44 + .../serialization/common/ble_serialization.c | 520 + .../serialization/common/ble_serialization.h | 582 + .../common/cond_field_serialization.c | 62 + .../common/cond_field_serialization.h | 64 + components/serialization/common/ser_config.h | 122 + .../s110/ble_gap_struct_serialization.c | 1365 ++ .../s110/ble_gap_struct_serialization.h | 352 + .../s110/ble_gattc_struct_serialization.c | 363 + .../s110/ble_gattc_struct_serialization.h | 88 + .../s110/ble_gatts_struct_serialization.c | 926 ++ .../s110/ble_gatts_struct_serialization.h | 160 + .../s110/ble_struct_serialization.c | 271 + .../s110/ble_struct_serialization.h | 75 + .../s120/ble_gap_struct_serialization.c | 1354 ++ .../s120/ble_gap_struct_serialization.h | 353 + .../s120/ble_gattc_struct_serialization.c | 363 + .../s120/ble_gattc_struct_serialization.h | 88 + .../s120/ble_gatts_struct_serialization.c | 959 ++ .../s120/ble_gatts_struct_serialization.h | 170 + .../s120/ble_struct_serialization.c | 276 + .../s120/ble_struct_serialization.h | 75 + .../s130/ble_gap_struct_serialization.c | 1363 ++ .../s130/ble_gap_struct_serialization.h | 353 + .../s130/ble_gattc_struct_serialization.c | 363 + .../s130/ble_gattc_struct_serialization.h | 88 + .../s130/ble_gatts_struct_serialization.c | 965 ++ .../s130/ble_gatts_struct_serialization.h | 170 + .../s130/ble_struct_serialization.c | 270 + .../s130/ble_struct_serialization.h | 75 + .../debug/debug_hci_config_nrf6310.h | 44 + .../transport/debug/debug_hci_nrf6310.c | 228 + .../common/transport/dtm_uart_params.h | 57 + .../common/transport/ser_hal_transport.c | 460 + .../common/transport/ser_hal_transport.h | 231 + .../ser_phy/config/ser_config_5W_app.h | 16 + .../ser_phy/config/ser_phy_config_app_nrf51.h | 70 + .../config/ser_phy_config_conn_nrf51.h | 42 + .../ser_phy/config/ser_phy_debug_app.h | 162 + .../ser_phy/config/ser_phy_debug_conn.h | 130 + .../common/transport/ser_phy/ser_phy.c | 61 + .../common/transport/ser_phy/ser_phy.h | 256 + .../common/transport/ser_phy/ser_phy_hci.c | 1667 +++ .../common/transport/ser_phy/ser_phy_hci.h | 147 + .../transport/ser_phy/ser_phy_hci_slip.c | 634 + .../common/transport/ser_phy/ser_phy_nohci.c | 356 + .../ser_phy/ser_phy_nrf51_nrf_drv_spi.c | 774 + .../ser_phy/ser_phy_nrf51_spi_5W_master.c | 803 + .../ser_phy/ser_phy_nrf51_spi_5W_slave.c | 618 + .../ser_phy/ser_phy_nrf51_spi_slave.c | 580 + .../transport/ser_phy/ser_phy_nrf51_uart.c | 440 + .../ser_phy/ser_phy_nrf51_uart_stm_app.c | 754 + .../ser_phy/ser_phy_nrf51_uart_stm_conn.c | 784 + .../common/transport/ser_phy/spi_5W_master.c | 603 + .../common/transport/ser_phy/spi_5W_master.h | 170 + .../common/transport/ser_phy_debug_comm.h | 167 + .../connectivity/codecs/common/ble_dtm_conn.h | 77 + .../connectivity/codecs/common/ble_dtm_init.c | 56 + .../connectivity/codecs/common/conn_mw.c | 84 + .../connectivity/codecs/common/conn_mw.h | 38 + .../codecs/s110/middleware/conn_mw_ble.c | 287 + .../codecs/s110/middleware/conn_mw_ble.h | 178 + .../codecs/s110/middleware/conn_mw_ble_gap.c | 831 ++ .../codecs/s110/middleware/conn_mw_ble_gap.h | 504 + .../s110/middleware/conn_mw_ble_gattc.c | 293 + .../s110/middleware/conn_mw_ble_gattc.h | 180 + .../s110/middleware/conn_mw_ble_gatts.c | 407 + .../s110/middleware/conn_mw_ble_gatts.h | 216 + .../s110/middleware/conn_mw_ble_l2cap.c | 91 + .../s110/middleware/conn_mw_ble_l2cap.h | 72 + .../codecs/s110/middleware/conn_mw_items.c | 76 + .../codecs/s110/middleware/conn_mw_nrf_soc.c | 60 + .../codecs/s110/middleware/conn_mw_nrf_soc.h | 55 + .../codecs/s110/serializers/ble_conn.h | 447 + .../codecs/s110/serializers/ble_enable.c | 46 + .../codecs/s110/serializers/ble_event.c | 186 + .../codecs/s110/serializers/ble_evt_conn.h | 96 + .../s110/serializers/ble_evt_tx_complete.c | 38 + .../serializers/ble_evt_user_mem_release.c | 56 + .../serializers/ble_evt_user_mem_request.c | 46 + .../s110/serializers/ble_gap_address_get.c | 79 + .../s110/serializers/ble_gap_address_set.c | 49 + .../s110/serializers/ble_gap_adv_data_set.c | 49 + .../s110/serializers/ble_gap_adv_start.c | 88 + .../s110/serializers/ble_gap_adv_stop.c | 23 + .../s110/serializers/ble_gap_appearance_get.c | 76 + .../s110/serializers/ble_gap_appearance_set.c | 42 + .../s110/serializers/ble_gap_auth_key_reply.c | 68 + .../s110/serializers/ble_gap_authenticate.c | 57 + .../codecs/s110/serializers/ble_gap_conn.h | 1044 ++ .../serializers/ble_gap_conn_param_update.c | 71 + .../s110/serializers/ble_gap_conn_sec_get.c | 75 + .../codecs/s110/serializers/ble_gap_connect.c | 55 + .../s110/serializers/ble_gap_connect_cancel.c | 25 + .../serializers/ble_gap_device_name_get.c | 92 + .../serializers/ble_gap_device_name_set.c | 61 + .../s110/serializers/ble_gap_disconnect.c | 52 + .../codecs/s110/serializers/ble_gap_encrypt.c | 60 + .../s110/serializers/ble_gap_evt_adv_report.c | 61 + .../ble_gap_evt_auth_key_request.c | 49 + .../serializers/ble_gap_evt_auth_status.c | 62 + .../s110/serializers/ble_gap_evt_conn.h | 336 + .../ble_gap_evt_conn_param_update.c | 49 + .../ble_gap_evt_conn_param_update_request.c | 49 + .../serializers/ble_gap_evt_conn_sec_update.c | 51 + .../s110/serializers/ble_gap_evt_connected.c | 49 + .../serializers/ble_gap_evt_disconnected.c | 49 + .../serializers/ble_gap_evt_passkey_display.c | 43 + .../serializers/ble_gap_evt_rssi_changed.c | 38 + .../serializers/ble_gap_evt_scan_req_report.c | 49 + .../ble_gap_evt_sec_info_request.c | 51 + .../ble_gap_evt_sec_params_request.c | 51 + .../serializers/ble_gap_evt_sec_request.c | 49 + .../s110/serializers/ble_gap_evt_timeout.c | 38 + .../s110/serializers/ble_gap_ppcp_get.c | 80 + .../s110/serializers/ble_gap_ppcp_set.c | 64 + .../s110/serializers/ble_gap_rssi_get.c | 77 + .../s110/serializers/ble_gap_rssi_start.c | 49 + .../s110/serializers/ble_gap_rssi_stop.c | 39 + .../s110/serializers/ble_gap_scan_start.c | 44 + .../s110/serializers/ble_gap_scan_stop.c | 23 + .../s110/serializers/ble_gap_sec_info_reply.c | 72 + .../serializers/ble_gap_sec_params_reply.c | 90 + .../s110/serializers/ble_gap_tx_power_set.c | 39 + .../ble_gattc_char_value_by_uuid_read.c | 65 + .../serializers/ble_gattc_char_values_read.c | 53 + .../ble_gattc_characteristics_discover.c | 63 + .../codecs/s110/serializers/ble_gattc_conn.h | 398 + .../ble_gattc_descriptors_discover.c | 62 + .../serializers/ble_gattc_evt_char_disc_rsp.c | 73 + .../ble_gattc_evt_char_val_by_uuid_read_rsp.c | 52 + .../ble_gattc_evt_char_vals_read_rsp.c | 59 + .../s110/serializers/ble_gattc_evt_conn.h | 236 + .../serializers/ble_gattc_evt_desc_disc_rsp.c | 53 + .../s110/serializers/ble_gattc_evt_hvx.c | 52 + .../ble_gattc_evt_prim_srvc_disc_rsp.c | 62 + .../s110/serializers/ble_gattc_evt_read_rsp.c | 52 + .../serializers/ble_gattc_evt_rel_disc_rsp.c | 51 + .../s110/serializers/ble_gattc_evt_timeout.c | 37 + .../serializers/ble_gattc_evt_write_rsp.c | 53 + .../s110/serializers/ble_gattc_hv_confirm.c | 45 + .../ble_gattc_primary_services_discover.c | 67 + .../codecs/s110/serializers/ble_gattc_read.c | 49 + .../ble_gattc_relationships_discover.c | 64 + .../codecs/s110/serializers/ble_gattc_write.c | 59 + .../ble_gatts_characteristic_add.c | 88 + .../codecs/s110/serializers/ble_gatts_conn.h | 514 + .../serializers/ble_gatts_descriptor_add.c | 94 + .../s110/serializers/ble_gatts_evt_conn.h | 156 + .../s110/serializers/ble_gatts_evt_hvc.c | 38 + .../ble_gatts_evt_rw_authorize_request.c | 59 + .../serializers/ble_gatts_evt_sc_confirm.c | 37 + .../ble_gatts_evt_sys_attr_missing.c | 37 + .../s110/serializers/ble_gatts_evt_timeout.c | 37 + .../s110/serializers/ble_gatts_evt_write.c | 63 + .../codecs/s110/serializers/ble_gatts_hvx.c | 81 + .../s110/serializers/ble_gatts_include_add.c | 74 + .../ble_gatts_rw_authorize_reply.c | 53 + .../s110/serializers/ble_gatts_service_add.c | 76 + .../serializers/ble_gatts_service_changed.c | 55 + .../s110/serializers/ble_gatts_sys_attr_get.c | 125 + .../s110/serializers/ble_gatts_sys_attr_set.c | 76 + .../s110/serializers/ble_gatts_value_get.c | 105 + .../s110/serializers/ble_gatts_value_set.c | 74 + .../s110/serializers/ble_l2cap_cid_register.c | 46 + .../serializers/ble_l2cap_cid_unregister.c | 46 + .../codecs/s110/serializers/ble_l2cap_conn.h | 156 + .../s110/serializers/ble_l2cap_evt_conn.h | 56 + .../s110/serializers/ble_l2cap_evt_rx.c | 50 + .../codecs/s110/serializers/ble_l2cap_tx.c | 67 + .../codecs/s110/serializers/ble_opt_get.c | 130 + .../s110/serializers/ble_opt_id_pre_decoder.c | 36 + .../codecs/s110/serializers/ble_opt_set.c | 114 + .../serializers/ble_tx_buffer_count_get.c | 65 + .../s110/serializers/ble_user_mem_reply.c | 66 + .../codecs/s110/serializers/ble_uuid_decode.c | 77 + .../codecs/s110/serializers/ble_uuid_encode.c | 117 + .../codecs/s110/serializers/ble_uuid_vs_add.c | 73 + .../codecs/s110/serializers/ble_version_get.c | 77 + .../s110/serializers/conn_ble_gap_sec_keys.c | 74 + .../s110/serializers/conn_ble_gap_sec_keys.h | 84 + .../s110/serializers/conn_ble_user_mem.c | 78 + .../s110/serializers/conn_ble_user_mem.h | 81 + .../codecs/s110/serializers/nrf_soc_conn.h | 89 + .../s110/serializers/power_system_off.c | 28 + .../codecs/s110/serializers/temp_get.c | 71 + .../codecs/s120/middleware/conn_mw.h | 38 + .../codecs/s120/middleware/conn_mw_ble.c | 287 + .../codecs/s120/middleware/conn_mw_ble.h | 179 + .../codecs/s120/middleware/conn_mw_ble_gap.c | 830 ++ .../codecs/s120/middleware/conn_mw_ble_gap.h | 532 + .../s120/middleware/conn_mw_ble_gattc.c | 293 + .../s120/middleware/conn_mw_ble_gattc.h | 180 + .../s120/middleware/conn_mw_ble_gatts.c | 407 + .../s120/middleware/conn_mw_ble_gatts.h | 216 + .../s120/middleware/conn_mw_ble_l2cap.c | 91 + .../s120/middleware/conn_mw_ble_l2cap.h | 72 + .../codecs/s120/middleware/conn_mw_items.c | 77 + .../codecs/s120/middleware/conn_mw_nrf_soc.c | 60 + .../codecs/s120/middleware/conn_mw_nrf_soc.h | 55 + .../codecs/s120/serializers/ble_conn.h | 447 + .../codecs/s120/serializers/ble_enable.c | 46 + .../codecs/s120/serializers/ble_event.c | 184 + .../codecs/s120/serializers/ble_evt_conn.h | 95 + .../s120/serializers/ble_evt_tx_complete.c | 38 + .../serializers/ble_evt_user_mem_release.c | 55 + .../serializers/ble_evt_user_mem_request.c | 46 + .../s120/serializers/ble_gap_address_get.c | 79 + .../s120/serializers/ble_gap_address_set.c | 52 + .../s120/serializers/ble_gap_adv_data_set.c | 49 + .../s120/serializers/ble_gap_adv_start.c | 88 + .../s120/serializers/ble_gap_adv_stop.c | 23 + .../s120/serializers/ble_gap_appearance_get.c | 76 + .../s120/serializers/ble_gap_appearance_set.c | 42 + .../s120/serializers/ble_gap_auth_key_reply.c | 68 + .../s120/serializers/ble_gap_authenticate.c | 57 + .../codecs/s120/serializers/ble_gap_conn.h | 1043 ++ .../serializers/ble_gap_conn_param_update.c | 71 + .../s120/serializers/ble_gap_conn_sec_get.c | 75 + .../codecs/s120/serializers/ble_gap_connect.c | 55 + .../s120/serializers/ble_gap_connect_cancel.c | 25 + .../serializers/ble_gap_device_name_get.c | 92 + .../serializers/ble_gap_device_name_set.c | 61 + .../s120/serializers/ble_gap_disconnect.c | 52 + .../codecs/s120/serializers/ble_gap_encrypt.c | 60 + .../s120/serializers/ble_gap_evt_adv_report.c | 61 + .../ble_gap_evt_auth_key_request.c | 49 + .../serializers/ble_gap_evt_auth_status.c | 62 + .../s120/serializers/ble_gap_evt_conn.h | 336 + .../ble_gap_evt_conn_param_update.c | 49 + .../ble_gap_evt_conn_param_update_request.c | 49 + .../serializers/ble_gap_evt_conn_sec_update.c | 51 + .../s120/serializers/ble_gap_evt_connected.c | 49 + .../serializers/ble_gap_evt_disconnected.c | 49 + .../serializers/ble_gap_evt_passkey_display.c | 43 + .../serializers/ble_gap_evt_rssi_changed.c | 38 + .../serializers/ble_gap_evt_scan_req_report.c | 49 + .../ble_gap_evt_sec_info_request.c | 51 + .../ble_gap_evt_sec_params_request.c | 51 + .../serializers/ble_gap_evt_sec_request.c | 49 + .../s120/serializers/ble_gap_evt_timeout.c | 38 + .../s120/serializers/ble_gap_ppcp_get.c | 80 + .../s120/serializers/ble_gap_ppcp_set.c | 64 + .../s120/serializers/ble_gap_rssi_get.c | 77 + .../s120/serializers/ble_gap_rssi_start.c | 49 + .../s120/serializers/ble_gap_rssi_stop.c | 39 + .../s120/serializers/ble_gap_scan_start.c | 44 + .../s120/serializers/ble_gap_scan_stop.c | 23 + .../s120/serializers/ble_gap_sec_info_reply.c | 72 + .../serializers/ble_gap_sec_params_reply.c | 90 + .../s120/serializers/ble_gap_tx_power_set.c | 39 + .../ble_gattc_char_value_by_uuid_read.c | 65 + .../serializers/ble_gattc_char_values_read.c | 53 + .../ble_gattc_characteristics_discover.c | 63 + .../codecs/s120/serializers/ble_gattc_conn.h | 398 + .../ble_gattc_descriptors_discover.c | 62 + .../serializers/ble_gattc_evt_char_disc_rsp.c | 73 + .../ble_gattc_evt_char_val_by_uuid_read_rsp.c | 52 + .../ble_gattc_evt_char_vals_read_rsp.c | 59 + .../s120/serializers/ble_gattc_evt_conn.h | 236 + .../serializers/ble_gattc_evt_desc_disc_rsp.c | 53 + .../s120/serializers/ble_gattc_evt_hvx.c | 52 + .../ble_gattc_evt_prim_srvc_disc_rsp.c | 62 + .../s120/serializers/ble_gattc_evt_read_rsp.c | 52 + .../serializers/ble_gattc_evt_rel_disc_rsp.c | 51 + .../s120/serializers/ble_gattc_evt_timeout.c | 37 + .../serializers/ble_gattc_evt_write_rsp.c | 53 + .../s120/serializers/ble_gattc_hv_confirm.c | 45 + .../ble_gattc_primary_services_discover.c | 67 + .../codecs/s120/serializers/ble_gattc_read.c | 49 + .../ble_gattc_relationships_discover.c | 64 + .../codecs/s120/serializers/ble_gattc_write.c | 59 + .../ble_gatts_characteristic_add.c | 88 + .../codecs/s120/serializers/ble_gatts_conn.h | 514 + .../serializers/ble_gatts_descriptor_add.c | 94 + .../s120/serializers/ble_gatts_evt_conn.h | 156 + .../s120/serializers/ble_gatts_evt_hvc.c | 38 + .../ble_gatts_evt_rw_authorize_request.c | 59 + .../serializers/ble_gatts_evt_sc_confirm.c | 37 + .../ble_gatts_evt_sys_attr_missing.c | 37 + .../s120/serializers/ble_gatts_evt_timeout.c | 37 + .../s120/serializers/ble_gatts_evt_write.c | 63 + .../codecs/s120/serializers/ble_gatts_hvx.c | 81 + .../s120/serializers/ble_gatts_include_add.c | 74 + .../ble_gatts_rw_authorize_reply.c | 53 + .../s120/serializers/ble_gatts_service_add.c | 76 + .../serializers/ble_gatts_service_changed.c | 55 + .../s120/serializers/ble_gatts_sys_attr_get.c | 125 + .../s120/serializers/ble_gatts_sys_attr_set.c | 76 + .../s120/serializers/ble_gatts_value_get.c | 105 + .../s120/serializers/ble_gatts_value_set.c | 74 + .../s120/serializers/ble_l2cap_cid_register.c | 46 + .../serializers/ble_l2cap_cid_unregister.c | 46 + .../codecs/s120/serializers/ble_l2cap_conn.h | 156 + .../s120/serializers/ble_l2cap_evt_conn.h | 56 + .../s120/serializers/ble_l2cap_evt_rx.c | 50 + .../codecs/s120/serializers/ble_l2cap_tx.c | 67 + .../codecs/s120/serializers/ble_opt_get.c | 130 + .../s120/serializers/ble_opt_id_pre_decoder.c | 36 + .../codecs/s120/serializers/ble_opt_set.c | 114 + .../serializers/ble_tx_buffer_count_get.c | 65 + .../s120/serializers/ble_user_mem_reply.c | 66 + .../codecs/s120/serializers/ble_uuid_decode.c | 77 + .../codecs/s120/serializers/ble_uuid_encode.c | 117 + .../codecs/s120/serializers/ble_uuid_vs_add.c | 73 + .../codecs/s120/serializers/ble_version_get.c | 77 + .../s120/serializers/conn_ble_gap_sec_keys.c | 73 + .../s120/serializers/conn_ble_gap_sec_keys.h | 86 + .../s120/serializers/conn_ble_user_mem.c | 78 + .../s120/serializers/conn_ble_user_mem.h | 81 + .../codecs/s120/serializers/nrf_soc_conn.h | 89 + .../s120/serializers/power_system_off.c | 28 + .../codecs/s120/serializers/temp_get.c | 71 + .../codecs/s130/middleware/conn_mw.h | 38 + .../codecs/s130/middleware/conn_mw_ble.c | 287 + .../codecs/s130/middleware/conn_mw_ble.h | 179 + .../codecs/s130/middleware/conn_mw_ble_gap.c | 854 ++ .../codecs/s130/middleware/conn_mw_ble_gap.h | 532 + .../s130/middleware/conn_mw_ble_gattc.c | 293 + .../s130/middleware/conn_mw_ble_gattc.h | 180 + .../s130/middleware/conn_mw_ble_gatts.c | 407 + .../s130/middleware/conn_mw_ble_gatts.h | 216 + .../s130/middleware/conn_mw_ble_l2cap.c | 91 + .../s130/middleware/conn_mw_ble_l2cap.h | 72 + .../codecs/s130/middleware/conn_mw_items.c | 76 + .../codecs/s130/middleware/conn_mw_nrf_soc.c | 60 + .../codecs/s130/middleware/conn_mw_nrf_soc.h | 55 + .../codecs/s130/serializers/ble_conn.h | 447 + .../codecs/s130/serializers/ble_enable.c | 46 + .../codecs/s130/serializers/ble_event.c | 184 + .../codecs/s130/serializers/ble_evt_conn.h | 95 + .../s130/serializers/ble_evt_tx_complete.c | 38 + .../serializers/ble_evt_user_mem_release.c | 55 + .../serializers/ble_evt_user_mem_request.c | 46 + .../s130/serializers/ble_gap_address_get.c | 79 + .../s130/serializers/ble_gap_address_set.c | 52 + .../s130/serializers/ble_gap_adv_data_set.c | 49 + .../s130/serializers/ble_gap_adv_start.c | 88 + .../s130/serializers/ble_gap_adv_stop.c | 23 + .../s130/serializers/ble_gap_appearance_get.c | 76 + .../s130/serializers/ble_gap_appearance_set.c | 42 + .../s130/serializers/ble_gap_auth_key_reply.c | 68 + .../s130/serializers/ble_gap_authenticate.c | 57 + .../codecs/s130/serializers/ble_gap_conn.h | 1043 ++ .../serializers/ble_gap_conn_param_update.c | 71 + .../s130/serializers/ble_gap_conn_sec_get.c | 75 + .../codecs/s130/serializers/ble_gap_connect.c | 55 + .../s130/serializers/ble_gap_connect_cancel.c | 25 + .../serializers/ble_gap_device_name_get.c | 92 + .../serializers/ble_gap_device_name_set.c | 61 + .../s130/serializers/ble_gap_disconnect.c | 52 + .../codecs/s130/serializers/ble_gap_encrypt.c | 60 + .../s130/serializers/ble_gap_evt_adv_report.c | 61 + .../ble_gap_evt_auth_key_request.c | 49 + .../serializers/ble_gap_evt_auth_status.c | 62 + .../s130/serializers/ble_gap_evt_conn.h | 336 + .../ble_gap_evt_conn_param_update.c | 49 + .../ble_gap_evt_conn_param_update_request.c | 49 + .../serializers/ble_gap_evt_conn_sec_update.c | 51 + .../s130/serializers/ble_gap_evt_connected.c | 49 + .../serializers/ble_gap_evt_disconnected.c | 49 + .../serializers/ble_gap_evt_passkey_display.c | 43 + .../serializers/ble_gap_evt_rssi_changed.c | 38 + .../serializers/ble_gap_evt_scan_req_report.c | 49 + .../ble_gap_evt_sec_info_request.c | 51 + .../ble_gap_evt_sec_params_request.c | 51 + .../serializers/ble_gap_evt_sec_request.c | 49 + .../s130/serializers/ble_gap_evt_timeout.c | 38 + .../s130/serializers/ble_gap_ppcp_get.c | 80 + .../s130/serializers/ble_gap_ppcp_set.c | 64 + .../s130/serializers/ble_gap_rssi_get.c | 77 + .../s130/serializers/ble_gap_rssi_start.c | 49 + .../s130/serializers/ble_gap_rssi_stop.c | 39 + .../s130/serializers/ble_gap_scan_start.c | 44 + .../s130/serializers/ble_gap_scan_stop.c | 23 + .../s130/serializers/ble_gap_sec_info_reply.c | 72 + .../serializers/ble_gap_sec_params_reply.c | 90 + .../s130/serializers/ble_gap_tx_power_set.c | 39 + .../ble_gattc_char_value_by_uuid_read.c | 65 + .../serializers/ble_gattc_char_values_read.c | 53 + .../ble_gattc_characteristics_discover.c | 63 + .../codecs/s130/serializers/ble_gattc_conn.h | 398 + .../ble_gattc_descriptors_discover.c | 62 + .../serializers/ble_gattc_evt_char_disc_rsp.c | 73 + .../ble_gattc_evt_char_val_by_uuid_read_rsp.c | 52 + .../ble_gattc_evt_char_vals_read_rsp.c | 59 + .../s130/serializers/ble_gattc_evt_conn.h | 236 + .../serializers/ble_gattc_evt_desc_disc_rsp.c | 53 + .../s130/serializers/ble_gattc_evt_hvx.c | 52 + .../ble_gattc_evt_prim_srvc_disc_rsp.c | 62 + .../s130/serializers/ble_gattc_evt_read_rsp.c | 52 + .../serializers/ble_gattc_evt_rel_disc_rsp.c | 51 + .../s130/serializers/ble_gattc_evt_timeout.c | 37 + .../serializers/ble_gattc_evt_write_rsp.c | 53 + .../s130/serializers/ble_gattc_hv_confirm.c | 45 + .../ble_gattc_primary_services_discover.c | 67 + .../codecs/s130/serializers/ble_gattc_read.c | 49 + .../ble_gattc_relationships_discover.c | 64 + .../codecs/s130/serializers/ble_gattc_write.c | 59 + .../ble_gatts_characteristic_add.c | 88 + .../codecs/s130/serializers/ble_gatts_conn.h | 514 + .../serializers/ble_gatts_descriptor_add.c | 94 + .../s130/serializers/ble_gatts_evt_conn.h | 156 + .../s130/serializers/ble_gatts_evt_hvc.c | 38 + .../ble_gatts_evt_rw_authorize_request.c | 59 + .../serializers/ble_gatts_evt_sc_confirm.c | 37 + .../ble_gatts_evt_sys_attr_missing.c | 37 + .../s130/serializers/ble_gatts_evt_timeout.c | 37 + .../s130/serializers/ble_gatts_evt_write.c | 63 + .../codecs/s130/serializers/ble_gatts_hvx.c | 81 + .../s130/serializers/ble_gatts_include_add.c | 74 + .../ble_gatts_rw_authorize_reply.c | 53 + .../s130/serializers/ble_gatts_service_add.c | 76 + .../serializers/ble_gatts_service_changed.c | 55 + .../s130/serializers/ble_gatts_sys_attr_get.c | 125 + .../s130/serializers/ble_gatts_sys_attr_set.c | 76 + .../s130/serializers/ble_gatts_value_get.c | 105 + .../s130/serializers/ble_gatts_value_set.c | 74 + .../s130/serializers/ble_l2cap_cid_register.c | 46 + .../serializers/ble_l2cap_cid_unregister.c | 46 + .../codecs/s130/serializers/ble_l2cap_conn.h | 156 + .../s130/serializers/ble_l2cap_evt_conn.h | 56 + .../s130/serializers/ble_l2cap_evt_rx.c | 50 + .../codecs/s130/serializers/ble_l2cap_tx.c | 67 + .../codecs/s130/serializers/ble_opt_get.c | 130 + .../s130/serializers/ble_opt_id_pre_decoder.c | 36 + .../codecs/s130/serializers/ble_opt_set.c | 114 + .../serializers/ble_tx_buffer_count_get.c | 65 + .../s130/serializers/ble_user_mem_reply.c | 66 + .../codecs/s130/serializers/ble_uuid_decode.c | 77 + .../codecs/s130/serializers/ble_uuid_encode.c | 117 + .../codecs/s130/serializers/ble_uuid_vs_add.c | 73 + .../codecs/s130/serializers/ble_version_get.c | 77 + .../s130/serializers/conn_ble_gap_sec_keys.c | 73 + .../s130/serializers/conn_ble_gap_sec_keys.h | 86 + .../s130/serializers/conn_ble_user_mem.c | 78 + .../s130/serializers/conn_ble_user_mem.h | 81 + .../codecs/s130/serializers/nrf_soc_conn.h | 89 + .../s130/serializers/power_system_off.c | 28 + .../codecs/s130/serializers/temp_get.c | 71 + .../serialization/connectivity/hal/dtm_uart.c | 233 + .../serialization/connectivity/hal/dtm_uart.h | 23 + .../connectivity/pstorage_platform.h | 60 + .../connectivity/ser_conn_cmd_decoder.c | 97 + .../connectivity/ser_conn_cmd_decoder.h | 53 + .../connectivity/ser_conn_dtm_cmd_decoder.c | 94 + .../connectivity/ser_conn_dtm_cmd_decoder.h | 62 + .../connectivity/ser_conn_error_handling.c | 104 + .../connectivity/ser_conn_event_encoder.c | 75 + .../connectivity/ser_conn_event_encoder.h | 50 + .../connectivity/ser_conn_handlers.c | 129 + .../connectivity/ser_conn_handlers.h | 84 + .../connectivity/ser_conn_pkt_decoder.c | 86 + .../connectivity/ser_conn_pkt_decoder.h | 54 + .../connectivity/ser_conn_reset_cmd_decoder.c | 20 + .../connectivity/ser_conn_reset_cmd_decoder.h | 45 + .../startup/arm/arm_startup_nrf51.s | 240 + .../ant_stack_handler_types.h | 69 + .../ble_stack_handler_types.h | 64 + .../softdevice_handler/softdevice_handler.c | 326 + .../softdevice_handler/softdevice_handler.h | 157 + .../softdevice_handler_appsh.c | 26 + .../softdevice_handler_appsh.h | 24 + ...s110_nrf51822_8.0.0_migration_document.pdf | Bin 0 -> 188439 bytes .../s110_nrf51_8.0.0_licence-agreement.pdf | Bin 0 -> 5553 bytes .../s110_nrf51_8.0.0_licence-agreement.txt | 88 + .../s110/doc/s110_nrf51_8.0.0_readme.txt | 9 + .../doc/s110_nrf51_8.0.0_release-notes.pdf | Bin 0 -> 50532 bytes components/softdevice/s110/headers/ble.h | 455 + components/softdevice/s110/headers/ble_err.h | 83 + components/softdevice/s110/headers/ble_gap.h | 1349 ++ components/softdevice/s110/headers/ble_gatt.h | 200 + .../softdevice/s110/headers/ble_gattc.h | 441 + .../softdevice/s110/headers/ble_gatts.h | 639 + components/softdevice/s110/headers/ble_hci.h | 125 + .../softdevice/s110/headers/ble_l2cap.h | 177 + .../softdevice/s110/headers/ble_ranges.h | 119 + .../softdevice/s110/headers/ble_types.h | 198 + .../softdevice/s110/headers/nrf_error.h | 78 + .../softdevice/s110/headers/nrf_error_sdm.h | 60 + .../softdevice/s110/headers/nrf_error_soc.h | 76 + components/softdevice/s110/headers/nrf_mbr.h | 184 + .../softdevice/s110/headers/nrf_sd_def.h | 23 + components/softdevice/s110/headers/nrf_sdm.h | 221 + components/softdevice/s110/headers/nrf_soc.h | 993 ++ components/softdevice/s110/headers/nrf_svc.h | 71 + .../s110/headers/softdevice_assert.h | 73 + .../s110/hex/s110_nrf51_8.0.0_softdevice.hex | 5649 +++++++ .../armgcc/armgcc_s110_nrf51422_xxaa.ld | 22 + .../armgcc/armgcc_s110_nrf51422_xxac.ld | 22 + .../armgcc/armgcc_s110_nrf51822_xxaa.ld | 22 + .../armgcc/armgcc_s110_nrf51822_xxab.ld | 22 + .../toolchain/iar/iar_s110_nrf51422_xxaa.icf | 31 + .../toolchain/iar/iar_s110_nrf51422_xxac.icf | 31 + .../toolchain/iar/iar_s110_nrf51822_xxaa.icf | 31 + .../toolchain/iar/iar_s110_nrf51822_xxab.icf | 31 + .../s120_nrf51822_2.0.0_licence_agreement.txt | 91 + .../s120_nrf51_2.1.0_licence_agreement.pdf | Bin 0 -> 5553 bytes .../s120/doc/s120_nrf51_2.1.0_readme.txt | 14 + .../doc/s120_nrf51_2.1.0_releasenotes.pdf | Bin 0 -> 54062 bytes components/softdevice/s120/headers/ble.h | 454 + components/softdevice/s120/headers/ble_err.h | 83 + components/softdevice/s120/headers/ble_gap.h | 1365 ++ components/softdevice/s120/headers/ble_gatt.h | 200 + .../softdevice/s120/headers/ble_gattc.h | 441 + .../softdevice/s120/headers/ble_gatts.h | 615 + components/softdevice/s120/headers/ble_hci.h | 125 + .../softdevice/s120/headers/ble_l2cap.h | 177 + .../softdevice/s120/headers/ble_ranges.h | 119 + .../softdevice/s120/headers/ble_types.h | 198 + .../softdevice/s120/headers/nrf_error.h | 78 + .../softdevice/s120/headers/nrf_error_sdm.h | 60 + .../softdevice/s120/headers/nrf_error_soc.h | 76 + components/softdevice/s120/headers/nrf_mbr.h | 185 + .../softdevice/s120/headers/nrf_sd_def.h | 23 + components/softdevice/s120/headers/nrf_sdm.h | 221 + components/softdevice/s120/headers/nrf_soc.h | 993 ++ components/softdevice/s120/headers/nrf_svc.h | 69 + .../s120/headers/softdevice_assert.h | 73 + .../s120/hex/s120_nrf51_2.1.0_softdevice.hex | 7080 +++++++++ .../armgcc/armgcc_s120_nrf51422_xxaa.ld | 22 + .../armgcc/armgcc_s120_nrf51422_xxac.ld | 22 + .../armgcc/armgcc_s120_nrf51822_xxaa.ld | 22 + .../armgcc/armgcc_s120_nrf51822_xxab.ld | 22 + .../toolchain/iar/iar_s120_nrf51422_xxaa.icf | 31 + .../toolchain/iar/iar_s120_nrf51422_xxac.icf | 31 + .../toolchain/iar/iar_s120_nrf51822_xxaa.icf | 31 + .../toolchain/iar/iar_s120_nrf51822_xxab.icf | 31 + .../s130_nrf51822_1.0.0_licence_agreement.pdf | Bin 0 -> 5564 bytes .../s130_nrf51822_1.0.0_licence_agreement.txt | 91 + .../s130/doc/s130_nrf51822_1.0.0_readme.txt | 8 + .../doc/s130_nrf51822_1.0.0_releasenotes.pdf | Bin 0 -> 22817 bytes components/softdevice/s130/headers/ble.h | 455 + components/softdevice/s130/headers/ble_err.h | 83 + components/softdevice/s130/headers/ble_gap.h | 1364 ++ components/softdevice/s130/headers/ble_gatt.h | 200 + .../softdevice/s130/headers/ble_gattc.h | 441 + .../softdevice/s130/headers/ble_gatts.h | 639 + components/softdevice/s130/headers/ble_hci.h | 125 + .../softdevice/s130/headers/ble_l2cap.h | 177 + .../softdevice/s130/headers/ble_ranges.h | 119 + .../softdevice/s130/headers/ble_types.h | 198 + .../softdevice/s130/headers/nrf_error.h | 78 + .../softdevice/s130/headers/nrf_error_sdm.h | 60 + .../softdevice/s130/headers/nrf_error_soc.h | 76 + components/softdevice/s130/headers/nrf_mbr.h | 185 + .../softdevice/s130/headers/nrf_sd_def.h | 23 + components/softdevice/s130/headers/nrf_sdm.h | 221 + components/softdevice/s130/headers/nrf_soc.h | 992 ++ components/softdevice/s130/headers/nrf_svc.h | 71 + .../s130/headers/softdevice_assert.h | 73 + .../s130/hex/s130_nrf51_1.0.0_softdevice.hex | 6861 +++++++++ .../armgcc/armgcc_s130_nrf51422_xxaa.ld | 22 + .../armgcc/armgcc_s130_nrf51422_xxac.ld | 22 + .../armgcc/armgcc_s130_nrf51822_xxaa.ld | 22 + .../armgcc/armgcc_s130_nrf51822_xxab.ld | 22 + .../toolchain/iar/iar_s130_nrf51422_xxaa.icf | 31 + .../toolchain/iar/iar_s130_nrf51422_xxac.icf | 31 + .../toolchain/iar/iar_s130_nrf51822_xxaa.icf | 31 + .../toolchain/iar/iar_s130_nrf51822_xxab.icf | 31 + .../s210_nrf51422_5.0.0_licence_agreement.pdf | Bin 0 -> 7025 bytes .../s210_nrf51422_5.0.0_licence_agreement.txt | 110 + ...s210_nrf51422_5.0.0_migration_document.pdf | Bin 0 -> 637984 bytes .../s210/doc/s210_nrf51422_5.0.0_readme.txt | 14 + .../doc/s210_nrf51422_5.0.0_releasenotes.pdf | Bin 0 -> 412251 bytes .../softdevice/s210/headers/ant_error.h | 43 + .../softdevice/s210/headers/ant_interface.h | 939 ++ .../softdevice/s210/headers/ant_parameters.h | 725 + .../softdevice/s210/headers/nrf_error.h | 78 + .../softdevice/s210/headers/nrf_error_sdm.h | 60 + .../softdevice/s210/headers/nrf_error_soc.h | 76 + components/softdevice/s210/headers/nrf_mbr.h | 184 + .../softdevice/s210/headers/nrf_sd_def.h | 23 + components/softdevice/s210/headers/nrf_sdm.h | 221 + components/softdevice/s210/headers/nrf_soc.h | 993 ++ components/softdevice/s210/headers/nrf_svc.h | 71 + .../s210/headers/softdevice_assert.h | 73 + .../hex/s210_nrf51422_5.0.0_softdevice.hex | 2952 ++++ .../armgcc/armgcc_s210_nrf51422_xxaa.ld | 22 + .../armgcc/armgcc_s210_nrf51422_xxac.ld | 22 + .../toolchain/iar/iar_s210_nrf51422_xxaa.icf | 31 + .../toolchain/iar/iar_s210_nrf51422_xxac.icf | 31 + .../s310_nrf51822_3.0.0_licence_agreement.pdf | Bin 0 -> 7025 bytes .../s310_nrf51822_3.0.0_licence_agreement.txt | 110 + ...s310_nrf51822_3.0.0_migration_document.pdf | Bin 0 -> 432939 bytes .../s310/doc/s310_nrf51822_3.0.0_readme.txt | 14 + .../doc/s310_nrf51822_3.0.0_releasenotes.pdf | Bin 0 -> 140119 bytes .../softdevice/s310/headers/ant_error.h | 43 + .../softdevice/s310/headers/ant_interface.h | 939 ++ .../softdevice/s310/headers/ant_parameters.h | 725 + components/softdevice/s310/headers/ble.h | 455 + components/softdevice/s310/headers/ble_err.h | 83 + components/softdevice/s310/headers/ble_gap.h | 1349 ++ components/softdevice/s310/headers/ble_gatt.h | 200 + .../softdevice/s310/headers/ble_gattc.h | 441 + .../softdevice/s310/headers/ble_gatts.h | 639 + components/softdevice/s310/headers/ble_hci.h | 125 + .../softdevice/s310/headers/ble_l2cap.h | 177 + .../softdevice/s310/headers/ble_ranges.h | 119 + .../softdevice/s310/headers/ble_types.h | 198 + .../softdevice/s310/headers/nrf_error.h | 78 + .../softdevice/s310/headers/nrf_error_sdm.h | 60 + .../softdevice/s310/headers/nrf_error_soc.h | 76 + components/softdevice/s310/headers/nrf_mbr.h | 184 + .../softdevice/s310/headers/nrf_sd_def.h | 23 + components/softdevice/s310/headers/nrf_sdm.h | 221 + components/softdevice/s310/headers/nrf_soc.h | 993 ++ components/softdevice/s310/headers/nrf_svc.h | 71 + .../s310/headers/softdevice_assert.h | 73 + .../hex/s310_nrf51422_3.0.0_softdevice.hex | 7295 +++++++++ .../armgcc/armgcc_s310_nrf51422_xxaa.ld | 22 + .../armgcc/armgcc_s310_nrf51422_xxac.ld | 22 + .../toolchain/iar/iar_s310_nrf51422_xxaa.icf | 31 + .../toolchain/iar/iar_s310_nrf51422_xxac.icf | 31 + components/toolchain/arm/arm_startup_nrf51.s | 255 + components/toolchain/arm/arm_startup_nrf52.s | 485 + components/toolchain/arm/uicr_config.h | 104 + components/toolchain/gcc/Makefile.common | 156 + components/toolchain/gcc/Makefile.posix | 4 + components/toolchain/gcc/Makefile.windows | 10 + components/toolchain/gcc/arm_common_tables.h | 136 + components/toolchain/gcc/arm_const_structs.h | 79 + components/toolchain/gcc/arm_math.h | 7544 ++++++++++ components/toolchain/gcc/core_cm0.h | 711 + components/toolchain/gcc/core_cm4.h | 1802 +++ components/toolchain/gcc/core_cmFunc.h | 637 + components/toolchain/gcc/core_cmInstr.h | 880 ++ components/toolchain/gcc/core_cmSimd.h | 697 + components/toolchain/gcc/gcc_nrf51_common.ld | 164 + components/toolchain/gcc/gcc_startup_nrf51.s | 266 + components/toolchain/gcc/gcc_startup_nrf52.s | 490 + components/toolchain/gcc/nrf51_common.ld | 164 + components/toolchain/gcc/nrf51_xxaa.ld | 13 + components/toolchain/gcc/nrf51_xxab.ld | 13 + components/toolchain/gcc/nrf51_xxac.ld | 13 + components/toolchain/gcc/nrf52_common.ld | 164 + components/toolchain/gcc/nrf52_xxaa.ld | 13 + components/toolchain/gcc/nrf5x_common.ld | 164 + .../toolchain/iar/iar_nrf51_blank_xxaa.icf | 31 + .../toolchain/iar/iar_nrf51_blank_xxac.icf | 31 + components/toolchain/iar/iar_startup_nrf51.s | 272 + components/toolchain/iar/iar_startup_nrf52.s | 524 + components/toolchain/system_nrf51.c | 121 + components/toolchain/system_nrf51.h | 69 + components/toolchain/system_nrf51422.c | 121 + components/toolchain/system_nrf52.c | 263 + components/toolchain/system_nrf52.h | 69 + config/bsp.h | 4 + config/nrf_drv_config.h | 341 + docs/index.html | 269 + main.c | 380 + 1503 files changed, 324924 insertions(+) create mode 100644 EPD/DEV_Config.c create mode 100644 EPD/DEV_Config.h create mode 100644 EPD/EPD_4in2.c create mode 100644 EPD/EPD_4in2.h create mode 100644 EPD/EPD_4in2_V2.c create mode 100644 EPD/EPD_4in2_V2.h create mode 100644 EPD/EPD_4in2b_V2.c create mode 100644 EPD/EPD_4in2b_V2.h create mode 100644 EPD/EPD_ble.c create mode 100644 EPD/EPD_ble.h create mode 100644 Keil/EPD.uvoptx create mode 100644 Keil/EPD.uvprojx create mode 100644 Keil/RTE/Device/nRF51822_xxAB/arm_startup_nrf51.s create mode 100644 Keil/RTE/Device/nRF51822_xxAB/system_nrf51.c create mode 100644 Keil/RTE/_EPD/RTE_Components.h create mode 100644 Keil/RTE/_EPD_Debug/RTE_Components.h create mode 100644 Keil/RTE/_flash_softdevice/RTE_Components.h create mode 100644 LICENSE create mode 100644 components/ant/ant_channel_config/ant_channel_config.c create mode 100644 components/ant/ant_channel_config/ant_channel_config.h create mode 100644 components/ant/ant_encryption/ant_encrypt_config.c create mode 100644 components/ant/ant_encryption/ant_encrypt_config.h create mode 100644 components/ant/ant_encryption/ant_encrypt_negotiation_slave.c create mode 100644 components/ant/ant_encryption/ant_encrypt_negotiation_slave.h create mode 100644 components/ant/ant_key_manager/ant_key_manager.c create mode 100644 components/ant/ant_key_manager/ant_key_manager.h create mode 100644 components/ant/ant_key_manager/config/ant_key_manager_config.h create mode 100644 components/ant/ant_profiles/ant_bpwr/ant_bpwr.c create mode 100644 components/ant/ant_profiles/ant_bpwr/ant_bpwr.h create mode 100644 components/ant/ant_profiles/ant_bpwr/ant_bpwr_local.h create mode 100644 components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_common_data.c create mode 100644 components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_common_data.h create mode 100644 components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_1.c create mode 100644 components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_1.h create mode 100644 components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_16.c create mode 100644 components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_16.h create mode 100644 components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_17.c create mode 100644 components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_17.h create mode 100644 components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_18.c create mode 100644 components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_18.h create mode 100644 components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_torque.c create mode 100644 components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_torque.h create mode 100644 components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_pages.h create mode 100644 components/ant/ant_profiles/ant_bpwr/pages/logger/ant_bpwr_page_logger.h create mode 100644 components/ant/ant_profiles/ant_bpwr/simulator/ant_bpwr_simulator.c create mode 100644 components/ant/ant_profiles/ant_bpwr/simulator/ant_bpwr_simulator.h create mode 100644 components/ant/ant_profiles/ant_bpwr/simulator/ant_bpwr_simulator_local.h create mode 100644 components/ant/ant_profiles/ant_bpwr/utils/ant_bpwr_utils.h create mode 100644 components/ant/ant_profiles/ant_bsc/ant_bsc.c create mode 100644 components/ant/ant_profiles/ant_bsc/ant_bsc.h create mode 100644 components/ant/ant_profiles/ant_bsc/ant_bsc_local.h create mode 100644 components/ant/ant_profiles/ant_bsc/pages/ant_bsc_combined_page_0.c create mode 100644 components/ant/ant_profiles/ant_bsc/pages/ant_bsc_combined_page_0.h create mode 100644 components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_0.c create mode 100644 components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_0.h create mode 100644 components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_1.c create mode 100644 components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_1.h create mode 100644 components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_2.c create mode 100644 components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_2.h create mode 100644 components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_3.c create mode 100644 components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_3.h create mode 100644 components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_4.c create mode 100644 components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_4.h create mode 100644 components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_5.c create mode 100644 components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_5.h create mode 100644 components/ant/ant_profiles/ant_bsc/pages/ant_bsc_pages.h create mode 100644 components/ant/ant_profiles/ant_bsc/pages/logger/ant_bsc_page_logger.h create mode 100644 components/ant/ant_profiles/ant_bsc/simulator/ant_bsc_simulator.c create mode 100644 components/ant/ant_profiles/ant_bsc/simulator/ant_bsc_simulator.h create mode 100644 components/ant/ant_profiles/ant_bsc/simulator/ant_bsc_simulator_local.h create mode 100644 components/ant/ant_profiles/ant_bsc/utils/ant_bsc_utils.h create mode 100644 components/ant/ant_profiles/ant_common/ant_request_controller/ant_request_controller.c create mode 100644 components/ant/ant_profiles/ant_common/ant_request_controller/ant_request_controller.h create mode 100644 components/ant/ant_profiles/ant_common/pages/ant_common_page_70.c create mode 100644 components/ant/ant_profiles/ant_common/pages/ant_common_page_70.h create mode 100644 components/ant/ant_profiles/ant_common/pages/ant_common_page_80.c create mode 100644 components/ant/ant_profiles/ant_common/pages/ant_common_page_80.h create mode 100644 components/ant/ant_profiles/ant_common/pages/ant_common_page_81.c create mode 100644 components/ant/ant_profiles/ant_common/pages/ant_common_page_81.h create mode 100644 components/ant/ant_profiles/ant_common/pages/logger/ant_common_page_logger.h create mode 100644 components/ant/ant_profiles/ant_hrm/ant_hrm.c create mode 100644 components/ant/ant_profiles/ant_hrm/ant_hrm.h create mode 100644 components/ant/ant_profiles/ant_hrm/ant_hrm_local.h create mode 100644 components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_0.c create mode 100644 components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_0.h create mode 100644 components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_1.c create mode 100644 components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_1.h create mode 100644 components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_2.c create mode 100644 components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_2.h create mode 100644 components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_3.c create mode 100644 components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_3.h create mode 100644 components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_4.c create mode 100644 components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_4.h create mode 100644 components/ant/ant_profiles/ant_hrm/pages/ant_hrm_pages.h create mode 100644 components/ant/ant_profiles/ant_hrm/pages/logger/ant_hrm_page_logger.h create mode 100644 components/ant/ant_profiles/ant_hrm/simulator/ant_hrm_simulator.c create mode 100644 components/ant/ant_profiles/ant_hrm/simulator/ant_hrm_simulator.h create mode 100644 components/ant/ant_profiles/ant_hrm/simulator/ant_hrm_simulator_local.h create mode 100644 components/ant/ant_profiles/ant_hrm/utils/ant_hrm_utils.h create mode 100644 components/ant/ant_profiles/ant_sdm/ant_sdm.c create mode 100644 components/ant/ant_profiles/ant_sdm/ant_sdm.h create mode 100644 components/ant/ant_profiles/ant_sdm/ant_sdm_local.h create mode 100644 components/ant/ant_profiles/ant_sdm/pages/ant_sdm_common_data.c create mode 100644 components/ant/ant_profiles/ant_sdm/pages/ant_sdm_common_data.h create mode 100644 components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_1.c create mode 100644 components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_1.h create mode 100644 components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_16.c create mode 100644 components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_16.h create mode 100644 components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_2.c create mode 100644 components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_2.h create mode 100644 components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_22.c create mode 100644 components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_22.h create mode 100644 components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_3.c create mode 100644 components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_3.h create mode 100644 components/ant/ant_profiles/ant_sdm/pages/ant_sdm_pages.h create mode 100644 components/ant/ant_profiles/ant_sdm/pages/logger/ant_sdm_page_logger.h create mode 100644 components/ant/ant_profiles/ant_sdm/simulator/ant_sdm_simulator.c create mode 100644 components/ant/ant_profiles/ant_sdm/simulator/ant_sdm_simulator.h create mode 100644 components/ant/ant_profiles/ant_sdm/simulator/ant_sdm_simulator_local.h create mode 100644 components/ant/ant_profiles/ant_sdm/utils/ant_sdm_utils.h create mode 100644 components/ant/ant_search_config/ant_search_config.c create mode 100644 components/ant/ant_search_config/ant_search_config.h create mode 100644 components/ant/ant_stack_config/ant_stack_config.c create mode 100644 components/ant/ant_stack_config/ant_stack_config.h create mode 100644 components/ant/ant_stack_config/config/ant_stack_config_defs.h create mode 100644 components/ant/ant_state_indicator/ant_state_indicator.c create mode 100644 components/ant/ant_state_indicator/ant_state_indicator.h create mode 100644 components/ble/ble_advertising/ble_advertising.c create mode 100644 components/ble/ble_advertising/ble_advertising.h create mode 100644 components/ble/ble_db_discovery/ble_db_discovery.c create mode 100644 components/ble/ble_db_discovery/ble_db_discovery.h create mode 100644 components/ble/ble_debug_assert_handler/ble_debug_assert_handler.c create mode 100644 components/ble/ble_debug_assert_handler/ble_debug_assert_handler.h create mode 100644 components/ble/ble_dtm/ble_dtm.c create mode 100644 components/ble/ble_dtm/ble_dtm.h create mode 100644 components/ble/ble_error_log/ble_error_log.c create mode 100644 components/ble/ble_error_log/ble_error_log.h create mode 100644 components/ble/ble_racp/ble_racp.c create mode 100644 components/ble/ble_racp/ble_racp.h create mode 100644 components/ble/ble_radio_notification/ble_radio_notification.c create mode 100644 components/ble/ble_radio_notification/ble_radio_notification.h create mode 100644 components/ble/ble_services/ble_ancs_c/ble_ancs_c.c create mode 100644 components/ble/ble_services/ble_ancs_c/ble_ancs_c.h create mode 100644 components/ble/ble_services/ble_ans_c/ble_ans_c.c create mode 100644 components/ble/ble_services/ble_ans_c/ble_ans_c.h create mode 100644 components/ble/ble_services/ble_bas/ble_bas.c create mode 100644 components/ble/ble_services/ble_bas/ble_bas.h create mode 100644 components/ble/ble_services/ble_bas_c/ble_bas_c.c create mode 100644 components/ble/ble_services/ble_bas_c/ble_bas_c.h create mode 100644 components/ble/ble_services/ble_bps/ble_bps.c create mode 100644 components/ble/ble_services/ble_bps/ble_bps.h create mode 100644 components/ble/ble_services/ble_cscs/ble_cscs.c create mode 100644 components/ble/ble_services/ble_cscs/ble_cscs.h create mode 100644 components/ble/ble_services/ble_cscs/ble_sc_ctrlpt.c create mode 100644 components/ble/ble_services/ble_cscs/ble_sc_ctrlpt.h create mode 100644 components/ble/ble_services/ble_cts_c/ble_cts_c.c create mode 100644 components/ble/ble_services/ble_cts_c/ble_cts_c.h create mode 100644 components/ble/ble_services/ble_dfu/ble_dfu.c create mode 100644 components/ble/ble_services/ble_dfu/ble_dfu.h create mode 100644 components/ble/ble_services/ble_dis/ble_dis.c create mode 100644 components/ble/ble_services/ble_dis/ble_dis.h create mode 100644 components/ble/ble_services/ble_gls/ble_gls.c create mode 100644 components/ble/ble_services/ble_gls/ble_gls.h create mode 100644 components/ble/ble_services/ble_gls/ble_gls_db.c create mode 100644 components/ble/ble_services/ble_gls/ble_gls_db.h create mode 100644 components/ble/ble_services/ble_hids/ble_hids.c create mode 100644 components/ble/ble_services/ble_hids/ble_hids.h create mode 100644 components/ble/ble_services/ble_hrs/ble_hrs.c create mode 100644 components/ble/ble_services/ble_hrs/ble_hrs.h create mode 100644 components/ble/ble_services/ble_hrs_c/ble_hrs_c.c create mode 100644 components/ble/ble_services/ble_hrs_c/ble_hrs_c.h create mode 100644 components/ble/ble_services/ble_hts/ble_hts.c create mode 100644 components/ble/ble_services/ble_hts/ble_hts.h create mode 100644 components/ble/ble_services/ble_ias/ble_ias.c create mode 100644 components/ble/ble_services/ble_ias/ble_ias.h create mode 100644 components/ble/ble_services/ble_ias_c/ble_ias_c.c create mode 100644 components/ble/ble_services/ble_ias_c/ble_ias_c.h create mode 100644 components/ble/ble_services/ble_lbs/ble_lbs.c create mode 100644 components/ble/ble_services/ble_lbs/ble_lbs.h create mode 100644 components/ble/ble_services/ble_lls/ble_lls.c create mode 100644 components/ble/ble_services/ble_lls/ble_lls.h create mode 100644 components/ble/ble_services/ble_nus/ble_nus.c create mode 100644 components/ble/ble_services/ble_nus/ble_nus.h create mode 100644 components/ble/ble_services/ble_nus_c/ble_nus_c.c create mode 100644 components/ble/ble_services/ble_nus_c/ble_nus_c.h create mode 100644 components/ble/ble_services/ble_rscs/ble_rscs.c create mode 100644 components/ble/ble_services/ble_rscs/ble_rscs.h create mode 100644 components/ble/ble_services/ble_rscs_c/ble_rscs_c.c create mode 100644 components/ble/ble_services/ble_rscs_c/ble_rscs_c.h create mode 100644 components/ble/ble_services/ble_tps/ble_tps.c create mode 100644 components/ble/ble_services/ble_tps/ble_tps.h create mode 100644 components/ble/ble_services/experimental_ble_lns/ble_lns.c create mode 100644 components/ble/ble_services/experimental_ble_lns/ble_lns.h create mode 100644 components/ble/common/ble_advdata.c create mode 100644 components/ble/common/ble_advdata.h create mode 100644 components/ble/common/ble_conn_params.c create mode 100644 components/ble/common/ble_conn_params.h create mode 100644 components/ble/common/ble_conn_state.c create mode 100644 components/ble/common/ble_conn_state.h create mode 100644 components/ble/common/ble_date_time.h create mode 100644 components/ble/common/ble_gatt_db.h create mode 100644 components/ble/common/ble_sensor_location.h create mode 100644 components/ble/common/ble_srv_common.c create mode 100644 components/ble/common/ble_srv_common.h create mode 100644 components/ble/device_manager/config/device_manager_cnfg.h create mode 100644 components/ble/device_manager/device_manager.h create mode 100644 components/ble/device_manager/device_manager_central.c create mode 100644 components/ble/device_manager/device_manager_peripheral.c create mode 100644 components/ble/peer_manager/gatt_cache_manager.c create mode 100644 components/ble/peer_manager/gatt_cache_manager.h create mode 100644 components/ble/peer_manager/gattc_cache_manager.c create mode 100644 components/ble/peer_manager/gattc_cache_manager.h create mode 100644 components/ble/peer_manager/gatts_cache_manager.c create mode 100644 components/ble/peer_manager/gatts_cache_manager.h create mode 100644 components/ble/peer_manager/id_manager.c create mode 100644 components/ble/peer_manager/id_manager.h create mode 100644 components/ble/peer_manager/peer_data.c create mode 100644 components/ble/peer_manager/peer_data.h create mode 100644 components/ble/peer_manager/peer_data_storage.c create mode 100644 components/ble/peer_manager/peer_data_storage.h create mode 100644 components/ble/peer_manager/peer_database.c create mode 100644 components/ble/peer_manager/peer_database.h create mode 100644 components/ble/peer_manager/peer_id.c create mode 100644 components/ble/peer_manager/peer_id.h create mode 100644 components/ble/peer_manager/peer_manager.c create mode 100644 components/ble/peer_manager/peer_manager.h create mode 100644 components/ble/peer_manager/peer_manager_types.h create mode 100644 components/ble/peer_manager/pm_buffer.c create mode 100644 components/ble/peer_manager/pm_buffer.h create mode 100644 components/ble/peer_manager/pm_mutex.c create mode 100644 components/ble/peer_manager/pm_mutex.h create mode 100644 components/ble/peer_manager/security_dispatcher.c create mode 100644 components/ble/peer_manager/security_dispatcher.h create mode 100644 components/ble/peer_manager/security_manager.c create mode 100644 components/ble/peer_manager/security_manager.h create mode 100644 components/device/compiler_abstraction.h create mode 100644 components/device/nrf.h create mode 100644 components/device/nrf51.h create mode 100644 components/device/nrf51_bitfields.h create mode 100644 components/device/nrf51_deprecated.h create mode 100644 components/device/nrf51_to_nrf52.h create mode 100644 components/device/nrf52.h create mode 100644 components/device/nrf52_bitfields.h create mode 100644 components/drivers_ext/adns2080/adns2080.c create mode 100644 components/drivers_ext/adns2080/adns2080.h create mode 100644 components/drivers_ext/cherry8x16/cherry8x16.c create mode 100644 components/drivers_ext/cherry8x16/cherry8x16.h create mode 100644 components/drivers_ext/ds1624/ds1624.c create mode 100644 components/drivers_ext/ds1624/ds1624.h create mode 100644 components/drivers_ext/mpu6050/mpu6050.c create mode 100644 components/drivers_ext/mpu6050/mpu6050.h create mode 100644 components/drivers_ext/nrf6350/nrf6350.c create mode 100644 components/drivers_ext/nrf6350/nrf6350.h create mode 100644 components/drivers_ext/segger_rtt/RTT_Syscalls_GCC.c create mode 100644 components/drivers_ext/segger_rtt/RTT_Syscalls_IAR.c create mode 100644 components/drivers_ext/segger_rtt/RTT_Syscalls_KEIL.c create mode 100644 components/drivers_ext/segger_rtt/SEGGER_RTT.c create mode 100644 components/drivers_ext/segger_rtt/SEGGER_RTT.h create mode 100644 components/drivers_ext/segger_rtt/SEGGER_RTT_Conf.h create mode 100644 components/drivers_ext/segger_rtt/SEGGER_RTT_printf.c create mode 100644 components/drivers_ext/synaptics_touchpad/synaptics_touchpad.c create mode 100644 components/drivers_ext/synaptics_touchpad/synaptics_touchpad.h create mode 100644 components/drivers_nrf/ble_flash/ble_flash.c create mode 100644 components/drivers_nrf/ble_flash/ble_flash.h create mode 100644 components/drivers_nrf/clock/nrf_drv_clock.c create mode 100644 components/drivers_nrf/clock/nrf_drv_clock.h create mode 100644 components/drivers_nrf/common/nrf_drv_common.c create mode 100644 components/drivers_nrf/common/nrf_drv_common.h create mode 100644 components/drivers_nrf/common/nrf_drv_validation.h create mode 100644 components/drivers_nrf/config/nrf_drv_config.h create mode 100644 components/drivers_nrf/config/nrf_drv_config_validation.h create mode 100644 components/drivers_nrf/delay/nrf_delay.c create mode 100644 components/drivers_nrf/delay/nrf_delay.h create mode 100644 components/drivers_nrf/gpiote/nrf_drv_gpiote.c create mode 100644 components/drivers_nrf/gpiote/nrf_drv_gpiote.h create mode 100644 components/drivers_nrf/hal/nrf_adc.c create mode 100644 components/drivers_nrf/hal/nrf_adc.h create mode 100644 components/drivers_nrf/hal/nrf_clock.h create mode 100644 components/drivers_nrf/hal/nrf_ecb.c create mode 100644 components/drivers_nrf/hal/nrf_ecb.h create mode 100644 components/drivers_nrf/hal/nrf_egu.h create mode 100644 components/drivers_nrf/hal/nrf_gpio.h create mode 100644 components/drivers_nrf/hal/nrf_gpiote.h create mode 100644 components/drivers_nrf/hal/nrf_lpcomp.h create mode 100644 components/drivers_nrf/hal/nrf_nvmc.c create mode 100644 components/drivers_nrf/hal/nrf_nvmc.h create mode 100644 components/drivers_nrf/hal/nrf_ppi.h create mode 100644 components/drivers_nrf/hal/nrf_qdec.h create mode 100644 components/drivers_nrf/hal/nrf_rng.h create mode 100644 components/drivers_nrf/hal/nrf_rtc.h create mode 100644 components/drivers_nrf/hal/nrf_saadc.c create mode 100644 components/drivers_nrf/hal/nrf_saadc.h create mode 100644 components/drivers_nrf/hal/nrf_spi.h create mode 100644 components/drivers_nrf/hal/nrf_spim.h create mode 100644 components/drivers_nrf/hal/nrf_spis.h create mode 100644 components/drivers_nrf/hal/nrf_temp.h create mode 100644 components/drivers_nrf/hal/nrf_timer.h create mode 100644 components/drivers_nrf/hal/nrf_twi.h create mode 100644 components/drivers_nrf/hal/nrf_twis.h create mode 100644 components/drivers_nrf/hal/nrf_uart.h create mode 100644 components/drivers_nrf/hal/nrf_uarte.h create mode 100644 components/drivers_nrf/hal/nrf_wdt.h create mode 100644 components/drivers_nrf/lpcomp/nrf_drv_lpcomp.c create mode 100644 components/drivers_nrf/lpcomp/nrf_drv_lpcomp.h create mode 100644 components/drivers_nrf/nrf_soc_nosd/nrf_error.h create mode 100644 components/drivers_nrf/nrf_soc_nosd/nrf_soc.c create mode 100644 components/drivers_nrf/nrf_soc_nosd/nrf_soc.h create mode 100644 components/drivers_nrf/ppi/nrf_drv_ppi.c create mode 100644 components/drivers_nrf/ppi/nrf_drv_ppi.h create mode 100644 components/drivers_nrf/pstorage/config/pstorage_platform.h create mode 100644 components/drivers_nrf/pstorage/pstorage.c create mode 100644 components/drivers_nrf/pstorage/pstorage.h create mode 100644 components/drivers_nrf/pstorage/pstorage_nosd.c create mode 100644 components/drivers_nrf/pstorage/pstorage_raw.c create mode 100644 components/drivers_nrf/qdec/nrf_drv_qdec.c create mode 100644 components/drivers_nrf/qdec/nrf_drv_qdec.h create mode 100644 components/drivers_nrf/radio_config/radio_config.c create mode 100644 components/drivers_nrf/radio_config/radio_config.h create mode 100644 components/drivers_nrf/rng/nrf_drv_rng.c create mode 100644 components/drivers_nrf/rng/nrf_drv_rng.h create mode 100644 components/drivers_nrf/rtc/nrf_drv_rtc.c create mode 100644 components/drivers_nrf/rtc/nrf_drv_rtc.h create mode 100644 components/drivers_nrf/sdio/config/sdio_config.h create mode 100644 components/drivers_nrf/sdio/sdio.c create mode 100644 components/drivers_nrf/sdio/sdio.h create mode 100644 components/drivers_nrf/spi_master/nrf_drv_spi.c create mode 100644 components/drivers_nrf/spi_master/nrf_drv_spi.h create mode 100644 components/drivers_nrf/spi_master/spi_5W_master.c create mode 100644 components/drivers_nrf/spi_master/spi_5W_master.h create mode 100644 components/drivers_nrf/spi_slave/nrf_drv_spis.c create mode 100644 components/drivers_nrf/spi_slave/nrf_drv_spis.h create mode 100644 components/drivers_nrf/swi/nrf_drv_swi.c create mode 100644 components/drivers_nrf/swi/nrf_drv_swi.h create mode 100644 components/drivers_nrf/timer/nrf_drv_timer.c create mode 100644 components/drivers_nrf/timer/nrf_drv_timer.h create mode 100644 components/drivers_nrf/twi_master/deprecated/config/twi_master_config.h create mode 100644 components/drivers_nrf/twi_master/deprecated/twi_hw_master.c create mode 100644 components/drivers_nrf/twi_master/deprecated/twi_master.h create mode 100644 components/drivers_nrf/twi_master/deprecated/twi_sw_master.c create mode 100644 components/drivers_nrf/twi_master/nrf_drv_twi.c create mode 100644 components/drivers_nrf/twi_master/nrf_drv_twi.h create mode 100644 components/drivers_nrf/uart/nrf_drv_uart.c create mode 100644 components/drivers_nrf/uart/nrf_drv_uart.h create mode 100644 components/drivers_nrf/wdt/nrf_drv_wdt.c create mode 100644 components/drivers_nrf/wdt/nrf_drv_wdt.h create mode 100644 components/libraries/ant_fs/antfs.c create mode 100644 components/libraries/ant_fs/antfs.h create mode 100644 components/libraries/ant_fs/crc.c create mode 100644 components/libraries/ant_fs/crc.h create mode 100644 components/libraries/ant_fs/defines.h create mode 100644 components/libraries/bootloader_dfu/ble_transport/hci_mem_pool_internal.h create mode 100644 components/libraries/bootloader_dfu/bootloader.c create mode 100644 components/libraries/bootloader_dfu/bootloader.h create mode 100644 components/libraries/bootloader_dfu/bootloader_settings.c create mode 100644 components/libraries/bootloader_dfu/bootloader_settings.h create mode 100644 components/libraries/bootloader_dfu/bootloader_types.h create mode 100644 components/libraries/bootloader_dfu/bootloader_util.c create mode 100644 components/libraries/bootloader_dfu/bootloader_util.h create mode 100644 components/libraries/bootloader_dfu/dfu.h create mode 100644 components/libraries/bootloader_dfu/dfu_app_handler.c create mode 100644 components/libraries/bootloader_dfu/dfu_app_handler.h create mode 100644 components/libraries/bootloader_dfu/dfu_bank_internal.h create mode 100644 components/libraries/bootloader_dfu/dfu_ble_svc.h create mode 100644 components/libraries/bootloader_dfu/dfu_ble_svc_internal.h create mode 100644 components/libraries/bootloader_dfu/dfu_dual_bank.c create mode 100644 components/libraries/bootloader_dfu/dfu_init.h create mode 100644 components/libraries/bootloader_dfu/dfu_init_template.c create mode 100644 components/libraries/bootloader_dfu/dfu_single_bank.c create mode 100644 components/libraries/bootloader_dfu/dfu_transport.h create mode 100644 components/libraries/bootloader_dfu/dfu_transport_ble.c create mode 100644 components/libraries/bootloader_dfu/dfu_transport_serial.c create mode 100644 components/libraries/bootloader_dfu/dfu_types.h create mode 100644 components/libraries/bootloader_dfu/experimental/dfu_init_template_signing.c create mode 100644 components/libraries/bootloader_dfu/experimental/nrf_sec.h create mode 100644 components/libraries/bootloader_dfu/hci_transport/hci_mem_pool_internal.h create mode 100644 components/libraries/bootloader_dfu/hci_transport/hci_transport_config.h create mode 100644 components/libraries/button/app_button.c create mode 100644 components/libraries/button/app_button.h create mode 100644 components/libraries/console/console.c create mode 100644 components/libraries/console/console.h create mode 100644 components/libraries/crc16/crc16.c create mode 100644 components/libraries/crc16/crc16.h create mode 100644 components/libraries/experimental_section_vars/section_vars.h create mode 100644 components/libraries/fds/fds.c create mode 100644 components/libraries/fds/fds.h create mode 100644 components/libraries/fds/fds_config.h create mode 100644 components/libraries/fds/fds_types_internal.h create mode 100644 components/libraries/fifo/app_fifo.c create mode 100644 components/libraries/fifo/app_fifo.h create mode 100644 components/libraries/fstorage/fstorage.c create mode 100644 components/libraries/fstorage/fstorage.h create mode 100644 components/libraries/fstorage/fstorage_config.h create mode 100644 components/libraries/fstorage/fstorage_nosd.c create mode 100644 components/libraries/gpiote/app_gpiote.c create mode 100644 components/libraries/gpiote/app_gpiote.h create mode 100644 components/libraries/gpiote/app_gpiote_fast_detect.c create mode 100644 components/libraries/hci/config/hci_mem_pool_internal.h create mode 100644 components/libraries/hci/config/hci_transport_config.h create mode 100644 components/libraries/hci/hci_mem_pool.c create mode 100644 components/libraries/hci/hci_mem_pool.h create mode 100644 components/libraries/hci/hci_slip.c create mode 100644 components/libraries/hci/hci_slip.h create mode 100644 components/libraries/hci/hci_transport.c create mode 100644 components/libraries/hci/hci_transport.h create mode 100644 components/libraries/ic_info/nrf51_ic_info.c create mode 100644 components/libraries/ic_info/nrf_ic_info.h create mode 100644 components/libraries/led_softblink/led_softblink.c create mode 100644 components/libraries/led_softblink/led_softblink.h create mode 100644 components/libraries/low_power_pwm/low_power_pwm.c create mode 100644 components/libraries/low_power_pwm/low_power_pwm.h create mode 100644 components/libraries/mailbox/app_mailbox.c create mode 100644 components/libraries/mailbox/app_mailbox.h create mode 100644 components/libraries/mailbox/app_mailbox_local.h create mode 100644 components/libraries/mem_manager/mem_manager.c create mode 100644 components/libraries/mem_manager/mem_manager.h create mode 100644 components/libraries/pwm/app_pwm.c create mode 100644 components/libraries/pwm/app_pwm.h create mode 100644 components/libraries/scheduler/app_scheduler.c create mode 100644 components/libraries/scheduler/app_scheduler.h create mode 100644 components/libraries/scheduler/app_scheduler_serconn.c create mode 100644 components/libraries/sensorsim/sensorsim.c create mode 100644 components/libraries/sensorsim/sensorsim.h create mode 100644 components/libraries/sha256/sha256.c create mode 100644 components/libraries/sha256/sha256.h create mode 100644 components/libraries/simple_timer/app_simple_timer.c create mode 100644 components/libraries/simple_timer/app_simple_timer.h create mode 100644 components/libraries/slip/slip.c create mode 100644 components/libraries/slip/slip.h create mode 100644 components/libraries/timer/app_timer.c create mode 100644 components/libraries/timer/app_timer.h create mode 100644 components/libraries/timer/app_timer_appsh.c create mode 100644 components/libraries/timer/app_timer_appsh.h create mode 100644 components/libraries/timer/app_timer_ble_gzll.c create mode 100644 components/libraries/timer/app_timer_freertos.c create mode 100644 components/libraries/timer/app_timer_rtx.c create mode 100644 components/libraries/trace/app_trace.c create mode 100644 components/libraries/trace/app_trace.h create mode 100644 components/libraries/twi/app_twi.c create mode 100644 components/libraries/twi/app_twi.h create mode 100644 components/libraries/uart/app_uart.c create mode 100644 components/libraries/uart/app_uart.h create mode 100644 components/libraries/uart/app_uart_fifo.c create mode 100644 components/libraries/uart/retarget.c create mode 100644 components/libraries/util/app_error.c create mode 100644 components/libraries/util/app_error.h create mode 100644 components/libraries/util/app_util.h create mode 100644 components/libraries/util/app_util_bds.h create mode 100644 components/libraries/util/app_util_platform.c create mode 100644 components/libraries/util/app_util_platform.h create mode 100644 components/libraries/util/common.h create mode 100644 components/libraries/util/nordic_common.h create mode 100644 components/libraries/util/nrf_assert.c create mode 100644 components/libraries/util/nrf_assert.h create mode 100644 components/libraries/util/nrf_log.c create mode 100644 components/libraries/util/nrf_log.h create mode 100644 components/libraries/util/sdk_common.h create mode 100644 components/libraries/util/sdk_errors.h create mode 100644 components/libraries/util/sdk_mapped_flags.c create mode 100644 components/libraries/util/sdk_mapped_flags.h create mode 100644 components/libraries/util/sdk_os.h create mode 100644 components/libraries/util/sdk_resources.h create mode 100644 components/properitary_rf/esb/arm/esb_arm.lib create mode 100644 components/properitary_rf/esb/arm/esb_sd_resources_arm.lib create mode 100644 components/properitary_rf/esb/gcc/esb_gcc.a create mode 100644 components/properitary_rf/esb/gcc/esb_sd_resources_gcc.a create mode 100644 components/properitary_rf/esb/iar/esb_iar.a create mode 100644 components/properitary_rf/esb/iar/esb_sd_resource_iar.a create mode 100644 components/properitary_rf/esb/nrf_esb.h create mode 100644 components/properitary_rf/esb/nrf_esb_constants.h create mode 100644 components/properitary_rf/esb/nrf_esb_resources.h create mode 100644 components/properitary_rf/gzll/arm/gzll_arm.lib create mode 100644 components/properitary_rf/gzll/arm/gzll_sd_resources_arm.lib create mode 100644 components/properitary_rf/gzll/config/nrf_gzp_config.h create mode 100644 components/properitary_rf/gzll/gcc/gzll_gcc.a create mode 100644 components/properitary_rf/gzll/gcc/gzll_sd_resources_gcc.a create mode 100644 components/properitary_rf/gzll/iar/gzll_iar.a create mode 100644 components/properitary_rf/gzll/iar/gzll_sd_resource_iar.a create mode 100644 components/properitary_rf/gzll/nrf_gzll.h create mode 100644 components/properitary_rf/gzll/nrf_gzll_constants.h create mode 100644 components/properitary_rf/gzll/nrf_gzll_resources.h create mode 100644 components/properitary_rf/gzll/nrf_gzp.c create mode 100644 components/properitary_rf/gzll/nrf_gzp.h create mode 100644 components/properitary_rf/gzll/nrf_gzp_device.c create mode 100644 components/properitary_rf/gzll/nrf_gzp_host.c create mode 100644 components/properitary_rf/gzll/nrf_gzp_host_nrf51.c create mode 100644 components/serialization/application/codecs/common/ble_dtm_app.c create mode 100644 components/serialization/application/codecs/common/ble_dtm_app.h create mode 100644 components/serialization/application/codecs/common/ble_dtm_init.c create mode 100644 components/serialization/application/codecs/common/conn_systemreset.c create mode 100644 components/serialization/application/codecs/common/conn_systemreset.h create mode 100644 components/serialization/application/codecs/s110/middleware/app_mw_ble.c create mode 100644 components/serialization/application/codecs/s110/middleware/app_mw_ble_gap.c create mode 100644 components/serialization/application/codecs/s110/middleware/app_mw_ble_gattc.c create mode 100644 components/serialization/application/codecs/s110/middleware/app_mw_ble_gatts.c create mode 100644 components/serialization/application/codecs/s110/middleware/app_mw_ble_l2cap.c create mode 100644 components/serialization/application/codecs/s110/middleware/app_mw_nrf_soc.c create mode 100644 components/serialization/application/codecs/s110/serializers/app_ble_gap_sec_keys.c create mode 100644 components/serialization/application/codecs/s110/serializers/app_ble_gap_sec_keys.h create mode 100644 components/serialization/application/codecs/s110/serializers/app_ble_user_mem.c create mode 100644 components/serialization/application/codecs/s110/serializers/app_ble_user_mem.h create mode 100644 components/serialization/application/codecs/s110/serializers/ble_app.h create mode 100644 components/serialization/application/codecs/s110/serializers/ble_enable.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_event.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_evt_app.h create mode 100644 components/serialization/application/codecs/s110/serializers/ble_evt_tx_complete.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_evt_user_mem_release.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_evt_user_mem_request.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_address_get.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_address_set.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_adv_data_set.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_adv_start.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_adv_stop.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_app.h create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_appearance_get.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_appearance_set.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_auth_key_reply.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_authenticate.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_conn_param_update.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_conn_sec_get.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_connect.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_connect_cancel.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_device_name_get.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_device_name_set.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_disconnect.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_encrypt.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_evt_adv_report.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_evt_app.h create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_evt_auth_key_request.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_evt_auth_status.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_evt_conn_param_update.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_evt_conn_param_update_request.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_evt_conn_sec_update.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_evt_connected.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_evt_disconnected.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_evt_passkey_display.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_evt_rssi_changed.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_evt_scan_req_report.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_evt_sec_info_request.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_evt_sec_params_request.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_evt_sec_request.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_evt_timeout.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_ppcp_get.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_ppcp_set.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_rssi_get.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_rssi_start.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_rssi_stop.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_scan_start.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_scan_stop.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_sec_info_reply.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_sec_params_reply.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gap_tx_power_set.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gattc_app.h create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gattc_char_value_by_uuid_read.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gattc_char_values_read.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gattc_characteristics_discover.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gattc_descriptors_discover.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gattc_evt_app.h create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gattc_evt_char_disc_rsp.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gattc_evt_char_vals_read_rsp.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gattc_evt_desc_disc_rsp.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gattc_evt_hvx.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gattc_evt_read_rsp.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gattc_evt_rel_disc_rsp.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gattc_evt_timeout.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gattc_evt_write_rsp.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gattc_hv_confirm.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gattc_primary_services_discover.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gattc_read.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gattc_relationships_discover.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gattc_write.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gatts_app.h create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gatts_characteristic_add.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gatts_descriptor_add.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gatts_evt_app.h create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gatts_evt_hvc.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gatts_evt_rw_authorize_request.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gatts_evt_sc_confirm.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gatts_evt_sys_attr_missing.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gatts_evt_timeout.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gatts_evt_write.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gatts_hvx.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gatts_include_add.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gatts_rw_authorize_reply.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gatts_service_add.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gatts_service_changed.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gatts_sys_attr_get.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gatts_sys_attr_set.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gatts_value_get.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_gatts_value_set.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_l2cap_app.h create mode 100644 components/serialization/application/codecs/s110/serializers/ble_l2cap_cid_register.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_l2cap_cid_unregister.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_l2cap_evt_app.h create mode 100644 components/serialization/application/codecs/s110/serializers/ble_l2cap_evt_rx.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_l2cap_tx.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_opt_get.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_opt_set.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_tx_buffer_count_get.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_user_mem_reply.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_uuid_decode.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_uuid_encode.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_uuid_vs_add.c create mode 100644 components/serialization/application/codecs/s110/serializers/ble_version_get.c create mode 100644 components/serialization/application/codecs/s110/serializers/nrf_soc_app.h create mode 100644 components/serialization/application/codecs/s110/serializers/power_system_off.c create mode 100644 components/serialization/application/codecs/s110/serializers/temp_get.c create mode 100644 components/serialization/application/codecs/s120/middleware/app_mw_ble.c create mode 100644 components/serialization/application/codecs/s120/middleware/app_mw_ble_gap.c create mode 100644 components/serialization/application/codecs/s120/middleware/app_mw_ble_gattc.c create mode 100644 components/serialization/application/codecs/s120/middleware/app_mw_ble_gatts.c create mode 100644 components/serialization/application/codecs/s120/middleware/app_mw_ble_l2cap.c create mode 100644 components/serialization/application/codecs/s120/middleware/app_mw_nrf_soc.c create mode 100644 components/serialization/application/codecs/s120/serializers/app_ble_gap_sec_keys.c create mode 100644 components/serialization/application/codecs/s120/serializers/app_ble_gap_sec_keys.h create mode 100644 components/serialization/application/codecs/s120/serializers/app_ble_user_mem.c create mode 100644 components/serialization/application/codecs/s120/serializers/app_ble_user_mem.h create mode 100644 components/serialization/application/codecs/s120/serializers/ble_app.h create mode 100644 components/serialization/application/codecs/s120/serializers/ble_enable.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_event.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_evt_app.h create mode 100644 components/serialization/application/codecs/s120/serializers/ble_evt_tx_complete.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_evt_user_mem_release.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_evt_user_mem_request.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_address_get.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_address_set.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_adv_data_set.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_adv_start.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_adv_stop.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_app.h create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_appearance_get.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_appearance_set.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_auth_key_reply.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_authenticate.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_conn_param_update.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_conn_sec_get.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_connect.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_connect_cancel.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_device_name_get.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_device_name_set.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_disconnect.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_encrypt.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_evt_adv_report.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_evt_app.h create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_evt_auth_key_request.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_evt_auth_status.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_evt_conn_param_update.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_evt_conn_param_update_request.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_evt_conn_sec_update.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_evt_connected.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_evt_disconnected.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_evt_passkey_display.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_evt_rssi_changed.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_evt_scan_req_report.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_evt_sec_info_request.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_evt_sec_params_request.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_evt_sec_request.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_evt_timeout.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_ppcp_get.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_ppcp_set.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_rssi_get.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_rssi_start.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_rssi_stop.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_scan_start.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_scan_stop.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_sec_info_reply.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_sec_params_reply.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gap_tx_power_set.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gattc_app.h create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gattc_char_value_by_uuid_read.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gattc_char_values_read.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gattc_characteristics_discover.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gattc_descriptors_discover.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gattc_evt_app.h create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gattc_evt_char_disc_rsp.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gattc_evt_char_vals_read_rsp.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gattc_evt_desc_disc_rsp.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gattc_evt_hvx.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gattc_evt_read_rsp.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gattc_evt_rel_disc_rsp.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gattc_evt_timeout.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gattc_evt_write_rsp.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gattc_hv_confirm.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gattc_primary_services_discover.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gattc_read.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gattc_relationships_discover.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gattc_write.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gatts_app.h create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gatts_characteristic_add.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gatts_descriptor_add.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gatts_evt_app.h create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gatts_evt_hvc.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gatts_evt_rw_authorize_request.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gatts_evt_sc_confirm.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gatts_evt_sys_attr_missing.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gatts_evt_timeout.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gatts_evt_write.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gatts_hvx.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gatts_include_add.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gatts_rw_authorize_reply.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gatts_service_add.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gatts_service_changed.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gatts_sys_attr_get.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gatts_sys_attr_set.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gatts_value_get.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_gatts_value_set.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_l2cap_app.h create mode 100644 components/serialization/application/codecs/s120/serializers/ble_l2cap_cid_register.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_l2cap_cid_unregister.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_l2cap_evt_app.h create mode 100644 components/serialization/application/codecs/s120/serializers/ble_l2cap_evt_rx.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_l2cap_tx.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_opt_get.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_opt_set.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_tx_buffer_count_get.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_user_mem_reply.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_uuid_decode.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_uuid_encode.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_uuid_vs_add.c create mode 100644 components/serialization/application/codecs/s120/serializers/ble_version_get.c create mode 100644 components/serialization/application/codecs/s120/serializers/nrf_soc_app.h create mode 100644 components/serialization/application/codecs/s120/serializers/power_system_off.c create mode 100644 components/serialization/application/codecs/s120/serializers/temp_get.c create mode 100644 components/serialization/application/codecs/s130/middleware/app_mw_ble.c create mode 100644 components/serialization/application/codecs/s130/middleware/app_mw_ble_gap.c create mode 100644 components/serialization/application/codecs/s130/middleware/app_mw_ble_gattc.c create mode 100644 components/serialization/application/codecs/s130/middleware/app_mw_ble_gatts.c create mode 100644 components/serialization/application/codecs/s130/middleware/app_mw_ble_l2cap.c create mode 100644 components/serialization/application/codecs/s130/middleware/app_mw_nrf_soc.c create mode 100644 components/serialization/application/codecs/s130/serializers/app_ble_gap_sec_keys.c create mode 100644 components/serialization/application/codecs/s130/serializers/app_ble_gap_sec_keys.h create mode 100644 components/serialization/application/codecs/s130/serializers/app_ble_user_mem.c create mode 100644 components/serialization/application/codecs/s130/serializers/app_ble_user_mem.h create mode 100644 components/serialization/application/codecs/s130/serializers/ble_app.h create mode 100644 components/serialization/application/codecs/s130/serializers/ble_enable.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_event.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_evt_app.h create mode 100644 components/serialization/application/codecs/s130/serializers/ble_evt_tx_complete.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_evt_user_mem_release.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_evt_user_mem_request.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_address_get.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_address_set.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_adv_data_set.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_adv_start.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_adv_stop.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_app.h create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_appearance_get.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_appearance_set.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_auth_key_reply.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_authenticate.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_conn_param_update.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_conn_sec_get.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_connect.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_connect_cancel.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_device_name_get.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_device_name_set.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_disconnect.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_encrypt.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_evt_adv_report.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_evt_app.h create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_evt_auth_key_request.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_evt_auth_status.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_param_update.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_param_update_request.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_sec_update.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_evt_connected.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_evt_disconnected.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_evt_passkey_display.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_evt_rssi_changed.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_evt_scan_req_report.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_info_request.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_params_request.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_request.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_evt_timeout.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_ppcp_get.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_ppcp_set.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_rssi_get.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_rssi_start.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_rssi_stop.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_scan_start.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_scan_stop.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_sec_info_reply.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_sec_params_reply.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gap_tx_power_set.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gattc_app.h create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gattc_char_value_by_uuid_read.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gattc_char_values_read.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gattc_characteristics_discover.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gattc_descriptors_discover.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gattc_evt_app.h create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_disc_rsp.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_vals_read_rsp.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gattc_evt_desc_disc_rsp.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gattc_evt_hvx.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gattc_evt_read_rsp.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gattc_evt_rel_disc_rsp.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gattc_evt_timeout.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gattc_evt_write_rsp.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gattc_hv_confirm.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gattc_primary_services_discover.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gattc_read.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gattc_relationships_discover.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gattc_write.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gatts_app.h create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gatts_characteristic_add.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gatts_descriptor_add.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gatts_evt_app.h create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gatts_evt_hvc.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gatts_evt_rw_authorize_request.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gatts_evt_sc_confirm.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gatts_evt_sys_attr_missing.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gatts_evt_timeout.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gatts_evt_write.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gatts_hvx.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gatts_include_add.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gatts_rw_authorize_reply.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gatts_service_add.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gatts_service_changed.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gatts_sys_attr_get.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gatts_sys_attr_set.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gatts_value_get.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_gatts_value_set.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_l2cap_app.h create mode 100644 components/serialization/application/codecs/s130/serializers/ble_l2cap_cid_register.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_l2cap_cid_unregister.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_l2cap_evt_app.h create mode 100644 components/serialization/application/codecs/s130/serializers/ble_l2cap_evt_rx.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_l2cap_tx.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_opt_get.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_opt_set.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_tx_buffer_count_get.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_user_mem_reply.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_uuid_decode.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_uuid_encode.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_uuid_vs_add.c create mode 100644 components/serialization/application/codecs/s130/serializers/ble_version_get.c create mode 100644 components/serialization/application/codecs/s130/serializers/nrf_soc_app.h create mode 100644 components/serialization/application/codecs/s130/serializers/power_system_off.c create mode 100644 components/serialization/application/codecs/s130/serializers/temp_get.c create mode 100644 components/serialization/application/hal/arm_startup_nrf51.s create mode 100644 components/serialization/application/hal/ser_app_hal.h create mode 100644 components/serialization/application/hal/ser_app_hal_nrf51.c create mode 100644 components/serialization/application/hal/ser_app_power_system_off.c create mode 100644 components/serialization/application/hal/ser_app_power_system_off.h create mode 100644 components/serialization/application/transport/ser_sd_transport.c create mode 100644 components/serialization/application/transport/ser_sd_transport.h create mode 100644 components/serialization/application/transport/ser_softdevice_handler.c create mode 100644 components/serialization/application/transport/ser_softdevice_handler.h create mode 100644 components/serialization/common/ble_serialization.c create mode 100644 components/serialization/common/ble_serialization.h create mode 100644 components/serialization/common/cond_field_serialization.c create mode 100644 components/serialization/common/cond_field_serialization.h create mode 100644 components/serialization/common/ser_config.h create mode 100644 components/serialization/common/struct_ser/s110/ble_gap_struct_serialization.c create mode 100644 components/serialization/common/struct_ser/s110/ble_gap_struct_serialization.h create mode 100644 components/serialization/common/struct_ser/s110/ble_gattc_struct_serialization.c create mode 100644 components/serialization/common/struct_ser/s110/ble_gattc_struct_serialization.h create mode 100644 components/serialization/common/struct_ser/s110/ble_gatts_struct_serialization.c create mode 100644 components/serialization/common/struct_ser/s110/ble_gatts_struct_serialization.h create mode 100644 components/serialization/common/struct_ser/s110/ble_struct_serialization.c create mode 100644 components/serialization/common/struct_ser/s110/ble_struct_serialization.h create mode 100644 components/serialization/common/struct_ser/s120/ble_gap_struct_serialization.c create mode 100644 components/serialization/common/struct_ser/s120/ble_gap_struct_serialization.h create mode 100644 components/serialization/common/struct_ser/s120/ble_gattc_struct_serialization.c create mode 100644 components/serialization/common/struct_ser/s120/ble_gattc_struct_serialization.h create mode 100644 components/serialization/common/struct_ser/s120/ble_gatts_struct_serialization.c create mode 100644 components/serialization/common/struct_ser/s120/ble_gatts_struct_serialization.h create mode 100644 components/serialization/common/struct_ser/s120/ble_struct_serialization.c create mode 100644 components/serialization/common/struct_ser/s120/ble_struct_serialization.h create mode 100644 components/serialization/common/struct_ser/s130/ble_gap_struct_serialization.c create mode 100644 components/serialization/common/struct_ser/s130/ble_gap_struct_serialization.h create mode 100644 components/serialization/common/struct_ser/s130/ble_gattc_struct_serialization.c create mode 100644 components/serialization/common/struct_ser/s130/ble_gattc_struct_serialization.h create mode 100644 components/serialization/common/struct_ser/s130/ble_gatts_struct_serialization.c create mode 100644 components/serialization/common/struct_ser/s130/ble_gatts_struct_serialization.h create mode 100644 components/serialization/common/struct_ser/s130/ble_struct_serialization.c create mode 100644 components/serialization/common/struct_ser/s130/ble_struct_serialization.h create mode 100644 components/serialization/common/transport/debug/debug_hci_config_nrf6310.h create mode 100644 components/serialization/common/transport/debug/debug_hci_nrf6310.c create mode 100644 components/serialization/common/transport/dtm_uart_params.h create mode 100644 components/serialization/common/transport/ser_hal_transport.c create mode 100644 components/serialization/common/transport/ser_hal_transport.h create mode 100644 components/serialization/common/transport/ser_phy/config/ser_config_5W_app.h create mode 100644 components/serialization/common/transport/ser_phy/config/ser_phy_config_app_nrf51.h create mode 100644 components/serialization/common/transport/ser_phy/config/ser_phy_config_conn_nrf51.h create mode 100644 components/serialization/common/transport/ser_phy/config/ser_phy_debug_app.h create mode 100644 components/serialization/common/transport/ser_phy/config/ser_phy_debug_conn.h create mode 100644 components/serialization/common/transport/ser_phy/ser_phy.c create mode 100644 components/serialization/common/transport/ser_phy/ser_phy.h create mode 100644 components/serialization/common/transport/ser_phy/ser_phy_hci.c create mode 100644 components/serialization/common/transport/ser_phy/ser_phy_hci.h create mode 100644 components/serialization/common/transport/ser_phy/ser_phy_hci_slip.c create mode 100644 components/serialization/common/transport/ser_phy/ser_phy_nohci.c create mode 100644 components/serialization/common/transport/ser_phy/ser_phy_nrf51_nrf_drv_spi.c create mode 100644 components/serialization/common/transport/ser_phy/ser_phy_nrf51_spi_5W_master.c create mode 100644 components/serialization/common/transport/ser_phy/ser_phy_nrf51_spi_5W_slave.c create mode 100644 components/serialization/common/transport/ser_phy/ser_phy_nrf51_spi_slave.c create mode 100644 components/serialization/common/transport/ser_phy/ser_phy_nrf51_uart.c create mode 100644 components/serialization/common/transport/ser_phy/ser_phy_nrf51_uart_stm_app.c create mode 100644 components/serialization/common/transport/ser_phy/ser_phy_nrf51_uart_stm_conn.c create mode 100644 components/serialization/common/transport/ser_phy/spi_5W_master.c create mode 100644 components/serialization/common/transport/ser_phy/spi_5W_master.h create mode 100644 components/serialization/common/transport/ser_phy_debug_comm.h create mode 100644 components/serialization/connectivity/codecs/common/ble_dtm_conn.h create mode 100644 components/serialization/connectivity/codecs/common/ble_dtm_init.c create mode 100644 components/serialization/connectivity/codecs/common/conn_mw.c create mode 100644 components/serialization/connectivity/codecs/common/conn_mw.h create mode 100644 components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble.c create mode 100644 components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble.h create mode 100644 components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_gap.c create mode 100644 components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_gap.h create mode 100644 components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_gattc.c create mode 100644 components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_gattc.h create mode 100644 components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_gatts.c create mode 100644 components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_gatts.h create mode 100644 components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_l2cap.c create mode 100644 components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_l2cap.h create mode 100644 components/serialization/connectivity/codecs/s110/middleware/conn_mw_items.c create mode 100644 components/serialization/connectivity/codecs/s110/middleware/conn_mw_nrf_soc.c create mode 100644 components/serialization/connectivity/codecs/s110/middleware/conn_mw_nrf_soc.h create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_conn.h create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_enable.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_event.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_evt_conn.h create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_evt_tx_complete.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_evt_user_mem_release.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_evt_user_mem_request.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_address_get.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_address_set.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_adv_data_set.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_adv_start.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_adv_stop.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_appearance_get.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_appearance_set.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_auth_key_reply.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_authenticate.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_conn.h create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_conn_param_update.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_conn_sec_get.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_connect.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_connect_cancel.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_device_name_get.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_device_name_set.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_disconnect.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_encrypt.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_adv_report.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_auth_key_request.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_auth_status.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_conn.h create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_conn_param_update.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_conn_param_update_request.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_conn_sec_update.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_connected.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_disconnected.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_passkey_display.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_rssi_changed.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_scan_req_report.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_sec_info_request.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_sec_params_request.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_sec_request.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_timeout.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_ppcp_get.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_ppcp_set.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_rssi_get.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_rssi_start.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_rssi_stop.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_scan_start.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_scan_stop.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_sec_info_reply.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_sec_params_reply.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gap_tx_power_set.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gattc_char_value_by_uuid_read.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gattc_char_values_read.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gattc_characteristics_discover.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gattc_conn.h create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gattc_descriptors_discover.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_char_disc_rsp.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_char_vals_read_rsp.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_conn.h create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_desc_disc_rsp.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_hvx.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_read_rsp.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_rel_disc_rsp.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_timeout.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_write_rsp.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gattc_hv_confirm.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gattc_primary_services_discover.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gattc_read.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gattc_relationships_discover.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gattc_write.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gatts_characteristic_add.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gatts_conn.h create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gatts_descriptor_add.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_conn.h create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_hvc.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_rw_authorize_request.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_sc_confirm.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_sys_attr_missing.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_timeout.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_write.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gatts_hvx.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gatts_include_add.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gatts_rw_authorize_reply.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gatts_service_add.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gatts_service_changed.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gatts_sys_attr_get.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gatts_sys_attr_set.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gatts_value_get.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_gatts_value_set.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_l2cap_cid_register.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_l2cap_cid_unregister.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_l2cap_conn.h create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_l2cap_evt_conn.h create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_l2cap_evt_rx.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_l2cap_tx.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_opt_get.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_opt_id_pre_decoder.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_opt_set.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_tx_buffer_count_get.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_user_mem_reply.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_uuid_decode.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_uuid_encode.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_uuid_vs_add.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/ble_version_get.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/conn_ble_gap_sec_keys.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/conn_ble_gap_sec_keys.h create mode 100644 components/serialization/connectivity/codecs/s110/serializers/conn_ble_user_mem.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/conn_ble_user_mem.h create mode 100644 components/serialization/connectivity/codecs/s110/serializers/nrf_soc_conn.h create mode 100644 components/serialization/connectivity/codecs/s110/serializers/power_system_off.c create mode 100644 components/serialization/connectivity/codecs/s110/serializers/temp_get.c create mode 100644 components/serialization/connectivity/codecs/s120/middleware/conn_mw.h create mode 100644 components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble.c create mode 100644 components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble.h create mode 100644 components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_gap.c create mode 100644 components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_gap.h create mode 100644 components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_gattc.c create mode 100644 components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_gattc.h create mode 100644 components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_gatts.c create mode 100644 components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_gatts.h create mode 100644 components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_l2cap.c create mode 100644 components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_l2cap.h create mode 100644 components/serialization/connectivity/codecs/s120/middleware/conn_mw_items.c create mode 100644 components/serialization/connectivity/codecs/s120/middleware/conn_mw_nrf_soc.c create mode 100644 components/serialization/connectivity/codecs/s120/middleware/conn_mw_nrf_soc.h create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_conn.h create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_enable.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_event.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_evt_conn.h create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_evt_tx_complete.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_evt_user_mem_release.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_evt_user_mem_request.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_address_get.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_address_set.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_adv_data_set.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_adv_start.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_adv_stop.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_appearance_get.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_appearance_set.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_auth_key_reply.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_authenticate.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_conn.h create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_conn_param_update.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_conn_sec_get.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_connect.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_connect_cancel.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_device_name_get.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_device_name_set.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_disconnect.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_encrypt.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_adv_report.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_auth_key_request.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_auth_status.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_conn.h create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_conn_param_update.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_conn_param_update_request.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_conn_sec_update.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_connected.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_disconnected.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_passkey_display.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_rssi_changed.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_scan_req_report.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_sec_info_request.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_sec_params_request.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_sec_request.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_timeout.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_ppcp_get.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_ppcp_set.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_rssi_get.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_rssi_start.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_rssi_stop.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_scan_start.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_scan_stop.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_sec_info_reply.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_sec_params_reply.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gap_tx_power_set.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gattc_char_value_by_uuid_read.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gattc_char_values_read.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gattc_characteristics_discover.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gattc_conn.h create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gattc_descriptors_discover.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_char_disc_rsp.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_char_vals_read_rsp.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_conn.h create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_desc_disc_rsp.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_hvx.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_read_rsp.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_rel_disc_rsp.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_timeout.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_write_rsp.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gattc_hv_confirm.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gattc_primary_services_discover.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gattc_read.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gattc_relationships_discover.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gattc_write.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gatts_characteristic_add.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gatts_conn.h create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gatts_descriptor_add.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_conn.h create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_hvc.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_rw_authorize_request.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_sc_confirm.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_sys_attr_missing.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_timeout.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_write.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gatts_hvx.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gatts_include_add.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gatts_rw_authorize_reply.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gatts_service_add.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gatts_service_changed.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gatts_sys_attr_get.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gatts_sys_attr_set.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gatts_value_get.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_gatts_value_set.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_l2cap_cid_register.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_l2cap_cid_unregister.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_l2cap_conn.h create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_l2cap_evt_conn.h create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_l2cap_evt_rx.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_l2cap_tx.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_opt_get.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_opt_id_pre_decoder.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_opt_set.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_tx_buffer_count_get.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_user_mem_reply.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_uuid_decode.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_uuid_encode.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_uuid_vs_add.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/ble_version_get.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/conn_ble_gap_sec_keys.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/conn_ble_gap_sec_keys.h create mode 100644 components/serialization/connectivity/codecs/s120/serializers/conn_ble_user_mem.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/conn_ble_user_mem.h create mode 100644 components/serialization/connectivity/codecs/s120/serializers/nrf_soc_conn.h create mode 100644 components/serialization/connectivity/codecs/s120/serializers/power_system_off.c create mode 100644 components/serialization/connectivity/codecs/s120/serializers/temp_get.c create mode 100644 components/serialization/connectivity/codecs/s130/middleware/conn_mw.h create mode 100644 components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble.c create mode 100644 components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble.h create mode 100644 components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gap.c create mode 100644 components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gap.h create mode 100644 components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gattc.c create mode 100644 components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gattc.h create mode 100644 components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gatts.c create mode 100644 components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gatts.h create mode 100644 components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_l2cap.c create mode 100644 components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_l2cap.h create mode 100644 components/serialization/connectivity/codecs/s130/middleware/conn_mw_items.c create mode 100644 components/serialization/connectivity/codecs/s130/middleware/conn_mw_nrf_soc.c create mode 100644 components/serialization/connectivity/codecs/s130/middleware/conn_mw_nrf_soc.h create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_conn.h create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_enable.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_event.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_evt_conn.h create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_evt_tx_complete.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_evt_user_mem_release.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_evt_user_mem_request.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_address_get.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_address_set.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_adv_data_set.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_adv_start.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_adv_stop.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_appearance_get.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_appearance_set.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_auth_key_reply.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_authenticate.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_conn.h create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_conn_param_update.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_conn_sec_get.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_connect.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_connect_cancel.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_device_name_get.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_device_name_set.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_disconnect.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_encrypt.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_adv_report.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_auth_key_request.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_auth_status.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_conn.h create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_conn_param_update.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_conn_param_update_request.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_conn_sec_update.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_connected.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_disconnected.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_passkey_display.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_rssi_changed.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_scan_req_report.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_sec_info_request.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_sec_params_request.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_sec_request.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_timeout.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_ppcp_get.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_ppcp_set.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_rssi_get.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_rssi_start.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_rssi_stop.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_scan_start.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_scan_stop.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_sec_info_reply.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_sec_params_reply.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gap_tx_power_set.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gattc_char_value_by_uuid_read.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gattc_char_values_read.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gattc_characteristics_discover.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gattc_conn.h create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gattc_descriptors_discover.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_char_disc_rsp.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_char_vals_read_rsp.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_conn.h create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_desc_disc_rsp.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_hvx.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_read_rsp.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_rel_disc_rsp.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_timeout.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_write_rsp.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gattc_hv_confirm.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gattc_primary_services_discover.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gattc_read.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gattc_relationships_discover.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gattc_write.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gatts_characteristic_add.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gatts_conn.h create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gatts_descriptor_add.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_conn.h create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_hvc.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_rw_authorize_request.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_sc_confirm.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_sys_attr_missing.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_timeout.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_write.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gatts_hvx.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gatts_include_add.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gatts_rw_authorize_reply.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gatts_service_add.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gatts_service_changed.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gatts_sys_attr_get.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gatts_sys_attr_set.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gatts_value_get.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_gatts_value_set.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_l2cap_cid_register.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_l2cap_cid_unregister.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_l2cap_conn.h create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_l2cap_evt_conn.h create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_l2cap_evt_rx.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_l2cap_tx.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_opt_get.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_opt_id_pre_decoder.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_opt_set.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_tx_buffer_count_get.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_user_mem_reply.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_uuid_decode.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_uuid_encode.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_uuid_vs_add.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/ble_version_get.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/conn_ble_gap_sec_keys.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/conn_ble_gap_sec_keys.h create mode 100644 components/serialization/connectivity/codecs/s130/serializers/conn_ble_user_mem.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/conn_ble_user_mem.h create mode 100644 components/serialization/connectivity/codecs/s130/serializers/nrf_soc_conn.h create mode 100644 components/serialization/connectivity/codecs/s130/serializers/power_system_off.c create mode 100644 components/serialization/connectivity/codecs/s130/serializers/temp_get.c create mode 100644 components/serialization/connectivity/hal/dtm_uart.c create mode 100644 components/serialization/connectivity/hal/dtm_uart.h create mode 100644 components/serialization/connectivity/pstorage_platform.h create mode 100644 components/serialization/connectivity/ser_conn_cmd_decoder.c create mode 100644 components/serialization/connectivity/ser_conn_cmd_decoder.h create mode 100644 components/serialization/connectivity/ser_conn_dtm_cmd_decoder.c create mode 100644 components/serialization/connectivity/ser_conn_dtm_cmd_decoder.h create mode 100644 components/serialization/connectivity/ser_conn_error_handling.c create mode 100644 components/serialization/connectivity/ser_conn_event_encoder.c create mode 100644 components/serialization/connectivity/ser_conn_event_encoder.h create mode 100644 components/serialization/connectivity/ser_conn_handlers.c create mode 100644 components/serialization/connectivity/ser_conn_handlers.h create mode 100644 components/serialization/connectivity/ser_conn_pkt_decoder.c create mode 100644 components/serialization/connectivity/ser_conn_pkt_decoder.h create mode 100644 components/serialization/connectivity/ser_conn_reset_cmd_decoder.c create mode 100644 components/serialization/connectivity/ser_conn_reset_cmd_decoder.h create mode 100644 components/serialization/connectivity/startup/arm/arm_startup_nrf51.s create mode 100644 components/softdevice/common/softdevice_handler/ant_stack_handler_types.h create mode 100644 components/softdevice/common/softdevice_handler/ble_stack_handler_types.h create mode 100644 components/softdevice/common/softdevice_handler/softdevice_handler.c create mode 100644 components/softdevice/common/softdevice_handler/softdevice_handler.h create mode 100644 components/softdevice/common/softdevice_handler/softdevice_handler_appsh.c create mode 100644 components/softdevice/common/softdevice_handler/softdevice_handler_appsh.h create mode 100644 components/softdevice/s110/doc/s110_nrf51822_8.0.0_migration_document.pdf create mode 100644 components/softdevice/s110/doc/s110_nrf51_8.0.0_licence-agreement.pdf create mode 100644 components/softdevice/s110/doc/s110_nrf51_8.0.0_licence-agreement.txt create mode 100644 components/softdevice/s110/doc/s110_nrf51_8.0.0_readme.txt create mode 100644 components/softdevice/s110/doc/s110_nrf51_8.0.0_release-notes.pdf create mode 100644 components/softdevice/s110/headers/ble.h create mode 100644 components/softdevice/s110/headers/ble_err.h create mode 100644 components/softdevice/s110/headers/ble_gap.h create mode 100644 components/softdevice/s110/headers/ble_gatt.h create mode 100644 components/softdevice/s110/headers/ble_gattc.h create mode 100644 components/softdevice/s110/headers/ble_gatts.h create mode 100644 components/softdevice/s110/headers/ble_hci.h create mode 100644 components/softdevice/s110/headers/ble_l2cap.h create mode 100644 components/softdevice/s110/headers/ble_ranges.h create mode 100644 components/softdevice/s110/headers/ble_types.h create mode 100644 components/softdevice/s110/headers/nrf_error.h create mode 100644 components/softdevice/s110/headers/nrf_error_sdm.h create mode 100644 components/softdevice/s110/headers/nrf_error_soc.h create mode 100644 components/softdevice/s110/headers/nrf_mbr.h create mode 100644 components/softdevice/s110/headers/nrf_sd_def.h create mode 100644 components/softdevice/s110/headers/nrf_sdm.h create mode 100644 components/softdevice/s110/headers/nrf_soc.h create mode 100644 components/softdevice/s110/headers/nrf_svc.h create mode 100644 components/softdevice/s110/headers/softdevice_assert.h create mode 100644 components/softdevice/s110/hex/s110_nrf51_8.0.0_softdevice.hex create mode 100644 components/softdevice/s110/toolchain/armgcc/armgcc_s110_nrf51422_xxaa.ld create mode 100644 components/softdevice/s110/toolchain/armgcc/armgcc_s110_nrf51422_xxac.ld create mode 100644 components/softdevice/s110/toolchain/armgcc/armgcc_s110_nrf51822_xxaa.ld create mode 100644 components/softdevice/s110/toolchain/armgcc/armgcc_s110_nrf51822_xxab.ld create mode 100644 components/softdevice/s110/toolchain/iar/iar_s110_nrf51422_xxaa.icf create mode 100644 components/softdevice/s110/toolchain/iar/iar_s110_nrf51422_xxac.icf create mode 100644 components/softdevice/s110/toolchain/iar/iar_s110_nrf51822_xxaa.icf create mode 100644 components/softdevice/s110/toolchain/iar/iar_s110_nrf51822_xxab.icf create mode 100644 components/softdevice/s120/doc/s120_nrf51822_2.0.0_licence_agreement.txt create mode 100644 components/softdevice/s120/doc/s120_nrf51_2.1.0_licence_agreement.pdf create mode 100644 components/softdevice/s120/doc/s120_nrf51_2.1.0_readme.txt create mode 100644 components/softdevice/s120/doc/s120_nrf51_2.1.0_releasenotes.pdf create mode 100644 components/softdevice/s120/headers/ble.h create mode 100644 components/softdevice/s120/headers/ble_err.h create mode 100644 components/softdevice/s120/headers/ble_gap.h create mode 100644 components/softdevice/s120/headers/ble_gatt.h create mode 100644 components/softdevice/s120/headers/ble_gattc.h create mode 100644 components/softdevice/s120/headers/ble_gatts.h create mode 100644 components/softdevice/s120/headers/ble_hci.h create mode 100644 components/softdevice/s120/headers/ble_l2cap.h create mode 100644 components/softdevice/s120/headers/ble_ranges.h create mode 100644 components/softdevice/s120/headers/ble_types.h create mode 100644 components/softdevice/s120/headers/nrf_error.h create mode 100644 components/softdevice/s120/headers/nrf_error_sdm.h create mode 100644 components/softdevice/s120/headers/nrf_error_soc.h create mode 100644 components/softdevice/s120/headers/nrf_mbr.h create mode 100644 components/softdevice/s120/headers/nrf_sd_def.h create mode 100644 components/softdevice/s120/headers/nrf_sdm.h create mode 100644 components/softdevice/s120/headers/nrf_soc.h create mode 100644 components/softdevice/s120/headers/nrf_svc.h create mode 100644 components/softdevice/s120/headers/softdevice_assert.h create mode 100644 components/softdevice/s120/hex/s120_nrf51_2.1.0_softdevice.hex create mode 100644 components/softdevice/s120/toolchain/armgcc/armgcc_s120_nrf51422_xxaa.ld create mode 100644 components/softdevice/s120/toolchain/armgcc/armgcc_s120_nrf51422_xxac.ld create mode 100644 components/softdevice/s120/toolchain/armgcc/armgcc_s120_nrf51822_xxaa.ld create mode 100644 components/softdevice/s120/toolchain/armgcc/armgcc_s120_nrf51822_xxab.ld create mode 100644 components/softdevice/s120/toolchain/iar/iar_s120_nrf51422_xxaa.icf create mode 100644 components/softdevice/s120/toolchain/iar/iar_s120_nrf51422_xxac.icf create mode 100644 components/softdevice/s120/toolchain/iar/iar_s120_nrf51822_xxaa.icf create mode 100644 components/softdevice/s120/toolchain/iar/iar_s120_nrf51822_xxab.icf create mode 100644 components/softdevice/s130/doc/s130_nrf51822_1.0.0_licence_agreement.pdf create mode 100644 components/softdevice/s130/doc/s130_nrf51822_1.0.0_licence_agreement.txt create mode 100644 components/softdevice/s130/doc/s130_nrf51822_1.0.0_readme.txt create mode 100644 components/softdevice/s130/doc/s130_nrf51822_1.0.0_releasenotes.pdf create mode 100644 components/softdevice/s130/headers/ble.h create mode 100644 components/softdevice/s130/headers/ble_err.h create mode 100644 components/softdevice/s130/headers/ble_gap.h create mode 100644 components/softdevice/s130/headers/ble_gatt.h create mode 100644 components/softdevice/s130/headers/ble_gattc.h create mode 100644 components/softdevice/s130/headers/ble_gatts.h create mode 100644 components/softdevice/s130/headers/ble_hci.h create mode 100644 components/softdevice/s130/headers/ble_l2cap.h create mode 100644 components/softdevice/s130/headers/ble_ranges.h create mode 100644 components/softdevice/s130/headers/ble_types.h create mode 100644 components/softdevice/s130/headers/nrf_error.h create mode 100644 components/softdevice/s130/headers/nrf_error_sdm.h create mode 100644 components/softdevice/s130/headers/nrf_error_soc.h create mode 100644 components/softdevice/s130/headers/nrf_mbr.h create mode 100644 components/softdevice/s130/headers/nrf_sd_def.h create mode 100644 components/softdevice/s130/headers/nrf_sdm.h create mode 100644 components/softdevice/s130/headers/nrf_soc.h create mode 100644 components/softdevice/s130/headers/nrf_svc.h create mode 100644 components/softdevice/s130/headers/softdevice_assert.h create mode 100644 components/softdevice/s130/hex/s130_nrf51_1.0.0_softdevice.hex create mode 100644 components/softdevice/s130/toolchain/armgcc/armgcc_s130_nrf51422_xxaa.ld create mode 100644 components/softdevice/s130/toolchain/armgcc/armgcc_s130_nrf51422_xxac.ld create mode 100644 components/softdevice/s130/toolchain/armgcc/armgcc_s130_nrf51822_xxaa.ld create mode 100644 components/softdevice/s130/toolchain/armgcc/armgcc_s130_nrf51822_xxab.ld create mode 100644 components/softdevice/s130/toolchain/iar/iar_s130_nrf51422_xxaa.icf create mode 100644 components/softdevice/s130/toolchain/iar/iar_s130_nrf51422_xxac.icf create mode 100644 components/softdevice/s130/toolchain/iar/iar_s130_nrf51822_xxaa.icf create mode 100644 components/softdevice/s130/toolchain/iar/iar_s130_nrf51822_xxab.icf create mode 100644 components/softdevice/s210/doc/s210_nrf51422_5.0.0_licence_agreement.pdf create mode 100644 components/softdevice/s210/doc/s210_nrf51422_5.0.0_licence_agreement.txt create mode 100644 components/softdevice/s210/doc/s210_nrf51422_5.0.0_migration_document.pdf create mode 100644 components/softdevice/s210/doc/s210_nrf51422_5.0.0_readme.txt create mode 100644 components/softdevice/s210/doc/s210_nrf51422_5.0.0_releasenotes.pdf create mode 100644 components/softdevice/s210/headers/ant_error.h create mode 100644 components/softdevice/s210/headers/ant_interface.h create mode 100644 components/softdevice/s210/headers/ant_parameters.h create mode 100644 components/softdevice/s210/headers/nrf_error.h create mode 100644 components/softdevice/s210/headers/nrf_error_sdm.h create mode 100644 components/softdevice/s210/headers/nrf_error_soc.h create mode 100644 components/softdevice/s210/headers/nrf_mbr.h create mode 100644 components/softdevice/s210/headers/nrf_sd_def.h create mode 100644 components/softdevice/s210/headers/nrf_sdm.h create mode 100644 components/softdevice/s210/headers/nrf_soc.h create mode 100644 components/softdevice/s210/headers/nrf_svc.h create mode 100644 components/softdevice/s210/headers/softdevice_assert.h create mode 100644 components/softdevice/s210/hex/s210_nrf51422_5.0.0_softdevice.hex create mode 100644 components/softdevice/s210/toolchain/armgcc/armgcc_s210_nrf51422_xxaa.ld create mode 100644 components/softdevice/s210/toolchain/armgcc/armgcc_s210_nrf51422_xxac.ld create mode 100644 components/softdevice/s210/toolchain/iar/iar_s210_nrf51422_xxaa.icf create mode 100644 components/softdevice/s210/toolchain/iar/iar_s210_nrf51422_xxac.icf create mode 100644 components/softdevice/s310/doc/s310_nrf51822_3.0.0_licence_agreement.pdf create mode 100644 components/softdevice/s310/doc/s310_nrf51822_3.0.0_licence_agreement.txt create mode 100644 components/softdevice/s310/doc/s310_nrf51822_3.0.0_migration_document.pdf create mode 100644 components/softdevice/s310/doc/s310_nrf51822_3.0.0_readme.txt create mode 100644 components/softdevice/s310/doc/s310_nrf51822_3.0.0_releasenotes.pdf create mode 100644 components/softdevice/s310/headers/ant_error.h create mode 100644 components/softdevice/s310/headers/ant_interface.h create mode 100644 components/softdevice/s310/headers/ant_parameters.h create mode 100644 components/softdevice/s310/headers/ble.h create mode 100644 components/softdevice/s310/headers/ble_err.h create mode 100644 components/softdevice/s310/headers/ble_gap.h create mode 100644 components/softdevice/s310/headers/ble_gatt.h create mode 100644 components/softdevice/s310/headers/ble_gattc.h create mode 100644 components/softdevice/s310/headers/ble_gatts.h create mode 100644 components/softdevice/s310/headers/ble_hci.h create mode 100644 components/softdevice/s310/headers/ble_l2cap.h create mode 100644 components/softdevice/s310/headers/ble_ranges.h create mode 100644 components/softdevice/s310/headers/ble_types.h create mode 100644 components/softdevice/s310/headers/nrf_error.h create mode 100644 components/softdevice/s310/headers/nrf_error_sdm.h create mode 100644 components/softdevice/s310/headers/nrf_error_soc.h create mode 100644 components/softdevice/s310/headers/nrf_mbr.h create mode 100644 components/softdevice/s310/headers/nrf_sd_def.h create mode 100644 components/softdevice/s310/headers/nrf_sdm.h create mode 100644 components/softdevice/s310/headers/nrf_soc.h create mode 100644 components/softdevice/s310/headers/nrf_svc.h create mode 100644 components/softdevice/s310/headers/softdevice_assert.h create mode 100644 components/softdevice/s310/hex/s310_nrf51422_3.0.0_softdevice.hex create mode 100644 components/softdevice/s310/toolchain/armgcc/armgcc_s310_nrf51422_xxaa.ld create mode 100644 components/softdevice/s310/toolchain/armgcc/armgcc_s310_nrf51422_xxac.ld create mode 100644 components/softdevice/s310/toolchain/iar/iar_s310_nrf51422_xxaa.icf create mode 100644 components/softdevice/s310/toolchain/iar/iar_s310_nrf51422_xxac.icf create mode 100644 components/toolchain/arm/arm_startup_nrf51.s create mode 100644 components/toolchain/arm/arm_startup_nrf52.s create mode 100644 components/toolchain/arm/uicr_config.h create mode 100644 components/toolchain/gcc/Makefile.common create mode 100644 components/toolchain/gcc/Makefile.posix create mode 100644 components/toolchain/gcc/Makefile.windows create mode 100644 components/toolchain/gcc/arm_common_tables.h create mode 100644 components/toolchain/gcc/arm_const_structs.h create mode 100644 components/toolchain/gcc/arm_math.h create mode 100644 components/toolchain/gcc/core_cm0.h create mode 100644 components/toolchain/gcc/core_cm4.h create mode 100644 components/toolchain/gcc/core_cmFunc.h create mode 100644 components/toolchain/gcc/core_cmInstr.h create mode 100644 components/toolchain/gcc/core_cmSimd.h create mode 100644 components/toolchain/gcc/gcc_nrf51_common.ld create mode 100644 components/toolchain/gcc/gcc_startup_nrf51.s create mode 100644 components/toolchain/gcc/gcc_startup_nrf52.s create mode 100644 components/toolchain/gcc/nrf51_common.ld create mode 100644 components/toolchain/gcc/nrf51_xxaa.ld create mode 100644 components/toolchain/gcc/nrf51_xxab.ld create mode 100644 components/toolchain/gcc/nrf51_xxac.ld create mode 100644 components/toolchain/gcc/nrf52_common.ld create mode 100644 components/toolchain/gcc/nrf52_xxaa.ld create mode 100644 components/toolchain/gcc/nrf5x_common.ld create mode 100644 components/toolchain/iar/iar_nrf51_blank_xxaa.icf create mode 100644 components/toolchain/iar/iar_nrf51_blank_xxac.icf create mode 100644 components/toolchain/iar/iar_startup_nrf51.s create mode 100644 components/toolchain/iar/iar_startup_nrf52.s create mode 100644 components/toolchain/system_nrf51.c create mode 100644 components/toolchain/system_nrf51.h create mode 100644 components/toolchain/system_nrf51422.c create mode 100644 components/toolchain/system_nrf52.c create mode 100644 components/toolchain/system_nrf52.h create mode 100644 config/bsp.h create mode 100644 config/nrf_drv_config.h create mode 100644 docs/index.html create mode 100644 main.c diff --git a/EPD/DEV_Config.c b/EPD/DEV_Config.c new file mode 100644 index 0000000..75dafe4 --- /dev/null +++ b/EPD/DEV_Config.c @@ -0,0 +1,91 @@ +/***************************************************************************** +* | File : DEV_Config.cpp +* | Author : Waveshare team +* | Function : +* | Info : +* Image scanning +* Please use progressive scanning to generate images or fonts +*---------------- +* | This version: V1.0 +* | Date : 2018-01-11 +* | Info : Basic version +* +******************************************************************************/ +#include "nrf_drv_spi.h" +#include "DEV_Config.h" + +#include +#include +#include + +uint32_t EPD_MOSI_PIN = 5; +uint32_t EPD_SCLK_PIN = 8; +uint32_t EPD_CS_PIN = 9; +uint32_t EPD_DC_PIN = 10; +uint32_t EPD_RST_PIN = 11; +uint32_t EPD_BUSY_PIN = 12; +uint32_t EPD_BS_PIN = 13; + +static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(0); + +/****************************************************************************** +function: Initialize Arduino, Initialize Pins, and SPI +parameter: +Info: +******************************************************************************/ +UBYTE DEV_Module_Init(void) +{ + nrf_gpio_cfg_output(EPD_CS_PIN); + nrf_gpio_cfg_output(EPD_DC_PIN); + nrf_gpio_cfg_output(EPD_RST_PIN); + nrf_gpio_cfg_input(EPD_BUSY_PIN, NRF_GPIO_PIN_NOPULL); + + nrf_gpio_cfg_output(EPD_BS_PIN); + DEV_Digital_Write(EPD_BS_PIN, 0); + + nrf_drv_spi_config_t spi_config = + { + .sck_pin = EPD_SCLK_PIN, + .mosi_pin = EPD_MOSI_PIN, + .miso_pin = NRF_DRV_SPI_PIN_NOT_USED, + .ss_pin = NRF_DRV_SPI_PIN_NOT_USED, + .frequency = NRF_DRV_SPI_FREQ_4M, + .mode = NRF_DRV_SPI_MODE_0, + }; + nrf_drv_spi_init(&spi, &spi_config, NULL); + + DEV_Digital_Write(EPD_DC_PIN, 0); + DEV_Digital_Write(EPD_CS_PIN, 0); + DEV_Digital_Write(EPD_RST_PIN, 1); + + return 0; +} + +/********************************************* +function: Hardware interface +note: + SPI4W_Write_Byte(value) : + Register hardware SPI +*********************************************/ +void DEV_SPI_WriteByte(UBYTE value) +{ + nrf_drv_spi_transfer(&spi, &value, 1, NULL, 0); +} + +UBYTE DEV_SPI_ReadByte(void) +{ + UBYTE value; + nrf_drv_spi_transfer(&spi, NULL, 0, &value, 1); + return value; +} + +void DEV_Module_Exit(void) +{ + DEV_Digital_Write(EPD_DC_PIN, 0); + DEV_Digital_Write(EPD_CS_PIN, 0); + + //close 5V + DEV_Digital_Write(EPD_RST_PIN, 0); + + nrf_drv_spi_uninit(&spi); +} diff --git a/EPD/DEV_Config.h b/EPD/DEV_Config.h new file mode 100644 index 0000000..5c01b8f --- /dev/null +++ b/EPD/DEV_Config.h @@ -0,0 +1,56 @@ +/***************************************************************************** +* | File : DEV_Config.h +* | Author : Waveshare team +* | Function : debug with prntf +* | Info : +* Image scanning +* Please use progressive scanning to generate images or fonts +*---------------- +* | This version: V1.0 +* | Date : 2018-01-11 +* | Info : Basic version +* +******************************************************************************/ +#ifndef _DEV_CONFIG_H_ +#define _DEV_CONFIG_H_ + +#include "nrf_delay.h" +#include "nrf_gpio.h" +#include +#include + +/** + * data +**/ +#define UBYTE uint8_t +#define UWORD uint16_t +#define UDOUBLE uint32_t + +extern uint32_t EPD_MOSI_PIN; +extern uint32_t EPD_SCLK_PIN; +extern uint32_t EPD_CS_PIN; +extern uint32_t EPD_DC_PIN; +extern uint32_t EPD_RST_PIN; +extern uint32_t EPD_BUSY_PIN; +extern uint32_t EPD_BS_PIN; + +/** + * GPIO read and write +**/ +#define DEV_Digital_Write(_pin, _value) nrf_gpio_pin_write(_pin, _value) +#define DEV_Digital_Read(_pin) nrf_gpio_pin_read(_pin) + + +/** + * delay x ms +**/ +#define DEV_Delay_ms(__xms) nrf_delay_ms(__xms); +#define DEV_Delay_us(__xus) nrf_delay_us(__xus); + +UBYTE DEV_Module_Init(void); +void DEV_Module_Exit(void); + +void DEV_SPI_WriteByte(UBYTE value); +UBYTE DEV_SPI_ReadByte(void); + +#endif diff --git a/EPD/EPD_4in2.c b/EPD/EPD_4in2.c new file mode 100644 index 0000000..5ab20cb --- /dev/null +++ b/EPD/EPD_4in2.c @@ -0,0 +1,582 @@ +/***************************************************************************** +* | File : EPD_4in2.c +* | Author : Waveshare team +* | Function : 4.2inch e-paper +* | Info : +*---------------- +* | This version: V3.0 +* | Date : 2019-06-13 +* | Info : +* ----------------------------------------------------------------------------- +* V3.0(2019-06-13): +* 1.Change: +* lut_vcomDC[] => EPD_4IN2_lut_vcomDC[] +* lut_ww[] => EPD_4IN2_lut_ww[] +* lut_bw[] => EPD_4IN2_lut_bw[] +* lut_wb[] => EPD_4IN2_lut_wb[] +* lut_bb[] => EPD_4IN2_lut_bb[] +* EPD_Reset() => EPD_4IN2_Reset() +* EPD_SendCommand() => EPD_4IN2_SendCommand() +* EPD_SendData() => EPD_4IN2_SendData() +* EPD_WaitUntilIdle() => EPD_4IN2_ReadBusy() +* EPD_SetFullReg() => EPD_4IN2_SetFullReg() +* EPD_SetPartReg() => EPD_4IN2_SetPartReg() +* EPD_TurnOnDisplay() => EPD_4IN2_TurnOnDisplay() +* EPD_Init() => EPD_4IN2_Init() +* EPD_Clear() => EPD_4IN2_Clear() +* EPD_Display() => EPD_4IN2_Display() +* EPD_Sleep() => EPD_4IN2_Sleep() +* 2.remove commands define: +* #define PANEL_SETTING 0x00 +* #define POWER_SETTING 0x01 +* #define POWER_OFF 0x02 +* #define POWER_OFF_SEQUENCE_SETTING 0x03 +* #define POWER_ON 0x04 +* #define POWER_ON_MEASURE 0x05 +* #define BOOSTER_SOFT_START 0x06 +* #define DEEP_SLEEP 0x07 +* #define DATA_START_TRANSMISSION_1 0x10 +* #define DATA_STOP 0x11 +* #define DISPLAY_REFRESH 0x12 +* #define DATA_START_TRANSMISSION_2 0x13 +* #define VCOM_LUT 0x20 +* #define W2W_LUT 0x21 +* #define B2W_LUT 0x22 +* #define W2B_LUT 0x23 +* #define B2B_LUT 0x24 +* #define PLL_CONTROL 0x30 +* #define TEMPERATURE_SENSOR_CALIBRATION 0x40 +* #define TEMPERATURE_SENSOR_SELECTION 0x41 +* #define TEMPERATURE_SENSOR_WRITE 0x42 +* #define TEMPERATURE_SENSOR_READ 0x43 +* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50 +* #define LOW_POWER_DETECTION 0x51 +* #define TCON_SETTING 0x60 +* #define RESOLUTION_SETTING 0x61 +* #define GET_STATUS 0x71 +* #define AUTO_MEASURE_VCOM 0x80 +* #define READ_VCOM_VALUE 0x81 +* #define VCM_DC_SETTING 0x82 +* #define PARTIAL_WINDOW 0x90 +* #define PARTIAL_IN 0x91 +* #define PARTIAL_OUT 0x92 +* #define PROGRAM_MODE 0xA0 +* #define ACTIVE_PROGRAM 0xA1 +* #define READ_OTP_DATA 0xA2 +* #define POWER_SAVING 0xE3 +* V2.0(2018-10-30): +* 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8] +* 2.Change:EPD_Display(UBYTE *Image) +* Need to pass parameters: pointer to cached data +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documnetation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +******************************************************************************/ +#include "EPD_4in2.h" + +static const unsigned char EPD_4IN2_lut_vcom0[] = { + 0x00, 0x08, 0x08, 0x00, 0x00, 0x02, + 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x01, + 0x00, 0x08, 0x08, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, + }; +static const unsigned char EPD_4IN2_lut_ww[] = { + 0x50, 0x08, 0x08, 0x00, 0x00, 0x02, + 0x90, 0x0F, 0x0F, 0x00, 0x00, 0x01, + 0xA0, 0x08, 0x08, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }; +static const unsigned char EPD_4IN2_lut_bw[] = { + 0x50, 0x08, 0x08, 0x00, 0x00, 0x02, + 0x90, 0x0F, 0x0F, 0x00, 0x00, 0x01, + 0xA0, 0x08, 0x08, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }; +static const unsigned char EPD_4IN2_lut_wb[] = { + 0xA0, 0x08, 0x08, 0x00, 0x00, 0x02, + 0x90, 0x0F, 0x0F, 0x00, 0x00, 0x01, + 0x50, 0x08, 0x08, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }; +static const unsigned char EPD_4IN2_lut_bb[] = { + 0x20, 0x08, 0x08, 0x00, 0x00, 0x02, + 0x90, 0x0F, 0x0F, 0x00, 0x00, 0x01, + 0x10, 0x08, 0x08, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }; + +/******************************partial screen update LUT*********************************/ +const unsigned char EPD_4IN2_Partial_lut_vcom1[] ={ + 0x00, 0x01, 0x20, 0x01, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +const unsigned char EPD_4IN2_Partial_lut_ww1[] ={ + 0x00, 0x01, 0x20, 0x01, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +const unsigned char EPD_4IN2_Partial_lut_bw1[] ={ + 0x20, 0x01, 0x20, 0x01, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +const unsigned char EPD_4IN2_Partial_lut_wb1[] ={ + 0x10, 0x01, 0x20, 0x01, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +const unsigned char EPD_4IN2_Partial_lut_bb1[] ={ + 0x00, 0x01,0x20, 0x01, 0x00, 0x01, + 0x00, 0x00,0x00, 0x00, 0x00, 0x00, + 0x00, 0x00,0x00, 0x00, 0x00, 0x00, + 0x00, 0x00,0x00, 0x00, 0x00, 0x00, + 0x00, 0x00,0x00, 0x00, 0x00, 0x00, + 0x00, 0x00,0x00, 0x00, 0x00, 0x00, + 0x00, 0x00,0x00, 0x00, 0x00, 0x00, +}; + + +/******************************gray*********************************/ +//0~3 gray +const unsigned char EPD_4IN2_4Gray_lut_vcom[] = +{ + 0x00 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01, + 0x60 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01, + 0x00 ,0x14 ,0x00 ,0x00 ,0x00 ,0x01, + 0x00 ,0x13 ,0x0A ,0x01 ,0x00 ,0x01, + 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, + 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, + 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 + +}; +//R21 +const unsigned char EPD_4IN2_4Gray_lut_ww[] ={ + 0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01, + 0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01, + 0x10 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01, + 0xA0 ,0x13 ,0x01 ,0x00 ,0x00 ,0x01, + 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, + 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, + 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +}; +//R22H r +const unsigned char EPD_4IN2_4Gray_lut_bw[] ={ + 0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01, + 0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01, + 0x00 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01, + 0x99 ,0x0C ,0x01 ,0x03 ,0x04 ,0x01, + 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, + 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, + 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +}; +//R23H w +const unsigned char EPD_4IN2_4Gray_lut_wb[] ={ + 0x40 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01, + 0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01, + 0x00 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01, + 0x99 ,0x0B ,0x04 ,0x04 ,0x01 ,0x01, + 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, + 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, + 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +}; +//R24H b +const unsigned char EPD_4IN2_4Gray_lut_bb[] ={ + 0x80 ,0x0A ,0x00 ,0x00 ,0x00 ,0x01, + 0x90 ,0x14 ,0x14 ,0x00 ,0x00 ,0x01, + 0x20 ,0x14 ,0x0A ,0x00 ,0x00 ,0x01, + 0x50 ,0x13 ,0x01 ,0x00 ,0x00 ,0x01, + 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, + 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, + 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00, +}; + +/****************************************************************************** +function : Software reset +parameter: +******************************************************************************/ +static void EPD_4IN2_Reset(void) +{ + DEV_Digital_Write(EPD_RST_PIN, 1); + DEV_Delay_ms(10); + DEV_Digital_Write(EPD_RST_PIN, 0); + DEV_Delay_ms(10); + DEV_Digital_Write(EPD_RST_PIN, 1); + DEV_Delay_ms(10); + DEV_Digital_Write(EPD_RST_PIN, 0); + DEV_Delay_ms(10); + DEV_Digital_Write(EPD_RST_PIN, 1); + DEV_Delay_ms(10); + DEV_Digital_Write(EPD_RST_PIN, 0); + DEV_Delay_ms(10); + DEV_Digital_Write(EPD_RST_PIN, 1); + DEV_Delay_ms(10); +} + +/****************************************************************************** +function : send command +parameter: + Reg : Command register +******************************************************************************/ +void EPD_4IN2_SendCommand(UBYTE Reg) +{ + DEV_Digital_Write(EPD_DC_PIN, 0); + DEV_Digital_Write(EPD_CS_PIN, 0); + DEV_SPI_WriteByte(Reg); + DEV_Digital_Write(EPD_CS_PIN, 1); +} + +/****************************************************************************** +function : send data +parameter: + Data : Write data +******************************************************************************/ +void EPD_4IN2_SendData(UBYTE Data) +{ + DEV_Digital_Write(EPD_DC_PIN, 1); + DEV_Digital_Write(EPD_CS_PIN, 0); + DEV_SPI_WriteByte(Data); + DEV_Digital_Write(EPD_CS_PIN, 1); +} + +/****************************************************************************** +function : Wait until the busy_pin goes LOW +parameter: +******************************************************************************/ +void EPD_4IN2_ReadBusy(void) +{ + while(DEV_Digital_Read(EPD_BUSY_PIN) == 0) { //LOW: idle, HIGH: busy + DEV_Delay_ms(100); + } +} + +/****************************************************************************** +function : Turn On Display +parameter: +******************************************************************************/ +static void EPD_4IN2_TurnOnDisplay(void) +{ + EPD_4IN2_SendCommand(0x12); + DEV_Delay_ms(100); + EPD_4IN2_ReadBusy(); +} + +/****************************************************************************** +function : set the look-up tables +parameter: +******************************************************************************/ +static void EPD_4IN2_SetLut(void) +{ + unsigned int count; + EPD_4IN2_SendCommand(0x20); + for(count=0;count<36;count++) + {EPD_4IN2_SendData(EPD_4IN2_lut_vcom0[count]);} + + EPD_4IN2_SendCommand(0x21); + for(count=0;count<36;count++) + {EPD_4IN2_SendData(EPD_4IN2_lut_ww[count]);} + + EPD_4IN2_SendCommand(0x22); + for(count=0;count<36;count++) + {EPD_4IN2_SendData(EPD_4IN2_lut_bw[count]);} + + EPD_4IN2_SendCommand(0x23); + for(count=0;count<36;count++) + {EPD_4IN2_SendData(EPD_4IN2_lut_wb[count]);} + + EPD_4IN2_SendCommand(0x24); + for(count=0;count<36;count++) + {EPD_4IN2_SendData(EPD_4IN2_lut_bb[count]);} +} +static void EPD_4IN2_Partial_SetLut(void) +{ + unsigned int count; + EPD_4IN2_SendCommand(0x20); + for(count=0;count<44;count++) + {EPD_4IN2_SendData(EPD_4IN2_Partial_lut_vcom1[count]);} + + EPD_4IN2_SendCommand(0x21); + for(count=0;count<42;count++) + {EPD_4IN2_SendData(EPD_4IN2_Partial_lut_ww1[count]);} + + EPD_4IN2_SendCommand(0x22); + for(count=0;count<42;count++) + {EPD_4IN2_SendData(EPD_4IN2_Partial_lut_bw1[count]);} + + EPD_4IN2_SendCommand(0x23); + for(count=0;count<42;count++) + {EPD_4IN2_SendData(EPD_4IN2_Partial_lut_wb1[count]);} + + EPD_4IN2_SendCommand(0x24); + for(count=0;count<42;count++) + {EPD_4IN2_SendData(EPD_4IN2_Partial_lut_bb1[count]);} +} + +//LUT download +static void EPD_4IN2_4Gray_lut(void) +{ + unsigned int count; + { + EPD_4IN2_SendCommand(0x20); //vcom + for(count=0;count<42;count++) + {EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_vcom[count]);} + + EPD_4IN2_SendCommand(0x21); //red not use + for(count=0;count<42;count++) + {EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_ww[count]);} + + EPD_4IN2_SendCommand(0x22); //bw r + for(count=0;count<42;count++) + {EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_bw[count]);} + + EPD_4IN2_SendCommand(0x23); //wb w + for(count=0;count<42;count++) + {EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_wb[count]);} + + EPD_4IN2_SendCommand(0x24); //bb b + for(count=0;count<42;count++) + {EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_bb[count]);} + + EPD_4IN2_SendCommand(0x25); //vcom + for(count=0;count<42;count++) + {EPD_4IN2_SendData(EPD_4IN2_4Gray_lut_ww[count]);} + } +} +/****************************************************************************** +function : Initialize the e-Paper register +parameter: +******************************************************************************/ +void EPD_4IN2_Init(void) +{ + EPD_4IN2_Reset(); + EPD_4IN2_SendCommand(0x01); //POWER SETTING + EPD_4IN2_SendData (0x03); + EPD_4IN2_SendData (0x00); + EPD_4IN2_SendData (0x2b); + EPD_4IN2_SendData (0x2b); + + EPD_4IN2_SendCommand(0x06); //boost soft start + EPD_4IN2_SendData (0x17); //A + EPD_4IN2_SendData (0x17); //B + EPD_4IN2_SendData (0x17); //C + + EPD_4IN2_SendCommand(0x04); + EPD_4IN2_ReadBusy(); + + EPD_4IN2_SendCommand(0x00); //panel setting + EPD_4IN2_SendData(0xbf); //KW-bf KWR-2F BWROTP 0f BWOTP 1f + + + EPD_4IN2_SendCommand(0x30); + EPD_4IN2_SendData (0x3c); // 3A 100HZ 29 150Hz 39 200HZ 31 171HZ + + EPD_4IN2_SendCommand(0x61); //resolution setting + EPD_4IN2_SendData (0x01); + EPD_4IN2_SendData (0x90); //400 + EPD_4IN2_SendData (0x01); //300 + EPD_4IN2_SendData (0x2c); + + + EPD_4IN2_SendCommand(0x82); //vcom_DC setting + EPD_4IN2_SendData (0x12); + + EPD_4IN2_SendCommand(0X50); + EPD_4IN2_SendData(0x97); + + EPD_4IN2_SetLut(); +} + +void EPD_4IN2_Init_4Gray(void) +{ + EPD_4IN2_Reset(); + EPD_4IN2_SendCommand(0x01); //POWER SETTING + EPD_4IN2_SendData (0x03); + EPD_4IN2_SendData (0x00); //VGH=20V,VGL=-20V + EPD_4IN2_SendData (0x2b); //VDH=15V + EPD_4IN2_SendData (0x2b); //VDL=-15V + EPD_4IN2_SendData (0x13); + + EPD_4IN2_SendCommand(0x06); //booster soft start + EPD_4IN2_SendData (0x17); //A + EPD_4IN2_SendData (0x17); //B + EPD_4IN2_SendData (0x17); //C + + EPD_4IN2_SendCommand(0x04); + EPD_4IN2_ReadBusy(); + + EPD_4IN2_SendCommand(0x00); //panel setting + EPD_4IN2_SendData(0x3f); //KW-3f KWR-2F BWROTP 0f BWOTP 1f + + EPD_4IN2_SendCommand(0x30); //PLL setting + EPD_4IN2_SendData (0x3c); //100hz + + EPD_4IN2_SendCommand(0x61); //resolution setting + EPD_4IN2_SendData (0x01); //400 + EPD_4IN2_SendData (0x90); + EPD_4IN2_SendData (0x01); //300 + EPD_4IN2_SendData (0x2c); + + EPD_4IN2_SendCommand(0x82); //vcom_DC setting + EPD_4IN2_SendData (0x12); + + EPD_4IN2_SendCommand(0X50); //VCOM AND DATA INTERVAL SETTING + EPD_4IN2_SendData(0x97); +} + +/****************************************************************************** +function : Clear screen +parameter: +******************************************************************************/ +void EPD_4IN2_Clear(void) +{ + UWORD Width, Height; + Width = (EPD_4IN2_WIDTH % 8 == 0)? (EPD_4IN2_WIDTH / 8 ): (EPD_4IN2_WIDTH / 8 + 1); + Height = EPD_4IN2_HEIGHT; + EPD_4IN2_SendCommand(0x92); + EPD_4IN2_SetLut(); + EPD_4IN2_SendCommand(0x10); + for (UWORD j = 0; j < Height; j++) { + for (UWORD i = 0; i < Width; i++) { + EPD_4IN2_SendData(0xFF); + } + } + + EPD_4IN2_SendCommand(0x13); + for (UWORD j = 0; j < Height; j++) { + for (UWORD i = 0; i < Width; i++) { + EPD_4IN2_SendData(0xFF); + } + } + + EPD_4IN2_TurnOnDisplay(); +} + +/****************************************************************************** +function : Sends the image buffer in RAM to e-Paper and displays +parameter: +******************************************************************************/ +void EPD_4IN2_Display(UBYTE *Image) +{ + UWORD Width, Height; + Width = (EPD_4IN2_WIDTH % 8 == 0)? (EPD_4IN2_WIDTH / 8 ): (EPD_4IN2_WIDTH / 8 + 1); + Height = EPD_4IN2_HEIGHT; + EPD_4IN2_SendCommand(0x92); + EPD_4IN2_SetLut(); + EPD_4IN2_SendCommand(0x13); + for (UWORD j = 0; j < Height; j++) { + for (UWORD i = 0; i < Width; i++) { + EPD_4IN2_SendData(Image[i + j * Width]); + } + } + + EPD_4IN2_TurnOnDisplay(); +} + +/****************************************************************************** +function : Sends the image buffer in RAM to e-Paper and displays +parameter: +******************************************************************************/ +void EPD_4IN2_Display_Half(UBYTE *Image, UBYTE Region) +{ + UWORD Width, Height; + Width = (EPD_4IN2_WIDTH % 8 == 0)? (EPD_4IN2_WIDTH / 8 ): (EPD_4IN2_WIDTH / 8 + 1); + Height = EPD_4IN2_HEIGHT; + + if(Region == 1){ + EPD_4IN2_SendCommand(0x13); + for (UWORD j = 0; j < Height/2; j++) { + for (UWORD i = 0; i < Width; i++) { + EPD_4IN2_SendData(Image[i + j * Width]); + } + } + }else if(Region == 2){ + for (UWORD j = 0; j < Height/2; j++) { + for (UWORD i = 0; i < Width; i++) { + EPD_4IN2_SendData(Image[i + j * Width]); + } + } + } +} + +/****************************************************************************** +function : Sends the image buffer in RAM to e-Paper and displays +parameter: +******************************************************************************/ +void EPD_4IN2_UpdateDisplay(void) +{ + EPD_4IN2_TurnOnDisplay(); +} + +/****************************************************************************** +function : Enter sleep mode +parameter: +******************************************************************************/ +void EPD_4IN2_Sleep(void) +{ + EPD_4IN2_SendCommand(0x50); // DEEP_SLEEP + EPD_4IN2_SendData(0XF7); + + EPD_4IN2_SendCommand(0x02); // POWER_OFF + EPD_4IN2_ReadBusy(); + + EPD_4IN2_SendCommand(0x07); // DEEP_SLEEP + EPD_4IN2_SendData(0XA5); +} diff --git a/EPD/EPD_4in2.h b/EPD/EPD_4in2.h new file mode 100644 index 0000000..afb5de7 --- /dev/null +++ b/EPD/EPD_4in2.h @@ -0,0 +1,108 @@ +/***************************************************************************** +* | File : EPD_4in2.h +* | Author : Waveshare team +* | Function : 4.2inch e-paper +* | Info : +*---------------- +* | This version: V3.0 +* | Date : 2019-06-13 +* | Info : +* ----------------------------------------------------------------------------- +* V3.0(2019-06-13): +* 1.Change: +* lut_vcomDC[] => EPD_4IN2_lut_vcomDC[] +* lut_ww[] => EPD_4IN2_lut_ww[] +* lut_bw[] => EPD_4IN2_lut_bw[] +* lut_wb[] => EPD_4IN2_lut_wb[] +* lut_bb[] => EPD_4IN2_lut_bb[] +* EPD_Reset() => EPD_4IN2_Reset() +* EPD_SendCommand() => EPD_4IN2_SendCommand() +* EPD_SendData() => EPD_4IN2_SendData() +* EPD_WaitUntilIdle() => EPD_4IN2_ReadBusy() +* EPD_SetFullReg() => EPD_4IN2_SetFullReg() +* EPD_SetPartReg() => EPD_4IN2_SetPartReg() +* EPD_TurnOnDisplay() => EPD_4IN2_TurnOnDisplay() +* EPD_Init() => EPD_4IN2_Init() +* EPD_Clear() => EPD_4IN2_Clear() +* EPD_Display() => EPD_4IN2_Display() +* EPD_Sleep() => EPD_4IN2_Sleep() +* 2.remove commands define: +* #define PANEL_SETTING 0x00 +* #define POWER_SETTING 0x01 +* #define POWER_OFF 0x02 +* #define POWER_OFF_SEQUENCE_SETTING 0x03 +* #define POWER_ON 0x04 +* #define POWER_ON_MEASURE 0x05 +* #define BOOSTER_SOFT_START 0x06 +* #define DEEP_SLEEP 0x07 +* #define DATA_START_TRANSMISSION_1 0x10 +* #define DATA_STOP 0x11 +* #define DISPLAY_REFRESH 0x12 +* #define DATA_START_TRANSMISSION_2 0x13 +* #define VCOM_LUT 0x20 +* #define W2W_LUT 0x21 +* #define B2W_LUT 0x22 +* #define W2B_LUT 0x23 +* #define B2B_LUT 0x24 +* #define PLL_CONTROL 0x30 +* #define TEMPERATURE_SENSOR_CALIBRATION 0x40 +* #define TEMPERATURE_SENSOR_SELECTION 0x41 +* #define TEMPERATURE_SENSOR_WRITE 0x42 +* #define TEMPERATURE_SENSOR_READ 0x43 +* #define VCOM_AND_DATA_INTERVAL_SETTING 0x50 +* #define LOW_POWER_DETECTION 0x51 +* #define TCON_SETTING 0x60 +* #define RESOLUTION_SETTING 0x61 +* #define GET_STATUS 0x71 +* #define AUTO_MEASURE_VCOM 0x80 +* #define READ_VCOM_VALUE 0x81 +* #define VCM_DC_SETTING 0x82 +* #define PARTIAL_WINDOW 0x90 +* #define PARTIAL_IN 0x91 +* #define PARTIAL_OUT 0x92 +* #define PROGRAM_MODE 0xA0 +* #define ACTIVE_PROGRAM 0xA1 +* #define READ_OTP_DATA 0xA2 +* #define POWER_SAVING 0xE3 +* V2.0(2018-10-30): +* 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8] +* 2.Change:EPD_Display(UBYTE *Image) +* Need to pass parameters: pointer to cached data +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documnetation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +******************************************************************************/ +#ifndef _EPD_4IN2_H_ +#define _EPD_4IN2_H_ + +#include "DEV_Config.h" + +// Display resolution +#define EPD_4IN2_WIDTH 400 +#define EPD_4IN2_HEIGHT 300 + +void EPD_4IN2_Init(void); +void EPD_4IN2_Clear(void); +void EPD_4IN2_Display(UBYTE *Image); +void EPD_4IN2_Sleep(void); +void EPD_4IN2_UpdateDisplay(void); +void EPD_4IN2_SendCommand(UBYTE Reg); +void EPD_4IN2_SendData(UBYTE Data); + +#endif diff --git a/EPD/EPD_4in2_V2.c b/EPD/EPD_4in2_V2.c new file mode 100644 index 0000000..2e86df2 --- /dev/null +++ b/EPD/EPD_4in2_V2.c @@ -0,0 +1,621 @@ +/***************************************************************************** +* | File : EPD_4in2_V2.h +* | Author : Waveshare team +* | Function : 4.2inch e-paper V2 +* | Info : +*---------------- +* | This version: V1.0 +* | Date : 2023-09-12 +* | Info : +* ----------------------------------------------------------------------------- +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documnetation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +******************************************************************************/ +#include "EPD_4in2_V2.h" + +const unsigned char LUT_ALL[233]={ +0x01, 0x0A, 0x1B, 0x0F, 0x03, 0x01, 0x01, +0x05, 0x0A, 0x01, 0x0A, 0x01, 0x01, 0x01, +0x05, 0x08, 0x03, 0x02, 0x04, 0x01, 0x01, +0x01, 0x04, 0x04, 0x02, 0x00, 0x01, 0x01, +0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, +0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, +0x01, 0x0A, 0x1B, 0x0F, 0x03, 0x01, 0x01, +0x05, 0x4A, 0x01, 0x8A, 0x01, 0x01, 0x01, +0x05, 0x48, 0x03, 0x82, 0x84, 0x01, 0x01, +0x01, 0x84, 0x84, 0x82, 0x00, 0x01, 0x01, +0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, +0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, +0x01, 0x0A, 0x1B, 0x8F, 0x03, 0x01, 0x01, +0x05, 0x4A, 0x01, 0x8A, 0x01, 0x01, 0x01, +0x05, 0x48, 0x83, 0x82, 0x04, 0x01, 0x01, +0x01, 0x04, 0x04, 0x02, 0x00, 0x01, 0x01, +0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, +0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, +0x01, 0x8A, 0x1B, 0x8F, 0x03, 0x01, 0x01, +0x05, 0x4A, 0x01, 0x8A, 0x01, 0x01, 0x01, +0x05, 0x48, 0x83, 0x02, 0x04, 0x01, 0x01, +0x01, 0x04, 0x04, 0x02, 0x00, 0x01, 0x01, +0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, +0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, +0x01, 0x8A, 0x9B, 0x8F, 0x03, 0x01, 0x01, +0x05, 0x4A, 0x01, 0x8A, 0x01, 0x01, 0x01, +0x05, 0x48, 0x03, 0x42, 0x04, 0x01, 0x01, +0x01, 0x04, 0x04, 0x42, 0x00, 0x01, 0x01, +0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, +0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x02, 0x00, 0x00, 0x07, 0x17, 0x41, 0xA8, +0x32, 0x30, +}; + +/****************************************************************************** +function : Software reset +parameter: +******************************************************************************/ +static void EPD_4IN2_V2_Reset(void) +{ + DEV_Digital_Write(EPD_RST_PIN, 1); + DEV_Delay_ms(100); + DEV_Digital_Write(EPD_RST_PIN, 0); + DEV_Delay_ms(2); + DEV_Digital_Write(EPD_RST_PIN, 1); + DEV_Delay_ms(100); +} + +/****************************************************************************** +function : send command +parameter: + Reg : Command register +******************************************************************************/ +void EPD_4IN2_V2_SendCommand(UBYTE Reg) +{ + DEV_Digital_Write(EPD_DC_PIN, 0); + DEV_Digital_Write(EPD_CS_PIN, 0); + DEV_SPI_WriteByte(Reg); + DEV_Digital_Write(EPD_CS_PIN, 1); +} + +/****************************************************************************** +function : send data +parameter: + Data : Write data +******************************************************************************/ +void EPD_4IN2_V2_SendData(UBYTE Data) +{ + DEV_Digital_Write(EPD_DC_PIN, 1); + DEV_Digital_Write(EPD_CS_PIN, 0); + DEV_SPI_WriteByte(Data); + DEV_Digital_Write(EPD_CS_PIN, 1); +} + +/****************************************************************************** +function : Wait until the busy_pin goes LOW +parameter: +******************************************************************************/ +void EPD_4IN2_V2_ReadBusy(void) +{ + while(DEV_Digital_Read(EPD_BUSY_PIN) == 1) { //LOW: idle, HIGH: busy + DEV_Delay_ms(10); + } +} + +/****************************************************************************** +function : Turn On Display +parameter: +******************************************************************************/ +static void EPD_4IN2_V2_TurnOnDisplay(void) +{ + EPD_4IN2_V2_SendCommand(0x22); + EPD_4IN2_V2_SendData(0xF7); + EPD_4IN2_V2_SendCommand(0x20); + EPD_4IN2_V2_ReadBusy(); +} + +static void EPD_4IN2_V2_TurnOnDisplay_Fast(void) +{ + EPD_4IN2_V2_SendCommand(0x22); + EPD_4IN2_V2_SendData(0xC7); + EPD_4IN2_V2_SendCommand(0x20); + EPD_4IN2_V2_ReadBusy(); +} + +static void EPD_4IN2_V2_TurnOnDisplay_Partial(void) +{ + EPD_4IN2_V2_SendCommand(0x22); + EPD_4IN2_V2_SendData(0xFF); + EPD_4IN2_V2_SendCommand(0x20); + EPD_4IN2_V2_ReadBusy(); +} + +static void EPD_4IN2_V2_TurnOnDisplay_4Gray(void) +{ + EPD_4IN2_V2_SendCommand(0x22); + EPD_4IN2_V2_SendData(0xCF); + EPD_4IN2_V2_SendCommand(0x20); + EPD_4IN2_V2_ReadBusy(); +} + +/****************************************************************************** +function : Setting the display window +parameter: +******************************************************************************/ +static void EPD_4IN2_V2_SetWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend) +{ + EPD_4IN2_V2_SendCommand(0x44); // SET_RAM_X_ADDRESS_START_END_POSITION + EPD_4IN2_V2_SendData((Xstart>>3) & 0xFF); + EPD_4IN2_V2_SendData((Xend>>3) & 0xFF); + + EPD_4IN2_V2_SendCommand(0x45); // SET_RAM_Y_ADDRESS_START_END_POSITION + EPD_4IN2_V2_SendData(Ystart & 0xFF); + EPD_4IN2_V2_SendData((Ystart >> 8) & 0xFF); + EPD_4IN2_V2_SendData(Yend & 0xFF); + EPD_4IN2_V2_SendData((Yend >> 8) & 0xFF); +} + +/****************************************************************************** +function : Set Cursor +parameter: +******************************************************************************/ +static void EPD_4IN2_V2_SetCursor(UWORD Xstart, UWORD Ystart) +{ + EPD_4IN2_V2_SendCommand(0x4E); // SET_RAM_X_ADDRESS_COUNTER + EPD_4IN2_V2_SendData(Xstart & 0xFF); + + EPD_4IN2_V2_SendCommand(0x4F); // SET_RAM_Y_ADDRESS_COUNTER + EPD_4IN2_V2_SendData(Ystart & 0xFF); + EPD_4IN2_V2_SendData((Ystart >> 8) & 0xFF); +} + +//LUT download +static void EPD_4IN2_V2_4Gray_lut(void) +{ + unsigned char i; + + //WS byte 0~152, the content of VS[nX-LUTm], TP[nX], RP[n], SR[nXY], FR[n] and XON[nXY] + EPD_4IN2_V2_SendCommand(0x32); + for(i=0;i<227;i++) + { + EPD_4IN2_V2_SendData(LUT_ALL[i]); + } + //WS byte 153, the content of Option for LUT end + EPD_4IN2_V2_SendCommand(0x3F); + EPD_4IN2_V2_SendData(LUT_ALL[i++]); + + //WS byte 154, the content of gate leve + EPD_4IN2_V2_SendCommand(0x03); + EPD_4IN2_V2_SendData(LUT_ALL[i++]);//VGH + + //WS byte 155~157, the content of source level + EPD_4IN2_V2_SendCommand(0x04); + EPD_4IN2_V2_SendData(LUT_ALL[i++]);//VSH1 + EPD_4IN2_V2_SendData(LUT_ALL[i++]);//VSH2 + EPD_4IN2_V2_SendData(LUT_ALL[i++]);//VSL + + //WS byte 158, the content of VCOM level + EPD_4IN2_V2_SendCommand(0x2c); + EPD_4IN2_V2_SendData(LUT_ALL[i++]);//VCOM +} + +/****************************************************************************** +function : Initialize the e-Paper register +parameter: +******************************************************************************/ +void EPD_4IN2_V2_Init(void) +{ + EPD_4IN2_V2_Reset(); + + EPD_4IN2_V2_ReadBusy(); + EPD_4IN2_V2_SendCommand(0x12); // soft reset + EPD_4IN2_V2_ReadBusy(); + + // EPD_4IN2_V2_SendCommand(0x01); //Driver output control + // EPD_4IN2_V2_SendData((EPD_4IN2_V2_HEIGHT-1)%256); + // EPD_4IN2_V2_SendData((EPD_4IN2_V2_HEIGHT-1)/256); + // EPD_4IN2_V2_SendData(0x00); + + EPD_4IN2_V2_SendCommand(0x21); // Display update control + EPD_4IN2_V2_SendData(0x40); + EPD_4IN2_V2_SendData(0x00); + + EPD_4IN2_V2_SendCommand(0x3C); //BorderWavefrom + EPD_4IN2_V2_SendData(0x05); + + EPD_4IN2_V2_SendCommand(0x11); // data entry mode + EPD_4IN2_V2_SendData(0x03); // X-mode + + EPD_4IN2_V2_SetWindows(0, 0, EPD_4IN2_V2_WIDTH-1, EPD_4IN2_V2_HEIGHT-1); + + EPD_4IN2_V2_SetCursor(0, 0); + + EPD_4IN2_V2_ReadBusy(); +} + +/****************************************************************************** +function : Initialize Fast the e-Paper register +parameter: +******************************************************************************/ +void EPD_4IN2_V2_Init_Fast(UBYTE Mode) +{ + EPD_4IN2_V2_Reset(); + + EPD_4IN2_V2_ReadBusy(); + EPD_4IN2_V2_SendCommand(0x12); // soft reset + EPD_4IN2_V2_ReadBusy(); + + EPD_4IN2_V2_SendCommand(0x21); + EPD_4IN2_V2_SendData(0x40); + EPD_4IN2_V2_SendData(0x00); + + EPD_4IN2_V2_SendCommand(0x3C); + EPD_4IN2_V2_SendData(0x05); + + if(Mode == Seconds_1_5S) + { + //1.5s + EPD_4IN2_V2_SendCommand(0x1A); // Write to temperature register + EPD_4IN2_V2_SendData(0x6E); + } + else if(Mode == Seconds_1S) + { + //1s + EPD_4IN2_V2_SendCommand(0x1A); // Write to temperature register + EPD_4IN2_V2_SendData(0x5A); + } + + EPD_4IN2_V2_SendCommand(0x22); // Load temperature value + EPD_4IN2_V2_SendData(0x91); + EPD_4IN2_V2_SendCommand(0x20); + EPD_4IN2_V2_ReadBusy(); + + EPD_4IN2_V2_SendCommand(0x11); // data entry mode + EPD_4IN2_V2_SendData(0x03); // X-mode + + EPD_4IN2_V2_SetWindows(0, 0, EPD_4IN2_V2_WIDTH-1, EPD_4IN2_V2_HEIGHT-1); + + EPD_4IN2_V2_SetCursor(0, 0); + + EPD_4IN2_V2_ReadBusy(); +} + + +void EPD_4IN2_V2_Init_4Gray(void) +{ + EPD_4IN2_V2_Reset(); + + EPD_4IN2_V2_SendCommand(0x12); //SWRESET + EPD_4IN2_V2_ReadBusy(); + + EPD_4IN2_V2_SendCommand(0x21); + EPD_4IN2_V2_SendData(0x00); + EPD_4IN2_V2_SendData(0x00); + + EPD_4IN2_V2_SendCommand(0x3C); + EPD_4IN2_V2_SendData(0x03); + + EPD_4IN2_V2_SendCommand(0x0C); //BTST + EPD_4IN2_V2_SendData(0x8B);//8B + EPD_4IN2_V2_SendData(0x9C);//9C + EPD_4IN2_V2_SendData(0xA4);//96 A4 + EPD_4IN2_V2_SendData(0x0F);//0F + + // EPD_4IN2_V2_SendCommand(0x01); // 驱动输出控制 drive output control + // EPD_4IN2_V2_SendData(0x2B); // Y 的低字节 + // EPD_4IN2_V2_SendData(0x01); // Y 的高字节 + // EPD_4IN2_V2_SendData(0x00); + + EPD_4IN2_V2_4Gray_lut(); //LUT + + EPD_4IN2_V2_SendCommand(0x11); // data entry mode + EPD_4IN2_V2_SendData(0x03); // X-mode + + EPD_4IN2_V2_SetWindows(0, 0, EPD_4IN2_V2_WIDTH-1, EPD_4IN2_V2_HEIGHT-1); + + EPD_4IN2_V2_SetCursor(0, 0); +} +/****************************************************************************** +function : Clear screen +parameter: +******************************************************************************/ +void EPD_4IN2_V2_Clear(void) +{ + UWORD Width, Height; + Width = (EPD_4IN2_V2_WIDTH % 8 == 0)? (EPD_4IN2_V2_WIDTH / 8 ): (EPD_4IN2_V2_WIDTH / 8 + 1); + Height = EPD_4IN2_V2_HEIGHT; + + EPD_4IN2_V2_SendCommand(0x24); + for (UWORD j = 0; j < Height; j++) { + for (UWORD i = 0; i < Width; i++) { + EPD_4IN2_V2_SendData(0xFF); + } + } + + EPD_4IN2_V2_SendCommand(0x26); + for (UWORD j = 0; j < Height; j++) { + for (UWORD i = 0; i < Width; i++) { + EPD_4IN2_V2_SendData(0xFF); + } + } + EPD_4IN2_V2_TurnOnDisplay(); +} + +/****************************************************************************** +function : Sends the image buffer in RAM to e-Paper and displays +parameter: +******************************************************************************/ +void EPD_4IN2_V2_Display_Half(UBYTE *Image, UBYTE Region) +{ + UWORD Width, Height; + Width = (EPD_4IN2_V2_WIDTH % 8 == 0)? (EPD_4IN2_V2_WIDTH / 8 ): (EPD_4IN2_V2_WIDTH / 8 + 1); + Height = EPD_4IN2_V2_HEIGHT; + + if(Region == 1){ + EPD_4IN2_V2_SendCommand(0x24); + for (UWORD j = 0; j < Height/2; j++) { + for (UWORD i = 0; i < Width; i++) { + EPD_4IN2_V2_SendData(Image[i + j * Width]); + } + } + + EPD_4IN2_V2_SendCommand(0x26); + for (UWORD j = 0; j < Height/2; j++) { + for (UWORD i = 0; i < Width; i++) { + EPD_4IN2_V2_SendData(Image[i + j * Width]); + } + } + } + else if(Region == 2){ + EPD_4IN2_V2_SendCommand(0x24); + for (UWORD j = 0; j < Height/2; j++) { + for (UWORD i = 0; i < Width; i++) { + EPD_4IN2_V2_SendData(Image[i + j * Width]); + } + } + + EPD_4IN2_V2_SendCommand(0x26); + for (UWORD j = 0; j < Height/2; j++) { + for (UWORD i = 0; i < Width; i++) { + EPD_4IN2_V2_SendData(Image[i + j * Width]); + } + } + EPD_4IN2_V2_TurnOnDisplay(); + } +} + +/****************************************************************************** +function : Sends the image buffer in RAM to e-Paper and displays +parameter: +******************************************************************************/ +void EPD_4IN2_V2_Display(UBYTE *Image) +{ + UWORD Width, Height; + Width = (EPD_4IN2_V2_WIDTH % 8 == 0)? (EPD_4IN2_V2_WIDTH / 8 ): (EPD_4IN2_V2_WIDTH / 8 + 1); + Height = EPD_4IN2_V2_HEIGHT; + + EPD_4IN2_V2_SendCommand(0x24); + for (UWORD j = 0; j < Height; j++) { + for (UWORD i = 0; i < Width; i++) { + EPD_4IN2_V2_SendData(Image[i + j * Width]); + } + } + + EPD_4IN2_V2_SendCommand(0x26); + for (UWORD j = 0; j < Height; j++) { + for (UWORD i = 0; i < Width; i++) { + EPD_4IN2_V2_SendData(Image[i + j * Width]); + } + } + EPD_4IN2_V2_TurnOnDisplay(); +} + +/****************************************************************************** +function : Sends the image buffer in RAM to e-Paper and fast displays +parameter: +******************************************************************************/ +void EPD_4IN2_V2_Display_Fast(UBYTE *Image) +{ + UWORD Width, Height; + Width = (EPD_4IN2_V2_WIDTH % 8 == 0)? (EPD_4IN2_V2_WIDTH / 8 ): (EPD_4IN2_V2_WIDTH / 8 + 1); + Height = EPD_4IN2_V2_HEIGHT; + + EPD_4IN2_V2_SendCommand(0x24); + for (UWORD j = 0; j < Height; j++) { + for (UWORD i = 0; i < Width; i++) { + EPD_4IN2_V2_SendData(Image[i + j * Width]); + } + } + + EPD_4IN2_V2_SendCommand(0x26); + for (UWORD j = 0; j < Height; j++) { + for (UWORD i = 0; i < Width; i++) { + EPD_4IN2_V2_SendData(Image[i + j * Width]); + } + } + EPD_4IN2_V2_TurnOnDisplay_Fast(); +} + + +void EPD_4IN2_V2_Display_4Gray(UBYTE *Image) +{ + UDOUBLE i,j,k,m; + UBYTE temp1,temp2,temp3; +/****Color display description**** + white gray2 gray1 black +0x10| 01 01 00 00 +0x13| 01 00 01 00 +*********************************/ + EPD_4IN2_V2_SendCommand(0x24); + // EPD_4IN2_HEIGHT + // EPD_4IN2_WIDTH + for(m = 0; m Xend % 8) || Xstart % 8 + Xend % 8 == 0 || (Xend - Xstart)%8 == 0) + { + Xstart = Xstart / 8 ; + Xend = Xend / 8; + } + else + { + Xstart = Xstart / 8 ; + Xend = Xend % 8 == 0 ? Xend / 8 : Xend / 8 + 1; + } + + + UWORD i, Width; + Width = Xend - Xstart; + UWORD IMAGE_COUNTER = Width * (Yend-Ystart); + + Xend -= 1; + Yend -= 1; + + EPD_4IN2_V2_SendCommand(0x3C); //BorderWavefrom, + EPD_4IN2_V2_SendData(0x80); + + EPD_4IN2_V2_SendCommand(0x21); + EPD_4IN2_V2_SendData(0x00); + EPD_4IN2_V2_SendData(0x00); + + EPD_4IN2_V2_SendCommand(0x3C); + EPD_4IN2_V2_SendData(0x80); + + EPD_4IN2_V2_SendCommand(0x44); // set RAM x address start/end, in page 35 + EPD_4IN2_V2_SendData(Xstart & 0xff); // RAM x address start at 00h; + EPD_4IN2_V2_SendData(Xend & 0xff); // RAM x address end at 0fh(15+1)*8->128 + EPD_4IN2_V2_SendCommand(0x45); // set RAM y address start/end, in page 35 + EPD_4IN2_V2_SendData(Ystart & 0xff); // RAM y address start at 0127h; + EPD_4IN2_V2_SendData((Ystart>>8) & 0x01); // RAM y address start at 0127h; + EPD_4IN2_V2_SendData(Yend & 0xff); // RAM y address end at 00h; + EPD_4IN2_V2_SendData((Yend>>8) & 0x01); + + EPD_4IN2_V2_SendCommand(0x4E); // set RAM x address count to 0; + EPD_4IN2_V2_SendData(Xstart & 0xff); + EPD_4IN2_V2_SendCommand(0x4F); // set RAM y address count to 0X127; + EPD_4IN2_V2_SendData(Ystart & 0xff); + EPD_4IN2_V2_SendData((Ystart>>8) & 0x01); + + EPD_4IN2_V2_SendCommand(0x24); + for (i = 0; i < IMAGE_COUNTER; i++) { + EPD_4IN2_V2_SendData(Image[i]); + } + + EPD_4IN2_V2_TurnOnDisplay_Partial(); +} + +void EPD_4IN2_V2_UpdateDisplay(void) +{ + EPD_4IN2_V2_TurnOnDisplay(); +} + +/****************************************************************************** +function : Enter sleep mode +parameter: +******************************************************************************/ +void EPD_4IN2_V2_Sleep(void) +{ + EPD_4IN2_V2_SendCommand(0x10); // DEEP_SLEEP + EPD_4IN2_V2_SendData(0x01); + DEV_Delay_ms(200); +} diff --git a/EPD/EPD_4in2_V2.h b/EPD/EPD_4in2_V2.h new file mode 100644 index 0000000..e327d39 --- /dev/null +++ b/EPD/EPD_4in2_V2.h @@ -0,0 +1,56 @@ +/***************************************************************************** +* | File : EPD_4in2_V2.h +* | Author : Waveshare team +* | Function : 4.2inch e-paper V2 +* | Info : +*---------------- +* | This version: V1.0 +* | Date : 2023-09-12 +* | Info : +* ----------------------------------------------------------------------------- +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documnetation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +******************************************************************************/ +#ifndef _EPD_4IN2_V2_H_ +#define _EPD_4IN2_V2_H_ + +#include "DEV_Config.h" + +// Display resolution +#define EPD_4IN2_V2_WIDTH 400 +#define EPD_4IN2_V2_HEIGHT 300 + +#define Seconds_1_5S 0 +#define Seconds_1S 1 + +void EPD_4IN2_V2_Init(void); +void EPD_4IN2_V2_Init_Fast(UBYTE Mode); +void EPD_4IN2_V2_Init_4Gray(void); +void EPD_4IN2_V2_Clear(void); +void EPD_4IN2_V2_Display_Half(UBYTE *Image, UBYTE Region); +void EPD_4IN2_V2_Display(UBYTE *Image); +void EPD_4IN2_V2_Display_Fast(UBYTE *Image); +void EPD_4IN2_V2_Display_4Gray(UBYTE *Image); +void EPD_4IN2_V2_PartialDisplay(UBYTE *Image, UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend); +void EPD_4IN2_V2_Sleep(void); +void EPD_4IN2_V2_SendCommand(UBYTE Reg); +void EPD_4IN2_V2_SendData(UBYTE Data); +void EPD_4IN2_V2_UpdateDisplay(void); +#endif diff --git a/EPD/EPD_4in2b_V2.c b/EPD/EPD_4in2b_V2.c new file mode 100644 index 0000000..7ed1b98 --- /dev/null +++ b/EPD/EPD_4in2b_V2.c @@ -0,0 +1,221 @@ +/***************************************************************************** +* | File : EPD_4in2b_V2.c +* | Author : Waveshare team +* | Function : 4.2inch e-paper b V2 +* | Info : +*---------------- +* | This version: V1.0 +* | Date : 2020-11-27 +* | Info : +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documnetation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +******************************************************************************/ +#include "EPD_4in2b_V2.h" + +/****************************************************************************** +function : Software reset +parameter: +******************************************************************************/ +static void EPD_4IN2B_V2_Reset(void) +{ + DEV_Digital_Write(EPD_RST_PIN, 1); + DEV_Delay_ms(200); + DEV_Digital_Write(EPD_RST_PIN, 0); + DEV_Delay_ms(2); + DEV_Digital_Write(EPD_RST_PIN, 1); + DEV_Delay_ms(200); +} + +/****************************************************************************** +function : send command +parameter: + Reg : Command register +******************************************************************************/ +void EPD_4IN2B_V2_SendCommand(UBYTE Reg) +{ + DEV_Digital_Write(EPD_DC_PIN, 0); + DEV_Digital_Write(EPD_CS_PIN, 0); + DEV_SPI_WriteByte(Reg); + DEV_Digital_Write(EPD_CS_PIN, 1); +} + +/****************************************************************************** +function : send data +parameter: + Data : Write data +******************************************************************************/ +void EPD_4IN2B_V2_SendData(UBYTE Data) +{ + DEV_Digital_Write(EPD_DC_PIN, 1); + DEV_Digital_Write(EPD_CS_PIN, 0); + DEV_SPI_WriteByte(Data); + DEV_Digital_Write(EPD_CS_PIN, 1); +} + +/****************************************************************************** +function : Wait until the busy_pin goes LOW +parameter: +******************************************************************************/ +void EPD_4IN2B_V2_ReadBusy(void) +{ + do{ + EPD_4IN2B_V2_SendCommand(0x71); + DEV_Delay_ms(50); + }while(!(DEV_Digital_Read(EPD_BUSY_PIN))); + DEV_Delay_ms(50); +} + +/****************************************************************************** +function : Turn On Display +parameter: +******************************************************************************/ +static void EPD_4IN2B_V2_TurnOnDisplay(void) +{ + EPD_4IN2B_V2_SendCommand(0x12); // DISPLAY_REFRESH + DEV_Delay_ms(100); + EPD_4IN2B_V2_ReadBusy(); +} + +/****************************************************************************** +function : Initialize the e-Paper register +parameter: +******************************************************************************/ +void EPD_4IN2B_V2_Init(void) +{ + EPD_4IN2B_V2_Reset(); + + EPD_4IN2B_V2_SendCommand(0x04); + EPD_4IN2B_V2_ReadBusy(); + + EPD_4IN2B_V2_SendCommand(0x00); + EPD_4IN2B_V2_SendData(0x0f); +} + +/****************************************************************************** +function : Clear screen +parameter: +******************************************************************************/ +void EPD_4IN2B_V2_Clear(void) +{ + UWORD Width, Height; + Width = (EPD_4IN2B_V2_WIDTH % 8 == 0)? (EPD_4IN2B_V2_WIDTH / 8 ): (EPD_4IN2B_V2_WIDTH / 8 + 1); + Height = EPD_4IN2B_V2_HEIGHT; + + EPD_4IN2B_V2_SendCommand(0x10); + for (UWORD j = 0; j < Height; j++) { + for (UWORD i = 0; i < Width; i++) { + EPD_4IN2B_V2_SendData(0xFF); + } + } + + EPD_4IN2B_V2_SendCommand(0x13); + for (UWORD j = 0; j < Height; j++) { + for (UWORD i = 0; i < Width; i++) { + EPD_4IN2B_V2_SendData(0xFF); + } + } + + EPD_4IN2B_V2_TurnOnDisplay(); +} + +/****************************************************************************** +function : Sends the image buffer in RAM to e-Paper and displays +parameter: +******************************************************************************/ +void EPD_4IN2B_V2_Display(const UBYTE *blackimage, const UBYTE *ryimage) +{ + UWORD Width, Height; + Width = (EPD_4IN2B_V2_WIDTH % 8 == 0)? (EPD_4IN2B_V2_WIDTH / 8 ): (EPD_4IN2B_V2_WIDTH / 8 + 1); + Height = EPD_4IN2B_V2_HEIGHT; + + EPD_4IN2B_V2_SendCommand(0x10); + for (UWORD j = 0; j < Height; j++) { + for (UWORD i = 0; i < Width; i++) { + EPD_4IN2B_V2_SendData(blackimage[i + j * Width]); + } + } + + EPD_4IN2B_V2_SendCommand(0x13); + for (UWORD j = 0; j < Height; j++) { + for (UWORD i = 0; i < Width; i++) { + EPD_4IN2B_V2_SendData(ryimage[i + j * Width]); + } + } + + EPD_4IN2B_V2_TurnOnDisplay(); +} + +/****************************************************************************** +function : Sends the image buffer in RAM to e-Paper and displays +parameter: +******************************************************************************/ +void EPD_4IN2B_V2_Display_Half(const UBYTE *blackimage, UBYTE Region) +{ + UWORD Width, Height; + Width = (EPD_4IN2B_V2_WIDTH % 8 == 0)? (EPD_4IN2B_V2_WIDTH / 8 ): (EPD_4IN2B_V2_WIDTH / 8 + 1); + Height = EPD_4IN2B_V2_HEIGHT; + + if(Region == 1){ + EPD_4IN2B_V2_SendCommand(0x10); + for (UWORD j = 0; j < Height/2; j++) { + for (UWORD i = 0; i < Width; i++) { + EPD_4IN2B_V2_SendData(blackimage[i + j * Width]); + } + } + }else if(Region == 2){ + for (UWORD j = 0; j < Height/2; j++) { + for (UWORD i = 0; i < Width; i++) { + EPD_4IN2B_V2_SendData(blackimage[i + j * Width]); + } + } + }else if(Region == 3){ + EPD_4IN2B_V2_SendCommand(0x13); + for (UWORD j = 0; j < Height/2; j++) { + for (UWORD i = 0; i < Width; i++) { + EPD_4IN2B_V2_SendData(blackimage[i + j * Width]); + } + } + }else if(Region == 4){ + for (UWORD j = 0; j < Height/2; j++) { + for (UWORD i = 0; i < Width; i++) { + EPD_4IN2B_V2_SendData(blackimage[i + j * Width]); + } + } + } +} + +void EPD_4IN2B_V2_UpdateDisplay(void) +{ + EPD_4IN2B_V2_TurnOnDisplay(); +} +/****************************************************************************** +function : Enter sleep mode +parameter: +******************************************************************************/ +void EPD_4IN2B_V2_Sleep(void) +{ + EPD_4IN2B_V2_SendCommand(0X50); + EPD_4IN2B_V2_SendData(0xf7); //border floating + + EPD_4IN2B_V2_SendCommand(0X02); //power off + EPD_4IN2B_V2_ReadBusy(); //waiting for the electronic paper IC to release the idle signal + EPD_4IN2B_V2_SendCommand(0X07); //deep sleep + EPD_4IN2B_V2_SendData(0xA5); +} diff --git a/EPD/EPD_4in2b_V2.h b/EPD/EPD_4in2b_V2.h new file mode 100644 index 0000000..35097fd --- /dev/null +++ b/EPD/EPD_4in2b_V2.h @@ -0,0 +1,47 @@ +/***************************************************************************** +* | File : EPD_4in2b_V2.h +* | Author : Waveshare team +* | Function : 4.2inch e-paper b V2 +* | Info : +*---------------- +* | This version: V1.0 +* | Date : 2020-11-27 +* | Info : +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documnetation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +******************************************************************************/ +#ifndef __EPD_4IN2B_V2_H_ +#define __EPD_4IN2B_V2_H_ + +#include "DEV_Config.h" + +// Display resolution +#define EPD_4IN2B_V2_WIDTH 400 +#define EPD_4IN2B_V2_HEIGHT 300 + +void EPD_4IN2B_V2_Init(void); +void EPD_4IN2B_V2_Clear(void); +void EPD_4IN2B_V2_Display(const UBYTE *blackimage, const UBYTE *ryimage); +void EPD_4IN2B_V2_Sleep(void); +void EPD_4IN2B_V2_Display_Half(const UBYTE *blackimage, UBYTE Region); +void EPD_4IN2B_V2_UpdateDisplay(void); +void EPD_4IN2B_V2_SendCommand(UBYTE Reg); +void EPD_4IN2B_V2_SendData(UBYTE Data); +#endif diff --git a/EPD/EPD_ble.c b/EPD/EPD_ble.c new file mode 100644 index 0000000..173ea22 --- /dev/null +++ b/EPD/EPD_ble.c @@ -0,0 +1,302 @@ +/* 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 +#include "nordic_common.h" +#include "ble_srv_common.h" +#include "nrf_log.h" +#include "EPD_4in2.h" +#include "EPD_4in2_V2.h" +#include "EPD_4in2b_V2.h" +#include "EPD_ble.h" + +#define BLE_EPD_BASE_UUID {{0XEC, 0X5A, 0X67, 0X1C, 0XC1, 0XB6, 0X46, 0XFB, \ + 0X8D, 0X91, 0X28, 0XD8, 0X22, 0X36, 0X75, 0X62}} +#define BLE_UUID_EPD_SERVICE 0x0001 +#define BLE_UUID_EPD_CHARACTERISTIC 0x0002 + +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) + +/** EPD drivers */ +static epd_driver_t epd_drivers[] = { + {EPD_DRIVER_4IN2, EPD_4IN2_Init, EPD_4IN2_Clear, + EPD_4IN2_SendCommand, EPD_4IN2_SendData, + EPD_4IN2_UpdateDisplay, EPD_4IN2_Sleep}, + {EPD_DRIVER_4IN2_V2, EPD_4IN2_V2_Init, EPD_4IN2_V2_Clear, + EPD_4IN2_V2_SendCommand, EPD_4IN2_V2_SendData, + EPD_4IN2_V2_UpdateDisplay, EPD_4IN2_V2_Sleep}, + {EPD_DRIVER_4IN2B_V2, EPD_4IN2B_V2_Init, EPD_4IN2B_V2_Clear, + EPD_4IN2B_V2_SendCommand, EPD_4IN2B_V2_SendData, + EPD_4IN2B_V2_UpdateDisplay, EPD_4IN2B_V2_Sleep}, +}; + +/**@brief Function for handling the @ref BLE_GAP_EVT_CONNECTED event from the S110 SoftDevice. + * + * @param[in] p_epd EPD Service structure. + * @param[in] p_ble_evt Pointer to the event received from BLE stack. + */ +static void on_connect(ble_epd_t * p_epd, ble_evt_t * p_ble_evt) +{ + p_epd->conn_handle = p_ble_evt->evt.gap_evt.conn_handle; + DEV_Module_Init(); +} + + +/**@brief Function for handling the @ref BLE_GAP_EVT_DISCONNECTED event from the S110 SoftDevice. + * + * @param[in] p_epd EPD Service structure. + * @param[in] p_ble_evt Pointer to the event received from BLE stack. + */ +static void on_disconnect(ble_epd_t * p_epd, ble_evt_t * p_ble_evt) +{ + UNUSED_PARAMETER(p_ble_evt); + p_epd->conn_handle = BLE_CONN_HANDLE_INVALID; + DEV_Module_Exit(); +} + +static void epd_service_process(ble_epd_t * p_epd, uint8_t * p_data, uint16_t length) +{ + if (p_data == NULL || length <= 0) return; + NRF_LOG_PRINTF("[EPD]: CMD=0x%02x, LEN=%d\n", p_data[0], length); + + switch (p_data[0]) + { + case EPD_CMD_SET_PINS: + if (length < 8) return; + NRF_LOG_PRINTF("[EPD]: MOSI=0x%02x SCLK=0x%02x CS=0x%02x DC=0x%02x RST=0x%02x BUSY=0x%02x BS=0x%02x\n", + p_data[1], p_data[2], p_data[3], p_data[4], p_data[5], p_data[6], p_data[7]); + EPD_MOSI_PIN = p_data[1]; + EPD_SCLK_PIN = p_data[2]; + EPD_CS_PIN = p_data[3]; + EPD_DC_PIN = p_data[4]; + EPD_RST_PIN = p_data[5]; + EPD_BUSY_PIN = p_data[6]; + EPD_BS_PIN = p_data[7]; + DEV_Module_Exit(); + DEV_Module_Init(); + break; + + case EPD_CMD_INIT: + if (length > 1) + { + for (uint8_t i = 0; i < ARRAY_SIZE(epd_drivers); i++) + { + if (epd_drivers[i].id == p_data[1]) + { + p_epd->driver = &epd_drivers[i]; + } + } + } + if (p_epd->driver == NULL) p_epd->driver= &epd_drivers[0]; + NRF_LOG_PRINTF("[EPD]: DRIVER=%d\n", p_epd->driver->id); + p_epd->driver->init(); + break; + + case EPD_CMD_CLEAR: + p_epd->driver->clear(); + break; + + case EPD_CMD_SEND_COMMAND: + if (length < 2) return; + p_epd->driver->send_command(p_data[1]); + break; + + case EPD_CMD_SEND_DATA: + for (UWORD i = 0; i < length - 1; i++) + { + p_epd->driver->send_data(p_data[i + 1]); + } + break; + + case EPD_CMD_DISPLAY: + p_epd->driver->display(); + DEV_Delay_ms(500); + break; + + case EPD_CMD_SLEEP: + p_epd->driver->sleep(); + DEV_Delay_ms(200); + break; + + default: + break; + } +} + +/**@brief Function for handling the @ref BLE_GATTS_EVT_WRITE event from the S110 SoftDevice. + * + * @param[in] p_epd EPD Service structure. + * @param[in] p_ble_evt Pointer to the event received from BLE stack. + */ +static void on_write(ble_epd_t * p_epd, ble_evt_t * p_ble_evt) +{ + ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write; + + if ( + (p_evt_write->handle == p_epd->char_handles.cccd_handle) + && + (p_evt_write->len == 2) + ) + { + if (ble_srv_is_notification_enabled(p_evt_write->data)) + { + p_epd->is_notification_enabled = true; + } + else + { + p_epd->is_notification_enabled = false; + } + } + else if (p_evt_write->handle == p_epd->char_handles.value_handle) + { + epd_service_process(p_epd, p_evt_write->data, p_evt_write->len); + } + else + { + // Do Nothing. This event is not relevant for this service. + } +} + + +void ble_epd_on_ble_evt(ble_epd_t * p_epd, ble_evt_t * p_ble_evt) +{ + if ((p_epd == NULL) || (p_ble_evt == NULL)) + { + return; + } + + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + on_connect(p_epd, p_ble_evt); + break; + + case BLE_GAP_EVT_DISCONNECTED: + on_disconnect(p_epd, p_ble_evt); + break; + + case BLE_GATTS_EVT_WRITE: + on_write(p_epd, p_ble_evt); + break; + + default: + // No implementation needed. + break; + } +} + + +static uint32_t epd_service_init(ble_epd_t * p_epd) +{ + ble_uuid128_t base_uuid = BLE_EPD_BASE_UUID; + ble_uuid_t ble_uuid; + uint32_t err_code; + + err_code = sd_ble_uuid_vs_add(&base_uuid, &ble_uuid.type); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + ble_uuid.uuid = BLE_UUID_EPD_SERVICE; + err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, + &ble_uuid, + &p_epd->service_handle); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + 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_gatts_attr_md_t attr_md; + + memset(&cccd_md, 0, sizeof(cccd_md)); + 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); + + memset(&char_md, 0, sizeof(char_md)); + char_md.char_props.read = 1; + char_md.char_props.notify = 1; + char_md.char_props.write = 1; + char_md.char_props.write_wo_resp = 1; + char_md.p_cccd_md = &cccd_md; + + char_uuid.type = ble_uuid.type; + char_uuid.uuid = BLE_UUID_EPD_CHARACTERISTIC; + + 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; + + 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(uint8_t); + attr_char_value.init_offs = 0; + attr_char_value.max_len = BLE_EPD_MAX_DATA_LEN; + + err_code = sd_ble_gatts_characteristic_add(p_epd->service_handle, + &char_md, + &attr_char_value, + &p_epd->char_handles); + return err_code; +} + +uint32_t ble_epd_init(ble_epd_t * p_epd) +{ + if (p_epd == NULL) + { + return NRF_ERROR_NULL; + } + + // Initialize the service structure. + p_epd->conn_handle = BLE_CONN_HANDLE_INVALID; + p_epd->is_notification_enabled = false; + + // Add the service. + return epd_service_init(p_epd); +} + + +uint32_t ble_epd_string_send(ble_epd_t * p_epd, uint8_t * p_string, uint16_t length) +{ + ble_gatts_hvx_params_t hvx_params; + + if (p_epd == NULL) + { + return NRF_ERROR_NULL; + } + + if ((p_epd->conn_handle == BLE_CONN_HANDLE_INVALID) || (!p_epd->is_notification_enabled)) + { + return NRF_ERROR_INVALID_STATE; + } + + if (length > BLE_EPD_MAX_DATA_LEN) + { + return NRF_ERROR_INVALID_PARAM; + } + + memset(&hvx_params, 0, sizeof(hvx_params)); + + hvx_params.handle = p_epd->char_handles.value_handle; + hvx_params.p_data = p_string; + hvx_params.p_len = &length; + hvx_params.type = BLE_GATT_HVX_NOTIFICATION; + + return sd_ble_gatts_hvx(p_epd->conn_handle, &hvx_params); +} diff --git a/EPD/EPD_ble.h b/EPD/EPD_ble.h new file mode 100644 index 0000000..7282c7e --- /dev/null +++ b/EPD/EPD_ble.h @@ -0,0 +1,136 @@ +/* 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 ble_sdk_srv_nus Nordic UART Service + * @{ + * @ingroup ble_sdk_srv + * @brief Nordic UART Service implementation. + * + * @details The Nordic UART Service is a simple GATT-based service with TX and RX characteristics. + * Data received from the peer is passed to the application, and the data received + * from the application of this service is sent to the peer as Handle Value + * Notifications. This module demonstrates how to implement a custom GATT-based + * service and characteristics using the S110 SoftDevice. The service + * is used by the application to send and receive ASCII text strings to and from the + * peer. + * + * @note The application must propagate S110 SoftDevice events to the Nordic UART Service module + * by calling the ble_nus_on_ble_evt() function from the ble_stack_handler callback. + */ + +#ifndef EPD_BLE_H__ +#define EPD_BLE_H__ + +#include "ble.h" +#include "ble_srv_common.h" +#include +#include +#include "DEV_Config.h" + +#define BLE_EPD_MAX_DATA_LEN (GATT_MTU_SIZE_DEFAULT - 3) /**< Maximum length of data (in bytes) that can be transmitted to the peer by the Nordic UART service module. */ + +enum EPD_CMDS +{ + EPD_CMD_SET_PINS, + EPD_CMD_INIT, + EPD_CMD_CLEAR, + EPD_CMD_SEND_COMMAND, + EPD_CMD_SEND_DATA, + EPD_CMD_DISPLAY, + EPD_CMD_SLEEP, +}; + +/* Forward declaration of the epd_driver_t type. */ +typedef struct epd_driver_s epd_driver_t; + +/**< epd driver DIs. */ +enum EPD_DRIVER_IDS +{ + EPD_DRIVER_4IN2 = 1, + EPD_DRIVER_4IN2_V2, + EPD_DRIVER_4IN2B_V2, +}; + +/**@brief EPD driver structure. + * + * @details This structure contains epd driver functions. + */ +struct epd_driver_s +{ + uint8_t id; /**< driver ID. */ + void (*init)(void); /**< Initialize the e-Paper register */ + void (*clear)(void); /**< Clear screen */ + void (*send_command)(UBYTE Reg); /**< send command */ + void (*send_data)(UBYTE Data); /**< send data */ + void (*display)(void); /**< Sends the image buffer in RAM to e-Paper and displays */ + void (*sleep)(void); /**< Enter sleep mode */ +}; + +/* Forward declaration of the ble_epd_t type. */ +typedef struct ble_epd_s ble_epd_t; + +/**@brief EPD Service structure. + * + * @details This structure contains status information related to the service. + */ +struct ble_epd_s +{ + uint8_t uuid_type; /**< UUID type for EPD Service Base UUID. */ + uint16_t service_handle; /**< Handle of EPD Service (as provided by the S110 SoftDevice). */ + ble_gatts_char_handles_t char_handles; /**< Handles related to the EPD characteristic (as provided by the S110 SoftDevice). */ + uint16_t conn_handle; /**< Handle of the current connection (as provided by the S110 SoftDevice). BLE_CONN_HANDLE_INVALID if not in a connection. */ + bool is_notification_enabled; /**< Variable to indicate if the peer has enabled notification of the RX characteristic.*/ + epd_driver_t *driver; /**< current EPD driver */ +}; + +/**@brief Function for initializing the EPD Service. + * + * @param[out] p_epd EPD Service structure. This structure must be supplied + * by the application. It is initialized by this function and will + * later be used to identify this particular service instance. + * @param[in] p_epd_init Information needed to initialize the service. + * + * @retval NRF_SUCCESS If the service was successfully initialized. Otherwise, an error code is returned. + * @retval NRF_ERROR_NULL If either of the pointers p_epd or p_epd_init is NULL. + */ +uint32_t ble_epd_init(ble_epd_t * p_epd); + +/**@brief Function for handling the EPD Service's BLE events. + * + * @details The EPD Service expects the application to call this function each time an + * event is received from the S110 SoftDevice. This function processes the event if it + * is relevant and calls the EPD Service event handler of the + * application if necessary. + * + * @param[in] p_epd EPD Service structure. + * @param[in] p_ble_evt Event received from the S110 SoftDevice. + */ +void ble_epd_on_ble_evt(ble_epd_t * p_epd, ble_evt_t * p_ble_evt); + +/**@brief Function for sending a string to the peer. + * + * @details This function sends the input string as an RX characteristic notification to the + * peer. + * + * @param[in] p_epd Pointer to the EPD Service structure. + * @param[in] p_string String to be sent. + * @param[in] length Length of the string. + * + * @retval NRF_SUCCESS If the string was sent successfully. Otherwise, an error code is returned. + */ +uint32_t ble_epd_string_send(ble_epd_t * p_epd, uint8_t * p_string, uint16_t length); + +#endif // EPD_BLE_H__ + +/** @} */ diff --git a/Keil/EPD.uvoptx b/Keil/EPD.uvoptx new file mode 100644 index 0000000..5cf4021 --- /dev/null +++ b/Keil/EPD.uvoptx @@ -0,0 +1,948 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp; *.cc; *.cxx + 0 + + + + 0 + 0 + + + + EPD + 0x4 + ARM-ADS + + 12000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\Listings\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 5 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 3 + + + + + + + + + + + BIN\CMSIS_AGDI.dll + + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + 0 + DLGUARM + + + + 0 + CMSIS_AGDI + -X"" -O206 -S0 -C0 -P00000000 -N00("ARM CoreSight SW-DP") -D00(0BB11477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC4000 -FN1 -FF0nrf51xxx.flm -FS00 -FL0200000 -FP0($$Device:nRF51822_xxAB$Flash\nrf51xxx.flm) + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC4000 -FN1 -FF0nrf51xxx -FS00 -FL0200000 -FP0($$Device:nRF51822_xxAB$Flash\nrf51xxx.flm)) + + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + 1 + 1 + 0 + 2 + 10000000 + + + + + + EPD_Debug + 0x4 + ARM-ADS + + 12000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\Listings\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 0 + + 5 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 3 + + + + + + + + + + + BIN\CMSIS_AGDI.dll + + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + 0 + DLGUARM + + + + 0 + CMSIS_AGDI + -X"" -O206 -S0 -C0 -P00000000 -N00("ARM CoreSight SW-DP") -D00(0BB11477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC4000 -FN1 -FF0nrf51xxx.flm -FS00 -FL0200000 -FP0($$Device:nRF51822_xxAB$Flash\nrf51xxx.flm) + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC4000 -FN1 -FF0nrf51xxx -FS00 -FL0200000 -FP0($$Device:nRF51822_xxAB$Flash\nrf51xxx.flm)) + + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + 1 + 1 + 0 + 2 + 10000000 + + + + + + flash_softdevice + 0x4 + ARM-ADS + + 12000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\Listings\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 0 + + 5 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 3 + + + + + + + + + + + BIN\CMSIS_AGDI.dll + + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + 0 + DLGUARM + + + + 0 + CMSIS_AGDI + -X"" -O78 -S8 -C0 -P00000000 -N00("") -D00(00000000) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC4000 -FN1 -FF0nrf51xxx.flm -FS00 -FL0200000 -FP0($$Device:nRF51822_xxAB$Flash\nrf51xxx.flm) + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC4000 -FN1 -FF0nrf51xxx -FS00 -FL0200000 -FP0($$Device:nRF51822_xxAB$Flash\nrf51xxx.flm)) + + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + 1 + 1 + 0 + 2 + 10000000 + + + + + + App + 0 + 0 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + ..\main.c + main.c + 0 + 0 + + + 1 + 2 + 5 + 0 + 0 + 0 + ..\config\nrf_drv_config.h + nrf_drv_config.h + 0 + 0 + + + 1 + 3 + 5 + 0 + 0 + 0 + ..\config\bsp.h + bsp.h + 0 + 0 + + + + + EPD + 0 + 0 + 0 + 0 + + 2 + 4 + 1 + 0 + 0 + 0 + ..\EPD\DEV_Config.c + DEV_Config.c + 0 + 0 + + + 2 + 5 + 1 + 0 + 0 + 0 + ..\EPD\EPD_4in2.c + EPD_4in2.c + 0 + 0 + + + 2 + 6 + 1 + 0 + 0 + 0 + ..\EPD\EPD_4in2_V2.c + EPD_4in2_V2.c + 0 + 0 + + + 2 + 7 + 1 + 0 + 0 + 0 + ..\EPD\EPD_4in2b_V2.c + EPD_4in2b_V2.c + 0 + 0 + + + 2 + 8 + 1 + 0 + 0 + 0 + ..\EPD\EPD_ble.c + EPD_ble.c + 0 + 0 + + + + + nRF_BLE + 0 + 0 + 0 + 0 + + 3 + 9 + 1 + 0 + 0 + 0 + ..\components\ble\ble_advertising\ble_advertising.c + ble_advertising.c + 0 + 0 + + + 3 + 10 + 1 + 0 + 0 + 0 + ..\components\ble\common\ble_advdata.c + ble_advdata.c + 0 + 0 + + + 3 + 11 + 1 + 0 + 0 + 0 + ..\components\ble\common\ble_conn_params.c + ble_conn_params.c + 0 + 0 + + + 3 + 12 + 1 + 0 + 0 + 0 + ..\components\ble\common\ble_srv_common.c + ble_srv_common.c + 0 + 0 + + + + + nRF_Drivers + 0 + 0 + 0 + 0 + + 4 + 13 + 1 + 0 + 0 + 0 + ..\components\drivers_nrf\delay\nrf_delay.c + nrf_delay.c + 0 + 0 + + + 4 + 14 + 1 + 0 + 0 + 0 + ..\components\drivers_nrf\common\nrf_drv_common.c + nrf_drv_common.c + 0 + 0 + + + 4 + 15 + 1 + 0 + 0 + 0 + ..\components\drivers_nrf\gpiote\nrf_drv_gpiote.c + nrf_drv_gpiote.c + 0 + 0 + + + 4 + 16 + 1 + 0 + 0 + 0 + ..\components\drivers_nrf\spi_master\nrf_drv_spi.c + nrf_drv_spi.c + 0 + 0 + + + 4 + 17 + 1 + 0 + 0 + 0 + ..\components\drivers_nrf\twi_master\nrf_drv_twi.c + nrf_drv_twi.c + 0 + 0 + + + 4 + 18 + 1 + 0 + 0 + 0 + ..\components\drivers_nrf\pstorage\pstorage.c + pstorage.c + 0 + 0 + + + + + nRF_Libraries + 0 + 0 + 0 + 0 + + 5 + 19 + 1 + 0 + 0 + 0 + ..\components\libraries\util\nrf_log.c + nrf_log.c + 0 + 0 + + + 5 + 20 + 1 + 0 + 0 + 0 + ..\components\libraries\util\nrf_assert.c + nrf_assert.c + 0 + 0 + + + 5 + 21 + 1 + 0 + 0 + 0 + ..\components\libraries\util\app_error.c + app_error.c + 0 + 0 + + + 5 + 22 + 1 + 0 + 0 + 0 + ..\components\libraries\timer\app_timer.c + app_timer.c + 0 + 0 + + + + + nRF_SoftDevice + 0 + 0 + 0 + 0 + + 6 + 23 + 1 + 0 + 0 + 0 + ..\components\softdevice\common\softdevice_handler\softdevice_handler.c + softdevice_handler.c + 0 + 0 + + + + + SEGGER_RTT + 0 + 0 + 0 + 0 + + 7 + 24 + 1 + 0 + 0 + 0 + ..\components\drivers_ext\segger_rtt\RTT_Syscalls_KEIL.c + RTT_Syscalls_KEIL.c + 0 + 0 + + + 7 + 25 + 1 + 0 + 0 + 0 + ..\components\drivers_ext\segger_rtt\SEGGER_RTT.c + SEGGER_RTT.c + 0 + 0 + + + 7 + 26 + 1 + 0 + 0 + 0 + ..\components\drivers_ext\segger_rtt\SEGGER_RTT_printf.c + SEGGER_RTT_printf.c + 0 + 0 + + + + + ::CMSIS + 0 + 0 + 0 + 1 + + + + ::Device + 1 + 0 + 0 + 1 + + +
diff --git a/Keil/EPD.uvprojx b/Keil/EPD.uvprojx new file mode 100644 index 0000000..85e1ff3 --- /dev/null +++ b/Keil/EPD.uvprojx @@ -0,0 +1,1734 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + EPD + 0x4 + ARM-ADS + 5060960::V5.06 update 7 (build 960)::.\ARMCC + 0 + + + nRF51822_xxAB + Nordic Semiconductor + NordicSemiconductor.nRF_DeviceFamilyPack.8.2.0 + http://developer.nordicsemi.com/nRF51_SDK/pieces/nRF_DeviceFamilyPack/ + IRAM(0x20000000,0x00004000) IROM(0x00000000,0x00020000) CPUTYPE("Cortex-M0") CLOCK(12000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC4000 -FN1 -FF0nrf51xxx -FS00 -FL0200000 -FP0($$Device:nRF51822_xxAB$Flash\nrf51xxx.flm)) + 0 + $$Device:nRF51822_xxAB$Device\Include\nrf.h + + + + + + + + + + $$Device:nRF51822_xxAB$SVD\nrf51.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\Objects\ + EPD + 1 + 0 + 1 + 1 + 1 + .\Listings\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 8 + 1 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x4000 + + + 1 + 0x0 + 0x20000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x18000 + 0x8000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20002000 + 0x2000 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 4 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 3 + 3 + 1 + 1 + 0 + 0 + 0 + + + BLE_STACK_SUPPORT_REQD S110 SWI_DISABLE0 SOFTDEVICE_PRESENT NRF51 + + ..\config;..\EPD;..\components\toolchain;..\components\drivers_nrf\config;..\components\drivers_nrf\common;..\components\drivers_nrf\delay;..\components\drivers_nrf\gpiote;..\components\drivers_nrf\hal;..\components\drivers_nrf\spi_master;..\components\drivers_nrf\pstorage;..\components\drivers_nrf\pstorage\config;..\components\drivers_nrf\twi_master;..\components\libraries\trace;..\components\libraries\timer;..\components\libraries\util;..\components\ble\common;..\components\ble\ble_advertising;..\components\softdevice\common\softdevice_handler;..\components\softdevice\s110\headers + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + + + BLE_STACK_SUPPORT_REQD S110 SWI_DISABLE0 SOFTDEVICE_PRESENT NRF51 + + ..\components;..\components\drivers_nrf\common;..\components\libraries\log;..\components\libraries\log\src;..\components\drivers_nrf\hal;..\components\drivers_nrf\delay;..\components\drivers_nrf\nrf_soc_nosd;..\components\drivers_nrf\spi_master;..\components\drivers_nrf\uart;..\components\libraries\util;..\components\toolchain;..\config;..\EPD;..\GUI + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + + + + + + + + + + + + + App + + + main.c + 1 + ..\main.c + + + nrf_drv_config.h + 5 + ..\config\nrf_drv_config.h + + + bsp.h + 5 + ..\config\bsp.h + + + + + EPD + + + DEV_Config.c + 1 + ..\EPD\DEV_Config.c + + + EPD_4in2.c + 1 + ..\EPD\EPD_4in2.c + + + EPD_4in2_V2.c + 1 + ..\EPD\EPD_4in2_V2.c + + + EPD_4in2b_V2.c + 1 + ..\EPD\EPD_4in2b_V2.c + + + EPD_ble.c + 1 + ..\EPD\EPD_ble.c + + + + + nRF_BLE + + + ble_advertising.c + 1 + ..\components\ble\ble_advertising\ble_advertising.c + + + ble_advdata.c + 1 + ..\components\ble\common\ble_advdata.c + + + ble_conn_params.c + 1 + ..\components\ble\common\ble_conn_params.c + + + ble_srv_common.c + 1 + ..\components\ble\common\ble_srv_common.c + + + + + nRF_Drivers + + + nrf_delay.c + 1 + ..\components\drivers_nrf\delay\nrf_delay.c + + + nrf_drv_common.c + 1 + ..\components\drivers_nrf\common\nrf_drv_common.c + + + nrf_drv_gpiote.c + 1 + ..\components\drivers_nrf\gpiote\nrf_drv_gpiote.c + + + nrf_drv_spi.c + 1 + ..\components\drivers_nrf\spi_master\nrf_drv_spi.c + + + nrf_drv_twi.c + 1 + ..\components\drivers_nrf\twi_master\nrf_drv_twi.c + + + pstorage.c + 1 + ..\components\drivers_nrf\pstorage\pstorage.c + + + + + nRF_Libraries + + + nrf_log.c + 1 + ..\components\libraries\util\nrf_log.c + + + nrf_assert.c + 1 + ..\components\libraries\util\nrf_assert.c + + + app_error.c + 1 + ..\components\libraries\util\app_error.c + + + app_timer.c + 1 + ..\components\libraries\timer\app_timer.c + + + + + nRF_SoftDevice + + + softdevice_handler.c + 1 + ..\components\softdevice\common\softdevice_handler\softdevice_handler.c + + + + + SEGGER_RTT + + + RTT_Syscalls_KEIL.c + 1 + ..\components\drivers_ext\segger_rtt\RTT_Syscalls_KEIL.c + + + SEGGER_RTT.c + 1 + ..\components\drivers_ext\segger_rtt\SEGGER_RTT.c + + + SEGGER_RTT_printf.c + 1 + ..\components\drivers_ext\segger_rtt\SEGGER_RTT_printf.c + + + + + ::CMSIS + + + ::Device + + + + + EPD_Debug + 0x4 + ARM-ADS + 5060960::V5.06 update 7 (build 960)::.\ARMCC + 0 + + + nRF51822_xxAB + Nordic Semiconductor + NordicSemiconductor.nRF_DeviceFamilyPack.8.2.0 + http://developer.nordicsemi.com/nRF51_SDK/pieces/nRF_DeviceFamilyPack/ + IRAM(0x20000000,0x00004000) IROM(0x00000000,0x00020000) CPUTYPE("Cortex-M0") CLOCK(12000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC4000 -FN1 -FF0nrf51xxx -FS00 -FL0200000 -FP0($$Device:nRF51822_xxAB$Flash\nrf51xxx.flm)) + 0 + $$Device:nRF51822_xxAB$Device\Include\nrf.h + + + + + + + + + + $$Device:nRF51822_xxAB$SVD\nrf51.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\Objects\ + EPD + 1 + 0 + 1 + 1 + 1 + .\Listings\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 8 + 1 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x4000 + + + 1 + 0x0 + 0x20000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x18000 + 0x8000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20002000 + 0x2000 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 3 + 3 + 1 + 1 + 0 + 0 + 0 + + + BLE_STACK_SUPPORT_REQD S110 SWI_DISABLE0 SOFTDEVICE_PRESENT NRF51 DEBUG NRF_LOG_USES_RTT=1 + + ..\config;..\EPD;..\components\toolchain;..\components\drivers_nrf\config;..\components\drivers_nrf\common;..\components\drivers_nrf\delay;..\components\drivers_nrf\gpiote;..\components\drivers_nrf\hal;..\components\drivers_nrf\spi_master;..\components\drivers_nrf\pstorage;..\components\drivers_nrf\pstorage\config;..\components\drivers_nrf\twi_master;..\components\drivers_ext\segger_rtt;..\components\libraries\trace;..\components\libraries\timer;..\components\libraries\util;..\components\ble\common;..\components\ble\ble_advertising;..\components\softdevice\common\softdevice_handler;..\components\softdevice\s110\headers + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + + + BLE_STACK_SUPPORT_REQD S110 SWI_DISABLE0 SOFTDEVICE_PRESENT NRF51 + + ..\components;..\components\drivers_nrf\common;..\components\libraries\log;..\components\libraries\log\src;..\components\drivers_nrf\hal;..\components\drivers_nrf\delay;..\components\drivers_nrf\nrf_soc_nosd;..\components\drivers_nrf\spi_master;..\components\drivers_nrf\uart;..\components\libraries\util;..\components\toolchain;..\config;..\EPD;..\GUI + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + + + + + + + + + + + + + App + + + main.c + 1 + ..\main.c + + + nrf_drv_config.h + 5 + ..\config\nrf_drv_config.h + + + bsp.h + 5 + ..\config\bsp.h + + + + + EPD + + + DEV_Config.c + 1 + ..\EPD\DEV_Config.c + + + EPD_4in2.c + 1 + ..\EPD\EPD_4in2.c + + + EPD_4in2_V2.c + 1 + ..\EPD\EPD_4in2_V2.c + + + EPD_4in2b_V2.c + 1 + ..\EPD\EPD_4in2b_V2.c + + + EPD_ble.c + 1 + ..\EPD\EPD_ble.c + + + + + nRF_BLE + + + ble_advertising.c + 1 + ..\components\ble\ble_advertising\ble_advertising.c + + + ble_advdata.c + 1 + ..\components\ble\common\ble_advdata.c + + + ble_conn_params.c + 1 + ..\components\ble\common\ble_conn_params.c + + + ble_srv_common.c + 1 + ..\components\ble\common\ble_srv_common.c + + + + + nRF_Drivers + + + nrf_delay.c + 1 + ..\components\drivers_nrf\delay\nrf_delay.c + + + nrf_drv_common.c + 1 + ..\components\drivers_nrf\common\nrf_drv_common.c + + + nrf_drv_gpiote.c + 1 + ..\components\drivers_nrf\gpiote\nrf_drv_gpiote.c + + + nrf_drv_spi.c + 1 + ..\components\drivers_nrf\spi_master\nrf_drv_spi.c + + + nrf_drv_twi.c + 1 + ..\components\drivers_nrf\twi_master\nrf_drv_twi.c + + + pstorage.c + 1 + ..\components\drivers_nrf\pstorage\pstorage.c + + + + + nRF_Libraries + + + nrf_log.c + 1 + ..\components\libraries\util\nrf_log.c + + + nrf_assert.c + 1 + ..\components\libraries\util\nrf_assert.c + + + app_error.c + 1 + ..\components\libraries\util\app_error.c + + + app_timer.c + 1 + ..\components\libraries\timer\app_timer.c + + + + + nRF_SoftDevice + + + softdevice_handler.c + 1 + ..\components\softdevice\common\softdevice_handler\softdevice_handler.c + + + + + SEGGER_RTT + + + RTT_Syscalls_KEIL.c + 1 + ..\components\drivers_ext\segger_rtt\RTT_Syscalls_KEIL.c + + + SEGGER_RTT.c + 1 + ..\components\drivers_ext\segger_rtt\SEGGER_RTT.c + + + SEGGER_RTT_printf.c + 1 + ..\components\drivers_ext\segger_rtt\SEGGER_RTT_printf.c + + + + + ::CMSIS + + + ::Device + + + + + flash_softdevice + 0x4 + ARM-ADS + 5060960::V5.06 update 7 (build 960)::.\ARMCC + 0 + + + nRF51822_xxAB + Nordic Semiconductor + NordicSemiconductor.nRF_DeviceFamilyPack.8.44.1 + http://developer.nordicsemi.com/nRF5_SDK/pieces/nRF_DeviceFamilyPack/ + IRAM(0x20000000,0x00004000) IROM(0x00000000,0x00020000) CPUTYPE("Cortex-M0") CLOCK(12000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC4000 -FN1 -FF0nrf51xxx -FS00 -FL0200000 -FP0($$Device:nRF51822_xxAB$Flash\nrf51xxx.flm)) + 0 + $$Device:nRF51822_xxAB$Device\Include\nrf.h + + + + + + + + + + $$Device:nRF51822_xxAB$SVD\nrf51.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + ..\components\softdevice\s110\hex\ + s110_nrf51_8.0.0_softdevice.hex + 1 + 0 + 1 + 1 + 1 + .\Listings\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + + DARMCM1.DLL + -pCM0 + SARMCM3.DLL + + TARMCM1.DLL + -pCM0 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M0" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 8 + 1 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x4000 + + + 1 + 0x0 + 0x20000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x18000 + 0x8000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20002000 + 0x2000 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 4 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 3 + 3 + 1 + 1 + 0 + 0 + 0 + + + BLE_STACK_SUPPORT_REQD S110 BOARD_PCA10028 SWI_DISABLE0 SOFTDEVICE_PRESENT NRF51 + + ..\config;..\EPD;..\GUI;..\components\toolchain;..\components\drivers_nrf\config;..\components\drivers_nrf\common;..\components\drivers_nrf\delay;..\components\drivers_nrf\gpiote;..\components\drivers_nrf\hal;..\components\drivers_nrf\spi_master;..\components\drivers_nrf\pstorage;..\components\libraries\log\src;..\components\libraries\log;..\components\libraries\trace;..\components\libraries\timer;..\components\libraries\util;..\components\ble\common;..\components\ble\ble_advertising;..\components\softdevice\common\softdevice_handler;..\components\softdevice\s110\headers + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + + + BLE_STACK_SUPPORT_REQD S110 BOARD_PCA10028 SWI_DISABLE0 SOFTDEVICE_PRESENT NRF51 + + ..\components;..\components\drivers_nrf\common;..\components\libraries\log;..\components\libraries\log\src;..\components\drivers_nrf\hal;..\components\drivers_nrf\delay;..\components\drivers_nrf\nrf_soc_nosd;..\components\drivers_nrf\spi_master;..\components\drivers_nrf\uart;..\components\libraries\util;..\components\toolchain;..\config;..\EPD;..\GUI + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + + + + + + + + + + + + + App + + + main.c + 1 + ..\main.c + + + nrf_drv_config.h + 5 + ..\config\nrf_drv_config.h + + + bsp.h + 5 + ..\config\bsp.h + + + + + EPD + + + DEV_Config.c + 1 + ..\EPD\DEV_Config.c + + + EPD_4in2.c + 1 + ..\EPD\EPD_4in2.c + + + EPD_4in2_V2.c + 1 + ..\EPD\EPD_4in2_V2.c + + + EPD_4in2b_V2.c + 1 + ..\EPD\EPD_4in2b_V2.c + + + EPD_ble.c + 1 + ..\EPD\EPD_ble.c + + + + + nRF_BLE + + + ble_advertising.c + 1 + ..\components\ble\ble_advertising\ble_advertising.c + + + ble_advdata.c + 1 + ..\components\ble\common\ble_advdata.c + + + ble_conn_params.c + 1 + ..\components\ble\common\ble_conn_params.c + + + ble_srv_common.c + 1 + ..\components\ble\common\ble_srv_common.c + + + + + nRF_Drivers + + + nrf_delay.c + 1 + ..\components\drivers_nrf\delay\nrf_delay.c + + + nrf_drv_common.c + 1 + ..\components\drivers_nrf\common\nrf_drv_common.c + + + nrf_drv_gpiote.c + 1 + ..\components\drivers_nrf\gpiote\nrf_drv_gpiote.c + + + nrf_drv_spi.c + 1 + ..\components\drivers_nrf\spi_master\nrf_drv_spi.c + + + nrf_drv_twi.c + 1 + ..\components\drivers_nrf\twi_master\nrf_drv_twi.c + + + pstorage.c + 1 + ..\components\drivers_nrf\pstorage\pstorage.c + + + + + nRF_Libraries + + + nrf_log.c + 1 + ..\components\libraries\util\nrf_log.c + + + nrf_assert.c + 1 + ..\components\libraries\util\nrf_assert.c + + + app_error.c + 1 + ..\components\libraries\util\app_error.c + + + app_timer.c + 1 + ..\components\libraries\timer\app_timer.c + + + + + nRF_SoftDevice + + + softdevice_handler.c + 1 + ..\components\softdevice\common\softdevice_handler\softdevice_handler.c + + + + + SEGGER_RTT + + + RTT_Syscalls_KEIL.c + 1 + ..\components\drivers_ext\segger_rtt\RTT_Syscalls_KEIL.c + + + SEGGER_RTT.c + 1 + ..\components\drivers_ext\segger_rtt\SEGGER_RTT.c + + + SEGGER_RTT_printf.c + 1 + ..\components\drivers_ext\segger_rtt\SEGGER_RTT_printf.c + + + + + ::CMSIS + + + ::Device + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RTE\Device\nRF51822_xxAB\arm_startup_nrf51.s + + + + + + + + + + + RTE\Device\nRF51822_xxAB\system_nrf51.c + + + + + + + + + + + + + + + + EPD + 1 + + + + +
diff --git a/Keil/RTE/Device/nRF51822_xxAB/arm_startup_nrf51.s b/Keil/RTE/Device/nRF51822_xxAB/arm_startup_nrf51.s new file mode 100644 index 0000000..a7b5e93 --- /dev/null +++ b/Keil/RTE/Device/nRF51822_xxAB/arm_startup_nrf51.s @@ -0,0 +1,255 @@ +; 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. + +; NOTE: Template files (including this one) are application specific and therefore +; expected to be copied into the application project folder prior to its use! + +; Description message + + IF :DEF: __STACK_SIZE +Stack_Size EQU __STACK_SIZE + ELSE +Stack_Size EQU 4096 + ENDIF + + AREA STACK, NOINIT, READWRITE, ALIGN=3 +Stack_Mem SPACE Stack_Size +__initial_sp + + IF :DEF: __HEAP_SIZE +Heap_Size EQU __HEAP_SIZE + ELSE +Heap_Size EQU 4096 + ENDIF + + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +Heap_Mem SPACE Heap_Size +__heap_limit + + 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 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD SVC_Handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD PendSV_Handler + DCD SysTick_Handler + + ; External Interrupts + DCD POWER_CLOCK_IRQHandler + DCD RADIO_IRQHandler + DCD UART0_IRQHandler + DCD SPI0_TWI0_IRQHandler + DCD SPI1_TWI1_IRQHandler + DCD 0 ; Reserved + DCD GPIOTE_IRQHandler + DCD ADC_IRQHandler + DCD TIMER0_IRQHandler + DCD TIMER1_IRQHandler + DCD TIMER2_IRQHandler + DCD RTC0_IRQHandler + DCD TEMP_IRQHandler + DCD RNG_IRQHandler + DCD ECB_IRQHandler + DCD CCM_AAR_IRQHandler + DCD WDT_IRQHandler + DCD RTC1_IRQHandler + DCD QDEC_IRQHandler + DCD LPCOMP_IRQHandler + DCD SWI0_IRQHandler + DCD SWI1_IRQHandler + DCD SWI2_IRQHandler + DCD SWI3_IRQHandler + DCD SWI4_IRQHandler + DCD SWI5_IRQHandler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + +__Vectors_End + +__Vectors_Size EQU __Vectors_End - __Vectors + + AREA |.text|, CODE, READONLY + +; Reset Handler + +NRF_POWER_RAMON_ADDRESS EQU 0x40000524 ; NRF_POWER->RAMON address +NRF_POWER_RAMONB_ADDRESS EQU 0x40000554 ; NRF_POWER->RAMONB address +NRF_POWER_RAMONx_RAMxON_ONMODE_Msk EQU 0x3 ; All RAM blocks on in onmode bit mask + +Reset_Handler PROC + EXPORT Reset_Handler [WEAK] + IMPORT SystemInit + IMPORT __main + + MOVS R1, #NRF_POWER_RAMONx_RAMxON_ONMODE_Msk + + LDR R0, =NRF_POWER_RAMON_ADDRESS + LDR R2, [R0] + ORRS R2, R2, R1 + STR R2, [R0] + + LDR R0, =NRF_POWER_RAMONB_ADDRESS + LDR R2, [R0] + ORRS R2, R2, R1 + STR R2, [R0] + + LDR R0, =SystemInit + 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 +SVC_Handler PROC + EXPORT SVC_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 UART0_IRQHandler [WEAK] + EXPORT SPI0_TWI0_IRQHandler [WEAK] + EXPORT SPI1_TWI1_IRQHandler [WEAK] + EXPORT GPIOTE_IRQHandler [WEAK] + EXPORT ADC_IRQHandler [WEAK] + EXPORT TIMER0_IRQHandler [WEAK] + EXPORT TIMER1_IRQHandler [WEAK] + EXPORT TIMER2_IRQHandler [WEAK] + EXPORT RTC0_IRQHandler [WEAK] + EXPORT TEMP_IRQHandler [WEAK] + EXPORT RNG_IRQHandler [WEAK] + EXPORT ECB_IRQHandler [WEAK] + EXPORT CCM_AAR_IRQHandler [WEAK] + EXPORT WDT_IRQHandler [WEAK] + EXPORT RTC1_IRQHandler [WEAK] + EXPORT QDEC_IRQHandler [WEAK] + EXPORT LPCOMP_IRQHandler [WEAK] + EXPORT SWI0_IRQHandler [WEAK] + EXPORT SWI1_IRQHandler [WEAK] + EXPORT SWI2_IRQHandler [WEAK] + EXPORT SWI3_IRQHandler [WEAK] + EXPORT SWI4_IRQHandler [WEAK] + EXPORT SWI5_IRQHandler [WEAK] +POWER_CLOCK_IRQHandler +RADIO_IRQHandler +UART0_IRQHandler +SPI0_TWI0_IRQHandler +SPI1_TWI1_IRQHandler +GPIOTE_IRQHandler +ADC_IRQHandler +TIMER0_IRQHandler +TIMER1_IRQHandler +TIMER2_IRQHandler +RTC0_IRQHandler +TEMP_IRQHandler +RNG_IRQHandler +ECB_IRQHandler +CCM_AAR_IRQHandler +WDT_IRQHandler +RTC1_IRQHandler +QDEC_IRQHandler +LPCOMP_IRQHandler +SWI0_IRQHandler +SWI1_IRQHandler +SWI2_IRQHandler +SWI3_IRQHandler +SWI4_IRQHandler +SWI5_IRQHandler + B . + ENDP + ALIGN + +; User Initial Stack & Heap + + IF :DEF:__MICROLIB + + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + + ELSE + + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + + LDR R0, = Heap_Mem + LDR R1, = (Stack_Mem + Stack_Size) + LDR R2, = (Heap_Mem + Heap_Size) + LDR R3, = Stack_Mem + BX LR + + ALIGN + + ENDIF + + END diff --git a/Keil/RTE/Device/nRF51822_xxAB/system_nrf51.c b/Keil/RTE/Device/nRF51822_xxAB/system_nrf51.c new file mode 100644 index 0000000..9bfe509 --- /dev/null +++ b/Keil/RTE/Device/nRF51822_xxAB/system_nrf51.c @@ -0,0 +1,121 @@ +/* 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. + * + */ + +/* NOTE: Template files (including this one) are application specific and therefore expected to + be copied into the application project folder prior to its use! */ + +#include +#include +#include "nrf.h" +#include "system_nrf51.h" + +/*lint ++flb "Enter library region" */ + + +#define __SYSTEM_CLOCK (16000000UL) /*!< nRF51 devices use a fixed System Clock Frequency of 16MHz */ + +static bool is_manual_peripheral_setup_needed(void); +static bool is_disabled_in_debug_needed(void); + + +#if defined ( __CC_ARM ) + uint32_t SystemCoreClock __attribute__((used)) = __SYSTEM_CLOCK; +#elif defined ( __ICCARM__ ) + __root uint32_t SystemCoreClock = __SYSTEM_CLOCK; +#elif defined ( __GNUC__ ) + uint32_t SystemCoreClock __attribute__((used)) = __SYSTEM_CLOCK; +#endif + +void SystemCoreClockUpdate(void) +{ + SystemCoreClock = __SYSTEM_CLOCK; +} + +void SystemInit(void) +{ + /* If desired, switch off the unused RAM to lower consumption by the use of RAMON register. + It can also be done in the application main() function. */ + + /* Prepare the peripherals for use as indicated by the PAN 26 "System: Manual setup is required + to enable the use of peripherals" found at Product Anomaly document for your device found at + https://www.nordicsemi.com/. The side effect of executing these instructions in the devices + that do not need it is that the new peripherals in the second generation devices (LPCOMP for + example) will not be available. */ + if (is_manual_peripheral_setup_needed()) + { + *(uint32_t volatile *)0x40000504 = 0xC007FFDF; + *(uint32_t volatile *)0x40006C18 = 0x00008000; + } + + /* Disable PROTENSET registers under debug, as indicated by PAN 59 "MPU: Reset value of DISABLEINDEBUG + register is incorrect" found at Product Anomaly document four your device found at + https://www.nordicsemi.com/. There is no side effect of using these instruction if not needed. */ + if (is_disabled_in_debug_needed()) + { + NRF_MPU->DISABLEINDEBUG = MPU_DISABLEINDEBUG_DISABLEINDEBUG_Disabled << MPU_DISABLEINDEBUG_DISABLEINDEBUG_Pos; + } +} + + +static bool is_manual_peripheral_setup_needed(void) +{ + if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x1) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) + { + if ((((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x00) && (((*(uint32_t *)0xF0000FEC) & 0x000000F0) == 0x0)) + { + return true; + } + if ((((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x10) && (((*(uint32_t *)0xF0000FEC) & 0x000000F0) == 0x0)) + { + return true; + } + if ((((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) && (((*(uint32_t *)0xF0000FEC) & 0x000000F0) == 0x0)) + { + return true; + } + } + + return false; +} + +static bool is_disabled_in_debug_needed(void) +{ + if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x1) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) + { + if ((((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x40) && (((*(uint32_t *)0xF0000FEC) & 0x000000F0) == 0x0)) + { + return true; + } + } + + return false; +} + +/*lint --flb "Leave library region" */ diff --git a/Keil/RTE/_EPD/RTE_Components.h b/Keil/RTE/_EPD/RTE_Components.h new file mode 100644 index 0000000..9350a11 --- /dev/null +++ b/Keil/RTE/_EPD/RTE_Components.h @@ -0,0 +1,21 @@ + +/* + * Auto generated Run-Time-Environment Configuration File + * *** Do not modify ! *** + * + * Project: 'EPD' + * Target: 'EPD' + */ + +#ifndef RTE_COMPONENTS_H +#define RTE_COMPONENTS_H + + +/* + * Define the Device Header File: + */ +#define CMSIS_device_header "nrf.h" + + + +#endif /* RTE_COMPONENTS_H */ diff --git a/Keil/RTE/_EPD_Debug/RTE_Components.h b/Keil/RTE/_EPD_Debug/RTE_Components.h new file mode 100644 index 0000000..b55965f --- /dev/null +++ b/Keil/RTE/_EPD_Debug/RTE_Components.h @@ -0,0 +1,21 @@ + +/* + * Auto generated Run-Time-Environment Configuration File + * *** Do not modify ! *** + * + * Project: 'EPD' + * Target: 'EPD_Debug' + */ + +#ifndef RTE_COMPONENTS_H +#define RTE_COMPONENTS_H + + +/* + * Define the Device Header File: + */ +#define CMSIS_device_header "nrf.h" + + + +#endif /* RTE_COMPONENTS_H */ diff --git a/Keil/RTE/_flash_softdevice/RTE_Components.h b/Keil/RTE/_flash_softdevice/RTE_Components.h new file mode 100644 index 0000000..6c704ae --- /dev/null +++ b/Keil/RTE/_flash_softdevice/RTE_Components.h @@ -0,0 +1,21 @@ + +/* + * Auto generated Run-Time-Environment Configuration File + * *** Do not modify ! *** + * + * Project: 'EPD' + * Target: 'flash_softdevice' + */ + +#ifndef RTE_COMPONENTS_H +#define RTE_COMPONENTS_H + + +/* + * Define the Device Header File: + */ +#define CMSIS_device_header "nrf.h" + + + +#endif /* RTE_COMPONENTS_H */ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/components/ant/ant_channel_config/ant_channel_config.c b/components/ant/ant_channel_config/ant_channel_config.c new file mode 100644 index 0000000..4be688d --- /dev/null +++ b/components/ant/ant_channel_config/ant_channel_config.c @@ -0,0 +1,68 @@ +/* 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 "ant_channel_config.h" +#include "ant_interface.h" +#include "ant_parameters.h" +#include "nrf_error.h" + +uint32_t ant_channel_init(ant_channel_config_t const * p_config) +{ + uint32_t err_code; + // Set Channel Number. + err_code = sd_ant_channel_assign(p_config->channel_number, + p_config->channel_type, + p_config->network_number, + p_config->ext_assign); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Set Channel ID. + err_code = sd_ant_channel_id_set(p_config->channel_number, + p_config->device_number, + p_config->device_type, + p_config->transmission_type); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Set Channel RF frequency. + err_code = sd_ant_channel_radio_freq_set(p_config->channel_number, p_config->rf_freq); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Set Channel period. + if (!(p_config->ext_assign & EXT_PARAM_ALWAYS_SEARCH)) + { + err_code = sd_ant_channel_period_set(p_config->channel_number, p_config->channel_period); + } + + +#if ANT_CONFIG_ENCRYPTED_CHANNELS > 0 + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + err_code = ant_channel_encrypt_config(p_config->channel_type , p_config->channel_number, p_config->p_crypto_settings); +#endif + + return err_code; +} diff --git a/components/ant/ant_channel_config/ant_channel_config.h b/components/ant/ant_channel_config/ant_channel_config.h new file mode 100644 index 0000000..35c5cd3 --- /dev/null +++ b/components/ant/ant_channel_config/ant_channel_config.h @@ -0,0 +1,50 @@ +#ifndef ANT_CHANNEL_CONFIG_H__ +#define ANT_CHANNEL_CONFIG_H__ + +/** @file + * + * @defgroup ant_sdk_channel_config ANT channel configuration + * @{ + * @ingroup ant_sdk_utils + * @brief ANT channel configuration module. + */ + +#include +#include "ant_stack_config_defs.h" + + +#ifndef ANT_CONFIG_ENCRYPTED_CHANNELS + #error Undefined ANT_CONFIG_ENCRYPTED_CHANNELS. It should be defined in ant_stack_config_defs.h file. +#elif ANT_CONFIG_ENCRYPTED_CHANNELS > 0 + #include "ant_encrypt_config.h" +#endif + +/**@brief ANT channel configuration structure. */ +typedef struct +{ + uint8_t channel_number; ///< Assigned channel number. + uint8_t channel_type; ///< Channel type (see Assign Channel Parameters in ant_parameters.h: @ref ant_parameters). + uint8_t ext_assign; ///< Extended assign (see Ext. Assign Channel Parameters in ant_parameters.h: @ref ant_parameters). + uint8_t rf_freq; ///< Radio frequency offset from 2400 MHz (for example, 2466 MHz, ucFreq = 66). + uint8_t transmission_type; ///< Transmission type. + uint8_t device_type; ///< Device type. + uint8_t device_number; ///< Device number. + uint16_t channel_period; ///< The period in 32 kHz counts. + uint8_t network_number; ///< Network number denoting the network key. + +#if ANT_CONFIG_ENCRYPTED_CHANNELS > 0 + ant_encrypt_channel_settings_t * p_crypto_settings; ///< Pointer to cryptographic settings, NULL if this configuration have to be omitted. +#endif + +} ant_channel_config_t; + +/**@brief Function for configuring the ANT channel. + * + * @param[in] p_config Pointer to the channel configuration structure. + * + * @retval NRF_SUCCESS If the channel was successfully configured. Otherwise, an error code is returned. + */ +uint32_t ant_channel_init(ant_channel_config_t const * p_config); + +#endif // ANT_CHANNEL_CONFIG_H__ +/** @} */ diff --git a/components/ant/ant_encryption/ant_encrypt_config.c b/components/ant/ant_encryption/ant_encrypt_config.c new file mode 100644 index 0000000..e7a27e3 --- /dev/null +++ b/components/ant/ant_encryption/ant_encrypt_config.c @@ -0,0 +1,222 @@ +/* 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 +#include "ant_encrypt_config.h" +#include "ant_interface.h" +#include "ant_parameters.h" +#include "nrf_error.h" + +#ifdef ANT_ENCRYPT_SLAVE_NEGOTIATION_USED + #include "ant_encrypt_negotiation_slave.h" +#endif + + /*lint -e551 -save*/ +/** Flag for checking if stack was configured for encryption. */ +static bool m_stack_encryption_configured = false; + /*lint -restore */ + + /** Pointer to handler of module's events. */ +static ant_encryp_user_handler_t m_ant_enc_evt_handler = NULL; + +static ret_code_t ant_enc_advance_burs_config_apply( + ant_encrypt_adv_burst_settings_t const * const p_adv_burst_set); + +ret_code_t ant_stack_encryption_config(ant_encrypt_stack_settings_t const * const p_crypto_set) +{ + ret_code_t err_code; + + for ( uint32_t i = 0; i < p_crypto_set->key_number; i++) + { + err_code = sd_ant_crypto_key_set(i, p_crypto_set->pp_key[i]); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + + if (p_crypto_set->p_adv_burst_config != NULL) + { + err_code = ant_enc_advance_burs_config_apply(p_crypto_set->p_adv_burst_config); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + + // subcomands LUT for @ref sd_ant_crypto_info_set calls + const uint8_t set_enc_info_param_lut[] = + { + ENCRYPTION_INFO_SET_CRYPTO_ID, + ENCRYPTION_INFO_SET_CUSTOM_USER_DATA, + ENCRYPTION_INFO_SET_RNG_SEED + }; + + for ( uint32_t i = 0; i < sizeof(set_enc_info_param_lut); i++) + { + if ( p_crypto_set->info.pp_array[i] != NULL) + { + err_code = sd_ant_crypto_info_set(set_enc_info_param_lut[i], + p_crypto_set->info.pp_array[i]); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + } + + #ifdef ANT_ENCRYPT_SLAVE_NEGOTIATION_USED + // all ANT channels have unsupported slave encryption tracking (even master's channel) + ant_channel_encryp_negotiation_slave_init(); + #endif + + m_ant_enc_evt_handler = NULL; + + m_stack_encryption_configured = true; + + return NRF_SUCCESS; +} + + +/** + * @brief Function for configuring advanced burst settings according to encryption requirements. + * + * @param p_adv_burst_set Pointer to ANT advanced burst settings. + * + * @retval Value returned by @ref sd_ant_adv_burst_config_set. + */ +static ret_code_t ant_enc_advance_burs_config_apply( + ant_encrypt_adv_burst_settings_t const * const p_adv_burst_set) +{ + uint8_t adv_burst_conf_str[ADV_BURST_CFG_MIN_SIZE] = + { ADV_BURST_MODE_ENABLE, 0, 0, 0, 0, 0, 0, 0 }; + + adv_burst_conf_str[ADV_BURST_CFG_PACKET_SIZE_INDEX] = p_adv_burst_set->packet_length; + adv_burst_conf_str[ADV_BURST_CFG_REQUIRED_FEATURES] = p_adv_burst_set->required_feature; + adv_burst_conf_str[ADV_BURST_CFG_OPTIONAL_FEATURES] = p_adv_burst_set->optional_feature; + + return sd_ant_adv_burst_config_set(adv_burst_conf_str, sizeof(adv_burst_conf_str)); +} + + +ret_code_t ant_channel_encrypt_config_perform(uint8_t channel_number, + ant_encrypt_channel_settings_t * p_crypto_config) +{ + return sd_ant_crypto_channel_enable(channel_number, + p_crypto_config->mode, + p_crypto_config->key_index, + p_crypto_config->decimation_rate); +} + + +ret_code_t ant_channel_encrypt_config(uint8_t channel_type, + uint8_t channel_number, + ant_encrypt_channel_settings_t * p_crypto_config) +{ + ret_code_t err_code; + + if (p_crypto_config != NULL) + { + // encryption of the stack should be initialized previously + if (m_stack_encryption_configured == false) + { + return MODULE_NOT_INITIALZED; + } + + switch (channel_type) + { + case CHANNEL_TYPE_MASTER: + err_code = ant_channel_encrypt_config_perform(channel_number, p_crypto_config); +#ifdef ANT_ENCRYPT_SLAVE_NEGOTIATION_USED + ant_channel_encryp_tracking_state_set(channel_number, + ANT_ENC_CHANNEL_STAT_TRACKING_UNSUPPORTED); +#endif + break; + +#ifdef ANT_ENCRYPT_SLAVE_NEGOTIATION_USED + case CHANNEL_TYPE_SLAVE: + ant_slave_channel_encrypt_config(channel_number, p_crypto_config); + + if (p_crypto_config->mode == ENCRYPTION_DISABLED_MODE) + { + err_code = ant_channel_encrypt_config_perform(channel_number, p_crypto_config); + ant_channel_encryp_tracking_state_set(channel_number, + ANT_ENC_CHANNEL_STAT_TRACKING_UNSUPPORTED); + } + else + { + ant_channel_encryp_tracking_state_set(channel_number, + ANT_ENC_CHANNEL_STAT_NOT_TRACKING); + err_code = NRF_SUCCESS; + } + break; +#endif + + default: + err_code = NRF_ERROR_INVALID_PARAM; + break; + } + } + else + { +#ifdef ANT_ENCRYPT_SLAVE_NEGOTIATION_USED + ant_channel_encryp_tracking_state_set(channel_number, + ANT_ENC_CHANNEL_STAT_TRACKING_UNSUPPORTED); +#endif + err_code = NRF_SUCCESS; + } + + return err_code; +} + +/** @brief Function for calling the handler of module events.*/ +static void ant_encrypt_user_handler_try_to_run(uint8_t ant_channel, ant_encrypt_user_evt_t event) +{ + if (m_ant_enc_evt_handler != NULL) + { + m_ant_enc_evt_handler(ant_channel, event); + } +} + +void ant_encrypt_event_handler(ant_evt_t * p_ant_evt) +{ + uint8_t const ant_channel = p_ant_evt->channel; + +#ifdef ANT_ENCRYPT_SLAVE_NEGOTIATION_USED + ant_slave_encrypt_negotiation(p_ant_evt); +#endif + + switch (p_ant_evt->event) + { + case EVENT_RX_FAIL_GO_TO_SEARCH: + ant_encrypt_user_handler_try_to_run(ant_channel, ANT_ENC_EVT_CHANNEL_LOST); + break; + + case EVENT_ENCRYPT_NEGOTIATION_SUCCESS: + ant_encrypt_user_handler_try_to_run(ant_channel, ANT_ENC_EVT_NEGOTIATION_SUCCESS); + break; + + case EVENT_ENCRYPT_NEGOTIATION_FAIL: + ant_encrypt_user_handler_try_to_run(ant_channel, ANT_ENC_EVT_NEGOTIATION_FAIL); + break; + } +} + +void ant_enc_event_handler_register(ant_encryp_user_handler_t user_handler_func) +{ + m_ant_enc_evt_handler = user_handler_func; +} + diff --git a/components/ant/ant_encryption/ant_encrypt_config.h b/components/ant/ant_encryption/ant_encrypt_config.h new file mode 100644 index 0000000..3a9489e --- /dev/null +++ b/components/ant/ant_encryption/ant_encrypt_config.h @@ -0,0 +1,219 @@ +/* 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. + * + */ + +#ifndef ANT_ENCRYPT_CONFIG__ +#define ANT_ENCRYPT_CONFIG__ + +/**@file + * + * @defgroup ant_encrypt_config ANT encryption configuration + * @{ + * @ingroup ant_sdk_utils + * + * @brief Encryption configuration for the ANT stack and channels. + * + */ + +#include + +#include "sdk_errors.h" +#include "ant_stack_handler_types.h" + +/** @name Advanced burst configuration for encryption modules + * @{ + */ +#define ADV_BURST_CFG_MIN_SIZE 8 ///< Minimum size of the advance burst configuration data. +#define ADV_BURST_CFG_PACKET_SIZE_INDEX 1 ///< Index of the packet size field in the configuration data. +#define ADV_BURST_CFG_REQUIRED_FEATURES 2 ///< Index of the required features field in the configuration data. +#define ADV_BURST_CFG_OPTIONAL_FEATURES 5 ///< Index of the optional features field in the configuration data. +/**@} */ + +/** @brief ANT channel cryptographic configuration. */ +typedef struct +{ + uint8_t mode; ///< Encryption mode. See the encrypted channel defines in ant_parameters.h. + uint8_t key_index; ///< Index of encryption key. + uint8_t decimation_rate; ///< Division of the master channel rate by the slave’s tracking channel rate. +} ant_encrypt_channel_settings_t; + +/** @brief ANT encryption information. */ +typedef union +{ + uint8_t * pp_array[3]; // For array access support. + struct + { + uint8_t * p_encryption_id; ///< Pointer to the encryption ID of the device (4 bytes). + uint8_t * p_user_info; ///< Pointer to the user information string (19 bytes). + uint8_t * p_random_num_seed; ///< Pointer to the random number seed (16 bytes). + } items; +} ant_encrypt_info_settings_t; + +/** @brief Advanced burst settings used by the encrypted channel. */ +typedef struct +{ + uint8_t packet_length; ///< RF payload size. See the advanced burst configuration defines in ant_parameters.h. + uint8_t required_feature; ///< Required advanced burst modes. See the advanced burst configuration defines in ant_parameters.h. + uint8_t optional_feature; ///< Optional advanced burst modes. See the advanced burst configuration defines in ant_parameters.h. +} ant_encrypt_adv_burst_settings_t; + +/**@brief ANT stack cryptographic configuration. */ +typedef struct +{ + ant_encrypt_info_settings_t info; ///< Pointer to the encryption information structure. + uint8_t * * pp_key; ///< Pointer to an array for pointers to encryption keys. Each key must have a length of 16 bytes. + uint8_t key_number; ///< Number of encryption keys. + ant_encrypt_adv_burst_settings_t * p_adv_burst_config; ///< Advanced burst configuration. If NULL, the advanced burst must be configured externally. +} ant_encrypt_stack_settings_t; + +/** + * @brief ANT encryption negotiation events. + */ +typedef enum +{ + ANT_ENC_EVT_NEGOTIATION_SUCCESS, ///< Negotiation success. + ANT_ENC_EVT_NEGOTIATION_FAIL, ///< Negotiation failure. + ANT_ENC_EVT_CHANNEL_LOST ///< Lost a channel. It's relevant only for slave channels. +} ant_encrypt_user_evt_t; + +/** + * @brief Event handler for ANT encryption user events. + */ +typedef void (* ant_encryp_user_handler_t)(uint8_t channel, ant_encrypt_user_evt_t event); + +/** + * @brief Macro for initializing an ANT encryption information structure. + * + * @param[in] P_ENC_ID Pointer to the encryption ID of the device (4 bytes). + * @param[in] P_USER_INFO Pointer to the user information string (19 bytes). + * @param[in] P_RAND_NUM_SEED Pointer to the random number seed (16 bytes). + */ +#define ANT_CRYPTO_INFO_SETTINGS_INIT(P_ENC_ID, P_USER_INFO, P_RAND_NUM_SEED) \ + { \ + .items = \ + { \ + .p_encryption_id = P_ENC_ID, \ + .p_user_info = P_USER_INFO, \ + .p_random_num_seed = P_RAND_NUM_SEED \ + } \ + } + +/** + * @brief Macro for declaring the basic cryptographic configuration for the ANT stack. + * + * This macro configures the following settings: + * - Cryptographic key + * - Encryption ID + * - Advanced burst mode with the maximum RF payload size + * + * Use @ref ANT_ENCRYPT_STACK_SETTINGS_BASE to access the created configuration instance. + * + * @param[in] NAME Name for the created data instance. + * @param[in] P_KEY Pointer to the cryptographic key (16 bytes). + * @param[in] P_ENC_ID Pointer to the encryption ID (4 bytes). + */ +#define ANT_ENCRYPT_STACK_SETTINGS_BASE_DEF(NAME, P_KEY, P_ENC_ID) \ + ant_encrypt_adv_burst_settings_t NAME##_ant_enc_adv_burst_set = \ + { \ + .packet_length = ADV_BURST_MODES_MAX_SIZE, \ + .required_feature = 0, \ + .optional_feature = 0 \ + }; \ + uint8_t * pp_##NAME##_key[1] = {P_KEY}; \ + ant_encrypt_stack_settings_t NAME ## _ant_crypto_settings = \ + { \ + .info = ANT_CRYPTO_INFO_SETTINGS_INIT(P_ENC_ID, NULL, NULL), \ + .pp_key = pp_##NAME##_key, \ + .key_number = 1, \ + .p_adv_burst_config = &NAME##_ant_enc_adv_burst_set \ + } + + +/** @brief Macro for accessing the configuration instance created + * by @ref ANT_ENCRYPT_STACK_SETTINGS_BASE_DEF. + * + * @param[in] NAME Name of the settings instance. + */ +#define ANT_ENCRYPT_STACK_SETTINGS_BASE(NAME) (NAME##_ant_crypto_settings) + +/** + * @brief Function for applying an encryption configuration to a slave channel. + * + * This function enables encryption on a channel. + * + * This function should be used by the @ref ant_encrypt_negotiation_slave module and this module. + * + * @param[in] channel_number ANT channel number. + * @param[in] p_crypto_config Pointer to the encryption configuration. + * + * @return Value returned by @ref sd_ant_crypto_channel_enable (for example, NRF_SUCCESS if + * the configuration was successful). + */ +ret_code_t ant_channel_encrypt_config_perform(uint8_t channel_number, + ant_encrypt_channel_settings_t * p_crypto_config); + +/** + * @brief Function for applying an encryption configuration to a master or slave channel. + * + * When called for a master channel, this function enables encryption + * for that channel. When called for a slave channel, it saves + * the encryption configuration for future use. + * + * This function should be used by the @ref ant_sdk_channel_config module. + * + * @param[in] channel_type ANT channel type: CHANNEL_TYPE_SLAVE or CHANNEL_TYPE_MASTER. + * @param[in] channel_num ANT channel number. + * @param[in] p_crypto_config Pointer to the encryption configuration. + * + * @retval NRF_SUCCESS If the function completed successfully. + * @retval NRF_ERROR_INVALID_PARAM If the channel type is invalid. + * @retval MODULE_NOT_INITIALZED If the stack is not configured for encryption. + * @retval Other Otherwise, the error value returned by the + * @ref ant_channel_encrypt_config_perform function is returned. + */ +ret_code_t ant_channel_encrypt_config(uint8_t channel_type, + uint8_t channel_num, + ant_encrypt_channel_settings_t * p_crypto_config); + +/** + * @brief Function for configuring the cryptographic settings of the ANT stack. + * + * @param[in] p_crypto_info_set Pointer to the settings. + */ +ret_code_t ant_stack_encryption_config(ant_encrypt_stack_settings_t const * const p_crypto_info_set); + + +/** + * @brief Function for handling ANT encryption events. + * + * This function should be used directly in the ANT event dispatching process. + * It serves the ANT encryption events to the registered event handler. + * If @ref ant_encrypt_negotiation_slave is used, this function is required. + * + * This function should be used by the @ref ant_encrypt_config module. + * + * @param[in] p_ant_evt Pointer to the ANT stack event message structure. + */ +void ant_encrypt_event_handler(ant_evt_t * p_ant_evt); + +/** + * @brief Function for registering an event handler for ANT encryption events. + * + * The event handler should support all of the events in @ref ant_encrypt_user_evt_t. + * + * @param[in] p_handler Pointer to a handler function. + */ +void ant_enc_event_handler_register(ant_encryp_user_handler_t p_handler); + +/** + * @} + */ +#endif // ANT_ENCRYPT_CONFIG__ diff --git a/components/ant/ant_encryption/ant_encrypt_negotiation_slave.c b/components/ant/ant_encryption/ant_encrypt_negotiation_slave.c new file mode 100644 index 0000000..52cb9e6 --- /dev/null +++ b/components/ant/ant_encryption/ant_encrypt_negotiation_slave.c @@ -0,0 +1,168 @@ +/* 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 +#include "ant_encrypt_config.h" +#include "ant_interface.h" +#include "ant_parameters.h" +#include "nrf_error.h" +#include "app_error.h" + +#include "ant_stack_config_defs.h" +#include "ant_encrypt_negotiation_slave.h" + +#ifndef ANT_ENCRYPT_SLAVE_NEGOTIATION_USED + #error "To use this module, ANT_ENCRYPT_SLAVE_NEGOTIATION_USED must be declared globally." +#else + +/** Number of supported channels. */ +#define NUMBER_OF_CHANNELS (ANT_CONFIG_TOTAL_CHANNELS_ALLOCATED) + +/** Flag to block other channels from attempting to enable encryption while + * another encryption is in the process. + */ +static volatile bool m_can_enable_crypto = true; + +/** Array to keep track of which channels are currently tracking. */ +static ant_encrypt_tracking_state_t m_encrypt_channel_states[NUMBER_OF_CHANNELS]; + +/** Array for the slave channels' encryption settings. */ +static ant_encrypt_channel_settings_t m_slave_channel_conf[MAX_ANT_CHANNELS]; + + + +void ant_channel_encryp_tracking_state_set(uint8_t channel_number, + ant_encrypt_tracking_state_t state) +{ + m_encrypt_channel_states[channel_number] = state; +} + + +void ant_channel_encryp_negotiation_slave_init(void) +{ + for (uint32_t channel = 0; channel < NUMBER_OF_CHANNELS; channel++) + { + ant_channel_encryp_tracking_state_set(channel, ANT_ENC_CHANNEL_STAT_TRACKING_UNSUPPORTED); + } + + m_can_enable_crypto = true; +} + + +ant_encrypt_tracking_state_t ant_channel_encryp_tracking_state_get(uint8_t channel_number) +{ + return m_encrypt_channel_states[channel_number]; +} + + +void ant_slave_channel_encrypt_config(uint8_t channel_number, + ant_encrypt_channel_settings_t const * const p_crypto_config) +{ + memcpy(&m_slave_channel_conf[channel_number], p_crypto_config, + sizeof(ant_encrypt_channel_settings_t)); +} + + +/**@brief Function for handling ANT RX channel events. + * + * @param[in] p_event_message_buffer The ANT event message buffer. + */ +static void ant_slave_encrypt_try_enable(uint8_t ant_channel, + uint8_t ant_message_id) +{ + uint32_t err_code; + ant_encrypt_tracking_state_t track_stat; + + + switch (ant_message_id) + { + // Broadcast data received. + case MESG_BROADCAST_DATA_ID: + + track_stat = ant_channel_encryp_tracking_state_get(ant_channel); + // If the encryption has not yet been negotiated for this channel and another channel + // is not currently trying to enable encryption, enable encryption + if ((track_stat != ANT_ENC_CHANNEL_STAT_TRACKING_DECRYPTED) + && (track_stat != ANT_ENC_CHANNEL_STAT_NEGOTIATING) + && m_can_enable_crypto) + { + // Block other channels from trying to enable encryption until this channel + // is finished + m_can_enable_crypto = false; + ant_channel_encryp_tracking_state_set(ant_channel, + ANT_ENC_CHANNEL_STAT_NEGOTIATING); + + // Enable encryption on ant_channel + err_code = + ant_channel_encrypt_config_perform(ant_channel, + &m_slave_channel_conf[ant_channel]); + APP_ERROR_CHECK(err_code); + } + break; + + default: + break; + } +} + + +void ant_slave_encrypt_negotiation(ant_evt_t * p_ant_evt) +{ + + uint8_t const ant_channel = p_ant_evt->channel; + ANT_MESSAGE * p_ant_msg; + + ant_encrypt_tracking_state_t track_state = ant_channel_encryp_tracking_state_get(ant_channel); + + if (track_state == ANT_ENC_CHANNEL_STAT_TRACKING_UNSUPPORTED) + return; + + switch (p_ant_evt->event) + { + case EVENT_RX_FAIL_GO_TO_SEARCH: + if (track_state == ANT_ENC_CHANNEL_STAT_NEGOTIATING) + { + m_can_enable_crypto = true; + } + + ant_channel_encryp_tracking_state_set(ant_channel, ANT_ENC_CHANNEL_STAT_NOT_TRACKING); + break; + + case EVENT_RX: + /*lint -e545 -save*/ + p_ant_msg = (ANT_MESSAGE *) &(p_ant_evt->evt_buffer); + /*lint -restore*/ + ant_slave_encrypt_try_enable(ant_channel, p_ant_msg->ANT_MESSAGE_ucMesgID); + break; + + case EVENT_ENCRYPT_NEGOTIATION_SUCCESS: + m_can_enable_crypto = true; + ant_channel_encryp_tracking_state_set(ant_channel, + ANT_ENC_CHANNEL_STAT_TRACKING_DECRYPTED); + break; + + case EVENT_ENCRYPT_NEGOTIATION_FAIL: + m_can_enable_crypto = true; + ant_channel_encryp_tracking_state_set(ant_channel, + ANT_ENC_CHANNEL_STAT_TRACKING_ENCRYPTED); + break; + + default: + break; + } +} + + +#endif + + diff --git a/components/ant/ant_encryption/ant_encrypt_negotiation_slave.h b/components/ant/ant_encryption/ant_encrypt_negotiation_slave.h new file mode 100644 index 0000000..a5cd5ae --- /dev/null +++ b/components/ant/ant_encryption/ant_encrypt_negotiation_slave.h @@ -0,0 +1,104 @@ +/* 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. + * + */ + +#ifndef ANT_ENCRYPT_NEGOTIATION_SLAVE_H__ +#define ANT_ENCRYPT_NEGOTIATION_SLAVE_H__ + +/**@file + * + * @defgroup ant_encrypt_negotiation_slave ANT encryption negotiation + * @{ + * @ingroup ant_sdk_utils + * + * @brief Encryption negotiation for encrypted ANT slave channels. + * + * After pairing, the slave starts negotiating the encryption with the master. After + * successful negotiation, the slave can decrypt messages from the master, and all + * future messages are sent encrypted. + * + */ + +#include +#include "ant_stack_handler_types.h" +#include "ant_encrypt_config.h" + +/** Encryption negotiation states for a slave channel. */ +typedef enum +{ + ANT_ENC_CHANNEL_STAT_NOT_TRACKING, ///< Not tracking the master. + ANT_ENC_CHANNEL_STAT_TRACKING_ENCRYPTED, ///< Tracking the master, but cannot decrypt messages. + ANT_ENC_CHANNEL_STAT_NEGOTIATING, ///< Encryption has been enabled and negotiation is in progress. + ANT_ENC_CHANNEL_STAT_TRACKING_DECRYPTED, ///< Tracking the master and can decrypt messages. + ANT_ENC_CHANNEL_STAT_TRACKING_UNSUPPORTED ///< Tracking unsupported on this channel. +} ant_encrypt_tracking_state_t; + + +/** + * @brief Function for setting the encryption negotiation state of a slave ANT channel. + * + * This function should be used by the @ref ant_encrypt_config module. + * + * @param[in] channel_number ANT channel number. + * @param[in] state State to set. + */ +void ant_channel_encryp_tracking_state_set(uint8_t channel_number, + ant_encrypt_tracking_state_t state); + +/** + * @brief Function for getting the encryption negotiation state of a slave ANT channel. + * + * @param[in] channel_number ANT channel number. + */ +ant_encrypt_tracking_state_t ant_channel_encryp_tracking_state_get(uint8_t channel_number); + +/** + * @brief Function for initializing the module. + * + * This function initializes internal states of the module. It should + * only be used by the @ref ant_encrypt_config module. + * + */ +void ant_channel_encryp_negotiation_slave_init(void); + +/** + * @brief Function for setting the configuration for the slave channel. + * + * This function saves the channel's encryption configuration to a lookup table (LUT) for + * future usage. The configuration can then be used to enable encryption. + * + * This function is intended to be used by the @ref ant_encrypt_config module. + * + * @param[in] channel_number ANT channel number. + * @param[in] p_crypto_config Pointer to the encryption configuration. + */ +void ant_slave_channel_encrypt_config(uint8_t channel_number, + ant_encrypt_channel_settings_t const * const p_crypto_config); + + +/** + * @brief Function for handling ANT encryption negotiation on slave nodes. + * + * This function should be used directly in the ANT event dispatching process. It + * tries to enable slave channel encryption for all slave channels that are declared + * as encrypted channels (if appropriate master channels are found). + * + * This function should be used by the @ref ant_encrypt_config module. + * + * @param[in] p_ant_evt Pointer to the ANT stack event message structure. + */ +void ant_slave_encrypt_negotiation(ant_evt_t * p_ant_evt); + + +/** + * @} + */ +#endif // ANT_ENCRYPT_NEGOTIATION_SLAVE_H__ diff --git a/components/ant/ant_key_manager/ant_key_manager.c b/components/ant/ant_key_manager/ant_key_manager.c new file mode 100644 index 0000000..9404945 --- /dev/null +++ b/components/ant/ant_key_manager/ant_key_manager.c @@ -0,0 +1,35 @@ +/* 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 "stdio.h" +#include "ant_key_manager.h" +#include "ant_key_manager_config.h" +#include "ant_interface.h" +#include "nrf_assert.h" + +static uint8_t m_ant_plus_network_key[] = ANT_PLUS_NETWORK_KEY; +static uint8_t m_ant_fs_network_key[] = ANT_FS_NETWORK_KEY; + +uint32_t ant_custom_key_set(uint8_t network_number, uint8_t * network_key) +{ + ASSERT(network_key != NULL); + return sd_ant_network_address_set(network_number, network_key); +} + +uint32_t ant_plus_key_set(uint8_t network_number) +{ + return sd_ant_network_address_set(network_number, m_ant_plus_network_key); +} + +uint32_t ant_fs_key_set(uint8_t network_number) +{ + return sd_ant_network_address_set(network_number, m_ant_fs_network_key); +} diff --git a/components/ant/ant_key_manager/ant_key_manager.h b/components/ant/ant_key_manager/ant_key_manager.h new file mode 100644 index 0000000..0c571a8 --- /dev/null +++ b/components/ant/ant_key_manager/ant_key_manager.h @@ -0,0 +1,67 @@ +/* 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. + * + */ +#ifndef ANT_KEY_MANAGER_H__ +#define ANT_KEY_MANAGER_H__ + +#include "stdint.h" + +/** + * @file + */ +/** + * @defgroup ant_key_manager ANT key manager + * @{ + * @ingroup ant_sdk_utils + * @brief Module for registering common and custom ANT network keys. + */ + +/**@brief Function for registering a custom network key. + * + * @param[in] network_number Network key number. + * @param[in] p_network_key Pointer to the custom ANT network key. + * + * @return A SoftDevice error code. + */ +uint32_t ant_custom_key_set(uint8_t network_number, uint8_t * p_network_key); + +/**@brief Function for registering an ANT+ network key. + * + * The key must be defined by @ref ANT_PLUS_NETWORK_KEY. + * + * @note The ANT+ Network Key is available for ANT+ Adopters. Go to http://thisisant.com + * to become an ANT+ Adopter and access the key. + * + * @param[in] network_number Network key number. + * + * @return A SoftDevice error code. + */ +uint32_t ant_plus_key_set(uint8_t network_number); + +/**@brief Function for registering an ANT-FS network key. + * + * The key must be defined by @ref ANT_FS_NETWORK_KEY. + * + * @note The ANT+ Network Key is available for ANT+ Adopters. Go to http://thisisant.com + * to become an ANT+ Adopter and access the key. + * + * @param[in] network_number Network key number. + * + * @return A SoftDevice error code. + */ +uint32_t ant_fs_key_set(uint8_t network_number); + + +/** + * @} + */ + +#endif // ANT_KEY_MANAGER_H__ diff --git a/components/ant/ant_key_manager/config/ant_key_manager_config.h b/components/ant/ant_key_manager/config/ant_key_manager_config.h new file mode 100644 index 0000000..4ee83b7 --- /dev/null +++ b/components/ant/ant_key_manager/config/ant_key_manager_config.h @@ -0,0 +1,33 @@ +/* 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. + * + */ + +#ifndef ANT_KEY_MANAGER_CONFIG_H__ +#define ANT_KEY_MANAGER_CONFIG_H__ + +/** + * @addtogroup ant_key_manager + * @{ + */ + +#ifndef ANT_PLUS_NETWORK_KEY + #define ANT_PLUS_NETWORK_KEY {0, 0, 0, 0, 0, 0, 0, 0} /**< The ANT+ network key. */ +#endif //ANT_PLUS_NETWORK_KEY + +#ifndef ANT_FS_NETWORK_KEY + #define ANT_FS_NETWORK_KEY {0, 0, 0, 0, 0, 0, 0, 0} /**< The ANT-FS network key. */ +#endif // ANT_FS_NETWORK_KEY + +/** + * @} + */ + +#endif // ANT_KEY_MANAGER_CONFIG_H__ diff --git a/components/ant/ant_profiles/ant_bpwr/ant_bpwr.c b/components/ant/ant_profiles/ant_bpwr/ant_bpwr.c new file mode 100644 index 0000000..743b2cf --- /dev/null +++ b/components/ant/ant_profiles/ant_bpwr/ant_bpwr.c @@ -0,0 +1,456 @@ +/* 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 "nrf_assert.h" +#include "app_error.h" +#include "ant_interface.h" +#include "app_util.h" +#include "ant_bpwr.h" +#include "ant_bpwr_page_logger.h" +#include "app_error.h" + +#define BPWR_CALIB_INT_TIMEOUT ((ANT_CLOCK_FREQUENCY * BPWR_CALIBRATION_TIMOUT_S) / BPWR_MSG_PERIOD) // calibration timeout in ant message period's unit + +// for torque sensor Minimum: Interleave every 9th message +#define BPWR_PAGE_16_INTERVAL 5 // Preferred: Interleave every 5th message +#define BPWR_PAGE_16_INTERVAL_OFS 2 // Permissible offset +#define COMMON_PAGE_80_INTERVAL 119 // Minimum: Interleave every 121 messages +#define COMMON_PAGE_81_INTERVAL 120 // Minimum: Interleave every 121 messages +#define AUTO_ZERO_SUPPORT_INTERVAL 120 // Minimum: Interleave every 121 messages + +/**@brief Bicycle power message data layout structure. */ +typedef struct +{ + uint8_t page_number; + uint8_t page_payload[7]; +} ant_bpwr_message_layout_t; + + +/**@brief Function for initializing the ANT Bicycle Power Profile instance. + * + * @param[in] p_profile Pointer to the profile instance. + * @param[in] p_channel_config Pointer to the ANT channel configuration structure. + * + * @retval NRF_SUCCESS If initialization was successful. Otherwise, an error code is returned. + */ +static ret_code_t ant_bpwr_init(ant_bpwr_profile_t * p_profile, + ant_channel_config_t const * p_channel_config) +{ + p_profile->channel_number = p_channel_config->channel_number; + + p_profile->page_1 = DEFAULT_ANT_BPWR_PAGE1(); + p_profile->page_16 = DEFAULT_ANT_BPWR_PAGE16(); + p_profile->page_17 = DEFAULT_ANT_BPWR_PAGE17(); + p_profile->page_18 = DEFAULT_ANT_BPWR_PAGE18(); + p_profile->page_80 = DEFAULT_ANT_COMMON_page80(); + p_profile->page_81 = DEFAULT_ANT_COMMON_page81(); + + LOG_BPWR("ANT B-PWR channel %u init\n\r", p_profile->channel_number); + return ant_channel_init(p_channel_config); +} + + +ret_code_t ant_bpwr_disp_init(ant_bpwr_profile_t * p_profile, + ant_channel_config_t const * p_channel_config, + ant_bpwr_disp_config_t const * p_disp_config) +{ + ASSERT(p_profile != NULL); + ASSERT(p_channel_config != NULL); + ASSERT(p_disp_config != NULL); + ASSERT(p_disp_config->evt_handler != NULL); + ASSERT(p_disp_config->p_cb != NULL); + + p_profile->evt_handler = p_disp_config->evt_handler; + p_profile->_cb.p_disp_cb = p_disp_config->p_cb; + + p_profile->_cb.p_disp_cb ->calib_timeout = 0; + p_profile->_cb.p_disp_cb ->calib_stat = BPWR_DISP_CALIB_NONE; + + return ant_bpwr_init(p_profile, p_channel_config); +} + + +ret_code_t ant_bpwr_sens_init(ant_bpwr_profile_t * p_profile, + ant_channel_config_t const * p_channel_config, + ant_bpwr_sens_config_t const * p_sens_config) +{ + ASSERT(p_profile != NULL); + ASSERT(p_channel_config != NULL); + ASSERT(p_sens_config != NULL); + ASSERT(p_sens_config->p_cb != NULL); + ASSERT(p_sens_config->evt_handler != NULL); + ASSERT(p_sens_config->calib_handler != NULL); + + p_profile->evt_handler = p_sens_config->evt_handler; + p_profile->_cb.p_sens_cb = p_sens_config->p_cb; + + p_profile->_cb.p_sens_cb->torque_use = p_sens_config->torque_use; + p_profile->_cb.p_sens_cb->calib_handler = p_sens_config->calib_handler; + p_profile->_cb.p_sens_cb->calib_stat = BPWR_SENS_CALIB_NONE; + p_profile->_cb.p_sens_cb->message_counter = 0; + + return ant_bpwr_init(p_profile, p_channel_config); +} + + + +/**@brief Function for getting next page number to send. + * + * @param[in] p_profile Pointer to the profile instance. + * + * @return Next page number. + */ +static ant_bpwr_page_t next_page_number_get(ant_bpwr_profile_t * p_profile) +{ + ant_bpwr_sens_cb_t * p_bpwr_cb = p_profile->_cb.p_sens_cb; + ant_bpwr_page_t page_number; + + if (p_bpwr_cb->calib_stat == BPWR_SENS_CALIB_READY) + { + page_number = ANT_BPWR_PAGE_1; + p_bpwr_cb->calib_stat = BPWR_SENS_CALIB_NONE; // mark event as processed + } + else if ((p_profile->BPWR_PROFILE_auto_zero_status != ANT_BPWR_AUTO_ZERO_NOT_SUPPORTED) + && (p_bpwr_cb->message_counter == AUTO_ZERO_SUPPORT_INTERVAL)) + { + page_number = ANT_BPWR_PAGE_1; + p_profile->BPWR_PROFILE_calibration_id = ANT_BPWR_CALIB_ID_AUTO_SUPPORT; + p_bpwr_cb->message_counter++; + } + else if (p_bpwr_cb->message_counter >= COMMON_PAGE_81_INTERVAL) + { + page_number = ANT_BPWR_PAGE_81; + p_bpwr_cb->message_counter = 0; + } + else + { + if (p_bpwr_cb->message_counter == COMMON_PAGE_80_INTERVAL) + { + page_number = ANT_BPWR_PAGE_80; + } + else + { + if ( p_bpwr_cb->torque_use == TORQUE_NONE) + { + page_number = ANT_BPWR_PAGE_16; + } + else if ((p_bpwr_cb->message_counter % BPWR_PAGE_16_INTERVAL) + == BPWR_PAGE_16_INTERVAL_OFS) + { + page_number = ANT_BPWR_PAGE_16; + } + else if ( p_bpwr_cb->torque_use == TORQUE_WHEEL) + { + page_number = ANT_BPWR_PAGE_17; + } + else // assumed TORQUE_CRANK + { + page_number = ANT_BPWR_PAGE_18; + } + } + p_bpwr_cb->message_counter++; + } + + return page_number; +} + + +/**@brief Function for encoding Bicycle Power Sensor message. + * + * @note Assume to be call each time when Tx window will occur. + */ +static void sens_message_encode(ant_bpwr_profile_t * p_profile, uint8_t * p_message_payload) +{ + ant_bpwr_message_layout_t * p_bpwr_message_payload = + (ant_bpwr_message_layout_t *)p_message_payload; + + p_bpwr_message_payload->page_number = next_page_number_get(p_profile); + + LOG_BPWR("B-PWR tx page: %u\r\n", p_bpwr_message_payload->page_number); + + switch (p_bpwr_message_payload->page_number) + { + case ANT_BPWR_PAGE_1: + ant_bpwr_page_1_encode(p_bpwr_message_payload->page_payload, &(p_profile->page_1)); + break; + + case ANT_BPWR_PAGE_16: + ant_bpwr_page_16_encode(p_bpwr_message_payload->page_payload, &(p_profile->page_16)); + ant_bpwr_cadence_encode(p_bpwr_message_payload->page_payload, &(p_profile->common)); + break; + + case ANT_BPWR_PAGE_17: + ant_bpwr_page_17_encode(p_bpwr_message_payload->page_payload, &(p_profile->page_17)); + ant_bpwr_cadence_encode(p_bpwr_message_payload->page_payload, &(p_profile->common)); + break; + + case ANT_BPWR_PAGE_18: + ant_bpwr_page_18_encode(p_bpwr_message_payload->page_payload, &(p_profile->page_18)); + ant_bpwr_cadence_encode(p_bpwr_message_payload->page_payload, &(p_profile->common)); + break; + + case ANT_COMMON_PAGE_80: + ant_common_page_80_encode(p_bpwr_message_payload->page_payload, &(p_profile->page_80)); + break; + + case ANT_COMMON_PAGE_81: + ant_common_page_81_encode(p_bpwr_message_payload->page_payload, &(p_profile->page_81)); + break; + + default: + return; + } + LOG_BPWR("\r\n"); + p_profile->evt_handler(p_profile, (ant_bpwr_evt_t)p_bpwr_message_payload->page_number); + +} + + +/**@brief Function for decoding messages received by Bicycle Power sensor message. + * + * @note Assume to be call each time when Rx window will occur. + */ +static void sens_message_decode(ant_bpwr_profile_t * p_profile, uint8_t * p_message_payload) +{ + const ant_bpwr_message_layout_t * p_bpwr_message_payload = + (ant_bpwr_message_layout_t *)p_message_payload; + ant_bpwr_page1_data_t page1; + + switch (p_bpwr_message_payload->page_number) + { + case ANT_BPWR_PAGE_1: + ant_bpwr_page_1_decode(p_bpwr_message_payload->page_payload, &page1); + p_profile->_cb.p_sens_cb->calib_stat = BPWR_SENS_CALIB_REQUESTED; + p_profile->_cb.p_sens_cb->calib_handler(p_profile, &page1); + break; + + default: + break; + } +} + + +/**@brief Function for decoding messages received by Bicycle Power display message. + * + * @note Assume to be call each time when Rx window will occur. + */ +static void disp_message_decode(ant_bpwr_profile_t * p_profile, uint8_t * p_message_payload) +{ + const ant_bpwr_message_layout_t * p_bpwr_message_payload = + (ant_bpwr_message_layout_t *)p_message_payload; + + LOG_BPWR("B-PWR rx page: %u\r\n", p_bpwr_message_payload->page_number); + + switch (p_bpwr_message_payload->page_number) + { + case ANT_BPWR_PAGE_1: + ant_bpwr_page_1_decode(p_bpwr_message_payload->page_payload, &(p_profile->page_1)); + p_profile->_cb.p_disp_cb->calib_stat = BPWR_DISP_CALIB_NONE; + break; + + case ANT_BPWR_PAGE_16: + ant_bpwr_page_16_decode(p_bpwr_message_payload->page_payload, &(p_profile->page_16)); + ant_bpwr_cadence_decode(p_bpwr_message_payload->page_payload, &(p_profile->common)); + break; + + case ANT_BPWR_PAGE_17: + ant_bpwr_page_17_decode(p_bpwr_message_payload->page_payload, &(p_profile->page_17)); + ant_bpwr_cadence_decode(p_bpwr_message_payload->page_payload, &(p_profile->common)); + break; + + case ANT_BPWR_PAGE_18: + ant_bpwr_page_18_decode(p_bpwr_message_payload->page_payload, &(p_profile->page_18)); + ant_bpwr_cadence_decode(p_bpwr_message_payload->page_payload, &(p_profile->common)); + break; + + case ANT_COMMON_PAGE_80: + ant_common_page_80_decode(p_bpwr_message_payload->page_payload, &(p_profile->page_80)); + break; + + case ANT_COMMON_PAGE_81: + ant_common_page_81_decode(p_bpwr_message_payload->page_payload, &(p_profile->page_81)); + break; + + default: + LOG_BPWR("\r\n"); + return; + } + LOG_BPWR("\r\n"); + p_profile->evt_handler(p_profile, (ant_bpwr_evt_t)p_bpwr_message_payload->page_number); +} + + +ret_code_t ant_bpwr_calib_request(ant_bpwr_profile_t * p_profile, ant_bpwr_page1_data_t * p_page_1) +{ + ant_bpwr_message_layout_t bpwr_message_payload; + + if (p_profile->_cb.p_disp_cb->calib_stat == BPWR_DISP_CALIB_REQUESTED) + { + return NRF_SUCCESS; // calibration in progress, so omit this request + } + + bpwr_message_payload.page_number = ANT_BPWR_PAGE_1; + ant_bpwr_page_1_encode(bpwr_message_payload.page_payload, p_page_1); + + uint32_t err_code = sd_ant_acknowledge_message_tx(p_profile->channel_number, + sizeof (bpwr_message_payload), + (uint8_t *) &bpwr_message_payload); + + if (err_code == NRF_SUCCESS) + { + p_profile->_cb.p_disp_cb->calib_timeout = BPWR_CALIB_INT_TIMEOUT; // initialize watch on calibration's time-out + p_profile->_cb.p_disp_cb->calib_stat = BPWR_DISP_CALIB_REQUESTED; + LOG_BPWR("Start calibration process\r\n"); + } + return err_code; +} + + +void ant_bpwr_calib_response(ant_bpwr_profile_t * p_profile) +{ + if (p_profile->_cb.p_sens_cb->calib_stat != BPWR_SENS_CALIB_READY) // abort if callback request is in progress + { + p_profile->_cb.p_sens_cb->calib_stat = BPWR_SENS_CALIB_READY; // calibration respond + } +} + + +/**@brief Function for hangling calibration events. + */ +static void service_calib(ant_bpwr_profile_t * p_profile, uint8_t event) +{ + ant_bpwr_evt_t bpwr_event; + + if (p_profile->_cb.p_disp_cb->calib_stat == BPWR_DISP_CALIB_REQUESTED) + { + switch (event) + { + case EVENT_RX: + /* fall through */ + case EVENT_RX_FAIL: + + if (p_profile->_cb.p_disp_cb->calib_timeout-- == 0) + { + bpwr_event = ANT_BPWR_CALIB_TIMEOUT; + break; + } + else + { + return; + } + + case EVENT_TRANSFER_TX_FAILED: + bpwr_event = ANT_BPWR_CALIB_REQUEST_TX_FAILED; + break; + + case EVENT_RX_SEARCH_TIMEOUT: + bpwr_event = ANT_BPWR_CALIB_TIMEOUT; + break; + + default: + return; + } + + LOG_BPWR("End calibration process\r\n"); + p_profile->_cb.p_disp_cb->calib_stat = BPWR_DISP_CALIB_NONE; + + p_profile->evt_handler(p_profile, bpwr_event); + } +} + + +static void ant_message_send(ant_bpwr_profile_t * p_profile) +{ + uint32_t err_code; + uint8_t p_message_payload[ANT_STANDARD_DATA_PAYLOAD_SIZE]; + + sens_message_encode(p_profile, p_message_payload); + err_code = + sd_ant_broadcast_message_tx(p_profile->channel_number, + sizeof (p_message_payload), + p_message_payload); + APP_ERROR_CHECK(err_code); +} + + +ret_code_t ant_bpwr_disp_open(ant_bpwr_profile_t * p_profile) +{ + LOG_BPWR("ANT B-PWR %u open\n\r", p_profile->channel_number); + return sd_ant_channel_open(p_profile->channel_number); +} + + +ret_code_t ant_bpwr_sens_open(ant_bpwr_profile_t * p_profile) +{ + // Fill tx buffer for the first frame + ant_message_send(p_profile); + + LOG_BPWR("ANT B-PWR %u open\n\r", p_profile->channel_number); + return sd_ant_channel_open(p_profile->channel_number); +} + + +void ant_bpwr_sens_evt_handler(ant_bpwr_profile_t * p_profile, ant_evt_t * p_ant_event) +{ + if (p_ant_event->channel == p_profile->channel_number) + { + ANT_MESSAGE * p_message; + + switch (p_ant_event->event) + { + case EVENT_TX: + ant_message_send(p_profile); + break; + + case EVENT_RX: + p_message = (ANT_MESSAGE *)p_ant_event->evt_buffer; + + if (p_message->ANT_MESSAGE_ucMesgID == MESG_ACKNOWLEDGED_DATA_ID) + { + sens_message_decode(p_profile, p_message->ANT_MESSAGE_aucPayload); + } + break; + + default: + // No implementation needed + break; + } + } +} + + +void ant_bpwr_disp_evt_handler(ant_bpwr_profile_t * p_profile, ant_evt_t * p_ant_event) +{ + if (p_ant_event->channel == p_profile->channel_number) + { + ANT_MESSAGE * p_message = (ANT_MESSAGE *)p_ant_event->evt_buffer; + + switch (p_ant_event->event) + { + case EVENT_RX: + + if (p_message->ANT_MESSAGE_ucMesgID == MESG_BROADCAST_DATA_ID + || p_message->ANT_MESSAGE_ucMesgID == MESG_ACKNOWLEDGED_DATA_ID + || p_message->ANT_MESSAGE_ucMesgID == MESG_BURST_DATA_ID) + { + disp_message_decode(p_profile, p_message->ANT_MESSAGE_aucPayload); + } + break; + + default: + break; + } + service_calib(p_profile, p_ant_event->event); + } +} + + diff --git a/components/ant/ant_profiles/ant_bpwr/ant_bpwr.h b/components/ant/ant_profiles/ant_bpwr/ant_bpwr.h new file mode 100644 index 0000000..2eec902 --- /dev/null +++ b/components/ant/ant_profiles/ant_bpwr/ant_bpwr.h @@ -0,0 +1,338 @@ +/* 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 ant_sdk_profiles_bpwr Bicycle Power profile + * @{ + * @ingroup ant_sdk_profiles + * @brief This module implements the Bicycle Power profile. + * + */ + + #ifndef ANT_BICYCLE_POWER_H__ + #define ANT_BICYCLE_POWER_H__ + +#include +#include +#include "ant_parameters.h" +#include "ant_stack_handler_types.h" +#include "ant_channel_config.h" +#include "ant_bpwr_pages.h" +#include "sdk_errors.h" + +#define BPWR_DEVICE_TYPE 0x0Bu ///< Device type reserved for ANT+ Bicycle Power. +#define BPWR_ANTPLUS_RF_FREQ 0x39u ///< Frequency, decimal 57 (2457 MHz). +#define BPWR_MSG_PERIOD 8182u ///< Message period, decimal 8182 (4.0049 Hz). + +#define BPWR_EXT_ASSIGN 0x00 ///< ANT ext assign (see Ext. Assign Channel Parameters in ant_parameters.h: @ref ant_parameters). +#define BPWR_DISP_CHANNEL_TYPE CHANNEL_TYPE_SLAVE ///< Display Bicycle Power channel type. +#define BPWR_SENS_CHANNEL_TYPE CHANNEL_TYPE_MASTER ///< Sensor Bicycle Power channel type. + +#define BPWR_CALIBRATION_TIMOUT_S 5u ///< Time-out for responding to calibration callback (s). + +/**@brief Initialize an ANT channel configuration structure for the Bicycle Power profile (Display). + * + * @param[in] NAME Name of related instance. + * @param[in] CHANNEL_NUMBER Number of the channel assigned to the profile instance. + * @param[in] TRANSMISSION_TYPE Type of transmission assigned to the profile instance. + * @param[in] DEVICE_NUMBER Number of the device assigned to the profile instance. + * @param[in] NETWORK_NUMBER Number of the network assigned to the profile instance. + */ +#define BPWR_DISP_CHANNEL_CONFIG_DEF(NAME, \ + CHANNEL_NUMBER, \ + TRANSMISSION_TYPE, \ + DEVICE_NUMBER, \ + NETWORK_NUMBER) \ +static const ant_channel_config_t NAME##_channel_bpwr_disp_config = \ + { \ + .channel_number = (CHANNEL_NUMBER), \ + .channel_type = BPWR_DISP_CHANNEL_TYPE, \ + .ext_assign = BPWR_EXT_ASSIGN, \ + .rf_freq = BPWR_ANTPLUS_RF_FREQ, \ + .transmission_type = (TRANSMISSION_TYPE), \ + .device_type = BPWR_DEVICE_TYPE, \ + .device_number = (DEVICE_NUMBER), \ + .channel_period = BPWR_MSG_PERIOD, \ + .network_number = (NETWORK_NUMBER), \ + } +#define BPWR_DISP_CHANNEL_CONFIG(NAME) &NAME##_channel_bpwr_disp_config + +/**@brief Initialize an ANT channel configuration structure for the Bicycle Power profile (Sensor). + * + * @param[in] NAME Name of related instance. + * @param[in] CHANNEL_NUMBER Number of the channel assigned to the profile instance. + * @param[in] TRANSMISSION_TYPE Type of transmission assigned to the profile instance. + * @param[in] DEVICE_NUMBER Number of the device assigned to the profile instance. + * @param[in] NETWORK_NUMBER Number of the network assigned to the profile instance. + */ +#define BPWR_SENS_CHANNEL_CONFIG_DEF(NAME, \ + CHANNEL_NUMBER, \ + TRANSMISSION_TYPE, \ + DEVICE_NUMBER, \ + NETWORK_NUMBER) \ +static const ant_channel_config_t NAME##_channel_bpwr_sens_config = \ + { \ + .channel_number = (CHANNEL_NUMBER), \ + .channel_type = BPWR_SENS_CHANNEL_TYPE, \ + .ext_assign = BPWR_EXT_ASSIGN, \ + .rf_freq = BPWR_ANTPLUS_RF_FREQ, \ + .transmission_type = (TRANSMISSION_TYPE), \ + .device_type = BPWR_DEVICE_TYPE, \ + .device_number = (DEVICE_NUMBER), \ + .channel_period = BPWR_MSG_PERIOD, \ + .network_number = (NETWORK_NUMBER), \ + } +#define BPWR_SENS_CHANNEL_CONFIG(NAME) &NAME##_channel_bpwr_sens_config + +/**@brief Initialize an ANT profile configuration structure for the BPWR profile (Display). + * + * @param[in] NAME Name of related instance. + * @param[in] EVT_HANDLER Event handler to be called for handling events in the BPWR profile. + */ +#define BPWR_DISP_PROFILE_CONFIG_DEF(NAME, \ + EVT_HANDLER) \ +static ant_bpwr_disp_cb_t NAME##_bpwr_disp_cb; \ +static const ant_bpwr_disp_config_t NAME##_profile_bpwr_disp_config = \ + { \ + .p_cb = &NAME##_bpwr_disp_cb, \ + .evt_handler = (EVT_HANDLER), \ + } +#define BPWR_DISP_PROFILE_CONFIG(NAME) &NAME##_profile_bpwr_disp_config + +/**@brief Initialize an ANT profile configuration structure for the BPWR profile (Sensor). + * + * @param[in] NAME Name of related instance. + * @param[in] TORQUE_USED Determines whether the torque page is included. + * @param[in] CALIB_HANDLER Event handler to be called for handling calibration requests. + * @param[in] EVT_HANDLER Event handler to be called for handling events in the BPWR profile. + */ +#define BPWR_SENS_PROFILE_CONFIG_DEF(NAME, \ + TORQUE_USED, \ + CALIB_HANDLER, \ + EVT_HANDLER) \ +static ant_bpwr_sens_cb_t NAME##_bpwr_sens_cb; \ +static const ant_bpwr_sens_config_t NAME##_profile_bpwr_sens_config = \ + { \ + .torque_use = (TORQUE_USED), \ + .calib_handler = (CALIB_HANDLER), \ + .p_cb = &NAME##_bpwr_sens_cb, \ + .evt_handler = (EVT_HANDLER), \ + } +#define BPWR_SENS_PROFILE_CONFIG(NAME) &NAME##_profile_bpwr_sens_config + +/**@brief Configuration values for the Bicycle Power torque page. */ +typedef enum +{ + TORQUE_NONE = 0, + TORQUE_WHEEL = 1, + TORQUE_CRANK = 2, +} ant_bpwr_torque_t; + +/**@brief Bicycle Power page number type. */ +typedef enum +{ + ANT_BPWR_PAGE_1 = 1, ///< Calibration data page. + ANT_BPWR_PAGE_16 = 16, ///< Standard power-only main data page. + ANT_BPWR_PAGE_17 = 17, ///< Standard wheel torque main data page. + ANT_BPWR_PAGE_18 = 18, ///< Standard crank torque main data page. + ANT_BPWR_PAGE_80 = ANT_COMMON_PAGE_80, + ANT_BPWR_PAGE_81 = ANT_COMMON_PAGE_81 +} ant_bpwr_page_t; + +/**@brief BPWR profile event type. */ +typedef enum +{ + ANT_BPWR_PAGE_1_UPDATED = ANT_BPWR_PAGE_1, ///< Data page 1 and speed have been updated (Display) or sent (Sensor). + ANT_BPWR_PAGE_16_UPDATED = ANT_BPWR_PAGE_16, ///< Data page 16 and speed have been updated (Display) or sent (Sensor). + ANT_BPWR_PAGE_17_UPDATED = ANT_BPWR_PAGE_17, ///< Data page 17 and speed have been updated (Display) or sent (Sensor). + ANT_BPWR_PAGE_18_UPDATED = ANT_BPWR_PAGE_18, ///< Data page 18 has been updated (Display) or sent (Sensor). + ANT_BPWR_PAGE_80_UPDATED = ANT_BPWR_PAGE_80, ///< Data page 80 has been updated (Display) or sent (Sensor). + ANT_BPWR_PAGE_81_UPDATED = ANT_BPWR_PAGE_81, ///< Data page 81 has been updated (Display) or sent (Sensor). + ANT_BPWR_CALIB_TIMEOUT, ///< Request of calibration time-out occurred (Display). + ANT_BPWR_CALIB_REQUEST_TX_FAILED, ///< Calibration request did not reach the destination (Display). +} ant_bpwr_evt_t; + +// Forward declaration of the ant_bpwr_profile_t type. +typedef struct ant_bpwr_profile_s ant_bpwr_profile_t; + +/**@brief BPWR event handler type. */ +typedef void (* ant_bpwr_evt_handler_t) (ant_bpwr_profile_t *, ant_bpwr_evt_t); + +/**@brief BPWR Sensor calibration request handler type. */ +typedef void (* ant_bpwr_calib_handler_t) (ant_bpwr_profile_t *, ant_bpwr_page1_data_t *); + +#include "ant_bpwr_local.h" + +/**@brief Bicycle Power Sensor configuration structure. */ +typedef struct +{ + ant_bpwr_torque_t torque_use; ///< Determines whether the torque page is included. + ant_bpwr_sens_cb_t * p_cb; ///< Pointer to the data buffer for internal use. + ant_bpwr_evt_handler_t evt_handler; ///< Event handler to be called for handling events in the BPWR profile. + ant_bpwr_calib_handler_t calib_handler; ///< Event handler to be called for handling calibration requests. +} ant_bpwr_sens_config_t; + +/**@brief Bicycle Power Display configuration structure. */ +typedef struct +{ + ant_bpwr_disp_cb_t * p_cb; ///< Pointer to the data buffer for internal use. + ant_bpwr_evt_handler_t evt_handler; ///< Event handler to be called for handling events in the BPWR profile. +} ant_bpwr_disp_config_t; + +/**@brief Bicycle Power profile structure. */ +struct ant_bpwr_profile_s +{ + uint8_t channel_number; ///< Channel number assigned to the profile. + union { + ant_bpwr_disp_cb_t * p_disp_cb; + ant_bpwr_sens_cb_t * p_sens_cb; + } _cb; ///< Pointer to internal control block. + ant_bpwr_evt_handler_t evt_handler; ///< Event handler to be called for handling events in the BPWR profile. + ant_bpwr_page1_data_t page_1; ///< Page 1. + ant_bpwr_page16_data_t page_16; ///< Page 16. + ant_bpwr_page17_data_t page_17; ///< Page 17. + ant_bpwr_page18_data_t page_18; ///< Page 18. + ant_common_page80_data_t page_80; ///< Page 80. + ant_common_page81_data_t page_81; ///< Page 81. + ant_bpwr_common_data_t common; ///< BPWR common data. +}; + +/** @name Defines for accessing ant_bpwr_profile_t member variables + @{ */ +#define BPWR_PROFILE_calibration_id page_1.calibration_id +#define BPWR_PROFILE_auto_zero_status page_1.auto_zero_status +#define BPWR_PROFILE_general_calib_data page_1.data.general_calib +#define BPWR_PROFILE_custom_calib_data page_1.data.custom_calib +#define BPWR_PROFILE_instantaneous_cadence common.instantaneous_cadence +#define BPWR_PROFILE_pedal_power page_16.pedal_power.items +#define BPWR_PROFILE_power_update_event_count page_16.update_event_count +#define BPWR_PROFILE_accumulated_power page_16.accumulated_power +#define BPWR_PROFILE_instantaneous_power page_16.instantaneous_power +#define BPWR_PROFILE_wheel_update_event_count page_17.update_event_count +#define BPWR_PROFILE_wheel_tick page_17.tick +#define BPWR_PROFILE_wheel_period page_17.period +#define BPWR_PROFILE_wheel_accumulated_torque page_17.accumulated_torque +#define BPWR_PROFILE_crank_update_event_count page_18.update_event_count +#define BPWR_PROFILE_crank_tick page_18.tick +#define BPWR_PROFILE_crank_period page_18.period +#define BPWR_PROFILE_crank_accumulated_torque page_18.accumulated_torque +#define BPWR_PROFILE_manuf_id page_80.manuf_id +#define BPWR_PROFILE_hw_revision page_80.hw_revision +#define BPWR_PROFILE_manufacturer_id page_80.manufacturer_id +#define BPWR_PROFILE_model_number page_80.model_number +#define BPWR_PROFILE_sw_revision_minor page_81.sw_revision_minor +#define BPWR_PROFILE_sw_revision_major page_81.sw_revision_major +#define BPWR_PROFILE_serial_number page_81.serial_number +/** @} */ + +/**@brief Function for initializing the ANT Bicycle Power Display profile instance. + * + * @param[in] p_profile Pointer to the profile instance. + * @param[in] p_channel_config Pointer to the ANT channel configuration structure. + * @param[in] p_disp_config Pointer to the Bicycle Power Display configuration structure. + * + * @retval NRF_SUCCESS If initialization was successful. Otherwise, an error code is returned. + */ +ret_code_t ant_bpwr_disp_init(ant_bpwr_profile_t * p_profile, + ant_channel_config_t const * p_channel_config, + ant_bpwr_disp_config_t const * p_disp_config); + +/**@brief Function for initializing the ANT Bicycle Power Sensor profile instance. + * + * @param[in] p_profile Pointer to the profile instance. + * @param[in] p_channel_config Pointer to the ANT channel configuration structure. + * @param[in] p_sens_config Pointer to the Bicycle Power Sensor configuration structure. + * + * @retval NRF_SUCCESS If initialization was successful. Otherwise, an error code is returned. + */ +ret_code_t ant_bpwr_sens_init(ant_bpwr_profile_t * p_profile, + ant_channel_config_t const * p_channel_config, + ant_bpwr_sens_config_t const * p_sens_config); + +/**@brief Function for opening the profile instance channel for ANT BPWR Display. + * + * Before calling this function, pages should be configured. + * + * @param[in] p_profile Pointer to the profile instance. + * + * @retval NRF_SUCCESS If the channel was successfully opened. Otherwise, an error code is returned. + */ +ret_code_t ant_bpwr_disp_open(ant_bpwr_profile_t * p_profile); + +/**@brief Function for opening the profile instance channel for ANT BPWR Sensor. + * + * Before calling this function, pages should be configured. + * + * @param[in] p_profile Pointer to the profile instance. + * + * @retval NRF_SUCCESS If the channel was successfully opened. Otherwise, an error code is returned. + */ +ret_code_t ant_bpwr_sens_open(ant_bpwr_profile_t * p_profile); + +/** @name Functions: Sensor calibration API + * @{ + */ + +/** @brief Function for initializing the response for a calibration request. + * + * This function should be used to signal the status of the calibration procedure to the ANT profile layer . + * + * @param[in] p_profile Pointer to the profile instance. + */ +void ant_bpwr_calib_response(ant_bpwr_profile_t * p_profile); +/** @} */ + + +/**@brief Function for handling the Sensor ANT events. + * + * @details This function handles all events from the ANT stack that are of interest to the Bicycle Power Display profile. + * + * @param[in] p_profile Pointer to the profile instance. + * @param[in] p_ant_event Event received from the ANT stack. + */ +void ant_bpwr_sens_evt_handler(ant_bpwr_profile_t * p_profile, ant_evt_t * p_ant_event); + +/**@brief Function for handling the Display ANT events. + * + * @details This function handles all events from the ANT stack that are of interest to the Bicycle Power Display profile. + * + * @param[in] p_profile Pointer to the profile instance. + * @param[in] p_ant_event Event received from the ANT stack. + */ +void ant_bpwr_disp_evt_handler(ant_bpwr_profile_t * p_profile, ant_evt_t * p_ant_event); + +/** @name Functions: Display calibration API + * @{ + */ + +/**@brief Function for initializing the calibration request process from the Bicycle Power Display side. + * + * @details This function requests a transfer to the Sensor and starts watching for the calibration response. + * If a calibration response has already been requested, the function ignores the new request and returns NRF_SUCCESS. + * + * @param [in] p_profile Pointer to the profile instance. + * @param [in] p_page_1 Pointer to the prepared page 1. + * + * @return Values returned by the @ref sd_ant_acknowledge_message_tx SVC callback. + */ +uint32_t ant_bpwr_calib_request(ant_bpwr_profile_t * p_profile, ant_bpwr_page1_data_t * p_page_1); + +/** + * @} + */ + +/** + * @} + */ +#endif // ANT_BICYCLE_POWER_H__ + diff --git a/components/ant/ant_profiles/ant_bpwr/ant_bpwr_local.h b/components/ant/ant_profiles/ant_bpwr/ant_bpwr_local.h new file mode 100644 index 0000000..e2f9b77 --- /dev/null +++ b/components/ant/ant_profiles/ant_bpwr/ant_bpwr_local.h @@ -0,0 +1,65 @@ +/* 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. + * + */ +/* 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. + * + */ + + +#ifndef ANT_BPWR_LOCAL_H__ +#define ANT_BPWR_LOCAL_H__ + +#include +#include +#include "ant_bpwr.h" + +/** + * @addtogroup ant_sdk_profiles_bpwr + * @{ + */ + +/** @brief Bicycle Power Sensor control block. */ +typedef struct +{ + uint8_t message_counter; + ant_bpwr_torque_t torque_use; + enum + { + BPWR_SENS_CALIB_NONE, ///< Idle state. + BPWR_SENS_CALIB_REQUESTED, ///< Received request for general calibration result message by the sensor. + BPWR_SENS_CALIB_READY, ///< Calibration response message is ready to be transmitted. + } calib_stat; + ant_bpwr_calib_handler_t calib_handler; +} ant_bpwr_sens_cb_t; + +/**@brief Bicycle Power Sensor RX control block. */ +typedef struct +{ + uint8_t calib_timeout; + enum + { + BPWR_DISP_CALIB_NONE, ///< Idle state. + BPWR_DISP_CALIB_REQUESTED, ///< Calibration requested. + } calib_stat; +} ant_bpwr_disp_cb_t; + +/** + * @} + */ +#endif // ANT_BPWR_LOCAL_H__ diff --git a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_common_data.c b/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_common_data.c new file mode 100644 index 0000000..b94c859 --- /dev/null +++ b/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_common_data.c @@ -0,0 +1,59 @@ +/* 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 "ant_bpwr_common_data.h" +#include "ant_bpwr_utils.h" +#include "ant_bpwr_page_logger.h" +#include "nordic_common.h" + +/**@brief BPWR common page data layout structure. */ +typedef struct +{ + uint8_t reserved0[2]; + uint8_t instantaneous_cadence; + uint8_t reserved1[4]; +}ant_bpwr_cadence_data_layout_t; + +/**@brief Function for tracing common data. + * + * @param[in] p_common_data Pointer to the common data. + */ +static void cadence_data_log(ant_bpwr_common_data_t const * p_common_data) +{ + if (p_common_data->instantaneous_cadence == 0xFF) + { + LOG_CADENCE("instantaneous cadence: -- rpm\n\r"); + } + else + { + LOG_CADENCE("instantaneous cadence: %u rpm\n\r", + p_common_data->instantaneous_cadence); + } +} + +void ant_bpwr_cadence_encode(uint8_t * p_page_buffer, + ant_bpwr_common_data_t const * p_common_data) +{ + ant_bpwr_cadence_data_layout_t * p_outcoming_data = (ant_bpwr_cadence_data_layout_t *)p_page_buffer; + p_outcoming_data->instantaneous_cadence = p_common_data->instantaneous_cadence; + + cadence_data_log(p_common_data); +} + +void ant_bpwr_cadence_decode(uint8_t const * p_page_buffer, + ant_bpwr_common_data_t * p_common_data) +{ + ant_bpwr_cadence_data_layout_t const * p_incoming_data = (ant_bpwr_cadence_data_layout_t *)p_page_buffer; + p_common_data->instantaneous_cadence = p_incoming_data->instantaneous_cadence; + + cadence_data_log(p_common_data); +} diff --git a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_common_data.h b/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_common_data.h new file mode 100644 index 0000000..d76424a --- /dev/null +++ b/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_common_data.h @@ -0,0 +1,63 @@ +/* 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. + * + */ + +#ifndef ANT_BPWR_COMMON_DATA_H__ +#define ANT_BPWR_COMMON_DATA_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_bpwr_common_data_page Stride Based Speed and Distance Monitor profile common data + * @{ + * @ingroup ant_sdk_profiles_bpwr_pages + */ + +#include + +/**@brief Data structure for BPWR common data. + * + * @details This structure stores data that is not associated with a particular page. + */ +typedef struct +{ + uint8_t instantaneous_cadence; ///< Crank cadence (rpm, 0-254, 255-> invalid). +} ant_bpwr_common_data_t; + +/**@brief Initialize common data. + */ +#define DEFAULT_ANT_BPWR_COMMON_DATA() \ + (ant_bpwr_common_data_t) \ + { \ + .instantaneous_cadence = 0, \ + } + +/**@brief Function for encoding speed. + * + * This function can be used for pages 16, 17, and 18. + * + * @param[in] p_common_data Pointer to the common data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_bpwr_cadence_encode(uint8_t * p_page_buffer, + ant_bpwr_common_data_t const * p_common_data); + +/**@brief Function for decoding speed. + * + * This function can be used for pages 16, 17, and 18. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_common_data Pointer to the common data. + */ +void ant_bpwr_cadence_decode(uint8_t const * p_page_buffer, + ant_bpwr_common_data_t * p_common_data); + +#endif // ANT_BPWR_COMMON_DATA_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_1.c b/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_1.c new file mode 100644 index 0000000..b1c476e --- /dev/null +++ b/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_1.c @@ -0,0 +1,253 @@ +/* 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 "ant_bpwr_page_1.h" +#include "ant_bpwr_page_logger.h" +#include "app_util.h" +#include "nordic_common.h" + +/**@brief bicycle power page 1 data layout structure. */ +typedef struct +{ + uint8_t calibration_id; ///< Calibration request type + union + { + struct + { + uint8_t reserved[6]; ///< Unused, fill by 0xFF. + } general_calib_request; + struct + { + uint8_t auto_zero_status; ///< Status of automatic zero feature of power sensor. + uint8_t reserved[5]; ///< Unused, fill by 0xFF. + } auto_zero_config; + struct + { + uint8_t auto_zero_status; ///< Status of automatic zero feature of power sensor. + uint8_t reserved[3]; ///< Unused, fill by 0xFF. + uint8_t data[2]; ///< Calibration Data. + } general_calib_response; + struct + { + uint8_t enable : 1; + uint8_t status : 1; + uint8_t reserved0 : 6; ///< Unused, fill by 0x00. + uint8_t reserved1[5]; ///< Unused, fill by 0xFF. + } auto_zero_support; + struct + { + uint8_t manufac_spec[6]; ///< Manufacture Specyfic Data. + } custom_calib; + } data; +} ant_bpwr_page1_data_layout_t; + + +static void page1_data_log(ant_bpwr_page1_data_t const * p_page_data) +{ + LOG_PAGE1("Calibration id: %u\n\r", p_page_data->calibration_id); + + switch (p_page_data->calibration_id) + { + case ANT_BPWR_CALIB_ID_MANUAL: + // No implementation needed + break; + + case ANT_BPWR_CALIB_ID_MANUAL_SUCCESS: + /* fall through */ + case ANT_BPWR_CALIB_ID_FAILED: + LOG_PAGE1("General calibration data: %u\n\r", p_page_data->data.general_calib); + + /* fall through */ + case ANT_BPWR_CALIB_ID_AUTO: + /* fall through */ + case ANT_BPWR_CALIB_ID_AUTO_SUPPORT: + + switch (p_page_data->auto_zero_status) + { + case ANT_BPWR_AUTO_ZERO_NOT_SUPPORTED: + LOG_PAGE1("Auto zero not supported\n\r"); + break; + + case ANT_BPWR_AUTO_ZERO_OFF: + LOG_PAGE1("Auto zero off\n\r"); + break; + + case ANT_BPWR_AUTO_ZERO_ON: + LOG_PAGE1("Auto zero on\n\r"); + break; + } + break; + + case ANT_BPWR_CALIB_ID_CTF: + LOG_PAGE1("Not supported\n\r"); + break; + + case ANT_BPWR_CALIB_ID_CUSTOM_REQ: + /* fall through */ + case ANT_BPWR_CALIB_ID_CUSTOM_REQ_SUCCESS: + /* fall through */ + case ANT_BPWR_CALIB_ID_CUSTOM_UPDATE: + /* fall through */ + case ANT_BPWR_CALIB_ID_CUSTOM_UPDATE_SUCCESS: + LOG_PAGE1("Manufacture specyfic: "); + + for (uint8_t i = 0; i < sizeof (p_page_data->data.custom_calib); i++) + { + LOG_PAGE1(" %u", p_page_data->data.custom_calib[i]); + } + LOG_PAGE1("\n\r"); + break; + + default: // shouldn't occur + LOG_PAGE1("Unsupported calibration ID\n\r"); + break; + } +} + + +void ant_bpwr_page_1_encode(uint8_t * p_page_buffer, + ant_bpwr_page1_data_t const * p_page_data) +{ + ant_bpwr_page1_data_layout_t * p_outcoming_data = (ant_bpwr_page1_data_layout_t *)p_page_buffer; + + page1_data_log(p_page_data); + + p_outcoming_data->calibration_id = p_page_data->calibration_id; + + switch (p_page_data->calibration_id) + { + case ANT_BPWR_CALIB_ID_MANUAL: + memset(p_outcoming_data->data.general_calib_request.reserved, 0xFF, + sizeof (p_outcoming_data->data.general_calib_request.reserved)); + break; + + case ANT_BPWR_CALIB_ID_AUTO: + memset(p_outcoming_data->data.auto_zero_config.reserved, 0xFF, + sizeof (p_outcoming_data->data.auto_zero_config.reserved)); + p_outcoming_data->data.auto_zero_config.auto_zero_status = + p_page_data->auto_zero_status; + break; + + case ANT_BPWR_CALIB_ID_MANUAL_SUCCESS: + /* fall through */ + case ANT_BPWR_CALIB_ID_FAILED: + memset(p_outcoming_data->data.general_calib_response.reserved, 0xFF, + sizeof (p_outcoming_data->data.general_calib_response.reserved)); + p_outcoming_data->data.general_calib_response.auto_zero_status = + p_page_data->auto_zero_status; + UNUSED_PARAMETER(uint16_encode(p_page_data->data.general_calib, + p_outcoming_data->data.general_calib_response.data)); + break; + + case ANT_BPWR_CALIB_ID_CTF: + LOG_PAGE1("Not supported\n\r"); + break; + + case ANT_BPWR_CALIB_ID_AUTO_SUPPORT: + memset(p_outcoming_data->data.auto_zero_support.reserved1, 0xFF, + sizeof (p_outcoming_data->data.auto_zero_support.reserved1)); + p_outcoming_data->data.auto_zero_support.reserved0 = 0x00; + p_outcoming_data->data.auto_zero_support.enable = + (p_page_data->auto_zero_status == ANT_BPWR_AUTO_ZERO_NOT_SUPPORTED) ? false : true; + p_outcoming_data->data.auto_zero_support.status = + (p_page_data->auto_zero_status == ANT_BPWR_AUTO_ZERO_ON) ? true : false; + break; + + case ANT_BPWR_CALIB_ID_CUSTOM_REQ: + /* fall through */ + case ANT_BPWR_CALIB_ID_CUSTOM_REQ_SUCCESS: + /* fall through */ + case ANT_BPWR_CALIB_ID_CUSTOM_UPDATE: + /* fall through */ + case ANT_BPWR_CALIB_ID_CUSTOM_UPDATE_SUCCESS: + memcpy(p_outcoming_data->data.custom_calib.manufac_spec, + (void *)p_page_data->data.custom_calib, + sizeof (p_page_data->data.custom_calib)); + break; + + default: // shouldn't occur + break; + } +} + + +void ant_bpwr_page_1_decode(uint8_t const * p_page_buffer, + ant_bpwr_page1_data_t * p_page_data) +{ + ant_bpwr_page1_data_layout_t const * p_incoming_data = + (ant_bpwr_page1_data_layout_t *)p_page_buffer; + + p_page_data->calibration_id = (ant_bpwr_calib_id_t)p_incoming_data->calibration_id; + + switch (p_incoming_data->calibration_id) + { + case ANT_BPWR_CALIB_ID_MANUAL: + // No implementation needed + break; + + case ANT_BPWR_CALIB_ID_AUTO: + /* fall through */ + p_page_data->auto_zero_status = + (ant_bpwr_auto_zero_status_t)p_incoming_data->data.auto_zero_config.auto_zero_status; + break; + + case ANT_BPWR_CALIB_ID_MANUAL_SUCCESS: + /* fall through */ + case ANT_BPWR_CALIB_ID_FAILED: + p_page_data->auto_zero_status = + (ant_bpwr_auto_zero_status_t)p_incoming_data->data.general_calib_response. + auto_zero_status; + p_page_data->data.general_calib = uint16_decode( + p_incoming_data->data.general_calib_response.data); + break; + + case ANT_BPWR_CALIB_ID_CTF: + LOG_PAGE1("Not supported\n\r"); + break; + + case ANT_BPWR_CALIB_ID_AUTO_SUPPORT: + + if (p_incoming_data->data.auto_zero_support.enable == false) + { + p_page_data->auto_zero_status = ANT_BPWR_AUTO_ZERO_NOT_SUPPORTED; + } + else if (p_incoming_data->data.auto_zero_support.status) + { + p_page_data->auto_zero_status = ANT_BPWR_AUTO_ZERO_ON; + } + else + { + p_page_data->auto_zero_status = ANT_BPWR_AUTO_ZERO_OFF; + } + break; + + case ANT_BPWR_CALIB_ID_CUSTOM_REQ: + /* fall through */ + case ANT_BPWR_CALIB_ID_CUSTOM_REQ_SUCCESS: + /* fall through */ + case ANT_BPWR_CALIB_ID_CUSTOM_UPDATE: + /* fall through */ + case ANT_BPWR_CALIB_ID_CUSTOM_UPDATE_SUCCESS: + memcpy((void *)p_page_data->data.custom_calib, + p_incoming_data->data.custom_calib.manufac_spec, + sizeof (p_page_data->data.custom_calib)); + break; + + default: // shouldn't occur + break; + } + + page1_data_log(p_page_data); +} + + diff --git a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_1.h b/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_1.h new file mode 100644 index 0000000..1962458 --- /dev/null +++ b/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_1.h @@ -0,0 +1,100 @@ +/* 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. + * + */ + +#ifndef ANT_BPWR_PAGE_1_H__ +#define ANT_BPWR_PAGE_1_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_bpwr_page1 Bicycle Power profile page 1 + * @{ + * @ingroup ant_sdk_profiles_bpwr_pages + */ + +#include + +/**@brief BPWR Calibration ID. + */ +typedef enum +{ + ANT_BPWR_CALIB_ID_NONE = 0x00, + ANT_BPWR_CALIB_ID_MANUAL = 0xAA, ///< Calibration Request: Manual Zero. + ANT_BPWR_CALIB_ID_AUTO = 0xAB, ///< Calibration Request: Auto Zero Configuration. + ANT_BPWR_CALIB_ID_MANUAL_SUCCESS = 0xAC, ///< Calibration Response: Manual Zero Successful. + ANT_BPWR_CALIB_ID_FAILED = 0xAF, ///< Calibration Response: Failed. + ANT_BPWR_CALIB_ID_CTF = 0x10, ///< Crank Torque Frequency (CTF) Power sensor Defined Message. + ANT_BPWR_CALIB_ID_AUTO_SUPPORT = 0x12, ///< Auto Zero Support. + ANT_BPWR_CALIB_ID_CUSTOM_REQ = 0xBA, ///< Custom Calibration Parameter Request. + ANT_BPWR_CALIB_ID_CUSTOM_REQ_SUCCESS = 0xBB, ///< Custom Calibration Parameter Response. + ANT_BPWR_CALIB_ID_CUSTOM_UPDATE = 0xBC, ///< Custom Calibration Parameter Update. + ANT_BPWR_CALIB_ID_CUSTOM_UPDATE_SUCCESS = 0xBD, ///< Custom Calibration Parameter Update Response. +} ant_bpwr_calib_id_t; + +/**@brief BPWR Calibration Auto Zero Status. + */ +typedef enum +{ + ANT_BPWR_AUTO_ZERO_NOT_SUPPORTED = 0xFF, ///< Auto Zero Not Supported. + ANT_BPWR_AUTO_ZERO_OFF = 0x00, ///< Auto Zero OFF. + ANT_BPWR_AUTO_ZERO_ON = 0x01, ///< Auto Zero ON. +} ant_bpwr_auto_zero_status_t; + +/**@brief Data structure for Bicycle Power data page 1. + */ +typedef struct +{ + ant_bpwr_calib_id_t calibration_id; ///< Calibration request type. + ant_bpwr_auto_zero_status_t auto_zero_status; ///< Status of automatic zero feature of power sensor. + union + { + int16_t general_calib; + uint8_t custom_calib[6]; + } data; +} ant_bpwr_page1_data_t; + +/**@brief Initialize page 1. + */ +#define DEFAULT_ANT_BPWR_PAGE1() \ + (ant_bpwr_page1_data_t) \ + { \ + .calibration_id = ANT_BPWR_CALIB_ID_NONE, \ + .auto_zero_status = ANT_BPWR_AUTO_ZERO_NOT_SUPPORTED, \ + .data.general_calib = 0x00, \ + } + +/**@brief Initialize page 1 with the general request. + */ +#define ANT_BPWR_GENERAL_CALIB_REQUEST() \ + (ant_bpwr_page1_data_t) \ + { \ + .calibration_id = ANT_BPWR_CALIB_ID_MANUAL, \ + } + +/**@brief Function for encoding page 1. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_bpwr_page_1_encode(uint8_t * p_page_buffer, + ant_bpwr_page1_data_t const * p_page_data); + +/**@brief Function for decoding page 1. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_bpwr_page_1_decode(uint8_t const * p_page_buffer, + ant_bpwr_page1_data_t * p_page_data); + + +#endif // ANT_BPWR_PAGE_1_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_16.c b/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_16.c new file mode 100644 index 0000000..e3fe474 --- /dev/null +++ b/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_16.c @@ -0,0 +1,80 @@ +/* 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 "ant_bpwr_page_16.h" +#include "ant_bpwr_page_logger.h" +#include "app_util.h" +#include "nordic_common.h" + +/**@brief bicycle power page 16 data layout structure. */ +typedef struct +{ + uint8_t update_event_count; + uint8_t pedal_power; + uint8_t reserved; + uint8_t accumulated_power[2]; + uint8_t instantaneous_power[2]; +}ant_bpwr_page16_data_layout_t; + + +static void page16_data_log(ant_bpwr_page16_data_t const * p_page_data) +{ + LOG_PAGE16("event count: %u\n\r", p_page_data->update_event_count); + + if (p_page_data->pedal_power.byte != 0xFF) + { + LOG_PAGE16("pedal power: %u %%\n\r", + p_page_data->pedal_power.items.distribution); + } + else + { + LOG_PAGE16("pedal power: --\n\r"); + } + + LOG_PAGE16("accumulated power: %u W\n\r", p_page_data->accumulated_power); + LOG_PAGE16("instantaneous power: %u W\n\r", p_page_data->instantaneous_power); +} + + +void ant_bpwr_page_16_encode(uint8_t * p_page_buffer, + ant_bpwr_page16_data_t const * p_page_data) +{ + ant_bpwr_page16_data_layout_t * p_outcoming_data = + (ant_bpwr_page16_data_layout_t *)p_page_buffer; + + p_outcoming_data->update_event_count = p_page_data->update_event_count; + p_outcoming_data->pedal_power = p_page_data->pedal_power.byte; + + UNUSED_PARAMETER(uint16_encode(p_page_data->accumulated_power, + p_outcoming_data->accumulated_power)); + UNUSED_PARAMETER(uint16_encode(p_page_data->instantaneous_power, + p_outcoming_data->instantaneous_power)); + + page16_data_log(p_page_data); +} + + +void ant_bpwr_page_16_decode(uint8_t const * p_page_buffer, + ant_bpwr_page16_data_t * p_page_data) +{ + ant_bpwr_page16_data_layout_t const * p_incoming_data = + (ant_bpwr_page16_data_layout_t *)p_page_buffer; + + p_page_data->update_event_count = p_incoming_data->update_event_count; + p_page_data->pedal_power.byte = p_incoming_data->pedal_power; + p_page_data->accumulated_power = uint16_decode(p_incoming_data->accumulated_power); + p_page_data->instantaneous_power = uint16_decode(p_incoming_data->instantaneous_power); + + page16_data_log(p_page_data); +} + + diff --git a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_16.h b/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_16.h new file mode 100644 index 0000000..caf0413 --- /dev/null +++ b/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_16.h @@ -0,0 +1,75 @@ +/* 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. + * + */ + +#ifndef ANT_BPWR_PAGE_16_H__ +#define ANT_BPWR_PAGE_16_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_bpwr_page16 Bicycle Power profile page 16 + * @{ + * @ingroup ant_sdk_profiles_bpwr_pages + */ + +#include + +/**@brief Data structure for Bicycle Power data page 16. + * + * @note This structure implements only page 16 specific data. + */ +typedef struct +{ + union + { + struct + { + uint8_t distribution : 7; ///< Pedal power distribution (%). + uint8_t differentiation : 1; ///< Pedal differentiation: 1 -> right, 0 -> unknown. + } items; + uint8_t byte; + } pedal_power; + + uint8_t update_event_count; ///< Power event count. + uint16_t accumulated_power; ///< Accumulated power (W). + uint16_t instantaneous_power; ///< Instantaneous power (W). +} ant_bpwr_page16_data_t; + +/**@brief Initialize page 16. + */ +#define DEFAULT_ANT_BPWR_PAGE16() \ + (ant_bpwr_page16_data_t) \ + { \ + .update_event_count = 0, \ + .pedal_power.items.distribution = 0, \ + .pedal_power.items.differentiation = 0, \ + .accumulated_power = 0, \ + .instantaneous_power = 0, \ + } + +/**@brief Function for encoding page 16. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_bpwr_page_16_encode(uint8_t * p_page_buffer, + ant_bpwr_page16_data_t const * p_page_data); + +/**@brief Function for decoding page 16. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_bpwr_page_16_decode(uint8_t const * p_page_buffer, + ant_bpwr_page16_data_t * p_page_data); + +#endif // ANT_BPWR_PAGE_16_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_17.c b/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_17.c new file mode 100644 index 0000000..cbbd31c --- /dev/null +++ b/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_17.c @@ -0,0 +1,41 @@ +/* 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 "ant_bpwr_page_17.h" +#include "app_util.h" +#include "ant_bpwr_page_logger.h" + +static void page17_data_log(ant_bpwr_page17_data_t const * p_page_data) +{ + LOG_PAGE17("Wheel:\n\r"); + #ifdef TRACE_BPWR_PAGE_17_ENABLE + ant_bpwr_page_torque_log((ant_bpwr_page_torque_data_t *) p_page_data); + #endif // TRACE_BPWR_PAGE_17_ENABLE +} + + +void ant_bpwr_page_17_encode(uint8_t * p_page_buffer, + ant_bpwr_page17_data_t const * p_page_data) +{ + ant_bpwr_page_torque_encode(p_page_buffer, (ant_bpwr_page_torque_data_t *)p_page_data); + page17_data_log(p_page_data); +} + + +void ant_bpwr_page_17_decode(uint8_t const * p_page_buffer, + ant_bpwr_page17_data_t * p_page_data) +{ + ant_bpwr_page_torque_decode(p_page_buffer, (ant_bpwr_page_torque_data_t *) p_page_data); + page17_data_log(p_page_data); +} + + diff --git a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_17.h b/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_17.h new file mode 100644 index 0000000..6964655 --- /dev/null +++ b/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_17.h @@ -0,0 +1,53 @@ +/* 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. + * + */ + +#ifndef ANT_BPWR_PAGE_17_H__ +#define ANT_BPWR_PAGE_17_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_bpwr_page17 Bicycle Power profile page 17 + * @{ + * @ingroup ant_sdk_profiles_bpwr_pages + */ + +#include +#include "ant_bpwr_page_torque.h" + +/**@brief Data structure for Bicycle Power data page 17. + * + * @note This structure implements only page 17 specific data. + */ +typedef ant_bpwr_page_torque_data_t ant_bpwr_page17_data_t; + +/**@brief Initialize page 17. + */ +#define DEFAULT_ANT_BPWR_PAGE17() (ant_bpwr_page17_data_t) DEFAULT_ANT_BPWR_PAGE_TORQUE(0, 0, 0, 0) + +/**@brief Function for encoding page 17. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_bpwr_page_17_encode(uint8_t * p_page_buffer, + ant_bpwr_page17_data_t const * p_page_data); + +/**@brief Function for decoding page 17. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_bpwr_page_17_decode(uint8_t const * p_page_buffer, + ant_bpwr_page17_data_t * p_page_data); + +#endif // ANT_BPWR_PAGE_17_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_18.c b/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_18.c new file mode 100644 index 0000000..68a26c5 --- /dev/null +++ b/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_18.c @@ -0,0 +1,41 @@ +/* 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 "ant_bpwr_page_18.h" +#include "app_util.h" +#include "ant_bpwr_page_logger.h" + +static void page18_data_log(ant_bpwr_page18_data_t const * p_page_data) +{ + LOG_PAGE18("Crank:\n\r"); + #ifdef TRACE_BPWR_PAGE_18_ENABLE + ant_bpwr_page_torque_log((ant_bpwr_page_torque_data_t *) p_page_data); + #endif // TRACE_BPWR_PAGE_18_ENABLE +} + + +void ant_bpwr_page_18_encode(uint8_t * p_page_buffer, + ant_bpwr_page18_data_t const * p_page_data) +{ + ant_bpwr_page_torque_encode(p_page_buffer, (ant_bpwr_page_torque_data_t *)p_page_data); + page18_data_log(p_page_data); +} + + +void ant_bpwr_page_18_decode(uint8_t const * p_page_buffer, + ant_bpwr_page18_data_t * p_page_data) +{ + ant_bpwr_page_torque_decode(p_page_buffer, (ant_bpwr_page_torque_data_t *) p_page_data); + page18_data_log(p_page_data); +} + + diff --git a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_18.h b/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_18.h new file mode 100644 index 0000000..2a71b96 --- /dev/null +++ b/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_18.h @@ -0,0 +1,41 @@ +#ifndef ANT_BPWR_PAGE_18_H__ +#define ANT_BPWR_PAGE_18_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_bpwr_page18 Bicycle Power profile page 18 + * @{ + * @ingroup ant_sdk_profiles_bpwr_pages + */ + +#include +#include "ant_bpwr_page_torque.h" + +/**@brief Data structure for Bicycle Power data page 18. + * + * @note This structure implements only page 18 specific data. + */ +typedef ant_bpwr_page_torque_data_t ant_bpwr_page18_data_t; + +/**@brief Initialize page 18. + */ +#define DEFAULT_ANT_BPWR_PAGE18() (ant_bpwr_page18_data_t) DEFAULT_ANT_BPWR_PAGE_TORQUE(0, 0, 0, 0) + +/**@brief Function for encoding page 18. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_bpwr_page_18_encode(uint8_t * p_page_buffer, + ant_bpwr_page18_data_t const * p_page_data); + +/**@brief Function for decoding page 18. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_bpwr_page_18_decode(uint8_t const * p_page_buffer, + ant_bpwr_page18_data_t * p_page_data); + +#endif // ANT_BPWR_PAGE_18_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_torque.c b/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_torque.c new file mode 100644 index 0000000..386ea02 --- /dev/null +++ b/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_torque.c @@ -0,0 +1,76 @@ +/* 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 "ant_bpwr_page_torque.h" +#include "ant_bpwr_utils.h" +#include "app_util.h" +#include "app_trace.h" +#include "nordic_common.h" + +/**@brief bicycle power page torque data layout structure. */ +typedef struct +{ + uint8_t update_event_count; + uint8_t tick; + uint8_t reserved; + uint8_t period[2]; + uint8_t accumulated_torque[2]; +}ant_bpwr_page_torque_data_layout_t; + +STATIC_ASSERT(ANT_BPWR_TORQUE_PERIOD_DISP_PRECISION == 1000); ///< Display format need to be updated +STATIC_ASSERT(ANT_BPWR_ACC_TORQUE_DISP_PRECISION == 10); ///< Display format need to be updated + +void ant_bpwr_page_torque_log(ant_bpwr_page_torque_data_t const * p_page_data) +{ + uint16_t period = ANT_BPWR_TORQUE_PERIOD_RESCALE(p_page_data->period); + uint32_t acc_torque = ANT_BPWR_ACC_TORQUE_RESCALE(p_page_data->accumulated_torque); + + app_trace_log("event count: %u\n\r", p_page_data->update_event_count); + app_trace_log("tick: %u\n\r", p_page_data->tick); + app_trace_log("period: %u.%03us\n\r", + (unsigned int)(period / ANT_BPWR_TORQUE_PERIOD_DISP_PRECISION), + (unsigned int)(period % ANT_BPWR_TORQUE_PERIOD_DISP_PRECISION)); + app_trace_log("accumulated torque: %u.%01uNm\n\r", + (unsigned int)(acc_torque / ANT_BPWR_ACC_TORQUE_DISP_PRECISION), + (unsigned int)(acc_torque % ANT_BPWR_ACC_TORQUE_DISP_PRECISION)); +} + + +void ant_bpwr_page_torque_encode(uint8_t * p_page_buffer, + ant_bpwr_page_torque_data_t const * p_page_data) +{ + ant_bpwr_page_torque_data_layout_t * p_outcoming_data = + (ant_bpwr_page_torque_data_layout_t *)p_page_buffer; + + p_outcoming_data->update_event_count = p_page_data->update_event_count; + p_outcoming_data->tick = p_page_data->tick; + + UNUSED_PARAMETER(uint16_encode(p_page_data->period, p_outcoming_data->period)); + UNUSED_PARAMETER(uint16_encode(p_page_data->accumulated_torque, + p_outcoming_data->accumulated_torque)); +} + + +void ant_bpwr_page_torque_decode(uint8_t const * p_page_buffer, + ant_bpwr_page_torque_data_t * p_page_data) +{ + ant_bpwr_page_torque_data_layout_t const * p_incoming_data = + (ant_bpwr_page_torque_data_layout_t *)p_page_buffer; + + p_page_data->update_event_count = p_incoming_data->update_event_count; + p_page_data->tick = p_incoming_data->tick; + p_page_data->period = uint16_decode(p_incoming_data->period); + p_page_data->accumulated_torque = uint16_decode(p_incoming_data->accumulated_torque); +} + + diff --git a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_torque.h b/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_torque.h new file mode 100644 index 0000000..ace1e15 --- /dev/null +++ b/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_page_torque.h @@ -0,0 +1,70 @@ +/* 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. + * + */ + +#ifndef ANT_BPWR_PAGE_TORQUE_COMMON_H__ +#define ANT_BPWR_PAGE_TORQUE_COMMON_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_bicycle_p_page_torque Bicycle Power profile pages 17, 18 (commons) + * @{ + * @ingroup ant_sdk_profiles_bpwr_pages + */ + +#include + +/**@brief Common data structure for Bicycle Power data pages 17, 18. + * + * @note This structure implements specific data that is common for pages 17, 18. + */ +typedef struct +{ + uint8_t update_event_count; ///< Power event count. + uint8_t tick; ///< Wheel/crank revolutions counter. + uint16_t period; ///< Accumulated wheel/crank period (1/2048 s). + uint16_t accumulated_torque; ///< Accumulated wheel/torque (1/32 Nm). +} ant_bpwr_page_torque_data_t; + +/**@brief Initialize page torque. + */ +#define DEFAULT_ANT_BPWR_PAGE_TORQUE(up_evt_cnt, def_tick, def_period, acc_torque) \ + { \ + .update_event_count = (up_evt_cnt), \ + .tick = (def_tick), \ + .period = (def_period), \ + .accumulated_torque = (acc_torque) \ + } + +/**@brief Function for encoding pages 17, 18. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_bpwr_page_torque_encode(uint8_t * p_page_buffer, + ant_bpwr_page_torque_data_t const * p_page_data); + +/**@brief Function for decoding pages 17, 18. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_bpwr_page_torque_decode(uint8_t const * p_page_buffer, + ant_bpwr_page_torque_data_t * p_page_data); + +/**@brief Function for logging pages 17, 18. + * + * @param[in] p_page_data Pointer to the page data. + */ +void ant_bpwr_page_torque_log(ant_bpwr_page_torque_data_t const * p_page_data); + +#endif // ANT_BPWR_PAGE_TORQUE_COMMON_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_pages.h b/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_pages.h new file mode 100644 index 0000000..5707db0 --- /dev/null +++ b/components/ant/ant_profiles/ant_bpwr/pages/ant_bpwr_pages.h @@ -0,0 +1,33 @@ +/* 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. + * + */ + +#ifndef ANT_BPWR_PAGES_H__ +#define ANT_BPWR_PAGES_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_bpwr_pages Bicycle Power profile pages + * @{ + * @ingroup ant_sdk_profiles_bpwr + * @brief This module implements functions for the BPWR data pages. + */ + +#include "ant_bpwr_page_1.h" // Calibration message main data page. +#include "ant_bpwr_page_16.h" // Standard power-only page. +#include "ant_bpwr_page_17.h" // Wheel Torque main data page. +#include "ant_bpwr_page_18.h" // Crank Torque main data page. +#include "ant_bpwr_common_data.h" // Instantaneous cadence data. +#include "ant_common_page_80.h" // Manufacturer's information data page. +#include "ant_common_page_81.h" // Product information data page. + +#endif // ANT_BPWR_PAGES_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_bpwr/pages/logger/ant_bpwr_page_logger.h b/components/ant/ant_profiles/ant_bpwr/pages/logger/ant_bpwr_page_logger.h new file mode 100644 index 0000000..7f5a334 --- /dev/null +++ b/components/ant/ant_profiles/ant_bpwr/pages/logger/ant_bpwr_page_logger.h @@ -0,0 +1,58 @@ +/* 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. + * + */ + +#ifndef ANT_BPWR_PAGE_LOGGER_H__ +#define ANT_BPWR_PAGE_LOGGER_H__ + +#ifdef TRACE_BPWR_GENERAL_ENABLE +#include "app_trace.h" +#define LOG_BPWR app_trace_log +#else +#define LOG_BPWR(...) +#endif // TRACE_BPWR_GENERAL_ENABLE + +#ifdef TRACE_BPWR_PAGE_1_ENABLE +#include "app_trace.h" +#define LOG_PAGE1 app_trace_log +#else +#define LOG_PAGE1(...) +#endif // TRACE_BPWR_PAGE_1_ENABLE + +#ifdef TRACE_BPWR_PAGE_16_ENABLE +#include "app_trace.h" +#define LOG_PAGE16 app_trace_log +#else +#define LOG_PAGE16(...) +#endif // TRACE_BPWR_PAGE_16_ENABLE + +#ifdef TRACE_BPWR_PAGE_17_ENABLE +#include "app_trace.h" +#define LOG_PAGE17 app_trace_log +#else +#define LOG_PAGE17(...) +#endif // TRACE_BPWR_PAGE_17_ENABLE + +#ifdef TRACE_BPWR_PAGE_18_ENABLE +#include "app_trace.h" +#define LOG_PAGE18 app_trace_log +#else +#define LOG_PAGE18(...) +#endif // TRACE_BPWR_PAGE_18_ENABLE + +#if ((defined TRACE_BPWR_PAGE_18_ENABLE) || (defined TRACE_BPWR_PAGE_17_ENABLE) || (defined TRACE_BPWR_PAGE_16_ENABLE)) +#include "app_trace.h" +#define LOG_CADENCE app_trace_log +#else +#define LOG_CADENCE(...) +#endif // ((defined TRACE_BPWR_PAGE_18_ENABLE) || (defined TRACE_BPWR_PAGE_17_ENABLE) || (defined TRACE_BPWR_PAGE_16_ENABLE)) + +#endif // ANT_BPWR_PAGE_LOGGER_H__ diff --git a/components/ant/ant_profiles/ant_bpwr/simulator/ant_bpwr_simulator.c b/components/ant/ant_profiles/ant_bpwr/simulator/ant_bpwr_simulator.c new file mode 100644 index 0000000..3b2d909 --- /dev/null +++ b/components/ant/ant_profiles/ant_bpwr/simulator/ant_bpwr_simulator.c @@ -0,0 +1,174 @@ +/* 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 "ant_bpwr_simulator.h" +#include "app_util.h" +#include "nordic_common.h" + +#define POWER_MIN 0 +#define POWER_MAX 2000 +#define POWER_INCR 10 + +#define CADENCE_MIN 0 +#define CADENCE_MAX (UINT8_MAX - 1) +#define CADENCE_INCR 1 + +#define PEDAL_MIN 0 +#define PEDAL_MAX 100 +#define PEDAL_INCR 1 + +#define TORQUE_PERIOD 774 +#define SIMULATOR_TIME_INCREMENT BPWR_MSG_PERIOD + +#define TORQUE_INCR 10 + + +void ant_bpwr_simulator_init(ant_bpwr_simulator_t * p_simulator, + ant_bpwr_simulator_cfg_t const * p_config, + bool auto_change) +{ + p_simulator->p_profile = p_config->p_profile; + p_simulator->_cb.auto_change = auto_change; + p_simulator->_cb.tick_incr = 0; + + p_simulator->_cb.power_sensorsim_cfg.min = POWER_MIN; + p_simulator->_cb.power_sensorsim_cfg.max = POWER_MAX; + p_simulator->_cb.power_sensorsim_cfg.incr = POWER_INCR; + p_simulator->_cb.power_sensorsim_cfg.start_at_max = false; + + p_simulator->_cb.cadence_sensorsim_cfg.min = CADENCE_MIN; + p_simulator->_cb.cadence_sensorsim_cfg.max = CADENCE_MAX; + p_simulator->_cb.cadence_sensorsim_cfg.incr = CADENCE_INCR; + p_simulator->_cb.cadence_sensorsim_cfg.start_at_max = false; + + p_simulator->_cb.pedal_sensorsim_cfg.min = PEDAL_MIN; + p_simulator->_cb.pedal_sensorsim_cfg.max = PEDAL_MAX; + p_simulator->_cb.pedal_sensorsim_cfg.incr = PEDAL_INCR; + p_simulator->_cb.pedal_sensorsim_cfg.start_at_max = false; + + p_simulator->p_profile->BPWR_PROFILE_pedal_power.differentiation = 0x01; // right + + sensorsim_init(&(p_simulator->_cb.power_sensorsim_state), + &(p_simulator->_cb.power_sensorsim_cfg)); + sensorsim_init(&(p_simulator->_cb.cadence_sensorsim_state), + &(p_simulator->_cb.cadence_sensorsim_cfg)); + sensorsim_init(&(p_simulator->_cb.pedal_sensorsim_state), + &(p_simulator->_cb.pedal_sensorsim_cfg)); +} + + +void ant_bpwr_simulator_one_iteration(ant_bpwr_simulator_t * p_simulator, ant_bpwr_evt_t event) +{ + switch (event) + { + case ANT_BPWR_PAGE_16_UPDATED: + + if (p_simulator->_cb.auto_change) + { + UNUSED_PARAMETER(sensorsim_measure(&(p_simulator->_cb.power_sensorsim_state), + &(p_simulator->_cb.power_sensorsim_cfg))); + UNUSED_PARAMETER(sensorsim_measure(&(p_simulator->_cb.cadence_sensorsim_state), + &(p_simulator->_cb.cadence_sensorsim_cfg))); + UNUSED_PARAMETER(sensorsim_measure(&(p_simulator->_cb.pedal_sensorsim_state), + &(p_simulator->_cb.pedal_sensorsim_cfg))); + } + + p_simulator->p_profile->BPWR_PROFILE_instantaneous_power = + p_simulator->_cb.power_sensorsim_state.current_val; + p_simulator->p_profile->BPWR_PROFILE_accumulated_power += + p_simulator->_cb.power_sensorsim_state.current_val; + + if (p_simulator->p_profile->BPWR_PROFILE_accumulated_power == UINT16_MAX) + { + p_simulator->p_profile->BPWR_PROFILE_accumulated_power = 0; + } + p_simulator->p_profile->BPWR_PROFILE_instantaneous_cadence = + p_simulator->_cb.cadence_sensorsim_state.current_val; + p_simulator->p_profile->BPWR_PROFILE_pedal_power.distribution = + p_simulator->_cb.pedal_sensorsim_state.current_val; + p_simulator->p_profile->BPWR_PROFILE_power_update_event_count++; + break; + + case ANT_BPWR_PAGE_17_UPDATED: + + if (p_simulator->_cb.auto_change) + { + UNUSED_PARAMETER(sensorsim_measure(&(p_simulator->_cb.cadence_sensorsim_state), + &(p_simulator->_cb.cadence_sensorsim_cfg))); + } + p_simulator->p_profile->BPWR_PROFILE_instantaneous_cadence = + p_simulator->_cb.cadence_sensorsim_state.current_val; + p_simulator->p_profile->BPWR_PROFILE_wheel_period = TORQUE_PERIOD; + p_simulator->_cb.tick_incr += + SIMULATOR_TIME_INCREMENT; + p_simulator->p_profile->BPWR_PROFILE_wheel_tick += + p_simulator->_cb.tick_incr / (TORQUE_PERIOD * 16); + p_simulator->_cb.tick_incr = + p_simulator->_cb.tick_incr % (TORQUE_PERIOD * 16); + p_simulator->p_profile->BPWR_PROFILE_wheel_accumulated_torque += TORQUE_INCR; + p_simulator->p_profile->BPWR_PROFILE_wheel_update_event_count++; + break; + + case ANT_BPWR_PAGE_18_UPDATED: + + if (p_simulator->_cb.auto_change) + { + UNUSED_PARAMETER(sensorsim_measure(&(p_simulator->_cb.cadence_sensorsim_state), + &(p_simulator->_cb.cadence_sensorsim_cfg))); + } + p_simulator->p_profile->BPWR_PROFILE_instantaneous_cadence = + p_simulator->_cb.cadence_sensorsim_state.current_val; + p_simulator->p_profile->BPWR_PROFILE_crank_period = TORQUE_PERIOD; + p_simulator->_cb.tick_incr += + SIMULATOR_TIME_INCREMENT; + p_simulator->p_profile->BPWR_PROFILE_crank_tick += + p_simulator->_cb.tick_incr / (TORQUE_PERIOD * 16); + p_simulator->_cb.tick_incr = + p_simulator->_cb.tick_incr % (TORQUE_PERIOD * 16); + p_simulator->p_profile->BPWR_PROFILE_crank_accumulated_torque += TORQUE_INCR; + p_simulator->p_profile->BPWR_PROFILE_crank_update_event_count++; + break; + + default: + break; + } +} + + +void ant_bpwr_simulator_increment(ant_bpwr_simulator_t * p_simulator) +{ + if (!p_simulator->_cb.auto_change) + { + sensorsim_increment(&(p_simulator->_cb.power_sensorsim_state), + &(p_simulator->_cb.power_sensorsim_cfg)); + sensorsim_increment(&(p_simulator->_cb.cadence_sensorsim_state), + &(p_simulator->_cb.cadence_sensorsim_cfg)); + sensorsim_increment(&(p_simulator->_cb.pedal_sensorsim_state), + &(p_simulator->_cb.pedal_sensorsim_cfg)); + } +} + + +void ant_bpwr_simulator_decrement(ant_bpwr_simulator_t * p_simulator) +{ + if (!p_simulator->_cb.auto_change) + { + sensorsim_decrement(&(p_simulator->_cb.power_sensorsim_state), + &(p_simulator->_cb.power_sensorsim_cfg)); + sensorsim_decrement(&(p_simulator->_cb.cadence_sensorsim_state), + &(p_simulator->_cb.cadence_sensorsim_cfg)); + sensorsim_decrement(&(p_simulator->_cb.pedal_sensorsim_state), + &(p_simulator->_cb.pedal_sensorsim_cfg)); + } +} + + diff --git a/components/ant/ant_profiles/ant_bpwr/simulator/ant_bpwr_simulator.h b/components/ant/ant_profiles/ant_bpwr/simulator/ant_bpwr_simulator.h new file mode 100644 index 0000000..f20ce1a --- /dev/null +++ b/components/ant/ant_profiles/ant_bpwr/simulator/ant_bpwr_simulator.h @@ -0,0 +1,87 @@ +/* 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. + * + */ + +#ifndef ANT_BPWR_SIMULATOR_H__ +#define ANT_BPWR_SIMULATOR_H__ + +/** @file + * + * @defgroup ant_sdk_simulators ANT simulators + * @ingroup ant_sdk_utils + * @brief Modules that simulate sensors. + * + * @defgroup ant_sdk_bpwr_simulator ANT BPWR simulator + * @{ + * @ingroup ant_sdk_simulators + * @brief ANT BPWR simulator module. + * + * @details This module simulates power for the ANT BPWR profile. The module calculates + * abstract values, which are handled by the BPWR pages data model to ensure that they are + * compatible. It provides a handler for changing the power value manually and functionality + * for changing the power automatically. + * + */ + +#include +#include +#include "bsp.h" +#include "ant_bpwr.h" +#include "sensorsim.h" +#include "ant_bpwr_simulator_local.h" + +/**@brief BPWR simulator configuration structure. */ +typedef struct +{ + ant_bpwr_profile_t * p_profile; ///< Related profile. + ant_bpwr_torque_t sensor_type; ///< Type of related sensor. +} ant_bpwr_simulator_cfg_t; + +/**@brief BPWR simulator structure. */ +typedef struct +{ + ant_bpwr_profile_t * p_profile; ///< Related profile. + ant_bpwr_simulator_cb_t _cb; ///< Internal control block. +} ant_bpwr_simulator_t; + + +/**@brief Function for initializing the ANT BPWR simulator instance. + * + * @param[in] p_simulator Pointer to the simulator instance. + * @param[in] p_config Pointer to the simulator configuration structure. + * @param[in] auto_change Enable or disable automatic changes of the power. + */ +void ant_bpwr_simulator_init(ant_bpwr_simulator_t * p_simulator, + ant_bpwr_simulator_cfg_t const * p_config, + bool auto_change); + +/**@brief Function for simulating a device event. + * + * @details Based on this event, the transmitter data is simulated. + * + * This function should be called in the BPWR TX event handler. + */ +void ant_bpwr_simulator_one_iteration(ant_bpwr_simulator_t * p_simulator, ant_bpwr_evt_t event); + +/**@brief Function for incrementing the power value. + * + * @param[in] p_simulator Pointer to the simulator instance. + */ +void ant_bpwr_simulator_increment(ant_bpwr_simulator_t * p_simulator); + +/**@brief Function for decrementing the power value. + * + * @param[in] p_simulator Pointer to the simulator instance. + */ +void ant_bpwr_simulator_decrement(ant_bpwr_simulator_t * p_simulator); + +#endif // ANT_BPWR_SIMULATOR_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_bpwr/simulator/ant_bpwr_simulator_local.h b/components/ant/ant_profiles/ant_bpwr/simulator/ant_bpwr_simulator_local.h new file mode 100644 index 0000000..4281c32 --- /dev/null +++ b/components/ant/ant_profiles/ant_bpwr/simulator/ant_bpwr_simulator_local.h @@ -0,0 +1,38 @@ +/* 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. + * + */ + +#ifndef ANT_BPWR_SIMULATOR_LOCAL_H__ +#define ANT_BPWR_SIMULATOR_LOCAL_H__ + +#include +#include +#include "bsp.h" +#include "ant_bpwr.h" +#include "sensorsim.h" + +/** + * @ingroup ant_sdk_bpwr_simulator + * @brief BPWR simulator control block structure. */ +typedef struct +{ + bool auto_change; ///< Power will change automatically (if auto_change is set) or manually. + uint32_t tick_incr; ///< Fractional part of tick increment. + sensorsim_state_t power_sensorsim_state; ///< Power state of the simulated sensor. + sensorsim_cfg_t power_sensorsim_cfg; ///< Power configuration of the simulated sensor. + sensorsim_state_t cadence_sensorsim_state; ///< Cadence stated of the simulated sensor. + sensorsim_cfg_t cadence_sensorsim_cfg; ///< Cadence configuration of the simulated sensor. + sensorsim_state_t pedal_sensorsim_state; ///< Pedal state of the simulated sensor. + sensorsim_cfg_t pedal_sensorsim_cfg; ///< Pedal configuration of the simulated sensor. +}ant_bpwr_simulator_cb_t; + + +#endif // ANT_BPWR_SIMULATOR_LOCAL_H__ diff --git a/components/ant/ant_profiles/ant_bpwr/utils/ant_bpwr_utils.h b/components/ant/ant_profiles/ant_bpwr/utils/ant_bpwr_utils.h new file mode 100644 index 0000000..8fac8c6 --- /dev/null +++ b/components/ant/ant_profiles/ant_bpwr/utils/ant_bpwr_utils.h @@ -0,0 +1,49 @@ +/* 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. + * + */ +#ifndef ANT_BPWR_UTILS_H__ +#define ANT_BPWR_UTILS_H__ + +#include "app_util.h" +#include "nrf_assert.h" +#include "nrf.h" + +/** @file + * + * @defgroup ant_sdk_profiles_bpwr_utils Bicycle Power profile utilities + * @{ + * @ingroup ant_sdk_profiles_bpwr + * @brief This module implements utilities for the Bicycle Power profile. + * + */ + +/*@brief A reversal of torque period unit. + * + * @details According to the ANT BPWR specification, the torque period unit is 1/2048 of a second. + */ +#define ANT_BPWR_TORQUE_PERIOD_UNIT_REVERSAL 2048 +#define ANT_BPWR_TORQUE_PERIOD_DISP_PRECISION 1000 +#define ANT_BPWR_TORQUE_PERIOD_RESCALE(VALUE) value_rescale((VALUE), ANT_BPWR_TORQUE_PERIOD_UNIT_REVERSAL, \ + ANT_BPWR_TORQUE_PERIOD_DISP_PRECISION) + +/*@brief A reversal of accumulated torque unit. + * + * @details According to the ANT BPWR specification, the accumulated torque unit is 1/32 of a Nm. + */ +#define ANT_BPWR_ACC_TORQUE_UNIT_REVERSAL 32 +#define ANT_BPWR_ACC_TORQUE_DISP_PRECISION 10 +#define ANT_BPWR_ACC_TORQUE_RESCALE(VALUE) value_rescale((VALUE), ANT_BPWR_ACC_TORQUE_UNIT_REVERSAL, \ + ANT_BPWR_ACC_TORQUE_DISP_PRECISION) + +/** @} */ + +#endif // ANT_BPWR_UTILS_H__ + diff --git a/components/ant/ant_profiles/ant_bsc/ant_bsc.c b/components/ant/ant_profiles/ant_bsc/ant_bsc.c new file mode 100644 index 0000000..92959c3 --- /dev/null +++ b/components/ant/ant_profiles/ant_bsc/ant_bsc.c @@ -0,0 +1,382 @@ +/* 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 "nrf_assert.h" +#include "app_error.h" +#include "ant_interface.h" +#include "app_util.h" +#include "ant_bsc.h" +#include "ant_bsc_utils.h" +#include "ant_bsc_page_logger.h" +#include "app_error.h" + +#define MAIN_DATA_INTERVAL 4 /**< The number of background data pages sent between main data pages.*/ +#define BACKGROUND_DATA_INTERVAL 64 /**< The number of main data pages sent between background data page. + Background data page is sent every 65th message. */ +#define TX_TOGGLE_DIVISOR 4 /**< The number of messages between changing state of toggle bit. */ + +/**@brief BSC message data layout structure. */ +typedef struct +{ + ant_bsc_page_t page_number : 7; + uint8_t toggle_bit : 1; + uint8_t page_payload[7]; +}ant_bsc_single_message_layout_t; + +typedef struct +{ + uint8_t page_payload[8]; +}ant_bsc_combined_message_layout_t; + +typedef union +{ + ant_bsc_single_message_layout_t speed_or_cadence; + ant_bsc_combined_message_layout_t combined; +}ant_bsc_message_layout_t; + + +/**@brief Function for initializing the ANT BSC profile instance. + * + * @param[in] p_profile Pointer to the profile instance. + * @param[in] p_channel_config Pointer to the ANT channel configuration structure. + * + * @retval NRF_SUCCESS If initialization was successful. Otherwise, an error code is returned. + */ +static ret_code_t ant_bsc_init(ant_bsc_profile_t * p_profile, + ant_channel_config_t const * p_channel_config) +{ + p_profile->channel_number = p_channel_config->channel_number; + + p_profile->page_0 = DEFAULT_ANT_BSC_PAGE0(); + p_profile->page_1 = DEFAULT_ANT_BSC_PAGE1(); + p_profile->page_2 = DEFAULT_ANT_BSC_PAGE2(); + p_profile->page_3 = DEFAULT_ANT_BSC_PAGE3(); + p_profile->page_4 = DEFAULT_ANT_BSC_PAGE4(); + p_profile->page_5 = DEFAULT_ANT_BSC_PAGE5(); + p_profile->page_comb_0 = DEFAULT_ANT_BSC_COMBINED_PAGE0(); + + LOG_BSC("ANT BSC channel %u init\n\r", p_profile->channel_number); + return ant_channel_init(p_channel_config); +} + +ret_code_t ant_bsc_disp_init(ant_bsc_profile_t * p_profile, + ant_channel_config_t const * p_channel_config, + ant_bsc_disp_config_t const * p_disp_config) +{ + ASSERT(p_profile != NULL); + ASSERT(p_channel_config != NULL); + ASSERT(p_disp_config->evt_handler != NULL); + + p_profile->evt_handler = p_disp_config->evt_handler; + p_profile->_cb.p_disp_cb = p_disp_config->p_cb; + + p_profile->_cb.p_disp_cb->device_type = p_channel_config->device_type; + + return ant_bsc_init(p_profile, p_channel_config); +} + +ret_code_t ant_bsc_sens_init(ant_bsc_profile_t * p_profile, + ant_channel_config_t const * p_channel_config, + ant_bsc_sens_config_t const * p_sens_config) +{ + ASSERT(p_profile != NULL); + ASSERT(p_channel_config != NULL); + ASSERT(p_sens_config != NULL); + ASSERT(p_sens_config->p_cb_buffer != NULL); + ASSERT(p_sens_config->evt_handler != NULL); + + ASSERT((p_sens_config->main_page_number == ANT_BSC_PAGE_0) + || (p_sens_config->main_page_number == ANT_BSC_PAGE_5) + || (p_sens_config->main_page_number == ANT_BSC_COMB_PAGE_0)); + + p_profile->evt_handler = p_sens_config->evt_handler; + p_profile->_cb.p_sens_cb = p_sens_config->p_cb; + + p_profile->_cb.p_sens_cb->page_1_present = p_sens_config->page_1_present; + p_profile->_cb.p_sens_cb->page_4_present = p_sens_config->page_4_present; + p_profile->_cb.p_sens_cb->main_page_number = p_sens_config->main_page_number; + p_profile->_cb.p_sens_cb->bkgd_page_number = + p_sens_config->page_1_present ? ANT_BSC_PAGE_1 : ANT_BSC_PAGE_2; + p_profile->_cb.p_sens_cb->message_counter = 0; + p_profile->_cb.p_sens_cb->toggle_bit = true; + p_profile->_cb.p_sens_cb->device_type = p_channel_config->device_type; /* Device type is set up in channel config */ + + return ant_bsc_init(p_profile, p_channel_config); +} + +/**@brief Function for setting the next background page number. + * + * @param[in] p_profile Pointer to the profile instance. + * + */ +__STATIC_INLINE void next_bkgd_page_number_set(ant_bsc_profile_t * p_profile) +{ + /* Determine the last background page*/ + ant_bsc_page_t last_bkgd_page = + p_profile->_cb.p_sens_cb->page_4_present ? ANT_BSC_PAGE_4 : ANT_BSC_PAGE_3; + + /* Switch the background page according to user settings */ + ++(p_profile->_cb.p_sens_cb->bkgd_page_number); + if (p_profile->_cb.p_sens_cb->bkgd_page_number > last_bkgd_page) + { + p_profile->_cb.p_sens_cb->bkgd_page_number = + p_profile->_cb.p_sens_cb->page_1_present ? ANT_BSC_PAGE_1 : ANT_BSC_PAGE_2; + } +} + +/**@brief Function for getting next page number to send. + * + * @param[in] p_profile Pointer to the profile instance. + * + * @return Next page number. + */ +static ant_bsc_page_t next_page_number_get(ant_bsc_profile_t * p_profile) +{ + ant_bsc_page_t page_number; + + /* This is a single speed or cadence sensor - switch data page */ + if (p_profile->_cb.p_sens_cb->message_counter < (BACKGROUND_DATA_INTERVAL)) + { + /* Return main page */ + page_number = p_profile->_cb.p_sens_cb->main_page_number; + } + else + { + /* Return background page */ + page_number = p_profile->_cb.p_sens_cb->bkgd_page_number; + } + + /* Set page toggle bit */ + if ((p_profile->_cb.p_sens_cb->message_counter % TX_TOGGLE_DIVISOR) == 0) + { + p_profile->_cb.p_sens_cb->toggle_bit ^= 1; + } + + /* Update message counter, wrap when counter equals 64 + 4 */ + ++(p_profile->_cb.p_sens_cb->message_counter); + if (p_profile->_cb.p_sens_cb->message_counter == (BACKGROUND_DATA_INTERVAL + MAIN_DATA_INTERVAL)) + { + p_profile->_cb.p_sens_cb->message_counter = 0; + /* Set new background data page number */ + next_bkgd_page_number_set(p_profile); + } + + return page_number; +} + +/**@brief Function for encoding BSC message. + * + * @param[in] p_profile Pointer to the profile instance. + * @param[out] p_message_payload Pointer to the message payload structure. + * + * @note Assume to be called each time when Tx window will occur. + */ +static void sens_message_encode(ant_bsc_profile_t * p_profile, uint8_t * p_message_payload) +{ + ant_bsc_message_layout_t * p_bsc_message_payload = (ant_bsc_message_layout_t *)p_message_payload; + ant_bsc_evt_t bsc_sens_event; + + if (p_profile->_cb.p_sens_cb->device_type == BSC_COMBINED_DEVICE_TYPE) + { + LOG_BSC("%-30s \"Combined Speed & Cadence Page\"\n\r", "BSC TX Page:"); + ant_bsc_combined_page_0_encode(p_bsc_message_payload->combined.page_payload, + &(p_profile->page_comb_0)); + bsc_sens_event = (ant_bsc_evt_t) ANT_BSC_COMB_PAGE_0_UPDATED; + } + else + { + p_bsc_message_payload->speed_or_cadence.page_number = next_page_number_get(p_profile); + p_bsc_message_payload->speed_or_cadence.toggle_bit = p_profile->_cb.p_sens_cb->toggle_bit; + LOG_BSC("%-30s %u\n\r", "BSC TX Page number:", + p_bsc_message_payload->speed_or_cadence.page_number); + + ant_bsc_page_0_encode(p_bsc_message_payload->speed_or_cadence.page_payload, + &(p_profile->page_0)); + bsc_sens_event = (ant_bsc_evt_t) p_bsc_message_payload->speed_or_cadence.page_number; + + switch(p_bsc_message_payload->speed_or_cadence.page_number) + { + case ANT_BSC_PAGE_0: + // No implementation needed + break; + case ANT_BSC_PAGE_1: + ant_bsc_page_1_encode(p_bsc_message_payload->speed_or_cadence.page_payload, + &(p_profile->page_1)); + break; + case ANT_BSC_PAGE_2: + ant_bsc_page_2_encode(p_bsc_message_payload->speed_or_cadence.page_payload, + &(p_profile->page_2)); + break; + case ANT_BSC_PAGE_3: + ant_bsc_page_3_encode(p_bsc_message_payload->speed_or_cadence.page_payload, + &(p_profile->page_3)); + break; + case ANT_BSC_PAGE_4: + ant_bsc_page_4_encode(p_bsc_message_payload->speed_or_cadence.page_payload, + &(p_profile->page_4)); + break; + case ANT_BSC_PAGE_5: + ant_bsc_page_5_encode(p_bsc_message_payload->speed_or_cadence.page_payload, + &(p_profile->page_5)); + break; + default: + // No implementation needed + break; + } + } + LOG_BSC("\r\n"); + + p_profile->evt_handler(p_profile, bsc_sens_event); +} + +/**@brief Function for setting payload for ANT message and sending it. + * + * @param[in] p_profile Pointer to the profile instance. + */ +static void ant_message_send(ant_bsc_profile_t * p_profile) +{ + uint8_t p_message_payload[ANT_STANDARD_DATA_PAYLOAD_SIZE]; + uint32_t err_code; + + sens_message_encode(p_profile, p_message_payload); + err_code = sd_ant_broadcast_message_tx(p_profile->channel_number, + sizeof(p_message_payload), + p_message_payload); + APP_ERROR_CHECK(err_code); +} + +void ant_bsc_sens_evt_handler(ant_bsc_profile_t * p_profile, + ant_evt_t * p_ant_event) +{ + if (p_ant_event->channel == p_profile->channel_number) + { + switch (p_ant_event->event) + { + case EVENT_TX: + ant_message_send(p_profile); + break; + + default: + break; + } + } +} + +ret_code_t ant_bsc_disp_open(ant_bsc_profile_t * p_profile) +{ + ASSERT(p_profile != NULL); + + LOG_BSC("ANT BSC channel %u open\n\r", p_profile->channel_number); + return sd_ant_channel_open(p_profile->channel_number); +} + +ret_code_t ant_bsc_sens_open(ant_bsc_profile_t * p_profile) +{ + ASSERT(p_profile != NULL); + + // Fill tx buffer for the first frame + ant_message_send(p_profile); + + LOG_BSC("ANT BSC channel %u open\n\r", p_profile->channel_number); + return sd_ant_channel_open(p_profile->channel_number); +} + +/**@brief Function for decoding BSC message. + * + * @param[in,out] p_profile Pointer to the profile instance. + * @param[in] p_message_payload Pointer to the message payload structure. + * + * @note Assume to be call each time when Rx window will occur. + */ +static void disp_message_decode(ant_bsc_profile_t * p_profile, uint8_t * p_message_payload) +{ + const ant_bsc_message_layout_t * p_bsc_message_payload = + (ant_bsc_message_layout_t *)p_message_payload; + ant_bsc_evt_t bsc_disp_event; + + if (p_profile->_cb.p_disp_cb->device_type == BSC_COMBINED_DEVICE_TYPE) + { + LOG_BSC("%-30s \"Combined Speed & Cadence Page\"\n\r", "BSC RX Page Number:"); + ant_bsc_combined_page_0_decode(p_bsc_message_payload->combined.page_payload, + &(p_profile->page_comb_0)); + bsc_disp_event = (ant_bsc_evt_t) ANT_BSC_COMB_PAGE_0_UPDATED; + } + else + { + LOG_BSC("%-30s %u\n\r", "BSC RX Page Number:", + p_bsc_message_payload->speed_or_cadence.page_number); + ant_bsc_page_0_decode(p_bsc_message_payload->speed_or_cadence.page_payload, + &(p_profile->page_0)); // Page 0 is present in each message + bsc_disp_event = (ant_bsc_evt_t) p_bsc_message_payload->speed_or_cadence.page_number; + + switch (p_bsc_message_payload->speed_or_cadence.page_number) + { + case ANT_BSC_PAGE_0: + // No implementation needed + break; + + case ANT_BSC_PAGE_1: + ant_bsc_page_1_decode(p_bsc_message_payload->speed_or_cadence.page_payload, + &(p_profile->page_1)); + break; + + case ANT_BSC_PAGE_2: + ant_bsc_page_2_decode(p_bsc_message_payload->speed_or_cadence.page_payload, + &(p_profile->page_2)); + break; + + case ANT_BSC_PAGE_3: + ant_bsc_page_3_decode(p_bsc_message_payload->speed_or_cadence.page_payload, + &(p_profile->page_3)); + break; + + case ANT_BSC_PAGE_4: + ant_bsc_page_4_decode(p_bsc_message_payload->speed_or_cadence.page_payload, + &(p_profile->page_4)); + break; + + case ANT_BSC_PAGE_5: + ant_bsc_page_5_decode(p_bsc_message_payload->speed_or_cadence.page_payload, + &(p_profile->page_5)); + break; + + default: + // No implementation needed + break; + } + } + LOG_BSC("\r\n"); + + p_profile->evt_handler(p_profile, bsc_disp_event); +} + +void ant_bsc_disp_evt_handler(ant_bsc_profile_t * p_profile, + ant_evt_t * p_ant_event) +{ + if (p_ant_event->channel == p_profile->channel_number) + { + ANT_MESSAGE * p_message = (ANT_MESSAGE *)p_ant_event->evt_buffer; + switch (p_ant_event->event) + { + case EVENT_RX: + + if (p_message->ANT_MESSAGE_ucMesgID == MESG_BROADCAST_DATA_ID + || p_message->ANT_MESSAGE_ucMesgID == MESG_ACKNOWLEDGED_DATA_ID + || p_message->ANT_MESSAGE_ucMesgID == MESG_BURST_DATA_ID) + { + disp_message_decode(p_profile, p_message->ANT_MESSAGE_aucPayload); + } + break; + default: + break; + } + } +} diff --git a/components/ant/ant_profiles/ant_bsc/ant_bsc.h b/components/ant/ant_profiles/ant_bsc/ant_bsc.h new file mode 100644 index 0000000..1251220 --- /dev/null +++ b/components/ant/ant_profiles/ant_bsc/ant_bsc.h @@ -0,0 +1,325 @@ +/* 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 ant_sdk_profiles_bsc Bicycle Speed and Cadence profile + * @{ + * @ingroup ant_sdk_profiles + * @brief This module implements the Bicycle Speed and Cadence profile. + * + */ + +#ifndef ANT_BSC_H__ +#define ANT_BSC_H__ + +#include +#include +#include "sdk_errors.h" +#include "ant_parameters.h" +#include "ant_stack_handler_types.h" +#include "ant_channel_config.h" +#include "ant_bsc_pages.h" + +#define BSC_ANTPLUS_RF_FREQ 0x39u ///< Frequency, decimal 57 (2457 MHz). + +#define BSC_SPEED_DEVICE_TYPE 0x7B ///< Device type reserved for ANT+ bike speed sensor. +#define BSC_CADENCE_DEVICE_TYPE 0x7A ///< Device type reserved for ANT+ bike cadence sensor. +#define BSC_COMBINED_DEVICE_TYPE 0x79 ///< Device type reserved for ANT+ bike combined speed and cadence sensor. + +#define BSC_MSG_PERIOD_4Hz 1u ///< Message period, 4 Hz (in basic period counts, where basic period time = 0.25 s). +#define BSC_MSG_PERIOD_2Hz 2u ///< Message period, 2 Hz (in basic period counts). +#define BSC_MSG_PERIOD_1Hz 4u ///< Message period, 1 Hz (in basic period counts). +#define BSC_MSG_PERIOD_SPEED 0x1FB6u ///< Message period in ticks, decimal 8118 (4.04 Hz). +#define BSC_MSG_PERIOD_CADENCE 0x1FA6u ///< Message period in ticks, decimal 8102 (4.04 Hz). +#define BSC_MSG_PERIOD_COMBINED 0x1F96u ///< Message period in ticks, decimal 8086 (4.05 Hz). + + +#define BSC_EXT_ASSIGN 0x00 ///< ANT ext assign (see Ext. Assign Channel Parameters in ant_parameters.h: @ref ant_parameters). +#define BSC_DISP_CHANNEL_TYPE CHANNEL_TYPE_SLAVE_RX_ONLY ///< Display BSC channel type. +#define BSC_SENS_CHANNEL_TYPE CHANNEL_TYPE_MASTER ///< Sensor BSC channel type. + + +/**@brief Select the basic ANT channel period (in ticks) for the BSC profile depending on the device type. + * + * @param[in] DEVICE_TYPE Type of device. Supported types: @ref BSC_SPEED_DEVICE_TYPE, @ref BSC_CADENCE_DEVICE_TYPE, + * @ref BSC_COMBINED_DEVICE_TYPE. + */ +#define BSC_DEVICE_TICKS(DEVICE_TYPE) \ + ((DEVICE_TYPE) == (BSC_SPEED_DEVICE_TYPE) ? (BSC_MSG_PERIOD_SPEED) : \ + ((DEVICE_TYPE) == (BSC_CADENCE_DEVICE_TYPE) ? (BSC_MSG_PERIOD_CADENCE) : \ + ((DEVICE_TYPE) == (BSC_COMBINED_DEVICE_TYPE) ? (BSC_MSG_PERIOD_COMBINED) : 0u))) + +/**@brief Calculate the channel period (in ticks) depending on the device type and the chosen message frequency. + * + * @param[in] DEVICE_TYPE Type of device. Supported types: @ref BSC_SPEED_DEVICE_TYPE, @ref BSC_CADENCE_DEVICE_TYPE, + * @ref BSC_COMBINED_DEVICE_TYPE. + * @param[in] BSC_MSG_PERIOD Channel data period. The BSC profile supports only the following periods: + * @ref BSC_MSG_PERIOD_4Hz, @ref BSC_MSG_PERIOD_2Hz, @ref BSC_MSG_PERIOD_1Hz. + */ +#define BSC_PERIOD_TICKS(DEVICE_TYPE, BSC_MSG_PERIOD) \ + ((BSC_DEVICE_TICKS(DEVICE_TYPE)) * (BSC_MSG_PERIOD)) + +/**@brief Initialize an ANT channel configuration structure for the BSC profile (Display). + * + * @param[in] NAME Name of related instance. + * @param[in] CHANNEL_NUMBER Number of the channel assigned to the profile instance. + * @param[in] TRANSMISSION_TYPE Type of transmission assigned to the profile instance. + * @param[in] DEVICE_TYPE Type of device. Supported types: @ref BSC_SPEED_DEVICE_TYPE, @ref BSC_CADENCE_DEVICE_TYPE, + * @ref BSC_COMBINED_DEVICE_TYPE. + * @param[in] DEVICE_NUMBER Number of the device assigned to the profile instance. + * @param[in] NETWORK_NUMBER Number of the network assigned to the profile instance. + * @param[in] BSC_MSG_PERIOD Channel data frequency in Hz. The BSC profile supports only the following frequencies: + * @ref BSC_MSG_PERIOD_4Hz, @ref BSC_MSG_PERIOD_2Hz, @ref BSC_MSG_PERIOD_1Hz. + */ +#define BSC_DISP_CHANNEL_CONFIG_DEF(NAME, \ + CHANNEL_NUMBER, \ + TRANSMISSION_TYPE, \ + DEVICE_TYPE, \ + DEVICE_NUMBER, \ + NETWORK_NUMBER, \ + BSC_MSG_PERIOD) \ +static const ant_channel_config_t NAME##_channel_bsc_disp_config = \ + { \ + .channel_number = (CHANNEL_NUMBER), \ + .channel_type = BSC_DISP_CHANNEL_TYPE, \ + .ext_assign = BSC_EXT_ASSIGN, \ + .rf_freq = BSC_ANTPLUS_RF_FREQ, \ + .transmission_type = (TRANSMISSION_TYPE), \ + .device_type = (DEVICE_TYPE), \ + .device_number = (DEVICE_NUMBER), \ + .channel_period = BSC_PERIOD_TICKS(DEVICE_TYPE, BSC_MSG_PERIOD), \ + .network_number = (NETWORK_NUMBER), \ + } +#define BSC_DISP_CHANNEL_CONFIG(NAME) &NAME##_channel_bsc_disp_config + +/**@brief Initialize an ANT channel configuration structure for the BSC profile (Transmitter). + * + * @param[in] NAME Name of related instance. + * @param[in] CHANNEL_NUMBER Number of the channel assigned to the profile instance. + * @param[in] TRANSMISSION_TYPE Type of transmission assigned to the profile instance. + * @param[in] DEVICE_TYPE Type of device. Supported types: @ref BSC_SPEED_DEVICE_TYPE, @ref BSC_CADENCE_DEVICE_TYPE, + * @ref BSC_COMBINED_DEVICE_TYPE. + * @param[in] DEVICE_NUMBER Number of the device assigned to the profile instance. + * @param[in] NETWORK_NUMBER Number of the network assigned to the profile instance. + */ +#define BSC_SENS_CHANNEL_CONFIG_DEF(NAME, \ + CHANNEL_NUMBER, \ + TRANSMISSION_TYPE, \ + DEVICE_TYPE, \ + DEVICE_NUMBER, \ + NETWORK_NUMBER) \ +static const ant_channel_config_t NAME##_channel_bsc_sens_config = \ + { \ + .channel_number = (CHANNEL_NUMBER), \ + .channel_type = BSC_SENS_CHANNEL_TYPE, \ + .ext_assign = BSC_EXT_ASSIGN, \ + .rf_freq = BSC_ANTPLUS_RF_FREQ, \ + .transmission_type = (TRANSMISSION_TYPE), \ + .device_type = (DEVICE_TYPE), \ + .device_number = (DEVICE_NUMBER), \ + .channel_period = BSC_PERIOD_TICKS(DEVICE_TYPE, BSC_MSG_PERIOD_4Hz), \ + .network_number = (NETWORK_NUMBER), \ + } +#define BSC_SENS_CHANNEL_CONFIG(NAME) &NAME##_channel_bsc_sens_config + +/**@brief Initialize an ANT profile configuration structure for the BSC profile (Display). + * + * @param[in] NAME Name of related instance. + * @param[in] EVT_HANDLER Event handler to be called for handling events in the BSC profile. + */ +#define BSC_DISP_PROFILE_CONFIG_DEF(NAME, \ + EVT_HANDLER) \ +static ant_bsc_disp_cb_t NAME##_bsc_disp_cb; \ +static const ant_bsc_disp_config_t NAME##_profile_bsc_disp_config = \ + { \ + .p_cb = &NAME##_bsc_disp_cb, \ + .evt_handler = (EVT_HANDLER), \ + } +#define BSC_DISP_PROFILE_CONFIG(NAME) &NAME##_profile_bsc_disp_config + +/**@brief Initialize an ANT profile configuration structure for the BSC profile (Sensor). + * + * @param[in] NAME Name of related instance. + * @param[in] PAGE_1_PRESENT Determines whether page 1 is included. + * @param[in] PAGE_4_PRESENT Determines whether page 4 is included. + * @param[in] MAIN_PAGE_NUMBER Determines the main data page (@ref ANT_BSC_PAGE_0 or @ref ANT_BSC_PAGE_5 or @ref ANT_BSC_COMB_PAGE_0). + * @param[in] EVT_HANDLER Event handler to be called for handling events in the BSC profile. + */ +#define BSC_SENS_PROFILE_CONFIG_DEF(NAME, \ + PAGE_1_PRESENT, \ + PAGE_4_PRESENT, \ + MAIN_PAGE_NUMBER, \ + EVT_HANDLER) \ +static ant_bsc_sens_cb_t NAME##_bsc_sens_cb; \ +static const ant_bsc_sens_config_t NAME##_profile_bsc_sens_config = \ + { \ + .page_1_present = (PAGE_1_PRESENT), \ + .page_4_present = (PAGE_4_PRESENT), \ + .main_page_number = (MAIN_PAGE_NUMBER), \ + .p_cb = &NAME##_bsc_sens_cb, \ + .evt_handler = (EVT_HANDLER), \ + } +#define BSC_SENS_PROFILE_CONFIG(NAME) &NAME##_profile_bsc_sens_config + +/**@brief BSC page number type. */ +typedef enum{ + ANT_BSC_PAGE_0, ///< Main data page number 0. + ANT_BSC_PAGE_1, ///< Background data page number 1. This page is optional. + ANT_BSC_PAGE_2, ///< Background data page number 2. + ANT_BSC_PAGE_3, ///< Background data page number 3. + ANT_BSC_PAGE_4, ///< Background data page number 4. This page is optional. + ANT_BSC_PAGE_5, ///< Main data page number 5. This page is optional. + ANT_BSC_COMB_PAGE_0 ///< Main data page number 0 for combined speed and cadence sensor. +} ant_bsc_page_t; + +/**@brief BSC profile event type. */ +typedef enum{ + ANT_BSC_PAGE_0_UPDATED = ANT_BSC_PAGE_0, ///< Data page 0 has been updated (Display) or sent (Sensor). + ANT_BSC_PAGE_1_UPDATED = ANT_BSC_PAGE_1, ///< Data page 0 and page 1 have been updated (Display) or sent (Sensor). + ANT_BSC_PAGE_2_UPDATED = ANT_BSC_PAGE_2, ///< Data page 0 and page 2 have been updated (Display) or sent (Sensor). + ANT_BSC_PAGE_3_UPDATED = ANT_BSC_PAGE_3, ///< Data page 0 and page 3 have been updated (Display) or sent (Sensor). + ANT_BSC_PAGE_4_UPDATED = ANT_BSC_PAGE_4, ///< Data page 0 and page 4 have been updated (Display) or sent (Sensor). + ANT_BSC_PAGE_5_UPDATED = ANT_BSC_PAGE_5, ///< Data page 0 and page 5 have been updated (Display) or sent (Sensor). + ANT_BSC_COMB_PAGE_0_UPDATED = ANT_BSC_COMB_PAGE_0, ///< Combined Speed and cadence data page has been updated (Display) or sent (Sensor). +} ant_bsc_evt_t; + +// Forward declaration of the ant_bsc_profile_t type. +typedef struct ant_bsc_profile_s ant_bsc_profile_t; + +/**@brief BSC event handler type. */ +typedef void (* ant_bsc_evt_handler_t) (ant_bsc_profile_t *, ant_bsc_evt_t); + +#include "ant_bsc_local.h" + +/**@brief BSC Display configuration structure. */ +typedef struct +{ + ant_bsc_disp_cb_t * p_cb; ///< Pointer to the data buffer for internal use. + ant_bsc_evt_handler_t evt_handler; ///< Event handler to be called for handling events in the BSC profile. +} ant_bsc_disp_config_t; + +/**@brief BSC Sensor configuration structure. */ +typedef struct +{ + bool page_1_present; ///< Determines whether page 1 is included. + bool page_4_present; ///< Determines whether page 4 is included. + ant_bsc_page_t main_page_number; ///< Determines the main data page (@ref ANT_BSC_PAGE_0 or @ref ANT_BSC_PAGE_5 or @ref ANT_BSC_COMB_PAGE_0). + ant_bsc_sens_cb_t * p_cb; ///< Pointer to the data buffer for internal use. + ant_bsc_evt_handler_t evt_handler; ///< Event handler to be called for handling events in the BSC profile. +} ant_bsc_sens_config_t; + +/**@brief BSC profile structure. */ +struct ant_bsc_profile_s +{ + uint8_t channel_number; ///< Channel number assigned to the profile. + union { + ant_bsc_disp_cb_t * p_disp_cb; + ant_bsc_sens_cb_t * p_sens_cb; + } _cb; ///< Pointer to internal control block. + ant_bsc_evt_handler_t evt_handler; ///< Event handler to be called for handling events in the BSC profile. + ant_bsc_page0_data_t page_0; ///< Page 0. + ant_bsc_page1_data_t page_1; ///< Page 1. + ant_bsc_page2_data_t page_2; ///< Page 2. + ant_bsc_page3_data_t page_3; ///< Page 3. + ant_bsc_page4_data_t page_4; ///< Page 4. + ant_bsc_page5_data_t page_5; ///< Page 5. + ant_bsc_combined_page0_data_t page_comb_0; ///< Page 0 for combined speed and cadence sensor. +}; + +/** @name Defines for accessing ant_bsc_profile_t member variables +@{ */ +#define BSC_PROFILE_event_time page_0.event_time +#define BSC_PROFILE_rev_count page_0.rev_count +#define BSC_PROFILE_operating_time page_1.operating_time +#define BSC_PROFILE_manuf_id page_2.manuf_id +#define BSC_PROFILE_serial_num page_2.serial_num +#define BSC_PROFILE_hw_version page_3.hw_version +#define BSC_PROFILE_sw_version page_3.sw_version +#define BSC_PROFILE_model_num page_3.model_num +#define BSC_PROFILE_fract_bat_volt page_4.fract_bat_volt +#define BSC_PROFILE_coarse_bat_volt page_4.coarse_bat_volt +#define BSC_PROFILE_bat_status page_4.bat_status +#define BSC_PROFILE_stop_indicator page_5.stop_indicator +#define BSC_PROFILE_cadence_event_time page_comb_0.cadence_event_time +#define BSC_PROFILE_cadence_rev_count page_comb_0.cadence_rev_count +#define BSC_PROFILE_speed_event_time page_comb_0.speed_event_time +#define BSC_PROFILE_speed_rev_count page_comb_0.speed_rev_count +/** @} */ + +/**@brief Function for initializing the ANT BSC profile instance. + * + * @param[in] p_profile Pointer to the profile instance. + * @param[in] p_channel_config Pointer to the ANT channel configuration structure. + * @param[in] p_disp_config Pointer to the BSC display configuration structure. + * + * @retval NRF_SUCCESS If initialization was successful. Otherwise, an error code is returned. + */ +ret_code_t ant_bsc_disp_init(ant_bsc_profile_t * p_profile, + ant_channel_config_t const * p_channel_config, + ant_bsc_disp_config_t const * p_disp_config); + +/**@brief Function for initializing the ANT BSC profile instance. + * + * @param[in] p_profile Pointer to the profile instance. + * @param[in] p_channel_config Pointer to the ANT channel configuration structure. + * @param[in] p_sens_config Pointer to the BSC sensor configuration structure. + * + * @retval NRF_SUCCESS If initialization was successful. Otherwise, an error code is returned. + */ +ret_code_t ant_bsc_sens_init(ant_bsc_profile_t * p_profile, + ant_channel_config_t const * p_channel_config, + ant_bsc_sens_config_t const * p_sens_config); + +/**@brief Function for opening the profile instance channel for the ANT BSC Display. + * + * Before calling this function, pages should be configured. + * + * @param[in] p_profile Pointer to the profile instance. + * + * @retval NRF_SUCCESS If the channel was successfully opened. Otherwise, an error code is returned. + */ +ret_code_t ant_bsc_disp_open(ant_bsc_profile_t * p_profile); + +/**@brief Function for opening the profile instance channel for the ANT BSC Sensor. + * + * Before calling this function, pages should be configured. + * + * @param[in] p_profile Pointer to the profile instance. + * + * @retval NRF_SUCCESS If the channel was successfully opened. Otherwise, an error code is returned. + */ +ret_code_t ant_bsc_sens_open(ant_bsc_profile_t * p_profile); + +/**@brief Function for handling the Sensor ANT events. + * + * @details This function handles all events from the ANT stack that are of interest to the Bicycle Speed and Cadence Sensor profile. + * + * @param[in] p_profile Pointer to the profile instance. + * @param[in] p_ant_event Event received from the ANT stack. + */ +void ant_bsc_sens_evt_handler(ant_bsc_profile_t * p_profile, + ant_evt_t * p_ant_event); + +/**@brief Function for handling the Display ANT events. + * + * @details This function handles all events from the ANT stack that are of interest to the Bicycle Speed and Cadence Display profile. + * + * @param[in] p_profile Pointer to the profile instance. + * @param[in] p_ant_event Event received from the ANT stack. + */ +void ant_bsc_disp_evt_handler(ant_bsc_profile_t * p_profile, + ant_evt_t * p_ant_event); + +#endif // ANT_BSC_H__ +/** @} */ + diff --git a/components/ant/ant_profiles/ant_bsc/ant_bsc_local.h b/components/ant/ant_profiles/ant_bsc/ant_bsc_local.h new file mode 100644 index 0000000..9c93c04 --- /dev/null +++ b/components/ant/ant_profiles/ant_bsc/ant_bsc_local.h @@ -0,0 +1,48 @@ +/* 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. + * + */ + + +#ifndef ANT_BSC_LOCAL_H__ +#define ANT_BSC_LOCAL_H__ + +#include +#include +#include "ant_bsc.h" + +/** + * @addtogroup ant_sdk_profiles_bsc + * @{ + */ + +/**@brief BSC Sensor control block. */ +typedef struct +{ + uint8_t device_type; + uint8_t toggle_bit : 1; + ant_bsc_page_t main_page_number : 7; + uint8_t page_1_present : 1; + uint8_t page_4_present : 1; + ant_bsc_page_t bkgd_page_number : 6; + uint8_t message_counter; +}ant_bsc_sens_cb_t; + +/**@brief BSC Display control block. */ +typedef struct +{ + uint8_t device_type; +}ant_bsc_disp_cb_t; + +/** + * @} + */ + +#endif // ANT_BSC_LOCAL_H__ diff --git a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_combined_page_0.c b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_combined_page_0.c new file mode 100644 index 0000000..e2e2614 --- /dev/null +++ b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_combined_page_0.c @@ -0,0 +1,94 @@ +/* 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 "ant_bsc_combined_page_0.h" +#include "ant_bsc_utils.h" +#include "ant_bsc_page_logger.h" + +/**@brief BSC page 0 data layout structure. */ +typedef struct +{ + uint8_t cadence_evt_time_LSB; + uint8_t cadence_evt_time_MSB; + uint8_t cadence_rev_count_LSB; + uint8_t cadence_rev_count_MSB; + uint8_t speed_evt_time_LSB; + uint8_t speed_evt_time_MSB; + uint8_t speed_rev_count_LSB; + uint8_t speed_rev_count_MSB; +}ant_bsc_combined_page0_data_layout_t; + +/**@brief Function for printing combined speed and cadence page0 data. */ +static void comb_page0_data_log(ant_bsc_combined_page0_data_t const * p_page_data) +{ + LOG_COMB_PAGE0("%-30s %u\n\r", + "Cadence Revolution count:", + (unsigned int)p_page_data->cadence_rev_count); + + LOG_COMB_PAGE0("%-30s %u.", + "Cadence event time:", + (unsigned int)ANT_BSC_EVENT_TIME_SEC(p_page_data->cadence_event_time)); + LOG_COMB_PAGE0("%03us\n\r", + (unsigned int)ANT_BSC_EVENT_TIME_MSEC(p_page_data->cadence_event_time)); + + LOG_COMB_PAGE0("%-30s %u\n\r", + "Speed Revolution count:", + (unsigned int)p_page_data->speed_rev_count); + + LOG_COMB_PAGE0("%-30s %u.", + "Speed event time:", + (unsigned int)ANT_BSC_EVENT_TIME_SEC(p_page_data->speed_event_time)); + LOG_COMB_PAGE0("%03us\n\r", (unsigned int)ANT_BSC_EVENT_TIME_MSEC(p_page_data->speed_event_time)); +} + +void ant_bsc_combined_page_0_encode(uint8_t * p_page_buffer, ant_bsc_combined_page0_data_t const * p_page_data) +{ + ant_bsc_combined_page0_data_layout_t * p_outcoming_data = (ant_bsc_combined_page0_data_layout_t *) p_page_buffer; + + uint16_t cadence_event_time = p_page_data->cadence_event_time; + uint16_t cadence_rev_count = p_page_data->cadence_rev_count; + uint16_t speed_event_time = p_page_data->speed_event_time; + uint16_t speed_rev_count = p_page_data->speed_rev_count; + + p_outcoming_data->cadence_evt_time_LSB = (uint8_t)(cadence_event_time & UINT8_MAX); + p_outcoming_data->cadence_evt_time_MSB = (uint8_t)((cadence_event_time >> 8) & UINT8_MAX); + p_outcoming_data->cadence_rev_count_LSB = (uint8_t)(cadence_rev_count & UINT8_MAX); + p_outcoming_data->cadence_rev_count_MSB = (uint8_t)((cadence_rev_count >> 8) & UINT8_MAX); + p_outcoming_data->speed_evt_time_LSB = (uint8_t)(speed_event_time & UINT8_MAX); + p_outcoming_data->speed_evt_time_MSB = (uint8_t)((speed_event_time >> 8) & UINT8_MAX); + p_outcoming_data->speed_rev_count_LSB = (uint8_t)(speed_rev_count & UINT8_MAX); + p_outcoming_data->speed_rev_count_MSB = (uint8_t)((speed_rev_count >> 8) & UINT8_MAX); + + comb_page0_data_log(p_page_data); +} + +void ant_bsc_combined_page_0_decode(uint8_t const * p_page_buffer, ant_bsc_combined_page0_data_t * p_page_data) +{ + ant_bsc_combined_page0_data_layout_t const * p_incoming_data = (ant_bsc_combined_page0_data_layout_t *)p_page_buffer; + + uint16_t cadence_event_time = (uint16_t)((p_incoming_data->cadence_evt_time_MSB << 8) + + p_incoming_data->cadence_evt_time_LSB); + uint16_t cadence_revolution_count = (uint16_t) ((p_incoming_data->cadence_rev_count_MSB << 8) + + p_incoming_data->cadence_rev_count_LSB); + uint16_t speed_event_time = (uint16_t)((p_incoming_data->speed_evt_time_MSB << 8) + + p_incoming_data->speed_evt_time_LSB); + uint16_t speed_revolution_count = (uint16_t) ((p_incoming_data->speed_rev_count_MSB << 8) + + p_incoming_data->speed_rev_count_LSB); + + p_page_data->cadence_event_time = cadence_event_time; + p_page_data->cadence_rev_count = cadence_revolution_count; + p_page_data->speed_event_time = speed_event_time; + p_page_data->speed_rev_count = speed_revolution_count; + + comb_page0_data_log(p_page_data); +} + diff --git a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_combined_page_0.h b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_combined_page_0.h new file mode 100644 index 0000000..cabc52c --- /dev/null +++ b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_combined_page_0.h @@ -0,0 +1,62 @@ +/* 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. + * + */ +#ifndef ANT_BSC_COMBINED_PAGE_0_H__ +#define ANT_BSC_COMBINED_PAGE_0_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_bsc_combined_page0 BSC profile page 0 (combined speed & cadence) + * @{ + * @ingroup ant_sdk_profiles_bsc_pages + */ + +#include + +/**@brief Data structure for Bicycle Combined Speed and Cadence data page 0. + * + * This structure is used as a common page. + */ +typedef struct +{ + uint16_t cadence_event_time; ///< Cadence event time. + uint16_t cadence_rev_count; ///< Cadence revolution count. + uint16_t speed_event_time; ///< Speed event time. + uint16_t speed_rev_count; ///< Speed revolution count. +} ant_bsc_combined_page0_data_t; + +/**@brief Initialize page 0. + */ +#define DEFAULT_ANT_BSC_COMBINED_PAGE0() \ + (ant_bsc_combined_page0_data_t) \ + { \ + .cadence_event_time = 0, \ + .cadence_rev_count = 0, \ + .speed_event_time = 0, \ + .speed_rev_count = 0, \ + } + +/**@brief Function for encoding page 0. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_bsc_combined_page_0_encode(uint8_t * p_page_buffer, ant_bsc_combined_page0_data_t const * p_page_data); + +/**@brief Function for decoding page 0. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_bsc_combined_page_0_decode(uint8_t const * p_page_buffer, ant_bsc_combined_page0_data_t * p_page_data); + +#endif // ANT_BSC_COMBINED_PAGE_0_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_0.c b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_0.c new file mode 100644 index 0000000..396dafd --- /dev/null +++ b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_0.c @@ -0,0 +1,70 @@ +/* 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 "ant_bsc_page_0.h" +#include "ant_bsc_utils.h" +#include "ant_bsc_page_logger.h" + +/**@brief BSC page 0 data layout structure. */ +typedef struct +{ + uint8_t reserved[3]; + uint8_t bsc_evt_time_LSB; + uint8_t bsc_evt_time_MSB; + uint8_t bsc_rev_count_LSB; + uint8_t bsc_rev_count_MSB; +}ant_bsc_page0_data_layout_t; + +/**@brief Function for printing speed or cadence page0 data. */ +static void page0_data_log(ant_bsc_page0_data_t const * p_page_data) +{ + LOG_PAGE0("%-30s %u\n\r", "Revolution count:", (unsigned int)p_page_data->rev_count); + + LOG_PAGE0("%-30s %u.", + "BSC event time:", + (unsigned int)ANT_BSC_EVENT_TIME_SEC(p_page_data->event_time)); + + LOG_PAGE0("%03us\n\r", (unsigned int)ANT_BSC_EVENT_TIME_MSEC(p_page_data->event_time)); +} + +void ant_bsc_page_0_encode(uint8_t * p_page_buffer, ant_bsc_page0_data_t const * p_page_data) +{ + ant_bsc_page0_data_layout_t * p_outcoming_data = (ant_bsc_page0_data_layout_t *) p_page_buffer; + uint16_t event_time = p_page_data->event_time; + uint16_t rev_count = p_page_data->rev_count; + + p_outcoming_data->reserved[0] = UINT8_MAX; + p_outcoming_data->reserved[1] = UINT8_MAX; + p_outcoming_data->reserved[2] = UINT8_MAX; + p_outcoming_data->bsc_evt_time_LSB = (uint8_t)(event_time & UINT8_MAX); + p_outcoming_data->bsc_evt_time_MSB = (uint8_t)((event_time >> 8) & UINT8_MAX); + p_outcoming_data->bsc_rev_count_LSB = (uint8_t)(rev_count & UINT8_MAX); + p_outcoming_data->bsc_rev_count_MSB = (uint8_t)((rev_count >> 8) & UINT8_MAX); + + page0_data_log(p_page_data); +} + +void ant_bsc_page_0_decode(uint8_t const * p_page_buffer, ant_bsc_page0_data_t * p_page_data) +{ + ant_bsc_page0_data_layout_t const * p_incoming_data = (ant_bsc_page0_data_layout_t *)p_page_buffer; + + uint16_t event_time = (uint16_t)((p_incoming_data->bsc_evt_time_MSB << 8) + + p_incoming_data->bsc_evt_time_LSB); + + uint16_t revolution_count = (uint16_t) ((p_incoming_data->bsc_rev_count_MSB << 8) + + p_incoming_data->bsc_rev_count_LSB); + + p_page_data->event_time = event_time; + p_page_data->rev_count = revolution_count; + + page0_data_log(p_page_data); +} + diff --git a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_0.h b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_0.h new file mode 100644 index 0000000..4e9f8c1 --- /dev/null +++ b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_0.h @@ -0,0 +1,58 @@ +/* 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. + * + */ +#ifndef ANT_BSC_PAGE_0_H__ +#define ANT_BSC_PAGE_0_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_bsc_page0 BSC profile page 0 + * @{ + * @ingroup ant_sdk_profiles_bsc_pages + */ + +#include + +/**@brief Data structure for BSC data page 0. + * + * This structure is used as a common page. + */ +typedef struct +{ + uint16_t event_time; ///< Speed or cadence event time. + uint16_t rev_count; ///< Speed or cadence revolution count. +} ant_bsc_page0_data_t; + +/**@brief Initialize page 0. + */ +#define DEFAULT_ANT_BSC_PAGE0() \ + (ant_bsc_page0_data_t) \ + { \ + .event_time = 0, \ + .rev_count = 0 \ + } + +/**@brief Function for encoding page 0. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_bsc_page_0_encode(uint8_t * p_page_buffer, ant_bsc_page0_data_t const * p_page_data); + +/**@brief Function for decoding page 0. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_bsc_page_0_decode(uint8_t const * p_page_buffer, ant_bsc_page0_data_t * p_page_data); + +#endif // ANT_BSC_PAGE_0_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_1.c b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_1.c new file mode 100644 index 0000000..a1d1d50 --- /dev/null +++ b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_1.c @@ -0,0 +1,55 @@ +/* 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 "ant_bsc_page_1.h" +#include "ant_bsc_utils.h" +#include "ant_bsc_page_logger.h" +#include "app_util.h" +#include "nordic_common.h" + +/**@brief BSC page 1 data layout structure. */ +typedef struct +{ + uint8_t cumulative_operating_time[3]; + uint8_t reserved[4]; +}ant_bsc_page1_data_layout_t; + +/**@brief Function for printing speed or cadence page1 data. */ +static void page1_data_log(ant_bsc_page1_data_t const * p_page_data) +{ + LOG_PAGE1("%-30s %ud ", + "Cumulative operating time:", + (unsigned int)ANT_BSC_OPERATING_DAYS(p_page_data->operating_time)); + LOG_PAGE1("%uh ", (unsigned int)ANT_BSC_OPERATING_HOURS(p_page_data->operating_time)); + LOG_PAGE1("%um ", (unsigned int)ANT_BSC_OPERATING_MINUTES(p_page_data->operating_time)); + LOG_PAGE1("%us\n\r", (unsigned int)ANT_BSC_OPERATING_SECONDS(p_page_data->operating_time)); +} + +void ant_bsc_page_1_encode(uint8_t * p_page_buffer, ant_bsc_page1_data_t const * p_page_data) +{ + ant_bsc_page1_data_layout_t * p_outcoming_data = (ant_bsc_page1_data_layout_t *)p_page_buffer; + + UNUSED_PARAMETER(uint24_encode(p_page_data->operating_time, + p_outcoming_data->cumulative_operating_time)); + page1_data_log( p_page_data); +} + +void ant_bsc_page_1_decode(uint8_t const * p_page_buffer, ant_bsc_page1_data_t * p_page_data) +{ + ant_bsc_page1_data_layout_t const * p_incoming_data = (ant_bsc_page1_data_layout_t *)p_page_buffer; + + p_page_data->operating_time = uint24_decode(p_incoming_data->cumulative_operating_time); + + page1_data_log( p_page_data); +} + + + diff --git a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_1.h b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_1.h new file mode 100644 index 0000000..fa8a221 --- /dev/null +++ b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_1.h @@ -0,0 +1,56 @@ +/* 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. + * + */ +#ifndef ANT_BSC_PAGE_1_H__ +#define ANT_BSC_PAGE_1_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_bsc_page1 BSC profile page 1 + * @{ + * @ingroup ant_sdk_profiles_bsc_pages + */ + +#include + +/**@brief Data structure for BSC data page 1. + * + * This structure implements only page 1 specific data. + */ +typedef struct +{ + uint32_t operating_time; ///< Operating time. +} ant_bsc_page1_data_t; + +/**@brief Initialize page 1. + */ +#define DEFAULT_ANT_BSC_PAGE1() \ + (ant_bsc_page1_data_t) \ + { \ + .operating_time = 0, \ + } + +/**@brief Function for encoding page 1. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_bsc_page_1_encode(uint8_t * p_page_buffer, ant_bsc_page1_data_t const * p_page_data); + +/**@brief Function for decoding page 1. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_bsc_page_1_decode(uint8_t const * p_page_buffer, ant_bsc_page1_data_t * p_page_data); + +#endif // ANT_BSC_PAGE_1_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_2.c b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_2.c new file mode 100644 index 0000000..e57e1cc --- /dev/null +++ b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_2.c @@ -0,0 +1,56 @@ +/* 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 "ant_bsc_page_2.h" +#include "ant_bsc_page_logger.h" + +/**@brief BSC page 2 data layout structure. */ +typedef struct +{ + uint8_t manuf_id; + uint8_t serial_num_LSB; + uint8_t serial_num_MSB; + uint8_t reserved[4]; +}ant_bsc_page2_data_layout_t; + +/**@brief Function for printing speed or cadence page2 data. */ +static void page2_data_log(ant_bsc_page2_data_t const * p_page_data) +{ + LOG_PAGE2("%-30s %u\n\r", "Manufacturer ID:", (unsigned int)p_page_data->manuf_id); + LOG_PAGE2("%-30s 0x%X\n\r", + "Serial No (upper 16-bits):", + (unsigned int)p_page_data->serial_num); +} + +void ant_bsc_page_2_encode(uint8_t * p_page_buffer, ant_bsc_page2_data_t const * p_page_data) +{ + ant_bsc_page2_data_layout_t * p_outcoming_data = (ant_bsc_page2_data_layout_t *)p_page_buffer; + uint32_t serial_num = p_page_data->serial_num; + + p_outcoming_data->manuf_id = (uint8_t)p_page_data->manuf_id; + p_outcoming_data->serial_num_LSB = (uint8_t)(serial_num & UINT8_MAX); + p_outcoming_data->serial_num_MSB = (uint8_t)((serial_num >> 8) & UINT8_MAX); + + page2_data_log( p_page_data); +} + +void ant_bsc_page_2_decode(uint8_t const * p_page_buffer, ant_bsc_page2_data_t * p_page_data) +{ + ant_bsc_page2_data_layout_t const * p_incoming_data = (ant_bsc_page2_data_layout_t *)p_page_buffer; + uint32_t serial_num = (uint32_t)((p_incoming_data->serial_num_MSB << 8) + + p_incoming_data->serial_num_LSB); + + p_page_data->manuf_id = (uint32_t)p_incoming_data->manuf_id; + p_page_data->serial_num = serial_num; + + page2_data_log( p_page_data); +} + diff --git a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_2.h b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_2.h new file mode 100644 index 0000000..668403f --- /dev/null +++ b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_2.h @@ -0,0 +1,58 @@ +/* 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. + * + */ +#ifndef ANT_BSC_PAGE_2_H__ +#define ANT_BSC_PAGE_2_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_bsc_page2 BSC profile page 2 + * @{ + * @ingroup ant_sdk_profiles_bsc_pages + */ + +#include + +/**@brief Data structure for BSC data page 2. + * + * This structure implements only page 2 specific data. + */ +typedef struct +{ + uint8_t manuf_id; ///< Manufacturer ID. + uint16_t serial_num; ///< Serial number. +} ant_bsc_page2_data_t; + +/**@brief Initialize page 2. + */ +#define DEFAULT_ANT_BSC_PAGE2() \ + (ant_bsc_page2_data_t) \ + { \ + .manuf_id = 0, \ + .serial_num = 0, \ + } + +/**@brief Function for encoding page 2. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_bsc_page_2_encode(uint8_t * p_page_buffer, ant_bsc_page2_data_t const * p_page_data); + +/**@brief Function for decoding page 2. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_bsc_page_2_decode(uint8_t const * p_page_buffer, ant_bsc_page2_data_t * p_page_data); + +#endif // ANT_BSC_PAGE_2_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_3.c b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_3.c new file mode 100644 index 0000000..6377f23 --- /dev/null +++ b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_3.c @@ -0,0 +1,53 @@ +/* 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 "ant_bsc_page_3.h" +#include "ant_bsc_page_logger.h" + +/**@brief BSC page 3 data layout structure. */ +typedef struct +{ + uint8_t hw_version; + uint8_t sw_version; + uint8_t model_num; + uint8_t reserved[4]; +}ant_bsc_page3_data_layout_t; + +/**@brief Function for printing speed or cadence page3 data. */ +static void page3_data_log(ant_bsc_page3_data_t const * p_page_data) +{ + LOG_PAGE3("%-30s %u\n\r", "Hardware Rev ID:", (unsigned int)p_page_data->hw_version); + LOG_PAGE3("%-30s %u\n\r", "Model:", (unsigned int)p_page_data->model_num); + LOG_PAGE3("%-30s %u\n\r", "Software Ver ID:", (unsigned int)p_page_data->sw_version); +} + +void ant_bsc_page_3_encode(uint8_t * p_page_buffer, ant_bsc_page3_data_t const * p_page_data) +{ + ant_bsc_page3_data_layout_t * p_outcoming_data = (ant_bsc_page3_data_layout_t *)p_page_buffer; + + p_outcoming_data->hw_version = (uint8_t)p_page_data->hw_version; + p_outcoming_data->sw_version = (uint8_t)p_page_data->sw_version; + p_outcoming_data->model_num = (uint8_t)p_page_data->model_num; + + page3_data_log( p_page_data); +} + +void ant_bsc_page_3_decode(uint8_t const * p_page_buffer, ant_bsc_page3_data_t * p_page_data) +{ + ant_bsc_page3_data_layout_t const * p_incoming_data = (ant_bsc_page3_data_layout_t *)p_page_buffer; + + p_page_data->hw_version = (uint32_t)p_incoming_data->hw_version; + p_page_data->sw_version = (uint32_t)p_incoming_data->sw_version; + p_page_data->model_num = (uint32_t)p_incoming_data->model_num; + + page3_data_log( p_page_data); +} + diff --git a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_3.h b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_3.h new file mode 100644 index 0000000..f4e2e40 --- /dev/null +++ b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_3.h @@ -0,0 +1,60 @@ +/* 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. + * + */ +#ifndef ANT_BSC_PAGE_3_H__ +#define ANT_BSC_PAGE_3_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_bsc_page3 BSC profile page 3 + * @{ + * @ingroup ant_sdk_profiles_bsc_pages + */ + +#include + +/**@brief Data structure for BSC data page 3. + * + * This structure implements only page 3 specific data. + */ +typedef struct +{ + uint8_t hw_version; ///< Hardware version. + uint8_t sw_version; ///< Software version. + uint8_t model_num; ///< Model number. +} ant_bsc_page3_data_t; + +/**@brief Initialize page 3. + */ +#define DEFAULT_ANT_BSC_PAGE3() \ + (ant_bsc_page3_data_t) \ + { \ + .hw_version = 0, \ + .sw_version = 0, \ + .model_num = 0, \ + } + +/**@brief Function for encoding page 3. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_bsc_page_3_encode(uint8_t * p_page_buffer, ant_bsc_page3_data_t const * p_page_data); + +/**@brief Function for decoding page 3. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_bsc_page_3_decode(uint8_t const * p_page_buffer, ant_bsc_page3_data_t * p_page_data); + +#endif // ANT_BSC_PAGE_3_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_4.c b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_4.c new file mode 100644 index 0000000..b4d9051 --- /dev/null +++ b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_4.c @@ -0,0 +1,64 @@ +/* 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 "ant_bsc_page_4.h" +#include "ant_bsc_utils.h" +#include "ant_bsc_page_logger.h" +#include "app_util.h" + +/**@brief BSC page 4 data layout structure. */ +typedef struct +{ + uint8_t reserved_byte; + uint8_t fract_bat_volt; + uint8_t coarse_bat_volt : 4; + uint8_t bat_status : 3; + uint8_t bitfield_reserved : 1; + uint8_t reserved[4]; +}ant_bsc_page4_data_layout_t; + +/* Display precission must be updated. */ +STATIC_ASSERT(ANT_BSC_BAT_VOLTAGE_PRECISION == 1000); + +/**@brief Function for printing speed or cadence page4 data. */ +static void page4_data_log( ant_bsc_page4_data_t const * p_page_data) +{ + LOG_PAGE4("%-30s %u.%03uV\r\n", + "Battery voltage:", + (unsigned int)p_page_data->coarse_bat_volt, + (unsigned int)ANT_BSC_BAT_VOLTAGE_FRACTION_MV(p_page_data->fract_bat_volt)); + LOG_PAGE4("%-30s %u\n\r", "Battery status:", (unsigned int)p_page_data->bat_status); +} + +void ant_bsc_page_4_encode(uint8_t * p_page_buffer, ant_bsc_page4_data_t const * p_page_data) +{ + ant_bsc_page4_data_layout_t * p_outcoming_data = (ant_bsc_page4_data_layout_t *)p_page_buffer; + + p_outcoming_data->reserved_byte = UINT8_MAX; + p_outcoming_data->fract_bat_volt = p_page_data->fract_bat_volt; + p_outcoming_data->coarse_bat_volt = p_page_data->coarse_bat_volt; + p_outcoming_data->bat_status = p_page_data->bat_status; + p_outcoming_data->bitfield_reserved = 0; + + page4_data_log( p_page_data); +} + +void ant_bsc_page_4_decode(uint8_t const * p_page_buffer, ant_bsc_page4_data_t * p_page_data) +{ + ant_bsc_page4_data_layout_t const * p_incoming_data = (ant_bsc_page4_data_layout_t *)p_page_buffer; + + p_page_data->fract_bat_volt = p_incoming_data->fract_bat_volt; + p_page_data->coarse_bat_volt = p_incoming_data->coarse_bat_volt; + p_page_data->bat_status = p_incoming_data->bat_status; + + page4_data_log( p_page_data); +} + diff --git a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_4.h b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_4.h new file mode 100644 index 0000000..e72b293 --- /dev/null +++ b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_4.h @@ -0,0 +1,76 @@ +/* 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. + * + */ +#ifndef ANT_BSC_PAGE_4_H__ +#define ANT_BSC_PAGE_4_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_bsc_page4 BSC profile page 4 + * @{ + * @ingroup ant_sdk_profiles_bsc_pages + */ + +#include + +/**@brief BSC profile battery status. + * + * This enum represents possible battery status values for the ANT BSC profile. + */ +typedef enum +{ + RESERVED0 = 0, ///< Reserved. + BSC_BAT_STATUS_NEW = 1, ///< Battery status: new. + BSC_BAT_STATUS_GOOD = 2, ///< Battery status: good. + BSC_BAT_STATUS_OK = 3, ///< Battery status: ok. + BSC_BAT_STATUS_LOW = 4, ///< Battery status: low. + BSC_BAT_STATUS_CRITICAL = 5, ///< Battery status: critical. + RESERVED1 = 6, ///< Reserved. + BSC_BAT_STATUS_INVALID = 7 ///< Invalid battery status. +} ant_bsc_bat_status_t; + +/**@brief Data structure for BSC data page 4. + * + * This structure implements only page 4 specific data. + */ +typedef struct +{ + uint8_t fract_bat_volt; ///< Fractional battery voltage. + uint8_t coarse_bat_volt : 4; ///< Coarse battery voltage. + uint8_t bat_status : 3; ///< Battery status. +} ant_bsc_page4_data_t; + +/**@brief Initialize page 4. + */ +#define DEFAULT_ANT_BSC_PAGE4() \ + (ant_bsc_page4_data_t) \ + { \ + .fract_bat_volt = 0, \ + .coarse_bat_volt = 0, \ + .bat_status = BSC_BAT_STATUS_INVALID \ + } + +/**@brief Function for encoding page 4. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_bsc_page_4_encode(uint8_t * p_page_buffer, ant_bsc_page4_data_t const * p_page_data); + +/**@brief Function for decoding page 4. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_bsc_page_4_decode(uint8_t const * p_page_buffer, ant_bsc_page4_data_t * p_page_data); + +#endif // ANT_BSC_PAGE_4_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_5.c b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_5.c new file mode 100644 index 0000000..9a5bd94 --- /dev/null +++ b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_5.c @@ -0,0 +1,56 @@ +/* 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 "ant_bsc_page_5.h" +#include "ant_bsc_utils.h" +#include "ant_bsc_page_logger.h" + +/**@brief BSC profile page 5 bitfields definitions. */ +#define ANT_BSC_STOP_IND_MASK 0x01 + +/**@brief BSC page 5 data layout structure. */ +typedef struct +{ + uint8_t flags; + uint8_t reserved[6]; +}ant_bsc_page5_data_layout_t; + +/**@brief Function for printing speed or cadence page5 data. */ +static void page5_data_log(ant_bsc_page5_data_t const * p_page_data) +{ + if (p_page_data->stop_indicator) + { + LOG_PAGE5("Bicycle stopped.\r\n"); + } + else + { + LOG_PAGE5("Bicycle moving.\r\n"); + } +} + +void ant_bsc_page_5_encode(uint8_t * p_page_buffer, ant_bsc_page5_data_t const * p_page_data) +{ + ant_bsc_page5_data_layout_t * p_outcoming_data = (ant_bsc_page5_data_layout_t *)p_page_buffer; + + p_outcoming_data->flags = (uint8_t)p_page_data->stop_indicator; + + page5_data_log( p_page_data); +} + +void ant_bsc_page_5_decode(uint8_t const * p_page_buffer, ant_bsc_page5_data_t * p_page_data) +{ + ant_bsc_page5_data_layout_t const * p_incoming_data = (ant_bsc_page5_data_layout_t *)p_page_buffer; + + p_page_data->stop_indicator = (p_incoming_data->flags) & ANT_BSC_STOP_IND_MASK; + + page5_data_log( p_page_data); +} + diff --git a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_5.h b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_5.h new file mode 100644 index 0000000..e7d925a --- /dev/null +++ b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_page_5.h @@ -0,0 +1,58 @@ +/* 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. + * + */ +#ifndef ANT_BSC_PAGE_5_H__ +#define ANT_BSC_PAGE_5_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_bsc_page5 BSC profile page 5 + * @{ + * @ingroup ant_sdk_profiles_bsc_pages + */ + +#include + +/**@brief Data structure for BSC data page 5. + * + * This structure implements only page 5 specific data. + */ +typedef struct +{ + uint8_t stop_indicator:1; ///< Stop indication bit. + uint8_t reserved:7; ///< Reserved. +} ant_bsc_page5_data_t; + +/**@brief Initialize page 5. + */ +#define DEFAULT_ANT_BSC_PAGE5() \ + (ant_bsc_page5_data_t) \ + { \ + .stop_indicator = 0, \ + .reserved = 0, \ + } + +/**@brief Function for encoding page 5. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_bsc_page_5_encode(uint8_t * p_page_buffer, ant_bsc_page5_data_t const * p_page_data); + +/**@brief Function for decoding page 5. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_bsc_page_5_decode(uint8_t const * p_page_buffer, ant_bsc_page5_data_t * p_page_data); + +#endif // ANT_BSC_PAGE_5_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_pages.h b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_pages.h new file mode 100644 index 0000000..2b8990a --- /dev/null +++ b/components/ant/ant_profiles/ant_bsc/pages/ant_bsc_pages.h @@ -0,0 +1,32 @@ +/* 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. + * + */ +#ifndef __ANT_BSC_PAGES_H +#define __ANT_BSC_PAGES_H + +/** @file + * + * @defgroup ant_sdk_profiles_bsc_pages Bicycle Speed and Cadence profile pages + * @{ + * @ingroup ant_sdk_profiles_bsc + * @brief This module implements functions for the BSC data pages. + */ + +#include "ant_bsc_page_0.h" +#include "ant_bsc_page_1.h" +#include "ant_bsc_page_2.h" +#include "ant_bsc_page_3.h" +#include "ant_bsc_page_4.h" +#include "ant_bsc_page_5.h" +#include "ant_bsc_combined_page_0.h" + +#endif // __ANT_BSC_PAGES_H +/** @} */ diff --git a/components/ant/ant_profiles/ant_bsc/pages/logger/ant_bsc_page_logger.h b/components/ant/ant_profiles/ant_bsc/pages/logger/ant_bsc_page_logger.h new file mode 100644 index 0000000..6b46312 --- /dev/null +++ b/components/ant/ant_profiles/ant_bsc/pages/logger/ant_bsc_page_logger.h @@ -0,0 +1,71 @@ +/* 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. + * + */ +#ifndef ANT_BSC_PAGE_LOGGER_H__ +#define ANT_BSC_PAGE_LOGGER_H__ + +#ifdef TRACE_BSC_GENERAL_ENABLE +#include "app_trace.h" +#define LOG_BSC app_trace_log +#else +#define LOG_BSC(...) +#endif // TRACE_BSC_GENERAL_ENABLE + +#ifdef TRACE_BSC_PAGE_0_ENABLE +#include "app_trace.h" +#define LOG_PAGE0 app_trace_log +#else +#define LOG_PAGE0(...) +#endif // TRACE_BSC_PAGE_0_ENABLE + +#ifdef TRACE_BSC_PAGE_1_ENABLE +#include "app_trace.h" +#define LOG_PAGE1 app_trace_log +#else +#define LOG_PAGE1(...) +#endif // TRACE_BSC_PAGE_1_ENABLE + +#ifdef TRACE_BSC_PAGE_2_ENABLE +#include "app_trace.h" +#define LOG_PAGE2 app_trace_log +#else +#define LOG_PAGE2(...) +#endif // TRACE_BSC_PAGE_2_ENABLE + +#ifdef TRACE_BSC_PAGE_3_ENABLE +#include "app_trace.h" +#define LOG_PAGE3 app_trace_log +#else +#define LOG_PAGE3(...) +#endif // TRACE_BSC_PAGE_3_ENABLE + +#ifdef TRACE_BSC_PAGE_4_ENABLE +#include "app_trace.h" +#define LOG_PAGE4 app_trace_log +#else +#define LOG_PAGE4(...) +#endif // TRACE_BSC_PAGE_4_ENABLE + +#ifdef TRACE_BSC_PAGE_5_ENABLE +#include "app_trace.h" +#define LOG_PAGE5 app_trace_log +#else +#define LOG_PAGE5(...) +#endif // TRACE_BSC_PAGE_5_ENABLE + +#ifdef TRACE_BSC_COMB_PAGE_0_ENABLE +#include "app_trace.h" +#define LOG_COMB_PAGE0 app_trace_log +#else +#define LOG_COMB_PAGE0(...) +#endif // TRACE_BSC_COMB_PAGE_0_ENABLE + +#endif // ANT_BSC_UTILS_H__ diff --git a/components/ant/ant_profiles/ant_bsc/simulator/ant_bsc_simulator.c b/components/ant/ant_profiles/ant_bsc/simulator/ant_bsc_simulator.c new file mode 100644 index 0000000..c1eb77f --- /dev/null +++ b/components/ant/ant_profiles/ant_bsc/simulator/ant_bsc_simulator.c @@ -0,0 +1,253 @@ +/* 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 "ant_bsc_simulator.h" +#include "ant_bsc_utils.h" +#include "app_util.h" + +#define ITERATION_ANT_CYCLES(DEVICE_TYPE) \ + (BSC_PERIOD_TICKS(DEVICE_TYPE, BSC_MSG_PERIOD_4Hz)) ///< period of calculation [1/32678 s], defined in ANT device profile + // use the same DEVICE TYPE as in profile definition +#define ITERATION_PERIOD(DEVICE_TYPE) \ + ((ITERATION_ANT_CYCLES(DEVICE_TYPE)) * 1024 / ANT_CLOCK_FREQUENCY) ///< integer part of calculation's period [1/1024 s] +#define ITERATION_FRACTION(DEVICE_TYPE) \ + ((ITERATION_ANT_CYCLES(DEVICE_TYPE)) * 1024 % ANT_CLOCK_FREQUENCY) ///< fractional part of calculation's period [1/32678 s] + +#define SPEED_SIM_MIN_VAL 0u ///< speed simulation minimum value [m/s] +#define SPEED_SIM_MAX_VAL 16u ///< speed simulation maximum value [m/s] +#define SPEED_SIM_INCREMENT 1u ///< speed simulation value increment [m/s] +#define CADENCE_SIM_MIN_VAL 70u ///< cadence simulation minimum value [rpm] +#define CADENCE_SIM_MAX_VAL 120u ///< cadence simulation maximum value [rpm] +#define CADENCE_SIM_INCREMENT 1u ///< cadence simulation value increment [rpm] +#define WHEEL_CIRCUMFERENCE 1766u ///< bike wheel circumference [mm] +#define MM_TO_METERS(MM_VAL) ((MM_VAL) / 1000u) +#define TWO_SEC_TO_TICKS 2048 ///< number of [1/1024s] ticks in 2 sec period +#define CUMULATIVE_TIME_UNIT 2 ///< cumulative time unit + +void ant_bsc_simulator_init(ant_bsc_simulator_t * p_simulator, + ant_bsc_simulator_cfg_t const * p_config, + bool auto_change) +{ + p_simulator->p_profile = p_config->p_profile; + p_simulator->_cb.auto_change = auto_change; + p_simulator->_cb.speed_sim_val = SPEED_SIM_MIN_VAL; + p_simulator->_cb.cadence_sim_val = CADENCE_SIM_MIN_VAL; + p_simulator->_cb.time_since_last_s_evt = 0; + p_simulator->_cb.fraction_since_last_s_evt = 0; + p_simulator->_cb.time_since_last_c_evt = 0; + p_simulator->_cb.fraction_since_last_c_evt = 0; + p_simulator->_cb.device_type = p_config->device_type; + + p_simulator->_cb.sensorsim_s_cfg.min = SPEED_SIM_MIN_VAL; + p_simulator->_cb.sensorsim_s_cfg.max = SPEED_SIM_MAX_VAL; + p_simulator->_cb.sensorsim_s_cfg.incr = SPEED_SIM_INCREMENT; + p_simulator->_cb.sensorsim_s_cfg.start_at_max = false; + sensorsim_init(&(p_simulator->_cb.sensorsim_s_state), + &(p_simulator->_cb.sensorsim_s_cfg)); + p_simulator->_cb.sensorsim_c_cfg.min = CADENCE_SIM_MIN_VAL; + p_simulator->_cb.sensorsim_c_cfg.max = CADENCE_SIM_MAX_VAL; + p_simulator->_cb.sensorsim_c_cfg.incr = CADENCE_SIM_INCREMENT; + p_simulator->_cb.sensorsim_c_cfg.start_at_max = false; + p_simulator->_cb.stop_cnt = 0; + sensorsim_init(&(p_simulator->_cb.sensorsim_c_state), + &(p_simulator->_cb.sensorsim_c_cfg)); +} + + +void ant_bsc_simulator_one_iteration(ant_bsc_simulator_t * p_simulator) +{ + + // Set constant battery voltage + p_simulator->p_profile->BSC_PROFILE_coarse_bat_volt = 2; + p_simulator->p_profile->BSC_PROFILE_fract_bat_volt = 200; + p_simulator->p_profile->BSC_PROFILE_bat_status = BSC_BAT_STATUS_GOOD; + + // Calculate speed and cadence values + if (p_simulator->_cb.auto_change) + { + p_simulator->_cb.speed_sim_val = sensorsim_measure(&(p_simulator->_cb.sensorsim_s_state), + &(p_simulator->_cb.sensorsim_s_cfg)); + p_simulator->_cb.cadence_sim_val = sensorsim_measure(&(p_simulator->_cb.sensorsim_c_state), + &(p_simulator->_cb.sensorsim_c_cfg)); + } + else + { + p_simulator->_cb.speed_sim_val = p_simulator->_cb.sensorsim_s_state.current_val; + p_simulator->_cb.cadence_sim_val = p_simulator->_cb.sensorsim_c_state.current_val; + } + + // Simulate bicycle stopped for around 10s and go for around 5s only in auto-simulation + if (p_simulator->_cb.auto_change) + { + if ((p_simulator->p_profile->_cb.p_sens_cb->main_page_number == ANT_BSC_PAGE_5) && + (p_simulator->_cb.stop_cnt++ < 40)) + { + p_simulator->_cb.speed_sim_val = 0; + p_simulator->_cb.cadence_sim_val = 0; + } + else + { + if (p_simulator->_cb.stop_cnt == 60) + { + p_simulator->_cb.stop_cnt = 0; + } + } + } + if (p_simulator->_cb.speed_sim_val == 0) + { + p_simulator->p_profile->BSC_PROFILE_stop_indicator = 1; + } + else + { + p_simulator->p_profile->BSC_PROFILE_stop_indicator = 0; + } + + // @note: Take a local copy within scope in order to assist the compiler in variable register + // allocation. + const uint32_t computed_speed = p_simulator->_cb.speed_sim_val; + const uint32_t computed_cadence = p_simulator->_cb.cadence_sim_val; + + // @note: This implementation assumes that the current instantaneous speed/cadence can vary and this + // function is called with static frequency. + // value and the speed/cadence pulse interval is derived from it. The computation is based on 60 + // seconds in a minute and the used time base is 1/1024 seconds. + const uint32_t current_speed_pulse_interval = + MM_TO_METERS((WHEEL_CIRCUMFERENCE * 1024u) / computed_speed); + const uint32_t current_cadence_pulse_interval = (60u * 1024u) / computed_cadence; + + //update time from last evt detected + p_simulator->_cb.time_since_last_s_evt += ITERATION_PERIOD(p_simulator->_cb.device_type); + p_simulator->_cb.time_since_last_c_evt += ITERATION_PERIOD(p_simulator->_cb.device_type); + + // extended calculation by fraction make calculating accurate in long time perspective + p_simulator->_cb.fraction_since_last_s_evt += ITERATION_FRACTION(p_simulator->_cb.device_type); + p_simulator->_cb.fraction_since_last_c_evt += ITERATION_FRACTION(p_simulator->_cb.device_type); + + uint32_t add_period = p_simulator->_cb.fraction_since_last_s_evt / ANT_CLOCK_FREQUENCY; + if(add_period > 0) + { + p_simulator->_cb.time_since_last_s_evt++; + p_simulator->_cb.fraction_since_last_s_evt %= ANT_CLOCK_FREQUENCY; + } + + add_period = p_simulator->_cb.fraction_since_last_c_evt / ANT_CLOCK_FREQUENCY; + if(add_period > 0) + { + p_simulator->_cb.time_since_last_c_evt++; + p_simulator->_cb.fraction_since_last_c_evt %= ANT_CLOCK_FREQUENCY; + } + + // Calculate cumulative time based on time since last event (from profile data) in [1/1024] ticks + int16_t diff = p_simulator->p_profile->BSC_PROFILE_event_time - + p_simulator->_cb.prev_time_since_evt; + p_simulator->_cb.prev_time_since_evt = p_simulator->p_profile->BSC_PROFILE_event_time; + + if(diff >= 0) // Check for time count overflow + { + // No overflow + p_simulator->_cb.cumulative_time += diff / TWO_SEC_TO_TICKS; + p_simulator->_cb.cumulative_time_frac += diff % TWO_SEC_TO_TICKS; + } + else + { + p_simulator->_cb.cumulative_time += (UINT16_MAX + diff) / TWO_SEC_TO_TICKS; + p_simulator->_cb.cumulative_time_frac += (UINT16_MAX + diff) % TWO_SEC_TO_TICKS; + } + // Check fraction + if ((p_simulator->_cb.cumulative_time_frac / TWO_SEC_TO_TICKS) > 0) + { + p_simulator->_cb.cumulative_time += p_simulator->_cb.cumulative_time_frac / TWO_SEC_TO_TICKS; + p_simulator->_cb.cumulative_time_frac %= TWO_SEC_TO_TICKS; + } + // Update page data if necessary + if (p_simulator->_cb.cumulative_time != p_simulator->p_profile->BSC_PROFILE_operating_time) + { + p_simulator->p_profile->BSC_PROFILE_operating_time = p_simulator->_cb.cumulative_time; + } + + //calc number of events as will fill + uint32_t new_s_events = p_simulator->_cb.time_since_last_s_evt / + current_speed_pulse_interval; + uint32_t add_speed_event_time = new_s_events * current_speed_pulse_interval; + if ((new_s_events > 0) && ((p_simulator->_cb.device_type == BSC_SPEED_DEVICE_TYPE) || + (p_simulator->_cb.device_type == BSC_COMBINED_DEVICE_TYPE))) + { + p_simulator->p_profile->BSC_PROFILE_rev_count += new_s_events; + p_simulator->p_profile->BSC_PROFILE_speed_rev_count += new_s_events; + + // Current speed event time is the previous event time plus the current speed + // pulse interval. + uint32_t current_speed_event_time = p_simulator->p_profile->BSC_PROFILE_event_time + + add_speed_event_time; + // Set current event time. + p_simulator->p_profile->BSC_PROFILE_event_time = current_speed_event_time; // <- B<4,5> <- + + current_speed_event_time = p_simulator->p_profile->BSC_PROFILE_speed_event_time + + add_speed_event_time; + // Set current event time for combined device. + p_simulator->p_profile->BSC_PROFILE_speed_event_time = current_speed_event_time; + + p_simulator->_cb.time_since_last_s_evt -= add_speed_event_time; + } + + uint32_t new_c_events = p_simulator->_cb.time_since_last_c_evt / + current_cadence_pulse_interval; + uint32_t add_cadence_event_time = new_c_events * current_cadence_pulse_interval; + if ((new_c_events > 0) && ((p_simulator->_cb.device_type == BSC_CADENCE_DEVICE_TYPE) || + (p_simulator->_cb.device_type == BSC_COMBINED_DEVICE_TYPE))) + { + p_simulator->p_profile->BSC_PROFILE_rev_count += new_c_events; + p_simulator->p_profile->BSC_PROFILE_cadence_rev_count += new_c_events; + + // Current speed event time is the previous event time plus the current speed + // pulse interval. + uint32_t current_cadence_event_time = p_simulator->p_profile->BSC_PROFILE_event_time + + add_cadence_event_time; + // Set current event time. + p_simulator->p_profile->BSC_PROFILE_event_time = current_cadence_event_time; //<- B<4,5> <- + + current_cadence_event_time = p_simulator->p_profile->BSC_PROFILE_cadence_event_time + + add_cadence_event_time; + // Set current event time for combined device. + p_simulator->p_profile->BSC_PROFILE_cadence_event_time = current_cadence_event_time; + + p_simulator->_cb.time_since_last_c_evt -= add_cadence_event_time; + } +} + + +void ant_bsc_simulator_increment(ant_bsc_simulator_t * p_simulator) +{ + if (!p_simulator->_cb.auto_change) + { + // Speed + sensorsim_increment(&(p_simulator->_cb.sensorsim_s_state), + &(p_simulator->_cb.sensorsim_s_cfg)); + // Cadence + sensorsim_increment(&(p_simulator->_cb.sensorsim_c_state), + &(p_simulator->_cb.sensorsim_c_cfg)); + } +} + + +void ant_bsc_simulator_decrement(ant_bsc_simulator_t * p_simulator) +{ + if (!p_simulator->_cb.auto_change) + { + // Speed + sensorsim_decrement(&(p_simulator->_cb.sensorsim_s_state), + &(p_simulator->_cb.sensorsim_s_cfg)); + // Cadence + sensorsim_decrement(&(p_simulator->_cb.sensorsim_c_state), + &(p_simulator->_cb.sensorsim_c_cfg)); + } +} diff --git a/components/ant/ant_profiles/ant_bsc/simulator/ant_bsc_simulator.h b/components/ant/ant_profiles/ant_bsc/simulator/ant_bsc_simulator.h new file mode 100644 index 0000000..95167df --- /dev/null +++ b/components/ant/ant_profiles/ant_bsc/simulator/ant_bsc_simulator.h @@ -0,0 +1,85 @@ +/* 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. + * + */ + +#ifndef ANT_BSC_SIMULATOR_H__ +#define ANT_BSC_SIMULATOR_H__ + +/** @file + * + * @defgroup ant_sdk_bsc_simulator ANT BSC simulator + * @{ + * @ingroup ant_sdk_simulators + * @brief ANT BSC simulator module. + * + * @details This module simulates a pulse for the ANT Bicycle Speed and Cadence profile. The module + * calculates abstract values, which are handled by the BSC pages data model to ensure that + * they are compatible. It provides a handler for changing the cadence and speed values manually + * as well as functionality to change the values automatically. + * + */ + +#include +#include +#include "bsp.h" +#include "ant_bsc.h" +#include "ant_bsc_utils.h" +#include "sensorsim.h" +#include "ant_bsc_simulator_local.h" + +/**@brief BSC simulator configuration structure. */ +typedef struct +{ + ant_bsc_profile_t * p_profile; ///< Related profile. + uint8_t device_type; ///< BSC device type (must be consistent with the type chosen for the profile). Supported types: + // @ref BSC_SPEED_DEVICE_TYPE, @ref BSC_CADENCE_DEVICE_TYPE, @ref BSC_COMBINED_DEVICE_TYPE. +} ant_bsc_simulator_cfg_t; + +/**@brief BSC simulator structure. */ +typedef struct +{ + ant_bsc_profile_t * p_profile; ///< Related profile. + ant_bsc_simulator_cb_t _cb; ///< Internal control block. +} ant_bsc_simulator_t; + + +/**@brief Function for initializing the ANT BSC simulator instance. + * + * @param[in] p_simulator Pointer to the simulator instance. + * @param[in] p_config Pointer to the simulator configuration structure. + * @param[in] auto_change Enable or disable automatic changes of speed or cadence. + */ +void ant_bsc_simulator_init(ant_bsc_simulator_t * p_simulator, + ant_bsc_simulator_cfg_t const * p_config, + bool auto_change); + +/**@brief Function for simulating a device event. + * + * @details Based on this event, the transmitter data is simulated. + * + * This function should be called in the BSC Sensor event handler. + */ +void ant_bsc_simulator_one_iteration(ant_bsc_simulator_t * p_simulator); + +/**@brief Function for incrementing the cadence value. + * + * @param[in] p_simulator Pointer to the simulator instance. + */ +void ant_bsc_simulator_increment(ant_bsc_simulator_t * p_simulator); + +/**@brief Function for decrementing the cadence value. + * + * @param[in] p_simulator Pointer to the simulator instance. + */ +void ant_bsc_simulator_decrement(ant_bsc_simulator_t * p_simulator); + +#endif // ANT_BSC_SIMULATOR_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_bsc/simulator/ant_bsc_simulator_local.h b/components/ant/ant_profiles/ant_bsc/simulator/ant_bsc_simulator_local.h new file mode 100644 index 0000000..e57277a --- /dev/null +++ b/components/ant/ant_profiles/ant_bsc/simulator/ant_bsc_simulator_local.h @@ -0,0 +1,44 @@ +/* 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. + * + */ + +#ifndef ANT_BSC_SIMULATOR_LOCAL_H__ +#define ANT_BSC_SIMULATOR_LOCAL_H__ + +#include +#include +#include "bsp.h" +#include "ant_bsc.h" +#include "sensorsim.h" + + +/**@brief BSC simulator control block structure. */ +typedef struct +{ + uint8_t device_type; + bool auto_change; ///< Cadence will change automatically (if auto_change is set) or manually. + uint16_t speed_sim_val; ///< Instantaneous speed value. + uint16_t cadence_sim_val; ///< Instantaneous cadence value. + uint32_t time_since_last_s_evt; ///< Time since last speed event occurred (integer part). + uint64_t fraction_since_last_s_evt; ///< Time since last speed event occurred (fractional part). + uint32_t time_since_last_c_evt; ///< Time since last cadence event occurred (integer part). + uint64_t fraction_since_last_c_evt; ///< Time since last cadence event occurred (fractional part). + sensorsim_state_t sensorsim_s_state; ///< State of the simulated speed sensor. + sensorsim_cfg_t sensorsim_s_cfg; ///< Configuration of the simulated speed sensor. + sensorsim_state_t sensorsim_c_state; ///< State of the simulated cadence sensor. + sensorsim_cfg_t sensorsim_c_cfg; ///< Configuration of the simulated cadence sensor. + uint16_t prev_time_since_evt; ///< Previous value of time since the last event. + uint32_t cumulative_time; ///< Cumulative time in 2 s ticks used for updating the cumulative time. + uint32_t cumulative_time_frac; ///< Cumulative time in 2 s ticks (fractional part), used for updating the cumulative time. + uint8_t stop_cnt; ///< Counter used for simulating bicycle stopped state. +} ant_bsc_simulator_cb_t; + +#endif // ANT_BSC_SIMULATOR_LOCAL_H__ diff --git a/components/ant/ant_profiles/ant_bsc/utils/ant_bsc_utils.h b/components/ant/ant_profiles/ant_bsc/utils/ant_bsc_utils.h new file mode 100644 index 0000000..3d54697 --- /dev/null +++ b/components/ant/ant_profiles/ant_bsc/utils/ant_bsc_utils.h @@ -0,0 +1,91 @@ +/* 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. + * + */ +#ifndef ANT_BSC_UTILS_H__ +#define ANT_BSC_UTILS_H__ + +#include "nrf.h" + +/** @file + * + * @defgroup ant_sdk_profiles_bsc_utils Bicycle Speed and Cadence profile utilities + * @{ + * @ingroup ant_sdk_profiles_bsc + * @brief This module implements utilities for the Bicycle Speed and Cadence profile. + * + */ + +/**@brief Unit for BSC operating time. + * + * @details According to the ANT BSC specification, the operating time unit is 2 seconds. + */ +#define ANT_BSC_OPERATING_TIME_UNIT 2u + +/**@brief This macro should be used to get the seconds part of the operating time. + */ +#define ANT_BSC_OPERATING_SECONDS(OPERATING_TIME) (((OPERATING_TIME) * ANT_BSC_OPERATING_TIME_UNIT) % 60) + +/**@brief This macro should be used to get the minutes part of the operating time. + */ +#define ANT_BSC_OPERATING_MINUTES(OPERATING_TIME) ((((OPERATING_TIME) * ANT_BSC_OPERATING_TIME_UNIT) / 60) % 60) + +/**@brief This macro should be used to get the hours part of the operating time. + */ +#define ANT_BSC_OPERATING_HOURS(OPERATING_TIME) ((((OPERATING_TIME) * ANT_BSC_OPERATING_TIME_UNIT) / (60 * 60)) % 24) + +/**@brief This macro should be used to get the days part of the operating time. + */ +#define ANT_BSC_OPERATING_DAYS(OPERATING_TIME) ((((OPERATING_TIME) * ANT_BSC_OPERATING_TIME_UNIT) / (60 * 60)) / 24) + +/**@brief Number of Bicycle Speed or Cadence event time counts per second. + * + * @details According to the ANT BSC specification, the speed or cadence event time unit is 1/1024 of a second. + */ +#define ANT_BSC_EVENT_TIME_COUNTS_PER_SEC 1024u + +/**@brief BSC event time display required precision. + * + * @details This value is used to decode the number of milliseconds. + */ +#define ANT_BSC_EVENT_TIME_PRECISION 1000u + +/**@brief This macro should be used to get the seconds part of the BSC event time. + */ +#define ANT_BSC_EVENT_TIME_SEC(EVENT_TIME) ((EVENT_TIME) / ANT_BSC_EVENT_TIME_COUNTS_PER_SEC) + +/**@brief This macro should be used to get the milliseconds part of the BSC event time. + */ +#define ANT_BSC_EVENT_TIME_MSEC(EVENT_TIME) (((((EVENT_TIME) % ANT_BSC_EVENT_TIME_COUNTS_PER_SEC) * ANT_BSC_EVENT_TIME_PRECISION) \ + + ANT_BSC_EVENT_TIME_COUNTS_PER_SEC / 2) \ + / ANT_BSC_EVENT_TIME_COUNTS_PER_SEC) + +/**@brief Battery voltage display required precision. + * + * @details This value is used to decode the number of mV. + */ +#define ANT_BSC_BAT_VOLTAGE_PRECISION 1000u + +/**@brief Bike Speed and Cadence profile, unit divisor of the fractional part of the battery voltage. + * + * @details According to the ANT BSC specification, the battery voltage fraction unit is (1/256) V. + */ +#define ANT_BSC_BAT_VOLTAGE_FRACTION_PER_VOLT 256u + +/**@brief This macro should be used to get the mV part of the BSC battery voltage. + */ +#define ANT_BSC_BAT_VOLTAGE_FRACTION_MV(VOLT_FRACT) ((((VOLT_FRACT) * ANT_BSC_BAT_VOLTAGE_PRECISION) \ + + ANT_BSC_BAT_VOLTAGE_FRACTION_PER_VOLT / 2) \ + / ANT_BSC_BAT_VOLTAGE_FRACTION_PER_VOLT) + +/** @} */ + +#endif // ANT_BSC_UTILS_H__ + diff --git a/components/ant/ant_profiles/ant_common/ant_request_controller/ant_request_controller.c b/components/ant/ant_profiles/ant_common/ant_request_controller/ant_request_controller.c new file mode 100644 index 0000000..da9a0ed --- /dev/null +++ b/components/ant/ant_profiles/ant_common/ant_request_controller/ant_request_controller.c @@ -0,0 +1,194 @@ +/* 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 "ant_request_controller.h" +#include "ant_interface.h" +#include "ant_parameters.h" +#include "app_error.h" +#include "nrf_assert.h" +#include "nrf.h" + +/**@brief Common message data layout structure. */ +typedef struct +{ + uint8_t page_number; ///< Page number. + uint8_t page_payload[7]; ///< Page payload. +}ant_common_message_layout_t; + + +void ant_request_controller_init(ant_request_controller_t * p_controller) +{ + ASSERT(p_controller != NULL); + + p_controller->state = ANT_REQUEST_CONTROLLER_IDLE; + p_controller->page_70 = DEFAULT_ANT_COMMON_PAGE70(); +} + + +uint32_t ant_request_controller_request(ant_request_controller_t * p_controller, + uint8_t channel_number, + ant_common_page70_data_t * p_page_70) +{ + ASSERT(p_controller != NULL); + ASSERT(p_page_70 != NULL); + + ant_common_message_layout_t message; + message.page_number = ANT_COMMON_PAGE_70; + + ant_common_page_70_encode(message.page_payload, p_page_70); + + p_controller->state = ANT_REQUEST_CONTROLLER_SENDED; + + return sd_ant_acknowledge_message_tx(channel_number, sizeof (message), (uint8_t *)&message); +} + + +bool ant_request_controller_pending_get(ant_request_controller_t * p_controller, + uint8_t * p_page_number) +{ + ASSERT(p_controller != NULL); + ASSERT(p_page_number != NULL); + + if ((p_controller->state == ANT_REQUEST_CONTROLLER_ACK_UNTIL_SUCCESS_REQUESTED) + || (p_controller->state == ANT_REQUEST_CONTROLLER_ACK_REQUESTED) + || (p_controller->state == ANT_REQUEST_CONTROLLER_BROADCAST_REQUESTED)) + { + *p_page_number = p_controller->page_70.page_number; + return true; + } + return false; +} + + +bool ant_request_controller_ack_needed(ant_request_controller_t * p_controller) +{ + ASSERT(p_controller != NULL); + return ((p_controller->state == ANT_REQUEST_CONTROLLER_ACK_UNTIL_SUCCESS_REQUESTED) + || (p_controller->state == ANT_REQUEST_CONTROLLER_ACK_REQUESTED)); +} + + +ant_request_controller_evt_t ant_request_controller_disp_evt_handler( + ant_request_controller_t * p_controller, + ant_evt_t * p_ant_event) +{ + ASSERT(p_controller != NULL); + ASSERT(p_ant_event != NULL); + + if ( p_controller->state == ANT_REQUEST_CONTROLLER_SENDED) + { + switch (p_ant_event->event) + { + case EVENT_TRANSFER_TX_FAILED: + p_controller->state = ANT_REQUEST_CONTROLLER_IDLE; + return ANT_REQUEST_CONTROLLER_FAILED; + + case EVENT_TRANSFER_TX_COMPLETED: + p_controller->state = ANT_REQUEST_CONTROLLER_IDLE; + return ANT_REQUEST_CONTROLLER_SUCCESS; + + default: + break; + } + } + + return ANT_REQUEST_CONTROLLER_NONE; +} + + +/**@brief Function for confirmation of page sending. + * + * @param[in] p_controller Pointer to the controller instance. + */ +__STATIC_INLINE void page_sended(ant_request_controller_t * p_controller) +{ + if (!((p_controller->page_70.transmission_response.items.transmit_count)--)) + { + p_controller->state = ANT_REQUEST_CONTROLLER_IDLE; + } +} + + +/**@brief Function for handling page request. + * + * @param[in] p_controller Pointer to the controller instance. + * @param[in] p_message_payload Pointer to the message payload. + */ +__STATIC_INLINE void page_requested(ant_request_controller_t * p_controller, + ant_common_message_layout_t * p_message_payload) +{ + ant_common_page_70_decode(p_message_payload->page_payload, &(p_controller->page_70)); + + if ((p_controller->page_70.command_type == ANT_PAGE70_COMMAND_PAGE_DATA_REQUEST) + && (p_controller->page_70.transmission_response.specyfic != ANT_PAGE70_RESPONSE_INVALID)) + { + if (p_controller->page_70.transmission_response.items.ack_resposne) + { + if (p_controller->page_70.transmission_response.specyfic == + ANT_PAGE70_RESPONSE_TRANSMIT_UNTIL_SUCCESS) + { + p_controller->state = ANT_REQUEST_CONTROLLER_ACK_UNTIL_SUCCESS_REQUESTED; + } + else + { + p_controller->state = ANT_REQUEST_CONTROLLER_ACK_REQUESTED; + } + } + else + { + p_controller->state = ANT_REQUEST_CONTROLLER_BROADCAST_REQUESTED; + } + } +} + + +void ant_request_controller_sens_evt_handler(ant_request_controller_t * p_controller, + ant_evt_t * p_ant_event) +{ + ASSERT(p_controller != NULL); + ASSERT(p_ant_event != NULL); + + ANT_MESSAGE * p_message = (ANT_MESSAGE *)p_ant_event->evt_buffer; + ant_common_message_layout_t * p_message_payload = + (ant_common_message_layout_t *)p_message->ANT_MESSAGE_aucPayload; + + switch (p_ant_event->event) + { + case EVENT_RX: + + if (p_message_payload->page_number == ANT_COMMON_PAGE_70) + { + page_requested(p_controller, p_message_payload); + } + break; + + case EVENT_TX: + case EVENT_TRANSFER_TX_COMPLETED: + + if (p_controller->state == ANT_REQUEST_CONTROLLER_ACK_UNTIL_SUCCESS_REQUESTED) + { + p_controller->state = ANT_REQUEST_CONTROLLER_IDLE; + } + + if (p_controller->state == ANT_REQUEST_CONTROLLER_BROADCAST_REQUESTED + || p_controller->state == ANT_REQUEST_CONTROLLER_ACK_REQUESTED) + { + page_sended(p_controller); + } + break; + + default: + break; + } +} + + diff --git a/components/ant/ant_profiles/ant_common/ant_request_controller/ant_request_controller.h b/components/ant/ant_profiles/ant_common/ant_request_controller/ant_request_controller.h new file mode 100644 index 0000000..59b6e9a --- /dev/null +++ b/components/ant/ant_profiles/ant_common/ant_request_controller/ant_request_controller.h @@ -0,0 +1,121 @@ +/* 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 ant_request_controller ANT request controller + * @{ + * @ingroup ant_sdk_utils + * + * @brief Module for handling page requests related to page 70. + */ + +#ifndef ANT_REQUEST_CONTROLLER_H__ +#define ANT_REQUEST_CONTROLLER_H__ +#include +#include "ant_common_page_70.h" +#include "ant_stack_handler_types.h" + +/**@brief Request controller events types. */ +typedef enum +{ + ANT_REQUEST_CONTROLLER_NONE, ///< No event. + ANT_REQUEST_CONTROLLER_SUCCESS, ///< Page request successful. + ANT_REQUEST_CONTROLLER_FAILED, ///< Page request failed. +} ant_request_controller_evt_t; + +/**@brief Request controller states. */ +typedef enum +{ + ANT_REQUEST_CONTROLLER_IDLE, ///< Module is in idle state. + ANT_REQUEST_CONTROLLER_SENDED, ///< Module waits for acknowledgment of its request. + ANT_REQUEST_CONTROLLER_BROADCAST_REQUESTED, ///< Module is requested to send page n times using broadcast. + ANT_REQUEST_CONTROLLER_ACK_REQUESTED, ///< Module is requested to send page n times using acknowledgment. + ANT_REQUEST_CONTROLLER_ACK_UNTIL_SUCCESS_REQUESTED, ///< Module is requested to send page until success using acknowledgment. +} ant_request_controller_state_t; + +/**@brief ANT request controller structure. */ +typedef struct +{ + ant_request_controller_state_t state; ///< Actual module state. + ant_common_page70_data_t page_70; ///< Page 70. +} ant_request_controller_t; + +/**@brief Function for initializing the ANT request controller instance. + * + * @param[in] p_controller Pointer to the controller instance. + */ +void ant_request_controller_init(ant_request_controller_t * p_controller); + +/**@brief Function for sending a request. + * + * @param[in] p_controller Pointer to the controller instance. + * @param[in] channel_number Channel number. + * @param[in] p_page_70 Pointer to the prepared page 70. + * + * @return Error code returned by @ref sd_ant_acknowledge_message_tx(). + */ +uint32_t ant_request_controller_request(ant_request_controller_t * p_controller, + uint8_t channel_number, + ant_common_page70_data_t * p_page_70); + +/**@brief Function for getting pending page number. + * + * @details This function checks whether a page number was requested. + * + * @param[in] p_controller Pointer to the controller instance. + * @param[out] p_page_number Pending page number (valid if true was returned). + * + * @retval TRUE If there was a pending page. + * @retval FALSE If no page was pending. + */ +bool ant_request_controller_pending_get(ant_request_controller_t * p_controller, + uint8_t * p_page_number); + +/**@brief Function for checking whether the next page must be sent with acknowledgment. + * + * @param[in] p_controller Pointer to the controller instance. + * + * @retval TRUE If the next transmission needs acknowledgment. + * @retval FALSE If the next transmission does not need acknowledgment. + */ +bool ant_request_controller_ack_needed(ant_request_controller_t * p_controller); + +/** + * @brief Function for handling ANT events on display side. + * + * @details All events from the ANT stack that are related to the appropriate channel number + * should be propagated. + * + * @param[in] p_controller Pointer to the controller instance. + * @param[in] p_ant_event Event received from the ANT stack. + */ +ant_request_controller_evt_t ant_request_controller_disp_evt_handler( + ant_request_controller_t * p_controller, + ant_evt_t * p_ant_event); + +/** + * @brief Function for handling ANT events on sensor side. + * + * @details All events from the ANT stack that are related to the appropriate channel number + * should be propagated. + * + * @param[in] p_controller Pointer to the controller instance. + * @param[in] p_ant_event Event received from the ANT stack. + * @retval TRUE If there was a pending page. + */ +void ant_request_controller_sens_evt_handler(ant_request_controller_t * p_controller, + ant_evt_t * p_ant_event); + + +#endif // ANT_REQUEST_CONTROLLER_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_common/pages/ant_common_page_70.c b/components/ant/ant_profiles/ant_common/pages/ant_common_page_70.c new file mode 100644 index 0000000..7e5f60f --- /dev/null +++ b/components/ant/ant_profiles/ant_common/pages/ant_common_page_70.c @@ -0,0 +1,104 @@ +/* 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 "ant_common_page_70.h" +#include "ant_common_page_logger.h" +#include "nordic_common.h" +#include "app_util.h" + +/**@brief ANT+ common page 70 data layout structure. */ +typedef struct +{ + uint8_t reserved[2]; + uint8_t descriptor[2]; + uint8_t req_trans_response; + uint8_t req_page_number; + uint8_t command_type; +}ant_common_page70_data_layout_t; + +/**@brief Function for tracing page 70 data. + * + * @param[in] p_page_data Pointer to the page 70 data. + */ +static void page70_data_log(volatile ant_common_page70_data_t const * p_page_data) +{ + LOG_PAGE70("Page %d request\n\r", p_page_data->page_number); + + switch (p_page_data->transmission_response.specyfic) + { + case ANT_PAGE70_RESPONSE_TRANSMIT_UNTIL_SUCCESS: + LOG_PAGE70("Try to send until ACK\n\r"); + break; + + case ANT_PAGE70_RESPONSE_INVALID: + LOG_PAGE70("Invalid requested transmission response\n\r"); + break; + + default: + + if (p_page_data->transmission_response.items.ack_resposne) + { + LOG_PAGE70("Answer with acknowledged messages\n\r"); + } + LOG_PAGE70("Requested number of transmissions: %d\n\r", + p_page_data->transmission_response.items.transmit_count); + } + + switch (p_page_data->command_type) + { + case ANT_PAGE70_COMMAND_PAGE_DATA_REQUEST: + LOG_PAGE70("Request Data Page\n\r"); + break; + + case ANT_PAGE70_COMMAND_ANT_FS_SESSION_REQUEST: + LOG_PAGE70("Request ANT-FS Session\n\r"); + break; + + default: + LOG_PAGE70("Invalid request\n\r"); + } + LOG_PAGE70("Descriptor %x\n\r", p_page_data->descriptor); +} + + +void ant_common_page_70_encode(uint8_t * p_page_buffer, + volatile ant_common_page70_data_t const * p_page_data) +{ + ant_common_page70_data_layout_t * p_outcoming_data = + (ant_common_page70_data_layout_t *)p_page_buffer; + + memset(p_outcoming_data->reserved, UINT8_MAX, sizeof (p_outcoming_data->reserved)); + UNUSED_PARAMETER(uint16_encode(p_page_data->descriptor, p_outcoming_data->descriptor)); + p_outcoming_data->req_trans_response = p_page_data->transmission_response.byte; + p_outcoming_data->req_page_number = p_page_data->page_number; + p_outcoming_data->command_type = p_page_data->command_type; + + page70_data_log(p_page_data); +} + + +void ant_common_page_70_decode(uint8_t const * p_page_buffer, + volatile ant_common_page70_data_t * p_page_data) +{ + ant_common_page70_data_layout_t const * p_incoming_data = + (ant_common_page70_data_layout_t *)p_page_buffer; + + p_page_data->descriptor = uint16_decode(p_incoming_data->descriptor); + p_page_data->transmission_response.byte = p_incoming_data->req_trans_response; + p_page_data->page_number = p_incoming_data->req_page_number; + p_page_data->command_type = (ant_page70_command_t)p_incoming_data->command_type; + + page70_data_log(p_page_data); +} + + diff --git a/components/ant/ant_profiles/ant_common/pages/ant_common_page_70.h b/components/ant/ant_profiles/ant_common/pages/ant_common_page_70.h new file mode 100644 index 0000000..385a344 --- /dev/null +++ b/components/ant/ant_profiles/ant_common/pages/ant_common_page_70.h @@ -0,0 +1,99 @@ +/* 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. + * + */ + +#ifndef ANT_COMMON_PAGE_70_H__ +#define ANT_COMMON_PAGE_70_H__ + +/** @file + * + * @defgroup ant_sdk_common_page70 ANT+ common page 70 + * @{ + * @ingroup ant_sdk_common_pages + */ + +#include + +#define ANT_COMMON_PAGE_70 (70) ///< @brief ID value of common page 70. +#define ANT_PAGE70_INVALID_DESCRIPTOR UINT16_MAX ///< Invalid descriptor. + +/**@brief Command type. + */ +typedef enum +{ + ANT_PAGE70_COMMAND_PAGE_DATA_REQUEST = 0x01, ///< Page request. + ANT_PAGE70_COMMAND_ANT_FS_SESSION_REQUEST = 0x02, ///< ANT FS session request. +} ant_page70_command_t; + + +/**@brief Data structure for ANT+ common data page 70. + */ +typedef struct +{ + uint8_t page_number; ///< Requested page number. + uint16_t descriptor; ///< Descriptor. + ant_page70_command_t command_type; ///< Command type. + union + { + enum + { + ANT_PAGE70_RESPONSE_INVALID = 0x00, ///< Invalid response type. + ANT_PAGE70_RESPONSE_TRANSMIT_UNTIL_SUCCESS = 0x80, ///< Transmit until a successful acknowledge is received. + } specyfic; + struct + { + uint8_t transmit_count :7; ///< Number of re-transmissions. + uint8_t ack_resposne :1; ///< Acknowledge transmission is required. + } items; + uint8_t byte; + } transmission_response; +} ant_common_page70_data_t; + +/**@brief Initialize page 70 with default values. + */ +#define DEFAULT_ANT_COMMON_PAGE70() \ + (ant_common_page70_data_t) \ + { \ + .page_number = 0x00, \ + .command_type = (ant_page70_command_t)0x00, \ + .transmission_response.specyfic = ANT_PAGE70_RESPONSE_INVALID, \ + .descriptor = ANT_PAGE70_INVALID_DESCRIPTOR, \ + } + +/**@brief Initialize page 70 with the page request. + */ +#define ANT_COMMON_PAGE_DATA_REQUEST(PAGE_NUMBER) \ + (ant_common_page70_data_t) \ + { \ + .page_number = (PAGE_NUMBER), \ + .command_type = ANT_PAGE70_COMMAND_PAGE_DATA_REQUEST, \ + .transmission_response.specyfic = ANT_PAGE70_RESPONSE_TRANSMIT_UNTIL_SUCCESS, \ + .descriptor = ANT_PAGE70_INVALID_DESCRIPTOR, \ + } + +/**@brief Function for encoding page 70. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_common_page_70_encode(uint8_t * p_page_buffer, + volatile ant_common_page70_data_t const * p_page_data); + +/**@brief Function for decoding page 70. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_common_page_70_decode(uint8_t const * p_page_buffer, + volatile ant_common_page70_data_t * p_page_data); + +#endif // ANT_COMMON_PAGE_70_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_common/pages/ant_common_page_80.c b/components/ant/ant_profiles/ant_common/pages/ant_common_page_80.c new file mode 100644 index 0000000..44822f4 --- /dev/null +++ b/components/ant/ant_profiles/ant_common/pages/ant_common_page_80.c @@ -0,0 +1,73 @@ +/* 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 "ant_common_page_80.h" +#include "ant_common_page_logger.h" +#include "app_util.h" +#include "nordic_common.h" + +/**@brief ant+ common page 80 data layout structure. */ +typedef struct +{ + uint8_t reserved[2]; ///< unused, fill by 0xFF + uint8_t hw_revision; + uint8_t manufacturer_id[2]; + uint8_t model_number[2]; +}ant_common_page80_data_layout_t; + + +/**@brief Function for tracing page 80 data. + * + * @param[in] p_page_data Pointer to the page 80 data. + */ +static void page80_data_log(volatile ant_common_page80_data_t const * p_page_data) +{ + LOG_PAGE80("hw revision: %u\n\r", p_page_data->hw_revision); + LOG_PAGE80("manufacturer id: %u\n\r", p_page_data->manufacturer_id); + LOG_PAGE80("model number: %u\n\r", p_page_data->model_number); +} + + +void ant_common_page_80_encode(uint8_t * p_page_buffer, + volatile ant_common_page80_data_t const * p_page_data) +{ + ant_common_page80_data_layout_t * p_outcoming_data = + (ant_common_page80_data_layout_t *)p_page_buffer; + + memset(p_page_buffer, UINT8_MAX, sizeof (p_outcoming_data->reserved)); + + p_outcoming_data->hw_revision = p_page_data->hw_revision; + + UNUSED_PARAMETER(uint16_encode(p_page_data->manufacturer_id, + p_outcoming_data->manufacturer_id)); + UNUSED_PARAMETER(uint16_encode(p_page_data->model_number, p_outcoming_data->model_number)); + + page80_data_log(p_page_data); +} + + +void ant_common_page_80_decode(uint8_t const * p_page_buffer, + volatile ant_common_page80_data_t * p_page_data) +{ + ant_common_page80_data_layout_t const * p_incoming_data = + (ant_common_page80_data_layout_t *)p_page_buffer; + + p_page_data->hw_revision = p_incoming_data->hw_revision; + + p_page_data->manufacturer_id = uint16_decode(p_incoming_data->manufacturer_id); + p_page_data->model_number = uint16_decode(p_incoming_data->model_number); + + page80_data_log(p_page_data); +} + + diff --git a/components/ant/ant_profiles/ant_common/pages/ant_common_page_80.h b/components/ant/ant_profiles/ant_common/pages/ant_common_page_80.h new file mode 100644 index 0000000..123bf72 --- /dev/null +++ b/components/ant/ant_profiles/ant_common/pages/ant_common_page_80.h @@ -0,0 +1,84 @@ +/* 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. + * + */ + +#ifndef ANT_COMMON_PAGE_80_H__ +#define ANT_COMMON_PAGE_80_H__ + +/** @file + * + * @defgroup ant_sdk_common_pages ANT+ common pages + * @{ + * @ingroup ant_sdk_profiles + * @brief This module implements functions for the ANT+ common pages. + * @details ANT+ common data pages define common data formats that can be used by any device on any ANT network. The ability to send and receive these common pages is defined by the transmission type of the ANT channel parameter. + * + * Note that all unused pages in this section are not defined and therefore cannot be used. + * @} + * + * @defgroup ant_sdk_common_page80 ANT+ common page 80 + * @{ + * @ingroup ant_sdk_common_pages + */ + +#include + +#define ANT_COMMON_PAGE_80 (80) ///< @brief ID value of common page 80. + +/**@brief Data structure for ANT+ common data page 80. + * + * @note This structure implements only page 80 specific data. + */ +typedef struct +{ + uint8_t hw_revision; ///< Hardware revision. + uint16_t manufacturer_id; ///< Manufacturer ID. + uint16_t model_number; ///< Model number. +} ant_common_page80_data_t; + +/**@brief Initialize page 80. + */ +#define DEFAULT_ANT_COMMON_page80() \ + (ant_common_page80_data_t) \ + { \ + .hw_revision = 0x00, \ + .manufacturer_id = UINT8_MAX, \ + .model_number = 0x00, \ + } + +/**@brief Initialize page 80. + */ +#define ANT_COMMON_page80(hw_rev, man_id, mod_num) \ + (ant_common_page80_data_t) \ + { \ + .hw_revision = (hw_rev), \ + .manufacturer_id = (man_id), \ + .model_number = (mod_num), \ + } + +/**@brief Function for encoding page 80. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_common_page_80_encode(uint8_t * p_page_buffer, + volatile ant_common_page80_data_t const * p_page_data); + +/**@brief Function for decoding page 80. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_common_page_80_decode(uint8_t const * p_page_buffer, + volatile ant_common_page80_data_t * p_page_data); + +#endif // ANT_COMMON_PAGE_80_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_common/pages/ant_common_page_81.c b/components/ant/ant_profiles/ant_common/pages/ant_common_page_81.c new file mode 100644 index 0000000..d109fca --- /dev/null +++ b/components/ant/ant_profiles/ant_common/pages/ant_common_page_81.c @@ -0,0 +1,80 @@ +/* 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 "ant_common_page_81.h" +#include "ant_common_page_logger.h" +#include "app_util.h" +#include "nordic_common.h" + +/**@brief ant+ common page 81 data layout structure. */ +typedef struct +{ + uint8_t reserved; ///< unused, fill by 0xFF + uint8_t sw_revision_minor; + uint8_t sw_revision_major; + uint8_t serial_number[4]; +}ant_common_page81_data_layout_t; + + +/**@brief Function for tracing page 80 data. + * + * @param[in] p_page_data Pointer to the page 80 data. + */ +static void page81_data_log(volatile ant_common_page81_data_t const * p_page_data) +{ + if (p_page_data->sw_revision_minor != UINT8_MAX) + { + LOG_PAGE81("sw revision: %u.%u\n\r", + ((ant_common_page81_data_t const *) p_page_data)->sw_revision_major, + ((ant_common_page81_data_t const *) p_page_data)->sw_revision_minor); + } + else + { + LOG_PAGE81("sw revision: %u\n\r", p_page_data->sw_revision_major); + } + + LOG_PAGE81("serial number: %u\n\r", (unsigned int) p_page_data->serial_number); +} + + +void ant_common_page_81_encode(uint8_t * p_page_buffer, + volatile ant_common_page81_data_t const * p_page_data) +{ + ant_common_page81_data_layout_t * p_outcoming_data = + (ant_common_page81_data_layout_t *)p_page_buffer; + + p_outcoming_data->reserved = UINT8_MAX; + + p_outcoming_data->sw_revision_minor = p_page_data->sw_revision_minor; + p_outcoming_data->sw_revision_major = p_page_data->sw_revision_major; + + UNUSED_PARAMETER(uint32_encode(p_page_data->serial_number, p_outcoming_data->serial_number)); + + page81_data_log(p_page_data); +} + + +void ant_common_page_81_decode(uint8_t const * p_page_buffer, + volatile ant_common_page81_data_t * p_page_data) +{ + ant_common_page81_data_layout_t const * p_incoming_data = + (ant_common_page81_data_layout_t *)p_page_buffer; + + p_page_data->sw_revision_minor = p_incoming_data->sw_revision_minor; + p_page_data->sw_revision_major = p_incoming_data->sw_revision_major; + + p_page_data->serial_number = uint32_decode(p_incoming_data->serial_number); + + page81_data_log(p_page_data); +} + + diff --git a/components/ant/ant_profiles/ant_common/pages/ant_common_page_81.h b/components/ant/ant_profiles/ant_common/pages/ant_common_page_81.h new file mode 100644 index 0000000..1e8ef6c --- /dev/null +++ b/components/ant/ant_profiles/ant_common/pages/ant_common_page_81.h @@ -0,0 +1,75 @@ +/* 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. + * + */ + +#ifndef ANT_COMMON_PAGE_81_H__ +#define ANT_COMMON_PAGE_81_H__ + +/** @file + * + * @defgroup ant_sdk_common_page81 ANT+ common page 81 + * @{ + * @ingroup ant_sdk_common_pages + */ + +#include + +#define ANT_COMMON_PAGE_81 (81) ///< @brief ID value of common page 81. + +/**@brief Data structure for ANT+ common data page 81. + * + * @note This structure implements only page 81 specific data. + */ +typedef struct +{ + uint8_t sw_revision_minor; ///< Supplemental, fill by 0xFF if unused. + uint8_t sw_revision_major; ///< Main software version. + uint32_t serial_number; ///< Lowest 32 b of serial number, fill by 0xFFFFFFFFF if unused. +} ant_common_page81_data_t; + +/**@brief Initialize page 81. + */ +#define DEFAULT_ANT_COMMON_page81() \ + (ant_common_page81_data_t) \ + { \ + .sw_revision_minor = UINT8_MAX, \ + .sw_revision_major = UINT8_MAX, \ + .serial_number = UINT32_MAX, \ + } + +/**@brief Initialize page 81. + */ +#define ANT_COMMON_page81(sw_major_rev, sw_minor_rev, seril_no) \ + (ant_common_page81_data_t) \ + { \ + .sw_revision_minor = (sw_minor_rev), \ + .sw_revision_major = (sw_major_rev), \ + .serial_number = (seril_no), \ + } + +/**@brief Function for encoding page 81. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_common_page_81_encode(uint8_t * p_page_buffer, + volatile ant_common_page81_data_t const * p_page_data); + +/**@brief Function for decoding page 81. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_common_page_81_decode(uint8_t const * p_page_buffer, + volatile ant_common_page81_data_t * p_page_data); + +#endif // ANT_COMMON_PAGE_81_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_common/pages/logger/ant_common_page_logger.h b/components/ant/ant_profiles/ant_common/pages/logger/ant_common_page_logger.h new file mode 100644 index 0000000..ed24c6c --- /dev/null +++ b/components/ant/ant_profiles/ant_common/pages/logger/ant_common_page_logger.h @@ -0,0 +1,26 @@ +#ifndef ANT_COMMON_PAGE_LOGGER_H__ +#define ANT_COMMON_PAGE_LOGGER_H__ + +#ifdef TRACE_COMMON_PAGE_70_ENABLE +#include "app_trace.h" +#define LOG_PAGE70 app_trace_log +#else +#define LOG_PAGE70(...) +#endif // TRACE_COMMON_PAGE_70_ENABLE + +#ifdef TRACE_COMMON_PAGE_80_ENABLE +#include "app_trace.h" +#define LOG_PAGE80 app_trace_log +#else +#define LOG_PAGE80(...) +#endif // TRACE_COMMON_PAGE_80_ENABLE + +#ifdef TRACE_COMMON_PAGE_81_ENABLE +#include "app_trace.h" +#define LOG_PAGE81 app_trace_log +#else +#define LOG_PAGE81(...) +#endif // TRACE_COMMON_PAGE_81_ENABLE + + +#endif // ANT_COMMON_PAGE_LOGGER_H__ diff --git a/components/ant/ant_profiles/ant_hrm/ant_hrm.c b/components/ant/ant_profiles/ant_hrm/ant_hrm.c new file mode 100644 index 0000000..2347b41 --- /dev/null +++ b/components/ant/ant_profiles/ant_hrm/ant_hrm.c @@ -0,0 +1,310 @@ +/* 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 "nrf_assert.h" +#include "app_error.h" +#include "ant_interface.h" +#include "app_util.h" +#include "ant_hrm.h" +#include "ant_hrm_utils.h" +#include "ant_hrm_page_logger.h" +#include "app_error.h" + +#define BACKGROUND_DATA_INTERVAL 64 /**< The number of main data pages sent between background data page. + Background data page is sent every 65th message. */ +#define TX_TOGGLE_DIVISOR 4 /**< The number of messages between changing state of toggle bit. */ + +/**@brief HRM message data layout structure. */ +typedef struct +{ + ant_hrm_page_t page_number : 7; + uint8_t toggle_bit : 1; + uint8_t page_payload[7]; +} ant_hrm_message_layout_t; + +/**@brief Function for initializing the ANT HRM profile instance. + * + * @param[in] p_profile Pointer to the profile instance. + * @param[in] p_channel_config Pointer to the ANT channel configuration structure. + * + * @retval NRF_SUCCESS If initialization was successful. Otherwise, an error code is returned. + */ +static ret_code_t ant_hrm_init(ant_hrm_profile_t * p_profile, + ant_channel_config_t const * p_channel_config) +{ + p_profile->channel_number = p_channel_config->channel_number; + + p_profile->page_0 = DEFAULT_ANT_HRM_PAGE0(); + p_profile->page_1 = DEFAULT_ANT_HRM_PAGE1(); + p_profile->page_2 = DEFAULT_ANT_HRM_PAGE2(); + p_profile->page_3 = DEFAULT_ANT_HRM_PAGE3(); + p_profile->page_4 = DEFAULT_ANT_HRM_PAGE4(); + + LOG_HRM("ANT HRM channel %u init\n\r", p_profile->channel_number); + return ant_channel_init(p_channel_config); +} + + +ret_code_t ant_hrm_disp_init(ant_hrm_profile_t * p_profile, + ant_channel_config_t const * p_channel_config, + ant_hrm_evt_handler_t evt_handler) +{ + ASSERT(p_profile != NULL); + ASSERT(p_channel_config != NULL); + ASSERT(evt_handler != NULL); + + p_profile->evt_handler = evt_handler; + + return ant_hrm_init(p_profile, p_channel_config); +} + + +ret_code_t ant_hrm_sens_init(ant_hrm_profile_t * p_profile, + ant_channel_config_t const * p_channel_config, + ant_hrm_sens_config_t const * p_sens_config) +{ + ASSERT(p_profile != NULL); + ASSERT(p_channel_config != NULL); + ASSERT(p_sens_config != NULL); + ASSERT(p_sens_config->p_cb != NULL); + ASSERT(p_sens_config->evt_handler != NULL); + + ASSERT((p_sens_config->main_page_number == ANT_HRM_PAGE_0) + || (p_sens_config->main_page_number == ANT_HRM_PAGE_4)); + + p_profile->evt_handler = p_sens_config->evt_handler; + p_profile->_cb.p_sens_cb = p_sens_config->p_cb; + + ant_hrm_sens_cb_t * p_hrm_cb = p_profile->_cb.p_sens_cb; + p_hrm_cb->page_1_present = p_sens_config->page_1_present; + p_hrm_cb->main_page_number = p_sens_config->main_page_number; + p_hrm_cb->ext_page_number = p_hrm_cb->page_1_present ? ANT_HRM_PAGE_1 : ANT_HRM_PAGE_2; + p_hrm_cb->message_counter = 0; + p_hrm_cb->toggle_bit = true; + + return ant_hrm_init(p_profile, p_channel_config); +} + + +/**@brief Function for getting next page number to send. + * + * @param[in] p_profile Pointer to the profile instance. + * + * @return Next page number. + */ +static ant_hrm_page_t next_page_number_get(ant_hrm_profile_t * p_profile) +{ + ant_hrm_sens_cb_t * p_hrm_cb = p_profile->_cb.p_sens_cb; + ant_hrm_page_t page_number; + + if (p_hrm_cb->message_counter == (BACKGROUND_DATA_INTERVAL)) + { + page_number = p_hrm_cb->ext_page_number; + + p_hrm_cb->message_counter = 0; + + p_hrm_cb->ext_page_number++; + + if (p_hrm_cb->ext_page_number > ANT_HRM_PAGE_3) + { + p_hrm_cb->ext_page_number = p_hrm_cb->page_1_present ? ANT_HRM_PAGE_1 : ANT_HRM_PAGE_2; + } + } + else + { + page_number = p_hrm_cb->main_page_number; + } + + if (p_hrm_cb->message_counter % TX_TOGGLE_DIVISOR == 0) + { + p_hrm_cb->toggle_bit ^= 1; + } + + p_hrm_cb->message_counter++; + + return page_number; +} + + +/**@brief Function for encoding HRM message. + * + * @note Assume to be call each time when Tx window will occur. + */ +static void sens_message_encode(ant_hrm_profile_t * p_profile, uint8_t * p_message_payload) +{ + ant_hrm_message_layout_t * p_hrm_message_payload = + (ant_hrm_message_layout_t *)p_message_payload; + ant_hrm_sens_cb_t * p_hrm_cb = p_profile->_cb.p_sens_cb; + + p_hrm_message_payload->page_number = next_page_number_get(p_profile); + p_hrm_message_payload->toggle_bit = p_hrm_cb->toggle_bit; + + LOG_HRM("HRM TX Page number: %u\n\r", p_hrm_message_payload->page_number); + + ant_hrm_page_0_encode(p_hrm_message_payload->page_payload, &(p_profile->page_0)); // Page 0 is present in each message + + switch (p_hrm_message_payload->page_number) + { + case ANT_HRM_PAGE_0: + // No implementation needed + break; + + case ANT_HRM_PAGE_1: + ant_hrm_page_1_encode(p_hrm_message_payload->page_payload, &(p_profile->page_1)); + break; + + case ANT_HRM_PAGE_2: + ant_hrm_page_2_encode(p_hrm_message_payload->page_payload, &(p_profile->page_2)); + break; + + case ANT_HRM_PAGE_3: + ant_hrm_page_3_encode(p_hrm_message_payload->page_payload, &(p_profile->page_3)); + break; + + case ANT_HRM_PAGE_4: + ant_hrm_page_4_encode(p_hrm_message_payload->page_payload, &(p_profile->page_4)); + break; + + default: + LOG_HRM("\r\n"); + return; + } + LOG_HRM("\r\n"); + p_profile->evt_handler(p_profile, (ant_hrm_evt_t)p_hrm_message_payload->page_number); +} + + +/**@brief Function for setting payload for ANT message and sending it. + * + * @param[in] p_profile Pointer to the profile instance. + */ +static void ant_message_send(ant_hrm_profile_t * p_profile) +{ + uint32_t err_code; + uint8_t p_message_payload[ANT_STANDARD_DATA_PAYLOAD_SIZE]; + + sens_message_encode(p_profile, p_message_payload); + err_code = + sd_ant_broadcast_message_tx(p_profile->channel_number, + sizeof (p_message_payload), + p_message_payload); + APP_ERROR_CHECK(err_code); +} + + +void ant_hrm_sens_evt_handler(ant_hrm_profile_t * p_profile, ant_evt_t * p_ant_event) +{ + if (p_ant_event->channel == p_profile->channel_number) + { + switch (p_ant_event->event) + { + case EVENT_TX: + ant_message_send(p_profile); + break; + + default: + break; + } + } +} + + +ret_code_t ant_hrm_disp_open(ant_hrm_profile_t * p_profile) +{ + ASSERT(p_profile != NULL); + + LOG_HRM("ANT HRM channel %u open\n\r", p_profile->channel_number); + return sd_ant_channel_open(p_profile->channel_number); +} + + +ret_code_t ant_hrm_sens_open(ant_hrm_profile_t * p_profile) +{ + ASSERT(p_profile != NULL); + + // Fill tx buffer for the first frame + ant_message_send(p_profile); + + LOG_HRM("ANT HRM channel %u open\n\r", p_profile->channel_number); + return sd_ant_channel_open(p_profile->channel_number); +} + + +/**@brief Function for decoding HRM message. + * + * @note Assume to be call each time when Rx window will occur. + */ +static void disp_message_decode(ant_hrm_profile_t * p_profile, uint8_t * p_message_payload) +{ + const ant_hrm_message_layout_t * p_hrm_message_payload = + (ant_hrm_message_layout_t *)p_message_payload; + + LOG_HRM("HRM RX Page Number: %u\n\r", p_hrm_message_payload->page_number); + + ant_hrm_page_0_decode(p_hrm_message_payload->page_payload, &(p_profile->page_0)); // Page 0 is present in each message + + switch (p_hrm_message_payload->page_number) + { + case ANT_HRM_PAGE_0: + // No implementation needed + break; + + case ANT_HRM_PAGE_1: + ant_hrm_page_1_decode(p_hrm_message_payload->page_payload, &(p_profile->page_1)); + break; + + case ANT_HRM_PAGE_2: + ant_hrm_page_2_decode(p_hrm_message_payload->page_payload, &(p_profile->page_2)); + break; + + case ANT_HRM_PAGE_3: + ant_hrm_page_3_decode(p_hrm_message_payload->page_payload, &(p_profile->page_3)); + break; + + case ANT_HRM_PAGE_4: + ant_hrm_page_4_decode(p_hrm_message_payload->page_payload, &(p_profile->page_4)); + break; + + default: + LOG_HRM("\r\n"); + return; + } + LOG_HRM("\r\n"); + + p_profile->evt_handler(p_profile, (ant_hrm_evt_t)p_hrm_message_payload->page_number); +} + + +void ant_hrm_disp_evt_handler(ant_hrm_profile_t * p_profile, ant_evt_t * p_ant_event) +{ + if (p_ant_event->channel == p_profile->channel_number) + { + ANT_MESSAGE * p_message = (ANT_MESSAGE *)p_ant_event->evt_buffer; + + switch (p_ant_event->event) + { + case EVENT_RX: + + if (p_message->ANT_MESSAGE_ucMesgID == MESG_BROADCAST_DATA_ID + || p_message->ANT_MESSAGE_ucMesgID == MESG_ACKNOWLEDGED_DATA_ID + || p_message->ANT_MESSAGE_ucMesgID == MESG_BURST_DATA_ID) + { + disp_message_decode(p_profile, p_message->ANT_MESSAGE_aucPayload); + } + break; + + default: + break; + } + } +} + + diff --git a/components/ant/ant_profiles/ant_hrm/ant_hrm.h b/components/ant/ant_profiles/ant_hrm/ant_hrm.h new file mode 100644 index 0000000..fca74af --- /dev/null +++ b/components/ant/ant_profiles/ant_hrm/ant_hrm.h @@ -0,0 +1,254 @@ +/* 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 ant_sdk_profiles_hrm Heart Rate Monitor profile + * @{ + * @ingroup ant_sdk_profiles + * @brief This module implements the Heart Rate Monitor profile. + * + */ + +#ifndef ANT_HRM_H__ +#define ANT_HRM_H__ + +#include +#include +#include "app_util.h" +#include "ant_parameters.h" +#include "ant_stack_handler_types.h" +#include "ant_channel_config.h" +#include "ant_hrm_pages.h" +#include "sdk_errors.h" + +#define HRM_DEVICE_TYPE 0x78u ///< Device type reserved for ANT+ heart rate monitor. +#define HRM_ANTPLUS_RF_FREQ 0x39u ///< Frequency, decimal 57 (2457 MHz). + +#define HRM_MSG_PERIOD_4Hz 0x1F86u ///< Message period, decimal 8070 (4.06 Hz). +#define HRM_MSG_PERIOD_2Hz 0x3F0Cu ///< Message period, decimal 16140 (2.03 Hz). +#define HRM_MSG_PERIOD_1Hz 0x7E18u ///< Message period, decimal 32280 (1.02 Hz). + +#define HRM_EXT_ASSIGN 0x00 ///< ANT ext assign. +#define HRM_DISP_CHANNEL_TYPE CHANNEL_TYPE_SLAVE_RX_ONLY ///< Display HRM channel type. +#define HRM_SENS_CHANNEL_TYPE CHANNEL_TYPE_MASTER ///< Sensor HRM channel type. + +/**@brief Initialize an ANT channel configuration structure for the HRM profile (Display). + * + * @param[in] NAME Name of related instance. + * @param[in] CHANNEL_NUMBER Number of the channel assigned to the profile instance. + * @param[in] TRANSMISSION_TYPE Type of transmission assigned to the profile instance. + * @param[in] DEVICE_NUMBER Number of the device assigned to the profile instance. + * @param[in] NETWORK_NUMBER Number of the network assigned to the profile instance. + * @param[in] HRM_MSG_PERIOD Channel period in 32 kHz counts. The HRM profile supports only the following periods: + * @ref HRM_MSG_PERIOD_4Hz, @ref HRM_MSG_PERIOD_2Hz, @ref HRM_MSG_PERIOD_1Hz. + */ +#define HRM_DISP_CHANNEL_CONFIG_DEF(NAME, \ + CHANNEL_NUMBER, \ + TRANSMISSION_TYPE, \ + DEVICE_NUMBER, \ + NETWORK_NUMBER, \ + HRM_MSG_PERIOD) \ +static const ant_channel_config_t NAME##_channel_hrm_disp_config = \ + { \ + .channel_number = (CHANNEL_NUMBER), \ + .channel_type = HRM_DISP_CHANNEL_TYPE, \ + .ext_assign = HRM_EXT_ASSIGN, \ + .rf_freq = HRM_ANTPLUS_RF_FREQ, \ + .transmission_type = (TRANSMISSION_TYPE), \ + .device_type = HRM_DEVICE_TYPE, \ + .device_number = (DEVICE_NUMBER), \ + .channel_period = (HRM_MSG_PERIOD), \ + .network_number = (NETWORK_NUMBER), \ + } +#define HRM_DISP_CHANNEL_CONFIG(NAME) &NAME##_channel_hrm_disp_config + +/**@brief Initialize an ANT channel configuration structure for the HRM profile (Sensor). + * + * @param[in] NAME Name of related instance. + * @param[in] CHANNEL_NUMBER Number of the channel assigned to the profile instance. + * @param[in] TRANSMISSION_TYPE Type of transmission assigned to the profile instance. + * @param[in] DEVICE_NUMBER Number of the device assigned to the profile instance. + * @param[in] NETWORK_NUMBER Number of the network assigned to the profile instance. + */ +#define HRM_SENS_CHANNEL_CONFIG_DEF(NAME, \ + CHANNEL_NUMBER, \ + TRANSMISSION_TYPE, \ + DEVICE_NUMBER, \ + NETWORK_NUMBER) \ +static const ant_channel_config_t NAME##_channel_hrm_sens_config = \ + { \ + .channel_number = (CHANNEL_NUMBER), \ + .channel_type = HRM_SENS_CHANNEL_TYPE, \ + .ext_assign = HRM_EXT_ASSIGN, \ + .rf_freq = HRM_ANTPLUS_RF_FREQ, \ + .transmission_type = (TRANSMISSION_TYPE), \ + .device_type = HRM_DEVICE_TYPE, \ + .device_number = (DEVICE_NUMBER), \ + .channel_period = HRM_MSG_PERIOD_4Hz, \ + .network_number = (NETWORK_NUMBER), \ + } +#define HRM_SENS_CHANNEL_CONFIG(NAME) &NAME##_channel_hrm_sens_config + +/**@brief Initialize an ANT profile configuration structure for the HRM profile (Sensor). + * + * @param[in] NAME Name of related instance. + * @param[in] PAGE_1_PRESENT Determines whether page 1 is included. + * @param[in] MAIN_PAGE_NUMBER Determines the main data page (@ref ANT_HRM_PAGE_0 or @ref ANT_HRM_PAGE_4). + * @param[in] EVT_HANDLER Event handler to be called for handling events in the HRM profile. + */ +#define HRM_SENS_PROFILE_CONFIG_DEF(NAME, \ + PAGE_1_PRESENT, \ + MAIN_PAGE_NUMBER, \ + EVT_HANDLER) \ +static ant_hrm_sens_cb_t NAME##_hrm_sens_cb; \ +static const ant_hrm_sens_config_t NAME##_profile_hrm_sens_config = \ + { \ + .page_1_present = (PAGE_1_PRESENT), \ + .main_page_number = (MAIN_PAGE_NUMBER), \ + .p_cb = &NAME##_hrm_sens_cb, \ + .evt_handler = (EVT_HANDLER), \ + } +#define HRM_SENS_PROFILE_CONFIG(NAME) &NAME##_profile_hrm_sens_config + +/**@brief HRM page number type. */ +typedef enum +{ + ANT_HRM_PAGE_0, ///< Main data page number 0. + ANT_HRM_PAGE_1, ///< Background data page number 1. This page is optional. + ANT_HRM_PAGE_2, ///< Background data page number 2. + ANT_HRM_PAGE_3, ///< Background data page number 3. + ANT_HRM_PAGE_4 ///< Main data page number 4. +} ant_hrm_page_t; + +/**@brief HRM profile event type. */ +typedef enum +{ + ANT_HRM_PAGE_0_UPDATED = ANT_HRM_PAGE_0, ///< Data page 0 has been updated (Display) or sent (Sensor). + ANT_HRM_PAGE_1_UPDATED = ANT_HRM_PAGE_1, ///< Data page 0 and page 1 have been updated (Display) or sent (Sensor). + ANT_HRM_PAGE_2_UPDATED = ANT_HRM_PAGE_2, ///< Data page 0 and page 2 have been updated (Display) or sent (Sensor). + ANT_HRM_PAGE_3_UPDATED = ANT_HRM_PAGE_3, ///< Data page 0 and page 3 have been updated (Display) or sent (Sensor). + ANT_HRM_PAGE_4_UPDATED = ANT_HRM_PAGE_4, ///< Data page 0 and page 4 have been updated (Display) or sent (Sensor). +} ant_hrm_evt_t; + +// Forward declaration of the ant_hrm_profile_t type. +typedef struct ant_hrm_profile_s ant_hrm_profile_t; + +/**@brief HRM event handler type. */ +typedef void (* ant_hrm_evt_handler_t) (ant_hrm_profile_t *, ant_hrm_evt_t); + +#include "ant_hrm_local.h" + +/**@brief HRM sensor configuration structure. */ +typedef struct +{ + bool page_1_present; ///< Determines whether page 1 is included. + ant_hrm_page_t main_page_number; ///< Determines the main data page (@ref ANT_HRM_PAGE_0 or @ref ANT_HRM_PAGE_4). + ant_hrm_sens_cb_t * p_cb; ///< Pointer to the data buffer for internal use. + ant_hrm_evt_handler_t evt_handler; ///< Event handler to be called for handling events in the HRM profile. +} ant_hrm_sens_config_t; + +/**@brief HRM profile structure. */ +struct ant_hrm_profile_s +{ + uint8_t channel_number; ///< Channel number assigned to the profile. + union { + void * p_none; + ant_hrm_sens_cb_t * p_sens_cb; + } _cb; ///< Pointer to internal control block. + ant_hrm_evt_handler_t evt_handler; ///< Event handler to be called for handling events in the HRM profile. + ant_hrm_page0_data_t page_0; ///< Page 0. + ant_hrm_page1_data_t page_1; ///< Page 1. + ant_hrm_page2_data_t page_2; ///< Page 2. + ant_hrm_page3_data_t page_3; ///< Page 3. + ant_hrm_page4_data_t page_4; ///< Page 4. +}; + +/** @name Defines for accessing ant_hrm_profile_t member variables + @{ */ +#define HRM_PROFILE_beat_count page_0.beat_count +#define HRM_PROFILE_computed_heart_rate page_0.computed_heart_rate +#define HRM_PROFILE_beat_time page_0.beat_time +#define HRM_PROFILE_operating_time page_1.operating_time +#define HRM_PROFILE_manuf_id page_2.manuf_id +#define HRM_PROFILE_serial_num page_2.serial_num +#define HRM_PROFILE_hw_version page_3.hw_version +#define HRM_PROFILE_sw_version page_3.sw_version +#define HRM_PROFILE_model_num page_3.model_num +#define HRM_PROFILE_manuf_spec page_4.manuf_spec +#define HRM_PROFILE_prev_beat page_4.prev_beat +/** @} */ + +/**@brief Function for initializing the ANT HRM Display profile instance. + * + * @param[in] p_profile Pointer to the profile instance. + * @param[in] p_channel_config Pointer to the ANT channel configuration structure. + * @param[in] evt_handler Event handler to be called for handling events in the HRM profile. + * + * @retval NRF_SUCCESS If initialization was successful. Otherwise, an error code is returned. + */ +ret_code_t ant_hrm_disp_init(ant_hrm_profile_t * p_profile, + ant_channel_config_t const * p_channel_config, + ant_hrm_evt_handler_t evt_handler); + +/**@brief Function for initializing the ANT HRM Sensor profile instance. + * + * @param[in] p_profile Pointer to the profile instance. + * @param[in] p_channel_config Pointer to the ANT channel configuration structure. + * @param[in] p_sens_config Pointer to the HRM sensor configuration structure. + * + * @retval NRF_SUCCESS If initialization was successful. Otherwise, an error code is returned. + */ +ret_code_t ant_hrm_sens_init(ant_hrm_profile_t * p_profile, + ant_channel_config_t const * p_channel_config, + ant_hrm_sens_config_t const * p_sens_config); + +/**@brief Function for opening the profile instance channel for ANT HRM Display. + * + * Before calling this function, pages should be configured. + * + * @param[in] p_profile Pointer to the profile instance. + * + * @retval NRF_SUCCESS If the channel was successfully opened. Otherwise, an error code is returned. + */ +ret_code_t ant_hrm_disp_open(ant_hrm_profile_t * p_profile); + +/**@brief Function for opening the profile instance channel for ANT HRM Sensor. + * + * Before calling this function, pages should be configured. + * + * @param[in] p_profile Pointer to the profile instance. + * + * @retval NRF_SUCCESS If the channel was successfully opened. Otherwise, an error code is returned. + */ +ret_code_t ant_hrm_sens_open(ant_hrm_profile_t * p_profile); + +/**@brief Function for handling the sensor ANT events. + * + * @details This function handles all events from the ANT stack that are of interest to the Heart Rate Monitor Sensor profile. + * + * @param[in] p_profile Pointer to the profile instance. + * @param[in] p_ant_event Event received from the ANT stack. + */ +void ant_hrm_sens_evt_handler(ant_hrm_profile_t * p_profile, ant_evt_t * p_ant_event); + +/**@brief Function for handling the display ANT events. + * + * @details This function handles all events from the ANT stack that are of interest to the Heart Rate Monitor Display profile. + * + * @param[in] p_profile Pointer to the profile instance. + * @param[in] p_ant_event Event received from the ANT stack. + */ +void ant_hrm_disp_evt_handler(ant_hrm_profile_t * p_profile, ant_evt_t * p_ant_event); +#endif // ANT_HRM_H__ +/** @} */ + diff --git a/components/ant/ant_profiles/ant_hrm/ant_hrm_local.h b/components/ant/ant_profiles/ant_hrm/ant_hrm_local.h new file mode 100644 index 0000000..f112230 --- /dev/null +++ b/components/ant/ant_profiles/ant_hrm/ant_hrm_local.h @@ -0,0 +1,40 @@ +/* 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. + * + */ + + +#ifndef ANT_HRM_LOCAL_H__ +#define ANT_HRM_LOCAL_H__ + +#include +#include +#include "ant_hrm.h" + +/** + * @addtogroup ant_sdk_profiles_hrm + * @{ + */ + +/** @brief HRM Sensor control block. */ +typedef struct +{ + uint8_t toggle_bit; + ant_hrm_page_t main_page_number; + uint8_t page_1_present; + ant_hrm_page_t ext_page_number; + uint8_t message_counter; +} ant_hrm_sens_cb_t; + +/** + * @} + */ + +#endif // ANT_HRM_LOCAL_H__ diff --git a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_0.c b/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_0.c new file mode 100644 index 0000000..94645df --- /dev/null +++ b/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_0.c @@ -0,0 +1,76 @@ +/* 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 "ant_hrm_page_0.h" +#include "ant_hrm_utils.h" +#include "ant_hrm_page_logger.h" + +/**@brief HRM page 0 data layout structure. */ +typedef struct +{ + uint8_t reserved[3]; + uint8_t heart_beat_evt_time_LSB; + uint8_t heart_beat_evt_time_MSB; + uint8_t heart_beat_count; + uint8_t computed_heart_rate; +}ant_hrm_page0_data_layout_t; + +/**@brief Function for tracing page 0 and common data. + * + * @param[in] p_common_data Pointer to the common data. + * @param[in] p_page_data Pointer to the page 0 data. + */ +static void page0_data_log(ant_hrm_page0_data_t const * p_page_data) +{ + LOG_PAGE0("Heart beat count: %u\n\r", (unsigned int)p_page_data->beat_count); + LOG_PAGE0("Computed heart rate: %u\n\r", + (unsigned int)p_page_data->computed_heart_rate); + LOG_PAGE0("Heart beat event time: %u.", + (unsigned int)ANT_HRM_BEAT_TIME_SEC(p_page_data->beat_time)); + LOG_PAGE0("%03us\n\r", (unsigned int)ANT_HRM_BEAT_TIME_MSEC(p_page_data->beat_time)); +} + + +void ant_hrm_page_0_encode(uint8_t * p_page_buffer, + ant_hrm_page0_data_t const * p_page_data) +{ + ant_hrm_page0_data_layout_t * p_outcoming_data = (ant_hrm_page0_data_layout_t *)p_page_buffer; + uint32_t beat_time = p_page_data->beat_time; + + p_outcoming_data->reserved[0] = UINT8_MAX; + p_outcoming_data->reserved[1] = UINT8_MAX; + p_outcoming_data->reserved[2] = UINT8_MAX; + p_outcoming_data->heart_beat_evt_time_LSB = (uint8_t)(beat_time & UINT8_MAX); + p_outcoming_data->heart_beat_evt_time_MSB = (uint8_t)((beat_time >> 8) & UINT8_MAX); + p_outcoming_data->heart_beat_count = (uint8_t)p_page_data->beat_count; + p_outcoming_data->computed_heart_rate = (uint8_t)p_page_data->computed_heart_rate; + + page0_data_log(p_page_data); +} + + +void ant_hrm_page_0_decode(uint8_t const * p_page_buffer, + ant_hrm_page0_data_t * p_page_data) +{ + ant_hrm_page0_data_layout_t const * p_incoming_data = + (ant_hrm_page0_data_layout_t *)p_page_buffer; + + uint32_t beat_time = (uint32_t)((p_incoming_data->heart_beat_evt_time_MSB << 8) + + p_incoming_data->heart_beat_evt_time_LSB); + + p_page_data->beat_count = (uint32_t)p_incoming_data->heart_beat_count; + p_page_data->computed_heart_rate = (uint32_t)p_incoming_data->computed_heart_rate; + p_page_data->beat_time = beat_time; + + page0_data_log(p_page_data); +} + + diff --git a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_0.h b/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_0.h new file mode 100644 index 0000000..24cad8a --- /dev/null +++ b/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_0.h @@ -0,0 +1,62 @@ +/* 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. + * + */ +#ifndef ANT_HRM_PAGE_0_H__ +#define ANT_HRM_PAGE_0_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_hrm_page0 HRM profile page 0 + * @{ + * @ingroup ant_sdk_profiles_hrm_pages + */ + +#include + +/**@brief Data structure for HRM data page 0. + * + * This structure is used as a common page. + */ +typedef struct +{ + uint8_t beat_count; ///< Beat count. + uint8_t computed_heart_rate; ///< Computed heart rate. + uint16_t beat_time; ///< Beat time. +} ant_hrm_page0_data_t; + +/**@brief Initialize page 0. + */ +#define DEFAULT_ANT_HRM_PAGE0() \ + (ant_hrm_page0_data_t) \ + { \ + .beat_count = 0, \ + .computed_heart_rate = 0, \ + .beat_time = 0, \ + } + +/**@brief Function for encoding page 0. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_hrm_page_0_encode(uint8_t * p_page_buffer, + ant_hrm_page0_data_t const * p_page_data); + +/**@brief Function for decoding page 0. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_hrm_page_0_decode(uint8_t const * p_page_buffer, + ant_hrm_page0_data_t * p_page_data); + +#endif // ANT_HRM_PAGE_0_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_1.c b/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_1.c new file mode 100644 index 0000000..9807fed --- /dev/null +++ b/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_1.c @@ -0,0 +1,64 @@ +/* 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 "ant_hrm_page_1.h" +#include "ant_hrm_utils.h" +#include "ant_hrm_page_logger.h" +#include "app_util.h" +#include "nordic_common.h" + +/**@brief HRM page 1 data layout structure. */ +typedef struct +{ + uint8_t cumulative_operating_time[3]; + uint8_t reserved[4]; +}ant_hrm_page1_data_layout_t; + +/**@brief Function for tracing page 1 and common data. + * + * @param[in] p_common_data Pointer to the common data. + * @param[in] p_page_data Pointer to the page 1 data. + */ +static void page1_data_log(ant_hrm_page1_data_t const * p_page_data) +{ + LOG_PAGE1("Cumulative operating time: %ud ", + (unsigned int)ANT_HRM_OPERATING_DAYS(p_page_data->operating_time)); + LOG_PAGE1("%uh ", (unsigned int)ANT_HRM_OPERATING_HOURS(p_page_data->operating_time)); + LOG_PAGE1("%um ", (unsigned int)ANT_HRM_OPERATING_MINUTES(p_page_data->operating_time)); + LOG_PAGE1("%us\n\r", (unsigned int)ANT_HRM_OPERATING_SECONDS(p_page_data->operating_time)); +} + + +void ant_hrm_page_1_encode(uint8_t * p_page_buffer, + ant_hrm_page1_data_t const * p_page_data) +{ + ant_hrm_page1_data_layout_t * p_outcoming_data = (ant_hrm_page1_data_layout_t *)p_page_buffer; + uint32_t operating_time = p_page_data->operating_time; + + UNUSED_PARAMETER(uint24_encode(operating_time, p_outcoming_data->cumulative_operating_time)); + page1_data_log(p_page_data); +} + + +void ant_hrm_page_1_decode(uint8_t const * p_page_buffer, + ant_hrm_page1_data_t * p_page_data) +{ + ant_hrm_page1_data_layout_t const * p_incoming_data = + (ant_hrm_page1_data_layout_t *)p_page_buffer; + + uint32_t operating_time = uint24_decode(p_incoming_data->cumulative_operating_time); + + p_page_data->operating_time = operating_time; + + page1_data_log(p_page_data); +} + + diff --git a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_1.h b/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_1.h new file mode 100644 index 0000000..7b02861 --- /dev/null +++ b/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_1.h @@ -0,0 +1,58 @@ +/* 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. + * + */ +#ifndef ANT_HRM_PAGE_1_H__ +#define ANT_HRM_PAGE_1_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_hrm_page1 HRM profile page 1 + * @{ + * @ingroup ant_sdk_profiles_hrm_pages + */ + +#include + +/**@brief Data structure for HRM data page 1. + * + * This structure implements only page 1 specific data. + */ +typedef struct +{ + uint32_t operating_time; ///< Operating time. +} ant_hrm_page1_data_t; + +/**@brief Initialize page 1. + */ +#define DEFAULT_ANT_HRM_PAGE1() \ + (ant_hrm_page1_data_t) \ + { \ + .operating_time = 0, \ + } + +/**@brief Function for encoding page 1. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_hrm_page_1_encode(uint8_t * p_page_buffer, + ant_hrm_page1_data_t const * p_page_data); + +/**@brief Function for decoding page 1. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_hrm_page_1_decode(uint8_t const * p_page_buffer, + ant_hrm_page1_data_t * p_page_data); + +#endif // ANT_HRM_PAGE_1_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_2.c b/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_2.c new file mode 100644 index 0000000..3a9ff52 --- /dev/null +++ b/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_2.c @@ -0,0 +1,66 @@ +/* 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 "ant_hrm_page_2.h" +#include "ant_hrm_page_logger.h" + +/**@brief HRM page 2 data layout structure. */ +typedef struct +{ + uint8_t manuf_id; + uint8_t serial_num_LSB; + uint8_t serial_num_MSB; + uint8_t reserved[4]; +}ant_hrm_page2_data_layout_t; + +/**@brief Function for tracing page 2 and common data. + * + * @param[in] p_common_data Pointer to the common data. + * @param[in] p_page_data Pointer to the page 2 data. + */ +static void page2_data_log(ant_hrm_page2_data_t const * p_page_data) +{ + LOG_PAGE2("Manufacturer ID: %u\n\r", (unsigned int)p_page_data->manuf_id); + LOG_PAGE2("Serial No (upper 16-bits): 0x%X\n\r", (unsigned int)p_page_data->serial_num); +} + + +void ant_hrm_page_2_encode(uint8_t * p_page_buffer, + ant_hrm_page2_data_t const * p_page_data) +{ + ant_hrm_page2_data_layout_t * p_outcoming_data = (ant_hrm_page2_data_layout_t *)p_page_buffer; + uint32_t serial_num = p_page_data->serial_num; + + p_outcoming_data->manuf_id = (uint8_t)p_page_data->manuf_id; + p_outcoming_data->serial_num_LSB = (uint8_t)(serial_num & UINT8_MAX); + p_outcoming_data->serial_num_MSB = (uint8_t)((serial_num >> 8) & UINT8_MAX); + + page2_data_log(p_page_data); +} + + +void ant_hrm_page_2_decode(uint8_t const * p_page_buffer, + ant_hrm_page2_data_t * p_page_data) +{ + ant_hrm_page2_data_layout_t const * p_incoming_data = + (ant_hrm_page2_data_layout_t *)p_page_buffer; + uint32_t serial_num = + (uint32_t)((p_incoming_data->serial_num_MSB << 8) + + p_incoming_data-> + serial_num_LSB); + + p_page_data->manuf_id = (uint32_t)p_incoming_data->manuf_id; + p_page_data->serial_num = serial_num; + + page2_data_log(p_page_data); +} + + diff --git a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_2.h b/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_2.h new file mode 100644 index 0000000..1ba449e --- /dev/null +++ b/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_2.h @@ -0,0 +1,60 @@ +/* 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. + * + */ +#ifndef ANT_HRM_PAGE_2_H__ +#define ANT_HRM_PAGE_2_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_hrm_page2 HRM profile page 2 + * @{ + * @ingroup ant_sdk_profiles_hrm_pages + */ + +#include + +/**@brief Data structure for HRM data page 2. + * + * This structure implements only page 2 specific data. + */ +typedef struct +{ + uint8_t manuf_id; ///< Manufacturer ID. + uint16_t serial_num; ///< Serial number. +} ant_hrm_page2_data_t; + +/**@brief Initialize page 2. + */ +#define DEFAULT_ANT_HRM_PAGE2() \ + (ant_hrm_page2_data_t) \ + { \ + .manuf_id = 0, \ + .serial_num = 0, \ + } + +/**@brief Function for encoding page 2. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_hrm_page_2_encode(uint8_t * p_page_buffer, + ant_hrm_page2_data_t const * p_page_data); + +/**@brief Function for decoding page 2. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_hrm_page_2_decode(uint8_t const * p_page_buffer, + ant_hrm_page2_data_t * p_page_data); + +#endif // ANT_HRM_PAGE_2_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_3.c b/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_3.c new file mode 100644 index 0000000..e9bd4de --- /dev/null +++ b/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_3.c @@ -0,0 +1,63 @@ +/* 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 "ant_hrm_page_3.h" +#include "ant_hrm_page_logger.h" + +/**@brief HRM page 3 data layout structure. */ +typedef struct +{ + uint8_t hw_version; + uint8_t sw_version; + uint8_t model_num; + uint8_t reserved[4]; +}ant_hrm_page3_data_layout_t; + +/**@brief Function for tracing page 3 and common data. + * + * @param[in] p_common_data Pointer to the common data. + * @param[in] p_page_data Pointer to the page 3 data. + */ +static void page3_data_log(ant_hrm_page3_data_t const * p_page_data) +{ + LOG_PAGE3("Hardware Rev ID %u\n\r", (unsigned int)p_page_data->hw_version); + LOG_PAGE3("Model %u\n\r", (unsigned int)p_page_data->model_num); + LOG_PAGE3("Software Ver ID %u\n\r", (unsigned int)p_page_data->sw_version); +} + + +void ant_hrm_page_3_encode(uint8_t * p_page_buffer, + ant_hrm_page3_data_t const * p_page_data) +{ + ant_hrm_page3_data_layout_t * p_outcoming_data = (ant_hrm_page3_data_layout_t *)p_page_buffer; + + p_outcoming_data->hw_version = (uint8_t)p_page_data->hw_version; + p_outcoming_data->sw_version = (uint8_t)p_page_data->sw_version; + p_outcoming_data->model_num = (uint8_t)p_page_data->model_num; + + page3_data_log(p_page_data); +} + + +void ant_hrm_page_3_decode(uint8_t const * p_page_buffer, + ant_hrm_page3_data_t * p_page_data) +{ + ant_hrm_page3_data_layout_t const * p_incoming_data = + (ant_hrm_page3_data_layout_t *)p_page_buffer; + + p_page_data->hw_version = (uint32_t)p_incoming_data->hw_version; + p_page_data->sw_version = (uint32_t)p_incoming_data->sw_version; + p_page_data->model_num = (uint32_t)p_incoming_data->model_num; + + page3_data_log(p_page_data); +} + + diff --git a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_3.h b/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_3.h new file mode 100644 index 0000000..9455a2d --- /dev/null +++ b/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_3.h @@ -0,0 +1,62 @@ +/* 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. + * + */ +#ifndef ANT_HRM_PAGE_3_H__ +#define ANT_HRM_PAGE_3_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_hrm_page3 HRM profile page 3 + * @{ + * @ingroup ant_sdk_profiles_hrm_pages + */ + +#include + +/**@brief Data structure for HRM data page 3. + * + * This structure implements only page 3 specific data. + */ +typedef struct +{ + uint8_t hw_version; ///< Hardware version. + uint8_t sw_version; ///< Software version. + uint8_t model_num; ///< Model number. +} ant_hrm_page3_data_t; + +/**@brief Initialize page 3. + */ +#define DEFAULT_ANT_HRM_PAGE3() \ + (ant_hrm_page3_data_t) \ + { \ + .hw_version = 0, \ + .sw_version = 0, \ + .model_num = 0, \ + } + +/**@brief Function for encoding page 3. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_hrm_page_3_encode(uint8_t * p_page_buffer, + ant_hrm_page3_data_t const * p_page_data); + +/**@brief Function for decoding page 3. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_hrm_page_3_decode(uint8_t const * p_page_buffer, + ant_hrm_page3_data_t * p_page_data); + +#endif // ANT_HRM_PAGE_3_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_4.c b/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_4.c new file mode 100644 index 0000000..c73b6e3 --- /dev/null +++ b/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_4.c @@ -0,0 +1,67 @@ +/* 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 "ant_hrm_page_4.h" +#include "ant_hrm_utils.h" +#include "ant_hrm_page_logger.h" + +/**@brief HRM page 4 data layout structure. */ +typedef struct +{ + uint8_t manuf_spec; + uint8_t prev_beat_LSB; + uint8_t prev_beat_MSB; + uint8_t reserved[4]; +}ant_hrm_page4_data_layout_t; + +/**@brief Function for tracing page 4 and common data. + * + * @param[in] p_common_data Pointer to the common data. + * @param[in] p_page_data Pointer to the page 4 data. + */ +static void page4_data_log(ant_hrm_page4_data_t const * p_page_data) +{ + LOG_PAGE4("Previous heart beat event time: %u.", + (unsigned int)ANT_HRM_BEAT_TIME_SEC(p_page_data->prev_beat)); + LOG_PAGE4("%03us\n\r", (unsigned int)ANT_HRM_BEAT_TIME_MSEC(p_page_data->prev_beat)); +} + + +void ant_hrm_page_4_encode(uint8_t * p_page_buffer, + ant_hrm_page4_data_t const * p_page_data) +{ + ant_hrm_page4_data_layout_t * p_outcoming_data = (ant_hrm_page4_data_layout_t *)p_page_buffer; + uint32_t prev_beat = p_page_data->prev_beat; + + p_outcoming_data->manuf_spec = p_page_data->manuf_spec; + p_outcoming_data->prev_beat_LSB = (uint8_t)(prev_beat & UINT8_MAX); + p_outcoming_data->prev_beat_MSB = (uint8_t)((prev_beat >> 8) & UINT8_MAX); + + page4_data_log(p_page_data); +} + + +void ant_hrm_page_4_decode(uint8_t const * p_page_buffer, + ant_hrm_page4_data_t * p_page_data) +{ + ant_hrm_page4_data_layout_t const * p_incoming_data = + (ant_hrm_page4_data_layout_t *)p_page_buffer; + + uint32_t prev_beat = (uint32_t)((p_incoming_data->prev_beat_MSB << 8) + + p_incoming_data->prev_beat_LSB); + + p_page_data->manuf_spec = p_incoming_data->manuf_spec; + p_page_data->prev_beat = prev_beat; + + page4_data_log(p_page_data); +} + + diff --git a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_4.h b/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_4.h new file mode 100644 index 0000000..e36d8af --- /dev/null +++ b/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_page_4.h @@ -0,0 +1,60 @@ +/* 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. + * + */ +#ifndef ANT_HRM_PAGE_4_H__ +#define ANT_HRM_PAGE_4_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_hrm_page4 HRM profile page 4 + * @{ + * @ingroup ant_sdk_profiles_hrm_pages + */ + +#include + +/**@brief Data structure for HRM data page 4. + * + * This structure implements only page 4 specific data. + */ +typedef struct +{ + uint8_t manuf_spec; ///< Manufacturer specific byte. + uint16_t prev_beat; ///< Previous beat. +} ant_hrm_page4_data_t; + +/**@brief Initialize page 4. + */ +#define DEFAULT_ANT_HRM_PAGE4() \ + (ant_hrm_page4_data_t) \ + { \ + .manuf_spec = 0, \ + .prev_beat = 0, \ + } + +/**@brief Function for encoding page 4. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_hrm_page_4_encode(uint8_t * p_page_buffer, + ant_hrm_page4_data_t const * p_page_data); + +/**@brief Function for decoding page 4. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_hrm_page_4_decode(uint8_t const * p_page_buffer, + ant_hrm_page4_data_t * p_page_data); + +#endif // ANT_HRM_PAGE_3_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_pages.h b/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_pages.h new file mode 100644 index 0000000..bf4e4d9 --- /dev/null +++ b/components/ant/ant_profiles/ant_hrm/pages/ant_hrm_pages.h @@ -0,0 +1,30 @@ +/* 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. + * + */ +#ifndef __ANT_HRM_PAGES_H +#define __ANT_HRM_PAGES_H + +/** @file + * + * @defgroup ant_sdk_profiles_hrm_pages Heart Rate Monitor profile pages + * @{ + * @ingroup ant_sdk_profiles_hrm + * @brief This module implements functions for the HRM data pages. + */ + +#include "ant_hrm_page_0.h" +#include "ant_hrm_page_1.h" +#include "ant_hrm_page_2.h" +#include "ant_hrm_page_3.h" +#include "ant_hrm_page_4.h" + +#endif // __ANT_HRM_PAGES_H +/** @} */ diff --git a/components/ant/ant_profiles/ant_hrm/pages/logger/ant_hrm_page_logger.h b/components/ant/ant_profiles/ant_hrm/pages/logger/ant_hrm_page_logger.h new file mode 100644 index 0000000..fcf803c --- /dev/null +++ b/components/ant/ant_profiles/ant_hrm/pages/logger/ant_hrm_page_logger.h @@ -0,0 +1,57 @@ +/* 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. + * + */ +#ifndef ANT_HRM_PAGE_LOGGER_H__ +#define ANT_HRM_PAGE_LOGGER_H__ + +#ifdef TRACE_HRM_GENERAL_ENABLE +#include "app_trace.h" +#define LOG_HRM app_trace_log +#else +#define LOG_HRM(...) +#endif // TRACE_HRM_GENERAL_ENABLE + +#ifdef TRACE_HRM_PAGE_0_ENABLE +#include "app_trace.h" +#define LOG_PAGE0 app_trace_log +#else +#define LOG_PAGE0(...) +#endif // TRACE_HRM_PAGE_0_ENABLE + +#ifdef TRACE_HRM_PAGE_1_ENABLE +#include "app_trace.h" +#define LOG_PAGE1 app_trace_log +#else +#define LOG_PAGE1(...) +#endif // TRACE_HRM_PAGE_1_ENABLE + +#ifdef TRACE_HRM_PAGE_2_ENABLE +#include "app_trace.h" +#define LOG_PAGE2 app_trace_log +#else +#define LOG_PAGE2(...) +#endif // TRACE_HRM_PAGE_2_ENABLE + +#ifdef TRACE_HRM_PAGE_3_ENABLE +#include "app_trace.h" +#define LOG_PAGE3 app_trace_log +#else +#define LOG_PAGE3(...) +#endif // TRACE_HRM_PAGE_3_ENABLE + +#ifdef TRACE_HRM_PAGE_4_ENABLE +#include "app_trace.h" +#define LOG_PAGE4 app_trace_log +#else +#define LOG_PAGE4(...) +#endif // TRACE_HRM_PAGE_4_ENABLE + +#endif // ANT_HRM_UTILS_H__ diff --git a/components/ant/ant_profiles/ant_hrm/simulator/ant_hrm_simulator.c b/components/ant/ant_profiles/ant_hrm/simulator/ant_hrm_simulator.c new file mode 100644 index 0000000..062f6c2 --- /dev/null +++ b/components/ant/ant_profiles/ant_hrm/simulator/ant_hrm_simulator.c @@ -0,0 +1,117 @@ +/* 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 "ant_hrm_simulator.h" +#include "ant_hrm_utils.h" +#include "nordic_common.h" + +#define ITERATION_ANT_CYCLES HRM_MSG_PERIOD_4Hz ///< period of calculation [1/32678 s], defined in ANT device profile +#define ITERATION_PERIOD (ITERATION_ANT_CYCLES * 1024 / ANT_CLOCK_FREQUENCY) ///< integer part of calculation's period [1/1024 s] +#define ITERATION_FRACTION (ITERATION_ANT_CYCLES * 1024 % ANT_CLOCK_FREQUENCY) ///< fractional part of calculation's period [1/32678 s] + +void ant_hrm_simulator_init(ant_hrm_simulator_t * p_simulator, + ant_hrm_simulator_cfg_t const * p_config, + bool auto_change) +{ + + p_simulator->p_profile = p_config->p_profile; + p_simulator->_cb.sensorsim_cfg = p_config->sensorsim_cfg; + p_simulator->_cb.auto_change = auto_change; + p_simulator->_cb.sensorsim_state.current_val = p_simulator->_cb.sensorsim_cfg.min; + p_simulator->_cb.time_since_last_hb = 0; + p_simulator->_cb.fraction_since_last_hb = 0; + + sensorsim_init(&(p_simulator->_cb.sensorsim_state), &(p_simulator->_cb.sensorsim_cfg)); +} + + +void ant_hrm_simulator_one_iteration(ant_hrm_simulator_t * p_simulator) +{ + + if (p_simulator->_cb.auto_change) + { + UNUSED_PARAMETER(sensorsim_measure(&(p_simulator->_cb.sensorsim_state), + &(p_simulator->_cb.sensorsim_cfg))); + } + + // @note: Take a local copy within scope in order to assist the compiler in variable register + // allocation. + const uint32_t computed_heart_rate_value = p_simulator->_cb.sensorsim_state.current_val; + + // @note: This implementation assumes that the current instantaneous heart can vary and this + // function is called with static frequency. + // value and the heart rate pulse interval is derived from it. The computation is based on 60 + // seconds in a minute and the used time base is 1/1024 seconds. + const uint32_t current_hb_pulse_interval = (60u * 1024u) / computed_heart_rate_value; + + // update time from last hb detected + p_simulator->_cb.time_since_last_hb += ITERATION_PERIOD; + + // extended celculadion by fraction make calculating accurat in long time perspective + p_simulator->_cb.fraction_since_last_hb += ITERATION_FRACTION; + uint32_t add_period = p_simulator->_cb.fraction_since_last_hb / ANT_CLOCK_FREQUENCY; + + if (add_period > 0) + { + p_simulator->_cb.time_since_last_hb++; + p_simulator->_cb.fraction_since_last_hb %= ANT_CLOCK_FREQUENCY; + } + + // calc number of hb as will fill + uint32_t new_beats = p_simulator->_cb.time_since_last_hb / current_hb_pulse_interval; + uint32_t add_event_time = new_beats * current_hb_pulse_interval; + + if (new_beats > 0) + { + p_simulator->p_profile->HRM_PROFILE_computed_heart_rate = + (uint8_t)computed_heart_rate_value; + + // Current heart beat event time is the previous event time added with the current heart rate + // pulse interval. + uint32_t current_heart_beat_event_time = p_simulator->p_profile->HRM_PROFILE_beat_time + + add_event_time; + + // Set current event time. + p_simulator->p_profile->HRM_PROFILE_beat_time = current_heart_beat_event_time; // <- B<4,5> <- + + // Set previous event time. // p4.B<2,3> <- B<4,5> + p_simulator->p_profile->HRM_PROFILE_prev_beat = + p_simulator->p_profile->HRM_PROFILE_beat_time - current_hb_pulse_interval; + + // Event count. + p_simulator->p_profile->HRM_PROFILE_beat_count += new_beats; // B<6> + + p_simulator->_cb.time_since_last_hb -= add_event_time; + } +} + + +void ant_hrm_simulator_increment(ant_hrm_simulator_t * p_simulator) +{ + if (!p_simulator->_cb.auto_change) + { + sensorsim_increment(&(p_simulator->_cb.sensorsim_state), + &(p_simulator->_cb.sensorsim_cfg)); + } +} + + +void ant_hrm_simulator_decrement(ant_hrm_simulator_t * p_simulator) +{ + if (!p_simulator->_cb.auto_change) + { + sensorsim_decrement(&(p_simulator->_cb.sensorsim_state), + &(p_simulator->_cb.sensorsim_cfg)); + } +} + + diff --git a/components/ant/ant_profiles/ant_hrm/simulator/ant_hrm_simulator.h b/components/ant/ant_profiles/ant_hrm/simulator/ant_hrm_simulator.h new file mode 100644 index 0000000..acc8976 --- /dev/null +++ b/components/ant/ant_profiles/ant_hrm/simulator/ant_hrm_simulator.h @@ -0,0 +1,95 @@ +/* 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. + * + */ + +#ifndef ANT_HRM_SIMULATOR_H__ +#define ANT_HRM_SIMULATOR_H__ + +/** @file + * + * @defgroup ant_sdk_hrm_simulator ANT HRM simulator + * @{ + * @ingroup ant_sdk_simulators + * @brief ANT HRM simulator module. + * + * @details This module simulates a pulse for the ANT HRM profile. The module calculates abstract values, which are handled + * by the HRM pages data model to ensure that they are compatible. It provides a handler for changing the heart rate + * value manually and functionality to change the heart rate value automatically. + * + */ + +#include +#include +#include "bsp.h" +#include "ant_hrm.h" +#include "ant_hrm_utils.h" +#include "sensorsim.h" +#include "ant_hrm_simulator_local.h" + + +/**@brief HRM simulator configuration structure. */ +typedef struct +{ + ant_hrm_profile_t * p_profile; ///< Related profile. + sensorsim_cfg_t sensorsim_cfg; ///< Sensorsim configuration. +} ant_hrm_simulator_cfg_t; + +/**@brief Initialize @ref ant_hrm_simulator_cfg_t. + */ +#define DEFAULT_ANT_HRM_SIMULATOR_CFG(P_PROFILE, MIN_HEART_RATE, MAX_HEART_RATE, INCREMENT) \ + { \ + .p_profile = (P_PROFILE), \ + .sensorsim_cfg.min = (MIN_HEART_RATE), \ + .sensorsim_cfg.max = (MAX_HEART_RATE), \ + .sensorsim_cfg.incr = (INCREMENT), \ + .sensorsim_cfg.start_at_max = false, \ + } + +/**@brief HRM simulator structure. */ +typedef struct +{ + ant_hrm_profile_t * p_profile; ///< Related profile. + ant_hrm_simulator_cb_t _cb; ///< Internal control block. +} ant_hrm_simulator_t; + + +/**@brief Function for initializing the ANT HRM simulator instance. + * + * @param[in] p_simulator Pointer to the simulator instance. + * @param[in] p_config Pointer to the simulator configuration structure. + * @param[in] auto_change Enable or disable automatic changes of the cadence. + */ +void ant_hrm_simulator_init(ant_hrm_simulator_t * p_simulator, + ant_hrm_simulator_cfg_t const * p_config, + bool auto_change); + +/**@brief Function for simulating a device event. + * + * @details Based on this event, the transmitter data is simulated. + * + * This function should be called in the HRM TX event handler. + */ +void ant_hrm_simulator_one_iteration(ant_hrm_simulator_t * p_simulator); + +/**@brief Function for incrementing the cadence value. + * + * @param[in] p_simulator Pointer to the simulator instance. + */ +void ant_hrm_simulator_increment(ant_hrm_simulator_t * p_simulator); + +/**@brief Function for decrementing the cadence value. + * + * @param[in] p_simulator Pointer to the simulator instance. + */ +void ant_hrm_simulator_decrement(ant_hrm_simulator_t * p_simulator); + +#endif // ANT_HRM_SIMULATOR_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_hrm/simulator/ant_hrm_simulator_local.h b/components/ant/ant_profiles/ant_hrm/simulator/ant_hrm_simulator_local.h new file mode 100644 index 0000000..f2a8899 --- /dev/null +++ b/components/ant/ant_profiles/ant_hrm/simulator/ant_hrm_simulator_local.h @@ -0,0 +1,34 @@ +/* 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. + * + */ + +#ifndef ANT_HRM_SIMULATOR_LOCAL_H__ +#define ANT_HRM_SIMULATOR_LOCAL_H__ + +#include +#include +#include "bsp.h" +#include "ant_hrm.h" +#include "sensorsim.h" + +/** + * @ingroup ant_sdk_hrm_simulator + * @brief HRM simulator control block structure. */ +typedef struct +{ + bool auto_change; ///< Cadence will change automatically (if auto_change is set) or manually. + uint32_t time_since_last_hb; ///< Time since last heart beat occurred (integer part). + uint64_t fraction_since_last_hb; ///< Time since last heart beat occurred (fractional part). + sensorsim_state_t sensorsim_state; ///< State of the simulated sensor. + sensorsim_cfg_t sensorsim_cfg; ///< Configuration of the simulated sensor. +} ant_hrm_simulator_cb_t; + +#endif // ANT_HRM_SIMULATOR_LOCAL_H__ diff --git a/components/ant/ant_profiles/ant_hrm/utils/ant_hrm_utils.h b/components/ant/ant_profiles/ant_hrm/utils/ant_hrm_utils.h new file mode 100644 index 0000000..c14aa77 --- /dev/null +++ b/components/ant/ant_profiles/ant_hrm/utils/ant_hrm_utils.h @@ -0,0 +1,74 @@ +/* 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. + * + */ +#ifndef ANT_HRM_UTILS_H__ +#define ANT_HRM_UTILS_H__ + +#include "app_util.h" +#include "nrf_assert.h" +#include "nrf.h" + +/** @file + * + * @defgroup ant_sdk_profiles_hrm_utils Heart Rate Monitor profile utilities + * @{ + * @ingroup ant_sdk_profiles_hrm + * @brief This module implements utilities for the Heart Rate Monitor profile. + * + */ + +/**@brief Unit for HRM operating time. + * + * @details According to the ANT HRM specification, the operating time unit is 2 seconds. + */ +#define ANT_HRM_OPERATING_TIME_UNIT 2u + +/**@brief This macro should be used to get the seconds part of the operating time. + */ +#define ANT_HRM_OPERATING_SECONDS(OPERATING_TIME) (((OPERATING_TIME) * ANT_HRM_OPERATING_TIME_UNIT) % 60) + +/**@brief This macro should be used to get the minutes part of the operating time. + */ +#define ANT_HRM_OPERATING_MINUTES(OPERATING_TIME) ((((OPERATING_TIME) * ANT_HRM_OPERATING_TIME_UNIT) / 60) % 60) + +/**@brief This macro should be used to get the hours part of the operating time. + */ +#define ANT_HRM_OPERATING_HOURS(OPERATING_TIME) ((((OPERATING_TIME) * ANT_HRM_OPERATING_TIME_UNIT) / (60 * 60)) % 24) + +/**@brief This macro should be used to get the days part of the operating time. + */ +#define ANT_HRM_OPERATING_DAYS(OPERATING_TIME) ((((OPERATING_TIME) * ANT_HRM_OPERATING_TIME_UNIT) / (60 * 60)) / 24) + +/**@brief Number of HRM beat time counts per second. + * + * @details According to the ANT HRM specification, the beat time unit is 1/1024 of a second. + */ +#define ANT_HRM_BEAT_TIME_COUNTS_PER_SEC 1024u + +/**@brief Beat time display required precision. + * + * @details This value is used to decode the number of milliseconds. + */ +#define ANT_HRM_BEAT_TIME_PRECISION 1000u + +/**@brief This macro should be used to get the seconds part of the HRM beat time. + */ +#define ANT_HRM_BEAT_TIME_SEC(BEAT_TIME) ((BEAT_TIME) / ANT_HRM_BEAT_TIME_COUNTS_PER_SEC) + +/**@brief This macro should be used to get the milliseconds part of the HRM beat time. + */ +#define ANT_HRM_BEAT_TIME_MSEC(BEAT_TIME) (((((BEAT_TIME) % ANT_HRM_BEAT_TIME_COUNTS_PER_SEC) * ANT_HRM_BEAT_TIME_PRECISION) \ + + (ANT_HRM_BEAT_TIME_COUNTS_PER_SEC / 2)) \ + / ANT_HRM_BEAT_TIME_COUNTS_PER_SEC) +/** @} */ + +#endif // ANT_HRM_UTILS_H__ + diff --git a/components/ant/ant_profiles/ant_sdm/ant_sdm.c b/components/ant/ant_profiles/ant_sdm/ant_sdm.c new file mode 100644 index 0000000..53cbbce --- /dev/null +++ b/components/ant/ant_profiles/ant_sdm/ant_sdm.c @@ -0,0 +1,366 @@ +/* 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 "nrf_assert.h" +#include "app_error.h" +#include "ant_interface.h" +#include "app_util.h" +#include "ant_sdm.h" +#include "app_error.h" +#include "ant_sdm_page_logger.h" +#include "ant_sdm_utils.h" +#include "nordic_common.h" + +#define COMMON_DATA_INTERVAL 64 /**< Common data page is sent every 65th message. */ + +/**@brief SDM message data layout structure. */ +typedef struct +{ + ant_sdm_page_t page_number; + uint8_t page_payload[7]; +}ant_sdm_message_layout_t; + +/**@brief Function for initializing the ANT SDM profile instance. + * + * @param[in] p_profile Pointer to the profile instance. + * @param[in] p_channel_config Pointer to the ANT channel configuration structure. + * + * @retval NRF_SUCCESS Successful initialization. + * Error code when initialization failed. + */ +static ret_code_t ant_sdm_init(ant_sdm_profile_t * p_profile, + ant_channel_config_t const * p_channel_config) +{ + p_profile->channel_number = p_channel_config->channel_number; + + p_profile->page_1 = DEFAULT_ANT_SDM_PAGE1(); + p_profile->page_2 = DEFAULT_ANT_SDM_PAGE2(); + p_profile->page_3 = DEFAULT_ANT_SDM_PAGE3(); + p_profile->page_22 = DEFAULT_ANT_SDM_PAGE22(); + p_profile->common = DEFAULT_ANT_SDM_COMMON_DATA(); + p_profile->page_80 = DEFAULT_ANT_COMMON_page80(); + p_profile->page_81 = DEFAULT_ANT_COMMON_page81(); + + LOG_SDM("ANT SDM channel %u init\n\r", p_profile->channel_number); + return ant_channel_init(p_channel_config); +} + +ret_code_t ant_sdm_disp_init(ant_sdm_profile_t * p_profile, + ant_channel_config_t const * p_channel_config, + ant_sdm_disp_config_t const * p_disp_config) +{ + ASSERT(p_profile != NULL); + ASSERT(p_channel_config != NULL); + ASSERT(p_disp_config != NULL); + ASSERT(p_disp_config->p_cb != NULL); + ASSERT(p_disp_config->evt_handler != NULL); + + p_profile->evt_handler = p_disp_config->evt_handler; + p_profile->_cb.p_disp_cb = p_disp_config->p_cb; + ant_request_controller_init(&(p_profile->_cb.p_disp_cb->req_controller)); + + return ant_sdm_init(p_profile, p_channel_config); +} + +ret_code_t ant_sdm_sens_init(ant_sdm_profile_t * p_profile, + ant_channel_config_t const * p_channel_config, + ant_sdm_sens_config_t const * p_sens_config) +{ + ASSERT(p_profile != NULL); + ASSERT(p_channel_config != NULL); + ASSERT(p_sens_config != NULL); + ASSERT(p_sens_config->p_cb != NULL); + ASSERT(p_sens_config->evt_handler != NULL); + ASSERT(p_sens_config->supplementary_page_number == ANT_SDM_PAGE_1 + || p_sens_config->supplementary_page_number == ANT_SDM_PAGE_2 + || p_sens_config->supplementary_page_number == ANT_SDM_PAGE_3); + + p_profile->evt_handler = p_sens_config->evt_handler; + p_profile->_cb.p_sens_cb = p_sens_config->p_cb; + ant_request_controller_init(&(p_profile->_cb.p_sens_cb->req_controller)); + + p_profile->_cb.p_sens_cb->message_counter = 0; + p_profile->_cb.p_sens_cb->supp_page_control = 0; + p_profile->_cb.p_sens_cb->supp_page_number = p_sens_config->supplementary_page_number; + p_profile->_cb.p_sens_cb->common_page_number = ANT_SDM_PAGE_80; + + return ant_sdm_init(p_profile, p_channel_config); +} + +ret_code_t ant_sdm_page_request(ant_sdm_profile_t * p_profile, ant_common_page70_data_t * p_page_70) +{ + ASSERT(p_profile != NULL); + ASSERT(p_page_70 != NULL); + + uint32_t err_code = ant_request_controller_request(&(p_profile->_cb.p_disp_cb->req_controller), + p_profile->channel_number, p_page_70); + LOG_SDM("\n\r"); + + return err_code; +} + +/**@brief Function for getting next page number to send. + * + * @param[in] p_profile Pointer to the profile instance. + * + * @return Next page number. + */ +static ant_sdm_page_t next_page_number_get(ant_sdm_profile_t * p_profile) +{ + ant_sdm_sens_cb_t * p_sdm_cb = p_profile->_cb.p_sens_cb; + ant_sdm_page_t page_number; + + if (ant_request_controller_pending_get(&(p_sdm_cb->req_controller), (uint8_t *)&page_number)) + { + // No implementation needed + } + else if (p_sdm_cb->message_counter == (COMMON_DATA_INTERVAL)) + { + page_number = p_sdm_cb->common_page_number; + p_sdm_cb->message_counter++; + } + else if (p_sdm_cb->message_counter == (COMMON_DATA_INTERVAL + 1)) + { + page_number = p_sdm_cb->common_page_number; + p_sdm_cb->common_page_number = (p_sdm_cb->common_page_number == ANT_SDM_PAGE_80) + ? ANT_SDM_PAGE_81 : ANT_SDM_PAGE_80; + p_sdm_cb->message_counter = 0; + } + else + { + if (p_sdm_cb->supp_page_control) + { + page_number = p_sdm_cb->supp_page_number; + } + else + { + page_number = ANT_SDM_PAGE_1; + } + + if ((p_sdm_cb->message_counter % 2) == 1) + { + p_sdm_cb->supp_page_control = !p_sdm_cb->supp_page_control; + } + p_sdm_cb->message_counter++; + } + return page_number; +} + +/**@brief Function for encoding SDM message. + * + * @param[in] p_profile Pointer to the profile instance. + * @param[in] p_message_payload Pointer to the message payload. + * + * @note Assume to be call each time when Tx window will occur. + */ +static void sens_message_encode(ant_sdm_profile_t * p_profile, uint8_t * p_message_payload) +{ + ant_sdm_message_layout_t * p_sdm_message_payload = (ant_sdm_message_layout_t *)p_message_payload; + + p_sdm_message_payload->page_number = next_page_number_get(p_profile); + + LOG_SDM("SDM Page number %u\n\r", p_sdm_message_payload->page_number); + + switch (p_sdm_message_payload->page_number) + { + case ANT_SDM_PAGE_1: + ant_sdm_page_1_encode(p_sdm_message_payload->page_payload, &(p_profile->page_1), + &(p_profile->common)); + ant_sdm_speed_encode(p_sdm_message_payload->page_payload, &(p_profile->common)); + break; + + case ANT_SDM_PAGE_2: + ant_sdm_page_2_encode(p_sdm_message_payload->page_payload, &(p_profile->page_2)); + ant_sdm_speed_encode(p_sdm_message_payload->page_payload, &(p_profile->common)); + break; + + case ANT_SDM_PAGE_3: + ant_sdm_page_2_encode(p_sdm_message_payload->page_payload, &(p_profile->page_2)); + ant_sdm_page_3_encode(p_sdm_message_payload->page_payload, &(p_profile->page_3)); + ant_sdm_speed_encode(p_sdm_message_payload->page_payload, &(p_profile->common)); + break; + + case ANT_SDM_PAGE_16: + ant_sdm_page_16_encode(p_sdm_message_payload->page_payload, &(p_profile->common)); + break; + + case ANT_SDM_PAGE_22: + ant_sdm_page_22_encode(p_sdm_message_payload->page_payload, &(p_profile->page_22)); + break; + + case ANT_SDM_PAGE_80: + ant_common_page_80_encode(p_sdm_message_payload->page_payload, &(p_profile->page_80)); + break; + + case ANT_SDM_PAGE_81: + ant_common_page_81_encode(p_sdm_message_payload->page_payload, &(p_profile->page_81)); + break; + + default: + LOG_SDM("\r\n"); + return; + } + LOG_SDM("\r\n"); + + + p_profile->evt_handler(p_profile, (ant_sdm_evt_t)p_sdm_message_payload->page_number); +} + +void ant_sdm_sens_evt_handler(ant_sdm_profile_t * p_profile, ant_evt_t * p_ant_event) +{ + ASSERT(p_profile != NULL); + ASSERT(p_ant_event != NULL); + + if (p_ant_event->channel == p_profile->channel_number) + { + uint32_t err_code; + uint8_t p_message_payload[ANT_STANDARD_DATA_PAYLOAD_SIZE]; + ant_sdm_sens_cb_t * p_sdm_cb = p_profile->_cb.p_sens_cb; + ant_request_controller_sens_evt_handler(&(p_sdm_cb->req_controller), p_ant_event); + + switch (p_ant_event->event) + { + case EVENT_TX: + case EVENT_TRANSFER_TX_FAILED: + case EVENT_TRANSFER_TX_COMPLETED: + sens_message_encode(p_profile, p_message_payload); + if (ant_request_controller_ack_needed(&(p_sdm_cb->req_controller))) + { + err_code = sd_ant_acknowledge_message_tx(p_profile->channel_number, sizeof(p_message_payload), p_message_payload); + } + else + { + err_code = sd_ant_broadcast_message_tx(p_profile->channel_number, sizeof(p_message_payload), p_message_payload); + } + APP_ERROR_CHECK(err_code); + break; + default: + break; + } + } +} + +ret_code_t ant_sdm_disp_open(ant_sdm_profile_t * p_profile) +{ + ASSERT(p_profile != NULL); + + LOG_SDM("ANT SDM channel %u open\n\r", p_profile->channel_number); + return sd_ant_channel_open(p_profile->channel_number); +} + +ret_code_t ant_sdm_sens_open(ant_sdm_profile_t * p_profile) +{ + ASSERT(p_profile != NULL); + + // Fill tx buffer for the first frame + uint32_t err_code; + uint8_t p_message_payload[ANT_STANDARD_DATA_PAYLOAD_SIZE]; + + sens_message_encode(p_profile, p_message_payload); + err_code = + sd_ant_broadcast_message_tx(p_profile->channel_number, + sizeof (p_message_payload), + p_message_payload); + APP_ERROR_CHECK(err_code); + + LOG_SDM("ANT SDM channel %u open\n\r", p_profile->channel_number); + return sd_ant_channel_open(p_profile->channel_number); +} + + +/**@brief Function for decoding SDM message. + * + * @note Assume to be call each time when Rx window will occur. + */ +static void disp_message_decode(ant_sdm_profile_t * p_profile, uint8_t * p_message_payload) +{ + const ant_sdm_message_layout_t * p_sdm_message_payload = (ant_sdm_message_layout_t *)p_message_payload; + + LOG_SDM("SDM Page number %u\n\r", p_sdm_message_payload->page_number); + + switch (p_sdm_message_payload->page_number) + { + case ANT_SDM_PAGE_1: + ant_sdm_page_1_decode(p_sdm_message_payload->page_payload, &(p_profile->page_1), &(p_profile->common)); + ant_sdm_speed_decode(p_sdm_message_payload->page_payload, &(p_profile->common)); + break; + + case ANT_SDM_PAGE_3: + ant_sdm_page_3_decode(p_sdm_message_payload->page_payload, &(p_profile->page_3)); + /* fall through */ + case ANT_SDM_PAGE_2: + ant_sdm_page_2_decode(p_sdm_message_payload->page_payload, &(p_profile->page_2)); + ant_sdm_speed_decode(p_sdm_message_payload->page_payload, &(p_profile->common)); + break; + + case ANT_SDM_PAGE_16: + ant_sdm_page_16_decode(p_sdm_message_payload->page_payload, &(p_profile->common)); + break; + + case ANT_SDM_PAGE_22: + ant_sdm_page_22_decode(p_sdm_message_payload->page_payload, &(p_profile->page_22)); + break; + + case ANT_SDM_PAGE_80: + ant_common_page_80_decode(p_sdm_message_payload->page_payload, &(p_profile->page_80)); + break; + + case ANT_SDM_PAGE_81: + ant_common_page_81_decode(p_sdm_message_payload->page_payload, &(p_profile->page_81)); + break; + + default: + LOG_SDM("\n"); + return; + } + LOG_SDM("\n"); + + p_profile->evt_handler(p_profile, (ant_sdm_evt_t)p_sdm_message_payload->page_number); +} + +void ant_sdm_disp_evt_handler(ant_sdm_profile_t * p_profile, ant_evt_t * p_ant_event) +{ + ASSERT(p_profile != NULL); + ASSERT(p_ant_event != NULL); + + if (p_ant_event->channel == p_profile->channel_number) + { + ANT_MESSAGE * p_message = (ANT_MESSAGE *)p_ant_event->evt_buffer; + ant_sdm_disp_cb_t * p_sdm_cb = p_profile->_cb.p_disp_cb; + + switch (ant_request_controller_disp_evt_handler(&(p_sdm_cb->req_controller), p_ant_event)) + { + case ANT_REQUEST_CONTROLLER_SUCCESS: + p_profile->evt_handler(p_profile, ANT_SDM_PAGE_REQUEST_SUCCESS); + break; + case ANT_REQUEST_CONTROLLER_FAILED: + p_profile->evt_handler(p_profile, ANT_SDM_PAGE_REQUEST_FAILED); + break; + default: + break; + } + + switch (p_ant_event->event) + { + case EVENT_RX: + if (p_message->ANT_MESSAGE_ucMesgID == MESG_BROADCAST_DATA_ID + || p_message->ANT_MESSAGE_ucMesgID == MESG_ACKNOWLEDGED_DATA_ID + || p_message->ANT_MESSAGE_ucMesgID == MESG_BURST_DATA_ID) + { + disp_message_decode(p_profile, p_message->ANT_MESSAGE_aucPayload); + } + break; + default: + break; + } + } +} diff --git a/components/ant/ant_profiles/ant_sdm/ant_sdm.h b/components/ant/ant_profiles/ant_sdm/ant_sdm.h new file mode 100644 index 0000000..d9ee0b3 --- /dev/null +++ b/components/ant/ant_profiles/ant_sdm/ant_sdm.h @@ -0,0 +1,294 @@ +/* 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 ant_sdk_profiles_sdm Stride Based Speed and Distance Monitor profile + * @{ + * @ingroup ant_sdk_profiles + * @brief This module implements the Stride Based Speed and Distance Monitor profile. + * + */ + +#ifndef ANT_SDM_H__ +#define ANT_SDM_H__ + +#include +#include +#include "ant_parameters.h" +#include "ant_stack_handler_types.h" +#include "ant_channel_config.h" +#include "ant_request_controller.h" +#include "ant_sdm_pages.h" +#include "sdk_errors.h" + +#define SDM_DEVICE_TYPE 0x7Cu ///< Device type reserved for ANT+ SDM. +#define SDM_ANTPLUS_RF_FREQ 0x39u ///< Frequency, decimal 57 (2457 MHz). + +#define SDM_MSG_PERIOD_4Hz 0x1FC6u ///< Message period, decimal 8134 (4.03 Hz). +#define SDM_MSG_PERIOD_2Hz 0x3F8Cu ///< Message period, decimal 16268 (2.01 Hz). + +#define SDM_EXT_ASSIGN 0x00 ///< ANT ext assign (see Ext. Assign Channel Parameters in ant_parameters.h: @ref ant_parameters). +#define SDM_DISP_CHANNEL_TYPE CHANNEL_TYPE_SLAVE ///< RX SDM channel type. +#define SDM_SENS_CHANNEL_TYPE CHANNEL_TYPE_MASTER ///< TX SDM channel type. + +/**@brief Initialize an ANT channel configuration structure for the SDM profile (Display). + * + * @param[in] NAME Name of related instance. + * @param[in] CHANNEL_NUMBER Number of the channel assigned to the profile instance. + * @param[in] TRANSMISSION_TYPE Type of transmission assigned to the profile instance. + * @param[in] DEVICE_NUMBER Number of the device assigned to the profile instance. + * @param[in] NETWORK_NUMBER Number of the network assigned to the profile instance. + * @param[in] SDM_MSG_PERIOD Channel period in 32 kHz counts. The SDM profile supports only the following periods: + * @ref SDM_MSG_PERIOD_4Hz, @ref SDM_MSG_PERIOD_2Hz. + */ +#define SDM_DISP_CHANNEL_CONFIG_DEF(NAME, \ + CHANNEL_NUMBER, \ + TRANSMISSION_TYPE, \ + DEVICE_NUMBER, \ + NETWORK_NUMBER, \ + SDM_MSG_PERIOD) \ +static const ant_channel_config_t NAME##_channel_sdm_disp_config = \ + { \ + .channel_number = (CHANNEL_NUMBER), \ + .channel_type = SDM_DISP_CHANNEL_TYPE, \ + .ext_assign = SDM_EXT_ASSIGN, \ + .rf_freq = SDM_ANTPLUS_RF_FREQ, \ + .transmission_type = (TRANSMISSION_TYPE), \ + .device_type = SDM_DEVICE_TYPE, \ + .device_number = (DEVICE_NUMBER), \ + .channel_period = (SDM_MSG_PERIOD), \ + .network_number = (NETWORK_NUMBER), \ + } +#define SDM_DISP_CHANNEL_CONFIG(NAME) &NAME##_channel_sdm_disp_config + +/**@brief Initialize an ANT channel configuration structure for the SDM profile (Sensor). + * + * @param[in] NAME Name of related instance. + * @param[in] CHANNEL_NUMBER Number of the channel assigned to the profile instance. + * @param[in] TRANSMISSION_TYPE Type of transmission assigned to the profile instance. + * @param[in] DEVICE_NUMBER Number of the device assigned to the profile instance. + * @param[in] NETWORK_NUMBER Number of the network assigned to the profile instance. + */ +#define SDM_SENS_CHANNEL_CONFIG_DEF(NAME, \ + CHANNEL_NUMBER, \ + TRANSMISSION_TYPE, \ + DEVICE_NUMBER, \ + NETWORK_NUMBER) \ +static const ant_channel_config_t NAME##_channel_sdm_sens_config = \ + { \ + .channel_number = (CHANNEL_NUMBER), \ + .channel_type = SDM_SENS_CHANNEL_TYPE, \ + .ext_assign = SDM_EXT_ASSIGN, \ + .rf_freq = SDM_ANTPLUS_RF_FREQ, \ + .transmission_type = (TRANSMISSION_TYPE), \ + .device_type = SDM_DEVICE_TYPE, \ + .device_number = (DEVICE_NUMBER), \ + .channel_period = SDM_MSG_PERIOD_4Hz, \ + .network_number = (NETWORK_NUMBER), \ + } +#define SDM_SENS_CHANNEL_CONFIG(NAME) &NAME##_channel_sdm_sens_config + +/**@brief Initialize an ANT profile configuration structure for the SDM profile (Display). + * + * @param[in] NAME Name of related instance. + * @param[in] EVT_HANDLER Event handler to be called for handling events in the SDM profile. + */ +#define SDM_DISP_PROFILE_CONFIG_DEF(NAME, \ + EVT_HANDLER) \ +static ant_sdm_disp_cb_t NAME##_sdm_disp_cb; \ +static const ant_sdm_disp_config_t NAME##_profile_sdm_disp_config = \ + { \ + .p_cb = &NAME##_sdm_disp_cb, \ + .evt_handler = (EVT_HANDLER), \ + } +#define SDM_DISP_PROFILE_CONFIG(NAME) &NAME##_profile_sdm_disp_config + +/**@brief Initialize an ANT profile configuration structure for the SDM profile (Sensor). + * + * @param[in] NAME Name of related instance. + * @param[in] SUPPLEMENTARY_PAGE_NUMBER Supplementary data page (ANT_SDM_PAGE_2 or ANT_SDM_PAGE_3). Use ANT_SDM_PAGE_1 to disable. + * @param[in] EVT_HANDLER Event handler to be called for handling events in the SDM profile. + */ +#define SDM_SENS_PROFILE_CONFIG_DEF(NAME, \ + SUPPLEMENTARY_PAGE_NUMBER, \ + EVT_HANDLER) \ +static ant_sdm_sens_cb_t NAME##_sdm_sens_cb; \ +static const ant_sdm_sens_config_t NAME##_profile_sdm_sens_config = \ + { \ + .supplementary_page_number = (SUPPLEMENTARY_PAGE_NUMBER), \ + .p_cb = &NAME##_sdm_sens_cb, \ + .evt_handler = (EVT_HANDLER), \ + } +#define SDM_SENS_PROFILE_CONFIG(NAME) &NAME##_profile_sdm_sens_config + + +/**@brief SDM page number type. */ +typedef enum{ + ANT_SDM_PAGE_1 = 1, ///< Required data page 1. + ANT_SDM_PAGE_2 = 2, ///< Supplementary data page 2. + ANT_SDM_PAGE_3 = 3, ///< Supplementary data page 3. + ANT_SDM_PAGE_16 = 16, ///< Page 16 (sent on request). + ANT_SDM_PAGE_22 = 22, ///< Page 22 (sent on request). + ANT_SDM_PAGE_70 = ANT_COMMON_PAGE_70, + ANT_SDM_PAGE_80 = ANT_COMMON_PAGE_80, + ANT_SDM_PAGE_81 = ANT_COMMON_PAGE_81, +} ant_sdm_page_t; + +/**@brief SDM profile event type. */ +typedef enum{ + ANT_SDM_PAGE_1_UPDATED = ANT_SDM_PAGE_1, ///< Data page 1 and speed have been updated (Display) or sent (Sensor). + ANT_SDM_PAGE_2_UPDATED = ANT_SDM_PAGE_2, ///< Data page 2 and speed have been updated (Display) or sent (Sensor). + ANT_SDM_PAGE_3_UPDATED = ANT_SDM_PAGE_3, ///< Data page 3 and speed have been updated (Display) or sent (Sensor). + ANT_SDM_PAGE_16_UPDATED = ANT_SDM_PAGE_16, ///< Data page 16 has been updated (Display) or sent (Sensor). + ANT_SDM_PAGE_22_UPDATED = ANT_SDM_PAGE_22, ///< Data page 22 has been updated (Display) or sent (Sensor). + ANT_SDM_PAGE_80_UPDATED = ANT_SDM_PAGE_80, ///< Data page 80 has been updated (Display) or sent (Sensor). + ANT_SDM_PAGE_81_UPDATED = ANT_SDM_PAGE_81, ///< Data page 81 has been updated (Display) or sent (Sensor). + ANT_SDM_PAGE_REQUEST_SUCCESS, ///< Data page request reached the destination. + ANT_SDM_PAGE_REQUEST_FAILED, ///< Data page request did not reach the destination. +} ant_sdm_evt_t; + +// Forward declaration of the ant_sdm_profile_t type. +typedef struct ant_sdm_profile_s ant_sdm_profile_t; + +/**@brief SDM event handler type. */ +typedef void (* ant_sdm_evt_handler_t) (ant_sdm_profile_t *, ant_sdm_evt_t); + +#include "ant_sdm_local.h" + +/**@brief SDM Sensor configuration structure. */ +typedef struct +{ + ant_sdm_page_t supplementary_page_number; ///< Supplementary data page (ANT_SDM_PAGE_2 or ANT_SDM_PAGE_3). Use ANT_SDM_PAGE_1 to disable. + ant_sdm_sens_cb_t * p_cb; ///< Pointer to the data buffer for internal use. + ant_sdm_evt_handler_t evt_handler; ///< Event handler to be called for handling events in the SDM profile. +} ant_sdm_sens_config_t; + +/**@brief SDM Display configuration structure. */ +typedef struct +{ + ant_sdm_disp_cb_t * p_cb; ///< Pointer to the data buffer for internal use. + ant_sdm_evt_handler_t evt_handler; ///< Event handler to be called for handling events in the SDM profile. +} ant_sdm_disp_config_t; + +/**@brief SDM profile structure. */ +struct ant_sdm_profile_s +{ + uint8_t channel_number; ///< Channel number assigned to the profile. + union { + ant_sdm_disp_cb_t * p_disp_cb; + ant_sdm_sens_cb_t * p_sens_cb; + } _cb; ///< Pointer to internal control block. + ant_sdm_evt_handler_t evt_handler; ///< Event handler to be called for handling events in the SDM profile. + ant_sdm_page1_data_t page_1; ///< Page 1. + ant_sdm_page2_data_t page_2; ///< Page 2. + ant_sdm_page3_data_t page_3; ///< Page 3. + ant_sdm_page22_data_t page_22; ///< Page 22. + ant_common_page80_data_t page_80; ///< Page 80. + ant_common_page81_data_t page_81; ///< Page 81. + ant_sdm_common_data_t common; ///< SDM common data. +}; + +/** @name Defines for accessing ant_sdm_profile_t members variables +@{ */ +#define SDM_PROFILE_update_latency page_1.update_latency +#define SDM_PROFILE_time page_1.time +#define SDM_PROFILE_status page_2.status.items +#define SDM_PROFILE_cadence page_2.cadence +#define SDM_PROFILE_calories page_3.calories +#define SDM_PROFILE_capabilities page_22.capabilities.items +#define SDM_PROFILE_speed common.speed +#define SDM_PROFILE_distance common.distance +#define SDM_PROFILE_strides common.strides +#define SDM_PROFILE_hw_revision page_80.hw_revision +#define SDM_PROFILE_manufacturer_id page_80.manufacturer_id +#define SDM_PROFILE_model_number page_80.model_number +#define SDM_PROFILE_sw_revision_minor page_81.sw_revision_minor +#define SDM_PROFILE_sw_revision_major page_81.sw_revision_major +#define SDM_PROFILE_serial_number page_81.serial_number +/** @} */ + +/**@brief Function for initializing the ANT SDM RX profile instance. + * + * @param[in] p_profile Pointer to the profile instance. + * @param[in] p_channel_config Pointer to the ANT channel configuration structure. + * @param[in] p_disp_config Pointer to the SDM Display configuration structure. + * + * @retval NRF_SUCCESS If initialization was successful. Otherwise, an error code is returned. + */ +ret_code_t ant_sdm_disp_init(ant_sdm_profile_t * p_profile, + ant_channel_config_t const * p_channel_config, + ant_sdm_disp_config_t const * p_disp_config); + +/**@brief Function for initializing the ANT SDM TX profile instance. + * + * @param[in] p_profile Pointer to the profile instance. + * @param[in] p_channel_config Pointer to the ANT channel configuration structure. + * @param[in] p_sens_config Pointer to the SDM Sensor configuration structure. + * + * @retval NRF_SUCCESS If initialization was successful. Otherwise, an error code is returned. + */ +ret_code_t ant_sdm_sens_init(ant_sdm_profile_t * p_profile, + ant_channel_config_t const * p_channel_config, + ant_sdm_sens_config_t const * p_sens_config); + +/**@brief Function for opening the profile instance channel for ANT SDM Display. + * + * Before calling this function, pages should be configured. + * + * @param[in] p_profile Pointer to the profile instance. + * + * @retval NRF_SUCCESS If the channel was successfully opened. Otherwise, an error code is returned. + */ +ret_code_t ant_sdm_disp_open(ant_sdm_profile_t * p_profile); + +/**@brief Function for opening the profile instance channel for ANT SDM Sensor. + * + * Before calling this function, pages should be configured. + * + * @param[in] p_profile Pointer to the profile instance. + * + * @retval NRF_SUCCESS If the channel was successfully opened. Otherwise, an error code is returned. + */ +ret_code_t ant_sdm_sens_open(ant_sdm_profile_t * p_profile); + +/**@brief Function for sending a data page request. + * + * This function can be called only on the display side. + * + * @param[in] p_profile Pointer to the profile instance. + * @param[in] p_page_70 Pointer to the prepared page 70. + * + * @retval NRF_SUCCESS If the request has been sent. Otherwise, an error code is returned. + */ +ret_code_t ant_sdm_page_request(ant_sdm_profile_t * p_profile, ant_common_page70_data_t * p_page_70); + +/**@brief Function for handling the Sensor ANT events. + * + * @details This function handles all events from the ANT stack that are of interest to the SDM Sensor profile. + * + * @param[in] p_profile Pointer to the profile instance. + * @param[in] p_ant_event Event received from the ANT stack. + */ +void ant_sdm_sens_evt_handler(ant_sdm_profile_t * p_profile, ant_evt_t * p_ant_event); + +/**@brief Function for handling the Display ANT events. + * + * @details This function handles all events from the ANT stack that are of interest to the SDM Display profile. + * + * @param[in] p_profile Pointer to the profile instance. + * @param[in] p_ant_event Event received from the ANT stack. + */ +void ant_sdm_disp_evt_handler(ant_sdm_profile_t * p_profile, ant_evt_t * p_ant_event); + +#endif // ANT_SDM_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_sdm/ant_sdm_local.h b/components/ant/ant_profiles/ant_sdm/ant_sdm_local.h new file mode 100644 index 0000000..bb3e4d4 --- /dev/null +++ b/components/ant/ant_profiles/ant_sdm/ant_sdm_local.h @@ -0,0 +1,46 @@ +/* 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. + * + */ + + +#ifndef ANT_SDM_LOCAL_H__ +#define ANT_SDM_LOCAL_H__ + +#include +#include +#include "ant_sdm.h" + +/** + * @addtogroup ant_sdk_profiles_sdm + * @{ + */ + +/** @brief SDM Display control block. */ +typedef struct +{ + ant_request_controller_t req_controller; +}ant_sdm_disp_cb_t; + +/**@brief SDM Sensor control block. */ +typedef struct +{ + uint8_t supp_page_control; + ant_sdm_page_t supp_page_number; + ant_sdm_page_t common_page_number; + uint8_t message_counter; + ant_request_controller_t req_controller; +}ant_sdm_sens_cb_t; + +/** + * @} + */ + +#endif // ANT_SDM_LOCAL_H__ diff --git a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_common_data.c b/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_common_data.c new file mode 100644 index 0000000..6c7e65f --- /dev/null +++ b/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_common_data.c @@ -0,0 +1,65 @@ +/* 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 "ant_sdm_common_data.h" +#include "ant_sdm_utils.h" +#include "ant_sdm_page_logger.h" +#include "nordic_common.h" + +/**@brief SDM common page data layout structure. */ +typedef struct +{ + uint8_t reserved0[3]; + uint8_t speed_integer :4; + uint8_t reserved1 :4; + uint8_t speed_fractional; + uint8_t reserved2[2]; +}ant_sdm_speed_data_layout_t; + +/**@brief Function for tracing common data. + * + * @param[in] p_common_data Pointer to the common data. + */ +static void speed_data_log(ant_sdm_common_data_t const * p_common_data) +{ + uint32_t speed = ANT_SDM_SPEED_RESCALE(p_common_data->speed); + UNUSED_VARIABLE(speed); + + LOG_SPEED("Speed %u.%02u m/s\n\r", + (unsigned int)(speed / ANT_SDM_SPEED_DISP_PRECISION), + (unsigned int)(speed % ANT_SDM_SPEED_DISP_PRECISION)); +} + +void ant_sdm_speed_encode(uint8_t * p_page_buffer, + ant_sdm_common_data_t const * p_common_data) +{ + ant_sdm_speed_data_layout_t * p_outcoming_data = (ant_sdm_speed_data_layout_t *)p_page_buffer; + uint16_t speed = p_common_data->speed; + + p_outcoming_data->speed_integer = speed / ANT_SDM_SPEED_UNIT_REVERSAL; + p_outcoming_data->speed_fractional = speed % ANT_SDM_SPEED_UNIT_REVERSAL; + + speed_data_log(p_common_data); +} + +void ant_sdm_speed_decode(uint8_t const * p_page_buffer, + ant_sdm_common_data_t * p_common_data) +{ + ant_sdm_speed_data_layout_t const * p_incoming_data = (ant_sdm_speed_data_layout_t *)p_page_buffer; + uint16_t speed = (p_incoming_data->speed_integer + * ANT_SDM_SPEED_UNIT_REVERSAL) + + p_incoming_data->speed_fractional; + + p_common_data->speed = speed; + + speed_data_log(p_common_data); +} diff --git a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_common_data.h b/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_common_data.h new file mode 100644 index 0000000..8b0be4e --- /dev/null +++ b/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_common_data.h @@ -0,0 +1,67 @@ +/* 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. + * + */ + +#ifndef ANT_SDM_COMMON_DATA_H__ +#define ANT_SDM_COMMON_DATA_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_sdm_common_data_page Stride Based Speed and Distance Monitor profile common data + * @{ + * @ingroup ant_sdk_profiles_sdm_pages + */ + +#include + +/**@brief Data structure for SDM common data. + * + * @details This structure stores data that is not associated with a particular page. + */ +typedef struct +{ + uint16_t speed; ///< Actual speed. + uint32_t distance; ///< Accumulated distance. + uint32_t strides; ///< Accumulated strides. +} ant_sdm_common_data_t; + +/**@brief Initialize common data. + */ +#define DEFAULT_ANT_SDM_COMMON_DATA() \ + (ant_sdm_common_data_t) \ + { \ + .speed = 0, \ + .distance = 0, \ + .strides = 0, \ + } + +/**@brief Function for encoding speed. + * + * This function can be used for pages 2 and 3. + * + * @param[in] p_common_data Pointer to the common data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_sdm_speed_encode(uint8_t * p_page_buffer, + ant_sdm_common_data_t const * p_common_data); + +/**@brief Function for decoding speed. + * + * This function can be used for pages 2 and 3. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_common_data Pointer to the common data. + */ +void ant_sdm_speed_decode(uint8_t const * p_page_buffer, + ant_sdm_common_data_t * p_common_data); + +#endif // ANT_SDM_COMMON_DATA_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_1.c b/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_1.c new file mode 100644 index 0000000..51a60ef --- /dev/null +++ b/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_1.c @@ -0,0 +1,108 @@ +/* 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 "ant_sdm_page_1.h" +#include "ant_sdm_utils.h" +#include "ant_sdm_page_logger.h" + +/**@brief SDM page 1 data layout structure. */ +typedef struct +{ + uint8_t time_fractional; + uint8_t time_integer; + uint8_t distance_integer; + uint8_t reserved0 : 4; + uint8_t distance_fractional : 4; + uint8_t reserved1; + uint8_t strides; + uint8_t update_latency; +}ant_sdm_page1_data_layout_t; + +STATIC_ASSERT(ANT_SDM_UPDATE_LATENCY_DISP_PRECISION == 1000); ///< Display format need to be updated +STATIC_ASSERT(ANT_SDM_TIME_DISP_PRECISION == 1000); ///< Display format need to be updated +STATIC_ASSERT(ANT_SDM_DISTANCE_DISP_PRECISION == 10); ///< Display format need to be updated + +/**@brief Function for tracing page 1 and common data. + * + * @param[in] p_common_data Pointer to the common data. + * @param[in] p_page_data Pointer to the page 1 data. + */ +static void page_1_data_log(ant_sdm_page1_data_t const * p_page_data, + ant_sdm_common_data_t const * p_common_data) +{ +#ifdef TRACE_SDM_PAGE_1_ENABLE + uint32_t strides = p_common_data->strides; + uint64_t distance = ANT_SDM_DISTANCE_RESCALE(p_common_data->distance); + uint16_t update_latency = ANT_SDM_UPDATE_LATENCY_RESCALE(p_page_data->update_latency); + uint32_t time = ANT_SDM_TIME_RESCALE(p_page_data->time); +#endif // TRACE_SDM_PAGE_1_ENABLE + + LOG_PAGE1("Update latency %u.%03u s\n\r", + update_latency / ANT_SDM_UPDATE_LATENCY_DISP_PRECISION, + update_latency % ANT_SDM_UPDATE_LATENCY_DISP_PRECISION); + LOG_PAGE1("Time %u.%03u s\n\r", + (unsigned int)(time / ANT_SDM_TIME_DISP_PRECISION), + (unsigned int)(time % ANT_SDM_TIME_DISP_PRECISION)); + LOG_PAGE1("Distance %u.%01um \n\r", + (unsigned int)(distance / ANT_SDM_DISTANCE_DISP_PRECISION), + (unsigned int)(distance % ANT_SDM_DISTANCE_DISP_PRECISION)); + LOG_PAGE1("Strides %u\n\r", (unsigned int)strides); +} + + +void ant_sdm_page_1_encode(uint8_t * p_page_buffer, + ant_sdm_page1_data_t const * p_page_data, + ant_sdm_common_data_t const * p_common_data) +{ + ant_sdm_page1_data_layout_t * p_outcoming_data = (ant_sdm_page1_data_layout_t *)p_page_buffer; + uint32_t distance = p_common_data->distance; + uint16_t time = p_page_data->time; + + p_outcoming_data->time_fractional = time % ANT_SDM_TIME_UNIT_REVERSAL; + p_outcoming_data->time_integer = time / ANT_SDM_TIME_UNIT_REVERSAL; + p_outcoming_data->distance_integer = + (UINT8_MAX & (distance / ANT_SDM_DISTANCE_UNIT_REVERSAL)); // Only LSB + p_outcoming_data->distance_fractional = distance % ANT_SDM_DISTANCE_UNIT_REVERSAL; + p_outcoming_data->strides = (UINT8_MAX & p_common_data->strides); // Only LSB + p_outcoming_data->update_latency = p_page_data->update_latency; + + page_1_data_log(p_page_data, p_common_data); +} + + +void ant_sdm_page_1_decode(uint8_t const * p_page_buffer, + ant_sdm_page1_data_t * p_page_data, + ant_sdm_common_data_t * p_common_data) +{ + ant_sdm_page1_data_layout_t const * p_incoming_data = + (ant_sdm_page1_data_layout_t *)p_page_buffer; + + uint16_t distance = p_incoming_data->distance_integer * ANT_SDM_DISTANCE_UNIT_REVERSAL + + p_incoming_data->distance_fractional; + uint16_t time = p_incoming_data->time_integer * ANT_SDM_TIME_UNIT_REVERSAL + + p_incoming_data->time_fractional; + + uint8_t prev_strides = p_common_data->strides; + + p_common_data->strides += ((p_incoming_data->strides - prev_strides) & UINT8_MAX); + + uint16_t prev_distance = p_common_data->distance; + p_common_data->distance += ((distance - prev_distance) & 0xFFF); + + p_page_data->update_latency = p_incoming_data->update_latency; + p_page_data->time = time; + p_page_data->strides = p_incoming_data->strides; + + page_1_data_log(p_page_data, p_common_data); +} + + diff --git a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_1.h b/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_1.h new file mode 100644 index 0000000..5bcd9d2 --- /dev/null +++ b/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_1.h @@ -0,0 +1,65 @@ +/* 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. + * + */ + +#ifndef ANT_SDM_PAGE_1_H__ +#define ANT_SDM_PAGE_1_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_sdm_page1 Stride Based Speed and Distance Monitor profile page 1 + * @{ + * @ingroup ant_sdk_profiles_sdm_pages + */ + +#include +#include "ant_sdm_common_data.h" + +/**@brief Data structure for SDM data page 1. + */ +typedef struct +{ + uint8_t update_latency; ///< Update latency. + uint8_t strides; ///< Strides (writing to this field has no effect). + uint16_t time; ///< Time. +} ant_sdm_page1_data_t; + +/**@brief Initialize page 1. + */ +#define DEFAULT_ANT_SDM_PAGE1() \ + (ant_sdm_page1_data_t) \ + { \ + .update_latency = 0, \ + .time = 0, \ + } + +/**@brief Function for encoding page 1. + * + * @param[in] p_page_data Pointer to the page data. + * @param[in] p_common_data Pointer to the common data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_sdm_page_1_encode(uint8_t * p_page_buffer, + ant_sdm_page1_data_t const * p_page_data, + ant_sdm_common_data_t const * p_common_data); + +/**@brief Function for decoding page 1. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + * @param[out] p_common_data Pointer to the common data. + */ +void ant_sdm_page_1_decode(uint8_t const * p_page_buffer, + ant_sdm_page1_data_t * p_page_data, + ant_sdm_common_data_t * p_common_data); + +#endif // ANT_SDM_PAGE_1_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_16.c b/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_16.c new file mode 100644 index 0000000..b9a1d34 --- /dev/null +++ b/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_16.c @@ -0,0 +1,68 @@ +/* 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 "ant_sdm_page_16.h" +#include "ant_sdm_utils.h" +#include "nordic_common.h" +#include "ant_sdm_page_logger.h" + +/**@brief SDM page 16 data layout structure. */ +typedef struct +{ + uint8_t strides[3]; + uint8_t distance[4]; +}ant_sdm_page16_data_layout_t; + +STATIC_ASSERT(ANT_SDM_DISTANCE_DISP_PRECISION == 10); ///< Display format need to be updated + +/**@brief Function for tracing common data. + * + * @param[in] p_common_data Pointer to the common data. + */ +static void page_16_data_log(ant_sdm_common_data_t const * p_common_data) +{ +#ifdef TRACE_SDM_PAGE_16_ENABLE + uint64_t distance = ANT_SDM_DISTANCE_RESCALE(p_common_data->distance); +#endif // TRACE_SDM_PAGE_16_ENABLE + + LOG_PAGE16("Distance %u.%01u m\n\r", + (unsigned int)(distance / ANT_SDM_DISTANCE_DISP_PRECISION), + (unsigned int)(distance % ANT_SDM_DISTANCE_DISP_PRECISION)); + LOG_PAGE16("Strides %u\n\r", (unsigned int)p_common_data->strides); +} + + +void ant_sdm_page_16_encode(uint8_t * p_page_buffer, + ant_sdm_common_data_t const * p_common_data) +{ + ant_sdm_page16_data_layout_t * p_outcoming_data = (ant_sdm_page16_data_layout_t *)p_page_buffer; + + UNUSED_PARAMETER(uint24_encode(p_common_data->strides, p_outcoming_data->strides)); + UNUSED_PARAMETER(uint32_encode(p_common_data->distance << 4, p_outcoming_data->distance)); + + page_16_data_log(p_common_data); +} + + +void ant_sdm_page_16_decode(uint8_t const * p_page_buffer, + ant_sdm_common_data_t * p_common_data) +{ + ant_sdm_page16_data_layout_t const * p_incoming_data = + (ant_sdm_page16_data_layout_t *)p_page_buffer; + + p_common_data->strides = uint24_decode(p_incoming_data->strides); + p_common_data->distance = uint32_decode(p_incoming_data->distance) >> 4; + + page_16_data_log(p_common_data); +} + + diff --git a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_16.h b/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_16.h new file mode 100644 index 0000000..11aa653 --- /dev/null +++ b/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_16.h @@ -0,0 +1,43 @@ +/* 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. + * + */ + +#ifndef ANT_SDM_PAGE_16_H__ +#define ANT_SDM_PAGE_16_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_sdm_page16 Stride Based Speed and Distance Monitor profile page 16 + * @{ + * @ingroup ant_sdk_profiles_sdm_pages + */ + +#include +#include "ant_sdm_common_data.h" + +/**@brief Function for encoding page 16. + * + * @param[in] p_common_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_sdm_page_16_encode(uint8_t * p_page_buffer, + ant_sdm_common_data_t const * p_common_data); + +/**@brief Function for decoding page 16. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_common_data Pointer to the page data. + */ +void ant_sdm_page_16_decode(uint8_t const * p_page_buffer, + ant_sdm_common_data_t * p_common_data); + +#endif // ANT_SDM_PAGE_16_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_2.c b/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_2.c new file mode 100644 index 0000000..2e11a94 --- /dev/null +++ b/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_2.c @@ -0,0 +1,91 @@ +/* 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 "ant_sdm_page_2.h" +#include "ant_sdm_utils.h" +#include "ant_sdm_page_logger.h" + +/**@brief SDM page 2 data layout structure. */ +typedef struct +{ + uint8_t reserved0[2]; + uint8_t cadence_integer; + uint8_t reserved1 : 4; + uint8_t cadence_fractional : 4; + uint8_t reserved2; + uint8_t reserved3; + uint8_t status; +}ant_sdm_page2_data_layout_t; + +/**@brief Function for page 2 data. + * + * @param[in] p_common_data Pointer to the page 2 data. + */ +static void page_2_data_log(ant_sdm_page2_data_t const * p_page_data) +{ +#ifdef TRACE_SDM_PAGE_2_ENABLE + static const char * p_location[4] = {"Laces", "Midsole", "Other", "Ankle"}; + static const char * p_battery[4] = {"New", "Good", "OK", "Low"}; + static const char * p_health[4] = {"OK", "Error", "Warning", ""}; + static const char * p_state[4] = {"Inactive", "Active", "", ""}; + + uint16_t cadence = ANT_SDM_CADENCE_RESCALE(p_page_data->cadence); +#endif // TRACE_SDM_PAGE_2_ENABLE + + LOG_PAGE2("Status: state: %s\n\r", + p_state[p_page_data->status.items.state]); + LOG_PAGE2(" health: %s\n\r", + p_health[p_page_data->status.items.health]); + LOG_PAGE2(" battery: %s\n\r", + p_battery[p_page_data->status.items.battery]); + LOG_PAGE2(" location: %s\n\r", + p_location[p_page_data->status.items.location]); + LOG_PAGE2("Cadence %u.%01u strides/min\n\r", + cadence / ANT_SDM_CADENCE_DISP_PRECISION, + cadence % ANT_SDM_CADENCE_DISP_PRECISION); +} + + +void ant_sdm_page_2_encode(uint8_t * p_page_buffer, + ant_sdm_page2_data_t const * p_page_data) +{ + ant_sdm_page2_data_layout_t * p_outcoming_data = (ant_sdm_page2_data_layout_t *)p_page_buffer; + uint8_t status = p_page_data->status.byte; + uint16_t cadence = p_page_data->cadence; + + p_outcoming_data->reserved0[0] = UINT8_MAX; + p_outcoming_data->reserved0[1] = UINT8_MAX; + p_outcoming_data->cadence_integer = cadence / ANT_SDM_CADENCE_UNIT_REVERSAL; + p_outcoming_data->cadence_fractional = cadence % ANT_SDM_CADENCE_UNIT_REVERSAL; + p_outcoming_data->reserved3 = UINT8_MAX; + p_outcoming_data->status = status; + page_2_data_log(p_page_data); +} + + +void ant_sdm_page_2_decode(uint8_t const * p_page_buffer, + ant_sdm_page2_data_t * p_page_data) +{ + ant_sdm_page2_data_layout_t const * p_incoming_data = + (ant_sdm_page2_data_layout_t *)p_page_buffer; + + uint8_t status = p_incoming_data->status; + uint16_t cadence = p_incoming_data->cadence_integer * ANT_SDM_CADENCE_UNIT_REVERSAL + + p_incoming_data->cadence_fractional; + + p_page_data->cadence = cadence; + p_page_data->status.byte = status; + + page_2_data_log(p_page_data); +} + + diff --git a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_2.h b/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_2.h new file mode 100644 index 0000000..26f5bff --- /dev/null +++ b/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_2.h @@ -0,0 +1,93 @@ +/* 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. + * + */ + +#ifndef ANT_SDM_PAGE_2_H__ +#define ANT_SDM_PAGE_2_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_sdm_page2 Stride Based Speed and Distance Monitor profile page 2 + * @{ + * @ingroup ant_sdk_profiles_sdm_pages + */ + +#include + +/**@brief Data structure for SDM data page 2. + */ +typedef struct +{ + union + { + struct + { + enum + { + ANT_SDM_USE_STATE_INACTIVE = 0x00, + ANT_SDM_USE_STATE_ACTIVE = 0x01, + ANT_SDM_STATE_RESERVED0 = 0x02, + ANT_SDM_STATE_RESERVED1 = 0x03, + } state : 2; ///< Use state. + enum + { + ANT_SDM_HEALTH_OK = 0x00, + ANT_SDM_HEALTH_ERROR = 0x01, + ANT_SDM_HEALTH_WARNING = 0x02, + ANT_SDM_HEALTH_RESERVED = 0x03, + } health : 2; ///< SDM health. + enum + { + ANT_SDM_BATTERY_STATUS_NEW = 0x00, + ANT_SDM_BATTERY_STATUS_GOOD = 0x01, + ANT_SDM_BATTERY_STATUS_OK = 0x02, + ANT_SDM_BATTERY_STATUS_LOW = 0x03, + } battery : 2; ///< Battery status. + enum + { + ANT_SDM_LOCATION_LACES = 0x00, + ANT_SDM_LOCATION_MIDSOLE = 0x01, + ANT_SDM_LOCATION_OTHER = 0x02, + ANT_SDM_LOCATION_ANKLE = 0x03, + } location : 2; ///< Location of the SDM sensor. + } items; + uint8_t byte; + } status; ///< Actual status. + uint16_t cadence; ///< Actual cadence. +} ant_sdm_page2_data_t; + +/**@brief Initialize page 2. + */ +#define DEFAULT_ANT_SDM_PAGE2() \ + (ant_sdm_page2_data_t) \ + { \ + .status.byte = 0, \ + .cadence = 0, \ + } + +/**@brief Function for encoding page 2. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_sdm_page_2_encode(uint8_t * p_page_buffer, + ant_sdm_page2_data_t const * p_page_data); + +/**@brief Function for decoding page 2. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_sdm_page_2_decode(uint8_t const * p_page_buffer, + ant_sdm_page2_data_t * p_page_data); + +#endif // ANT_SDM_PAGE_2_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_22.c b/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_22.c new file mode 100644 index 0000000..4aee44a --- /dev/null +++ b/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_22.c @@ -0,0 +1,89 @@ +/* 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 "ant_sdm_page_22.h" +#include "ant_sdm_utils.h" +#include "ant_sdm_page_logger.h" + +/**@brief SDM page 22 data layout structure. */ +typedef struct +{ + uint8_t capabilities; + uint8_t reserved[6]; +}ant_sdm_page22_data_layout_t; + +/**@brief Function for tracing page 22 data. + * + * @param[in] p_page_data Pointer to the page 22 data. + */ +static void page_22_data_log(ant_sdm_page22_data_t const * p_page_data) +{ + LOG_PAGE22("Capabilities: "); + + if (p_page_data->capabilities.items.time_is_valid) + { + LOG_PAGE22(" time"); + } + + if (p_page_data->capabilities.items.distance_is_valid) + { + LOG_PAGE22(" distance"); + } + + if (p_page_data->capabilities.items.speed_is_valid) + { + LOG_PAGE22(" speed"); + } + + if (p_page_data->capabilities.items.latency_is_valid) + { + LOG_PAGE22(" latency"); + } + + if (p_page_data->capabilities.items.cadency_is_valid) + { + LOG_PAGE22(" cadency"); + } + + if (p_page_data->capabilities.items.calorie_is_valid) + { + LOG_PAGE22(" calorie"); + } + LOG_PAGE22("\n\r"); +} + + +void ant_sdm_page_22_encode(uint8_t * p_page_buffer, + ant_sdm_page22_data_t const * p_page_data) +{ + ant_sdm_page22_data_layout_t * p_outcoming_data = (ant_sdm_page22_data_layout_t *)p_page_buffer; + + p_outcoming_data->capabilities = p_page_data->capabilities.byte; + memset(p_outcoming_data->reserved, UINT8_MAX, sizeof (p_outcoming_data->reserved)); + + page_22_data_log(p_page_data); +} + + +void ant_sdm_page_22_decode(uint8_t const * p_page_buffer, + ant_sdm_page22_data_t * p_page_data) +{ + ant_sdm_page22_data_layout_t const * p_incoming_data = + (ant_sdm_page22_data_layout_t *)p_page_buffer; + + p_page_data->capabilities.byte = p_incoming_data->capabilities; + + page_22_data_log(p_page_data); +} + + diff --git a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_22.h b/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_22.h new file mode 100644 index 0000000..9e0aaa4 --- /dev/null +++ b/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_22.h @@ -0,0 +1,70 @@ +/* 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. + * + */ + +#ifndef ANT_SDM_PAGE_22_H__ +#define ANT_SDM_PAGE_22_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_sdm_page22 Stride Based Speed and Distance Monitor profile page 22 + * @{ + * @ingroup ant_sdk_profiles_sdm_pages + */ + +#include +#include + +/**@brief Data structure for SDM data page 22. + */ +typedef struct +{ + union + { + struct + { + bool time_is_valid : 1; ///< Transmitted time is valid. + bool distance_is_valid : 1; ///< Transmitted distance is valid. + bool speed_is_valid : 1; ///< Transmitted speed is valid. + bool latency_is_valid : 1; ///< Transmitted latency is valid. + bool cadency_is_valid : 1; ///< Transmitted cadency is valid. + bool calorie_is_valid : 1; ///< Transmitted calorie is valid. + } items; + uint8_t byte; + } capabilities; +} ant_sdm_page22_data_t; + +/**@brief Initialize page 2. + */ +#define DEFAULT_ANT_SDM_PAGE22() \ + (ant_sdm_page22_data_t) \ + { \ + .capabilities.byte = 0, \ + } + +/**@brief Function for encoding page 22. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_sdm_page_22_encode(uint8_t * p_page_buffer, + ant_sdm_page22_data_t const * p_page_data); + +/**@brief Function for decoding page 22. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_sdm_page_22_decode(uint8_t const * p_page_buffer, + ant_sdm_page22_data_t * p_page_data); + +#endif // ANT_SDM_PAGE_22_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_3.c b/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_3.c new file mode 100644 index 0000000..276b144 --- /dev/null +++ b/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_3.c @@ -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. + * + */ + +#include "ant_sdm_page_3.h" +#include "ant_sdm_utils.h" +#include "ant_sdm_page_logger.h" + +/**@brief SDM page 3 data layout structure. */ +typedef struct +{ + uint8_t reserved0[5]; + uint8_t calories; + uint8_t reserved1; +}ant_sdm_page3_data_layout_t; + +static void page_3_data_log(ant_sdm_page3_data_t const * p_page_data) +{ + LOG_PAGE3("Calories: %u\n\r", p_page_data->calories); +} + + +void ant_sdm_page_3_encode(uint8_t * p_page_buffer, + ant_sdm_page3_data_t const * p_page_data) +{ + ant_sdm_page3_data_layout_t * p_outcoming_data = (ant_sdm_page3_data_layout_t *)p_page_buffer; + + p_outcoming_data->calories = p_page_data->calories; + page_3_data_log(p_page_data); +} + + +void ant_sdm_page_3_decode(uint8_t const * p_page_buffer, + ant_sdm_page3_data_t * p_page_data) +{ + ant_sdm_page3_data_layout_t const * p_incoming_data = + (ant_sdm_page3_data_layout_t *)p_page_buffer; + + p_page_data->calories = p_incoming_data->calories; + + page_3_data_log(p_page_data); +} + + diff --git a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_3.h b/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_3.h new file mode 100644 index 0000000..658987d --- /dev/null +++ b/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_page_3.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef ANT_SDM_PAGE_3_H__ +#define ANT_SDM_PAGE_3_H__ + +/** @file + * + * @defgroup ant_sdk_profiles_sdm_page3 Stride Based Speed and Distance Monitor profile page 3 + * @{ + * @ingroup ant_sdk_profiles_sdm_pages + */ + +#include + +/**@brief Data structure for SDM data page 3. + */ +typedef struct +{ + uint8_t calories; ///< Calories. +} ant_sdm_page3_data_t; + +/**@brief Initialize page 3. + */ +#define DEFAULT_ANT_SDM_PAGE3() \ + (ant_sdm_page3_data_t) \ + { \ + .calories = 0, \ + } + +/**@brief Function for encoding page 3. + * + * @param[in] p_page_data Pointer to the page data. + * @param[out] p_page_buffer Pointer to the data buffer. + */ +void ant_sdm_page_3_encode(uint8_t * p_page_buffer, + ant_sdm_page3_data_t const * p_page_data); + +/**@brief Function for decoding page 3. + * + * @param[in] p_page_buffer Pointer to the data buffer. + * @param[out] p_page_data Pointer to the page data. + */ +void ant_sdm_page_3_decode(uint8_t const * p_page_buffer, + ant_sdm_page3_data_t * p_page_data); + +#endif // ANT_SDM_PAGE_3_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_pages.h b/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_pages.h new file mode 100644 index 0000000..eba992a --- /dev/null +++ b/components/ant/ant_profiles/ant_sdm/pages/ant_sdm_pages.h @@ -0,0 +1,34 @@ +/* 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. + * + */ + +#ifndef __ANT_SDM_PAGES_H +#define __ANT_SDM_PAGES_H + +/** @file + * + * @defgroup ant_sdk_profiles_sdm_pages Stride Based Speed and Distance Monitor profile pages + * @{ + * @ingroup ant_sdk_profiles_sdm + * @brief This module implements functions for the SDM data pages. + */ + +#include "ant_sdm_page_1.h" +#include "ant_sdm_page_2.h" +#include "ant_sdm_page_3.h" +#include "ant_sdm_page_16.h" +#include "ant_sdm_page_22.h" +#include "ant_sdm_common_data.h" +#include "ant_common_page_70.h" +#include "ant_common_page_80.h" +#include "ant_common_page_81.h" +#endif // __ANT_SDM_PAGES_H +/** @} */ diff --git a/components/ant/ant_profiles/ant_sdm/pages/logger/ant_sdm_page_logger.h b/components/ant/ant_profiles/ant_sdm/pages/logger/ant_sdm_page_logger.h new file mode 100644 index 0000000..898f7a4 --- /dev/null +++ b/components/ant/ant_profiles/ant_sdm/pages/logger/ant_sdm_page_logger.h @@ -0,0 +1,65 @@ +/* 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. + * + */ + +#ifndef ANT_SDM_PAGE_LOGGER_H__ +#define ANT_SDM_PAGE_LOGGER_H__ + +#ifdef TRACE_SDM_GENERAL_ENABLE +#include "app_trace.h" +#define LOG_SDM app_trace_log +#else +#define LOG_SDM(...) +#endif // TRACE_SDM_GENERAL_ENABLE + +#ifdef TRACE_SDM_PAGE_1_ENABLE +#include "app_trace.h" +#define LOG_PAGE1 app_trace_log +#else +#define LOG_PAGE1(...) +#endif // TRACE_SDM_PAGE_1_ENABLE + +#ifdef TRACE_SDM_PAGE_2_ENABLE +#include "app_trace.h" +#define LOG_PAGE2 app_trace_log +#else +#define LOG_PAGE2(...) +#endif // TRACE_SDM_PAGE_2_ENABLE + +#ifdef TRACE_SDM_PAGE_3_ENABLE +#include "app_trace.h" +#define LOG_PAGE3 app_trace_log +#else +#define LOG_PAGE3(...) +#endif // TRACE_SDM_PAGE_3_ENABLE + +#ifdef TRACE_SDM_PAGE_16_ENABLE +#include "app_trace.h" +#define LOG_PAGE16 app_trace_log +#else +#define LOG_PAGE16(...) +#endif // TRACE_SDM_PAGE_16_ENABLE + +#ifdef TRACE_SDM_PAGE_22_ENABLE +#include "app_trace.h" +#define LOG_PAGE22 app_trace_log +#else +#define LOG_PAGE22(...) +#endif // TRACE_SDM_PAGE_22_ENABLE + +#if (defined TRACE_SDM_PAGE_2_ENABLE) || (defined TRACE_SDM_PAGE_3_ENABLE) +#include "app_trace.h" +#define LOG_SPEED app_trace_log +#else +#define LOG_SPEED(...) +#endif // (defined TRACE_SDM_PAGE_2_ENABLE) || (defined TRACE_SDM_PAGE_3_ENABLE) + +#endif // ANT_SDM_PAGE_LOGGER_H__ diff --git a/components/ant/ant_profiles/ant_sdm/simulator/ant_sdm_simulator.c b/components/ant/ant_profiles/ant_sdm/simulator/ant_sdm_simulator.c new file mode 100644 index 0000000..37c98d9 --- /dev/null +++ b/components/ant/ant_profiles/ant_sdm/simulator/ant_sdm_simulator.c @@ -0,0 +1,130 @@ +/* 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 "ant_sdm_simulator.h" +#include "ant_sdm_utils.h" +#include "nordic_common.h" + +#define SIMULATOR_STRIDE_LENGTH_UNIT_REVERSAL 100 ///< Stride length unit is cm. +#define SIMULATOR_BURN_RATE_UNIT 1000 ///< Burn rate uinit is kcal per km. +#define SIMULATOR_TIME_INCREMENT SDM_MSG_PERIOD_4Hz ///< Ticks between two cycles. +#define SIMULATOR_TIME_UNIT_REVERSAL ANT_CLOCK_FREQUENCY ///< Simulation time frequency. +#define SEC_PER_MIN 60 ///< Number of seconds per minute. +#define SIMULATOR_STRIDE_UNIT_REVERSAL (SIMULATOR_TIME_UNIT_REVERSAL * \ + ANT_SDM_CADENCE_UNIT_REVERSAL * SEC_PER_MIN) + + +void ant_sdm_simulator_init(ant_sdm_simulator_t * p_simulator, + ant_sdm_simulator_cfg_t const * p_config, + bool auto_change) +{ + p_simulator->p_profile = p_config->p_profile; + p_simulator->_cb.stride_length = p_config->stride_length; + p_simulator->_cb.burn_rate = p_config->burn_rate; + p_simulator->_cb.sensorsim_cfg = p_config->sensorsim_cfg; + p_simulator->_cb.auto_change = auto_change; + p_simulator->_cb.sensorsim_state.current_val = p_simulator->_cb.sensorsim_cfg.min; + p_simulator->_cb.stride_incr = 0; + p_simulator->_cb.time = 0; + + + sensorsim_init(&(p_simulator->_cb.sensorsim_state), &(p_simulator->_cb.sensorsim_cfg)); +} + + +void ant_sdm_simulator_one_iteration(ant_sdm_simulator_t * p_simulator) +{ + if (p_simulator->_cb.auto_change) + { + UNUSED_PARAMETER(sensorsim_measure(&(p_simulator->_cb.sensorsim_state), + &(p_simulator->_cb.sensorsim_cfg))); + } + + p_simulator->_cb.time += SIMULATOR_TIME_INCREMENT; + + p_simulator->_cb.stride_incr += p_simulator->_cb.sensorsim_state.current_val * + SIMULATOR_TIME_INCREMENT; + p_simulator->p_profile->SDM_PROFILE_strides += p_simulator->_cb.stride_incr / + SIMULATOR_STRIDE_UNIT_REVERSAL; + p_simulator->_cb.stride_incr = p_simulator->_cb.stride_incr % + SIMULATOR_STRIDE_UNIT_REVERSAL; + + + uint32_t distance = value_rescale( + p_simulator->p_profile->SDM_PROFILE_strides * p_simulator->_cb.stride_length, + SIMULATOR_STRIDE_LENGTH_UNIT_REVERSAL, + ANT_SDM_DISTANCE_UNIT_REVERSAL); + + if (p_simulator->p_profile->SDM_PROFILE_capabilities.cadency_is_valid) + { + p_simulator->p_profile->SDM_PROFILE_cadence = p_simulator->_cb.sensorsim_state.current_val; + } + + if (p_simulator->p_profile->SDM_PROFILE_capabilities.speed_is_valid) + { + p_simulator->p_profile->SDM_PROFILE_speed = value_rescale( + p_simulator->_cb.sensorsim_state.current_val * p_simulator->_cb.stride_length, + ANT_SDM_CADENCE_UNIT_REVERSAL * SIMULATOR_STRIDE_LENGTH_UNIT_REVERSAL * SEC_PER_MIN, + ANT_SDM_SPEED_UNIT_REVERSAL); + } + + if (p_simulator->p_profile->SDM_PROFILE_capabilities.distance_is_valid) + { + p_simulator->p_profile->SDM_PROFILE_distance = distance; + } + + if (p_simulator->p_profile->SDM_PROFILE_capabilities.calorie_is_valid) + { + p_simulator->p_profile->SDM_PROFILE_calories = value_rescale(distance, + SIMULATOR_BURN_RATE_UNIT + * ANT_SDM_DISTANCE_UNIT_REVERSAL, + p_simulator->_cb.burn_rate); + } + + if (p_simulator->p_profile->SDM_PROFILE_capabilities.time_is_valid) + { + p_simulator->p_profile->SDM_PROFILE_time = value_rescale(p_simulator->_cb.time, + SIMULATOR_TIME_UNIT_REVERSAL, + ANT_SDM_TIME_UNIT_REVERSAL); + } + + if (p_simulator->p_profile->SDM_PROFILE_capabilities.latency_is_valid) + { + p_simulator->p_profile->SDM_PROFILE_update_latency = + ROUNDED_DIV(((uint64_t)p_simulator->_cb.stride_incr * + ANT_SDM_UPDATE_LATENCY_UNIT_REVERSAL), + (uint64_t)SIMULATOR_TIME_UNIT_REVERSAL * + p_simulator->_cb.sensorsim_state.current_val); + } +} + + +void ant_sdm_simulator_increment(ant_sdm_simulator_t * p_simulator) +{ + if (!p_simulator->_cb.auto_change) + { + sensorsim_increment(&(p_simulator->_cb.sensorsim_state), + &(p_simulator->_cb.sensorsim_cfg)); + } +} + + +void ant_sdm_simulator_decrement(ant_sdm_simulator_t * p_simulator) +{ + if (!p_simulator->_cb.auto_change) + { + sensorsim_decrement(&(p_simulator->_cb.sensorsim_state), + &(p_simulator->_cb.sensorsim_cfg)); + } +} + + diff --git a/components/ant/ant_profiles/ant_sdm/simulator/ant_sdm_simulator.h b/components/ant/ant_profiles/ant_sdm/simulator/ant_sdm_simulator.h new file mode 100644 index 0000000..5d95e13 --- /dev/null +++ b/components/ant/ant_profiles/ant_sdm/simulator/ant_sdm_simulator.h @@ -0,0 +1,104 @@ +/* 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. + * + */ + +#ifndef ANT_SDM_SIMULATOR_H__ +#define ANT_SDM_SIMULATOR_H__ + +/** @file + * + * @defgroup ant_sdk_sdm_simulator ANT SDM simulator + * @{ + * @ingroup ant_sdk_simulators + * @brief ANT SDM simulator module. + * + * @details This module simulates strides for the ANT SDM profile. The module calculates + * abstract values, which are handled by the SDM pages data model to ensure that they are + * compatible. It provides a handler for changing the cadence value manually and functionality + * for changing the cadence automatically. + * + */ + +#include +#include +#include "bsp.h" +#include "ant_sdm.h" +#include "ant_sdm_utils.h" +#include "sensorsim.h" +#include "ant_sdm_simulator_local.h" + +/**@brief SDM simulator configuration structure. */ +typedef struct +{ + ant_sdm_profile_t * p_profile; ///< Related profile. + uint32_t stride_length; ///< Length of a stride in cm. + uint32_t burn_rate; ///< Kcal per kilometer. + sensorsim_cfg_t sensorsim_cfg; ///< Sensorsim configuration. +} ant_sdm_simulator_cfg_t; + +/**@brief Initialize @ref ant_sdm_simulator_cfg_t. + */ +#define DEFAULT_ANT_SDM_SIMULATOR_CFG(P_PROFILE, \ + STRIDE_LEN, \ + BURN_RATE, \ + MIN_CADENCE, \ + MAX_CADENCE, \ + INCREMENT) \ + { \ + .p_profile = (P_PROFILE), \ + .stride_length = (STRIDE_LEN), \ + .burn_rate = (BURN_RATE), \ + .sensorsim_cfg.min = (MIN_CADENCE) *(ANT_SDM_CADENCE_UNIT_REVERSAL), \ + .sensorsim_cfg.max = (MAX_CADENCE) *(ANT_SDM_CADENCE_UNIT_REVERSAL), \ + .sensorsim_cfg.incr = (INCREMENT) *(ANT_SDM_CADENCE_UNIT_REVERSAL), \ + .sensorsim_cfg.start_at_max = false, \ + } + +/**@brief SDM simulator structure. */ +typedef struct +{ + ant_sdm_profile_t * p_profile; ///< Related profile. + ant_sdm_simulator_cb_t _cb; ///< Internal control block. +} ant_sdm_simulator_t; + + +/**@brief Function for initializing the ANT SDM simulator instance. + * + * @param[in] p_simulator Pointer to the simulator instance. + * @param[in] p_config Pointer to the simulator configuration structure. + * @param[in] auto_change Enable or disable automatic changes of the cadence. + */ +void ant_sdm_simulator_init(ant_sdm_simulator_t * p_simulator, + ant_sdm_simulator_cfg_t const * p_config, + bool auto_change); + +/**@brief Function for simulating a device event. + * + * @details Based on this event, the transmitter data is simulated. + * + * This function should be called in the SDM TX event handler. + */ +void ant_sdm_simulator_one_iteration(ant_sdm_simulator_t * p_simulator); + +/**@brief Function for incrementing the cadence value. + * + * @param[in] p_simulator Pointer to the simulator instance. + */ +void ant_sdm_simulator_increment(ant_sdm_simulator_t * p_simulator); + +/**@brief Function for decrementing the cadence value. + * + * @param[in] p_simulator Pointer to the simulator instance. + */ +void ant_sdm_simulator_decrement(ant_sdm_simulator_t * p_simulator); + +#endif // ANT_SDM_SIMULATOR_H__ +/** @} */ diff --git a/components/ant/ant_profiles/ant_sdm/simulator/ant_sdm_simulator_local.h b/components/ant/ant_profiles/ant_sdm/simulator/ant_sdm_simulator_local.h new file mode 100644 index 0000000..6b6d8c3 --- /dev/null +++ b/components/ant/ant_profiles/ant_sdm/simulator/ant_sdm_simulator_local.h @@ -0,0 +1,36 @@ +/* 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. + * + */ + +#ifndef ANT_SDM_SIMULATOR_LOCAL_H__ +#define ANT_SDM_SIMULATOR_LOCAL_H__ + +#include +#include +#include "bsp.h" +#include "ant_sdm.h" +#include "sensorsim.h" + +/** + * @ingroup ant_sdk_sdm_simulator + * @brief SDM simulator control block structure. */ +typedef struct +{ + bool auto_change; ///< Cadence will change automatically (if auto_change is set) or manually. + uint8_t stride_length; ///< Length of a stride (in cm). + uint8_t burn_rate; ///< Kcal per kilometer. + uint32_t stride_incr; ///< Fractional part of stride increment. + uint64_t time; ///< Simulation time. + sensorsim_state_t sensorsim_state; ///< State of the simulated sensor. + sensorsim_cfg_t sensorsim_cfg; ///< Configuration of the simulated sensor. +}ant_sdm_simulator_cb_t; + +#endif // ANT_SDM_SIMULATOR_LOCAL_H__ diff --git a/components/ant/ant_profiles/ant_sdm/utils/ant_sdm_utils.h b/components/ant/ant_profiles/ant_sdm/utils/ant_sdm_utils.h new file mode 100644 index 0000000..be14b64 --- /dev/null +++ b/components/ant/ant_profiles/ant_sdm/utils/ant_sdm_utils.h @@ -0,0 +1,77 @@ +/* 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. + * + */ + +#ifndef ANT_SDM_UTILS_H__ +#define ANT_SDM_UTILS_H__ + +#include "app_util.h" +#include "nrf_assert.h" +#include "nrf.h" + +/** @file + * + * @defgroup ant_sdk_profiles_sdm_utils Stride Based Speed and Distance Monitor profile utilities + * @{ + * @ingroup ant_sdk_profiles_sdm + * @brief This module implements utilities for the Stride Based Speed and Distance Monitor profile. + * + */ + +/*@brief A reversal of time unit. + * + * @details According to the ANT SDM specification, the time unit (fractional part) is 1/200 of a second. + */ +#define ANT_SDM_TIME_UNIT_REVERSAL 200 +#define ANT_SDM_TIME_DISP_PRECISION 1000 +#define ANT_SDM_TIME_RESCALE(VALUE) value_rescale((VALUE), ANT_SDM_TIME_UNIT_REVERSAL, \ + ANT_SDM_TIME_DISP_PRECISION) + +/*@brief A reversal of distance unit. + * + * @details According to the ANT SDM specification, the distance unit (page 1 - fractional part) is 1/16 of a meter. + */ +#define ANT_SDM_DISTANCE_UNIT_REVERSAL 16 +#define ANT_SDM_DISTANCE_DISP_PRECISION 10 +#define ANT_SDM_DISTANCE_RESCALE(VALUE) value_rescale((VALUE), ANT_SDM_DISTANCE_UNIT_REVERSAL, \ + ANT_SDM_DISTANCE_DISP_PRECISION) + +/*@brief A reversal of speed unit. + * + * @details According to the ANT SDM specification, the speed unit (fractional part) is 1/256 of m/s. + */ +#define ANT_SDM_SPEED_UNIT_REVERSAL 256 +#define ANT_SDM_SPEED_DISP_PRECISION 100 +#define ANT_SDM_SPEED_RESCALE(VALUE) value_rescale((VALUE), ANT_SDM_SPEED_UNIT_REVERSAL, \ + ANT_SDM_SPEED_DISP_PRECISION) + +/*@brief A reversal of update latency unit. + * + * @details According to the ANT SDM specification, the update latency unit (fractional part) is 1/32 of a second. + */ +#define ANT_SDM_UPDATE_LATENCY_UNIT_REVERSAL 32 +#define ANT_SDM_UPDATE_LATENCY_DISP_PRECISION 1000 +#define ANT_SDM_UPDATE_LATENCY_RESCALE(VALUE) value_rescale((VALUE), ANT_SDM_UPDATE_LATENCY_UNIT_REVERSAL, \ + ANT_SDM_UPDATE_LATENCY_DISP_PRECISION) + +/*@brief A reversal of cadence unit. + * + * @details According to the ANT SDM specification, the cadence unit (fractional part) is 1/16 of strides/minute. + */ +#define ANT_SDM_CADENCE_UNIT_REVERSAL 16 +#define ANT_SDM_CADENCE_DISP_PRECISION 10 +#define ANT_SDM_CADENCE_RESCALE(VALUE) value_rescale((VALUE), ANT_SDM_CADENCE_UNIT_REVERSAL, \ + ANT_SDM_CADENCE_DISP_PRECISION) + +/** @} */ + +#endif // ANT_SDM_UTILS_H__ + diff --git a/components/ant/ant_search_config/ant_search_config.c b/components/ant/ant_search_config/ant_search_config.c new file mode 100644 index 0000000..ecf583c --- /dev/null +++ b/components/ant/ant_search_config/ant_search_config.c @@ -0,0 +1,58 @@ +/* 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 "ant_search_config.h" +#include "ant_interface.h" +#include "nrf_error.h" + +uint32_t ant_search_init(ant_search_config_t const * p_config) +{ + uint32_t err_code; + + if (p_config->low_priority_timeout == ANT_LOW_PRIORITY_SEARCH_DISABLE + && p_config->high_priority_timeout == ANT_HIGH_PRIORITY_SEARCH_DISABLE) + { + return NRF_ERROR_INVALID_PARAM; + } + + err_code = sd_ant_search_channel_priority_set(p_config->channel_number, + p_config->search_priority); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + err_code = sd_ant_search_waveform_set(p_config->channel_number, + p_config->waveform); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + err_code = sd_ant_channel_rx_search_timeout_set(p_config->channel_number, + p_config->high_priority_timeout); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + err_code = sd_ant_channel_low_priority_rx_search_timeout_set(p_config->channel_number, + p_config->low_priority_timeout); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + err_code = sd_ant_active_search_sharing_cycles_set(p_config->channel_number, + p_config->search_sharing_cycles); + return err_code; +} diff --git a/components/ant/ant_search_config/ant_search_config.h b/components/ant/ant_search_config/ant_search_config.h new file mode 100644 index 0000000..a830609 --- /dev/null +++ b/components/ant/ant_search_config/ant_search_config.h @@ -0,0 +1,82 @@ +#ifndef ANT_SEARCH_CONFIG_H__ +#define ANT_SEARCH_CONFIG_H__ + +/** @file + * + * @defgroup ant_sdk_search_config ANT search configuration + * @{ + * @ingroup ant_sdk_utils + * @brief ANT channel search configuration module. + */ + +#include +#include "ant_parameters.h" + +#define ANT_SEARCH_SHARING_CYCLES_DISABLE 0x00 ///< Disable search sharing. + +#define ANT_LOW_PRIORITY_SEARCH_DISABLE 0x00 ///< Disable low priority search. +#define ANT_LOW_PRIORITY_TIMEOUT_DISABLE 0xFF ///< Disable low priority search time-out. +#define ANT_DEFAULT_LOW_PRIORITY_TIMEOUT 0x02 ///< Default low priority search time-out. + +#define ANT_HIGH_PRIORITY_SEARCH_DISABLE 0x00 ///< Disable high priority search. +#define ANT_HIGH_PRIORITY_TIMEOUT_DISABLE 0xFF ///< Disable high priority search time-out. +#define ANT_DEFAULT_HIGH_PRIORITY_TIMEOUT 0x0A ///< Default high priority search time-out. + +/**@brief Search priority. */ +typedef enum +{ + ANT_SEARCH_PRIORITY_DEFAULT = 0, ///< Default search priority level. + ANT_SEARCH_PRIORITY_LOWEST = ANT_SEARCH_PRIORITY_DEFAULT, ///< Lowest search priority level. + ANT_SEARCH_PRIORITY_0 = ANT_SEARCH_PRIORITY_LOWEST, + ANT_SEARCH_PRIORITY_1 = 1, + ANT_SEARCH_PRIORITY_2 = 2, + ANT_SEARCH_PRIORITY_3 = 3, + ANT_SEARCH_PRIORITY_4 = 4, + ANT_SEARCH_PRIORITY_5 = 5, + ANT_SEARCH_PRIORITY_6 = 6, + ANT_SEARCH_PRIORITY_7 = 7, + ANT_SEARCH_PRIORITY_HIGHEST = ANT_SEARCH_PRIORITY_7, ///< Highest search priority level. +} ant_search_priority_t; + +/**@brief ANT search waveform. */ +typedef enum +{ + ANT_WAVEFORM_DEFAULT = 316, ///< Standard search waveform value. + ANT_WAVEFORM_FAST = 97, ///< Accelerated search waveform value. +} ant_waveform_t; + +/**@brief ANT search configuration structure. */ +typedef struct +{ + uint8_t channel_number; ///< Assigned channel number. + uint8_t low_priority_timeout; ///< Low priority time-out (in 2.5 second increments). + uint8_t high_priority_timeout; ///< High priority time-out (in 2.5 second increments). + uint8_t search_sharing_cycles; ///< Number of search cycles to run before alternating searches. Search sharing can be disabled by @ref ANT_SEARCH_SHARING_CYCLES_DISABLE. + ant_search_priority_t search_priority; ///< Search priority. + ant_waveform_t waveform; ///< Search waveform. Do not use custom values. +} ant_search_config_t; + +/**@brief Initializes the default ANT search configuration structure. + * + * @param[in] CHANNEL_NUMBER Number of the channel. + */ +#define DEFAULT_ANT_SEARCH_CONFIG(CHANNEL_NUMBER) \ +{ \ + .channel_number = CHANNEL_NUMBER, \ + .low_priority_timeout = ANT_DEFAULT_LOW_PRIORITY_TIMEOUT, \ + .high_priority_timeout = ANT_DEFAULT_HIGH_PRIORITY_TIMEOUT, \ + .search_sharing_cycles = ANT_SEARCH_SHARING_CYCLES_DISABLE, \ + .search_priority = ANT_SEARCH_PRIORITY_DEFAULT, \ + .waveform = ANT_WAVEFORM_DEFAULT, \ +} + +/**@brief Function for configuring the ANT channel search. + * + * @param[in] p_config Pointer to the search configuration structure. + * + * @retval NRF_SUCCESS If the channel was successfully configured. Otherwise, an error code is returned. + */ +uint32_t ant_search_init(ant_search_config_t const * p_config); + +#endif // ANT_SEARCH_CONFIG_H__ +/** @} */ diff --git a/components/ant/ant_stack_config/ant_stack_config.c b/components/ant/ant_stack_config/ant_stack_config.c new file mode 100644 index 0000000..71abf59 --- /dev/null +++ b/components/ant/ant_stack_config/ant_stack_config.c @@ -0,0 +1,48 @@ +/* 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 "nrf_assert.h" +#include "ant_stack_config.h" +#include "ant_interface.h" +#include "ant_parameters.h" +// The header below should be provided by a project. +// At least ANT_CONFIG_TOTAL_CHANNELS_ALLOCATED and ANT_CONFIG_ENCRYPTED_CHANNELS must be defined. +#include "ant_stack_config_defs.h" + +#ifndef ANT_CONFIG_BURST_QUEUE_SIZE + #define ANT_CONFIG_BURST_QUEUE_SIZE 128 // legacy tx burst buffer queue size 128 B +#endif + + +#define ANT_BUFFER_SIZE_FOR_SD ANT_ENABLE_GET_REQUIRED_SPACE(ANT_CONFIG_TOTAL_CHANNELS_ALLOCATED, ANT_CONFIG_ENCRYPTED_CHANNELS, ANT_CONFIG_BURST_QUEUE_SIZE) + +static union +{ + uint8_t u8[ANT_BUFFER_SIZE_FOR_SD]; + uint32_t u32[1]; // force allign to uint32_t +}ant_stack_buffer; /*!< Memory buffer provided in order to support channel configuration */ + +uint32_t ant_stack_static_config(void) +{ + ASSERT(ANT_CONFIG_TOTAL_CHANNELS_ALLOCATED <= MAX_ANT_CHANNELS); + ASSERT(ANT_CONFIG_ENCRYPTED_CHANNELS <= ANT_CONFIG_TOTAL_CHANNELS_ALLOCATED); + + ANT_ENABLE m_ant_enable_cfg = + { + .ucTotalNumberOfChannels = ANT_CONFIG_TOTAL_CHANNELS_ALLOCATED, + .ucNumberOfEncryptedChannels = ANT_CONFIG_ENCRYPTED_CHANNELS, + .pucMemoryBlockStartLocation = ant_stack_buffer.u8, + .usMemoryBlockByteSize = ANT_BUFFER_SIZE_FOR_SD + }; + + return sd_ant_enable(&m_ant_enable_cfg); +} diff --git a/components/ant/ant_stack_config/ant_stack_config.h b/components/ant/ant_stack_config/ant_stack_config.h new file mode 100644 index 0000000..8abdecb --- /dev/null +++ b/components/ant/ant_stack_config/ant_stack_config.h @@ -0,0 +1,45 @@ +/* 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. + * + */ + +#ifndef ANT_STACK_CONFIG_H__ +#define ANT_STACK_CONFIG_H__ + +#include + +/** + * @file + */ + +/** + * @defgroup ant_stack_config ANT stack configuration + * @{ + * @ingroup ant_sdk_utils + * @brief Configuration of resources used in the ANT stack. + * + * This module initializes the stack according to the configuration of the ANT channels. + */ + +/** + * @brief Function for configuring and enabling the ANT stack. + * @details The function sets the channel configuration for the stack using the parameters provided + * in the ant_stack_config_defs.h file. It also assigns a correspondingly large buffer + * as static resource. + * + * @return A SoftDevice error code. + */ +uint32_t ant_stack_static_config(void); + +/** + * @} + */ + +#endif // ANT_STACK_CONFIG_H__ diff --git a/components/ant/ant_stack_config/config/ant_stack_config_defs.h b/components/ant/ant_stack_config/config/ant_stack_config_defs.h new file mode 100644 index 0000000..d36578e --- /dev/null +++ b/components/ant/ant_stack_config/config/ant_stack_config_defs.h @@ -0,0 +1,20 @@ +/* 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. + * + */ + +#ifndef ANT_STACK_CONFIG_DEFS_H__ +#define ANT_STACK_CONFIG_DEFS_H__ + +#define ANT_CONFIG_TOTAL_CHANNELS_ALLOCATED 0 +#define ANT_CONFIG_ENCRYPTED_CHANNELS 0 +#define ANT_CONFIG_BURST_QUEUE_SIZE 128 + +#endif // ANT_STACK_CONFIG_DEFS_H__ diff --git a/components/ant/ant_state_indicator/ant_state_indicator.c b/components/ant/ant_state_indicator/ant_state_indicator.c new file mode 100644 index 0000000..3499737 --- /dev/null +++ b/components/ant/ant_state_indicator/ant_state_indicator.c @@ -0,0 +1,129 @@ +/* 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 "ant_parameters.h" +#include "bsp.h" +#include "ant_state_indicator.h" +#include "app_error.h" +#include "bsp_btn_ant.h" +#include "nrf_soc.h" + +/** + * @addtogroup ant_sdk_state_indicator ANT channel state indicator module. + * @{ + */ + +static uint8_t m_related_channel; ///< ANT channel number linked to indication +static uint8_t m_channel_type; ///< type of linked ANT channel + + +void ant_state_indicator_init( uint8_t channel, uint8_t channel_type) +{ + m_related_channel = channel; + m_channel_type = channel_type; + + uint32_t err_code = bsp_indication_set(BSP_INDICATE_IDLE); + APP_ERROR_CHECK(err_code); +} + + +uint32_t ant_state_indicator_channel_opened(void) +{ + uint32_t err_code = NRF_SUCCESS; + + switch (m_channel_type) + { + case CHANNEL_TYPE_SLAVE: + err_code = bsp_indication_set(BSP_INDICATE_SCANNING); + break; + + case CHANNEL_TYPE_SLAVE_RX_ONLY: + err_code = bsp_indication_set(BSP_INDICATE_SCANNING); + break; + + case CHANNEL_TYPE_MASTER: + err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING); + break; + } + + return err_code; +} + + +void ant_state_indicator_evt_handler(ant_evt_t * p_ant_evt) +{ + uint32_t err_code = NRF_SUCCESS; + + if (m_related_channel != p_ant_evt->channel) + return; + + switch (m_channel_type) + { + case CHANNEL_TYPE_SLAVE: + case CHANNEL_TYPE_SLAVE_RX_ONLY: + switch (p_ant_evt->event) + { + case EVENT_RX: + err_code = bsp_indication_set(BSP_INDICATE_CONNECTED); + break; + + case EVENT_RX_FAIL: + err_code = bsp_indication_set(BSP_INDICATE_RCV_ERROR); + break; + + case EVENT_RX_FAIL_GO_TO_SEARCH: + err_code = bsp_indication_set(BSP_INDICATE_SCANNING); + break; + + case EVENT_CHANNEL_CLOSED: + err_code = bsp_indication_set(BSP_INDICATE_IDLE); + ant_state_indicator_sleep_mode_enter(); + break; + + case EVENT_RX_SEARCH_TIMEOUT: + err_code = bsp_indication_set(BSP_INDICATE_IDLE); + break; + } + break; + + case CHANNEL_TYPE_MASTER: + switch (p_ant_evt->event) + { + case EVENT_TX: + break; + } + break; + } + APP_ERROR_CHECK(err_code); +} + + +void ant_state_indicator_sleep_mode_enter(void) +{ + uint32_t err_code = bsp_indication_set(BSP_INDICATE_IDLE); + APP_ERROR_CHECK(err_code); + + // Prepare wakeup buttons. + err_code = bsp_btn_ant_sleep_mode_prepare(); + APP_ERROR_CHECK(err_code); + + // Go to system-off mode (this function will not return; wakeup will cause a reset). + err_code = sd_power_system_off(); + for (;;) + { + // Infinite loop after sd_power_system_off for emulated System OFF. + } +} + +/** + *@} + */ diff --git a/components/ant/ant_state_indicator/ant_state_indicator.h b/components/ant/ant_state_indicator/ant_state_indicator.h new file mode 100644 index 0000000..d991a1b --- /dev/null +++ b/components/ant/ant_state_indicator/ant_state_indicator.h @@ -0,0 +1,65 @@ +#ifndef __ANT_STATE_INDICATOR_H +#define __ANT_STATE_INDICATOR_H + +/** @file + * + * @defgroup ant_sdk_state_indicator ANT channel state indicator + * @{ + * @ingroup ant_sdk_utils + * @brief ANT channel state indicator module. + * + * @details This module provides functionality for indicating the ANT channel state. + */ + +#include +#include "ant_stack_handler_types.h" + + +/** + * @brief Function for initializing the ANT channel state indicator. + * + * @details This function links the signaling procedure with a specific ANT channel. + * + * Before calling this function, you must initiate the @ref lib_bsp to be able to use the LEDs. + * + * @param[in] channel ANT channel number. + * @param[in] channel_type ANT channel type (see Assign Channel Parameters in ant_parameters.h: @ref ant_parameters). + */ +void ant_state_indicator_init( uint8_t channel, uint8_t channel_type); + + +/** + * @brief Function for handling ANT events. + * + * @details This function handles all events from the ANT stack that are of interest to the channel state indicator. + * This function should always be called when an ANT event occurs. + * + * @param[in] p_ant_evt Event received from the ANT stack. + */ +void ant_state_indicator_evt_handler(ant_evt_t * p_ant_evt); + + +/** + * @brief Function for indicating the channel opening. + * + * @details This function should be called after the opening of the channel. + * + * @retval NRF_SUCCESS If the state was successfully indicated. + * @retval NRF_ERROR_NO_MEM If the internal timer operations queue was full. + * @retval NRF_ERROR_INVALID_STATE If the application timer module has not been initialized + * or the internal timer has not been created. + */ +uint32_t ant_state_indicator_channel_opened(void); + + +/**@brief Function for putting the chip into sleep mode. + * + * @details This function sets up a wakeup button and puts the chip into deep sleep mode. + * + * @note This function will not return. + */ +void ant_state_indicator_sleep_mode_enter(void); + + +#endif +/** @} */ diff --git a/components/ble/ble_advertising/ble_advertising.c b/components/ble/ble_advertising/ble_advertising.c new file mode 100644 index 0000000..1760166 --- /dev/null +++ b/components/ble/ble_advertising/ble_advertising.c @@ -0,0 +1,553 @@ +/* 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 "ble_advdata.h" +#include "ble_advertising.h" +#include "nrf_soc.h" +#include "app_trace.h" +#include "nordic_common.h" +#include "pstorage.h" + + +#define LOG app_trace_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; + + if((p_advdata == NULL) || p_config == NULL) + { + return NRF_ERROR_NULL; + } + 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; +} + + +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; + + uint32_t count = 0; + + // Verify if there are any pending flash operations. If so, delay starting advertising until + // the flash operations are complete. + err_code = pstorage_access_status_get(&count); + if (err_code == NRF_ERROR_INVALID_STATE) + { + // Pstorage is not initialized, i.e. not in use. + count = 0; + } + else if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (count != 0) + { + m_advertising_start_pending = true; + return NRF_SUCCESS; + } + + // 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_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: + 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: + 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); + if(err_code != NRF_SUCCESS) + { + return err_code; + } + + m_adv_evt = BLE_ADV_EVT_FAST_WHITELIST; + LOG("[ADV]: Starting fast advertisement with whitelist.\r\n"); + } + else + { + m_adv_evt = BLE_ADV_EVT_FAST; + 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); + if(err_code != NRF_SUCCESS) + { + return err_code; + } + + m_adv_evt = BLE_ADV_EVT_SLOW_WHITELIST; + LOG("[ADV]: Starting slow advertisement with whitelist.\r\n"); + } + else + { + m_adv_evt = BLE_ADV_EVT_SLOW; + 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); + if(err_code != NRF_SUCCESS) + { + return 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 (defined(S130) || defined(S132)) + 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; + } +#else + current_slave_link_conn_handle = p_ble_evt->evt.gap_evt.conn_handle; +#endif + 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: + 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: + 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; + 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; + 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(); + if(err_code != NRF_SUCCESS) + { + return err_code; + } + } + m_whitelist_temporarily_disabled = true; + + 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/components/ble/ble_advertising/ble_advertising.h b/components/ble/ble_advertising/ble_advertising.h new file mode 100644 index 0000000..ea7558a --- /dev/null +++ b/components/ble/ble_advertising/ble_advertising.h @@ -0,0 +1,223 @@ +/* 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 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 slave 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 "ble_gattc.h" +#include "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/components/ble/ble_db_discovery/ble_db_discovery.c b/components/ble/ble_db_discovery/ble_db_discovery.c new file mode 100644 index 0000000..e984eeb --- /dev/null +++ b/components/ble/ble_db_discovery/ble_db_discovery.c @@ -0,0 +1,902 @@ +/* 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 "ble_db_discovery.h" +#include +#include +#include "nrf_error.h" +#include "ble.h" +#include "app_trace.h" +#include "nordic_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 app_trace_log /**< 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 struct +{ + ble_uuid_t srv_uuid; /**< The UUID of the service for which the application module had registered itself.*/ + ble_db_discovery_evt_handler_t evt_handler; /**< The event handler of the application module to be called in case there are any events.*/ +} 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 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. */ + +/**@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(ble_uuid_t * p_srv_uuid) +{ + uint32_t i; + + for (i = 0; i < m_num_of_handlers_reg; i++) + { + if (BLE_UUID_EQ(&(m_registered_handlers[i].srv_uuid), p_srv_uuid)) + { + return (m_registered_handlers[i].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. + * @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 (m_num_of_handlers_reg < DB_DISCOVERY_MAX_USERS) + { + m_registered_handlers[m_num_of_handlers_reg].srv_uuid = *p_srv_uuid; + m_registered_handlers[m_num_of_handlers_reg].evt_handler = p_evt_handler; + + 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; + + 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. + * + */ +static void discovery_error_evt_trigger(ble_db_discovery_t * const p_db_discovery, + uint32_t err_code) +{ + 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 = + p_db_discovery->conn_handle; + m_pending_user_evts[m_pending_usr_evt_index].evt.evt_type = + BLE_DB_DISCOVERY_ERROR; + m_pending_user_evts[m_pending_usr_evt_index].evt.params.err_code = err_code; + 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 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. + */ +static void discovery_complete_evt_trigger(ble_db_discovery_t * const p_db_discovery, + bool is_srv_found) +{ + 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 = + p_db_discovery->conn_handle; + + if (is_srv_found) + { + m_pending_user_evts[m_pending_usr_evt_index].evt.evt_type = + BLE_DB_DISCOVERY_COMPLETE; + + m_pending_user_evts[m_pending_usr_evt_index].evt.params.discovered_db = + *p_srv_being_discovered; + } + 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. + */ +static void on_srv_disc_completion(ble_db_discovery_t * p_db_discovery) +{ + 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].srv_uuid; + + // 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, p_db_discovery->conn_handle); + + uint32_t err_code; + + err_code = sd_ble_gattc_primary_services_discover + ( + p_db_discovery->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); + + return; + } + } + else + { + // No more service discovery is needed. + p_db_discovery->discovery_in_progress = false; + } +} + + +/**@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. + * + * @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) +{ + 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(p_db_discovery->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. + * + * @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) +{ + 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(p_db_discovery->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) +{ + 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; + ble_gatt_db_srv_t * p_srv_being_discovered; + + p_srv_being_discovered = &(p_db_discovery->services[p_db_discovery->curr_srv_ind]); + + 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); + + 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); + } + } + else + { + // Trigger Service Not Found event to the application. + discovery_complete_evt_trigger(p_db_discovery, false); + + on_srv_disc_completion(p_db_discovery); + } +} + + +/**@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; + + 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); + + if (err_code != NRF_SUCCESS) + { + p_db_discovery->discovery_in_progress = false; + + discovery_error_evt_trigger(p_db_discovery, err_code); + + 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); + + if (err_code != NRF_SUCCESS) + { + p_db_discovery->discovery_in_progress = false; + + discovery_error_evt_trigger(p_db_discovery, err_code); + + 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_db_discovery->conn_handle); + + discovery_complete_evt_trigger(p_db_discovery, true); + + on_srv_disc_completion(p_db_discovery); + } + } +} + + +/**@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; + + 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); + + 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); + + 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_db_discovery->conn_handle); + + discovery_complete_evt_trigger(p_db_discovery, true); + + on_srv_disc_completion(p_db_discovery); + } +} + + +uint32_t ble_db_discovery_init(void) +{ + m_num_of_handlers_reg = 0; + m_initialized = true; + m_pending_usr_evt_index = 0; + + return NRF_SUCCESS; +} + + +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, + const ble_db_discovery_evt_handler_t evt_handler) +{ + if ((p_uuid == NULL) || (evt_handler == NULL)) + { + return NRF_ERROR_NULL; + } + + if (!m_initialized) + { + return NRF_ERROR_INVALID_STATE; + } + + if (m_num_of_handlers_reg == DB_DISCOVERY_MAX_USERS) + { + // The limit on the maximum number of supported users has been reached. Return error. + return NRF_ERROR_NOT_SUPPORTED; + } + + return registered_handler_set(p_uuid, evt_handler); +} + + +uint32_t ble_db_discovery_start(ble_db_discovery_t * const p_db_discovery, + uint16_t conn_handle) +{ + if (p_db_discovery == NULL) + { + return NRF_ERROR_NULL; + } + + if (!m_initialized) + { + return NRF_ERROR_INVALID_STATE; + } + + 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; + } + + ble_gatt_db_srv_t * p_srv_being_discovered; + + m_pending_usr_evt_index = 0; + + p_db_discovery->conn_handle = conn_handle; + 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].srv_uuid; + + DB_LOG("[DB]: Starting discovery of service with UUID 0x%x for Connection handle %d\r\n", + p_srv_being_discovered->srv_uuid.uuid, p_db_discovery->conn_handle); + + uint32_t err_code; + + err_code = sd_ble_gattc_primary_services_discover(p_db_discovery->conn_handle, + SRV_DISC_START_HANDLE, + &(p_srv_being_discovered->srv_uuid)); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + p_db_discovery->discovery_in_progress = true; + + return NRF_SUCCESS; +} + + +void ble_db_discovery_on_ble_evt(ble_db_discovery_t * const p_db_discovery, + const ble_evt_t * const p_ble_evt) +{ + if ((p_db_discovery == NULL) || (p_ble_evt == NULL)) + { + // Null pointer provided. Return. + return; + } + + if (!m_initialized) + { + return; + } + + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + p_db_discovery->conn_handle = p_ble_evt->evt.gap_evt.conn_handle; + break; + + case BLE_GAP_EVT_DISCONNECTED: + memset(p_db_discovery, 0, sizeof(ble_db_discovery_t)); + p_db_discovery->conn_handle = BLE_CONN_HANDLE_INVALID; + break; + + 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; + + default: + break; + } +} diff --git a/components/ble/ble_db_discovery/ble_db_discovery.h b/components/ble/ble_db_discovery/ble_db_discovery.h new file mode 100644 index 0000000..c0b75d4 --- /dev/null +++ b/components/ble/ble_db_discovery/ble_db_discovery.h @@ -0,0 +1,217 @@ +/* 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. + */ + + +/**@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. + * A typical use of this library is described in the figure below. + * @image html db_discovery.jpg + * + * @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 + * ble_gatt_db.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 "ble_gattc.h" +#include "ble.h" +#include "nrf_error.h" +#include "ble_srv_common.h" +#include "ble_gatt_db.h" + +/** + * @defgroup db_disc_defines Defines + * @{ + */ + +#define BLE_DB_DISCOVERY_MAX_SRV 2 /**< 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). */ + +/** @} */ + +/** + * @defgroup db_disc_enums Enumerations + * @{ + */ + +/**@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_evt_type_t; + +/** @} */ + +/** + * @defgroup db_disc_structs Structures + * @{ + */ + + +/**@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.*/ + uint16_t conn_handle; /**< Connection handle as provided by the SoftDevice. */ + 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. */ +} 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; + +/** @} */ + +/** + * @defgroup db_disc_types Types + * @{ + */ + +/**@brief DB Discovery event handler type. */ +typedef void (* ble_db_discovery_evt_handler_t)(ble_db_discovery_evt_t * p_evt); + +/** @} */ + +/** + * @addtogroup db_disc_structs + * @{ + */ + +/** @} */ + +/** + * @defgroup db_disc_functions Functions + * @{ + */ + +/**@brief Function for initializing the DB Discovery module. + * + * @retval NRF_SUCCESS on successful initialization. + */ +uint32_t ble_db_discovery_init(void); + + +/**@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. + * @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. + * + * @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_NOT_SUPPORTED 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, + const ble_db_discovery_evt_handler_t evt_handler); + + +/**@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/components/ble/ble_debug_assert_handler/ble_debug_assert_handler.c b/components/ble/ble_debug_assert_handler/ble_debug_assert_handler.c new file mode 100644 index 0000000..a47ec5e --- /dev/null +++ b/components/ble/ble_debug_assert_handler/ble_debug_assert_handler.c @@ -0,0 +1,55 @@ +/* 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 "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/components/ble/ble_debug_assert_handler/ble_debug_assert_handler.h b/components/ble/ble_debug_assert_handler/ble_debug_assert_handler.h new file mode 100644 index 0000000..051e6a4 --- /dev/null +++ b/components/ble/ble_debug_assert_handler/ble_debug_assert_handler.h @@ -0,0 +1,51 @@ +/* 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. + * + */ + +/** @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/components/ble/ble_dtm/ble_dtm.c b/components/ble/ble_dtm/ble_dtm.c new file mode 100644 index 0000000..de0ed8d --- /dev/null +++ b/components/ble/ble_dtm/ble_dtm.c @@ -0,0 +1,643 @@ +/* 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 "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/components/ble/ble_dtm/ble_dtm.h b/components/ble/ble_dtm/ble_dtm.h new file mode 100644 index 0000000..76acb1e --- /dev/null +++ b/components/ble/ble_dtm/ble_dtm.h @@ -0,0 +1,141 @@ +/* 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 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/components/ble/ble_error_log/ble_error_log.c b/components/ble/ble_error_log/ble_error_log.c new file mode 100644 index 0000000..0e26140 --- /dev/null +++ b/components/ble/ble_error_log/ble_error_log.c @@ -0,0 +1,58 @@ +/* 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 +#include +#include +#include +#include "ble_error_log.h" +#include "app_util.h" +#include "app_error.h" +#include "nrf_gpio.h" +#include "pstorage.h" + + +// Made static to avoid the error_log to go on the stack. +static ble_error_log_data_t m_ble_error_log; /**< . */ +//lint -esym(526,__Vectors) +extern uint32_t * __Vectors; /**< The initialization vector holds the address to __initial_sp that will be used when fetching the stack. */ + +static void fetch_stack(ble_error_log_data_t * error_log) +{ + uint32_t * p_stack; + uint32_t * initial_sp; + uint32_t length; + + initial_sp = (uint32_t *) __Vectors; + p_stack = (uint32_t *) GET_SP(); + + length = ((uint32_t) initial_sp) - ((uint32_t) p_stack); + memcpy(error_log->stack_info, + p_stack, + (length > STACK_DUMP_LENGTH) ? STACK_DUMP_LENGTH : length); +} + +uint32_t ble_error_log_write(uint32_t err_code, const uint8_t * p_message, uint16_t line_number) +{ + m_ble_error_log.failure = true; + m_ble_error_log.err_code = err_code; + m_ble_error_log.line_number = line_number; + + strncpy((char *)m_ble_error_log.message, (const char *)p_message, ERROR_MESSAGE_LENGTH - 1); + m_ble_error_log.message[ERROR_MESSAGE_LENGTH - 1] = '\0'; + + fetch_stack(&m_ble_error_log); + + // Write to flash removed, to be redone. + + return NRF_SUCCESS; +} diff --git a/components/ble/ble_error_log/ble_error_log.h b/components/ble/ble_error_log/ble_error_log.h new file mode 100644 index 0000000..825046f --- /dev/null +++ b/components/ble/ble_error_log/ble_error_log.h @@ -0,0 +1,69 @@ +/* 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 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/components/ble/ble_racp/ble_racp.c b/components/ble/ble_racp/ble_racp.c new file mode 100644 index 0000000..047c855 --- /dev/null +++ b/components/ble/ble_racp/ble_racp.c @@ -0,0 +1,56 @@ +/* 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 "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/components/ble/ble_racp/ble_racp.h b/components/ble/ble_racp/ble_racp.h new file mode 100644 index 0000000..d3296e4 --- /dev/null +++ b/components/ble/ble_racp/ble_racp.h @@ -0,0 +1,96 @@ +/* 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 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 "ble.h" +#include "ble_types.h" +#include "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/components/ble/ble_radio_notification/ble_radio_notification.c b/components/ble/ble_radio_notification/ble_radio_notification.c new file mode 100644 index 0000000..96ece18 --- /dev/null +++ b/components/ble/ble_radio_notification/ble_radio_notification.c @@ -0,0 +1,59 @@ +/* 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 "ble_radio_notification.h" +#include + + +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(nrf_app_irq_priority_t irq_priority, + nrf_radio_notification_distance_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/components/ble/ble_radio_notification/ble_radio_notification.h b/components/ble/ble_radio_notification/ble_radio_notification.h new file mode 100644 index 0000000..dd47b36 --- /dev/null +++ b/components/ble/ble_radio_notification/ble_radio_notification.h @@ -0,0 +1,45 @@ +/* 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 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(nrf_app_irq_priority_t irq_priority, + nrf_radio_notification_distance_t distance, + ble_radio_notification_evt_handler_t evt_handler); + +#endif // BLE_RADIO_NOTIFICATION_H__ + +/** @} */ diff --git a/components/ble/ble_services/ble_ancs_c/ble_ancs_c.c b/components/ble/ble_services/ble_ancs_c/ble_ancs_c.c new file mode 100644 index 0000000..a9bd03a --- /dev/null +++ b/components/ble/ble_services/ble_ancs_c/ble_ancs_c.c @@ -0,0 +1,737 @@ +/* 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. + */ + +/* Disclaimer: This client implementation of the Apple Notification Center Service can and will be changed at any time by Nordic Semiconductor ASA. + * Server implementations such as the ones found in iOS can be changed at any time by Apple and may cause this client implementation to stop working. + */ + +#include "ble_ancs_c.h" +#include +#include +#include "ble_err.h" +#include "ble_srv_common.h" +#include "nordic_common.h" +#include "nrf_assert.h" +#include "device_manager.h" +#include "ble_db_discovery.h" +#include "app_error.h" +#include "app_trace.h" + +#define BLE_ANCS_NOTIF_EVT_ID_INDEX 0 /**< Index of the Event ID field when parsing notifications. */ +#define BLE_ANCS_NOTIF_FLAGS_INDEX 1 /**< Index of the Flags field when parsing notifications. */ +#define BLE_ANCS_NOTIF_CATEGORY_ID_INDEX 2 /**< Index of the Category ID field when parsing notifications. */ +#define BLE_ANCS_NOTIF_CATEGORY_CNT_INDEX 3 /**< Index of the Category Count field when parsing notifications. */ +#define BLE_ANCS_NOTIF_NOTIF_UID 4 /**< Index of the Notification UID field when patsin notifications. */ + +#define LOG app_trace_log /**< Debug logger macro that will be used in this file to do logging of important information over UART. */ +#define LOG_DUMP app_trace_dump /**< Debug logger macro that will be used in this file to do logging of important information over UART. */ + +#define START_HANDLE_DISCOVER 0x0001 /**< Value of start handle during discovery. */ + +#define TX_BUFFER_MASK 0x07 /**< TX buffer mask. Must be a mask of contiguous zeroes followed by a contiguous sequence of ones: 000...111. */ +#define TX_BUFFER_SIZE (TX_BUFFER_MASK + 1) /**< Size of send buffer, which is 1 higher than the mask. */ +#define WRITE_MESSAGE_LENGTH 20 /**< Length of the write message for CCCD/control point. */ +#define BLE_CCCD_NOTIFY_BIT_MASK 0x0001 /**< Enable notification bit. */ + +#define BLE_ANCS_MAX_DISCOVERED_CENTRALS DEVICE_MANAGER_MAX_BONDS /**< Maximum number of discovered services that can be stored in the flash. This number should be identical to maximum number of bonded peer devices. */ + +#define TIME_STRING_LEN 15 /**< Unicode Technical Standard (UTS) #35 date format pattern "yyyyMMdd'T'HHmmSS" + "'\0'". */ + +#define DISCOVERED_SERVICE_DB_SIZE \ + CEIL_DIV(sizeof(ble_ancs_c_service_t) * BLE_ANCS_MAX_DISCOVERED_CENTRALS, sizeof(uint32_t)) /**< Size of bonded peer's database in word size (4 byte). */ + + +/**@brief ANCS request types. + */ +typedef enum +{ + READ_REQ = 1, /**< Type identifying that this tx_message is a read request. */ + WRITE_REQ /**< Type identifying that this tx_message is a write request. */ +} ancs_tx_request_t; + + +/**@brief Structure used for holding the characteristic found during the discovery process. + */ +typedef struct +{ + ble_uuid_t uuid; /**< UUID identifying the characteristic. */ + ble_gatt_char_props_t properties; /**< Properties for the characteristic. */ + uint16_t handle_decl; /**< Characteristic Declaration Handle for the characteristic. */ + uint16_t handle_value; /**< Value Handle for the value provided in the characteristic. */ + uint16_t handle_cccd; /**< CCCD Handle value for the characteristic. */ +} ble_ancs_c_characteristic_t; + + +/**@brief Structure used for holding the Apple Notification Center Service found during the discovery process. + */ +typedef struct +{ + uint8_t handle; /**< Handle of Apple Notification Center Service, which identifies to which peer this discovered service belongs. */ + ble_gattc_service_t service; /**< The GATT Service holding the discovered Apple Notification Center Service. */ + ble_ancs_c_characteristic_t control_point; /**< Control Point Characteristic for the service. Allows interaction with the peer. */ + ble_ancs_c_characteristic_t notif_source; /**< Characteristic that keeps track of arrival, modification, and removal of notifications. */ + ble_ancs_c_characteristic_t data_source; /**< Characteristic where attribute data for the notifications is received from peer. */ +} ble_ancs_c_service_t; + + +/**@brief Structure for writing a message to the central, i.e. Control Point or CCCD. + */ +typedef struct +{ + uint8_t gattc_value[WRITE_MESSAGE_LENGTH]; /**< The message to write. */ + ble_gattc_write_params_t gattc_params; /**< GATTC parameters for this message. */ +} write_params_t; + + +/**@brief Structure for holding data to be transmitted to the connected master. + */ +typedef struct +{ + uint16_t conn_handle; /**< Connection handle to be used when transmitting this message. */ + ancs_tx_request_t type; /**< Type of this message, i.e. read or write message. */ + union + { + uint16_t read_handle; /**< Read request message. */ + write_params_t write_req; /**< Write request message. */ + } req; +} tx_message_t; + + +/**@brief Parsing states for received iOS notification attributes. + */ +typedef enum +{ + COMMAND_ID_AND_NOTIF_UID, /**< Parsing the command ID and the notification UID. */ + ATTR_ID, /**< Parsing attribute ID. */ + ATTR_LEN1, /**< Parsing the LSB of the attribute length. */ + ATTR_LEN2, /**< Parsing the MSB of the attribute length. */ + ATTR_DATA, /**< Parsing the attribute data. */ + DONE /**< Parsing is done. */ +} ble_ancs_c_parse_state_t; + +static tx_message_t m_tx_buffer[TX_BUFFER_SIZE]; /**< Transmit buffer for messages to be transmitted to the Notification Provider. */ +static uint32_t m_tx_insert_index = 0; /**< Current index in the transmit buffer where the next message should be inserted. */ +static uint32_t m_tx_index = 0; /**< Current index in the transmit buffer from where the next message to be transmitted resides. */ + +static ble_ancs_c_service_t m_service; /**< Current service data. */ +static ble_ancs_c_t * mp_ble_ancs; /**< Pointer to the current instance of the ANCS client module. The memory for this is provided by the application.*/ +static ble_ancs_c_attr_list_t m_ancs_attr_list[BLE_ANCS_NB_OF_ATTRS]; /**< For all attributes; contains whether they should be requested upon attribute request and the length and buffer of where to store attribute data. */ +static uint32_t m_expected_number_of_attrs; /**< Variable to keep track of when to stop reading incoming attributes. */ +static ble_ancs_c_evt_t m_ancs_evt; /**< The ANCS event that is created in this module and propagated to the application. */ + +static ble_ancs_c_parse_state_t m_parse_state = COMMAND_ID_AND_NOTIF_UID; /**< ANCS notification attribute parsing state. */ + + +/**@brief 128-bit service UUID for the Apple Notification Center Service. + */ +const ble_uuid128_t ble_ancs_base_uuid128 = +{ + { + // 7905F431-B5CE-4E99-A40F-4B1E122D00D0 + 0xd0, 0x00, 0x2d, 0x12, 0x1e, 0x4b, 0x0f, 0xa4, + 0x99, 0x4e, 0xce, 0xb5, 0x31, 0xf4, 0x05, 0x79 + } +}; + + +/**@brief 128-bit control point UUID. + */ +const ble_uuid128_t ble_ancs_cp_base_uuid128 = +{ + { + // 69d1d8f3-45e1-49a8-9821-9BBDFDAAD9D9 + 0xd9, 0xd9, 0xaa, 0xfd, 0xbd, 0x9b, 0x21, 0x98, + 0xa8, 0x49, 0xe1, 0x45, 0xf3, 0xd8, 0xd1, 0x69 + } +}; + +/**@brief 128-bit notification source UUID. +*/ +const ble_uuid128_t ble_ancs_ns_base_uuid128 = +{ + { + // 9FBF120D-6301-42D9-8C58-25E699A21DBD + 0xbd, 0x1d, 0xa2, 0x99, 0xe6, 0x25, 0x58, 0x8c, + 0xd9, 0x42, 0x01, 0x63, 0x0d, 0x12, 0xbf, 0x9f + + } +}; + +/**@brief 128-bit data source UUID. +*/ +const ble_uuid128_t ble_ancs_ds_base_uuid128 = +{ + { + // 22EAC6E9-24D6-4BB5-BE44-B36ACE7C7BFB + 0xfb, 0x7b, 0x7c, 0xce, 0x6a, 0xb3, 0x44, 0xbe, + 0xb5, 0x4b, 0xd6, 0x24, 0xe9, 0xc6, 0xea, 0x22 + } +}; + + +/**@brief Function for handling events from the database discovery module. + * + * @details This function handles events from the database discovery module and determines + * if it relates to the discovery of the Apple Notification Center Service at the + * peer. If so, it will call the application's event handler indicating that the Apple + * Notification Center Service has been discovered at the peer. It also populates the + * event with the service-related information before providing it to the application. + * + * @param[in] p_evt Pointer to the event received from the database discovery module. + */ +static void db_discover_evt_handler(ble_db_discovery_evt_t * p_evt) +{ + LOG("[ANCS]: Database Discovery handler called with event 0x%x\r\n", p_evt->evt_type); + + ble_ancs_c_evt_t evt; + ble_gatt_db_char_t * p_chars; + + p_chars = p_evt->params.discovered_db.charateristics; + + // Check if the ANCS Service was discovered. + if (p_evt->evt_type == BLE_DB_DISCOVERY_COMPLETE && + p_evt->params.discovered_db.srv_uuid.uuid == ANCS_UUID_SERVICE && + p_evt->params.discovered_db.srv_uuid.type == BLE_UUID_TYPE_VENDOR_BEGIN) + { + mp_ble_ancs->conn_handle = p_evt->conn_handle; + + // Find the handles of the ANCS characteristic. + uint32_t i; + + for (i = 0; i < p_evt->params.discovered_db.char_count; i++) + { + switch (p_evt->params.discovered_db.charateristics[i].characteristic.uuid.uuid) + { + case ANCS_UUID_CHAR_CONTROL_POINT: + LOG("[ANCS]: Control Point Characteristic found.\n\r"); + m_service.control_point.properties = p_chars[i].characteristic.char_props; + m_service.control_point.handle_decl = p_chars[i].characteristic.handle_decl; + m_service.control_point.handle_value = p_chars[i].characteristic.handle_value; + m_service.control_point.handle_cccd = p_chars[i].cccd_handle; + break; + + case ANCS_UUID_CHAR_DATA_SOURCE: + LOG("[ANCS]: Data Source Characteristic found.\n\r"); + m_service.data_source.properties = p_chars[i].characteristic.char_props; + m_service.data_source.handle_decl = p_chars[i].characteristic.handle_decl; + m_service.data_source.handle_value = p_chars[i].characteristic.handle_value; + m_service.data_source.handle_cccd = p_chars[i].cccd_handle; + break; + + case ANCS_UUID_CHAR_NOTIFICATION_SOURCE: + LOG("[ANCS]: Notification point Characteristic found.\n\r"); + m_service.notif_source.properties = p_chars[i].characteristic.char_props; + m_service.notif_source.handle_decl = p_chars[i].characteristic.handle_decl; + m_service.notif_source.handle_value = p_chars[i].characteristic.handle_value; + m_service.notif_source.handle_cccd = p_chars[i].cccd_handle; + break; + + default: + break; + } + } + evt.evt_type = BLE_ANCS_C_EVT_DISCOVER_COMPLETE; + mp_ble_ancs->evt_handler(&evt); + } + else + { + evt.evt_type = BLE_ANCS_C_EVT_DISCOVER_FAILED; + mp_ble_ancs->evt_handler(&evt); + } +} + + +/**@brief Function for passing any pending request from the buffer to the stack. + */ +static void tx_buffer_process(void) +{ + if (m_tx_index != m_tx_insert_index) + { + uint32_t err_code; + + if (m_tx_buffer[m_tx_index].type == READ_REQ) + { + err_code = sd_ble_gattc_read(m_tx_buffer[m_tx_index].conn_handle, + m_tx_buffer[m_tx_index].req.read_handle, + 0); + } + else + { + err_code = sd_ble_gattc_write(m_tx_buffer[m_tx_index].conn_handle, + &m_tx_buffer[m_tx_index].req.write_req.gattc_params); + } + if (err_code == NRF_SUCCESS) + { + ++m_tx_index; + m_tx_index &= TX_BUFFER_MASK; + } + } +} + + +/**@brief Function for parsing received notification attribute response data. + * + * @details The data that comes from the Notification Provider can be much longer than what + * would fit in a single GATTC notification. Therefore, function relies on static + * variables and a state-oriented switch case. + * UID and command ID will be received only once at the beginning of the first + * GATTC notification of a new attribute request for a given iOS notification. + * After this, we can loop several ID > LENGTH > DATA > ID > LENGTH > DATA until we have + * received all attributes we wanted as a Notification Consumer. The Notification Provider + * can also simply stop sending attributes. + * + * @param[in] p_ancs Pointer to an ANCS instance to which the event belongs. + * @param[in] p_data_src Pointer to data that was received from the Notification Provider. + * @param[in] hvx_len Length of the data that was received from the Notification Provider. + */ +static void parse_get_notif_attrs_response(ble_ancs_c_t * p_ancs, + const uint8_t * p_data_src, + const uint16_t hvx_data_len) +{ + static uint8_t * p_data_dest; + static uint16_t current_attr_index; + static ble_ancs_c_evt_t evt; + ble_ancs_c_command_id_values_t command_id; + uint32_t index; + + evt.ancs_attr_list = m_ancs_attr_list; + + for (index = 0; index < hvx_data_len;) + { + switch (m_parse_state) + { + case COMMAND_ID_AND_NOTIF_UID: + command_id = (ble_ancs_c_command_id_values_t) p_data_src[index++]; + if(command_id != BLE_ANCS_COMMAND_ID_GET_NOTIF_ATTRIBUTES) + { + LOG("[ANCS]: Invalid Command ID"); + m_parse_state = DONE; + } + + evt.attr.notif_uid = uint32_decode(&p_data_src[index]); + index += sizeof(uint32_t); + m_parse_state = ATTR_ID; + + if (evt.attr.notif_uid != m_ancs_evt.notif.notif_uid) + { + LOG("UID mismatch: Notification UID %x , Attribute UID %x\n\r", + evt.notif.notif_uid, + evt.attr.notif_uid); + m_parse_state = DONE; + } + break; + + case ATTR_ID: + if (m_expected_number_of_attrs == 0) + { + LOG("[ANCS]: All requested attributes received\n\r"); + m_parse_state = DONE; + index++; + } + else + { + evt.attr.attr_id = (ble_ancs_c_notif_attr_id_values_t) p_data_src[index++]; + p_data_dest = m_ancs_attr_list[evt.attr.attr_id].p_attr_data; + if (m_ancs_attr_list[evt.attr.attr_id].get == true) + { + m_parse_state = ATTR_LEN1; + } + m_expected_number_of_attrs--; + LOG("Attribute ID %i \n\r", evt.attr.attr_id); + } + break; + + case ATTR_LEN1: + evt.attr.attr_len = p_data_src[index++]; + m_parse_state = ATTR_LEN2; + break; + + case ATTR_LEN2: + evt.attr.attr_len |= (p_data_src[index++] << 8); + current_attr_index = 0; + if (evt.attr.attr_len != 0) + { + m_parse_state = ATTR_DATA; + } + else + { + evt.evt_type = BLE_ANCS_C_EVT_NOTIF_ATTRIBUTE; + p_ancs->evt_handler(&evt); + m_parse_state = ATTR_ID; + } + LOG("Attribute LEN %i \n\r", evt.attr.attr_len); + break; + + case ATTR_DATA: + // We have not reached the end of the attribute, nor our max allocated internal size. + // Proceed with copying data over to our buffer. + if ( (current_attr_index < m_ancs_attr_list[evt.attr.attr_id].attr_len) + && (current_attr_index < evt.attr.attr_len)) + { + p_data_dest[current_attr_index++] = p_data_src[index++]; + } + // We have reached the end of the attribute, or our max allocated internal size. + // Stop copying data over to our buffer. NUL-terminate at the current index. + if ( (current_attr_index == evt.attr.attr_len) || + (current_attr_index == m_ancs_attr_list[evt.attr.attr_id].attr_len)) + { + p_data_dest[current_attr_index] = '\0'; + + // If our max buffer size is smaller than the remaining attribute data, we must + // increase index to skip the data until the start of the next attribute. + if (current_attr_index < evt.attr.attr_len) + { + index += (evt.attr.attr_len - current_attr_index); + } + m_parse_state = ATTR_ID; + LOG("Attribute finished!\n\r"); + evt.evt_type = BLE_ANCS_C_EVT_NOTIF_ATTRIBUTE; + p_ancs->evt_handler(&evt); + } + break; + + case DONE: + index = hvx_data_len; + break; + + default: + // Default case will never trigger intentionally. Go to the DONE state to minimize the consequences. + m_parse_state = DONE; + break; + } + } +} + + +/**@brief Function for checking if data in an iOS notification is out of bounds. + * + * @param[in] notif An iOS notification. + * + * @retval NRF_SUCCESS If the notification is within bounds. + * @retval NRF_ERROR_INVALID_PARAM If the notification is out of bounds. + */ +static uint32_t ble_ancs_verify_notification_format(const ble_ancs_c_evt_notif_t * notif) +{ + if( (notif->evt_id >= BLE_ANCS_NB_OF_EVT_ID) + || (notif->category_id >= BLE_ANCS_NB_OF_CATEGORY_ID)) + { + return NRF_ERROR_INVALID_PARAM; + } + return NRF_SUCCESS; +} + +/**@brief Function for receiving and validating notifications received from the Notification Provider. + * + * @param[in] p_ancs Pointer to an ANCS instance to which the event belongs. + * @param[in] p_ble_evt Bluetooth stack event. + * @param[in] p_data_src Pointer to data that was received from the Notification Provider. + * @param[in] hvx_len Length of the data that was received by the Notification Provider. + */ +static void parse_notif(const ble_ancs_c_t * p_ancs, + ble_ancs_c_evt_t * p_ancs_evt, + const uint8_t * p_data_src, + const uint16_t hvx_data_len) +{ + uint32_t err_code; + if (hvx_data_len != BLE_ANCS_NOTIFICATION_DATA_LENGTH) + { + m_ancs_evt.evt_type = BLE_ANCS_C_EVT_INVALID_NOTIF; + p_ancs->evt_handler(&m_ancs_evt); + } + + /*lint --e{415} --e{416} -save suppress Warning 415: possible access out of bond */ + p_ancs_evt->notif.evt_id = + (ble_ancs_c_evt_id_values_t) p_data_src[BLE_ANCS_NOTIF_EVT_ID_INDEX]; + + p_ancs_evt->notif.evt_flags.silent = + (p_data_src[BLE_ANCS_NOTIF_FLAGS_INDEX] >> BLE_ANCS_EVENT_FLAG_SILENT) & 0x01; + + p_ancs_evt->notif.evt_flags.important = + (p_data_src[BLE_ANCS_NOTIF_FLAGS_INDEX] >> BLE_ANCS_EVENT_FLAG_IMPORTANT) & 0x01; + + p_ancs_evt->notif.evt_flags.pre_existing = + (p_data_src[BLE_ANCS_NOTIF_FLAGS_INDEX] >> BLE_ANCS_EVENT_FLAG_PREEXISTING) & 0x01; + + p_ancs_evt->notif.evt_flags.positive_action = + (p_data_src[BLE_ANCS_NOTIF_FLAGS_INDEX] >> BLE_ANCS_EVENT_FLAG_POSITIVE_ACTION) & 0x01; + + p_ancs_evt->notif.evt_flags.negative_action = + (p_data_src[BLE_ANCS_NOTIF_FLAGS_INDEX] >> BLE_ANCS_EVENT_FLAG_NEGATIVE_ACTION) & 0x01; + + p_ancs_evt->notif.category_id = + (ble_ancs_c_category_id_values_t) p_data_src[BLE_ANCS_NOTIF_CATEGORY_ID_INDEX]; + + p_ancs_evt->notif.category_count = p_data_src[BLE_ANCS_NOTIF_CATEGORY_CNT_INDEX]; + p_ancs_evt->notif.notif_uid = uint32_decode(&p_data_src[BLE_ANCS_NOTIF_NOTIF_UID]); + /*lint -restore*/ + + err_code = ble_ancs_verify_notification_format(&m_ancs_evt.notif); + if (err_code == NRF_SUCCESS) + { + m_ancs_evt.evt_type = BLE_ANCS_C_EVT_NOTIF; + } + else + { + m_ancs_evt.evt_type = BLE_ANCS_C_EVT_INVALID_NOTIF; + } + + p_ancs->evt_handler(&m_ancs_evt); +} + + +/**@brief Function for receiving and validating notifications received from the Notification Provider. + * + * @param[in] p_ancs Pointer to an ANCS instance to which the event belongs. + * @param[in] p_ble_evt Bluetooth stack event. + */ +static void on_evt_gattc_notif(ble_ancs_c_t * p_ancs, const ble_evt_t * p_ble_evt) +{ + const ble_gattc_evt_hvx_t * p_notif = &p_ble_evt->evt.gattc_evt.params.hvx; + + if (p_notif->handle == m_service.notif_source.handle_value) + { + BLE_UUID_COPY_INST(m_ancs_evt.uuid, m_service.notif_source.uuid); + parse_notif(p_ancs, &m_ancs_evt,p_notif->data,p_notif->len); + } + else if (p_notif->handle == m_service.data_source.handle_value) + { + BLE_UUID_COPY_INST(m_ancs_evt.uuid, m_service.data_source.uuid); + parse_get_notif_attrs_response(p_ancs, p_notif->data, p_notif->len); + } + else + { + // No applicable action. + } +} + +/**@brief Function for handling write response events. + */ +static void on_evt_write_rsp() +{ + tx_buffer_process(); +} + + +void ble_ancs_c_on_device_manager_evt(ble_ancs_c_t * p_ans, + dm_handle_t const * p_handle, + dm_event_t const * p_dm_evt) +{ + switch (p_dm_evt->event_id) + { + case DM_EVT_CONNECTION: + // Fall through. + case DM_EVT_SECURITY_SETUP_COMPLETE: + p_ans->central_handle = p_handle->device_id; + break; + + default: + // Do nothing. + break; + } +} + + +void ble_ancs_c_on_ble_evt(ble_ancs_c_t * p_ancs, const ble_evt_t * p_ble_evt) +{ + uint16_t evt = p_ble_evt->header.evt_id; + + switch (evt) + { + case BLE_GATTC_EVT_WRITE_RSP: + on_evt_write_rsp(); + break; + + case BLE_GATTC_EVT_HVX: + on_evt_gattc_notif(p_ancs, p_ble_evt); + break; + + default: + break; + } +} + + +uint32_t ble_ancs_c_init(ble_ancs_c_t * p_ancs, const ble_ancs_c_init_t * p_ancs_init) +{ + if ((p_ancs == NULL) || p_ancs_init == NULL || (p_ancs_init->evt_handler == NULL)) + { + return NRF_ERROR_NULL; + } + + mp_ble_ancs = p_ancs; + + mp_ble_ancs->evt_handler = p_ancs_init->evt_handler; + mp_ble_ancs->error_handler = p_ancs_init->error_handler; + mp_ble_ancs->service_handle = BLE_GATT_HANDLE_INVALID; + mp_ble_ancs->central_handle = DM_INVALID_ID; + mp_ble_ancs->conn_handle = BLE_CONN_HANDLE_INVALID; + + memset(&m_service, 0, sizeof(ble_ancs_c_service_t)); + memset(m_tx_buffer, 0, TX_BUFFER_SIZE); + + m_service.handle = BLE_GATT_HANDLE_INVALID; + + ble_uuid_t ancs_uuid; + ancs_uuid.uuid = ANCS_UUID_SERVICE; + ancs_uuid.type = BLE_UUID_TYPE_VENDOR_BEGIN; + + return ble_db_discovery_evt_register(&ancs_uuid, db_discover_evt_handler); +} + + +/**@brief Function for creating a TX message for writing a CCCD. + * + * @param[in] conn_handle Connection handle on which to perform the configuration. + * @param[in] handle_cccd Handle of the CCCD. + * @param[in] enable Enable or disable GATTC notifications. + * + * @retval NRF_SUCCESS If the message was created successfully. + * @retval NRF_ERROR_INVALID_PARAM If one of the input parameters was invalid. + */ +static uint32_t cccd_configure(const uint16_t conn_handle, const uint16_t handle_cccd, bool enable) +{ + tx_message_t * p_msg; + uint16_t cccd_val = enable ? BLE_CCCD_NOTIFY_BIT_MASK : 0; + + p_msg = &m_tx_buffer[m_tx_insert_index++]; + m_tx_insert_index &= TX_BUFFER_MASK; + + p_msg->req.write_req.gattc_params.handle = handle_cccd; + p_msg->req.write_req.gattc_params.len = 2; + p_msg->req.write_req.gattc_params.p_value = p_msg->req.write_req.gattc_value; + p_msg->req.write_req.gattc_params.offset = 0; + p_msg->req.write_req.gattc_params.write_op = BLE_GATT_OP_WRITE_REQ; + p_msg->req.write_req.gattc_value[0] = LSB_16(cccd_val); + p_msg->req.write_req.gattc_value[1] = MSB_16(cccd_val); + p_msg->conn_handle = conn_handle; + p_msg->type = WRITE_REQ; + + tx_buffer_process(); + return NRF_SUCCESS; +} + + +uint32_t ble_ancs_c_notif_source_notif_enable(const ble_ancs_c_t * p_ancs) +{ + LOG("[ANCS]: Enable Notification Source notifications. writing to handle: %i \n\r", + m_service.notif_source.handle_cccd); + return cccd_configure(p_ancs->conn_handle, m_service.notif_source.handle_cccd, true); +} + + +uint32_t ble_ancs_c_notif_source_notif_disable(const ble_ancs_c_t * p_ancs) +{ + return cccd_configure(p_ancs->conn_handle, m_service.notif_source.handle_cccd, false); +} + + +uint32_t ble_ancs_c_data_source_notif_enable(const ble_ancs_c_t * p_ancs) +{ + LOG("[ANCS]: Enable Data Source notifications. Writing to handle: %i \n\r", + m_service.data_source.handle_cccd); + return cccd_configure(p_ancs->conn_handle, m_service.data_source.handle_cccd, true); +} + + +uint32_t ble_ancs_c_data_source_notif_disable(const ble_ancs_c_t * p_ancs) +{ + return cccd_configure(p_ancs->conn_handle, m_service.data_source.handle_cccd, false); +} + + +uint32_t ble_ancs_get_notif_attrs(const ble_ancs_c_t * p_ancs, + const uint32_t p_uid) +{ + tx_message_t * p_msg; + uint32_t index = 0; + uint32_t number_of_requested_attr = 0; + + p_msg = &m_tx_buffer[m_tx_insert_index++]; + m_tx_insert_index &= TX_BUFFER_MASK; + + p_msg->req.write_req.gattc_params.handle = m_service.control_point.handle_value; + p_msg->req.write_req.gattc_params.p_value = p_msg->req.write_req.gattc_value; + p_msg->req.write_req.gattc_params.offset = 0; + p_msg->req.write_req.gattc_params.write_op = BLE_GATT_OP_WRITE_REQ; + + //Encode Command ID. + p_msg->req.write_req.gattc_value[index++] = BLE_ANCS_COMMAND_ID_GET_NOTIF_ATTRIBUTES; + + //Encode Notification UID. + index += uint32_encode(p_uid, &p_msg->req.write_req.gattc_value[index]); + + //Encode Attribute ID. + for (uint32_t attr = 0; attr < BLE_ANCS_NB_OF_ATTRS; attr++) + { + if (m_ancs_attr_list[attr].get == true) + { + p_msg->req.write_req.gattc_value[index++] = attr; + if ((attr == BLE_ANCS_NOTIF_ATTR_ID_TITLE) || + (attr == BLE_ANCS_NOTIF_ATTR_ID_SUBTITLE) || + (attr == BLE_ANCS_NOTIF_ATTR_ID_MESSAGE)) + { + //Encode Length field, only applicable for Title, Subtitle and Message + index += uint16_encode(m_ancs_attr_list[attr].attr_len, + &p_msg->req.write_req.gattc_value[index]); + } + number_of_requested_attr++; + } + } + p_msg->req.write_req.gattc_params.len = index; + p_msg->conn_handle = p_ancs->conn_handle; + p_msg->type = WRITE_REQ; + m_expected_number_of_attrs = number_of_requested_attr; + + tx_buffer_process(); + + return NRF_SUCCESS; +} + + +uint32_t ble_ancs_c_attr_add(const ble_ancs_c_notif_attr_id_values_t id, + uint8_t * p_data, + const uint16_t len) +{ + if(p_data == NULL) + { + return NRF_ERROR_NULL; + } + if((len == 0) || (len > BLE_ANCS_ATTR_DATA_MAX)) + { + return NRF_ERROR_INVALID_LENGTH; + } + + m_ancs_attr_list[id].get = true; + m_ancs_attr_list[id].attr_len = len; + m_ancs_attr_list[id].p_attr_data = p_data; + + return NRF_SUCCESS; +} + + +uint32_t ble_ancs_c_request_attrs(const ble_ancs_c_evt_notif_t * notif) +{ + uint32_t err_code; + err_code = ble_ancs_verify_notification_format(notif); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + err_code = ble_ancs_get_notif_attrs(mp_ble_ancs, notif->notif_uid); + m_parse_state = COMMAND_ID_AND_NOTIF_UID; + if (err_code != NRF_SUCCESS) + { + return err_code; + } + return NRF_SUCCESS; +} + diff --git a/components/ble/ble_services/ble_ancs_c/ble_ancs_c.h b/components/ble/ble_services/ble_ancs_c/ble_ancs_c.h new file mode 100644 index 0000000..9a03956 --- /dev/null +++ b/components/ble/ble_services/ble_ancs_c/ble_ancs_c.h @@ -0,0 +1,320 @@ +/* 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 ble_sdk_srv_ancs_c Apple Notification Service client + * @{ + * @ingroup ble_sdk_srv + * @brief Apple Notification Center Service Client Module. + * + * @details Disclaimer: This client implementation of the Apple Notification Center Service can + * and will be changed at any time by Nordic Semiconductor ASA. + * + * Server implementations such as the ones found in iOS can be changed at any + * time by Apple and may cause this client implementation to stop working. + * + * This module implements the Apple Notification Center Service (ANCS) client. + * This client can be used as a Notification Consumer (NC) that receives data + * notifications from a Notification Provider (NP). The NP is typically an iOS + * device acting as a server. For terminology and up-to-date specs, see + * http://developer.apple.com. + * + * The term "notification" is used in two different meanings: + * - An iOS notification is the data received from the Notification Provider. + * - A GATTC notification is a way to transfer data with Bluetooth Smart. + * In this module, we receive iOS notifications using GATTC notifications. + * We use the full term (iOS notification or GATTC notification) where required. + * + * @note The application must propagate BLE stack events to this module + * by calling ble_ancs_c_on_ble_evt() from the @ref softdevice_handler callback. + */ +#ifndef BLE_ANCS_C_H__ +#define BLE_ANCS_C_H__ + + +#include "ble_types.h" +#include "ble_srv_common.h" +#include "device_manager.h" + + +#define BLE_ANCS_ATTR_DATA_MAX 32 /**< Maximum data length of an iOS notification attribute. */ +#define BLE_ANCS_NB_OF_CATEGORY_ID 12 /**< Number of iOS notification categories: Other, Incoming Call, Missed Call, Voice Mail, Social, Schedule, Email, News, Health And Fitness, Business And Finance, Location, Entertainment. */ +#define BLE_ANCS_NB_OF_ATTRS 8 /**< Number of iOS notification attributes: AppIdentifier, Title, Subtitle, Message, MessageSize, Date, PositiveActionLabel, NegativeActionLabel. */ +#define BLE_ANCS_NB_OF_EVT_ID 3 /**< Number of iOS notification events: Added, Modified, Removed.*/ + +/** @brief Length of the iOS notification data. + * + * @details 8 bytes: + * Event ID |Event flags |Category ID |Category count|Notification UID + * ---------|------------|------------|--------------|---------------- + * 1 byte | 1 byte | 1 byte | 1 byte | 4 bytes + */ +#define BLE_ANCS_NOTIFICATION_DATA_LENGTH 8 + +#define ANCS_UUID_SERVICE 0xF431 /**< 16-bit service UUID for the Apple Notification Center Service. */ +#define ANCS_UUID_CHAR_CONTROL_POINT 0xD8F3 /**< 16-bit control point UUID. */ +#define ANCS_UUID_CHAR_DATA_SOURCE 0xC6E9 /**< 16-bit data source UUID. */ +#define ANCS_UUID_CHAR_NOTIFICATION_SOURCE 0x120D /**< 16-bit notification source UUID. */ + +#define BLE_ANCS_EVENT_FLAG_SILENT 0 /**< 0b.......1 Silent: First (LSB) bit is set. All flags can be active at the same time.*/ +#define BLE_ANCS_EVENT_FLAG_IMPORTANT 1 /**< 0b......1. Important: Second (LSB) bit is set. All flags can be active at the same time.*/ +#define BLE_ANCS_EVENT_FLAG_PREEXISTING 2 /**< 0b.....1.. Pre-existing: Third (LSB) bit is set. All flags can be active at the same time.*/ +#define BLE_ANCS_EVENT_FLAG_POSITIVE_ACTION 3 /**< 0b....1... Positive action: Fourth (LSB) bit is set. All flags can be active at the same time.*/ +#define BLE_ANCS_EVENT_FLAG_NEGATIVE_ACTION 4 /**< 0b...1.... Negative action: Fifth (LSB) bit is set. All flags can be active at the same time. */ + + +/**@brief Event types that are passed from client to application on an event. */ +typedef enum +{ + BLE_ANCS_C_EVT_DISCOVER_COMPLETE, /**< A successful connection has been established and the service was found on the connected peer. */ + BLE_ANCS_C_EVT_DISCOVER_FAILED, /**< It was not possible to discover the service or characteristics of the connected peer. */ + BLE_ANCS_C_EVT_NOTIF, /**< An iOS notification was received on the notification source control point. */ + BLE_ANCS_C_EVT_INVALID_NOTIF, /**< An iOS notification was received on the notification source control point, but the format is invalid. */ + BLE_ANCS_C_EVT_NOTIF_ATTRIBUTE /**< A received iOS notification attribute has been parsed. */ +} ble_ancs_c_evt_type_t; + +/**@brief Category IDs for iOS notifications. */ +typedef enum +{ + BLE_ANCS_CATEGORY_ID_OTHER, /**< The iOS notification belongs to the "other" category. */ + BLE_ANCS_CATEGORY_ID_INCOMING_CALL, /**< The iOS notification belongs to the "Incoming Call" category. */ + BLE_ANCS_CATEGORY_ID_MISSED_CALL, /**< The iOS notification belongs to the "Missed Call" category. */ + BLE_ANCS_CATEGORY_ID_VOICE_MAIL, /**< The iOS notification belongs to the "Voice Mail" category. */ + BLE_ANCS_CATEGORY_ID_SOCIAL, /**< The iOS notification belongs to the "Social" category. */ + BLE_ANCS_CATEGORY_ID_SCHEDULE, /**< The iOS notification belongs to the "Schedule" category. */ + BLE_ANCS_CATEGORY_ID_EMAIL, /**< The iOS notification belongs to the "E-mail" category. */ + BLE_ANCS_CATEGORY_ID_NEWS, /**< The iOS notification belongs to the "News" category. */ + BLE_ANCS_CATEGORY_ID_HEALTH_AND_FITNESS, /**< The iOS notification belongs to the "Health and Fitness" category. */ + BLE_ANCS_CATEGORY_ID_BUSINESS_AND_FINANCE, /**< The iOS notification belongs to the "Buisness and Finance" category. */ + BLE_ANCS_CATEGORY_ID_LOCATION, /**< The iOS notification belongs to the "Location" category. */ + BLE_ANCS_CATEGORY_ID_ENTERTAINMENT /**< The iOS notification belongs to the "Entertainment" category. */ +} ble_ancs_c_category_id_values_t; + +/**@brief Event IDs for iOS notifications. */ +typedef enum +{ + BLE_ANCS_EVENT_ID_NOTIFICATION_ADDED, /**< The iOS notification was added. */ + BLE_ANCS_EVENT_ID_NOTIFICATION_MODIFIED, /**< The iOS notification was modified. */ + BLE_ANCS_EVENT_ID_NOTIFICATION_REMOVED /**< The iOS notification was removed. */ +} ble_ancs_c_evt_id_values_t; + +/**@brief Control point command IDs that the Notification Consumer can send to the Notification Provider. */ +typedef enum +{ + BLE_ANCS_COMMAND_ID_GET_NOTIF_ATTRIBUTES, /**< Requests attributes to be sent from the NP to the NC for a given notification. */ + BLE_ANCS_COMMAND_ID_GET_APP_ATTRIBUTES, /**< Requests attributes to be sent from the NP to the NC for a given iOS App. */ + BLE_ANCS_COMMAND_ID_GET_PERFORM_NOTIF_ACTION, /**< Requests an action to be performed on a given notification, for example dismiss an alarm. */ +} ble_ancs_c_command_id_values_t; + +/**@brief IDs for iOS notification attributes. */ +typedef enum +{ + BLE_ANCS_NOTIF_ATTR_ID_APP_IDENTIFIER, /**< Identifies that the attribute data is of an "App Identifier" type. */ + BLE_ANCS_NOTIF_ATTR_ID_TITLE, /**< Identifies that the attribute data is a "Title". */ + BLE_ANCS_NOTIF_ATTR_ID_SUBTITLE, /**< Identifies that the attribute data is a "Subtitle". */ + BLE_ANCS_NOTIF_ATTR_ID_MESSAGE, /**< Identifies that the attribute data is a "Message". */ + BLE_ANCS_NOTIF_ATTR_ID_MESSAGE_SIZE, /**< Identifies that the attribute data is a "Message Size". */ + BLE_ANCS_NOTIF_ATTR_ID_DATE, /**< Identifies that the attribute data is a "Date". */ + BLE_ANCS_NOTIF_ATTR_ID_POSITIVE_ACTION_LABEL, /**< The notification has a "Positive action" that can be executed associated with it. */ + BLE_ANCS_NOTIF_ATTR_ID_NEGATIVE_ACTION_LABEL, /**< The notification has a "Negative action" that can be executed associated with it. */ +} ble_ancs_c_notif_attr_id_values_t; + + +/**@brief Flags for iOS notifications. */ +typedef struct +{ + uint8_t silent : 1; /**< If this flag is set, the notification has a low priority. */ + uint8_t important : 1; /**< If this flag is set, the notification has a high priority. */ + uint8_t pre_existing : 1; /**< If this flag is set, the notification is pre-existing. */ + uint8_t positive_action : 1; /**< If this flag is set, the notification has a positive action that can be taken. */ + uint8_t negative_action : 1; /**< If this flag is set, the notification has a negative action that can be taken. */ +} ble_ancs_c_notif_flags_t; + +/**@brief iOS notification structure. */ +typedef struct +{ + ble_ancs_c_evt_id_values_t evt_id; /**< Whether the notification was added, removed, or modified. */ + ble_ancs_c_notif_flags_t evt_flags; /**< Bitmask to signal if a special condition applies to the notification, for example, "Silent" or "Important". */ + ble_ancs_c_category_id_values_t category_id; /**< Classification of the notification type, for example, email or location. */ + uint8_t category_count; /**< Current number of active notifications for this category ID. */ + uint32_t notif_uid; /**< Notification UID. */ +} ble_ancs_c_evt_notif_t; + + +/**@brief iOS notification attribute structure for incomming attributes. */ +typedef struct +{ + uint32_t notif_uid; /**< UID of the notification that the attribute belongs to.*/ + uint16_t attr_len; /**< Length of the received attribute data. */ + ble_ancs_c_notif_attr_id_values_t attr_id; /**< Classification of the attribute type, for example, title or date. */ +} ble_ancs_c_evt_notif_attr_t; + + +/**@brief iOS notification attribute content wanted by our application. */ +typedef struct +{ + bool get; /**< Boolean to determine if this attribute will be requested from the Notification Provider. */ + ble_ancs_c_notif_attr_id_values_t attr_id; /**< Attribute ID: AppIdentifier(0), Title(1), Subtitle(2), Message(3), MessageSize(4), Date(5), PositiveActionLabel(6), NegativeActionLabel(7). */ + uint16_t attr_len; /**< Length of the attribute. If more data is received from the Notification Provider, all data beyond this length is discarded. */ + uint8_t * p_attr_data; /**< Pointer to where the memory is allocated for storing incoming attributes. */ +} ble_ancs_c_attr_list_t; + + +/**@brief ANCS client module event structure. + * + * @details The structure contains the event that should be handled by the main application. + */ +typedef struct +{ + ble_ancs_c_evt_type_t evt_type; /**< Type of event. */ + ble_uuid_t uuid; /**< UUID of the event if it is an iOS notification. */ + ble_ancs_c_evt_notif_t notif; /**< iOS notification. */ + ble_ancs_c_evt_notif_attr_t attr; /**< Currently received attribute for a given notification. */ + uint32_t error_code; /**< Additional status or error code if the event was caused by a stack error or GATT status, for example, during service discovery. */ + ble_ancs_c_attr_list_t * ancs_attr_list; /**< List of attributes that will be requested if attributes are requested for a notification.*/ +} ble_ancs_c_evt_t; + + +/**@brief iOS notification event handler type. */ +typedef void (*ble_ancs_c_evt_handler_t) (ble_ancs_c_evt_t * p_evt); + + +/**@brief iOS notification structure, which contains various status information for the client. */ +typedef struct +{ + ble_ancs_c_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Apple Notification client application. */ + ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */ + uint16_t conn_handle; /**< Handle of the current connection (as provided by the BLE stack; BLE_CONN_HANDLE_INVALID if not in a connection). */ + uint8_t central_handle; /**< Handle of the currently connected peer (if we have a bond in the Device Manager). */ + uint8_t service_handle; /**< Handle of the service in the database to use for this instance. */ +} ble_ancs_c_t; + + +/**@brief Apple Notification client init structure, which contains all options and data needed for + * initialization of the client.*/ +typedef struct +{ + ble_ancs_c_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Battery Service. */ + ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */ +} ble_ancs_c_init_t; + + +/**@brief Apple Notification Center Service UUIDs. */ +extern const ble_uuid128_t ble_ancs_base_uuid128; /**< Service UUID. */ +extern const ble_uuid128_t ble_ancs_cp_base_uuid128; /**< Control point UUID. */ +extern const ble_uuid128_t ble_ancs_ns_base_uuid128; /**< Notification source UUID. */ +extern const ble_uuid128_t ble_ancs_ds_base_uuid128; /**< Data source UUID. */ + + +/**@brief Function for handling the application's BLE Stack events. + * + * @details Handles all events from the BLE stack that are of interest to the ANCS client. + * + * @param[in] p_ancs ANCS client structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +void ble_ancs_c_on_ble_evt(ble_ancs_c_t * p_ancs, const ble_evt_t * p_ble_evt); + + +/**@brief Function for handling the ANCS client Device Manager events. + * + * @details This function handles all events from the Device Manager that are of interest to the + * ANCS client. When reconnecting to the existing central and creating new bonds for + * handling service discovery and writing to the Apple Notification Control Point, the + * Notification Provider will send new and unread iOS notifications again. + * + * @param[in] p_ancs ANCS client structure. + * @param[in] p_handle Pointer to the ANCS device handle. + * @param[in] p_dm_evt Event received from the Device Manager. + */ +void ble_ancs_c_on_device_manager_evt(ble_ancs_c_t * p_ancs, + dm_handle_t const * p_handle, + dm_event_t const * p_dm_evt); + + +/**@brief Function for initializing the ANCS client. + * + * @param[out] p_ancs ANCS client structure. This structure must be + * supplied by the application. It is initialized by this function + * and will later be used to identify this particular client instance. + * @param[in] p_ancs_init Information needed to initialize the client. + * + * @retval NRF_SUCCESS If the client was initialized successfully. Otherwise, an error code is returned. + */ +uint32_t ble_ancs_c_init(ble_ancs_c_t * p_ancs, const ble_ancs_c_init_t * p_ancs_init); + + +/**@brief Function for writing to the CCCD to enable notifications from the Apple Notification Service. + * + * @param[in] p_ancs iOS notification structure. This structure must be supplied by + * the application. It identifies the particular client instance to use. + * + * @retval NRF_SUCCESS If writing to the CCCD was successful. Otherwise, an error code is returned. + */ +uint32_t ble_ancs_c_notif_source_notif_enable(const ble_ancs_c_t * p_ancs); + + +/**@brief Function for writing to the CCCD to enable data source notifications from the ANCS. + * + * @param[in] p_ancs iOS notification structure. This structure must be supplied by + * the application. It identifies the particular client instance to use. + * + * @retval NRF_SUCCESS If writing to the CCCD was successful. Otherwise, an error code is returned. + */ +uint32_t ble_ancs_c_data_source_notif_enable(const ble_ancs_c_t * p_ancs); + + +/**@brief Function for writing to the CCCD to disable notifications from the ANCS. + * + * @param[in] p_ancs iOS notification structure. This structure must be supplied by + * the application. It identifies the particular client instance to use. + * + * @retval NRF_SUCCESS If writing to the CCCD was successful. Otherwise, an error code is returned. + */ +uint32_t ble_ancs_c_notif_source_notif_disable(const ble_ancs_c_t * p_ancs); + + +/**@brief Function for writing to the CCCD to disable data source notifications from the ANCS. + * + * @param[in] p_ancs iOS notification structure. This structure must be supplied by + * the application. It identifies the particular client instance to use. + * + * @retval NRF_SUCCESS If writing to the CCCD was successful. Otherwise, an error code is returned. + */ +uint32_t ble_ancs_c_data_source_notif_disable(const ble_ancs_c_t * p_ancs); + + +/**@brief Function for registering attributes that will be requested if ble_ancs_c_request_attrs + * is called. + * + * @param[in] id ID of the attribute that will be added. + * @param[in] p_data Pointer to a buffer where the data of the attribute can be stored. + * @param[in] len Length of the buffer where the data of the attribute can be stored. + + * @retval NRF_SUCCESS If all operations were successful. Otherwise, an error code is returned. + */ +uint32_t ble_ancs_c_attr_add(const ble_ancs_c_notif_attr_id_values_t id, uint8_t * p_data, const uint16_t len); + + +/**@brief Function for requesting attributes for a notification. + * + * @param[in] p_notif Pointer to the notification whose attributes will be requested from + * the Notification Provider. + * + * @retval NRF_SUCCESS If all operations were successful. Otherwise, an error code is returned. + */ +uint32_t ble_ancs_c_request_attrs(const ble_ancs_c_evt_notif_t * p_notif); + +#endif // BLE_ANCS_C_H__ + +/** @} */ + diff --git a/components/ble/ble_services/ble_ans_c/ble_ans_c.c b/components/ble/ble_services/ble_ans_c/ble_ans_c.c new file mode 100644 index 0000000..fca4b2c --- /dev/null +++ b/components/ble/ble_services/ble_ans_c/ble_ans_c.c @@ -0,0 +1,1049 @@ +/* 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. + */ + +/* Attention! +* To maintain compliance with Nordic Semiconductor ASAs Bluetooth profile +* qualification listings, this section of source code must not be modified. +*/ + +#include "ble_ans_c.h" +#include +#include +#include "ble_err.h" +#include "ble_srv_common.h" +#include "nordic_common.h" +#include "nrf_assert.h" +#include "device_manager.h" +#include "pstorage.h" + +#define START_HANDLE_DISCOVER 0x0001 /**< Value of start handle during discovery. */ + +#define NOTIFICATION_DATA_LENGTH 2 /**< The mandatory length of notification data. After the mandatory data, the optional message is located. */ +#define READ_DATA_LENGTH_MIN 1 /**< Minimum data length in a valid Alert Notification Read Response message. */ + +#define TX_BUFFER_MASK 0x07 /**< TX Buffer mask, must be a mask of contiguous zeroes, followed by contiguous sequence of ones: 000...111. */ +#define TX_BUFFER_SIZE (TX_BUFFER_MASK + 1) /**< Size of send buffer, which is 1 higher than the mask. */ +#define WRITE_MESSAGE_LENGTH 2 /**< Length of the write message for CCCD/control point. */ + +#define BLE_ANS_MAX_DISCOVERED_CENTRALS DEVICE_MANAGER_MAX_BONDS /**< Maximum number of discovered services that can be stored in the flash. This number should be identical to maximum number of bonded centrals. */ + +#define DISCOVERED_SERVICE_DB_SIZE \ + CEIL_DIV(sizeof(alert_service_t) * BLE_ANS_MAX_DISCOVERED_CENTRALS, sizeof(uint32_t)) /**< Size of bonded centrals database in word size (4 byte). */ + +typedef enum +{ + READ_REQ = 1, /**< Type identifying that this tx_message is a read request. */ + WRITE_REQ /**< Type identifying that this tx_message is a write request. */ +} ans_tx_request_t; + +typedef enum +{ + STATE_UNINITIALIZED, /**< Uninitialized state of the internal state machine. */ + STATE_IDLE, /**< Idle state, this is the state when no central has connected to this device. */ + STATE_DISC_SERV, /**< A BLE central is connected and a service discovery is in progress. */ + STATE_DISC_CHAR, /**< A BLE central is connected and characteristic discovery is in progress. */ + STATE_DISC_DESC, /**< A BLE central is connected and descriptor discovery is in progress. */ + STATE_RUNNING, /**< A BLE central is connected and complete service discovery has been performed. */ + STATE_WAITING_ENC, /**< A previously bonded BLE central has re-connected and the service awaits the setup of an encrypted link. */ + STATE_RUNNING_NOT_DISCOVERED, /**< A BLE central is connected and a service discovery is in progress. */ +} ans_state_t; + +/**@brief Structure used for holding the characteristic found during discovery process. + */ +typedef struct +{ + ble_uuid_t uuid; /**< UUID identifying this characteristic. */ + ble_gatt_char_props_t properties; /**< Properties for this characteristic. */ + uint16_t handle_decl; /**< Characteristic Declaration Handle for this characteristic. */ + uint16_t handle_value; /**< Value Handle for the value provided in this characteristic. */ + uint16_t handle_cccd; /**< CCCD Handle value for this characteristic. BLE_ANS_INVALID_HANDLE if not present in the central. */ +} alert_characteristic_t; + +/**@brief Structure used for holding the Alert Notification Service found during discovery process. + */ +typedef struct +{ + uint8_t handle; /**< Handle of Alert Notification Service which identifies to which central this discovered service belongs. */ + ble_gattc_service_t service; /**< The GATT service holding the discovered Alert Notification Service. */ + alert_characteristic_t alert_notif_ctrl_point; /**< Characteristic for the Alert Notification Control Point. */ + alert_characteristic_t suported_new_alert_cat; /**< Characteristic for the Supported New Alert category. */ + alert_characteristic_t suported_unread_alert_cat; /**< Characteristic for the Unread Alert category. */ + alert_characteristic_t new_alert; /**< Characteristic for the New Alert Notification. */ + alert_characteristic_t unread_alert_status; /**< Characteristic for the Unread Alert Notification. */ +} alert_service_t; + +/**@brief Structure for writing a message to the central, i.e. Control Point or CCCD. + */ +typedef struct +{ + uint8_t gattc_value[WRITE_MESSAGE_LENGTH]; /**< The message to write. */ + ble_gattc_write_params_t gattc_params; /**< GATTC parameters for this message. */ +} write_params_t; + +/**@brief Structure for holding data to be transmitted to the connected central. + */ +typedef struct +{ + uint16_t conn_handle; /**< Connection handle to be used when transmitting this message. */ + ans_tx_request_t type; /**< Type of this message, i.e. read or write message. */ + union + { + uint16_t read_handle; /**< Read request message. */ + write_params_t write_req; /**< Write request message. */ + } req; +} tx_message_t; + +static tx_message_t m_tx_buffer[TX_BUFFER_SIZE]; /**< Transmit buffer for messages to be transmitted to the central. */ +static uint32_t m_tx_insert_index = 0; /**< Current index in the transmit buffer where next message should be inserted. */ +static uint32_t m_tx_index = 0; /**< Current index in the transmit buffer from where the next message to be transmitted resides. */ +static pstorage_handle_t m_flash_handle; /**< Flash handle where discovered services for bonded masters should be stored. */ + +static ans_state_t m_client_state = STATE_UNINITIALIZED; /**< Current state of the Alert Notification State Machine. */ + +static uint32_t m_service_db[DISCOVERED_SERVICE_DB_SIZE]; /**< Service database for bonded centrals (Word size aligned). */ +static alert_service_t * mp_service_db; /**< Pointer to start of discovered services database. */ +static alert_service_t m_service; /**< Current service data. */ +static ble_ans_c_t * m_ans_c_obj; /**< Pointer to the instantiated object. */ + + +/**@brief Function for passing any pending request from the buffer to the stack. + */ +static void tx_buffer_process(void) +{ + if (m_tx_index != m_tx_insert_index) + { + uint32_t err_code; + + if (m_tx_buffer[m_tx_index].type == READ_REQ) + { + err_code = sd_ble_gattc_read(m_tx_buffer[m_tx_index].conn_handle, + m_tx_buffer[m_tx_index].req.read_handle, + 0); + } + else + { + err_code = sd_ble_gattc_write(m_tx_buffer[m_tx_index].conn_handle, + &m_tx_buffer[m_tx_index].req.write_req.gattc_params); + } + if (err_code == NRF_SUCCESS) + { + ++m_tx_index; + m_tx_index &= TX_BUFFER_MASK; + } + } +} + + +/**@brief Function for updating the current state and sending an event on discovery failure. + */ +static void handle_discovery_failure(const ble_ans_c_t * p_ans, uint32_t code) +{ + ble_ans_c_evt_t event; + + m_client_state = STATE_RUNNING_NOT_DISCOVERED; + event.evt_type = BLE_ANS_C_EVT_DISCOVER_FAILED; + event.data.error_code = code; + + p_ans->evt_handler(&event); +} + + +/**@brief Function for executing the Service Discovery Procedure. + */ +static void service_disc_req_send(const ble_ans_c_t * p_ans) +{ + uint16_t handle = START_HANDLE_DISCOVER; + ble_uuid_t ans_uuid; + uint32_t err_code; + + // Discover services on uuid Alert Notification. + BLE_UUID_BLE_ASSIGN(ans_uuid, BLE_UUID_ALERT_NOTIFICATION_SERVICE); + + err_code = sd_ble_gattc_primary_services_discover(p_ans->conn_handle, handle, &ans_uuid); + if (err_code != NRF_SUCCESS) + { + handle_discovery_failure(p_ans, err_code); + } + else + { + m_client_state = STATE_DISC_SERV; + } +} + + +/**@brief Function for executing the Characteristic Discovery Procedure. + */ +static void characteristic_disc_req_send(const ble_ans_c_t * p_ans, + const ble_gattc_handle_range_t * p_handle) +{ + uint32_t err_code; + + // With valid service, we should discover characteristics. + err_code = sd_ble_gattc_characteristics_discover(p_ans->conn_handle, p_handle); + + if (err_code == NRF_SUCCESS) + { + m_client_state = STATE_DISC_CHAR; + } + else + { + handle_discovery_failure(p_ans, err_code); + } +} + + +/**@brief Function for executing the Characteristic Descriptor Discovery Procedure. + */ +static void descriptor_disc_req_send(const ble_ans_c_t * p_ans) +{ + ble_gattc_handle_range_t descriptor_handle; + uint32_t err_code = NRF_SUCCESS; + + // If we have not discovered descriptors for all characteristics, + // we will discover next descriptor. + if (m_service.new_alert.handle_cccd == BLE_ANS_INVALID_HANDLE) + { + descriptor_handle.start_handle = m_service.new_alert.handle_value + 1; + descriptor_handle.end_handle = m_service.new_alert.handle_value + 1; + + err_code = sd_ble_gattc_descriptors_discover(p_ans->conn_handle, &descriptor_handle); + } + else if (m_service.unread_alert_status.handle_cccd == BLE_ANS_INVALID_HANDLE) + { + descriptor_handle.start_handle = m_service.unread_alert_status.handle_value + 1; + descriptor_handle.end_handle = m_service.unread_alert_status.handle_value + 1; + + err_code = sd_ble_gattc_descriptors_discover(p_ans->conn_handle, &descriptor_handle); + } + + if (err_code == NRF_SUCCESS) + { + m_client_state = STATE_DISC_DESC; + } + else + { + handle_discovery_failure(p_ans, err_code); + } +} + + +/**@brief Function for indicating that a connection has successfully been established. + * Either when the Service Discovery Procedure completes or a re-connection has been + * established to a bonded central. + * + * @details This function is executed when a service discovery or a re-connect to a bonded central + * occurs. In the event of re-connection to a bonded central, this function will ensure + * writing of the control point according to the Alert Notification Service Client + * specification. + * Finally an event is passed to the application: + * BLE_ANS_C_EVT_RECONNECT - When we are connected to an existing central and the + * alert notification control point has been written. + * BLE_ANS_C_EVT_DISCOVER_COMPLETE - When we are connected to a new central and the Service + * Discovery has been completed. + */ +static void connection_established(const ble_ans_c_t * p_ans) +{ + ble_ans_c_evt_t event; + + m_client_state = STATE_RUNNING; + + if (m_service.handle == INVALID_SERVICE_HANDLE) + { + m_service.handle = INVALID_SERVICE_HANDLE_DISC; + } + + if (p_ans->central_handle != DM_INVALID_ID && + m_service.handle < INVALID_SERVICE_HANDLE_BASE) + { + uint32_t err_code = ble_ans_c_new_alert_notify(p_ans, ANS_TYPE_ALL_ALERTS); + if (err_code != NRF_SUCCESS && p_ans->error_handler != NULL) + { + p_ans->error_handler(err_code); + } + + err_code = ble_ans_c_unread_alert_notify(p_ans, ANS_TYPE_ALL_ALERTS); + if (err_code != NRF_SUCCESS && p_ans->error_handler != NULL) + { + p_ans->error_handler(err_code); + } + + event.evt_type = BLE_ANS_C_EVT_RECONNECT; + p_ans->evt_handler(&event); + } + else + { + event.evt_type = BLE_ANS_C_EVT_DISCOVER_COMPLETE; + p_ans->evt_handler(&event); + } +} + + +/**@brief Function for waiting until an encrypted link has been established to a bonded central. + */ +static void encrypted_link_setup_wait(const ble_ans_c_t * p_ans) +{ + m_client_state = STATE_WAITING_ENC; +} + + +/**@brief Function for handling the connect event when a central connects. + * + * @details This function will check if bonded central connects, and do the following + * Bonded central - enter wait for encryption state. + * Unknown central - Initiate service discovery procedure. + */ +static void event_connect(ble_ans_c_t * p_ans, const ble_evt_t * p_ble_evt) +{ + p_ans->conn_handle = p_ble_evt->evt.gatts_evt.conn_handle; + + if (p_ans->central_handle != DM_INVALID_ID) + { + m_service = mp_service_db[p_ans->central_handle]; + encrypted_link_setup_wait(p_ans); + } + else + { + m_service.handle = INVALID_SERVICE_HANDLE; + service_disc_req_send(p_ans); + } +} + + +/**@brief Function for handling the encrypted link event when a secure + * connection has been established with a central. + * + * @details This function will check if the service for the central is known. + * Service known - Execute action running / switch to running state. + * Service unknown - Initiate Service Discovery Procedure. + */ +static void event_encrypted_link(ble_ans_c_t * p_ans, const ble_evt_t * p_ble_evt) +{ + // If we are setting up a bonded connection and the UUID of the service + // is unknown, a new discovery must be performed. + if (m_service.service.uuid.uuid != BLE_UUID_ALERT_NOTIFICATION_SERVICE) + { + m_service.handle = INVALID_SERVICE_HANDLE; + service_disc_req_send(p_ans); + } + else + { + connection_established(p_ans); + } +} + + +/**@brief Function for handling the response on service discovery. + * + * @details This function will validate the response. + * Invalid response - Handle discovery failure. + * Valid response - Initiate Characteristic Discovery Procedure. + */ +static void event_discover_rsp(ble_ans_c_t * p_ans, const ble_evt_t * p_ble_evt) +{ + if (p_ble_evt->evt.gattc_evt.gatt_status != BLE_GATT_STATUS_SUCCESS) + { + // We have received an unexpected result. + // As we are in a connected state, but can not continue + // our service discovery, we will go to running state. + handle_discovery_failure(p_ans, p_ble_evt->evt.gattc_evt.gatt_status); + } + else + { + BLE_UUID_COPY_INST(m_service.service.uuid, + p_ble_evt->evt.gattc_evt.params.prim_srvc_disc_rsp.services[0].uuid); + + if (p_ble_evt->evt.gattc_evt.params.prim_srvc_disc_rsp.count > 0) + { + const ble_gattc_service_t * p_service; + + p_service = &(p_ble_evt->evt.gattc_evt.params.prim_srvc_disc_rsp.services[0]); + + m_service.service.handle_range.start_handle = p_service->handle_range.start_handle; + m_service.service.handle_range.end_handle = p_service->handle_range.end_handle; + + characteristic_disc_req_send(p_ans, &(m_service.service.handle_range)); + } + else + { + // If we receive an answer, but it contains no service, we just go to state: Running. + handle_discovery_failure(p_ans, p_ble_evt->evt.gattc_evt.gatt_status); + } + } +} + + +/**@brief Function for setting the discovered characteristics in the alert service. + */ +static void characteristics_set(alert_characteristic_t * p_characteristic, + const ble_gattc_char_t * p_char_resp) +{ + BLE_UUID_COPY_INST(p_characteristic->uuid, p_char_resp->uuid); + + p_characteristic->properties = p_char_resp->char_props; + p_characteristic->handle_decl = p_char_resp->handle_decl; + p_characteristic->handle_value = p_char_resp->handle_value; + p_characteristic->handle_cccd = BLE_ANS_INVALID_HANDLE; +} + + +/**@brief Function for handling a characteristic discovery response event. + * + * @details This function will validate and store the characteristics received. + * If not all characteristics are discovered it will continue the characteristic discovery + * procedure, otherwise it will continue with the descriptor discovery procedure. + * If we receive a GATT Client error, we will go to handling of discovery failure. + */ +static void event_characteristic_rsp(ble_ans_c_t * p_ans, const ble_evt_t * p_ble_evt) +{ + if (p_ble_evt->evt.gattc_evt.gatt_status == BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_FOUND || + p_ble_evt->evt.gattc_evt.gatt_status == BLE_GATT_STATUS_ATTERR_INVALID_HANDLE) + { + if ((m_service.alert_notif_ctrl_point.handle_value == 0) || + (m_service.suported_new_alert_cat.handle_value == 0) || + (m_service.suported_unread_alert_cat.handle_value == 0) || + (m_service.new_alert.handle_value == 0) || + (m_service.unread_alert_status.handle_value == 0)) + { + // At least one required characteristic is missing on the server side. + handle_discovery_failure(p_ans, NRF_ERROR_NOT_FOUND); + } + else + { + descriptor_disc_req_send(p_ans); + } + } + else if (p_ble_evt->evt.gattc_evt.gatt_status) + { + // We have received an unexpected result. + // As we are in a connected state, but can not continue + // our service discovery, we must go to running state. + handle_discovery_failure(p_ans, p_ble_evt->evt.gattc_evt.gatt_status); + } + else + { + uint32_t i; + const ble_gattc_char_t * p_char_resp = NULL; + + // Iterate trough the characteristics and find the correct one. + for (i = 0; i < p_ble_evt->evt.gattc_evt.params.char_disc_rsp.count; i++) + { + p_char_resp = &(p_ble_evt->evt.gattc_evt.params.char_disc_rsp.chars[i]); + switch (p_char_resp->uuid.uuid) + { + case BLE_UUID_ALERT_NOTIFICATION_CONTROL_POINT_CHAR: + characteristics_set(&m_service.alert_notif_ctrl_point, p_char_resp); + break; + + case BLE_UUID_UNREAD_ALERT_CHAR: + characteristics_set(&m_service.unread_alert_status, p_char_resp); + break; + + case BLE_UUID_NEW_ALERT_CHAR: + characteristics_set(&m_service.new_alert, p_char_resp); + break; + + case BLE_UUID_SUPPORTED_UNREAD_ALERT_CATEGORY_CHAR: + characteristics_set(&m_service.suported_unread_alert_cat, p_char_resp); + break; + + case BLE_UUID_SUPPORTED_NEW_ALERT_CATEGORY_CHAR: + characteristics_set(&m_service.suported_new_alert_cat, p_char_resp); + break; + + default: + // No implementation needed. + break; + } + } + + if (p_char_resp != NULL) + { + // If not all characteristics are received, we do a 2nd/3rd/... round. + ble_gattc_handle_range_t char_handle; + + char_handle.start_handle = p_char_resp->handle_value + 1; + char_handle.end_handle = m_service.service.handle_range.end_handle; + + characteristic_disc_req_send(p_ans, &char_handle); + } + else + { + characteristic_disc_req_send(p_ans, &(m_service.service.handle_range)); + } + } +} + + +/**@brief Function for setting the discovered descriptor in the alert service. + */ +static void descriptor_set(alert_service_t * p_service, const ble_gattc_desc_t * p_desc_resp) +{ + if (p_service->new_alert.handle_value == (p_desc_resp->handle - 1) && + p_desc_resp->uuid.uuid == BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG) + { + p_service->new_alert.handle_cccd = p_desc_resp->handle; + } + else if (p_service->unread_alert_status.handle_value == (p_desc_resp->handle - 1) && + p_desc_resp->uuid.uuid == BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG) + { + p_service->unread_alert_status.handle_cccd = p_desc_resp->handle; + } +} + + +/**@brief Function for handling of descriptor discovery responses. + * + * @details This function will validate and store the descriptor received. + * If not all descriptors are discovered it will continue the descriptor discovery + * procedure, otherwise it will continue to running state. + * If we receive a GATT Client error, we will go to handling of discovery failure. + */ +static void event_descriptor_rsp(ble_ans_c_t * p_ans, const ble_evt_t * p_ble_evt) +{ + if (p_ble_evt->evt.gattc_evt.gatt_status == BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_FOUND || + p_ble_evt->evt.gattc_evt.gatt_status == BLE_GATT_STATUS_ATTERR_INVALID_HANDLE) + { + handle_discovery_failure(p_ans, NRF_ERROR_NOT_FOUND); + } + else if (p_ble_evt->evt.gattc_evt.gatt_status) + { + // We have received an unexpected result. + // As we are in a connected state, but can not continue + // our descriptor discovery, we will go to running state. + handle_discovery_failure(p_ans, p_ble_evt->evt.gattc_evt.gatt_status); + } + else + { + if (p_ble_evt->evt.gattc_evt.params.desc_disc_rsp.count > 0) + { + descriptor_set(&m_service, &(p_ble_evt->evt.gattc_evt.params.desc_disc_rsp.descs[0])); + } + + if (m_service.new_alert.handle_cccd == BLE_ANS_INVALID_HANDLE || + m_service.unread_alert_status.handle_cccd == BLE_ANS_INVALID_HANDLE) + { + descriptor_disc_req_send(p_ans); + } + else + { + connection_established(p_ans); + } + } +} + + +/**@brief Function for receiving and validating notifications received from the central. + */ +static void event_notify(ble_ans_c_t * p_ans, const ble_evt_t * p_ble_evt) +{ + uint32_t message_length; + ble_ans_c_evt_t event; + ble_ans_alert_notification_t * p_alert = &event.data.alert; + const ble_gattc_evt_hvx_t * p_notification = &p_ble_evt->evt.gattc_evt.params.hvx; + + // Message is not valid -> ignore. + event.evt_type = BLE_ANS_C_EVT_NOTIFICATION; + if (p_notification->len < NOTIFICATION_DATA_LENGTH) + { + return; + } + message_length = p_notification->len - NOTIFICATION_DATA_LENGTH; + + if (p_notification->handle == m_service.new_alert.handle_value) + { + BLE_UUID_COPY_INST(event.uuid, m_service.new_alert.uuid); + } + else if (p_notification->handle == m_service.unread_alert_status.handle_value) + { + BLE_UUID_COPY_INST(event.uuid, m_service.unread_alert_status.uuid); + } + else + { + // Nothing to process. + return; + } + + p_alert->alert_category = p_notification->data[0]; + p_alert->alert_category_count = p_notification->data[1]; //lint !e415 + p_alert->alert_msg_length = (message_length > p_ans->message_buffer_size) + ? p_ans->message_buffer_size + : message_length; + p_alert->p_alert_msg_buf = p_ans->p_message_buffer; + + memcpy(p_alert->p_alert_msg_buf, + &p_notification->data[NOTIFICATION_DATA_LENGTH], + p_alert->alert_msg_length); //lint !e416 + + p_ans->evt_handler(&event); +} + + +/**@brief Function for handling write response events. + */ +static void event_write_rsp(ble_ans_c_t * p_ans, const ble_evt_t * p_ble_evt) +{ + tx_buffer_process(); +} + + +/**@brief Function for validating and passing the response to the application, + * when a read response is received. + */ +static void event_read_rsp(ble_ans_c_t * p_ans, const ble_evt_t * p_ble_evt) +{ + ble_ans_c_evt_t event; + const ble_gattc_evt_read_rsp_t * p_response; + + p_response = &p_ble_evt->evt.gattc_evt.params.read_rsp; + event.evt_type = BLE_ANS_C_EVT_READ_RESP; + + if (p_response->len < READ_DATA_LENGTH_MIN) + { + tx_buffer_process(); + return; + } + + if (p_response->handle == m_service.suported_new_alert_cat.handle_value) + { + BLE_UUID_COPY_INST(event.uuid, m_service.suported_new_alert_cat.uuid); + } + else if (p_response->handle == m_service.suported_unread_alert_cat.handle_value) + { + BLE_UUID_COPY_INST(event.uuid, m_service.suported_unread_alert_cat.uuid); + } + else + { + // Bad response, ignore. + tx_buffer_process(); + return; + } + + event.data.settings = *(ble_ans_alert_settings_t *)(p_response->data); + + if (p_response->len == READ_DATA_LENGTH_MIN) + { + // Those must default to 0, if they are not returned by central. + event.data.settings.ans_high_prioritized_alert_support = 0; + event.data.settings.ans_instant_message_support = 0; + } + + p_ans->evt_handler(&event); + + tx_buffer_process(); +} + + +/**@brief Function for disconnecting and cleaning the current service. + */ +static void event_disconnect(ble_ans_c_t * p_ans) +{ + ble_ans_c_evt_t event; + ans_state_t prev_state = m_client_state; + + m_client_state = STATE_IDLE; + + if (m_service.handle == INVALID_SERVICE_HANDLE_DISC && + p_ans->central_handle != DM_INVALID_ID) + { + m_service.handle = p_ans->central_handle; + } + + if (m_service.handle < BLE_ANS_MAX_DISCOVERED_CENTRALS) + { + mp_service_db[m_service.handle] = m_service; + } + + memset(&m_service, 0, sizeof(alert_service_t)); + + m_service.handle = INVALID_SERVICE_HANDLE; + p_ans->service_handle = INVALID_SERVICE_HANDLE; + p_ans->conn_handle = BLE_CONN_HANDLE_INVALID; + p_ans->central_handle = DM_INVALID_ID; + + // Only if our previous state was RUNNING, i.e. the client had fully initialized, then the + // application should be notified of the DISCONNECT_COMPLETE. + if (prev_state == STATE_RUNNING) + { + event.evt_type = BLE_ANS_C_EVT_DISCONN_COMPLETE; + p_ans->evt_handler(&event); + } +} + + +/**@brief Function for handling of Device Manager events. + */ +void ble_ans_c_on_device_manager_evt(ble_ans_c_t * p_ans, + dm_handle_t const * p_handle, + dm_event_t const * p_dm_evt) +{ + switch (p_dm_evt->event_id) + { + case DM_EVT_CONNECTION: + // Fall through. + case DM_EVT_SECURITY_SETUP_COMPLETE: + p_ans->central_handle = p_handle->device_id; + break; + default: + // Do nothing. + break; + } +} + + +/**@brief Function for handling of BLE stack events. + */ +void ble_ans_c_on_ble_evt(ble_ans_c_t * p_ans, const ble_evt_t * p_ble_evt) +{ + uint16_t event = p_ble_evt->header.evt_id; + + switch (m_client_state) + { + case STATE_UNINITIALIZED: + // Initialization is handle in special case, thus if we enter here, it means that an + // event is received even though we are not initialized --> ignore. + break; + + case STATE_IDLE: + if (event == BLE_GAP_EVT_CONNECTED) + { + event_connect(p_ans, p_ble_evt); + } + break; + + case STATE_WAITING_ENC: + if ((event == BLE_GAP_EVT_AUTH_STATUS) || (event == BLE_GAP_EVT_SEC_INFO_REQUEST)) + { + event_encrypted_link(p_ans, p_ble_evt); + } + else if (event == BLE_GAP_EVT_DISCONNECTED) + { + event_disconnect(p_ans); + } + break; + + case STATE_DISC_SERV: + if (event == BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP) + { + event_discover_rsp(p_ans, p_ble_evt); + } + else if (event == BLE_GAP_EVT_DISCONNECTED) + { + event_disconnect(p_ans); + } + break; + + case STATE_DISC_CHAR: + if (event == BLE_GATTC_EVT_CHAR_DISC_RSP) + { + event_characteristic_rsp(p_ans, p_ble_evt); + } + else if (event == BLE_GAP_EVT_DISCONNECTED) + { + event_disconnect(p_ans); + } + break; + + case STATE_DISC_DESC: + if (event == BLE_GATTC_EVT_DESC_DISC_RSP) + { + event_descriptor_rsp(p_ans, p_ble_evt); + } + else if (event == BLE_GAP_EVT_DISCONNECTED) + { + event_disconnect(p_ans); + } + break; + + case STATE_RUNNING: + if (event == BLE_GATTC_EVT_HVX) + { + event_notify(p_ans, p_ble_evt); + } + else if (event == BLE_GATTC_EVT_READ_RSP) + { + event_read_rsp(p_ans, p_ble_evt); + } + else if (event == BLE_GATTC_EVT_WRITE_RSP) + { + event_write_rsp(p_ans, p_ble_evt); + } + else if (event == BLE_GAP_EVT_DISCONNECTED) + { + event_disconnect(p_ans); + } + else + { + // Do nothing, event not handled in this state. + } + break; + + case STATE_RUNNING_NOT_DISCOVERED: + if (event == BLE_GAP_EVT_DISCONNECTED) + { + event_disconnect(p_ans); + } + break; + + default: + event_disconnect(p_ans); + break; + } +} + + +static void ans_pstorage_callback(pstorage_handle_t * handle, + uint8_t op_code, + uint32_t reason, + uint8_t * p_data, + uint32_t param_len) +{ + if (reason != NRF_SUCCESS) + { + m_ans_c_obj->error_handler(reason); + } +} + + +uint32_t ble_ans_c_init(ble_ans_c_t * p_ans, const ble_ans_c_init_t * p_ans_init) +{ + uint32_t err_code; + pstorage_module_param_t param; + + if (p_ans_init->evt_handler == NULL) + { + return NRF_ERROR_INVALID_PARAM; + } + + p_ans->evt_handler = p_ans_init->evt_handler; + p_ans->error_handler = p_ans_init->error_handler; + p_ans->service_handle = INVALID_SERVICE_HANDLE; + p_ans->central_handle = DM_INVALID_ID; + p_ans->service_handle = 0; + p_ans->message_buffer_size = p_ans_init->message_buffer_size; + p_ans->p_message_buffer = p_ans_init->p_message_buffer; + p_ans->conn_handle = BLE_CONN_HANDLE_INVALID; + + m_ans_c_obj = p_ans; + + memset(&m_service, 0, sizeof(alert_service_t)); + memset(m_tx_buffer, 0, TX_BUFFER_SIZE); + + m_service.handle = INVALID_SERVICE_HANDLE; + m_client_state = STATE_IDLE; + + param.block_count = 1; + param.block_size = DISCOVERED_SERVICE_DB_SIZE * sizeof(uint32_t); // uint32_t array. + param.cb = ans_pstorage_callback; + + // Register with storage module. + err_code = pstorage_register(¶m, &m_flash_handle); + + mp_service_db = (alert_service_t *) (m_service_db); + + return err_code; +} + + +/**@brief Function for creating a TX message for writing a CCCD. + */ +static uint32_t cccd_configure(uint16_t conn_handle, uint16_t handle_cccd, bool enable) +{ + tx_message_t * p_msg; + uint16_t cccd_val = enable ? BLE_GATT_HVX_NOTIFICATION : 0; + + if (m_client_state != STATE_RUNNING) + { + return NRF_ERROR_INVALID_STATE; + } + + p_msg = &m_tx_buffer[m_tx_insert_index++]; + m_tx_insert_index &= TX_BUFFER_MASK; + + p_msg->req.write_req.gattc_params.handle = handle_cccd; + p_msg->req.write_req.gattc_params.len = WRITE_MESSAGE_LENGTH; + p_msg->req.write_req.gattc_params.p_value = p_msg->req.write_req.gattc_value; + p_msg->req.write_req.gattc_params.offset = 0; + p_msg->req.write_req.gattc_params.write_op = BLE_GATT_OP_WRITE_REQ; + p_msg->req.write_req.gattc_value[0] = LSB_16(cccd_val); + p_msg->req.write_req.gattc_value[1] = MSB_16(cccd_val); + p_msg->conn_handle = conn_handle; + p_msg->type = WRITE_REQ; + + tx_buffer_process(); + return NRF_SUCCESS; +} + + +uint32_t ble_ans_c_enable_notif_new_alert(const ble_ans_c_t * p_ans) +{ + return cccd_configure(p_ans->conn_handle, + m_service.new_alert.handle_cccd, + true); +} + + +uint32_t ble_ans_c_disable_notif_new_alert(const ble_ans_c_t * p_ans) +{ + return cccd_configure(p_ans->conn_handle, + m_service.new_alert.handle_cccd, + false); +} + + +uint32_t ble_ans_c_enable_notif_unread_alert(const ble_ans_c_t * p_ans) +{ + return cccd_configure(p_ans->conn_handle, + m_service.unread_alert_status.handle_cccd, + true); +} + + +uint32_t ble_ans_c_disable_notif_unread_alert(const ble_ans_c_t * p_ans) +{ + return cccd_configure(p_ans->conn_handle, + m_service.unread_alert_status.handle_cccd, + false); +} + + +uint32_t ble_ans_c_control_point_write(const ble_ans_c_t * p_ans, + const ble_ans_control_point_t * p_control_point) +{ + tx_message_t * p_msg; + + if (m_client_state != STATE_RUNNING) + { + return NRF_ERROR_INVALID_STATE; + } + + p_msg = &m_tx_buffer[m_tx_insert_index++]; + m_tx_insert_index &= TX_BUFFER_MASK; + + p_msg->req.write_req.gattc_params.handle = m_service.alert_notif_ctrl_point.handle_value; + p_msg->req.write_req.gattc_params.len = WRITE_MESSAGE_LENGTH; + p_msg->req.write_req.gattc_params.p_value = p_msg->req.write_req.gattc_value; + p_msg->req.write_req.gattc_params.offset = 0; + p_msg->req.write_req.gattc_params.write_op = BLE_GATT_OP_WRITE_REQ; + p_msg->req.write_req.gattc_value[0] = p_control_point->command; + p_msg->req.write_req.gattc_value[1] = p_control_point->category; + p_msg->conn_handle = p_ans->conn_handle; + p_msg->type = WRITE_REQ; + + tx_buffer_process(); + return NRF_SUCCESS; +} + + +uint32_t ble_ans_c_new_alert_read(const ble_ans_c_t * p_ans) +{ + tx_message_t * msg; + + msg = &m_tx_buffer[m_tx_insert_index++]; + m_tx_insert_index &= TX_BUFFER_MASK; + + msg->req.read_handle = m_service.suported_new_alert_cat.handle_value; + msg->conn_handle = p_ans->conn_handle; + msg->type = READ_REQ; + + tx_buffer_process(); + return NRF_SUCCESS; +} + + +uint32_t ble_ans_c_unread_alert_read(const ble_ans_c_t * p_ans) +{ + tx_message_t * msg; + + msg = &m_tx_buffer[m_tx_insert_index++]; + m_tx_insert_index &= TX_BUFFER_MASK; + + msg->req.read_handle = m_service.suported_unread_alert_cat.handle_value; + msg->conn_handle = p_ans->conn_handle; + msg->type = READ_REQ; + + tx_buffer_process(); + return NRF_SUCCESS; +} + + +uint32_t ble_ans_c_new_alert_notify(const ble_ans_c_t * p_ans, ble_ans_category_id_t category_id) +{ + ble_ans_control_point_t control_point; + + control_point.command = ANS_NOTIFY_NEW_INCOMING_ALERT_IMMEDIATELY; + control_point.category = category_id; + + return ble_ans_c_control_point_write(p_ans, &control_point); +} + + +uint32_t ble_ans_c_unread_alert_notify(const ble_ans_c_t * p_ans, ble_ans_category_id_t category_id) +{ + ble_ans_control_point_t control_point; + + control_point.command = ANS_NOTIFY_UNREAD_CATEGORY_STATUS_IMMEDIATELY; + control_point.category = category_id; + + return ble_ans_c_control_point_write(p_ans, &control_point); +} + + +uint32_t ble_ans_c_service_load(const ble_ans_c_t * p_ans) +{ + uint32_t err_code; + uint32_t i; + + err_code = pstorage_load((uint8_t *)m_service_db, + &m_flash_handle, + (DISCOVERED_SERVICE_DB_SIZE * sizeof(uint32_t)), + 0); + + if (err_code != NRF_SUCCESS) + { + // Problem with loading values from flash, initialize the RAM DB with default. + for (i = 0; i < BLE_ANS_MAX_DISCOVERED_CENTRALS; ++i) + { + mp_service_db[i].handle = INVALID_SERVICE_HANDLE; + } + + if (err_code == NRF_ERROR_NOT_FOUND) + { + // The flash does not contain any memorized centrals, set the return code to success. + err_code = NRF_SUCCESS; + } + } + return err_code; +} + + +uint32_t ble_ans_c_service_store(void) +{ + uint32_t err_code; + + err_code = pstorage_store(&m_flash_handle, + (uint8_t *) m_service_db, + DISCOVERED_SERVICE_DB_SIZE * sizeof(uint32_t), + 0); + + return err_code; +} + + +uint32_t ble_ans_c_service_delete(void) +{ + if (m_client_state == STATE_UNINITIALIZED) + { + return NRF_SUCCESS; + } + + return pstorage_clear(&m_flash_handle, (DISCOVERED_SERVICE_DB_SIZE * sizeof(uint32_t))); +} + diff --git a/components/ble/ble_services/ble_ans_c/ble_ans_c.h b/components/ble/ble_services/ble_ans_c/ble_ans_c.h new file mode 100644 index 0000000..8c52e65 --- /dev/null +++ b/components/ble/ble_services/ble_ans_c/ble_ans_c.h @@ -0,0 +1,352 @@ +/* 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 ble_sdk_srv_ans_c Alert Notification Service Client + * @{ + * @ingroup ble_sdk_srv + * @brief Alert Notification module. + * + * @details This module implements the Alert Notification Client according to the + * Alert Notification Profile. + * + * @note The application must propagate BLE stack events to the Alert Notification Client module + * by calling ble_ans_c_on_ble_evt() from the @ref softdevice_handler callback. + * + * @note Attention! + * To maintain compliance with Nordic Semiconductor ASA Bluetooth profile + * qualification listings, this section of source code must not be modified. + */ +#ifndef BLE_ANS_C_H__ +#define BLE_ANS_C_H__ + +#include "ble.h" +#include "ble_gatts.h" +#include "ble_types.h" +#include "ble_srv_common.h" +#include "device_manager.h" + +#define ANS_NB_OF_CHARACTERISTICS 5 /**< Number of characteristics as defined by Alert Notification Service specification. */ +#define ANS_NB_OF_SERVICES 1 /**< Number of services supported in one central. */ +#define INVALID_SERVICE_HANDLE_BASE 0xF0 /**< Base for indicating invalid service handle. */ +#define INVALID_SERVICE_HANDLE (INVALID_SERVICE_HANDLE_BASE + 0x0F) /**< Indication that the current service handle is invalid. */ +#define INVALID_SERVICE_HANDLE_DISC (INVALID_SERVICE_HANDLE_BASE + 0x0E) /**< Indication that the current service handle is invalid but the service has been discovered. */ +#define BLE_ANS_INVALID_HANDLE 0xFF /**< Indication that the current service handle is invalid. */ + +// Forward declaration of the ble_ans_c_t type. +typedef struct ble_ans_c_s ble_ans_c_t; + +/** Alerts types as defined in the alert category id; UUID: 0x2A43. */ +typedef enum +{ + ANS_TYPE_SIMPLE_ALERT = 0, /**< General text alert or non-text alert.*/ + ANS_TYPE_EMAIL = 1, /**< Alert when email messages arrives.*/ + ANS_TYPE_NEWS = 2, /**< News feeds such as RSS, Atom.*/ + ANS_TYPE_NOTIFICATION_CALL = 3, /**< Incoming call.*/ + ANS_TYPE_MISSED_CALL = 4, /**< Missed call.*/ + ANS_TYPE_SMS_MMS = 5, /**< SMS/MMS message arrives.*/ + ANS_TYPE_VOICE_MAIL = 6, /**< Voice mail.*/ + ANS_TYPE_SCHEDULE = 7, /**< Alert occurred on calendar, planner.*/ + ANS_TYPE_HIGH_PRIORITIZED_ALERT = 8, /**< Alert that should be handled as high priority.*/ + ANS_TYPE_INSTANT_MESSAGE = 9, /**< Alert for incoming instant messages.*/ + ANS_TYPE_ALL_ALERTS = 0xFF /**< Identifies All Alerts. */ +} ble_ans_category_id_t; + +/** Alerts notification control point commands as defined in the Alert Notification Specification; + * UUID: 0x2A44. + */ +typedef enum +{ + ANS_ENABLE_NEW_INCOMING_ALERT_NOTIFICATION = 0, /**< Enable New Incoming Alert Notification.*/ + ANS_ENABLE_UNREAD_CATEGORY_STATUS_NOTIFICATION = 1, /**< Enable Unread Category Status Notification.*/ + ANS_DISABLE_NEW_INCOMING_ALERT_NOTIFICATION = 2, /**< Disable New Incoming Alert Notification.*/ + ANS_DISABLE_UNREAD_CATEGORY_STATUS_NOTIFICATION = 3, /**< Disable Unread Category Status Notification.*/ + ANS_NOTIFY_NEW_INCOMING_ALERT_IMMEDIATELY = 4, /**< Notify New Incoming Alert immediately.*/ + ANS_NOTIFY_UNREAD_CATEGORY_STATUS_IMMEDIATELY = 5, /**< Notify Unread Category Status immediately.*/ +} ble_ans_command_id_t; + +/**@brief Alert Notification Event types that are passed from client to application on an event. */ +typedef enum +{ + BLE_ANS_C_EVT_DISCOVER_COMPLETE, /**< A successful connection has been established and the characteristics of the server has been fetched. */ + BLE_ANS_C_EVT_DISCOVER_FAILED, /**< It was not possible to discover service or characteristics of the connected peer. */ + BLE_ANS_C_EVT_RECONNECT, /**< A re-connection to a known and previously discovered central has occurred. */ + BLE_ANS_C_EVT_DISCONN_COMPLETE, /**< The connection has been taken down. */ + BLE_ANS_C_EVT_NOTIFICATION, /**< A valid Alert Notification has been received from the server.*/ + BLE_ANS_C_EVT_READ_RESP, /**< A read response has been received from the server.*/ + BLE_ANS_C_EVT_WRITE_RESP /**< A write response has been received from the server.*/ +} ble_ans_c_evt_type_t; + +/**@brief Alert Notification Control Point structure. */ +typedef struct +{ + ble_ans_command_id_t command; /**< The command to be written to the control point, see @ref ble_ans_command_id_t. */ + ble_ans_category_id_t category; /**< The category for the control point for which the command applies, see @ref ble_ans_category_id_t. */ +} ble_ans_control_point_t; + +/**@brief Alert Notification Setting structure containing the supported alerts in the service. + * + *@details + * The structure contains bit fields describing which alerts that are supported: + * 0 = Unsupported + * 1 = Supported + */ +typedef struct +{ + uint8_t ans_simple_alert_support : 1; /**< Support for General text alert or non-text alert.*/ + uint8_t ans_email_support : 1; /**< Support for Alert when email messages arrives.*/ + uint8_t ans_news_support : 1; /**< Support for News feeds such as RSS, Atom.*/ + uint8_t ans_notification_call_support : 1; /**< Support for Incoming call.*/ + uint8_t ans_missed_call_support : 1; /**< Support for Missed call.*/ + uint8_t ans_sms_mms_support : 1; /**< Support for SMS/MMS message arrives.*/ + uint8_t ans_voice_mail_support : 1; /**< Support for Voice mail.*/ + uint8_t ans_schedule_support : 1; /**< Support for Alert occurred on calendar, planner.*/ + uint8_t ans_high_prioritized_alert_support : 1; /**< Support for Alert that should be handled as high priority.*/ + uint8_t ans_instant_message_support : 1; /**< Support for Alert for incoming instant messages.*/ + uint8_t reserved : 6; /**< Reserved for future use. */ +} ble_ans_alert_settings_t; + +/**@brief Alert Notification structure + */ +typedef struct +{ + uint8_t alert_category; /**< Alert category to which this alert belongs.*/ + uint8_t alert_category_count; /**< Number of alerts in the category. */ + uint32_t alert_msg_length; /**< Length of optional text message send by the server. */ + uint8_t * p_alert_msg_buf; /**< Pointer to buffer containing the optional text message. */ +} ble_ans_alert_notification_t; + +/**@brief Alert Notification Event structure + * + * @details The structure contains the event that should be handled, as well as + * additional information. + */ +typedef struct +{ + ble_ans_c_evt_type_t evt_type; /**< Type of event. */ + ble_uuid_t uuid; /**< UUID of the event in case of an alert or notification. */ + union + { + ble_ans_alert_settings_t settings; /**< Setting returned from server on read request. */ + ble_ans_alert_notification_t alert; /**< Alert Notification data sent by the server. */ + uint32_t error_code; /**< Additional status/error code if the event was caused by a stack error or gatt status, e.g. during service discovery. */ + } data; +} ble_ans_c_evt_t; + +/**@brief Alert Notification event handler type. */ +typedef void (*ble_ans_c_evt_handler_t) (ble_ans_c_evt_t * p_evt); + +/**@brief Alert Notification structure. This contains various status information for the client. */ +struct ble_ans_c_s +{ + ble_ans_c_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Alert Notification Client Application. */ + ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */ + uint16_t conn_handle; /**< Handle of the current connection (as provided by the BLE stack, is BLE_CONN_HANDLE_INVALID if not in a connection). */ + uint8_t central_handle; /**< Handle for the currently connected central if peer is bonded. */ + uint8_t service_handle; /**< Handle to the service in the database to use for this instance. */ + uint32_t message_buffer_size; /**< Size of message buffer to hold the additional text messages received on notifications. */ + uint8_t * p_message_buffer; /**< Pointer to the buffer to be used for additional text message handling. */ +}; + +/**@brief Alert Notification init structure. This contains all options and data needed for + * initialization of the client.*/ +typedef struct +{ + ble_ans_c_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Battery Service. */ + ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */ + uint32_t message_buffer_size; /**< Size of buffer to handle messages. */ + uint8_t * p_message_buffer; /**< Pointer to buffer for passing messages. */ +} ble_ans_c_init_t; + + +/**@brief Function for handling the Application's BLE Stack events. + * + * @details Handles all events from the BLE stack of interest to the Alert Notification Client. + * + * @param[in] p_ans Alert Notification Client structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +void ble_ans_c_on_ble_evt(ble_ans_c_t * p_ans, const ble_evt_t * p_ble_evt); + + +/**@brief Function for handling the Alert Notification Client - Device Manager Event. + * + * @details Handles all events from the Bond Manager of interest to the Alert Notification Client. + * The Alert Notification Client will use the events of re-connection to existing central + * and creation of new bonds for handling of service discovery and writing of the Alert + * Notification Control Point for re-send of New Alert and Unread Alert notifications. + * + * @param[in] p_ans Alert Notification Client structure. + * @param[in] p_handle Handle. + * @param[in] p_dm_evt Event received from the Bond Manager. + */ +void ble_ans_c_on_device_manager_evt(ble_ans_c_t * p_ans, + dm_handle_t const * p_handle, + dm_event_t const * p_dm_evt); + + +/**@brief Function for initializing the Alert Notification Client. + * + * @param[out] p_ans Alert Notification Client 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 this particular client instance. + * @param[in] p_ans_init Information needed to initialize the client. + * + * @return NRF_SUCCESS on successful initialization of client, otherwise an error code. + */ +uint32_t ble_ans_c_init(ble_ans_c_t * p_ans, const ble_ans_c_init_t * p_ans_init); + + +/**@brief Function for writing the to CCCD to enable new alert notifications from the Alert Notification Service. + * + * @param[in] p_ans Alert Notification structure. This structure will have to be supplied by + * the application. It identifies the particular client instance to use. + * + * @return NRF_SUCCESS on successful writing of the CCCD, otherwise an error code. + */ +uint32_t ble_ans_c_enable_notif_new_alert(const ble_ans_c_t * p_ans); + + +/**@brief Function for writing to the CCCD to enable unread alert notifications from the Alert Notification Service. + * + * @param[in] p_ans Alert Notification structure. This structure will have to be supplied by + * the application. It identifies the particular client instance to use. + * + * @return NRF_SUCCESS on successful writing of the CCCD, otherwise an error code. + */ +uint32_t ble_ans_c_enable_notif_unread_alert(const ble_ans_c_t * p_ans); + + +/**@brief Function for writing to the CCCD to disable new alert notifications from the Alert Notification Service. + * + * @param[in] p_ans Alert Notification structure. This structure will have to be supplied by + * the application. It identifies the particular client instance to use. + * + * @return NRF_SUCCESS on successful writing of the CCCD, otherwise an error code. + */ +uint32_t ble_ans_c_disable_notif_new_alert(const ble_ans_c_t * p_ans); + + +/**@brief Function for writing to the CCCD to disable unread alert notifications from the Alert Notification Service. + * + * @param[in] p_ans Alert Notification structure. This structure will have to be supplied by + * the application. It identifies the particular client instance to use. + * + * @return NRF_SUCCESS on successful writing of the CCCD, otherwise an error code. + */ +uint32_t ble_ans_c_disable_notif_unread_alert(const ble_ans_c_t * p_ans); + + +/**@brief Function for writing to the Alert Notification Control Point to specify alert notification behavior in the + * Alert Notification Service on the Central. + * + * @param[in] p_ans Alert Notification structure. This structure will have to be + * supplied by the application. It identifies the particular client + * instance to use. + * @param[in] p_control_point Alert Notification Control Point structure. This structure + * specifies the values to write to the Alert Notification Control + * Point, UUID 0x2A44. + * + * @return NRF_SUCCESS on successful writing of the Control Point, otherwise an error code. + */ +uint32_t ble_ans_c_control_point_write(const ble_ans_c_t * p_ans, + const ble_ans_control_point_t * p_control_point); + + +/**@brief Function for reading the Supported New Alert characteristic value of the service. + * The value describes the alerts supported in the central. + * + * @param[in] p_ans Alert Notification structure. This structure will have to be supplied by + * the application. It identifies the particular client instance to use. + * + * @return NRF_SUCCESS on successful transmission of the read request, otherwise an error code. + */ +uint32_t ble_ans_c_new_alert_read(const ble_ans_c_t * p_ans); + + +/**@brief Function for reading the Supported Unread Alert characteristic value of the service. + * The value describes the alerts supported in the central. + * + * @param[in] p_ans Alert Notification structure. This structure will have to be supplied by + * the application. It identifies the particular client instance to use. + * + * @return NRF_SUCCESS on successful transmission of the read request, otherwise an error code. + */ +uint32_t ble_ans_c_unread_alert_read(const ble_ans_c_t * p_ans); + + +/**@brief Function for requesting the peer to notify the New Alert characteristics immediately. + * + * @param[in] p_ans Alert Notification structure. This structure will have to be supplied by + * the application. It identifies the particular client instance to use. + * @param[in] category The category ID for which the peer should notify the client. + * + * @return NRF_SUCCESS on successful transmission of the read request, otherwise an error code. + */ +uint32_t ble_ans_c_new_alert_notify(const ble_ans_c_t * p_ans, ble_ans_category_id_t category); + + +/**@brief Function for requesting the peer to notify the Unread Alert characteristics immediately. + * + * @param[in] p_ans Alert Notification structure. This structure will have to be supplied by + * the application. It identifies the particular client instance to use. + * @param[in] category The category ID for which the peer should notify the client. + * + * @return NRF_SUCCESS on successful transmission of the read request, otherwise an error code. + */ +uint32_t ble_ans_c_unread_alert_notify(const ble_ans_c_t * p_ans, ble_ans_category_id_t category); + + +/**@brief Function for loading previous discovered service and characteristic handles for bonded centrals from + * flash into RAM. + * + * @details Read the database of all discovered service and characteristic handles from flash. + * If the flash does not contain any valid data, the array of discovered service handles in + * RAM will be empty. + * + * @param[in] p_ans Alert Notification structure. This structure will have to be supplied by the + * application. It identifies the particular client instance to use. + * + * @note Currently the Alert Notification Client uses only one page in flash. + * + * @return NRF_SUCCESS if all operations went successfully, an error_code otherwise. + */ +uint32_t ble_ans_c_service_load(const ble_ans_c_t * p_ans); + + +/**@brief Function for storing discovered service and characteristic handles for bonded centrals into flash memory. + * + * @details This function will erase the flash page (if the data to store + * are diferent than the one already stored) and then write into flash. Those + * operations could prevent the radio to run. + * + * @note Do not call this function while in a connection or when advertising. If you do, the + * behavior is undefined. + * + * @return NRF_SUCCESS if all operations went successfully, an error_code otherwise. + */ +uint32_t ble_ans_c_service_store(void); + + +/**@brief Function for deleting the Alert Notification Client database from flash. + * + * @details After calling this function you should call ble_ans_c_init(...) to re-initialize + * the RAM database. + * + * @return NRF_SUCCESS if all operations went successfully. + */ +uint32_t ble_ans_c_service_delete(void); + +#endif // BLE_ANS_C_H__ + +/** @} */ + diff --git a/components/ble/ble_services/ble_bas/ble_bas.c b/components/ble/ble_services/ble_bas/ble_bas.c new file mode 100644 index 0000000..2922a3a --- /dev/null +++ b/components/ble/ble_services/ble_bas/ble_bas.c @@ -0,0 +1,316 @@ +/* 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. + * + */ + +/* Attention! +* To maintain compliance with Nordic Semiconductor ASAs Bluetooth profile +* qualification listings, this section of source code must not be modified. +*/ + +#include "ble_bas.h" +#include +#include "nordic_common.h" +#include "ble_srv_common.h" +#include "app_util.h" + + +#define INVALID_BATTERY_LEVEL 255 + + +/**@brief Function for handling the Connect event. + * + * @param[in] p_bas Battery Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_connect(ble_bas_t * p_bas, ble_evt_t * p_ble_evt) +{ + p_bas->conn_handle = p_ble_evt->evt.gap_evt.conn_handle; +} + + +/**@brief Function for handling the Disconnect event. + * + * @param[in] p_bas Battery Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_disconnect(ble_bas_t * p_bas, ble_evt_t * p_ble_evt) +{ + UNUSED_PARAMETER(p_ble_evt); + p_bas->conn_handle = BLE_CONN_HANDLE_INVALID; +} + + +/**@brief Function for handling the Write event. + * + * @param[in] p_bas Battery Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_write(ble_bas_t * p_bas, ble_evt_t * p_ble_evt) +{ + if (p_bas->is_notification_supported) + { + ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write; + + if ( + (p_evt_write->handle == p_bas->battery_level_handles.cccd_handle) + && + (p_evt_write->len == 2) + ) + { + // CCCD written, call application event handler + if (p_bas->evt_handler != NULL) + { + ble_bas_evt_t evt; + + if (ble_srv_is_notification_enabled(p_evt_write->data)) + { + evt.evt_type = BLE_BAS_EVT_NOTIFICATION_ENABLED; + } + else + { + evt.evt_type = BLE_BAS_EVT_NOTIFICATION_DISABLED; + } + + p_bas->evt_handler(p_bas, &evt); + } + } + } +} + + +void ble_bas_on_ble_evt(ble_bas_t * p_bas, ble_evt_t * p_ble_evt) +{ + if (p_bas == NULL || p_ble_evt == NULL) + { + return; + } + + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + on_connect(p_bas, p_ble_evt); + break; + + case BLE_GAP_EVT_DISCONNECTED: + on_disconnect(p_bas, p_ble_evt); + break; + + case BLE_GATTS_EVT_WRITE: + on_write(p_bas, p_ble_evt); + break; + + default: + // No implementation needed. + break; + } +} + + +/**@brief Function for adding the Battery Level characteristic. + * + * @param[in] p_bas Battery Service structure. + * @param[in] p_bas_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t battery_level_char_add(ble_bas_t * p_bas, const ble_bas_init_t * p_bas_init) +{ + uint32_t err_code; + 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; + uint8_t initial_battery_level; + uint8_t encoded_report_ref[BLE_SRV_ENCODED_REPORT_REF_LEN]; + uint8_t init_len; + + // Add Battery Level characteristic + if (p_bas->is_notification_supported) + { + memset(&cccd_md, 0, sizeof(cccd_md)); + + // According to BAS_SPEC_V10, the read operation on cccd should be possible without + // authentication. + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm); + cccd_md.write_perm = p_bas_init->battery_level_char_attr_md.cccd_write_perm; + cccd_md.vloc = BLE_GATTS_VLOC_STACK; + } + + memset(&char_md, 0, sizeof(char_md)); + + char_md.char_props.read = 1; + char_md.char_props.notify = (p_bas->is_notification_supported) ? 1 : 0; + 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 = (p_bas->is_notification_supported) ? &cccd_md : NULL; + char_md.p_sccd_md = NULL; + + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_BATTERY_LEVEL_CHAR); + + memset(&attr_md, 0, sizeof(attr_md)); + + attr_md.read_perm = p_bas_init->battery_level_char_attr_md.read_perm; + attr_md.write_perm = p_bas_init->battery_level_char_attr_md.write_perm; + attr_md.vloc = BLE_GATTS_VLOC_STACK; + attr_md.rd_auth = 0; + attr_md.wr_auth = 0; + attr_md.vlen = 0; + + initial_battery_level = p_bas_init->initial_batt_level; + + 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 = sizeof(uint8_t); + attr_char_value.init_offs = 0; + attr_char_value.max_len = sizeof(uint8_t); + attr_char_value.p_value = &initial_battery_level; + + err_code = sd_ble_gatts_characteristic_add(p_bas->service_handle, &char_md, + &attr_char_value, + &p_bas->battery_level_handles); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (p_bas_init->p_report_ref != NULL) + { + // Add Report Reference descriptor + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_REPORT_REF_DESCR); + + memset(&attr_md, 0, sizeof(attr_md)); + + attr_md.read_perm = p_bas_init->battery_level_report_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 = 0; + + init_len = ble_srv_report_ref_encode(encoded_report_ref, p_bas_init->p_report_ref); + + 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 = init_len; + attr_char_value.init_offs = 0; + attr_char_value.max_len = attr_char_value.init_len; + attr_char_value.p_value = encoded_report_ref; + + err_code = sd_ble_gatts_descriptor_add(p_bas->battery_level_handles.value_handle, + &attr_char_value, + &p_bas->report_ref_handle); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + else + { + p_bas->report_ref_handle = BLE_GATT_HANDLE_INVALID; + } + + return NRF_SUCCESS; +} + + +uint32_t ble_bas_init(ble_bas_t * p_bas, const ble_bas_init_t * p_bas_init) +{ + if (p_bas == NULL || p_bas_init == NULL) + { + return NRF_ERROR_NULL; + } + + uint32_t err_code; + ble_uuid_t ble_uuid; + + // Initialize service structure + p_bas->evt_handler = p_bas_init->evt_handler; + p_bas->conn_handle = BLE_CONN_HANDLE_INVALID; + p_bas->is_notification_supported = p_bas_init->support_notification; + p_bas->battery_level_last = INVALID_BATTERY_LEVEL; + + // Add service + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_BATTERY_SERVICE); + + err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &ble_uuid, &p_bas->service_handle); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add battery level characteristic + return battery_level_char_add(p_bas, p_bas_init); +} + + +uint32_t ble_bas_battery_level_update(ble_bas_t * p_bas, uint8_t battery_level) +{ + if (p_bas == NULL) + { + return NRF_ERROR_NULL; + } + + uint32_t err_code = NRF_SUCCESS; + ble_gatts_value_t gatts_value; + + if (battery_level != p_bas->battery_level_last) + { + // Initialize value struct. + memset(&gatts_value, 0, sizeof(gatts_value)); + + gatts_value.len = sizeof(uint8_t); + gatts_value.offset = 0; + gatts_value.p_value = &battery_level; + + // Update database. + err_code = sd_ble_gatts_value_set(p_bas->conn_handle, + p_bas->battery_level_handles.value_handle, + &gatts_value); + if (err_code == NRF_SUCCESS) + { + // Save new battery value. + p_bas->battery_level_last = battery_level; + } + else + { + return err_code; + } + + // Send value if connected and notifying. + if ((p_bas->conn_handle != BLE_CONN_HANDLE_INVALID) && p_bas->is_notification_supported) + { + ble_gatts_hvx_params_t hvx_params; + + memset(&hvx_params, 0, sizeof(hvx_params)); + + hvx_params.handle = p_bas->battery_level_handles.value_handle; + hvx_params.type = BLE_GATT_HVX_NOTIFICATION; + hvx_params.offset = gatts_value.offset; + hvx_params.p_len = &gatts_value.len; + hvx_params.p_data = gatts_value.p_value; + + err_code = sd_ble_gatts_hvx(p_bas->conn_handle, &hvx_params); + } + else + { + err_code = NRF_ERROR_INVALID_STATE; + } + } + + return err_code; +} diff --git a/components/ble/ble_services/ble_bas/ble_bas.h b/components/ble/ble_services/ble_bas/ble_bas.h new file mode 100644 index 0000000..7673a7c --- /dev/null +++ b/components/ble/ble_services/ble_bas/ble_bas.h @@ -0,0 +1,133 @@ +/* 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 ble_sdk_srv_bas Battery Service + * @{ + * @ingroup ble_sdk_srv + * @brief Battery Service module. + * + * @details This module implements the Battery Service with the Battery Level characteristic. + * During initialization it adds the Battery Service and Battery Level characteristic + * to the BLE stack database. Optionally it can also add a Report Reference descriptor + * to the Battery Level characteristic (used when including the Battery Service in + * the HID service). + * + * If specified, the module will support notification of the Battery Level characteristic + * through the ble_bas_battery_level_update() function. + * If an event handler is supplied by the application, the Battery Service will + * generate Battery Service events to the application. + * + * @note The application must propagate BLE stack events to the Battery Service module by calling + * ble_bas_on_ble_evt() from the @ref softdevice_handler callback. + * + * @note Attention! + * To maintain compliance with Nordic Semiconductor ASA Bluetooth profile + * qualification listings, this section of source code must not be modified. + */ + +#ifndef BLE_BAS_H__ +#define BLE_BAS_H__ + +#include +#include +#include "ble.h" +#include "ble_srv_common.h" + +/**@brief Battery Service event type. */ +typedef enum +{ + BLE_BAS_EVT_NOTIFICATION_ENABLED, /**< Battery value notification enabled event. */ + BLE_BAS_EVT_NOTIFICATION_DISABLED /**< Battery value notification disabled event. */ +} ble_bas_evt_type_t; + +/**@brief Battery Service event. */ +typedef struct +{ + ble_bas_evt_type_t evt_type; /**< Type of event. */ +} ble_bas_evt_t; + +// Forward declaration of the ble_bas_t type. +typedef struct ble_bas_s ble_bas_t; + +/**@brief Battery Service event handler type. */ +typedef void (*ble_bas_evt_handler_t) (ble_bas_t * p_bas, ble_bas_evt_t * p_evt); + +/**@brief Battery Service init structure. This contains all options and data needed for + * initialization of the service.*/ +typedef struct +{ + ble_bas_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Battery Service. */ + bool support_notification; /**< TRUE if notification of Battery Level measurement is supported. */ + ble_srv_report_ref_t * p_report_ref; /**< If not NULL, a Report Reference descriptor with the specified value will be added to the Battery Level characteristic */ + uint8_t initial_batt_level; /**< Initial battery level */ + ble_srv_cccd_security_mode_t battery_level_char_attr_md; /**< Initial security level for battery characteristics attribute */ + ble_gap_conn_sec_mode_t battery_level_report_read_perm; /**< Initial security level for battery report read attribute */ +} ble_bas_init_t; + +/**@brief Battery Service structure. This contains various status information for the service. */ +struct ble_bas_s +{ + ble_bas_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Battery Service. */ + uint16_t service_handle; /**< Handle of Battery Service (as provided by the BLE stack). */ + ble_gatts_char_handles_t battery_level_handles; /**< Handles related to the Battery Level characteristic. */ + uint16_t report_ref_handle; /**< Handle of the Report Reference descriptor. */ + uint8_t battery_level_last; /**< Last Battery Level measurement passed to the Battery Service. */ + uint16_t conn_handle; /**< Handle of the current connection (as provided by the BLE stack, is BLE_CONN_HANDLE_INVALID if not in a connection). */ + bool is_notification_supported; /**< TRUE if notification of Battery Level is supported. */ +}; + +/**@brief Function for initializing the Battery Service. + * + * @param[out] p_bas Battery 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 this particular service instance. + * @param[in] p_bas_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on successful initialization of service, otherwise an error code. + */ +uint32_t ble_bas_init(ble_bas_t * p_bas, const ble_bas_init_t * p_bas_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. + * + * @note For the requirements in the BAS specification to be fulfilled, + * ble_bas_battery_level_update() must be called upon reconnection if the + * battery level has changed while the service has been disconnected from a bonded + * client. + * + * @param[in] p_bas Battery Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +void ble_bas_on_ble_evt(ble_bas_t * p_bas, ble_evt_t * p_ble_evt); + +/**@brief Function for updating the battery level. + * + * @details The application calls this function after having performed a battery measurement. If + * notification has been enabled, the battery level characteristic is sent to the client. + * + * @note For the requirements in the BAS specification to be fulfilled, + * this function must be called upon reconnection if the battery level has changed + * while the service has been disconnected from a bonded client. + * + * @param[in] p_bas Battery Service structure. + * @param[in] battery_level New battery measurement value (in percent of full capacity). + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +uint32_t ble_bas_battery_level_update(ble_bas_t * p_bas, uint8_t battery_level); + +#endif // BLE_BAS_H__ + +/** @} */ diff --git a/components/ble/ble_services/ble_bas_c/ble_bas_c.c b/components/ble/ble_services/ble_bas_c/ble_bas_c.c new file mode 100644 index 0000000..04d16e0 --- /dev/null +++ b/components/ble/ble_services/ble_bas_c/ble_bas_c.c @@ -0,0 +1,321 @@ +/* + * Copyright (c) 2012 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. + * + */ + +#include "ble_bas_c.h" +#include +#include "ble_db_discovery.h" +#include "ble_types.h" +#include "ble_srv_common.h" +#include "nrf_error.h" +#include "ble_gattc.h" +#include "app_util.h" +#include "nordic_common.h" +#include "app_trace.h" + +#define LOG app_trace_log /**< Debug logger macro that will be used in this file to do logging of important information over UART. */ +#define TX_BUFFER_MASK 0x07 /**< TX Buffer mask, must be a mask of contiguous zeroes, followed by contiguous sequence of ones: 000...111. */ +#define TX_BUFFER_SIZE (TX_BUFFER_MASK + 1) /**< Size of the send buffer, which is 1 higher than the mask. */ +#define WRITE_MESSAGE_LENGTH BLE_CCCD_VALUE_LEN /**< Length of the write message for CCCD. */ + +typedef enum +{ + READ_REQ, /**< Type identifying that this tx_message is a read request. */ + WRITE_REQ /**< Type identifying that this tx_message is a write request. */ +} tx_request_t; + +/**@brief Structure for writing a message to the peer, i.e. CCCD. + */ +typedef struct +{ + uint8_t gattc_value[WRITE_MESSAGE_LENGTH]; /**< The message to write. */ + ble_gattc_write_params_t gattc_params; /**< The GATTC parameters for this message. */ +} write_params_t; + +/**@brief Structure for holding the data that will be transmitted to the connected central. + */ +typedef struct +{ + uint16_t conn_handle; /**< Connection handle to be used when transmitting this message. */ + tx_request_t type; /**< Type of message. (read or write). */ + union + { + uint16_t read_handle; /**< Read request handle. */ + write_params_t write_req; /**< Write request message. */ + } req; +} tx_message_t; + + +static ble_bas_c_t * mp_ble_bas_c; /**< Pointer to the current instance of the BAS Client module. The memory for this is provided by the application.*/ +static tx_message_t m_tx_buffer[TX_BUFFER_SIZE]; /**< Transmit buffer for the messages that will be transmitted to the central. */ +static uint32_t m_tx_insert_index = 0; /**< Current index in the transmit buffer where the next message should be inserted. */ +static uint32_t m_tx_index = 0; /**< Current index in the transmit buffer containing the next message to be transmitted. */ + +/**@brief Function for passing any pending request from the buffer to the stack. + */ +static void tx_buffer_process(void) +{ + if (m_tx_index != m_tx_insert_index) + { + uint32_t err_code; + + if (m_tx_buffer[m_tx_index].type == READ_REQ) + { + err_code = sd_ble_gattc_read(m_tx_buffer[m_tx_index].conn_handle, + m_tx_buffer[m_tx_index].req.read_handle, + 0); + } + else + { + err_code = sd_ble_gattc_write(m_tx_buffer[m_tx_index].conn_handle, + &m_tx_buffer[m_tx_index].req.write_req.gattc_params); + } + if (err_code == NRF_SUCCESS) + { + LOG("[BAS_C]: SD Read/Write API returns Success..\r\n"); + m_tx_index++; + m_tx_index &= TX_BUFFER_MASK; + } + else + { + LOG("[BAS_C]: SD Read/Write API returns error. This message sending will be " + "attempted again..\r\n"); + } + } +} + + +/**@brief Function for handling write response events. + * + * @param[in] p_bas_c Pointer to the Battery Service Client Structure. + * @param[in] p_ble_evt Pointer to the SoftDevice event. + */ +static void on_write_rsp(ble_bas_c_t * p_bas_c, const ble_evt_t * p_ble_evt) +{ + // Check if there is any message to be sent across to the peer and send it. + tx_buffer_process(); +} + + +/**@brief Function for handling read response events. + * + * @details This function will validate the read response and raise the appropriate + * event to the application. + * + * @param[in] p_bas_c Pointer to the Battery Service Client Structure. + * @param[in] p_ble_evt Pointer to the SoftDevice event. + */ +static void on_read_rsp(ble_bas_c_t * p_bas_c, const ble_evt_t * p_ble_evt) +{ + const ble_gattc_evt_read_rsp_t * p_response; + + p_response = &p_ble_evt->evt.gattc_evt.params.read_rsp; + + if (p_response->handle == p_bas_c->bl_handle) + { + ble_bas_c_evt_t evt; + + evt.evt_type = BLE_BAS_C_EVT_BATT_READ_RESP; + + evt.params.battery_level = p_response->data[0]; + + p_bas_c->evt_handler(p_bas_c, &evt); + } + // Check if there is any buffered transmissions and send them. + tx_buffer_process(); +} + + +/**@brief Function for handling Handle Value Notification received from the SoftDevice. + * + * @details This function will handle the Handle Value Notification received from the SoftDevice + * and checks if it is a notification of the Battery Level measurement from the peer. If + * so, this function will decode the battery level measurement and send it to the + * application. + * + * @param[in] p_ble_bas_c Pointer to the Battery Service Client structure. + * @param[in] p_ble_evt Pointer to the BLE event received. + */ +static void on_hvx(ble_bas_c_t * p_ble_bas_c, const ble_evt_t * p_ble_evt) +{ + // Check if this notification is a battery level notification. + if (p_ble_evt->evt.gattc_evt.params.hvx.handle == p_ble_bas_c->bl_handle) + { + ble_bas_c_evt_t ble_bas_c_evt; + + ble_bas_c_evt.evt_type = BLE_BAS_C_EVT_BATT_NOTIFICATION; + + ble_bas_c_evt.params.battery_level = p_ble_evt->evt.gattc_evt.params.hvx.data[0]; + + p_ble_bas_c->evt_handler(p_ble_bas_c, &ble_bas_c_evt); + } +} + + +/**@brief Function for handling events from the database discovery module. + * + * @details This function will handle an event from the database discovery module, and determine + * if it relates to the discovery of Battery service at the peer. If so, it will + * call the application's event handler indicating that the Battery service has been + * discovered at the peer. It also populate the event with the service related + * information before providing it to the application. + * + * @param[in] p_evt Pointer to the event received from the database discovery module. + * + */ +static void db_discovery_evt_handler(ble_db_discovery_evt_t * p_evt) +{ + // Check if the Battery Service was discovered. + if (p_evt->evt_type == BLE_DB_DISCOVERY_COMPLETE + && + p_evt->params.discovered_db.srv_uuid.uuid == BLE_UUID_BATTERY_SERVICE + && + p_evt->params.discovered_db.srv_uuid.type == BLE_UUID_TYPE_BLE) + { + mp_ble_bas_c->conn_handle = p_evt->conn_handle; + + // Find the CCCD Handle of the Battery Level characteristic. + uint8_t i; + + for (i = 0; i < p_evt->params.discovered_db.char_count; i++) + { + if (p_evt->params.discovered_db.charateristics[i].characteristic.uuid.uuid == + BLE_UUID_BATTERY_LEVEL_CHAR) + { + // Found Battery Level characteristic. Store CCCD handle and break. + mp_ble_bas_c->bl_cccd_handle = + p_evt->params.discovered_db.charateristics[i].cccd_handle; + mp_ble_bas_c->bl_handle = + p_evt->params.discovered_db.charateristics[i].characteristic.handle_value; + break; + } + } + + LOG("[BAS_C]: Battery Service discovered at peer.\r\n"); + + ble_bas_c_evt_t evt; + + evt.evt_type = BLE_BAS_C_EVT_DISCOVERY_COMPLETE; + + mp_ble_bas_c->evt_handler(mp_ble_bas_c, &evt); + } + else + { + LOG("[BAS_C]: Battery Service discovery failure at peer. \r\n"); + } +} + + +/**@brief Function for creating a message for writing to the CCCD. + */ +static uint32_t cccd_configure(uint16_t conn_handle, uint16_t handle_cccd, bool notification_enable) +{ + LOG("[BAS_C]: Configuring CCCD. CCCD Handle = %d, Connection Handle = %d\r\n", + handle_cccd,conn_handle); + + tx_message_t * p_msg; + uint16_t cccd_val = notification_enable ? BLE_GATT_HVX_NOTIFICATION : 0; + + p_msg = &m_tx_buffer[m_tx_insert_index++]; + m_tx_insert_index &= TX_BUFFER_MASK; + + p_msg->req.write_req.gattc_params.handle = handle_cccd; + p_msg->req.write_req.gattc_params.len = WRITE_MESSAGE_LENGTH; + p_msg->req.write_req.gattc_params.p_value = p_msg->req.write_req.gattc_value; + p_msg->req.write_req.gattc_params.offset = 0; + p_msg->req.write_req.gattc_params.write_op = BLE_GATT_OP_WRITE_REQ; + p_msg->req.write_req.gattc_value[0] = LSB_16(cccd_val); + p_msg->req.write_req.gattc_value[1] = MSB_16(cccd_val); + p_msg->conn_handle = conn_handle; + p_msg->type = WRITE_REQ; + + tx_buffer_process(); + return NRF_SUCCESS; +} + + +uint32_t ble_bas_c_init(ble_bas_c_t * p_ble_bas_c, ble_bas_c_init_t * p_ble_bas_c_init) +{ + if ((p_ble_bas_c == NULL) || (p_ble_bas_c_init == NULL)) + { + return NRF_ERROR_NULL; + } + + ble_uuid_t bas_uuid; + + bas_uuid.type = BLE_UUID_TYPE_BLE; + bas_uuid.uuid = BLE_UUID_BATTERY_SERVICE; + + mp_ble_bas_c = p_ble_bas_c; + + mp_ble_bas_c->conn_handle = BLE_CONN_HANDLE_INVALID; + mp_ble_bas_c->bl_cccd_handle = BLE_GATT_HANDLE_INVALID; + mp_ble_bas_c->bl_handle = BLE_GATT_HANDLE_INVALID; + mp_ble_bas_c->evt_handler = p_ble_bas_c_init->evt_handler; + + return ble_db_discovery_evt_register(&bas_uuid, + db_discovery_evt_handler); +} + + +void ble_bas_c_on_ble_evt(ble_bas_c_t * p_ble_bas_c, const ble_evt_t * p_ble_evt) +{ + if ((p_ble_bas_c == NULL) || (p_ble_evt == NULL)) + { + return; + } + + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + p_ble_bas_c->conn_handle = p_ble_evt->evt.gap_evt.conn_handle; + break; + + case BLE_GATTC_EVT_HVX: + on_hvx(p_ble_bas_c, p_ble_evt); + break; + + case BLE_GATTC_EVT_WRITE_RSP: + on_write_rsp(p_ble_bas_c, p_ble_evt); + break; + + case BLE_GATTC_EVT_READ_RSP: + on_read_rsp(p_ble_bas_c, p_ble_evt); + break; + + default: + break; + } +} + + +uint32_t ble_bas_c_bl_notif_enable(ble_bas_c_t * p_ble_bas_c) +{ + if (p_ble_bas_c == NULL) + { + return NRF_ERROR_NULL; + } + + return cccd_configure(p_ble_bas_c->conn_handle, p_ble_bas_c->bl_cccd_handle, true); +} + + +uint32_t ble_bas_c_bl_read(ble_bas_c_t * p_ble_bas_c) +{ + tx_message_t * msg; + + msg = &m_tx_buffer[m_tx_insert_index++]; + m_tx_insert_index &= TX_BUFFER_MASK; + + msg->req.read_handle = p_ble_bas_c->bl_handle; + msg->conn_handle = p_ble_bas_c->conn_handle; + msg->type = READ_REQ; + + tx_buffer_process(); + return NRF_SUCCESS; +} diff --git a/components/ble/ble_services/ble_bas_c/ble_bas_c.h b/components/ble/ble_services/ble_bas_c/ble_bas_c.h new file mode 100644 index 0000000..242cc8d --- /dev/null +++ b/components/ble/ble_services/ble_bas_c/ble_bas_c.h @@ -0,0 +1,169 @@ +/* + * Copyright (c) 2012 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. + * + */ + +/**@file + * + * @defgroup ble_sdk_srv_bas_c Battery Service Client + * @{ + * @ingroup ble_sdk_srv + * @brief Battery Service Client module. + * + * @details This module contains APIs to read and interact with the Battery Service of a remote + * device. + * + * @note The application must propagate BLE stack events to this module by calling + * ble_hrs_c_on_ble_evt(). + * + */ + +#ifndef BLE_BAS_C_H__ +#define BLE_BAS_C_H__ + +#include +#include "ble.h" + +/** + * @defgroup bas_c_enums Enumerations + * @{ + */ + +/**@brief Battery Service Client event type. */ +typedef enum +{ + BLE_BAS_C_EVT_DISCOVERY_COMPLETE, /**< Event indicating that the Battery Service has been discovered at the peer. */ + BLE_BAS_C_EVT_BATT_NOTIFICATION, /**< Event indicating that a notification of the Battery Level characteristic has been received from the peer. */ + BLE_BAS_C_EVT_BATT_READ_RESP /**< Event indicating that a read response on Battery Level characteristic has been received from peer. */ +} ble_bas_c_evt_type_t; + +/** @} */ + +/** + * @defgroup bas_c_structs Structures + * @{ + */ + +/**@brief Battery Service Client Event structure. */ +typedef struct +{ + ble_bas_c_evt_type_t evt_type; /**< Event Type. */ + union + { + uint8_t battery_level; /**< Battery level received from peer. This field will be used for the events @ref BLE_BAS_C_EVT_BATT_NOTIFICATION and @ref BLE_BAS_C_EVT_BATT_READ_RESP.*/ + } params; +} ble_bas_c_evt_t; + +/** @} */ + +/** + * @defgroup bas_c_types Types + * @{ + */ + +// Forward declaration of the ble_bas_t type. +typedef struct ble_bas_c_s ble_bas_c_t; + +/**@brief Event handler type. + * + * @details This is the type of the event handler that should be provided by the application + * of this module in order to receive events. + */ +typedef void (* ble_bas_c_evt_handler_t) (ble_bas_c_t * p_bas_bas_c, ble_bas_c_evt_t * p_evt); + +/** @} */ + +/** + * @addtogroup bas_c_structs + * @{ + */ + +/**@brief Battery Service Client structure. + + */ +struct ble_bas_c_s +{ + uint16_t conn_handle; /**< Connection handle as provided by the SoftDevice. */ + uint16_t bl_cccd_handle; /**< Handle of the CCCD of the Battery Level characteristic. */ + uint16_t bl_handle; /**< Handle of the Battery Level characteristic as provided by the SoftDevice. */ + ble_bas_c_evt_handler_t evt_handler; /**< Application event handler to be called when there is an event related to the Battery service. */ +}; + +/**@brief Battery Service Client initialization structure. + */ +typedef struct +{ + ble_bas_c_evt_handler_t evt_handler; /**< Event handler to be called by the Battery Service Client module whenever there is an event related to the Battery Service. */ +} ble_bas_c_init_t; + +/** @} */ + +/** + * @defgroup bas_c_functions Functions + * @{ + */ + +/**@brief Function for initializing the Battery Service Client module. + * + * @details This function will initialize the module and set up Database Discovery to discover + * the Battery Service. After calling this function, call @ref ble_db_discovery_start + * to start discovery. + * + * @param[out] p_ble_bas_c Pointer to the Battery Service client structure. + * @param[in] p_ble_bas_c_init Pointer to the Battery Service initialization structure containing + * the initialization information. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_NULL A parameter is NULL. + * Otherwise, an error code returned by @ref ble_db_discovery_evt_register. + */ +uint32_t ble_bas_c_init(ble_bas_c_t * p_ble_bas_c, ble_bas_c_init_t * p_ble_bas_c_init); + + +/**@brief Function for handling BLE events from the SoftDevice. + * + * @details This function will handle the BLE events received from the SoftDevice. If the BLE + * event is relevant for the Battery Service Client module, then it is used to update + * interval variables and, if necessary, send events to the application. + * + * @note This function must be called by the application. + * + * @param[in] p_ble_bas_c Pointer to the Battery Service client structure. + * @param[in] p_ble_evt Pointer to the BLE event. + */ +void ble_bas_c_on_ble_evt(ble_bas_c_t * p_ble_bas_c, const ble_evt_t * p_ble_evt); + + +/**@brief Function for enabling notifications on the Battery Level characteristic. + * + * @details This function will enable to notification of the Battery Level characteristic at the + * peer by writing to the CCCD of the Battery Level Characteristic. + * + * @param p_ble_bas_c Pointer to the Battery Service client structure. + * + * @retval NRF_SUCCESS If the SoftDevice has been requested to write to the CCCD of the peer. + * NRF_ERROR_NULL Parameter is NULL. + * Otherwise, an error code returned by the SoftDevice API @ref + * sd_ble_gattc_write. + */ +uint32_t ble_bas_c_bl_notif_enable(ble_bas_c_t * p_ble_bas_c); + + +/**@brief Function for reading the Battery Level characteristic. + * + * @param p_ble_bas_c Pointer to the Battery Service client structure. + * + * @retval NRF_SUCCESS If the read request was successfully queued to be sent to peer. + */ +uint32_t ble_bas_c_bl_read(ble_bas_c_t * p_ble_bas_c); + + +/** @} */ // End tag for Function group. + +#endif // BLE_BAS_C_H__ + +/** @} */ // End tag for the file. diff --git a/components/ble/ble_services/ble_bps/ble_bps.c b/components/ble/ble_services/ble_bps/ble_bps.c new file mode 100644 index 0000000..a3b89ad --- /dev/null +++ b/components/ble/ble_services/ble_bps/ble_bps.c @@ -0,0 +1,439 @@ +/* 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. + * + */ + +/* Attention! +* To maintain compliance with Nordic Semiconductor ASAs Bluetooth profile +* qualification listings, this section of source code must not be modified. +*/ + +#include "ble_bps.h" +#include +#include "nordic_common.h" +#include "ble_l2cap.h" +#include "ble_srv_common.h" +#include "app_util.h" + + +#define OPCODE_LENGTH 1 /**< Length of opcode inside Blood Pressure Measurement packet. */ +#define HANDLE_LENGTH 2 /**< Length of handle inside Blood Pressure Measurement packet. */ +#define MAX_BPM_LEN (BLE_L2CAP_MTU_DEF - OPCODE_LENGTH - HANDLE_LENGTH) /**< Maximum size of a transmitted Blood Pressure Measurement. */ + +// Blood Pressure Measurement Flags bits +#define BPS_MEAS_BLOOD_PRESSURE_UNITS_FLAG_BIT (0x01 << 0) /**< Blood Pressure Units Flag bit. */ +#define BPS_MEAS_TIME_STAMP_FLAG_BIT (0x01 << 1) /**< Time Stamp Flag bit. */ +#define BPS_MEAS_PULSE_RATE_FLAG_BIT (0x01 << 2) /**< Pulse Rate Flag bit. */ +#define BPS_MEAS_USER_ID_FLAG_BIT (0x01 << 3) /**< User ID Flag bit. */ +#define BPS_MEAS_MEASUREMENT_STATUS_FLAG_BIT (0x01 << 4) /**< Measurement Status Flag bit. */ + + +/**@brief Function for handling the Connect event. + * + * @param[in] p_bps Blood Pressure Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_connect(ble_bps_t * p_bps, ble_evt_t * p_ble_evt) +{ + p_bps->conn_handle = p_ble_evt->evt.gatts_evt.conn_handle; +} + + +/**@brief Function for handling the Disconnect event. + * + * @param[in] p_bps Blood Pressure Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_disconnect(ble_bps_t * p_bps, ble_evt_t * p_ble_evt) +{ + UNUSED_PARAMETER(p_ble_evt); + p_bps->conn_handle = BLE_CONN_HANDLE_INVALID; +} + + +/**@brief Function for handling the write events to the Blood Pressure Measurement characteristic. + * + * @param[in] p_bps Blood Pressure Service structure. + * @param[in] p_evt_write Write event received from the BLE stack. + */ +static void on_cccd_write(ble_bps_t * p_bps, ble_gatts_evt_write_t * p_evt_write) +{ + if (p_evt_write->len == 2) + { + // CCCD written, update indication state + if (p_bps->evt_handler != NULL) + { + ble_bps_evt_t evt; + + if (ble_srv_is_indication_enabled(p_evt_write->data)) + { + evt.evt_type = BLE_BPS_EVT_INDICATION_ENABLED; + } + else + { + evt.evt_type = BLE_BPS_EVT_INDICATION_DISABLED; + } + + p_bps->evt_handler(p_bps, &evt); + } + } +} + + +/**@brief Function for handling the Write event. + * + * @param[in] p_bps Blood Pressure Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_write(ble_bps_t * p_bps, ble_evt_t * p_ble_evt) +{ + ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write; + + if (p_evt_write->handle == p_bps->meas_handles.cccd_handle) + { + on_cccd_write(p_bps, p_evt_write); + } +} + + +/**@brief Function for handling the HVC event. + * + * @details Handles HVC events from the BLE stack. + * + * @param[in] p_bps Blood Pressure Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_hvc(ble_bps_t * p_bps, ble_evt_t * p_ble_evt) +{ + ble_gatts_evt_hvc_t * p_hvc = &p_ble_evt->evt.gatts_evt.params.hvc; + + if (p_hvc->handle == p_bps->meas_handles.value_handle) + { + ble_bps_evt_t evt; + + evt.evt_type = BLE_BPS_EVT_INDICATION_CONFIRMED; + p_bps->evt_handler(p_bps, &evt); + } +} + + +void ble_bps_on_ble_evt(ble_bps_t * p_bps, ble_evt_t * p_ble_evt) +{ + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + on_connect(p_bps, p_ble_evt); + break; + + case BLE_GAP_EVT_DISCONNECTED: + on_disconnect(p_bps, p_ble_evt); + break; + + case BLE_GATTS_EVT_WRITE: + on_write(p_bps, p_ble_evt); + break; + + case BLE_GATTS_EVT_HVC: + on_hvc(p_bps, p_ble_evt); + break; + + default: + // No implementation needed. + break; + } +} + + +/**@brief Function for encoding a Blood Pressure Measurement. + * + * @param[in] p_bps Blood Pressure Service structure. + * @param[in] p_bps_meas Measurement to be encoded. + * @param[out] p_encoded_buffer Buffer where the encoded data will be written. + * + * @return Size of encoded data. + */ +static uint8_t bps_measurement_encode(ble_bps_t * p_bps, + ble_bps_meas_t * p_bps_meas, + uint8_t * p_encoded_buffer) +{ + uint8_t flags = 0; + uint8_t len = 1; + uint16_t encoded_sfloat; + + // Set measurement units flag + if (p_bps_meas->blood_pressure_units_in_kpa) + { + flags |= BPS_MEAS_BLOOD_PRESSURE_UNITS_FLAG_BIT; + } + + // Blood Pressure Measurement - Systolic + encoded_sfloat = ((p_bps_meas->blood_pressure_systolic.exponent << 12) & 0xF000) | + ((p_bps_meas->blood_pressure_systolic.mantissa << 0) & 0x0FFF); + len += uint16_encode(encoded_sfloat, &p_encoded_buffer[len]); + + // Blood Pressure Measurement - Diastolic + encoded_sfloat = ((p_bps_meas->blood_pressure_diastolic.exponent << 12) & 0xF000) | + ((p_bps_meas->blood_pressure_diastolic.mantissa << 0) & 0x0FFF); + len += uint16_encode(encoded_sfloat, &p_encoded_buffer[len]); + + // Blood Pressure Measurement - Mean Arterial Pressure + encoded_sfloat = ((p_bps_meas->mean_arterial_pressure.exponent << 12) & 0xF000) | + ((p_bps_meas->mean_arterial_pressure.mantissa << 0) & 0x0FFF); + len += uint16_encode(encoded_sfloat, &p_encoded_buffer[len]); + + // Time Stamp field + if (p_bps_meas->time_stamp_present) + { + flags |= BPS_MEAS_TIME_STAMP_FLAG_BIT; + len += ble_date_time_encode(&p_bps_meas->time_stamp, &p_encoded_buffer[len]); + } + + // Pulse Rate + if (p_bps_meas->pulse_rate_present) + { + flags |= BPS_MEAS_PULSE_RATE_FLAG_BIT; + + encoded_sfloat = ((p_bps_meas->pulse_rate.exponent << 12) & 0xF000) | + ((p_bps_meas->pulse_rate.mantissa << 0) & 0x0FFF); + len += uint16_encode(encoded_sfloat, &p_encoded_buffer[len]); + } + + // User ID + if (p_bps_meas->user_id_present) + { + flags |= BPS_MEAS_USER_ID_FLAG_BIT; + p_encoded_buffer[len++] = p_bps_meas->user_id; + } + + // Measurement Status + if (p_bps_meas->measurement_status_present) + { + flags |= BPS_MEAS_MEASUREMENT_STATUS_FLAG_BIT; + len += uint16_encode(p_bps_meas->measurement_status, &p_encoded_buffer[len]); + } + + // Flags field + p_encoded_buffer[0] = flags; + + return len; +} + + +/**@brief Function for adding Blood Pressure Measurement characteristics. + * + * @param[in] p_bps Blood Pressure Service structure. + * @param[in] p_bps_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t bps_measurement_char_add(ble_bps_t * p_bps, const ble_bps_init_t * p_bps_init) +{ + 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; + ble_bps_meas_t initial_bpm; + uint8_t encoded_bpm[MAX_BPM_LEN]; + + memset(&cccd_md, 0, sizeof(cccd_md)); + + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm); + cccd_md.vloc = BLE_GATTS_VLOC_STACK; + cccd_md.write_perm = p_bps_init->bps_meas_attr_md.cccd_write_perm; + + memset(&char_md, 0, sizeof(char_md)); + + char_md.char_props.indicate = 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_BLE_ASSIGN(ble_uuid, BLE_UUID_BLOOD_PRESSURE_MEASUREMENT_CHAR); + + memset(&attr_md, 0, sizeof(attr_md)); + + attr_md.vloc = BLE_GATTS_VLOC_STACK; + attr_md.read_perm = p_bps_init->bps_meas_attr_md.read_perm; + attr_md.write_perm = p_bps_init->bps_meas_attr_md.write_perm; + attr_md.rd_auth = 0; + attr_md.wr_auth = 0; + attr_md.vlen = 1; + + memset(&attr_char_value, 0, sizeof(attr_char_value)); + memset(&initial_bpm, 0, sizeof(initial_bpm)); + + attr_char_value.p_uuid = &ble_uuid; + attr_char_value.p_attr_md = &attr_md; + attr_char_value.init_len = bps_measurement_encode(p_bps, &initial_bpm, encoded_bpm); + attr_char_value.init_offs = 0; + attr_char_value.max_len = MAX_BPM_LEN; + attr_char_value.p_value = encoded_bpm; + + return sd_ble_gatts_characteristic_add(p_bps->service_handle, + &char_md, + &attr_char_value, + &p_bps->meas_handles); +} + + +/**@brief Function for adding Blood Pressure Feature characteristics. + * + * @param[in] p_bps Blood Pressure Service structure. + * @param[in] p_bps_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t bps_feature_char_add(ble_bps_t * p_bps, const ble_bps_init_t * p_bps_init) +{ + ble_gatts_char_md_t char_md; + ble_gatts_attr_t attr_char_value; + ble_uuid_t ble_uuid; + ble_gatts_attr_md_t attr_md; + uint8_t init_value_encoded[2]; + uint8_t init_value_len; + + 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; + + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_BLOOD_PRESSURE_FEATURE_CHAR); + + memset(&attr_md, 0, sizeof(attr_md)); + + attr_md.vloc = BLE_GATTS_VLOC_STACK; + attr_md.read_perm = p_bps_init->bps_feature_attr_md.read_perm; + attr_md.write_perm = p_bps_init->bps_feature_attr_md.write_perm; + attr_md.rd_auth = 0; + attr_md.wr_auth = 0; + attr_md.vlen = 0; + + memset(&attr_char_value, 0, sizeof(attr_char_value)); + + init_value_len = uint16_encode(p_bps_init->feature, init_value_encoded); + + attr_char_value.p_uuid = &ble_uuid; + attr_char_value.p_attr_md = &attr_md; + attr_char_value.init_len = init_value_len; + attr_char_value.init_offs = 0; + attr_char_value.max_len = init_value_len; + attr_char_value.p_value = init_value_encoded; + + return sd_ble_gatts_characteristic_add(p_bps->service_handle, + &char_md, + &attr_char_value, + &p_bps->feature_handles); +} + + +uint32_t ble_bps_init(ble_bps_t * p_bps, const ble_bps_init_t * p_bps_init) +{ + uint32_t err_code; + ble_uuid_t ble_uuid; + + // Initialize service structure + p_bps->evt_handler = p_bps_init->evt_handler; + p_bps->conn_handle = BLE_CONN_HANDLE_INVALID; + p_bps->feature = p_bps_init->feature; + + // Add service + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_BLOOD_PRESSURE_SERVICE); + + err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &ble_uuid, &p_bps->service_handle); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add measurement characteristic + err_code = bps_measurement_char_add(p_bps, p_bps_init); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add feature characteristic + err_code = bps_feature_char_add(p_bps, p_bps_init); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + return NRF_SUCCESS; +} + + +uint32_t ble_bps_measurement_send(ble_bps_t * p_bps, ble_bps_meas_t * p_bps_meas) +{ + uint32_t err_code; + + // Send value if connected + if (p_bps->conn_handle != BLE_CONN_HANDLE_INVALID) + { + uint8_t encoded_bps_meas[MAX_BPM_LEN]; + uint16_t len; + uint16_t hvx_len; + ble_gatts_hvx_params_t hvx_params; + + len = bps_measurement_encode(p_bps, p_bps_meas, encoded_bps_meas); + hvx_len = len; + + memset(&hvx_params, 0, sizeof(hvx_params)); + + hvx_params.handle = p_bps->meas_handles.value_handle; + hvx_params.type = BLE_GATT_HVX_INDICATION; + hvx_params.offset = 0; + hvx_params.p_len = &hvx_len; + hvx_params.p_data = encoded_bps_meas; + + err_code = sd_ble_gatts_hvx(p_bps->conn_handle, &hvx_params); + if ((err_code == NRF_SUCCESS) && (hvx_len != len)) + { + err_code = NRF_ERROR_DATA_SIZE; + } + } + else + { + err_code = NRF_ERROR_INVALID_STATE; + } + + return err_code; +} + + +uint32_t ble_bps_is_indication_enabled(ble_bps_t * p_bps, bool * p_indication_enabled) +{ + uint32_t err_code; + uint8_t cccd_value_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_value_buf; + + err_code = sd_ble_gatts_value_get(p_bps->conn_handle, + p_bps->meas_handles.cccd_handle, + &gatts_value); + if (err_code == NRF_SUCCESS) + { + *p_indication_enabled = ble_srv_is_indication_enabled(cccd_value_buf); + } + return err_code; +} diff --git a/components/ble/ble_services/ble_bps/ble_bps.h b/components/ble/ble_services/ble_bps/ble_bps.h new file mode 100644 index 0000000..04404e6 --- /dev/null +++ b/components/ble/ble_services/ble_bps/ble_bps.h @@ -0,0 +1,161 @@ +/* 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 ble_sdk_srv_bps Blood Pressure Service + * @{ + * @ingroup ble_sdk_srv + * @brief Blood Pressure Service module. + * + * @details This module implements the Blood Pressure Service. + * + * If an event handler is supplied by the application, the Blood Pressure + * Service will generate Blood Pressure Service events to the application. + * + * @note The application must propagate BLE stack events to the Blood Pressure Service + * module by calling ble_bps_on_ble_evt() from the @ref softdevice_handler function. + * + * @note Attention! + * To maintain compliance with Nordic Semiconductor ASA Bluetooth profile + * qualification listings, this section of source code must not be modified. + */ + +#ifndef BLE_BPS_H__ +#define BLE_BPS_H__ + +#include +#include +#include "ble.h" +#include "ble_srv_common.h" +#include "ble_date_time.h" + +// Blood Pressure Feature bits +#define BLE_BPS_FEATURE_BODY_MOVEMENT_BIT (0x01 << 0) /**< Body Movement Detection Support bit. */ +#define BLE_BPS_FEATURE_CUFF_FIT_BIT (0x01 << 1) /**< Cuff Fit Detection Support bit. */ +#define BLE_BPS_FEATURE_IRREGULAR_PULSE_BIT (0x01 << 2) /**< Irregular Pulse Detection Support bit. */ +#define BLE_BPS_FEATURE_PULSE_RATE_RANGE_BIT (0x01 << 3) /**< Pulse Rate Range Detection Support bit. */ +#define BLE_BPS_FEATURE_MEASUREMENT_POSITION_BIT (0x01 << 4) /**< Measurement Position Detection Support bit. */ +#define BLE_BPS_FEATURE_MULTIPLE_BOND_BIT (0x01 << 5) /**< Multiple Bond Support bit. */ + +/**@brief Blood Pressure Service event type. */ +typedef enum +{ + BLE_BPS_EVT_INDICATION_ENABLED, /**< Blood Pressure value indication enabled event. */ + BLE_BPS_EVT_INDICATION_DISABLED, /**< Blood Pressure value indication disabled event. */ + BLE_BPS_EVT_INDICATION_CONFIRMED /**< Confirmation of a blood pressure measurement indication has been received. */ +} ble_bps_evt_type_t; + +/**@brief Blood Pressure Service event. */ +typedef struct +{ + ble_bps_evt_type_t evt_type; /**< Type of event. */ +} ble_bps_evt_t; + +// Forward declaration of the ble_bps_t type. +typedef struct ble_bps_s ble_bps_t; + +/**@brief Blood Pressure Service event handler type. */ +typedef void (*ble_bps_evt_handler_t) (ble_bps_t * p_bps, ble_bps_evt_t * p_evt); + +/**@brief SFLOAT format (IEEE-11073 16-bit FLOAT, defined as a 16-bit vlue with 12-bit mantissa and + * 4-bit exponent. */ +typedef struct +{ + int8_t exponent; /**< Base 10 exponent, only 4 bits */ + int16_t mantissa; /**< Mantissa, only 12 bits */ +} ieee_float16_t; + +/**@brief Blood Pressure Service init structure. This contains all options and data + * needed for initialization of the service. */ +typedef struct +{ + ble_bps_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Blood Pressure Service. */ + ble_srv_cccd_security_mode_t bps_meas_attr_md; /**< Initial security level for blood pressure measurement attribute */ + ble_srv_security_mode_t bps_feature_attr_md; /**< Initial security level for blood pressure feature attribute */ + uint16_t feature; /**< Initial value for blood pressure feature */ +} ble_bps_init_t; + +/**@brief Blood Pressure Service structure. This contains various status information for + * the service. */ +struct ble_bps_s +{ + ble_bps_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Blood Pressure Service. */ + uint16_t service_handle; /**< Handle of Blood Pressure Service (as provided by the BLE stack). */ + ble_gatts_char_handles_t meas_handles; /**< Handles related to the Blood Pressure Measurement characteristic. */ + ble_gatts_char_handles_t feature_handles; /**< Handles related to the Blood Pressure Feature characteristic. */ + uint16_t conn_handle; /**< Handle of the current connection (as provided by the BLE stack, is BLE_CONN_HANDLE_INVALID if not in a connection). */ + uint16_t feature; /**< Value of Blood Pressure feature. */ +}; + +/**@brief Blood Pressure Service measurement structure. This contains a Blood Pressure + * measurement. */ +typedef struct ble_bps_meas_s +{ + bool blood_pressure_units_in_kpa; /**< Blood Pressure Units Flag, 0=mmHg, 1=kPa */ + bool time_stamp_present; /**< Time Stamp Flag, 0=not present, 1=present. */ + bool pulse_rate_present; /**< Pulse Rate Flag, 0=not present, 1=present. */ + bool user_id_present; /**< User ID Flag, 0=not present, 1=present. */ + bool measurement_status_present; /**< Measurement Status Flag, 0=not present, 1=present. */ + ieee_float16_t blood_pressure_systolic; /**< Blood Pressure Measurement Compound Value - Systolic. */ + ieee_float16_t blood_pressure_diastolic; /**< Blood Pressure Measurement Compound Value - Diastolic . */ + ieee_float16_t mean_arterial_pressure; /**< Blood Pressure Measurement Compound Value - Mean Arterial Pressure. */ + ble_date_time_t time_stamp; /**< Time Stamp. */ + ieee_float16_t pulse_rate; /**< Pulse Rate. */ + uint8_t user_id; /**< User ID. */ + uint16_t measurement_status; /**< Measurement Status. */ +} ble_bps_meas_t; + +/**@brief Function for initializing the Blood Pressure Service. + * + * @param[out] p_bps Blood Pressure 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 this particular service instance. + * @param[in] p_bps_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on successful initialization of service, otherwise an error code. + */ +uint32_t ble_bps_init(ble_bps_t * p_bps, const ble_bps_init_t * p_bps_init); + +/**@brief Function for handling the Application's BLE Stack events. + * + * @details Handles all events from the BLE stack of interest to the Blood Pressure Service. + * + * @param[in] p_bps Blood Pressure Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +void ble_bps_on_ble_evt(ble_bps_t * p_bps, ble_evt_t * p_ble_evt); + +/**@brief Function for sending blood pressure measurement if indication has been enabled. + * + * @details The application calls this function after having performed a Blood Pressure + * measurement. If indication has been enabled, the measurement data is encoded and + * sent to the client. + * + * @param[in] p_bps Blood Pressure Service structure. + * @param[in] p_bps_meas Pointer to new blood pressure measurement. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +uint32_t ble_bps_measurement_send(ble_bps_t * p_bps, ble_bps_meas_t * p_bps_meas); + +/**@brief Function for checking if indication of Blood Pressure Measurement is currently enabled. + * + * @param[in] p_bps Blood Pressure Service structure. + * @param[out] p_indication_enabled TRUE if indication is enabled, FALSE otherwise. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +uint32_t ble_bps_is_indication_enabled(ble_bps_t * p_bps, bool * p_indication_enabled); + +#endif // BLE_BPS_H__ + +/** @} */ diff --git a/components/ble/ble_services/ble_cscs/ble_cscs.c b/components/ble/ble_services/ble_cscs/ble_cscs.c new file mode 100644 index 0000000..490c891 --- /dev/null +++ b/components/ble/ble_services/ble_cscs/ble_cscs.c @@ -0,0 +1,443 @@ +/* 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. + * + */ + +/* Attention! +* To maintain compliance with Nordic Semiconductor ASAs Bluetooth profile +* qualification listings, this section of source code must not be modified. +*/ + +#include "ble_cscs.h" +#include +#include "nordic_common.h" +#include "ble_l2cap.h" +#include "ble_srv_common.h" +#include "app_util.h" + +#define OPCODE_LENGTH 1 /**< Length of opcode inside Cycling Speed and Cadence Measurement packet. */ +#define HANDLE_LENGTH 2 /**< Length of handle inside Cycling Speed and Cadence Measurement packet. */ +#define MAX_CSCM_LEN (BLE_L2CAP_MTU_DEF - OPCODE_LENGTH - HANDLE_LENGTH) /**< Maximum size of a transmitted Cycling Speed and Cadence Measurement. */ + +// Cycling Speed and Cadence Measurement flag bits +#define CSC_MEAS_FLAG_MASK_WHEEL_REV_DATA_PRESENT (0x01 << 0) /**< Wheel revolution data present flag bit. */ +#define CSC_MEAS_FLAG_MASK_CRANK_REV_DATA_PRESENT (0x01 << 1) /**< Crank revolution data present flag bit. */ + + +/**@brief Function for handling the Connect event. + * + * @param[in] p_cscs Cycling Speed and Cadence Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_connect(ble_cscs_t * p_cscs, ble_evt_t * p_ble_evt) +{ + p_cscs->conn_handle = p_ble_evt->evt.gap_evt.conn_handle; +} + + +/**@brief Function for handling the Disconnect event. + * + * @param[in] p_cscs Cycling Speed and Cadence Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_disconnect(ble_cscs_t * p_cscs, ble_evt_t * p_ble_evt) +{ + UNUSED_PARAMETER(p_ble_evt); + p_cscs->conn_handle = BLE_CONN_HANDLE_INVALID; +} + + +/**@brief Function for handling write events to the CSCS Measurement characteristic. + * + * @param[in] p_cscs Cycling Speed and Cadence Service structure. + * @param[in] p_evt_write Write event received from the BLE stack. + */ +static void on_meas_cccd_write(ble_cscs_t * p_cscs, ble_gatts_evt_write_t * p_evt_write) +{ + if (p_evt_write->len == 2) + { + // CCCD written, update notification state + if (p_cscs->evt_handler != NULL) + { + ble_cscs_evt_t evt; + + if (ble_srv_is_notification_enabled(p_evt_write->data)) + { + evt.evt_type = BLE_CSCS_EVT_NOTIFICATION_ENABLED; + } + else + { + evt.evt_type = BLE_CSCS_EVT_NOTIFICATION_DISABLED; + } + + p_cscs->evt_handler(p_cscs, &evt); + } + } +} + + +/**@brief Function for handling the Write event. + * + * @param[in] p_cscs Cycling Speed and Cadence Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_write(ble_cscs_t * p_cscs, ble_evt_t * p_ble_evt) +{ + ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write; + + if (p_evt_write->handle == p_cscs->meas_handles.cccd_handle) + { + on_meas_cccd_write(p_cscs, p_evt_write); + } +} + + +void ble_cscs_on_ble_evt(ble_cscs_t * p_cscs, ble_evt_t * p_ble_evt) +{ + ble_sc_ctrlpt_on_ble_evt(&(p_cscs->ctrl_pt), p_ble_evt); + + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + on_connect(p_cscs, p_ble_evt); + break; + + case BLE_GAP_EVT_DISCONNECTED: + on_disconnect(p_cscs, p_ble_evt); + break; + + case BLE_GATTS_EVT_WRITE: + on_write(p_cscs, p_ble_evt); + break; + + default: + // No implementation needed. + break; + } +} + + +/**@brief Function for encoding a CSCS Measurement. + * + * @param[in] p_cscs Cycling Speed and Cadence Service structure. + * @param[in] p_csc_measurement Measurement to be encoded. + * @param[out] p_encoded_buffer Buffer where the encoded data will be written. + * + * @return Size of encoded data. + */ +static uint8_t csc_measurement_encode(ble_cscs_t * p_cscs, + ble_cscs_meas_t * p_csc_measurement, + uint8_t * p_encoded_buffer) +{ + uint8_t flags = 0; + uint8_t len = 1; + + // Cumulative Wheel Revolutions and Last Wheel Event Time Fields + if (p_cscs->feature & BLE_CSCS_FEATURE_WHEEL_REV_BIT) + { + if (p_csc_measurement->is_wheel_rev_data_present) + { + flags |= CSC_MEAS_FLAG_MASK_WHEEL_REV_DATA_PRESENT; + len += uint32_encode(p_csc_measurement->cumulative_wheel_revs, &p_encoded_buffer[len]); + len += uint16_encode(p_csc_measurement->last_wheel_event_time, &p_encoded_buffer[len]); + } + } + + // Cumulative Crank Revolutions and Last Crank Event Time Fields + if (p_cscs->feature & BLE_CSCS_FEATURE_CRANK_REV_BIT) + { + if (p_csc_measurement->is_crank_rev_data_present) + { + flags |= CSC_MEAS_FLAG_MASK_CRANK_REV_DATA_PRESENT; + len += uint16_encode(p_csc_measurement->cumulative_crank_revs, &p_encoded_buffer[len]); + len += uint16_encode(p_csc_measurement->last_crank_event_time, &p_encoded_buffer[len]); + } + } + + // Flags Field + p_encoded_buffer[0] = flags; + + return len; +} + + +/**@brief Function for adding CSC Measurement characteristics. + * + * @param[in] p_cscs Cycling Speed and Cadence Service structure. + * @param[in] p_cscs_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t csc_measurement_char_add(ble_cscs_t * p_cscs, const ble_cscs_init_t * p_cscs_init) +{ + 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; + ble_cscs_meas_t initial_scm; + uint8_t encoded_scm[MAX_CSCM_LEN]; + memset(&cccd_md, 0, sizeof(cccd_md)); + + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm); + cccd_md.write_perm = p_cscs_init->csc_meas_attr_md.cccd_write_perm; + cccd_md.vloc = BLE_GATTS_VLOC_STACK; + + memset(&char_md, 0, sizeof(char_md)); + + 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 = &cccd_md; + char_md.p_sccd_md = NULL; + + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_CSC_MEASUREMENT_CHAR); + + 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_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 = &ble_uuid; + attr_char_value.p_attr_md = &attr_md; + attr_char_value.init_len = csc_measurement_encode(p_cscs, &initial_scm, encoded_scm); + attr_char_value.init_offs = 0; + attr_char_value.max_len = MAX_CSCM_LEN; + attr_char_value.p_value = encoded_scm; + + return sd_ble_gatts_characteristic_add(p_cscs->service_handle, + &char_md, + &attr_char_value, + &p_cscs->meas_handles); +} + + +/**@brief Function for adding CSC Feature characteristics. + * + * @param[in] p_cscs Cycling Speed and Cadence Service structure. + * @param[in] p_cscs_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t csc_feature_char_add(ble_cscs_t * p_cscs, const ble_cscs_init_t * p_cscs_init) +{ + ble_gatts_char_md_t char_md; + ble_gatts_attr_t attr_char_value; + ble_uuid_t ble_uuid; + ble_gatts_attr_md_t attr_md; + uint8_t init_value_encoded[2]; + uint8_t init_value_len; + + 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; + + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_CSC_FEATURE_CHAR); + + memset(&attr_md, 0, sizeof(attr_md)); + + attr_md.read_perm = p_cscs_init->csc_feature_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 = 0; + + memset(&attr_char_value, 0, sizeof(attr_char_value)); + + init_value_len = uint16_encode(p_cscs_init->feature, &init_value_encoded[0]); + + attr_char_value.p_uuid = &ble_uuid; + attr_char_value.p_attr_md = &attr_md; + attr_char_value.init_len = init_value_len; + attr_char_value.init_offs = 0; + attr_char_value.max_len = init_value_len; + attr_char_value.p_value = init_value_encoded; + + return sd_ble_gatts_characteristic_add(p_cscs->service_handle, + &char_md, + &attr_char_value, + &p_cscs->feature_handles); +} + + +/**@brief Function for adding CSC Sensor Location characteristic. + * + * @param[in] p_cscs Cycling Speed and Cadence Service structure. + * @param[in] p_cscs_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t csc_sensor_loc_char_add(ble_cscs_t * p_cscs, const ble_cscs_init_t * p_cscs_init) +{ + ble_gatts_char_md_t char_md; + ble_gatts_attr_t attr_char_value; + ble_uuid_t ble_uuid; + ble_gatts_attr_md_t attr_md; + uint8_t init_value_len; + uint8_t encoded_init_value[1]; + + 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; + + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_SENSOR_LOCATION_CHAR); + + memset(&attr_md, 0, sizeof(attr_md)); + + attr_md.read_perm = p_cscs_init->csc_sensor_loc_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 = 0; + + memset(&attr_char_value, 0, sizeof(attr_char_value)); + + init_value_len = sizeof(uint8_t); + if (p_cscs_init->sensor_location != NULL) + { + encoded_init_value[0] = *p_cscs_init->sensor_location; + } + + attr_char_value.p_uuid = &ble_uuid; + attr_char_value.p_attr_md = &attr_md; + attr_char_value.init_len = init_value_len; + attr_char_value.init_offs = 0; + attr_char_value.max_len = init_value_len; + attr_char_value.p_value = encoded_init_value; + + return sd_ble_gatts_characteristic_add(p_cscs->service_handle, + &char_md, + &attr_char_value, + &p_cscs->sensor_loc_handles); +} + + +uint32_t ble_cscs_init(ble_cscs_t * p_cscs, const ble_cscs_init_t * p_cscs_init) +{ + uint32_t err_code; + ble_uuid_t ble_uuid; + ble_cs_ctrlpt_init_t sc_ctrlpt_init; + + // Initialize service structure + p_cscs->evt_handler = p_cscs_init->evt_handler; + p_cscs->conn_handle = BLE_CONN_HANDLE_INVALID; + p_cscs->feature = p_cscs_init->feature; + + // Add service + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_CYCLING_SPEED_AND_CADENCE); + + err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, + &ble_uuid, + &p_cscs->service_handle); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add cycling speed and cadence measurement characteristic + err_code = csc_measurement_char_add(p_cscs, p_cscs_init); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add cycling speed and cadence feature characteristic + err_code = csc_feature_char_add(p_cscs, p_cscs_init); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add Sensor Location characteristic (optional) + if (p_cscs_init->sensor_location != NULL) + { + err_code = csc_sensor_loc_char_add(p_cscs, p_cscs_init); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + + + // Add speed and cadence control point characteristic + sc_ctrlpt_init.error_handler = p_cscs_init->error_handler; + sc_ctrlpt_init.size_list_supported_locations = p_cscs_init->size_list_supported_locations; + sc_ctrlpt_init.supported_functions = p_cscs_init->ctrplt_supported_functions; + sc_ctrlpt_init.evt_handler = p_cscs_init->ctrlpt_evt_handler; + sc_ctrlpt_init.list_supported_locations = p_cscs_init->list_supported_locations; + sc_ctrlpt_init.sc_ctrlpt_attr_md = p_cscs_init->csc_ctrlpt_attr_md; + sc_ctrlpt_init.sensor_location_handle = p_cscs->sensor_loc_handles.value_handle; + sc_ctrlpt_init.service_handle = p_cscs->service_handle; + + return ble_sc_ctrlpt_init(&p_cscs->ctrl_pt, &sc_ctrlpt_init); +} + + +uint32_t ble_cscs_measurement_send(ble_cscs_t * p_cscs, ble_cscs_meas_t * p_measurement) +{ + uint32_t err_code; + + // Send value if connected and notifying + if (p_cscs->conn_handle != BLE_CONN_HANDLE_INVALID) + { + uint8_t encoded_csc_meas[MAX_CSCM_LEN]; + uint16_t len; + uint16_t hvx_len; + ble_gatts_hvx_params_t hvx_params; + + len = csc_measurement_encode(p_cscs, p_measurement, encoded_csc_meas); + hvx_len = len; + + memset(&hvx_params, 0, sizeof(hvx_params)); + + hvx_params.handle = p_cscs->meas_handles.value_handle; + hvx_params.type = BLE_GATT_HVX_NOTIFICATION; + hvx_params.offset = 0; + hvx_params.p_len = &hvx_len; + hvx_params.p_data = encoded_csc_meas; + + err_code = sd_ble_gatts_hvx(p_cscs->conn_handle, &hvx_params); + if ((err_code == NRF_SUCCESS) && (hvx_len != len)) + { + err_code = NRF_ERROR_DATA_SIZE; + } + } + else + { + err_code = NRF_ERROR_INVALID_STATE; + } + + return err_code; +} diff --git a/components/ble/ble_services/ble_cscs/ble_cscs.h b/components/ble/ble_services/ble_cscs/ble_cscs.h new file mode 100644 index 0000000..5517ccb --- /dev/null +++ b/components/ble/ble_services/ble_cscs/ble_cscs.h @@ -0,0 +1,161 @@ +/* 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 ble_sdk_srv_csc Cycling Speed and Cadence Service + * @{ + * @ingroup ble_sdk_srv + * @brief Cycling Speed and Cadence Service module. + * + * @details This module implements the Cycling Speed and Cadence Service. If enabled, notification + * of the Cycling Speead and Candence Measurement is performed when the application + * calls ble_cscs_measurement_send(). + * + * To use this service, you need to provide the the supported features (@ref BLE_CSCS_FEATURES). + * If you choose to support Wheel revolution data (feature bit @ref BLE_CSCS_FEATURE_WHEEL_REV_BIT), + * you then need to support the 'setting of cumulative value' operation by the supporting the + * Speed and Cadence Control Point (@ref ble_sdk_srv_sc_ctrlpt) by setting the @ref BLE_SRV_SC_CTRLPT_CUM_VAL_OP_SUPPORTED + * bit of the ctrplt_supported_functions in the @ref ble_cscs_init_t structure. + * If you want to support the 'start autocalibration' control point feature, you need, after the @ref BLE_SC_CTRLPT_EVT_START_CALIBRATION + * has been received and the auto calibration is finished, to call the @ref ble_sc_ctrlpt_rsp_send to indicate that the operation is finished + * and thus be able to receive new control point operations. + * If you want to support the 'sensor location' related operation, you need to provide a list of supported location in the + * @ref ble_cscs_init_t structure. + * + * + * @note The application or the service using this module must propagate BLE stack events to the + * Cycling Speead and Candence Service module by calling ble_cscs_on_ble_evt() from the + * from the @ref softdevice_handler function. This service will forward the event to the @ref ble_sdk_srv_sc_ctrlpt module. + * + * @note Attention! + * To maintain compliance with Nordic Semiconductor ASA Bluetooth profile + * qualification listings, this section of source code must not be modified. + */ + +#ifndef BLE_CSCS_H__ +#define BLE_CSCS_H__ + +#include +#include +#include "ble.h" +#include "ble_srv_common.h" +#include "ble_sc_ctrlpt.h" +#include "ble_sensor_location.h" + +/** @defgroup BLE_CSCS_FEATURES Cycling Speed and Cadence Service feature bits + * @{ */ +#define BLE_CSCS_FEATURE_WHEEL_REV_BIT (0x01 << 0) /**< Wheel Revolution Data Supported bit. */ +#define BLE_CSCS_FEATURE_CRANK_REV_BIT (0x01 << 1) /**< Crank Revolution Data Supported bit. */ +#define BLE_CSCS_FEATURE_MULTIPLE_SENSORS_BIT (0x01 << 2) /**< Multiple Sensor Locations Supported bit. */ +/** @} */ + +/**@brief Cycling Speed and Cadence Service event type. */ +typedef enum +{ + BLE_CSCS_EVT_NOTIFICATION_ENABLED, /**< Cycling Speed and Cadence value notification enabled event. */ + BLE_CSCS_EVT_NOTIFICATION_DISABLED /**< Cycling Speed and Cadence value notification disabled event. */ +} ble_cscs_evt_type_t; + +/**@brief Cycling Speed and Cadence Service event. */ +typedef struct +{ + ble_cscs_evt_type_t evt_type; /**< Type of event. */ +} ble_cscs_evt_t; + +// Forward declaration of the ble_csc_t type. +typedef struct ble_cscs_s ble_cscs_t; + +/**@brief Cycling Speed and Cadence Service event handler type. */ +typedef void (*ble_cscs_evt_handler_t) (ble_cscs_t * p_cscs, ble_cscs_evt_t * p_evt); + +/**@brief Cycling Speed and Cadence Service init structure. This contains all options and data +* needed for initialization of the service. */ +typedef struct +{ + ble_cscs_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Cycling Speed and Cadence Service. */ + ble_srv_cccd_security_mode_t csc_meas_attr_md; /**< Initial security level for cycling speed and cadence measurement attribute */ + ble_srv_cccd_security_mode_t csc_ctrlpt_attr_md; /**< Initial security level for cycling speed and cadence control point attribute */ + ble_srv_security_mode_t csc_feature_attr_md; /**< Initial security level for feature attribute */ + uint16_t feature; /**< Initial value for features of sensor @ref BLE_CSCS_FEATURES. */ + uint8_t ctrplt_supported_functions; /**< Supported control point functionalities see @ref BLE_SRV_SC_CTRLPT_SUPP_FUNC. */ + ble_sc_ctrlpt_evt_handler_t ctrlpt_evt_handler; /**< Event handler */ + ble_sensor_location_t *list_supported_locations; /**< List of supported sensor locations.*/ + uint8_t size_list_supported_locations; /**< Number of supported sensor locations in the list.*/ + ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */ + ble_sensor_location_t *sensor_location; /**< Initial Sensor Location, if NULL, sensor_location characteristic is not added*/ + ble_srv_cccd_security_mode_t csc_sensor_loc_attr_md; /**< Initial security level for sensor location attribute */ +} ble_cscs_init_t; + +/**@brief Cycling Speed and Cadence Service structure. This contains various status information for + * the service. */ +struct ble_cscs_s +{ + ble_cscs_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Cycling Speed and Cadence Service. */ + uint16_t service_handle; /**< Handle of Cycling Speed and Cadence Service (as provided by the BLE stack). */ + ble_gatts_char_handles_t meas_handles; /**< Handles related to the Cycling Speed and Cadence Measurement characteristic. */ + ble_gatts_char_handles_t feature_handles; /**< Handles related to the Cycling Speed and Cadence feature characteristic. */ + ble_gatts_char_handles_t sensor_loc_handles; /**< Handles related to the Cycling Speed and Cadence Sensor Location characteristic. */ + uint16_t conn_handle; /**< Handle of the current connection (as provided by the BLE stack, is BLE_CONN_HANDLE_INVALID if not in a connection). */ + uint16_t feature; /**< Bit mask of features available on sensor. */ + ble_sc_ctrlpt_t ctrl_pt; /**< data for speed and cadence control point */ +}; + +/**@brief Cycling Speed and Cadence Service measurement structure. This contains a Cycling Speed and + * Cadence Service measurement. */ +typedef struct ble_cscs_meas_s +{ + bool is_wheel_rev_data_present; /**< True if Wheel Revolution Data is present in the measurement. */ + bool is_crank_rev_data_present; /**< True if Crank Revolution Data is present in the measurement. */ + uint32_t cumulative_wheel_revs; /**< Cumulative Wheel Revolutions. */ + uint16_t last_wheel_event_time; /**< Last Wheel Event Time. */ + uint16_t cumulative_crank_revs; /**< Cumulative Crank Revolutions. */ + uint16_t last_crank_event_time; /**< Last Crank Event Time. */ +} ble_cscs_meas_t; + +/**@brief Function for initializing the Cycling Speed and Cadence Service. + * + * @param[out] p_cscs Cycling Speed and Cadence 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 this particular service instance. + * @param[in] p_cscs_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on successful initialization of service, otherwise an error code. + */ +uint32_t ble_cscs_init(ble_cscs_t * p_cscs, const ble_cscs_init_t * p_cscs_init); + +/**@brief Function for handling the Application's BLE Stack events. + * + * @details Handles all events from the BLE stack of interest to the Cycling Speed and Cadence + * Service. + * + * @param[in] p_cscs Cycling Speed and Cadence Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +void ble_cscs_on_ble_evt(ble_cscs_t * p_cscs, ble_evt_t * p_ble_evt); + +/**@brief Function for sending cycling speed and cadence measurement if notification has been enabled. + * + * @details The application calls this function after having performed a Cycling Speed and Cadence + * Service measurement. If notification has been enabled, the measurement data is encoded + * and sent to the client. + * + * @param[in] p_cscs Cycling Speed and Cadence Service structure. + * @param[in] p_measurement Pointer to new cycling speed and cadence measurement. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +uint32_t ble_cscs_measurement_send(ble_cscs_t * p_cscs, ble_cscs_meas_t * p_measurement); + +#endif // BLE_CSCS_H__ + +/** @} */ diff --git a/components/ble/ble_services/ble_cscs/ble_sc_ctrlpt.c b/components/ble/ble_services/ble_cscs/ble_sc_ctrlpt.c new file mode 100644 index 0000000..33e24fc --- /dev/null +++ b/components/ble/ble_services/ble_cscs/ble_sc_ctrlpt.c @@ -0,0 +1,634 @@ +/* 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. + * + */ + +/* Attention! + * To maintain compliance with Nordic Semiconductor ASAs Bluetooth profile + * qualification listings, this section of source code must not be modified. + */ + +#include "ble_sc_ctrlpt.h" +#include +#include "nordic_common.h" +#include "ble_l2cap.h" +#include "ble_srv_common.h" +#include "app_util.h" + +#define SC_CTRLPT_NACK_PROC_ALREADY_IN_PROGRESS (BLE_GATT_STATUS_ATTERR_APP_BEGIN + 0) +#define SC_CTRLPT_NACK_CCCD_IMPROPERLY_CONFIGURED (BLE_GATT_STATUS_ATTERR_APP_BEGIN + 1) + +uint32_t ble_sc_ctrlpt_init(ble_sc_ctrlpt_t * p_sc_ctrlpt, + const ble_cs_ctrlpt_init_t * p_sc_ctrlpt_init) +{ + 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; + + p_sc_ctrlpt->conn_handle = BLE_CONN_HANDLE_INVALID; + p_sc_ctrlpt->procedure_status = BLE_SCPT_NO_PROC_IN_PROGRESS; + + p_sc_ctrlpt->size_list_supported_locations = p_sc_ctrlpt_init->size_list_supported_locations; + + if ((p_sc_ctrlpt_init->size_list_supported_locations != 0) && + (p_sc_ctrlpt_init->list_supported_locations != NULL)) + { + memcpy(p_sc_ctrlpt->list_supported_locations, + p_sc_ctrlpt_init->list_supported_locations, + p_sc_ctrlpt->size_list_supported_locations * sizeof(ble_sensor_location_t)); + } + + p_sc_ctrlpt->service_handle = p_sc_ctrlpt_init->service_handle; + p_sc_ctrlpt->evt_handler = p_sc_ctrlpt_init->evt_handler; + p_sc_ctrlpt->supported_functions = p_sc_ctrlpt_init->supported_functions; + p_sc_ctrlpt->sensor_location_handle = p_sc_ctrlpt_init->sensor_location_handle; + p_sc_ctrlpt->error_handler = p_sc_ctrlpt_init->error_handler; + + memset(&cccd_md, 0, sizeof(cccd_md)); + + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm); + cccd_md.write_perm = p_sc_ctrlpt_init->sc_ctrlpt_attr_md.cccd_write_perm; + cccd_md.vloc = BLE_GATTS_VLOC_STACK; + + memset(&char_md, 0, sizeof(char_md)); + + char_md.char_props.indicate = 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_BLE_ASSIGN(ble_uuid, BLE_UUID_SC_CTRLPT_CHAR); + + memset(&attr_md, 0, sizeof(attr_md)); + + BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&attr_md.read_perm); + attr_md.write_perm = p_sc_ctrlpt_init->sc_ctrlpt_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_SC_CTRLPT_MAX_LEN; + attr_char_value.p_value = 0; + + return sd_ble_gatts_characteristic_add(p_sc_ctrlpt->service_handle, + &char_md, + &attr_char_value, + &p_sc_ctrlpt->sc_ctrlpt_handles); +} + + +/**@brief Decode an incoming control point write. + * + * @param[in] rcvd_val received write value + * @param[in] len value length + * @param[out] decoded_ctrlpt decoded control point structure + */ +static uint32_t sc_ctrlpt_decode(uint8_t * p_rcvd_val, + uint8_t len, + ble_sc_ctrlpt_val_t * p_write_val) +{ + int pos = 0; + + if (len < BLE_SC_CTRLPT_MIN_LEN) + { + return NRF_ERROR_INVALID_PARAM; + } + + p_write_val->opcode = (ble_scpt_operator_t) p_rcvd_val[pos++]; + + switch (p_write_val->opcode) + { + case BLE_SCPT_REQUEST_SUPPORTED_SENSOR_LOCATIONS: + break; + + case BLE_SCPT_START_AUTOMATIC_CALIBRATION: + break; + + case BLE_SCPT_UPDATE_SENSOR_LOCATION: + p_write_val->location = (ble_sensor_location_t)p_rcvd_val[pos]; + break; + + case BLE_SCPT_SET_CUMULATIVE_VALUE: + p_write_val->cumulative_value = uint32_decode(&(p_rcvd_val[pos])); + break; + + default: + return NRF_ERROR_INVALID_PARAM; + } + return NRF_SUCCESS; +} + + +/**@brief encode a control point response indication. + * + * @param[in] p_sc_ctrlpt SC Ctrlpt structure. + * @param[in] p_ctrlpt_rsp structure containing response data to be encoded + * @param[out] p_data pointer where data needs to be written + * @return size of encoded data + */ +static int ctrlpt_rsp_encode(ble_sc_ctrlpt_t * p_sc_ctrlpt, + ble_sc_ctrlpt_rsp_t * p_ctrlpt_rsp, + uint8_t * p_data) +{ + int len = 0; + + p_data[len++] = BLE_SCPT_RESPONSE_CODE; + p_data[len++] = p_ctrlpt_rsp->opcode; + p_data[len++] = p_ctrlpt_rsp->status; + + if (p_ctrlpt_rsp->status == BLE_SCPT_SUCCESS) + { + switch (p_ctrlpt_rsp->opcode) + { + case BLE_SCPT_REQUEST_SUPPORTED_SENSOR_LOCATIONS: + { + int i; + for (i = 0; i < p_sc_ctrlpt->size_list_supported_locations; i++) + { + p_data[len++] = p_sc_ctrlpt->list_supported_locations[i]; + } + break; + } + + default: + // No implementation needed. + break; + } + } + return len; +} + + +/**@brief check if a given sensor location is supported or not. + * + * @param[in] p_sc_ctrlpt SC Ctrlpt structure. + * @param[in] location sensor location to check. + * @return true if the given location is found in the list of supported locations, false otherwise. + */ +static bool is_location_supported(ble_sc_ctrlpt_t * p_sc_ctrlpt, ble_sensor_location_t location) +{ + int i; + + for (i = 0; i < p_sc_ctrlpt->size_list_supported_locations; i++) + { + if (p_sc_ctrlpt->list_supported_locations[i] == location) + { + return true; + } + } + return false; +} + + +/**@brief check if the cccd is configured + * + * @param[in] p_sc_ctrlpt SC Ctrlpt structure. + * @return true if the sc_control point's cccd is correctly configured, false otherwise. + */ +static bool is_cccd_configured(ble_sc_ctrlpt_t * p_sc_ctrlpt) +{ + uint32_t err_code; + uint8_t cccd_value_buf[BLE_CCCD_VALUE_LEN]; + bool is_sccp_indic_enabled = false; + 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_value_buf; + + err_code = sd_ble_gatts_value_get(p_sc_ctrlpt->conn_handle, + p_sc_ctrlpt->sc_ctrlpt_handles.cccd_handle, + &gatts_value); + if (err_code != NRF_SUCCESS) + { + // Report error to application + if (p_sc_ctrlpt->error_handler != NULL) + { + p_sc_ctrlpt->error_handler(err_code); + } + } + + is_sccp_indic_enabled = ble_srv_is_indication_enabled(cccd_value_buf); + + return is_sccp_indic_enabled; +} + + +/**@brief sends a control point indication. + * + * @param[in] p_sc_ctrlpt SC Ctrlpt structure. + */ +static void sc_ctrlpt_resp_send(ble_sc_ctrlpt_t * p_sc_ctrlpt) +{ + uint16_t hvx_len; + ble_gatts_hvx_params_t hvx_params; + uint32_t err_code; + + if ((p_sc_ctrlpt->procedure_status == BLE_SCPT_INDICATION_PENDING)) + { + hvx_len = p_sc_ctrlpt->response.len; + memset(&hvx_params, 0, sizeof(hvx_params)); + + hvx_params.handle = p_sc_ctrlpt->sc_ctrlpt_handles.value_handle; + hvx_params.type = BLE_GATT_HVX_INDICATION; + hvx_params.offset = 0; + hvx_params.p_len = &hvx_len; + hvx_params.p_data = p_sc_ctrlpt->response.encoded_ctrl_rsp; + + err_code = sd_ble_gatts_hvx(p_sc_ctrlpt->conn_handle, &hvx_params); + + // Error handling + if ((err_code == NRF_SUCCESS) && (hvx_len != p_sc_ctrlpt->response.len)) + { + err_code = NRF_ERROR_DATA_SIZE; + } + + switch (err_code) + { + case NRF_SUCCESS: + p_sc_ctrlpt->procedure_status = BLE_SCPT_IND_CONFIRM_PENDING; + // Wait for HVC event + break; + + case BLE_ERROR_NO_TX_BUFFERS: + // Wait for TX_COMPLETE event to retry transmission + p_sc_ctrlpt->procedure_status = BLE_SCPT_INDICATION_PENDING; + break; + + default: + // Report error to application + p_sc_ctrlpt->procedure_status = BLE_SCPT_NO_PROC_IN_PROGRESS; + if (p_sc_ctrlpt->error_handler != NULL) + { + p_sc_ctrlpt->error_handler(err_code); + } + break; + } + } +} + + +/**@brief Handle a write event to the Speed and Cadence Control Point. + * + * @param[in] p_sc_ctrlpt SC Ctrlpt structure. + * @param[in] p_evt_write WRITE event to be handled. + */ +static void on_ctrlpt_write(ble_sc_ctrlpt_t * p_sc_ctrlpt, + ble_gatts_evt_write_t * p_evt_write) +{ + ble_sc_ctrlpt_val_t rcvd_ctrlpt = + { BLE_SCPT_RESPONSE_CODE , 0, BLE_SENSOR_LOCATION_OTHER }; + + ble_sc_ctrlpt_rsp_t rsp; + uint32_t err_code; + ble_gatts_rw_authorize_reply_params_t auth_reply; + ble_sc_ctrlpt_evt_t evt; + + auth_reply.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE; + auth_reply.params.write.gatt_status = BLE_GATT_STATUS_SUCCESS; + + if (is_cccd_configured(p_sc_ctrlpt)) + { + if (p_sc_ctrlpt->procedure_status == BLE_SCPT_NO_PROC_IN_PROGRESS) + { + auth_reply.params.write.gatt_status = BLE_GATT_STATUS_SUCCESS; + } + else + { + auth_reply.params.write.gatt_status = SC_CTRLPT_NACK_PROC_ALREADY_IN_PROGRESS; + } + } + else + { + auth_reply.params.write.gatt_status = SC_CTRLPT_NACK_CCCD_IMPROPERLY_CONFIGURED; + } + + err_code = sd_ble_gatts_rw_authorize_reply(p_sc_ctrlpt->conn_handle, &auth_reply); + if (err_code != NRF_SUCCESS) + { + // Report error to application. + if (p_sc_ctrlpt->error_handler != NULL) + { + p_sc_ctrlpt->error_handler(err_code); + } + } + + if (auth_reply.params.write.gatt_status != BLE_GATT_STATUS_SUCCESS) + { + return; + } + + p_sc_ctrlpt->procedure_status = BLE_SCPT_INDICATION_PENDING; + rsp.status = BLE_SCPT_OP_CODE_NOT_SUPPORTED; + + err_code = sc_ctrlpt_decode(p_evt_write->data, p_evt_write->len, &rcvd_ctrlpt); + if (err_code != NRF_SUCCESS) + { + rsp.opcode = rcvd_ctrlpt.opcode; + rsp.status = BLE_SCPT_OP_CODE_NOT_SUPPORTED; + } + else + { + rsp.opcode = rcvd_ctrlpt.opcode; + + switch (rcvd_ctrlpt.opcode) + { + case BLE_SCPT_REQUEST_SUPPORTED_SENSOR_LOCATIONS: + if ((p_sc_ctrlpt->supported_functions & + BLE_SRV_SC_CTRLPT_SENSOR_LOCATIONS_OP_SUPPORTED) == + BLE_SRV_SC_CTRLPT_SENSOR_LOCATIONS_OP_SUPPORTED) + { + rsp.status = BLE_SCPT_SUCCESS; + } + else + { + rsp.status = BLE_SCPT_OP_CODE_NOT_SUPPORTED; + } + break; + + case BLE_SCPT_UPDATE_SENSOR_LOCATION: + if ((p_sc_ctrlpt->supported_functions & + BLE_SRV_SC_CTRLPT_SENSOR_LOCATIONS_OP_SUPPORTED) == + BLE_SRV_SC_CTRLPT_SENSOR_LOCATIONS_OP_SUPPORTED) + { + if (is_location_supported(p_sc_ctrlpt, rcvd_ctrlpt.location)) + { + ble_gatts_value_t gatts_value; + uint8_t rcvd_location = (uint8_t)rcvd_ctrlpt.location; + rsp.status = BLE_SCPT_SUCCESS; + + // Initialize value struct. + memset(&gatts_value, 0, sizeof(gatts_value)); + + gatts_value.len = sizeof(uint8_t); + gatts_value.offset = 0; + gatts_value.p_value = &rcvd_location; + + evt.evt_type = BLE_SC_CTRLPT_EVT_UPDATE_LOCATION; + evt.params.update_location = rcvd_ctrlpt.location; + if (p_sc_ctrlpt->evt_handler != NULL) + { + rsp.status = p_sc_ctrlpt->evt_handler(p_sc_ctrlpt, &evt); + } + if (rsp.status == BLE_SCPT_SUCCESS) + { + err_code = sd_ble_gatts_value_set(p_sc_ctrlpt->conn_handle, + p_sc_ctrlpt->sensor_location_handle, + &gatts_value); + if (err_code != NRF_SUCCESS) + { + // Report error to application + if (p_sc_ctrlpt->error_handler != NULL) + { + p_sc_ctrlpt->error_handler(err_code); + } + rsp.status = BLE_SCPT_OPERATION_FAILED; + } + } + } + else + { + rsp.status = BLE_SCPT_INVALID_PARAMETER; + } + } + else + { + rsp.status = BLE_SCPT_OP_CODE_NOT_SUPPORTED; + } + break; + + case BLE_SCPT_SET_CUMULATIVE_VALUE: + if ((p_sc_ctrlpt->supported_functions & + BLE_SRV_SC_CTRLPT_CUM_VAL_OP_SUPPORTED) == + BLE_SRV_SC_CTRLPT_CUM_VAL_OP_SUPPORTED) + { + rsp.status = BLE_SCPT_SUCCESS; + + evt.evt_type = BLE_SC_CTRLPT_EVT_SET_CUMUL_VALUE; + evt.params.cumulative_value = rcvd_ctrlpt.cumulative_value; + if (p_sc_ctrlpt->evt_handler != NULL) + { + rsp.status = p_sc_ctrlpt->evt_handler(p_sc_ctrlpt, &evt); + } + } + else + { + rsp.status = BLE_SCPT_OP_CODE_NOT_SUPPORTED; + } + break; + + case BLE_SCPT_START_AUTOMATIC_CALIBRATION: + if ((p_sc_ctrlpt->supported_functions & + BLE_SRV_SC_CTRLPT_START_CALIB_OP_SUPPORTED) == + BLE_SRV_SC_CTRLPT_START_CALIB_OP_SUPPORTED) + { + p_sc_ctrlpt->procedure_status = BLE_SCPT_AUTOMATIC_CALIB_IN_PROGRESS; + evt.evt_type = BLE_SC_CTRLPT_EVT_START_CALIBRATION; + if (p_sc_ctrlpt->evt_handler != NULL) + { + rsp.status = p_sc_ctrlpt->evt_handler(p_sc_ctrlpt, &evt); + if (rsp.status != BLE_SCPT_SUCCESS) + { + p_sc_ctrlpt->procedure_status = BLE_SCPT_INDICATION_PENDING; // If the application returns an error, the response is to be sent right away and the calibration is considered as not started. + } + } + } + else + { + rsp.status = BLE_SCPT_OP_CODE_NOT_SUPPORTED; + } + break; + + default: + rsp.status = BLE_SCPT_OP_CODE_NOT_SUPPORTED; + break; + } + + } + + p_sc_ctrlpt->response.len = ctrlpt_rsp_encode(p_sc_ctrlpt, &rsp, + p_sc_ctrlpt->response.encoded_ctrl_rsp); + + + if (p_sc_ctrlpt->procedure_status == BLE_SCPT_INDICATION_PENDING) + { + sc_ctrlpt_resp_send(p_sc_ctrlpt); + } +} + + +/**@brief Authorize WRITE request event handler. + * + * @details Handles WRITE events from the BLE stack. + * + * @param[in] p_sc_ctrlpt SC Ctrlpt structure. + * @param[in] p_gatts_evt GATTS Event received from the BLE stack. + * + */ +static void on_rw_authorize_request(ble_sc_ctrlpt_t * p_sc_ctrlpt, ble_gatts_evt_t * p_gatts_evt) +{ + ble_gatts_evt_rw_authorize_request_t * p_auth_req = &p_gatts_evt->params.authorize_request; + if (p_auth_req->type == BLE_GATTS_AUTHORIZE_TYPE_WRITE) + { + if ( (p_gatts_evt->params.authorize_request.request.write.op + != BLE_GATTS_OP_PREP_WRITE_REQ) + && (p_gatts_evt->params.authorize_request.request.write.op + != BLE_GATTS_OP_EXEC_WRITE_REQ_NOW) + && (p_gatts_evt->params.authorize_request.request.write.op + != BLE_GATTS_OP_EXEC_WRITE_REQ_CANCEL) + ) + { + if (p_auth_req->request.write.handle == p_sc_ctrlpt->sc_ctrlpt_handles.value_handle) + { + on_ctrlpt_write(p_sc_ctrlpt, &p_auth_req->request.write); + } + } + } +} + + +/**@brief Tx Complete event handler. + * + * @details Tx Complete event handler. + * Handles WRITE events from the BLE stack and if an indication was pending try sending it + * again. + * + * @param[in] p_sc_ctrlpt SC Ctrlpt structure. + * + */ +static void on_tx_complete(ble_sc_ctrlpt_t * p_sc_ctrlpt) +{ + if (p_sc_ctrlpt->procedure_status == BLE_SCPT_INDICATION_PENDING) + { + sc_ctrlpt_resp_send(p_sc_ctrlpt); + } +} + + +/**@brief Function for handling the Connect event. + * + * @param[in] p_sc_ctrlpt SC Ctrlpt structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_connect(ble_sc_ctrlpt_t * p_sc_ctrlpt, ble_evt_t * p_ble_evt) +{ + p_sc_ctrlpt->conn_handle = p_ble_evt->evt.gap_evt.conn_handle; + p_sc_ctrlpt->procedure_status = BLE_SCPT_NO_PROC_IN_PROGRESS; +} + + +/**@brief Function for handling the Disconnect event. + * + * @param[in] p_sc_ctrlpt SC Ctrlpt structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_disconnect(ble_sc_ctrlpt_t * p_sc_ctrlpt, ble_evt_t * p_ble_evt) +{ + UNUSED_PARAMETER(p_ble_evt); + p_sc_ctrlpt->conn_handle = BLE_CONN_HANDLE_INVALID; + p_sc_ctrlpt->procedure_status = BLE_SCPT_NO_PROC_IN_PROGRESS; +} + + +/**@brief Function for handling the BLE_GATTS_EVT_HVC event. + * + * @param[in] p_sc_ctrlpt SC Ctrlpt structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_sc_hvc_confirm(ble_sc_ctrlpt_t * p_sc_ctrlpt, ble_evt_t * p_ble_evt) +{ + if (p_ble_evt->evt.gatts_evt.params.hvc.handle == p_sc_ctrlpt->sc_ctrlpt_handles.value_handle) + { + if (p_sc_ctrlpt->procedure_status == BLE_SCPT_IND_CONFIRM_PENDING) + { + p_sc_ctrlpt->procedure_status = BLE_SCPT_NO_PROC_IN_PROGRESS; + } + } +} + + +void ble_sc_ctrlpt_on_ble_evt(ble_sc_ctrlpt_t * p_sc_ctrlpt, ble_evt_t * p_ble_evt) +{ + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + on_connect(p_sc_ctrlpt, p_ble_evt); + break; + + case BLE_GAP_EVT_DISCONNECTED: + on_disconnect(p_sc_ctrlpt, p_ble_evt); + break; + + case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST: + on_rw_authorize_request(p_sc_ctrlpt, &p_ble_evt->evt.gatts_evt); + break; + + case BLE_GATTS_EVT_HVC: + on_sc_hvc_confirm(p_sc_ctrlpt, p_ble_evt); + break; + + case BLE_EVT_TX_COMPLETE: + on_tx_complete(p_sc_ctrlpt); + break; + + default: + break; + } +} + + +uint32_t ble_sc_ctrlpt_rsp_send(ble_sc_ctrlpt_t * p_sc_ctrlpt, ble_scpt_response_t response_status) +{ + uint32_t err_code = NRF_SUCCESS; + ble_sc_ctrlpt_rsp_t rsp; + uint8_t encoded_ctrl_rsp[BLE_SC_CTRLPT_MAX_LEN]; + uint16_t hvx_len; + ble_gatts_hvx_params_t hvx_params; + + if (p_sc_ctrlpt->procedure_status != BLE_SCPT_AUTOMATIC_CALIB_IN_PROGRESS) + { + return NRF_ERROR_INVALID_STATE; + } + rsp.status = response_status; + rsp.opcode = BLE_SCPT_START_AUTOMATIC_CALIBRATION; + hvx_len = ctrlpt_rsp_encode(p_sc_ctrlpt, &rsp, encoded_ctrl_rsp); + + // Send indication + memset(&hvx_params, 0, sizeof(hvx_params)); + + hvx_params.handle = p_sc_ctrlpt->sc_ctrlpt_handles.value_handle; + hvx_params.type = BLE_GATT_HVX_INDICATION; + hvx_params.offset = 0; + hvx_params.p_len = &hvx_len; + hvx_params.p_data = encoded_ctrl_rsp; + + err_code = sd_ble_gatts_hvx(p_sc_ctrlpt->conn_handle, &hvx_params); + + if (err_code == NRF_SUCCESS) + { + p_sc_ctrlpt->procedure_status = BLE_SCPT_NO_PROC_IN_PROGRESS; + } + return err_code; +} diff --git a/components/ble/ble_services/ble_cscs/ble_sc_ctrlpt.h b/components/ble/ble_services/ble_cscs/ble_sc_ctrlpt.h new file mode 100644 index 0000000..fc5ac9b --- /dev/null +++ b/components/ble/ble_services/ble_cscs/ble_sc_ctrlpt.h @@ -0,0 +1,211 @@ +/* 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. + * + */ + +/** @file + * + * @defgroup ble_sdk_srv_sc_ctrlpt Speed and Cadence Control Point + * @{ + * @ingroup ble_sdk_srv + * @brief Speed and Cadence Control Point module. + * + * @details This module implements the Speed and Cadence control point behavior. It is used + * by the @ref ble_sdk_srv_csc module and the ble_sdk_srv_rsc module for control point + * mechanisms like setting a cumulative value, Start an automatic calibration, + * Update the sensor location or request the supported locations. + * + * @note Attention! + * To maintain compliance with Nordic Semiconductor ASA Bluetooth profile + * qualification listings, this section of source code must not be modified. + */ + +#ifndef BLE_SC_CTRLPT_H__ +#define BLE_SC_CTRLPT_H__ + +#include +#include +#include "ble.h" +#include "ble_srv_common.h" +#include "ble_sensor_location.h" + +#define BLE_SC_CTRLPT_MAX_LEN 19 /**< maximum lenght for Speed and cadence control point characteristic value. */ +#define BLE_SC_CTRLPT_MIN_LEN 1 /**< minimum length for Speed and cadence control point characteristic value. */ + +// Forward declaration of the ble_sc_ctrlpt_t type. +typedef struct ble_sc_ctrlpt_s ble_sc_ctrlpt_t; + + +/**@brief Speed and Cadence Control Point event type. */ +typedef enum +{ + BLE_SC_CTRLPT_EVT_UPDATE_LOCATION, /**< rcvd update location opcode (the control point handles the change of location automatically, the event just informs the application in case it needs to adjust its algorithm). */ + BLE_SC_CTRLPT_EVT_SET_CUMUL_VALUE, /**< rcvd set cumulative value opcode, it is then up to the application to use the new cumulative value. */ + BLE_SC_CTRLPT_EVT_START_CALIBRATION, /**< rcvd start calibration opcode, the application needs, at the end ot the calibration to call ble_sc_ctrlpt_send_rsp. */ +} ble_sc_ctrlpt_evt_type_t; + + +/**@brief Speed and Cadence Control point event. */ +typedef struct +{ + ble_sc_ctrlpt_evt_type_t evt_type; /**< Type of event. */ + union + { + ble_sensor_location_t update_location; + uint32_t cumulative_value; + }params; +} ble_sc_ctrlpt_evt_t; + + +/** Speed and Cadence Control Point operator code (see RSC service specification)*/ +typedef enum { + BLE_SCPT_SET_CUMULATIVE_VALUE = 0x01, /**< Operator to set a given cumulative value. */ + BLE_SCPT_START_AUTOMATIC_CALIBRATION = 0x02, /**< Operator to start automatic calibration. */ + BLE_SCPT_UPDATE_SENSOR_LOCATION = 0x03, /**< Operator to update the sensor location. */ + BLE_SCPT_REQUEST_SUPPORTED_SENSOR_LOCATIONS = 0x04, /**< Operator to request the supported sensor locations. */ + BLE_SCPT_RESPONSE_CODE = 0x10, /**< Response Code. */ +} ble_scpt_operator_t; + + +/** Speed and Cadence Control Point response parameter (see RSC service specification)*/ +typedef enum { + BLE_SCPT_SUCCESS = 0x01, /**< Sucess Response. */ + BLE_SCPT_OP_CODE_NOT_SUPPORTED = 0x02, /**< Error Response received opcode not supported. */ + BLE_SCPT_INVALID_PARAMETER = 0x03, /**< Error Response received parameter invalid. */ + BLE_SCPT_OPERATION_FAILED = 0x04, /**< Error Response operation failed. */ +} ble_scpt_response_t; + + +/** Speed and Cadence Control Point procedure status (indicates is a procedure is in progress or not and which procedure is in progress*/ +typedef enum { + BLE_SCPT_NO_PROC_IN_PROGRESS = 0x00, /**< No procedure in progress. */ + BLE_SCPT_AUTOMATIC_CALIB_IN_PROGRESS = 0x01, /**< Automatic Calibration is in progress. */ + BLE_SCPT_INDICATION_PENDING = 0x02, /**< Control Point Indication is pending. */ + BLE_SCPT_IND_CONFIRM_PENDING = 0x03, /**< Waiting for the indication confirmation. */ +}ble_scpt_procedure_status_t; + +/**@brief Speed and Cadence Control point event handler type. */ +typedef ble_scpt_response_t (*ble_sc_ctrlpt_evt_handler_t) (ble_sc_ctrlpt_t * p_sc_ctrlpt, + ble_sc_ctrlpt_evt_t * p_evt); + + +typedef struct{ + ble_scpt_operator_t opcode; + uint32_t cumulative_value; + ble_sensor_location_t location; +}ble_sc_ctrlpt_val_t; + + +typedef struct{ + ble_scpt_operator_t opcode; + ble_scpt_response_t status; + ble_sensor_location_t location_list[BLE_NB_MAX_SENSOR_LOCATIONS]; +}ble_sc_ctrlpt_rsp_t; + + +/** + * \defgroup BLE_SRV_SC_CTRLPT_SUPP_FUNC Control point functionalities. + *@{ + */ +#define BLE_SRV_SC_CTRLPT_SENSOR_LOCATIONS_OP_SUPPORTED 0x01 /**< Support for sensor location related operations */ +#define BLE_SRV_SC_CTRLPT_CUM_VAL_OP_SUPPORTED 0x02 /**< Support for setting cumulative value related operations */ +#define BLE_SRV_SC_CTRLPT_START_CALIB_OP_SUPPORTED 0x04 /**< Support for starting calibration related operations */ +/** + *@} + */ + +/**@brief Speed and Cadence Control Point init structure. This contains all options and data +* needed for initialization of the Speed and Cadence Control Point module. */ +typedef struct +{ + ble_srv_cccd_security_mode_t sc_ctrlpt_attr_md; /**< Initial security level for cycling speed and cadence control point attribute */ + uint8_t supported_functions; /**< supported control point functionalities see @ref BLE_SRV_SC_CTRLPT_SUPP_FUNC. */ + uint16_t service_handle; /**< Handle of the parent service (as provided by the BLE stack). */ + ble_sc_ctrlpt_evt_handler_t evt_handler; /**< event handler */ + ble_sensor_location_t *list_supported_locations; /**< list of supported sensor locations.*/ + uint8_t size_list_supported_locations; /**< number of supported sensor locations in the list.*/ + uint16_t sensor_location_handle; /**< handle for the sensor location characteristic (if sensor_location related operation are supported).*/ + ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */ +} ble_cs_ctrlpt_init_t; + + +/**@brief Speed and Cadence Control Point response indication structure. */ +typedef struct +{ + ble_scpt_response_t status; /**< control point response status .*/ + uint8_t len; /**< control point response length .*/ + uint8_t encoded_ctrl_rsp[BLE_SC_CTRLPT_MAX_LEN]; /**< control point encoded response.*/ +}ble_sc_ctrlpt_resp_t; + + +/**@brief Speed and Cadence Control Point structure. This contains various status information for + * the Speed and Cadence Control Point behavior. */ +struct ble_sc_ctrlpt_s +{ + uint8_t supported_functions; /**< supported control point functionalities see @ref BLE_SRV_SC_CTRLPT_SUPP_FUNC. */ + uint16_t service_handle; /**< Handle of the parent service (as provided by the BLE stack). */ + ble_gatts_char_handles_t sc_ctrlpt_handles; /**< Handles related to the Speed and Cadence Control Point characteristic. */ + uint16_t conn_handle; /**< Handle of the current connection (as provided by the BLE stack, is BLE_CONN_HANDLE_INVALID if not in a connection). */ + ble_sensor_location_t list_supported_locations[BLE_NB_MAX_SENSOR_LOCATIONS]; /**< list of supported sensor locations.*/ + uint8_t size_list_supported_locations; /**< number of supported sensor locations in the list.*/ + ble_sc_ctrlpt_evt_handler_t evt_handler; /**< Handle of the parent service (as provided by the BLE stack). */ + uint16_t sensor_location_handle; /**< handle for the sensor location characteristic (if sensor_location related operation are supported).*/ + ble_scpt_procedure_status_t procedure_status; /**< status of possible procedure*/ + ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */ + ble_sc_ctrlpt_resp_t response; /**< pending response data.*/ +}; + +#define SCPT_OPCODE_POS 0 /**< Request opcode position. */ +#define SCPT_PARAMETER_POS 1 /**< Request parameter position. */ + +#define SCPT_RESPONSE_REQUEST_OPCODE_POS 1 /**< Response position of requested opcode. */ +#define SCPT_RESPONSE_CODE_POS 2 /**< Response position of response code. */ +#define SCPT_RESPONSE_PARAMETER 3 /**< Response position of response parameter. */ + +#define SCPT_MIN_RESPONSE_SIZE 3 /**< Minimum size for control point response. */ +#define SCPT_MAX_RESPONSE_SIZE (SCPT_MIN_RESPONSE_SIZE + NB_MAX_SENSOR_LOCATIONS) /**< Maximum size for control point response. */ + + +/**@brief Function for Initializing the Speed and Cadence Control Point. + * + * @details Function for Initializing the Speed and Cadence Control Point. + * @param[in] p_sc_ctrlpt Speed and Cadence Control Point structure. + * @param[in] p_sc_ctrlpt_init Information needed to initialize the control point behavior. + * + * @return NRF_SUCCESS on successful initialization of service, otherwise an error code. + */ +uint32_t ble_sc_ctrlpt_init(ble_sc_ctrlpt_t * p_sc_ctrlpt, + const ble_cs_ctrlpt_init_t * p_sc_ctrlpt_init); + + +/**@brief Function for sending a control point response. + * + * @details Function for sending a control point response when the control point received was + * BLE_SCPT_START_AUTOMATIC_CALIBRATION. To be called after the calibration procedure is finished. + * + * @param[in] p_sc_ctrlpt Speed and Cadence Control Point structure. + * @param[in] response_status status to include in the control point response. + */ +uint32_t ble_sc_ctrlpt_rsp_send(ble_sc_ctrlpt_t * p_sc_ctrlpt, ble_scpt_response_t response_status); + + +/**@brief Speed and Cadence Control Point BLE stack event handler. + * + * @details Handles all events from the BLE stack of interest to the Speed and Cadence Control Point. + * + * @param[in] p_sc_ctrlpt Speed and Cadence Control Point structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +void ble_sc_ctrlpt_on_ble_evt(ble_sc_ctrlpt_t * p_sc_ctrlpt, ble_evt_t * p_ble_evt); + + +#endif // BLE_SC_CTRLPT_H__ + +/** @} */ diff --git a/components/ble/ble_services/ble_cts_c/ble_cts_c.c b/components/ble/ble_services/ble_cts_c/ble_cts_c.c new file mode 100644 index 0000000..4dbc0b5 --- /dev/null +++ b/components/ble/ble_services/ble_cts_c/ble_cts_c.c @@ -0,0 +1,332 @@ +/* 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 +#include "ble.h" +#include "ble_srv_common.h" +#include "ble_gattc.h" +#include "ble_cts_c.h" +#include "ble_date_time.h" +#include "device_manager.h" +#include "ble_db_discovery.h" +#include "app_trace.h" + +#define LOG app_trace_log /**< Debug logger macro that will be used in this file to do logging of important information over UART. */ +#define CTS_YEAR_MIN 1582 /**< The lowest valid Current Time year is the year when the western calendar was introduced. */ +#define CTS_YEAR_MAX 9999 /**< The highest possible Current Time. */ + +#define CTS_C_CURRENT_TIME_EXPECTED_LENGTH 10 /**< | Year |Month |Day |Hours |Minutes |Seconds |Weekday |Fraction|Reason | + | 2 bytes |1 byte |1 byte |1 byte |1 byte |1 byte |1 byte |1 byte |1 byte | = 10 bytes. */ + +static ble_cts_c_t * mp_ble_cts; /**< Pointer to the current instance of the CTS Client module. The memory for this provided by the application.*/ + + + +/**@brief Function for handling events from the database discovery module. + * + * @details This function will handle an event from the database discovery module, and determine + * if it relates to the discovery of Current Time Service at the peer. If so, it will + * call the application's event handler indicating that the Current Time Service has been + * discovered at the peer. It also populates the event with the service related + * information before providing it to the application. + * + * @param[in] p_evt Pointer to the event received from the database discovery module. + * + */ +static void db_discover_evt_handler(ble_db_discovery_evt_t * p_evt) +{ + LOG("[CTS]: Database Discovery handler called with event 0x%x\r\n", p_evt->evt_type); + + ble_cts_c_evt_t evt; + + // Check if the Current Time Service was discovered. + if (p_evt->evt_type == BLE_DB_DISCOVERY_COMPLETE && + p_evt->params.discovered_db.srv_uuid.uuid == BLE_UUID_CURRENT_TIME_SERVICE && + p_evt->params.discovered_db.srv_uuid.type == BLE_UUID_TYPE_BLE) + { + mp_ble_cts->conn_handle = p_evt->conn_handle; + + // Find the handles of the Current Time characteristic. + uint32_t i; + + for (i = 0; i < p_evt->params.discovered_db.char_count; i++) + { + if (p_evt->params.discovered_db.charateristics[i].characteristic.uuid.uuid == + BLE_UUID_CURRENT_TIME_CHAR) + { + // Found Current Time characteristic. Store CCCD and value handle and break. + mp_ble_cts->cts_cccd_handle = + p_evt->params.discovered_db.charateristics[i].cccd_handle; + mp_ble_cts->current_time_handle = + p_evt->params.discovered_db.charateristics[i].characteristic.handle_value; + break; + } + } + + LOG("[CTS]: Current Time Service discovered at peer.\r\n"); + + evt.evt_type = BLE_CTS_C_EVT_DISCOVERY_COMPLETE; + + mp_ble_cts->evt_handler(mp_ble_cts, &evt); + } + else + { + evt.evt_type = BLE_CTS_C_EVT_SERVICE_NOT_FOUND; + mp_ble_cts->evt_handler(mp_ble_cts, &evt); + } +} + + +uint32_t ble_cts_c_init(ble_cts_c_t * p_cts, ble_cts_c_init_t const * p_cts_init) +{ + if ( (p_cts_init == NULL) + || (p_cts_init->error_handler == NULL) + || (p_cts_init->evt_handler == NULL) + || (p_cts == NULL)) + { + return NRF_ERROR_NULL; + } + + ble_uuid_t cts_uuid; + + mp_ble_cts = p_cts; + + BLE_UUID_BLE_ASSIGN(cts_uuid, BLE_UUID_CURRENT_TIME_SERVICE); + + p_cts->evt_handler = p_cts_init->evt_handler; + p_cts->error_handler = p_cts_init->error_handler; + p_cts->conn_handle = BLE_CONN_HANDLE_INVALID; + p_cts->current_time_handle = BLE_GATT_HANDLE_INVALID; + + return ble_db_discovery_evt_register(&cts_uuid, db_discover_evt_handler); +} + + +/**@brief Function for decoding a read from the current time characteristic. + * + * @param[in] p_time Current Time structure. + * @param[in] p_data Pointer to the buffer containing the current time. + * @param[in] length length of the buffer containing the current time. + * + * @return NRF_SUCCESS if the time struct is valid. + * @return NRF_ERROR_DATA_SIZE if length does not match the expected size of the data. + */ +static uint32_t current_time_decode(current_time_char_t * p_time, + const uint8_t * p_data, + const uint32_t length) +{ + //lint -save -e415 -e416 "Access of out of bounds pointer" "Creation of out of bounds pointer" + + if (length != CTS_C_CURRENT_TIME_EXPECTED_LENGTH) + { + // Return to prevent accessing out of bounds data. + return NRF_ERROR_DATA_SIZE; + } + + LOG("Current Time read response data: %02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X \r\n", + p_data[0], + p_data[1], + p_data[2], + p_data[3], + p_data[4], + p_data[5], + p_data[6], + p_data[7], + p_data[8], + p_data[9]); + + uint32_t index = 0; + + // Date. + index += ble_date_time_decode(&p_time->exact_time_256.day_date_time.date_time, p_data); + + // Day of week. + p_time->exact_time_256.day_date_time.day_of_week = p_data[index++]; + + // Fractions of a second. + p_time->exact_time_256.fractions256 = p_data[index++]; + + // Reason for updating the time. + p_time->adjust_reason.manual_time_update = (p_data[index] >> 0) & 0x01; + p_time->adjust_reason.external_reference_time_update = (p_data[index] >> 1) & 0x01; + p_time->adjust_reason.change_of_time_zone = (p_data[index] >> 2) & 0x01; + p_time->adjust_reason.change_of_daylight_savings_time = (p_data[index] >> 3) & 0x01; + + + //lint -restore + return NRF_SUCCESS; +} + + +/**@brief Function for decoding a read from the current time characteristic. + * + * @param[in] p_time Current Time struct. + * + * @return NRF_SUCCESS if the time struct is valid. + * @return NRF_ERROR_INVALID_DATA if the time is out of bounds. + */ +static uint32_t current_time_validate(current_time_char_t * p_time) +{ + // Year. + if ( (p_time->exact_time_256.day_date_time.date_time.year > CTS_YEAR_MAX) + || ((p_time->exact_time_256.day_date_time.date_time.year < CTS_YEAR_MIN) + && (p_time->exact_time_256.day_date_time.date_time.year != 0))) + { + return NRF_ERROR_INVALID_DATA; + } + + // Month. + if (p_time->exact_time_256.day_date_time.date_time.month > 12) + { + return NRF_ERROR_INVALID_DATA; + } + + // Day. + if (p_time->exact_time_256.day_date_time.date_time.day > 31) + { + return NRF_ERROR_INVALID_DATA; + } + + // Hours. + if (p_time->exact_time_256.day_date_time.date_time.hours > 23) + { + return NRF_ERROR_INVALID_DATA; + } + + // Minutes. + if (p_time->exact_time_256.day_date_time.date_time.minutes > 59) + { + return NRF_ERROR_INVALID_DATA; + } + + // Seconds. + if (p_time->exact_time_256.day_date_time.date_time.seconds > 59) + { + return NRF_ERROR_INVALID_DATA; + } + + // Day of week. + if (p_time->exact_time_256.day_date_time.day_of_week > 7) + { + return NRF_ERROR_INVALID_DATA; + } + + return NRF_SUCCESS; +} + + +/**@brief Function for reading the current time. The time is decoded, then it is validated. + * Depending on the outcome the cts event handler will be called with + * the current time event or an invalid time event. + * + * @param[in] p_cts Current Time Service client structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void current_time_read(ble_cts_c_t * p_cts, const ble_evt_t * p_ble_evt) +{ + ble_cts_c_evt_t evt; + uint32_t err_code = NRF_SUCCESS; + + if (p_ble_evt->evt.gattc_evt.gatt_status == BLE_GATT_STATUS_SUCCESS) + { + err_code = current_time_decode(&evt.params.current_time, + p_ble_evt->evt.gattc_evt.params.read_rsp.data, + p_ble_evt->evt.gattc_evt.params.read_rsp.len); + + if (err_code != NRF_SUCCESS) + { + // The data length was invalid, decoding was not completed. + evt.evt_type = BLE_CTS_C_EVT_INVALID_TIME; + p_cts->evt_handler(p_cts, &evt); + } + else + { + // Verify That the time is valid. + err_code = current_time_validate(&evt.params.current_time); + + if (err_code != NRF_SUCCESS) + { + // Invalid time received. + evt.evt_type = BLE_CTS_C_EVT_INVALID_TIME; + p_cts->evt_handler(p_cts, &evt); + } + else + { + // Valid time reveiced. + evt.evt_type = BLE_CTS_C_EVT_CURRENT_TIME; + p_cts->evt_handler(p_cts, &evt); + } + } + } +} + + +/**@brief Function for handling the Disconnect event. + * + * @param[in] p_cts Current Time Service client structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_disconnect(ble_cts_c_t * p_cts, ble_evt_t const * p_ble_evt) +{ + // The connection handle is now invalid. It will be re-initialized upon connection. + p_cts->conn_handle = BLE_CONN_HANDLE_INVALID; + + if (ble_cts_c_is_cts_discovered(p_cts)) + { + // There was a valid instance of cts on the peer. Send an event to the + // application, so that it can do any clean up related to this module. + ble_cts_c_evt_t evt; + + evt.evt_type = BLE_CTS_C_EVT_DISCONN_COMPLETE; + + p_cts->evt_handler(p_cts, &evt); + p_cts->current_time_handle = BLE_GATT_HANDLE_INVALID; + } +} + + +void ble_cts_c_on_ble_evt(ble_cts_c_t * p_cts, ble_evt_t const * p_ble_evt) +{ + LOG("[CTS]: BLE event handler called with event 0x%x\r\n", p_ble_evt->header.evt_id); + + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + p_cts->conn_handle = p_ble_evt->evt.gap_evt.conn_handle; + break; + + case BLE_GATTC_EVT_READ_RSP: + current_time_read(p_cts, p_ble_evt); + break; + + case BLE_GAP_EVT_DISCONNECTED: + on_disconnect(p_cts, p_ble_evt); + break; + + default: + // No implementation needed. + break; + } +} + + +uint32_t ble_cts_c_current_time_read(ble_cts_c_t const * p_cts) +{ + if (!ble_cts_c_is_cts_discovered(p_cts)) + { + return NRF_ERROR_NOT_FOUND; + } + + return sd_ble_gattc_read(p_cts->conn_handle, p_cts->current_time_handle, 0); +} + + diff --git a/components/ble/ble_services/ble_cts_c/ble_cts_c.h b/components/ble/ble_services/ble_cts_c/ble_cts_c.h new file mode 100644 index 0000000..eae377c --- /dev/null +++ b/components/ble/ble_services/ble_cts_c/ble_cts_c.h @@ -0,0 +1,169 @@ +/* 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. + * + */ + +/** @file + * + * @defgroup ble_sdk_srv_cts_c Current Time Service client + * @{ + * @ingroup ble_sdk_srv + * @brief Current Time Service client module. + * + * @details This module implements the Current Time Service (CTS) client-peripheral role of + * the Time Profile. After security is established, the module tries to discover the + * Current Time Service and Characteristic on the central side. If this succeeds, + * the application can trigger a read of the current time from the connected server. + * + * The module informs the application about a successful discovery using the + * @ref BLE_CTS_C_EVT_DISCOVERY_COMPLETE event. The application can then use the function + * @ref ble_cts_c_current_time_read to read the current time. Calling this function + * triggers either a @ref BLE_CTS_C_EVT_CURRENT_TIME event or a + * @ref BLE_CTS_C_EVT_INVALID_TIME event, which is sent to the application. The current + * time is then available in the params field of the passed ble_cts_evt_t structure. + * + * @note The application must propagate BLE stack events to this module by calling + * ble_cts_c_on_ble_evt() from the @ref softdevice_handler callback function. + */ + +#ifndef BLE_CTS_C_H__ +#define BLE_CTS_C_H__ + +#include "ble_srv_common.h" +#include "ble_gattc.h" +#include "ble.h" +#include "ble_date_time.h" +#include "device_manager.h" +#include + + +/**@brief "Day Date Time" field of the "Exact Time 256" field of the Current Time Characteristic. */ +typedef struct +{ + ble_date_time_t date_time; + uint8_t day_of_week; +} day_date_time_t; + +/**@brief "Exact Time 256" field of the Current Time Characteristic. */ +typedef struct +{ + day_date_time_t day_date_time; + uint8_t fractions256; +} exact_time_256_t; + +/**@brief "Adjust Reason" field of the Current Time Characteristic. */ +typedef struct +{ + uint8_t manual_time_update : 1; + uint8_t external_reference_time_update : 1; + uint8_t change_of_time_zone : 1; + uint8_t change_of_daylight_savings_time : 1; +} adjust_reason_t; + +/**@brief Data structure for the Current Time Characteristic. */ +typedef struct +{ + exact_time_256_t exact_time_256; + adjust_reason_t adjust_reason; +} current_time_char_t; + +// Forward declaration of the ble_cts_c_t type. +typedef struct ble_cts_c_s ble_cts_c_t; + +/**@brief Current Time Service client event type. */ +typedef enum +{ + BLE_CTS_C_EVT_SERVICE_NOT_FOUND, /**< The Current Time Service was not found at the peer. */ + BLE_CTS_C_EVT_DISCOVERY_COMPLETE, /**< The Current Time Service was found at the peer. */ + BLE_CTS_C_EVT_DISCONN_COMPLETE, /**< Event indicating that the Current Time Service client module has finished processing the BLE_GAP_EVT_DISCONNECTED event. This event is raised only if a valid instance of the Current Time Service was found at the server. The event can be used by the application to do clean up related to the Current Time Service client.*/ + BLE_CTS_C_EVT_CURRENT_TIME, /**< A new current time reading has been received. */ + BLE_CTS_C_EVT_INVALID_TIME /**< The current time value received from the peer is invalid.*/ +} ble_cts_c_evt_type_t; + +/**@brief Current Time Service client event. */ +typedef struct +{ + ble_cts_c_evt_type_t evt_type; /**< Type of event. */ + union + { + current_time_char_t current_time; /**< Current Time Characteristic data. See @ref BLE_CTS_C_EVT_CURRENT_TIME. */ + } params; +} ble_cts_c_evt_t; + +/**@brief Current Time Service client event handler type. */ +typedef void (* ble_cts_c_evt_handler_t) (ble_cts_c_t * p_cts, ble_cts_c_evt_t * p_evt); + +/**@brief Current Time Service client structure. This structure contains status information for the client. */ +struct ble_cts_c_s +{ + ble_cts_c_evt_handler_t evt_handler; /**< Event handler to be called for handling events from the Current Time Service client. */ + ble_srv_error_handler_t error_handler; /**< Function to be called if an error occurs. */ + uint16_t current_time_handle; /**< Handle of Current Time Characteristic at the peer (handles are provided by the BLE stack through the DB Discovery module). */ + uint16_t cts_cccd_handle; /**< Handle of the CCCD of the Current Time Characteristic at the peer. */ + uint16_t conn_handle; /**< Handle of the current connection. BLE_CONN_HANDLE_INVALID if not in a connection. */ +}; + +/**@brief Current Time Service client init structure. This structure contains all options and data needed for initialization of the client.*/ +typedef struct +{ + ble_cts_c_evt_handler_t evt_handler; /**< Event handler to be called for handling events from the Current Time Service client. */ + ble_srv_error_handler_t error_handler; /**< Function to be called if an error occurs. */ +} ble_cts_c_init_t; + + +/**@brief Function for initializing the Current Time Service client. + * + * @details This function must be used by the application to initialize the Current Time Service client. + * + * @param[out] p_cts Current Time Service client structure. This structure must + * be supplied by the application. It is initialized by this + * function and can later be used to identify this particular client + * instance. + * @param[in] p_cts_init Information needed to initialize the Current Time Service client. + * + * @retval NRF_SUCCESS If the service was initialized successfully. + */ +uint32_t ble_cts_c_init(ble_cts_c_t * p_cts, const ble_cts_c_init_t * p_cts_init); + + +/**@brief Function for handling the application's BLE stack events. + * + * @details This function handles all events from the BLE stack that are of interest to the + * Current Time Service client. This is a callback function that must be dispatched + * from main application context. + * + * @param[in] p_cts Current Time Service client structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +void ble_cts_c_on_ble_evt(ble_cts_c_t * p_cts, const ble_evt_t * p_ble_evt); + + +/**@brief Function for checking whether the peer's Current Time Service instance and the Current Time + * Characteristic have been discovered. + * + * @param[in] p_cts Current Time Service client structure. + */ +static __INLINE bool ble_cts_c_is_cts_discovered(const ble_cts_c_t * p_cts) +{ + return (p_cts->current_time_handle != BLE_GATT_HANDLE_INVALID); +} + + +/**@brief Function for reading the peer's Current Time Service Current Time Characteristic. + * + * @param[in] p_cts Current Time Service client structure. + * + * @retval NRF_SUCCESS If the operation is successful. Otherwise, an error code is returned. + */ +uint32_t ble_cts_c_current_time_read(ble_cts_c_t const * p_cts); + +#endif // BLE_CTS_C_H__ + +/** @} */ diff --git a/components/ble/ble_services/ble_dfu/ble_dfu.c b/components/ble/ble_services/ble_dfu/ble_dfu.c new file mode 100644 index 0000000..05d4b8b --- /dev/null +++ b/components/ble/ble_services/ble_dfu/ble_dfu.c @@ -0,0 +1,666 @@ +/* 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 "ble_dfu.h" +#include "nrf_error.h" +#include "ble_types.h" +#include "ble_gatts.h" +#include "app_util.h" +#include "ble_srv_common.h" +#include "nordic_common.h" +#include +#include +#include + +#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 write_authorize_reply; + + write_authorize_reply.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE; + + if (!is_cccd_configured(p_dfu)) + { + // Send an error response to the peer indicating that the CCCD is improperly configured. + write_authorize_reply.params.write.gatt_status = + BLE_GATT_STATUS_ATTERR_CPS_CCCD_CONFIG_ERROR; + + return (sd_ble_gatts_rw_authorize_reply(p_dfu->conn_handle, &write_authorize_reply)); + + } + else + { + uint32_t err_code; + + write_authorize_reply.params.write.gatt_status = BLE_GATT_STATUS_SUCCESS; + + err_code = (sd_ble_gatts_rw_authorize_reply(p_dfu->conn_handle, &write_authorize_reply)); + + if (err_code != NRF_SUCCESS) + { + return 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)); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, + &service_uuid, + &(p_dfu->service_handle)); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + p_dfu->uuid_type = service_uuid.type; + + err_code = dfu_pkt_char_add(p_dfu); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + err_code = dfu_ctrl_pt_add(p_dfu); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + err_code = dfu_rev_char_add(p_dfu, p_dfu_init); + if (err_code != NRF_SUCCESS) + { + return 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/components/ble/ble_services/ble_dfu/ble_dfu.h b/components/ble/ble_services/ble_dfu/ble_dfu.h new file mode 100644 index 0000000..e63fe66 --- /dev/null +++ b/components/ble/ble_services/ble_dfu/ble_dfu.h @@ -0,0 +1,239 @@ +/* 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. + * + */ + +/**@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 "ble_gatts.h" +#include "ble_gap.h" +#include "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 S110 SoftDevice). This will be BLE_CONN_HANDLE_INVALID when not in a connection. */ + uint16_t revision; /**< Handle of DFU Service (as provided by the S110 SoftDevice). */ + uint16_t service_handle; /**< Handle of DFU Service (as provided by the S110 SoftDevice). */ + uint8_t uuid_type; /**< UUID type assigned for DFU Service by the S110 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 S110 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 S110 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 + * S110 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 S110 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 S110 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 S110 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/components/ble/ble_services/ble_dis/ble_dis.c b/components/ble/ble_services/ble_dis/ble_dis.c new file mode 100644 index 0000000..72abc58 --- /dev/null +++ b/components/ble/ble_services/ble_dis/ble_dis.c @@ -0,0 +1,277 @@ +/* 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. + * + */ + +/* Attention! +* To maintain compliance with Nordic Semiconductor ASAs Bluetooth profile +* qualification listings, this section of source code must not be modified. +*/ + +#include "ble_dis.h" + +#include +#include +#include "app_error.h" +#include "ble_gatts.h" +#include "nordic_common.h" +#include "ble_srv_common.h" +#include "app_util.h" + + +#define BLE_DIS_SYS_ID_LEN 8 /**< Length of System ID Characteristic Value. */ +#define BLE_DIS_PNP_ID_LEN 7 /**< Length of Pnp ID Characteristic Value. */ + +static uint16_t service_handle; +static ble_gatts_char_handles_t manufact_name_handles; +static ble_gatts_char_handles_t model_num_handles; +static ble_gatts_char_handles_t serial_num_handles; +static ble_gatts_char_handles_t hw_rev_handles; +static ble_gatts_char_handles_t fw_rev_handles; +static ble_gatts_char_handles_t sw_rev_handles; +static ble_gatts_char_handles_t sys_id_handles; +static ble_gatts_char_handles_t reg_cert_data_list_handles; +static ble_gatts_char_handles_t pnp_id_handles; + + +/**@brief Function for encoding a System ID. + * + * @param[out] p_encoded_buffer Buffer where the encoded data will be written. + * @param[in] p_sys_id System ID to be encoded. + */ +static void sys_id_encode(uint8_t * p_encoded_buffer, const ble_dis_sys_id_t * p_sys_id) +{ + APP_ERROR_CHECK_BOOL(p_sys_id != NULL); + APP_ERROR_CHECK_BOOL(p_encoded_buffer != NULL); + + p_encoded_buffer[0] = (p_sys_id->manufacturer_id & 0x00000000FF); + p_encoded_buffer[1] = (p_sys_id->manufacturer_id & 0x000000FF00) >> 8; + p_encoded_buffer[2] = (p_sys_id->manufacturer_id & 0x0000FF0000) >> 16; + p_encoded_buffer[3] = (p_sys_id->manufacturer_id & 0x00FF000000) >> 24; + p_encoded_buffer[4] = (p_sys_id->manufacturer_id & 0xFF00000000) >> 32; + + p_encoded_buffer[5] = (p_sys_id->organizationally_unique_id & 0x0000FF); + p_encoded_buffer[6] = (p_sys_id->organizationally_unique_id & 0x00FF00) >> 8; + p_encoded_buffer[7] = (p_sys_id->organizationally_unique_id & 0xFF0000) >> 16; +} + + +/**@brief Function for encoding a PnP ID. + * + * @param[out] p_encoded_buffer Buffer where the encoded data will be written. + * @param[in] p_pnp_id PnP ID to be encoded. + */ +static void pnp_id_encode(uint8_t * p_encoded_buffer, const ble_dis_pnp_id_t * p_pnp_id) +{ + uint8_t len = 0; + + APP_ERROR_CHECK_BOOL(p_pnp_id != NULL); + APP_ERROR_CHECK_BOOL(p_encoded_buffer != NULL); + + p_encoded_buffer[len++] = p_pnp_id->vendor_id_source; + + len += uint16_encode(p_pnp_id->vendor_id, &p_encoded_buffer[len]); + len += uint16_encode(p_pnp_id->product_id, &p_encoded_buffer[len]); + len += uint16_encode(p_pnp_id->product_version, &p_encoded_buffer[len]); + + APP_ERROR_CHECK_BOOL(len == BLE_DIS_PNP_ID_LEN); +} + + +/**@brief Function for adding the Characteristic. + * + * @param[in] uuid UUID of characteristic to be added. + * @param[in] p_char_value Initial value of characteristic to be added. + * @param[in] char_len Length of initial value. This will also be the maximum value. + * @param[in] dis_attr_md Security settings of characteristic to be added. + * @param[out] p_handles Handles of new characteristic. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t char_add(uint16_t uuid, + uint8_t * p_char_value, + uint16_t char_len, + const ble_srv_security_mode_t * dis_attr_md, + ble_gatts_char_handles_t * p_handles) +{ + ble_uuid_t ble_uuid; + ble_gatts_char_md_t char_md; + ble_gatts_attr_t attr_char_value; + ble_gatts_attr_md_t attr_md; + + APP_ERROR_CHECK_BOOL(p_char_value != NULL); + APP_ERROR_CHECK_BOOL(char_len > 0); + + // The ble_gatts_char_md_t structure uses bit fields. So we reset the memory to zero. + 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; + + BLE_UUID_BLE_ASSIGN(ble_uuid, uuid); + + memset(&attr_md, 0, sizeof(attr_md)); + + attr_md.read_perm = dis_attr_md->read_perm; + attr_md.write_perm = dis_attr_md->write_perm; + attr_md.vloc = BLE_GATTS_VLOC_STACK; + attr_md.rd_auth = 0; + attr_md.wr_auth = 0; + attr_md.vlen = 0; + + 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 = char_len; + attr_char_value.init_offs = 0; + attr_char_value.max_len = char_len; + attr_char_value.p_value = p_char_value; + + return sd_ble_gatts_characteristic_add(service_handle, &char_md, &attr_char_value, p_handles); +} + + +uint32_t ble_dis_init(const ble_dis_init_t * p_dis_init) +{ + uint32_t err_code; + ble_uuid_t ble_uuid; + + // Add service + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_DEVICE_INFORMATION_SERVICE); + + err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &ble_uuid, &service_handle); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add characteristics + if (p_dis_init->manufact_name_str.length > 0) + { + err_code = char_add(BLE_UUID_MANUFACTURER_NAME_STRING_CHAR, + p_dis_init->manufact_name_str.p_str, + p_dis_init->manufact_name_str.length, + &p_dis_init->dis_attr_md, + &manufact_name_handles); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + if (p_dis_init->model_num_str.length > 0) + { + err_code = char_add(BLE_UUID_MODEL_NUMBER_STRING_CHAR, + p_dis_init->model_num_str.p_str, + p_dis_init->model_num_str.length, + &p_dis_init->dis_attr_md, + &model_num_handles); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + if (p_dis_init->serial_num_str.length > 0) + { + err_code = char_add(BLE_UUID_SERIAL_NUMBER_STRING_CHAR, + p_dis_init->serial_num_str.p_str, + p_dis_init->serial_num_str.length, + &p_dis_init->dis_attr_md, + &serial_num_handles); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + if (p_dis_init->hw_rev_str.length > 0) + { + err_code = char_add(BLE_UUID_HARDWARE_REVISION_STRING_CHAR, + p_dis_init->hw_rev_str.p_str, + p_dis_init->hw_rev_str.length, + &p_dis_init->dis_attr_md, + &hw_rev_handles); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + if (p_dis_init->fw_rev_str.length > 0) + { + err_code = char_add(BLE_UUID_FIRMWARE_REVISION_STRING_CHAR, + p_dis_init->fw_rev_str.p_str, + p_dis_init->fw_rev_str.length, + &p_dis_init->dis_attr_md, + &fw_rev_handles); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + if (p_dis_init->sw_rev_str.length > 0) + { + err_code = char_add(BLE_UUID_SOFTWARE_REVISION_STRING_CHAR, + p_dis_init->sw_rev_str.p_str, + p_dis_init->sw_rev_str.length, + &p_dis_init->dis_attr_md, + &sw_rev_handles); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + if (p_dis_init->p_sys_id != NULL) + { + uint8_t encoded_sys_id[BLE_DIS_SYS_ID_LEN]; + + sys_id_encode(encoded_sys_id, p_dis_init->p_sys_id); + err_code = char_add(BLE_UUID_SYSTEM_ID_CHAR, + encoded_sys_id, + BLE_DIS_SYS_ID_LEN, + &p_dis_init->dis_attr_md, + &sys_id_handles); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + if (p_dis_init->p_reg_cert_data_list != NULL) + { + err_code = char_add(BLE_UUID_IEEE_REGULATORY_CERTIFICATION_DATA_LIST_CHAR, + p_dis_init->p_reg_cert_data_list->p_list, + p_dis_init->p_reg_cert_data_list->list_len, + &p_dis_init->dis_attr_md, + ®_cert_data_list_handles); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + if (p_dis_init->p_pnp_id != NULL) + { + uint8_t encoded_pnp_id[BLE_DIS_PNP_ID_LEN]; + + pnp_id_encode(encoded_pnp_id, p_dis_init->p_pnp_id); + err_code = char_add(BLE_UUID_PNP_ID_CHAR, + encoded_pnp_id, + BLE_DIS_PNP_ID_LEN, + &p_dis_init->dis_attr_md, + &pnp_id_handles); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + + return NRF_SUCCESS; +} diff --git a/components/ble/ble_services/ble_dis/ble_dis.h b/components/ble/ble_services/ble_dis/ble_dis.h new file mode 100644 index 0000000..603c611 --- /dev/null +++ b/components/ble/ble_services/ble_dis/ble_dis.h @@ -0,0 +1,98 @@ +/* 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 ble_sdk_srv_dis Device Information Service + * @{ + * @ingroup ble_sdk_srv + * @brief Device Information Service module. + * + * @details This module implements the Device Information Service. + * During initialization it adds the Device Information Service to the BLE stack database. + * It then encodes the supplied information, and adds the curresponding characteristics. + * + * @note Attention! + * To maintain compliance with Nordic Semiconductor ASA Bluetooth profile + * qualification listings, this section of source code must not be modified. + */ + +#ifndef BLE_DIS_H__ +#define BLE_DIS_H__ + +#include +#include "ble_srv_common.h" + +/** @defgroup DIS_VENDOR_ID_SRC_VALUES Vendor ID Source values + * @{ + */ +#define BLE_DIS_VENDOR_ID_SRC_BLUETOOTH_SIG 1 /**< Vendor ID assigned by Bluetooth SIG. */ +#define BLE_DIS_VENDOR_ID_SRC_USB_IMPL_FORUM 2 /**< Vendor ID assigned by USB Implementer's Forum. */ +/** @} */ + +/**@brief System ID parameters */ +typedef struct +{ + uint64_t manufacturer_id; /**< Manufacturer ID. Only 5 LSOs shall be used. */ + uint32_t organizationally_unique_id; /**< Organizationally unique ID. Only 3 LSOs shall be used. */ +} ble_dis_sys_id_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. */ +} ble_dis_reg_cert_data_list_t; + +/**@brief PnP ID parameters */ +typedef struct +{ + uint8_t vendor_id_source; /**< Vendor ID Source. see @ref DIS_VENDOR_ID_SRC_VALUES. */ + uint16_t vendor_id; /**< Vendor ID. */ + uint16_t product_id; /**< Product ID. */ + uint16_t product_version; /**< Product Version. */ +} ble_dis_pnp_id_t; + +/**@brief Device Information Service init structure. This contains all possible characteristics + * needed for initialization of the service. + */ +typedef struct +{ + ble_srv_utf8_str_t manufact_name_str; /**< Manufacturer Name String. */ + ble_srv_utf8_str_t model_num_str; /**< Model Number String. */ + ble_srv_utf8_str_t serial_num_str; /**< Serial Number String. */ + ble_srv_utf8_str_t hw_rev_str; /**< Hardware Revision String. */ + ble_srv_utf8_str_t fw_rev_str; /**< Firmware Revision String. */ + ble_srv_utf8_str_t sw_rev_str; /**< Software Revision String. */ + ble_dis_sys_id_t * p_sys_id; /**< System ID. */ + ble_dis_reg_cert_data_list_t * p_reg_cert_data_list; /**< IEEE 11073-20601 Regulatory Certification Data List. */ + ble_dis_pnp_id_t * p_pnp_id; /**< PnP ID. */ + ble_srv_security_mode_t dis_attr_md; /**< Initial Security Setting for Device Information Characteristics. */ +} ble_dis_init_t; + +/**@brief Function for initializing the Device Information Service. + * + * @details This call allows the application to initialize the device information service. + * It adds the DIS service and DIS characteristics to the database, using the initial + * values supplied through the p_dis_init parameter. Characteristics which are not to be + * added, shall be set to NULL in p_dis_init. + * + * @param[in] p_dis_init The structure containing the values of characteristics needed by the + * service. + * + * @return NRF_SUCCESS on successful initialization of service. + */ +uint32_t ble_dis_init(const ble_dis_init_t * p_dis_init); + +#endif // BLE_DIS_H__ + +/** @} */ diff --git a/components/ble/ble_services/ble_gls/ble_gls.c b/components/ble/ble_services/ble_gls/ble_gls.c new file mode 100644 index 0000000..4cd30d1 --- /dev/null +++ b/components/ble/ble_services/ble_gls/ble_gls.c @@ -0,0 +1,1267 @@ +/* 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. + */ + +/* Attention! +* To maintain compliance with Nordic Semiconductor ASAs Bluetooth profile +* qualification listings, this section of source code must not be modified. +*/ + +#include "ble_gls.h" +#include +#include "ble_srv_common.h" +#include "ble_racp.h" +#include "ble_gls_db.h" + + +#define OPERAND_FILTER_TYPE_SEQ_NUM 0x01 /**< Filter data using Sequence Number criteria. */ +#define OPERAND_FILTER_TYPE_FACING_TIME 0x02 /**< Filter data using User Facing Time criteria. */ +#define OPERAND_FILTER_TYPE_RFU_START 0x07 /**< Start of filter types reserved For Future Use range */ +#define OPERAND_FILTER_TYPE_RFU_END 0xFF /**< End of filter types reserved For Future Use range */ + +#define OPCODE_LENGTH 1 /**< Length of opcode inside Glucose Measurement packet. */ +#define HANDLE_LENGTH 2 /**< Length of handle inside Glucose Measurement packet. */ +#define MAX_GLM_LEN (BLE_L2CAP_MTU_DEF - OPCODE_LENGTH - HANDLE_LENGTH) /**< Maximum size of a transmitted Glucose Measurement. */ + +#define GLS_NACK_PROC_ALREADY_IN_PROGRESS BLE_GATT_STATUS_ATTERR_APP_BEGIN + 0 /**< Reply when a requested procedure is already in progress. */ +#define GLS_NACK_CCCD_IMPROPERLY_CONFIGURED BLE_GATT_STATUS_ATTERR_APP_BEGIN + 1 /**< Reply when the a s CCCD is improperly configured. */ + +/**@brief Glucose Service communication state. */ +typedef enum +{ + STATE_NO_COMM, /**< The service is not in a communicating state. */ + STATE_RACP_PROC_ACTIVE, /**< Processing requested data. */ + STATE_RACP_RESPONSE_PENDING, /**< There is a RACP indication waiting to be sent. */ + STATE_RACP_RESPONSE_IND_VERIF /**< Waiting for a verification of a RACP indication. */ +} gls_state_t; + +static gls_state_t m_gls_state; /**< Current communication state. */ +static uint16_t m_next_seq_num; /**< Sequence number of the next database record. */ +static uint8_t m_racp_proc_operator; /**< Operator of current request. */ +static uint16_t m_racp_proc_seq_num; /**< Sequence number of current request. */ +static uint8_t m_racp_proc_record_ndx; /**< Current record index. */ +static uint8_t m_racp_proc_records_reported; /**< Number of reported records. */ +static uint8_t m_racp_proc_records_reported_since_txcomplete; /**< Number of reported records since last TX_COMPLETE event. */ +static ble_racp_value_t m_pending_racp_response; /**< RACP response to be sent. */ +static uint8_t m_pending_racp_response_operand[2]; /**< Operand of RACP response to be sent. */ + + +/**@brief Function for setting the GLS communication state. + * + * @param[in] new_state New communication state. + */ +static void state_set(gls_state_t new_state) +{ + m_gls_state = new_state; +} + + +/**@brief Function for setting the next sequence number by reading the last record in the data base. + * + * @return NRF_SUCCESS on successful initialization of service, otherwise an error code. + */ +static uint32_t next_sequence_number_set(void) +{ + uint16_t num_records; + ble_gls_rec_t rec; + + num_records = ble_gls_db_num_records_get(); + if (num_records > 0) + { + // Get last record + uint32_t err_code = ble_gls_db_record_get(num_records - 1, &rec); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + m_next_seq_num = rec.meas.sequence_number + 1; + } + else + { + m_next_seq_num = 0; + } + + return NRF_SUCCESS; +} + + +/**@brief Function for encoding a Glucose measurement. + * + * @param[in] p_meas Measurement to be encoded. + * @param[out] p_encoded_buffer Pointer to buffer where the encoded measurement is to be stored. + * + * @return Size of encoded measurement. + */ +static uint8_t gls_meas_encode(const ble_gls_meas_t * p_meas, uint8_t * p_encoded_buffer) +{ + uint8_t len = 0; + + p_encoded_buffer[len++] = p_meas->flags; + + len += uint16_encode(p_meas->sequence_number, &p_encoded_buffer[len]); + len += ble_date_time_encode(&p_meas->base_time, &p_encoded_buffer[len]); + + if (p_meas->flags & BLE_GLS_MEAS_FLAG_TIME_OFFSET) + { + len += uint16_encode(p_meas->time_offset, &p_encoded_buffer[len]); + } + + if (p_meas->flags & BLE_GLS_MEAS_FLAG_CONC_TYPE_LOC) + { + uint16_t encoded_concentration; + + encoded_concentration = ((p_meas->glucose_concentration.exponent << 12) & 0xF000) | + ((p_meas->glucose_concentration.mantissa << 0) & 0x0FFF); + + p_encoded_buffer[len++] = (uint8_t)(encoded_concentration); + p_encoded_buffer[len++] = (uint8_t)(encoded_concentration >> 8); + p_encoded_buffer[len++] = (p_meas->sample_location << 4) | (p_meas->type & 0x0F); + } + + if (p_meas->flags & BLE_GLS_MEAS_FLAG_SENSOR_STATUS) + { + len += uint16_encode(p_meas->sensor_status_annunciation, &p_encoded_buffer[len]); + } + + return len; +} + + +/**@brief Function for adding the characteristic for a glucose measurement. + * + * @param[in] p_gls Service instance. + * + * @return NRF_SUCCESS if characteristic was successfully added, otherwise an error code. + */ +static uint32_t glucose_measurement_char_add(ble_gls_t * p_gls) +{ + 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; + ble_gls_rec_t initial_gls_rec_value; + uint8_t encoded_gls_meas[MAX_GLM_LEN]; + uint8_t num_recs; + memset(&cccd_md, 0, sizeof(cccd_md)); + + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm); + BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&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.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_BLE_ASSIGN(ble_uuid, BLE_UUID_GLUCOSE_MEASUREMENT_CHAR); + 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_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)); + memset(&initial_gls_rec_value, 0, sizeof(initial_gls_rec_value)); + + num_recs = ble_gls_db_num_records_get(); + if (num_recs > 0) + { + uint32_t err_code = ble_gls_db_record_get(num_recs - 1, &initial_gls_rec_value); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + + attr_char_value.p_uuid = &ble_uuid; + attr_char_value.p_attr_md = &attr_md; + attr_char_value.init_len = gls_meas_encode(&initial_gls_rec_value.meas, encoded_gls_meas); + attr_char_value.init_offs = 0; + attr_char_value.max_len = MAX_GLM_LEN; + attr_char_value.p_value = encoded_gls_meas; + + return sd_ble_gatts_characteristic_add(p_gls->service_handle, + &char_md, + &attr_char_value, + &p_gls->glm_handles); +} + + +/**@brief Function for adding the characteristic for a glucose feature. + * + * @param[in] p_gls Service instance. + * + * @return NRF_SUCCESS if characteristic was successfully added, otherwise an error code. + */ +static uint32_t glucose_feature_char_add(ble_gls_t * p_gls) +{ + ble_gatts_char_md_t char_md; + ble_gatts_attr_t attr_char_value; + ble_uuid_t ble_uuid; + ble_gatts_attr_md_t attr_md; + uint8_t encoded_initial_feature[2]; + + 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; + + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_GLUCOSE_FEATURE_CHAR); + + memset(&attr_md, 0, sizeof(attr_md)); + + BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&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 = 0; + + memset(&attr_char_value, 0, sizeof(attr_char_value)); + + encoded_initial_feature[0] = (uint8_t)(p_gls->feature); + encoded_initial_feature[1] = (uint8_t)((p_gls->feature) >> 8); + + attr_char_value.p_uuid = &ble_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 = encoded_initial_feature; + + return sd_ble_gatts_characteristic_add(p_gls->service_handle, + &char_md, + &attr_char_value, + &p_gls->glf_handles); +} + + +/**@brief Function for adding the characteristic for a record access control point. + * + * @param[in] p_gls Service instance. + * + * @return NRF_SUCCESS if characteristic was successfully added, otherwise an error code. + */ +static uint32_t record_access_control_point_char_add(ble_gls_t * p_gls) +{ + 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_ENC_NO_MITM(&cccd_md.write_perm); + cccd_md.vloc = BLE_GATTS_VLOC_STACK; + + memset(&char_md, 0, sizeof(char_md)); + + char_md.char_props.indicate = 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_BLE_ASSIGN(ble_uuid, BLE_UUID_RECORD_ACCESS_CONTROL_POINT_CHAR); + + 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_ENC_NO_MITM(&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; + attr_char_value.p_value = 0; + + return sd_ble_gatts_characteristic_add(p_gls->service_handle, + &char_md, + &attr_char_value, + &p_gls->racp_handles); +} + + +uint32_t ble_gls_init(ble_gls_t * p_gls, const ble_gls_init_t * p_gls_init) +{ + uint32_t err_code; + ble_uuid_t ble_uuid; + + // Initialize data base + err_code = ble_gls_db_init(); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + err_code = next_sequence_number_set(); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Initialize service structure + p_gls->evt_handler = p_gls_init->evt_handler; + p_gls->error_handler = p_gls_init->error_handler; + p_gls->feature = p_gls_init->feature; + p_gls->is_context_supported = p_gls_init->is_context_supported; + p_gls->conn_handle = BLE_CONN_HANDLE_INVALID; + + + // Initialize global variables + state_set(STATE_NO_COMM); + m_racp_proc_records_reported_since_txcomplete = 0; + + // Add service + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_GLUCOSE_SERVICE); + + err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &ble_uuid, &p_gls->service_handle); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add glucose measurement characteristic + err_code = glucose_measurement_char_add(p_gls); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add glucose measurement feature characteristic + err_code = glucose_feature_char_add(p_gls); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add record control access point characteristic + err_code = record_access_control_point_char_add(p_gls); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + return NRF_SUCCESS; +} + + +/**@brief Function for sending a response from the Record Access Control Point. + * + * @param[in] p_gls Service instance. + * @param[in] p_racp_val RACP value to be sent. + */ +static void racp_send(ble_gls_t * p_gls, ble_racp_value_t * p_racp_val) +{ + uint32_t err_code; + uint8_t encoded_resp[25]; + uint8_t len; + uint16_t hvx_len; + ble_gatts_hvx_params_t hvx_params; + + if ( + (m_gls_state != STATE_RACP_RESPONSE_PENDING) + && + (m_racp_proc_records_reported_since_txcomplete > 0) + ) + { + state_set(STATE_RACP_RESPONSE_PENDING); + return; + } + + // Send indication + len = ble_racp_encode(p_racp_val, encoded_resp); + hvx_len = len; + + memset(&hvx_params, 0, sizeof(hvx_params)); + + hvx_params.handle = p_gls->racp_handles.value_handle; + hvx_params.type = BLE_GATT_HVX_INDICATION; + hvx_params.offset = 0; + hvx_params.p_len = &hvx_len; + hvx_params.p_data = encoded_resp; + + err_code = sd_ble_gatts_hvx(p_gls->conn_handle, &hvx_params); + + // Error handling + if ((err_code == NRF_SUCCESS) && (hvx_len != len)) + { + err_code = NRF_ERROR_DATA_SIZE; + } + switch (err_code) + { + case NRF_SUCCESS: + // Wait for HVC event + state_set(STATE_RACP_RESPONSE_IND_VERIF); + break; + + case BLE_ERROR_NO_TX_BUFFERS: + // Wait for TX_COMPLETE event to retry transmission + state_set(STATE_RACP_RESPONSE_PENDING); + break; + + case NRF_ERROR_INVALID_STATE: + // Make sure state machine returns to the default state + state_set(STATE_NO_COMM); + break; + + default: + // Report error to application + if (p_gls->error_handler != NULL) + { + p_gls->error_handler(err_code); + } + + // Make sure state machine returns to the default state + state_set(STATE_NO_COMM); + break; + } +} + + +/**@brief Function for sending a RACP response containing a Response Code Op Code and a Response Code Value. + * + * @param[in] p_gls Service instance. + * @param[in] opcode RACP Op Code. + * @param[in] value RACP Response Code Value. + */ +static void racp_response_code_send(ble_gls_t * p_gls, uint8_t opcode, uint8_t value) +{ + m_pending_racp_response.opcode = RACP_OPCODE_RESPONSE_CODE; + m_pending_racp_response.operator = RACP_OPERATOR_NULL; + m_pending_racp_response.operand_len = 2; + m_pending_racp_response.p_operand = m_pending_racp_response_operand; + + m_pending_racp_response_operand[0] = opcode; + m_pending_racp_response_operand[1] = value; + + racp_send(p_gls, &m_pending_racp_response); +} + + +/**@brief Function for sending a glucose measurement/context. + * + * @param[in] p_gls Service instance. + * @param[in] p_rec Measurement to be sent. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t glucose_meas_send(ble_gls_t * p_gls, ble_gls_rec_t * p_rec) +{ + uint32_t err_code; + uint8_t encoded_glm[MAX_GLM_LEN]; + uint16_t len; + uint16_t hvx_len; + ble_gatts_hvx_params_t hvx_params; + + len = gls_meas_encode(&p_rec->meas, encoded_glm); + hvx_len = len; + + memset(&hvx_params, 0, sizeof (hvx_params)); + + hvx_params.handle = p_gls->glm_handles.value_handle; + hvx_params.type = BLE_GATT_HVX_NOTIFICATION; + hvx_params.offset = 0; + hvx_params.p_len = &hvx_len; + hvx_params.p_data = encoded_glm; + + err_code = sd_ble_gatts_hvx(p_gls->conn_handle, &hvx_params); + if (err_code == NRF_SUCCESS) + { + if (hvx_len != len) + { + err_code = NRF_ERROR_DATA_SIZE; + } + else + { + // Measurement successfully sent + m_racp_proc_records_reported++; + m_racp_proc_records_reported_since_txcomplete++; + } + } + + return err_code; +} + + +/**@brief Function for responding to the ALL operation. + * + * @param[in] p_gls Service instance. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t racp_report_records_all(ble_gls_t * p_gls) +{ + uint16_t total_records = ble_gls_db_num_records_get(); + + if (m_racp_proc_record_ndx >= total_records) + { + state_set(STATE_NO_COMM); + } + else + { + uint32_t err_code; + ble_gls_rec_t rec; + + err_code = ble_gls_db_record_get(m_racp_proc_record_ndx, &rec); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + err_code = glucose_meas_send(p_gls, &rec); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + + return NRF_SUCCESS; +} + + +/**@brief Function for responding to the FIRST or the LAST operation. + * + * @param[in] p_gls Service instance. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t racp_report_records_first_last(ble_gls_t * p_gls) +{ + uint32_t err_code; + ble_gls_rec_t rec; + uint16_t total_records; + + total_records = ble_gls_db_num_records_get(); + + if ((m_racp_proc_records_reported != 0) || (total_records == 0)) + { + state_set(STATE_NO_COMM); + } + else + { + if (m_racp_proc_operator == RACP_OPERATOR_FIRST) + { + err_code = ble_gls_db_record_get(0, &rec); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + else if (m_racp_proc_operator == RACP_OPERATOR_LAST) + { + err_code = ble_gls_db_record_get(total_records - 1, &rec); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + + err_code = glucose_meas_send(p_gls, &rec); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + + return NRF_SUCCESS; +} + + +/**@brief Function for responding to the GREATER_OR_EQUAL operation. + * + * @param[in] p_gls Service instance. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t racp_report_records_greater_or_equal(ble_gls_t * p_gls) +{ + uint16_t total_records = ble_gls_db_num_records_get(); + + while (m_racp_proc_record_ndx < total_records) + { + uint32_t err_code; + ble_gls_rec_t rec; + + err_code = ble_gls_db_record_get(m_racp_proc_record_ndx, &rec); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (rec.meas.sequence_number >= m_racp_proc_seq_num) + { + err_code = glucose_meas_send(p_gls, &rec); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + break; + } + m_racp_proc_record_ndx++; + } + if (m_racp_proc_record_ndx == total_records) + { + state_set(STATE_NO_COMM); + } + + return NRF_SUCCESS; +} + + +/**@brief Function for informing that the REPORT RECORDS procedure is completed. + * + * @param[in] p_gls Service instance. + */ +static void racp_report_records_completed(ble_gls_t * p_gls) +{ + uint8_t resp_code_value; + + if (m_racp_proc_records_reported > 0) + { + resp_code_value = RACP_RESPONSE_SUCCESS; + } + else + { + resp_code_value = RACP_RESPONSE_NO_RECORDS_FOUND; + } + + racp_response_code_send(p_gls, RACP_OPCODE_REPORT_RECS, resp_code_value); +} + + +/**@brief Function for the RACP report records procedure. + * + * @param[in] p_gls Service instance. + */ +static void racp_report_records_procedure(ble_gls_t * p_gls) +{ + uint32_t err_code; + + while (m_gls_state == STATE_RACP_PROC_ACTIVE) + { + // Execute requested procedure + switch (m_racp_proc_operator) + { + case RACP_OPERATOR_ALL: + err_code = racp_report_records_all(p_gls); + break; + + case RACP_OPERATOR_FIRST: + case RACP_OPERATOR_LAST: + err_code = racp_report_records_first_last(p_gls); + break; + + case RACP_OPERATOR_GREATER_OR_EQUAL: + err_code = racp_report_records_greater_or_equal(p_gls); + break; + + default: + // Report error to application + if (p_gls->error_handler != NULL) + { + p_gls->error_handler(NRF_ERROR_INTERNAL); + } + + // Make sure state machine returns to the default state + state_set(STATE_NO_COMM); + return; + } + + // Error handling + switch (err_code) + { + case NRF_SUCCESS: + if (m_gls_state == STATE_RACP_PROC_ACTIVE) + { + m_racp_proc_record_ndx++; + } + else + { + racp_report_records_completed(p_gls); + } + break; + + case BLE_ERROR_NO_TX_BUFFERS: + // Wait for TX_COMPLETE event to resume transmission + return; + + case NRF_ERROR_INVALID_STATE: + // Notification is probably not enabled. Ignore request. + state_set(STATE_NO_COMM); + return; + + default: + // Report error to application + if (p_gls->error_handler != NULL) + { + p_gls->error_handler(err_code); + } + + // Make sure state machine returns to the default state + state_set(STATE_NO_COMM); + return; + } + } +} + + +/**@brief Function for testing if the received request is to be executed. + * + * @param[in] p_racp_request Request to be checked. + * @param[out] p_response_code Response code to be sent in case the request is rejected. + * RACP_RESPONSE_RESERVED is returned if the received message is + * to be rejected without sending a response. + * + * @return TRUE if the request is to be executed, FALSE if it is to be rejected. + * If it is to be rejected, p_response_code will contain the response code to be + * returned to the central. + */ +static bool is_request_to_be_executed(const ble_racp_value_t * p_racp_request, + uint8_t * p_response_code) +{ + *p_response_code = RACP_RESPONSE_RESERVED; + + if (p_racp_request->opcode == RACP_OPCODE_ABORT_OPERATION) + { + if (m_gls_state == STATE_RACP_PROC_ACTIVE) + { + if (p_racp_request->operator != RACP_OPERATOR_NULL) + { + *p_response_code = RACP_RESPONSE_INVALID_OPERATOR; + } + else if (p_racp_request->operand_len != 0) + { + *p_response_code = RACP_RESPONSE_INVALID_OPERAND; + } + else + { + *p_response_code = RACP_RESPONSE_SUCCESS; + } + } + else + { + *p_response_code = RACP_RESPONSE_ABORT_FAILED; + } + } + else if (m_gls_state != STATE_NO_COMM) + { + return false; + } + // Supported opcodes. + else if ((p_racp_request->opcode == RACP_OPCODE_REPORT_RECS) || + (p_racp_request->opcode == RACP_OPCODE_REPORT_NUM_RECS)) + { + switch (p_racp_request->operator) + { + // Operators WITHOUT a filter. + case RACP_OPERATOR_ALL: + case RACP_OPERATOR_FIRST: + case RACP_OPERATOR_LAST: + if (p_racp_request->operand_len != 0) + { + *p_response_code = RACP_RESPONSE_INVALID_OPERAND; + } + break; + + // Operators WITH a filter. + case RACP_OPERATOR_GREATER_OR_EQUAL: + if (p_racp_request->p_operand[0] == OPERAND_FILTER_TYPE_SEQ_NUM) + { + if (p_racp_request->operand_len != 3) + { + *p_response_code = RACP_RESPONSE_INVALID_OPERAND; + } + } + else if (p_racp_request->p_operand[0] == OPERAND_FILTER_TYPE_FACING_TIME) + { + *p_response_code = RACP_RESPONSE_OPERAND_UNSUPPORTED; + } + else if (p_racp_request->p_operand[0] >= OPERAND_FILTER_TYPE_RFU_START) + { + *p_response_code = RACP_RESPONSE_OPERAND_UNSUPPORTED; + } + else + { + *p_response_code = RACP_RESPONSE_INVALID_OPERAND; + } + break; + + // Unsupported operators. + case RACP_OPERATOR_LESS_OR_EQUAL: + case RACP_OPERATOR_RANGE: + *p_response_code = RACP_RESPONSE_OPERATOR_UNSUPPORTED; + break; + + // Invalid operators. + case RACP_OPERATOR_NULL: + default: + if (p_racp_request->operator >= RACP_OPERATOR_RFU_START) + { + *p_response_code = RACP_RESPONSE_OPERATOR_UNSUPPORTED; + } + else + { + *p_response_code = RACP_RESPONSE_INVALID_OPERATOR; + } + break; + } + } + // Unsupported opcodes, + else if (p_racp_request->opcode == RACP_OPCODE_DELETE_RECS) + { + *p_response_code = RACP_RESPONSE_OPCODE_UNSUPPORTED; + } + // Unknown opcodes. + else + { + *p_response_code = RACP_RESPONSE_OPCODE_UNSUPPORTED; + } + + // NOTE: The computation of the return value will change slightly when deferred write has been + // implemented in the stack. + return (*p_response_code == RACP_RESPONSE_RESERVED); +} + + +/**@brief Function for processing a REPORT RECORDS request. + * + * @param[in] p_gls Service instance. + * @param[in] p_racp_request Request to be executed. + */ +static void report_records_request_execute(ble_gls_t * p_gls, ble_racp_value_t * p_racp_request) +{ + uint16_t seq_num = (p_racp_request->p_operand[2] << 8) | p_racp_request->p_operand[1]; + + state_set(STATE_RACP_PROC_ACTIVE); + + m_racp_proc_record_ndx = 0; + m_racp_proc_operator = p_racp_request->operator; + m_racp_proc_records_reported = 0; + m_racp_proc_seq_num = seq_num; + + racp_report_records_procedure(p_gls); +} + + +/**@brief Function for processing a REPORT NUM RECORDS request. + * + * @param[in] p_gls Service instance. + * @param[in] p_racp_request Request to be executed. + */ +static void report_num_records_request_execute(ble_gls_t * p_gls, ble_racp_value_t * p_racp_request) +{ + uint16_t total_records; + uint16_t num_records; + + total_records = ble_gls_db_num_records_get(); + num_records = 0; + + if (p_racp_request->operator == RACP_OPERATOR_ALL) + { + num_records = total_records; + } + else if (p_racp_request->operator == RACP_OPERATOR_GREATER_OR_EQUAL) + { + uint16_t seq_num; + uint16_t i; + + seq_num = (p_racp_request->p_operand[2] << 8) | p_racp_request->p_operand[1]; + + for (i = 0; i < total_records; i++) + { + uint32_t err_code; + ble_gls_rec_t rec; + + err_code = ble_gls_db_record_get(i, &rec); + if (err_code != NRF_SUCCESS) + { + if (p_gls->error_handler != NULL) + { + p_gls->error_handler(err_code); + } + return; + } + + if (rec.meas.sequence_number >= seq_num) + { + num_records++; + } + } + } + else if ((p_racp_request->operator == RACP_OPERATOR_FIRST) || + (p_racp_request->operator == RACP_OPERATOR_LAST)) + { + if (total_records > 0) + { + num_records = 1; + } + } + + m_pending_racp_response.opcode = RACP_OPCODE_NUM_RECS_RESPONSE; + m_pending_racp_response.operator = RACP_OPERATOR_NULL; + m_pending_racp_response.operand_len = sizeof(uint16_t); + m_pending_racp_response.p_operand = m_pending_racp_response_operand; + + m_pending_racp_response_operand[0] = num_records & 0xFF; + m_pending_racp_response_operand[1] = num_records >> 8; + + racp_send(p_gls, &m_pending_racp_response); +} + + +/**@brief Function for checking if the CCCDs are configured. + * + * @param[in] p_gls Service instance. + * @param[in] p_are_cccd_configured boolean indicating if both cccds are configured + */ +uint32_t ble_gls_are_cccd_configured(ble_gls_t * p_gls, bool * p_are_cccd_configured) +{ + uint32_t err_code; + uint8_t cccd_value_buf[BLE_CCCD_VALUE_LEN]; + bool is_glm_notif_enabled = false; + bool is_racp_indic_enabled = false; + 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_value_buf; + + err_code = sd_ble_gatts_value_get(p_gls->conn_handle, + p_gls->glm_handles.cccd_handle, + &gatts_value); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + is_glm_notif_enabled = ble_srv_is_notification_enabled(cccd_value_buf); + + err_code = sd_ble_gatts_value_get(p_gls->conn_handle, + p_gls->racp_handles.cccd_handle, + &gatts_value); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + is_racp_indic_enabled = ble_srv_is_indication_enabled(cccd_value_buf); + if (is_racp_indic_enabled & is_glm_notif_enabled) + { + *p_are_cccd_configured = true; + } + else + { + *p_are_cccd_configured = false; + } + return NRF_SUCCESS; +} + + +/**@brief Function for handling a write event to the Record Access Control Point. + * + * @param[in] p_gls Service instance. + * @param[in] p_evt_write WRITE event to be handled. + */ +static void on_racp_value_write(ble_gls_t * p_gls, ble_gatts_evt_write_t * p_evt_write) +{ + ble_racp_value_t racp_request; + uint8_t response_code; + ble_gatts_rw_authorize_reply_params_t auth_reply; + bool are_cccd_configured; + uint32_t err_code; + + auth_reply.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE; + + err_code = ble_gls_are_cccd_configured(p_gls, &are_cccd_configured); + if (err_code != NRF_SUCCESS) + { + if (p_gls->error_handler != NULL) + { + p_gls->error_handler(err_code); + } + return; + } + + if (!are_cccd_configured) + { + auth_reply.params.write.gatt_status = GLS_NACK_CCCD_IMPROPERLY_CONFIGURED; + err_code = sd_ble_gatts_rw_authorize_reply(p_gls->conn_handle, + &auth_reply); + + if (err_code != NRF_SUCCESS) + { + if (p_gls->error_handler != NULL) + { + p_gls->error_handler(err_code); + } + } + return; + } + + // Decode request. + ble_racp_decode(p_evt_write->len, p_evt_write->data, &racp_request); + + // Check if request is to be executed. + if (is_request_to_be_executed(&racp_request, &response_code)) + { + auth_reply.params.write.gatt_status = BLE_GATT_STATUS_SUCCESS; + err_code = sd_ble_gatts_rw_authorize_reply(p_gls->conn_handle, + &auth_reply); + + if (err_code != NRF_SUCCESS) + { + if (p_gls->error_handler != NULL) + { + p_gls->error_handler(err_code); + } + return; + } + // Execute request. + if (racp_request.opcode == RACP_OPCODE_REPORT_RECS) + { + report_records_request_execute(p_gls, &racp_request); + } + else if (racp_request.opcode == RACP_OPCODE_REPORT_NUM_RECS) + { + report_num_records_request_execute(p_gls, &racp_request); + } + } + else if (response_code != RACP_RESPONSE_RESERVED) + { + auth_reply.params.write.gatt_status = BLE_GATT_STATUS_SUCCESS; + err_code = sd_ble_gatts_rw_authorize_reply(p_gls->conn_handle, + &auth_reply); + + if (err_code != NRF_SUCCESS) + { + if (p_gls->error_handler != NULL) + { + p_gls->error_handler(err_code); + } + return; + } + + // Abort any running procedure. + state_set(STATE_NO_COMM); + + // Respond with error code. + racp_response_code_send(p_gls, racp_request.opcode, response_code); + } + else + { + auth_reply.params.write.gatt_status = GLS_NACK_PROC_ALREADY_IN_PROGRESS; + err_code = sd_ble_gatts_rw_authorize_reply(p_gls->conn_handle, + &auth_reply); + + if (err_code != NRF_SUCCESS) + { + if (p_gls->error_handler != NULL) + { + p_gls->error_handler(err_code); + } + return; + } + } +} + + +/**@brief Function for handling the Glucose measurement CCCD write event. + * + * @param[in] p_gls Service instance. + * @param[in] p_evt_write WRITE event to be handled. + */ +static void on_glm_cccd_write(ble_gls_t * p_gls, ble_gatts_evt_write_t * p_evt_write) +{ + if (p_evt_write->len == 2) + { + // CCCD written, update notification state + ble_gls_evt_t evt; + + if (ble_srv_is_notification_enabled(p_evt_write->data)) + { + evt.evt_type = BLE_GLS_EVT_NOTIFICATION_ENABLED; + } + else + { + evt.evt_type = BLE_GLS_EVT_NOTIFICATION_DISABLED; + } + + if (p_gls->evt_handler != NULL) + { + p_gls->evt_handler(p_gls, &evt); + } + } +} + + +/**@brief Function for handling the WRITE event. + * + * @details Handles WRITE events from the BLE stack. + * + * @param[in] p_gls Glucose Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_write(ble_gls_t * p_gls, ble_evt_t * p_ble_evt) +{ + ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write; + + if (p_evt_write->handle == p_gls->glm_handles.cccd_handle) + { + on_glm_cccd_write(p_gls, p_evt_write); + } + else if (p_evt_write->handle == p_gls->racp_handles.value_handle) + { + on_racp_value_write(p_gls, p_evt_write); + } +} + + +/**@brief Function for handling the TX_COMPLETE event. + * + * @details Handles TX_COMPLETE events from the BLE stack. + * + * @param[in] p_gls Glucose Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_tx_complete(ble_gls_t * p_gls, ble_evt_t * p_ble_evt) +{ + m_racp_proc_records_reported_since_txcomplete = 0; + + if (m_gls_state == STATE_RACP_RESPONSE_PENDING) + { + racp_send(p_gls, &m_pending_racp_response); + } + else if (m_gls_state == STATE_RACP_PROC_ACTIVE) + { + racp_report_records_procedure(p_gls); + } +} + + +/**@brief Function for handling the HVC event. + * + * @details Handles HVC events from the BLE stack. + * + * @param[in] p_gls Glucose Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_hvc(ble_gls_t * p_gls, ble_evt_t * p_ble_evt) +{ + ble_gatts_evt_hvc_t * p_hvc = &p_ble_evt->evt.gatts_evt.params.hvc; + + if (p_hvc->handle == p_gls->racp_handles.value_handle) + { + if (m_gls_state == STATE_RACP_RESPONSE_IND_VERIF) + { + // Indication has been acknowledged. Return to default state. + state_set(STATE_NO_COMM); + } + else + { + // We did not expect this event in this state. Report error to application. + if (p_gls->error_handler != NULL) + { + p_gls->error_handler(NRF_ERROR_INVALID_STATE); + } + } + } +} + + +static void on_rw_authorize_request(ble_gls_t * p_gls, ble_gatts_evt_t * p_gatts_evt) +{ + ble_gatts_evt_rw_authorize_request_t * p_auth_req = &p_gatts_evt->params.authorize_request; + if (p_auth_req->type == BLE_GATTS_AUTHORIZE_TYPE_WRITE) + { + if ( (p_gatts_evt->params.authorize_request.request.write.op + != BLE_GATTS_OP_PREP_WRITE_REQ) + && (p_gatts_evt->params.authorize_request.request.write.op + != BLE_GATTS_OP_EXEC_WRITE_REQ_NOW) + && (p_gatts_evt->params.authorize_request.request.write.op + != BLE_GATTS_OP_EXEC_WRITE_REQ_CANCEL) + ) + { + if (p_auth_req->request.write.handle == p_gls->racp_handles.value_handle) + { + on_racp_value_write(p_gls, &p_auth_req->request.write); + } + } + } +} + +void ble_gls_on_ble_evt(ble_gls_t * p_gls, ble_evt_t * p_ble_evt) +{ + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + p_gls->conn_handle = p_ble_evt->evt.gap_evt.conn_handle; + state_set(STATE_NO_COMM); + break; + + case BLE_GAP_EVT_DISCONNECTED: + p_gls->conn_handle = BLE_CONN_HANDLE_INVALID; + break; + + case BLE_GATTS_EVT_WRITE: + on_write(p_gls, p_ble_evt); + break; + + case BLE_EVT_TX_COMPLETE: + on_tx_complete(p_gls, p_ble_evt); + break; + + case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST: + on_rw_authorize_request(p_gls, &p_ble_evt->evt.gatts_evt); + break; + + case BLE_GATTS_EVT_HVC: + on_hvc(p_gls, p_ble_evt); + break; + + default: + // No implementation needed. + break; + } +} + + +uint32_t ble_gls_glucose_new_meas(ble_gls_t * p_gls, ble_gls_rec_t * p_rec) +{ + p_rec->meas.sequence_number = m_next_seq_num++; + return ble_gls_db_record_add(p_rec); +} diff --git a/components/ble/ble_services/ble_gls/ble_gls.h b/components/ble/ble_services/ble_gls/ble_gls.h new file mode 100644 index 0000000..8c33805 --- /dev/null +++ b/components/ble/ble_services/ble_gls/ble_gls.h @@ -0,0 +1,264 @@ +/* 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 ble_sdk_srv_gls Glucose Service + * @{ + * @ingroup ble_sdk_srv + * @brief Glucose Service module. + * + * @details This module implements the Glucose Service. + * + * @note The application must propagate BLE stack events to the Glucose Service module by calling + * ble_gls_on_ble_evt() from the @ref softdevice_handler callback. + * + * @note Attention! + * To maintain compliance with Nordic Semiconductor ASA Bluetooth profile + * qualification listings, this section of source code must not be modified. + */ + +#ifndef BLE_GLS_H__ +#define BLE_GLS_H__ + +#include +#include +#include "ble.h" +#include "ble_srv_common.h" +#include "ble_date_time.h" + +/**@brief Glucose feature */ +#define BLE_GLS_FEATURE_LOW_BATT 0x0001 /**< Low Battery Detection During Measurement Supported */ +#define BLE_GLS_FEATURE_MALFUNC 0x0002 /**< Sensor Malfunction Detection Supported */ +#define BLE_GLS_FEATURE_SAMPLE_SIZE 0x0004 /**< Sensor Sample Size Supported */ +#define BLE_GLS_FEATURE_INSERT_ERR 0x0008 /**< Sensor Strip Insertion Error Detection Supported */ +#define BLE_GLS_FEATURE_TYPE_ERR 0x0010 /**< Sensor Strip Type Error Detection Supported */ +#define BLE_GLS_FEATURE_RES_HIGH_LOW 0x0020 /**< Sensor Result High-Low Detection Supported */ +#define BLE_GLS_FEATURE_TEMP_HIGH_LOW 0x0040 /**< Sensor Temperature High-Low Detection Supported */ +#define BLE_GLS_FEATURE_READ_INT 0x0080 /**< Sensor Read Interrupt Detection Supported */ +#define BLE_GLS_FEATURE_GENERAL_FAULT 0x0100 /**< General Device Fault Supported */ +#define BLE_GLS_FEATURE_TIME_FAULT 0x0200 /**< Time Fault Supported */ +#define BLE_GLS_FEATURE_MULTI_BOND 0x0400 /**< Multiple Bond Supported */ + +/**@brief Glucose measurement flags */ +#define BLE_GLS_MEAS_FLAG_TIME_OFFSET 0x01 /**< Time Offset Present */ +#define BLE_GLS_MEAS_FLAG_CONC_TYPE_LOC 0x02 /**< Glucose Concentration, Type, and Sample Location Present */ +#define BLE_GLS_MEAS_FLAG_UNITS_KG_L 0x00 /**< Glucose Concentration Units kg/L */ +#define BLE_GLS_MEAS_FLAG_UNITS_MOL_L 0x04 /**< Glucose Concentration Units mol/L */ +#define BLE_GLS_MEAS_FLAG_SENSOR_STATUS 0x08 /**< Sensor Status Annunciation Present */ +#define BLE_GLS_MEAS_FLAG_CONTEXT_INFO 0x10 /**< Context Information Follows */ + +/**@brief Glucose measurement type */ +#define BLE_GLS_MEAS_TYPE_CAP_BLOOD 1 /**< Capillary whole blood */ +#define BLE_GLS_MEAS_TYPE_CAP_PLASMA 2 /**< Capillary plasma */ +#define BLE_GLS_MEAS_TYPE_VEN_BLOOD 3 /**< Venous whole blood */ +#define BLE_GLS_MEAS_TYPE_VEN_PLASMA 4 /**< Venous plasma */ +#define BLE_GLS_MEAS_TYPE_ART_BLOOD 5 /**< Arterial whole blood */ +#define BLE_GLS_MEAS_TYPE_ART_PLASMA 6 /**< Arterial plasma */ +#define BLE_GLS_MEAS_TYPE_UNDET_BLOOD 7 /**< Undetermined whole blood */ +#define BLE_GLS_MEAS_TYPE_UNDET_PLASMA 8 /**< Undetermined plasma */ +#define BLE_GLS_MEAS_TYPE_FLUID 9 /**< Interstitial fluid (ISF) */ +#define BLE_GLS_MEAS_TYPE_CONTROL 10 /**< Control solution */ + +/**@brief Glucose measurement location */ +#define BLE_GLS_MEAS_LOC_FINGER 1 /**< Finger */ +#define BLE_GLS_MEAS_LOC_AST 2 /**< Alternate Site Test (AST) */ +#define BLE_GLS_MEAS_LOC_EAR 3 /**< Earlobe */ +#define BLE_GLS_MEAS_LOC_CONTROL 4 /**< Control solution */ +#define BLE_GLS_MEAS_LOC_NOT_AVAIL 15 /**< Sample Location value not available */ + +/**@brief Glucose sensor status annunciation */ +#define BLE_GLS_MEAS_STATUS_BATT_LOW 0x0001 /**< Device battery low at time of measurement */ +#define BLE_GLS_MEAS_STATUS_SENSOR_FAULT 0x0002 /**< Sensor malfunction or faulting at time of measurement */ +#define BLE_GLS_MEAS_STATUS_SAMPLE_SIZE 0x0004 /**< Sample size for blood or control solution insufficient at time of measurement */ +#define BLE_GLS_MEAS_STATUS_STRIP_INSERT 0x0008 /**< Strip insertion error */ +#define BLE_GLS_MEAS_STATUS_STRIP_TYPE 0x0010 /**< Strip type incorrect for device */ +#define BLE_GLS_MEAS_STATUS_RESULT_HIGH 0x0020 /**< Sensor result higher than the device can process */ +#define BLE_GLS_MEAS_STATUS_RESULT_LOW 0x0040 /**< Sensor result lower than the device can process */ +#define BLE_GLS_MEAS_STATUS_TEMP_HIGH 0x0080 /**< Sensor temperature too high for valid test/result at time of measurement */ +#define BLE_GLS_MEAS_STATUS_TEMP_LOW 0x0100 /**< Sensor temperature too low for valid test/result at time of measurement */ +#define BLE_GLS_MEAS_STATUS_STRIP_PULL 0x0200 /**< Sensor read interrupted because strip was pulled too soon at time of measurement */ +#define BLE_GLS_MEAS_STATUS_GENERAL_FAULT 0x0400 /**< General device fault has occurred in the sensor */ +#define BLE_GLS_MEAS_STATUS_TIME_FAULT 0x0800 /**< Time fault has occurred in the sensor and time may be inaccurate */ + +/**@brief Glucose measurement context flags */ +#define BLE_GLS_CONTEXT_FLAG_CARB 0x01 /**< Carbohydrate id and carbohydrate present */ +#define BLE_GLS_CONTEXT_FLAG_MEAL 0x02 /**< Meal present */ +#define BLE_GLS_CONTEXT_FLAG_TESTER 0x04 /**< Tester-health present */ +#define BLE_GLS_CONTEXT_FLAG_EXERCISE 0x08 /**< Exercise duration and exercise intensity present */ +#define BLE_GLS_CONTEXT_FLAG_MED 0x10 /**< Medication ID and medication present */ +#define BLE_GLS_CONTEXT_FLAG_MED_KG 0x00 /**< Medication value units, kilograms */ +#define BLE_GLS_CONTEXT_FLAG_MED_L 0x20 /**< Medication value units, liters */ +#define BLE_GLS_CONTEXT_FLAG_HBA1C 0x40 /**< Hba1c present */ +#define BLE_GLS_CONTEXT_FLAG_EXT 0x80 /**< Extended flags present */ + +/**@brief Glucose measurement context carbohydrate ID */ +#define BLE_GLS_CONTEXT_CARB_BREAKFAST 1 /**< Breakfast */ +#define BLE_GLS_CONTEXT_CARB_LUNCH 2 /**< Lunch */ +#define BLE_GLS_CONTEXT_CARB_DINNER 3 /**< Dinner */ +#define BLE_GLS_CONTEXT_CARB_SNACK 4 /**< Snack */ +#define BLE_GLS_CONTEXT_CARB_DRINK 5 /**< Drink */ +#define BLE_GLS_CONTEXT_CARB_SUPPER 6 /**< Supper */ +#define BLE_GLS_CONTEXT_CARB_BRUNCH 7 /**< Brunch */ + +/**@brief Glucose measurement context meal */ +#define BLE_GLS_CONTEXT_MEAL_PREPRANDIAL 1 /**< Preprandial (before meal) */ +#define BLE_GLS_CONTEXT_MEAL_POSTPRANDIAL 2 /**< Postprandial (after meal) */ +#define BLE_GLS_CONTEXT_MEAL_FASTING 3 /**< Fasting */ +#define BLE_GLS_CONTEXT_MEAL_CASUAL 4 /**< Casual (snacks, drinks, etc.) */ +#define BLE_GLS_CONTEXT_MEAL_BEDTIME 5 /**< Bedtime */ + +/**@brief Glucose measurement context tester */ +#define BLE_GLS_CONTEXT_TESTER_SELF 1 /**< Self */ +#define BLE_GLS_CONTEXT_TESTER_PRO 2 /**< Health care professional */ +#define BLE_GLS_CONTEXT_TESTER_LAB 3 /**< Lab test */ +#define BLE_GLS_CONTEXT_TESTER_NOT_AVAIL 15 /**< Tester value not available */ + +/**@brief Glucose measurement context health */ +#define BLE_GLS_CONTEXT_HEALTH_MINOR 1 /**< Minor health issues */ +#define BLE_GLS_CONTEXT_HEALTH_MAJOR 2 /**< Major health issues */ +#define BLE_GLS_CONTEXT_HEALTH_MENSES 3 /**< During menses */ +#define BLE_GLS_CONTEXT_HEALTH_STRESS 4 /**< Under stress */ +#define BLE_GLS_CONTEXT_HEALTH_NONE 5 /**< No health issues */ +#define BLE_GLS_CONTEXT_HEALTH_NOT_AVAIL 15 /**< Health value not available */ + +/**@brief Glucose measurement context medication ID */ +#define BLE_GLS_CONTEXT_MED_RAPID 1 /**< Rapid acting insulin */ +#define BLE_GLS_CONTEXT_MED_SHORT 2 /**< Short acting insulin */ +#define BLE_GLS_CONTEXT_MED_INTERMED 3 /**< Intermediate acting insulin */ +#define BLE_GLS_CONTEXT_MED_LONG 4 /**< Long acting insulin */ +#define BLE_GLS_CONTEXT_MED_PREMIX 5 /**< Pre-mixed insulin */ + +/**@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 Glucose Service event type. */ +typedef enum +{ + BLE_GLS_EVT_NOTIFICATION_ENABLED, /**< Glucose value notification enabled event. */ + BLE_GLS_EVT_NOTIFICATION_DISABLED /**< Glucose value notification disabled event. */ +} ble_gls_evt_type_t; + +/**@brief Glucose Service event. */ +typedef struct +{ + ble_gls_evt_type_t evt_type; /**< Type of event. */ +} ble_gls_evt_t; + +// Forward declaration of the ble_gls_t type. +typedef struct ble_gls_s ble_gls_t; + +/**@brief Glucose Service event handler type. */ +typedef void (*ble_gls_evt_handler_t) (ble_gls_t * p_gls, ble_gls_evt_t * p_evt); + +/**@brief Glucose Measurement structure. This contains glucose measurement value. */ +typedef struct +{ + uint8_t flags; /**< Flags */ + uint16_t sequence_number; /**< Sequence number */ + ble_date_time_t base_time; /**< Time stamp */ + int16_t time_offset; /**< Time offset */ + sfloat_t glucose_concentration; /**< Glucose concentration */ + uint8_t type; /**< Type */ + uint8_t sample_location; /**< Sample location */ + uint16_t sensor_status_annunciation; /**< Sensor status annunciation */ +} ble_gls_meas_t; + +/**@brief Glucose measurement context structure */ +typedef struct +{ + uint8_t flags; /**< Flags */ + uint8_t extended_flags; /**< Extended Flags */ + uint8_t carbohydrate_id; /**< Carbohydrate ID */ + sfloat_t carbohydrate; /**< Carbohydrate */ + uint8_t meal; /**< Meal */ + uint8_t tester_and_health; /**< Tester and health */ + uint16_t exercise_duration; /**< Exercise Duration */ + uint8_t exercise_intensity; /**< Exercise Intensity */ + uint8_t medication_id; /**< Medication ID */ + sfloat_t medication; /**< Medication */ + uint16_t hba1c; /**< HbA1c */ +} ble_gls_meas_context_t; + +/**@brief Glucose measurement record */ +typedef struct +{ + ble_gls_meas_t meas; /**< Glucose measurement */ + ble_gls_meas_context_t context; /**< Glucose measurement context */ +} ble_gls_rec_t; + +/**@brief Glucose Service init structure. This contains all options and data needed for + * initialization of the service. */ +typedef struct +{ + ble_gls_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Glucose Service. */ + ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */ + uint16_t feature; /**< Glucose Feature value indicating supported features. */ + bool is_context_supported; /**< Determines if optional Glucose Measurement Context is to be supported. */ +} ble_gls_init_t; + +/**@brief Glucose Service structure. This contains various status information for the service. */ +struct ble_gls_s +{ + ble_gls_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Glucose Service. */ + ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */ + uint16_t service_handle; /**< Handle of Glucose Service (as provided by the BLE stack). */ + ble_gatts_char_handles_t glm_handles; /**< Handles related to the Glucose Measurement characteristic. */ + ble_gatts_char_handles_t glm_context_handles; /**< Handles related to the Glucose Measurement Context characteristic. */ + ble_gatts_char_handles_t glf_handles; /**< Handles related to the Glucose Feature characteristic. */ + ble_gatts_char_handles_t racp_handles; /**< Handles related to the Record Access Control Point characteristic. */ + uint16_t conn_handle; /**< Handle of the current connection (as provided by the BLE stack, is BLE_CONN_HANDLE_INVALID if not in a connection). */ + uint16_t feature; + bool is_context_supported; +}; + +/**@brief Function for initializing the Glucose Service. + * + * @details This call allows the application to initialize the Glucose Service. + * + * @param[out] p_gls Glucose 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 this particular service instance. + * @param[in] p_gls_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on successful initialization of service, otherwise an error code. + */ +uint32_t ble_gls_init(ble_gls_t * p_gls, const ble_gls_init_t * p_gls_init); + +/**@brief Function for handling the Application's BLE Stack events. + * + * @details Handles all events from the BLE stack of interest to the Glucose Service. + * + * @param[in] p_gls Glucose Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +void ble_gls_on_ble_evt(ble_gls_t * p_gls, ble_evt_t * p_ble_evt); + +/**@brief Function for reporting a new glucose measurement to the glucose service module. + * + * @details The application calls this function after having performed a new glucose measurement. + * The new measurement is recorded in the RACP database. + * + * @param[in] p_gls Glucose Service structure. + * @param[in] p_rec Pointer to glucose record (measurement plus context). + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +uint32_t ble_gls_glucose_new_meas(ble_gls_t * p_gls, ble_gls_rec_t * p_rec); + +#endif // BLE_GLS_H__ + +/** @} */ + diff --git a/components/ble/ble_services/ble_gls/ble_gls_db.c b/components/ble/ble_services/ble_gls/ble_gls_db.c new file mode 100644 index 0000000..0f7d1a9 --- /dev/null +++ b/components/ble/ble_services/ble_gls/ble_gls_db.c @@ -0,0 +1,112 @@ +/* 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 "ble_gls_db.h" + + +typedef struct +{ + bool in_use_flag; + ble_gls_rec_t record; +} database_entry_t; + +static database_entry_t m_database[BLE_GLS_DB_MAX_RECORDS]; +static uint8_t m_database_crossref[BLE_GLS_DB_MAX_RECORDS]; +static uint16_t m_num_records; + + +uint32_t ble_gls_db_init(void) +{ + int i; + + for (i = 0; i < BLE_GLS_DB_MAX_RECORDS; i++) + { + m_database[i].in_use_flag = false; + m_database_crossref[i] = 0xFF; + } + + m_num_records = 0; + + return NRF_SUCCESS; +} + + +uint16_t ble_gls_db_num_records_get(void) +{ + return m_num_records; +} + + +uint32_t ble_gls_db_record_get(uint8_t rec_ndx, ble_gls_rec_t * p_rec) +{ + if (rec_ndx >= m_num_records) + { + return NRF_ERROR_INVALID_PARAM; + } + + // copy record to the specified memory + *p_rec = m_database[m_database_crossref[rec_ndx]].record; + + return NRF_SUCCESS; +} + + +uint32_t ble_gls_db_record_add(ble_gls_rec_t * p_rec) +{ + int i; + + if (m_num_records == BLE_GLS_DB_MAX_RECORDS) + { + return NRF_ERROR_NO_MEM; + } + + // find next available database entry + for (i = 0; i < BLE_GLS_DB_MAX_RECORDS; i++) + { + if (!m_database[i].in_use_flag) + { + m_database[i].in_use_flag = true; + m_database[i].record = *p_rec; + + m_database_crossref[m_num_records] = i; + m_num_records++; + + return NRF_SUCCESS; + } + } + + return NRF_ERROR_NO_MEM; +} + + +uint32_t ble_gls_db_record_delete(uint8_t rec_ndx) +{ + int i; + + if (rec_ndx >= m_num_records) + { + return NRF_ERROR_NOT_FOUND; + } + + // free entry + m_database[m_database_crossref[rec_ndx]].in_use_flag = false; + + // decrease number of records + m_num_records--; + + // remove cross reference index + for (i = rec_ndx; i < m_num_records; i++) + { + m_database_crossref[i] = m_database_crossref[i + 1]; + } + + return NRF_SUCCESS; +} diff --git a/components/ble/ble_services/ble_gls/ble_gls_db.h b/components/ble/ble_services/ble_gls/ble_gls_db.h new file mode 100644 index 0000000..2f2f4f9 --- /dev/null +++ b/components/ble/ble_services/ble_gls/ble_gls_db.h @@ -0,0 +1,84 @@ +/* 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 ble_sdk_srv_gls_db Glucose Database Service + * @{ + * @ingroup ble_sdk_srv + * @brief Glucose Service module. + * + * @details This module implements at database of stored glucose measurement values. + * + * @note Attention! + * To maintain compliance with Nordic Semiconductor ASA Bluetooth profile + * qualification listings, These APIs must not be modified. However, the corresponding + * functions' implementations can be modified. + */ + +#ifndef BLE_GLS_DB_H__ +#define BLE_GLS_DB_H__ + +#include +#include "ble_gls.h" + +#define BLE_GLS_DB_MAX_RECORDS 20 + +/**@brief Function for initializing the glucose record database. + * + * @details This call initializes the database holding glucose records. + * + * @return NRF_SUCCESS on success. + */ +uint32_t ble_gls_db_init(void); + +/**@brief Function for getting the number of records in the database. + * + * @details This call returns the number of records in the database. + * + * @return Number of records in the database. + */ +uint16_t ble_gls_db_num_records_get(void); + +/**@brief Function for getting a record from the database. + * + * @details This call returns a specified record from the database. + * + * @param[in] record_num Index of the record to retrieve. + * @param[out] p_rec Pointer to record structure where retrieved record is copied to. + * + * @return NRF_SUCCESS on success. + */ +uint32_t ble_gls_db_record_get(uint8_t record_num, ble_gls_rec_t * p_rec); + +/**@brief Function for adding a record at the end of the database. + * + * @details This call adds a record as the last record in the database. + * + * @param[in] p_rec Pointer to record to add to database. + * + * @return NRF_SUCCESS on success. + */ +uint32_t ble_gls_db_record_add(ble_gls_rec_t * p_rec); + +/**@brief Function for deleting a database entry. + * + * @details This call deletes an record from the database. + * + * @param[in] record_num Index of record to delete. + * + * @return NRF_SUCCESS on success. + */ +uint32_t ble_gls_db_record_delete(uint8_t record_num); + +#endif // BLE_GLS_DB_H__ + +/** @} */ diff --git a/components/ble/ble_services/ble_hids/ble_hids.c b/components/ble/ble_services/ble_hids/ble_hids.c new file mode 100644 index 0000000..240a25f --- /dev/null +++ b/components/ble/ble_services/ble_hids/ble_hids.c @@ -0,0 +1,1380 @@ +/* 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. + * + */ + +/* Attention! +* To maintain compliance with Nordic Semiconductor ASAs Bluetooth profile +* qualification listings, this section of source code must not be modified. +*/ + +#include "ble_hids.h" +#include +#include "app_error.h" +#include "nordic_common.h" +#include "ble_srv_common.h" +#include "app_util.h" + + +// Protocol Mode values +#define PROTOCOL_MODE_BOOT 0x00 /**< Boot Protocol Mode. */ +#define PROTOCOL_MODE_REPORT 0x01 /**< Report Protocol Mode. */ + +// HID Control Point values +#define HIDS_CONTROL_POINT_SUSPEND 0 /**< Suspend command. */ +#define HIDS_CONTROL_POINT_EXIT_SUSPEND 1 /**< Exit Suspend command. */ + +#define DEFAULT_PROTOCOL_MODE PROTOCOL_MODE_REPORT /**< Default value for the Protocol Mode characteristic. */ +#define INITIAL_VALUE_HID_CONTROL_POINT HIDS_CONTROL_POINT_SUSPEND /**< Initial value for the HID Control Point characteristic. */ + +#define ENCODED_HID_INFORMATION_LEN 4 /**< Maximum size of an encoded HID Information characteristic. */ + +#define BOOT_KB_INPUT_REPORT_MAX_SIZE 8 /**< Maximum size of a Boot Keyboard Input Report (as per Appendix B in Device Class Definition for Human Interface Devices (HID), Version 1.11). */ +#define BOOT_KB_OUTPUT_REPORT_MAX_SIZE 1 /**< Maximum size of a Boot Keyboard Output Report (as per Appendix B in Device Class Definition for Human Interface Devices (HID), Version 1.11). */ +#define BOOT_MOUSE_INPUT_REPORT_MIN_SIZE 3 /**< Minimum size of a Boot Mouse Input Report (as per Appendix B in Device Class Definition for Human Interface Devices (HID), Version 1.11). */ +#define BOOT_MOUSE_INPUT_REPORT_MAX_SIZE 8 /**< Maximum size of a Boot Mouse Input Report (as per Appendix B in Device Class Definition for Human Interface Devices (HID), Version 1.11). */ + + +/**@brief Function for making a HID Service characteristic id. + * + * @param[in] uuid UUID of characteristic. + * @param[in] rep_type Type of report. + * @param[in] rep_index Index of the characteristic. + * + * @return HID Service characteristic id structure. + */ +static ble_hids_char_id_t make_char_id(uint16_t uuid, uint8_t rep_type, uint8_t rep_index) +{ + ble_hids_char_id_t char_id = {0}; + + char_id.uuid = uuid; + char_id.rep_type = rep_type; + char_id.rep_index = rep_index; + + return char_id; +} + + +/**@brief Function for handling the Connect event. + * + * @param[in] p_hids HID Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_connect(ble_hids_t * p_hids, ble_evt_t * p_ble_evt) +{ + uint32_t err_code; + uint8_t default_protocol_mode; + ble_gatts_value_t gatts_value; + + p_hids->conn_handle = p_ble_evt->evt.gap_evt.conn_handle; + + if (p_hids->protocol_mode_handles.value_handle) + { + // Set Protocol Mode characteristic value to default value + default_protocol_mode = DEFAULT_PROTOCOL_MODE; + + // Initialize value struct. + memset(&gatts_value, 0, sizeof(gatts_value)); + + gatts_value.len = sizeof(uint8_t); + gatts_value.offset = 0; + gatts_value.p_value = &default_protocol_mode; + + err_code = sd_ble_gatts_value_set(p_hids->conn_handle, + p_hids->protocol_mode_handles.value_handle, + &gatts_value); + if ((err_code != NRF_SUCCESS) && (p_hids->error_handler != NULL)) + { + p_hids->error_handler(err_code); + } + } +} + + +/**@brief Function for handling the Disconnect event. + * + * @param[in] p_hids HID Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_disconnect(ble_hids_t * p_hids, ble_evt_t * p_ble_evt) +{ + UNUSED_PARAMETER(p_ble_evt); + p_hids->conn_handle = BLE_CONN_HANDLE_INVALID; +} + + +/**@brief Function for handling write events to the HID Control Point value. + * + * @param[in] p_hids HID Service structure. + * @param[in] p_evt_write Write event received from the BLE stack. + */ +static void on_control_point_write(ble_hids_t * p_hids, ble_gatts_evt_write_t * p_evt_write) +{ + if ((p_evt_write->len == 1) && (p_hids->evt_handler != NULL)) + { + ble_hids_evt_t evt; + + // HID Control Point written, propagate event to application + switch (p_evt_write->data[0]) + { + case HIDS_CONTROL_POINT_SUSPEND: + evt.evt_type = BLE_HIDS_EVT_HOST_SUSP; + break; + + case HIDS_CONTROL_POINT_EXIT_SUSPEND: + evt.evt_type = BLE_HIDS_EVT_HOST_EXIT_SUSP; + break; + + default: + // Illegal Control Point value, ignore + return; + } + + p_hids->evt_handler(p_hids, &evt); + } +} + + +/**@brief Function for handling write events to the Protocol Mode value. + * + * @param[in] p_hids HID Service structure. + * @param[in] p_evt_write Write event received from the BLE stack. + */ +static void on_protocol_mode_write(ble_hids_t * p_hids, ble_gatts_evt_write_t * p_evt_write) +{ + if ((p_evt_write->len == 1) && (p_hids->evt_handler != NULL)) + { + ble_hids_evt_t evt; + + // HID Protocol Mode written, propagate event to application + switch (p_evt_write->data[0]) + { + case PROTOCOL_MODE_BOOT: + evt.evt_type = BLE_HIDS_EVT_BOOT_MODE_ENTERED; + break; + + case PROTOCOL_MODE_REPORT: + evt.evt_type = BLE_HIDS_EVT_REPORT_MODE_ENTERED; + break; + + default: + // Illegal Protocol Mode value, ignore + return; + } + + p_hids->evt_handler(p_hids, &evt); + } +} + + +/**@brief Function for handling write events to a report CCCD. + * + * @param[in] p_hids HID Service structure. + * @param[in] p_char_id Id of report characteristic. + * @param[in] p_evt_write Write event received from the BLE stack. + */ +static void on_report_cccd_write(ble_hids_t * p_hids, + ble_hids_char_id_t * p_char_id, + ble_gatts_evt_write_t * p_evt_write) +{ + if (p_evt_write->len == 2) + { + // CCCD written, update notification state + if (p_hids->evt_handler != NULL) + { + ble_hids_evt_t evt; + + if (ble_srv_is_notification_enabled(p_evt_write->data)) + { + evt.evt_type = BLE_HIDS_EVT_NOTIF_ENABLED; + } + else + { + evt.evt_type = BLE_HIDS_EVT_NOTIF_DISABLED; + } + evt.params.notification.char_id = *p_char_id; + + p_hids->evt_handler(p_hids, &evt); + } + } +} + + +/**@brief Function for handling write events to a report value. + * + * @param[in] p_hids HID Service structure. + * @param[in] p_char_id Id of report characteristic. + */ +static void on_report_value_write(ble_hids_t * p_hids, + ble_evt_t * p_ble_evt, + ble_hids_char_id_t * p_char_id) +{ + if (p_hids->evt_handler != NULL) + { + ble_hids_evt_t evt; + + evt.evt_type = BLE_HIDS_EVT_REP_CHAR_WRITE; + evt.params.char_write.char_id = *p_char_id; + evt.params.char_write.offset = p_ble_evt->evt.gatts_evt.params.write.offset; + evt.params.char_write.len = p_ble_evt->evt.gatts_evt.params.write.len; + evt.params.char_write.data = p_ble_evt->evt.gatts_evt.params.write.data; + + p_hids->evt_handler(p_hids, &evt); + } +} + +/**@brief Handle authorize read events to a report value. + * + * @param[in] p_hids HID Service structure. + * @param[in] p_char_id Id of report characteristic. + */ +static void on_report_value_read_auth(ble_hids_t * p_hids, + ble_hids_char_id_t * p_char_id, + ble_evt_t * p_ble_evt) +{ + if (p_hids->evt_handler != NULL) + { + ble_hids_evt_t evt; + + evt.evt_type = BLE_HIDS_EVT_REPORT_READ; + evt.params.char_auth_read.char_id = *p_char_id; + evt.p_ble_evt = p_ble_evt; + + p_hids->evt_handler(p_hids, &evt); + } +} + +/**@brief Function for finding the Characteristic Id of a characteristic corresponding to a CCCD handle. + * + * @param[in] p_hids HID Service structure. + * @param[in] handle Handle to search for. + * @param[out] p_char_id Id of report characteristic. + * + * @return TRUE if CCCD handle was found, FALSE otherwise. + */ +static bool inp_rep_cccd_identify(ble_hids_t * p_hids, + uint16_t handle, + ble_hids_char_id_t * p_char_id) +{ + uint8_t i; + + for (i = 0; i < p_hids->inp_rep_count; i++) + { + if (handle == p_hids->inp_rep_array[i].char_handles.cccd_handle) + { + *p_char_id = make_char_id(BLE_UUID_REPORT_CHAR, BLE_HIDS_REP_TYPE_INPUT, i); + return true; + } + } + + return false; +} + + +/**@brief Function for finding the Characteristic Id of a characteristic corresponding to a value handle. + * + * @param[in] p_hids HID Service structure. + * @param[in] handle Handle to search for. + * @param[out] p_char_id Id of report characteristic. + * + * @return TRUE if value handle was found, FALSE otherwise. + */ +static bool rep_value_identify(ble_hids_t * p_hids, + uint16_t handle, + ble_hids_char_id_t * p_char_id) +{ + uint8_t i; + + for (i = 0; i < p_hids->inp_rep_count; i++) + { + if (handle == p_hids->inp_rep_array[i].char_handles.value_handle) + { + *p_char_id = make_char_id(BLE_UUID_REPORT_CHAR, BLE_HIDS_REP_TYPE_INPUT, i); + return true; + } + } + + for (i = 0; i < p_hids->outp_rep_count; i++) + { + if (handle == p_hids->outp_rep_array[i].char_handles.value_handle) + { + *p_char_id = make_char_id(BLE_UUID_REPORT_CHAR, BLE_HIDS_REP_TYPE_OUTPUT, i); + return true; + } + } + + for (i = 0; i < p_hids->feature_rep_count; i++) + { + if (handle == p_hids->feature_rep_array[i].char_handles.value_handle) + { + *p_char_id = make_char_id(BLE_UUID_REPORT_CHAR, BLE_HIDS_REP_TYPE_FEATURE, i); + return true; + } + } + + return false; +} + + +/**@brief Function for handling the Write event. + * + * @param[in] p_hids HID Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_write(ble_hids_t * p_hids, ble_evt_t * p_ble_evt) +{ + ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write; + ble_hids_char_id_t char_id; + + if (p_evt_write->handle == p_hids->hid_control_point_handles.value_handle) + { + on_control_point_write(p_hids, p_evt_write); + } + else if (p_evt_write->handle == p_hids->protocol_mode_handles.value_handle) + { + on_protocol_mode_write(p_hids, p_evt_write); + } + else if (p_evt_write->handle == p_hids->boot_kb_inp_rep_handles.cccd_handle) + { + char_id = make_char_id(BLE_UUID_BOOT_KEYBOARD_INPUT_REPORT_CHAR, 0, 0); + on_report_cccd_write(p_hids, &char_id, p_evt_write); + } + else if (p_evt_write->handle == p_hids->boot_kb_inp_rep_handles.value_handle) + { + char_id = make_char_id(BLE_UUID_BOOT_KEYBOARD_INPUT_REPORT_CHAR, 0, 0); + on_report_value_write(p_hids, p_ble_evt, &char_id); + } + else if (p_evt_write->handle == p_hids->boot_mouse_inp_rep_handles.cccd_handle) + { + char_id = make_char_id(BLE_UUID_BOOT_MOUSE_INPUT_REPORT_CHAR, 0, 0); + on_report_cccd_write(p_hids, &char_id, p_evt_write); + } + else if (p_evt_write->handle == p_hids->boot_mouse_inp_rep_handles.value_handle) + { + char_id = make_char_id(BLE_UUID_BOOT_MOUSE_INPUT_REPORT_CHAR, 0, 0); + on_report_value_write(p_hids, p_ble_evt, &char_id); + } + else if (inp_rep_cccd_identify(p_hids, p_evt_write->handle, &char_id)) + { + on_report_cccd_write(p_hids, &char_id, p_evt_write); + } + else if (rep_value_identify(p_hids, p_evt_write->handle, &char_id)) + { + on_report_value_write(p_hids, p_ble_evt, &char_id); + } + else + { + // No implementation needed. + } +} + +/**@brief Read/write authorize request event handler. + * + * @param[in] p_hids HID Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_rw_authorize_request(ble_hids_t * p_hids, ble_evt_t * p_ble_evt) +{ + ble_gatts_evt_rw_authorize_request_t * evt_rw_auth = &p_ble_evt->evt.gatts_evt.params.authorize_request; + ble_hids_char_id_t char_id; + + if (evt_rw_auth->type != BLE_GATTS_AUTHORIZE_TYPE_READ) + { + // Unexpected operation + return; + } + + if (rep_value_identify(p_hids, evt_rw_auth->request.read.handle, &char_id)) + { + on_report_value_read_auth(p_hids, &char_id, p_ble_evt); + } +} + +void ble_hids_on_ble_evt(ble_hids_t * p_hids, ble_evt_t * p_ble_evt) +{ + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + on_connect(p_hids, p_ble_evt); + break; + + case BLE_GAP_EVT_DISCONNECTED: + on_disconnect(p_hids, p_ble_evt); + break; + + case BLE_GATTS_EVT_WRITE: + on_write(p_hids, p_ble_evt); + break; + + case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST: + on_rw_authorize_request(p_hids, p_ble_evt); + break; + default: + // No implementation needed. + break; + } +} + + +/**@brief Function for adding Protocol Mode characteristics. + * + * @param[in] p_hids HID Service structure. + * @param[in] p_sec_mode Characteristic security settings. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t protocol_mode_char_add(ble_hids_t * p_hids, + const ble_srv_security_mode_t * p_sec_mode) +{ + ble_gatts_char_md_t char_md; + ble_gatts_attr_t attr_char_value; + ble_uuid_t ble_uuid; + ble_gatts_attr_md_t attr_md; + uint8_t initial_protocol_mode; + + memset(&char_md, 0, sizeof(char_md)); + + char_md.char_props.read = 1; + 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; + + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_PROTOCOL_MODE_CHAR); + + memset(&attr_md, 0, sizeof(attr_md)); + + attr_md.read_perm = p_sec_mode->read_perm; + attr_md.write_perm = p_sec_mode->write_perm; + attr_md.vloc = BLE_GATTS_VLOC_STACK; + attr_md.rd_auth = 0; + attr_md.wr_auth = 0; + attr_md.vlen = 0; + + memset(&attr_char_value, 0, sizeof(attr_char_value)); + + initial_protocol_mode = DEFAULT_PROTOCOL_MODE; + + attr_char_value.p_uuid = &ble_uuid; + attr_char_value.p_attr_md = &attr_md; + attr_char_value.init_len = sizeof(uint8_t); + attr_char_value.init_offs = 0; + attr_char_value.max_len = sizeof(uint8_t); + attr_char_value.p_value = &initial_protocol_mode; + + return sd_ble_gatts_characteristic_add(p_hids->service_handle, + &char_md, + &attr_char_value, + &p_hids->protocol_mode_handles); +} + + +/**@brief Function for adding report characteristics. + * + * @param[in] p_hids HID Service structure. + * @param[in] p_properties Report characteristic properties. + * @param[in] max_len Maximum length of report value. + * @param[in] p_rep_ref Report Reference descriptor. + * @param[in] p_rep_ref_attr_md Characteristic security settings. + * @param[in] is_read_resp Characteristic read authorization. + * @param[out] p_rep_char Handles of new characteristic. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t rep_char_add(ble_hids_t * p_hids, + ble_gatt_char_props_t * p_properties, + uint16_t max_len, + ble_srv_report_ref_t * p_rep_ref, + ble_srv_cccd_security_mode_t * p_rep_ref_attr_md, + bool is_read_resp, + ble_hids_rep_char_t * p_rep_char) +{ + uint32_t err_code; + 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; + uint8_t encoded_rep_ref[BLE_SRV_ENCODED_REPORT_REF_LEN]; + + // Add Report characteristic + if (p_properties->notify) + { + memset(&cccd_md, 0, sizeof(cccd_md)); + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm); + cccd_md.write_perm = p_rep_ref_attr_md->cccd_write_perm; + cccd_md.vloc = BLE_GATTS_VLOC_STACK; + } + + memset(&char_md, 0, sizeof(char_md)); + + char_md.char_props = *p_properties; + 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 = (p_properties->notify) ? &cccd_md : NULL; + char_md.p_sccd_md = NULL; + + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_REPORT_CHAR); + + memset(&attr_md, 0, sizeof(attr_md)); + + attr_md.read_perm = p_rep_ref_attr_md->read_perm; + attr_md.write_perm = p_rep_ref_attr_md->write_perm; + attr_md.vloc = BLE_GATTS_VLOC_STACK; + attr_md.rd_auth = is_read_resp ? 1 : 0; + attr_md.wr_auth = 0; + 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 = max_len; + attr_char_value.p_value = NULL; + + err_code = sd_ble_gatts_characteristic_add(p_hids->service_handle, + &char_md, + &attr_char_value, + &p_rep_char->char_handles); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add Report Reference descriptor + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_REPORT_REF_DESCR); + + memset(&attr_md, 0, sizeof(attr_md)); + + attr_md.read_perm = p_rep_ref_attr_md->read_perm; + attr_md.write_perm = p_rep_ref_attr_md->write_perm; + attr_md.vloc = BLE_GATTS_VLOC_STACK; + attr_md.rd_auth = 0; + attr_md.wr_auth = 0; + attr_md.vlen = 0; + + 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 = ble_srv_report_ref_encode(encoded_rep_ref, p_rep_ref); + attr_char_value.init_offs = 0; + attr_char_value.max_len = attr_char_value.init_len; + attr_char_value.p_value = encoded_rep_ref; + + return sd_ble_gatts_descriptor_add(p_rep_char->char_handles.value_handle, + &attr_char_value, + &p_rep_char->ref_handle); +} + + +/**@brief Function for adding Report Map characteristics. + * + * @param[in] p_hids HID Service structure. + * @param[in] p_hids_init Service initialization structure. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t rep_map_char_add(ble_hids_t * p_hids, const ble_hids_init_t * p_hids_init) +{ + uint32_t err_code; + ble_gatts_char_md_t char_md; + ble_gatts_attr_t attr_char_value; + ble_uuid_t ble_uuid; + ble_gatts_attr_md_t attr_md; + + // Add Report Map characteristic + 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; + + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_REPORT_MAP_CHAR); + + memset(&attr_md, 0, sizeof(attr_md)); + + attr_md.read_perm = p_hids_init->rep_map.security_mode.read_perm; + attr_md.write_perm = p_hids_init->rep_map.security_mode.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 = &ble_uuid; + attr_char_value.p_attr_md = &attr_md; + attr_char_value.init_len = p_hids_init->rep_map.data_len; + attr_char_value.init_offs = 0; + attr_char_value.max_len = p_hids_init->rep_map.data_len; + attr_char_value.p_value = p_hids_init->rep_map.p_data; + + err_code = sd_ble_gatts_characteristic_add(p_hids->service_handle, + &char_md, + &attr_char_value, + &p_hids->rep_map_handles); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (p_hids_init->rep_map.ext_rep_ref_num != 0 && p_hids_init->rep_map.p_ext_rep_ref == NULL) + { + return NRF_ERROR_INVALID_PARAM; + } + for (int i = 0; i < p_hids_init->rep_map.ext_rep_ref_num; ++i) + { + uint8_t encoded_rep_ref[sizeof(ble_uuid128_t)]; + uint8_t encoded_rep_ref_len; + + // Add External Report Reference descriptor + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_EXTERNAL_REPORT_REF_DESCR); + + memset(&attr_md, 0, sizeof(attr_md)); + + BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&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 = 0; + + err_code = sd_ble_uuid_encode(&p_hids_init->rep_map.p_ext_rep_ref[i], + &encoded_rep_ref_len, + encoded_rep_ref); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + 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 = encoded_rep_ref_len; + attr_char_value.init_offs = 0; + attr_char_value.max_len = attr_char_value.init_len; + attr_char_value.p_value = encoded_rep_ref; + + err_code = sd_ble_gatts_descriptor_add(p_hids->rep_map_handles.value_handle, + &attr_char_value, + &p_hids->rep_map_ext_rep_ref_handle); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + + return NRF_SUCCESS; +} + + +/**@brief Function for adding Input Report characteristics. + * + * @param[in] p_hids HID Service structure. + * @param[in] uuid UUID of report characteristic to be added. + * @param[in] max_data_len Maximum length of report value. + * @param[in] p_sec_mode Characteristic security settings. + * @param[out] p_char_handles Handles of new characteristic. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t boot_inp_rep_char_add(ble_hids_t * p_hids, + uint16_t uuid, + uint16_t max_data_len, + const ble_srv_cccd_security_mode_t * p_sec_mode, + ble_gatts_char_handles_t * p_char_handles) +{ + 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); + cccd_md.write_perm = p_sec_mode->cccd_write_perm; + cccd_md.vloc = BLE_GATTS_VLOC_STACK; + + memset(&char_md, 0, sizeof(char_md)); + + char_md.char_props.read = 1; + char_md.char_props.write = (p_sec_mode->write_perm.sm) ? 1 : 0; + 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 = &cccd_md; + char_md.p_sccd_md = NULL; + + BLE_UUID_BLE_ASSIGN(ble_uuid, uuid); + + memset(&attr_md, 0, sizeof(attr_md)); + + attr_md.read_perm = p_sec_mode->read_perm; + attr_md.write_perm = p_sec_mode->write_perm; + attr_md.vloc = BLE_GATTS_VLOC_STACK; + attr_md.rd_auth = 0; + attr_md.wr_auth = 0; + attr_md.vlen = 0; + + 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 = max_data_len; + attr_char_value.p_value = NULL; + + return sd_ble_gatts_characteristic_add(p_hids->service_handle, + &char_md, + &attr_char_value, + p_char_handles); +} + + +/**@brief Function for adding Boot Keyboard Output Report characteristics. + * + * @param[in] p_hids HID Service structure. + * @param[in] p_hids_init Service initialization structure. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t boot_kb_outp_rep_char_add(ble_hids_t * p_hids, const ble_hids_init_t * p_hids_init) +{ + ble_gatts_char_md_t char_md; + ble_gatts_attr_t attr_char_value; + ble_uuid_t ble_uuid; + ble_gatts_attr_md_t attr_md; + + memset(&char_md, 0, sizeof(char_md)); + + char_md.char_props.read = 1; + char_md.char_props.write = 1; + 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; + + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_BOOT_KEYBOARD_OUTPUT_REPORT_CHAR); + + memset(&attr_md, 0, sizeof(attr_md)); + + attr_md.read_perm = p_hids_init->security_mode_boot_kb_outp_rep.read_perm; + attr_md.write_perm = p_hids_init->security_mode_boot_kb_outp_rep.write_perm; + attr_md.vloc = BLE_GATTS_VLOC_STACK; + attr_md.rd_auth = 0; + attr_md.wr_auth = 0; + attr_md.vlen = 0; + + 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 = BOOT_KB_OUTPUT_REPORT_MAX_SIZE; + attr_char_value.p_value = NULL; + + return sd_ble_gatts_characteristic_add(p_hids->service_handle, &char_md, &attr_char_value, + &p_hids->boot_kb_outp_rep_handles); +} + + +/**@brief Function for encoding a HID Information characteristic value. + * + * @param[out] p_encoded_buffer Buffer where the encoded data will be written. + * @param[in] p_hid_information Measurement to be encoded. + * + * @return Size of encoded data. + */ +static uint8_t encode_hid_information(uint8_t * p_encoded_buffer, + const ble_hids_hid_information_t * p_hid_information) +{ + uint8_t len = uint16_encode(p_hid_information->bcd_hid, p_encoded_buffer); + + p_encoded_buffer[len++] = p_hid_information->b_country_code; + p_encoded_buffer[len++] = p_hid_information->flags; + + APP_ERROR_CHECK_BOOL(len == ENCODED_HID_INFORMATION_LEN); + + return len; +} + + +/**@brief Function for adding HID Information characteristics. + * + * @param[in] p_hids HID Service structure. + * @param[in] p_hids_init Service initialization structure. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t hid_information_char_add(ble_hids_t * p_hids, const ble_hids_init_t * p_hids_init) +{ + ble_gatts_char_md_t char_md; + ble_gatts_attr_t attr_char_value; + ble_uuid_t ble_uuid; + ble_gatts_attr_md_t attr_md; + uint8_t encoded_hid_information[ENCODED_HID_INFORMATION_LEN]; + uint8_t hid_info_len; + + 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; + + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_HID_INFORMATION_CHAR); + + memset(&attr_md, 0, sizeof(attr_md)); + + attr_md.read_perm = p_hids_init->hid_information.security_mode.read_perm; + attr_md.write_perm = p_hids_init->hid_information.security_mode.write_perm; + attr_md.vloc = BLE_GATTS_VLOC_STACK; + attr_md.rd_auth = 0; + attr_md.wr_auth = 0; + attr_md.vlen = 0; + + hid_info_len = encode_hid_information(encoded_hid_information, &p_hids_init->hid_information); + + 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 = hid_info_len; + attr_char_value.init_offs = 0; + attr_char_value.max_len = attr_char_value.init_len; + attr_char_value.p_value = encoded_hid_information; + + return sd_ble_gatts_characteristic_add(p_hids->service_handle, &char_md, + &attr_char_value, + &p_hids->hid_information_handles); +} + + +/**@brief Function for adding HID Control Point characteristics. + * + * @param[in] p_hids HID Service structure. + * @param[in] p_sec_mode Characteristic security settings. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t hid_control_point_char_add(ble_hids_t * p_hids, + const ble_srv_security_mode_t * p_sec_mode) +{ + ble_gatts_char_md_t char_md; + ble_gatts_attr_t attr_char_value; + ble_uuid_t ble_uuid; + ble_gatts_attr_md_t attr_md; + uint8_t initial_hid_control_point; + + 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; + + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_HID_CONTROL_POINT_CHAR); + + memset(&attr_md, 0, sizeof(attr_md)); + + attr_md.read_perm = p_sec_mode->read_perm; + attr_md.write_perm = p_sec_mode->write_perm; + attr_md.vloc = BLE_GATTS_VLOC_STACK; + attr_md.rd_auth = 0; + attr_md.wr_auth = 0; + attr_md.vlen = 0; + + initial_hid_control_point = INITIAL_VALUE_HID_CONTROL_POINT; + + 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 = sizeof(uint8_t); + attr_char_value.init_offs = 0; + attr_char_value.max_len = sizeof(uint8_t); + attr_char_value.p_value = &initial_hid_control_point; + + return sd_ble_gatts_characteristic_add(p_hids->service_handle, &char_md, + &attr_char_value, + &p_hids->hid_control_point_handles); +} + + +/**@brief Function for adding input report characteristics. + * + * @param[in] p_hids HID Service structure. + * @param[in] p_hids_init Service initialization structure. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t inp_rep_characteristics_add(ble_hids_t * p_hids, + const ble_hids_init_t * p_hids_init) +{ + if ((p_hids_init->inp_rep_count != 0) && (p_hids_init->p_inp_rep_array != NULL)) + { + uint8_t i; + + for (i = 0; i < p_hids_init->inp_rep_count; i++) + { + uint32_t err_code; + ble_hids_inp_rep_init_t * p_rep_init = &p_hids_init->p_inp_rep_array[i]; + ble_gatt_char_props_t properties; + + memset(&properties, 0, sizeof(properties)); + + properties.read = true; + properties.write = p_rep_init->security_mode.write_perm.sm ? 1 : 0; + properties.notify = true; + + err_code = rep_char_add(p_hids, + &properties, + p_rep_init->max_len, + &p_rep_init->rep_ref, + &p_rep_init->security_mode, + p_rep_init->read_resp, + &p_hids->inp_rep_array[i]); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + } + + return NRF_SUCCESS; +} + + +/**@brief Function for adding output report characteristics. + * + * @param[in] p_hids HID Service structure. + * @param[in] p_hids_init Service initialization structure. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t outp_rep_characteristics_add(ble_hids_t * p_hids, + const ble_hids_init_t * p_hids_init) +{ + if ((p_hids_init->outp_rep_count != 0) && (p_hids_init->p_outp_rep_array != NULL)) + { + uint8_t i; + + for (i = 0; i < p_hids_init->outp_rep_count; i++) + { + uint32_t err_code; + ble_hids_outp_rep_init_t * p_rep_init = &p_hids_init->p_outp_rep_array[i]; + ble_gatt_char_props_t properties; + + memset(&properties, 0, sizeof(properties)); + + properties.read = true; + properties.write = true; + properties.write_wo_resp = true; + + err_code = rep_char_add(p_hids, + &properties, + p_rep_init->max_len, + &p_rep_init->rep_ref, + &p_rep_init->security_mode, + p_rep_init->read_resp, + &p_hids->outp_rep_array[i]); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + } + + return NRF_SUCCESS; +} + + +/**@brief Function for adding feature report characteristics. + * + * @param[in] p_hids HID Service structure. + * @param[in] p_hids_init Service initialization structure. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t feature_rep_characteristics_add(ble_hids_t * p_hids, + const ble_hids_init_t * p_hids_init) +{ + if ((p_hids_init->feature_rep_count != 0) && (p_hids_init->p_feature_rep_array != NULL)) + { + uint8_t i; + + for (i = 0; i < p_hids_init->feature_rep_count; i++) + { + uint32_t err_code; + ble_hids_feature_rep_init_t * p_rep_init = &p_hids_init->p_feature_rep_array[i]; + ble_gatt_char_props_t properties; + + memset(&properties, 0, sizeof(properties)); + + properties.read = true; + properties.write = true; + + err_code = rep_char_add(p_hids, + &properties, + p_rep_init->max_len, + &p_rep_init->rep_ref, + &p_rep_init->security_mode, + p_rep_init->read_resp, + &p_hids->feature_rep_array[i]); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + } + + return NRF_SUCCESS; +} + + +/**@brief Function for adding included services. + * + * @param[in] p_hids HID Service structure. + * @param[in] p_hids_init Service initialization structure. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t includes_add(ble_hids_t * p_hids, const ble_hids_init_t * p_hids_init) +{ + uint32_t err_code; + uint8_t i; + uint16_t unused_include_handle; + + for (i = 0; i < p_hids_init->included_services_count; i++) + { + err_code = sd_ble_gatts_include_add(p_hids->service_handle, + p_hids_init->p_included_services_array[i], + &unused_include_handle); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + + return NRF_SUCCESS; +} + + +uint32_t ble_hids_init(ble_hids_t * p_hids, const ble_hids_init_t * p_hids_init) +{ + uint32_t err_code; + ble_uuid_t ble_uuid; + + if ((p_hids_init->inp_rep_count > BLE_HIDS_MAX_INPUT_REP) || + (p_hids_init->outp_rep_count > BLE_HIDS_MAX_OUTPUT_REP) || + (p_hids_init->feature_rep_count > BLE_HIDS_MAX_FEATURE_REP) + ) + { + return NRF_ERROR_INVALID_PARAM; + } + + // Initialize service structure. + p_hids->evt_handler = p_hids_init->evt_handler; + p_hids->error_handler = p_hids_init->error_handler; + p_hids->inp_rep_count = p_hids_init->inp_rep_count; + p_hids->outp_rep_count = p_hids_init->outp_rep_count; + p_hids->feature_rep_count = p_hids_init->feature_rep_count; + p_hids->conn_handle = BLE_CONN_HANDLE_INVALID; + + // Add service. + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_HUMAN_INTERFACE_DEVICE_SERVICE); + + err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, + &ble_uuid, + &p_hids->service_handle); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add includes. + err_code = includes_add(p_hids, p_hids_init); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (p_hids_init->is_kb || p_hids_init->is_mouse) + { + // Add Protocol Mode characteristic. + err_code = protocol_mode_char_add(p_hids, &p_hids_init->security_mode_protocol); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + + // Add Input Report characteristics (if any). + err_code = inp_rep_characteristics_add(p_hids, p_hids_init); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add Output Report characteristics (if any). + err_code = outp_rep_characteristics_add(p_hids, p_hids_init); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add Feature Report characteristic (if any). + err_code = feature_rep_characteristics_add(p_hids, p_hids_init); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add Report Map characteristic. + err_code = rep_map_char_add(p_hids, p_hids_init); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (p_hids_init->is_kb) + { + // Add Boot Keyboard Input Report characteristic. + err_code = boot_inp_rep_char_add(p_hids, + BLE_UUID_BOOT_KEYBOARD_INPUT_REPORT_CHAR, + BOOT_KB_INPUT_REPORT_MAX_SIZE, + &p_hids_init->security_mode_boot_kb_inp_rep, + &p_hids->boot_kb_inp_rep_handles); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add Boot Keyboard Output Report characteristic. + err_code = boot_kb_outp_rep_char_add(p_hids, p_hids_init); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + + if (p_hids_init->is_mouse) + { + // Add Boot Mouse Input Report characteristic. + err_code = boot_inp_rep_char_add(p_hids, + BLE_UUID_BOOT_MOUSE_INPUT_REPORT_CHAR, + BOOT_MOUSE_INPUT_REPORT_MAX_SIZE, + &p_hids_init->security_mode_boot_mouse_inp_rep, + &p_hids->boot_mouse_inp_rep_handles); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + + // Add HID Information characteristic. + err_code = hid_information_char_add(p_hids, p_hids_init); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add HID Control Point characteristic. + err_code = hid_control_point_char_add(p_hids, &p_hids_init->security_mode_ctrl_point); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + return NRF_SUCCESS; +} + + +uint32_t ble_hids_inp_rep_send(ble_hids_t * p_hids, + uint8_t rep_index, + uint16_t len, + uint8_t * p_data) +{ + uint32_t err_code; + + if (rep_index < p_hids->inp_rep_count) + { + ble_hids_rep_char_t * p_rep_char = &p_hids->inp_rep_array[rep_index]; + + if (p_hids->conn_handle != BLE_CONN_HANDLE_INVALID) + { + ble_gatts_hvx_params_t hvx_params; + uint16_t hvx_len = len; + + memset(&hvx_params, 0, sizeof(hvx_params)); + + hvx_params.handle = p_rep_char->char_handles.value_handle; + hvx_params.type = BLE_GATT_HVX_NOTIFICATION; + hvx_params.offset = 0; + hvx_params.p_len = &hvx_len; + hvx_params.p_data = p_data; + + err_code = sd_ble_gatts_hvx(p_hids->conn_handle, &hvx_params); + if ((err_code == NRF_SUCCESS) && (hvx_len != len)) + { + err_code = NRF_ERROR_DATA_SIZE; + } + } + else + { + err_code = NRF_ERROR_INVALID_STATE; + } + } + else + { + err_code = NRF_ERROR_INVALID_PARAM; + } + + return err_code; +} + + +uint32_t ble_hids_boot_kb_inp_rep_send(ble_hids_t * p_hids, uint16_t len, uint8_t * p_data) +{ + uint32_t err_code; + + if (p_hids->conn_handle != BLE_CONN_HANDLE_INVALID) + { + ble_gatts_hvx_params_t hvx_params; + uint16_t hvx_len = len; + + memset(&hvx_params, 0, sizeof(hvx_params)); + + hvx_params.handle = p_hids->boot_kb_inp_rep_handles.value_handle; + hvx_params.type = BLE_GATT_HVX_NOTIFICATION; + hvx_params.offset = 0; + hvx_params.p_len = &hvx_len; + hvx_params.p_data = p_data; + + err_code = sd_ble_gatts_hvx(p_hids->conn_handle, &hvx_params); + if ((err_code == NRF_SUCCESS) && (hvx_len != len)) + { + err_code = NRF_ERROR_DATA_SIZE; + } + } + else + { + err_code = NRF_ERROR_INVALID_STATE; + } + + return err_code; +} + + +uint32_t ble_hids_boot_mouse_inp_rep_send(ble_hids_t * p_hids, + uint8_t buttons, + int8_t x_delta, + int8_t y_delta, + uint16_t optional_data_len, + uint8_t * p_optional_data) +{ + uint32_t err_code; + + if (p_hids->conn_handle != BLE_CONN_HANDLE_INVALID) + { + uint16_t hvx_len = BOOT_MOUSE_INPUT_REPORT_MIN_SIZE + optional_data_len; + + if (hvx_len <= BOOT_MOUSE_INPUT_REPORT_MAX_SIZE) + { + uint8_t buffer[BOOT_MOUSE_INPUT_REPORT_MAX_SIZE]; + ble_gatts_hvx_params_t hvx_params; + + APP_ERROR_CHECK_BOOL(BOOT_MOUSE_INPUT_REPORT_MIN_SIZE == 3); + + // Build buffer + buffer[0] = buttons; + buffer[1] = (uint8_t)x_delta; + buffer[2] = (uint8_t)y_delta; + + if (optional_data_len > 0) + { + memcpy(&buffer[3], p_optional_data, optional_data_len); + } + + // Pass buffer to stack + memset(&hvx_params, 0, sizeof(hvx_params)); + + hvx_params.handle = p_hids->boot_mouse_inp_rep_handles.value_handle; + hvx_params.type = BLE_GATT_HVX_NOTIFICATION; + hvx_params.offset = 0; + hvx_params.p_len = &hvx_len; + hvx_params.p_data = buffer; + + err_code = sd_ble_gatts_hvx(p_hids->conn_handle, &hvx_params); + if ((err_code == NRF_SUCCESS) && + (hvx_len != BOOT_MOUSE_INPUT_REPORT_MIN_SIZE + optional_data_len) + ) + { + err_code = NRF_ERROR_DATA_SIZE; + } + } + else + { + err_code = NRF_ERROR_DATA_SIZE; + } + } + else + { + err_code = NRF_ERROR_INVALID_STATE; + } + + return err_code; +} + + +uint32_t ble_hids_outp_rep_get(ble_hids_t * p_hids, + uint8_t rep_index, + uint16_t len, + uint8_t offset, + uint8_t * p_outp_rep) +{ + ble_gatts_value_t gatts_value; + + // Initialize value struct. + memset(&gatts_value, 0, sizeof(gatts_value)); + + gatts_value.len = len; + gatts_value.offset = offset; + gatts_value.p_value = p_outp_rep; + + return sd_ble_gatts_value_get(p_hids->conn_handle, + p_hids->outp_rep_array[rep_index].char_handles.value_handle, + &gatts_value); +} + +/** + @} +*/ diff --git a/components/ble/ble_services/ble_hids/ble_hids.h b/components/ble/ble_services/ble_hids/ble_hids.h new file mode 100644 index 0000000..ff18e00 --- /dev/null +++ b/components/ble/ble_services/ble_hids/ble_hids.h @@ -0,0 +1,314 @@ +/* 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 ble_sdk_srv_hids Human Interface Device Service + * @{ + * @ingroup ble_sdk_srv + * @brief Human Interface Device Service module. + * + * @details This module implements the Human Interface Device Service with the corresponding set of + * characteristics. During initialization it adds the Human Interface Device Service and + * a set of characteristics as per the Human Interface Device Service specification and + * the user requirements to the BLE stack database. + * + * If enabled, notification of Input Report characteristics is performed when the + * application calls the corresponding ble_hids_xx_input_report_send() function. + * + * If an event handler is supplied by the application, the Human Interface Device Service + * will generate Human Interface Device Service events to the application. + * + * @note The application must propagate BLE stack events to the Human Interface Device Service + * module by calling ble_hids_on_ble_evt() from the @ref softdevice_handler callback. + * + * @note Attention! + * To maintain compliance with Nordic Semiconductor ASA Bluetooth profile + * qualification listings, this section of source code must not be modified. + */ + +#ifndef BLE_HIDS_H__ +#define BLE_HIDS_H__ + +#include +#include +#include "ble.h" +#include "ble_srv_common.h" + +/** @name Report Type values + * @anchor BLE_HIDS_REPORT_TYPE @{ + */ +// Report Type values +#define BLE_HIDS_REP_TYPE_INPUT 1 +#define BLE_HIDS_REP_TYPE_OUTPUT 2 +#define BLE_HIDS_REP_TYPE_FEATURE 3 +/** @} */ + +// Maximum number of the various Report Types +#define BLE_HIDS_MAX_INPUT_REP 10 +#define BLE_HIDS_MAX_OUTPUT_REP 10 +#define BLE_HIDS_MAX_FEATURE_REP 10 + +// Information Flags +#define HID_INFO_FLAG_REMOTE_WAKE_MSK 0x01 +#define HID_INFO_FLAG_NORMALLY_CONNECTABLE_MSK 0x02 + +/**@brief HID Service characteristic id. */ +typedef struct +{ + uint16_t uuid; /**< UUID of characteristic. */ + uint8_t rep_type; /**< Type of report (only used for BLE_UUID_REPORT_CHAR, see @ref BLE_HIDS_REPORT_TYPE). */ + uint8_t rep_index; /**< Index of the characteristic (only used for BLE_UUID_REPORT_CHAR). */ +} ble_hids_char_id_t; + +/**@brief HID Service event type. */ +typedef enum +{ + BLE_HIDS_EVT_HOST_SUSP, /**< Suspend command received. */ + BLE_HIDS_EVT_HOST_EXIT_SUSP, /**< Exit suspend command received. */ + BLE_HIDS_EVT_NOTIF_ENABLED, /**< Notification enabled event. */ + BLE_HIDS_EVT_NOTIF_DISABLED, /**< Notification disabled event. */ + BLE_HIDS_EVT_REP_CHAR_WRITE, /**< A new value has been written to an Report characteristic. */ + BLE_HIDS_EVT_BOOT_MODE_ENTERED, /**< Boot mode entered. */ + BLE_HIDS_EVT_REPORT_MODE_ENTERED, /**< Report mode entered. */ + BLE_HIDS_EVT_REPORT_READ /**< Read with response */ +} ble_hids_evt_type_t; + +/**@brief HID Service event. */ +typedef struct +{ + ble_hids_evt_type_t evt_type; /**< Type of event. */ + union + { + struct + { + ble_hids_char_id_t char_id; /**< Id of characteristic for which notification has been started. */ + } notification; + struct + { + ble_hids_char_id_t char_id; /**< Id of characteristic having been written. */ + uint16_t offset; /**< Offset for the write operation. */ + uint16_t len; /**< Length of the incoming data. */ + uint8_t* data; /**< Incoming data, variable length */ + } char_write; + struct + { + ble_hids_char_id_t char_id; /**< Id of characteristic being read. */ + } char_auth_read; + } params; + ble_evt_t * p_ble_evt; /**< corresponding received ble event, NULL if not relevant */ +} ble_hids_evt_t; + +// Forward declaration of the ble_hids_t type. +typedef struct ble_hids_s ble_hids_t; + +/**@brief HID Service event handler type. */ +typedef void (*ble_hids_evt_handler_t) (ble_hids_t * p_hids, ble_hids_evt_t * p_evt); + +/**@brief HID Information characteristic value. */ +typedef struct +{ + uint16_t bcd_hid; /**< 16-bit unsigned integer representing version number of base USB HID Specification implemented by HID Device */ + uint8_t b_country_code; /**< Identifies which country the hardware is localized for. Most hardware is not localized and thus this value would be zero (0). */ + uint8_t flags; /**< See http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.hid_information.xml */ + ble_srv_security_mode_t security_mode; /**< Security mode for the HID Information characteristic. */ +} ble_hids_hid_information_t; + +/**@brief HID Service Input Report characteristic init structure. This contains all options and + * data needed for initialization of one Input Report characteristic. */ +typedef struct +{ + uint16_t max_len; /**< Maximum length of characteristic value. */ + ble_srv_report_ref_t rep_ref; /**< Value of the Report Reference descriptor. */ + ble_srv_cccd_security_mode_t security_mode; /**< Security mode for the HID Input Report characteristic, including cccd. */ + uint8_t read_resp : 1; /**< Should application generate a response to read requests. */ +} ble_hids_inp_rep_init_t; + +/**@brief HID Service Output Report characteristic init structure. This contains all options and + * data needed for initialization of one Output Report characteristic. */ +typedef struct +{ + uint16_t max_len; /**< Maximum length of characteristic value. */ + ble_srv_report_ref_t rep_ref; /**< Value of the Report Reference descriptor. */ + ble_srv_cccd_security_mode_t security_mode; /**< Security mode for the HID Output Report characteristic, including cccd. */ + uint8_t read_resp : 1; /**< Should application generate a response to read requests. */ +} ble_hids_outp_rep_init_t; + +/**@brief HID Service Feature Report characteristic init structure. This contains all options and + * data needed for initialization of one Feature Report characteristic. */ +typedef struct +{ + uint16_t max_len; /**< Maximum length of characteristic value. */ + ble_srv_report_ref_t rep_ref; /**< Value of the Report Reference descriptor. */ + ble_srv_cccd_security_mode_t security_mode; /**< Security mode for the HID Service Feature Report characteristic, including cccd. */ + uint8_t read_resp : 1; /**< Should application generate a response to read requests. */ +} ble_hids_feature_rep_init_t; + +/**@brief HID Service Report Map characteristic init structure. This contains all options and data + * needed for initialization of the Report Map characteristic. */ +typedef struct +{ + uint8_t * p_data; /**< Report map data. */ + uint16_t data_len; /**< Length of report map data. */ + uint8_t ext_rep_ref_num; /**< Number of Optional External Report Reference descriptors. */ + ble_uuid_t * p_ext_rep_ref; /**< Optional External Report Reference descriptor (will be added if != NULL). */ + ble_srv_security_mode_t security_mode; /**< Security mode for the HID Service Report Map characteristic. */ +} ble_hids_rep_map_init_t; + +/**@brief HID Report characteristic structure. */ +typedef struct +{ + ble_gatts_char_handles_t char_handles; /**< Handles related to the Report characteristic. */ + uint16_t ref_handle; /**< Handle of the Report Reference descriptor. */ +} ble_hids_rep_char_t; + +/**@brief HID Service init structure. This contains all options and data needed for initialization + * of the service. */ +typedef struct +{ + ble_hids_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the HID Service. */ + ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */ + bool is_kb; /**< TRUE if device is operating as a keyboard, FALSE if it is not. */ + bool is_mouse; /**< TRUE if device is operating as a mouse, FALSE if it is not. */ + uint8_t inp_rep_count; /**< Number of Input Report characteristics. */ + ble_hids_inp_rep_init_t * p_inp_rep_array; /**< Information about the Input Report characteristics. */ + uint8_t outp_rep_count; /**< Number of Output Report characteristics. */ + ble_hids_outp_rep_init_t * p_outp_rep_array; /**< Information about the Output Report characteristics. */ + uint8_t feature_rep_count; /**< Number of Feature Report characteristics. */ + ble_hids_feature_rep_init_t * p_feature_rep_array; /**< Information about the Feature Report characteristics. */ + ble_hids_rep_map_init_t rep_map; /**< Information nedeed for initialization of the Report Map characteristic. */ + ble_hids_hid_information_t hid_information; /**< Value of the HID Information characteristic. */ + uint8_t included_services_count; /**< Number of services to include in HID service. */ + uint16_t * p_included_services_array; /**< Array of services to include in HID service. */ + ble_srv_security_mode_t security_mode_protocol; /**< Security settings for HID service protocol attribute */ + ble_srv_security_mode_t security_mode_ctrl_point; /**< Security settings for HID service Control Point attribute */ + ble_srv_cccd_security_mode_t security_mode_boot_mouse_inp_rep; /**< Security settings for HID service Mouse input report attribute */ + ble_srv_cccd_security_mode_t security_mode_boot_kb_inp_rep; /**< Security settings for HID service Keyboard input report attribute */ + ble_srv_security_mode_t security_mode_boot_kb_outp_rep; /**< Security settings for HID service Keyboard output report attribute */ +} ble_hids_init_t; + +/**@brief HID Service structure. This contains various status information for the service. */ +struct ble_hids_s +{ + ble_hids_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the HID Service. */ + ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */ + uint16_t service_handle; /**< Handle of HID Service (as provided by the BLE stack). */ + ble_gatts_char_handles_t protocol_mode_handles; /**< Handles related to the Protocol Mode characteristic (will only be created if ble_hids_init_t.is_kb or ble_hids_init_t.is_mouse is set). */ + uint8_t inp_rep_count; /**< Number of Input Report characteristics. */ + ble_hids_rep_char_t inp_rep_array[BLE_HIDS_MAX_INPUT_REP]; /**< Information about the Input Report characteristics. */ + uint8_t outp_rep_count; /**< Number of Output Report characteristics. */ + ble_hids_rep_char_t outp_rep_array[BLE_HIDS_MAX_OUTPUT_REP]; /**< Information about the Output Report characteristics. */ + uint8_t feature_rep_count; /**< Number of Feature Report characteristics. */ + ble_hids_rep_char_t feature_rep_array[BLE_HIDS_MAX_FEATURE_REP]; /**< Information about the Feature Report characteristics. */ + ble_gatts_char_handles_t rep_map_handles; /**< Handles related to the Report Map characteristic. */ + uint16_t rep_map_ext_rep_ref_handle; /**< Handle of the Report Map External Report Reference descriptor. */ + ble_gatts_char_handles_t boot_kb_inp_rep_handles; /**< Handles related to the Boot Keyboard Input Report characteristic (will only be created if ble_hids_init_t.is_kb is set). */ + ble_gatts_char_handles_t boot_kb_outp_rep_handles; /**< Handles related to the Boot Keyboard Output Report characteristic (will only be created if ble_hids_init_t.is_kb is set). */ + ble_gatts_char_handles_t boot_mouse_inp_rep_handles; /**< Handles related to the Boot Mouse Input Report characteristic (will only be created if ble_hids_init_t.is_mouse is set). */ + ble_gatts_char_handles_t hid_information_handles; /**< Handles related to the Report Map characteristic. */ + ble_gatts_char_handles_t hid_control_point_handles; /**< Handles related to the Report Map characteristic. */ + uint16_t conn_handle; /**< Handle of the current connection (as provided by the BLE stack, is BLE_CONN_HANDLE_INVALID if not in a connection). */ +}; + +/**@brief Function for initializing the HID Service. + * + * @param[out] p_hids HID 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 this particular service instance. + * @param[in] p_hids_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on successful initialization of service, otherwise an error code. + */ +uint32_t ble_hids_init(ble_hids_t * p_hids, const ble_hids_init_t * p_hids_init); + +/**@brief Function for handling the Application's BLE Stack events. + * + * @details Handles all events from the BLE stack of interest to the HID Service. + * + * @param[in] p_hids HID Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +void ble_hids_on_ble_evt(ble_hids_t * p_hids, ble_evt_t * p_ble_evt); + +/**@brief Function for sending Input Report. + * + * @details Sends data on an Input Report characteristic. + * + * @param[in] p_hids HID Service structure. + * @param[in] rep_index Index of the characteristic (corresponding to the index in + * ble_hids_t.inp_rep_array as passed to ble_hids_init()). + * @param[in] len Length of data to be sent. + * @param[in] p_data Pointer to data to be sent. + * + * @return NRF_SUCCESS on successful sending of input report, otherwise an error code. + */ +uint32_t ble_hids_inp_rep_send(ble_hids_t * p_hids, + uint8_t rep_index, + uint16_t len, + uint8_t * p_data); + +/**@brief Function for sending Boot Keyboard Input Report. + * + * @details Sends data on an Boot Keyboard Input Report characteristic. + * + * @param[in] p_hids HID Service structure. + * @param[in] len Length of data to be sent. + * @param[in] p_data Pointer to data to be sent. + * + * @return NRF_SUCCESS on successful sending of the report, otherwise an error code. + */ +uint32_t ble_hids_boot_kb_inp_rep_send(ble_hids_t * p_hids, + uint16_t len, + uint8_t * p_data); + +/**@brief Function for sending Boot Mouse Input Report. + * + * @details Sends data on an Boot Mouse Input Report characteristic. + * + * @param[in] p_hids HID Service structure. + * @param[in] buttons State of mouse buttons. + * @param[in] x_delta Horizontal movement. + * @param[in] y_delta Vertical movement. + * @param[in] optional_data_len Length of optional part of Boot Mouse Input Report. + * @param[in] p_optional_data Optional part of Boot Mouse Input Report. + * + * @return NRF_SUCCESS on successful sending of the report, otherwise an error code. + */ +uint32_t ble_hids_boot_mouse_inp_rep_send(ble_hids_t * p_hids, + uint8_t buttons, + int8_t x_delta, + int8_t y_delta, + uint16_t optional_data_len, + uint8_t * p_optional_data); + +/**@brief Function for getting the current value of Output Report from the stack. + * + * @details Fetches the current value of the output report characteristic from the stack. + * + * @param[in] p_hids HID Service structure. + * @param[in] rep_index Index of the characteristic (corresponding to the index in + * ble_hids_t.outp_rep_array as passed to ble_hids_init()). + * @param[in] len Length of output report needed. + * @param[in] offset Offset in bytes to read from. + * @param[out] p_outp_rep Pointer to the output report. + * + * @return NRF_SUCCESS on successful read of the report, otherwise an error code. + */ +uint32_t ble_hids_outp_rep_get(ble_hids_t * p_hids, + uint8_t rep_index, + uint16_t len, + uint8_t offset, + uint8_t * p_outp_rep); + +#endif // BLE_HIDS_H__ + +/** @} */ diff --git a/components/ble/ble_services/ble_hrs/ble_hrs.c b/components/ble/ble_services/ble_hrs/ble_hrs.c new file mode 100644 index 0000000..4975f07 --- /dev/null +++ b/components/ble/ble_services/ble_hrs/ble_hrs.c @@ -0,0 +1,440 @@ +/* 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. + * + */ + +/* Attention! +* To maintain compliance with Nordic Semiconductor ASAs Bluetooth profile +* qualification listings, this section of source code must not be modified. +*/ + +#include "ble_hrs.h" +#include +#include "nordic_common.h" +#include "ble_l2cap.h" +#include "ble_srv_common.h" +#include "app_util.h" + + +#define OPCODE_LENGTH 1 /**< Length of opcode inside Heart Rate Measurement packet. */ +#define HANDLE_LENGTH 2 /**< Length of handle inside Heart Rate Measurement packet. */ +#define MAX_HRM_LEN (BLE_L2CAP_MTU_DEF - OPCODE_LENGTH - HANDLE_LENGTH) /**< Maximum size of a transmitted Heart Rate Measurement. */ + +#define INITIAL_VALUE_HRM 0 /**< Initial Heart Rate Measurement value. */ + +// Heart Rate Measurement flag bits +#define HRM_FLAG_MASK_HR_VALUE_16BIT (0x01 << 0) /**< Heart Rate Value Format bit. */ +#define HRM_FLAG_MASK_SENSOR_CONTACT_DETECTED (0x01 << 1) /**< Sensor Contact Detected bit. */ +#define HRM_FLAG_MASK_SENSOR_CONTACT_SUPPORTED (0x01 << 2) /**< Sensor Contact Supported bit. */ +#define HRM_FLAG_MASK_EXPENDED_ENERGY_INCLUDED (0x01 << 3) /**< Energy Expended Status bit. Feature Not Supported */ +#define HRM_FLAG_MASK_RR_INTERVAL_INCLUDED (0x01 << 4) /**< RR-Interval bit. */ + + +/**@brief Function for handling the Connect event. + * + * @param[in] p_hrs Heart Rate Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_connect(ble_hrs_t * p_hrs, ble_evt_t * p_ble_evt) +{ + p_hrs->conn_handle = p_ble_evt->evt.gap_evt.conn_handle; +} + + +/**@brief Function for handling the Disconnect event. + * + * @param[in] p_hrs Heart Rate Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_disconnect(ble_hrs_t * p_hrs, ble_evt_t * p_ble_evt) +{ + UNUSED_PARAMETER(p_ble_evt); + p_hrs->conn_handle = BLE_CONN_HANDLE_INVALID; +} + + +/**@brief Function for handling write events to the Heart Rate Measurement characteristic. + * + * @param[in] p_hrs Heart Rate Service structure. + * @param[in] p_evt_write Write event received from the BLE stack. + */ +static void on_hrm_cccd_write(ble_hrs_t * p_hrs, ble_gatts_evt_write_t * p_evt_write) +{ + if (p_evt_write->len == 2) + { + // CCCD written, update notification state + if (p_hrs->evt_handler != NULL) + { + ble_hrs_evt_t evt; + + if (ble_srv_is_notification_enabled(p_evt_write->data)) + { + evt.evt_type = BLE_HRS_EVT_NOTIFICATION_ENABLED; + } + else + { + evt.evt_type = BLE_HRS_EVT_NOTIFICATION_DISABLED; + } + + p_hrs->evt_handler(p_hrs, &evt); + } + } +} + + +/**@brief Function for handling the Write event. + * + * @param[in] p_hrs Heart Rate Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_write(ble_hrs_t * p_hrs, ble_evt_t * p_ble_evt) +{ + ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write; + + if (p_evt_write->handle == p_hrs->hrm_handles.cccd_handle) + { + on_hrm_cccd_write(p_hrs, p_evt_write); + } +} + + +void ble_hrs_on_ble_evt(ble_hrs_t * p_hrs, ble_evt_t * p_ble_evt) +{ + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + on_connect(p_hrs, p_ble_evt); + break; + + case BLE_GAP_EVT_DISCONNECTED: + on_disconnect(p_hrs, p_ble_evt); + break; + + case BLE_GATTS_EVT_WRITE: + on_write(p_hrs, p_ble_evt); + break; + + default: + // No implementation needed. + break; + } +} + + +/**@brief Function for encoding a Heart Rate Measurement. + * + * @param[in] p_hrs Heart Rate Service structure. + * @param[in] heart_rate Measurement to be encoded. + * @param[out] p_encoded_buffer Buffer where the encoded data will be written. + * + * @return Size of encoded data. + */ +static uint8_t hrm_encode(ble_hrs_t * p_hrs, uint16_t heart_rate, uint8_t * p_encoded_buffer) +{ + uint8_t flags = 0; + uint8_t len = 1; + int i; + + // Set sensor contact related flags + if (p_hrs->is_sensor_contact_supported) + { + flags |= HRM_FLAG_MASK_SENSOR_CONTACT_SUPPORTED; + } + if (p_hrs->is_sensor_contact_detected) + { + flags |= HRM_FLAG_MASK_SENSOR_CONTACT_DETECTED; + } + + // Encode heart rate measurement + if (heart_rate > 0xff) + { + flags |= HRM_FLAG_MASK_HR_VALUE_16BIT; + len += uint16_encode(heart_rate, &p_encoded_buffer[len]); + } + else + { + p_encoded_buffer[len++] = (uint8_t)heart_rate; + } + + // Encode rr_interval values + if (p_hrs->rr_interval_count > 0) + { + flags |= HRM_FLAG_MASK_RR_INTERVAL_INCLUDED; + } + for (i = 0; i < p_hrs->rr_interval_count; i++) + { + if (len + sizeof(uint16_t) > MAX_HRM_LEN) + { + // Not all stored rr_interval values can fit into the encoded hrm, + // move the remaining values to the start of the buffer. + memmove(&p_hrs->rr_interval[0], + &p_hrs->rr_interval[i], + (p_hrs->rr_interval_count - i) * sizeof(uint16_t)); + break; + } + len += uint16_encode(p_hrs->rr_interval[i], &p_encoded_buffer[len]); + } + p_hrs->rr_interval_count -= i; + + // Add flags + p_encoded_buffer[0] = flags; + + return len; +} + + +/**@brief Function for adding the Heart Rate Measurement characteristic. + * + * @param[in] p_hrs Heart Rate Service structure. + * @param[in] p_hrs_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t heart_rate_measurement_char_add(ble_hrs_t * p_hrs, + const ble_hrs_init_t * p_hrs_init) +{ + 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; + uint8_t encoded_initial_hrm[MAX_HRM_LEN]; + + memset(&cccd_md, 0, sizeof(cccd_md)); + + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm); + cccd_md.write_perm = p_hrs_init->hrs_hrm_attr_md.cccd_write_perm; + cccd_md.vloc = BLE_GATTS_VLOC_STACK; + + memset(&char_md, 0, sizeof(char_md)); + + 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 = &cccd_md; + char_md.p_sccd_md = NULL; + + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_HEART_RATE_MEASUREMENT_CHAR); + + memset(&attr_md, 0, sizeof(attr_md)); + + attr_md.read_perm = p_hrs_init->hrs_hrm_attr_md.read_perm; + attr_md.write_perm = p_hrs_init->hrs_hrm_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 = &ble_uuid; + attr_char_value.p_attr_md = &attr_md; + attr_char_value.init_len = hrm_encode(p_hrs, INITIAL_VALUE_HRM, encoded_initial_hrm); + attr_char_value.init_offs = 0; + attr_char_value.max_len = MAX_HRM_LEN; + attr_char_value.p_value = encoded_initial_hrm; + + return sd_ble_gatts_characteristic_add(p_hrs->service_handle, + &char_md, + &attr_char_value, + &p_hrs->hrm_handles); +} + + +/**@brief Function for adding the Body Sensor Location characteristic. + * + * @param[in] p_hrs Heart Rate Service structure. + * @param[in] p_hrs_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t body_sensor_location_char_add(ble_hrs_t * p_hrs, const ble_hrs_init_t * p_hrs_init) +{ + ble_gatts_char_md_t char_md; + ble_gatts_attr_t attr_char_value; + ble_uuid_t ble_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; + + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_BODY_SENSOR_LOCATION_CHAR); + + memset(&attr_md, 0, sizeof(attr_md)); + + attr_md.read_perm = p_hrs_init->hrs_bsl_attr_md.read_perm; + attr_md.write_perm = p_hrs_init->hrs_bsl_attr_md.write_perm; + attr_md.vloc = BLE_GATTS_VLOC_STACK; + attr_md.rd_auth = 0; + attr_md.wr_auth = 0; + attr_md.vlen = 0; + + 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 = sizeof (uint8_t); + attr_char_value.init_offs = 0; + attr_char_value.max_len = sizeof (uint8_t); + attr_char_value.p_value = p_hrs_init->p_body_sensor_location; + + return sd_ble_gatts_characteristic_add(p_hrs->service_handle, + &char_md, + &attr_char_value, + &p_hrs->bsl_handles); +} + + +uint32_t ble_hrs_init(ble_hrs_t * p_hrs, const ble_hrs_init_t * p_hrs_init) +{ + uint32_t err_code; + ble_uuid_t ble_uuid; + + // Initialize service structure + p_hrs->evt_handler = p_hrs_init->evt_handler; + p_hrs->is_sensor_contact_supported = p_hrs_init->is_sensor_contact_supported; + p_hrs->conn_handle = BLE_CONN_HANDLE_INVALID; + p_hrs->is_sensor_contact_detected = false; + p_hrs->rr_interval_count = 0; + + // Add service + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_HEART_RATE_SERVICE); + + err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, + &ble_uuid, + &p_hrs->service_handle); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add heart rate measurement characteristic + err_code = heart_rate_measurement_char_add(p_hrs, p_hrs_init); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (p_hrs_init->p_body_sensor_location != NULL) + { + // Add body sensor location characteristic + err_code = body_sensor_location_char_add(p_hrs, p_hrs_init); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + + return NRF_SUCCESS; +} + + +uint32_t ble_hrs_heart_rate_measurement_send(ble_hrs_t * p_hrs, uint16_t heart_rate) +{ + uint32_t err_code; + + // Send value if connected and notifying + if (p_hrs->conn_handle != BLE_CONN_HANDLE_INVALID) + { + uint8_t encoded_hrm[MAX_HRM_LEN]; + uint16_t len; + uint16_t hvx_len; + ble_gatts_hvx_params_t hvx_params; + + len = hrm_encode(p_hrs, heart_rate, encoded_hrm); + hvx_len = len; + + memset(&hvx_params, 0, sizeof(hvx_params)); + + hvx_params.handle = p_hrs->hrm_handles.value_handle; + hvx_params.type = BLE_GATT_HVX_NOTIFICATION; + hvx_params.offset = 0; + hvx_params.p_len = &hvx_len; + hvx_params.p_data = encoded_hrm; + + err_code = sd_ble_gatts_hvx(p_hrs->conn_handle, &hvx_params); + if ((err_code == NRF_SUCCESS) && (hvx_len != len)) + { + err_code = NRF_ERROR_DATA_SIZE; + } + } + else + { + err_code = NRF_ERROR_INVALID_STATE; + } + + return err_code; +} + + +void ble_hrs_rr_interval_add(ble_hrs_t * p_hrs, uint16_t rr_interval) +{ + if (p_hrs->rr_interval_count == BLE_HRS_MAX_BUFFERED_RR_INTERVALS) + { + // The rr_interval buffer is full, delete the oldest value + memmove(&p_hrs->rr_interval[0], + &p_hrs->rr_interval[1], + (BLE_HRS_MAX_BUFFERED_RR_INTERVALS - 1) * sizeof(uint16_t)); + p_hrs->rr_interval_count--; + } + + // Add new value + p_hrs->rr_interval[p_hrs->rr_interval_count++] = rr_interval; +} + + +bool ble_hrs_rr_interval_buffer_is_full(ble_hrs_t * p_hrs) +{ + return (p_hrs->rr_interval_count == BLE_HRS_MAX_BUFFERED_RR_INTERVALS); +} + + +uint32_t ble_hrs_sensor_contact_supported_set(ble_hrs_t * p_hrs, bool is_sensor_contact_supported) +{ + // Check if we are connected to peer + if (p_hrs->conn_handle == BLE_CONN_HANDLE_INVALID) + { + p_hrs->is_sensor_contact_supported = is_sensor_contact_supported; + return NRF_SUCCESS; + } + else + { + return NRF_ERROR_INVALID_STATE; + } +} + + +void ble_hrs_sensor_contact_detected_update(ble_hrs_t * p_hrs, bool is_sensor_contact_detected) +{ + p_hrs->is_sensor_contact_detected = is_sensor_contact_detected; +} + + +uint32_t ble_hrs_body_sensor_location_set(ble_hrs_t * p_hrs, uint8_t body_sensor_location) +{ + ble_gatts_value_t gatts_value; + + // Initialize value struct. + memset(&gatts_value, 0, sizeof(gatts_value)); + + gatts_value.len = sizeof(uint8_t); + gatts_value.offset = 0; + gatts_value.p_value = &body_sensor_location; + + return sd_ble_gatts_value_set(p_hrs->conn_handle, p_hrs->bsl_handles.value_handle, &gatts_value); +} diff --git a/components/ble/ble_services/ble_hrs/ble_hrs.h b/components/ble/ble_services/ble_hrs/ble_hrs.h new file mode 100644 index 0000000..7936091 --- /dev/null +++ b/components/ble/ble_services/ble_hrs/ble_hrs.h @@ -0,0 +1,192 @@ +/* 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 ble_sdk_srv_hrs Heart Rate Service + * @{ + * @ingroup ble_sdk_srv + * @brief Heart Rate Service module. + * + * @details This module implements the Heart Rate Service with the Heart Rate Measurement, + * Body Sensor Location and Heart Rate Control Point characteristics. + * During initialization it adds the Heart Rate Service and Heart Rate Measurement + * characteristic to the BLE stack database. Optionally it also adds the + * Body Sensor Location and Heart Rate Control Point characteristics. + * + * If enabled, notification of the Heart Rate Measurement characteristic is performed + * when the application calls ble_hrs_heart_rate_measurement_send(). + * + * The Heart Rate Service also provides a set of functions for manipulating the + * various fields in the Heart Rate Measurement characteristic, as well as setting + * the Body Sensor Location characteristic value. + * + * If an event handler is supplied by the application, the Heart Rate Service will + * generate Heart Rate Service events to the application. + * + * @note The application must propagate BLE stack events to the Heart Rate Service module by calling + * ble_hrs_on_ble_evt() from the @ref softdevice_handler callback. + * + * @note Attention! + * To maintain compliance with Nordic Semiconductor ASA Bluetooth profile + * qualification listings, this section of source code must not be modified. + */ + +#ifndef BLE_HRS_H__ +#define BLE_HRS_H__ + +#include +#include +#include "ble.h" +#include "ble_srv_common.h" + +// Body Sensor Location values +#define BLE_HRS_BODY_SENSOR_LOCATION_OTHER 0 +#define BLE_HRS_BODY_SENSOR_LOCATION_CHEST 1 +#define BLE_HRS_BODY_SENSOR_LOCATION_WRIST 2 +#define BLE_HRS_BODY_SENSOR_LOCATION_FINGER 3 +#define BLE_HRS_BODY_SENSOR_LOCATION_HAND 4 +#define BLE_HRS_BODY_SENSOR_LOCATION_EAR_LOBE 5 +#define BLE_HRS_BODY_SENSOR_LOCATION_FOOT 6 + +#define BLE_HRS_MAX_BUFFERED_RR_INTERVALS 20 /**< Size of RR Interval buffer inside service. */ + +/**@brief Heart Rate Service event type. */ +typedef enum +{ + BLE_HRS_EVT_NOTIFICATION_ENABLED, /**< Heart Rate value notification enabled event. */ + BLE_HRS_EVT_NOTIFICATION_DISABLED /**< Heart Rate value notification disabled event. */ +} ble_hrs_evt_type_t; + +/**@brief Heart Rate Service event. */ +typedef struct +{ + ble_hrs_evt_type_t evt_type; /**< Type of event. */ +} ble_hrs_evt_t; + +// Forward declaration of the ble_hrs_t type. +typedef struct ble_hrs_s ble_hrs_t; + +/**@brief Heart Rate Service event handler type. */ +typedef void (*ble_hrs_evt_handler_t) (ble_hrs_t * p_hrs, ble_hrs_evt_t * p_evt); + +/**@brief Heart Rate Service init structure. This contains all options and data needed for + * initialization of the service. */ +typedef struct +{ + ble_hrs_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Heart Rate Service. */ + bool is_sensor_contact_supported; /**< Determines if sensor contact detection is to be supported. */ + uint8_t * p_body_sensor_location; /**< If not NULL, initial value of the Body Sensor Location characteristic. */ + ble_srv_cccd_security_mode_t hrs_hrm_attr_md; /**< Initial security level for heart rate service measurement attribute */ + ble_srv_security_mode_t hrs_bsl_attr_md; /**< Initial security level for body sensor location attribute */ +} ble_hrs_init_t; + +/**@brief Heart Rate Service structure. This contains various status information for the service. */ +struct ble_hrs_s +{ + ble_hrs_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Heart Rate Service. */ + bool is_expended_energy_supported; /**< TRUE if Expended Energy measurement is supported. */ + bool is_sensor_contact_supported; /**< TRUE if sensor contact detection is supported. */ + uint16_t service_handle; /**< Handle of Heart Rate Service (as provided by the BLE stack). */ + ble_gatts_char_handles_t hrm_handles; /**< Handles related to the Heart Rate Measurement characteristic. */ + ble_gatts_char_handles_t bsl_handles; /**< Handles related to the Body Sensor Location characteristic. */ + ble_gatts_char_handles_t hrcp_handles; /**< Handles related to the Heart Rate Control Point characteristic. */ + uint16_t conn_handle; /**< Handle of the current connection (as provided by the BLE stack, is BLE_CONN_HANDLE_INVALID if not in a connection). */ + bool is_sensor_contact_detected; /**< TRUE if sensor contact has been detected. */ + uint16_t rr_interval[BLE_HRS_MAX_BUFFERED_RR_INTERVALS]; /**< Set of RR Interval measurements since the last Heart Rate Measurement transmission. */ + uint16_t rr_interval_count; /**< Number of RR Interval measurements since the last Heart Rate Measurement transmission. */ +}; + +/**@brief Function for initializing the Heart Rate Service. + * + * @param[out] p_hrs Heart Rate 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 this particular service instance. + * @param[in] p_hrs_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on successful initialization of service, otherwise an error code. + */ +uint32_t ble_hrs_init(ble_hrs_t * p_hrs, const ble_hrs_init_t * p_hrs_init); + +/**@brief Function for handling the Application's BLE Stack events. + * + * @details Handles all events from the BLE stack of interest to the Heart Rate Service. + * + * @param[in] p_hrs Heart Rate Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +void ble_hrs_on_ble_evt(ble_hrs_t * p_hrs, ble_evt_t * p_ble_evt); + +/**@brief Function for sending heart rate measurement if notification has been enabled. + * + * @details The application calls this function after having performed a heart rate measurement. + * If notification has been enabled, the heart rate measurement data is encoded and sent to + * the client. + * + * @param[in] p_hrs Heart Rate Service structure. + * @param[in] heart_rate New heart rate measurement. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +uint32_t ble_hrs_heart_rate_measurement_send(ble_hrs_t * p_hrs, uint16_t heart_rate); + +/**@brief Function for adding a RR Interval measurement to the RR Interval buffer. + * + * @details All buffered RR Interval measurements will be included in the next heart rate + * measurement message, up to the maximum number of measurements that will fit into the + * message. If the buffer is full, the oldest measurement in the buffer will be deleted. + * + * @param[in] p_hrs Heart Rate Service structure. + * @param[in] rr_interval New RR Interval measurement (will be buffered until the next + * transmission of Heart Rate Measurement). + */ +void ble_hrs_rr_interval_add(ble_hrs_t * p_hrs, uint16_t rr_interval); + +/**@brief Function for checking if RR Interval buffer is full. + * + * @param[in] p_hrs Heart Rate Service structure. + * + * @return true if RR Interval buffer is full, false otherwise. + */ +bool ble_hrs_rr_interval_buffer_is_full(ble_hrs_t * p_hrs); + +/**@brief Function for setting the state of the Sensor Contact Supported bit. + * + * @param[in] p_hrs Heart Rate Service structure. + * @param[in] is_sensor_contact_supported New state of the Sensor Contact Supported bit. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +uint32_t ble_hrs_sensor_contact_supported_set(ble_hrs_t * p_hrs, bool is_sensor_contact_supported); + +/**@brief Function for setting the state of the Sensor Contact Detected bit. + * + * @param[in] p_hrs Heart Rate Service structure. + * @param[in] is_sensor_contact_detected TRUE if sensor contact is detected, FALSE otherwise. + */ +void ble_hrs_sensor_contact_detected_update(ble_hrs_t * p_hrs, bool is_sensor_contact_detected); + +/**@brief Function for setting the Body Sensor Location. + * + * @details Sets a new value of the Body Sensor Location characteristic. The new value will be sent + * to the client the next time the client reads the Body Sensor Location characteristic. + * + * @param[in] p_hrs Heart Rate Service structure. + * @param[in] body_sensor_location New Body Sensor Location. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +uint32_t ble_hrs_body_sensor_location_set(ble_hrs_t * p_hrs, uint8_t body_sensor_location); + +#endif // BLE_HRS_H__ + +/** @} */ diff --git a/components/ble/ble_services/ble_hrs_c/ble_hrs_c.c b/components/ble/ble_services/ble_hrs_c/ble_hrs_c.c new file mode 100644 index 0000000..c38f1f1 --- /dev/null +++ b/components/ble/ble_services/ble_hrs_c/ble_hrs_c.c @@ -0,0 +1,290 @@ +/* + * Copyright (c) 2012 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. + * + */ + +/**@cond To Make Doxygen skip documentation generation for this file. + * @{ + */ + +#include +#include "ble_hrs_c.h" +#include "ble_db_discovery.h" +#include "ble_types.h" +#include "ble_srv_common.h" +#include "nordic_common.h" +#include "nrf_error.h" +#include "ble_gattc.h" +#include "app_util.h" +#include "app_trace.h" + +#define LOG app_trace_log /**< Debug logger macro that will be used in this file to do logging of important information over UART. */ + +#define HRM_FLAG_MASK_HR_16BIT (0x01 << 0) /**< Bit mask used to extract the type of heart rate value. This is used to find if the received heart rate is a 16 bit value or an 8 bit value. */ + +#define TX_BUFFER_MASK 0x07 /**< TX Buffer mask, must be a mask of continuous zeroes, followed by continuous sequence of ones: 000...111. */ +#define TX_BUFFER_SIZE (TX_BUFFER_MASK + 1) /**< Size of send buffer, which is 1 higher than the mask. */ + +#define WRITE_MESSAGE_LENGTH BLE_CCCD_VALUE_LEN /**< Length of the write message for CCCD. */ +#define WRITE_MESSAGE_LENGTH BLE_CCCD_VALUE_LEN /**< Length of the write message for CCCD. */ + +typedef enum +{ + READ_REQ, /**< Type identifying that this tx_message is a read request. */ + WRITE_REQ /**< Type identifying that this tx_message is a write request. */ +} tx_request_t; + +/**@brief Structure for writing a message to the peer, i.e. CCCD. + */ +typedef struct +{ + uint8_t gattc_value[WRITE_MESSAGE_LENGTH]; /**< The message to write. */ + ble_gattc_write_params_t gattc_params; /**< GATTC parameters for this message. */ +} write_params_t; + +/**@brief Structure for holding data to be transmitted to the connected central. + */ +typedef struct +{ + uint16_t conn_handle; /**< Connection handle to be used when transmitting this message. */ + tx_request_t type; /**< Type of this message, i.e. read or write message. */ + union + { + uint16_t read_handle; /**< Read request message. */ + write_params_t write_req; /**< Write request message. */ + } req; +} tx_message_t; + + +static ble_hrs_c_t * mp_ble_hrs_c; /**< Pointer to the current instance of the HRS Client module. The memory for this provided by the application.*/ +static tx_message_t m_tx_buffer[TX_BUFFER_SIZE]; /**< Transmit buffer for messages to be transmitted to the central. */ +static uint32_t m_tx_insert_index = 0; /**< Current index in the transmit buffer where the next message should be inserted. */ +static uint32_t m_tx_index = 0; /**< Current index in the transmit buffer from where the next message to be transmitted resides. */ + + +/**@brief Function for passing any pending request from the buffer to the stack. + */ +static void tx_buffer_process(void) +{ + if (m_tx_index != m_tx_insert_index) + { + uint32_t err_code; + + if (m_tx_buffer[m_tx_index].type == READ_REQ) + { + err_code = sd_ble_gattc_read(m_tx_buffer[m_tx_index].conn_handle, + m_tx_buffer[m_tx_index].req.read_handle, + 0); + } + else + { + err_code = sd_ble_gattc_write(m_tx_buffer[m_tx_index].conn_handle, + &m_tx_buffer[m_tx_index].req.write_req.gattc_params); + } + if (err_code == NRF_SUCCESS) + { + LOG("[HRS_C]: SD Read/Write API returns Success..\r\n"); + m_tx_index++; + m_tx_index &= TX_BUFFER_MASK; + } + else + { + LOG("[HRS_C]: SD Read/Write API returns error. This message sending will be " + "attempted again..\r\n"); + } + } +} + + +/**@brief Function for handling write response events. + * + * @param[in] p_ble_hrs_c Pointer to the Heart Rate Client structure. + * @param[in] p_ble_evt Pointer to the BLE event received. + */ +static void on_write_rsp(ble_hrs_c_t * p_ble_hrs_c, const ble_evt_t * p_ble_evt) +{ + // Check if there is any message to be sent across to the peer and send it. + tx_buffer_process(); +} + + +/**@brief Function for handling Handle Value Notification received from the SoftDevice. + * + * @details This function will uses the Handle Value Notification received from the SoftDevice + * and checks if it is a notification of the heart rate measurement from the peer. If + * it is, this function will decode the heart rate measurement and send it to the + * application. + * + * @param[in] p_ble_hrs_c Pointer to the Heart Rate Client structure. + * @param[in] p_ble_evt Pointer to the BLE event received. + */ +static void on_hvx(ble_hrs_c_t * p_ble_hrs_c, const ble_evt_t * p_ble_evt) +{ + // Check if this is a heart rate notification. + if (p_ble_evt->evt.gattc_evt.params.hvx.handle == p_ble_hrs_c->hrm_handle) + { + ble_hrs_c_evt_t ble_hrs_c_evt; + uint32_t index = 0; + + ble_hrs_c_evt.evt_type = BLE_HRS_C_EVT_HRM_NOTIFICATION; + + if (!(p_ble_evt->evt.gattc_evt.params.hvx.data[index++] & HRM_FLAG_MASK_HR_16BIT)) + { + // 8 Bit heart rate value received. + ble_hrs_c_evt.params.hrm.hr_value = p_ble_evt->evt.gattc_evt.params.hvx.data[index++]; //lint !e415 suppress Lint Warning 415: Likely access out of bond + } + else + { + // 16 bit heart rate value received. + ble_hrs_c_evt.params.hrm.hr_value = + uint16_decode(&(p_ble_evt->evt.gattc_evt.params.hvx.data[index])); + } + + p_ble_hrs_c->evt_handler(p_ble_hrs_c, &ble_hrs_c_evt); + } +} + + +/**@brief Function for handling events from the database discovery module. + * + * @details This function will handle an event from the database discovery module, and determine + * if it relates to the discovery of heart rate service at the peer. If so, it will + * call the application's event handler indicating that the heart rate service has been + * discovered at the peer. It also populates the event with the service related + * information before providing it to the application. + * + * @param[in] p_evt Pointer to the event received from the database discovery module. + * + */ +static void db_discover_evt_handler(ble_db_discovery_evt_t * p_evt) +{ + // Check if the Heart Rate Service was discovered. + if (p_evt->evt_type == BLE_DB_DISCOVERY_COMPLETE && + p_evt->params.discovered_db.srv_uuid.uuid == BLE_UUID_HEART_RATE_SERVICE && + p_evt->params.discovered_db.srv_uuid.type == BLE_UUID_TYPE_BLE) + { + mp_ble_hrs_c->conn_handle = p_evt->conn_handle; + + // Find the CCCD Handle of the Heart Rate Measurement characteristic. + uint32_t i; + + for (i = 0; i < p_evt->params.discovered_db.char_count; i++) + { + if (p_evt->params.discovered_db.charateristics[i].characteristic.uuid.uuid == + BLE_UUID_HEART_RATE_MEASUREMENT_CHAR) + { + // Found Heart Rate characteristic. Store CCCD handle and break. + mp_ble_hrs_c->hrm_cccd_handle = + p_evt->params.discovered_db.charateristics[i].cccd_handle; + mp_ble_hrs_c->hrm_handle = + p_evt->params.discovered_db.charateristics[i].characteristic.handle_value; + break; + } + } + + LOG("[HRS_C]: Heart Rate Service discovered at peer.\r\n"); + + ble_hrs_c_evt_t evt; + + evt.evt_type = BLE_HRS_C_EVT_DISCOVERY_COMPLETE; + + mp_ble_hrs_c->evt_handler(mp_ble_hrs_c, &evt); + } +} + + +uint32_t ble_hrs_c_init(ble_hrs_c_t * p_ble_hrs_c, ble_hrs_c_init_t * p_ble_hrs_c_init) +{ + if ((p_ble_hrs_c == NULL) || (p_ble_hrs_c_init == NULL)) + { + return NRF_ERROR_NULL; + } + + ble_uuid_t hrs_uuid; + + hrs_uuid.type = BLE_UUID_TYPE_BLE; + hrs_uuid.uuid = BLE_UUID_HEART_RATE_SERVICE; + + mp_ble_hrs_c = p_ble_hrs_c; + + mp_ble_hrs_c->evt_handler = p_ble_hrs_c_init->evt_handler; + mp_ble_hrs_c->conn_handle = BLE_CONN_HANDLE_INVALID; + mp_ble_hrs_c->hrm_cccd_handle = BLE_GATT_HANDLE_INVALID; + + return ble_db_discovery_evt_register(&hrs_uuid, + db_discover_evt_handler); +} + + +void ble_hrs_c_on_ble_evt(ble_hrs_c_t * p_ble_hrs_c, const ble_evt_t * p_ble_evt) +{ + if ((p_ble_hrs_c == NULL) || (p_ble_evt == NULL)) + { + return; + } + + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + p_ble_hrs_c->conn_handle = p_ble_evt->evt.gap_evt.conn_handle; + break; + + case BLE_GATTC_EVT_HVX: + on_hvx(p_ble_hrs_c, p_ble_evt); + break; + + case BLE_GATTC_EVT_WRITE_RSP: + on_write_rsp(p_ble_hrs_c, p_ble_evt); + break; + + default: + break; + } +} + + +/**@brief Function for creating a message for writing to the CCCD. + */ +static uint32_t cccd_configure(uint16_t conn_handle, uint16_t handle_cccd, bool enable) +{ + LOG("[HRS_C]: Configuring CCCD. CCCD Handle = %d, Connection Handle = %d\r\n", + handle_cccd,conn_handle); + + tx_message_t * p_msg; + uint16_t cccd_val = enable ? BLE_GATT_HVX_NOTIFICATION : 0; + + p_msg = &m_tx_buffer[m_tx_insert_index++]; + m_tx_insert_index &= TX_BUFFER_MASK; + + p_msg->req.write_req.gattc_params.handle = handle_cccd; + p_msg->req.write_req.gattc_params.len = WRITE_MESSAGE_LENGTH; + p_msg->req.write_req.gattc_params.p_value = p_msg->req.write_req.gattc_value; + p_msg->req.write_req.gattc_params.offset = 0; + p_msg->req.write_req.gattc_params.write_op = BLE_GATT_OP_WRITE_REQ; + p_msg->req.write_req.gattc_value[0] = LSB_16(cccd_val); + p_msg->req.write_req.gattc_value[1] = MSB_16(cccd_val); + p_msg->conn_handle = conn_handle; + p_msg->type = WRITE_REQ; + + tx_buffer_process(); + return NRF_SUCCESS; +} + + +uint32_t ble_hrs_c_hrm_notif_enable(ble_hrs_c_t * p_ble_hrs_c) +{ + if (p_ble_hrs_c == NULL) + { + return NRF_ERROR_NULL; + } + + return cccd_configure(p_ble_hrs_c->conn_handle, p_ble_hrs_c->hrm_cccd_handle, true); +} + +/** @} + * @endcond + */ diff --git a/components/ble/ble_services/ble_hrs_c/ble_hrs_c.h b/components/ble/ble_services/ble_hrs_c/ble_hrs_c.h new file mode 100644 index 0000000..0bd080a --- /dev/null +++ b/components/ble/ble_services/ble_hrs_c/ble_hrs_c.h @@ -0,0 +1,170 @@ +/* + * Copyright (c) 2012 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. + * + */ + +/**@file + * + * @defgroup ble_sdk_srv_hrs_c Heart Rate Service Client + * @{ + * @ingroup ble_sdk_srv + * @brief Heart Rate Service Client module. + * + * @details This module contains the APIs and types exposed by the Heart Rate Service Client + * module. These APIs and types can be used by the application to perform discovery of + * Heart Rate Service at the peer and interact with it. + * + * @warning Currently this module only has support for Heart Rate Measurement characteristic. This + * means that it will be able to enable notification of the characteristic at the peer and + * be able to receive Heart Rate Measurement notifications from the peer. It does not + * support the Body Sensor Location and the Heart Rate Control Point characteristics. + * When a Heart Rate Measurement is received, this module will decode only the + * Heart Rate Measurement Value (both 8 bit and 16 bit) field from it and provide it to + * the application. + * + * @note The application must propagate BLE stack events to this module by calling + * ble_hrs_c_on_ble_evt(). + * + */ + +#ifndef BLE_HRS_C_H__ +#define BLE_HRS_C_H__ + +#include +#include "ble.h" + +/** + * @defgroup hrs_c_enums Enumerations + * @{ + */ + +/**@brief HRS Client event type. */ +typedef enum +{ + BLE_HRS_C_EVT_DISCOVERY_COMPLETE = 1, /**< Event indicating that the Heart Rate Service has been discovered at the peer. */ + BLE_HRS_C_EVT_HRM_NOTIFICATION /**< Event indicating that a notification of the Heart Rate Measurement characteristic has been received from the peer. */ +} ble_hrs_c_evt_type_t; + +/** @} */ + +/** + * @defgroup hrs_c_structs Structures + * @{ + */ + +/**@brief Structure containing the heart rate measurement received from the peer. */ +typedef struct +{ + uint16_t hr_value; /**< Heart Rate Value. */ +} ble_hrm_t; + +/**@brief Heart Rate Event structure. */ +typedef struct +{ + ble_hrs_c_evt_type_t evt_type; /**< Type of the event. */ + union + { + ble_hrm_t hrm; /**< Heart rate measurement received. This will be filled if the evt_type is @ref BLE_HRS_C_EVT_HRM_NOTIFICATION. */ + } params; +} ble_hrs_c_evt_t; + +/** @} */ + +/** + * @defgroup hrs_c_types Types + * @{ + */ + +// Forward declaration of the ble_bas_t type. +typedef struct ble_hrs_c_s ble_hrs_c_t; + +/**@brief Event handler type. + * + * @details This is the type of the event handler that should be provided by the application + * of this module in order to receive events. + */ +typedef void (* ble_hrs_c_evt_handler_t) (ble_hrs_c_t * p_ble_hrs_c, ble_hrs_c_evt_t * p_evt); + +/** @} */ + +/** + * @addtogroup hrs_c_structs + * @{ + */ + +/**@brief Heart Rate Client structure. + */ +struct ble_hrs_c_s +{ + uint16_t conn_handle; /**< Connection handle as provided by the SoftDevice. */ + uint16_t hrm_cccd_handle; /**< Handle of the CCCD of the Heart Rate Measurement characteristic. */ + uint16_t hrm_handle; /**< Handle of the Heart Rate Measurement characteristic as provided by the SoftDevice. */ + ble_hrs_c_evt_handler_t evt_handler; /**< Application event handler to be called when there is an event related to the heart rate service. */ +}; + +/**@brief Heart Rate Client initialization structure. + */ +typedef struct +{ + ble_hrs_c_evt_handler_t evt_handler; /**< Event handler to be called by the Heart Rate Client module whenever there is an event related to the Heart Rate Service. */ +} ble_hrs_c_init_t; + +/** @} */ + +/** + * @defgroup hrs_c_functions Functions + * @{ + */ + +/**@brief Function for initializing the heart rate client module. + * + * @details This function will register with the DB Discovery module. There it + * registers for the Heart Rate Service. Doing so will make the DB Discovery + * module look for the presence of a Heart Rate Service instance at the peer when a + * discovery is started. + * + * @param[in] p_ble_hrs_c Pointer to the heart rate client structure. + * @param[in] p_ble_hrs_c_init Pointer to the heart rate initialization structure containing the + * initialization information. + * + * @retval NRF_SUCCESS On successful initialization. Otherwise an error code. This function + * propagates the error code returned by the Database Discovery module API + * @ref ble_db_discovery_evt_register. + */ +uint32_t ble_hrs_c_init(ble_hrs_c_t * p_ble_hrs_c, ble_hrs_c_init_t * p_ble_hrs_c_init); + +/**@brief Function for handling BLE events from the SoftDevice. + * + * @details This function will handle the BLE events received from the SoftDevice. If a BLE + * event is relevant to the Heart Rate Client module, then it uses it to update + * interval variables and, if necessary, send events to the application. + * + * @param[in] p_ble_hrs_c Pointer to the heart rate client structure. + * @param[in] p_ble_evt Pointer to the BLE event. + */ +void ble_hrs_c_on_ble_evt(ble_hrs_c_t * p_ble_hrs_c, const ble_evt_t * p_ble_evt); + + +/**@brief Function for requesting the peer to start sending notification of Heart Rate + * Measurement. + * + * @details This function will enable to notification of the Heart Rate Measurement at the peer + * by writing to the CCCD of the Heart Rate Measurement Characteristic. + * + * @param p_ble_hrs_c Pointer to the heart rate client structure. + * + * @retval NRF_SUCCESS If the SoftDevice has been requested to write to the CCCD of the peer. + * Otherwise, an error code. This function propagates the error code returned + * by the SoftDevice API @ref sd_ble_gattc_write. + */ +uint32_t ble_hrs_c_hrm_notif_enable(ble_hrs_c_t * p_ble_hrs_c); + +/** @} */ // End tag for Function group. + +#endif // BLE_HRS_C_H__ + +/** @} */ // End tag for the file. diff --git a/components/ble/ble_services/ble_hts/ble_hts.c b/components/ble/ble_services/ble_hts/ble_hts.c new file mode 100644 index 0000000..1ac6bed --- /dev/null +++ b/components/ble/ble_services/ble_hts/ble_hts.c @@ -0,0 +1,428 @@ +/* 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. + * + */ + +/* Attention! +* To maintain compliance with Nordic Semiconductor ASAs Bluetooth profile +* qualification listings, this section of source code must not be modified. +*/ + +#include "ble_hts.h" +#include +#include "nordic_common.h" +#include "ble_l2cap.h" +#include "ble_srv_common.h" +#include "app_util.h" + + +#define OPCODE_LENGTH 1 /**< Length of opcode inside Health Thermometer Measurement packet. */ +#define HANDLE_LENGTH 2 /**< Length of handle inside Health Thermometer Measurement packet. */ +#define MAX_HTM_LEN (BLE_L2CAP_MTU_DEF - OPCODE_LENGTH - HANDLE_LENGTH) /**< Maximum size of a transmitted Health Thermometer Measurement. */ + +// Health Thermometer Measurement flag bits +#define HTS_MEAS_FLAG_TEMP_UNITS_BIT (0x01 << 0) /**< Temperature Units flag. */ +#define HTS_MEAS_FLAG_TIME_STAMP_BIT (0x01 << 1) /**< Time Stamp flag. */ +#define HTS_MEAS_FLAG_TEMP_TYPE_BIT (0x01 << 2) /**< Temperature Type flag. */ + + +/**@brief Function for handling the Connect event. + * + * @param[in] p_hts Health Thermometer Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_connect(ble_hts_t * p_hts, ble_evt_t * p_ble_evt) +{ + p_hts->conn_handle = p_ble_evt->evt.gatts_evt.conn_handle; +} + + +/**@brief Function for handling the Disconnect event. + * + * @param[in] p_hts Health Thermometer Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_disconnect(ble_hts_t * p_hts, ble_evt_t * p_ble_evt) +{ + UNUSED_PARAMETER(p_ble_evt); + p_hts->conn_handle = BLE_CONN_HANDLE_INVALID; +} + + +/**@brief Function for handling write events to the Blood Pressure Measurement characteristic. + * + * @param[in] p_hts Health Thermometer Service structure. + * @param[in] p_evt_write Write event received from the BLE stack. + */ +static void on_cccd_write(ble_hts_t * p_hts, ble_gatts_evt_write_t * p_evt_write) +{ + if (p_evt_write->len == 2) + { + // CCCD written, update indication state + if (p_hts->evt_handler != NULL) + { + ble_hts_evt_t evt; + + if (ble_srv_is_indication_enabled(p_evt_write->data)) + { + evt.evt_type = BLE_HTS_EVT_INDICATION_ENABLED; + } + else + { + evt.evt_type = BLE_HTS_EVT_INDICATION_DISABLED; + } + + p_hts->evt_handler(p_hts, &evt); + } + } +} + + +/**@brief Function for handling the Write event. + * + * @param[in] p_hts Health Thermometer Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_write(ble_hts_t * p_hts, ble_evt_t * p_ble_evt) +{ + ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write; + + if (p_evt_write->handle == p_hts->meas_handles.cccd_handle) + { + on_cccd_write(p_hts, p_evt_write); + } +} + + +/**@brief Function for handling the HVC event. + * + * @details Handles HVC events from the BLE stack. + * + * @param[in] p_hts Health Thermometer Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_hvc(ble_hts_t * p_hts, ble_evt_t * p_ble_evt) +{ + ble_gatts_evt_hvc_t * p_hvc = &p_ble_evt->evt.gatts_evt.params.hvc; + + if (p_hvc->handle == p_hts->meas_handles.value_handle) + { + ble_hts_evt_t evt; + + evt.evt_type = BLE_HTS_EVT_INDICATION_CONFIRMED; + p_hts->evt_handler(p_hts, &evt); + } +} + + +void ble_hts_on_ble_evt(ble_hts_t * p_hts, ble_evt_t * p_ble_evt) +{ + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + on_connect(p_hts, p_ble_evt); + break; + + case BLE_GAP_EVT_DISCONNECTED: + on_disconnect(p_hts, p_ble_evt); + break; + + case BLE_GATTS_EVT_WRITE: + on_write(p_hts, p_ble_evt); + break; + + case BLE_GATTS_EVT_HVC: + on_hvc(p_hts, p_ble_evt); + break; + + default: + // No implementation needed. + break; + } +} + + +/**@brief Function for encoding a Health Thermometer Measurement. + * + * @param[in] p_hts Health Thermometer Service structure. + * @param[in] p_hts_meas Measurement to be encoded. + * @param[out] p_encoded_buffer Buffer where the encoded data will be written. + * + * @return Size of encoded data. + */ +static uint8_t hts_measurement_encode(ble_hts_t * p_hts, + ble_hts_meas_t * p_hts_meas, + uint8_t * p_encoded_buffer) +{ + uint8_t flags = 0; + uint8_t len = 1; + uint32_t encoded_temp; + + // Flags field + if (p_hts_meas->temp_in_fahr_units) + { + flags |= HTS_MEAS_FLAG_TEMP_UNITS_BIT; + } + if (p_hts_meas->time_stamp_present) + { + flags |= HTS_MEAS_FLAG_TIME_STAMP_BIT; + } + + // Temperature Measurement Value field + if (p_hts_meas->temp_in_fahr_units) + { + flags |= HTS_MEAS_FLAG_TEMP_UNITS_BIT; + + encoded_temp = ((p_hts_meas->temp_in_fahr.exponent << 24) & 0xFF000000) | + ((p_hts_meas->temp_in_fahr.mantissa << 0) & 0x00FFFFFF); + } + else + { + encoded_temp = ((p_hts_meas->temp_in_celcius.exponent << 24) & 0xFF000000) | + ((p_hts_meas->temp_in_celcius.mantissa << 0) & 0x00FFFFFF); + } + len += uint32_encode(encoded_temp, &p_encoded_buffer[len]); + + // Time Stamp field + if (p_hts_meas->time_stamp_present) + { + flags |= HTS_MEAS_FLAG_TIME_STAMP_BIT; + len += ble_date_time_encode(&p_hts_meas->time_stamp, &p_encoded_buffer[len]); + } + + // Temperature Type field + if (p_hts_meas->temp_type_present) + { + flags |= HTS_MEAS_FLAG_TEMP_TYPE_BIT; + p_encoded_buffer[len++] = p_hts_meas->temp_type; + } + + // Flags field + p_encoded_buffer[0] = flags; + + return len; +} + + +/**@brief Function for adding Health Thermometer Measurement characteristics. + * + * @param[in] p_hts Health Thermometer Service structure. + * @param[in] p_hts_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t hts_measurement_char_add(ble_hts_t * p_hts, const ble_hts_init_t * p_hts_init) +{ + 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; + ble_hts_meas_t initial_htm; + uint8_t encoded_htm[MAX_HTM_LEN]; + + memset(&cccd_md, 0, sizeof(cccd_md)); + + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm); + cccd_md.vloc = BLE_GATTS_VLOC_STACK; + cccd_md.write_perm = p_hts_init->hts_meas_attr_md.cccd_write_perm; + + memset(&char_md, 0, sizeof(char_md)); + + char_md.char_props.indicate = 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_BLE_ASSIGN(ble_uuid, BLE_UUID_TEMPERATURE_MEASUREMENT_CHAR); + + memset(&attr_md, 0, sizeof(attr_md)); + + attr_md.vloc = BLE_GATTS_VLOC_STACK; + attr_md.read_perm = p_hts_init->hts_meas_attr_md.read_perm; + attr_md.write_perm = p_hts_init->hts_meas_attr_md.write_perm; + attr_md.rd_auth = 0; + attr_md.wr_auth = 0; + attr_md.vlen = 1; + + memset(&attr_char_value, 0, sizeof(attr_char_value)); + memset(&initial_htm, 0, sizeof(initial_htm)); + + attr_char_value.p_uuid = &ble_uuid; + attr_char_value.p_attr_md = &attr_md; + attr_char_value.init_len = hts_measurement_encode(p_hts, &initial_htm, encoded_htm); + attr_char_value.init_offs = 0; + attr_char_value.max_len = MAX_HTM_LEN; + attr_char_value.p_value = encoded_htm; + + return sd_ble_gatts_characteristic_add(p_hts->service_handle, + &char_md, + &attr_char_value, + &p_hts->meas_handles); +} + + +/**@brief Function for adding Temperature Type characteristics. + * + * @param[in] p_hts Health Thermometer Service structure. + * @param[in] p_hts_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t hts_temp_type_char_add(ble_hts_t * p_hts, const ble_hts_init_t * p_hts_init) +{ + ble_gatts_char_md_t char_md; + ble_gatts_attr_t attr_char_value; + ble_uuid_t ble_uuid; + ble_gatts_attr_md_t attr_md; + uint8_t init_value_temp_type; + uint8_t init_value_encoded[1]; + + 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; + + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_TEMPERATURE_TYPE_CHAR); + + memset(&attr_md, 0, sizeof(attr_md)); + + attr_md.vloc = BLE_GATTS_VLOC_STACK; + attr_md.read_perm = p_hts_init->hts_temp_type_attr_md.read_perm; + attr_md.write_perm = p_hts_init->hts_temp_type_attr_md.write_perm; + attr_md.rd_auth = 0; + attr_md.wr_auth = 0; + attr_md.vlen = 0; + + memset(&attr_char_value, 0, sizeof(attr_char_value)); + + init_value_temp_type = p_hts_init->temp_type; + init_value_encoded[0] = init_value_temp_type; + + attr_char_value.p_uuid = &ble_uuid; + attr_char_value.p_attr_md = &attr_md; + attr_char_value.init_len = sizeof (uint8_t); + attr_char_value.init_offs = 0; + attr_char_value.max_len = sizeof (uint8_t); + attr_char_value.p_value = init_value_encoded; + + return sd_ble_gatts_characteristic_add(p_hts->service_handle, + &char_md, + &attr_char_value, + &p_hts->temp_type_handles); +} + + +uint32_t ble_hts_init(ble_hts_t * p_hts, const ble_hts_init_t * p_hts_init) +{ + uint32_t err_code; + ble_uuid_t ble_uuid; + + // Initialize service structure + p_hts->evt_handler = p_hts_init->evt_handler; + p_hts->conn_handle = BLE_CONN_HANDLE_INVALID; + p_hts->temp_type = p_hts_init->temp_type; + + // Add service + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_HEALTH_THERMOMETER_SERVICE); + + err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &ble_uuid, &p_hts->service_handle); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add measurement characteristic + err_code = hts_measurement_char_add(p_hts, p_hts_init); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add temperature type characteristic + if (p_hts_init->temp_type_as_characteristic) + { + err_code = hts_temp_type_char_add(p_hts, p_hts_init); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + + return NRF_SUCCESS; +} + + +uint32_t ble_hts_measurement_send(ble_hts_t * p_hts, ble_hts_meas_t * p_hts_meas) +{ + uint32_t err_code; + + // Send value if connected + if (p_hts->conn_handle != BLE_CONN_HANDLE_INVALID) + { + uint8_t encoded_hts_meas[MAX_HTM_LEN]; + uint16_t len; + uint16_t hvx_len; + ble_gatts_hvx_params_t hvx_params; + + len = hts_measurement_encode(p_hts, p_hts_meas, encoded_hts_meas); + hvx_len = len; + + memset(&hvx_params, 0, sizeof(hvx_params)); + + hvx_params.handle = p_hts->meas_handles.value_handle; + hvx_params.type = BLE_GATT_HVX_INDICATION; + hvx_params.offset = 0; + hvx_params.p_len = &hvx_len; + hvx_params.p_data = encoded_hts_meas; + + err_code = sd_ble_gatts_hvx(p_hts->conn_handle, &hvx_params); + if ((err_code == NRF_SUCCESS) && (hvx_len != len)) + { + err_code = NRF_ERROR_DATA_SIZE; + } + } + else + { + err_code = NRF_ERROR_INVALID_STATE; + } + + return err_code; +} + + +uint32_t ble_hts_is_indication_enabled(ble_hts_t * p_hts, bool * p_indication_enabled) +{ + uint32_t err_code; + uint8_t cccd_value_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_value_buf; + + err_code = sd_ble_gatts_value_get(p_hts->conn_handle, + p_hts->meas_handles.cccd_handle, + &gatts_value); + if (err_code == NRF_SUCCESS) + { + *p_indication_enabled = ble_srv_is_indication_enabled(cccd_value_buf); + } + return err_code; +} diff --git a/components/ble/ble_services/ble_hts/ble_hts.h b/components/ble/ble_services/ble_hts/ble_hts.h new file mode 100644 index 0000000..f6d5723 --- /dev/null +++ b/components/ble/ble_services/ble_hts/ble_hts.h @@ -0,0 +1,160 @@ +/* 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 ble_sdk_srv_hts Health Thermometer Service + * @{ + * @ingroup ble_sdk_srv + * @brief Health Thermometer Service module. + * + * @details This module implements the Health Thermometer Service. + * + * If an event handler is supplied by the application, the Health Thermometer + * Service will generate Health Thermometer Service events to the application. + * + * @note The application must propagate BLE stack events to the Health Thermometer Service + * module by calling ble_hts_on_ble_evt() from the @ref softdevice_handler function. + * + * @note Attention! + * To maintain compliance with Nordic Semiconductor ASA Bluetooth profile + * qualification listings, this section of source code must not be modified. + */ + +#ifndef BLE_HTS_H__ +#define BLE_HTS_H__ + +#include +#include +#include "ble.h" +#include "ble_srv_common.h" +#include "ble_date_time.h" + +// Temperature Type measurement locations +#define BLE_HTS_TEMP_TYPE_ARMPIT 1 +#define BLE_HTS_TEMP_TYPE_BODY 2 +#define BLE_HTS_TEMP_TYPE_EAR 3 +#define BLE_HTS_TEMP_TYPE_FINGER 4 +#define BLE_HTS_TEMP_TYPE_GI_TRACT 5 +#define BLE_HTS_TEMP_TYPE_MOUTH 6 +#define BLE_HTS_TEMP_TYPE_RECTUM 7 +#define BLE_HTS_TEMP_TYPE_TOE 8 +#define BLE_HTS_TEMP_TYPE_EAR_DRUM 9 + +/**@brief Health Thermometer Service event type. */ +typedef enum +{ + BLE_HTS_EVT_INDICATION_ENABLED, /**< Health Thermometer value indication enabled event. */ + BLE_HTS_EVT_INDICATION_DISABLED, /**< Health Thermometer value indication disabled event. */ + BLE_HTS_EVT_INDICATION_CONFIRMED /**< Confirmation of a temperature measurement indication has been received. */ +} ble_hts_evt_type_t; + +/**@brief Health Thermometer Service event. */ +typedef struct +{ + ble_hts_evt_type_t evt_type; /**< Type of event. */ +} ble_hts_evt_t; + +// Forward declaration of the ble_hts_t type. +typedef struct ble_hts_s ble_hts_t; + +/**@brief Health Thermometer Service event handler type. */ +typedef void (*ble_hts_evt_handler_t) (ble_hts_t * p_hts, ble_hts_evt_t * p_evt); + +/**@brief FLOAT format (IEEE-11073 32-bit FLOAT, defined as a 32-bit value with a 24-bit mantissa + * and an 8-bit exponent. */ +typedef struct +{ + int8_t exponent; /**< Base 10 exponent */ + int32_t mantissa; /**< Mantissa, should be using only 24 bits */ +} ieee_float32_t; + +/**@brief Health Thermometer Service init structure. This contains all options and data + * needed for initialization of the service. */ +typedef struct +{ + ble_hts_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Health Thermometer Service. */ + ble_srv_cccd_security_mode_t hts_meas_attr_md; /**< Initial security level for health thermometer measurement attribute */ + ble_srv_security_mode_t hts_temp_type_attr_md; /**< Initial security level for health thermometer tempearture type attribute */ + uint8_t temp_type_as_characteristic; /**< Set non-zero if temp type given as characteristic */ + uint8_t temp_type; /**< Temperature type if temperature characteristic is used */ +} ble_hts_init_t; + +/**@brief Health Thermometer Service structure. This contains various status information for + * the service. */ +struct ble_hts_s +{ + ble_hts_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Health Thermometer Service. */ + uint16_t service_handle; /**< Handle of Health Thermometer Service (as provided by the BLE stack). */ + ble_gatts_char_handles_t meas_handles; /**< Handles related to the Health Thermometer Measurement characteristic. */ + ble_gatts_char_handles_t temp_type_handles; /**< Handles related to the Health Thermometer Temperature Type characteristic. */ + uint16_t conn_handle; /**< Handle of the current connection (as provided by the BLE stack, is BLE_CONN_HANDLE_INVALID if not in a connection). */ + uint8_t temp_type; /**< Temperature type indicates where the measurement was taken. */ +}; + +/**@brief Health Thermometer Service measurement structure. This contains a Health Thermometer + * measurement. */ +typedef struct ble_hts_meas_s +{ + bool temp_in_fahr_units; /**< True if Temperature is in Fahrenheit units, Celcius otherwise. */ + bool time_stamp_present; /**< True if Time Stamp is present. */ + bool temp_type_present; /**< True if Temperature Type is present. */ + ieee_float32_t temp_in_celcius; /**< Temperature Measurement Value (Celcius). */ + ieee_float32_t temp_in_fahr; /**< Temperature Measurement Value (Fahrenheit). */ + ble_date_time_t time_stamp; /**< Time Stamp. */ + uint8_t temp_type; /**< Temperature Type. */ +} ble_hts_meas_t; + +/**@brief Function for initializing the Health Thermometer Service. + * + * @param[out] p_hts Health Thermometer 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 this particular service instance. + * @param[in] p_hts_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on successful initialization of service, otherwise an error code. + */ +uint32_t ble_hts_init(ble_hts_t * p_hts, const ble_hts_init_t * p_hts_init); + +/**@brief Function for handling the Application's BLE Stack events. + * + * @details Handles all events from the BLE stack of interest to the Health Thermometer Service. + * + * @param[in] p_hts Health Thermometer Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +void ble_hts_on_ble_evt(ble_hts_t * p_hts, ble_evt_t * p_ble_evt); + +/**@brief Function for sending health thermometer measurement if indication has been enabled. + * + * @details The application calls this function after having performed a Health Thermometer + * measurement. If indication has been enabled, the measurement data is encoded and + * sent to the client. + * + * @param[in] p_hts Health Thermometer Service structure. + * @param[in] p_hts_meas Pointer to new health thermometer measurement. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +uint32_t ble_hts_measurement_send(ble_hts_t * p_hts, ble_hts_meas_t * p_hts_meas); + +/**@brief Function for checking if indication of Temperature Measurement is currently enabled. + * + * @param[in] p_hts Health Thermometer Service structure. + * @param[out] p_indication_enabled TRUE if indication is enabled, FALSE otherwise. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +uint32_t ble_hts_is_indication_enabled(ble_hts_t * p_hts, bool * p_indication_enabled); + +#endif // BLE_HTS_H__ + +/** @} */ diff --git a/components/ble/ble_services/ble_ias/ble_ias.c b/components/ble/ble_services/ble_ias/ble_ias.c new file mode 100644 index 0000000..da33c52 --- /dev/null +++ b/components/ble/ble_services/ble_ias/ble_ias.c @@ -0,0 +1,173 @@ +/* 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. + * + */ + +/* Attention! +* To maintain compliance with Nordic Semiconductor ASAs Bluetooth profile +* qualification listings, this section of source code must not be modified. +*/ + +#include "ble_ias.h" +#include +#include "ble_srv_common.h" + + +#define INITIAL_ALERT_LEVEL BLE_CHAR_ALERT_LEVEL_NO_ALERT + + +/**@brief Function for handling the Connect event. + * + * @param[in] p_ias Immediate Alert Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_connect(ble_ias_t * p_ias, ble_evt_t * p_ble_evt) +{ + p_ias->conn_handle = p_ble_evt->evt.gap_evt.conn_handle; +} + +/**@brief Function for handling the Write event. + * + * @param[in] p_ias Immediate Alert Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_write(ble_ias_t * p_ias, ble_evt_t * p_ble_evt) +{ + ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write; + + if ((p_evt_write->handle == p_ias->alert_level_handles.value_handle) && (p_evt_write->len == 1)) + { + // Alert level written, call application event handler + ble_ias_evt_t evt; + + evt.evt_type = BLE_IAS_EVT_ALERT_LEVEL_UPDATED; + evt.params.alert_level = p_evt_write->data[0]; + + p_ias->evt_handler(p_ias, &evt); + } +} + + +void ble_ias_on_ble_evt(ble_ias_t * p_ias, ble_evt_t * p_ble_evt) +{ + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + on_connect(p_ias, p_ble_evt); + break; + + case BLE_GATTS_EVT_WRITE: + on_write(p_ias, p_ble_evt); + break; + + default: + // No implementation needed. + break; + } +} + + +/**@brief Function for adding Alert Level characteristics. + * + * @param[in] p_ias Immediate Alert Service structure. + * @param[in] p_ias_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t alert_level_char_add(ble_ias_t * p_ias) +{ + ble_gatts_char_md_t char_md; + ble_gatts_attr_t attr_char_value; + ble_uuid_t ble_uuid; + ble_gatts_attr_md_t attr_md; + uint8_t initial_alert_level; + + 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; + + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_ALERT_LEVEL_CHAR); + + 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_ENC_NO_MITM(&attr_md.write_perm); + + attr_md.vloc = BLE_GATTS_VLOC_STACK; + attr_md.rd_auth = 0; + attr_md.wr_auth = 0; + attr_md.vlen = 0; + + memset(&attr_char_value, 0, sizeof(attr_char_value)); + initial_alert_level = INITIAL_ALERT_LEVEL; + + attr_char_value.p_uuid = &ble_uuid; + attr_char_value.p_attr_md = &attr_md; + attr_char_value.init_len = sizeof (uint8_t); + attr_char_value.init_offs = 0; + attr_char_value.max_len = sizeof (uint8_t); + attr_char_value.p_value = &initial_alert_level; + + return sd_ble_gatts_characteristic_add(p_ias->service_handle, + &char_md, + &attr_char_value, + &p_ias->alert_level_handles); +} + + +uint32_t ble_ias_init(ble_ias_t * p_ias, const ble_ias_init_t * p_ias_init) +{ + uint32_t err_code; + ble_uuid_t ble_uuid; + + // Initialize service structure + if (p_ias_init->evt_handler == NULL) + { + return NRF_ERROR_INVALID_PARAM; + } + p_ias->evt_handler = p_ias_init->evt_handler; + + // Add service + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_IMMEDIATE_ALERT_SERVICE); + + err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, + &ble_uuid, + &p_ias->service_handle); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add alert level characteristic + return alert_level_char_add(p_ias); +} + + +uint32_t ble_ias_alert_level_get(ble_ias_t * p_ias, uint8_t * p_alert_level) +{ + ble_gatts_value_t gatts_value; + + // Initialize value struct. + memset(&gatts_value, 0, sizeof(gatts_value)); + + gatts_value.len = sizeof(uint8_t); + gatts_value.offset = 0; + gatts_value.p_value = p_alert_level; + + return sd_ble_gatts_value_get(p_ias->conn_handle, + p_ias->alert_level_handles.value_handle, + &gatts_value); +} diff --git a/components/ble/ble_services/ble_ias/ble_ias.h b/components/ble/ble_services/ble_ias/ble_ias.h new file mode 100644 index 0000000..6089f59 --- /dev/null +++ b/components/ble/ble_services/ble_ias/ble_ias.h @@ -0,0 +1,113 @@ +/* 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 ble_sdk_srv_ias Immediate Alert Service + * @{ + * @ingroup ble_sdk_srv + * @brief Immediate Alert Service module. + * + * @details This module implements the Immediate Alert Service with the Alert Level characteristic. + * During initialization it adds the Immediate Alert Service and Alert Level characteristic + * to the BLE stack database. + * + * The application must supply an event handler for receiving Immediate Alert Service + * events. Using this handler, the service will notify the application when the + * Alert Level characteristic value changes. + * + * The service also provides a function for letting the application poll the current + * value of the Alert Level characteristic. + * + * @note The application must propagate BLE stack events to the Immediate Alert Service + * module by calling ble_ias_on_ble_evt() from the @ref softdevice_handler callback. + * + * @note Attention! + * To maintain compliance with Nordic Semiconductor ASA Bluetooth profile + * qualification listings, this section of source code must not be modified. +*/ + +#ifndef BLE_IAS_H__ +#define BLE_IAS_H__ + +#include +#include "ble.h" + +/**@brief Immediate Alert Service event type. */ +typedef enum +{ + BLE_IAS_EVT_ALERT_LEVEL_UPDATED /**< Alert Level Updated event. */ +} ble_ias_evt_type_t; + +/**@brief Immediate Alert Service event. */ +typedef struct +{ + ble_ias_evt_type_t evt_type; /**< Type of event. */ + union + { + uint8_t alert_level; /**< New Alert Level value. */ + } params; +} ble_ias_evt_t; + +// Forward declaration of the ble_ias_t type. +typedef struct ble_ias_s ble_ias_t; + +/**@brief Immediate Alert Service event handler type. */ +typedef void (*ble_ias_evt_handler_t) (ble_ias_t * p_ias, ble_ias_evt_t * p_evt); + +/**@brief Immediate Alert Service init structure. This contains all options and data needed for + * initialization of the service. */ +typedef struct +{ + ble_ias_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Immediate Alert Service. */ +} ble_ias_init_t; + +/**@brief Immediate Alert Service structure. This contains various status information for the + * service. */ +struct ble_ias_s +{ + ble_ias_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Immediate Alert Service. */ + uint16_t service_handle; /**< Handle of Immediate Alert Service (as provided by the BLE stack). */ + ble_gatts_char_handles_t alert_level_handles; /**< Handles related to the Alert Level characteristic. */ + uint16_t conn_handle; /**< Handle of the current connection (as provided by the BLE stack, is BLE_CONN_HANDLE_INVALID if not in a connection). */ +}; + +/**@brief Function for initializing the Immediate Alert Service. + * + * @param[out] p_ias Immediate Alert 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 this particular service instance. + * @param[in] p_ias_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on successful initialization of service, otherwise an error code. + */ +uint32_t ble_ias_init(ble_ias_t * p_ias, const ble_ias_init_t * p_ias_init); + +/**@brief Function for handling the Application's BLE Stack events. + * + * @details Handles all events from the BLE stack of interest to the Immediate Alert Service. + * + * @param[in] p_ias Immediate Alert Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +void ble_ias_on_ble_evt(ble_ias_t * p_ias, ble_evt_t * p_ble_evt); + +/**@brief Function for getting current value of the Alert Level characteristic. + * + * @param[in] p_ias Immediate Alert Service structure. + * @param[out] p_alert_level Current Alert Level value. + */ +uint32_t ble_ias_alert_level_get(ble_ias_t * p_ias, uint8_t * p_alert_level); + +#endif // BLE_IAS_H__ + +/** @} */ diff --git a/components/ble/ble_services/ble_ias_c/ble_ias_c.c b/components/ble/ble_services/ble_ias_c/ble_ias_c.c new file mode 100644 index 0000000..223ec72 --- /dev/null +++ b/components/ble/ble_services/ble_ias_c/ble_ias_c.c @@ -0,0 +1,250 @@ +/* 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 "ble_ias_c.h" + +#include +#include "ble.h" +#include "ble_srv_common.h" +#include "ble_gattc.h" + +#define START_HANDLE 0x0001 /**< Start handle to be used during service discovery procedure. */ + +static ble_uuid_t m_alert_level_uuid; /**< Structure to store the UUID of Alert Level characteristic. */ + + +uint32_t ble_ias_c_init(ble_ias_c_t * p_ias_c, ble_ias_c_init_t const * p_ias_c_init) +{ + if (p_ias_c_init->evt_handler == NULL) + { + return NRF_ERROR_INVALID_PARAM; + } + + p_ias_c->evt_handler = p_ias_c_init->evt_handler; + p_ias_c->error_handler = p_ias_c_init->error_handler; + p_ias_c->conn_handle = BLE_CONN_HANDLE_INVALID; + p_ias_c->alert_level_handle = BLE_GATT_HANDLE_INVALID; + + BLE_UUID_BLE_ASSIGN(m_alert_level_uuid, BLE_UUID_ALERT_LEVEL_CHAR); + + return NRF_SUCCESS; +} + + +/**@brief Function for handling the Connect event. + * + * @param[in] p_ias_c Immediate Alert Service client structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static uint32_t on_connect(ble_ias_c_t * p_ias_c, ble_evt_t const * p_ble_evt) +{ + ble_uuid_t ias_uuid; + + p_ias_c->conn_handle = p_ble_evt->evt.gap_evt.conn_handle; + + // Discover Immediate alert service + BLE_UUID_BLE_ASSIGN(ias_uuid, BLE_UUID_IMMEDIATE_ALERT_SERVICE); + + return sd_ble_gattc_primary_services_discover(p_ias_c->conn_handle, START_HANDLE, &ias_uuid); +} + + +/**@brief Function for handling the Primary Service Discovery Response event. + * + * @param[in] p_ias_c Immediate Alert Service client structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static uint32_t on_srv_disc_resp(ble_ias_c_t * p_ias_c, ble_evt_t const * p_ble_evt) +{ + uint32_t err_code = NRF_SUCCESS; + + if ( + p_ble_evt->evt.gattc_evt.gatt_status != BLE_GATT_STATUS_SUCCESS + || + p_ble_evt->evt.gattc_evt.params.prim_srvc_disc_rsp.count == 0 + ) + { + // The Immediate Alert Service was not found at the peer. Notify the application using + // evt_handler. + ble_ias_c_evt_t evt; + + evt.evt_type = BLE_IAS_C_EVT_SRV_NOT_FOUND; + + p_ias_c->evt_handler(p_ias_c, &evt); + } + else + { + // As per Find Me profile specification, there shall be only one instance of + // Immediate Alert Service at the peer. So only the first element of the + // p_ble_evt->evt.gattc_evt.params.prim_srvc_disc_rsp.services array is of interest. + const ble_gattc_handle_range_t * p_service_handle_range = + &(p_ble_evt->evt.gattc_evt.params.prim_srvc_disc_rsp.services[0].handle_range); + + // Discover characteristics. + err_code = sd_ble_gattc_characteristics_discover(p_ias_c->conn_handle, + p_service_handle_range); + } + + return err_code; +} + + +/**@brief Function for handling the Characteristic Discovery Response event. + * + * @param[in] p_ias_c Immediate Alert Service client structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_char_disc_resp(ble_ias_c_t * p_ias_c, const ble_evt_t * p_ble_evt) +{ + ble_ias_c_evt_t evt; + + if (p_ble_evt->evt.gattc_evt.gatt_status == BLE_GATT_STATUS_SUCCESS) + { + int i; + const ble_gattc_evt_char_disc_rsp_t * p_char_disc_rsp; + + p_char_disc_rsp = &(p_ble_evt->evt.gattc_evt.params.char_disc_rsp); + + // Iterate through the characteristics and find the correct one. + for (i = 0; i < p_char_disc_rsp->count; i++) + { + if (BLE_UUID_EQ(&m_alert_level_uuid, &(p_char_disc_rsp->chars[i].uuid))) + { + // The Alert Level characteristic in the Immediate Alert Service instance is found + // on peer. Check if it has the correct property 'Write without response' as per + // Section 3.3.1.1 in Bluetooth Specification Vol 3. + if (p_char_disc_rsp->chars[i].char_props.write_wo_resp) + { + // The Alert Level characteristic has the correct property. + p_ias_c->alert_level_handle = p_char_disc_rsp->chars[i].handle_value; + + evt.evt_type = BLE_IAS_C_EVT_SRV_DISCOVERED; + + p_ias_c->evt_handler(p_ias_c, &evt); + return; + } + else + { + // The property of Alert Level characteristic is invalid. Hence break out of the + // loop. + break; + } + } + } + } + + // The Alert Level characteristic in Immediate Alert Service was not found at the peer. Notify + // the application using evt_handler. + evt.evt_type = BLE_IAS_C_EVT_SRV_NOT_FOUND; + + p_ias_c->evt_handler(p_ias_c, &evt); +} + + +/**@brief Function for handling the Disconnect event. + * + * @param[in] p_ias_c Immediate Alert Service client structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_disconnect(ble_ias_c_t * p_ias_c, ble_evt_t const * p_ble_evt) +{ + // The following values will be re-initialized when a new connection is made. + p_ias_c->conn_handle = BLE_CONN_HANDLE_INVALID; + + if (p_ias_c->alert_level_handle != BLE_GATT_HANDLE_INVALID) + { + // There was a valid instance of IAS on the peer. Send an event to the + // application, so that it can do any clean up related to this module. + ble_ias_c_evt_t evt; + + evt.evt_type = BLE_IAS_C_EVT_DISCONN_COMPLETE; + + p_ias_c->evt_handler(p_ias_c, &evt); + p_ias_c->alert_level_handle = BLE_GATT_HANDLE_INVALID; + } +} + + +void ble_ias_c_on_ble_evt(ble_ias_c_t * p_ias_c, ble_evt_t const * p_ble_evt) +{ + uint32_t err_code = NRF_SUCCESS; + + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + err_code = on_connect(p_ias_c, p_ble_evt); + break; + + case BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP: + err_code = on_srv_disc_resp(p_ias_c, p_ble_evt); + break; + + case BLE_GATTC_EVT_CHAR_DISC_RSP: + on_char_disc_resp(p_ias_c, p_ble_evt); + break; + + case BLE_GAP_EVT_DISCONNECTED: + on_disconnect(p_ias_c, p_ble_evt); + break; + + default: + // No implementation needed. + break; + } + + if (err_code != NRF_SUCCESS && p_ias_c->error_handler != 0) + { + p_ias_c->error_handler(err_code); + } +} + + +/**@brief Function for performing a Write procedure. + * + * @param[in] conn_handle Handle of the connection on which to perform the write operation. + * @param[in] write_handle Handle of the attribute to be written. + * @param[in] length Length of data to be written. + * @param[in] p_value Data to be written. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t write_characteristic_value(uint16_t conn_handle, + uint16_t write_handle, + uint16_t length, + uint8_t * p_value) +{ + ble_gattc_write_params_t write_params; + + memset(&write_params, 0, sizeof(write_params)); + + write_params.handle = write_handle; + write_params.write_op = BLE_GATT_OP_WRITE_CMD; + write_params.offset = 0; + write_params.len = length; + write_params.p_value = p_value; + + return sd_ble_gattc_write(conn_handle, &write_params); +} + + +uint32_t ble_ias_c_send_alert_level(ble_ias_c_t const * p_ias_c, uint8_t alert_level) +{ + if (!ble_ias_c_is_ias_discovered(p_ias_c)) + { + return NRF_ERROR_NOT_FOUND; + } + + return write_characteristic_value(p_ias_c->conn_handle, + p_ias_c->alert_level_handle, + sizeof(uint8_t), + &alert_level); +} diff --git a/components/ble/ble_services/ble_ias_c/ble_ias_c.h b/components/ble/ble_services/ble_ias_c/ble_ias_c.h new file mode 100644 index 0000000..4b27158 --- /dev/null +++ b/components/ble/ble_services/ble_ias_c/ble_ias_c.h @@ -0,0 +1,121 @@ +/* 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 ble_sdk_srv_ias_c Immediate Alert Service Client + * @{ + * @ingroup ble_sdk_srv + * @brief Immediate Alert Service Client module + * + * @details This module implements the Immediate Alert Service client - locator role of the Find Me + * profile. On @ref BLE_GAP_EVT_CONNECTED event, this module starts discovery of the + * Immediate Alert Service with Alert Level characteristic at the peer. This module will + * indicate the application about a successful service & characteristic discovery using + * @ref BLE_IAS_C_EVT_SRV_DISCOVERED event. The application can use @ref + * ble_ias_c_send_alert_level function to signal alerts to the peer. + * + * @note The application must propagate BLE stack events to this module by calling + * ble_ias_c_on_ble_evt() from the @ref softdevice_handler callback function. + */ + +#ifndef BLE_IAS_C_H__ +#define BLE_IAS_C_H__ + +#include "ble_srv_common.h" +#include "ble_gattc.h" +#include "ble.h" +#include + +// Forward declaration of the ble_ias_c_t type. +typedef struct ble_ias_c_s ble_ias_c_t; + +/**@brief Immediate Alert Service client event type. */ +typedef enum +{ + BLE_IAS_C_EVT_SRV_DISCOVERED, /**< Event indicating that the Immediate Alert Service is found at the peer. */ + BLE_IAS_C_EVT_SRV_NOT_FOUND, /**< Event indicating that the Immediate Alert Service is not found at the peer. */ + BLE_IAS_C_EVT_DISCONN_COMPLETE /**< Event indicating that the Immediate Alert Service client module has completed the processing of BLE_GAP_EVT_DISCONNECTED event. This event is raised only if a valid instance of IAS was found at the peer during the discovery phase. This event can be used the application to do clean up related to the IAS Client.*/ +} ble_ias_c_evt_type_t; + +/**@brief Immediate Alert Service client event. */ +typedef struct +{ + ble_ias_c_evt_type_t evt_type; /**< Type of event. */ +} ble_ias_c_evt_t; + +/**@brief Immediate Alert Service client event handler type. */ +typedef void (*ble_ias_c_evt_handler_t) (ble_ias_c_t * p_ias_c, ble_ias_c_evt_t * p_evt); + +/**@brief IAS Client structure. This contains various status information for the client. */ +struct ble_ias_c_s +{ + ble_ias_c_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Immediate Alert Service client. */ + ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */ + uint16_t alert_level_handle; /**< Handle of Alert Level characteristic at peer (as provided by the BLE stack). */ + uint16_t conn_handle; /**< Handle of the current connection (as provided by the BLE stack, is BLE_CONN_HANDLE_INVALID if not in a connection). */ +}; + +/**@brief IAS Client init structure. This contains all options and data needed for initialization of + * the client.*/ +typedef struct +{ + ble_ias_c_evt_handler_t evt_handler; /**< Event handler to be called for handling events from the Immediate Alert Service client. */ + ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */ +} ble_ias_c_init_t; + +/**@brief Function for initializing the Immediate Alert Service client. + * + * @details This call allows the application to initialize the Immediate Alert Service client. + * + * @param[out] p_ias_c Immediate Alert Service client 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 this particular client + * instance. + * @param[in] p_ias_c_init Information needed to initialize the Immediate Alert Service client. + * + * @return NRF_SUCCESS on successful initialization of service. + */ +uint32_t ble_ias_c_init(ble_ias_c_t * p_ias_c, const ble_ias_c_init_t * p_ias_c_init); + +/**@brief Function for sending alert level to the peer. + * + * @details This function allows the application to send an alert to the peer. + * + * @param[in] p_ias_c Immediate Alert Service client structure. + * @param[in] alert_level Required alert level to be sent to the peer. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +uint32_t ble_ias_c_send_alert_level(const ble_ias_c_t * p_ias_c, uint8_t alert_level); + +/**@brief Function for handling the Application's BLE Stack events for Immediate Alert Service client. + * + * @details Handles all events from the BLE stack of interest to the Immediate Alert Service client. + * + * @param[in] p_ias_c Immediate Alert Service client structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +void ble_ias_c_on_ble_evt(ble_ias_c_t * p_ias_c, const ble_evt_t * p_ble_evt); + +/**@brief Function for checking whether the peer's Immediate Alert Service instance and the alert level + * characteristic have been discovered. + * @param[in] p_ias_c Immediate Alert Service client structure. + */ +static __INLINE bool ble_ias_c_is_ias_discovered(const ble_ias_c_t * p_ias_c) +{ + return (p_ias_c->alert_level_handle != BLE_GATT_HANDLE_INVALID); +} + +#endif + +/** @} */ diff --git a/components/ble/ble_services/ble_lbs/ble_lbs.c b/components/ble/ble_services/ble_lbs/ble_lbs.c new file mode 100644 index 0000000..0ebd7bb --- /dev/null +++ b/components/ble/ble_services/ble_lbs/ble_lbs.c @@ -0,0 +1,242 @@ +/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the license.txt file. + */ + +#include +#include "ble_lbs.h" +#include "nordic_common.h" +#include "ble_srv_common.h" +#include "app_util.h" + + +/**@brief Function for handling the Connect event. + * + * @param[in] p_lbs LED Button Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_connect(ble_lbs_t * p_lbs, ble_evt_t * p_ble_evt) +{ + p_lbs->conn_handle = p_ble_evt->evt.gap_evt.conn_handle; +} + + +/**@brief Function for handling the Disconnect event. + * + * @param[in] p_lbs LED Button Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_disconnect(ble_lbs_t * p_lbs, ble_evt_t * p_ble_evt) +{ + UNUSED_PARAMETER(p_ble_evt); + p_lbs->conn_handle = BLE_CONN_HANDLE_INVALID; +} + + +/**@brief Function for handling the Write event. + * + * @param[in] p_lbs LED Button Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_write(ble_lbs_t * p_lbs, ble_evt_t * p_ble_evt) +{ + ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write; + + if ((p_evt_write->handle == p_lbs->led_char_handles.value_handle) && + (p_evt_write->len == 1) && + (p_lbs->led_write_handler != NULL)) + { + p_lbs->led_write_handler(p_lbs, p_evt_write->data[0]); + } +} + + +void ble_lbs_on_ble_evt(ble_lbs_t * p_lbs, ble_evt_t * p_ble_evt) +{ + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + on_connect(p_lbs, p_ble_evt); + break; + + case BLE_GAP_EVT_DISCONNECTED: + on_disconnect(p_lbs, p_ble_evt); + break; + + case BLE_GATTS_EVT_WRITE: + on_write(p_lbs, p_ble_evt); + break; + + default: + // No implementation needed. + break; + } +} + + +/**@brief Function for adding the LED Characteristic. + * + * @param[in] p_lbs LED Button Service structure. + * @param[in] p_lbs_init LED Button Service initialization structure. + * + * @retval NRF_SUCCESS on success, else an error value from the SoftDevice + */ +static uint32_t led_char_add(ble_lbs_t * p_lbs, const ble_lbs_init_t * p_lbs_init) +{ + ble_gatts_char_md_t char_md; + ble_gatts_attr_t attr_char_value; + ble_uuid_t ble_uuid; + ble_gatts_attr_md_t attr_md; + + memset(&char_md, 0, sizeof(char_md)); + + char_md.char_props.read = 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 = NULL; + char_md.p_sccd_md = NULL; + + ble_uuid.type = p_lbs->uuid_type; + ble_uuid.uuid = LBS_UUID_LED_CHAR; + + 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 = 0; + attr_md.vlen = 0; + + 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 = sizeof(uint8_t); + attr_char_value.init_offs = 0; + attr_char_value.max_len = sizeof(uint8_t); + attr_char_value.p_value = NULL; + + return sd_ble_gatts_characteristic_add(p_lbs->service_handle, + &char_md, + &attr_char_value, + &p_lbs->led_char_handles); +} + + +/**@brief Function for adding the Button Characteristic. + * + * @param[in] p_lbs LED Button Service structure. + * @param[in] p_lbs_init LED Button Service initialization structure. + * + * @retval NRF_SUCCESS on success, else an error value from the SoftDevice + */ +static uint32_t button_char_add(ble_lbs_t * p_lbs, const ble_lbs_init_t * p_lbs_init) +{ + 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.read = 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 = &cccd_md; + char_md.p_sccd_md = NULL; + + ble_uuid.type = p_lbs->uuid_type; + ble_uuid.uuid = LBS_UUID_BUTTON_CHAR; + + 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 = 0; + + 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 = sizeof(uint8_t); + attr_char_value.init_offs = 0; + attr_char_value.max_len = sizeof(uint8_t); + attr_char_value.p_value = NULL; + + return sd_ble_gatts_characteristic_add(p_lbs->service_handle, + &char_md, + &attr_char_value, + &p_lbs->button_char_handles); +} + +uint32_t ble_lbs_init(ble_lbs_t * p_lbs, const ble_lbs_init_t * p_lbs_init) +{ + uint32_t err_code; + ble_uuid_t ble_uuid; + + // Initialize service structure. + p_lbs->conn_handle = BLE_CONN_HANDLE_INVALID; + p_lbs->led_write_handler = p_lbs_init->led_write_handler; + + // Add service. + ble_uuid128_t base_uuid = {LBS_UUID_BASE}; + err_code = sd_ble_uuid_vs_add(&base_uuid, &p_lbs->uuid_type); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + ble_uuid.type = p_lbs->uuid_type; + ble_uuid.uuid = LBS_UUID_SERVICE; + + err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &ble_uuid, &p_lbs->service_handle); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add characteristics. + err_code = button_char_add(p_lbs, p_lbs_init); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + err_code = led_char_add(p_lbs, p_lbs_init); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + return NRF_SUCCESS; +} + +uint32_t ble_lbs_on_button_change(ble_lbs_t * p_lbs, uint8_t button_state) +{ + ble_gatts_hvx_params_t params; + uint16_t len = sizeof(button_state); + + memset(¶ms, 0, sizeof(params)); + params.type = BLE_GATT_HVX_NOTIFICATION; + params.handle = p_lbs->button_char_handles.value_handle; + params.p_data = &button_state; + params.p_len = &len; + + return sd_ble_gatts_hvx(p_lbs->conn_handle, ¶ms); +} diff --git a/components/ble/ble_services/ble_lbs/ble_lbs.h b/components/ble/ble_services/ble_lbs/ble_lbs.h new file mode 100644 index 0000000..d7a1e1e --- /dev/null +++ b/components/ble/ble_services/ble_lbs/ble_lbs.h @@ -0,0 +1,104 @@ +/* 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 ble_sdk_srv_lbs LED Button Service + * @{ + * @ingroup ble_sdk_srv + * + * @brief LED Button Service module. + * + * @details This module implements a custom LED Button Service with an LED and Button Characteristics. + * During initialization, the module adds the LED Button Service and Characteristics + * to the BLE stack database. + * + * The application must supply an event handler for receiving LED Button Service + * events. Using this handler, the service notifies the application when the + * LED value changes. + * + * The service also provides a function for letting the application notify + * the state of the Button Characteristic to connected peers. + * + * @note The application must propagate BLE stack events to the LED Button Service + * module by calling ble_lbs_on_ble_evt() from the @ref softdevice_handler callback. +*/ + +#ifndef BLE_LBS_H__ +#define BLE_LBS_H__ + +#include +#include +#include "ble.h" +#include "ble_srv_common.h" + +#define LBS_UUID_BASE {0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78, 0x23, 0x15, \ + 0xDE, 0xEF, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00} +#define LBS_UUID_SERVICE 0x1523 +#define LBS_UUID_LED_CHAR 0x1525 +#define LBS_UUID_BUTTON_CHAR 0x1524 + +// Forward declaration of the ble_lbs_t type. +typedef struct ble_lbs_s ble_lbs_t; + +typedef void (*ble_lbs_led_write_handler_t) (ble_lbs_t * p_lbs, uint8_t new_state); + +/** @brief LED Button Service init structure. This structure contains all options and data needed for + * initialization of the service.*/ +typedef struct +{ + ble_lbs_led_write_handler_t led_write_handler; /**< Event handler to be called when the LED Characteristic is written. */ +} ble_lbs_init_t; + +/**@brief LED Button Service structure. This structure contains various status information for the service. */ +struct ble_lbs_s +{ + uint16_t service_handle; /**< Handle of LED Button Service (as provided by the BLE stack). */ + ble_gatts_char_handles_t led_char_handles; /**< Handles related to the LED Characteristic. */ + ble_gatts_char_handles_t button_char_handles; /**< Handles related to the Button Characteristic. */ + uint8_t uuid_type; /**< UUID type for the LED Button Service. */ + uint16_t conn_handle; /**< Handle of the current connection (as provided by the BLE stack). BLE_CONN_HANDLE_INVALID if not in a connection. */ + ble_lbs_led_write_handler_t led_write_handler; /**< Event handler to be called when the LED Characteristic is written. */ +}; + +/**@brief Function for initializing the LED Button Service. + * + * @param[out] p_lbs LED Button Service structure. This structure must be supplied by + * the application. It is initialized by this function and will later + * be used to identify this particular service instance. + * @param[in] p_lbs_init Information needed to initialize the service. + * + * @retval NRF_SUCCESS If the service was initialized successfully. Otherwise, an error code is returned. + */ +uint32_t ble_lbs_init(ble_lbs_t * p_lbs, const ble_lbs_init_t * p_lbs_init); + +/**@brief Function for handling the application's BLE stack events. + * + * @details This function handles all events from the BLE stack that are of interest to the LED Button Service. + * + * @param[in] p_lbs LED Button Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +void ble_lbs_on_ble_evt(ble_lbs_t * p_lbs, ble_evt_t * p_ble_evt); + +/**@brief Function for sending a button state notification. + * + * @param[in] p_lbs LED Button Service structure. + * @param[in] button_state New button state. + * + * @retval NRF_SUCCESS If the notification was sent successfully. Otherwise, an error code is returned. + */ +uint32_t ble_lbs_on_button_change(ble_lbs_t * p_lbs, uint8_t button_state); + +#endif // BLE_LBS_H__ + +/** @} */ diff --git a/components/ble/ble_services/ble_lls/ble_lls.c b/components/ble/ble_services/ble_lls/ble_lls.c new file mode 100644 index 0000000..bdc1ca8 --- /dev/null +++ b/components/ble/ble_services/ble_lls/ble_lls.c @@ -0,0 +1,214 @@ +/* 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. + * + */ + +/* Attention! +* To maintain compliance with Nordic Semiconductor ASAs Bluetooth profile +* qualification listings, this section of source code must not be modified. +*/ + +#include "ble_lls.h" +#include +#include "ble_hci.h" +#include "ble_srv_common.h" + + +/**@brief Function for handling the Connect event. + * + * @param[in] p_lls Link Loss Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_connect(ble_lls_t * p_lls, ble_evt_t * p_ble_evt) +{ + // Link reconnected, notify application with a no_alert event + ble_lls_evt_t evt; + + p_lls->conn_handle = p_ble_evt->evt.gap_evt.conn_handle; + + evt.evt_type = BLE_LLS_EVT_LINK_LOSS_ALERT; + evt.params.alert_level = BLE_CHAR_ALERT_LEVEL_NO_ALERT; + p_lls->evt_handler(p_lls, &evt); +} + + +/**@brief Function for handling the Disconnect event. + * + * @param[in] p_lls Link Loss Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_disconnect(ble_lls_t * p_lls, ble_evt_t * p_ble_evt) +{ + uint8_t reason = p_ble_evt->evt.gap_evt.params.disconnected.reason; + + if (reason == BLE_HCI_CONNECTION_TIMEOUT) + { + // Link loss detected, notify application + uint32_t err_code; + ble_lls_evt_t evt; + + evt.evt_type = BLE_LLS_EVT_LINK_LOSS_ALERT; + + err_code = ble_lls_alert_level_get(p_lls, &evt.params.alert_level); + if (err_code == NRF_SUCCESS) + { + p_lls->evt_handler(p_lls, &evt); + } + else + { + if (p_lls->error_handler != NULL) + { + p_lls->error_handler(err_code); + } + } + } +} + + +/**@brief Function for handling the Authentication Status event. + * + * @param[in] p_lls Link Loss Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_auth_status(ble_lls_t * p_lls, ble_evt_t * p_ble_evt) +{ + if (p_ble_evt->evt.gap_evt.params.auth_status.auth_status == BLE_GAP_SEC_STATUS_SUCCESS) + { + ble_lls_evt_t evt; + + evt.evt_type = BLE_LLS_EVT_LINK_LOSS_ALERT; + evt.params.alert_level = BLE_CHAR_ALERT_LEVEL_NO_ALERT; + + p_lls->evt_handler(p_lls, &evt); + } +} + + +void ble_lls_on_ble_evt(ble_lls_t * p_lls, ble_evt_t * p_ble_evt) +{ + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + on_connect(p_lls, p_ble_evt); + break; + + case BLE_GAP_EVT_DISCONNECTED: + on_disconnect(p_lls, p_ble_evt); + break; + + case BLE_GAP_EVT_AUTH_STATUS: + on_auth_status(p_lls, p_ble_evt); + break; + + default: + // No implementation needed. + break; + } +} + + +/**@brief Function for adding Alert Level characteristics. + * + * @param[in] p_lls Link Loss Service structure. + * @param[in] p_lls_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t alert_level_char_add(ble_lls_t * p_lls, const ble_lls_init_t * p_lls_init) +{ + ble_gatts_char_md_t char_md; + ble_gatts_attr_t attr_char_value; + ble_uuid_t ble_uuid; + ble_gatts_attr_md_t attr_md; + uint8_t initial_alert_level; + + memset(&char_md, 0, sizeof(char_md)); + + char_md.char_props.read = 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 = NULL; + char_md.p_sccd_md = NULL; + + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_ALERT_LEVEL_CHAR); + memset(&attr_md, 0, sizeof(attr_md)); + + attr_md.read_perm = p_lls_init->lls_attr_md.read_perm; + attr_md.write_perm = p_lls_init->lls_attr_md.write_perm; + attr_md.vloc = BLE_GATTS_VLOC_STACK; + attr_md.rd_auth = 0; + attr_md.wr_auth = 0; + attr_md.vlen = 0; + + memset(&attr_char_value, 0, sizeof(attr_char_value)); + initial_alert_level = p_lls_init->initial_alert_level; + + attr_char_value.p_uuid = &ble_uuid; + attr_char_value.p_attr_md = &attr_md; + attr_char_value.init_len = sizeof (uint8_t); + attr_char_value.init_offs = 0; + attr_char_value.max_len = sizeof (uint8_t); + attr_char_value.p_value = &initial_alert_level; + + return sd_ble_gatts_characteristic_add(p_lls->service_handle, + &char_md, + &attr_char_value, + &p_lls->alert_level_handles); +} + + +uint32_t ble_lls_init(ble_lls_t * p_lls, const ble_lls_init_t * p_lls_init) +{ + uint32_t err_code; + ble_uuid_t ble_uuid; + + // Initialize service structure + if (p_lls_init->evt_handler == NULL) + { + return NRF_ERROR_INVALID_PARAM; + } + + p_lls->evt_handler = p_lls_init->evt_handler; + p_lls->error_handler = p_lls_init->error_handler; + + // Add service + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_LINK_LOSS_SERVICE); + + err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, + &ble_uuid, + &p_lls->service_handle); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add alert level characteristic + return alert_level_char_add(p_lls, p_lls_init); +} + + +uint32_t ble_lls_alert_level_get(ble_lls_t * p_lls, uint8_t * p_alert_level) +{ + ble_gatts_value_t gatts_value; + + // Initialize value struct. + memset(&gatts_value, 0, sizeof(gatts_value)); + + gatts_value.len = sizeof(uint8_t); + gatts_value.offset = 0; + gatts_value.p_value = p_alert_level; + + return sd_ble_gatts_value_get(p_lls->conn_handle, + p_lls->alert_level_handles.value_handle, + &gatts_value); +} diff --git a/components/ble/ble_services/ble_lls/ble_lls.h b/components/ble/ble_services/ble_lls/ble_lls.h new file mode 100644 index 0000000..8a3e2cb --- /dev/null +++ b/components/ble/ble_services/ble_lls/ble_lls.h @@ -0,0 +1,116 @@ +/* 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 ble_sdk_srv_lls Link Loss Service + * @{ + * @ingroup ble_sdk_srv + * @brief Link Loss Service module. + * + * @details This module implements the Link Loss Service with the Alert Level characteristic. + * During initialization it adds the Link Loss Service and Alert Level characteristic + * to the BLE stack database. + * + * The application must supply an event handler for receiving Link Loss Service + * events. Using this handler, the service will notify the application when the + * link has been lost, and which Alert Level has been set. + * + * The service also provides a function for letting the application poll the current + * value of the Alert Level characteristic. + * + * @note The application must propagate BLE stack events to the Link Loss Service + * module by calling ble_lls_on_ble_evt() from the @ref softdevice_handler callback. + * + * @note Attention! + * To maintain compliance with Nordic Semiconductor ASA Bluetooth profile + * qualification listings, this section of source code must not be modified. +*/ + +#ifndef BLE_LLS_H__ +#define BLE_LLS_H__ + +#include +#include "ble.h" +#include "ble_srv_common.h" + +/**@brief Link Loss Service event type. */ +typedef enum +{ + BLE_LLS_EVT_LINK_LOSS_ALERT /**< Alert Level Updated event. */ +} ble_lls_evt_type_t; + +/**@brief Link Loss Service event. */ +typedef struct +{ + ble_lls_evt_type_t evt_type; /**< Type of event. */ + union + { + uint8_t alert_level; /**< New Alert Level value. */ + } params; +} ble_lls_evt_t; + +// Forward declaration of the ble_lls_t type. +typedef struct ble_lls_s ble_lls_t; + +/**@brief Link Loss Service event handler type. */ +typedef void (*ble_lls_evt_handler_t) (ble_lls_t * p_lls, ble_lls_evt_t * p_evt); + +/**@brief Link Loss Service init structure. This contains all options and data needed for initialization of the service. */ +typedef struct +{ + ble_lls_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Link Loss Service. */ + ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */ + uint8_t initial_alert_level; /**< Initial value of the Alert Level characteristic. */ + ble_srv_security_mode_t lls_attr_md; /**< Initial Security Setting for Link Loss Service Characteristics. */ +} ble_lls_init_t; + +/**@brief Link Loss Service structure. This contains various status information for the service. */ +struct ble_lls_s +{ + ble_lls_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Link Loss Service. */ + ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */ + uint16_t service_handle; /**< Handle of Link Loss Service (as provided by the BLE stack). */ + ble_gatts_char_handles_t alert_level_handles; /**< Handles related to the Alert Level characteristic. */ + uint16_t conn_handle; /**< Handle of the current connection (as provided by the BLE stack, is BLE_CONN_HANDLE_INVALID if not in a connection). */ +}; + +/**@brief Function for initializing the Link Loss Service. + * + * @param[out] p_lls Link Loss 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 this particular service instance. + * @param[in] p_lls_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on successful initialization of service, otherwise an error code. + */ +uint32_t ble_lls_init(ble_lls_t * p_lls, const ble_lls_init_t * p_lls_init); + +/**@brief Function for handling the Application's BLE Stack events. + * + * @details Handles all events from the BLE stack of interest to the Link Loss Service. + * + * @param[in] p_lls Link Loss Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +void ble_lls_on_ble_evt(ble_lls_t * p_lls, ble_evt_t * p_ble_evt); + +/**@brief Function for getting current value of the Alert Level characteristic. + * + * @param[in] p_lls Link Loss Service structure. + * @param[out] p_alert_level Current Alert Level value. + */ +uint32_t ble_lls_alert_level_get(ble_lls_t * p_lls, uint8_t * p_alert_level); + +#endif // BLE_LLS_H__ + +/** @} */ diff --git a/components/ble/ble_services/ble_nus/ble_nus.c b/components/ble/ble_services/ble_nus/ble_nus.c new file mode 100644 index 0000000..f92c223 --- /dev/null +++ b/components/ble/ble_services/ble_nus/ble_nus.c @@ -0,0 +1,313 @@ +/* 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 "ble_nus.h" +#include +#include "nordic_common.h" +#include "ble_srv_common.h" + +#define BLE_UUID_NUS_TX_CHARACTERISTIC 0x0002 /**< The UUID of the TX Characteristic. */ +#define BLE_UUID_NUS_RX_CHARACTERISTIC 0x0003 /**< The UUID of the RX Characteristic. */ + +#define BLE_NUS_MAX_RX_CHAR_LEN BLE_NUS_MAX_DATA_LEN /**< Maximum length of the RX Characteristic (in bytes). */ +#define BLE_NUS_MAX_TX_CHAR_LEN BLE_NUS_MAX_DATA_LEN /**< Maximum length of the TX Characteristic (in bytes). */ + +#define NUS_BASE_UUID {{0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0, 0x93, 0xF3, 0xA3, 0xB5, 0x00, 0x00, 0x40, 0x6E}} /**< Used vendor specific UUID. */ + +/**@brief Function for handling the @ref BLE_GAP_EVT_CONNECTED event from the S110 SoftDevice. + * + * @param[in] p_nus Nordic UART Service structure. + * @param[in] p_ble_evt Pointer to the event received from BLE stack. + */ +static void on_connect(ble_nus_t * p_nus, ble_evt_t * p_ble_evt) +{ + p_nus->conn_handle = p_ble_evt->evt.gap_evt.conn_handle; +} + + +/**@brief Function for handling the @ref BLE_GAP_EVT_DISCONNECTED event from the S110 SoftDevice. + * + * @param[in] p_nus Nordic UART Service structure. + * @param[in] p_ble_evt Pointer to the event received from BLE stack. + */ +static void on_disconnect(ble_nus_t * p_nus, ble_evt_t * p_ble_evt) +{ + UNUSED_PARAMETER(p_ble_evt); + p_nus->conn_handle = BLE_CONN_HANDLE_INVALID; +} + + +/**@brief Function for handling the @ref BLE_GATTS_EVT_WRITE event from the S110 SoftDevice. + * + * @param[in] p_nus Nordic UART Service structure. + * @param[in] p_ble_evt Pointer to the event received from BLE stack. + */ +static void on_write(ble_nus_t * p_nus, ble_evt_t * p_ble_evt) +{ + ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write; + + if ( + (p_evt_write->handle == p_nus->rx_handles.cccd_handle) + && + (p_evt_write->len == 2) + ) + { + if (ble_srv_is_notification_enabled(p_evt_write->data)) + { + p_nus->is_notification_enabled = true; + } + else + { + p_nus->is_notification_enabled = false; + } + } + else if ( + (p_evt_write->handle == p_nus->tx_handles.value_handle) + && + (p_nus->data_handler != NULL) + ) + { + p_nus->data_handler(p_nus, p_evt_write->data, p_evt_write->len); + } + else + { + // Do Nothing. This event is not relevant for this service. + } +} + + +/**@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_nus_t * p_nus, const ble_nus_init_t * p_nus_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.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_nus->uuid_type; + ble_uuid.uuid = BLE_UUID_NUS_RX_CHARACTERISTIC; + + 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 = 0; + 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 = sizeof(uint8_t); + attr_char_value.init_offs = 0; + attr_char_value.max_len = BLE_NUS_MAX_RX_CHAR_LEN; + + return sd_ble_gatts_characteristic_add(p_nus->service_handle, + &char_md, + &attr_char_value, + &p_nus->rx_handles); + /**@snippet [Adding proprietary characteristic to S110 SoftDevice] */ +} + + +/**@brief Function for adding TX 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 tx_char_add(ble_nus_t * p_nus, const ble_nus_init_t * p_nus_init) +{ + ble_gatts_char_md_t char_md; + ble_gatts_attr_t attr_char_value; + ble_uuid_t ble_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.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; + + ble_uuid.type = p_nus->uuid_type; + ble_uuid.uuid = BLE_UUID_NUS_TX_CHARACTERISTIC; + + 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 = 0; + 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 = 1; + attr_char_value.init_offs = 0; + attr_char_value.max_len = BLE_NUS_MAX_TX_CHAR_LEN; + + return sd_ble_gatts_characteristic_add(p_nus->service_handle, + &char_md, + &attr_char_value, + &p_nus->tx_handles); +} + + +void ble_nus_on_ble_evt(ble_nus_t * p_nus, ble_evt_t * p_ble_evt) +{ + if ((p_nus == NULL) || (p_ble_evt == NULL)) + { + return; + } + + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + on_connect(p_nus, p_ble_evt); + break; + + case BLE_GAP_EVT_DISCONNECTED: + on_disconnect(p_nus, p_ble_evt); + break; + + case BLE_GATTS_EVT_WRITE: + on_write(p_nus, p_ble_evt); + break; + + default: + // No implementation needed. + break; + } +} + + +uint32_t ble_nus_init(ble_nus_t * p_nus, const ble_nus_init_t * p_nus_init) +{ + uint32_t err_code; + ble_uuid_t ble_uuid; + ble_uuid128_t nus_base_uuid = NUS_BASE_UUID; + + if ((p_nus == NULL) || (p_nus_init == NULL)) + { + return NRF_ERROR_NULL; + } + + // Initialize the service structure. + p_nus->conn_handle = BLE_CONN_HANDLE_INVALID; + p_nus->data_handler = p_nus_init->data_handler; + p_nus->is_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_nus->uuid_type); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + ble_uuid.type = p_nus->uuid_type; + ble_uuid.uuid = BLE_UUID_NUS_SERVICE; + + // Add the service. + err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, + &ble_uuid, + &p_nus->service_handle); + /**@snippet [Adding proprietary Service to S110 SoftDevice] */ + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add the RX Characteristic. + err_code = rx_char_add(p_nus, p_nus_init); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add the TX Characteristic. + err_code = tx_char_add(p_nus, p_nus_init); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + return NRF_SUCCESS; +} + + +uint32_t ble_nus_string_send(ble_nus_t * p_nus, uint8_t * p_string, uint16_t length) +{ + ble_gatts_hvx_params_t hvx_params; + + if (p_nus == NULL) + { + return NRF_ERROR_NULL; + } + + if ((p_nus->conn_handle == BLE_CONN_HANDLE_INVALID) || (!p_nus->is_notification_enabled)) + { + return NRF_ERROR_INVALID_STATE; + } + + if (length > BLE_NUS_MAX_DATA_LEN) + { + return NRF_ERROR_INVALID_PARAM; + } + + memset(&hvx_params, 0, sizeof(hvx_params)); + + hvx_params.handle = p_nus->rx_handles.value_handle; + hvx_params.p_data = p_string; + hvx_params.p_len = &length; + hvx_params.type = BLE_GATT_HVX_NOTIFICATION; + + return sd_ble_gatts_hvx(p_nus->conn_handle, &hvx_params); +} + + diff --git a/components/ble/ble_services/ble_nus/ble_nus.h b/components/ble/ble_services/ble_nus/ble_nus.h new file mode 100644 index 0000000..01ec813 --- /dev/null +++ b/components/ble/ble_services/ble_nus/ble_nus.h @@ -0,0 +1,114 @@ +/* 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 ble_sdk_srv_nus Nordic UART Service + * @{ + * @ingroup ble_sdk_srv + * @brief Nordic UART Service implementation. + * + * @details The Nordic UART Service is a simple GATT-based service with TX and RX characteristics. + * Data received from the peer is passed to the application, and the data received + * from the application of this service is sent to the peer as Handle Value + * Notifications. This module demonstrates how to implement a custom GATT-based + * service and characteristics using the S110 SoftDevice. The service + * is used by the application to send and receive ASCII text strings to and from the + * peer. + * + * @note The application must propagate S110 SoftDevice events to the Nordic UART Service module + * by calling the ble_nus_on_ble_evt() function from the ble_stack_handler callback. + */ + +#ifndef BLE_NUS_H__ +#define BLE_NUS_H__ + +#include "ble.h" +#include "ble_srv_common.h" +#include +#include + +#define BLE_UUID_NUS_SERVICE 0x0001 /**< The UUID of the Nordic UART Service. */ +#define BLE_NUS_MAX_DATA_LEN (GATT_MTU_SIZE_DEFAULT - 3) /**< Maximum length of data (in bytes) that can be transmitted to the peer by the Nordic UART service module. */ + +/* Forward declaration of the ble_nus_t type. */ +typedef struct ble_nus_s ble_nus_t; + +/**@brief Nordic UART Service event handler type. */ +typedef void (*ble_nus_data_handler_t) (ble_nus_t * p_nus, uint8_t * p_data, uint16_t length); + +/**@brief Nordic UART Service initialization structure. + * + * @details This structure contains the initialization information for the service. The application + * must fill this structure and pass it to the service using the @ref ble_nus_init + * function. + */ +typedef struct +{ + ble_nus_data_handler_t data_handler; /**< Event handler to be called for handling received data. */ +} ble_nus_init_t; + +/**@brief Nordic UART Service structure. + * + * @details This structure contains status information related to the service. + */ +struct ble_nus_s +{ + uint8_t uuid_type; /**< UUID type for Nordic UART Service Base UUID. */ + uint16_t service_handle; /**< Handle of Nordic UART Service (as provided by the S110 SoftDevice). */ + ble_gatts_char_handles_t tx_handles; /**< Handles related to the TX characteristic (as provided by the S110 SoftDevice). */ + ble_gatts_char_handles_t rx_handles; /**< Handles related to the RX characteristic (as provided by the S110 SoftDevice). */ + uint16_t conn_handle; /**< Handle of the current connection (as provided by the S110 SoftDevice). BLE_CONN_HANDLE_INVALID if not in a connection. */ + bool is_notification_enabled; /**< Variable to indicate if the peer has enabled notification of the RX characteristic.*/ + ble_nus_data_handler_t data_handler; /**< Event handler to be called for handling received data. */ +}; + +/**@brief Function for initializing the Nordic UART Service. + * + * @param[out] p_nus Nordic UART Service structure. This structure must be supplied + * by the application. It is initialized by this function and will + * later be used to identify this particular service instance. + * @param[in] p_nus_init Information needed to initialize the service. + * + * @retval NRF_SUCCESS If the service was successfully initialized. Otherwise, an error code is returned. + * @retval NRF_ERROR_NULL If either of the pointers p_nus or p_nus_init is NULL. + */ +uint32_t ble_nus_init(ble_nus_t * p_nus, const ble_nus_init_t * p_nus_init); + +/**@brief Function for handling the Nordic UART Service's BLE events. + * + * @details The Nordic UART Service expects the application to call this function each time an + * event is received from the S110 SoftDevice. This function processes the event if it + * is relevant and calls the Nordic UART Service event handler of the + * application if necessary. + * + * @param[in] p_nus Nordic UART Service structure. + * @param[in] p_ble_evt Event received from the S110 SoftDevice. + */ +void ble_nus_on_ble_evt(ble_nus_t * p_nus, ble_evt_t * p_ble_evt); + +/**@brief Function for sending a string to the peer. + * + * @details This function sends the input string as an RX characteristic notification to the + * peer. + * + * @param[in] p_nus Pointer to the Nordic UART Service structure. + * @param[in] p_string String to be sent. + * @param[in] length Length of the string. + * + * @retval NRF_SUCCESS If the string was sent successfully. Otherwise, an error code is returned. + */ +uint32_t ble_nus_string_send(ble_nus_t * p_nus, uint8_t * p_string, uint16_t length); + +#endif // BLE_NUS_H__ + +/** @} */ diff --git a/components/ble/ble_services/ble_nus_c/ble_nus_c.c b/components/ble/ble_services/ble_nus_c/ble_nus_c.c new file mode 100644 index 0000000..c424356 --- /dev/null +++ b/components/ble/ble_services/ble_nus_c/ble_nus_c.c @@ -0,0 +1,228 @@ +#include +#include // definition of NULL + +#include "ble.h" +#include "ble_nus_c.h" +#include "ble_db_discovery.h" +#include "ble_gattc.h" +#include "ble_srv_common.h" +#include "nordic_common.h" +#include "app_error.h" + + +static ble_nus_c_t * mp_ble_nus_c; + +/**@brief Function for handling events from the database discovery module. + * + * @details This function will handle an event from the database discovery module, and determine + * if it relates to the discovery of NUS at the peer. If so, it will + * call the application's event handler indicating that the NUS has been + * discovered at the peer. It also populates the event with the service related + * information before providing it to the application. + * + * @param[in] p_evt Pointer to the event received from the database discovery module. + * + */ +static void db_discover_evt_handler(ble_db_discovery_evt_t * p_evt) +{ + // Check if the NUS was discovered. + if (p_evt->evt_type == BLE_DB_DISCOVERY_COMPLETE && + p_evt->params.discovered_db.srv_uuid.uuid == BLE_UUID_NUS_SERVICE && + p_evt->params.discovered_db.srv_uuid.type == mp_ble_nus_c->uuid_type) + { + + uint32_t i; + + for (i = 0; i < p_evt->params.discovered_db.char_count; i++) + { + if (p_evt->params.discovered_db.charateristics[i].characteristic.uuid.uuid + == BLE_UUID_NUS_TX_CHARACTERISTIC) + { + mp_ble_nus_c->nus_tx_handle = + p_evt->params.discovered_db.charateristics[i].characteristic.handle_value; + + if (mp_ble_nus_c->evt_handler != NULL) + { + ble_nus_c_evt_t nus_c_evt; + + nus_c_evt.evt_type = BLE_NUS_C_EVT_FOUND_NUS_TX_CHARACTERISTIC; + mp_ble_nus_c->evt_handler(mp_ble_nus_c, &nus_c_evt); + } + } + else if (p_evt->params.discovered_db.charateristics[i].characteristic.uuid.uuid + == BLE_UUID_NUS_RX_CHARACTERISTIC) + { + mp_ble_nus_c->nus_rx_handle = + p_evt->params.discovered_db.charateristics[i].characteristic.handle_value; + mp_ble_nus_c->nus_rx_cccd_handle = + p_evt->params.discovered_db.charateristics[i].cccd_handle; + + if (mp_ble_nus_c->evt_handler != NULL) + { + ble_nus_c_evt_t nus_c_evt; + + nus_c_evt.evt_type = BLE_NUS_C_EVT_FOUND_NUS_RX_CHARACTERISTIC; + mp_ble_nus_c->evt_handler(mp_ble_nus_c, &nus_c_evt); + } + } + } + } +} + +/**@brief Function for handling Handle Value Notification received from the SoftDevice. + * + * @details This function will uses the Handle Value Notification received from the SoftDevice + * and checks if it is a notification of the NUS RX characteristic from the peer. If + * it is, this function will decode the data and send it to the + * application. + * + * @param[in] p_ble_nus_c Pointer to the NUS Client structure. + * @param[in] p_ble_evt Pointer to the BLE event received. + */ +static void on_hvx(ble_nus_c_t * p_ble_nus_c, const ble_evt_t * p_ble_evt) +{ + // HVX can only occur from client sending. + if ( (p_ble_nus_c->nus_rx_handle != BLE_GATT_HANDLE_INVALID) + && (p_ble_evt->evt.gattc_evt.params.hvx.handle == p_ble_nus_c->nus_rx_handle) + && (p_ble_nus_c->evt_handler != NULL) + ) + { + ble_nus_c_evt_t ble_nus_c_evt; + + ble_nus_c_evt.evt_type = BLE_NUS_C_EVT_NUS_RX_EVT; + ble_nus_c_evt.p_data = (uint8_t *)p_ble_evt->evt.gattc_evt.params.hvx.data; + ble_nus_c_evt.data_len = p_ble_evt->evt.gattc_evt.params.hvx.len; + + p_ble_nus_c->evt_handler(p_ble_nus_c, &ble_nus_c_evt); + } +} + +uint32_t ble_nus_c_init(ble_nus_c_t * p_ble_nus_c, ble_nus_c_init_t * p_ble_nus_c_init) +{ + uint32_t err_code; + ble_uuid_t uart_uuid; + ble_uuid128_t nus_base_uuid = NUS_BASE_UUID; + + if ((p_ble_nus_c == NULL) || (p_ble_nus_c_init == NULL)) + { + return NRF_ERROR_NULL; + } + + err_code = sd_ble_uuid_vs_add(&nus_base_uuid, &p_ble_nus_c->uuid_type); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + uart_uuid.type = p_ble_nus_c->uuid_type; + uart_uuid.uuid = BLE_UUID_NUS_SERVICE; + + // save the pointer to the ble_uart_c_t struct locally + mp_ble_nus_c = p_ble_nus_c; + + p_ble_nus_c->conn_handle = BLE_CONN_HANDLE_INVALID; + p_ble_nus_c->evt_handler = p_ble_nus_c_init->evt_handler; + p_ble_nus_c->nus_rx_handle = BLE_GATT_HANDLE_INVALID; + p_ble_nus_c->nus_tx_handle = BLE_GATT_HANDLE_INVALID; + + return ble_db_discovery_evt_register(&uart_uuid, db_discover_evt_handler); +} + +void ble_nus_c_on_ble_evt(ble_nus_c_t * p_ble_nus_c, const ble_evt_t * p_ble_evt) +{ + if ((p_ble_nus_c == NULL) || (p_ble_evt == NULL)) + { + return; + } + + if ( (p_ble_nus_c->conn_handle != BLE_CONN_HANDLE_INVALID) + &&(p_ble_nus_c->conn_handle != p_ble_evt->evt.gap_evt.conn_handle) + ) + { + return; + } + + switch (p_ble_evt->header.evt_id) + { + case BLE_GATTC_EVT_HVX: + on_hvx(p_ble_nus_c, p_ble_evt); + break; + + case BLE_GAP_EVT_DISCONNECTED: + if (p_ble_evt->evt.gap_evt.conn_handle == p_ble_nus_c->conn_handle + && p_ble_nus_c->evt_handler != NULL) + { + ble_nus_c_evt_t nus_c_evt; + + nus_c_evt.evt_type = BLE_NUS_C_EVT_DISCONNECTED; + + p_ble_nus_c->conn_handle = BLE_CONN_HANDLE_INVALID; + p_ble_nus_c->evt_handler(p_ble_nus_c, &nus_c_evt); + } + break; + } +} + +/**@brief Function for creating a message for writing to the CCCD. + */ +static uint32_t cccd_configure(uint16_t conn_handle, uint16_t cccd_handle, bool enable) +{ + uint8_t buf[BLE_CCCD_VALUE_LEN]; + + buf[0] = enable ? BLE_GATT_HVX_NOTIFICATION : 0; + buf[1] = 0; + + const ble_gattc_write_params_t write_params = { + .write_op = BLE_GATT_OP_WRITE_REQ, + .flags = BLE_GATT_EXEC_WRITE_FLAG_PREPARED_WRITE, + .handle = cccd_handle, + .offset = 0, + .len = sizeof(buf), + .p_value = buf + }; + + return sd_ble_gattc_write(conn_handle, &write_params); +} + +uint32_t ble_nus_c_rx_notif_enable(ble_nus_c_t * p_ble_nus_c) +{ + if (p_ble_nus_c == NULL) + { + return NRF_ERROR_NULL; + } + if ( (p_ble_nus_c->conn_handle == BLE_CONN_HANDLE_INVALID) + ||(p_ble_nus_c->nus_rx_cccd_handle == BLE_GATT_HANDLE_INVALID) + ) + { + return NRF_ERROR_INVALID_STATE; + } + return cccd_configure(p_ble_nus_c->conn_handle,p_ble_nus_c->nus_rx_cccd_handle, true); +} + +uint32_t ble_nus_c_string_send(ble_nus_c_t * p_ble_nus_c, uint8_t * p_string, uint16_t length) +{ + if (p_ble_nus_c == NULL) + { + return NRF_ERROR_NULL; + } + + if (length > BLE_NUS_MAX_DATA_LEN) + { + return NRF_ERROR_INVALID_PARAM; + } + if ( p_ble_nus_c->conn_handle == BLE_CONN_HANDLE_INVALID) + { + return NRF_ERROR_INVALID_STATE; + } + + const ble_gattc_write_params_t write_params = { + .write_op = BLE_GATT_OP_WRITE_CMD, + .flags = BLE_GATT_EXEC_WRITE_FLAG_PREPARED_WRITE, + .handle = p_ble_nus_c->nus_tx_handle, + .offset = 0, + .len = length, + .p_value = p_string + }; + + return sd_ble_gattc_write(p_ble_nus_c->conn_handle, &write_params); +} diff --git a/components/ble/ble_services/ble_nus_c/ble_nus_c.h b/components/ble/ble_services/ble_nus_c/ble_nus_c.h new file mode 100644 index 0000000..a81d281 --- /dev/null +++ b/components/ble/ble_services/ble_nus_c/ble_nus_c.h @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2012 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. + * + */ + +/**@file + * + * @defgroup ble_sdk_srv_nus_c Nordic UART Service Client + * @{ + * @ingroup ble_sdk_srv + * @brief Nordic UART Service Client module. + * + * @details This module contains the APIs and types exposed by the Nordic UART Service Client + * module. These APIs and types can be used by the application to perform discovery of + * the Nordic UART Service at the peer and interact with it. + * + * @note The application must propagate BLE stack events to this module by calling + * ble_nus_c_on_ble_evt(). + * + */ + + +#ifndef BLE_NUS_C_H__ +#define BLE_NUS_C_H__ + +#include "ble.h" +#include "ble_gatt.h" +#include +#include + +#define NUS_BASE_UUID {{0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0, 0x93, 0xF3, 0xA3, 0xB5, 0x00, 0x00, 0x40, 0x6E}} /**< Used vendor specific UUID. */ +#define BLE_UUID_NUS_SERVICE 0x0001 /**< The UUID of the Nordic UART Service. */ +#define BLE_UUID_NUS_TX_CHARACTERISTIC 0x0002 /**< The UUID of the TX Characteristic. */ +#define BLE_UUID_NUS_RX_CHARACTERISTIC 0x0003 /**< The UUID of the RX Characteristic. */ + +#define BLE_NUS_MAX_DATA_LEN (GATT_MTU_SIZE_DEFAULT - 3) /**< Maximum length of data (in bytes) that can be transmitted to the peer by the Nordic UART service module. */ + +/** + * @defgroup hrs_c_enums Enumerations + * @{ + */ + +/**@brief NUS Client event type. */ +typedef enum +{ + BLE_NUS_C_EVT_FOUND_NUS_TX_CHARACTERISTIC = 1, /**< Event indicating that the TX characteristic was found. */ + BLE_NUS_C_EVT_FOUND_NUS_RX_CHARACTERISTIC, /**< Event indicating that the RX characteristic was found. */ + BLE_NUS_C_EVT_NUS_RX_EVT, /**< Event indicating that the central has received something from a peer. */ + BLE_NUS_C_EVT_DISCONNECTED /**< Event indicating that the NUS server has disconnected. */ +} ble_nus_c_evt_type_t; + +/** @} */ + + +/** + * @defgroup hrs_c_structs Structures + * @{ + */ + +/**@brief Structure containing the NUS event data received from the peer. */ +typedef struct { + ble_nus_c_evt_type_t evt_type; + uint8_t * p_data; + uint8_t data_len; +} ble_nus_c_evt_t; + + +// Forward declaration of the ble_nus_t type. +typedef struct ble_nus_c_s ble_nus_c_t; + +/**@brief Event handler type. + * + * @details This is the type of the event handler that should be provided by the application + * of this module to receive events. + */ +typedef void (* ble_nus_c_evt_handler_t)(ble_nus_c_t * p_ble_nus_c, const ble_nus_c_evt_t * p_evt); + + +/**@brief NUS Client structure. + */ +struct ble_nus_c_s +{ + uint8_t uuid_type; /**< UUID type. */ + uint16_t conn_handle; /**< Connection handle as provided by the SoftDevice. */ + uint16_t nus_rx_handle; /**< Handle of the NUS RX characteristic as provided by a discovery. */ + uint16_t nus_rx_cccd_handle; /**< Handle of the CCCD of the NUS RX characteristic as provided by a discovery. */ + uint16_t nus_tx_handle; /**< Handle of the NUS TX characteristic as provided by a discovery. */ + ble_nus_c_evt_handler_t evt_handler; /**< Application event handler to be called when there is an event related to the NUS. */ +}; + +/**@brief NUS Client initialization structure. + */ +typedef struct { + ble_nus_c_evt_handler_t evt_handler; +} ble_nus_c_init_t; + +/** @} */ + + +/** + * @defgroup nus_c_functions Functions + * @{ + */ + +/**@brief Function for initializing the Nordic UART client module. + * + * @details This function registers with the Database Discovery module + * for the NUS. Doing so will make the Database Discovery + * module look for the presence of a NUS instance at the peer when a + * discovery is started. + * + * @param[in] p_ble_nus_c Pointer to the NUS client structure. + * @param[in] p_ble_nus_c_init Pointer to the NUS initialization structure containing the + * initialization information. + * + * @retval NRF_SUCCESS If the module was initialized successfully. Otherwise, an error + * code is returned. This function + * propagates the error code returned by the Database Discovery module API + * @ref ble_db_discovery_evt_register. + */ +uint32_t ble_nus_c_init(ble_nus_c_t * p_ble_nus_c, ble_nus_c_init_t * p_ble_nus_c_init); + +/**@brief Function for handling BLE events from the SoftDevice. + * + * @details This function handles the BLE events received from the SoftDevice. If a BLE + * event is relevant to the NUS module, it is used to update + * internal variables and, if necessary, send events to the application. + * + * @param[in] p_ble_nus_c Pointer to the NUS client structure. + * @param[in] p_ble_evt Pointer to the BLE event. + */ +void ble_nus_c_on_ble_evt(ble_nus_c_t * p_ble_nus_c, const ble_evt_t * p_ble_evt); + +/**@brief Function for requesting the peer to start sending notification of RX characteristic. + * + * @details This function enables notifications of the NUS RX characteristic at the peer + * by writing to the CCCD of the NUS RX characteristic. + * + * @param p_ble_nus_c Pointer to the NUS client structure. + * + * @retval NRF_SUCCESS If the SoftDevice has been requested to write to the CCCD of the peer. + * Otherwise, an error code is returned. This function propagates the error + * code returned by the SoftDevice API @ref sd_ble_gattc_write. + */ +uint32_t ble_nus_c_rx_notif_enable(ble_nus_c_t * p_ble_nus_c); + +/**@brief Function for sending a string to the server. + * + * @details This function writes the TX characteristic of the server. + * + * @param[in] p_ble_nus_c Pointer to the NUS client structure. + * @param[in] p_string String to be sent. + * @param[in] length Length of the string. + * + * @retval NRF_SUCCESS If the string was sent successfully. Otherwise, an error code is returned. + */ +uint32_t ble_nus_c_string_send(ble_nus_c_t * p_ble_nus_c, uint8_t * p_string, uint16_t length); + +/** @} */ + +#endif // BLE_NUS_C_H__ + +/** @} */ diff --git a/components/ble/ble_services/ble_rscs/ble_rscs.c b/components/ble/ble_services/ble_rscs/ble_rscs.c new file mode 100644 index 0000000..eac2bf5 --- /dev/null +++ b/components/ble/ble_services/ble_rscs/ble_rscs.c @@ -0,0 +1,385 @@ +/* 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. + * + */ + +/* Attention! +* To maintain compliance with Nordic Semiconductor ASAs Bluetooth profile +* qualification listings, this section of source code must not be modified. +*/ + +#include "ble_rscs.h" +#include +#include "nordic_common.h" +#include "ble_l2cap.h" +#include "ble_srv_common.h" +#include "app_util.h" + +#define OPCODE_LENGTH 1 /**< Length of opcode inside Running Speed and Cadence Measurement packet. */ +#define HANDLE_LENGTH 2 /**< Length of handle inside Running Speed and Cadence Measurement packet. */ +#define MAX_RSCM_LEN (BLE_L2CAP_MTU_DEF - OPCODE_LENGTH - HANDLE_LENGTH) /**< Maximum size of a transmitted Running Speed and Cadence Measurement. */ + +// Running Speed and Cadence Measurement flag bits +#define RSC_MEAS_FLAG_INSTANT_STRIDE_LEN_PRESENT (0x01 << 0) /**< Instantaneous Stride Length Present flag bit. */ +#define RSC_MEAS_FLAG_TOTAL_DISTANCE_PRESENT (0x01 << 1) /**< Total Distance Present flag bit. */ +#define RSC_MEAS_FLAG_WALKING_OR_RUNNING_BIT (0x01 << 2) /**< Walking or Running Status flag bit. */ + + +/**@brief Function for handling the Connect event. + * + * @param[in] p_rscs Running Speed and Cadence Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_connect(ble_rscs_t * p_rscs, ble_evt_t * p_ble_evt) +{ + p_rscs->conn_handle = p_ble_evt->evt.gap_evt.conn_handle; +} + + +/**@brief Function for handling the Disconnect event. + * + * @param[in] p_rscs Running Speed and Cadence Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_disconnect(ble_rscs_t * p_rscs, ble_evt_t * p_ble_evt) +{ + UNUSED_PARAMETER(p_ble_evt); + p_rscs->conn_handle = BLE_CONN_HANDLE_INVALID; +} + + +/**@brief Function for handling the write events to the RSCS Measurement characteristic. + * + * @param[in] p_rscs Running Speed and Cadence Service structure. + * @param[in] p_evt_write Write event received from the BLE stack. + */ +static void on_meas_cccd_write(ble_rscs_t * p_rscs, ble_gatts_evt_write_t * p_evt_write) +{ + if (p_evt_write->len == 2) + { + // CCCD written, update notification state + if (p_rscs->evt_handler != NULL) + { + ble_rscs_evt_t evt; + + if (ble_srv_is_notification_enabled(p_evt_write->data)) + { + evt.evt_type = BLE_RSCS_EVT_NOTIFICATION_ENABLED; + } + else + { + evt.evt_type = BLE_RSCS_EVT_NOTIFICATION_DISABLED; + } + + p_rscs->evt_handler(p_rscs, &evt); + } + } +} + + +/**@brief Function for handling the Write event. + * + * @param[in] p_rscs Running Speed and Cadence Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_write(ble_rscs_t * p_rscs, ble_evt_t * p_ble_evt) +{ + ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write; + + if (p_evt_write->handle == p_rscs->meas_handles.cccd_handle) + { + on_meas_cccd_write(p_rscs, p_evt_write); + } +} + + +void ble_rscs_on_ble_evt(ble_rscs_t * p_rscs, ble_evt_t * p_ble_evt) +{ + if (p_rscs == NULL || p_ble_evt == NULL) + { + return; + } + + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + on_connect(p_rscs, p_ble_evt); + break; + + case BLE_GAP_EVT_DISCONNECTED: + on_disconnect(p_rscs, p_ble_evt); + break; + + case BLE_GATTS_EVT_WRITE: + on_write(p_rscs, p_ble_evt); + break; + + default: + // No implementation needed. + break; + } +} + + +/**@brief Function for encoding a RSCS Measurement. + * + * @param[in] p_rscs Running Speed and Cadence Service structure. + * @param[in] p_rsc_measurement Measurement to be encoded. + * @param[out] p_encoded_buffer Buffer where the encoded data will be written. + * + * @return Size of encoded data. + */ +static uint8_t rsc_measurement_encode(const ble_rscs_t * p_rscs, + const ble_rscs_meas_t * p_rsc_measurement, + uint8_t * p_encoded_buffer) +{ + uint8_t flags = 0; + uint8_t len = 1; + + // Instantaneous speed field + len += uint16_encode(p_rsc_measurement->inst_speed, &p_encoded_buffer[len]); + + // Instantaneous cadence field + p_encoded_buffer[len++] = p_rsc_measurement->inst_cadence; + + // Instantaneous stride length field + if (p_rscs->feature & BLE_RSCS_FEATURE_INSTANT_STRIDE_LEN_BIT) + { + if (p_rsc_measurement->is_inst_stride_len_present) + { + flags |= RSC_MEAS_FLAG_INSTANT_STRIDE_LEN_PRESENT; + len += uint16_encode(p_rsc_measurement->inst_stride_length, + &p_encoded_buffer[len]); + } + } + + // Total distance field + if (p_rscs->feature & BLE_RSCS_FEATURE_TOTAL_DISTANCE_BIT) + { + if (p_rsc_measurement->is_total_distance_present) + { + flags |= RSC_MEAS_FLAG_TOTAL_DISTANCE_PRESENT; + len += uint32_encode(p_rsc_measurement->total_distance, &p_encoded_buffer[len]); + } + } + + // Flags field + if (p_rscs->feature & BLE_RSCS_FEATURE_WALKING_OR_RUNNING_STATUS_BIT) + { + if (p_rsc_measurement->is_running) + { + flags |= RSC_MEAS_FLAG_WALKING_OR_RUNNING_BIT; + } + } + p_encoded_buffer[0] = flags; + + return len; +} + + +/**@brief Function for adding RSC Measurement characteristics. + * + * @param[in] p_rscs Running Speed and Cadence Service structure. + * @param[in] p_rscs_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t rsc_measurement_char_add(ble_rscs_t * p_rscs, const ble_rscs_init_t * p_rscs_init) +{ + 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; + uint8_t encoded_rcm[MAX_RSCM_LEN]; + + memset(&cccd_md, 0, sizeof(cccd_md)); + + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm); + cccd_md.write_perm = p_rscs_init->rsc_meas_attr_md.cccd_write_perm; + cccd_md.vloc = BLE_GATTS_VLOC_STACK; + + memset(&char_md, 0, sizeof(char_md)); + + 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 = &cccd_md; + char_md.p_sccd_md = NULL; + + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_RSC_MEASUREMENT_CHAR); + memset(&attr_md, 0, sizeof(attr_md)); + + attr_md.read_perm = p_rscs_init->rsc_meas_attr_md.read_perm; + attr_md.write_perm = p_rscs_init->rsc_meas_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 = &ble_uuid; + attr_char_value.p_attr_md = &attr_md; + attr_char_value.init_len = rsc_measurement_encode(p_rscs, &p_rscs_init->initial_rcm, encoded_rcm); + attr_char_value.init_offs = 0; + attr_char_value.max_len = MAX_RSCM_LEN; + attr_char_value.p_value = encoded_rcm; + + return sd_ble_gatts_characteristic_add(p_rscs->service_handle, + &char_md, + &attr_char_value, + &p_rscs->meas_handles); +} + + +/**@brief Function for adding RSC Feature characteristics. + * + * @param[in] p_rscs Running Speed and Cadence Service structure. + * @param[in] p_rscs_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t rsc_feature_char_add(ble_rscs_t * p_rscs, const ble_rscs_init_t * p_rscs_init) +{ + ble_gatts_char_md_t char_md; + ble_gatts_attr_t attr_char_value; + ble_uuid_t ble_uuid; + ble_gatts_attr_md_t attr_md; + uint16_t init_value_feature; + uint8_t init_value_encoded[2]; + + 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; + + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_RSC_FEATURE_CHAR); + + memset(&attr_md, 0, sizeof(attr_md)); + + attr_md.read_perm = p_rscs_init->rsc_feature_attr_md.read_perm; + attr_md.write_perm = p_rscs_init->rsc_feature_attr_md.write_perm; + attr_md.vloc = BLE_GATTS_VLOC_STACK; + attr_md.rd_auth = 0; + attr_md.wr_auth = 0; + attr_md.vlen = 0; + + memset(&attr_char_value, 0, sizeof(attr_char_value)); + + init_value_feature = p_rscs_init->feature; + init_value_encoded[0] = init_value_feature & 0xFF; + init_value_encoded[1] = (init_value_feature >> 8) & 0xFF; + + attr_char_value.p_uuid = &ble_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 = init_value_encoded; + + return sd_ble_gatts_characteristic_add(p_rscs->service_handle, + &char_md, + &attr_char_value, + &p_rscs->feature_handles); +} + + +uint32_t ble_rscs_init(ble_rscs_t * p_rscs, const ble_rscs_init_t * p_rscs_init) +{ + if (p_rscs == NULL || p_rscs_init == NULL) + { + return NRF_ERROR_NULL; + } + + uint32_t err_code; + ble_uuid_t ble_uuid; + + // Initialize service structure + p_rscs->evt_handler = p_rscs_init->evt_handler; + p_rscs->conn_handle = BLE_CONN_HANDLE_INVALID; + p_rscs->feature = p_rscs_init->feature; + + // Add service + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_RUNNING_SPEED_AND_CADENCE); + + err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, + &ble_uuid, + &p_rscs->service_handle); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add measurement characteristic + err_code = rsc_measurement_char_add(p_rscs, p_rscs_init); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add feature characteristic + err_code = rsc_feature_char_add(p_rscs, p_rscs_init); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + return NRF_SUCCESS; +} + + +uint32_t ble_rscs_measurement_send(ble_rscs_t * p_rscs, ble_rscs_meas_t * p_measurement) +{ + if (p_rscs == NULL || p_measurement == NULL) + { + return NRF_ERROR_NULL; + } + + uint32_t err_code; + + // Send value if connected and notifying + if (p_rscs->conn_handle != BLE_CONN_HANDLE_INVALID) + { + uint8_t encoded_rsc_meas[MAX_RSCM_LEN]; + uint16_t len; + uint16_t hvx_len; + ble_gatts_hvx_params_t hvx_params; + + len = rsc_measurement_encode(p_rscs, p_measurement, encoded_rsc_meas); + hvx_len = len; + + memset(&hvx_params, 0, sizeof(hvx_params)); + + hvx_params.handle = p_rscs->meas_handles.value_handle; + hvx_params.type = BLE_GATT_HVX_NOTIFICATION; + hvx_params.offset = 0; + hvx_params.p_len = &hvx_len; + hvx_params.p_data = encoded_rsc_meas; + + err_code = sd_ble_gatts_hvx(p_rscs->conn_handle, &hvx_params); + if ((err_code == NRF_SUCCESS) && (hvx_len != len)) + { + err_code = NRF_ERROR_DATA_SIZE; + } + } + else + { + err_code = NRF_ERROR_INVALID_STATE; + } + + return err_code; +} diff --git a/components/ble/ble_services/ble_rscs/ble_rscs.h b/components/ble/ble_services/ble_rscs/ble_rscs.h new file mode 100644 index 0000000..4c5c2d9 --- /dev/null +++ b/components/ble/ble_services/ble_rscs/ble_rscs.h @@ -0,0 +1,144 @@ +/* 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 ble_sdk_srv_rsc Running Speed and Cadence Service + * @{ + * @ingroup ble_sdk_srv + * @brief Running Speed and Cadence Service module. + * + * @details This module implements the Running Speed and Cadence Service. If enabled, notification + * of the Running Speead and Candence Measurement is performed when the application + * calls ble_rscs_measurement_send(). + * + * If an event handler is supplied by the application, the Running Speed and Cadence + * Service will generate Running Speed and Cadence Service events to the application. + * + * @note The application must propagate BLE stack events to the Running Speead and Candence Service + * module by calling ble_rscs_on_ble_evt() from the @ref softdevice_handler function. + * + * @note Attention! + * To maintain compliance with Nordic Semiconductor ASA Bluetooth profile + * qualification listings, this section of source code must not be modified. + */ + +#ifndef BLE_RSCS_H__ +#define BLE_RSCS_H__ + +#include +#include +#include "ble.h" +#include "ble_srv_common.h" + +/**@brief Running Speed and Cadence Service feature bits. */ +#define BLE_RSCS_FEATURE_INSTANT_STRIDE_LEN_BIT (0x01 << 0) /**< Instantaneous Stride Length Measurement Supported bit. */ +#define BLE_RSCS_FEATURE_TOTAL_DISTANCE_BIT (0x01 << 1) /**< Total Distance Measurement Supported bit. */ +#define BLE_RSCS_FEATURE_WALKING_OR_RUNNING_STATUS_BIT (0x01 << 2) /**< Walking or Running Status Supported bit. */ +#define BLE_RSCS_FEATURE_CALIBRATION_PROCEDURE_BIT (0x01 << 3) /**< Calibration Procedure Supported bit. */ +#define BLE_RSCS_FEATURE_MULTIPLE_SENSORS_BIT (0x01 << 4) /**< Multiple Sensor Locations Supported bit. */ + +/**@brief Running Speed and Cadence Service event type. */ +typedef enum +{ + BLE_RSCS_EVT_NOTIFICATION_ENABLED, /**< Running Speed and Cadence value notification enabled event. */ + BLE_RSCS_EVT_NOTIFICATION_DISABLED /**< Running Speed and Cadence value notification disabled event. */ +} ble_rscs_evt_type_t; + +/**@brief Running Speed and Cadence Service event. */ +typedef struct +{ + ble_rscs_evt_type_t evt_type; /**< Type of event. */ +} ble_rscs_evt_t; + +// Forward declaration of the ble_rsc types. +typedef struct ble_rscs_s ble_rscs_t; +typedef struct ble_rscs_meas_s ble_rscs_meas_t; + +/**@brief Running Speed and Cadence Service event handler type. */ +typedef void (*ble_rscs_evt_handler_t) (ble_rscs_t * p_rscs, ble_rscs_evt_t * p_evt); + +/**@brief Running Speed and Cadence Service measurement structure. This contains a Running Speed and + * Cadence measurement. */ +struct ble_rscs_meas_s +{ + bool is_inst_stride_len_present; /**< True if Instantaneous Stride Length is present in the measurement. */ + bool is_total_distance_present; /**< True if Total Distance is present in the measurement. */ + bool is_running; /**< True if running, False if walking. */ + uint16_t inst_speed; /**< Instantaneous Speed. */ + uint8_t inst_cadence; /**< Instantaneous Cadence. */ + uint16_t inst_stride_length; /**< Instantaneous Stride Length. */ + uint32_t total_distance; /**< Total Distance. */ +}; + +/**@brief Running Speed and Cadence Service init structure. This contains all options and data + * needed for initialization of the service. */ +typedef struct +{ + ble_rscs_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Running Speed and Cadence Service. */ + ble_srv_cccd_security_mode_t rsc_meas_attr_md; /**< Initial security level for running speed and cadence measurement attribute */ + ble_srv_security_mode_t rsc_feature_attr_md; /**< Initial security level for feature attribute */ + uint16_t feature; /**< Initial value for features of sensor. */ + ble_rscs_meas_t initial_rcm; /**< Initial Running Speed Cadence Measurement.*/ +} ble_rscs_init_t; + +/**@brief Running Speed and Cadence Service structure. This contains various status information for + * the service. */ +struct ble_rscs_s +{ + ble_rscs_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Running Speed and Cadence Service. */ + uint16_t service_handle; /**< Handle of Running Speed and Cadence Service (as provided by the BLE stack). */ + ble_gatts_char_handles_t meas_handles; /**< Handles related to the Running Speed and Cadence Measurement characteristic. */ + ble_gatts_char_handles_t feature_handles; /**< Handles related to the Running Speed and Cadence feature characteristic. */ + uint16_t conn_handle; /**< Handle of the current connection (as provided by the BLE stack, is BLE_CONN_HANDLE_INVALID if not in a connection). */ + uint16_t feature; /**< Bit mask of features available on sensor. */ +}; + + + +/**@brief Function for initializing the Running Speed and Cadence Service. + * + * @param[out] p_rscs Running Speed and Cadence 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 this particular service instance. + * @param[in] p_rscs_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on successful initialization of service, otherwise an error code. + */ +uint32_t ble_rscs_init(ble_rscs_t * p_rscs, const ble_rscs_init_t * p_rscs_init); + +/**@brief Function for handling the Application's BLE Stack events. + * + * @details Handles all events from the BLE stack of interest to the Running Speed and Cadence + * Service. + * + * @param[in] p_rscs Running Speed and Cadence Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +void ble_rscs_on_ble_evt(ble_rscs_t * p_rscs, ble_evt_t * p_ble_evt); + +/**@brief Function for sending running speed and cadence measurement if notification has been enabled. + * + * @details The application calls this function after having performed a Running Speed and Cadence + * measurement. If notification has been enabled, the measurement data is encoded and sent + * to the client. + * + * @param[in] p_rscs Running Speed and Cadence Service structure. + * @param[in] p_measurement Pointer to new running speed and cadence measurement. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +uint32_t ble_rscs_measurement_send(ble_rscs_t * p_rscs, ble_rscs_meas_t * p_measurement); + +#endif // BLE_RSCS_H__ + +/** @} */ diff --git a/components/ble/ble_services/ble_rscs_c/ble_rscs_c.c b/components/ble/ble_services/ble_rscs_c/ble_rscs_c.c new file mode 100644 index 0000000..8f200a2 --- /dev/null +++ b/components/ble/ble_services/ble_rscs_c/ble_rscs_c.c @@ -0,0 +1,308 @@ +/* + * Copyright (c) 2012 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. + * + */ + +/**@cond To Make Doxygen skip documentation generation for this file. + * @{ + */ + +#include +#include "ble_rscs_c.h" +#include "ble_db_discovery.h" +#include "ble_types.h" +#include "ble_srv_common.h" +#include "nordic_common.h" +#include "nrf_error.h" +#include "ble_gattc.h" +#include "app_util.h" +#include "app_trace.h" + +#define LOG app_trace_log /**< Debug logger macro that will be used in this file to do logging of important information over UART. */ + +#define TX_BUFFER_MASK 0x07 /**< TX Buffer mask, must be a mask of continuous zeroes, followed by continuous sequence of ones: 000...111. */ +#define TX_BUFFER_SIZE (TX_BUFFER_MASK + 1) /**< Size of send buffer, which is 1 higher than the mask. */ + +#define WRITE_MESSAGE_LENGTH BLE_CCCD_VALUE_LEN /**< Length of the write message for CCCD. */ + +typedef enum +{ + READ_REQ, /**< Type identifying that this tx_message is a read request. */ + WRITE_REQ /**< Type identifying that this tx_message is a write request. */ +} tx_request_t; + +/**@brief Structure for writing a message to the peer, i.e. CCCD. + */ +typedef struct +{ + uint8_t gattc_value[WRITE_MESSAGE_LENGTH]; /**< The message to write. */ + ble_gattc_write_params_t gattc_params; /**< GATTC parameters for this message. */ +} write_params_t; + +/**@brief Structure for holding data to be transmitted to the connected central. + */ +typedef struct +{ + uint16_t conn_handle; /**< Connection handle to be used when transmitting this message. */ + tx_request_t type; /**< Type of this message, i.e. read or write message. */ + union + { + uint16_t read_handle; /**< Read request message. */ + write_params_t write_req; /**< Write request message. */ + } req; +} tx_message_t; + + +static ble_rscs_c_t * mp_ble_rscs_c; /**< Pointer to the current instance of the HRS Client module. The memory for this provided by the application.*/ +static tx_message_t m_tx_buffer[TX_BUFFER_SIZE]; /**< Transmit buffer for messages to be transmitted to the central. */ +static uint32_t m_tx_insert_index = 0; /**< Current index in the transmit buffer where the next message should be inserted. */ +static uint32_t m_tx_index = 0; /**< Current index in the transmit buffer from where the next message to be transmitted resides. */ + + +/**@brief Function for passing any pending request from the buffer to the stack. + */ +static void tx_buffer_process(void) +{ + if (m_tx_index != m_tx_insert_index) + { + uint32_t err_code; + + if (m_tx_buffer[m_tx_index].type == READ_REQ) + { + err_code = sd_ble_gattc_read(m_tx_buffer[m_tx_index].conn_handle, + m_tx_buffer[m_tx_index].req.read_handle, + 0); + } + else + { + err_code = sd_ble_gattc_write(m_tx_buffer[m_tx_index].conn_handle, + &m_tx_buffer[m_tx_index].req.write_req.gattc_params); + } + if (err_code == NRF_SUCCESS) + { + LOG("[RSCS_C]: SD Read/Write API returns Success.\r\n"); + m_tx_index++; + m_tx_index &= TX_BUFFER_MASK; + } + else + { + LOG("[RSCS_C]: SD Read/Write API returns error. This message sending will be " + "attempted again..\r\n"); + } + } +} + + +/**@brief Function for handling write response events. + * + * @param[in] p_ble_rscs_c Pointer to the Running Speed and Cadence Client structure. + * @param[in] p_ble_evt Pointer to the BLE event received. + */ +static void on_write_rsp(ble_rscs_c_t * p_ble_rscs_c, const ble_evt_t * p_ble_evt) +{ + // Check if there is any message to be sent across to the peer and send it. + tx_buffer_process(); +} + + +/**@brief Function for handling Handle Value Notification received from the SoftDevice. + * + * @details This function will uses the Handle Value Notification received from the SoftDevice + * and checks if it is a notification of the Running Speed and Cadence measurement from + * the peer. If it is, this function will decode the Running Speed measurement and send it + * to the application. + * + * @param[in] p_ble_rscs_c Pointer to the Running Speed and Cadence Client structure. + * @param[in] p_ble_evt Pointer to the BLE event received. + */ +static void on_hvx(ble_rscs_c_t * p_ble_rscs_c, const ble_evt_t * p_ble_evt) +{ + const ble_gattc_evt_hvx_t * p_notif = &p_ble_evt->evt.gattc_evt.params.hvx; + + // Check if this is a Running Speed and Cadence notification. + if (p_ble_evt->evt.gattc_evt.params.hvx.handle == p_ble_rscs_c->rsc_handle) + { + uint32_t index = 0; + ble_rscs_c_evt_t ble_rscs_c_evt; + ble_rscs_c_evt.evt_type = BLE_RSCS_C_EVT_RSC_NOTIFICATION; + + //lint -save -e415 -e416 -e662 "Access of out of bounds pointer" "Creation of out of bounds pointer" + + // Flags field + ble_rscs_c_evt.params.rsc.is_inst_stride_len_present = p_notif->data[index] >> BLE_RSCS_INSTANT_STRIDE_LEN_PRESENT & 0x01; + ble_rscs_c_evt.params.rsc.is_total_distance_present = p_notif->data[index] >> BLE_RSCS_TOTAL_DISTANCE_PRESENT & 0x01; + ble_rscs_c_evt.params.rsc.is_running = p_notif->data[index] >> BLE_RSCS_WALKING_OR_RUNNING_STATUS_BIT & 0x01; + index++; + + // Instantaneous Speed + ble_rscs_c_evt.params.rsc.inst_speed = uint16_decode(&p_notif->data[index]); + index += sizeof(uint16_t); + + // Instantaneous Cadence + ble_rscs_c_evt.params.rsc.inst_cadence = p_notif->data[index]; + index++; + + // Instantaneous Stride Length + if (ble_rscs_c_evt.params.rsc.is_inst_stride_len_present == true) + { + ble_rscs_c_evt.params.rsc.inst_stride_length = uint16_decode(&p_notif->data[index]); + index += sizeof(uint16_t); + } + + // Total distance field + if (ble_rscs_c_evt.params.rsc.is_total_distance_present == true) + { + ble_rscs_c_evt.params.rsc.total_distance = uint32_decode(&p_notif->data[index]); + //index += sizeof(uint32_t); + } + + p_ble_rscs_c->evt_handler(p_ble_rscs_c, &ble_rscs_c_evt); + + //lint -restore + } +} + + +/**@brief Function for handling events from the database discovery module. + * + * @details This function will handle an event from the database discovery module, and determine + * if it relates to the discovery of heart rate service at the peer. If so, it will + * call the application's event handler indicating that the Running Speed and Cadence + * service has been discovered at the peer. It also populates the event with the service + * related information before providing it to the application. + * + * @param[in] p_evt Pointer to the event received from the database discovery module. + * + */ +static void db_discover_evt_handler(ble_db_discovery_evt_t * p_evt) +{ + // Check if the Heart Rate Service was discovered. + if (p_evt->evt_type == BLE_DB_DISCOVERY_COMPLETE && + p_evt->params.discovered_db.srv_uuid.uuid == BLE_UUID_RUNNING_SPEED_AND_CADENCE && + p_evt->params.discovered_db.srv_uuid.type == BLE_UUID_TYPE_BLE) + { + mp_ble_rscs_c->conn_handle = p_evt->conn_handle; + + // Find the CCCD Handle of the Running Speed and Cadence characteristic. + uint32_t i; + + for (i = 0; i < p_evt->params.discovered_db.char_count; i++) + { + if (p_evt->params.discovered_db.charateristics[i].characteristic.uuid.uuid == + BLE_UUID_RSC_MEASUREMENT_CHAR) + { + // Found Running Speed and Cadence characteristic. Store CCCD handle and break. + mp_ble_rscs_c->rsc_cccd_handle = + p_evt->params.discovered_db.charateristics[i].cccd_handle; + mp_ble_rscs_c->rsc_handle = + p_evt->params.discovered_db.charateristics[i].characteristic.handle_value; + break; + } + } + + LOG("[rscs_c]: Running Speed and Cadence Service discovered at peer.\r\n"); + + ble_rscs_c_evt_t evt; + + evt.evt_type = BLE_RSCS_C_EVT_DISCOVERY_COMPLETE; + + mp_ble_rscs_c->evt_handler(mp_ble_rscs_c, &evt); + } +} + + +uint32_t ble_rscs_c_init(ble_rscs_c_t * p_ble_rscs_c, ble_rscs_c_init_t * p_ble_rscs_c_init) +{ + if ((p_ble_rscs_c == NULL) || (p_ble_rscs_c_init == NULL)) + { + return NRF_ERROR_NULL; + } + + ble_uuid_t rscs_uuid; + + rscs_uuid.type = BLE_UUID_TYPE_BLE; + rscs_uuid.uuid = BLE_UUID_RUNNING_SPEED_AND_CADENCE; + + mp_ble_rscs_c = p_ble_rscs_c; + + mp_ble_rscs_c->evt_handler = p_ble_rscs_c_init->evt_handler; + mp_ble_rscs_c->conn_handle = BLE_CONN_HANDLE_INVALID; + mp_ble_rscs_c->rsc_cccd_handle = BLE_GATT_HANDLE_INVALID; + + return ble_db_discovery_evt_register(&rscs_uuid, + db_discover_evt_handler); +} + + +void ble_rscs_c_on_ble_evt(ble_rscs_c_t * p_ble_rscs_c, const ble_evt_t * p_ble_evt) +{ + if ((p_ble_rscs_c == NULL) || (p_ble_evt == NULL)) + { + return; + } + + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + p_ble_rscs_c->conn_handle = p_ble_evt->evt.gap_evt.conn_handle; + break; + + case BLE_GATTC_EVT_HVX: + on_hvx(p_ble_rscs_c, p_ble_evt); + break; + + case BLE_GATTC_EVT_WRITE_RSP: + on_write_rsp(p_ble_rscs_c, p_ble_evt); + break; + + default: + break; + } +} + + +/**@brief Function for creating a message for writing to the CCCD. + */ +static uint32_t cccd_configure(uint16_t conn_handle, uint16_t handle_cccd, bool enable) +{ + LOG("[rscs_c]: Configuring CCCD. CCCD Handle = %d, Connection Handle = %d\r\n", + handle_cccd, conn_handle); + + tx_message_t * p_msg; + uint16_t cccd_val = enable ? BLE_GATT_HVX_NOTIFICATION : 0; + + p_msg = &m_tx_buffer[m_tx_insert_index++]; + m_tx_insert_index &= TX_BUFFER_MASK; + + p_msg->req.write_req.gattc_params.handle = handle_cccd; + p_msg->req.write_req.gattc_params.len = WRITE_MESSAGE_LENGTH; + p_msg->req.write_req.gattc_params.p_value = p_msg->req.write_req.gattc_value; + p_msg->req.write_req.gattc_params.offset = 0; + p_msg->req.write_req.gattc_params.write_op = BLE_GATT_OP_WRITE_REQ; + p_msg->req.write_req.gattc_value[0] = LSB_16(cccd_val); + p_msg->req.write_req.gattc_value[1] = MSB_16(cccd_val); + p_msg->conn_handle = conn_handle; + p_msg->type = WRITE_REQ; + + tx_buffer_process(); + return NRF_SUCCESS; +} + + +uint32_t ble_rscs_c_rsc_notif_enable(ble_rscs_c_t * p_ble_rscs_c) +{ + if (p_ble_rscs_c == NULL) + { + return NRF_ERROR_NULL; + } + + return cccd_configure(p_ble_rscs_c->conn_handle, p_ble_rscs_c->rsc_cccd_handle, true); +} + +/** @} + * @endcond + */ diff --git a/components/ble/ble_services/ble_rscs_c/ble_rscs_c.h b/components/ble/ble_services/ble_rscs_c/ble_rscs_c.h new file mode 100644 index 0000000..7151b8d --- /dev/null +++ b/components/ble/ble_services/ble_rscs_c/ble_rscs_c.h @@ -0,0 +1,89 @@ +#ifndef BLE_RSCS_C_H__ +#define BLE_RSCS_C_H__ + +#include +#include +#include "ble.h" + +/** + * @defgroup ble_sdk_srv_rscs_c Running Speed and Cadence Service Client + * @{ + * @ingroup ble_sdk_srv + * + * @details This module contains the APIs and types exposed by the Running Speed and Cadence + * Service Client module. These APIs and types can be used by the application to perform + * discovery of Running Speed and Cadence Service at the peer and interact with it. + * + * @note The application must propagate BLE stack events to this module by calling + * ble_rscs_c_on_ble_evt(). + */ + +/**@brief RSCS Client event type. */ +typedef enum +{ + BLE_RSCS_C_EVT_DISCOVERY_COMPLETE = 1, /**< Event indicating that the Running Speed and Cadence Service has been discovered at the peer. */ + BLE_RSCS_C_EVT_RSC_NOTIFICATION /**< Event indicating that a notification of the Running Speed and Cadence measurement characteristic has been received from the peer. */ +} ble_rscs_c_evt_type_t; + +#define BLE_RSCS_INSTANT_STRIDE_LEN_PRESENT 0x00 /**< Instantaneous Stride Length Measurement Supported bit. */ +#define BLE_RSCS_TOTAL_DISTANCE_PRESENT 0x01 /**< Total Distance Measurement Supported bit. */ +#define BLE_RSCS_WALKING_OR_RUNNING_STATUS_BIT 0x02 /**< Walking or Running Status Supported bit. */ + +/**@brief Structure containing the Running Speed and Cadence measurement received from the peer. */ +typedef struct +{ + bool is_inst_stride_len_present; /**< True if Instantaneous Stride Length is present in the measurement. */ + bool is_total_distance_present; /**< True if Total Distance is present in the measurement. */ + bool is_running; /**< True if running, False if walking. */ + uint16_t inst_speed; /**< Instantaneous Speed. */ + uint8_t inst_cadence; /**< Instantaneous Cadence. */ + uint16_t inst_stride_length; /**< Instantaneous Stride Length. */ + uint32_t total_distance; /**< Total Distance. */ +} ble_rsc_t; + +/**@brief Running Speed and Cadence Event structure. */ +typedef struct +{ + ble_rscs_c_evt_type_t evt_type; /**< Type of the event. */ + union + { + ble_rsc_t rsc; /**< Running Speed and Cadence measurement received. This will be filled if the evt_type is @ref BLE_RSCS_C_EVT_RSC_NOTIFICATION. */ + } params; +} ble_rscs_c_evt_t; + +// Forward declaration of the ble_rscs_c_t type. +typedef struct ble_rscs_c_s ble_rscs_c_t; + +/**@brief Event handler type. + * + * @details This is the type of the event handler that should be provided by the application + * of this module in order to receive events. + */ +typedef void (* ble_rscs_c_evt_handler_t) (ble_rscs_c_t * p_ble_rscs_c, ble_rscs_c_evt_t * p_evt); + +/**@brief Running Speed and Cadence client structure. + */ +struct ble_rscs_c_s +{ + uint16_t conn_handle; /**< Connection handle as provided by the SoftDevice. */ + uint16_t rsc_cccd_handle; /**< Handle of the CCCD of the Running Speed and Cadence characteristic. */ + uint16_t rsc_handle; /**< Handle of the Running Speed and Cadence characteristic as provided by the SoftDevice. */ + ble_rscs_c_evt_handler_t evt_handler; /**< Application event handler to be called when there is an event related to the Running Speed and Cadence service. */ +}; + +/**@brief Running Speed and Cadence client initialization structure. + */ +typedef struct +{ + ble_rscs_c_evt_handler_t evt_handler; /**< Event handler to be called by the Running Speed and Cadence Client module whenever there is an event related to the Running Speed and Cadence Service. */ +} ble_rscs_c_init_t; + +uint32_t ble_rscs_c_init(ble_rscs_c_t * p_ble_rscs_c, ble_rscs_c_init_t * p_ble_rscs_c_init); + +void ble_rscs_c_on_ble_evt(ble_rscs_c_t * p_ble_rscs_c, const ble_evt_t * p_ble_evt); + +uint32_t ble_rscs_c_rsc_notif_enable(ble_rscs_c_t * p_ble_rscs_c); + +#endif // BLE_RSCS_C_H__ + +/** @} */ // End tag for the file. diff --git a/components/ble/ble_services/ble_tps/ble_tps.c b/components/ble/ble_services/ble_tps/ble_tps.c new file mode 100644 index 0000000..8b2c0c2 --- /dev/null +++ b/components/ble/ble_services/ble_tps/ble_tps.c @@ -0,0 +1,139 @@ +/* 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. + * + */ + +/* Attention! +* To maintain compliance with Nordic Semiconductor ASAs Bluetooth profile +* qualification listings, this section of source code must not be modified. +*/ + +#include "ble_tps.h" +#include +#include "ble_srv_common.h" + + +/**@brief Function for handling the Connect event. + * + * @param[in] p_tps TX Power Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_connect(ble_tps_t * p_tps, ble_evt_t * p_ble_evt) +{ + p_tps->conn_handle = p_ble_evt->evt.gap_evt.conn_handle; +} + + +void ble_tps_on_ble_evt(ble_tps_t * p_tps, ble_evt_t * p_ble_evt) +{ + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + on_connect(p_tps, p_ble_evt); + break; + + default: + // No implementation needed. + break; + } +} + + +/**@brief Function for adding TX Power Level characteristics. + * + * @param[in] p_tps TX Power Service structure. + * @param[in] p_tps_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t tx_power_level_char_add(ble_tps_t * p_tps, + const ble_tps_init_t * p_tps_init) +{ + ble_gatts_char_md_t char_md; + ble_gatts_attr_t attr_char_value; + ble_uuid_t ble_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; + + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_TX_POWER_LEVEL_CHAR); + + memset(&attr_md, 0, sizeof(attr_md)); + + attr_md.read_perm = p_tps_init->tps_attr_md.read_perm; + attr_md.write_perm = p_tps_init->tps_attr_md.write_perm; + attr_md.vloc = BLE_GATTS_VLOC_STACK; + attr_md.rd_auth = 0; + attr_md.wr_auth = 0; + attr_md.vlen = 0; + + memset(&attr_char_value, 0, sizeof(attr_char_value)); + + 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 = sizeof (int8_t); + attr_char_value.init_offs = 0; + attr_char_value.max_len = sizeof (uint8_t); + attr_char_value.p_value = (uint8_t*)&p_tps_init->initial_tx_power_level; + + return sd_ble_gatts_characteristic_add(p_tps->service_handle, + &char_md, + &attr_char_value, + &p_tps->tx_power_level_handles); +} + + +uint32_t ble_tps_init(ble_tps_t * p_tps, const ble_tps_init_t * p_tps_init) +{ + uint32_t err_code; + ble_uuid_t ble_uuid; + + // Add service + BLE_UUID_BLE_ASSIGN(ble_uuid, BLE_UUID_TX_POWER_SERVICE); + + err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, + &ble_uuid, + &p_tps->service_handle); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add TX Power Level characteristic + return tx_power_level_char_add(p_tps, p_tps_init); +} + + +uint32_t ble_tps_tx_power_level_set(ble_tps_t * p_tps, int8_t tx_power_level) +{ + ble_gatts_value_t gatts_value; + + // Initialize value struct. + memset(&gatts_value, 0, sizeof(gatts_value)); + + gatts_value.len = sizeof(uint8_t); + gatts_value.offset = 0; + gatts_value.p_value = (uint8_t*)&tx_power_level; + + // Update database + return sd_ble_gatts_value_set(p_tps->conn_handle, + p_tps->tx_power_level_handles.value_handle, + &gatts_value); +} diff --git a/components/ble/ble_services/ble_tps/ble_tps.h b/components/ble/ble_services/ble_tps/ble_tps.h new file mode 100644 index 0000000..f0b4454 --- /dev/null +++ b/components/ble/ble_services/ble_tps/ble_tps.h @@ -0,0 +1,86 @@ +/* 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 ble_sdk_srv_tps TX Power Service + * @{ + * @ingroup ble_sdk_srv + * @brief TX Power Service module. + * + * @details This module implements the TX Power Service with the TX Power Level characteristic. + * During initialization it adds the TX Power Service and TX Power Level characteristic + * with the specified initial value to the BLE stack database. + * + * It provides a function for letting the application update the TX Power Level + * characteristic. + * + * @note Attention! + * To maintain compliance with Nordic Semiconductor ASA Bluetooth profile + * qualification listings, this section of source code must not be modified. + */ + +#ifndef BLE_TPS_H__ +#define BLE_TPS_H__ + +#include +#include "ble.h" +#include "ble_srv_common.h" + +/**@brief TX Power Service init structure. This contains all options and data needed for + * initialization of the service. */ +typedef struct +{ + int8_t initial_tx_power_level; /**< Initial value of the TX Power Level characteristic (in dBm). */ + ble_srv_security_mode_t tps_attr_md; /**< Initial Security Setting for TX Power Service Characteristics. */ +} ble_tps_init_t; + +/**@brief TX Power Service structure. This contains various status information for the service. */ +typedef struct +{ + uint16_t service_handle; /**< Handle of TX Power Service (as provided by the BLE stack). */ + ble_gatts_char_handles_t tx_power_level_handles; /**< Handles related to the TX Power Level characteristic. */ + uint16_t conn_handle; /**< Handle of the current connection (as provided by the BLE stack, is BLE_CONN_HANDLE_INVALID if not in a connection). */ +} ble_tps_t; + +/**@brief Function for initializing the TX Power Service. + * + * @param[out] p_hrs TX Power 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 this particular service instance. + * @param[in] p_tps_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on successful initialization of service, otherwise an error code. + */ +uint32_t ble_tps_init(ble_tps_t * p_hrs, const ble_tps_init_t * p_tps_init); + +/**@brief Function for handling the Application's BLE Stack events. + * + * @details Handles all events from the BLE stack of interest to the TX Power Service. + * + * @param[in] p_tps TX Power Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +void ble_tps_on_ble_evt(ble_tps_t * p_tps, ble_evt_t * p_ble_evt); + +/**@brief Function for setting the state of the Sensor Contact Detected bit. + * + * @param[in] p_tps TX Power Service structure. + * @param[in] tx_power_level New TX Power Level (unit dBm, range -100 to 20). + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +uint32_t ble_tps_tx_power_level_set(ble_tps_t * p_tps, int8_t tx_power_level); + +#endif // BLE_TPS_H__ + +/** @} */ diff --git a/components/ble/ble_services/experimental_ble_lns/ble_lns.c b/components/ble/ble_services/experimental_ble_lns/ble_lns.c new file mode 100644 index 0000000..aeb1d73 --- /dev/null +++ b/components/ble/ble_services/experimental_ble_lns/ble_lns.c @@ -0,0 +1,1580 @@ +/* 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 "ble_lns.h" +#include +#include "nordic_common.h" +#include "ble_l2cap.h" +#include "ble_srv_common.h" +#include "app_util.h" +#include "ble_gatt.h" + +// Location and Speed flag bits +#define LOC_SPEED_FLAG_INSTANT_SPEED_PRESENT (0x01 << 0) /**< Instantaneous Speed Present bit. */ +#define LOC_SPEED_FLAG_TOTAL_DISTANCE_PRESENT (0x01 << 1) /**< Total Distance Present bit. */ +#define LOC_SPEED_FLAG_LOCATION_PRESENT (0x01 << 2) /**< Location Present bit. */ +#define LOC_SPEED_FLAG_ELEVATION_PRESENT (0x01 << 3) /**< Elevation Present bit. */ +#define LOC_SPEED_FLAG_HEADING_PRESENT (0x01 << 4) /**< Heading Present bit. */ +#define LOC_SPEED_FLAG_ROLLING_TIME_PRESENT (0x01 << 5) /**< Rolling Time Present bit. */ +#define LOC_SPEED_FLAG_UTC_TIME_PRESENT (0x01 << 6) /**< UTC Time Present bit. */ +#define LOC_SPEED_FLAG_POSITION_STATUS (0x03 << 7) /**< Position Status bits(2). */ +#define LOC_SPEED_FLAG_SPEED_AND_DIST_FORMAT (0x01 << 9) /**< Speed and Distance Format. */ +#define LOC_SPEED_FLAG_ELEVATION_SOURCE (0x03 << 10) /**< Elevation Source bits(2). */ +#define LOC_SPEED_FLAG_HEADING_SOURCE (0x01 << 12) /**< Heading Source. */ + +// Position Quality flag bits +#define POS_QUAL_FLAG_NUM_SATS_IN_SOLUTION_PRESENT (0x01 << 0) /**< Number of Satellites in Solution Present bit. */ +#define POS_QUAL_FLAG_NUM_SATS_IN_VIEW_PRESENT (0x01 << 1) /**< Number of Satellites in View Present bit. */ +#define POS_QUAL_FLAG_TIME_TO_FIRST_FIX_PRESESNT (0x01 << 2) /**< Time to First Fix Present bit. */ +#define POS_QUAL_FLAG_EHPE_PRESENT (0x01 << 3) /**< EHPE Present bit. */ +#define POS_QUAL_FLAG_EVPE_PRESENT (0x01 << 4) /**< EVPE Present bit. */ +#define POS_QUAL_FLAG_HDOP_PRESENT (0x01 << 5) /**< HDOP Present bit. */ +#define POS_QUAL_FLAG_VDOP_PRESENT (0x01 << 6) /**< VDOP Present bit. */ +#define POS_QUAL_FLAG_POSITION_STATUS (0x03 << 7) /**< Position Status bits(2). */ + +// Navigation flag bits +#define NAV_FLAG_REMAINING_DIST_PRESENT (0x01 << 0) /**< Remaining Distance Present bit. */ +#define NAV_FLAG_REAMINGING_VERT_DIST_PRESESNT (0x01 << 1) /**< Remaining Vertical Distance Present bit . */ +#define NAV_FLAG_ETA_PRESENT (0x01 << 2) /**< Estimated Time of Arrival Present bit. */ +#define NAV_FLAG_POSITION_STATUS (0x03 << 3) /**< Position Status bits(2). */ +#define NAV_FLAG_HEADING_SOURCE (0x01 << 5) /**< Heading Source bit. */ +#define NAV_FLAG_NAVIGATION_INDICATOR_TYPE (0x01 << 6) /**< Navigation Indicator Type bit. */ +#define NAV_FLAG_WAYPOINT_REACHED (0x01 << 7) /**< Waypoint Reached bit. */ +#define NAV_FLAG_DESTINATION_REACHED (0x01 << 8) /**< Destination Reached bit. */ + +// Feature Mask bits +#define FEATURE_MASK_INSTANTANEOUS_SPEED (0x01 << 0) /**< Instantaneous Speed mask bit. */ +#define FEATURE_MASK_TOTAL_DISTANCE (0x01 << 1) /**< Total Distance mask bit. */ +#define FEATURE_MASK_LOCATION (0x01 << 2) /**< Location mask bit. */ +#define FEATURE_MASK_ELEVATION (0x01 << 3) /**< Elevation mask bit. */ +#define FEATURE_MASK_HEADING (0x01 << 4) /**< Heading mask bit. */ +#define FEATURE_MASK_ROLLING_TIME (0x01 << 5) /**< Rolling Time mask bit. */ +#define FEATURE_MASK_UTC_TIME (0x01 << 6) /**< UTC Time mask bit. */ + +// Data Control point parameter type lengths. +#define INT8_LEN 1 +#define INT16_LEN 2 +#define INT24_LEN 3 +#define INT32_LEN 4 + +#define OPCODE_LENGTH 1 /**< Length of opcode inside Location and Navigation Measurement packet. */ +#define HANDLE_LENGTH 2 /**< Length of handle inside Location and Navigation Measurement packet. */ +#define BLE_LNS_NAV_MAX_LEN 19 /**< The length of a navigation notification when all features are enabled. See @ref ble_lns_navigation_t to see what this represents, or check https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.navigation.xml. */ + + +/**@brief Connect event handler. + * + * @param[in] p_lns Location and Navigation Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_connect(ble_lns_t * p_lns, ble_evt_t * p_ble_evt) +{ + // Clear previous mask. No features are masked away. + memset(&p_lns->mask, 0, sizeof (p_lns->mask)); + p_lns->control_point_procedure_status = BLE_LNS_CTRLPT_STATE_NO_PROC_IN_PROGRESS; + p_lns->conn_handle = p_ble_evt->evt.gap_evt.conn_handle; +} + +/**@brief Disconnect event handler. + * + * @param[in] p_lns Location and Navigation Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_disconnect(ble_lns_t * p_lns, ble_evt_t * p_ble_evt) +{ + UNUSED_PARAMETER(p_ble_evt); + p_lns->conn_handle = BLE_CONN_HANDLE_INVALID; + p_lns->control_point_procedure_status = BLE_LNS_CTRLPT_STATE_NO_PROC_IN_PROGRESS; +} + +/**@brief Handle write events to the Location and Speed cccd. + * + * @param[in] p_lns Location and Navigation Service structure. + * @param[in] p_evt_write Write event received from the BLE stack. + */ +static void on_loc_speed_cccd_write(ble_lns_t * p_lns, ble_gatts_evt_write_t * p_evt_write) +{ + if (p_evt_write->len == BLE_CCCD_VALUE_LEN) + { + // CCCD written, update notification state + memcpy(p_lns->loc_speed_cccd_handle_status, p_evt_write->data, INT16_LEN); //lint !e420 "Apparent access beyond array" + if (p_lns->evt_handler != NULL) + { + ble_lns_evt_t evt; + + if (ble_srv_is_notification_enabled(p_evt_write->data)) + { + evt.evt_type = BLE_LNS_LOC_SPEED_EVT_NOTIFICATION_ENABLED; + } + else + { + evt.evt_type = BLE_LNS_LOC_SPEED_EVT_NOTIFICATION_DISABLED; + } + + p_lns->evt_handler(p_lns, &evt); + } + } +} + +/**@brief Handle write events to the control point cccd. + * + * @param[in] p_lns Location and Navigation Service structure. + * @param[in] p_evt_write Write event received from the BLE stack. + */ +static void on_control_point_cccd_write(ble_lns_t * p_lns, ble_gatts_evt_write_t * p_evt_write) +{ + if (p_evt_write->len == BLE_CCCD_VALUE_LEN) + { + // CCCD written, update indications state + memcpy(p_lns->ctrl_pnt_cccd_handle_status, p_evt_write->data, INT16_LEN); //lint !e420 "Apparent access beyond array" + if (p_lns->evt_handler != NULL) + { + ble_lns_evt_t evt; + + if (ble_srv_is_indication_enabled(p_evt_write->data)) + { + evt.evt_type = BLE_LNS_CONTROL_POINT_EVT_INDICATION_ENABLED; + } + else + { + evt.evt_type = BLE_LNS_CONTROL_POINT_EVT_INDICATION_DISABLED; + } + + p_lns->evt_handler(p_lns, &evt); + } + } +} + +/**@brief Handle write events to the navigation cccd. + * + * @param[in] p_lns Location and Navigation Service structure. + * @param[in] p_evt_write Write event received from the BLE stack. + */ +static void on_navigation_cccd_write(ble_lns_t * p_lns, ble_gatts_evt_write_t * p_evt_write) +{ + if (p_evt_write->len == BLE_CCCD_VALUE_LEN) + { + // CCCD written, update notification state + memcpy(p_lns->navigation_cccd_handle_status, p_evt_write->data, INT16_LEN); //lint !e420 "Apparent access beyond array" + if (p_lns->evt_handler != NULL) + { + ble_lns_evt_t evt; + + if (ble_srv_is_notification_enabled(p_evt_write->data)) + { + evt.evt_type = BLE_LNS_NAVIGATION_EVT_NOTIFICATION_ENABLED; + } + else + { + evt.evt_type = BLE_LNS_NAVIGATION_EVT_NOTIFICATION_DISABLED; + } + + p_lns->evt_handler(p_lns, &evt); + } + } +} + +static void ctrl_point_response_send(ble_lns_t * p_lns) +{ + // Send indication + uint16_t hvx_len; + uint8_t hvx_data[MAX_CTRL_POINT_RESP_PARAM_LEN]; + ble_gatts_hvx_params_t hvx_params; + uint32_t err_code; + + memset(&hvx_params, 0, sizeof(hvx_params)); + + hvx_len = 3 + p_lns->pending_ctrlpt_response.response_param_len; + hvx_data[0] = OP_CODE_RESPONSE_CODE; + hvx_data[1] = p_lns->pending_ctrlpt_response.op_code; + hvx_data[2] = p_lns->pending_ctrlpt_response.response_code; + + memcpy(&hvx_data[3], &p_lns->pending_ctrlpt_response.response_param[0], p_lns->pending_ctrlpt_response.response_param_len); + + hvx_params.handle = p_lns->ctrl_point_handles.value_handle; + hvx_params.type = BLE_GATT_HVX_INDICATION; + hvx_params.offset = 0; + hvx_params.p_len = &hvx_len; + hvx_params.p_data = hvx_data; + + err_code = sd_ble_gatts_hvx(p_lns->conn_handle, &hvx_params); + + // Error handling + if ((err_code == NRF_SUCCESS) && (hvx_len != p_lns->pending_ctrlpt_response.response_param_len + 3)) + { + err_code = NRF_ERROR_DATA_SIZE; + } + + switch (err_code) + { + case NRF_SUCCESS: + p_lns->control_point_procedure_status = BLE_LNS_CTRLPT_STATE_IND_CONFIRM_PENDING; + // Wait for HVC event + break; + + case BLE_ERROR_NO_TX_BUFFERS: + // Wait for TX_COMPLETE event to retry transmission + p_lns->control_point_procedure_status = BLE_LNS_CTRLPT_STATE_INDICATION_PENDING; + break; + + default: + p_lns->control_point_procedure_status = BLE_LNS_CTRLPT_STATE_INDICATION_PENDING; + // error + if (p_lns->error_handler != NULL) + { + p_lns->error_handler(err_code); + } + break; + } +} + +/**@brief Event handler for control point write. + * + * @param[in] p_lns Location and Navigation Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_set_cumulative_value(ble_lns_t * p_lns, ble_gatts_evt_write_t * p_evt_write) +{ + //lint -save -e415 -e416 "Likely access of out-of-bounds pointer" + ble_lns_evt_t lns_evt; + + if ( !(p_lns->available_features & BLE_LNS_FEATURE_TOTAL_DISTANCE_SUPPORTED) ) + { + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_OP_CODE_NOT_SUPPORTED; + return; + } + + if (p_evt_write->len != OPCODE_LENGTH + INT24_LEN) + { + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_INVALID_PARAMETER; + return; + } + + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_SUCCESS; + + p_lns->p_location_speed->total_distance = (p_evt_write->data[1]<<0) + | (p_evt_write->data[2]<<8) + | (p_evt_write->data[3]<<16); + if (p_lns->evt_handler != NULL) + { + lns_evt.evt_type = BLE_LNS_LOC_SPEED_EVT_TOTAL_DISTANCE_SET; + lns_evt.params.total_distance = p_lns->p_location_speed->total_distance; + p_lns->evt_handler(p_lns, &lns_evt); + } + //lint -restore +} + +/**@brief Event handler for control point write. + * + * @param[in] p_lns Location and Navigation Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_mask_loc_speed_content(ble_lns_t * p_lns, ble_gatts_evt_write_t * p_evt_write) +{ + //lint -save -e415 -e416 "Likely access of out-of-bounds pointer" + ble_lns_evt_t lns_evt; + + if ( !(p_lns->available_features & BLE_LNS_FEATURE_LOC_AND_SPEED_CONTENT_MASKING_SUPPORTED) ) + { + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_OP_CODE_NOT_SUPPORTED; + return; + } + if (p_evt_write->len != OPCODE_LENGTH + INT16_LEN) + { + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_INVALID_PARAMETER; + return; + } + + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_SUCCESS; + uint16_t rcvd_mask = uint16_decode(&p_evt_write->data[1]); + if(rcvd_mask > 0x7f) + { + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_INVALID_PARAMETER; + return; + } + + p_lns->mask.instantaneous_speed = !(!(rcvd_mask & FEATURE_MASK_INSTANTANEOUS_SPEED)); + p_lns->mask.total_distance = !(!(rcvd_mask & FEATURE_MASK_TOTAL_DISTANCE )); + p_lns->mask.location = !(!(rcvd_mask & FEATURE_MASK_LOCATION )); + p_lns->mask.elevation = !(!(rcvd_mask & FEATURE_MASK_ELEVATION )); + p_lns->mask.heading = !(!(rcvd_mask & FEATURE_MASK_HEADING )); + p_lns->mask.rolling_time = !(!(rcvd_mask & FEATURE_MASK_ROLLING_TIME )); + p_lns->mask.utc_time = !(!(rcvd_mask & FEATURE_MASK_UTC_TIME )); + + + if (p_lns->evt_handler != NULL) + { + lns_evt.evt_type = BLE_LNS_LOC_SPEED_EVT_MASK_SET; + lns_evt.params.mask = p_lns->mask; + p_lns->evt_handler(p_lns, &lns_evt); + } + //lint -restore +} + +/**@brief Event handler for control point write. + * + * @param[in] p_lns Location and Navigation Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_nav_control(ble_lns_t * p_lns, ble_gatts_evt_write_t * p_evt_write) +{ + //lint -save -e415 -e416 "Likely access of out-of-bounds pointer" + ble_lns_evt_t lns_evt; + + if ( !(p_lns->is_navigation_present) ) + { + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_OP_CODE_NOT_SUPPORTED; + return; + } + + if(p_evt_write->len != OPCODE_LENGTH + INT8_LEN) + { + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_INVALID_PARAMETER; + return; + } + + if (p_evt_write->data[1] > 0x05) + { + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_INVALID_PARAMETER; + return; + } + + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_SUCCESS; + if ( p_evt_write->data[1] == BLE_LNS_NAVIGATION_START + || p_evt_write->data[1] == BLE_LNS_NAVIGATION_CONTINUE + || p_evt_write->data[1] == BLE_LNS_NAVIGATION_NEAREST + ) + { + p_lns->is_navigation_running = true; + } + else if ( p_evt_write->data[1] == BLE_LNS_NAVIGATION_STOP + || p_evt_write->data[1] == BLE_LNS_NAVIGATION_PAUSE + ) + { + p_lns->is_navigation_running = false; + } + + if (p_lns->evt_handler != NULL) + { + lns_evt.evt_type = BLE_LNS_NAVIGATION_EVT_COMMAND; + lns_evt.params.navigation_command = (ble_lns_navigation_command_t)p_evt_write->data[1]; + p_lns->evt_handler(p_lns, &lns_evt); + } + //lint -restore +} + +/**@brief Event handler for control point write. + * + * @param[in] p_lns Location and Navigation Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_req_num_routes(ble_lns_t * p_lns, ble_gatts_evt_write_t * p_evt_write) +{ + //lint -save -e415 -e416 "Likely access of out-of-bounds pointer" + if ( !(p_lns->is_navigation_present) ) + { + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_OP_CODE_NOT_SUPPORTED; + return; + } + if(p_evt_write->len == OPCODE_LENGTH) + { + p_lns->pending_ctrlpt_response.response_param_len = + uint16_encode(p_lns->number_of_routes, &p_lns->pending_ctrlpt_response.response_param[0]); + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_SUCCESS; + } + else + { + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_INVALID_PARAMETER; + } + //lint -restore +} + +/**@brief Event handler for control point write. + * + * @param[in] p_lns Location and Navigation Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_req_name_of_route(ble_lns_t * p_lns, ble_gatts_evt_write_t * p_evt_write) +{ + //lint -save -e415 -e416 "Likely access of out-of-bounds pointer" + if ( !(p_lns->is_navigation_present) ) + { + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_OP_CODE_NOT_SUPPORTED; + return; + } + + if(p_evt_write->len != OPCODE_LENGTH + INT16_LEN) + { + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_INVALID_PARAMETER; + return; + } + + uint16_t route_num = uint16_decode(&p_evt_write->data[1]); + if (route_num < p_lns->number_of_routes) + { + memcpy(&p_lns->pending_ctrlpt_response.response_param[0], p_lns->routes[route_num].route_name, BLE_LNS_MAX_ROUTE_NAME_LEN); + p_lns->pending_ctrlpt_response.response_param_len = BLE_LNS_MAX_ROUTE_NAME_LEN; + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_SUCCESS; + } + else + { + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_INVALID_PARAMETER; + } + //lint -restore +} + +/**@brief Event handler for control point write. + * + * @param[in] p_lns Location and Navigation Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_select_route(ble_lns_t * p_lns, ble_gatts_evt_write_t * p_evt_write) +{ + //lint -save -e415 -e416 "Likely access of out-of-bounds pointer" + ble_lns_evt_t lns_evt; + + if ( !(p_lns->is_navigation_present)) + { + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_OP_CODE_NOT_SUPPORTED; + return; + } + + if(p_evt_write->len != OPCODE_LENGTH + INT16_LEN) + { + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_INVALID_PARAMETER; + return; + } + + uint16_t route_num = uint16_decode(&p_evt_write->data[1]); + if (route_num < p_lns->number_of_routes) + { + p_lns->selected_route = route_num; + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_SUCCESS; + if (p_lns->evt_handler != NULL) + { + lns_evt.evt_type = BLE_LNS_NAVIGATION_EVT_ROUTE_SELECTED; + lns_evt.params.selected_route = p_lns->selected_route; + p_lns->evt_handler(p_lns, &lns_evt); + } + } + else + { + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_INVALID_PARAMETER; + } + //lint -restore +} + +/**@brief Event handler for control point write. + * + * @param[in] p_lns Location and Navigation Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_set_fix_rate(ble_lns_t * p_lns, ble_gatts_evt_write_t * p_evt_write) +{ + //lint -save -e415 -e416 "Likely access of out-of-bounds pointer" + ble_lns_evt_t lns_evt; + + if ( !(p_lns->available_features & BLE_LNS_FEATURE_FIX_RATE_SETTING_SUPPORTED) ) + { + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_OP_CODE_NOT_SUPPORTED; + return; + } + + if (p_evt_write->len != OPCODE_LENGTH + INT8_LEN) + { + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_INVALID_PARAMETER; + return; + } + + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_SUCCESS; + p_lns->fix_rate = p_evt_write->data[1]; + if (p_lns->evt_handler != NULL) + { + lns_evt.evt_type = BLE_LNS_POS_QUAL_EVT_FIX_RATE_SET; + lns_evt.params.fix_rate = p_lns->fix_rate; + p_lns->evt_handler(p_lns, &lns_evt); + } + //lint -restore +} + +/**@brief Event handler for control point write. + * + * @param[in] p_lns Location and Navigation Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_set_elevation(ble_lns_t * p_lns, ble_gatts_evt_write_t * p_evt_write) +{ + //lint -save -e415 -e416 "Likely access of out-of-bounds pointer" + ble_lns_evt_t lns_evt; + + if ( !(p_lns->available_features & BLE_LNS_FEATURE_ELEVATION_SETTING_SUPPORTED) ) + { + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_OP_CODE_NOT_SUPPORTED; + return; + } + + if (p_evt_write->len != OPCODE_LENGTH + INT24_LEN) + { + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_INVALID_PARAMETER; + return; + } + + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_SUCCESS; + + p_lns->p_location_speed->elevation = (p_evt_write->data[1]<<0) + | (p_evt_write->data[2]<<8) + | (p_evt_write->data[3]<<16); + + if (p_lns->evt_handler != NULL) + { + lns_evt.evt_type = BLE_LNS_LOC_SPEED_EVT_ELEVATION_SET; + lns_evt.params.elevation = p_lns->p_location_speed->elevation; + p_lns->evt_handler(p_lns, &lns_evt); + } + //lint -restore +} + + +/**@brief Handle write events to the Location and Navigation Service Control Point characteristic. + * + * @param[in] p_lns Location and Navigation Service structure. + * @param[in] p_evt_write Write event received from the BLE stack. + */ +static void on_ctrl_point_write(ble_lns_t * p_lns, ble_gatts_evt_write_t * p_evt_write) +{ + uint32_t err_code; + + p_lns->pending_ctrlpt_response.response_param_len = 0; + + ble_gatts_rw_authorize_reply_params_t write_authorize_reply; + write_authorize_reply.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE; + + if (ble_srv_is_indication_enabled(p_lns->ctrl_pnt_cccd_handle_status)) + { + if (p_lns->control_point_procedure_status == BLE_LNS_CTRLPT_STATE_NO_PROC_IN_PROGRESS) + { + write_authorize_reply.params.write.gatt_status = BLE_GATT_STATUS_SUCCESS; + + // if the op code is navigation control, its cccd must be checked + if (p_evt_write->len > 0 && p_lns->is_navigation_present) + { + if ( p_evt_write->data[0] == OP_CODE_NAV_CONTROL + || p_evt_write->data[0] == OP_CODE_REQ_NAME_OF_ROUTE + || p_evt_write->data[0] == OP_CODE_REQ_NUM_ROUTES) + { + if (ble_srv_is_notification_enabled(p_lns->navigation_cccd_handle_status) == false) + { + write_authorize_reply.params.write.gatt_status = CONTROL_POINT_RESP_CCCD_CONFIG_IMPROPER; + } + } + } + } + else + { + write_authorize_reply.params.write.gatt_status = CONTROL_POINT_RESP_PROC_ALR_IN_PROG; + } + } + else + { + write_authorize_reply.params.write.gatt_status = + CONTROL_POINT_RESP_CCCD_CONFIG_IMPROPER; + } + + // reply to the write authorization + do { + err_code = sd_ble_gatts_rw_authorize_reply(p_lns->conn_handle, &write_authorize_reply); + if (err_code != NRF_SUCCESS && err_code != NRF_ERROR_BUSY) + { + if (p_lns->error_handler != NULL) + { + p_lns->error_handler(err_code); + } + } + } 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 + p_lns->control_point_procedure_status = BLE_LNS_CTRLPT_STATE_INDICATION_PENDING; + if (p_evt_write->len > 0) + { + p_lns->pending_ctrlpt_response.op_code = p_evt_write->data[0]; + switch (p_lns->pending_ctrlpt_response.op_code) + { + case OP_CODE_SET_CUMULATIVE_VALUE: + on_set_cumulative_value(p_lns, p_evt_write); + break; + + case OP_CODE_MASK_LOC_SPEED_CONTENT: + on_mask_loc_speed_content(p_lns, p_evt_write); + break; + + case OP_CODE_NAV_CONTROL: + on_nav_control(p_lns, p_evt_write); + break; + + case OP_CODE_REQ_NUM_ROUTES: + on_req_num_routes(p_lns, p_evt_write); + break; + + case OP_CODE_REQ_NAME_OF_ROUTE: + on_req_name_of_route(p_lns, p_evt_write); + break; + + case OP_CODE_SELECT_ROUTE: + on_select_route(p_lns, p_evt_write); + break; + + case OP_CODE_SET_FIX_RATE: + on_set_fix_rate(p_lns, p_evt_write); + break; + + case OP_CODE_SET_ELEVATION: + on_set_elevation(p_lns, p_evt_write); + break; + + // Unrecognized Op Code + default: + p_lns->pending_ctrlpt_response.response_code = CONTROL_POINT_RESP_OP_CODE_NOT_SUPPORTED; + break; + } + + ctrl_point_response_send(p_lns); + } + else + { + p_lns->control_point_procedure_status = BLE_LNS_CTRLPT_STATE_NO_PROC_IN_PROGRESS; + } +} + +/**@brief Write event handler. + * + * @param[in] p_lns Location and Navigation Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_write(ble_lns_t * p_lns, ble_evt_t * p_ble_evt) +{ + ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write; + + if (p_evt_write->handle == p_lns->loc_speed_handles.cccd_handle) + { + on_loc_speed_cccd_write(p_lns, p_evt_write); + } + else if (p_evt_write->handle == p_lns->ctrl_point_handles.cccd_handle) + { + on_control_point_cccd_write(p_lns, p_evt_write); + } + else if (p_evt_write->handle == p_lns->navigation_handles.cccd_handle) + { + on_navigation_cccd_write(p_lns, p_evt_write); + } + +} + +/**@brief Write authorization request event handler. + * + * @details The write authorization request event handler is only called when writing to the control point. + * + * @param[in] p_lns Location and Navigation Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_rw_authorize_req(ble_lns_t * p_lns, 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_lns->ctrl_point_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) + ) + { + on_ctrl_point_write(p_lns, &(p_authorize_request->request.write)); + } + +} + +/**@brief Tx Complete event handler. This is used to retry sending a packet. + * + * @details Tx Complete event handler. + * Handles WRITE events from the BLE stack and if an indication was pending try sending it + * again. + * + * @param[in] p_lns Location navigation structure. + */ +static void on_tx_complete(ble_lns_t * p_lns) +{ + if (p_lns->control_point_procedure_status == BLE_LNS_CTRLPT_STATE_INDICATION_PENDING) + { + ctrl_point_response_send(p_lns); + } +} + +/**@brief Function for handling the BLE_GATTS_EVT_HVC event. A control point procedure is finished when its indication is acknowledged. + * + * @param[in] p_lns LNS structure. + * @param[in] p_ble_evt Event received from the BLE stack. + */ +static void on_hvc_confirm(ble_lns_t * p_lns, ble_evt_t * p_ble_evt) +{ + if (p_ble_evt->evt.gatts_evt.params.hvc.handle == p_lns->ctrl_point_handles.value_handle) + { + if (p_lns->control_point_procedure_status == BLE_LNS_CTRLPT_STATE_IND_CONFIRM_PENDING) + { + p_lns->control_point_procedure_status = BLE_LNS_CTRLPT_STATE_NO_PROC_IN_PROGRESS; + } + else + { + if (p_lns->error_handler != NULL) + { + p_lns->error_handler(NRF_ERROR_INVALID_STATE); + } + } + } +} + +void ble_lns_on_ble_evt(ble_lns_t * p_lns, ble_evt_t * p_ble_evt) +{ + if (p_lns == NULL || p_ble_evt == NULL) + { + return; + } + + + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + on_connect(p_lns, p_ble_evt); + break; + + case BLE_GAP_EVT_DISCONNECTED: + if (p_ble_evt->evt.gap_evt.conn_handle == p_lns->conn_handle) + { + on_disconnect(p_lns, p_ble_evt); + } + break; + + case BLE_GATTS_EVT_WRITE: + if (p_ble_evt->evt.gatts_evt.conn_handle == p_lns->conn_handle) + { + on_write(p_lns, p_ble_evt); + } + break; + + case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST: + if (p_ble_evt->evt.gatts_evt.conn_handle == p_lns->conn_handle) + { + on_rw_authorize_req(p_lns, p_ble_evt); + } + break; + + case BLE_GATTS_EVT_HVC: + if (p_ble_evt->evt.gatts_evt.conn_handle == p_lns->conn_handle) + { + on_hvc_confirm(p_lns, p_ble_evt); + } + break; + + case BLE_EVT_TX_COMPLETE: + on_tx_complete(p_lns); + break; + + default: + // no implementation + break; + } +} + +/**@brief Encode position quality. + * + * @param[in] p_lns Location and Navigation Service structure. + * @param[in] p_pos_qual Position quality data to be encoded. + * @param[out] p_encoded_buffer Buffer where the encoded data will be written. + * + * @return Size of encoded data. + */ +static uint8_t pos_qual_encode(ble_lns_t * p_lns, ble_lns_pos_quality_t const * p_pos_qual, uint8_t * p_encoded_buffer) +{ + uint16_t flags = 0; + uint8_t len = 2; // flags are added at last + + flags |= ((uint16_t)p_pos_qual->position_status << 7) & POS_QUAL_FLAG_POSITION_STATUS; + + if (p_pos_qual->number_of_satellites_in_solution_present) + { + flags |= POS_QUAL_FLAG_NUM_SATS_IN_SOLUTION_PRESENT; + p_encoded_buffer[len++] = p_pos_qual->number_of_satellites_in_solution; + } + + if (p_pos_qual->number_of_satellites_in_view_present) + { + flags |= POS_QUAL_FLAG_NUM_SATS_IN_VIEW_PRESENT; + p_encoded_buffer[len++] = p_pos_qual->number_of_satellites_in_view; + } + + if (p_pos_qual->time_to_first_fix_present) + { + flags |= POS_QUAL_FLAG_TIME_TO_FIRST_FIX_PRESESNT; + len += uint16_encode(p_pos_qual->time_to_first_fix, &p_encoded_buffer[len]); + } + + if (p_pos_qual->ehpe_present) + { + flags |= POS_QUAL_FLAG_EHPE_PRESENT; + len += uint32_encode(p_pos_qual->ehpe, &p_encoded_buffer[len]); + } + + if (p_pos_qual->evpe_present) + { + flags |= POS_QUAL_FLAG_EVPE_PRESENT; + len += uint32_encode(p_pos_qual->evpe, &p_encoded_buffer[len]); + } + + if (p_pos_qual->hdop_present) + { + flags |= POS_QUAL_FLAG_HDOP_PRESENT; + p_encoded_buffer[len++] = p_pos_qual->hdop; + } + + if (p_pos_qual->vdop_present) + { + flags |= POS_QUAL_FLAG_VDOP_PRESENT; + p_encoded_buffer[len++] = p_pos_qual->vdop; + } + + // Flags field + uint16_encode(flags, &p_encoded_buffer[0]); //lint !e534 "Ignoring return value of function" + + return len; +} + + +/**@brief Encode Location and Speed data. + * + * @details The Location and Speed data will be encoded into two packets. Each packet has its own flags. + * + * @param[in] p_lns Location and Navigation Service structure. + * @param[in] p_loc_speed Location and Speed data to be encoded. + * @param[out] p_encoded_buffer1 First buffer where encoded data will be written. + * @param[out] p_encoded_buffer2 Second buffer where encoded data will be written. + * @param[out] p_lengths The lengths of the resulting buffers. + * + */ +static void loc_speed_encode(ble_lns_t * p_lns, ble_lns_loc_speed_t const * p_loc_speed, + uint8_t * p_encoded_buffer1, uint8_t * p_encoded_buffer2, uint8_t * p_lengths) +{ + uint16_t flags; + + // Encode packet 1 + flags = 0; + p_lengths[0] = 2; + + // Instantaneous Speed + if (p_lns->available_features & BLE_LNS_FEATURE_INSTANT_SPEED_SUPPORTED) + { + if ((p_loc_speed->instant_speed_present)&&(!p_lns->mask.instantaneous_speed)) + { + flags |= LOC_SPEED_FLAG_INSTANT_SPEED_PRESENT; + flags |= ((uint16_t)p_loc_speed->data_format<<9) & LOC_SPEED_FLAG_SPEED_AND_DIST_FORMAT; + p_lengths[0] += uint16_encode(p_loc_speed->instant_speed, &p_encoded_buffer1[p_lengths[0]]); + } + } + + // Total Distance + if (p_lns->available_features & BLE_LNS_FEATURE_TOTAL_DISTANCE_SUPPORTED) + { + if ((p_loc_speed->total_distance_present)&&(!p_lns->mask.total_distance)) + { + flags |= LOC_SPEED_FLAG_TOTAL_DISTANCE_PRESENT; + p_encoded_buffer1[p_lengths[0]++] = ((p_loc_speed->total_distance >> 0) & 0xFF); + p_encoded_buffer1[p_lengths[0]++] = ((p_loc_speed->total_distance >> 8) & 0xFF); + p_encoded_buffer1[p_lengths[0]++] = ((p_loc_speed->total_distance >> 16) & 0xFF); + } + } + + // Location + if (p_lns->available_features & BLE_LNS_FEATURE_LOCATION_SUPPORTED) + { + if ((p_loc_speed->location_present)&&(!p_lns->mask.location)) + { + flags |= LOC_SPEED_FLAG_LOCATION_PRESENT; + flags |= ((uint16_t)p_loc_speed->position_status <<7) & LOC_SPEED_FLAG_POSITION_STATUS; + p_lengths[0] += uint32_encode(p_loc_speed->latitude, &p_encoded_buffer1[p_lengths[0]]); + p_lengths[0] += uint32_encode(p_loc_speed->longitude, &p_encoded_buffer1[p_lengths[0]]); + } + } + + // Flags field + uint16_encode(flags, &p_encoded_buffer1[0]); //lint !e534 "Ignoring return value of function" + + // Encode packet 2 + flags = 0; + p_lengths[1] = 2; + + // Elevation + if (p_lns->available_features & BLE_LNS_FEATURE_ELEVATION_SUPPORTED) + { + if ((p_loc_speed->elevation_present)&&(!p_lns->mask.elevation)) + { + flags |= LOC_SPEED_FLAG_ELEVATION_PRESENT; + flags |= ((uint16_t)p_loc_speed->elevation_source<<10)& LOC_SPEED_FLAG_ELEVATION_SOURCE; + p_encoded_buffer2[p_lengths[1]++] = ((p_loc_speed->elevation >> 0) & 0xFF); + p_encoded_buffer2[p_lengths[1]++] = ((p_loc_speed->elevation >> 8) & 0xFF); + p_encoded_buffer2[p_lengths[1]++] = ((p_loc_speed->elevation >> 16) & 0xFF); + } + } + + // Heading + if (p_lns->available_features & BLE_LNS_FEATURE_HEADING_SUPPORTED) + { + if ((p_loc_speed->heading_present)&&(!p_lns->mask.heading)) + { + flags |= LOC_SPEED_FLAG_HEADING_PRESENT; + flags |= ((uint16_t)p_loc_speed->heading_source<<12) & LOC_SPEED_FLAG_HEADING_SOURCE; + p_lengths[1] += uint16_encode(p_loc_speed->heading, &p_encoded_buffer2[p_lengths[1]]); + } + } + + // Rolling Time + if (p_lns->available_features & BLE_LNS_FEATURE_ROLLING_TIME_SUPPORTED) + { + if ((p_loc_speed->rolling_time_present)&&(!p_lns->mask.rolling_time)) + { + flags |= LOC_SPEED_FLAG_ROLLING_TIME_PRESENT; + p_encoded_buffer2[p_lengths[1]++] = p_loc_speed->rolling_time; + } + } + + // UTC Time + if (p_lns->available_features & BLE_LNS_FEATURE_UTC_TIME_SUPPORTED) + { + if ((p_loc_speed->utc_time_time_present)&&(!p_lns->mask.utc_time)) + { + flags |= LOC_SPEED_FLAG_UTC_TIME_PRESENT; + p_lengths[1] += ble_date_time_encode(&p_loc_speed->utc_time, &p_encoded_buffer2[p_lengths[1]]); + } + } + // Flags field + uint16_encode(flags, &p_encoded_buffer2[0]); //lint !e534 "Ignoring return value of function" +} + + +/**@brief Encode Navigation data. + * + * @param[in] p_lns Location and Navigation Service structure. + * @param[in] p_navigation Navigation data to be encoded. + * @param[out] p_encoded_buffer Buffer where the encoded data will be written. + * + * @return Size of encoded data. + */ +static uint8_t navigation_encode(ble_lns_t * p_lns, ble_lns_navigation_t const * p_navigation, uint8_t * p_encoded_buffer) +{ + uint16_t flags = 0; + uint8_t len = 2; + + // Bearing + len += uint16_encode(p_navigation->bearing, &p_encoded_buffer[len]); + + // Heading + len += uint16_encode(p_navigation->heading, &p_encoded_buffer[len]); + + // Remaining Distance + if (p_lns->available_features & BLE_LNS_FEATURE_REMAINING_DISTANCE_SUPPORTED) + { + if (p_navigation->remaining_dist_present) + { + flags |= NAV_FLAG_REMAINING_DIST_PRESENT; + p_encoded_buffer[len++] = ((p_navigation->remaining_distance >> 0) & 0xFF); + p_encoded_buffer[len++] = ((p_navigation->remaining_distance >> 8) & 0xFF); + p_encoded_buffer[len++] = ((p_navigation->remaining_distance >> 16) & 0xFF); + } + } + + // Remaining Vertical Distance + if (p_lns->available_features & BLE_LNS_FEATURE_REMAINING_VERT_DISTANCE_SUPPORTED) + { + if (p_navigation->remaining_vert_dist_present) + { + flags |= NAV_FLAG_REAMINGING_VERT_DIST_PRESESNT; + p_encoded_buffer[len++] = ((p_navigation->remaining_vert_distance >> 0) & 0xFF); + p_encoded_buffer[len++] = ((p_navigation->remaining_vert_distance >> 8) & 0xFF); + p_encoded_buffer[len++] = ((p_navigation->remaining_vert_distance >> 16) & 0xFF); + } + } + + // Estimated Time of Arrival + if (p_lns->available_features & BLE_LNS_FEATURE_EST_TIME_OF_ARRIVAL_SUPPORTED) + { + if (p_navigation->eta_present) + { + flags |= NAV_FLAG_ETA_PRESENT; + len += ble_date_time_encode(&p_navigation->eta, &p_encoded_buffer[len]); + } + } + + flags |= ((uint16_t)p_navigation->position_status <<3) & NAV_FLAG_POSITION_STATUS; + flags |= ((uint16_t)p_navigation->heading_source <<5) & NAV_FLAG_HEADING_SOURCE; + flags |= ((uint16_t)p_navigation->navigation_indicator_type<<6)& NAV_FLAG_NAVIGATION_INDICATOR_TYPE; + flags |= ((uint16_t)p_navigation->waypoint_reached <<7)& NAV_FLAG_WAYPOINT_REACHED; + flags |= ((uint16_t)p_navigation->destination_reached <<8)& NAV_FLAG_DESTINATION_REACHED; + + // Flags field + uint16_encode(flags, &p_encoded_buffer[0]); //lint !e534 "Ignoring return value of function" + + return len; +} + + +/**@brief Add Location and Navigation Feature characteristic. + * + * @param[in] p_lns Location and Navigation Service structure. + * @param[in] p_lns_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t loc_and_nav_feature_char_add(ble_lns_t * p_lns, const ble_lns_init_t * p_lns_init) +{ + uint8_t init_value_encoded[sizeof(uint32_t)]; + uint8_t len; + ble_add_char_params_t add_char_params; + + len = uint32_encode(p_lns_init->available_features, init_value_encoded); + + memset(&add_char_params, 0, sizeof(add_char_params)); + + add_char_params.uuid = BLE_UUID_LN_FEATURE_CHAR; + add_char_params.max_len = len; + add_char_params.init_len = len; + add_char_params.p_init_value = &init_value_encoded[0]; + add_char_params.char_props.read = true; + add_char_params.read_access = p_lns_init->loc_nav_feature_security_req_read_perm; + + return characteristic_add(p_lns->service_handle, + &add_char_params, + &p_lns->feature_handles); +} + +/**@brief Add Location and Speed characteristic. + * + * @param[in] p_lns Location and Navigation Service structure. + * @param[in] p_lns_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t loc_speed_char_add(ble_lns_t * p_lns, + const ble_lns_init_t * p_lns_init) +{ + uint8_t encoded_initial_loc_speed1[BLE_L2CAP_MTU_DEF ]; + uint8_t encoded_initial_loc_speed2[BLE_L2CAP_MTU_DEF ]; + uint8_t lengths[2]; + ble_add_char_params_t add_char_params; + + loc_speed_encode(p_lns, p_lns_init->p_location_speed, &encoded_initial_loc_speed1[0], &encoded_initial_loc_speed2[0], &lengths[0]); + + memset(&add_char_params, 0, sizeof(add_char_params)); + + add_char_params.uuid = BLE_UUID_LN_LOCATION_AND_SPEED_CHAR; + add_char_params.max_len = BLE_L2CAP_MTU_DEF ; + add_char_params.init_len = lengths[0]; + add_char_params.p_init_value = &encoded_initial_loc_speed1[0]; + add_char_params.is_var_len = true; + add_char_params.char_props.notify = true; + add_char_params.cccd_write_access = p_lns_init->loc_speed_security_req_cccd_write_perm; + + return characteristic_add(p_lns->service_handle, + &add_char_params, + &p_lns->loc_speed_handles); +} + +/**@brief Add Location and Navigation position quality characteristic. + * + * @param[in] p_lns Location and Navigation Service structure. + * @param[in] p_lns_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t pos_quality_char_add(ble_lns_t * p_lns, const ble_lns_init_t * p_lns_init) +{ + uint8_t len; + uint8_t init_value_encoded[BLE_L2CAP_MTU_DEF]; + ble_add_char_params_t add_char_params; + + len = pos_qual_encode(p_lns, p_lns_init->p_position_quality, init_value_encoded); + + memset(&add_char_params, 0, sizeof(add_char_params)); + + add_char_params.uuid = BLE_UUID_LN_POSITION_QUALITY_CHAR; + add_char_params.max_len = BLE_L2CAP_MTU_DEF ; + add_char_params.init_len = len; + add_char_params.p_init_value = init_value_encoded; + add_char_params.char_props.read = true; + add_char_params.read_access = p_lns_init->position_quality_security_req_read_perm; + + return characteristic_add(p_lns->service_handle, + &add_char_params, + &p_lns->pos_qual_handles); +} + +/**@brief Add Location and Navigation Control Point characteristic. + * + * @param[in] p_lns Location and Navigation Service structure. + * + * @return NRF_SUCCESS if characteristic was successfully added, otherwise an error code. + */ +static uint32_t loc_and_nav_control_point_char_add(ble_lns_t * p_lns, const ble_lns_init_t * p_lns_init) +{ + ble_add_char_params_t add_char_params; + + memset(&add_char_params, 0, sizeof(add_char_params)); + + add_char_params.uuid = BLE_UUID_LN_CONTROL_POINT_CHAR; + add_char_params.max_len = 0; + add_char_params.char_props.indicate = true; + add_char_params.char_props.write = true; + add_char_params.is_defered_write = true; + add_char_params.is_var_len = true; + add_char_params.max_len = BLE_L2CAP_MTU_DEF; + add_char_params.write_access = p_lns_init->ctrl_point_security_req_write_perm; + add_char_params.cccd_write_access = p_lns_init->ctrl_point_security_req_cccd_write_perm; + + return characteristic_add(p_lns->service_handle, + &add_char_params, + &p_lns->ctrl_point_handles); +} + +/**@brief Add Navigation characteristic. + * + * @param[in] p_lns Location and Navigation Service structure. + * @param[in] p_lns_init Information needed to initialize the service. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static uint32_t navigation_char_add(ble_lns_t * p_lns, + const ble_lns_init_t * p_lns_init) +{ + ble_add_char_params_t add_char_params; + + memset(&add_char_params, 0, sizeof(add_char_params)); + + add_char_params.uuid = BLE_UUID_LN_NAVIGATION_CHAR; + add_char_params.max_len = BLE_LNS_NAV_MAX_LEN; + add_char_params.init_len = 0; + add_char_params.p_init_value = NULL; + add_char_params.char_props.notify = true; + add_char_params.cccd_write_access = p_lns_init->navigation_security_req_cccd_write_perm; + + return characteristic_add(p_lns->service_handle, + &add_char_params, + &p_lns->navigation_handles); +} + +/** @brief Check if there is a mismatch in initialization parameters. + * + * @details It is possible to give an input which has an internal mismatch. Such a mismatch can arise in two different ways. + * One possibility is a mismatch between the characteristic present indicators and the available features specified. + * The other mismatch arises when no pointer to the characteristic data structure is specified. + * + * @param[in] p_lns_init The init structure which will be checked + * + * @return false if there is no mismatch. true if there is a mismatch + */ +static bool init_param_mismatch_present(const ble_lns_init_t * p_lns_init) +{ + if (p_lns_init->is_position_quality_present == false) + { + if (p_lns_init->available_features & + (BLE_LNS_FEATURE_NUM_SATS_IN_SOLUTION_SUPPORTED | + BLE_LNS_FEATURE_NUM_SATS_IN_VIEW_SUPPORTED | + BLE_LNS_FEATURE_TIME_TO_FIRST_FIX_SUPPORTED | + BLE_LNS_FEATURE_EST_HORZ_POS_ERROR_SUPPORTED | + BLE_LNS_FEATURE_EST_VERT_POS_ERROR_SUPPORTED | + BLE_LNS_FEATURE_HORZ_DILUTION_OF_PRECISION_SUPPORTED | + BLE_LNS_FEATURE_VERT_DILUTION_OF_PRECISION_SUPPORTED) + ) + { + return true; + } + if (p_lns_init->p_position_quality != NULL) + { + return true; + } + } + else if (p_lns_init->is_position_quality_present == true) + { + if (p_lns_init->p_position_quality == NULL) + { + return true; + } + } + + if (p_lns_init->is_control_point_present == false) + { + if (p_lns_init->available_features & + (BLE_LNS_FEATURE_LOC_AND_SPEED_CONTENT_MASKING_SUPPORTED | + BLE_LNS_FEATURE_FIX_RATE_SETTING_SUPPORTED | + BLE_LNS_FEATURE_ELEVATION_SETTING_SUPPORTED) + ) + { + return true; + } + } + + if (p_lns_init->is_navigation_present == false) + { + if (p_lns_init->available_features & + (BLE_LNS_FEATURE_REMAINING_DISTANCE_SUPPORTED | + BLE_LNS_FEATURE_REMAINING_VERT_DISTANCE_SUPPORTED | + BLE_LNS_FEATURE_EST_TIME_OF_ARRIVAL_SUPPORTED) + ) + { + return true; + } + if (p_lns_init->p_navigation != NULL) + { + return true; + } + } + else if (p_lns_init->is_navigation_present == true) + { + if (p_lns_init->p_navigation == NULL) + { + return true; + } + } + + // location and speed must always be specified + if (p_lns_init->p_location_speed == NULL) + { + return true; + } + + return false; +} + +uint32_t ble_lns_init(ble_lns_t * p_lns, const ble_lns_init_t * p_lns_init) +{ + if (p_lns == NULL || p_lns_init == NULL) + { + return NRF_ERROR_NULL; + } + + if (init_param_mismatch_present(p_lns_init) == true) + { + return NRF_ERROR_INVALID_PARAM; + } + + + uint32_t err_code; + ble_uuid_t service_uuid; + + // Initialize service structure + p_lns->evt_handler = p_lns_init->evt_handler; + p_lns->error_handler = p_lns_init->error_handler; + p_lns->conn_handle = BLE_CONN_HANDLE_INVALID; + p_lns->available_features = p_lns_init->available_features; + p_lns->is_navigation_present = p_lns_init->is_navigation_present; + + memset(&p_lns->mask, 0, sizeof (p_lns->mask)); + + p_lns->p_location_speed = p_lns_init->p_location_speed; + p_lns->p_position_quality = p_lns_init->p_position_quality; + p_lns->p_navigation = p_lns_init->p_navigation; + + p_lns->control_point_procedure_status = BLE_LNS_CTRLPT_STATE_NO_PROC_IN_PROGRESS; + + memset(p_lns->ctrl_pnt_cccd_handle_status, 0, INT16_LEN); + memset(p_lns->navigation_cccd_handle_status, 0, INT16_LEN); + memset(p_lns->loc_speed_cccd_handle_status, 0, INT16_LEN); + + p_lns->is_navigation_running = false; + p_lns->number_of_routes = 0; + p_lns->selected_route = BLE_LNS_INVALID_ROUTE; + p_lns->fix_rate = BLE_LNS_NO_FIX; + + for (int i = 0; i < BLE_LNS_MAX_NUM_ROUTES; i++) + { + p_lns->routes[i].route_id = BLE_LNS_INVALID_ROUTE; + } + + // Add service + BLE_UUID_BLE_ASSIGN(service_uuid, BLE_UUID_LOCATION_AND_NAVIGATION_SERVICE); + + err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &service_uuid, &p_lns->service_handle); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add location and navigation feature characteristic + err_code = loc_and_nav_feature_char_add(p_lns, p_lns_init); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + // Add location and speed characteristic + err_code = loc_speed_char_add(p_lns, p_lns_init); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (p_lns_init->is_position_quality_present) + { + // Add Position quality characteristic + err_code = pos_quality_char_add(p_lns, p_lns_init); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + else + { + p_lns->pos_qual_handles.cccd_handle = BLE_GATT_HANDLE_INVALID; + p_lns->pos_qual_handles.sccd_handle = BLE_GATT_HANDLE_INVALID; + p_lns->pos_qual_handles.user_desc_handle = BLE_GATT_HANDLE_INVALID; + p_lns->pos_qual_handles.value_handle = BLE_GATT_HANDLE_INVALID; + } + + if (p_lns_init->is_control_point_present) + { + // Add control pointer characteristic + err_code = loc_and_nav_control_point_char_add(p_lns, p_lns_init); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + else + { + p_lns->ctrl_point_handles.cccd_handle = BLE_GATT_HANDLE_INVALID; + p_lns->ctrl_point_handles.sccd_handle = BLE_GATT_HANDLE_INVALID; + p_lns->ctrl_point_handles.user_desc_handle = BLE_GATT_HANDLE_INVALID; + p_lns->ctrl_point_handles.value_handle = BLE_GATT_HANDLE_INVALID; + } + + if (p_lns_init->is_navigation_present) + { + // Add navigation characteristic + err_code = navigation_char_add(p_lns, p_lns_init); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + else + { + p_lns->navigation_handles.cccd_handle = BLE_GATT_HANDLE_INVALID; + p_lns->navigation_handles.sccd_handle = BLE_GATT_HANDLE_INVALID; + p_lns->navigation_handles.user_desc_handle = BLE_GATT_HANDLE_INVALID; + p_lns->navigation_handles.value_handle = BLE_GATT_HANDLE_INVALID; + } + + return NRF_SUCCESS; +} + + +uint32_t ble_lns_loc_speed_send(ble_lns_t * p_lns) +{ + if (p_lns == NULL) + { + return NRF_ERROR_NULL; + } + + if (p_lns->conn_handle == BLE_CONN_HANDLE_INVALID) + { + return NRF_ERROR_INVALID_STATE; + } + + uint32_t err_code; + + + // Location speed data is always sent as two packets. + uint8_t encoded_loc_speed1[BLE_L2CAP_MTU_DEF]; + uint8_t encoded_loc_speed2[BLE_L2CAP_MTU_DEF]; + uint8_t lengths[2]; + uint16_t hvx_len; + ble_gatts_hvx_params_t hvx_params; + + loc_speed_encode(p_lns, p_lns->p_location_speed, &encoded_loc_speed1[0], &encoded_loc_speed2[0], &lengths[0]); + + memset(&hvx_params, 0, sizeof(hvx_params)); + + hvx_params.handle = p_lns->loc_speed_handles.value_handle; + hvx_params.type = BLE_GATT_HVX_NOTIFICATION; + hvx_params.offset = 0; + hvx_params.p_len = &hvx_len; + + // send packet 1 + + hvx_len = lengths[0]; + hvx_params.p_data = &encoded_loc_speed1[0]; + + err_code = sd_ble_gatts_hvx(p_lns->conn_handle, &hvx_params); + + if (err_code == NRF_ERROR_INVALID_STATE) + { + return err_code; + } + + if ((err_code == NRF_SUCCESS) && (hvx_len != lengths[0])) + { + return NRF_ERROR_DATA_SIZE; + } + + + // send packet 2 + hvx_len = lengths[1]; + hvx_params.p_data = &encoded_loc_speed2[0]; + + err_code = sd_ble_gatts_hvx(p_lns->conn_handle, &hvx_params); + + if ((err_code == NRF_SUCCESS) && (hvx_len != lengths[1])) + { + return NRF_ERROR_DATA_SIZE; + } + + + + return err_code; +} + +uint32_t ble_lns_navigation_send(ble_lns_t * p_lns) +{ + if (p_lns == NULL) + { + return NRF_ERROR_NULL; + } + + if (p_lns->conn_handle == BLE_CONN_HANDLE_INVALID) + { + return NRF_ERROR_INVALID_STATE; + } + + uint32_t err_code; + + // Send value if connected and notifying + if (p_lns->is_navigation_present) + { + if (p_lns->is_navigation_running) + { + uint8_t encoded_navigation[BLE_L2CAP_MTU_DEF]; + uint16_t len; + uint16_t hvx_len; + ble_gatts_hvx_params_t hvx_params; + + len = navigation_encode(p_lns, p_lns->p_navigation, &encoded_navigation[0]); + hvx_len = len; + + memset(&hvx_params, 0, sizeof(hvx_params)); + + hvx_params.handle = p_lns->navigation_handles.value_handle; + hvx_params.type = BLE_GATT_HVX_NOTIFICATION; + hvx_params.offset = 0; + hvx_params.p_len = &hvx_len; + hvx_params.p_data = &encoded_navigation[0]; + + err_code = sd_ble_gatts_hvx(p_lns->conn_handle, &hvx_params); + if ((err_code == NRF_SUCCESS) && (hvx_len != len)) + { + err_code = NRF_ERROR_DATA_SIZE; + } + } + else + { + err_code = NRF_ERROR_INVALID_STATE; + } + + } + else + { + err_code = NRF_ERROR_NOT_SUPPORTED; + } + + return err_code; +} + + +uint32_t ble_lns_add_route(ble_lns_t * p_lns, ble_lns_route_t * p_route) +{ + if (p_lns == NULL || p_route == NULL) + { + return NRF_ERROR_NULL; + } + + if (p_lns->is_navigation_present == false) + { + return NRF_ERROR_NOT_SUPPORTED; + } + + if (p_lns->number_of_routes >= BLE_LNS_MAX_NUM_ROUTES) + { + return NRF_ERROR_NO_MEM; + } + + // find an empty slot + for (int i = 0; i < BLE_LNS_MAX_NUM_ROUTES; i++) + { + if (p_lns->routes[i].route_id == BLE_LNS_INVALID_ROUTE) + { + memcpy(p_lns->routes[i].route_name, p_route->route_name, BLE_LNS_MAX_ROUTE_NAME_LEN); + p_lns->routes[i].route_id = i; + p_route->route_id = i; + + p_lns->number_of_routes++; + return NRF_SUCCESS; + } + } + // an inconsistency in the route the table + return NRF_ERROR_INTERNAL; +} + +uint32_t ble_lns_remove_route(ble_lns_t * p_lns, uint16_t route_id) +{ + if (p_lns == NULL) + { + return NRF_ERROR_NULL; + } + + if (p_lns->is_navigation_present == false) + { + return NRF_ERROR_NOT_SUPPORTED; + } + + if (route_id >= BLE_LNS_MAX_NUM_ROUTES) + { + return NRF_ERROR_INVALID_PARAM; + } + + if (p_lns->routes[route_id].route_id != BLE_LNS_INVALID_ROUTE) + { + p_lns->routes[route_id].route_id = BLE_LNS_INVALID_ROUTE; + p_lns->number_of_routes--; + return NRF_SUCCESS; + } + else + { + return NRF_ERROR_INVALID_PARAM; + } +} + diff --git a/components/ble/ble_services/experimental_ble_lns/ble_lns.h b/components/ble/ble_services/experimental_ble_lns/ble_lns.h new file mode 100644 index 0000000..28164f4 --- /dev/null +++ b/components/ble/ble_services/experimental_ble_lns/ble_lns.h @@ -0,0 +1,424 @@ +/* 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 ble_sdk_srv_lns Location and Navigation Service + * @{ + * @ingroup ble_sdk_srv + * @brief Location and Navigation Service module. + * + * @details This module implements the Location and Navigation Service with the Location and Speed, Position + * Quality, Feature, Control Point, and Navigation characteristics. + * + * If an event handler is supplied by the application, the Location and Navigation Service will + * generate Location and Navigation Service events to the application. + * + * @note The application must propagate BLE stack events to the Location and Navigation Service module by calling + * @ref ble_lns_on_ble_evt() from the from the ble_stack_handler callback. + */ + +#ifndef BLE_LNS_H__ +#define BLE_LNS_H__ + +#include +#include +#include "ble.h" +#include "ble_srv_common.h" +#include "ble_date_time.h" + +// Location and Navigation Service feature bits +#define BLE_LNS_FEATURE_INSTANT_SPEED_SUPPORTED (0x01 << 0) /**< Instaneous Speed Supported bit. */ +#define BLE_LNS_FEATURE_TOTAL_DISTANCE_SUPPORTED (0x01 << 1) /**< Total Distance Supported bit. */ +#define BLE_LNS_FEATURE_LOCATION_SUPPORTED (0x01 << 2) /**< Location Supported bit. */ +#define BLE_LNS_FEATURE_ELEVATION_SUPPORTED (0x01 << 3) /**< Elevation Supported bit. */ +#define BLE_LNS_FEATURE_HEADING_SUPPORTED (0x01 << 4) /**< Heading Supported bit. */ +#define BLE_LNS_FEATURE_ROLLING_TIME_SUPPORTED (0x01 << 5) /**< Rolling Time Supported bit. */ +#define BLE_LNS_FEATURE_UTC_TIME_SUPPORTED (0x01 << 6) /**< UTC Time Supported bit. */ +#define BLE_LNS_FEATURE_REMAINING_DISTANCE_SUPPORTED (0x01 << 7) /**< Remaining Distance Supported bit. */ +#define BLE_LNS_FEATURE_REMAINING_VERT_DISTANCE_SUPPORTED (0x01 << 8) /**< Remaining Vertical Distance Supported bit. */ +#define BLE_LNS_FEATURE_EST_TIME_OF_ARRIVAL_SUPPORTED (0x01 << 9) /**< Estimated Time of Arrival Supported bit. */ +#define BLE_LNS_FEATURE_NUM_SATS_IN_SOLUTION_SUPPORTED (0x01 << 10) /**< Number of Satellites in Solution Supported bit. */ +#define BLE_LNS_FEATURE_NUM_SATS_IN_VIEW_SUPPORTED (0x01 << 11) /**< Number of Satellites in View Supported bit. */ +#define BLE_LNS_FEATURE_TIME_TO_FIRST_FIX_SUPPORTED (0x01 << 12) /**< Time to First Fix Supported bit. */ +#define BLE_LNS_FEATURE_EST_HORZ_POS_ERROR_SUPPORTED (0x01 << 13) /**< Estimated Horizontal Position Error Supported bit. */ +#define BLE_LNS_FEATURE_EST_VERT_POS_ERROR_SUPPORTED (0x01 << 14) /**< Estimated Vertical Position Error Supported bit. */ +#define BLE_LNS_FEATURE_HORZ_DILUTION_OF_PRECISION_SUPPORTED (0x01 << 15) /**< Horizontal Dilution of Precision Supported bit. */ +#define BLE_LNS_FEATURE_VERT_DILUTION_OF_PRECISION_SUPPORTED (0x01 << 16) /**< Vertical Dilution of Precision Supported bit. */ +#define BLE_LNS_FEATURE_LOC_AND_SPEED_CONTENT_MASKING_SUPPORTED (0x01 << 17) /**< Location and Speed Characteristic Content Masking Supported bit. */ +#define BLE_LNS_FEATURE_FIX_RATE_SETTING_SUPPORTED (0x01 << 18) /**< Fix Rate Setting Supported bit. */ +#define BLE_LNS_FEATURE_ELEVATION_SETTING_SUPPORTED (0x01 << 19) /**< Elevation Setting Supported bit. */ +#define BLE_LNS_FEATURE_POSITION_STATUS_SUPPORTED (0x01 << 20) /**< Position Status Supported bit. */ + +#define BLE_LNS_MAX_ROUTE_NAME_LEN (BLE_L2CAP_MTU_DEF-5) /**< The maximum length of length of a route name. */ +#define BLE_LNS_MAX_NUM_ROUTES 3 /**< The maximum number of routes. This affects memory usage only. */ +#define BLE_LNS_INVALID_ROUTE 0xFFFF +#define BLE_LNS_NO_FIX 0xFF + +#define MAX_CTRL_POINT_RESP_PARAM_LEN BLE_LNS_MAX_ROUTE_NAME_LEN + 3 + +// Location and Navigation Control Point Op Code values +typedef enum { + OP_CODE_RESERVED = 0x00, /**< Reserved for future use. */ + OP_CODE_SET_CUMULATIVE_VALUE = 0x01, /**< Set Cumulative Value. */ + OP_CODE_MASK_LOC_SPEED_CONTENT = 0x02, /**< Mask Location and Speed Characteristic Content. */ + OP_CODE_NAV_CONTROL = 0x03, /**< Navigation Control. */ + OP_CODE_REQ_NUM_ROUTES = 0x04, /**< Request Number of Routes. */ + OP_CODE_REQ_NAME_OF_ROUTE = 0x05, /**< Request Name of Route. */ + OP_CODE_SELECT_ROUTE = 0x06, /**< Select Route. */ + OP_CODE_SET_FIX_RATE = 0x07, /**< Set Fix Rate. */ + OP_CODE_SET_ELEVATION = 0x08, /**< Set Elevation. */ + OP_CODE_RESPONSE_CODE = 0x20 /**< Response code. */ +} ble_lns_ctrl_point_opcodes_t; + +// Location and Navigation Control Point response values +typedef enum { + CONTROL_POINT_RESP_RESERVED = 0x00, /**< Reserved for future use. */ + CONTROL_POINT_RESP_SUCCESS = 0x01, /**< Success. */ + CONTROL_POINT_RESP_OP_CODE_NOT_SUPPORTED = 0x02, /**< Op Code not supported. */ + CONTROL_POINT_RESP_INVALID_PARAMETER = 0x03, /**< Invalid Parameter. */ + CONTROL_POINT_RESP_OPERATION_FAILED = 0x04, /**< Operation Failed. */ + CONTROL_POINT_RESP_PROC_ALR_IN_PROG = BLE_GATT_STATUS_ATTERR_CPS_PROC_ALR_IN_PROG, /**< Control point procedure is already in progress. */ + CONTROL_POINT_RESP_CCCD_CONFIG_IMPROPER = BLE_GATT_STATUS_ATTERR_CPS_CCCD_CONFIG_ERROR /**< CCCD is improperly configured. */ +} ble_lns_ctrl_point_response_codes_t; + +/** @brief Location and Navigation event type. This list defines the possible events types from the Location and Navigation Service. */ +typedef enum { + BLE_LNS_LOC_SPEED_EVT_NOTIFICATION_ENABLED, /**< Location and Speed value notification was enabled. */ + BLE_LNS_LOC_SPEED_EVT_NOTIFICATION_DISABLED, /**< Location and Speed value notification was disabled. */ + BLE_LNS_LOC_SPEED_EVT_MASK_SET, /**< Location and Speed feature mask was set. */ + BLE_LNS_LOC_SPEED_EVT_TOTAL_DISTANCE_SET, /**< Location and Navigation total distance was set. */ + BLE_LNS_LOC_SPEED_EVT_ELEVATION_SET, /**< Location and Navigation elevation was set. */ + + BLE_LNS_POS_QUAL_EVT_FIX_RATE_SET, /**< Fix rate was set. */ + + BLE_LNS_CONTROL_POINT_EVT_INDICATION_ENABLED, /**< Location and Navigation Control point indication was enabled. */ + BLE_LNS_CONTROL_POINT_EVT_INDICATION_DISABLED, /**< Location and Navigation Control point indication was disabled. */ + + BLE_LNS_NAVIGATION_EVT_COMMAND, /**< A navigation command was issued. */ + BLE_LNS_NAVIGATION_EVT_ROUTE_SELECTED, /**< A route was selected. */ + BLE_LNS_NAVIGATION_EVT_NOTIFICATION_ENABLED, /**< Navigation value notification was enabled. */ + BLE_LNS_NAVIGATION_EVT_NOTIFICATION_DISABLED, /**< Navigation value notification was disabled. */ +} ble_lns_evt_type_t; + +/** @brief Navigation commands. These commands can be sent to the control point and returned by an event callback. */ +typedef enum { + BLE_LNS_NAVIGATION_STOP = 0x00, /**< When received, is_navigation_running in @ref ble_lns_s will be set to false. */ + BLE_LNS_NAVIGATION_START = 0x01, /**< When received, is_navigation_running in @ref ble_lns_s will be set to true. */ + BLE_LNS_NAVIGATION_PAUSE = 0x02, /**< When received, is_navigation_running in @ref ble_lns_s will be set to false. */ + BLE_LNS_NAVIGATION_CONTINUE = 0x03, /**< When received, is_navigation_running in @ref ble_lns_s will be set to true. */ + BLE_LNS_NAVIGATION_SKIP_WAYPOINT = 0x04, /**< When received, is_navigation_running in @ref ble_lns_s will not be affected. */ + BLE_LNS_NAVIGATION_NEAREST = 0x05 /**< When received, is_navigation_running in @ref ble_lns_s will be set to true. */ +} ble_lns_navigation_command_t; + +/** @brief A mask can be used to temporarily enable and disable features of the Location and Speed characteristic.*/ +typedef struct { + bool instantaneous_speed; + bool total_distance; + bool location; + bool elevation; + bool heading; + bool rolling_time; + bool utc_time; +} ble_lns_mask_t; + +/** @brief Location and Navigation event structure. When an event occurs, the data structures of the module are automatically updated. */ +typedef struct { + ble_lns_evt_type_t evt_type; + union { + ble_lns_mask_t mask; + uint32_t total_distance; + uint32_t elevation; + int8_t fix_rate; + ble_lns_navigation_command_t navigation_command; + uint16_t selected_route; + } params; +} ble_lns_evt_t; + +// Forward declarations of the ble_lns types. +typedef struct ble_lns_init_s ble_lns_init_t; +typedef struct ble_lns_s ble_lns_t; +typedef struct ble_lns_loc_speed_s ble_lns_loc_speed_t; +typedef struct ble_lns_pos_quality_s ble_lns_pos_quality_t; +typedef struct ble_lns_navigation_s ble_lns_navigation_t; + +/**@brief Location and Navigation Service event handler type. */ +typedef void (*ble_lns_evt_handler_t) (ble_lns_t * p_lns, ble_lns_evt_t * p_evt); + +/**@brief Location and Navigation Service init structure. This structure contains all options and data needed to + * initialize the service. */ +struct ble_lns_init_s +{ + ble_lns_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Location and Navigation Service. */ + ble_srv_error_handler_t error_handler; /**< Errors will be sent back to this function. */ + + bool is_position_quality_present; /**< If set to true, the position quality characteristic will be added. Else not. */ + bool is_control_point_present; /**< If set to true, the control point characteristic will be added. Else not. */ + bool is_navigation_present; /**< If set to true, the navigation characteristic will be added. Else not. */ + + security_req_t loc_nav_feature_security_req_read_perm; /**< Read security level of the LN Feature characteristic. */ + security_req_t loc_speed_security_req_cccd_write_perm; /**< CCCD write security level of the Write Location and Speed characteristic. */ + security_req_t position_quality_security_req_read_perm; /**< Read security level of the Position Quality characteristic. */ + security_req_t navigation_security_req_cccd_write_perm; /**< CCCD write security level of the Navigation characteristic. */ + 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. */ + + uint32_t available_features; /**< Value of the LN feature. */ + ble_lns_loc_speed_t * p_location_speed; /**< Initial Location and Speed. */ + ble_lns_pos_quality_t * p_position_quality; /**< Initial Position Quality. */ + ble_lns_navigation_t * p_navigation; /**< Initial Navigation data structure. */ +}; + +/**@brief Definition of a navigation route.*/ +typedef struct ble_lns_routes_s +{ + uint16_t route_id; + uint8_t route_name[BLE_LNS_MAX_ROUTE_NAME_LEN]; +} ble_lns_route_t; + + +/** @brief Location and Navigation Control Point procedure status (indicates if a procedure is in progress or not and which procedure is in progress).*/ +typedef enum { + BLE_LNS_CTRLPT_STATE_NO_PROC_IN_PROGRESS, /**< No procedure in progress. */ + BLE_LNS_CTRLPT_STATE_INDICATION_PENDING, /**< Control Point indication is pending. */ + BLE_LNS_CTRLPT_STATE_IND_CONFIRM_PENDING, /**< Waiting for the indication confirmation. */ +} ble_lns_ctrlpt_procedure_status_t; + +/** @brief Information included in a control point write response indication. */ +typedef struct { + uint8_t op_code; /**< Opcode of the control point write action. */ + uint8_t response_code; /**< Response code of the control point write action. */ + uint8_t response_param_len; + uint8_t response_param[MAX_CTRL_POINT_RESP_PARAM_LEN]; +} ble_lns_ctrlpt_response_t; + +/**@brief Location and Navigation Service structure. This structure contains various status information for the service. */ +struct ble_lns_s +{ + ble_lns_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Location and Navigation Service. */ + ble_srv_error_handler_t error_handler; /**< Error handler. */ + + bool is_navigation_present; /**< If set to true, the navigation characteristic is present. Else not. */ + + uint16_t conn_handle; /**< Handle of the current connection (as provided by the BLE stack; BLE_CONN_HANDLE_INVALID if not in a connection). */ + uint16_t service_handle; /**< Handle of Location and Navigation Service (as provided by the BLE stack). */ + ble_gatts_char_handles_t loc_speed_handles; /**< Handles related to the Location and Speed characteristic. */ + ble_gatts_char_handles_t feature_handles; /**< Handles related to the Location and Navigation Feature characteristic. */ + ble_gatts_char_handles_t ctrl_point_handles; /**< Handles related to the Location and Navigation Control Point characteristic. */ + ble_gatts_char_handles_t navigation_handles; /**< Handles related to the Navigation characteristic. */ + ble_gatts_char_handles_t pos_qual_handles; /**< Handles related to the Position Quality characteristic. */ + uint32_t available_features; /**< Value of Location and Navigation feature. */ + + uint8_t loc_speed_cccd_handle_status[BLE_CCCD_VALUE_LEN]; /**< A buffer that stores the value of the CCCD handle of the Location and Speed characteristic.*/ + uint8_t ctrl_pnt_cccd_handle_status[BLE_CCCD_VALUE_LEN]; /**< A buffer that stores the value of the CCCD handle of the Control Point characteristic.*/ + uint8_t navigation_cccd_handle_status[BLE_CCCD_VALUE_LEN]; /**< A buffer that stores the value of the CCCD handle of the Navigation characteristic.*/ + + uint8_t fix_rate; /**< The fix rate in seconds. */ + ble_lns_mask_t mask; /**< When a field is set to true, the feature is turned off. Can be set by writing to the control point. */ + ble_lns_loc_speed_t * p_location_speed; /**< Location and Speed. */ + ble_lns_pos_quality_t * p_position_quality; /**< Position measurement quality. */ + ble_lns_navigation_t * p_navigation; /**< Navigation data structure. */ + ble_lns_ctrlpt_procedure_status_t control_point_procedure_status; /**< Status of a control point action. */ + ble_lns_ctrlpt_response_t pending_ctrlpt_response; /**< Pending response data from a control point action. */ + bool is_navigation_running; /**< This variable can be set using the control point. Must be true to be able to send navigation updates. */ + uint16_t number_of_routes; /**< The number of routes present. */ + uint16_t selected_route; /**< Index of route selected. */ + ble_lns_route_t routes[BLE_LNS_MAX_NUM_ROUTES]; /**< The stored routes. */ +}; + +/** @brief Position status. This enumeration defines how to interpret the position data. */ +typedef enum +{ + BLE_LNS_NO_POSITION = 0, + BLE_LNS_POSITION_OK = 1, + BLE_LNS_ESTIMATED = 2, + BLE_LNS_LAST_KNOWN_POSITION = 3 +} ble_lns_pos_status_type_t; + +/** @brief The format of the position and speed measurements. */ +typedef enum +{ + BLE_LNS_SPEED_DISTANCE_FORMAT_2D = 0, + BLE_LNS_SPEED_DISTANCE_FORMAT_3D = 1 +} ble_lns_speed_distance_format_t; + +/** @brief Elevation source. */ +typedef enum +{ + BLE_LNS_ELEV_SOURCE_POSITIONING_SYSTEM = 0, + BLE_LNS_ELEV_SOURCE_BAROMETRIC = 1, + BLE_LNS_ELEV_SOURCE_DATABASE_SERVICE = 2, + BLE_LNS_ELEV_SOURCE_OTHER = 3 +} ble_lns_elevation_source_t; + +/** @brief Heading source. */ +typedef enum +{ + BLE_LNS_HEADING_SOURCE_MOVEMENT = 0, + BLE_LNS_HEADING_SOURCE_COMPASS = 1 +} ble_lns_heading_source_t; + +/**@brief Location and Speed data structure. */ +struct ble_lns_loc_speed_s +{ + bool instant_speed_present; /**< Instantaneous Speed present (0=not present, 1=present). */ + bool total_distance_present; /**< Total Distance present (0=not present, 1=present). */ + bool location_present; /**< Location present (0=not present, 1=present). */ + bool elevation_present; /**< Elevation present (0=not present, 1=present). */ + bool heading_present; /**< Heading present (0=not present, 1=present). */ + bool rolling_time_present; /**< Rolling Time present (0=not present, 1=present). */ + bool utc_time_time_present; /**< UTC Time present (0=not present, 1=present). */ + ble_lns_pos_status_type_t position_status; /**< Status of current position */ + ble_lns_speed_distance_format_t data_format; /**< Format of data (either 2D or 3D). */ + ble_lns_elevation_source_t elevation_source; /**< Source of the elevation measurement. */ + ble_lns_heading_source_t heading_source; /**< Source of the heading measurement. */ + uint16_t instant_speed; /**< Instantaneous Speed (1/10 meter per sec). */ + uint32_t total_distance; /**< Total Distance (meters), size=24 bits. */ + int32_t latitude; /**< Latitude (10e-7 degrees). */ + int32_t longitude; /**< Longitude (10e-7 degrees). */ + int32_t elevation; /**< Elevation (1/100 meters), size=24 bits. */ + uint16_t heading; /**< Heading (1/100 degrees). */ + uint8_t rolling_time; /**< Rolling Time (seconds). */ + ble_date_time_t utc_time; /**< UTC Time. */ +}; + +/** @brief Position quality structure. */ +struct ble_lns_pos_quality_s +{ + bool number_of_satellites_in_solution_present; /**< The number of satellites present in solution (0=not present, 1=present). */ + bool number_of_satellites_in_view_present; /**< The number of satellites present in solution (0=not present, 1=present). */ + bool time_to_first_fix_present; /**< Time to the first position fix present (0=not present, 1=present). */ + bool ehpe_present; /**< Error in horizontal position estimate present (0=not present, 1=present). */ + bool evpe_present; /**< Error in vertical position estimate present (0=not present, 1=present). */ + bool hdop_present; /**< Horizontal dilution of precision present (0=not present, 1=present). */ + bool vdop_present; /**< Vertical dilution of precision present (0=not present, 1=present). */ + ble_lns_pos_status_type_t position_status; /**< Status of last measured position. */ + uint8_t number_of_satellites_in_solution; /**< The number of satellites in solution (unitless, with a resolution of 1). */ + uint8_t number_of_satellites_in_view; /**< The number of satellites in view (unitless, with a resolution of 1). */ + uint16_t time_to_first_fix; /**< Time to the first position fix (seconds, with a resolution of 1/10). */ + uint32_t ehpe; /**< Error in horizontal position estimate (meters, with a resolution of 1/100). */ + uint32_t evpe; /**< Error in vertical position estimate (meters, with a resolution of 1/100). */ + uint8_t hdop; /**< Horizontal dilution of precision (unitless, with a resolution of 2/10). */ + uint8_t vdop; /**< Vertical dilution of precision (unitless, with a resolution of 2/10). */ +}; + +/** @brief Navigation indicator type. */ +typedef enum +{ + BLE_LNS_NAV_TO_WAYPOINT = 0, + BLE_LNS_NAV_TO_DESTINATION = 1 +} ble_lns_nav_indicator_type_t; + +/**@brief Navigation data structure. */ +struct ble_lns_navigation_s +{ + bool remaining_dist_present; /**< Remaining Distance present (0=not present, 1=present). */ + bool remaining_vert_dist_present; /**< Remaining Vertical Distance present (0=not present, 1=present). */ + bool eta_present; /**< Estimated Time of Arrival present (0=not present, 1=present). */ + ble_lns_pos_status_type_t position_status; /**< Status of last measured position. */ + ble_lns_heading_source_t heading_source; /**< Source of the heading measurement. */ + ble_lns_nav_indicator_type_t navigation_indicator_type; /**< Navigation indicator type. */ + bool waypoint_reached; /**< Waypoint Reached (0=not reached, 1=reached). */ + bool destination_reached; /**< Destination Reached (0=not reached, 1=reached). */ + uint16_t bearing; /**< Bearing (1/100 degrees).*/ + uint16_t heading; /**< Heading (1/100 degrees), size=24 bit. */ + uint32_t remaining_distance; /**< Remaining Distance (1/10 meters), size=24 bit. */ + int32_t remaining_vert_distance; /**< Remaining Vertical Distance (1/100 meters), size=24 bit. */ + ble_date_time_t eta; /**< Estimated Time of Arrival. */ +}; + + +/**@brief Function for initializing the Location and Navigation Service. + * + * @param[out] p_lns Location and Navigation Service structure. This structure must be supplied by + * the application. It is initialized by this function, and will later + * be used to identify this particular service instance. + * @param[in] p_lns_init Information needed to initialize the service. + * + * @retval NRF_SUCCESS If the service was initialized successfully. + * @retval NRF_ERROR_NULL If a NULL parameter was provided. + * @retval NRF_INVALID_PARAMS If there is an inconsistency in the initialization structure. + * @return Otherwise, an error code from either sd_ble_gatts_service_add() or sd_ble_gatts_characteristic_add() is returned. + */ +uint32_t ble_lns_init(ble_lns_t * p_lns, const ble_lns_init_t * p_lns_init); + +/**@brief Function for handling Location and Navigation Service BLE stack events. + * + * @details This function handles all events from the BLE stack that are of interest to the Location and Navigation Service. + * + * @note The function returns when a NULL parameter is provided. + * + * @param[in] p_lns Location and Navigation Service structure. + * @param[in] p_ble_evt Event received from the BLE stack. + * + */ +void ble_lns_on_ble_evt(ble_lns_t * p_lns, ble_evt_t * p_ble_evt); + +/**@brief Function for sending location and speed data if notification has been enabled. + * + * @details The application calls this function after having performed a location and speed determination. + * If notification has been enabled, the location and speed data is encoded and sent to + * the client. + * + * @param[in] p_lns Location and Navigation Service structure holding the location and speed data. + * + * @retval NRF_SUCCESS If the data was sent successfully. + * @retval NRF_ERROR_NULL If a NULL parameter was provided. + * @retval NRF_ERROR_INVALID_STATE If notification is disabled. + * @return Otherwise, an error code from @ref sd_ble_gatts_hvx() is returned. + */ +uint32_t ble_lns_loc_speed_send(ble_lns_t * p_lns); + +/**@brief Function for sending navigation data if notification has been enabled. + * + * @details The application calls this function after having performed a navigation determination. + * If notification has been enabled, the navigation data is encoded and sent to + * the client. + * + * @param[in] p_lns Location and Navigation Service structure holding the navigation data. + * + * @retval NRF_SUCCESS If the data was sent successfully. + * @retval NRF_ERROR_NULL If a NULL parameter was provided. + * @retval NRF_ERROR_NOT_SUPPORTED If the navigation characteristic is absent. + * @retval NRF_ERROR_INVALID_STATE If navigation is not running or notification is disabled. + * @return Otherwise, an error code from @ref sd_ble_gatts_hvx() is returned. + */ +uint32_t ble_lns_navigation_send(ble_lns_t * p_lns); + +/**@brief Function for adding a route to the Location and Navigation Service. + * + * @param[in] p_lns Location and Navigation Service structure. + * @param[in,out] p_route The new route to be added. The route ID is updated. + * + * @retval NRF_SUCCESS If the route was added successfully. + * @retval NRF_ERROR_NULL If a NULL parameter was provided. + * @retval NRF_ERROR_NOT_SUPPORTED If the navigation characteristic is absent. + * @retval NRF_ERROR_NO_MEM If there is no memory left. + * @retval NRF_ERROR_INTERNAL If there is an inconsistency in the routes table. + */ +uint32_t ble_lns_add_route(ble_lns_t * p_lns, ble_lns_route_t * p_route); + +/**@brief Function for removing a route from the Location and Navigation Service. + * + * @param[in] p_lns Location and Navigation Service structure. + * @param[in] route_id The ID of the route to be removed. + * + * @retval NRF_SUCCESS If the route was removed successfully. + * @retval NRF_ERROR_NULL If a NULL parameter was provided. + * @retval NRF_ERROR_NOT_SUPPORTED If the navigation characteristic is absent. + * @retval NRF_INVALID_PARAM If the route ID does not exist. + */ +uint32_t ble_lns_remove_route(ble_lns_t * p_lns, uint16_t route_id); + +#endif // BLE_LNS_H__ + +/** @} */ diff --git a/components/ble/common/ble_advdata.c b/components/ble/common/ble_advdata.c new file mode 100644 index 0000000..aef7f72 --- /dev/null +++ b/components/ble/common/ble_advdata.c @@ -0,0 +1,841 @@ +/* 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 "ble_advdata.h" +#include "nordic_common.h" +#include "nrf_error.h" +#include "ble_gap.h" +#include "ble_srv_common.h" +#include "app_util.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); + if (err_code != NRF_SUCCESS) + { + return 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); + if (err_code != NRF_SUCCESS) + { + return 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); + if (err_code != NRF_SUCCESS) + { + return 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); + if (err_code != NRF_SUCCESS) + { + return 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]); + if (err_code != NRF_SUCCESS) + { + return 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); + if (err_code != NRF_SUCCESS) + { + return 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); + if (err_code != NRF_SUCCESS) + { + return 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); + if (err_code != NRF_SUCCESS) + { + return 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); + if (err_code != NRF_SUCCESS) + { + return 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); + if (err_code != NRF_SUCCESS) + { + return 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); + if (err_code != NRF_SUCCESS) + { + return 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); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + + // Encode appearance. + if (p_advdata->include_appearance) + { + err_code = appearance_encode(p_encoded_data, p_len, max_size); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + + //Encode Flags + if(p_advdata->flags != 0 ) + { + err_code = flags_encode(p_advdata->flags, p_encoded_data, p_len, max_size); + if (err_code != NRF_SUCCESS) + { + return 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); + if (err_code != NRF_SUCCESS) + { + return 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); + if (err_code != NRF_SUCCESS) + { + return 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); + if (err_code != NRF_SUCCESS) + { + return 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); + if (err_code != NRF_SUCCESS) + { + return 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); + if (err_code != NRF_SUCCESS) + { + return 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); + if (err_code != NRF_SUCCESS) + { + return 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); + if (err_code != NRF_SUCCESS) + { + return 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); + if (err_code != NRF_SUCCESS) + { + return 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); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + err_code = adv_data_encode(p_advdata, encoded_advdata, &len_advdata); + if (err_code != NRF_SUCCESS) + { + return 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); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + err_code = adv_data_encode(p_srdata, encoded_srdata, &len_srdata); + if (err_code != NRF_SUCCESS) + { + return 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/components/ble/common/ble_advdata.h b/components/ble/common/ble_advdata.h new file mode 100644 index 0000000..ef34b9d --- /dev/null +++ b/components/ble/common/ble_advdata.h @@ -0,0 +1,212 @@ +/* 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 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 "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.*/ + ble_advdata_tk_value_t * p_tk_value; /**< Security Manager TK value field. Included when different from NULL.*/ + uint8_t * p_sec_mgr_oob_flags; /**< Security Manager Out Of Band Flags field. Included when different from 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/components/ble/common/ble_conn_params.c b/components/ble/common/ble_conn_params.c new file mode 100644 index 0000000..ddc1ba9 --- /dev/null +++ b/components/ble/common/ble_conn_params.c @@ -0,0 +1,323 @@ +/* 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 "ble_conn_params.h" +#include +#include "nordic_common.h" +#include "ble_hci.h" +#include "app_timer.h" +#include "ble_srv_common.h" +#include "app_util.h" + + +static ble_conn_params_init_t m_conn_params_config; /**< Configuration as specified by the application. */ +static ble_gap_conn_params_t m_preferred_conn_params; /**< Connection parameters preferred by the application. */ +static uint8_t m_update_count; /**< Number of Connection Parameter Update messages that has currently been sent. */ +static uint16_t m_conn_handle; /**< Current connection handle. */ +static ble_gap_conn_params_t m_current_conn_params; /**< Connection parameters received in the most recent Connect event. */ +APP_TIMER_DEF(m_conn_params_timer_id); /**< Connection parameters timer. */ + +static bool m_change_param = false; + +static bool is_conn_params_ok(ble_gap_conn_params_t * p_conn_params) +{ + // Check if interval is within the acceptable range. + // NOTE: Using max_conn_interval in the received event data because this contains + // the client's connection interval. + if ( + (p_conn_params->max_conn_interval >= m_preferred_conn_params.min_conn_interval) + && + (p_conn_params->max_conn_interval <= m_preferred_conn_params.max_conn_interval) + ) + { + return true; + } + else + { + return false; + } +} + + +static void update_timeout_handler(void * p_context) +{ + UNUSED_PARAMETER(p_context); + + if (m_conn_handle != BLE_CONN_HANDLE_INVALID) + { + // Check if we have reached the maximum number of attempts + m_update_count++; + if (m_update_count <= m_conn_params_config.max_conn_params_update_count) + { + uint32_t err_code; + + // Parameters are not ok, send connection parameters update request. + err_code = sd_ble_gap_conn_param_update(m_conn_handle, &m_preferred_conn_params); + if ((err_code != NRF_SUCCESS) && (m_conn_params_config.error_handler != NULL)) + { + m_conn_params_config.error_handler(err_code); + } + } + else + { + m_update_count = 0; + + // Negotiation failed, disconnect automatically if this has been configured + if (m_conn_params_config.disconnect_on_fail) + { + uint32_t err_code; + + err_code = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_CONN_INTERVAL_UNACCEPTABLE); + if ((err_code != NRF_SUCCESS) && (m_conn_params_config.error_handler != NULL)) + { + m_conn_params_config.error_handler(err_code); + } + } + + // Notify the application that the procedure has failed + if (m_conn_params_config.evt_handler != NULL) + { + ble_conn_params_evt_t evt; + + evt.evt_type = BLE_CONN_PARAMS_EVT_FAILED; + m_conn_params_config.evt_handler(&evt); + } + } + } +} + + +uint32_t ble_conn_params_init(const ble_conn_params_init_t * p_init) +{ + uint32_t err_code; + + m_conn_params_config = *p_init; + m_change_param = false; + if (p_init->p_conn_params != NULL) + { + m_preferred_conn_params = *p_init->p_conn_params; + + // Set the connection params in stack + err_code = sd_ble_gap_ppcp_set(&m_preferred_conn_params); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + else + { + // Fetch the connection params from stack + err_code = sd_ble_gap_ppcp_get(&m_preferred_conn_params); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + + m_conn_handle = BLE_CONN_HANDLE_INVALID; + m_update_count = 0; + + return app_timer_create(&m_conn_params_timer_id, + APP_TIMER_MODE_SINGLE_SHOT, + update_timeout_handler); +} + + +uint32_t ble_conn_params_stop(void) +{ + return app_timer_stop(m_conn_params_timer_id); +} + + +static void conn_params_negotiation(void) +{ + // Start negotiation if the received connection parameters are not acceptable + if (!is_conn_params_ok(&m_current_conn_params)) + { + uint32_t err_code; + uint32_t timeout_ticks; + + if (m_change_param) + { + // Notify the application that the procedure has failed + if (m_conn_params_config.evt_handler != NULL) + { + ble_conn_params_evt_t evt; + + evt.evt_type = BLE_CONN_PARAMS_EVT_FAILED; + m_conn_params_config.evt_handler(&evt); + } + } + else + { + if (m_update_count == 0) + { + // First connection parameter update + timeout_ticks = m_conn_params_config.first_conn_params_update_delay; + } + else + { + timeout_ticks = m_conn_params_config.next_conn_params_update_delay; + } + + err_code = app_timer_start(m_conn_params_timer_id, timeout_ticks, NULL); + if ((err_code != NRF_SUCCESS) && (m_conn_params_config.error_handler != NULL)) + { + m_conn_params_config.error_handler(err_code); + } + } + } + else + { + // Notify the application that the procedure has succeded + if (m_conn_params_config.evt_handler != NULL) + { + ble_conn_params_evt_t evt; + + evt.evt_type = BLE_CONN_PARAMS_EVT_SUCCEEDED; + m_conn_params_config.evt_handler(&evt); + } + } + m_change_param = false; +} + + +static void on_connect(ble_evt_t * p_ble_evt) +{ + // Save connection parameters + m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle; + m_current_conn_params = p_ble_evt->evt.gap_evt.params.connected.conn_params; + m_update_count = 0; // Connection parameter negotiation should re-start every connection + + // Check if we shall handle negotiation on connect + if (m_conn_params_config.start_on_notify_cccd_handle == BLE_GATT_HANDLE_INVALID) + { + conn_params_negotiation(); + } +} + + +static void on_disconnect(ble_evt_t * p_ble_evt) +{ + uint32_t err_code; + + m_conn_handle = BLE_CONN_HANDLE_INVALID; + + // Stop timer if running + m_update_count = 0; // Connection parameters updates should happen during every connection + + err_code = app_timer_stop(m_conn_params_timer_id); + if ((err_code != NRF_SUCCESS) && (m_conn_params_config.error_handler != NULL)) + { + m_conn_params_config.error_handler(err_code); + } +} + + +static void on_write(ble_evt_t * p_ble_evt) +{ + ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write; + + // Check if this the correct CCCD + if ( + (p_evt_write->handle == m_conn_params_config.start_on_notify_cccd_handle) + && + (p_evt_write->len == 2) + ) + { + // Check if this is a 'start notification' + if (ble_srv_is_notification_enabled(p_evt_write->data)) + { + // Do connection parameter negotiation if necessary + conn_params_negotiation(); + } + else + { + uint32_t err_code; + + // Stop timer if running + err_code = app_timer_stop(m_conn_params_timer_id); + if ((err_code != NRF_SUCCESS) && (m_conn_params_config.error_handler != NULL)) + { + m_conn_params_config.error_handler(err_code); + } + } + } +} + + +static void on_conn_params_update(ble_evt_t * p_ble_evt) +{ + // Copy the parameters + m_current_conn_params = p_ble_evt->evt.gap_evt.params.conn_param_update.conn_params; + + conn_params_negotiation(); +} + + +void ble_conn_params_on_ble_evt(ble_evt_t * p_ble_evt) +{ + switch (p_ble_evt->header.evt_id) + { + case BLE_GAP_EVT_CONNECTED: + on_connect(p_ble_evt); + break; + + case BLE_GAP_EVT_DISCONNECTED: + on_disconnect(p_ble_evt); + break; + + case BLE_GATTS_EVT_WRITE: + on_write(p_ble_evt); + break; + + case BLE_GAP_EVT_CONN_PARAM_UPDATE: + on_conn_params_update(p_ble_evt); + break; + + default: + // No implementation needed. + break; + } +} + + +uint32_t ble_conn_params_change_conn_params(ble_gap_conn_params_t * new_params) +{ + uint32_t err_code; + + m_preferred_conn_params = *new_params; + // Set the connection params in stack + err_code = sd_ble_gap_ppcp_set(&m_preferred_conn_params); + if (err_code == NRF_SUCCESS) + { + if (!is_conn_params_ok(&m_current_conn_params)) + { + m_change_param = true; + err_code = sd_ble_gap_conn_param_update(m_conn_handle, &m_preferred_conn_params); + m_update_count = 1; + } + else + { + // Notify the application that the procedure has succeded + if (m_conn_params_config.evt_handler != NULL) + { + ble_conn_params_evt_t evt; + + evt.evt_type = BLE_CONN_PARAMS_EVT_SUCCEEDED; + m_conn_params_config.evt_handler(&evt); + } + err_code = NRF_SUCCESS; + } + } + return err_code; +} diff --git a/components/ble/common/ble_conn_params.h b/components/ble/common/ble_conn_params.h new file mode 100644 index 0000000..9983573 --- /dev/null +++ b/components/ble/common/ble_conn_params.h @@ -0,0 +1,111 @@ +/* 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 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 "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/components/ble/common/ble_conn_state.c b/components/ble/common/ble_conn_state.c new file mode 100644 index 0000000..dc1639f --- /dev/null +++ b/components/ble/common/ble_conn_state.c @@ -0,0 +1,394 @@ +/* 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 "ble_conn_state.h" +#include +#include +#include +#include "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 +{ + uint16_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 (int 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 + { +#if defined(S110) + bool is_central = false; +#elif defined(S120) + bool is_central = true; +#elif defined(S130) || defined(S132) || defined(S332) + bool is_central = + (p_ble_evt->evt.gap_evt.params.connected.role == BLE_GAP_ROLE_CENTRAL); +#else + /* BLE SoftDevice missing. */ +#endif + 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/components/ble/common/ble_conn_state.h b/components/ble/common/ble_conn_state.h new file mode 100644 index 0000000..03b813c --- /dev/null +++ b/components/ble/common/ble_conn_state.h @@ -0,0 +1,267 @@ +/* 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 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 "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 16 /**< 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_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/components/ble/common/ble_date_time.h b/components/ble/common/ble_date_time.h new file mode 100644 index 0000000..38b274d --- /dev/null +++ b/components/ble/common/ble_date_time.h @@ -0,0 +1,76 @@ +/* Copyright (c) 2011 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. +*/ + +/* Attention! +* To maintain compliance with Nordic Semiconductor ASAs 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/components/ble/common/ble_gatt_db.h b/components/ble/common/ble_gatt_db.h new file mode 100644 index 0000000..45e8b76 --- /dev/null +++ b/components/ble/common/ble_gatt_db.h @@ -0,0 +1,30 @@ + +#ifndef BLE_GATT_DB_H__ +#define BLE_GATT_DB_H__ + +#include "stdint.h" +#include "ble.h" +#include "ble_gattc.h" + +#define BLE_GATT_DB_MAX_CHARS 4 /**< 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/components/ble/common/ble_sensor_location.h b/components/ble/common/ble_sensor_location.h new file mode 100644 index 0000000..4fdbbf6 --- /dev/null +++ b/components/ble/common/ble_sensor_location.h @@ -0,0 +1,40 @@ +/* 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. + * + */ + + /* Attention! +* To maintain compliance with Nordic Semiconductor ASAs 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/components/ble/common/ble_srv_common.c b/components/ble/common/ble_srv_common.c new file mode 100644 index 0000000..364798d --- /dev/null +++ b/components/ble/common/ble_srv_common.c @@ -0,0 +1,197 @@ +/* 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. + * + */ + +/* Attention! +* To maintain compliance with Nordic Semiconductor ASAs 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 "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/components/ble/common/ble_srv_common.h b/components/ble/common/ble_srv_common.h new file mode 100644 index 0000000..94f6d94 --- /dev/null +++ b/components/ble/common/ble_srv_common.h @@ -0,0 +1,348 @@ +/* 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 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 "ble_types.h" +#include "app_util.h" +#include "ble.h" +#include "ble_gap.h" +#include "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. */ +/** @} */ + +/** @defgroup UUID_CHARACTERISTICS Characteristic UUID definitions + * @{ */ +#define BLE_UUID_BATTERY_LEVEL_STATE_CHAR 0x2A1B /**< Battery Level State characteristic UUID. */ +#define BLE_UUID_BATTERY_POWER_STATE_CHAR 0x2A1A /**< Battery Power State characteristic UUID. */ +#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. */ +/** @} */ + +/** @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 * 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 * 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/components/ble/device_manager/config/device_manager_cnfg.h b/components/ble/device_manager/config/device_manager_cnfg.h new file mode 100644 index 0000000..9aff537 --- /dev/null +++ b/components/ble/device_manager/config/device_manager_cnfg.h @@ -0,0 +1,98 @@ +/* Copyright (C) 2013 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * 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 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/components/ble/device_manager/device_manager.h b/components/ble/device_manager/device_manager.h new file mode 100644 index 0000000..9aa465d --- /dev/null +++ b/components/ble/device_manager/device_manager.h @@ -0,0 +1,888 @@ +/* Copyright (C) 2013 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * 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 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 "ble.h" +#include "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/components/ble/device_manager/device_manager_central.c b/components/ble/device_manager/device_manager_central.c new file mode 100644 index 0000000..f71d067 --- /dev/null +++ b/components/ble/device_manager/device_manager_central.c @@ -0,0 +1,2793 @@ +/* Copyright (C) 2013 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * 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 "device_manager.h" +#include "app_trace.h" +#include "ble_advdata.h" +#include "pstorage.h" +#include "ble_hci.h" +#include "app_error.h" + +#define INVALID_ADDR_TYPE 0xFF /**< Identifier for an invalid address type. */ + +/** + * @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 4 /**< 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. */ + +#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) +#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. */ + 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 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 +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. */ +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. */ + +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; + + //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) +{ + ret_code_t err_code; + uint32_t index; + + err_code = NRF_ERROR_NOT_FOUND; + + 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 (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; + 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, + BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS | BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS); + + 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].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; + + 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; + } + + err_code = sd_ble_gatts_sys_attr_set(m_connection_table[p_handle->connection_id].conn_handle, + p_gatts_context, + context_len, + BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS | BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS); + + 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; + } + + 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; +} + + +uint32_t initiate_security_request(const dm_handle_t * p_handle) +{ + uint32_t err_code; + + DM_LOG("[DM]: Initiating authentication request\r\n"); + DM_DUMP((uint8_t *)&m_application_table[p_handle->appl_id].sec_param, + sizeof (ble_gap_sec_params_t)); + + err_code = sd_ble_gap_authenticate(m_connection_table[p_handle->connection_id].conn_handle, + &m_application_table[p_handle->appl_id].sec_param); + + if (err_code == NRF_SUCCESS) + { + m_application_table[p_handle->appl_id].state |= STATE_CONTROL_PROCEDURE_IN_PROGRESS; + m_connection_table[p_handle->connection_id].state |= STATE_PAIRING; + m_connection_table[p_handle->connection_id].state &= (~STATE_PAIRING_PENDING); + } + + 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_central.p_enc_key = NULL; + keys_exchanged.keys_central.p_id_key = &m_local_id_info; + keys_exchanged.keys_periph.p_enc_key = &m_bond_table[index_count].peer_enc_key; + keys_exchanged.keys_periph.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); + } + + //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; + + //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) + { + if ((p_handle->device_id != DM_INVALID_ID) || + (m_connection_table[p_handle->connection_id].bonded_dev_id != DM_INVALID_ID)) + { + p_handle->device_id = m_connection_table[p_handle->connection_id].bonded_dev_id; + + //Already bonded device, encrypt the link. + err_code = sd_ble_gap_encrypt(m_connection_table[p_handle->connection_id].conn_handle, + &m_bond_table[p_handle->connection_id].peer_enc_key.master_id, + &m_bond_table[p_handle->connection_id].peer_enc_key.enc_info); + } + else + { + uint8_t device_index; + + //Request for pairing, allocate a bonded device instance. + err_code = device_instance_allocate(&device_index, + &m_connection_table[p_handle->connection_id].peer_addr); + + if (err_code == NRF_SUCCESS) + { + m_connection_table[p_handle->connection_id].bonded_dev_id = device_index; + p_handle->device_id = device_index; + + if ((m_application_table[p_handle->appl_id].state & + STATE_CONTROL_PROCEDURE_IN_PROGRESS) == STATE_CONTROL_PROCEDURE_IN_PROGRESS) + { + DM_LOG("[DM]: Marked pending\r\n"); + + m_connection_table[p_handle->connection_id].state |= STATE_PAIRING_PENDING; + m_application_table[p_handle->appl_id].state |= + STATE_QUEUED_CONTROL_REQUEST; + err_code = NRF_SUCCESS; + } + else + { + err_code = initiate_security_request(p_handle); + } + } + } + } + + 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; + 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->context_data.p_data == NULL) && + (p_context->context_data.len < DM_GATT_SERVER_ATTR_MAX_SIZE)) + { + 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); + + 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); + 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_local_id_info; + p_key_dist->keys_central.p_sign_key = NULL; + p_key_dist->keys_periph.p_id_key = (dm_id_key_t *)&m_peer_table[p_handle->device_id].peer_id; + p_key_dist->keys_periph.p_sign_key = NULL; + + 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_local_id_info; + p_key_dist->keys_central.p_sign_key = NULL; + p_key_dist->keys_periph.p_id_key = (dm_id_key_t *)&m_peer_table[p_handle->device_id].peer_id; + 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; +} + + +void dm_ble_evt_handler(ble_evt_t * p_ble_evt) +{ + uint32_t err_code; + uint32_t index; + uint32_t device_index; + bool notify_app = false; + bool start_sec_procedure = false; + dm_handle_t handle; + dm_event_t event; + uint32_t event_result; + + 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; + + //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); + + if (err_code == NRF_SUCCESS) + { + pstorage_handle_t block_handle; + + m_connection_table[index].bonded_dev_id = device_index; + m_connection_table[index].state |= STATE_BONDED; + handle.device_id = device_index; + err_code = pstorage_block_identifier_get(&m_storage_handle, + device_index, + &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", + index, + block_handle.block_id, + &m_bond_table[index], + BOND_SIZE, + BOND_STORAGE_OFFSET); + + err_code = pstorage_load((uint8_t *)&m_bond_table[index], + &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", + index, + err_code); + } + + DM_LOG("[DM]:[%02X]:Loading service context at %p, size 0x%08X, offset 0x%08X.\r\n", + index, + &m_gatts_table[index], + sizeof(dm_gatts_context_t), + SERVICE_STORAGE_OFFSET); + err_code = m_service_context_load[m_application_table[0].service]( + &block_handle, + &handle); + + if (err_code != NRF_SUCCESS) + { + DM_ERR("[DM]:[%02X]: Failed to load service information, reason %08X\r\n", + index, + err_code); + } + } + else + { + DM_ERR("[DM]:[%02X]: Failed to get block identifier for " + "device %08X, reason %08X.\r\n", + index, + device_index, + err_code); + } + } + } + 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; + } + } + + if ((m_connection_table[index].state & STATE_PAIRING) == STATE_PAIRING) + { + start_sec_procedure = true; + m_application_table[0].state &= (~STATE_CONTROL_PROCEDURE_IN_PROGRESS); + } + m_connection_table[index].state = STATE_DISCONNECTING; + + notify_app = true; + event.event_id = DM_EVT_DISCONNECTION; + + break; + + case BLE_GAP_EVT_SEC_PARAMS_REQUEST: + DM_LOG("[DM]: >> BLE_GAP_EVT_SEC_PARAMS_REQUEST\r\n"); + + notify_app = false; + 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_periph.enc, + p_ble_evt->evt.gap_evt.params.sec_params_request.peer_params.kdist_periph.id, + p_ble_evt->evt.gap_evt.params.sec_params_request.peer_params.kdist_periph.sign, + p_ble_evt->evt.gap_evt.params.sec_params_request.peer_params.bond); + + keys_exchanged.keys_central.p_enc_key = NULL; + keys_exchanged.keys_central.p_id_key = NULL; + keys_exchanged.keys_central.p_sign_key = NULL; + keys_exchanged.keys_periph.p_enc_key = &m_bond_table[index].peer_enc_key; + keys_exchanged.keys_periph.p_id_key = + &m_peer_table[m_connection_table[index].bonded_dev_id].peer_id; + keys_exchanged.keys_periph.p_sign_key = NULL; + + err_code = sd_ble_gap_sec_params_reply(p_ble_evt->evt.gap_evt.conn_handle, + BLE_GAP_SEC_STATUS_SUCCESS, + NULL, + &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; + } + else + { + m_connection_table[index].state |= STATE_PAIRING; + } + 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; + start_sec_procedure = true; + + if (p_ble_evt->evt.gap_evt.params.auth_status.auth_status != BLE_GAP_SEC_STATUS_SUCCESS) + { + 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_periph.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)); + } + 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; + start_sec_procedure = true; + 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); + } + } + + if (start_sec_procedure) + { + if ((m_application_table[0].state & STATE_QUEUED_CONTROL_REQUEST) == + STATE_QUEUED_CONTROL_REQUEST) + { + dm_handle_t pending_handle; + uint32_t pending_index; + + DM_LOG("[DM]:Queued request\r\n"); + err_code = connection_instance_find(BLE_CONN_HANDLE_INVALID, + STATE_PAIRING_PENDING, + &pending_index); + + if (err_code == NRF_SUCCESS) + { + pending_handle.appl_id = 0; + pending_handle.connection_id = pending_index; + pending_handle.device_id = m_connection_table[pending_index].bonded_dev_id; + err_code = initiate_security_request(&pending_handle); + DM_LOG("[DM]:[CI 0x%02X]:[DI 0x%02X]: Security request result 0x%08X\r\n", + pending_handle.connection_id, + pending_handle.device_id, + err_code); + } + else + { + DM_LOG("[DM]:Nothing pending!\r\n"); + m_application_table[0].state &= (~STATE_QUEUED_CONTROL_REQUEST); + } + } + } + + UNUSED_VARIABLE(err_code); + + DM_MUTEX_UNLOCK(); +} diff --git a/components/ble/device_manager/device_manager_peripheral.c b/components/ble/device_manager/device_manager_peripheral.c new file mode 100644 index 0000000..fc3f06e --- /dev/null +++ b/components/ble/device_manager/device_manager_peripheral.c @@ -0,0 +1,2914 @@ +/* Copyright (C) 2013 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * 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 "device_manager.h" +#include "app_trace.h" +#include "pstorage.h" +#include "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. */ + +#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_BUFFERS) && + (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_central.p_enc_key = NULL; + keys_exchanged.keys_central.p_id_key = &m_local_id_info; + keys_exchanged.keys_periph.p_enc_key = &m_bond_table[index_count].peer_enc_key; + keys_exchanged.keys_periph.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_central.enc = 0; + m_application_table[0].sec_param.kdist_central.id = 1; + m_application_table[0].sec_param.kdist_central.sign = 0; + m_application_table[0].sec_param.kdist_periph.enc = 1; + m_application_table[0].sec_param.kdist_periph.id = 1; + m_application_table[0].sec_param.kdist_periph.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->context_data.p_data == NULL) && + (p_context->context_data.len < DM_GATT_SERVER_ATTR_MAX_SIZE)) + { + 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); + + 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; + } + } + else + { + //Bond/key refresh. + event.event_id = DM_EVT_SECURITY_SETUP_REFRESH; + memset(m_gatts_table[index].attributes, 0, DM_GATT_SERVER_ATTR_MAX_SIZE); + + //Set the update flag for bond data. + m_connection_table[index].state |= STATE_BOND_INFO_UPDATE; + } + + 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_periph.enc, + p_ble_evt->evt.gap_evt.params.sec_params_request.peer_params.kdist_central.id, + p_ble_evt->evt.gap_evt.params.sec_params_request.peer_params.kdist_periph.sign, + p_ble_evt->evt.gap_evt.params.sec_params_request.peer_params.bond); + + keys_exchanged.keys_central.p_enc_key = NULL; + keys_exchanged.keys_central.p_id_key = &m_peer_table[m_connection_table[index].bonded_dev_id].peer_id; + keys_exchanged.keys_central.p_sign_key = NULL; + keys_exchanged.keys_periph.p_enc_key = &m_bond_table[index].peer_enc_key; + keys_exchanged.keys_periph.p_id_key = NULL; + keys_exchanged.keys_periph.p_sign_key = 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; + } + 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) + { + // 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_central.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/components/ble/peer_manager/gatt_cache_manager.c b/components/ble/peer_manager/gatt_cache_manager.c new file mode 100644 index 0000000..dc24f63 --- /dev/null +++ b/components/ble/peer_manager/gatt_cache_manager.c @@ -0,0 +1,542 @@ + + +#include "gatt_cache_manager.h" + +#include +#include "ble_gap.h" +#include "ble_conn_state.h" +#include "peer_manager_types.h" +#include "peer_database.h" +#include "id_manager.h" +#include "security_dispatcher.h" +#include "gatts_cache_manager.h" +#include "gattc_cache_manager.h" + + +/**@brief Macro for verifying that the module is initialized. It will cause the function to return + * @ref NRF_ERROR_INVALID_STATE if not. + */ +#define VERIFY_MODULE_INITIALIZED() \ +do \ +{ \ + if (m_gcm.evt_handler == NULL) \ + { \ + return NRF_ERROR_INVALID_STATE; \ + } \ +} while(0) + + +/**@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. + */ +#define VERIFY_PARAM_NOT_NULL(param) \ +do \ +{ \ + if (param == NULL) \ + { \ + return NRF_ERROR_NULL; \ + } \ +} while(0) + + + +/**@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. */ +} gcm_t; + +static gcm_t m_gcm; /**< Instantiation of module variable(s). */ + + +/**@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->context.type == BLE_GATTS_ATTR_TYPE_DESC) + && (p_write_evt->context.desc_uuid.type == BLE_UUID_TYPE_BLE) + && (p_write_evt->context.desc_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; + ret_code_t err_code = gscm_service_changed_ind_send(conn_handle); + + switch(err_code) + { + case NRF_SUCCESS: + /* Do nothing */ + break; + + case BLE_ERROR_INVALID_CONN_HANDLE: + /* Do nothing */ + break; + + case NRF_ERROR_BUSY: + /* Do nothing */ + break; + + case BLE_ERROR_GATTS_SYS_ATTR_MISSING: + local_db_apply_in_evt(conn_handle); + 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, true); +} + + +/**@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; + switch (p_event->evt_id) + { + case GSCM_EVT_LOCAL_DB_CACHE_STORED: + event.evt_id = GCM_EVT_LOCAL_DB_CACHE_STORED; + event.peer_id = p_event->peer_id; + + 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.peer_id = p_event->peer_id; + 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); + } + } + 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); + if (err_code != NRF_SUCCESS) {return err_code;} + + err_code = gccm_init(gccm_evt_handler); + if (err_code != NRF_SUCCESS) {return err_code;} + + internal_state_reset(&m_gcm); + m_gcm.evt_handler = evt_handler; + + err_code = im_register(im_evt_handler); + if (err_code != NRF_SUCCESS) {return err_code;} + + err_code = smd_register(smd_evt_handler); + if (err_code != NRF_SUCCESS) {return 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(); + + 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)) + { + 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 (int 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 (int 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 (int 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)) + { + 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) +{ + 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: + gscm_peer_was_notified_of_db_change(im_peer_id_get_by_conn_handle(p_ble_evt->evt.gatts_evt.conn_handle)); + ble_conn_state_user_flag_set(p_ble_evt->evt.gatts_evt.conn_handle, m_gcm.flag_id_service_changed_pending, false); + 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, pm_peer_data_remote_gatt_db_t * p_remote_db) +{ + VERIFY_MODULE_INITIALIZED(); + + return gccm_remote_db_store(peer_id, p_remote_db); +} + + +ret_code_t gcm_remote_db_retrieve(pm_peer_id_t peer_id, pm_peer_data_remote_gatt_db_t * p_remote_db) +{ + VERIFY_MODULE_INITIALIZED(); + VERIFY_PARAM_NOT_NULL(p_remote_db); + + return gccm_remote_db_retrieve(peer_id, p_remote_db); +} + + +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/components/ble/peer_manager/gatt_cache_manager.h b/components/ble/peer_manager/gatt_cache_manager.h new file mode 100644 index 0000000..010f829 --- /dev/null +++ b/components/ble/peer_manager/gatt_cache_manager.h @@ -0,0 +1,184 @@ + + +#ifndef GATT_CACHE_MANAGER_H__ +#define GATT_CACHE_MANAGER_H__ + +#include "stdint.h" +#include "sdk_errors.h" +#include "ble.h" +#include "ble_gap.h" +#include "peer_manager_types.h" + + + +/** + * @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_INDICATION_SENT, /**< A service changed indication has been sent to and 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_indication_sent; + 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. If NULL, values are cleared instead. + * + * @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, pm_peer_data_remote_gatt_db_t * p_remote_db); + + +/**@brief Function for retrieving a persistently stored remote database. + * + * @param[in] peer_id Peer to retrieve data for. + * @param[inout] p_remote_db Copied database values. + * + * @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, pm_peer_data_remote_gatt_db_t * p_remote_db); + + +/**@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); + + /* @} */ + +#endif /* GATT_CACHE_MANAGER_H__ */ diff --git a/components/ble/peer_manager/gattc_cache_manager.c b/components/ble/peer_manager/gattc_cache_manager.c new file mode 100644 index 0000000..f301278 --- /dev/null +++ b/components/ble/peer_manager/gattc_cache_manager.c @@ -0,0 +1,108 @@ + +#include "gattc_cache_manager.h" + +#include +#include "ble_gap.h" +#include "ble_conn_state.h" +#include "peer_manager_types.h" +#include "peer_database.h" +#include "id_manager.h" + + +#define MAX_SIMUL_SEC_PROCEDURES 2 + + +#define VERIFY_MODULE_INITIALIZED() \ +do \ +{ \ + if (m_gccm.evt_handler == NULL) \ + { \ + return NRF_ERROR_INVALID_STATE; \ + } \ +} while(0) + +#define VERIFY_PARAM_NOT_NULL(param) \ +do \ +{ \ + if (param == NULL) \ + { \ + return NRF_ERROR_NULL; \ + } \ +} while(0) + + + +typedef struct +{ + gccm_evt_handler_t evt_handler; +} gccm_t; + +static gccm_t m_gccm; + +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, pm_peer_data_remote_gatt_db_t * p_remote_db) +{ + 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_type = PM_PEER_DATA_ID_GATT_REMOTE; + peer_data.data.p_remote_gatt_db = p_remote_db; + + return pdb_raw_store(peer_id, &peer_data, NULL); +} + + +ret_code_t gccm_remote_db_retrieve(pm_peer_id_t peer_id, pm_peer_data_remote_gatt_db_t * p_remote_db) +{ + VERIFY_MODULE_INITIALIZED(); + VERIFY_PARAM_NOT_NULL(p_remote_db); + + // Initialize the peer_data + pm_peer_data_t peer_data; + memset(&peer_data, 0, sizeof(peer_data)); + peer_data.data_type = PM_PEER_DATA_ID_GATT_REMOTE; + peer_data.data.p_remote_gatt_db = p_remote_db; + + return pdb_raw_read(peer_id, PM_PEER_DATA_ID_GATT_REMOTE, &peer_data); +} diff --git a/components/ble/peer_manager/gattc_cache_manager.h b/components/ble/peer_manager/gattc_cache_manager.h new file mode 100644 index 0000000..c8e6e35 --- /dev/null +++ b/components/ble/peer_manager/gattc_cache_manager.h @@ -0,0 +1,83 @@ + + +#ifndef GATTC_CACHE_MANAGER_H__ +#define GATTC_CACHE_MANAGER_H__ + +#include "stdint.h" +#include "sdk_errors.h" +#include "ble.h" +#include "ble_gap.h" +#include "peer_manager_types.h" + + +/** + * @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. If NULL, values are cleared instead. + * + * @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, pm_peer_data_remote_gatt_db_t * p_remote_db); + + +/**@brief Function for retrieving a persistently stored remote database. + * + * @param[in] peer_id Peer to retrieve data for. + * @param[inout] p_remote_db Copied database values. If NULL, nothing is copied. + * + * @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, + pm_peer_data_remote_gatt_db_t * p_remote_db); + + + /* @} */ + +#endif /* GATTC_CACHE_MANAGER_H__ */ diff --git a/components/ble/peer_manager/gatts_cache_manager.c b/components/ble/peer_manager/gatts_cache_manager.c new file mode 100644 index 0000000..f67de76 --- /dev/null +++ b/components/ble/peer_manager/gatts_cache_manager.c @@ -0,0 +1,373 @@ + +#include "gatts_cache_manager.h" + +#include +#include "ble_gap.h" +#include "ble_conn_state.h" +#include "peer_manager_types.h" +#include "peer_database.h" +#include "id_manager.h" +#include "nordic_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 Macro for verifying that the module is initialized. It will cause the function to return + * @ref NRF_ERROR_INVALID_STATE if not. + */ +#define VERIFY_MODULE_INITIALIZED() \ +do \ +{ \ + if (m_gscm.evt_handler == NULL) \ + { \ + return NRF_ERROR_INVALID_STATE; \ + } \ +} while(0) + + +/**@brief Macro for verifying that the module is initialized. It will cause the function to return + * if not. + */ +#define VERIFY_MODULE_INITIALIZED_VOID()\ +do \ +{ \ + if (m_gscm.evt_handler == NULL) \ + { \ + return; \ + } \ +} while(0) + + +/**@brief Macro for verifying that a variable (typically a function parameter) is not NULL. It will + * cause the function to return @ref NRF_ERROR_NULL if not. + * + * @param[in] param The variable to check if is NULL. + */ +#define VERIFY_PARAM_NOT_NULL(param) \ +do \ +{ \ + if (param == NULL) \ + { \ + return NRF_ERROR_NULL; \ + } \ +} while(0) + + + +/**@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. */ +} gscm_t; + +static gscm_t m_gscm; /**< Instantiation of module variable(s). */ + + +/**@brief Function for resetting the module variable(s) of the GSCM module. + * + * @param[out] The instance to reset. + */ +static void internal_state_reset(gscm_t * gscm) +{ + memset(gscm, 0, sizeof(gscm_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) +{ + 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.data.p_service_changed_pending; + + m_gscm.evt_handler(&gscm_evt); + } + } + } +} + + +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.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->p_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. + pdb_clear(peer_id, PM_PEER_DATA_ID_GATT_LOCAL); + err_code = NRF_SUCCESS; + } + + pdb_write_buf_release(peer_id, PM_PEER_DATA_ID_GATT_LOCAL); + } + } + 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; + uint8_t sys_attr_data[100]; // Workaround for s130 v1, which does not accept pointers to flash. + 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) + { + return BLE_ERROR_INVALID_CONN_HANDLE; + } + + 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_flash_t const * p_local_gatt_db = peer_data.data.p_local_gatt_db; + p_sys_attr_data = sys_attr_data; + sys_attr_len = p_local_gatt_db->len; + sys_attr_flags = p_local_gatt_db->flags; + memcpy(sys_attr_data, p_local_gatt_db->p_data, MIN(sys_attr_len, sizeof(sys_attr_data))); + } + + 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_type = PM_PEER_DATA_ID_GATT_LOCAL; + peer_data.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.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(); + + static const bool service_changed_pending = true; + pm_peer_id_t current_peer_id = PM_PEER_ID_INVALID; + pm_peer_data_const_t peer_data = + { + .data_type = PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING, + .length_words = PM_SC_STATE_N_WORDS(), + .data = + { + .p_service_changed_pending = &service_changed_pending + } + }; + + do + { + current_peer_id = pdb_next_peer_id_get(current_peer_id); + pdb_raw_store(current_peer_id, &peer_data, NULL); + } while(current_peer_id != PM_PEER_ID_INVALID); +} + + +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.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 == NRF_ERROR_INVALID_STATE) + { + err_code = NRF_SUCCESS; + } + else if (err_code == BLE_ERROR_INVALID_ATTR_HANDLE) + { + start_handle += 1; + } + } while (err_code == BLE_ERROR_INVALID_ATTR_HANDLE); + + return err_code; +} + + +void gscm_peer_was_notified_of_db_change(pm_peer_id_t peer_id) +{ + VERIFY_MODULE_INITIALIZED_VOID(); + + static const bool service_changed_pending = false; + + pm_peer_data_const_t peer_data = + { + .data_type = PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING, + .length_words = PM_SC_STATE_N_WORDS(), + .data = + { + .p_service_changed_pending = &service_changed_pending + } + }; + + // Don't need to check return code, because all error conditions can be ignored. + pdb_raw_store(peer_id, &peer_data, NULL); +} diff --git a/components/ble/peer_manager/gatts_cache_manager.h b/components/ble/peer_manager/gatts_cache_manager.h new file mode 100644 index 0000000..adb2aee --- /dev/null +++ b/components/ble/peer_manager/gatts_cache_manager.h @@ -0,0 +1,184 @@ + + +#ifndef GATTS_CACHE_MANAGER_H__ +#define GATTS_CACHE_MANAGER_H__ + +#include "stdint.h" +#include "sdk_errors.h" +#include "ble.h" +#include "ble_gap.h" +#include "peer_manager_types.h" + + + +/** + * @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. + */ +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_peer_was_notified_of_db_change(pm_peer_id_t peer_id); + +/** @} */ + +#endif /* GATTS_CACHE_MANAGER_H__ */ diff --git a/components/ble/peer_manager/id_manager.c b/components/ble/peer_manager/id_manager.c new file mode 100644 index 0000000..5b87c84 --- /dev/null +++ b/components/ble/peer_manager/id_manager.c @@ -0,0 +1,730 @@ +/* Copyright (C) 2015 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * 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 "id_manager.h" + +#include +#include "nrf_soc.h" +#include "ble_gap.h" +#include "ble_conn_state.h" +#include "peer_manager_types.h" +#include "peer_database.h" +#include "nordic_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 + +#define MODULE_INITIALIZED (m_im.n_registrants > 0) + +#define VERIFY_MODULE_INITIALIZED() \ +do \ +{ \ + if (!MODULE_INITIALIZED) \ + { \ + return NRF_ERROR_INVALID_STATE; \ + } \ +} while(0) + +#define VERIFY_PARAM_NOT_NULL(param) \ +do \ +{ \ + if (param == NULL) \ + { \ + return NRF_ERROR_NULL; \ + } \ +} while(0) + + +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 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_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}; + +static void internal_state_reset() +{ + memset(&m_im, 0, sizeof(im_t)); + m_im.n_registrants = 0; + m_im.n_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.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.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.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); + } + } + new_connection(ble_evt->evt.gap_evt.conn_handle, &ble_evt->evt.gap_evt.params.connected.peer_addr); + + 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.data.p_bonding_data, + compared_data.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; +} + + +/**@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 master_id_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.data.p_bonding_data->own_ltk.master_id; + if (compared_data.data.p_bonding_data->own_role == BLE_GAP_ROLE_CENTRAL) + { + p_compared_master_id = &compared_data.data.p_bonding_data->peer_ltk.master_id; + } + if (master_id_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_whitelist_peer_ids) + { + // Return the peer_id from the white list + return m_im.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; +} + + +void im_new_peer_id(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; + } +} + + +ret_code_t im_wlist_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_whitelist_peer_ids = 0; + for (uint32_t peer_index = 0; peer_index < n_peer_ids; peer_index++) + { + bool peer_connected = false; + for (uint32_t conn_index = 0; conn_index < IM_MAX_CONN_HANDLES; conn_index++) + { + if (p_peer_ids[peer_index] == m_im.connections[conn_index].peer_id && + ble_conn_state_user_flag_get(m_im.connections[conn_index].conn_handle, m_im.conn_state_user_flag_id) + ) + { + peer_connected = true; + break; + } + } + if (!peer_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.data.p_bonding_data->peer_id.id_addr_info.addr_type + != BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE && + peer_data.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.data.p_bonding_data->peer_id.id_addr_info.addr, + BLE_GAP_ADDR_LEN + ); + m_im.whitelist_addrs[peer_index].addr_type = + peer_data.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.data.p_bonding_data->peer_id.id_info)) + ) + { + memcpy(m_im.whitelist_irks[peer_index].irk, + peer_data.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.whitelist_peer_ids[peer_index] = p_peer_ids[peer_index]; + m_im.n_whitelist_peer_ids++; + } + } + } + return NRF_SUCCESS; +} + + +ret_code_t im_wlist_set(ble_gap_whitelist_t * p_whitelist) +{ + pm_peer_id_t new_whitelist_peer_ids[BLE_GAP_WHITELIST_IRK_MAX_COUNT]; + uint32_t n_new_whitelist_peer_ids = 0; + VERIFY_PARAM_NOT_NULL(p_whitelist); + for (uint32_t i = 0; i < BLE_GAP_WHITELIST_IRK_MAX_COUNT; i++) + { + new_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; + pdb_read_buf_get(compared_peer_id, PM_PEER_DATA_ID_BONDING, &compared_data, NULL); + for (uint32_t i = 0; i < p_whitelist->irk_count; i++) + { + bool valid_irk = is_valid_irk(&compared_data.data.p_bonding_data->peer_id.id_info); + bool duplicate_irk = valid_irk && + (memcmp(p_whitelist->pp_irks[i]->irk, + compared_data.data.p_bonding_data->peer_id.id_info.irk, + BLE_GAP_SEC_KEY_LEN) == 0 + ); + if (duplicate_irk) + { + new_whitelist_peer_ids[i] = compared_peer_id; + n_new_whitelist_peer_ids++; + } + } + compared_peer_id = pdb_next_peer_id_get(compared_peer_id); + } + if (n_new_whitelist_peer_ids != p_whitelist->irk_count) + { + return NRF_ERROR_NOT_FOUND; + } + else + { + for (uint32_t i = 0; i < n_new_whitelist_peer_ids; i++) + { + m_im.whitelist_peer_ids[i] = new_whitelist_peer_ids[i]; + } + m_im.n_whitelist_peer_ids = n_new_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) +{ + 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]; + } + + sd_ecb_block_encrypt(&ecb_hal_data); + + 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/components/ble/peer_manager/id_manager.h b/components/ble/peer_manager/id_manager.h new file mode 100644 index 0000000..fdb7eea --- /dev/null +++ b/components/ble/peer_manager/id_manager.h @@ -0,0 +1,213 @@ +/* Copyright (C) 2015 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * 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 PEER_ID_MANAGER_H__ +#define PEER_ID_MANAGER_H__ + +#include "stdint.h" +#include "sdk_errors.h" +#include "ble.h" +#include "ble_gap.h" +#include "peer_manager_types.h" + + +/** + * @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 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 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. + * + * @note When using a whitelist, always use the whitelist created/set by the most recent + * call to @ref im_wlist_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. + * + * @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_wlist_set(ble_gap_whitelist_t * 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_wlist_set, 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_wlist_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); + +/** @} */ + +#endif /* PEER_ID_MANAGER_H__ */ diff --git a/components/ble/peer_manager/peer_data.c b/components/ble/peer_manager/peer_data.c new file mode 100644 index 0000000..b145898 --- /dev/null +++ b/components/ble/peer_manager/peer_data.c @@ -0,0 +1,145 @@ +/* Copyright (C) 2015 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * 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 "peer_data.h" + +#include +#include +#include "peer_manager_types.h" +#include "fds.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 + { + switch (p_peer_data->data_type) + { + case PM_PEER_DATA_ID_BONDING: + p_chunks[0].p_data = p_peer_data->data.p_bonding_data; + p_chunks[0].length_words = p_peer_data->length_words; + *p_n_chunks = 1; + break; + case PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING: + p_chunks[0].p_data = p_peer_data->data.p_service_changed_pending; + p_chunks[0].length_words = p_peer_data->length_words; + *p_n_chunks = 1; + break; + case PM_PEER_DATA_ID_GATT_LOCAL: + p_chunks[0].p_data = p_peer_data->data.p_local_gatt_db; + p_chunks[0].length_words = PM_N_WORDS(PM_LOCAL_DB_LEN_OVERHEAD_BYTES); + p_chunks[1].p_data = p_peer_data->data.p_local_gatt_db->p_data; + p_chunks[1].length_words = p_peer_data->length_words - p_chunks[0].length_words; + *p_n_chunks = 2; + break; + case PM_PEER_DATA_ID_GATT_REMOTE: + p_chunks[0].p_data = p_peer_data->data.p_remote_gatt_db; + p_chunks[0].length_words = PM_N_WORDS(PM_REMOTE_DB_LEN_OVERHEAD_BYTES); + p_chunks[1].p_data = p_peer_data->data.p_remote_gatt_db->p_data; + p_chunks[1].length_words = p_peer_data->length_words - p_chunks[0].length_words; + *p_n_chunks = 2; + break; + case PM_PEER_DATA_ID_APPLICATION: + p_chunks[0].p_data = p_peer_data->data.p_application_data; + p_chunks[0].length_words = p_peer_data->length_words; + *p_n_chunks = 1; + break; + default: + *p_n_chunks = 0; + break; + } + } +} + + +ret_code_t peer_data_deserialize(pm_peer_data_flash_t const * p_in_data, pm_peer_data_t * p_out_data) +{ + if ((p_in_data == NULL) || (p_out_data == NULL)) + { + return 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; + return NRF_ERROR_NO_MEM; + } + p_out_data->length_words = p_in_data->length_words; + p_out_data->data_type = p_in_data->data_type; + + switch (p_in_data->data_type) + { + case PM_PEER_DATA_ID_BONDING: + *p_out_data->data.p_bonding_data = *p_in_data->data.p_bonding_data; + break; + case PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING: + *p_out_data->data.p_service_changed_pending = *p_in_data->data.p_service_changed_pending; + break; + case PM_PEER_DATA_ID_GATT_LOCAL: + if (p_out_data->data.p_local_gatt_db->p_data == NULL) + { + return NRF_ERROR_NULL; + } + if (p_out_data->data.p_local_gatt_db->len < p_in_data->data.p_local_gatt_db->len) + { + p_out_data->data.p_local_gatt_db->len = p_in_data->data.p_local_gatt_db->len; + return NRF_ERROR_NO_MEM; + } + else + { + p_out_data->data.p_local_gatt_db->flags = p_in_data->data.p_local_gatt_db->flags; + p_out_data->data.p_local_gatt_db->len = p_in_data->data.p_local_gatt_db->len; + memcpy(p_out_data->data.p_local_gatt_db->p_data, + p_in_data->data.p_local_gatt_db->p_data, + p_in_data->data.p_local_gatt_db->len); + } + break; + case PM_PEER_DATA_ID_GATT_REMOTE: + if (p_out_data->data.p_remote_gatt_db->p_data == NULL) + { + return NRF_ERROR_NULL; + } + if (p_out_data->data.p_remote_gatt_db->service_count < p_in_data->data.p_remote_gatt_db->service_count) + { + p_out_data->data.p_remote_gatt_db->service_count = p_in_data->data.p_remote_gatt_db->service_count; + return NRF_ERROR_NO_MEM; + } + else + { + p_out_data->data.p_remote_gatt_db->service_count = p_in_data->data.p_remote_gatt_db->service_count; + memcpy(p_out_data->data.p_remote_gatt_db->p_data, + p_in_data->data.p_remote_gatt_db->p_data, + p_in_data->data.p_remote_gatt_db->service_count * sizeof(ble_gatt_db_srv_t)); + } + break; + case PM_PEER_DATA_ID_APPLICATION: + memcpy(p_out_data->data.p_application_data, + p_in_data->data.p_application_data, + p_in_data->length_words * 4); + break; + default: + break; + } + } + return NRF_SUCCESS; +} + + diff --git a/components/ble/peer_manager/peer_data.h b/components/ble/peer_manager/peer_data.h new file mode 100644 index 0000000..a69b454 --- /dev/null +++ b/components/ble/peer_manager/peer_data.h @@ -0,0 +1,53 @@ +/* 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. +* +*/ + + +#ifndef PEER_DATA_H__ +#define PEER_DATA_H__ + +#include +#include "peer_manager_types.h" +#include "fds.h" + + +/** + * @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); + +/** @} */ + +#endif /* PEER_DATA_H__ */ diff --git a/components/ble/peer_manager/peer_data_storage.c b/components/ble/peer_manager/peer_data_storage.c new file mode 100644 index 0000000..b480fbf --- /dev/null +++ b/components/ble/peer_manager/peer_data_storage.c @@ -0,0 +1,669 @@ +/* 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 "peer_data_storage.h" + +#include +#include +#include "sdk_errors.h" +#include "peer_manager_types.h" +#include "peer_id.h" +#include "peer_data.h" +#include "fds.h" +#include "nrf_log.h" + +#define MAX_REGISTRANTS 6 /**< The number of user that can register with the module. */ + +#define MODULE_INITIALIZED (m_pds.n_registrants > 0) /**< Expression which is true when the module is initialized. */ + +/**@brief Macro for verifying that the module is initialized. It will cause the function to return + * @ref NRF_ERROR_INVALID_STATE if not. + */ +#define VERIFY_MODULE_INITIALIZED() \ +do \ +{ \ + if (!MODULE_INITIALIZED) \ + { \ + return NRF_ERROR_INVALID_STATE; \ + } \ +} while(0) + + +/**@brief Macro for verifying that the module is initialized. It will cause the function to return + * if not. + */ +#define VERIFY_MODULE_INITIALIZED_VOID() \ +do \ +{ \ + if (!MODULE_INITIALIZED) \ + { \ + return; \ + } \ +} while(0) + + +/**@brief Macro for verifying that the param is not NULL. It will cause the function to return + * if not. + * + * @param[in] param The variable to check if is NULL. + */ +#define VERIFY_PARAM_NOT_NULL(param) \ +do \ +{ \ + if (param == NULL) \ + { \ + return NRF_ERROR_NULL; \ + } \ +} while(0) + + +/**@brief Macro for verifying that param is not zero. It will cause the function to return + * if not. + * + * @param[in] param The variable to check if is zero. + */ +#define VERIFY_PARAM_NOT_ZERO(param) \ +do \ +{ \ + if (param == 0) \ + { \ + return NRF_ERROR_NULL; \ + } \ +} while(0) + + +/**@brief Macro for verifying that the peer id is within a valid range + * + * @param[in] id The peer data id to check. + */ +#define VERIFY_PEER_ID_IN_RANGE(id) \ +do \ +{ \ + if ((id >= PM_PEER_ID_N_AVAILABLE_IDS)) \ + { \ + return NRF_ERROR_INVALID_PARAM; \ + } \ +} while (0) + + +/**@brief Macro for verifying that the peer data id is withing a valid range + * + * @param[in] id The peer data id to check. + */ +#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 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; +} pds_t; + +static pds_t m_pds = {.n_registrants = 0}; + +static void internal_state_reset(pds_t * p_pds) +{ + memset(p_pds, 0, sizeof(pds_t)); +} + +/**@brief Function for dispatching outbound events to all registered event handlers. + * + * @param[in] p_event The event to dispatch. + */ +static void pds_evt_send(pds_evt_t * p_event) +{ + for (int i = 0; i < m_pds.n_registrants; i++) + { + m_pds.evt_handlers[i](p_event); + } +} + +/**@brief Function to convert peer id to instance id + * + * @param[in] peer_id Peer id to convert to instance id + * + * @return Value as instance id + */ +static fds_instance_id_t convert_peer_id_to_instance_id(pm_peer_id_t peer_id) +{ + return (fds_instance_id_t)(peer_id + peer_id_to_instance_id); +} + +/**@brief Function to convert peer data id to type id + * + * @param[in] peer_data_id Peer data id to convert to type_id + * + * @return Value as type id + */ +static fds_type_id_t convert_peer_data_id_to_type_id(pm_peer_data_id_t peer_data_id) +{ + return (fds_type_id_t)peer_data_id + (fds_type_id_t)peer_data_id_to_type_id; +} + + +/**@brief Function to convert peer data id to type id + * + * @param[in] peer_data_id Peer data id to convert to type_id + * + * @return Value as type id + */ +static pm_peer_id_t convert_instance_id_to_peer_id(fds_instance_id_t instance_id) +{ + return (pm_peer_id_t)(instance_id + instance_id_to_peer_id); +} + + +/**@brief Function to type id to peer data id + * + * @param[in] type_id Type id to convert to peer data id + * + * @return Value as peer data id + */ +static pm_peer_data_id_t convert_type_id_to_peer_data_id(fds_type_id_t type_id) +{ + return (pm_peer_data_id_t)(type_id + instance_id_to_peer_id); +} + + +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; + + VERIFY_PEER_ID_IN_RANGE(peer_id); + VERIFY_PEER_DATA_ID_IN_RANGE(data_id); + // pp_record verified outside + + fds_type_id_t type_id = convert_peer_data_id_to_type_id(data_id); + fds_instance_id_t instance_id = convert_peer_id_to_instance_id(peer_id); + + return fds_find(type_id, instance_id, p_desc, &find_tok); +} + + +static void peer_ids_init() +{ + fds_record_t record; + fds_record_desc_t record_desc; + fds_find_token_t find_tok; + fds_type_id_t const type_id = convert_peer_data_id_to_type_id(PM_PEER_DATA_ID_BONDING); + pm_peer_id_t peer_id; + + if (!m_pds.peer_ids_initialized) + { + while(fds_find_by_type(type_id, &record_desc, &find_tok) == NRF_SUCCESS) + { + fds_open(&record_desc, &record); + fds_close(&record_desc); + peer_id = convert_instance_id_to_peer_id(record.header.ic.instance); + peer_id_allocate(peer_id); + } + + m_pds.peer_ids_initialized = true; + } +} + +//uint32_t size_pad_to_mult_of_four(uint32_t unpadded_size) +//{ +// return (unpadded_size + 3) & 3; +//} + +static void fds_evt_handler(ret_code_t result, + fds_cmd_id_t cmd, + fds_record_id_t record_id, + fds_record_key_t record_key + /*fds_record_t const * const p_record*/) +{ + pds_evt_t evt; + switch(cmd) + { + case FDS_CMD_INIT: + + break; + + case FDS_CMD_UPDATE: + case FDS_CMD_WRITE: + evt.peer_id = convert_instance_id_to_peer_id(record_key.instance); + evt.evt_id = (result == NRF_SUCCESS) ? PDS_EVT_STORED : PDS_EVT_ERROR_STORE; + evt.data_id = convert_type_id_to_peer_data_id(record_key.type); + evt.store_token = record_id; + pds_evt_send(&evt); + break; + + case FDS_CMD_CLEAR: + evt.peer_id = convert_instance_id_to_peer_id(record_key.instance); + evt.evt_id = (result == NRF_SUCCESS) ? PDS_EVT_CLEARED : PDS_EVT_ERROR_CLEAR; + evt.data_id = convert_type_id_to_peer_data_id(record_key.type); + evt.store_token = record_id; + pds_evt_send(&evt); + break; + + case FDS_CMD_CLEAR_INST: + { + if ((record_key.type == FDS_TYPE_ID_INVALID) && + (record_key.instance != FDS_TYPE_ID_INVALID)) + { + pm_peer_id_t peer_id = convert_instance_id_to_peer_id(record_key.instance); + + evt.peer_id = peer_id; + evt.data_id = PM_PEER_DATA_ID_INVALID; + if (result == NRF_SUCCESS) + { + evt.evt_id = PDS_EVT_PEER_ID_CLEAR; + peer_id_free(peer_id); + } + else + { + evt.evt_id = PDS_EVT_ERROR_PEER_ID_CLEAR; + } + } + else + { + // TODO: Not supported yet (clear many without clearing peer_id) + } + + pds_evt_send(&evt); + } + break; + + case FDS_CMD_GC: + evt.peer_id = convert_instance_id_to_peer_id(record_key.instance); + evt.evt_id = PDS_EVT_COMPRESSED; + evt.data_id = convert_type_id_to_peer_data_id(record_key.type); + evt.store_token = record_id; + pds_evt_send(&evt); + break; + + default: + + break; + } +} + + +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(); + + fds_cb_t cb = fds_evt_handler; + retval = fds_register(cb); + if(retval != NRF_SUCCESS) + { + return retval; + } + + retval = fds_init(); + if(retval != NRF_SUCCESS) + { + return retval; + } + } + + 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_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); + + retval = find_fds_item(peer_id, data_id, &record_desc); + if (retval != NRF_SUCCESS) + { + return retval; + } + + // Shouldn't fail, unless record is cleared. + fds_open(&record_desc, &record); + // No need to keep it open, since we are not reading. + fds_close(&record_desc); + + //NRF_LOG_PRINTF("Found item with peer_id: %d, data_id: %d, Address: %p\r\n", record.p_data); + + if (p_data != NULL) + { + p_data->data_type = data_id; + p_data->length_words = record.header.tl.length_words; + + p_data->data.p_application_data = (uint8_t const*)record.p_data; + } + + if (p_token != NULL) + { + *p_token = (uint32_t)record.header.id; + } + + return retval; +} + + +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 yet in fds + + 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 yet in fds + + 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, + fds_length_t * p_len_words) +{ + 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); + + ret_code_t err_code; + pm_peer_data_flash_t peer_data_flash; + + err_code = pds_peer_data_read_ptr_get(peer_id, data_id, &peer_data_flash, NULL); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + 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->data.p_application_data); + + err_code = peer_data_deserialize(&peer_data_flash, p_data); + + return err_code; +} + + +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_PARAM_NOT_NULL(p_prepare_token); + VERIFY_PEER_DATA_ID_IN_RANGE(p_peer_data->data_type); + + retval = fds_reserve((fds_write_token_t*)p_prepare_token, p_peer_data->length_words); + return retval; +} + + +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_write_token_t*)&prepare_token); + return retval; +} + + +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_desc_t record_desc; + fds_record_key_t record_key; + fds_record_chunk_t chunks[2]; + uint16_t n_chunks; + + VERIFY_MODULE_INITIALIZED(); + //VERIFY_PARAM_NOT_ZERO(prepare_token); + VERIFY_PARAM_NOT_NULL(p_peer_data); + VERIFY_PEER_ID_IN_RANGE(peer_id); + VERIFY_PEER_DATA_ID_IN_RANGE(p_peer_data->data_type); + + // Fill in the keys. + record_key.type = convert_peer_data_id_to_type_id(p_peer_data->data_type); + record_key.instance = convert_peer_id_to_instance_id(peer_id); + + // Create chunks. + peer_data_parts_get(p_peer_data, chunks, &n_chunks); + + retval = fds_write_reserved((fds_write_token_t*)&prepare_token, &record_desc, + record_key, n_chunks, chunks); + + if ((retval == NRF_SUCCESS) && (p_store_token != NULL)) + { + fds_record_id_from_desc(&record_desc, (fds_record_id_t*)p_store_token); + } + + return retval; +} + + +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_desc_t record_desc; + fds_record_key_t record_key; + fds_record_chunk_t chunks[2]; + uint16_t n_chunks; + + VERIFY_MODULE_INITIALIZED(); + VERIFY_PEER_ID_IN_RANGE(peer_id); + VERIFY_PEER_DATA_ID_IN_RANGE(p_peer_data->data_type); + + // Fill in the keys. + record_key.type = convert_peer_data_id_to_type_id(p_peer_data->data_type); + record_key.instance = convert_peer_id_to_instance_id(peer_id); + + // Create chunks + peer_data_parts_get(p_peer_data, chunks, &n_chunks); + + // Request write + retval = fds_write(&record_desc, record_key, n_chunks, chunks); + + if ((retval == NRF_SUCCESS) && (p_store_token != NULL)) + { + fds_record_id_from_desc(&record_desc, (fds_record_id_t*)p_store_token); + } + + return retval; +} + + +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_desc_t record_desc; + fds_record_key_t record_key; + fds_record_chunk_t chunks[2]; + uint16_t n_chunks; + + VERIFY_MODULE_INITIALIZED(); + VERIFY_PEER_DATA_ID_IN_RANGE(p_peer_data->data_type); + VERIFY_PARAM_NOT_NULL(p_peer_data); + + record_key.type = convert_peer_data_id_to_type_id(p_peer_data->data_type); + record_key.instance = convert_peer_id_to_instance_id(peer_id); + + // Create chunks + peer_data_parts_get(p_peer_data, chunks, &n_chunks); + + fds_descriptor_from_rec_id(&record_desc, (fds_record_id_t)old_token); + + retval = fds_update(&record_desc, record_key, n_chunks, chunks); + + if ((retval == NRF_SUCCESS) && (p_store_token != NULL)) + { + fds_record_id_from_desc(&record_desc, (fds_record_id_t*)p_store_token); + } + + return retval; +} + +ret_code_t pds_peer_data_clear(pm_peer_id_t peer_id, pm_peer_data_id_t data_id) +{ + ret_code_t retval; + fds_type_id_t type_id; + fds_instance_id_t instance_id; + fds_record_desc_t record_desc; + fds_find_token_t find_tok; + + VERIFY_MODULE_INITIALIZED(); + VERIFY_PEER_ID_IN_RANGE(peer_id); + VERIFY_PEER_DATA_ID_IN_RANGE(data_id); + + type_id = convert_peer_data_id_to_type_id(data_id); + instance_id = convert_peer_id_to_instance_id(peer_id); + + retval = fds_find(type_id, instance_id, &record_desc, &find_tok); + if(retval != NRF_SUCCESS) + { + return retval; + } + + retval = fds_clear(&record_desc); + return retval; +} + + +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) +{ + ret_code_t retval; + fds_instance_id_t instance_id; + + VERIFY_MODULE_INITIALIZED(); + VERIFY_PEER_ID_IN_RANGE(peer_id); + PEER_IDS_INITIALIZE(); + + instance_id = convert_peer_id_to_instance_id(peer_id); + + retval = fds_clear_by_instance(instance_id); + return retval; +} + + +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_next_id_get(prev_peer_id); +} + + +uint32_t pds_n_peers(void) +{ + if (!MODULE_INITIALIZED) + { + return 0; + } + PEER_IDS_INITIALIZE(); + return peer_id_n_ids(); +} + diff --git a/components/ble/peer_manager/peer_data_storage.h b/components/ble/peer_manager/peer_data_storage.h new file mode 100644 index 0000000..ec0311f --- /dev/null +++ b/components/ble/peer_manager/peer_data_storage.h @@ -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. +* +*/ + + +#ifndef PEER_DATA_STORAGE_H__ +#define PEER_DATA_STORAGE_H__ + + +#include "stdint.h" +#include "sdk_errors.h" +#include "ble_gap.h" +#include "peer_manager_types.h" +#include "fds.h" + + +/** + * @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 +#define PDS_STORE_TOKEN_INVALID 0 + + +typedef enum +{ + peer_id_to_instance_id = 16384, + instance_id_to_peer_id = -peer_id_to_instance_id, + peer_data_id_to_type_id = 32768, + type_id_to_peer_data_id = -peer_data_id_to_type_id, +} pds_convert_t; + + +/**@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_CLEARED, /**< The specified data has been successfully cleared. */ + PDS_EVT_PEER_ID_CLEAR, /**< The peer id has been successfully cleared. */ + PDS_EVT_ERROR_STORE, /**< The specified data could not be stored. */ + PDS_EVT_ERROR_CLEAR, /**< The specified data could not be 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_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; +} 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_INVALID_PARAM Unexpected return code from @ref pm_buffer_init. + * @retval NRF_ERROR_INVALID_STATE FDS has not been initalized. + */ +ret_code_t pds_register(pds_evt_handler_t evt_handler); + + +#if 0 +/**@brief Function for initializing Peer Data storage and registering a + * callback for its events. + * + * @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_INVALID_STATE FDS has not completed initialization. + */ +ret_code_t pds_init(pds_evt_handler_t evt_handler); +#endif + +/**@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_NULL p_data was NULL. + * @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); + +/**@brief Function to lock the flash data (to defer compression from invalidating data) + * + * @param[in] store_token The token representing the item to lock + * + */ +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); + + +/**@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. + * @retval NRF_ERROR_NULL 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, + fds_length_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_INVALID_PARAM Invalid data ID. + * @retval NRF_ERROR_INVALID_LENGTH Data length above the maximum allowed. + * @retval NRF_ERROR_NO_MEM No space available in persistent storage. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + */ +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_NOT_FOUND Invalid peer ID and/or prepare token. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + */ +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 data ID or store_flags. + * @retval NRF_ERROR_INVALID_LENGTH Length of data longer than in prepare call. + * @retval NRF_ERROR_NULL data contained a NULL pointer. + * @retval NRF_ERROR_NO_MEM No space available in persistent storage. This can only happen + * if p_prepare_token is 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. + */ +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 store_flags. + * @retval NRF_ERROR_NULL Data contained a NULL pointer. + * @retval NRF_ERROR_NO_MEM No space available in persistent storage. This can only happen + * if p_prepare_token is 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. + */ +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] 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 pds_peer_data_update(pm_peer_id_t peer_id, + pm_peer_data_const_t const * 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 was invalid. + * @retval NRF_ERROR_NOT_FOUND Nothing to clear for this peer ID. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + */ +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_BUSY Another peer_id clear was already requested or fds queue full + */ +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); + + +/** @} */ + +#endif /* PEER_DATA_STORAGE_H__ */ diff --git a/components/ble/peer_manager/peer_database.c b/components/ble/peer_manager/peer_database.c new file mode 100644 index 0000000..d600d07 --- /dev/null +++ b/components/ble/peer_manager/peer_database.c @@ -0,0 +1,748 @@ +/* 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 "peer_database.h" + +#include +#include "peer_manager_types.h" +#include "peer_data_storage.h" +#include "pm_buffer.h" + + +#define MAX_REGISTRANTS 6 /**< The number of user that can register with the module. */ + +#define MODULE_INITIALIZED (m_pdb.n_registrants > 0) /**< Expression which is true when the module is initialized. */ + +#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 module is initialized. It will cause the function to return + * @ref NRF_ERROR_INVALID_STATE if not. + */ +#define VERIFY_MODULE_INITIALIZED() \ +do \ +{ \ + if (!MODULE_INITIALIZED) \ + { \ + return NRF_ERROR_INVALID_STATE; \ + } \ +} while(0) + + +/**@brief Macro for verifying that the module is initialized. It will cause the function to return + * if not. + */ +#define VERIFY_MODULE_INITIALIZED_VOID()\ +do \ +{ \ + if (!MODULE_INITIALIZED) \ + { \ + return; \ + } \ +} while(0) + + +/**@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. + */ +#define VERIFY_PARAM_NOT_NULL(param) \ +do \ +{ \ + if (param == NULL) \ + { \ + return NRF_ERROR_NULL; \ + } \ +} while(0) + + +typedef struct +{ + pm_peer_id_t peer_id; + pm_peer_data_id_t data_id; + uint8_t buffer_block_id; + uint8_t store_busy : 1; + uint8_t store_flash_full : 1; + uint8_t store_requested : 1; + uint32_t n_bufs; + pm_prepare_token_t prepare_token; + pm_store_token_t store_token; +} pdb_buffer_record_t; + +typedef struct +{ + pdb_evt_handler_t evt_handlers[MAX_REGISTRANTS]; + uint8_t n_registrants; + pm_buffer_t write_buffer; + pdb_buffer_record_t write_buffer_records[N_WRITE_BUFFER_RECORDS]; + uint32_t n_writes; +} pdb_t; + +static pdb_t m_pdb = {.n_registrants = 0}; + + +/**@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 = PDS_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[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) +{ + for (int i = 0; i < N_WRITE_BUFFER_RECORDS; i++) + { + if ((m_pdb.write_buffer_records[i].peer_id == peer_id) + && (m_pdb.write_buffer_records[i].data_id == data_id)) + { + return &m_pdb.write_buffer_records[i]; + } + } + return NULL; +} + + +/**@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 (int 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); +} + + +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 (int 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 (int 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: + 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; + pdb_evt_send(&event); + } + else + { + event.evt_id = PDB_EVT_RAW_STORED; + pdb_evt_send(&event); + } + break; + case PDS_EVT_ERROR_STORE: + 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; + 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; + pdb_evt_send(&event); + break; + case PDS_EVT_COMPRESSED: + retry_flash_full = true; + event.evt_id = PDB_EVT_COMPRESSED; + pdb_evt_send(&event); + break; + default: + break; + } + + if (m_pdb.n_writes > 0) + { + for (int 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; + } + + 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 err_code; + } + PM_BUFFER_INIT(&m_pdb.write_buffer, N_WRITE_BUFFERS, PDB_WRITE_BUF_SIZE, err_code); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + + 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(); + + return pds_peer_id_free(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) +{ + 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_type = data_id; + + switch(p_peer_data->data_type) + { + case PM_PEER_DATA_ID_BONDING: + p_peer_data->data.p_bonding_data = (pm_peer_data_bonding_t *)p_buffer_memory; + p_peer_data->length_words = PM_BONDING_DATA_N_WORDS(); + break; + case PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING: + p_peer_data->data.p_service_changed_pending = (bool *)p_buffer_memory; + p_peer_data->length_words = PM_SC_STATE_N_WORDS(); + break; + case PM_PEER_DATA_ID_GATT_LOCAL: + p_peer_data->data.p_local_gatt_db = (pm_peer_data_local_gatt_db_t *)p_buffer_memory; + p_peer_data->length_words = PM_LOCAL_DB_N_WORDS(n_bytes); + break; + case PM_PEER_DATA_ID_GATT_REMOTE: + p_peer_data->data.p_remote_gatt_db = (pm_peer_data_remote_gatt_db_t *)p_buffer_memory; + p_peer_data->length_words = PM_REMOTE_DB_N_WORDS(n_bytes / sizeof(ble_gatt_db_srv_t)); + break; + case PM_PEER_DATA_ID_APPLICATION: + p_peer_data->data.p_application_data = p_buffer_memory; + p_peer_data->length_words = PM_N_WORDS(n_bytes); + break; + default: + p_peer_data->length_words = 0; + break; + } +} + + +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); +} + + +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); + if ( !PM_PEER_DATA_ID_IS_VALID(data_id) + || (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; + + 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; + } + } + + 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); + switch(data_id) + { + case PM_PEER_DATA_ID_BONDING: + /* No action needed. */ + break; + case PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING: + /* No action needed. */ + break; + case PM_PEER_DATA_ID_GATT_LOCAL: + { + uint32_t size_offset = sizeof(pm_peer_data_local_gatt_db_t); + p_peer_data->data.p_local_gatt_db->p_data = &p_buffer_memory[size_offset]; + p_peer_data->data.p_local_gatt_db->len = (PDB_WRITE_BUF_SIZE*n_bufs)-size_offset; + } + break; + case PM_PEER_DATA_ID_GATT_REMOTE: + { + uint32_t size_offset = sizeof(pm_peer_data_remote_gatt_db_t); + p_peer_data->data.p_remote_gatt_db->p_data = (ble_gatt_db_srv_t*)&(p_buffer_memory[size_offset]); + p_peer_data->data.p_remote_gatt_db->service_count + = ((PDB_WRITE_BUF_SIZE*n_bufs)-size_offset)/sizeof(ble_gatt_db_srv_t); + } + break; + case PM_PEER_DATA_ID_APPLICATION: + { + p_peer_data->data.p_application_data = p_buffer_memory; + } + break; + default: + // Invalid data_id. This should have been picked up earlier. + return NRF_ERROR_INTERNAL; + } + + 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(); + + 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_type = 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); + + 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) + { + pds_peer_data_write_prepare_cancel(prepare_token); + err_code = pds_peer_data_update(peer_id, p_peer_data, old_store_token, p_store_token); + } + 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(); + + 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_type = 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); + + switch (data_id) + { + case PM_PEER_DATA_ID_BONDING: + peer_data.length_words = PM_BONDING_DATA_N_WORDS(); + break; + case PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING: + peer_data.length_words = PM_SC_STATE_N_WORDS(); + break; + case PM_PEER_DATA_ID_GATT_LOCAL: + peer_data.length_words = PM_LOCAL_DB_N_WORDS(peer_data.data.p_local_gatt_db->len); + break; + case PM_PEER_DATA_ID_GATT_REMOTE: + peer_data.length_words = PM_REMOTE_DB_N_WORDS(peer_data.data.p_remote_gatt_db->service_count); + break; + case PM_PEER_DATA_ID_APPLICATION: + peer_data.length_words = PM_N_WORDS(p_write_buffer_record->n_bufs * PDB_WRITE_BUF_SIZE); + break; + default: + return NRF_ERROR_INVALID_PARAM; + } + + 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_type, p_peer_data, p_store_token, PDS_PREPARE_TOKEN_INVALID); +} + diff --git a/components/ble/peer_manager/peer_database.h b/components/ble/peer_manager/peer_database.h new file mode 100644 index 0000000..4ceb9a5 --- /dev/null +++ b/components/ble/peer_manager/peer_database.h @@ -0,0 +1,334 @@ +/* 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. +* +*/ + + +#ifndef PEER_DATABASE_H__ +#define PEER_DATABASE_H__ + +#include +#include "peer_manager_types.h" +#include "sdk_errors.h" + +/** + * @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 pdb_write_buf_store operation has completed successfully. */ + PDB_EVT_RAW_STORED, /**< A pdb_raw_store operation has completed successfully. */ + PDB_EVT_RAW_STORE_FAILED, /**< A pdb_raw_store operation has failed. */ + PDB_EVT_CLEARED, /**< A pdb_clear operation has completed successfully. */ + PDB_EVT_CLEAR_FAILED, /**< A pdb_clear 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 + { + pm_store_token_t store_token; /**< A token identifying the store operation this event pertains to. */ + } raw_stored_evt; + struct + { + pm_store_token_t store_token; /**< A token identifying the store operation this event pertains to. */ + } error_raw_store_evt; + } 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_INVALID_PARAM Unexpected return code from @ref pm_buffer_init. + * @retval NRF_ERROR_INVALID_STATE FDS has not been initalized. + */ +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_BUSY Another peer_id clear was already requested or could not be started. + * @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 Data clear was successfully started. + * @retval NRF_ERROR_INVALID_PARAM Data ID was invalid. + * @retval NRF_ERROR_NOT_FOUND Nothing to clear for this data for this peer ID. + * @retval NRF_ERROR_BUSY Could not process request at this time. Reattempt later. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + */ +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. + */ +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); + + +/** @} */ + +#endif /* PEER_DATABASE_H__ */ + + diff --git a/components/ble/peer_manager/peer_id.c b/components/ble/peer_manager/peer_id.c new file mode 100644 index 0000000..34e0a4d --- /dev/null +++ b/components/ble/peer_manager/peer_id.c @@ -0,0 +1,111 @@ +/* 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 "peer_id.h" + +#include +#include +#include "sdk_errors.h" +#include "peer_manager_types.h" +#include "pm_mutex.h" + + +typedef struct +{ + uint8_t peer_ids[MUTEX_STORAGE_SIZE(PM_PEER_ID_N_AVAILABLE_IDS)]; /*< bitmap. */ +} pi_t; + + +static pi_t m_pi = {.peer_ids = {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.peer_ids, PM_PEER_ID_N_AVAILABLE_IDS); +} + + +pm_peer_id_t peer_id_allocate(pm_peer_id_t peer_id) +{ + 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(m_pi.peer_ids, 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(m_pi.peer_ids, peer_id); + allocated_peer_id = lock_success ? peer_id : PM_PEER_ID_INVALID; + } + return allocated_peer_id; +} + + +void peer_id_free(pm_peer_id_t peer_id) +{ + if (peer_id < PM_PEER_ID_N_AVAILABLE_IDS) + { + pm_mutex_unlock(m_pi.peer_ids, peer_id); + } +} + + +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.peer_ids, peer_id); + } + return false; +} + + +pm_peer_id_t peer_id_next_id_get(pm_peer_id_t prev_peer_id) +{ + 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(m_pi.peer_ids, i)) + { + return i; + } + } + + return PM_PEER_ID_INVALID; +} + + +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.peer_ids, i); + } + + return n_ids; +} + + diff --git a/components/ble/peer_manager/peer_id.h b/components/ble/peer_manager/peer_id.h new file mode 100644 index 0000000..b2c40d7 --- /dev/null +++ b/components/ble/peer_manager/peer_id.h @@ -0,0 +1,92 @@ +/* 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. +* +*/ + + +#ifndef PEER_ID_H__ +#define PEER_ID_H__ + + +#include "stdint.h" +#include "sdk_errors.h" +#include "ble_gap.h" +#include "peer_manager_types.h" + + +/** + * @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 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 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_next_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 peer_id_n_ids(void); + +/** @} */ + +#endif /* PEER_ID_H__ */ diff --git a/components/ble/peer_manager/peer_manager.c b/components/ble/peer_manager/peer_manager.c new file mode 100644 index 0000000..d48f511 --- /dev/null +++ b/components/ble/peer_manager/peer_manager.c @@ -0,0 +1,618 @@ +/* Copyright (C) 2015 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * 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 "peer_manager.h" +#include +#include "security_manager.h" +#include "gatt_cache_manager.h" +#include "peer_database.h" +#include "id_manager.h" +#include "ble_conn_state.h" + + + +#define MAX_REGISTRANTS 3 /**< The number of user that can register with the module. */ + + +/**@brief Macro for verifying that the module is initialized. It will cause the function to return + * @ref NRF_ERROR_INVALID_STATE if not. + */ +#define VERIFY_MODULE_INITIALIZED() \ +do \ +{ \ + if (!m_pm.initialized) \ + { \ + return NRF_ERROR_INVALID_STATE; \ + } \ +} while(0) + + +/**@brief Macro for verifying that the module is initialized. It will cause the function to return + * if not. + */ +#define VERIFY_MODULE_INITIALIZED_VOID()\ +do \ +{ \ + if (!m_pm.initialized) \ + { \ + return; \ + } \ +} while(0) + + +/**@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. + */ +#define VERIFY_PARAM_NOT_NULL(param) \ +do \ +{ \ + if (param == NULL) \ + { \ + return NRF_ERROR_NULL; \ + } \ +} while(0) + + +typedef struct +{ + bool initialized; + pm_evt_handler_t evt_handlers[MAX_REGISTRANTS]; + uint8_t n_registrants; + ble_conn_state_user_flag_id_t pairing_flag_id; + ble_conn_state_user_flag_id_t bonding_flag_id; +} pm_t; + +static pm_t m_pm; + + +static void evt_send(pm_evt_t * p_event) +{ + for (int i = 0; i < m_pm.n_registrants; i++) + { + m_pm.evt_handlers[i](p_event); + } +} + + +void pdb_evt_handler(pdb_evt_t const * p_evt) +{ + bool send_evt = true; + pm_evt_t pm_evt; + + memset(&pm_evt, 0, sizeof(pm_evt_t)); + pm_evt.peer_id = p_evt->peer_id; + pm_evt.conn_handle = im_conn_handle_get(pm_evt.peer_id); + + switch (p_evt->evt_id) + { + case PDB_EVT_WRITE_BUF_STORED: + pm_evt.evt_id = PM_EVT_PEER_DATA_UPDATED; + pm_evt.params.peer_data_updated_evt.data_id = p_evt->data_id; + pm_evt.params.peer_data_updated_evt.action = PM_PEER_DATA_ACTION_UPDATE; + break; + + case PDB_EVT_RAW_STORED: + pm_evt.evt_id = PM_EVT_PEER_DATA_UPDATED; + pm_evt.params.peer_data_updated_evt.data_id = p_evt->data_id; + pm_evt.params.peer_data_updated_evt.action = PM_PEER_DATA_ACTION_UPDATE; + break; + + case PDB_EVT_RAW_STORE_FAILED: + pm_evt.evt_id = PM_EVT_PEER_DATA_UPDATE_FAILED; + pm_evt.params.peer_data_update_failed_evt.data_id = p_evt->data_id; + pm_evt.params.peer_data_update_failed_evt.action = PM_PEER_DATA_ACTION_UPDATE; + pm_evt.params.peer_data_update_failed_evt.error = NRF_ERROR_INTERNAL; + break; + + case PDB_EVT_CLEARED: + pm_evt.evt_id = PM_EVT_PEER_DATA_UPDATED; + pm_evt.params.peer_data_updated_evt.data_id = p_evt->data_id; + pm_evt.params.peer_data_updated_evt.action = PM_PEER_DATA_ACTION_CLEAR; + break; + + case PDB_EVT_CLEAR_FAILED: + pm_evt.evt_id = PM_EVT_PEER_DATA_UPDATE_FAILED; + pm_evt.params.peer_data_update_failed_evt.data_id = p_evt->data_id; + pm_evt.params.peer_data_update_failed_evt.action = PM_PEER_DATA_ACTION_CLEAR; + pm_evt.params.peer_data_update_failed_evt.error = NRF_ERROR_INTERNAL; + 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: + /* No implementation necessary. */ + break; + } + if (send_evt) + { + evt_send(&pm_evt); + } +} + + +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: + { + 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; + find_peer_id = false; + send_evt = false; + 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_LINK_SECURED; + pm_evt.params.link_secured_evt.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_LINK_SECURE_FAILED; + pm_evt.params.link_secure_failed_evt.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.link_secure_failed_evt.error.error_type = PM_ERROR_TYPE_SEC_STATUS; + pm_evt.params.link_secure_failed_evt.error.error_src + = p_sm_evt->params.pairing_failed.error_src; + pm_evt.params.link_secure_failed_evt.error.error.sec_status + = p_sm_evt->params.pairing_failed.auth_status; + 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_LINK_SECURED; + pm_evt.params.link_secured_evt.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_LINK_SECURE_FAILED; + pm_evt.params.link_secure_failed_evt.procedure + = PM_LINK_SECURED_PROCEDURE_ENCRYPTION; + pm_evt.params.link_secure_failed_evt.error.error_type + = PM_ERROR_TYPE_PM_SEC_ERROR; + pm_evt.params.link_secure_failed_evt.error.error_src + = p_sm_evt->params.link_encryption_failed.error_src; + pm_evt.params.link_secure_failed_evt.error.error.sec_status + = p_sm_evt->params.link_encryption_failed.error; + break; + + case SM_EVT_BONDING_INFO_STORED: + pm_evt.evt_id = PM_EVT_PEER_DATA_UPDATED; + pm_evt.peer_id = p_sm_evt->params.bonding_info_stored.peer_id; + pm_evt.params.peer_data_updated_evt.data_id = PM_PEER_DATA_ID_BONDING; + pm_evt.params.peer_data_updated_evt.action = PM_PEER_DATA_ACTION_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_evt.data_id = PM_PEER_DATA_ID_BONDING; + pm_evt.params.peer_data_update_failed_evt.action = PM_PEER_DATA_ACTION_UPDATE; + pm_evt.params.peer_data_update_failed_evt.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_evt.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_LINK_SECURE_FAILED; + pm_evt.params.link_secure_failed_evt.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.link_secure_failed_evt.error.error_type = PM_ERROR_TYPE_PM_SEC_ERROR; + pm_evt.params.link_secure_failed_evt.error.error_src = BLE_GAP_SEC_STATUS_SOURCE_LOCAL; + pm_evt.params.link_secure_failed_evt.error.error.pm_sec_error + = PM_SEC_ERROR_SMP_TIMEOUT; + 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); + } +} + + +void gcm_evt_handler(gcm_evt_t const * p_evt) +{ + + bool send_evt = true; + pm_evt_t pm_evt; + + memset(&pm_evt, 0, sizeof(pm_evt_t)); + pm_evt.peer_id = p_evt->peer_id; + pm_evt.conn_handle = im_conn_handle_get(pm_evt.peer_id); + + switch (p_evt->evt_id) + { + case GCM_EVT_LOCAL_DB_CACHE_STORED: + pm_evt.evt_id = PM_EVT_PEER_DATA_UPDATED; + pm_evt.params.peer_data_updated_evt.action = PM_PEER_DATA_ACTION_UPDATE; + pm_evt.params.peer_data_updated_evt.data_id = PM_PEER_DATA_ID_GATT_LOCAL; + break; + + case GCM_EVT_LOCAL_DB_CACHE_UPDATED: + pm_evt.evt_id = PM_EVT_PEER_DATA_UPDATED; + pm_evt.params.peer_data_updated_evt.action = PM_PEER_DATA_ACTION_UPDATE; + pm_evt.params.peer_data_updated_evt.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; + pm_evt.params.peer_data_updated_evt.action = PM_PEER_DATA_ACTION_UPDATE; + pm_evt.params.peer_data_updated_evt.data_id = PM_PEER_DATA_ID_GATT_LOCAL; + break; + + case GCM_EVT_ERROR_LOCAL_DB_CACHE_APPLY: + pm_evt.evt_id = PM_EVT_ERROR_LOCAL_DB_CACHE_APPLY; + pm_evt.params.peer_data_updated_evt.action = PM_PEER_DATA_ACTION_UPDATE; + pm_evt.params.peer_data_updated_evt.data_id = PM_PEER_DATA_ID_GATT_LOCAL; + break; + + case GCM_EVT_REMOTE_DB_CACHE_UPDATED: + pm_evt.evt_id = PM_EVT_PEER_DATA_UPDATED; + pm_evt.params.peer_data_updated_evt.action = PM_PEER_DATA_ACTION_UPDATE; + pm_evt.params.peer_data_updated_evt.data_id = PM_PEER_DATA_ID_GATT_REMOTE; + break; + + case GCM_EVT_SERVICE_CHANGED_INDICATION_SENT: + pm_evt.evt_id = PM_EVT_SERVICE_CHANGED_INDICATION_SENT; + 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_evt.error = p_evt->params.error_unexpected.error; + pm_evt.conn_handle = p_evt->params.error_unexpected.conn_handle; + break; + } + + if (send_evt) + { + evt_send(&pm_evt); + } +} + + +void im_evt_handler(im_evt_t const * p_evt) +{ + pm_evt_t pm_evt; + + switch (p_evt->evt_id) + { + case IM_EVT_DUPLICATE_ID: + // Delete the duplicate data to free space and avoid finding old data when scanning in the future + pm_peer_delete(p_evt->params.duplicate_id.peer_id_2); + break; + + case IM_EVT_BONDED_PEER_CONNECTED: + ble_conn_state_user_flag_set(p_evt->conn_handle, m_pm.bonding_flag_id, true); + memset(&pm_evt, 0, sizeof(pm_evt_t)); + pm_evt.conn_handle = p_evt->conn_handle; + pm_evt.peer_id = im_peer_id_get_by_conn_handle(p_evt->conn_handle); + pm_evt.evt_id = PM_EVT_BONDED_PEER_CONNECTED; + evt_send(&pm_evt); + break; + } +} + + +void pm_ble_evt_handler(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); +} + + +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; + } + + 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.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_link_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; +} + + +ret_code_t pm_sec_params_reply(uint16_t conn_handle, ble_gap_sec_params_t * p_sec_params) +{ + return NRF_SUCCESS; +} + + +void pm_local_database_has_changed(void) +{ + gcm_local_database_has_changed(); +} + + +ret_code_t pm_wlist_create(pm_peer_id_t * p_peer_ids, + uint8_t n_peer_ids, + ble_gap_whitelist_t * p_whitelist) +{ + return im_wlist_create(p_peer_ids, n_peer_ids, p_whitelist); +} + + +ret_code_t pm_wlist_set(ble_gap_whitelist_t * p_whitelist) +{ + return im_wlist_set(p_whitelist); +} + + +ret_code_t pm_link_status_get(uint16_t conn_handle, pm_link_status_t * p_link_status) +{ + VERIFY_PARAM_NOT_NULL(p_link_status); + if (conn_handle == BLE_CONN_HANDLE_INVALID) + { + return NRF_ERROR_INVALID_PARAM; + } + // Read the bonded status from the user flag that is maintained by events. + p_link_status->bonded = ble_conn_state_user_flag_get(conn_handle, m_pm.bonding_flag_id); + // Read the connected, encrypted and mitm status from the connection state module. + p_link_status->connected = ble_conn_state_valid(conn_handle); + p_link_status->encrypted = ble_conn_state_encrypted(conn_handle); + p_link_status->mitm_protected = ble_conn_state_mitm_protected(conn_handle); + return NRF_SUCCESS; +} + + +ret_code_t pm_peer_id_get(uint16_t conn_handle, pm_peer_id_t * p_peer_id) +{ + VERIFY_PARAM_NOT_NULL(p_peer_id); + * p_peer_id = im_peer_id_get_by_conn_handle(conn_handle); + return NRF_SUCCESS; +} + + +ret_code_t pm_conn_handle_get(pm_peer_id_t peer_id, uint16_t * p_conn_handle) +{ + VERIFY_PARAM_NOT_NULL(p_conn_handle); + * p_conn_handle = im_conn_handle_get(peer_id); + return NRF_SUCCESS; +} + + +uint32_t pm_n_peers(void) +{ + return pdb_n_peers(); +} + + +pm_peer_id_t pm_next_peer_id_get(pm_peer_id_t prev_peer_id) +{ + return pdb_next_peer_id_get(prev_peer_id); +} + + +ret_code_t pm_peer_data_get(pm_peer_id_t peer_id, pm_peer_data_id_t data_id, pm_peer_data_t * p_peer_data) +{ + return pdb_raw_read(peer_id, data_id, p_peer_data); +} + + +ret_code_t pm_peer_data_store(pm_peer_id_t peer_id, + pm_peer_data_const_t * p_peer_data, + pm_store_token_t * p_token) +{ + return pdb_raw_store(peer_id, p_peer_data, p_token); +} + + +ret_code_t pm_peer_data_clear(pm_peer_id_t peer_id, pm_peer_data_id_t data_id) +{ + ret_code_t err_code; + VERIFY_MODULE_INITIALIZED(); + if (data_id == PM_PEER_DATA_ID_BONDING || data_id == PM_PEER_DATA_ID_INVALID) + { + return NRF_ERROR_INVALID_PARAM; + } + err_code = pdb_clear(peer_id, data_id); + return err_code; +} + + +ret_code_t pm_peer_new(pm_peer_data_bonding_t * p_bonding_data, + pm_peer_id_t * p_new_peer_id, + pm_store_token_t * p_token) +{ + VERIFY_MODULE_INITIALIZED(); + VERIFY_PARAM_NOT_NULL(p_bonding_data); + VERIFY_PARAM_NOT_NULL(p_new_peer_id); + * 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 = PM_BONDING_DATA_N_WORDS(); + peer_data.data_type = PM_PEER_DATA_ID_BONDING; + peer_data.data.p_bonding_data = p_bonding_data; + + return pm_peer_data_store(*p_new_peer_id, &peer_data, p_token); +} + + +void pm_peer_delete(pm_peer_id_t peer_id) +{ + pdb_peer_free(peer_id); +} + + +void pm_peer_delete_all(void) +{ + pm_peer_id_t current_peer_id = PM_PEER_ID_INVALID; + while (pdb_next_peer_id_get(PM_PEER_ID_INVALID) != PM_PEER_ID_INVALID) + { + current_peer_id = pdb_next_peer_id_get(current_peer_id); + pm_peer_delete(current_peer_id); + } +} diff --git a/components/ble/peer_manager/peer_manager.h b/components/ble/peer_manager/peer_manager.h new file mode 100644 index 0000000..26506fe --- /dev/null +++ b/components/ble/peer_manager/peer_manager.h @@ -0,0 +1,475 @@ +/* Copyright (C) 2015 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * 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 peer_manager.h + * + * @defgroup peer_manager Peer Manager + * @ingroup ble_sdk_lib + * @{ + * @brief A module for managing BLE bonding. This involves 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/encryption behavior of the + * device, and functions for manipulation of the stored data. + */ + + +#ifndef PEER_MANAGER_H__ +#define PEER_MANAGER_H__ + +#include +#include +#include "sdk_common.h" +#include "ble.h" +#include "ble_gap.h" +#include "peer_manager_types.h" +#include "peer_database.h" + + + +/**@brief Structure used to report the security status of a connection. + */ +typedef struct +{ + uint8_t connected : 1; /**< This connection is active. */ + uint8_t encrypted : 1; /**< Communication on this link is/was encrypted. */ + uint8_t mitm_protected : 1; /**< The encrypted communication is/was also protected against man-in-the-middle attacks. */ + uint8_t bonded : 1; /**< The peer is bonded with us. */ +} pm_link_status_t; + + +/**@brief Enum of the events that can come from the @ref peer_manager module. + */ +typedef enum +{ + PM_EVT_BONDED_PEER_CONNECTED, /**< A connected peer has been identified as one with which we have a bond. */ + PM_EVT_LINK_SECURED, /**< A link has been encrypted, either as a result of a call to @ref pm_link_secure, or of action by the peer. The event structure contains more information about the circumstances. */ + PM_EVT_LINK_SECURE_FAILED, /**< A pairing or encryption procedure has failed. In most cases, this will mean that security is not possible on this link. */ + // PM_EVT_SEC_PARAMS_REQ, /**< Not yet implemented. The specified link is being secured. Please respond, using pm_sec_params_reply(), with the desired security parameters for this link. */ + PM_EVT_STORAGE_FULL, /**< There is no more room for peer data in flash storage. This must be mitigated by performing a compress procedure in FDS, possibly preceded by deleting some information. */ + PM_EVT_ERROR_UNEXPECTED, /**< An operation failed with an unexpected error. The error is provided. This is possibly a fatal error. */ + PM_EVT_PEER_DATA_UPDATED, /**< A piece of peer data was stored, updated, or cleared in flash storage. */ + PM_EVT_PEER_DATA_UPDATE_FAILED, /**< A piece of peer data was attempted stored, updated, or cleared in flash storage, but failed. */ + // PM_EVT_ALL_PEER_DATA_DELETED, /**< Not yet implemented. A call to @ref pm_peer_delete_all has completed successfully. It is now safe to create BLE links. */ + PM_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. */ + PM_EVT_LOCAL_DB_CACHE_APPLIED, /**< The SoftDevice has been given local database values from the persistent cache, for one peer. */ + PM_EVT_SERVICE_CHANGED_INDICATION_SENT, /**< A service changed indication has been sent to and confirmed by a peer. */ +} pm_evt_id_t; + + +/**@brief Structure containing parameters specific to the @ref PM_EVT_LINK_SECURED event. + */ +typedef struct +{ + pm_sec_procedure_t procedure; /**< The procedure that led to securing the link. */ +} pm_link_secured_evt_t; + + +/**@brief The different types of errors that can cause security establishment to fail. + */ +typedef enum +{ + PM_ERROR_TYPE_SEC_STATUS, /**< Error is in the range defined in @ref BLE_GAP_SEC_STATUS. */ + PM_ERROR_TYPE_PM_SEC_ERROR, /**< Error is of type @ref pm_sec_error_code_t. */ +} pm_error_type_t; + + +/**@brief Type describing all errors that can occur asynchronously when securing a link. + */ +typedef struct +{ + pm_error_type_t error_type; /**< Which type of error. Specifies which entry in the below union to read. */ + uint8_t error_src; /**< The party that raised the error, see @ref BLE_GAP_SEC_STATUS_SOURCES. */ + union + { + uint8_t sec_status; /**< The error when the error_type is @ref PM_ERROR_TYPE_SEC_STATUS. See @ref BLE_GAP_SEC_STATUS. See also Table 3.7 ("Pairing Failed Reason Codes") in the Bluetooth Core Specification 4.2, Vol 3, Part H, Ch 3.5.5. */ + pm_sec_error_code_t pm_sec_error; /**< The error when the error_type is @ref PM_ERROR_TYPE_PM_SEC_ERROR. */ + } error; +} pm_sec_error_t; + + +/**@brief Structure containing parameters specific to the @ref PM_EVT_LINK_SECURE_FAILED event. + */ +typedef struct +{ + pm_sec_procedure_t procedure; /**< The procedure that failed. */ + pm_sec_error_t error; /**< How the procedure failed. */ +} pm_link_secure_failed_evt_t; + + +/**@brief Actions that can be performed to peer data in persistent storage. + */ +typedef enum +{ + PM_PEER_DATA_ACTION_UPDATE, /**< Overwriting the data. */ + PM_PEER_DATA_ACTION_CLEAR, /**< Removing the data. */ +} pm_peer_data_action_t; + + +/**@brief Structure containing parameters specific to the @ref PM_EVT_PEER_DATA_UPDATED event. + */ +typedef struct +{ + pm_peer_data_id_t data_id; /**< The type of data that was updated */ + pm_peer_data_action_t action; /**< What happened to the data. */ +} pm_peer_data_update_t; + + +/**@brief Structure containing parameters specific to the @ref PM_EVT_PEER_DATA_UPDATE_FAILED event. + */ +typedef struct +{ + pm_peer_data_id_t data_id; /**< The type of data that was updated */ + pm_peer_data_action_t action; /**< The action that failed. */ + ret_code_t error; /**< The error that occurred. */ +} pm_peer_data_update_failed_t; + + +/**@brief Structure containing parameters specific to the @ref PM_EVT_ERROR_UNEXPECTED event. + */ +typedef struct +{ + ret_code_t error; /**< The unexpected error that occurred. */ +} pm_error_unexpected_evt_t; + + +/**@brief Structure describing events from the @ref peer_manager module. + */ +typedef struct +{ + pm_evt_id_t evt_id; /**< The type of the event. */ + uint16_t conn_handle; /**< The connection this event pertains to, or @ref BLE_CONN_HANDLE_INVALID. */ + pm_peer_id_t peer_id; /**< The connection this event pertains to, or @ref PM_PEER_ID_INVALID. */ + union + { + pm_link_secured_evt_t link_secured_evt; /**< Parameters specific to the @ref PM_EVT_LINK_SECURED event. */ + pm_link_secure_failed_evt_t link_secure_failed_evt; /**< Parameters specific to the @ref PM_EVT_LINK_SECURE_FAILED event. */ + pm_peer_data_update_t peer_data_updated_evt; /**< Parameters specific to the @ref PM_EVT_PEER_DATA_UPDATED event. */ + pm_peer_data_update_failed_t peer_data_update_failed_evt; /**< Parameters specific to the @ref PM_EVT_PEER_DATA_UPDATE_FAILED event. */ + pm_error_unexpected_evt_t error_unexpected_evt; /**< Parameters specific to the @ref PM_EVT_ERROR_UNEXPECTED event. */ + } params; +} pm_evt_t; + + +/**@brief Event handler for events from the @ref peer_manager module. + * + * @param[in] p_event The event that has happened. + */ +typedef void (*pm_evt_handler_t)(pm_evt_t const * p_event); + + +/**@brief Function for initializing the @ref peer_manager. + * + * @note FDS must be initialized before calling this function. + * + * @retval NRF_SUCCESS Initialization was successful. + * @retval NRF_ERROR_INVALID_STATE FDS not initialized. + * @retval NRF_ERROR_NULL p_init_params was NULL. + * @retval NRF_ERROR_INTERNAL An unexpected internal error occurred. + */ +ret_code_t pm_init(void); + + +/**@brief Function for registering with the Peer Manager. + * + * @param[in] event_handler Callback for events from the @ref peer_manager module. + * + * @retval NRF_SUCCESS Initialization was successful. + * @retval NRF_ERROR_INVALID_STATE @ref peer_manager not initialized. + * @retval NRF_ERROR_NULL p_init_params was NULL. + */ +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 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 Security parameters to be used for all security procedures. + * + * @retval NRF_SUCCESS Success. + * @retval NRF_ERROR_INVALID_PARAM Invalid combination of parameters. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + * @retval NRF_ERROR_INTERNAL An unexpected internal 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. + * + * @note 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 pm_ble_evt_handler(ble_evt_t * p_ble_evt); + + +/**@brief Function for encrypting a link, and optionally establishing a bond. + * + * @details The actions taken by this function is partly dictated by the parameters given in the + * @ref pm_sec_params_set. + * + * @note If the connection is a slave connection, this will send a security request to the master, + * but the master is not obligated to initiate pairing or encryption in response. + * + * @param[in] conn_handle Connection handle of the link as provided by the SoftDevice. + * @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, or the peer is disconnected or + * in the process of disconnecting. + * @retval NRF_ERROR_INTERNAL An unexpected error occurred. + */ +ret_code_t pm_link_secure(uint16_t conn_handle, bool force_repairing); + + +/**@brief Function for replying with desired security parameters for a specific link. + * + * @warning This function is not yet implemented + * + * @details This function must be called if and only if a PM_EVT_SEC_PARAMS_REQ event was received. + * The PM_EVT_SEC_PARAMS_REQ is received only if the always_ask_for_sec_params option was + * set during initialization. + * + * @param[in] conn_handle The link to set the security parameters for. + * @param[in] p_sec_params The security parameters to set for the link. + * + * @retval NRF_SUCCESS Successfully set security parameters. + * @retval BLE_ERROR_INVALID_CONN_HANDLE Connection handle does not refer to an active connection. + * @retval NRF_ERROR_FORBIDDEN Security parameters have not been requested on this link. + * @retval NRF_ERROR_INVALID_PARAM Invalid value or combination in security parameters. + */ +ret_code_t pm_sec_params_reply(uint16_t conn_handle, ble_gap_sec_params_t * p_sec_params); + + +/**@brief Function for manually informing that the local database has changed. + * + * @details This causes a service changed indication to be sent to all bonded peers that subscribe + * to it. + */ +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_link_status Security status of the link. + * + * @retval NRF_SUCCESS Pairing initiated successfully. + * @retval NRF_ERROR_INVALID_PARAM conn_handle is invalid or does not refer to an active connection. + * @retval NRF_ERROR_NULL p_link_status was NULL. + */ +ret_code_t pm_link_status_get(uint16_t conn_handle, pm_link_status_t * p_link_status); + + +/** + * @brief Function for constructing a whitelist for use when advertising. + * + * @details Construct a whitelist containing the addresses and IRKs of the provided peer IDs. If + * p_peer_ids is NULL, the first (lowest) peer IDs will be chosen. If pp_addrs in + * p_whitelist is NULL, the whitelist will contain only IRKs, and vice versa. + * + * @note When advertising with whitelist, always use the whitelist created/set by the most recent + * call to this function or to @ref im_wlist_set, 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 pm_wlist_create(pm_peer_id_t * p_peer_ids, uint8_t n_peer_ids, ble_gap_whitelist_t * p_whitelist); + + +/** + * @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. + * + * @note When using a whitelist, always use the whitelist created/set by the most recent + * call to @ref im_wlist_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. + * + * @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 pm_wlist_set(ble_gap_whitelist_t * p_whitelist); + + +/** + * @brief Function for getting the corresponding connection handle based on the Peer ID. + * + * @param[out] peer_id Peer ID. + * @param[in] p_conn_handle Corresponding connection handle. BLE_INVALID_CONN_HANDLE if peer is + * not connected. + * + * @retval NRF_SUCCESS Connection handle retrieved successfully. + * @retval NRF_ERROR_NULL p_conn_handle was NULL. + */ +ret_code_t pm_conn_handle_get(pm_peer_id_t peer_id, uint16_t * p_conn_handle); + + +/**@brief Function for getting the corresponding peer ID based on the connection handle. + * + * @param[in] conn_handle Connection handle as provided by the SoftDevice. + * @param[out] p_peer_id Corresponding peer ID. + * + * @retval NRF_SUCCESS Peer ID retrieved successfully. + * @retval NRF_ERROR_NULL p_peer_id was NULL. + * @retval NRF_ERROR_NOT_FOUND No peer ID was found for the connection handle. This means that + * there is no bond with the connected peer, or the conn_handle + * does not refer to an active connection. + */ +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. 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 used + * peer ID. + * + * @note The order the peer IDs are returned can be considered random. + * + * @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 used peer ID. + */ +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 available (i.e the number of peers + * there exists data for in persistent storage). + * + * @return The number of valid peer IDs. + */ +uint32_t pm_n_peers(void); + + +/**@brief Function for retrieving (copying out) stored data for a peer. + * + * @param[in] peer_id Peer ID to get info 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 pm_peer_data_get(pm_peer_id_t peer_id, pm_peer_data_id_t data_id, pm_peer_data_t * p_peer_data); + + +/**@brief Function for setting/updating the stored data for a peer. + * + * @note Writing the data to persistent storage happens asynchronously. + * + * @param[in] peer_id Peer ID to get info for. + * @param[in] p_peer_data Data to set. For values that are NULL, the stored data will not be + * touched. + * @param[out] p_token A token identifying this particular store operation. The token can be + * used to identify events pertaining to this operation. + * + * @retval NRF_SUCCESS Data will be written to persistent storage ASAP. + * @retval NRF_ERROR_NULL p_peer_data is NULL. + * @retval NRF_ERROR_NOT_FOUND No peer found for that peer ID. + * @retval NRF_ERROR_BUSY Bonding procedure is in progress, so data integrity cannot be + * guaranteed. + */ +ret_code_t pm_peer_data_store(pm_peer_id_t peer_id, pm_peer_data_const_t * p_peer_data, pm_store_token_t * p_token); + + +/**@brief Function for deleting a peer's stored data. + * + * @note Clearing of data in persistent storage happens asynchronously. + * + * @note Bonding data can not be cleared with on their own. Use pm_peer_delete() to delete all + * data for a spesified peer including bonding data. + * + * @param[in] peer_id Peer ID to clear info for. + * @param[in] data_id Which data to clear. Bonding data cannot be cleared, use @ref pm_peer_delete + * + * @retval NRF_SUCCESS Data will be cleared in persistent storage ASAP. + * @retval NRF_ERROR_INVALID_PARAM Attempted to delete bonding data or data id was invalid. + * @retval NRF_ERROR_NOT_FOUND Nothing to clear for this data for this peer ID. + * @retval NRF_ERROR_BUSY Could not process request at this time. Reattempt later. + * @retval NRF_ERROR_INVALID_STATE Module is not initialized. + */ +ret_code_t pm_peer_data_clear(pm_peer_id_t peer_id, pm_peer_data_id_t data_id); + + +/**@brief Function for registering persistent storage for a new peer. + * + * @param[in] p_bonding_data The bonding data of the new peer. This must be provided to avoid + * inconsistencies (duplicate entries). Must contain a public/static + * address or a non-zero master ID. + * @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 identifying this particular store operation (storing the + * bonding data). The token can be used to identify events pertaining to + * this operation. + * + * @retval NRF_SUCCESS Store operation for bonding data started successfully. + * @retval NRF_ERROR_NULL A parameter is NULL. + * @retval NRF_ERROR_NO_MEM No more space in persistent storage. New peer cannot be allocated. + * @retval NRF_ERROR_BUSY Operation cannot be performed at this time. Try again later. + * @retval NRF_ERROR_INVALID_PARAM Bonding data is invalid. + * @retval NRF_ERROR_INVALID_STATE Peer Manager not initialized. + */ +ret_code_t pm_peer_new(pm_peer_data_bonding_t * p_bonding_data, pm_peer_id_t * p_new_peer_id, pm_store_token_t * p_token); + + +/**@brief Function for freeing persistent storage for a peer. + * + * @param[in] peer_id Peer ID to be freed. + */ +void pm_peer_delete(pm_peer_id_t peer_id); + + +/**@brief Function for deleting all data stored for all peers. + * + * @note Use this only when not connected or connectable. + */ +void pm_peer_delete_all(void); + + +/** @} */ + +#endif // PEER_MANAGER_H__ diff --git a/components/ble/peer_manager/peer_manager_types.h b/components/ble/peer_manager/peer_manager_types.h new file mode 100644 index 0000000..0a3c5d5 --- /dev/null +++ b/components/ble/peer_manager/peer_manager_types.h @@ -0,0 +1,269 @@ + + +#ifndef PEER_MANAGER_TYPES_H__ +#define PEER_MANAGER_TYPES_H__ + +#include +#include + + +/** + * @file peer_manager_types.h + * + * @addtogroup peer_manager + * @{ + */ + + +#include +#include +#include "ble_gap.h" +#include "ble_hci.h" +#include "ble_gatt_db.h" +#include "compiler_abstraction.h" + + +/**@brief Handle to uniquely identify a peer for which we have persistently stored data. + */ +typedef uint16_t pm_peer_id_t; + +#define PM_PEER_ID_INVALID 0xFFFF /**< Invalid value for @ref pm_peer_id_t. */ +#define PM_PEER_ID_N_AVAILABLE_IDS 256 /**< The number of available peer IDs. */ +#define PM_LOCAL_DB_LEN_OVERHEAD_BYTES offsetof(pm_peer_data_local_gatt_db_flash_t, p_data) +#define PM_REMOTE_DB_LEN_OVERHEAD_BYTES offsetof(pm_peer_data_remote_gatt_db_flash_t, p_data) + +static __INLINE uint16_t PM_N_WORDS(uint16_t n_bytes) +{ + return ((n_bytes + 3) >> 2); +} + +/**@brief Errors originating from the Peer Manager module. + */ +typedef enum +{ + PM_SEC_ERROR_CODE_PIN_OR_KEY_MISSING = BLE_HCI_STATUS_CODE_PIN_OR_KEY_MISSING, /**< Encryption failed because the peripheral has lost the LTK for this bond. */ + PM_SEC_ERROR_CODE_MIC_FAILURE = BLE_HCI_CONN_TERMINATED_DUE_TO_MIC_FAILURE, /**< Pairing ended with disconnection because of mismatching keys. */ + PM_SEC_ERROR_SMP_TIMEOUT, /**< Pairing/bonding could not start because an SMP timeout 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 specification 4.2 section 3.H.3.4 */ +} pm_sec_error_code_t; + + +/**@brief Enumeration describing the different procedures that can lead to an encrypted link. + */ +typedef enum +{ + PM_LINK_SECURED_PROCEDURE_ENCRYPTION, /**< Using an LTK shared during a previous bonding procedure to encrypt the link. */ + PM_LINK_SECURED_PROCEDURE_BONDING, /**< A pairing procedure, followed by a bonding procedure. */ + PM_LINK_SECURED_PROCEDURE_PAIRING, /**< A pairing procedure with no bonding. */ +} pm_sec_procedure_t; + + +/**@brief Data associated with a bond to a peer. + */ +typedef struct +{ + uint8_t own_role; /**< The role of the local device during bonding. */ + ble_gap_id_key_t peer_id; /**< The peer's peer address and identity resolution key. */ + ble_gap_enc_key_t peer_ltk; /**< The peer's long term encryption key. */ + ble_gap_enc_key_t own_ltk; /**< Locally generated long term encryption key, distributed to the peer. */ +} pm_peer_data_bonding_t; + + +/**@brief Function for calculating the flash size of bonding data. + * + * @return The number of words the data will take in flash. + */ +static __INLINE uint16_t PM_BONDING_DATA_N_WORDS(void) +{ + return PM_N_WORDS(sizeof(pm_peer_data_bonding_t)); +} + + +/**@brief Function for calculating the flash size of service changed pending state. + * + * @return The number of words the data will take in flash. + */ +static __INLINE uint16_t PM_SC_STATE_N_WORDS(void) +{ + return PM_N_WORDS(sizeof(bool)); +} + + +/**@brief Data on a local GATT database. + */ +typedef struct +{ + uint32_t flags; /**< Flags describing the database attributes. */ + uint16_t len; /**< Size of attribute array. */ + uint8_t * p_data; /**< Array to hold the database attributes. */ +} pm_peer_data_local_gatt_db_t; + + +/**@brief Data on a local GATT database, as formatted in flash. + */ +typedef struct +{ + uint32_t flags; + uint16_t len; + uint16_t _padding; + uint8_t p_data[]; +} pm_peer_data_local_gatt_db_flash_t; + + +/**@brief Function for calculating the flash size of local GATT database data. + * + * @param[in] local_db_len The length of the database as reported by the SoftDevice. + * + * @return The number of words the data will take in flash. + */ +static __INLINE uint16_t PM_LOCAL_DB_N_WORDS(uint16_t local_db_len) +{ + return PM_N_WORDS(local_db_len + PM_LOCAL_DB_LEN_OVERHEAD_BYTES); +} + + +/**@brief Function for calculating the length of a local GATT database attribute array. + * + * @param[in] n_words The number of words the data takes in flash. + * + * @return The length of the database attribute array. + */ +static __INLINE uint16_t PM_LOCAL_DB_LEN(uint16_t n_words) +{ + return ((n_words * 4) - PM_LOCAL_DB_LEN_OVERHEAD_BYTES); +} + + +/**@brief Data on a remote GATT database. + */ +typedef struct +{ + uint32_t service_count; /**< Number of stored services. */ + ble_gatt_db_srv_t * p_data; /**< Array to hold the database attributes. */ +} pm_peer_data_remote_gatt_db_t; + + +/**@brief Data on a remote GATT database, as formatted in flash. + */ +typedef struct +{ + uint32_t service_count; + ble_gatt_db_srv_t p_data[]; +} pm_peer_data_remote_gatt_db_flash_t; + + + +/**@brief Function 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 the data will take in flash. + */ +static __INLINE uint16_t PM_REMOTE_DB_N_WORDS(uint16_t service_count) +{ + return PM_N_WORDS((sizeof(ble_gatt_db_srv_t) * service_count) + PM_REMOTE_DB_LEN_OVERHEAD_BYTES); +} + + +/**@brief Union of all data associated with one peer. + */ +typedef union +{ + pm_peer_data_bonding_t * p_bonding_data; /**< The exchanged bond information in addition to metadata of the bonding. */ + bool * p_service_changed_pending; /**< Whether a service changed indication should be sent to the peer. */ + pm_peer_data_local_gatt_db_t * p_local_gatt_db; /**< Persistent information pertaining to a peer GATT client. */ + pm_peer_data_remote_gatt_db_t * p_remote_gatt_db; /**< Persistent information pertaining to a peer GATT server. */ + uint8_t * p_application_data; /**< Arbitrary data to associate with the peer. This data can be freely used by the application. */ +} pm_peer_data_unit_t; + + +/**@brief Immutable version of @ref pm_peer_data_unit_t. + */ +typedef union +{ + pm_peer_data_bonding_t const * p_bonding_data; + bool const * p_service_changed_pending; + pm_peer_data_local_gatt_db_t const * p_local_gatt_db; + pm_peer_data_remote_gatt_db_t const * p_remote_gatt_db; + uint8_t const * p_application_data; +} pm_peer_data_unit_const_t; + + +/**@brief Data from @ref pm_peer_data_unit_t, as mapped in flash. + */ +typedef union +{ + pm_peer_data_bonding_t const * p_bonding_data; + bool const * p_service_changed_pending; + pm_peer_data_local_gatt_db_flash_t const * p_local_gatt_db; + pm_peer_data_remote_gatt_db_flash_t const * p_remote_gatt_db; + uint8_t const * p_application_data; +} pm_peer_data_unit_flash_t; + + +/**@brief The different types of data associated with a peer. + */ +typedef enum +{ + PM_PEER_DATA_ID_BONDING, + PM_PEER_DATA_ID_SERVICE_CHANGED_PENDING, + PM_PEER_DATA_ID_GATT_LOCAL, + PM_PEER_DATA_ID_GATT_REMOTE, + PM_PEER_DATA_ID_APPLICATION, + PM_PEER_DATA_ID_INVALID, +} pm_peer_data_id_t; + + +//STATIC_ASSERT_MSG(sizeof(pm_peer_data_t) == sizeof(pm_peer_data_const_t), "Size of pm_peer_data_t different from immutable version."); + + +/**@brief Macro saying whether a data_id is valid, i.e. one of the valid enum values. + * + * @param[in] data_id The data_id to check. + */ +static __INLINE bool PM_PEER_DATA_ID_IS_VALID(pm_peer_data_id_t data_id) +{ + return ((data_id - PM_PEER_DATA_ID_BONDING) < (PM_PEER_DATA_ID_INVALID - PM_PEER_DATA_ID_BONDING)); +} + + +/**@brief One piece of data associated with a peer, together with the type. + */ +typedef struct +{ + uint16_t length_words; + pm_peer_data_id_t data_type; + pm_peer_data_unit_t data; +} pm_peer_data_t; + +/**@brief Immutable version of @ref pm_peer_data_t. + */ +typedef struct +{ + uint16_t length_words; + pm_peer_data_id_t data_type; + pm_peer_data_unit_const_t data; +} pm_peer_data_const_t; + +/**@brief Data from @ref pm_peer_data_t, as mapped in flash. + */ +typedef struct +{ + uint16_t length_words; + pm_peer_data_id_t data_type; + pm_peer_data_unit_flash_t data; +} pm_peer_data_flash_t; + + +/**@brief Typedef for type used for write prepares. Used to reserve space in flash + */ +typedef uint32_t pm_prepare_token_t; + + +/**@brief Typedef for type used to hold reference to stored item in flash. + * this token can be used for locking and validity check + */ +typedef uint32_t pm_store_token_t; + + /** @} */ + +#endif /* PEER_MANAGER_TYPES_H__ */ diff --git a/components/ble/peer_manager/pm_buffer.c b/components/ble/peer_manager/pm_buffer.c new file mode 100644 index 0000000..833070a --- /dev/null +++ b/components/ble/peer_manager/pm_buffer.c @@ -0,0 +1,122 @@ +/* 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 "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) == 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/components/ble/peer_manager/pm_buffer.h b/components/ble/peer_manager/pm_buffer.h new file mode 100644 index 0000000..906d516 --- /dev/null +++ b/components/ble/peer_manager/pm_buffer.h @@ -0,0 +1,113 @@ +/* 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. +* +*/ + + +#ifndef BUFFER_H__ +#define BUFFER_H__ + +#include +#include "sdk_errors.h" +#include "pm_mutex.h" + + +/** + * @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 uint8_t buffer_memory[(n_blocks) * (block_size)]; \ + 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 +{ + 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__ + +/** + * @} + */ diff --git a/components/ble/peer_manager/pm_mutex.c b/components/ble/peer_manager/pm_mutex.c new file mode 100644 index 0000000..d6e9e2d --- /dev/null +++ b/components/ble/peer_manager/pm_mutex.c @@ -0,0 +1,115 @@ +/* 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 "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/components/ble/peer_manager/pm_mutex.h b/components/ble/peer_manager/pm_mutex.h new file mode 100644 index 0000000..c75a0a7 --- /dev/null +++ b/components/ble/peer_manager/pm_mutex.h @@ -0,0 +1,88 @@ +/* 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. +* +*/ + + + +#ifndef MUTEX_H__ +#define MUTEX_H__ + + +#include +#include + +/** + * @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__ + +/** @} */ diff --git a/components/ble/peer_manager/security_dispatcher.c b/components/ble/peer_manager/security_dispatcher.c new file mode 100644 index 0000000..66c1724 --- /dev/null +++ b/components/ble/peer_manager/security_dispatcher.c @@ -0,0 +1,833 @@ +/* Copyright (C) 2015 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * 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 "security_dispatcher.h" + +#include +#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" + + +#define MAX_REGISTRANTS 3 /**< The number of user that can register with the module. */ + +#define MODULE_INITIALIZED (m_smd.n_registrants > 0) /**< Expression which is true when the module is initialized. */ + +/**@brief Macro for verifying that the module is initialized. It will cause the function to return + * @ref NRF_ERROR_INVALID_STATE if not. + */ +#define VERIFY_MODULE_INITIALIZED() \ +do \ +{ \ + if (!MODULE_INITIALIZED) \ + { \ + return NRF_ERROR_INVALID_STATE; \ + } \ +} while(0) + + +/**@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. + */ +#define VERIFY_PARAM_NOT_NULL(param) \ +do \ +{ \ + if (param == NULL) \ + { \ + return NRF_ERROR_NULL; \ + } \ +} while(0) + + +typedef struct +{ + smd_evt_handler_t evt_handlers[MAX_REGISTRANTS]; + uint8_t n_registrants; + pm_peer_id_t pending_bond_central; + pm_peer_id_t pending_bond_peripheral; +} smd_t; + +static smd_t m_smd; + +static void internal_state_reset(smd_t * smd) +{ + memset(smd, 0, sizeof(smd_t)); + smd->pending_bond_central = PM_PEER_ID_INVALID; + smd->pending_bond_peripheral = PM_PEER_ID_INVALID; +} + + +/**@brief Function for storing the fact that a new bond is being made. + * + * @details This specifies that there is no bonding data yet stored for this peer. The role is + * needed because the SoftDevice supports two simultaneous bonding procedures, one per role. + * + * @param[in] role The role of the local device in the bonding procedure. + * @param[in] peer_id ID of the device being bonded with. + */ +static void pending_bond_push(uint8_t role, pm_peer_id_t peer_id) +{ + if (role == BLE_GAP_ROLE_CENTRAL) + { + m_smd.pending_bond_central = peer_id; + } + else + { + m_smd.pending_bond_peripheral = peer_id; + } +} + + +/**@brief Function for reading and clearing the record of whether a new bond is being made. + * + * @details If the bonding fails, and this function returns true this peer ID must be freed. The + * role is needed because the SoftDevice supports two simultaneous bonding procedures, one + * per role. + * + * @param[in] role The role of the local device in the bonding procedure. + * @param[in] peer_id ID of the device being bonded with. + * + * @return Whether a new bond was/is being made. I.E. whether @ref pending_bond_push has been + * called with the same parameters. + */ +static bool pending_bond_pop(uint8_t role, pm_peer_id_t peer_id) +{ + if (peer_id == PM_PEER_ID_INVALID) + { + return false; + } + + if ((role == BLE_GAP_ROLE_CENTRAL) && (m_smd.pending_bond_central == peer_id)) + { + m_smd.pending_bond_central = PM_PEER_ID_INVALID; + return true; + } + else if ((role == BLE_GAP_ROLE_PERIPH) && (m_smd.pending_bond_peripheral == peer_id)) + { + m_smd.pending_bond_peripheral = PM_PEER_ID_INVALID; + return true; + } + else + { + return false; + } +} + + +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_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 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) + { + 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.data.p_bonding_data->own_ltk; + + if (peer_data.data.p_bonding_data->own_role == BLE_GAP_ROLE_CENTRAL) + { + // Role has changed since bonding. + p_existing_key = &peer_data.data.p_bonding_data->peer_ltk; + } + + if (im_master_id_is_valid(&p_existing_key->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_SEC_ERROR_CODE_PIN_OR_KEY_MISSING; + evt.params.link_encryption_failed.error_src = BLE_GAP_SEC_STATUS_SOURCE_LOCAL; + + evt_send(&evt); + } + else + { + sec_start_send(p_gap_evt->conn_handle, PM_LINK_SECURED_PROCEDURE_ENCRYPTION); + } + 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_periph = p_gap_evt->params.auth_status.kdist_periph; + ble_gap_sec_kdist_t kdist_central = p_gap_evt->params.auth_status.kdist_central; + ble_gap_sec_kdist_t kdist_own = (role == BLE_GAP_ROLE_CENTRAL) ? kdist_central : kdist_periph; + ble_gap_sec_kdist_t kdist_peer = (role == BLE_GAP_ROLE_CENTRAL) ? kdist_periph : kdist_central; + + if (role == BLE_GAP_ROLE_INVALID) + { + /* Unlikely, but maybe possible? */ + return; + } + + pending_bond_pop(role, peer_id); + + err_code = pdb_write_buf_store(peer_id, PM_PEER_DATA_ID_BONDING); + if (err_code != NRF_SUCCESS) + { + /* Unexpected */ + smd_evt_t error_evt = + { + .evt_id = SMD_EVT_ERROR_BONDING_INFO, + .conn_handle = p_gap_evt->conn_handle, + .params = + { + .error_bonding_info = + { + .peer_id = peer_id, + .error = err_code, + } + } + }; + evt_send(&error_evt); + } + + smd_evt_t pairing_success_evt = + { + .evt_id = SMD_EVT_PAIRING_SUCCESS, + .conn_handle = p_gap_evt->conn_handle, + .params = + { + .pairing_success = + { + .bonded = p_gap_evt->params.auth_status.bonded, + .mitm = p_gap_evt->params.auth_status.sm1_levels.lv3, + .kdist_own = kdist_own, + .kdist_peer = kdist_peer, + } + } + }; + evt_send(&pairing_success_evt); + return; +} + + +/**@brief Function for cleaning up after a failed pairing procedure. + * + * @param[in] role Our role in the pairing procedure. See @ref BLE_GAP_ROLES. + * @param[in] peer_id The peer id used in the pairing procedure. + */ +static void pairing_failure(uint8_t role, pm_peer_id_t peer_id) +{ + if(pending_bond_pop(role, peer_id)) + { + // The peer_id was created during the procedure, and should be freed, because no data is stored under it. + pdb_peer_free(peer_id); + } + else + { + pdb_write_buf_release(peer_id, PM_PEER_DATA_ID_BONDING); + } + + return; +} + + +/**@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) +{ + 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); + + if ( (peer_id != PM_PEER_ID_INVALID) + && (p_gap_evt->params.disconnected.reason == BLE_HCI_CONN_TERMINATED_DUE_TO_MIC_FAILURE) + && (pending_bond_pop(role, peer_id))) + { +// smd_evt_t evt = +// { +// .evt_id = SMD_EVT_PAIRING_FAIL, +// .conn_handle = p_gap_evt->conn_handle, +// .params = +// { +// .pairing_failed = +// { +// .auth_status = ? +// .error_src = ? +// } +// } +// }; + + pairing_failure(role, peer_id); + +// evt_send(&evt); + } +} + + + +/**@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) +{ + 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); + smd_evt_t evt = + { + .evt_id = SMD_EVT_PAIRING_FAIL, + .conn_handle = p_gap_evt->conn_handle, + .params = + { + .pairing_failed = + { + .auth_status = p_gap_evt->params.auth_status.auth_status, + .error_src = p_gap_evt->params.auth_status.error_src, + } + } + }; + + pairing_failure(role, peer_id); + + evt_send(&evt); +} + + +/**@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; + + case BLE_GAP_SEC_STATUS_PDU_INVALID: + /* Ignore, because they don't have anything to do with an ongoing procedure. */ + 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) +{ + smd_evt_t evt; + + evt.conn_handle = p_gap_evt->conn_handle; + + if (ble_conn_state_encrypted(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); + } + else + { + evt.evt_id = SMD_EVT_LINK_ENCRYPTION_FAILED; + evt.params.link_encryption_failed.error = PM_SEC_ERROR_CODE_PIN_OR_KEY_MISSING; + evt.params.link_encryption_failed.error_src = BLE_GAP_SEC_STATUS_SOURCE_REMOTE; + } + + evt_send(&evt); +} + + +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) + { + err_code = pdb_register(pdb_evt_handler); + if (err_code == NRF_SUCCESS) + { + internal_state_reset(&m_smd); + } + } + 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) +{ + 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; + + 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) + { + pending_bond_push(role, peer_id); + } + else + { + err_code = NRF_ERROR_INTERNAL; + } + } + + if (err_code == NRF_SUCCESS) + { + // Peer ID is OK, retrieve memory buffer to receive data. + err_code = pdb_write_buf_get(peer_id, PM_PEER_DATA_ID_BONDING, 1, &peer_data); + if (err_code == NRF_SUCCESS) + { + peer_data.data.p_bonding_data->own_role = role; + + if (role == BLE_GAP_ROLE_CENTRAL) + { + sec_keyset.keys_central.p_enc_key = &peer_data.data.p_bonding_data->own_ltk; + sec_keyset.keys_periph.p_enc_key = &peer_data.data.p_bonding_data->peer_ltk; + sec_keyset.keys_periph.p_id_key = &peer_data.data.p_bonding_data->peer_id; + im_ble_addr_get(conn_handle, &peer_data.data.p_bonding_data->peer_id.id_addr_info); // Will be overwritten if ID is shared. + } + else + { + sec_keyset.keys_periph.p_enc_key = &peer_data.data.p_bonding_data->own_ltk; + sec_keyset.keys_central.p_enc_key = &peer_data.data.p_bonding_data->peer_ltk; + sec_keyset.keys_central.p_id_key = &peer_data.data.p_bonding_data->peer_id; + im_ble_addr_get(conn_handle, &peer_data.data.p_bonding_data->peer_id.id_addr_info); // Will be overwritten if ID is shared. + } + + // 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_sec_procedure_t procedure = p_sec_params->bond + ? PM_LINK_SECURED_PROCEDURE_BONDING + : PM_LINK_SECURED_PROCEDURE_PAIRING; + sec_start_send(conn_handle, procedure); + } + } + } + + if(pending_bond_pop(role, peer_id)) + { + // New peer ID created, either report it or free it. + if (err_code == NRF_SUCCESS) + { + pending_bond_push(role, peer_id); + im_new_peer_id(conn_handle, peer_id); + } + else + { + pdb_peer_free(peer_id); + } + } + 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_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; + + + err_code = pdb_read_buf_get(peer_id, PM_PEER_DATA_ID_BONDING, &peer_data, NULL); + + if (err_code == NRF_SUCCESS) + { + p_existing_key = &(peer_data.data.p_bonding_data->peer_ltk); + if (peer_data.data.p_bonding_data->own_role == BLE_GAP_ROLE_PERIPH) + { + // Role has changed since bonding. + p_existing_key = &(peer_data.data.p_bonding_data->own_ltk); + } + } + + if (!force_repairing + && (err_code == NRF_SUCCESS) + && (p_existing_key != NULL) + && (im_master_id_is_valid(&(p_existing_key->master_id))) /* There is an existing LTK stored. */ + && (p_existing_key->enc_info.auth >= p_sec_params->mitm)) /* The requested security is at or below the existing level. */ + { + 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; + } + } + } + + 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_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; + } + pdb_peer_free(peer_id); + } + else + { + pending_bond_push(BLE_GAP_ROLE_CENTRAL, peer_id); + im_new_peer_id(conn_handle, peer_id); + } + } + else + { + err_code = NRF_ERROR_INTERNAL; + } + + 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_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 + { + err_code = sd_ble_gap_authenticate(conn_handle, p_sec_params); + } + + if (err_code == NRF_SUCCESS) + { + sec_start_send(conn_handle, procedure); + } + + 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: + VERIFY_PARAM_NOT_NULL(p_sec_params); + return sd_ble_gap_authenticate(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/components/ble/peer_manager/security_dispatcher.h b/components/ble/peer_manager/security_dispatcher.h new file mode 100644 index 0000000..bd1ef50 --- /dev/null +++ b/components/ble/peer_manager/security_dispatcher.h @@ -0,0 +1,248 @@ +/* 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. +* +*/ + +#ifndef SECURITY_DISPATCHER_H__ +#define SECURITY_DISPATCHER_H__ + +#include "stdint.h" +#include "sdk_errors.h" +#include "ble.h" +#include "ble_gap.h" +#include "peer_manager_types.h" + + +/** + * @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_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 +{ + uint8_t auth_status; /**< The error code describing the error. See @ref BLE_GAP_SEC_STATUS. */ + uint8_t error_src; /**< The origin of 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 which 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. + * + * @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); + + +/**@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, or no space in RAM for + * peer_database to use. + * @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); + +/** @} */ + +#endif /* SECURITY_DISPATCHER_H__ */ diff --git a/components/ble/peer_manager/security_manager.c b/components/ble/peer_manager/security_manager.c new file mode 100644 index 0000000..1a8cb21 --- /dev/null +++ b/components/ble/peer_manager/security_manager.c @@ -0,0 +1,540 @@ +/* Copyright (C) 2015 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is property of Nordic Semiconductor ASA. + * 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 "security_manager.h" +#include +#include "security_dispatcher.h" +#include "peer_database.h" +#include "ble_conn_state.h" + + + +#define MAX_REGISTRANTS 3 /**< The number of user that can register with the module. */ + +#define MODULE_INITIALIZED (m_sm.n_registrants > 0) /**< Expression which is true when the module is initialized. */ + +/**@brief Macro for verifying that the module is initialized. It will cause the function to return + * @ref NRF_ERROR_INVALID_STATE if not. + */ +#define VERIFY_MODULE_INITIALIZED() \ +do \ +{ \ + if (!MODULE_INITIALIZED) \ + { \ + return NRF_ERROR_INVALID_STATE; \ + } \ +} while(0) + + +/**@brief Macro for verifying that the module is initialized. It will cause the function to return + * if not. + */ +#define VERIFY_MODULE_INITIALIZED_VOID()\ +do \ +{ \ + if (!MODULE_INITIALIZED) \ + { \ + return; \ + } \ +} while(0) + + +/**@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. + */ +#define VERIFY_PARAM_NOT_NULL(param) \ +do \ +{ \ + if (param == NULL) \ + { \ + return NRF_ERROR_NULL; \ + } \ +} while(0) + + +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; + bool pdb_evt_handler_registered; + bool sec_params_valid; + ble_gap_sec_params_t sec_params; +} 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}; + + +static void evt_send(sm_evt_t * p_event) +{ + for (int 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_flash_full = true; + flag_value_busy = false; + } + 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 smd_params_reply_perform(uint16_t conn_handle) +{ + ret_code_t err_code; + + if (m_sm.sec_params_valid) + { + err_code = smd_params_reply(conn_handle, &m_sm.sec_params); + } + else + { + err_code = smd_params_reply(conn_handle, 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; + } + link_secure(p_event->conn_handle, null_params, false, true); + } + 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_id = (sm_evt_id_t)p_event->evt_id, + .conn_handle = p_event->conn_handle, + .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 (int 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); + + link_secure(conn_handle_list.flag_keys[i], null_params, force_repairing, true); + } + } + } +} + + +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 (int 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: + 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 Macro for initializing a BLE Connection State user flag. + * + * @param[out] flag_id The flag to initialize. + */ +#define FLAG_ID_INIT(flag_id) \ +do \ +{ \ + if ((flag_id) == BLE_CONN_STATE_USER_FLAG_INVALID) \ + { \ + (flag_id) = ble_conn_state_user_flag_acquire(); \ + if ((flag_id) == BLE_CONN_STATE_USER_FLAG_INVALID)\ + { \ + return NRF_ERROR_INTERNAL; \ + } \ + } \ +} while(0) + + +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); + + 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_periph.sign || p_sec_params->kdist_central.sign) + { + return false; + } + + // If bonding is not enabled, no keys can be distributed. + if (!p_sec_params->bond && ( p_sec_params->kdist_periph.enc + || p_sec_params->kdist_periph.id + || p_sec_params->kdist_central.enc + || p_sec_params->kdist_central.id)) + { + return false; + } + + // If bonding is enabled, one or more keys must be distributed. + if ( p_sec_params->bond + && !p_sec_params->kdist_periph.enc + && !p_sec_params->kdist_periph.id + && !p_sec_params->kdist_central.enc + && !p_sec_params->kdist_central.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; + } +} + + +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/components/ble/peer_manager/security_manager.h b/components/ble/peer_manager/security_manager.h new file mode 100644 index 0000000..6c2743b --- /dev/null +++ b/components/ble/peer_manager/security_manager.h @@ -0,0 +1,158 @@ +/* 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. +* +*/ + +#ifndef SECURITY_MANAGER_H__ +#define SECURITY_MANAGER_H__ + +#include "stdint.h" +#include "sdk_errors.h" +#include "ble.h" +#include "ble_gap.h" +#include "peer_manager_types.h" +#include "security_dispatcher.h" + + +/** + * @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 (slave) 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_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 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); + +/** @} */ + +#endif /* SECURITY_MANAGER_H__ */ diff --git a/components/device/compiler_abstraction.h b/components/device/compiler_abstraction.h new file mode 100644 index 0000000..6c56e96 --- /dev/null +++ b/components/device/compiler_abstraction.h @@ -0,0 +1,126 @@ +/* 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. + * + */ +#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/components/device/nrf.h b/components/device/nrf.h new file mode 100644 index 0000000..dfe7cea --- /dev/null +++ b/components/device/nrf.h @@ -0,0 +1,60 @@ +/* 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. + * + */ + +#ifndef NRF_H +#define NRF_H + +#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" + #else + #error "Device family must be defined. See nrf.h." + #endif /* NRF51, NRF52 */ + + #include "compiler_abstraction.h" + +#endif /* _WIN32 || __unix || __APPLE__ */ + +#endif /* NRF_H */ + diff --git a/components/device/nrf51.h b/components/device/nrf51.h new file mode 100644 index 0000000..122b275 --- /dev/null +++ b/components/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 20. October 2015 + * + * @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/components/device/nrf51_bitfields.h b/components/device/nrf51_bitfields.h new file mode 100644 index 0000000..a668447 --- /dev/null +++ b/components/device/nrf51_bitfields.h @@ -0,0 +1,6892 @@ +/* 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. + * + */ +#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/components/device/nrf51_deprecated.h b/components/device/nrf51_deprecated.h new file mode 100644 index 0000000..2a45aee --- /dev/null +++ b/components/device/nrf51_deprecated.h @@ -0,0 +1,438 @@ +/* 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. + * + */ + +#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/components/device/nrf51_to_nrf52.h b/components/device/nrf51_to_nrf52.h new file mode 100644 index 0000000..57d8045 --- /dev/null +++ b/components/device/nrf51_to_nrf52.h @@ -0,0 +1,935 @@ +/* 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. + * + */ + +#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/components/device/nrf52.h b/components/device/nrf52.h new file mode 100644 index 0000000..af264ba --- /dev/null +++ b/components/device/nrf52.h @@ -0,0 +1,2070 @@ + +/****************************************************************************************************//** + * @file nrf52.h + * + * @brief CMSIS Cortex-M4 Peripheral Access Layer Header File for + * nrf52 from Nordic Semiconductor. + * + * @version V1 + * @date 20. October 2015 + * + * @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 */ +} 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 */ + __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 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[17]; + __I uint32_t CONFIGID; /*!< Configuration identifier */ + __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 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 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 (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; + + +/* ================================================================================ */ +/* ================ 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 */ + __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[9]; + __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; /*!< 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; + + +/* ================================================================================ */ +/* ================ 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 indicating which GPIO pins have met the criteria set in + PIN_CNF[n].SENSE register */ + __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_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_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_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_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/components/device/nrf52_bitfields.h b/components/device/nrf52_bitfields.h new file mode 100644 index 0000000..6b55c81 --- /dev/null +++ b/components/device/nrf52_bitfields.h @@ -0,0 +1,12369 @@ +/* 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. + * + */ +#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: 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 mode */ + +/* Bit 0 : Disable the protection mechanism for NVM regions while in debug mode. This register will only disable the protection mechanism if the device is in debug 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 (5UL) /*!< 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 : VDOWN = (THDOWN+1)/64*VREF */ +#define COMP_TH_THDOWN_Pos (8UL) /*!< Position of THDOWN field. */ +#define COMP_TH_THDOWN_Msk (0x3FUL << COMP_TH_THDOWN_Pos) /*!< Bit mask of THDOWN field. */ + +/* Bits 5..0 : VUP = (THUP+1)/64*VREF */ +#define COMP_TH_THUP_Pos (0UL) /*!< Position of THUP field. */ +#define COMP_TH_THUP_Msk (0x3FUL << COMP_TH_THUP_Pos) /*!< Bit mask of THUP 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_CONFIGID */ +/* Description: Configuration identifier */ + +/* Bits 31..16 : Deprecated field - Identification number for the FW that is pre-loaded into the chip */ +#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 : Identification number for the HW */ +#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_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 */ + +/* Bits 31..0 : Part variant */ +#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_nRF52AA (0x2000UL) /*!< nRF52832-AA (Engineering sample) */ +#define FICR_INFO_VARIANT_VARIANT_nRF52A0 (0x2001UL) /*!< nRF52832-A0 */ +#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_QFN48 (0x0000UL) /*!< 48-pin QFN with 31 GPIO */ +#define FICR_INFO_PACKAGE_PACKAGE_nRF52832QF (0x2000UL) /*!< nRF52832 QFxx - 48-pin QFN */ +#define FICR_INFO_PACKAGE_PACKAGE_nRF52832CH (0x2001UL) /*!< nRF52832 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 (16UL) /*!< 16 kByte RAM */ +#define FICR_INFO_RAM_RAM_K32 (32UL) /*!< 32 kByte RAM */ +#define FICR_INFO_RAM_RAM_K64 (64UL) /*!< 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 (128UL) /*!< 128 kByte FLASH */ +#define FICR_INFO_FLASH_FLASH_K256 (256UL) /*!< 256 kByte FLASH */ +#define FICR_INFO_FLASH_FLASH_K512 (512UL) /*!< 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_DISABLE (0UL) /*!< Disabl */ +#define I2S_ENABLE_ENABLE_ENABLE (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_DISABLE (0UL) /*!< Reception disabled and now data will be written to the RXD.PTR address. */ +#define I2S_CONFIG_RXEN_RXEN_ENABLE (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_DISABLE (0UL) /*!< Transmission disabled and now data will be read from the RXD.TXD address. */ +#define I2S_CONFIG_TXEN_TXEN_ENABLE (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_DISABLE (0UL) /*!< Master clock generator disabled and PSEL.MCK not connected(available as GPIO). */ +#define I2S_CONFIG_MCKEN_MCKEN_ENABLE (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. Value 0 has a special meaning, see below. */ +#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 6 : No valid End of Frame detected */ +#define NFCT_ERRORSTATUS_EOFERROR_Pos (6UL) /*!< Position of EOFERROR field. */ +#define NFCT_ERRORSTATUS_EOFERROR_Msk (0x1UL << NFCT_ERRORSTATUS_EOFERROR_Pos) /*!< Bit mask of EOFERROR field. */ + +/* 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 1 : The received pulse does not match a valid NFC-A symbol */ +#define NFCT_ERRORSTATUS_INVALIDNFCSYMBOL_Pos (1UL) /*!< Position of INVALIDNFCSYMBOL field. */ +#define NFCT_ERRORSTATUS_INVALIDNFCSYMBOL_Msk (0x1UL << NFCT_ERRORSTATUS_INVALIDNFCSYMBOL_Pos) /*!< Bit mask of INVALIDNFCSYMBOL 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 indicating which GPIO pins have met the criteria set in PIN_CNF[n].SENSE register */ + +/* Bits 31..0 : Register holding a '1' for each GPIO pins which has met the criteria set in PIN_CNF[n].SENSE */ +#define GPIO_LATCH_LATCH_Pos (0UL) /*!< Position of LATCH field. */ +#define GPIO_LATCH_LATCH_Msk (0xFFFFFFFFUL << GPIO_LATCH_LATCH_Pos) /*!< Bit mask of LATCH field. */ + +/* 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) /*!< Use default behaviour */ +#define GPIO_DETECTMODE_DETECTMODE_LDETECT (1UL) /*!< Use 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' */ +#define GPIO_PIN_CNF_DRIVE_D0H1 (5UL) /*!< Disconnect '0', high drive '1' */ +#define GPIO_PIN_CNF_DRIVE_S0D1 (6UL) /*!< Standard '0'. disconnect '1' */ +#define GPIO_PIN_CNF_DRIVE_H0D1 (7UL) /*!< High drive '0', disconnect '1' */ + +/* 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 */ +#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 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) /*!< 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_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_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 switched 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 switched 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 of RAMm 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 of RAMm 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 RAMm 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 RAMm 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 RAMm 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 RAMm 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 */ + +/* 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, compatible with nRF51 */ +#define RADIO_MODECNF0_RU_Fast (1UL) /*!< Fast ramp-up, see product 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 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 15..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 (0xFFFFUL << SAADC_RESULT_MAXCNT_MAXCNT_Pos) /*!< Bit mask of MAXCNT field. */ + +/* Register: SAADC_RESULT_AMOUNT */ +/* Description: Number of buffer words transferred since last START */ + +/* Bits 15..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 (0xFFFFUL << 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) /*!< 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 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 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 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 : Blocks debugger read/write access to all CPU registers and memory mapped addresses */ +#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/components/drivers_ext/adns2080/adns2080.c b/components/drivers_ext/adns2080/adns2080.c new file mode 100644 index 0000000..0598eed --- /dev/null +++ b/components/drivers_ext/adns2080/adns2080.c @@ -0,0 +1,331 @@ +/* Copyright (c) 2009 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 + +#include "adns2080.h" +#include "sdio.h" + +/*lint ++flb "Enter library region" */ + +#define ADNS2080_PRODUCT_ID (0x2AU) /*!< ADNS2080 product id */ +#define ADNS2080_RESET_NUMBER (0x5AU) /*!< ADNS2080 reset code */ + +/* ADNS2080 register addresses */ +#define REG_PROD_ID (0x00U) /*!< Product ID. Default value : 0x2A */ +#define REG_REV_ID (0x01U) /*!< Revision ID. Default value : 0x00 */ +#define REG_MOTION_ST (0x02U) /*!< Motion Status. Default value : 0x00 */ +#define REG_DELTA_X (0x03U) /*!< Lower byte of Delta_X. Default value : 0x00 */ +#define REG_DELTA_Y (0x04U) /*!< Lower byte of Delta_Y. Default value : 0x00 */ +#define REG_SQUAL (0x05U) /*!< Squal Quality. Default value : 0x00 */ +#define REG_SHUT_HI (0x06U) /*!< Shutter Open Time (Upper 8-bit). Default value : 0x00 */ +#define REG_SHUT_LO (0x07U) /*!< Shutter Open Time (Lower 8-bit). Default value : 0x64 */ +#define REG_PIX_MAX (0x08U) /*!< Maximum Pixel Value. Default value : 0xD0 */ +#define REG_PIX_ACCUM (0x09U) /*!< Average Pixel Value. Default value : 0x80 */ +#define REG_PIX_MIN (0x0AU) /*!< Minimum Pixel Value. Default value : 0x00 */ +#define REG_PIX_GRAB (0x0BU) /*!< Pixel Grabber. Default value : 0x00 */ +#define REG_DELTA_XY_HIGH (0x0CU) /*!< Upper 4 bits of Delta X and Y displacement. Default value : 0x00 */ +#define REG_MOUSE_CTRL (0x0DU) /*!< Mouse Control. Default value : 0x01 */ +#define REG_RUN_DOWNSHIFT (0x0EU) /*!< Run to Rest1 Time. Default value : 0x08 */ +#define REG_REST1_PERIOD (0x0FU) /*!< Rest1 Period. Default value : 0x01 */ +#define REG_REST1_DOWNSHIFT (0x10U) /*!< Rest1 to Rest2 Time. Default value : 0x1f */ +#define REG_REST2_PERIOD (0x11U) /*!< Rest2 Period. Default value : 0x09 */ +#define REG_REST2_DOWNSHIFT (0x12U) /*!< Rest2 to Rest3 Time. Default value : 0x2f */ +#define REG_REST3_PERIOD (0x13U) /*!< Rest3 Period. Default value : 0x31 */ +#define REG_PERFORMANCE (0x22U) /*!< Performance. Default value : 0x00 */ +#define REG_RESET (0x3aU) /*!< Reset. Default value : 0x00 */ +#define REG_NOT_REV_ID (0x3fU) /*!< Inverted Revision ID. Default value : 0xff */ +#define REG_LED_CTRL (0x40U) /*!< LED Control. Default value : 0x00 */ +#define REG_MOTION_CTRL (0x41U) /*!< Motion Control. Default value : 0x40 */ +#define REG_BURST_READ_FIRST (0x42U) /*!< Burst Read Starting Register. Default value : 0x03 */ +#define REG_BURST_READ_LAST (0x44U) /*!< Burst Read Ending Register. Default value : 0x09 */ +#define REG_REST_MODE_CONFIG (0x45U) /*!< Rest Mode Confi guration. Default value : 0x00 */ +#define REG_MOTION_BURST (0x63U) /*!< Burst Read. Default value : 0x00 */ + +/* ADNS2080 register bits */ +#define REG_MOUSE_CTRL_POWERDOWN (0x02U) /*!< Mouse control register powerdown bit */ +#define REG_MOTION_CTRL_MOT_A (0x80U) /*!< Motion control register polarity bit */ +#define REG_MOTION_CTRL_MOT_S (0x40U) /*!< Motion control register edge sensitivity bit */ +#define REG_MOUSE_CTRL_RES_EN (0x40U) /*!< Mouse control register resolution enable bit */ +#define REG_MOUSE_CTRL_BIT_REPORTING (0x80U) /*!< Mouse control register "number of motion bits" bit*/ + +void adns2080_movement_read(int16_t * deltaX, int16_t * deltaY) +{ + uint8_t delta_x; /*!< Stores REG_DELTA_X contents */ + uint8_t delta_y; /*!< Stores REG_DELTA_Y contents */ + uint8_t delta_xy_high; /*!< Stores REG_DELTA_XY contents which contains upper 4 bits for both delta_x and delta_y when 12 bit mode is used */ + uint8_t delta_x_high; /*!< Stores delta_x 4 MSB bits */ + uint8_t delta_y_high; /*!< Stores delta_y 4 MSB bits */ + + uint16_t u16_deltaX; /*!< This is used to buffer the result and will be cast later to int16_t */ + uint16_t u16_deltaY; /*!< This is used to buffer the result and will be cast later to int16_t */ + + delta_x = sdio_read_byte(REG_DELTA_X); + delta_y = sdio_read_byte(REG_DELTA_Y); + + if (adns2080_motion_bits_read() == ADNS2080_MOTION_BITS_12) + { + // In 12 bit mode the upper 4 bits are stored in a separate register + // where first 4 upper bits are for delta_x and lower 4 bits for delta_y. + delta_xy_high = sdio_read_byte(REG_DELTA_XY_HIGH); + + delta_x_high = ((delta_xy_high & 0xF0) >> 4); + delta_y_high = (delta_xy_high & 0x0F); + + // Check if MSB is 1. If it is, this is a negative number and we have + // to fill the upper unused bits with 1s. + if (delta_x_high & 0x08) + { + u16_deltaX = 0xF000; + } + else + { + u16_deltaX = 0x0000; + } + + // Check if MSB is 1. If it is, this is a negative number and we have + // to fill the upper unused bits with 1s. + if (delta_y_high & 0x08) + { + u16_deltaY = 0xF000; + } + else + { + u16_deltaY = 0x0000; + } + + u16_deltaX |= (delta_x_high << 4) | delta_x; + u16_deltaY |= (delta_y_high << 4) | delta_y; + } + else // Only 8 bits is used for motion data + { + // Check if MSB is 1. If it is, this is a negative number and we have + // to fill the upper unused bits with 1s. + if (delta_x & 0x80) + { + u16_deltaX = 0xFF00; + } + else + { + u16_deltaX = 0x0000; + } + + // Check if MSB is 1. If it is, this is a negative number and we have + // to fill the upper unused bits with 1s. + if (delta_y & 0x80) + { + u16_deltaY = 0xFF00; + } + else + { + u16_deltaY = 0x0000; + } + + u16_deltaX |= delta_x; + u16_deltaY |= delta_y; + } + + *deltaX = (int16_t)u16_deltaX; + *deltaY = (int16_t)u16_deltaY; +} + +adns2080_motion_bits_t adns2080_motion_bits_read(void) +{ + /* Read the most significant bit */ + return (adns2080_motion_bits_t)((sdio_read_byte(REG_MOUSE_CTRL) >> 7) & 0x01); +} + +bool adns2080_is_motion_detected(void) +{ + return ((sdio_read_byte(REG_MOTION_ST) & 0x80) != 0); +} + +uint8_t adns2080_product_id_read(void) +{ + return sdio_read_byte(REG_PROD_ID); +} + +uint8_t adns2080_revision_id_read(void) +{ + return sdio_read_byte(REG_REV_ID); +} + +adns2080_status_t adns2080_init(void) +{ + sdio_init(); + adns2080_reset(); + + if (adns2080_product_id_read() != ADNS2080_PRODUCT_ID) + { + return ADNS2080_CHIP_NOT_DETECTED; + } + + sdio_write_byte(REG_BURST_READ_FIRST, REG_DELTA_X); + sdio_write_byte(REG_BURST_READ_LAST, REG_DELTA_Y); + + return ADNS2080_OK; +} + +void adns2080_reset(void) +{ + sdio_write_byte(REG_RESET, ADNS2080_RESET_NUMBER); +} + +void adns2080_powerdown(void) +{ + sdio_write_byte(REG_MOUSE_CTRL, REG_MOUSE_CTRL_POWERDOWN); +} + +void adns2080_wakeup(void) +{ + adns2080_reset(); +} + +adns2080_status_t adns2080_motion_interrupt_set(motion_output_polarity_t polarity, motion_output_sensitivity_t sensitivity) +{ + uint8_t databyte = 0; + adns2080_status_t status = ADNS2080_OK; + + switch (polarity) + { + case ADNS2080_MOTION_OUTPUT_POLARITY_LOW: + databyte = 0; // Clear REG_MOTION_CTRL_MOT_A bit + break; + + case ADNS2080_MOTION_OUTPUT_POLARITY_HIGH: + databyte = REG_MOTION_CTRL_MOT_A; + break; + + default: + status = ADNS2080_INVALID_PARAMETER; + break; + } + + switch (sensitivity) + { + case ADNS2080_MOTION_OUTPUT_SENSITIVITY_LEVEL: + databyte &= ~(REG_MOTION_CTRL_MOT_S); + break; + + case ADNS2080_MOTION_OUTPUT_SENSITIVITY_EDGE: + databyte |= (REG_MOTION_CTRL_MOT_S); + break; + + default: + status = ADNS2080_INVALID_PARAMETER; + break; + } + + if (status == ADNS2080_OK) + { + sdio_write_byte(REG_MOTION_CTRL, databyte); + } + + return status; +} + +adns2080_status_t adns2080_resolution_set(adns2080_resolution_t resolution) +{ + uint8_t databyte = sdio_read_byte(REG_MOUSE_CTRL); + adns2080_status_t status = ADNS2080_OK; + + // Enable resolution settings on REG_MOUSE_CTRL [4:2] + databyte |= (REG_MOUSE_CTRL_RES_EN); + + switch (resolution) + { + case ADNS2080_RESOLUTION_250DPI: + case ADNS2080_RESOLUTION_500DPI: + case ADNS2080_RESOLUTION_1000DPI: + case ADNS2080_RESOLUTION_1250DPI: + case ADNS2080_RESOLUTION_1500DPI: + case ADNS2080_RESOLUTION_1750DPI: + case ADNS2080_RESOLUTION_2000DPI: + // Clear resolution bits [4:2] + databyte &= ~(0x1C); // 0b00011100; + // Set resolution bits + databyte |= (uint8_t)((uint8_t)resolution << 2); + break; + + default: + status = ADNS2080_INVALID_PARAMETER; + break; + } + + if (status == ADNS2080_OK) + { + sdio_write_byte(REG_MOUSE_CTRL, databyte); + } + + return status; +} + +adns2080_status_t adns2080_motion_bits_set(adns2080_motion_bits_t motion_bits) +{ + uint8_t databyte = sdio_read_byte(REG_MOUSE_CTRL); + adns2080_status_t status = ADNS2080_OK; + + switch (motion_bits) + { + case ADNS2080_MOTION_BITS_8: + databyte &= ~(REG_MOUSE_CTRL_BIT_REPORTING); + break; + + case ADNS2080_MOTION_BITS_12: + databyte |= (REG_MOUSE_CTRL_BIT_REPORTING); + break; + + default: + status = ADNS2080_INVALID_PARAMETER; + break; + } + + if (status == ADNS2080_OK) + { + sdio_write_byte(REG_MOUSE_CTRL, databyte); + } + + return status; +} + +void adns2080_rest_periods_set(uint8_t rest1_period, uint8_t rest2_period, uint8_t rest3_period) +{ + adns2080_mode_t current_mode = adns2080_force_mode_read(); + adns2080_force_mode_set(ADNS2080_MODE_RUN1); + sdio_write_byte(REG_REST1_PERIOD, rest1_period); + sdio_write_byte(REG_REST2_PERIOD, rest2_period); + sdio_write_byte(REG_REST3_PERIOD, rest3_period); + adns2080_force_mode_set(current_mode); +} + +void adns2080_downshift_times_set(uint8_t run_to_rest1_mode_time, uint8_t rest1_to_rest2_mode_time, uint8_t rest2_to_rest3_mode_time) +{ + adns2080_mode_t current_mode = adns2080_force_mode_read(); + adns2080_force_mode_set(ADNS2080_MODE_RUN1); + sdio_write_byte(REG_RUN_DOWNSHIFT, run_to_rest1_mode_time); + sdio_write_byte(REG_REST1_DOWNSHIFT, rest1_to_rest2_mode_time); + sdio_write_byte(REG_REST2_DOWNSHIFT, rest2_to_rest3_mode_time); + adns2080_force_mode_set(current_mode); +} + +adns2080_mode_t adns2080_force_mode_read(void) +{ + return (adns2080_mode_t)((sdio_read_byte(REG_PERFORMANCE) >> 4) & 0x07); +} + +void adns2080_force_mode_set(adns2080_mode_t mode) +{ + sdio_write_byte(REG_PERFORMANCE, (uint8_t)((uint8_t)mode << 4)); +} + +/*lint --flb "Leave library region" */ diff --git a/components/drivers_ext/adns2080/adns2080.h b/components/drivers_ext/adns2080/adns2080.h new file mode 100644 index 0000000..e69fdcd --- /dev/null +++ b/components/drivers_ext/adns2080/adns2080.h @@ -0,0 +1,281 @@ + /* Copyright (c) 2009 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 ADNS2080_H +#define ADNS2080_H + +/*lint ++flb "Enter library region" */ + +#include +#include + +/** @file +* @brief ADNS2080 mouse sensor driver +* +* @defgroup nrf_drivers_adns2080 ADNS2080 driver +* @{ +* @ingroup nrf_drivers +* @brief ADNS2080 mouse sensor driver. +*/ + +/** + * Describes return values for @ref adns2080_init. + */ +typedef enum +{ + ADNS2080_OK, /*!< Operation was succesful */ + ADNS2080_SERIAL_COMM_FAILURE, /*!< Serial communication failed */ + ADNS2080_CHIP_NOT_DETECTED, /*!< Product/Revision ID was not what was expected */ + ADNS2080_INVALID_PARAMETER /*!< Given parameters were not valid */ +} adns2080_status_t; + +/** + * ADNS2080 motion output pin polarity values. + */ +typedef enum +{ + ADNS2080_MOTION_OUTPUT_POLARITY_LOW = 0, /*!< Motion output polarity active low */ + ADNS2080_MOTION_OUTPUT_POLARITY_HIGH = 1 /*!< Motion output polarity active high */ +} motion_output_polarity_t; + +/** + * Motion output pin configuration. + */ +typedef enum +{ + ADNS2080_MOTION_OUTPUT_SENSITIVITY_LEVEL = 0, /*!< Motion output pin will be driven low/high (depending on the polarity setting) as long as there is motion data in DELTA registers */ + ADNS2080_MOTION_OUTPUT_SENSITIVITY_EDGE = 1 /*!< Motion output pin will be driven low/high (depending on the polarity setting) for 380 ns when motion is detected during rest modes */ +} motion_output_sensitivity_t; + +/** + * Mouse sensor resolution values. + */ +typedef enum +{ + ADNS2080_RESOLUTION_250DPI = 1, /*!< 250 dpi resolution */ + ADNS2080_RESOLUTION_500DPI = 2, /*!< 500 dpi resolution */ + ADNS2080_RESOLUTION_1000DPI = 0, /*!< 1000 dpi resolution */ + ADNS2080_RESOLUTION_1250DPI = 3, /*!< 1250 dpi resolution */ + ADNS2080_RESOLUTION_1500DPI = 4, /*!< 1500 dpi resolution */ + ADNS2080_RESOLUTION_1750DPI = 5, /*!< 1750 dpi resolution */ + ADNS2080_RESOLUTION_2000DPI = 6 /*!< 2000 dpi resolution */ +} adns2080_resolution_t; + +/** + * Mouse sensor forced mode options. + */ +typedef enum +{ + ADNS2080_MODE_NORMAL = 0, /*!< Normal operation mode */ + ADNS2080_MODE_REST1 = 1, /*!< Rest1 operation mode */ + ADNS2080_MODE_REST2 = 2, /*!< Rest2 operation mode */ + ADNS2080_MODE_REST3 = 3, /*!< Rest3 operation mode */ + ADNS2080_MODE_RUN1 = 4, /*!< Run1 operation mode */ + ADNS2080_MODE_RUN2 = 5, /*!< Run2 operation mode */ + ADNS2080_MODE_IDLE = 6 /*!< Idle operation mode */ +} adns2080_mode_t; + +/** + * Mouse sensor motion reporting bits. + */ +typedef enum +{ + ADNS2080_MOTION_BITS_8 = 0, /*!< Motion reporting uses 8 bits */ + ADNS2080_MOTION_BITS_12 = 1 /*!< Motion reporting uses 12 bits */ +} adns2080_motion_bits_t; + +/** + * @brief Function for initializing the mouse sensor chip. + * + * Valid mouse sensor information will be available 50 milliseconds after this + * function finishes. + * + * @return + * @retval ADNS2080_OK Mouse sensor was initialized succesfully. + * @retval ADNS2080_SERIAL_COMM_FAILURE Serial communications failure. + * @retval ADNS2080_CHIP_NOT_DETECTED Could not find revision 0 ADNS2080 chip. + */ +adns2080_status_t adns2080_init(void); + +/** + * @brief Function for resetting the mouse sensor chip. + * + * Valid mouse sensor information will be available 50 milliseconds after this + * function finishes. + * All register settings will be lost and need to be reloaded. + * + */ +void adns2080_reset(void); + +/** + * @brief Function for reading mouse sensor product ID. + * + * Chip is expected to be initialized before calling this function. + * Returned product ID should always be 0x2A. + * + * @return Product ID. + */ +uint8_t adns2080_product_id_read(void); + +/** + * @brief Function for reading mouse sensor revision ID. + * + * Chip is expected to be initialized before calling this function. + * + * @return Product ID. + */ +uint8_t adns2080_revision_id_read(void); // also note there is "not rev id" register + +/** + * @brief Function for powering down the mouse sensor. + * + * Chip is expected to be initialized before calling this function. + * Serial port should not be accessed during the power down. To exit the power + * down mode, @ref adns2080_wakeup must be called. + * + */ +void adns2080_powerdown(void); + +/** + * @brief Function for waking up the mouse sensor. + * + * After wakeup, all mouse sensor settings must be reloaded. Valid mouse sensor + * information will be available 55 milliseconds after this function finishes. + */ +void adns2080_wakeup(void); + +/** + * @brief Function for configuring the MOTION interrupt output pin. + * + * When motion is detected by the mouse sensor, the chip has a MOTION pin + * indicating there is motion data in DELTA_X and DELTA_Y registers. This + * function configures the polarity and sensitivity of that pin. + * + * Chip is expected to be initialized before calling this function. + * + * @param polarity MOTION output pin is either active LOW (default) or active HIGH + * @param sensitivity Level or Edge (default) sensitive + * @return + * @retval ADNS2080_OK Operation succeeded. + * @retval ADNS2080_INVALID_PARAMETER One of the parameters was not within valid range. + */ +adns2080_status_t adns2080_motion_interrupt_set(motion_output_polarity_t polarity, motion_output_sensitivity_t sensitivity); + +/** + * @brief Function for setting mouse sensor resolution. + * + * Chip is expected to be initialized before calling this function. + * + * @param resolution Desired resolution. + * @return + * @retval ADNS2080_OK Operation succeeded. + * @retval ADNS2080_INVALID_PARAMETER One of the parameters was not within valid range. + */ +adns2080_status_t adns2080_resolution_set(adns2080_resolution_t resolution); + +/** + * @brief Function for setting number of bits used for mouse sensor motion reporting. + * + * Chip is expected to be initialized before calling this function. + * + * @param motion_bits Desired number of bits. + * @return + * @retval ADNS2080_OK Operation succeeded. + * @retval ADNS2080_INVALID_PARAMETER One of the parameters was not within valid range. + */ +adns2080_status_t adns2080_motion_bits_set(adns2080_motion_bits_t motion_bits); + +/** + * @brief Function for reading number of bits used for mouse sensor motion reporting. + * + * Chip is expected to be initialized before calling this function. + * + * @return motion_bits Number of bits. + */ +adns2080_motion_bits_t adns2080_motion_bits_read(void); + +/** + * @brief Function for reading X- and Y-axis movement (in counts) since last report. + * + * Absolute value is determined by resolution. + * Chip is expected to be initialized before calling this function. + * + * @param p_delta_x Location to store X-axis movement + * @param p_delta_y Location to store Y-axis movement + */ +void adns2080_movement_read(int16_t *p_delta_x, int16_t *p_delta_y); + +/** + * @brief Function for checking if motion has been detected since last call. + * + * Chip is expected to be initialized before calling this function. + * + * @return + * @retval true, if movement has been detected + * @retval false, if no movement has been detected + */ +bool adns2080_is_motion_detected(void); + +/** + * @brief Function for setting mouse sensor Rest1, Rest2 and Rest3 mode motion detection time period. + * + * Allowed range for the periods is 0x01 to 0xFD. + * Resulting period is derived from the following equation : + * Period = (Rest period + 1) * 10 milliseconds + * Chip is expected to be initialized before calling this function. + * + * @param rest1_period Rest1 period + * @param rest2_period Rest2 period + * @param rest3_period Rest3 period + */ +void adns2080_rest_periods_set(uint8_t rest1_period, uint8_t rest2_period, uint8_t rest3_period); + +/** + * @brief Function for setting mouse sensor mode downshift time periods. + * + * Allowed range for run_to_rest1_mode_time period is 0x00 to 0xFF. + * Allowed range for rest1_to_rest2_mode_time period is 0x01 to 0xFF. + * Allowed range for rest2_to_rest3_mode_time period is 0x01 to 0xFF. + * + * Chip is expected to be initialized before calling this function. + * + * @param run_to_rest1_mode_time Run mode to Rest1 mode downshift time period (Time = run_to_rest1_mode_time * 8 * 4) + * @param rest1_to_rest2_mode_time Rest1 mode to Rest2 mode downshift time period (Time = rest1_to_rest2_mode_time * rest1_period * 16) + * @param rest2_to_rest3_mode_time Rest2 mode to Rest3 mode downshift time period (Time = rest2_to_rest3_mode_time * rest2_period * 128) + */ +void adns2080_downshift_times_set(uint8_t run_to_rest1_mode_time, uint8_t rest1_to_rest2_mode_time, uint8_t rest2_to_rest3_mode_time); + +/** + * @brief Function for forcing mouse sensor to a certain operating mode. + * + * Chip is expected to be initialized before calling this function. + * Normal operation will not continue until this function is called with ADNS2080_MODE_NORMAL parameter. + * + * @param mode Mode to force the sensor to. + */ +void adns2080_force_mode_set(adns2080_mode_t mode); + +/** + * @brief Function for reading the current forced operating mode. + * + * Chip is expected to be initialized before calling this function. + * + * @return Mode the sensor is forced to. + */ +adns2080_mode_t adns2080_force_mode_read(void); + +/** + *@} + **/ + +/*lint --flb "Leave library region" */ +#endif diff --git a/components/drivers_ext/cherry8x16/cherry8x16.c b/components/drivers_ext/cherry8x16/cherry8x16.c new file mode 100644 index 0000000..3e106bb --- /dev/null +++ b/components/drivers_ext/cherry8x16/cherry8x16.c @@ -0,0 +1,448 @@ +/* Copyright (c) 2009 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 + +#include "cherry8x16.h" +#include "nrf.h" + +#define CHERRY8x16_NUM_OF_COLUMNS 16 // !< Number of columns in the keyboard matrix +#define CHERRY8x16_NUM_OF_ROWS 8 // !< Number of rows in the keyboard matrix + +#define MODIFIER_HID_START 0xE0 +#define MODIFIER_HID_END 0xE7 +static uint8_t m_currently_pressed_keys[CHERRY8x16_MAX_NUM_OF_PRESSED_KEYS]; //!< Array holding currently pressed keys. Filled up from index 0. Values are +static uint8_t m_transmitted_keys[CHERRY8x16_MAX_NUM_OF_PRESSED_KEYS]; //!< Array holding the keys that have already been transmitted. +static uint8_t m_num_of_currently_pressed_keys; //!< Number of keys in m_currently_pressed_keys +static uint8_t m_number_of_transmitted_keys; //!< Number of keys in m_transmitted_keys + +static uint8_t m_key_packet[KEY_PACKET_SIZE]; //!< Stores last created key packet. One byte is used for modifier keys, one for OEMs. Key values are USB HID keycodes. + +static const uint8_t volatile * m_row_port; //!< Pointer to location where row IO can be read +static uint16_t volatile * m_column_port; //!< Pointer to location where column IO can be written +static const uint8_t * matrix_lookup; //!< Pointer to the key lookup matrix in use + +/** Table containing the mapping between the key matrix and the HID Usage codes for each key. */ +static const uint8_t default_matrix_lookup[CHERRY8x16_NUM_OF_COLUMNS * CHERRY8x16_NUM_OF_ROWS] = +{ + 0xE7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xE3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xE1, 0xE6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xE2, 0xE5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x29, 0x3E, 0x3D, 0x3C, 0x3B, 0x3A, 0x3F, 0x40, + 0x1E, 0x23, 0x22, 0x21, 0x20, 0x1F, 0x24, 0x25, + 0x4F, 0x43, 0x47, 0x53, 0x46, 0x48, 0x42, 0x41, + 0x51, 0x2D, 0x2E, 0x2A, 0x00, 0x4A, 0x27, 0x26, + 0x52, 0x13, 0x2F, 0x30, 0x00, 0x4B, 0x12, 0x0C, + 0x50, 0x33, 0x34, 0x32, 0x28, 0x4E, 0x0F, 0x0E, + 0x2C, 0x38, 0x4C, 0x49, 0x65, 0x4D, 0x37, 0x36, + 0x35, 0x05, 0x19, 0x06, 0x1B, 0x1D, 0x11, 0x10, + 0x39, 0x0A, 0x09, 0x07, 0x16, 0x04, 0x0B, 0x0D, + 0x2B, 0x17, 0x15, 0x08, 0x1A, 0x14, 0x1C, 0x18 +}; + +static bool cherry8x16_have_keys_changed(const uint8_t * state_now, + uint8_t number_of_now_pressed_keys, + const uint8_t * state_before, + uint8_t number_of_before_pressed_keys); +static bool cherry8x16_keymatrix_read(uint8_t * pressed_keys, uint8_t * number_of_pressed_keys); +static void cherry8x16_keypacket_addkey(uint8_t key); +static void cherry8x16_keypacket_create(uint8_t * key_packet, uint8_t key_packet_size); +static void cherry8x16_remap_fn_keys(uint8_t * keys, uint8_t number_of_keys); +static uint8_t cherry8x16_row_read(void); + +cherry8x16_status_t cherry8x16_init(const uint8_t volatile * row_port, + uint16_t * column_port, + const uint8_t * key_lookup_matrix) +{ + cherry8x16_status_t status = CHERRY8x16_OK; + + if (row_port == 0 || column_port == 0) + { + status = CHERRY8x16_INVALID_PARAMETER; + } + else + { + m_row_port = row_port; + m_column_port = column_port; + + *m_column_port = 0x0000; + if (*m_row_port != 0x00) + { + status = CHERRY8x16_NOT_DETECTED; + } + else + { + m_num_of_currently_pressed_keys = 0; + m_number_of_transmitted_keys = 0; + + for (uint_fast8_t i = CHERRY8x16_MAX_NUM_OF_PRESSED_KEYS; i--;) + { + m_currently_pressed_keys[i] = 0; + m_transmitted_keys[i] = 0; + } + } + + if (key_lookup_matrix == CHERRY8x16_DEFAULT_KEY_LOOKUP_MATRIX) + { + matrix_lookup = default_matrix_lookup; + } + else + { + matrix_lookup = key_lookup_matrix; + } + } + + return status; +} + +bool cherry8x16_new_packet(const uint8_t ** p_key_packet, uint8_t * p_key_packet_size) +{ + bool new_packet_prepared; + + // Save currently pressed keys + for (uint_fast8_t i = CHERRY8x16_MAX_NUM_OF_PRESSED_KEYS; i--; ) + { + m_transmitted_keys[i] = m_currently_pressed_keys[i]; + } + m_number_of_transmitted_keys = m_num_of_currently_pressed_keys; + + // Create a new packet if key states have changed and there are no keys blocking each other (ghosting/phantom keys) + if (cherry8x16_keymatrix_read(m_currently_pressed_keys, &m_num_of_currently_pressed_keys)) + { + if (cherry8x16_have_keys_changed(m_currently_pressed_keys, m_num_of_currently_pressed_keys, + m_transmitted_keys, m_number_of_transmitted_keys)) + { + cherry8x16_keypacket_create(&m_key_packet[0], KEY_PACKET_SIZE); + *p_key_packet = &m_key_packet[0]; + *p_key_packet_size = KEY_PACKET_SIZE; + new_packet_prepared = true; + } + else + { + // The same keys are still pressed, no need to create a new packet + new_packet_prepared = false; + } + } + else + { + // Ghosting detected. Don't create a packet. + new_packet_prepared = false; + } + + return new_packet_prepared; +} + + +/** + * @brief Function for reading and returning keyboard matrix row state. + * + * @return uint8_t Row state + */ +static uint8_t cherry8x16_row_read(void) +{ + return *m_row_port; +} + + +/** + * @brief Function for reading the keyboard matrix state and stores the pressed keys to an array. + * + * This function resolves keys from the matrix and finds their corresponding HID usage codes + * If there are any ghost key conditions the packet will be discarded + * @param pressed_keys Array holding pressed keys. Must be at least CHERRY8x16_MAX_NUM_OF_PRESSED_KEYS in size. + * @param number_of_pressed_keys Pointer to variable where number of pressed keys will be stored. + * @return + * @retval true If no keys were blocking each other. + * @retval false If some keys were blocking each other o rno key is pressed. + */ +static bool cherry8x16_keymatrix_read(uint8_t * pressed_keys, uint8_t * number_of_pressed_keys) +{ + uint_fast8_t row_state[CHERRY8x16_NUM_OF_COLUMNS]; + uint_fast8_t blocking_mask = 0; + + *number_of_pressed_keys = 0; + + for (uint_fast8_t column = CHERRY8x16_NUM_OF_COLUMNS; column--;) + { + // drive column under test + *m_column_port = (uint16_t)(1UL << column); + row_state[column] = cherry8x16_row_read(); + + // Check if any keys are pressed + if (row_state[column] != 0) + { + uint_fast8_t detected_keypresses_on_column = 0; + + // Loop through rows, check for active rows and add pressed keys to the array + for (uint_fast8_t row = CHERRY8x16_NUM_OF_ROWS; row--;) + { + if (row_state[column] & (1U << row)) + { + if (*number_of_pressed_keys < CHERRY8x16_MAX_NUM_OF_PRESSED_KEYS) + { + *pressed_keys = matrix_lookup[column * CHERRY8x16_NUM_OF_ROWS + row]; + pressed_keys++; + (*number_of_pressed_keys)++; + } + detected_keypresses_on_column++; + } + } + + if (detected_keypresses_on_column > 1) + { + if (blocking_mask & row_state[column]) + { + // Cannot determine reliably all pressed keys, two or more keys are blocking each other. + return false; + } + } + blocking_mask |= row_state[column]; + } + } + + return true; +} + + +/** + * @brief Function for remapping the keypad, F11 and F12 keys in case when Fn key is pressed. + * + * @param keys Array holding pressed keys. + * @param number_of_keys Number of elements if 'keys' array. + */ +static void cherry8x16_remap_fn_keys(uint8_t * keys, uint8_t number_of_keys) +{ + + /*lint -e845 -save // A zero has been given as right argument to operator '<<'" */ + /*lint -e778 -save // Constant expression evaluates to zero */ + +#define MODIFIER_LEFT_CONTROL_HID 0xE0 +#define MODIFER_RIGHT_CONTROL_HID 0xE4 + // Check if Fn key is pressed along with any other modifier key (only usage now is Fn+Left_Ctrl = Right Ctrl) + // So we modify the modifier byte if Fn+Left_Ctrl is pressed, HID for left_Ctrl = 0xE0 + if ( keys[0] & (1UL << (MODIFIER_LEFT_CONTROL_HID - MODIFIER_HID_START)) ) + { + keys[0] &= ~(1UL << (MODIFIER_LEFT_CONTROL_HID - MODIFIER_HID_START)); + keys[0] |= (1UL << (MODIFER_RIGHT_CONTROL_HID - MODIFIER_HID_START)); + } + + /*lint -restore */ + /*lint -restore */ + + for (uint_fast8_t i = 2; i < number_of_keys; i++) + { + switch (keys[i]) + { + case 0x10: // 'M' + keys[i] = 0x62; // Keypad 0 + break; + + case 0x37: // '>' + keys[i] = 0x63; // Keypad . + break; + + case 0x38: // '/' + keys[i] = 0x54; // Keypad / + break; + + case 0x0D: // 'J' + keys[i] = 0x59; // Keypad 1 + break; + + case 0x0E: // 'K' + keys[i] = 0x5A; // Keypad 2 + break; + + case 0x0F: // 'L' + keys[i] = 0x5B; // Keypad 3 + break; + + case 0x33: // '' + keys[i] = 0x57; // Keypad + + break; + + case 0x28: // 'Enter' + keys[i] = 0x58; // Keypad enter + break; + + case 0x18: // 'U' + keys[i] = 0x5C; // Keypad 4 + break; + + case 0x0C: // 'I' + keys[i] = 0x5D; // Keypad 5 + break; + + case 0x12: // 'O' + keys[i] = 0x5E; // Keypad 6 + break; + + case 0x13: // 'P' + keys[i] = 0x56; // Keypad - + break; + + case 0x24: // '7' + keys[i] = 0x5F; // Keypad 7 + break; + + case 0x25: // '8' + keys[i] = 0x60; // Keypad 8 + break; + + case 0x26: // '9' + keys[i] = 0x61; // Keypad 9 + break; + + case 0x27: // '0' + keys[i] = 0x55; // Keypad * + break; + + case 0x3A: // 'F1' + keys[i] = 0x44; // 'F11' + break; + + case 0x3B: // 'F2' + keys[i] = 0x45; // 'F12' + break; + + default: + break; + } + } +} + + +/** + * @brief Function for determining whether the keyboard matrix state has changed compared to the state before. + * + * @param state_now List of pressed keys in current state + * @param number_of_now_pressed_keys Number of pressed keys in current state + * @param state_before List of pressed keys in previous state + * @param number_of_before_pressed_keys Number of pressed keys in previous state + * @return + * @retval true If keyboard matrix is different compared to state before. + * @retval false If keyboard matrix is the same compared to state before. + */ +static bool cherry8x16_have_keys_changed(const uint8_t * state_now, + uint8_t number_of_now_pressed_keys, + const uint8_t * state_before, + uint8_t number_of_before_pressed_keys) +{ + if (number_of_now_pressed_keys != number_of_before_pressed_keys) + { + return true; + } + else + { + for (uint_fast8_t i = number_of_now_pressed_keys; i--;) + { + if (state_now[i] != state_before[i]) + { + return true; + } + } + } + return false; +} + +/** + * @brief Function for adding a key to the key packet. + * + * If key is found to be in the packet, it will not be added twice. + * Attempts to add more keys than the buffer capacity allows will be silently ignored. + * + * @param key Key to add + */ +static void cherry8x16_keypacket_addkey(uint8_t key) +{ + for (uint_fast8_t i = KEY_PACKET_KEY_INDEX; i < KEY_PACKET_SIZE; i++) + { + if (m_key_packet[i] == key) + { + return; + } + } + + for (uint_fast8_t i = KEY_PACKET_KEY_INDEX; i < KEY_PACKET_SIZE; i++) + { + if (m_key_packet[i] == KEY_PACKET_NO_KEY) + { + m_key_packet[i] = key; + return; + } + } +} + +/** + * @brief Function for creating a new key packet. + * + * This function uses @ref m_currently_pressed_keys to determine pressed keys. + * Priority is given to those keys that were found in the previous packet. + * All modifier keys can be found in all packets. + * If Fn key is detected to be pressed, some keys are remapped to different functions. + * + * @param key_packet Pointer to location where packet contents will be put + * @param key_packet_size Key packet size in bytes + */ +static void cherry8x16_keypacket_create(uint8_t * key_packet, uint8_t key_packet_size) +{ + // Clear key_packet contents + for (uint_fast8_t i = KEY_PACKET_KEY_INDEX; i < key_packet_size; i++) + { + key_packet[i] = KEY_PACKET_NO_KEY; + } + key_packet[KEY_PACKET_MODIFIER_KEY_INDEX] = 0; + key_packet[KEY_PACKET_RESERVED_INDEX] = 0; + + // Give priority to keys that were already pressed when we transmitted them the last time. + for (uint_fast8_t i = 0; i < m_number_of_transmitted_keys; i++) + { + for (uint_fast8_t j = 0; j < m_num_of_currently_pressed_keys; j++) + { + if (m_transmitted_keys[i] == m_currently_pressed_keys[j]) + { + cherry8x16_keypacket_addkey(m_currently_pressed_keys[j]); + break; + } + } + } + + bool fn_key_is_set = false; + + // Detect if Fn is pressed, detect modifier keys, and add rest of the keys to the packet + for (uint_fast8_t i = 0; i < m_num_of_currently_pressed_keys; i++) + { + if (m_currently_pressed_keys[i] == 0xFF) // Pressing Fn key changes function of certain keys and it must handled by the firmware + { + fn_key_is_set = true; + } + // Modifier HID usage codes are from 0xE0 to 0xE7 + else if (m_currently_pressed_keys[i] >= MODIFIER_HID_START && m_currently_pressed_keys[i] <= MODIFIER_HID_END) // Detect and set modifier keys + { + key_packet[KEY_PACKET_MODIFIER_KEY_INDEX] |= (uint8_t)(1U << (m_currently_pressed_keys[i] - MODIFIER_HID_START)); + } + else if (m_currently_pressed_keys[i] != 0) + { + cherry8x16_keypacket_addkey(m_currently_pressed_keys[i]); + } + } + + if (fn_key_is_set) + { + cherry8x16_remap_fn_keys(&key_packet[0], KEY_PACKET_MAX_KEYS); + } +} diff --git a/components/drivers_ext/cherry8x16/cherry8x16.h b/components/drivers_ext/cherry8x16/cherry8x16.h new file mode 100644 index 0000000..43f8e18 --- /dev/null +++ b/components/drivers_ext/cherry8x16/cherry8x16.h @@ -0,0 +1,83 @@ + /* Copyright (c) 2009 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 CHERRY8x16_H +#define CHERRY8x16_H + +/*lint ++flb "Enter library region" */ + +#include +#include + +/** @file +* @brief Cherry 8x16 keyboard matrix driver +* +* +* @defgroup nrf_drivers_cherry8x16 Cherry 8x16 keyboard matrix driver +* @{ +* @ingroup nrf_drivers +* @brief Cherry 8x16 keyboard matrix driver. +*/ + +#define CHERRY8x16_MAX_NUM_OF_PRESSED_KEYS 6 //!< Maximum number of pressed keys kept in buffers +#define CHERRY8x16_DEFAULT_KEY_LOOKUP_MATRIX (const uint8_t*)0 //!< If passed to @ref cherry8x16_init, default lookup matrix will be used + +#define KEY_PACKET_MODIFIER_KEY_INDEX (0) //!< Index in the key packet where modifier keys such as ALT and Control are stored +#define KEY_PACKET_RESERVED_INDEX (1) //!< Index in the key packet where OEMs can store information +#define KEY_PACKET_KEY_INDEX (2) //!< Start index in the key packet where pressed keys are stored +#define KEY_PACKET_MAX_KEYS (6) //!< Maximum number of keys that can be stored into the key packet +#define KEY_PACKET_SIZE (KEY_PACKET_KEY_INDEX+KEY_PACKET_MAX_KEYS) //!< Total size of the key packet in bytes +#define KEY_PACKET_NO_KEY (0) //!< Value to be stored to key index to indicate no key is pressed + + +/** + * Describes return values for: + * @ref cherry8x16_init + */ +typedef enum +{ + CHERRY8x16_OK, /*!< Operation was succesful. */ + CHERRY8x16_NOT_DETECTED, /*!< Product/Revision ID was not what was expected */ + CHERRY8x16_INVALID_PARAMETER /*!< Given parameters were not valid */ +} cherry8x16_status_t; + +/** + * @brief Function for initializing the driver. + * + * @note Before calling this function, setup row_port as IO inputs with pulldowns enabled and column_port as IO outputs. + * + * @param row_port Pointer to GPIO port address that is used as key matrix row input. + * @param column_port Pointer to GPIO port address that is used as key matrix column output. + * @param key_lookup_matrix If NULL, use a default key lookup matrix. Otherwise pointer to a 128 (8x16) element array containing HID keycodes. + * @return + * @retval CHERRY8X16_OK Peripheral was initialized succesfully. + * @retval CHERRY8X16_NOT_DETECTED Could not detect the peripheral. + */ +cherry8x16_status_t cherry8x16_init(const uint8_t volatile * row_port, uint16_t * column_port, const uint8_t * key_lookup_matrix); + +/** + * @brief Function for creating a new key packet if new data is available and key ghosting is not detected. + * + * @param p_key_packet Array that will hold the created key packet. Previously created packet will be discarded. + * @param p_key_packet_size Key packet size in bytes. + * @return + * @retval true If new packet was created. + * @retval false If packet was not created. + */ +bool cherry8x16_new_packet(const uint8_t ** p_key_packet, uint8_t *p_key_packet_size); + +/** + *@} + **/ + +/*lint --flb "Leave library region" */ +#endif diff --git a/components/drivers_ext/ds1624/ds1624.c b/components/drivers_ext/ds1624/ds1624.c new file mode 100644 index 0000000..21916d7 --- /dev/null +++ b/components/drivers_ext/ds1624/ds1624.c @@ -0,0 +1,127 @@ +/* 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 "ds1624.h" +#include "twi_master.h" +#include "nrf_delay.h" + +/*lint ++flb "Enter library region" */ + +#define DS1634_BASE_ADDRESS 0x90 //!< 4 MSBs of the DS1624 TWI address + +#define DS1624_ONESHOT_MODE 0x01 //!< Bit in configuration register for 1-shot mode +#define DS1624_CONVERSION_DONE 0x80 //!< Bit in configuration register to indicate completed temperature conversion + +static uint8_t m_device_address; //!< Device address in bits [7:1] + +const uint8_t command_access_memory = 0x17; //!< Reads or writes to 256-byte EEPROM memory +const uint8_t command_access_config = 0xAC; //!< Reads or writes configuration data to configuration register +const uint8_t command_read_temp = 0xAA; //!< Reads last converted temperature value from temperature register +const uint8_t command_start_convert_temp = 0xEE; //!< Initiates temperature conversion. +const uint8_t command_stop_convert_temp = 0x22; //!< Halts temperature conversion. + +/** + * @brief Function for reading the current configuration of the sensor. + * + * @return uint8_t Zero if communication with the sensor failed. Contents (always non-zero) of configuration register (@ref DS1624_ONESHOT_MODE and @ref DS1624_CONVERSION_DONE) if communication succeeded. + */ +static uint8_t ds1624_config_read(void) +{ + uint8_t config = 0; + + // Write: command protocol + if (twi_master_transfer(m_device_address, (uint8_t*)&command_access_config, 1, TWI_DONT_ISSUE_STOP)) + { + if (twi_master_transfer(m_device_address | TWI_READ_BIT, &config, 1, TWI_ISSUE_STOP)) // Read: current configuration + { + // Read succeeded, configuration stored to variable "config" + } + else + { + // Read failed + config = 0; + } + } + + return config; +} + +bool ds1624_init(uint8_t device_address) +{ + bool transfer_succeeded = true; + m_device_address = DS1634_BASE_ADDRESS + (uint8_t)(device_address << 1); + + uint8_t config = ds1624_config_read(); + + if (config != 0) + { + // Configure DS1624 for 1SHOT mode if not done so already. + if (!(config & DS1624_ONESHOT_MODE)) + { + uint8_t data_buffer[2]; + + data_buffer[0] = command_access_config; + data_buffer[1] = DS1624_ONESHOT_MODE; + + transfer_succeeded &= twi_master_transfer(m_device_address, data_buffer, 2, TWI_ISSUE_STOP); + } + } + else + { + transfer_succeeded = false; + } + + return transfer_succeeded; +} + +bool ds1624_start_temp_conversion(void) +{ + return twi_master_transfer(m_device_address, (uint8_t*)&command_start_convert_temp, 1, TWI_ISSUE_STOP); +} + +bool ds1624_is_temp_conversion_done(void) +{ + uint8_t config = ds1624_config_read(); + + if (config & DS1624_CONVERSION_DONE) + { + return true; + } + else + { + return false; + } +} + +bool ds1624_temp_read(int8_t * temperature_in_celcius, int8_t * temperature_fraction) +{ + bool transfer_succeeded = false; + + // Write: Begin read temperature command + if (twi_master_transfer(m_device_address, (uint8_t*)&command_read_temp, 1, TWI_DONT_ISSUE_STOP)) + { + uint8_t data_buffer[2]; + + // Read: 2 temperature bytes to data_buffer + if (twi_master_transfer(m_device_address | TWI_READ_BIT, data_buffer, 2, TWI_ISSUE_STOP)) + { + *temperature_in_celcius = (int8_t)data_buffer[0]; + *temperature_fraction = (int8_t)data_buffer[1]; + + transfer_succeeded = true; + } + } + + return transfer_succeeded; +} + +/*lint --flb "Leave library region" */ diff --git a/components/drivers_ext/ds1624/ds1624.h b/components/drivers_ext/ds1624/ds1624.h new file mode 100644 index 0000000..7441977 --- /dev/null +++ b/components/drivers_ext/ds1624/ds1624.h @@ -0,0 +1,77 @@ + /* Copyright (c) 2009 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 DS1624_H +#define DS1624_H + +/*lint ++flb "Enter library region" */ + +#include +#include + +/** @file +* @brief DS1624 digital temperature sensor driver. +* +* +* @defgroup nrf_drivers_ds1624 DS1624 digital temperature sensor driver +* @{ +* @ingroup nrf_drivers +* @brief DS1624 digital temperature sensor driver. +*/ + +/** + * @brief Function for initializing DS1624 temperature sensor to 1-shot mode. + * + * @note Before calling this function, you must initialize twi_master first. + * + * @param device_address Bits [2:0] for the device address. All other bits must be zero. + * @return + * @retval true If communication succeeded with the device. + * @retval false If communication failed with the device. + */ +bool ds1624_init(uint8_t device_address); + +/** + * @brief Function for reading temperature from the sensor. + * + * @param temperature_in_celcius Memory location to store temperature in full celcius degrees. + * @param temperature_fraction Memory location to store temperature's fraction part in 0.03125 celcius degree increments. + * @return + * @retval true Temperature was successfully read + * @retval false Temperature reading failed or conversion was not yet complete + */ +bool ds1624_temp_read(int8_t *temperature_in_celcius, int8_t *temperature_fraction); + +/** + * @brief Function for starting temperature conversion. Valid data will be available 400-1000 milliseconds after exiting this function. + * + * @return + * @retval true Temperature conversion started. + * @retval false Temperature converion failed to start. +*/ +bool ds1624_start_temp_conversion(void); + +/** + * @brief Function for checking if temperature conversion is done. + * + * @return + * @retval true Temperature conversion done. + * @retval false Temperature converion still in progress. +*/ +bool ds1624_is_temp_conversion_done(void); + +/** + *@} + **/ + +/*lint --flb "Leave library region" */ +#endif diff --git a/components/drivers_ext/mpu6050/mpu6050.c b/components/drivers_ext/mpu6050/mpu6050.c new file mode 100644 index 0000000..9be6aeb --- /dev/null +++ b/components/drivers_ext/mpu6050/mpu6050.c @@ -0,0 +1,81 @@ +/* Copyright (c) 2009 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 + +#include "twi_master.h" +#include "mpu6050.h" + +/*lint ++flb "Enter library region" */ + +#define ADDRESS_WHO_AM_I (0x75U) // !< WHO_AM_I register identifies the device. Expected value is 0x68. +#define ADDRESS_SIGNAL_PATH_RESET (0x68U) // !< + +static const uint8_t expected_who_am_i = 0x68U; // !< Expected value to get from WHO_AM_I register. +static uint8_t m_device_address; // !< Device address in bits [7:1] + +bool mpu6050_init(uint8_t device_address) +{ + bool transfer_succeeded = true; + + m_device_address = (uint8_t)(device_address << 1); + + // Do a reset on signal paths + uint8_t reset_value = 0x04U | 0x02U | 0x01U; // Resets gyro, accelerometer and temperature sensor signal paths. + transfer_succeeded &= mpu6050_register_write(ADDRESS_SIGNAL_PATH_RESET, reset_value); + + // Read and verify product ID + transfer_succeeded &= mpu6050_verify_product_id(); + + return transfer_succeeded; +} + +bool mpu6050_verify_product_id(void) +{ + uint8_t who_am_i; + + if (mpu6050_register_read(ADDRESS_WHO_AM_I, &who_am_i, 1)) + { + if (who_am_i != expected_who_am_i) + { + return false; + } + else + { + return true; + } + } + else + { + return false; + } +} + +bool mpu6050_register_write(uint8_t register_address, uint8_t value) +{ + uint8_t w2_data[2]; + + w2_data[0] = register_address; + w2_data[1] = value; + return twi_master_transfer(m_device_address, w2_data, 2, TWI_ISSUE_STOP); +} + +bool mpu6050_register_read(uint8_t register_address, uint8_t * destination, uint8_t number_of_bytes) +{ + bool transfer_succeeded; + transfer_succeeded = twi_master_transfer(m_device_address, ®ister_address, 1, TWI_DONT_ISSUE_STOP); + transfer_succeeded &= twi_master_transfer(m_device_address|TWI_READ_BIT, destination, number_of_bytes, TWI_ISSUE_STOP); + return transfer_succeeded; +} + +/*lint --flb "Leave library region" */ diff --git a/components/drivers_ext/mpu6050/mpu6050.h b/components/drivers_ext/mpu6050/mpu6050.h new file mode 100644 index 0000000..e9d89f5 --- /dev/null +++ b/components/drivers_ext/mpu6050/mpu6050.h @@ -0,0 +1,74 @@ +/* Copyright (c) 2009 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 MPU6050_H +#define MPU6050_H + +/*lint ++flb "Enter library region" */ + +#include +#include + +/** @file +* @brief MPU6050 gyro/accelerometer driver. +* +* +* @defgroup nrf_drivers_mpu6050 MPU6050 gyro/accelerometer driver +* @{ +* @ingroup nrf_drivers +* @brief MPU6050 gyro/accelerometer driver. +*/ + +/** + * @brief Function for initializing MPU6050 and verifies it's on the bus. + * + * @param device_address Device TWI address in bits [6:0]. + * @return + * @retval true MPU6050 found on the bus and ready for operation. + * @retval false MPU6050 not found on the bus or communication failure. + */ +bool mpu6050_init(uint8_t device_address); + +/** + @brief Function for writing a MPU6050 register contents over TWI. + @param[in] register_address Register address to start writing to + @param[in] value Value to write to register + @retval true Register write succeeded + @retval false Register write failed +*/ +bool mpu6050_register_write(uint8_t register_address, const uint8_t value); + +/** + @brief Function for reading MPU6050 register contents over TWI. + Reads one or more consecutive registers. + @param[in] register_address Register address to start reading from + @param[in] number_of_bytes Number of bytes to read + @param[out] destination Pointer to a data buffer where read data will be stored + @retval true Register read succeeded + @retval false Register read failed +*/ +bool mpu6050_register_read(uint8_t register_address, uint8_t *destination, uint8_t number_of_bytes); + +/** + @brief Function for reading and verifying MPU6050 product ID. + @retval true Product ID is what was expected + @retval false Product ID was not what was expected +*/ +bool mpu6050_verify_product_id(void); + +/** + *@} + **/ + +/*lint --flb "Leave library region" */ + +#endif /* MPU6050_H */ diff --git a/components/drivers_ext/nrf6350/nrf6350.c b/components/drivers_ext/nrf6350/nrf6350.c new file mode 100644 index 0000000..225bc3b --- /dev/null +++ b/components/drivers_ext/nrf6350/nrf6350.c @@ -0,0 +1,278 @@ +/* Copyright (c) 2008-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 "nrf6350.h" +#include "nrf_delay.h" +#include "twi_master.h" + +/*lint ++flb "Enter library region" */ + +#define DDRAM_ADR 0x80 //!< Write to DDRAM AC +#define DDRAM_WR 0x40 //!< Write to DDRAM +#define FUNC_SET 0x00 //!< Enter LCD Function settings +#define LCD_ADDR 0x3E //!< LCD display adr +#define JS_ADDR 0x3F //!< Joystick adr + +#define X 0 //!< X direction in pos 0 of joystick array +#define Y 1 //!< Y direction in pos 1 of joystick array + + +//static void nrf6350_nrf6350_lcd_set_instruction(uint8_t instr); + +#define BUF_LEN 32 //!< LCD data buffer length +static uint8_t data_buffer[BUF_LEN]; //!< LCD data buffer +static uint8_t empty_str[18] = {DDRAM_WR, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '}; //!< Blank line + + +static bool nrf6350_lcd_set_instruction(uint8_t instr) +{ + nrf_delay_us(10000); + data_buffer[0] = FUNC_SET; + data_buffer[1] = instr; + return twi_master_transfer(LCD_ADDR << 1, data_buffer, 2, TWI_ISSUE_STOP); +} + +bool nrf6350_lcd_clear(void) +{ + nrf_delay_us(10000); + data_buffer[0] = FUNC_SET; + data_buffer[1] = (uint8_t)(DDRAM_ADR + LCD_UPPER_LINE); + if (!twi_master_transfer(LCD_ADDR << 1, data_buffer, 2, TWI_ISSUE_STOP)) + return false; + if (!twi_master_transfer(LCD_ADDR << 1, empty_str, 18, TWI_ISSUE_STOP)) + { + return false; + } + data_buffer[1] = DDRAM_ADR + LCD_LOWER_LINE; + if (!twi_master_transfer(LCD_ADDR << 1, data_buffer, 2, TWI_ISSUE_STOP)) + return false; + if (!twi_master_transfer(LCD_ADDR << 1, empty_str, 18, TWI_ISSUE_STOP)) + return false; + return true; +} + +bool nrf6350_lcd_set_contrast(uint8_t contrast) +{ + nrf_delay_us(10000); + data_buffer[0] = FUNC_SET; + data_buffer[1] = 0x70 | contrast; + return twi_master_transfer(LCD_ADDR << 1, data_buffer, 2, TWI_ISSUE_STOP); +} + +bool nrf6350_lcd_on(void) +{ + nrf_delay_us(10000); + data_buffer[0] = FUNC_SET; + data_buffer[1] = 0x0C; + return twi_master_transfer(LCD_ADDR << 1, data_buffer, 2, TWI_ISSUE_STOP); +} + +bool nrf6350_lcd_off(void) +{ + nrf_delay_us(10000); + data_buffer[0] = FUNC_SET; + data_buffer[1] = 0x08; + return twi_master_transfer(LCD_ADDR << 1, data_buffer, 2, TWI_ISSUE_STOP); +} + +bool nrf6350_lcd_init(void) +{ + if (!twi_master_init()) + { + return false; + } + + // Sometimes the first command doesn't get through, so we'll try + // sending non-important "wake up" command first and don't care if it fails. + (void)nrf6350_lcd_wake_up(); + + if (!nrf6350_lcd_set_instruction(0x38)) // Function set. + return false; + if (!nrf6350_lcd_set_instruction(0x39)) // Choose two-line mode. + return false; + if (!nrf6350_lcd_set_instruction(0x14)) // Internal OSC frequency. + return false; + if (!nrf6350_lcd_set_contrast(LCD_CONTRAST_HIGH)) // Contrast set (low byte). + return false; + if (!nrf6350_lcd_set_instruction(0x5F)) // Power/ICON control/. + return false; + if (!nrf6350_lcd_set_instruction(0x6A)) // Follower control. + return false; + nrf_delay_us(200000); // Need to wait 200ms here according to datasheet. + if (!nrf6350_lcd_on()) // Display ON. + return false; + if (!nrf6350_lcd_clear()) // Clear display. + return false; + return nrf6350_lcd_set_instruction(0x06); // Entry mode set. +} + +bool nrf6350_lcd_write_string(const char *p_text, uint8_t size, uint8_t line, uint8_t pos) +{ + uint8_t i; + + data_buffer[0] = FUNC_SET; + data_buffer[1] = DDRAM_ADR + (pos + line); + if (!twi_master_transfer(LCD_ADDR << 1, data_buffer, 2, TWI_ISSUE_STOP)) + return false; + if (!twi_master_transfer(LCD_ADDR << 1, empty_str, 18 - pos, TWI_ISSUE_STOP)) + return false; + data_buffer[0] = FUNC_SET; + data_buffer[1] = DDRAM_ADR + (pos + line); + if (!twi_master_transfer(LCD_ADDR << 1, data_buffer, 2, TWI_ISSUE_STOP)) + return false; + data_buffer[0] = DDRAM_WR; + for (i=0;iTXD = *data++; + NRF_TWI1->TASKS_STARTTX = 1; + + /** @snippet [TWI HW master write] */ + while (true) + { + while (NRF_TWI1->EVENTS_TXDSENT == 0 && (--timeout)) + { + // Do nothing. + } + + if (timeout == 0) + { + NRF_TWI1->EVENTS_STOPPED = 0; + NRF_TWI1->TASKS_STOP = 1; + + /* Wait until stop sequence is sent */ + while (NRF_TWI1->EVENTS_STOPPED == 0) + { + // Do nothing. + } + + /* Timeout before receiving event*/ + return false; + } + + NRF_TWI1->EVENTS_TXDSENT = 0; + if (--data_length == 0) + { + break; + } + + NRF_TWI1->TXD = *data++; + } + /** @snippet [TWI HW master write] */ + + if (issue_stop_condition) + { + NRF_TWI1->EVENTS_STOPPED = 0; + NRF_TWI1->TASKS_STOP = 1; + + /* Wait until stop sequence is sent */ + while (NRF_TWI1->EVENTS_STOPPED == 0) + { + // Do nothing. + } + } + return true; +} + +/** @brief Function for transfer by twi_master. + */ +bool nrf6350_lcd_wake_up(void) +{ + uint8_t address = (LCD_ADDR << 1); + uint8_t dummy_data[] = {0, 0, 0, 0}; + uint8_t dummy_data_length = 4; + bool issue_stop_condition = 0; + bool transfer_succeeded = false; + + NRF_TWI1->ADDRESS = (address >> 1); + + transfer_succeeded = nrf6350_lcd_write_without_recovery(dummy_data, + dummy_data_length, + issue_stop_condition); + + NRF_TWI1->EVENTS_ERROR = 0; + + return transfer_succeeded; +} + +/*lint --flb "Leave library region" */ diff --git a/components/drivers_ext/nrf6350/nrf6350.h b/components/drivers_ext/nrf6350/nrf6350.h new file mode 100644 index 0000000..447613e --- /dev/null +++ b/components/drivers_ext/nrf6350/nrf6350.h @@ -0,0 +1,118 @@ +/* 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. + * + */ + +#ifndef NRF6350_H_ +#define NRF6350_H_ + +#include +#include + +#define LCD_LLEN 16 //!< LCD Line length + +#define JS_BUTTON_NONE 0x00 //!< Joystick not touched +#define JS_BUTTON_LEFT 0x01 //!< joystick pulled left +#define JS_BUTTON_PUSH 0x02 //!< joystick pushed +#define JS_BUTTON_DOWN 0x04 //!< joystick pulled down +#define JS_BUTTON_UP 0x08 //!< joystick pulled up +#define JS_BUTTON_RIGHT 0x10 //!< joystick pulled right +#define LCD_UPPER_LINE 0x00 //!< LCD upper line +#define LCD_LOWER_LINE 0x40 //!< LCD lower line +#define LCD_CONTRAST_LOW 0x00 //!< LCD Low contrast +#define LCD_CONTRAST_MEDIUM 0x02 //!< LCD Medium contrast +#define LCD_CONTRAST_HIGH 0x08 //!< LCD High contrast + + +/** + * @brief Function for initializing the LCD display prior to writing. + * @return + * @retval true Operation succeeded + * @retval false Operation failed + */ +bool nrf6350_lcd_init(void); + +/** + * @brief Function for writing a text string on the LCD-display. + * + * @param p_text A pointer to the text string to be written + * @param size Size of the text string to be written + * @param line The line the text should be written to + * @param pos The start position of the text on the line + * @return + * @retval true Write succeeded + * @retval false Write failed + */ +bool nrf6350_lcd_write_string(const char *p_text, uint8_t size, uint8_t line, uint8_t pos); + +/** + * @brief Function for clearing the contents of the LCD-display. + * + * @return + * @retval true Operation succeeded + * @retval false Operation failed + */ +bool nrf6350_lcd_clear(void); + +/** + * @brief Function for adjusting the contrast of the LCD-display, select between + * LCD_CONTRAST_LOW, LCD_CONTRAST_MEDIUM and LCD_CONTRAST_HIGH. + * + * @param contrast The desired contrast of the lcd display + * @return + * @retval true Operation succeeded + * @retval false Operation failed + */ +bool nrf6350_lcd_set_contrast(uint8_t contrast); + +/** + * @brief Function for turning ON the LCD-display. + * + * @return + * @retval true Operation succeeded + * @retval false Operation failed + */ +bool nrf6350_lcd_on(void); + +/** + * @brief Function for turning OFF the LCD-display. + * + * @return + * @retval true Operation succeeded + * @retval false Operation failed + */ +bool nrf6350_lcd_off(void); + +/** + * @brief Function for getting the position of the joystick. + * + * @param val pointer to a 2 byte array where the X,Y position is stored + * @return + * @retval true Operation succeeded + * @retval false Operation failed + */ +bool nrf6350_js_get_value(int8_t *val); + +/** + * @brief Function for getting the status of the joystick. + * + * @param js_state pointer to a uint8_t that receives the status of the joystick + * @return + * @retval true Operation succeeded + * @retval false Operation failed + */ +bool nrf6350_js_get_status(uint8_t *js_state); + +/** @brief Function for transferring data over TWI bus. Used the first time you want to communicate nRF6350 to bypass a fail. + */ +bool nrf6350_lcd_wake_up(void); + +#endif // NRF6350_H_ +/** @} */ diff --git a/components/drivers_ext/segger_rtt/RTT_Syscalls_GCC.c b/components/drivers_ext/segger_rtt/RTT_Syscalls_GCC.c new file mode 100644 index 0000000..3d7429d --- /dev/null +++ b/components/drivers_ext/segger_rtt/RTT_Syscalls_GCC.c @@ -0,0 +1,98 @@ +/********************************************************************* +* SEGGER MICROCONTROLLER GmbH & Co. KG * +* Solutions for real time microcontroller applications * +********************************************************************** +* * +* (c) 2014 - 2015 SEGGER Microcontroller GmbH & Co. KG * +* * +* www.segger.com Support: support@segger.com * +* * +********************************************************************** +* * +* All rights reserved. * +* * +* * This software may in its unmodified form be freely redistributed * +* in source form. * +* * The source code may be modified, provided the source code * +* retains the above copyright notice, this list of conditions and * +* the following disclaimer. * +* * Modified versions of this software in source or linkable form * +* may not be distributed without prior consent of SEGGER. * +* * This software may only be used for communication with SEGGER * +* J-Link debug probes. * +* * +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * +* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * +* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR * +* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * +* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * +* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * +* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * +* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * +* DAMAGE. * +* * +********************************************************************** +-------- END-OF-HEADER --------------------------------------------- +File : SEGGER_RTT_Syscalls_GCC.c +Purpose : Low-level functions for using printf() via RTT in GCC. + To use RTT for printf output, include this file in your + application. +---------------------------------------------------------------------- +*/ +#include +#include "SEGGER_RTT.h" + +/********************************************************************* +* +* Function prototypes +* +********************************************************************** +*/ +int _write(int file, char *ptr, int len); +int _write_r(struct _reent *r, int file, char *ptr, int len); + +/********************************************************************* +* +* Global functions +* +********************************************************************** +*/ + +/********************************************************************* +* +* _write() +* +* Function description +* Low-level write function. +* libc subroutines will use this system routine for output to all files, +* including stdout. +* Write data via RTT. +*/ +int _write(int file, char *ptr, int len) { + (void) file; /* Not used, avoid warning */ + SEGGER_RTT_Write(0, ptr, len); + return len; +} + +/********************************************************************* +* +* _write_r() +* +* Function description +* Low-level reentrant write function. +* libc subroutines will use this system routine for output to all files, +* including stdout. +* Write data via RTT. +*/ +int _write_r(struct _reent *r, int file, char *ptr, int len) { + (void) file; /* Not used, avoid warning */ + (void) r; /* Not used, avoid warning */ + SEGGER_RTT_Write(0, ptr, len); + return len; +} + +/****** End Of File *************************************************/ \ No newline at end of file diff --git a/components/drivers_ext/segger_rtt/RTT_Syscalls_IAR.c b/components/drivers_ext/segger_rtt/RTT_Syscalls_IAR.c new file mode 100644 index 0000000..814f1e0 --- /dev/null +++ b/components/drivers_ext/segger_rtt/RTT_Syscalls_IAR.c @@ -0,0 +1,95 @@ +/********************************************************************* +* SEGGER MICROCONTROLLER GmbH & Co. KG * +* Solutions for real time microcontroller applications * +********************************************************************** +* * +* (c) 2014 - 2015 SEGGER Microcontroller GmbH & Co. KG * +* * +* www.segger.com Support: support@segger.com * +* * +********************************************************************** +* * +* All rights reserved. * +* * +* * This software may in its unmodified form be freely redistributed * +* in source form. * +* * The source code may be modified, provided the source code * +* retains the above copyright notice, this list of conditions and * +* the following disclaimer. * +* * Modified versions of this software in source or linkable form * +* may not be distributed without prior consent of SEGGER. * +* * This software may only be used for communication with SEGGER * +* J-Link debug probes. * +* * +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * +* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * +* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR * +* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * +* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * +* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * +* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * +* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * +* DAMAGE. * +* * +********************************************************************** +-------- END-OF-HEADER --------------------------------------------- +File : SEGGER_RTT_Syscalls_IAR.c +Purpose : Low-level functions for using printf() via RTT in IAR. + To use RTT for printf output, include this file in your + application and set the Library Configuration to Normal. +---------------------------------------------------------------------- +*/ +#include +#include "SEGGER_RTT.h" +#pragma module_name = "?__write" + +/********************************************************************* +* +* Function prototypes +* +********************************************************************** +*/ +size_t __write(int handle, const unsigned char * buffer, size_t size); + +/********************************************************************* +* +* Global functions +* +********************************************************************** +*/ +/********************************************************************* +* +* __write() +* +* Function description +* Low-level write function. +* Standard library subroutines will use this system routine +* for output to all files, including stdout. +* Write data via RTT. +*/ +size_t __write(int handle, const unsigned char * buffer, size_t size) { + (void) handle; /* Not used, avoid warning */ + SEGGER_RTT_Write(0, (const char*)buffer, size); + return size; +} + +/********************************************************************* +* +* __write_buffered() +* +* Function description +* Low-level write function. +* Standard library subroutines will use this system routine +* for output to all files, including stdout. +* Write data via RTT. +*/ +size_t __write_buffered(int handle, const unsigned char * buffer, size_t size) { + (void) handle; /* Not used, avoid warning */ + SEGGER_RTT_Write(0, (const char*)buffer, size); + return size; +} +/****** End Of File *************************************************/ diff --git a/components/drivers_ext/segger_rtt/RTT_Syscalls_KEIL.c b/components/drivers_ext/segger_rtt/RTT_Syscalls_KEIL.c new file mode 100644 index 0000000..b4c1fb8 --- /dev/null +++ b/components/drivers_ext/segger_rtt/RTT_Syscalls_KEIL.c @@ -0,0 +1,338 @@ +/********************************************************************* +* SEGGER MICROCONTROLLER GmbH & Co. KG * +* Solutions for real time microcontroller applications * +********************************************************************** +* * +* (c) 2014 - 2015 SEGGER Microcontroller GmbH & Co. KG * +* * +* www.segger.com Support: support@segger.com * +* * +********************************************************************** +* * +* All rights reserved. * +* * +* * This software may in its unmodified form be freely redistributed * +* in source form. * +* * The source code may be modified, provided the source code * +* retains the above copyright notice, this list of conditions and * +* the following disclaimer. * +* * Modified versions of this software in source or linkable form * +* may not be distributed without prior consent of SEGGER. * +* * This software may only be used for communication with SEGGER * +* J-Link debug probes. * +* * +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * +* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * +* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR * +* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * +* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * +* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * +* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * +* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * +* DAMAGE. * +* * +********************************************************************** +--------- END-OF-HEADER -------------------------------------------- +File : RTT_Syscalls_KEIL.c +Purpose : Retargeting module for KEIL MDK-CM3. + Low-level functions for using printf() via RTT +---------------------------------------------------------------------- +*/ + +#include +#include +#include +#include +#include + +#include "SEGGER_RTT.h" +/********************************************************************* +* +* #pragmas +* +********************************************************************** +*/ +#pragma import(__use_no_semihosting) + +#ifdef _MICROLIB + #pragma import(__use_full_stdio) +#endif + +/********************************************************************* +* +* Defines non-configurable +* +********************************************************************** +*/ + +/* Standard IO device handles - arbitrary, but any real file system handles must be + less than 0x8000. */ +#define STDIN 0x8001 // Standard Input Stream +#define STDOUT 0x8002 // Standard Output Stream +#define STDERR 0x8003 // Standard Error Stream + +/********************************************************************* +* +* Public const +* +********************************************************************** +*/ +const char __stdin_name[] = "STDIN"; +const char __stdout_name[] = "STDOUT"; +const char __stderr_name[] = "STDERR"; + +/********************************************************************* +* +* Public code +* +********************************************************************** +*/ + +/********************************************************************* +* +* _ttywrch +* +* Function description: +* Outputs a character to the console +* +* Parameters: +* c - character to output +* +*/ +void _ttywrch(int c) { + fputc(c, stdout); // stdout + fflush(stdout); +} + +/********************************************************************* +* +* _sys_open +* +* Function description: +* Opens the device/file in order to do read/write operations +* +* Parameters: +* sName - sName of the device/file to open +* OpenMode - This parameter is currently ignored +* +* Return value: +* != 0 - Handle to the object to open, otherwise +* == 0 -"device" is not handled by this module +* +*/ +FILEHANDLE _sys_open(const char * sName, int OpenMode) { + // Register standard Input Output devices. + if (strcmp(sName, __stdout_name) == 0) { + return (STDOUT); + } else if (strcmp(sName, __stderr_name) == 0) { + return (STDERR); + } else + return (0); // Not implemented +} + +/********************************************************************* +* +* _sys_close +* +* Function description: +* Closes the handle to the open device/file +* +* Parameters: +* hFile - Handle to a file opened via _sys_open +* +* Return value: +* 0 - device/file closed +* +*/ +int _sys_close(FILEHANDLE hFile) { + return 0; // Not implemented +} + +/********************************************************************* +* +* _sys_write +* +* Function description: +* Writes the data to an open handle. +* Currently this function only outputs data to the console +* +* Parameters: +* hFile - Handle to a file opened via _sys_open +* pBuffer - Pointer to the data that shall be written +* NumBytes - Number of bytes to write +* Mode - The Mode that shall be used +* +* Return value: +* Number of bytes *not* written to the file/device +* +*/ +int _sys_write(FILEHANDLE hFile, const unsigned char * pBuffer, unsigned NumBytes, int Mode) { + int r = 0; + + if (hFile == STDOUT) { + return NumBytes - SEGGER_RTT_Write(0, (const char*)pBuffer, NumBytes); + } + return r; +} + +/********************************************************************* +* +* _sys_read +* +* Function description: +* Reads data from an open handle. +* Currently this modules does nothing. +* +* Parameters: +* hFile - Handle to a file opened via _sys_open +* pBuffer - Pointer to buffer to store the read data +* NumBytes - Number of bytes to read +* Mode - The Mode that shall be used +* +* Return value: +* Number of bytes read from the file/device +* +*/ +int _sys_read(FILEHANDLE hFile, unsigned char * pBuffer, unsigned NumBytes, int Mode) { + return (0); // Not implemented +} + +/********************************************************************* +* +* _sys_istty +* +* Function description: +* This function shall return whether the opened file +* is a console device or not. +* +* Parameters: +* hFile - Handle to a file opened via _sys_open +* +* Return value: +* 1 - Device is a console +* 0 - Device is not a console +* +*/ +int _sys_istty(FILEHANDLE hFile) { + if (hFile > 0x8000) { + return (1); + } + return (0); // Not implemented +} + +/********************************************************************* +* +* _sys_seek +* +* Function description: +* Seeks via the file to a specific position +* +* Parameters: +* hFile - Handle to a file opened via _sys_open +* Pos - +* +* Return value: +* int - +* +*/ +int _sys_seek(FILEHANDLE hFile, long Pos) { + return (0); // Not implemented +} + +/********************************************************************* +* +* _sys_ensure +* +* Function description: +* +* +* Parameters: +* hFile - Handle to a file opened via _sys_open +* +* Return value: +* int - +* +*/ +int _sys_ensure(FILEHANDLE hFile) { + return (-1); // Not implemented +} + +/********************************************************************* +* +* _sys_flen +* +* Function description: +* Returns the length of the opened file handle +* +* Parameters: +* hFile - Handle to a file opened via _sys_open +* +* Return value: +* Length of the file +* +*/ +long _sys_flen(FILEHANDLE hFile) { + return (0); // Not implemented +} + +/********************************************************************* +* +* _sys_tmpnam +* +* Function description: +* This function converts the file number fileno for a temporary +* file to a unique filename, for example, tmp0001. +* +* Parameters: +* pBuffer - Pointer to a buffer to store the name +* FileNum - file number to convert +* MaxLen - Size of the buffer +* +* Return value: +* 1 - Error +* 0 - Success +* +*/ +int _sys_tmpnam(char * pBuffer, int FileNum, unsigned MaxLen) { + return (1); // Not implemented +} + +/********************************************************************* +* +* _sys_command_string +* +* Function description: +* This function shall execute a system command. +* +* Parameters: +* cmd - Pointer to the command string +* len - Length of the string +* +* Return value: +* == NULL - Command was not successfully executed +* == sCmd - Command was passed successfully +* +*/ +char * _sys_command_string(char * cmd, int len) { + return cmd; // Not implemented +} + +/********************************************************************* +* +* _sys_exit +* +* Function description: +* This function is called when the application returns from main +* +* Parameters: +* ReturnCode - Return code from the main function +* +* +*/ +void _sys_exit(int ReturnCode) { + while (1); // Not implemented +} diff --git a/components/drivers_ext/segger_rtt/SEGGER_RTT.c b/components/drivers_ext/segger_rtt/SEGGER_RTT.c new file mode 100644 index 0000000..cc72fc2 --- /dev/null +++ b/components/drivers_ext/segger_rtt/SEGGER_RTT.c @@ -0,0 +1,1102 @@ +/********************************************************************* +* SEGGER MICROCONTROLLER GmbH & Co. KG * +* Solutions for real time microcontroller applications * +********************************************************************** +* * +* (c) 2014 - 2015 SEGGER Microcontroller GmbH & Co. KG * +* * +* www.segger.com Support: support@segger.com * +* * +********************************************************************** +* * +* All rights reserved. * +* * +* * This software may in its unmodified form be freely redistributed * +* in source form. * +* * The source code may be modified, provided the source code * +* retains the above copyright notice, this list of conditions and * +* the following disclaimer. * +* * Modified versions of this software in source or linkable form * +* may not be distributed without prior consent of SEGGER. * +* * This software may only be used for communication with SEGGER * +* J-Link debug probes. * +* * +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * +* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * +* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR * +* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * +* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * +* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * +* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * +* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * +* DAMAGE. * +* * +********************************************************************** +---------------------------END-OF-HEADER------------------------------ +File : SEGGER_RTT.c +Purpose : Implementation of SEGGER real-time transfer (RTT) which + allows real-time communication on targets which support + debugger memory accesses while the CPU is running. + +Additional information: + Type "int" is assumed to be 32-bits in size + H->T Host to target communication + T->H Target to host communication + + RTT channel 0 is always present and reserved for Terminal usage. + Name is fixed to "Terminal" + +---------------------------------------------------------------------- +*/ + +#include "SEGGER_RTT.h" + +#include // for memcpy + +/********************************************************************* +* +* Configuration, default values +* +********************************************************************** +*/ + +#ifndef BUFFER_SIZE_UP + #define BUFFER_SIZE_UP 1024 // Size of the buffer for terminal output of target, up to host +#endif + +#ifndef BUFFER_SIZE_DOWN + #define BUFFER_SIZE_DOWN 16 // Size of the buffer for terminal input to target from host (Usually keyboard input) +#endif + +#ifndef SEGGER_RTT_MAX_NUM_UP_BUFFERS + #define SEGGER_RTT_MAX_NUM_UP_BUFFERS 2 // Number of up-buffers (T->H) available on this target +#endif + +#ifndef SEGGER_RTT_MAX_NUM_DOWN_BUFFERS + #define SEGGER_RTT_MAX_NUM_DOWN_BUFFERS 2 // Number of down-buffers (H->T) available on this target +#endif + +#ifndef SEGGER_RTT_MODE_DEFAULT + #define SEGGER_RTT_MODE_DEFAULT SEGGER_RTT_MODE_NO_BLOCK_SKIP +#endif + +#ifndef SEGGER_RTT_LOCK + #define SEGGER_RTT_LOCK(SavedState) +#endif + +#ifndef SEGGER_RTT_UNLOCK + #define SEGGER_RTT_UNLOCK(SavedState) +#endif + +#ifndef STRLEN + #define STRLEN(a) strlen((a)) +#endif + +#ifndef MEMCPY + #define MEMCPY(pDest, pSrc, NumBytes) memcpy((pDest), (pSrc), (NumBytes)) +#endif + +#ifndef MIN + #define MIN(a, b) (((a) < (b)) ? (a) : (b)) +#endif + +#ifndef MAX + #define MAX(a, b) (((a) > (b)) ? (a) : (b)) +#endif +// +// For some environments, NULL may not be defined until certain headers are included +// +#ifndef NULL + #define NULL 0 +#endif + +/********************************************************************* +* +* Static const data +* +********************************************************************** +*/ + +static unsigned char _aTerminalId[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; + +/********************************************************************* +* +* Static data +* +********************************************************************** +*/ +// +// Allocate buffers for channel 0 +// +static char _acUpBuffer [BUFFER_SIZE_UP]; +static char _acDownBuffer[BUFFER_SIZE_DOWN]; +// +// Initialize SEGGER Real-time-Terminal control block (CB) +// +SEGGER_RTT_CB _SEGGER_RTT; + +static char _ActiveTerminal; + +/********************************************************************* +* +* Static functions +* +********************************************************************** +*/ + +/********************************************************************* +* +* _DoInit() +* +* Function description +* Initializes the control block an buffers. +* May only be called via INIT() to avoid overriding settings. +* +*/ +#define INIT() do { \ + if (_SEGGER_RTT.acID[0] == '\0') { _DoInit(); } \ + } while (0) +static void _DoInit(void) { + SEGGER_RTT_CB* p; + // + // Initialize control block + // + p = &_SEGGER_RTT; + p->MaxNumUpBuffers = SEGGER_RTT_MAX_NUM_UP_BUFFERS; + p->MaxNumDownBuffers = SEGGER_RTT_MAX_NUM_DOWN_BUFFERS; + // + // Initialize up buffer 0 + // + p->aUp[0].sName = "Terminal"; + p->aUp[0].pBuffer = _acUpBuffer; + p->aUp[0].SizeOfBuffer = sizeof(_acUpBuffer); + p->aUp[0].RdOff = 0u; + p->aUp[0].WrOff = 0u; + p->aUp[0].Flags = SEGGER_RTT_MODE_DEFAULT; + // + // Initialize down buffer 0 + // + p->aDown[0].sName = "Terminal"; + p->aDown[0].pBuffer = _acDownBuffer; + p->aDown[0].SizeOfBuffer = sizeof(_acDownBuffer); + p->aDown[0].RdOff = 0u; + p->aDown[0].WrOff = 0u; + p->aDown[0].Flags = SEGGER_RTT_MODE_DEFAULT; + // + // Finish initialization of the control block. + // Copy Id string in three steps to make sure "SEGGER RTT" is not found + // in initializer memory (usually flash) by J-Link + // + strcpy(&p->acID[7], "RTT"); + strcpy(&p->acID[0], "SEGGER"); + p->acID[6] = ' '; +} + +/********************************************************************* +* +* _WriteBlocking() +* +* Function description +* Stores a specified number of characters in SEGGER RTT ring buffer +* and updates the associated write pointer which is periodically +* read by the host. +* The caller is responsible for managing the write chunk sizes as +* _WriteBlocking() will block until all data has been posted successfully. +* +* Parameters +* pRing Ring buffer to post to. +* pBuffer Pointer to character array. Does not need to point to a \0 terminated string. +* NumBytes Number of bytes to be stored in the SEGGER RTT control block. +* +* Return value +* >= 0 - Number of bytes written into buffer. +*/ +static unsigned _WriteBlocking(SEGGER_RTT_RING_BUFFER *pRing, const char* pBuffer, unsigned NumBytes) { + unsigned NumBytesToWrite; + unsigned NumBytesWritten; + unsigned RdOff; + unsigned WrOff; + // + // Write data to buffer and handle wrap-around if necessary + // + NumBytesWritten = 0u; + WrOff = pRing->WrOff; + do { + RdOff = pRing->RdOff; // May be changed by host (debug probe) in the meantime + if (RdOff > WrOff) { + NumBytesToWrite = RdOff - WrOff - 1u; + } else { + NumBytesToWrite = pRing->SizeOfBuffer - (WrOff - RdOff + 1u); + } + NumBytesToWrite = MIN(NumBytesToWrite, (pRing->SizeOfBuffer - WrOff)); // Number of bytes that can be written until buffer wrap-around + NumBytesToWrite = MIN(NumBytesToWrite, NumBytes); + memcpy(pRing->pBuffer + WrOff, pBuffer, NumBytesToWrite); + NumBytesWritten += NumBytesToWrite; + pBuffer += NumBytesToWrite; + NumBytes -= NumBytesToWrite; + WrOff += NumBytesToWrite; + if (WrOff == pRing->SizeOfBuffer) { + WrOff = 0u; + } + pRing->WrOff = WrOff; + } while (NumBytes); + // + return NumBytesWritten; +} + +/********************************************************************* +* +* _WriteNoCheck() +* +* Function description +* Stores a specified number of characters in SEGGER RTT ring buffer +* and updates the associated write pointer which is periodically +* read by the host. +* It is callers responsibility to make sure data actually fits in buffer. +* +* Parameters +* pRing Ring buffer to post to. +* pBuffer Pointer to character array. Does not need to point to a \0 terminated string. +* NumBytes Number of bytes to be stored in the SEGGER RTT control block. +* +* Notes +* (1) If there might not be enough space in the "Up"-buffer, call _WriteBlocking +*/ +static void _WriteNoCheck(SEGGER_RTT_RING_BUFFER *pRing, const char* pData, unsigned NumBytes) { + unsigned NumBytesAtOnce; + unsigned WrOff; + unsigned Rem; + + WrOff = pRing->WrOff; + Rem = pRing->SizeOfBuffer - WrOff; + if (Rem > NumBytes) { + // + // All data fits before wrap around + // + memcpy(pRing->pBuffer + WrOff, pData, NumBytes); + pRing->WrOff = WrOff + NumBytes; + } else { + // + // We reach the end of the buffer, so need to wrap around + // + NumBytesAtOnce = Rem; + memcpy(pRing->pBuffer + WrOff, pData, NumBytesAtOnce); + NumBytesAtOnce = NumBytes - Rem; + memcpy(pRing->pBuffer, pData + Rem, NumBytesAtOnce); + pRing->WrOff = NumBytesAtOnce; + } +} + +/********************************************************************* +* +* _PostTerminalSwitch() +* +* Function description +* Switch terminal to the given terminal ID. It is the caller's +* responsibility to ensure the terminal ID is correct and there is +* enough space in the buffer for this to complete successfully. +* +* Parameters +* pRing Ring buffer to post to. +* TerminalId Terminal ID to switch to. +*/ +static void _PostTerminalSwitch(SEGGER_RTT_RING_BUFFER *pRing, char TerminalId) { + char ac[2]; + + ac[0] = 0xFFu; + ac[1] = _aTerminalId[(unsigned char)TerminalId]; // Caller made already sure that TerminalId does not exceed our terminal limit + _WriteBlocking(pRing, ac, 2u); +} + +/********************************************************************* +* +* _GetAvailWriteSpace() +* +* Function description +* Returns the number of bytes that can be written to the ring +* buffer without blocking. +* +* Parameters +* pRing Ring buffer to check. +* +* Return value +* Number of bytes that are free in the buffer. +*/ +static unsigned _GetAvailWriteSpace(SEGGER_RTT_RING_BUFFER *pRing) { + unsigned RdOff; + unsigned WrOff; + unsigned r; + // + // Avoid warnings regarding volatile access order. It's not a problem + // in this case, but dampen compiler enthusiasm. + // + RdOff = pRing->RdOff; + WrOff = pRing->WrOff; + if (RdOff <= WrOff) { + r = pRing->SizeOfBuffer - 1u - WrOff + RdOff; + } else { + r = RdOff - WrOff - 1u; + } + return r; +} + +/********************************************************************* +* +* Public code +* +********************************************************************** +*/ +/********************************************************************* +* +* SEGGER_RTT_ReadNoLock() +* +* Function description +* Reads characters from SEGGER real-time-terminal control block +* which have been previously stored by the host. +* Do not lock against interrupts and multiple access. +* +* Parameters +* BufferIndex Index of Down-buffer to be used (e.g. 0 for "Terminal"). +* pBuffer Pointer to buffer provided by target application, to copy characters from RTT-down-buffer to. +* BufferSize Size of the target application buffer. +* +* Return value +* Number of bytes that have been read. +*/ +unsigned SEGGER_RTT_ReadNoLock(unsigned BufferIndex, void* pData, unsigned BufferSize) { + unsigned NumBytesRem; + unsigned NumBytesRead; + unsigned RdOff; + unsigned WrOff; + unsigned char* pBuffer; + SEGGER_RTT_RING_BUFFER* pRing; + // + INIT(); + pRing = &_SEGGER_RTT.aDown[BufferIndex]; + pBuffer = (unsigned char*)pData; + RdOff = pRing->RdOff; + WrOff = pRing->WrOff; + NumBytesRead = 0u; + // + // Read from current read position to wrap-around of buffer, first + // + if (RdOff > WrOff) { + NumBytesRem = pRing->SizeOfBuffer - RdOff; + NumBytesRem = MIN(NumBytesRem, BufferSize); + memcpy(pBuffer, pRing->pBuffer + RdOff, NumBytesRem); + NumBytesRead += NumBytesRem; + pBuffer += NumBytesRem; + BufferSize -= NumBytesRem; + RdOff += NumBytesRem; + // + // Handle wrap-around of buffer + // + if (RdOff == pRing->SizeOfBuffer) { + RdOff = 0u; + } + } + // + // Read remaining items of buffer + // + NumBytesRem = WrOff - RdOff; + NumBytesRem = MIN(NumBytesRem, BufferSize); + if (NumBytesRem > 0u) { + memcpy(pBuffer, pRing->pBuffer + RdOff, NumBytesRem); + NumBytesRead += NumBytesRem; + pBuffer += NumBytesRem; + BufferSize -= NumBytesRem; + RdOff += NumBytesRem; + } + if (NumBytesRead) { + pRing->RdOff = RdOff; + } + // + return NumBytesRead; +} + +/********************************************************************* +* +* SEGGER_RTT_Read +* +* Function description +* Reads characters from SEGGER real-time-terminal control block +* which have been previously stored by the host. +* +* Parameters +* BufferIndex Index of Down-buffer to be used (e.g. 0 for "Terminal"). +* pBuffer Pointer to buffer provided by target application, to copy characters from RTT-down-buffer to. +* BufferSize Size of the target application buffer. +* +* Return value +* Number of bytes that have been read. +*/ +unsigned SEGGER_RTT_Read(unsigned BufferIndex, void* pBuffer, unsigned BufferSize) { + unsigned NumBytesRead; + volatile unsigned SavedState; + // + SEGGER_RTT_LOCK(SavedState); + // + // Call the non-locking read function + // + NumBytesRead = SEGGER_RTT_ReadNoLock(BufferIndex, pBuffer, BufferSize); + // + // Finish up. + // + SEGGER_RTT_UNLOCK(SavedState); + // + return NumBytesRead; +} + +/********************************************************************* +* +* SEGGER_RTT_WriteSkipNoLock +* +* Function description +* Stores a specified number of characters in SEGGER RTT +* control block which is then read by the host. +* SEGGER_RTT_WriteSkipNoLock does not lock the application and +* skips all data, if the data does not fit into the buffer. +* +* Parameters +* BufferIndex Index of "Up"-buffer to be used (e.g. 0 for "Terminal"). +* pBuffer Pointer to character array. Does not need to point to a \0 terminated string. +* NumBytes Number of bytes to be stored in the SEGGER RTT control block. +* +* Return value +* Number of bytes which have been stored in the "Up"-buffer. +* +* Notes +* (1) If there is not enough space in the "Up"-buffer, all data is dropped. +* (2) For performance reasons this function does not call Init() +* and may only be called after RTT has been initialized. +* Either by calling SEGGER_RTT_Init() or calling another RTT API function first. +*/ +unsigned SEGGER_RTT_WriteSkipNoLock(unsigned BufferIndex, const void* pBuffer, unsigned NumBytes) { + const char* pData; + SEGGER_RTT_RING_BUFFER* pRing; + unsigned Avail; + unsigned RdOff; + unsigned WrOff; + unsigned Rem; + + pData = (const char *)pBuffer; + // + // Get "to-host" ring buffer and copy some elements into local variables. + // + pRing = &_SEGGER_RTT.aUp[BufferIndex]; + RdOff = pRing->RdOff; + WrOff = pRing->WrOff; + // + // Handle the most common cases fastest. + // Which is: + // RdOff <= WrOff -> Space until wrap around is free. + // AND + // WrOff + NumBytes < SizeOfBuffer -> No Wrap around necessary. + // + // OR + // + // RdOff > WrOff -> Space until RdOff - 1 is free. + // AND + // WrOff + NumBytes < RdOff -> Data fits into buffer + // + if (RdOff <= WrOff) { + // + // Get space until WrOff will be at wrap around. + // + Avail = pRing->SizeOfBuffer - 1u - WrOff ; + if (Avail >= NumBytes) { + memcpy(pRing->pBuffer + WrOff, pData, NumBytes); + pRing->WrOff = WrOff + NumBytes; + return 1; + } + // + // If data did not fit into space until wrap around calculate complete space in buffer. + // + Avail += RdOff; + // + // If there is still no space for the whole of this output, don't bother. + // + if (Avail >= NumBytes) { + // + // OK, we have enough space in buffer. Copy in one or 2 chunks + // + Rem = pRing->SizeOfBuffer - WrOff; // Space until end of buffer + if (Rem > NumBytes) { + memcpy(pRing->pBuffer + WrOff, pData, NumBytes); + pRing->WrOff = WrOff + NumBytes; + } else { + // + // We reach the end of the buffer, so need to wrap around + // + memcpy(pRing->pBuffer + WrOff, pData, Rem); + memcpy(pRing->pBuffer, pData + Rem, NumBytes - Rem); + pRing->WrOff = NumBytes - Rem; + } + return 1; + } + } else { + Avail = RdOff - WrOff - 1u; + if (Avail >= NumBytes) { + memcpy(pRing->pBuffer + WrOff, pData, NumBytes); + pRing->WrOff = WrOff + NumBytes; + return 1; + } + } + // + // If we reach this point no data has been written + // + return 0; +} + +/********************************************************************* +* +* SEGGER_RTT_WriteNoLock +* +* Function description +* Stores a specified number of characters in SEGGER RTT +* control block which is then read by the host. +* SEGGER_RTT_WriteNoLock does not lock the application. +* +* Parameters +* BufferIndex Index of "Up"-buffer to be used (e.g. 0 for "Terminal"). +* pBuffer Pointer to character array. Does not need to point to a \0 terminated string. +* NumBytes Number of bytes to be stored in the SEGGER RTT control block. +* +* Return value +* Number of bytes which have been stored in the "Up"-buffer. +* +* Notes +* (1) If there is not enough space in the "Up"-buffer, remaining characters of pBuffer are dropped. +* (2) For performance reasons this function does not call Init() +* and may only be called after RTT has been initialized. +* Either by calling SEGGER_RTT_Init() or calling another RTT API function first. +*/ +unsigned SEGGER_RTT_WriteNoLock(unsigned BufferIndex, const void* pBuffer, unsigned NumBytes) { + unsigned Status; + unsigned Avail; + const char* pData; + SEGGER_RTT_RING_BUFFER *pRing; + + pData = (const char *)pBuffer; + // + // Get "to-host" ring buffer. + // + pRing = &_SEGGER_RTT.aUp[BufferIndex]; + // + // How we output depends upon the mode... + // + switch (pRing->Flags) { + case SEGGER_RTT_MODE_NO_BLOCK_SKIP: + // + // If we are in skip mode and there is no space for the whole + // of this output, don't bother. + // + Avail = _GetAvailWriteSpace(pRing); + if (Avail < NumBytes) { + Status = 0u; + } else { + Status = NumBytes; + _WriteNoCheck(pRing, pData, NumBytes); + } + break; + case SEGGER_RTT_MODE_NO_BLOCK_TRIM: + // + // If we are in trim mode, trim to what we can output without blocking. + // + Avail = _GetAvailWriteSpace(pRing); + Status = Avail < NumBytes ? Avail : NumBytes; + _WriteNoCheck(pRing, pData, Status); + break; + case SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL: + // + // If we are in blocking mode, output everything. + // + Status = _WriteBlocking(pRing, pData, NumBytes); + break; + default: + Status = 0u; + break; + } + // + // Finish up. + // + return Status; +} + +/********************************************************************* +* +* SEGGER_RTT_Write +* +* Function description +* Stores a specified number of characters in SEGGER RTT +* control block which is then read by the host. +* +* Parameters +* BufferIndex Index of "Up"-buffer to be used (e.g. 0 for "Terminal"). +* pBuffer Pointer to character array. Does not need to point to a \0 terminated string. +* NumBytes Number of bytes to be stored in the SEGGER RTT control block. +* +* Return value +* Number of bytes which have been stored in the "Up"-buffer. +* +* Notes +* (1) If there is not enough space in the "Up"-buffer, remaining characters of pBuffer are dropped. +*/ +unsigned SEGGER_RTT_Write(unsigned BufferIndex, const void* pBuffer, unsigned NumBytes) { + unsigned Status; + volatile unsigned SavedState; + // + INIT(); + SEGGER_RTT_LOCK(SavedState); + // + // Call the non-locking write function + // + Status = SEGGER_RTT_WriteNoLock(BufferIndex, pBuffer, NumBytes); + // + // Finish up. + // + SEGGER_RTT_UNLOCK(SavedState); + // + return Status; +} + +/********************************************************************* +* +* SEGGER_RTT_WriteString +* +* Function description +* Stores string in SEGGER RTT control block. +* This data is read by the host. +* +* Parameters +* BufferIndex Index of "Up"-buffer to be used (e.g. 0 for "Terminal"). +* s Pointer to string. +* +* Return value +* Number of bytes which have been stored in the "Up"-buffer. +* +* Notes +* (1) If there is not enough space in the "Up"-buffer, depending on configuration, +* remaining characters may be dropped or RTT module waits until there is more space in the buffer. +* (2) String passed to this function has to be \0 terminated +* (3) \0 termination character is *not* stored in RTT buffer +*/ +unsigned SEGGER_RTT_WriteString(unsigned BufferIndex, const char* s) { + unsigned Len; + + Len = STRLEN(s); + return SEGGER_RTT_Write(BufferIndex, s, Len); +} + +/********************************************************************* +* +* SEGGER_RTT_GetKey +* +* Function description +* Reads one character from the SEGGER RTT buffer. +* Host has previously stored data there. +* +* Return value +* < 0 - No character available (buffer empty). +* >= 0 - Character which has been read. (Possible values: 0 - 255) +* +* Notes +* (1) This function is only specified for accesses to RTT buffer 0. +*/ +int SEGGER_RTT_GetKey(void) { + char c; + int r; + + r = (int)SEGGER_RTT_Read(0u, &c, 1u); + if (r == 1) { + r = (int)(unsigned char)c; + } else { + r = -1; + } + return r; +} + +/********************************************************************* +* +* SEGGER_RTT_WaitKey +* +* Function description +* Waits until at least one character is avaible in the SEGGER RTT buffer. +* Once a character is available, it is read and this function returns. +* +* Return value +* >=0 - Character which has been read. +* +* Notes +* (1) This function is only specified for accesses to RTT buffer 0 +* (2) This function is blocking if no character is present in RTT buffer +*/ +int SEGGER_RTT_WaitKey(void) { + int r; + + do { + r = SEGGER_RTT_GetKey(); + } while (r < 0); + return r; +} + +/********************************************************************* +* +* SEGGER_RTT_HasKey +* +* Function description +* Checks if at least one character for reading is available in the SEGGER RTT buffer. +* +* Return value +* == 0 - No characters are available to read. +* == 1 - At least one character is available. +* +* Notes +* (1) This function is only specified for accesses to RTT buffer 0 +*/ +int SEGGER_RTT_HasKey(void) { + unsigned RdOff; + int r; + + INIT(); + RdOff = _SEGGER_RTT.aDown[0].RdOff; + if (RdOff != _SEGGER_RTT.aDown[0].WrOff) { + r = 1; + } else { + r = 0; + } + return r; +} + +/********************************************************************* +* +* SEGGER_RTT_HasData +* +* Function description +* Check if there is data from the host in the given buffer. +* +* Return value: +* ==0: No data +* !=0: Data in buffer +* +*/ +unsigned SEGGER_RTT_HasData(unsigned BufferIndex) { + SEGGER_RTT_RING_BUFFER *pRing; + unsigned v; + + pRing = &_SEGGER_RTT.aDown[BufferIndex]; + v = pRing->WrOff; + return v - pRing->RdOff; +} + + +/********************************************************************* +* +* SEGGER_RTT_ConfigUpBuffer +* +* Function description +* Run-time configuration of a specific up-buffer (T->H). +* Buffer to be configured is specified by index. +* This includes: Buffer address, size, name, flags, ... +* +* Parameters +* BufferIndex Index of the buffer to configure. +* sName Pointer to a constant name string. +* pBuffer Pointer to a buffer to be used. +* BufferSize Size of the buffer. +* Flags Operating modes. Define behavior if buffer is full (not enough space for entire message). +* +* Return value +* >= 0 - O.K. +* < 0 - Error +*/ +int SEGGER_RTT_ConfigUpBuffer(unsigned BufferIndex, const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags) { + int r; + volatile unsigned SavedState; + + INIT(); + if (BufferIndex < (unsigned)_SEGGER_RTT.MaxNumUpBuffers) { + SEGGER_RTT_LOCK(SavedState); + if (BufferIndex > 0u) { + _SEGGER_RTT.aUp[BufferIndex].sName = sName; + _SEGGER_RTT.aUp[BufferIndex].pBuffer = pBuffer; + _SEGGER_RTT.aUp[BufferIndex].SizeOfBuffer = BufferSize; + _SEGGER_RTT.aUp[BufferIndex].RdOff = 0u; + _SEGGER_RTT.aUp[BufferIndex].WrOff = 0u; + } + _SEGGER_RTT.aUp[BufferIndex].Flags = Flags; + SEGGER_RTT_UNLOCK(SavedState); + r = 0; + } else { + r = -1; + } + return r; +} + +/********************************************************************* +* +* SEGGER_RTT_ConfigDownBuffer +* +* Function description +* Run-time configuration of a specific down-buffer (H->T). +* Buffer to be configured is specified by index. +* This includes: Buffer address, size, name, flags, ... +* +* Parameters +* BufferIndex Index of the buffer to configure. +* sName Pointer to a constant name string. +* pBuffer Pointer to a buffer to be used. +* BufferSize Size of the buffer. +* Flags Operating modes. Define behavior if buffer is full (not enough space for entire message). +* +* Return value +* >= 0 O.K. +* < 0 Error +*/ +int SEGGER_RTT_ConfigDownBuffer(unsigned BufferIndex, const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags) { + int r; + volatile unsigned SavedState; + + INIT(); + if (BufferIndex < (unsigned)_SEGGER_RTT.MaxNumDownBuffers) { + SEGGER_RTT_LOCK(SavedState); + if (BufferIndex > 0u) { + _SEGGER_RTT.aDown[BufferIndex].sName = sName; + _SEGGER_RTT.aDown[BufferIndex].pBuffer = pBuffer; + _SEGGER_RTT.aDown[BufferIndex].SizeOfBuffer = BufferSize; + _SEGGER_RTT.aDown[BufferIndex].RdOff = 0u; + _SEGGER_RTT.aDown[BufferIndex].WrOff = 0u; + } + _SEGGER_RTT.aDown[BufferIndex].Flags = Flags; + SEGGER_RTT_UNLOCK(SavedState); + r = 0; + } else { + r = -1; + } + return r; +} + +/********************************************************************* +* +* SEGGER_RTT_SetNameUpBuffer +* +* Function description +* Run-time configuration of a specific up-buffer name (T->H). +* Buffer to be configured is specified by index. +* +* Parameters +* BufferIndex Index of the buffer to renamed. +* sName Pointer to a constant name string. +* +* Return value +* >= 0 O.K. +* < 0 Error +*/ +int SEGGER_RTT_SetNameUpBuffer(unsigned BufferIndex, const char* sName) { + int r; + volatile unsigned SavedState; + + INIT(); + if (BufferIndex < (unsigned)_SEGGER_RTT.MaxNumUpBuffers) { + SEGGER_RTT_LOCK(SavedState); + _SEGGER_RTT.aUp[BufferIndex].sName = sName; + SEGGER_RTT_UNLOCK(SavedState); + r = 0; + } else { + r = -1; + } + return r; +} + +/********************************************************************* +* +* SEGGER_RTT_SetNameDownBuffer +* +* Function description +* Run-time configuration of a specific Down-buffer name (T->H). +* Buffer to be configured is specified by index. +* +* Parameters +* BufferIndex Index of the buffer to renamed. +* sName Pointer to a constant name string. +* +* Return value +* >= 0 O.K. +* < 0 Error +*/ +int SEGGER_RTT_SetNameDownBuffer(unsigned BufferIndex, const char* sName) { + int r; + volatile unsigned SavedState; + + INIT(); + if (BufferIndex < (unsigned)_SEGGER_RTT.MaxNumDownBuffers) { + SEGGER_RTT_LOCK(SavedState); + _SEGGER_RTT.aDown[BufferIndex].sName = sName; + SEGGER_RTT_UNLOCK(SavedState); + r = 0; + } else { + r = -1; + } + return r; +} + +/********************************************************************* +* +* SEGGER_RTT_Init +* +* Function description +* Initializes the RTT Control Block. +* Should be used in RAM targets, at start of the application. +* +*/ +void SEGGER_RTT_Init (void) { + INIT(); +} + +/********************************************************************* +* +* SEGGER_RTT_SetTerminal +* +* Function description +* Sets the terminal to be used for output on channel 0. +* +* Parameters +* TerminalId Index of the terminal. +* +* Return value +* >= 0 O.K. +* < 0 Error (e.g. if RTT is configured for non-blocking mode and there was no space in the buffer to set the new terminal Id) +*/ +int SEGGER_RTT_SetTerminal (char TerminalId) { + char ac[2]; + SEGGER_RTT_RING_BUFFER *pRing; + volatile unsigned SavedState; + unsigned Avail; + int r; + // + INIT(); + // + r = 0; + ac[0] = 0xFFU; + if (TerminalId < (char)sizeof(_aTerminalId)) { // We only support a certain number of channels + ac[1] = _aTerminalId[(unsigned char)TerminalId]; + pRing = &_SEGGER_RTT.aUp[0]; // Buffer 0 is always reserved for terminal I/O, so we can use index 0 here, fixed + SEGGER_RTT_LOCK(SavedState); // Lock to make sure that no other task is writing into buffer, while we are and number of free bytes in buffer does not change downwards after checking and before writing + if ((pRing->Flags & SEGGER_RTT_MODE_MASK) == SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL) { + _ActiveTerminal = TerminalId; + _WriteBlocking(pRing, ac, 2u); + } else { // Skipping mode or trim mode? => We cannot trim this command so handling is the same for both modes + Avail = _GetAvailWriteSpace(pRing); + if (Avail >= 2) { + _ActiveTerminal = TerminalId; // Only change active terminal in case of success + _WriteNoCheck(pRing, ac, 2u); + } else { + r = -1; + } + } + SEGGER_RTT_UNLOCK(SavedState); + } else { + r = -1; + } + return r; +} + +/********************************************************************* +* +* SEGGER_RTT_TerminalOut +* +* Function description +* Writes a string to the given terminal +* without changing the terminal for channel 0. +* +* Parameters +* TerminalId Index of the terminal. +* s String to be printed on the terminal. +* +* Return value +* >= 0 - Number of bytes written. +* < 0 - Error. +* +*/ +int SEGGER_RTT_TerminalOut (char TerminalId, const char* s) { + int Status; + unsigned FragLen; + unsigned Avail; + SEGGER_RTT_RING_BUFFER *pRing; + volatile unsigned SavedState; + // + INIT(); + // + // Validate terminal ID. + // + if (TerminalId < (char)sizeof(_aTerminalId)) { // We only support a certain number of channels + // + // Get "to-host" ring buffer. + // + pRing = &_SEGGER_RTT.aUp[0]; + // + // Need to be able to change terminal, write data, change back. + // Compute the fixed and variable sizes. + // + FragLen = strlen(s); + // + // How we output depends upon the mode... + // + SEGGER_RTT_LOCK(SavedState); + Avail = _GetAvailWriteSpace(pRing); + switch (pRing->Flags & SEGGER_RTT_MODE_MASK) { + case SEGGER_RTT_MODE_NO_BLOCK_SKIP: + // + // If we are in skip mode and there is no space for the whole + // of this output, don't bother switching terminals at all. + // + if (Avail < (FragLen + 4u)) { + Status = 0; + } else { + _PostTerminalSwitch(pRing, TerminalId); + Status = (int)_WriteBlocking(pRing, s, FragLen); + _PostTerminalSwitch(pRing, _ActiveTerminal); + } + break; + case SEGGER_RTT_MODE_NO_BLOCK_TRIM: + // + // If we are in trim mode and there is not enough space for everything, + // trim the output but always include the terminal switch. If no room + // for terminal switch, skip that totally. + // + if (Avail < 4u) { + Status = -1; + } else { + _PostTerminalSwitch(pRing, TerminalId); + Status = (int)_WriteBlocking(pRing, s, (FragLen < (Avail - 4u)) ? FragLen : (Avail - 4u)); + _PostTerminalSwitch(pRing, _ActiveTerminal); + } + break; + case SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL: + // + // If we are in blocking mode, output everything. + // + _PostTerminalSwitch(pRing, TerminalId); + Status = (int)_WriteBlocking(pRing, s, FragLen); + _PostTerminalSwitch(pRing, _ActiveTerminal); + break; + default: + Status = -1; + break; + } + // + // Finish up. + // + SEGGER_RTT_UNLOCK(SavedState); + } else { + Status = -1; + } + return Status; +} + + +/*************************** End of file ****************************/ diff --git a/components/drivers_ext/segger_rtt/SEGGER_RTT.h b/components/drivers_ext/segger_rtt/SEGGER_RTT.h new file mode 100644 index 0000000..07bddb1 --- /dev/null +++ b/components/drivers_ext/segger_rtt/SEGGER_RTT.h @@ -0,0 +1,204 @@ +/********************************************************************* +* SEGGER MICROCONTROLLER GmbH & Co. KG * +* Solutions for real time microcontroller applications * +********************************************************************** +* * +* (c) 2014 - 2015 SEGGER Microcontroller GmbH & Co. KG * +* * +* www.segger.com Support: support@segger.com * +* * +********************************************************************** +* * +* All rights reserved. * +* * +* * This software may in its unmodified form be freely redistributed * +* in source form. * +* * The source code may be modified, provided the source code * +* retains the above copyright notice, this list of conditions and * +* the following disclaimer. * +* * Modified versions of this software in source or linkable form * +* may not be distributed without prior consent of SEGGER. * +* * This software may only be used for communication with SEGGER * +* J-Link debug probes. * +* * +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * +* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * +* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR * +* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * +* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * +* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * +* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * +* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * +* DAMAGE. * +* * +********************************************************************** +---------------------------END-OF-HEADER------------------------------ +File : SEGGER_RTT.h +Purpose : Implementation of SEGGER real-time transfer which allows + real-time communication on targets which support debugger + memory accesses while the CPU is running. +---------------------------------------------------------------------- +*/ + +#ifndef SEGGER_RTT_H +#define SEGGER_RTT_H + +#include "SEGGER_RTT_Conf.h" + +/********************************************************************* +* +* Defines, fixed +* +********************************************************************** +*/ + +/********************************************************************* +* +* Types +* +********************************************************************** +*/ + +// +// Description for a circular buffer (also called "ring buffer") +// which is used as up- (T->H) or down-buffer (H->T) +// +typedef struct { + const char* sName; // Optional name. Standard names so far are: "Terminal", "SysView", "J-Scope_t4i4" + char* pBuffer; // Pointer to start of buffer + unsigned SizeOfBuffer; // Buffer size in bytes. Note that one byte is lost, as this implementation does not fill up the buffer in order to avoid the problem of being unable to distinguish between full and empty. + volatile unsigned WrOff; // Position of next item to be written by either host (down-buffer) or target (up-buffer). Must be volatile since it may be modified by host (down-buffer) + volatile unsigned RdOff; // Position of next item to be read by target (down-buffer) or host (up-buffer). Must be volatile since it may be modified by host (up-buffer) + unsigned Flags; // Contains configuration flags +} SEGGER_RTT_RING_BUFFER; + +// +// RTT control block which describes the number of buffers available +// as well as the configuration for each buffer +// +// +typedef struct { + char acID[16]; // Initialized to "SEGGER RTT" + int MaxNumUpBuffers; // Initialized to SEGGER_RTT_MAX_NUM_UP_BUFFERS (type. 2) + int MaxNumDownBuffers; // Initialized to SEGGER_RTT_MAX_NUM_DOWN_BUFFERS (type. 2) + SEGGER_RTT_RING_BUFFER aUp[SEGGER_RTT_MAX_NUM_UP_BUFFERS]; // Up buffers, transferring information up from target via debug probe to host + SEGGER_RTT_RING_BUFFER aDown[SEGGER_RTT_MAX_NUM_DOWN_BUFFERS]; // Down buffers, transferring information down from host via debug probe to target +} SEGGER_RTT_CB; + +/********************************************************************* +* +* Global data +* +********************************************************************** +*/ +extern SEGGER_RTT_CB _SEGGER_RTT; + +/********************************************************************* +* +* RTT API functions +* +********************************************************************** +*/ +int SEGGER_RTT_ConfigUpBuffer (unsigned BufferIndex, const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags); +int SEGGER_RTT_ConfigDownBuffer (unsigned BufferIndex, const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags); +int SEGGER_RTT_GetKey (void); +unsigned SEGGER_RTT_HasData (unsigned BufferIndex); +int SEGGER_RTT_HasKey (void); +void SEGGER_RTT_Init (void); +unsigned SEGGER_RTT_Read (unsigned BufferIndex, void* pBuffer, unsigned BufferSize); +unsigned SEGGER_RTT_ReadNoLock (unsigned BufferIndex, void* pData, unsigned BufferSize); +int SEGGER_RTT_SetNameDownBuffer(unsigned BufferIndex, const char* sName); +int SEGGER_RTT_SetNameUpBuffer (unsigned BufferIndex, const char* sName); +int SEGGER_RTT_WaitKey (void); +unsigned SEGGER_RTT_Write (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes); +unsigned SEGGER_RTT_WriteNoLock (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes); +unsigned SEGGER_RTT_WriteSkipNoLock (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes); +unsigned SEGGER_RTT_WriteString (unsigned BufferIndex, const char* s); +// +// Function macro for performance optimization +// +#define SEGGER_RTT_HASDATA(n) (_SEGGER_RTT.aDown[n].WrOff - _SEGGER_RTT.aDown[n].RdOff) + +/********************************************************************* +* +* RTT "Terminal" API functions +* +********************************************************************** +*/ +int SEGGER_RTT_SetTerminal (char TerminalId); +int SEGGER_RTT_TerminalOut (char TerminalId, const char* s); + +/********************************************************************* +* +* RTT printf functions (require SEGGER_RTT_printf.c) +* +********************************************************************** +*/ +int SEGGER_RTT_printf(unsigned BufferIndex, const char * sFormat, ...); + +/********************************************************************* +* +* Defines +* +********************************************************************** +*/ + +// +// Operating modes. Define behavior if buffer is full (not enough space for entire message) +// +#define SEGGER_RTT_MODE_NO_BLOCK_SKIP (0U) // Skip. Do not block, output nothing. (Default) +#define SEGGER_RTT_MODE_NO_BLOCK_TRIM (1U) // Trim: Do not block, output as much as fits. +#define SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL (2U) // Block: Wait until there is space in the buffer. +#define SEGGER_RTT_MODE_MASK (3U) + +// +// Control sequences, based on ANSI. +// Can be used to control color, and clear the screen +// +#define RTT_CTRL_RESET "\e[0m" // Reset to default colors +#define RTT_CTRL_CLEAR "\e[2J" // Clear screen, reposition cursor to top left + +#define RTT_CTRL_TEXT_BLACK "\e[2;30m" +#define RTT_CTRL_TEXT_RED "\e[2;31m" +#define RTT_CTRL_TEXT_GREEN "\e[2;32m" +#define RTT_CTRL_TEXT_YELLOW "\e[2;33m" +#define RTT_CTRL_TEXT_BLUE "\e[2;34m" +#define RTT_CTRL_TEXT_MAGENTA "\e[2;35m" +#define RTT_CTRL_TEXT_CYAN "\e[2;36m" +#define RTT_CTRL_TEXT_WHITE "\e[2;37m" + +#define RTT_CTRL_TEXT_BRIGHT_BLACK "\e[1;30m" +#define RTT_CTRL_TEXT_BRIGHT_RED "\e[1;31m" +#define RTT_CTRL_TEXT_BRIGHT_GREEN "\e[1;32m" +#define RTT_CTRL_TEXT_BRIGHT_YELLOW "\e[1;33m" +#define RTT_CTRL_TEXT_BRIGHT_BLUE "\e[1;34m" +#define RTT_CTRL_TEXT_BRIGHT_MAGENTA "\e[1;35m" +#define RTT_CTRL_TEXT_BRIGHT_CYAN "\e[1;36m" +#define RTT_CTRL_TEXT_BRIGHT_WHITE "\e[1;37m" + +#define RTT_CTRL_BG_BLACK "\e[24;40m" +#define RTT_CTRL_BG_RED "\e[24;41m" +#define RTT_CTRL_BG_GREEN "\e[24;42m" +#define RTT_CTRL_BG_YELLOW "\e[24;43m" +#define RTT_CTRL_BG_BLUE "\e[24;44m" +#define RTT_CTRL_BG_MAGENTA "\e[24;45m" +#define RTT_CTRL_BG_CYAN "\e[24;46m" +#define RTT_CTRL_BG_WHITE "\e[24;47m" + +#define RTT_CTRL_BG_BRIGHT_BLACK "\e[4;40m" +#define RTT_CTRL_BG_BRIGHT_RED "\e[4;41m" +#define RTT_CTRL_BG_BRIGHT_GREEN "\e[4;42m" +#define RTT_CTRL_BG_BRIGHT_YELLOW "\e[4;43m" +#define RTT_CTRL_BG_BRIGHT_BLUE "\e[4;44m" +#define RTT_CTRL_BG_BRIGHT_MAGENTA "\e[4;45m" +#define RTT_CTRL_BG_BRIGHT_CYAN "\e[4;46m" +#define RTT_CTRL_BG_BRIGHT_WHITE "\e[4;47m" + + +#endif + +/*************************** End of file ****************************/ diff --git a/components/drivers_ext/segger_rtt/SEGGER_RTT_Conf.h b/components/drivers_ext/segger_rtt/SEGGER_RTT_Conf.h new file mode 100644 index 0000000..ac99664 --- /dev/null +++ b/components/drivers_ext/segger_rtt/SEGGER_RTT_Conf.h @@ -0,0 +1,135 @@ +/********************************************************************* +* SEGGER MICROCONTROLLER GmbH & Co. KG * +* Solutions for real time microcontroller applications * +********************************************************************** +* * +* (c) 2014 - 2015 SEGGER Microcontroller GmbH & Co. KG * +* * +* www.segger.com Support: support@segger.com * +* * +********************************************************************** +---------------------------------------------------------------------- +File : SEGGER_RTT_Conf.h +Purpose : Implementation of SEGGER real-time transfer (RTT) which + allows real-time communication on targets which support + debugger memory accesses while the CPU is running. +---------------------------END-OF-HEADER------------------------------ +*/ + +#ifndef SEGGER_RTT_CONF_H +#define SEGGER_RTT_CONF_H + +#ifdef __ICCARM__ + #include +#endif + +/********************************************************************* +* +* Defines, configurable +* +********************************************************************** +*/ + +#define SEGGER_RTT_MAX_NUM_UP_BUFFERS (2) // Max. number of up-buffers (T->H) available on this target (Default: 2) +#define SEGGER_RTT_MAX_NUM_DOWN_BUFFERS (2) // Max. number of down-buffers (H->T) available on this target (Default: 2) + +#define BUFFER_SIZE_UP (1024) // Size of the buffer for terminal output of target, up to host (Default: 1k) +#define BUFFER_SIZE_DOWN (16) // Size of the buffer for terminal input to target from host (Usually keyboard input) (Default: 16) + +#define SEGGER_RTT_PRINTF_BUFFER_SIZE (64u) // Size of buffer for RTT printf to bulk-send chars via RTT (Default: 64) + +#define SEGGER_RTT_MODE_DEFAULT SEGGER_RTT_MODE_NO_BLOCK_SKIP // Mode for pre-initialized terminal channel (buffer 0) + +// +// Target is not allowed to perform other RTT operations while string still has not been stored completely. +// Otherwise we would probably end up with a mixed string in the buffer. +// If using RTT from within interrupts, multiple tasks or multi processors, define the SEGGER_RTT_LOCK() and SEGGER_RTT_UNLOCK() function here. +// +/********************************************************************* +* +* RTT lock configuration for SEGGER Embedded Studio, +* Rowley CrossStudio and GCC +*/ +#if (defined __SES_ARM) || (defined __CROSSWORKS_ARM) || (defined __GNUC__) + #ifdef __ARM_ARCH_6M__ + #define SEGGER_RTT_LOCK(SavedState) { \ + asm volatile ("mrs %0, primask \n\t" \ + "mov r1, $1 \n\t" \ + "msr primask, r1 \n\t" \ + : "=r" (SavedState) \ + : \ + : "r1" \ + ); \ + } + + #define SEGGER_RTT_UNLOCK(SavedState) { \ + asm volatile ("msr primask, %0 \n\t" \ + : \ + : "r" (SavedState) \ + : \ + ); \ + } + + #elif (defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)) + #define SEGGER_RTT_LOCK(SavedState) { \ + asm volatile ("mrs %0, basepri \n\t" \ + "mov r1, $128 \n\t" \ + "msr basepri, r1 \n\t" \ + : "=r" (SavedState) \ + : \ + : "r1" \ + ); \ + } + #define SEGGER_RTT_UNLOCK(SavedState) { \ + asm volatile ("msr basepri, %0 \n\t" \ + : \ + : "r" (SavedState) \ + : \ + ); \ + } + #else + #define SEGGER_RTT_LOCK(SavedState) (void)(SavedState) + #define SEGGER_RTT_UNLOCK(SavedState) (void)(SavedState) + #endif +#endif + +/********************************************************************* +* +* RTT lock configuration for IAR EWARM +*/ +#ifdef __ICCARM__ + #if (defined (__ARM7M__) && (__CORE__ == __ARM7M__)) + #define SEGGER_RTT_LOCK(SavedState) { \ + SavedState = __get_PRIMASK(); \ + __set_PRIMASK(1); \ + } + + #define SEGGER_RTT_UNLOCK(SavedState) { \ + __set_PRIMASK(SavedState); \ + } + #elif (defined (__ARM7EM__) && (__CORE__ == __ARM7EM__)) + #define SEGGER_RTT_LOCK(SavedState) { \ + SavedState = __get_BASEPRI(); \ + __set_BASEPRI(128); \ + } + + #define SEGGER_RTT_UNLOCK(SavedState) { \ + __set_BASEPRI(SavedState); \ + } + #endif +#endif + +/********************************************************************* +* +* RTT lock configuration fallback +*/ +#ifndef SEGGER_RTT_LOCK + #define SEGGER_RTT_LOCK(SavedState) (void)(SavedState) +#endif + +#ifndef SEGGER_RTT_UNLOCK + #define SEGGER_RTT_UNLOCK(SavedState) (void)(SavedState) +#endif + +#endif +/*************************** End of file ****************************/ diff --git a/components/drivers_ext/segger_rtt/SEGGER_RTT_printf.c b/components/drivers_ext/segger_rtt/SEGGER_RTT_printf.c new file mode 100644 index 0000000..d1878f3 --- /dev/null +++ b/components/drivers_ext/segger_rtt/SEGGER_RTT_printf.c @@ -0,0 +1,492 @@ +/********************************************************************* +* SEGGER MICROCONTROLLER GmbH & Co. KG * +* Solutions for real time microcontroller applications * +********************************************************************** +* * +* (c) 2014 - 2015 SEGGER Microcontroller GmbH & Co. KG * +* * +* www.segger.com Support: support@segger.com * +* * +********************************************************************** +* * +* All rights reserved. * +* * +* * This software may in its unmodified form be freely redistributed * +* in source form. * +* * The source code may be modified, provided the source code * +* retains the above copyright notice, this list of conditions and * +* the following disclaimer. * +* * Modified versions of this software in source or linkable form * +* may not be distributed without prior consent of SEGGER. * +* * This software may only be used for communication with SEGGER * +* J-Link debug probes. * +* * +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * +* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * +* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR * +* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * +* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * +* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * +* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * +* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * +* DAMAGE. * +* * +********************************************************************** +---------------------------END-OF-HEADER------------------------------ +File : SEGGER_RTT_printf.c +Purpose : Replacement for printf to write formatted data via RTT +---------------------------------------------------------------------- +*/ +#include "SEGGER_RTT.h" +#include "SEGGER_RTT_Conf.h" + +/********************************************************************* +* +* Defines, configurable +* +********************************************************************** +*/ + +#ifndef SEGGER_RTT_PRINTF_BUFFER_SIZE + #define SEGGER_RTT_PRINTF_BUFFER_SIZE (64) +#endif + +#include +#include + + +#define FORMAT_FLAG_LEFT_JUSTIFY (1u << 0) +#define FORMAT_FLAG_PAD_ZERO (1u << 1) +#define FORMAT_FLAG_PRINT_SIGN (1u << 2) +#define FORMAT_FLAG_ALTERNATE (1u << 3) + +/********************************************************************* +* +* Types +* +********************************************************************** +*/ + +typedef struct { + char* pBuffer; + unsigned BufferSize; + unsigned Cnt; + + int ReturnValue; + + unsigned RTTBufferIndex; +} SEGGER_RTT_PRINTF_DESC; + +/********************************************************************* +* +* Function prototypes +* +********************************************************************** +*/ +int SEGGER_RTT_vprintf(unsigned BufferIndex, const char * sFormat, va_list * pParamList); + +/********************************************************************* +* +* Static code +* +********************************************************************** +*/ +/********************************************************************* +* +* _StoreChar +*/ +static void _StoreChar(SEGGER_RTT_PRINTF_DESC * p, char c) { + unsigned Cnt; + + Cnt = p->Cnt; + if ((Cnt + 1u) <= p->BufferSize) { + *(p->pBuffer + Cnt) = c; + p->Cnt = Cnt + 1u; + p->ReturnValue++; + } + // + // Write part of string, when the buffer is full + // + if (p->Cnt == p->BufferSize) { + if (SEGGER_RTT_Write(p->RTTBufferIndex, p->pBuffer, p->Cnt) != p->Cnt) { + p->ReturnValue = -1; + } else { + p->Cnt = 0u; + } + } +} + +/********************************************************************* +* +* _PrintUnsigned +*/ +static void _PrintUnsigned(SEGGER_RTT_PRINTF_DESC * pBufferDesc, unsigned v, unsigned Base, unsigned NumDigits, unsigned FieldWidth, unsigned FormatFlags) { + static const char _aV2C[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; + unsigned Div; + unsigned Digit; + unsigned Number; + unsigned Width; + char c; + + Number = v; + Digit = 1u; + // + // Get actual field width + // + Width = 1u; + while (Number >= Base) { + Number = (Number / Base); + Width++; + } + if (NumDigits > Width) { + Width = NumDigits; + } + // + // Print leading chars if necessary + // + if ((FormatFlags & FORMAT_FLAG_LEFT_JUSTIFY) == 0u) { + if (FieldWidth != 0u) { + if (((FormatFlags & FORMAT_FLAG_PAD_ZERO) == FORMAT_FLAG_PAD_ZERO) && (NumDigits == 0u)) { + c = '0'; + } else { + c = ' '; + } + while ((FieldWidth != 0u) && (Width < FieldWidth)) { + FieldWidth--; + _StoreChar(pBufferDesc, c); + if (pBufferDesc->ReturnValue < 0) { + break; + } + } + } + } + if (pBufferDesc->ReturnValue >= 0) { + // + // Compute Digit. + // Loop until Digit has the value of the highest digit required. + // Example: If the output is 345 (Base 10), loop 2 times until Digit is 100. + // + while (1) { + if (NumDigits > 1u) { // User specified a min number of digits to print? => Make sure we loop at least that often, before checking anything else (> 1 check avoids problems with NumDigits being signed / unsigned) + NumDigits--; + } else { + Div = v / Digit; + if (Div < Base) { // Is our divider big enough to extract the highest digit from value? => Done + break; + } + } + Digit *= Base; + } + // + // Output digits + // + do { + Div = v / Digit; + v -= Div * Digit; + _StoreChar(pBufferDesc, _aV2C[Div]); + if (pBufferDesc->ReturnValue < 0) { + break; + } + Digit /= Base; + } while (Digit); + // + // Print trailing spaces if necessary + // + if ((FormatFlags & FORMAT_FLAG_LEFT_JUSTIFY) == FORMAT_FLAG_LEFT_JUSTIFY) { + if (FieldWidth != 0u) { + while ((FieldWidth != 0u) && (Width < FieldWidth)) { + FieldWidth--; + _StoreChar(pBufferDesc, ' '); + if (pBufferDesc->ReturnValue < 0) { + break; + } + } + } + } + } +} + +/********************************************************************* +* +* _PrintInt +*/ +static void _PrintInt(SEGGER_RTT_PRINTF_DESC * pBufferDesc, int v, unsigned Base, unsigned NumDigits, unsigned FieldWidth, unsigned FormatFlags) { + unsigned Width; + int Number; + + Number = (v < 0) ? -v : v; + + // + // Get actual field width + // + Width = 1u; + while (Number >= (int)Base) { + Number = (Number / (int)Base); + Width++; + } + if (NumDigits > Width) { + Width = NumDigits; + } + if ((FieldWidth > 0u) && ((v < 0) || ((FormatFlags & FORMAT_FLAG_PRINT_SIGN) == FORMAT_FLAG_PRINT_SIGN))) { + FieldWidth--; + } + + // + // Print leading spaces if necessary + // + if ((((FormatFlags & FORMAT_FLAG_PAD_ZERO) == 0u) || (NumDigits != 0u)) && ((FormatFlags & FORMAT_FLAG_LEFT_JUSTIFY) == 0u)) { + if (FieldWidth != 0u) { + while ((FieldWidth != 0u) && (Width < FieldWidth)) { + FieldWidth--; + _StoreChar(pBufferDesc, ' '); + if (pBufferDesc->ReturnValue < 0) { + break; + } + } + } + } + // + // Print sign if necessary + // + if (pBufferDesc->ReturnValue >= 0) { + if (v < 0) { + v = -v; + _StoreChar(pBufferDesc, '-'); + } else if ((FormatFlags & FORMAT_FLAG_PRINT_SIGN) == FORMAT_FLAG_PRINT_SIGN) { + _StoreChar(pBufferDesc, '+'); + } else { + + } + if (pBufferDesc->ReturnValue >= 0) { + // + // Print leading zeros if necessary + // + if (((FormatFlags & FORMAT_FLAG_PAD_ZERO) == FORMAT_FLAG_PAD_ZERO) && ((FormatFlags & FORMAT_FLAG_LEFT_JUSTIFY) == 0u) && (NumDigits == 0u)) { + if (FieldWidth != 0u) { + while ((FieldWidth != 0u) && (Width < FieldWidth)) { + FieldWidth--; + _StoreChar(pBufferDesc, '0'); + if (pBufferDesc->ReturnValue < 0) { + break; + } + } + } + } + if (pBufferDesc->ReturnValue >= 0) { + // + // Print number without sign + // + _PrintUnsigned(pBufferDesc, (unsigned)v, Base, NumDigits, FieldWidth, FormatFlags); + } + } + } +} + +/********************************************************************* +* +* Public code +* +********************************************************************** +*/ +/********************************************************************* +* +* SEGGER_RTT_vprintf +* +* Function description +* Stores a formatted string in SEGGER RTT control block. +* This data is read by the host. +* +* Parameters +* BufferIndex Index of "Up"-buffer to be used. (e.g. 0 for "Terminal") +* sFormat Pointer to format string +* pParamList Pointer to the list of arguments for the format string +* +* Return values +* >= 0: Number of bytes which have been stored in the "Up"-buffer. +* < 0: Error +*/ +int SEGGER_RTT_vprintf(unsigned BufferIndex, const char * sFormat, va_list * pParamList) { + char c; + SEGGER_RTT_PRINTF_DESC BufferDesc; + int v; + unsigned NumDigits; + unsigned FormatFlags; + unsigned FieldWidth; + char acBuffer[SEGGER_RTT_PRINTF_BUFFER_SIZE]; + + BufferDesc.pBuffer = acBuffer; + BufferDesc.BufferSize = SEGGER_RTT_PRINTF_BUFFER_SIZE; + BufferDesc.Cnt = 0u; + BufferDesc.RTTBufferIndex = BufferIndex; + BufferDesc.ReturnValue = 0; + + do { + c = *sFormat; + sFormat++; + if (c == 0u) { + break; + } + if (c == '%') { + // + // Filter out flags + // + FormatFlags = 0u; + v = 1; + do { + c = *sFormat; + switch (c) { + case '-': FormatFlags |= FORMAT_FLAG_LEFT_JUSTIFY; sFormat++; break; + case '0': FormatFlags |= FORMAT_FLAG_PAD_ZERO; sFormat++; break; + case '+': FormatFlags |= FORMAT_FLAG_PRINT_SIGN; sFormat++; break; + case '#': FormatFlags |= FORMAT_FLAG_ALTERNATE; sFormat++; break; + default: v = 0; break; + } + } while (v); + // + // filter out field with + // + FieldWidth = 0u; + do { + c = *sFormat; + if ((c < '0') || (c > '9')) { + break; + } + sFormat++; + FieldWidth = (FieldWidth * 10u) + ((unsigned)c - '0'); + } while (1); + + // + // Filter out precision (number of digits to display) + // + NumDigits = 0u; + c = *sFormat; + if (c == '.') { + sFormat++; + do { + c = *sFormat; + if ((c < '0') || (c > '9')) { + break; + } + sFormat++; + NumDigits = NumDigits * 10u + ((unsigned)c - '0'); + } while (1); + } + // + // Filter out length modifier + // + c = *sFormat; + do { + if ((c == 'l') || (c == 'h')) { + c = *sFormat; + sFormat++; + } else { + break; + } + } while (1); + // + // Handle specifiers + // + switch (c) { + case 'c': { + char c0; + v = va_arg(*pParamList, int); + c0 = (char)v; + _StoreChar(&BufferDesc, c0); + break; + } + case 'd': + v = va_arg(*pParamList, int); + _PrintInt(&BufferDesc, v, 10u, NumDigits, FieldWidth, FormatFlags); + break; + case 'u': + v = va_arg(*pParamList, int); + _PrintUnsigned(&BufferDesc, (unsigned)v, 10u, NumDigits, FieldWidth, FormatFlags); + break; + case 'x': + case 'X': + v = va_arg(*pParamList, int); + _PrintUnsigned(&BufferDesc, (unsigned)v, 16u, NumDigits, FieldWidth, FormatFlags); + break; + case 's': + { + const char * s = va_arg(*pParamList, const char *); + do { + c = *s; + s++; + if (c == '\0') { + break; + } + _StoreChar(&BufferDesc, c); + } while (BufferDesc.ReturnValue >= 0); + } + break; + case 'p': + v = va_arg(*pParamList, int); + _PrintUnsigned(&BufferDesc, (unsigned)v, 16u, 8u, 8u, 0u); + break; + case '%': + _StoreChar(&BufferDesc, '%'); + break; + default: + break; + } + sFormat++; + } else { + _StoreChar(&BufferDesc, c); + } + } while (BufferDesc.ReturnValue >= 0); + + if (BufferDesc.ReturnValue > 0) { + // + // Write remaining data, if any + // + if (BufferDesc.Cnt != 0u) { + SEGGER_RTT_Write(BufferIndex, acBuffer, BufferDesc.Cnt); + } + BufferDesc.ReturnValue += (int)BufferDesc.Cnt; + } + return BufferDesc.ReturnValue; +} + +/********************************************************************* +* +* SEGGER_RTT_printf +* +* Function description +* Stores a formatted string in SEGGER RTT control block. +* This data is read by the host. +* +* Parameters +* BufferIndex Index of "Up"-buffer to be used. (e.g. 0 for "Terminal") +* sFormat Pointer to format string, followed by the arguments for conversion +* +* Return values +* >= 0: Number of bytes which have been stored in the "Up"-buffer. +* < 0: Error +* +* Notes +* (1) Conversion specifications have following syntax: +* %[flags][FieldWidth][.Precision]ConversionSpecifier +* (2) Supported flags: +* -: Left justify within the field width +* +: Always print sign extension for signed conversions +* 0: Pad with 0 instead of spaces. Ignored when using '-'-flag or precision +* Supported conversion specifiers: +* c: Print the argument as one char +* d: Print the argument as a signed integer +* u: Print the argument as an unsigned integer +* x: Print the argument as an hexadecimal integer +* s: Print the string pointed to by the argument +* p: Print the argument as an 8-digit hexadecimal integer. (Argument shall be a pointer to void.) +*/ +int SEGGER_RTT_printf(unsigned BufferIndex, const char * sFormat, ...) { + va_list ParamList; + + va_start(ParamList, sFormat); + return SEGGER_RTT_vprintf(BufferIndex, sFormat, &ParamList); +} +/*************************** End of file ****************************/ diff --git a/components/drivers_ext/synaptics_touchpad/synaptics_touchpad.c b/components/drivers_ext/synaptics_touchpad/synaptics_touchpad.c new file mode 100644 index 0000000..bc955cf --- /dev/null +++ b/components/drivers_ext/synaptics_touchpad/synaptics_touchpad.c @@ -0,0 +1,115 @@ +/* Copyright (c) 2009 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 + +#include "twi_master.h" +#include "synaptics_touchpad.h" + +/*lint ++flb "Enter library region" */ + +#define PRODUCT_ID_BYTES 10U //!< Number of bytes to expect to be in product ID + +static uint8_t m_device_address; // !< Device address in bits [7:1] +static const uint8_t expected_product_id[PRODUCT_ID_BYTES] = {'T', 'M', '1', '9', '4', '4', '-', '0', '0', '2'}; //!< Product ID expected to get from product ID query + +bool touchpad_init(uint8_t device_address) +{ + bool transfer_succeeded = true; + + m_device_address = (uint8_t)(device_address << 1); + + // Do a soft reset + uint8_t reset_command = 0x01; + transfer_succeeded &= touchpad_write_register(TOUCHPAD_RESET, reset_command); + + // Page select 0 + uint8_t page_to_select = 0x00; + transfer_succeeded &= touchpad_write_register(TOUCHPAD_PAGESELECT, page_to_select); + + // Read and verify product ID + transfer_succeeded &= touchpad_product_id_verify(); + + return transfer_succeeded; +} + + +bool touchpad_product_id_verify(void) +{ + bool transfer_succeeded = true; + uint8_t product_id[PRODUCT_ID_BYTES]; + transfer_succeeded &= touchpad_product_id_read(product_id, PRODUCT_ID_BYTES); + + for (uint8_t i = 0; i < 10; i++) + { + if (product_id[i] != expected_product_id[i]) + { + transfer_succeeded = false; + } + } + + return transfer_succeeded; +} + +bool touchpad_reset(void) +{ + uint8_t w2_data[2] = {TOUCHPAD_COMMAND, 0x01}; + + return twi_master_transfer(m_device_address, w2_data, 2, TWI_ISSUE_STOP); +} + +bool touchpad_interrupt_status_read(uint8_t *interrupt_status) +{ + return touchpad_read_register(TOUCHPAD_INT_STATUS, interrupt_status); +} + +bool touchpad_set_sleep_mode(TouchpadSleepMode_t mode) +{ + return touchpad_write_register(TOUCHPAD_CONTROL, (uint8_t)mode); +} + +bool touchpad_read_register(uint8_t register_address, uint8_t *value) +{ + bool transfer_succeeded = true; + transfer_succeeded &= twi_master_transfer(m_device_address, ®ister_address, 1, TWI_DONT_ISSUE_STOP); + if (transfer_succeeded) + { + transfer_succeeded &= twi_master_transfer(m_device_address | TWI_READ_BIT, value, 1, TWI_ISSUE_STOP); + } + return transfer_succeeded; +} + +bool touchpad_write_register(uint8_t register_address, const uint8_t value) +{ + uint8_t w2_data[2]; + + w2_data[0] = register_address; + w2_data[1] = value; + return twi_master_transfer(m_device_address, w2_data, 2, TWI_ISSUE_STOP); +} + +bool touchpad_product_id_read(uint8_t * product_id, uint8_t product_id_bytes) +{ + uint8_t w2_data[1]; + bool transfer_succeeded = true; + + w2_data[0] = TOUCHPAD_PRODUCT_ID; + transfer_succeeded &= twi_master_transfer(m_device_address, w2_data, 1, TWI_DONT_ISSUE_STOP); + if (transfer_succeeded) + { + transfer_succeeded &= twi_master_transfer(m_device_address | TWI_READ_BIT, product_id, product_id_bytes, TWI_ISSUE_STOP); + } + return transfer_succeeded; +} + +/*lint --flb "Leave library region" */ diff --git a/components/drivers_ext/synaptics_touchpad/synaptics_touchpad.h b/components/drivers_ext/synaptics_touchpad/synaptics_touchpad.h new file mode 100644 index 0000000..a892f59 --- /dev/null +++ b/components/drivers_ext/synaptics_touchpad/synaptics_touchpad.h @@ -0,0 +1,128 @@ +/* Copyright (c) 2009 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 SYNAPTICS_TOUCHPAD_H +#define SYNAPTICS_TOUCHPAD_H + +/*lint ++flb "Enter library region" */ + +#include +#include + +/** @file +* @brief Synaptics Touchpad driver +* +* +* @defgroup nrf_drivers_synaptics_touchpad Synaptics Touchpad driver. +* @{ +* @ingroup nrf_drivers +* @brief Synaptics Touchpad driver. +*/ + +/** + Touchpad register addresses. +*/ +#define TOUCHPAD_INT_STATUS 0x14 //!< Interrupt status register +#define TOUCHPAD_BUTTON_STATUS 0x41 //!< Button status register +#define TOUCHPAD_FINGER0_REL 0x30 //!< First register in finger delta block +#define TOUCHPAD_GESTURE_FLAGS 0x3A //!< Gesture flags 0 +#define TOUCHPAD_SCROLL 0x3F //!< Scroll zone X / horizontal multifinger scroll +#define TOUCHPAD_CONTROL 0x42 //!< Device control register +#define TOUCHPAD_COMMAND 0x8F //!< Device command register + +#define TOUCHPAD_RESET 0x54 //!< Address of reset +#define TOUCHPAD_PAGESELECT 0xFF //!< Address of page select (can be found in every page at the same address) +#define TOUCHPAD_PRODUCT_ID 0xA2 //!< Address of product ID string + +/** + Operational states +*/ +typedef enum +{ + SleepmodeNormal = 0x00, //!< Normal operation + SleepmodeSensorSleep = 0x01 //!< Low power operation +} TouchpadSleepMode_t; + +/** + @brief Function for Touchpad initialization. + @param device_address TWI address of the device in bits [6:0] + @retval true Touchpad was successfully identified and initialized + @retval false Unexpected product ID or communication failure +*/ +bool touchpad_init(uint8_t device_address); + +/** + @brief Function for attempting to soft-reset the device. + @retval true Reset succeeded + @retval false Reset failed +*/ +bool touchpad_reset(void); + +/** + @brief Function for reading the interrupt status register of the device. This clears all interrupts. + @param interrupt_status Address to store interrupt status to. + @retval true Register contents read successfully to interrupt_status + @retval false Reading failed +*/ +bool touchpad_interrupt_status_read(uint8_t *interrupt_status); + +/** + @brief Function for sleep mode configuration. + @note In low power mode the touchpad do not generate interrupts from touch sensing. + @param[in] mode Operational mode + @retval true Sleep mode set successfully + @retval false Sleep mode setting failed +*/ +bool touchpad_set_sleep_mode(TouchpadSleepMode_t mode); + +/** + @brief Function for reading a touchpad register contents over TWI. + @param[in] register_address Register address + @param[out] value Pointer to a data buffer where read data will be stored + @retval true Register read succeeded + @retval false Register read failed +*/ +bool touchpad_read_register(uint8_t register_address, uint8_t *value); + +/** + @brief Function for writing a touchpad register contents over TWI. + @param[in] register_address Register address + @param[in] value Value to write to register + @retval true Register write succeeded + @retval false Register write failed +*/ +bool touchpad_write_register(uint8_t register_address, uint8_t value); + +/** + @brief Function for writing touchpad register contents over TWI. + Writes one or more consecutive registers. + @param[out] product_id Pointer to a address to store product ID. Memory must be allocated for product_id_bytes number of bytes. + @param[in] product_id_bytes Number of bytes to read + @retval true Product ID read succeeded + @retval false Product ID read failed +*/ +bool touchpad_product_id_read(uint8_t *product_id, uint8_t product_id_bytes); + +/** + @brief Function for reading and verifying touchpad's product ID. + @retval true Product ID is what was expected + @retval false Product ID was not what was expected +*/ +bool touchpad_product_id_verify(void); + +/** + *@} + **/ + +/*lint --flb "Leave library region" */ + +#endif /* __TOUCHPAD_H__ */ diff --git a/components/drivers_nrf/ble_flash/ble_flash.c b/components/drivers_nrf/ble_flash/ble_flash.c new file mode 100644 index 0000000..fbe3034 --- /dev/null +++ b/components/drivers_nrf/ble_flash/ble_flash.c @@ -0,0 +1,286 @@ +/* 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 "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/components/drivers_nrf/ble_flash/ble_flash.h b/components/drivers_nrf/ble_flash/ble_flash.h new file mode 100644 index 0000000..22c1583 --- /dev/null +++ b/components/drivers_nrf/ble_flash/ble_flash.h @@ -0,0 +1,142 @@ +/* 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 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->BOOTLOADERADDR != BLE_FLASH_EMPTY_MASK) \ + ? (NRF_UICR->BOOTLOADERADDR / 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/components/drivers_nrf/clock/nrf_drv_clock.c b/components/drivers_nrf/clock/nrf_drv_clock.c new file mode 100644 index 0000000..b4ad35d --- /dev/null +++ b/components/drivers_nrf/clock/nrf_drv_clock.c @@ -0,0 +1,458 @@ +/* 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 "nrf_drv_clock.h" +#include "nrf_error.h" +#include "nordic_common.h" + +#ifdef SOFTDEVICE_PRESENT +#include "nrf_sdm.h" +#include "nrf_soc.h" +#else +#include "app_util_platform.h" +#endif // SOFTDEVICE_PRESENT + +/*lint -save -e652 */ +#define NRF_CLOCK_LF_SRC_RC CLOCK_LFCLKSRC_SRC_RC +#define NRF_CLOCK_LF_SRC_Xtal CLOCK_LFCLKSRC_SRC_Xtal +#define NRF_CLOCK_LF_SRC_Synth CLOCK_LFCLKSRC_SRC_Synth +/*lint -restore */ + +#define INT_MAX 0xFFFFFFFF + +/**@brief CLOCK control block. */ +typedef struct +{ + bool module_initialized; /*< Indicate the state of module */ + uint32_t hfclk_requests; /*< High frequency clock state. */ +#ifndef SOFTDEVICE_PRESENT + uint32_t lfclk_requests; /*< Low frequency clock state. */ +#if CLOCK_CONFIG_LF_SRC == NRF_CLOCK_LF_SRC_RC + volatile bool calibration_in_progress; /*< Indicate the state of calibration */ +#endif //CLOCK_CONFIG_LF_SRC == NRF_CLOCK_LF_SRC_RC +#endif //SOFTDEVICE_PRESENT +}nrf_drv_clock_cb_t; + +static nrf_drv_clock_cb_t m_clock_cb; + +#if (CLOCK_CONFIG_LF_SRC == NRF_CLOCK_LF_SRC_RC) && (!defined SOFTDEVICE_PRESENT) + +static const nrf_drv_clock_config_t m_default_config = NRF_DRV_CLOCK_DEAFULT_CONFIG; + +static uint32_t m_in_critical_region = 0; + +#define CLOCK_CRITICAL_REGION_ENTER() \ + do { \ + nrf_drv_common_irq_disable(POWER_CLOCK_IRQn); \ + __DSB(); \ + __ISB(); \ + m_in_critical_region++; \ + } while (0) + +#define CLOCK_CRITICAL_REGION_EXIT() \ + do { \ + m_in_critical_region--; \ + if (m_in_critical_region == 0) \ + { \ + NVIC_EnableIRQ(POWER_CLOCK_IRQn); \ + } \ + } while (0) + +#else + +#define CLOCK_CRITICAL_REGION_ENTER() \ + do { \ + } while (0) + +#define CLOCK_CRITICAL_REGION_EXIT() \ + do { \ + } while (0) + +#endif + + +#ifndef SOFTDEVICE_PRESENT +/**@brief Function for starting hfclk. This function will return immediately without waiting for start. + */ +static void hfclk_start(void) +{ + nrf_clock_event_clear(NRF_CLOCK_EVENT_HFCLKSTARTED); + nrf_clock_task_trigger(NRF_CLOCK_TASK_HFCLKSTART); +} + + +/**@brief Function for stopping hfclk. + */ +static void hfclk_stop(void) +{ + nrf_clock_task_trigger(NRF_CLOCK_TASK_HFCLKSTOP); + while (nrf_clock_hf_src_get() == NRF_CLOCK_HF_SRC_HIGH_ACCURACY) + { + + } +} + + +/**@brief Function for starting lfclk. This function will return immediately without waiting for start. + * It will also set up calibration if it is needed. + */ +static void lfclk_start(void) +{ + nrf_clock_event_clear(NRF_CLOCK_EVENT_LFCLKSTARTED); + nrf_clock_task_trigger(NRF_CLOCK_TASK_LFCLKSTART); + +#if CLOCK_CONFIG_LF_SRC == NRF_CLOCK_LF_SRC_RC + nrf_clock_int_enable(NRF_CLOCK_INT_DONE_MASK + | NRF_CLOCK_INT_CTTO_MASK); + nrf_clock_event_clear(NRF_CLOCK_EVENT_CTTO); + nrf_clock_task_trigger(NRF_CLOCK_TASK_CTSTART); +#endif +} + + +/**@brief Function for stopping lfclk and calibration(if it was set up). + */ +static void lfclk_stop(void) +{ +#if CLOCK_CONFIG_LF_SRC == NRF_CLOCK_LF_SRC_RC + nrf_clock_int_disable(NRF_CLOCK_INT_DONE_MASK + | NRF_CLOCK_INT_CTTO_MASK + | NRF_CLOCK_INT_HF_STARTED_MASK); + m_clock_cb.calibration_in_progress = false; + nrf_clock_task_trigger(NRF_CLOCK_TASK_CTSTOP); +#endif // CLOCK_CONFIG_LF_SRC == NRF_CLOCK_LF_SRC_RC + + nrf_clock_task_trigger(NRF_CLOCK_TASK_LFCLKSTOP); + while (nrf_clock_lf_is_running()) + { + + } +} + + +/**@brief Function for controling lfclk. This function decides whether lfclk should be started or stopped. + */ +static void lfclk_control(void) +{ + CLOCK_CRITICAL_REGION_ENTER(); + + if (m_clock_cb.lfclk_requests > 0) + { + if ((nrf_clock_lf_is_running() == false) + && (nrf_clock_lf_start_task_status_get() == NRF_CLOCK_START_TASK_NOT_TRIGGERED)) + { + lfclk_start(); + } + } + else + { + if (nrf_clock_lf_is_running() + || (nrf_clock_lf_start_task_status_get() == NRF_CLOCK_START_TASK_TRIGGERED)) + { + lfclk_stop(); + } + } + CLOCK_CRITICAL_REGION_EXIT(); +} + + +/**@brief Function for controling hfclk. + * + * @param[in] interrupt_enable Determines if this function will enable interrupt + * during hflck start. + * + * @retval true hfclk was started + * @retval false hfclk was not started + */ +static bool hfclk_control(bool interrupt_enable) +{ + bool result = false; + + CLOCK_CRITICAL_REGION_ENTER(); + + if ((m_clock_cb.hfclk_requests > 0) +#if CLOCK_CONFIG_LF_SRC == NRF_CLOCK_LF_SRC_Synth + || (m_clock_cb.lfclk_requests > 0) +#elif CLOCK_CONFIG_LF_SRC == NRF_CLOCK_LF_SRC_RC + || (m_clock_cb.calibration_in_progress == true) +#endif + ) + { + if ((nrf_clock_hf_src_get() != NRF_CLOCK_HF_SRC_HIGH_ACCURACY) + && (nrf_clock_hf_start_task_status_get() == NRF_CLOCK_START_TASK_NOT_TRIGGERED)) + { + result = true; + + if (interrupt_enable) + { + nrf_clock_int_enable(NRF_CLOCK_INT_HF_STARTED_MASK); + } + hfclk_start(); + } + } + else + { + if ((nrf_clock_hf_src_get() == NRF_CLOCK_HF_SRC_HIGH_ACCURACY) + || (nrf_clock_hf_start_task_status_get() == NRF_CLOCK_START_TASK_TRIGGERED)) + { + hfclk_stop(); + } + } + CLOCK_CRITICAL_REGION_EXIT(); + + return result; +} +#endif // SOFTDEVICE_PRESENT + + +ret_code_t nrf_drv_clock_init(nrf_drv_clock_config_t const * p_config) +{ + uint32_t result = NRF_SUCCESS; + + if (m_clock_cb.module_initialized == false) + { + m_clock_cb.hfclk_requests = 0; +#ifndef SOFTDEVICE_PRESENT + m_clock_cb.lfclk_requests = 0; + + nrf_clock_xtalfreq_set(CLOCK_CONFIG_XTAL_FREQ); + nrf_clock_lf_src_set((nrf_clock_lf_src_t)CLOCK_CONFIG_LF_SRC); + +#if CLOCK_CONFIG_LF_SRC == NRF_CLOCK_LF_SRC_RC + + m_clock_cb.calibration_in_progress = false; + + nrf_clock_event_clear(NRF_CLOCK_EVENT_HFCLKSTARTED); + nrf_clock_event_clear(NRF_CLOCK_EVENT_LFCLKSTARTED); + nrf_clock_event_clear(NRF_CLOCK_EVENT_DONE); + nrf_clock_event_clear(NRF_CLOCK_EVENT_CTTO); + + if (p_config == NULL) + { + p_config = &m_default_config; + } + + nrf_clock_cal_timer_timeout_set(p_config->cal_interval); + nrf_drv_common_irq_enable(POWER_CLOCK_IRQn, p_config->interrupt_priority); + +#endif // CLOCK_CONFIG_LF_SRC == NRF_CLOCK_LF_SRC_RC +#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 + } + else + { + result = MODULE_ALREADY_INITIALIZED; + } + + if (result == NRF_SUCCESS) + { + m_clock_cb.module_initialized = true; + } + + return result; +} + + +void nrf_drv_clock_uninit(void) +{ + ASSERT(m_clock_cb.module_initialized); +#ifndef SOFTDEVICE_PRESENT + +#if CLOCK_CONFIG_LF_SRC == NRF_CLOCK_LF_SRC_RC + nrf_drv_common_irq_disable(POWER_CLOCK_IRQn); +#endif // CLOCK_CONFIG_LF_SRC == NRF_CLOCK_LF_SRC_RC + + lfclk_stop(); + hfclk_stop(); +#else + UNUSED_VARIABLE(sd_clock_hfclk_release()); +#endif // SOFTDEVICE_PRESENT + + m_clock_cb.module_initialized = false; +} + + +void nrf_drv_clock_lfclk_request(void) +{ + ASSERT(m_clock_cb.module_initialized); +#ifndef SOFTDEVICE_PRESENT + ASSERT(m_clock_cb.lfclk_requests != INT_MAX); + m_clock_cb.lfclk_requests++; + UNUSED_VARIABLE(hfclk_control(false)); + lfclk_control(); +#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); + m_clock_cb.lfclk_requests--; + UNUSED_VARIABLE(hfclk_control(false)); + lfclk_control(); +#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(void) +{ + ASSERT(m_clock_cb.module_initialized); + ASSERT(m_clock_cb.hfclk_requests != INT_MAX); + m_clock_cb.hfclk_requests++; +#ifndef SOFTDEVICE_PRESENT + UNUSED_VARIABLE(hfclk_control(false)); +#else + if(m_clock_cb.hfclk_requests == 1) + { + UNUSED_VARIABLE(sd_clock_hfclk_request()); + } +#endif // SOFTDEVICE_PRESENT +} + + +void nrf_drv_clock_hfclk_release(void) +{ + ASSERT(m_clock_cb.module_initialized); + ASSERT(m_clock_cb.hfclk_requests > 0); + m_clock_cb.hfclk_requests--; +#ifndef SOFTDEVICE_PRESENT + UNUSED_VARIABLE(hfclk_control(false)); +#else + if(m_clock_cb.hfclk_requests == 0) + { + UNUSED_VARIABLE(sd_clock_hfclk_release()); + } +#endif // SOFTDEVICE_PRESENT +} + + +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(); +#else + uint32_t is_running; + UNUSED_VARIABLE(sd_clock_hfclk_is_running(&is_running)); + result = is_running ? true : false; +#endif + return result; +} + + +ret_code_t nrf_drv_clock_calibration_force(void) +{ +#if ((!defined SOFTDEVICE_PRESENT) && (CLOCK_CONFIG_LF_SRC == NRF_CLOCK_LF_SRC_RC)) + uint32_t result; + ASSERT(m_clock_cb.module_initialized); + if (m_clock_cb.lfclk_requests > 0) + { + result = NRF_SUCCESS; + CLOCK_CRITICAL_REGION_ENTER(); + nrf_clock_task_trigger(NRF_CLOCK_TASK_CTSTOP); + + if (m_clock_cb.calibration_in_progress == false) + { + m_clock_cb.calibration_in_progress = true; + + if (hfclk_control(true) == false) + { + nrf_clock_task_trigger(NRF_CLOCK_TASK_CAL); + } + } + CLOCK_CRITICAL_REGION_EXIT(); + } + else + { + result = NRF_ERROR_INVALID_STATE; + } + return result; +#else // ((!defined SOFTDEVICE_PRESENT) && (CLOCK_CONFIG_LF_SRC == NRF_CLOCK_LF_SRC_RC)) + return NRF_ERROR_FORBIDDEN; +#endif +} + + +ret_code_t nrf_drv_clock_is_calibrating(bool * p_is_calibrating) +{ +#if ((!defined SOFTDEVICE_PRESENT) && (CLOCK_CONFIG_LF_SRC == NRF_CLOCK_LF_SRC_RC)) + ASSERT(m_clock_cb.module_initialized); + *p_is_calibrating = m_clock_cb.calibration_in_progress; + return NRF_SUCCESS; +#else // ((!defined SOFTDEVICE_PRESENT) && (CLOCK_CONFIG_LF_SRC == NRF_CLOCK_LF_SRC_RC)) + return NRF_ERROR_FORBIDDEN; +#endif +} + + +#if ((!defined SOFTDEVICE_PRESENT) && (CLOCK_CONFIG_LF_SRC == NRF_CLOCK_LF_SRC_RC)) +void POWER_CLOCK_IRQHandler(void) +{ + if (nrf_clock_event_check(NRF_CLOCK_EVENT_HFCLKSTARTED) && + nrf_clock_int_enable_check(NRF_CLOCK_INT_HF_STARTED_MASK)) + { + nrf_clock_event_clear(NRF_CLOCK_EVENT_HFCLKSTARTED); + nrf_clock_int_disable(NRF_CLOCK_INT_HF_STARTED_MASK); + + if (m_clock_cb.calibration_in_progress == true) + { + nrf_clock_task_trigger(NRF_CLOCK_TASK_CAL); + } + } + if (nrf_clock_event_check(NRF_CLOCK_EVENT_CTTO) && + nrf_clock_int_enable_check(NRF_CLOCK_INT_CTTO_MASK)) + { + nrf_clock_event_clear(NRF_CLOCK_EVENT_CTTO); + m_clock_cb.calibration_in_progress = true; + + if(hfclk_control(true) == false) + { + nrf_clock_task_trigger(NRF_CLOCK_TASK_CAL); + } + } + + if (nrf_clock_event_check(NRF_CLOCK_EVENT_DONE) && + nrf_clock_int_enable_check(NRF_CLOCK_INT_DONE_MASK)) + { + nrf_clock_event_clear(NRF_CLOCK_EVENT_DONE); + m_clock_cb.calibration_in_progress = false; + UNUSED_VARIABLE(hfclk_control(true)); + nrf_clock_task_trigger(NRF_CLOCK_TASK_CTSTART); + } +} +#endif // ((!defined SOFTDEVICE_PRESENT) && (CLOCK_CONFIG_LF_SRC == NRF_CLOCK_LF_SRC_RC)) + +#undef NRF_CLOCK_LF_SRC_RC +#undef NRF_CLOCK_LF_SRC_Xtal +#undef NRF_CLOCK_LF_SRC_Synth diff --git a/components/drivers_nrf/clock/nrf_drv_clock.h b/components/drivers_nrf/clock/nrf_drv_clock.h new file mode 100644 index 0000000..1fdc606 --- /dev/null +++ b/components/drivers_nrf/clock/nrf_drv_clock.h @@ -0,0 +1,183 @@ +/* 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. + * + */ + +#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 Calibration interval configuration for the low-frequency RC oscillator. + * + * @details Calibration can be affected by radio transmission. To avoid this problem, + * call @ref nrf_drv_clock_calibration_force() and wait for end of calibration. + */ +typedef enum +{ + RC_250MS_CALIBRATION_INTERVAL = 1, /*< Calibration every 250 ms. */ + RC_500MS_CALIBRATION_INTERVAL = 2, /*< Calibration every 500 ms. */ + RC_1000MS_CALIBRATION_INTERVAL = 4, /*< Calibration every 1000 ms. */ + RC_2000MS_CALIBRATION_INTERVAL = 8, /*< Calibration every 2000 ms. */ + RC_4000MS_CALIBRATION_INTERVAL = 16, /*< Calibration every 4000 ms. */ + RC_8000MS_CALIBRATION_INTERVAL = 32, /*< Calibration every 8000 ms. */ + RC_16000MS_CALIBRATION_INTERVAL = 64 /*< Calibration every 16000 ms. */ +} nrf_drv_clock_lf_cal_interval_t; + +/**@brief Struct for Clock initialization. Thise parameters are used when SoftDevice is not present + * and low-frequency RC oscillator is selected. + */ +typedef struct +{ + nrf_drv_clock_lf_cal_interval_t cal_interval; /**< Calibration interval. */ + uint8_t interrupt_priority; /**< Clock interrupt priority. */ +} nrf_drv_clock_config_t; + +/**@brief Clock default configuration.*/ +#define NRF_DRV_CLOCK_DEAFULT_CONFIG \ + { \ + .cal_interval = CLOCK_CONFIG_LF_RC_CAL_INTERVAL, \ + .interrupt_priority = CLOCK_CONFIG_IRQ_PRIORITY, \ + } + +/** + * @brief Function for initialization the nrf_drv_clock module. + * + * After initialization, the module is in power off state (clocks are not requested). + * + * @param[in] p_config Initial configuration. Default configuration used if NULL. + * + * @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(nrf_drv_clock_config_t const * p_config); + +/** + * @brief Function for uninitialization the nrf_drv_clock module. + * + * After uninitialization, the module is in idle state. + */ +void nrf_drv_clock_uninit(void); + +/** + * @brief Function for requesting LFCLK. LFCLK can be repeatedly requested. + * + * @note When Softdevice is enabled, LFCLK is always running. + * + * @details If it is first request, selected LFCLK source will be started. + * The @ref nrf_drv_clock_lfclk_is_running() function can be polled to check if it has started. + */ +void nrf_drv_clock_lfclk_request(void); + +/** + * @brief Function for releasing LFCLK. If there is no more requests, LFCLK source will be stopped. + * + * @note When Softdevice is enabled, LFCLK is always running. + */ +void nrf_drv_clock_lfclk_release(void); + +/** + * @brief Function for checking LFCLK state. + * + * @retval true if the LFCLK is running, false if not. + */ +bool nrf_drv_clock_lfclk_is_running(void); + +/** + * @brief Function for requesting high-accuracy (for \nRFXX it is XTAL) source HFCLK. High-accuracy source + * can be repeatedly requested. + * + * @details The @ref nrf_drv_clock_hfclk_is_running() function can be polled to check if it has started. + */ +void nrf_drv_clock_hfclk_request(void); + +/** + * @brief Function for releasing high-accuracy source HFCLK. If there is no more requests, high-accuracy + * source will be released. + */ +void nrf_drv_clock_hfclk_release(void); + +/** + * @brief Function for checking HFCLK state. + * + * @retval true if the HFCLK is running (for \nRFXX XTAL source), false if not. + */ +bool nrf_drv_clock_hfclk_is_running(void); + +/** + * @brief Function for forcing calibration. + * + * @details This function resets the calibration interval timer. The @ref nrf_drv_clock_is_calibrating() + * function can be polled to check if calibration is still in progress. + * + * @retval NRF_SUCCESS If the procedure was successful. + * @retval NRF_ERROR_FORBIDDEN If Softdevice is present or selected LFCLK source is not RC oscillator. + */ +ret_code_t nrf_drv_clock_calibration_force(void); + +/** + * @brief Function for checking if calibration is in progress. + * + * @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 Softdevice is present or selected LFCLK source is not 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. + * + * @retval Task address. + */ +__STATIC_INLINE uint32_t nrf_drv_clock_ppi_task_addr(nrf_clock_task_t task) +{ + return nrf_clock_task_address_get(task); +} + +/**@brief Function for returning a requested event address for the clock driver module. + * + * @param[in] event One of the peripheral events. + * + * @retval Event address. + */ +__STATIC_INLINE uint32_t nrf_drv_clock_ppi_event_addr(nrf_clock_event_t event) +{ + return nrf_clock_event_address_get(event); +} +/** + *@} + **/ + +/*lint --flb "Leave library region" */ +#endif // NRF_CLOCK_H__ diff --git a/components/drivers_nrf/common/nrf_drv_common.c b/components/drivers_nrf/common/nrf_drv_common.c new file mode 100644 index 0000000..96bf542 --- /dev/null +++ b/components/drivers_nrf/common/nrf_drv_common.c @@ -0,0 +1,31 @@ +/* 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 "nrf_drv_common.h" +#include "nrf_assert.h" +#include "nrf_error.h" + +#ifdef SOFTDEVICE_PRESENT +#include "nrf_soc.h" +#endif + +void nrf_drv_common_irq_enable(IRQn_Type IRQn, uint8_t priority) +{ + +#ifdef SOFTDEVICE_PRESENT + ASSERT((priority == NRF_APP_PRIORITY_LOW) || (priority == NRF_APP_PRIORITY_HIGH)); +#endif + + NVIC_SetPriority(IRQn, priority); + NVIC_ClearPendingIRQ(IRQn); + NVIC_EnableIRQ(IRQn); +} diff --git a/components/drivers_nrf/common/nrf_drv_common.h b/components/drivers_nrf/common/nrf_drv_common.h new file mode 100644 index 0000000..44e6dbb --- /dev/null +++ b/components/drivers_nrf/common/nrf_drv_common.h @@ -0,0 +1,147 @@ +/* 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. + * + */ + +#ifndef NRF_DRV_COMMON_H__ +#define NRF_DRV_COMMON_H__ + +#include "nrf.h" +#include +#include + +/** + * @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 + +/** + * @enum nrf_drv_state_t + * @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; + +/** + * @enum nrf_drv_pwr_ctrl_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 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 + +#endif //NRF_DRV_COMMON_H__ diff --git a/components/drivers_nrf/common/nrf_drv_validation.h b/components/drivers_nrf/common/nrf_drv_validation.h new file mode 100644 index 0000000..88ff384 --- /dev/null +++ b/components/drivers_nrf/common/nrf_drv_validation.h @@ -0,0 +1,21 @@ +/* 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 NRF_DRV_VALIDATION__ +#define NRF_DRV_VALIDATION__ + +#if TIMER1_ENABLED + #if (TIMER1_CONFIG_BIT_WIDTH == TIMER_BITMODE_BITMODE_24Bit) || (TIMER1_CONFIG_BIT_WIDTH == TIMER_BITMODE_BITMODE_32Bit) + #error "TIMER1 instance does not support such BIT_WIDTH" + #endif +#endif +#endif //NRF_DRV_VALIDATION__ diff --git a/components/drivers_nrf/config/nrf_drv_config.h b/components/drivers_nrf/config/nrf_drv_config.h new file mode 100644 index 0000000..3f958ce --- /dev/null +++ b/components/drivers_nrf/config/nrf_drv_config.h @@ -0,0 +1,341 @@ +/* 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. + * + */ + +#ifndef NRF_DRV_CONFIG_H +#define NRF_DRV_CONFIG_H + +/* CLOCK */ +#define CLOCK_CONFIG_XTAL_FREQ NRF_CLOCK_XTALFREQ_Default +#define CLOCK_CONFIG_LF_SRC NRF_CLOCK_LF_SRC_Xtal +#define CLOCK_CONFIG_LF_RC_CAL_INTERVAL RC_2000MS_CALIBRATION_INTERVAL +#define CLOCK_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW + +/* GPIOTE */ +#define GPIOTE_ENABLED 0 + +#if (GPIOTE_ENABLED == 1) +#define GPIOTE_CONFIG_USE_SWI_EGU false +#define GPIOTE_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW +#define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 1 +#endif + +/* TIMER */ +#define TIMER0_ENABLED 0 + +#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_LOW + +#define TIMER0_INSTANCE_INDEX 0 +#endif + +#define TIMER1_ENABLED 0 + +#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_LOW + +#define TIMER1_INSTANCE_INDEX (TIMER0_ENABLED) +#endif + +#define TIMER2_ENABLED 0 + +#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_LOW + +#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_LOW + +#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_LOW + +#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_LOW +#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_LOW +#define RTC1_CONFIG_RELIABLE false + +#define RTC1_INSTANCE_INDEX (RTC0_ENABLED) +#endif + +#define RTC_COUNT (RTC0_ENABLED+RTC1_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_LOW +#endif + +/* SPI */ +#define SPI0_ENABLED 0 + +#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_LOW + +#define SPI0_INSTANCE_INDEX 0 +#endif + +#define SPI1_ENABLED 0 + +#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_LOW + +#define SPI1_INSTANCE_INDEX (SPI0_ENABLED) +#endif + +#define SPI2_ENABLED 0 + +#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_LOW + +#define SPI2_INSTANCE_INDEX (SPI0_ENABLED + SPI1_ENABLED) +#endif + +#define SPI_COUNT (SPI0_ENABLED + SPI1_ENABLED + SPI2_ENABLED) + +/* SPIS */ +#define SPIS0_ENABLED 0 + +#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_LOW + +#define SPIS0_INSTANCE_INDEX 0 +#endif + +#define SPIS1_ENABLED 0 + +#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_LOW + +#define SPIS1_INSTANCE_INDEX SPIS0_ENABLED +#endif + +#define SPIS2_ENABLED 0 + +#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_LOW + +#define SPIS2_INSTANCE_INDEX (SPIS0_ENABLED + SPIS1_ENABLED) +#endif + +#define SPIS_COUNT (SPIS0_ENABLED + SPIS1_ENABLED + SPIS2_ENABLED) + +/* UART */ +#define UART0_ENABLED 0 + +#if (UART0_ENABLED == 1) +#define UART0_CONFIG_HWFC NRF_UART_HWFC_DISABLED +#define UART0_CONFIG_PARITY NRF_UART_PARITY_EXCLUDED +#define UART0_CONFIG_BAUDRATE NRF_UART_BAUDRATE_38400 +#define UART0_CONFIG_PSEL_TXD 0 +#define UART0_CONFIG_PSEL_RXD 0 +#define UART0_CONFIG_PSEL_CTS 0 +#define UART0_CONFIG_PSEL_RTS 0 +#define UART0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW +#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 0 + +#if (TWI0_ENABLED == 1) +#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_LOW + +#define TWI0_INSTANCE_INDEX 0 +#endif + +#define TWI1_ENABLED 0 + +#if (TWI1_ENABLED == 1) +#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_LOW + +#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_LOW + + #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_LOW + + #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 +/** + * @brief Definition for patching PAN problems + * + * Set this definition to nonzero value to patch anomalies + * from MPW3 - first lunch microcontroller. + * + * Concerns: + * - PAN-29: TWIS: incorrect bits in ERRORSRC + * - PAN-30: TWIS: STOP task does not work as expected + */ +#define NRF_TWIS_PATCH_FOR_MPW3 1 + + +/* 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_LOW +#define QDEC_CONFIG_DBFEN false +#define QDEC_CONFIG_SAMPLE_INTEN false +#endif + +/* SAADC */ +#define SAADC_ENABLED 0 + +#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_LOW +#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_LOW +#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 + + +#include "nrf_drv_config_validation.h" + +#endif // NRF_DRV_CONFIG_H diff --git a/components/drivers_nrf/config/nrf_drv_config_validation.h b/components/drivers_nrf/config/nrf_drv_config_validation.h new file mode 100644 index 0000000..7acf1f3 --- /dev/null +++ b/components/drivers_nrf/config/nrf_drv_config_validation.h @@ -0,0 +1,62 @@ +/* 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. + * + */ + +#ifndef NRF_DRV_CONFIG_VALIDATION_H +#define NRF_DRV_CONFIG_VALIDATION_H + +#ifdef NRF52 + +#if (TWI0_ENABLED+SPI0_ENABLED+SPIS0_ENABLED+TWIS0_ENABLED)>1 +#error "TWI0, SPI0, SPIS0 or TWIS0 cannot be enabled together. Instances overlaps." +#endif + +#if (TWI1_ENABLED+SPI1_ENABLED+SPIS1_ENABLED+TWIS1_ENABLED)>1 +#error "TWI1, SPI1, SPIS1 or TWIS1 cannot be enabled together. Instances overlaps." +#endif + +#if (SPI2_ENABLED+SPIS2_ENABLED)>1 +#error "SPI2 and SPIS2 cannot be enabled together. Instances overlaps." +#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 (TIMER3_ENABLED + TIMER4_ENABLED) > 0 +#error "TIMER3 and TIMER4 not present in NRF51" +#endif + +#if (TWI0_ENABLED+SPI0_ENABLED)>1 +#error "TWI0, SPI0 or TWIS0 cannot be enabled together. Peripherals overlaps." +#endif + +#if (TWI1_ENABLED+SPI1_ENABLED)>1 +#error "TWI1, SPI1 or TWIS1 cannot be enabled together. Peripherals overlaps." +#endif + +#if SAADC_ENABLED > 0 +#error "SAADC not present in NRF51." +#endif + +#endif //NRF51 + +#endif //NRF_DRV_CONFIG_VALIDATION_H diff --git a/components/drivers_nrf/delay/nrf_delay.c b/components/drivers_nrf/delay/nrf_delay.c new file mode 100644 index 0000000..e8b561a --- /dev/null +++ b/components/drivers_nrf/delay/nrf_delay.c @@ -0,0 +1,26 @@ +/* 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 +#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/components/drivers_nrf/delay/nrf_delay.h b/components/drivers_nrf/delay/nrf_delay.h new file mode 100644 index 0000000..c68bd9a --- /dev/null +++ b/components/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 void __INLINE nrf_delay_us(uint32_t volatile number_of_us) __attribute__((always_inline)); +static void __INLINE 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/components/drivers_nrf/gpiote/nrf_drv_gpiote.c b/components/drivers_nrf/gpiote/nrf_drv_gpiote.c new file mode 100644 index 0000000..8966342 --- /dev/null +++ b/components/drivers_nrf/gpiote/nrf_drv_gpiote.c @@ -0,0 +1,541 @@ +/* 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 "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. */ + for (i = 0; i < GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS; i++) + { + if (m_cb.port_handlers_pins[i] != PIN_NOT_USED) + { + uint8_t pin_and_sense = m_cb.port_handlers_pins[i]; + nrf_drv_gpiote_pin_t pin = (pin_and_sense & ~SENSE_FIELD_MASK); + nrf_drv_gpiote_evt_handler_t handler = channel_handler_get(channel_port_get(pin)); + if (handler) + { + nrf_gpiote_polarity_t polarity = + (nrf_gpiote_polarity_t)((pin_and_sense & SENSE_FIELD_MASK) >> SENSE_FIELD_POS); + mask = 1 << pin; + 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); + } + handler(pin, polarity); + } + } + } + } + } +} +//lint -restore diff --git a/components/drivers_nrf/gpiote/nrf_drv_gpiote.h b/components/drivers_nrf/gpiote/nrf_drv_gpiote.h new file mode 100644 index 0000000..279a3ac --- /dev/null +++ b/components/drivers_nrf/gpiote/nrf_drv_gpiote.h @@ -0,0 +1,305 @@ +/* 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. + * + */ + +#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. + * + * @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/components/drivers_nrf/hal/nrf_adc.c b/components/drivers_nrf/hal/nrf_adc.c new file mode 100644 index 0000000..1fc591e --- /dev/null +++ b/components/drivers_nrf/hal/nrf_adc.c @@ -0,0 +1,78 @@ +/* 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. + * + */ + +/** + * @file + * @brief ADC HAL implementation + */ + +#include "nrf_adc.h" + +#ifndef NRF52 + +/** + * @brief Function for configuring ADC. + * + * This function power on ADC and configure it. ADC is in DISABLE state after configuration, + * so it should be enabled before using it. + * + * @param[in] config is 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 desired input, starts single conversion, + * waits for its finish and returns result. + * ADC is left in STOP state, given input is selected. + * This function does not check if ADC is initialized and powered. + * + * @param[in] input is 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/components/drivers_nrf/hal/nrf_adc.h b/components/drivers_nrf/hal/nrf_adc.h new file mode 100644 index 0000000..e360c43 --- /dev/null +++ b/components/drivers_nrf/hal/nrf_adc.h @@ -0,0 +1,324 @@ +/* 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. + * + */ + +/** + * @file + * @brief ADC HAL API. + */ + +#ifndef NRF_ADC_H_ +#define NRF_ADC_H_ + +/** + * @defgroup nrf_adc ADC HAL + * @{ + * @ingroup nrf_drivers + * @brief Hardware access layer for managing the analog-to-digital converter. + */ + +#include +#include + +#include "nrf.h" + +/** + * @enum nrf_adc_config_resolution_t + * @brief Resolution of the analog-to-digital converter. + */ +#ifndef NRF52 +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 enabling interrupts from the ADC. + * + * @param[in] interrupts Mask of interrupts to be enabled. + * + * @sa nrf_adc_int_disable() + * @sa nrf_adc_int_get() + */ +__STATIC_INLINE void nrf_adc_int_enable(uint32_t interrupts) +{ + NRF_ADC->INTENSET = interrupts; +} + + +/** + * @brief Function for disabling interrupts from the ADC. + * + * @param[in] interrupts Mask of interrupts to be disabled. + * + * @sa nrf_adc_int_enable() + * @sa nrf_adc_int_get() + */ +__STATIC_INLINE void nrf_adc_int_disable(uint32_t interrupts) +{ + NRF_ADC->INTENCLR = interrupts; +} + + +/** + * @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 cleaning 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) +{ + return (uint32_t *)((uint8_t *)NRF_ADC + 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) +{ + return (uint32_t *)((uint8_t *)NRF_ADC + adc_event); +} + +#endif /* NRF52 */ +/** + *@} + **/ + +#endif /* NRF_ADC_H_ */ diff --git a/components/drivers_nrf/hal/nrf_clock.h b/components/drivers_nrf/hal/nrf_clock.h new file mode 100644 index 0000000..0cbdf6a --- /dev/null +++ b/components/drivers_nrf/hal/nrf_clock.h @@ -0,0 +1,367 @@ +/* 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. + * + */ + +#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_LF_SRC_RC = CLOCK_LFCLKSRC_SRC_RC, /**< Internal 32 kHz RC oscillator. */ + NRF_CLOCK_LF_SRC_Xtal = CLOCK_LFCLKSRC_SRC_Xtal, /**< External 32 kHz crystal. */ + NRF_CLOCK_LF_SRC_Synth = CLOCK_LFCLKSRC_SRC_Synth /**< Internal 32 kHz synthesizer from HFCLK system clock. */ +} nrf_clock_lf_src_t; + +/** + * @brief High-frequency clock sources. + */ +typedef enum +{ + NRF_CLOCK_HF_SRC_LOW_ACCURACY = CLOCK_HFCLKSTAT_SRC_RC, /**< Internal 16 MHz RC oscillator. */ + NRF_CLOCK_HF_SRC_HIGH_ACCURACY = CLOCK_HFCLKSTAT_SRC_Xtal /**< External 16 MHz/32 MHz crystal oscillator. */ +} nrf_clock_hf_src_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. 32MHz. */ + 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) +{ + NRF_CLOCK->INTENSET = 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) +{ + NRF_CLOCK->INTENCLR = int_mask; +} + +/** + * @brief Function for retrieving the state of a specific interrupt. + * + * @param[in] int_mask Interrupt. + * + * @retval true Interrupt is enabled. + * @retval false Interrupt is not enabled. + */ +__STATIC_INLINE bool nrf_clock_int_enable_check(nrf_clock_int_mask_t int_mask) +{ + return (bool)(NRF_CLOCK->INTENCLR & 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. + * + * @retval address of requested task register + */ +__STATIC_INLINE uint32_t nrf_clock_task_address_get(nrf_clock_task_t task) +{ + return ((uint32_t )NRF_CLOCK + task); +} + +/** + * @brief Function for setting a specific task. + * + * @param[in] task 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; +} + +/** + * @brief Function for retrieving the address of a specific event. + * @details This function can be used by the PPI module. + * + * @param[in] event Event. + * + * @retval address of requested event register + */ +__STATIC_INLINE uint32_t nrf_clock_event_address_get(nrf_clock_event_t event) +{ + return ((uint32_t)NRF_CLOCK + event); +} + +/** + * @brief Function for clearing a specific event. + * + * @param[in] event 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 +} + +/** + * @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) +{ + return (bool)*((volatile uint32_t *)((uint8_t *)NRF_CLOCK + 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_lf_src_t source) +{ + NRF_CLOCK->LFCLKSRC = + (uint32_t)((source << CLOCK_LFCLKSRC_SRC_Pos) & CLOCK_LFCLKSRC_SRC_Msk); +} + +/** + * @brief Function for retrieving the selected source for the low-frequency clock. + * + * @retval NRF_CLOCK_LF_SRC_RC If the internal 32 kHz RC oscillator is the selected source for the low-frequency clock. + * @retval NRF_CLOCK_LF_SRC_Xtal If an external 32 kHz crystal oscillator is the selected source for the low-frequency clock. + * @retval NRF_CLOCK_LF_SRC_Synth If the internal 32 kHz synthesizer from the HFCLK is the selected source for the low-frequency clock. + */ +__STATIC_INLINE nrf_clock_lf_src_t nrf_clock_lf_src_get(void) +{ + return (nrf_clock_lf_src_t)((NRF_CLOCK->LFCLKSRC & + CLOCK_LFCLKSRC_SRC_Msk) >> CLOCK_LFCLKSRC_SRC_Pos); +} + +/** + * @brief Function for retrieving the active source of the low-frequency clock. + * + * @retval NRF_CLOCK_LF_SRC_RC If the internal 32 kHz RC oscillator is the active source of the low-frequency clock. + * @retval NRF_CLOCK_LF_SRC_Xtal If an external 32 kHz crystal oscillator is the active source of the low-frequency clock. + * @retval NRF_CLOCK_LF_SRC_Synth If the internal 32 kHz synthesizer from the HFCLK is the active source of the low-frequency clock. + */ +__STATIC_INLINE nrf_clock_lf_src_t nrf_clock_lf_actv_src_get(void) +{ + return (nrf_clock_lf_src_t)((NRF_CLOCK->LFCLKSTAT & + CLOCK_LFCLKSTAT_SRC_Msk) >> CLOCK_LFCLKSTAT_SRC_Pos); +} + +/** + * @brief Function for retrieving the clock source for the LFCLK clock when the task LKCLKSTART is triggered. + * + * @retval NRF_CLOCK_LF_SRC_RC If the internal 32 kHz RC oscillator is running and generating the LFCLK clock. + * @retval NRF_CLOCK_LF_SRC_Xtal If an external 32 kHz crystal oscillator is running and generating the LFCLK clock. + * @retval NRF_CLOCK_LF_SRC_Synth If the internal 32 kHz synthesizer from the HFCLK is running and generating the LFCLK clock. + */ +__STATIC_INLINE nrf_clock_lf_src_t nrf_clock_lf_srccopy_get(void) +{ + return (nrf_clock_lf_src_t)((NRF_CLOCK->LFCLKSRCCOPY & + CLOCK_LFCLKSRCCOPY_SRC_Msk) >> CLOCK_LFCLKSRCCOPY_SRC_Pos); +} + +/** + * @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) +{ + return ((NRF_CLOCK->LFCLKSTAT & + CLOCK_LFCLKSTAT_STATE_Msk) >> CLOCK_LFCLKSTAT_STATE_Pos); +} + +/** + * @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) +{ + return (nrf_clock_start_task_status_t)((NRF_CLOCK->LFCLKRUN & + CLOCK_LFCLKRUN_STATUS_Msk) >> + CLOCK_LFCLKRUN_STATUS_Pos); +} + +/** + * @brief Function for retrieving the active source of the high-frequency clock. + * + * @retval NRF_CLOCK_HF_SRC_RC If the internal 16 MHz RC oscillator is the active source of the high-frequency clock. + * @retval NRF_CLOCK_HF_SRC_Xtal If an external 16 MHz/32 MHz crystal oscillator is the active source of the high-frequency clock. + */ +__STATIC_INLINE nrf_clock_hf_src_t nrf_clock_hf_src_get(void) +{ + return (nrf_clock_hf_src_t)((NRF_CLOCK->HFCLKSTAT & + CLOCK_HFCLKSTAT_SRC_Msk) >> CLOCK_HFCLKSTAT_SRC_Pos); +} + +/** + * @brief Function for retrieving the state of the HFCLK clock. + * + * @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(void) +{ + return ((NRF_CLOCK->HFCLKSTAT & + CLOCK_HFCLKSTAT_STATE_Msk) >> CLOCK_HFCLKSTAT_STATE_Pos); +} + +/** + * @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) +{ + return (nrf_clock_start_task_status_t)((NRF_CLOCK->HFCLKRUN & + CLOCK_HFCLKRUN_STATUS_Msk) >> + CLOCK_HFCLKRUN_STATUS_Pos); +} + +/** + * @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) +{ +#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 +} + +/** + * @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) +{ +#ifdef NRF51 + NRF_CLOCK->XTALFREQ = + (uint32_t)((xtalfreq << CLOCK_XTALFREQ_XTALFREQ_Pos) & CLOCK_XTALFREQ_XTALFREQ_Msk); +#elif defined NRF52 + return; +#endif +} + +/** + * @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) +{ + NRF_CLOCK->CTIV = ((interval << CLOCK_CTIV_CTIV_Pos) & CLOCK_CTIV_CTIV_Msk); +} +/** + *@} + **/ +#endif // NRF_CLOCK_H__ diff --git a/components/drivers_nrf/hal/nrf_ecb.c b/components/drivers_nrf/hal/nrf_ecb.c new file mode 100644 index 0000000..a70398c --- /dev/null +++ b/components/drivers_nrf/hal/nrf_ecb.c @@ -0,0 +1,74 @@ +/* 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. +* +* $LastChangedRevision: 25419 $ +*/ + +/** + * @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/components/drivers_nrf/hal/nrf_ecb.h b/components/drivers_nrf/hal/nrf_ecb.h new file mode 100644 index 0000000..0d5997d --- /dev/null +++ b/components/drivers_nrf/hal/nrf_ecb.h @@ -0,0 +1,66 @@ +/* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is confidential 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. + * + * $LastChangedRevision: 13999 $ + */ + +/** + * @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/components/drivers_nrf/hal/nrf_egu.h b/components/drivers_nrf/hal/nrf_egu.h new file mode 100644 index 0000000..a53e7f0 --- /dev/null +++ b/components/drivers_nrf/hal/nrf_egu.h @@ -0,0 +1,286 @@ +/* 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. + * + */ + +#ifndef NRF_EGU_H__ +#define NRF_EGU_H__ + +#ifndef NRF52 + #error EGU is not supported on your chip. +#endif + +/** +* @defgroup nrf_egu EGU (Event Generator Unit) abstraction +* @{ +* @ingroup nrf_drivers +* @brief EGU (Event Generator Unit) module functions. +* +*/ + +#include +#include +#include +#include "nrf_assert.h" +#include "nrf.h" + +#define NRF_EGU_COUNT 6 /**< Number of EGU instances. */ +#define NRF_EGU_CHANNEL_COUNT 16 /**< Number of channels per EGU instance. */ + +/** + * @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 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); + return (uint32_t*)&NRF_EGUx->TASKS_TRIGGER[channel]; +} + + +/** + * @brief Function for returning the specific EGU TRIGGER task. + * + * @param channel Channel number. + */ +__STATIC_INLINE nrf_egu_task_t nrf_egu_task_trigger_get(uint8_t channel) +{ + ASSERT(channel <= NRF_EGU_CHANNEL_COUNT); + 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; +} + + +/** + * @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); + return (uint32_t*)&NRF_EGUx->EVENTS_TRIGGERED[channel]; +} + + +/** + * @brief Function for returning the specific EGU TRIGGERED event. + * + * @param channel Channel number. + */ +__STATIC_INLINE nrf_egu_event_t nrf_egu_event_triggered_get(uint8_t channel) +{ + ASSERT(channel < NRF_EGU_CHANNEL_COUNT); + 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 channel Channel number. + * + * @returns EGU interrupt mask. + */ +__STATIC_INLINE nrf_egu_int_mask_t nrf_egu_int_get(uint8_t channel) +{ + ASSERT(channel < NRF_EGU_CHANNEL_COUNT); + return (nrf_egu_int_mask_t)((uint32_t) (EGU_INTENSET_TRIGGERED0_Msk << channel)); +} + +/** @} */ + +#endif diff --git a/components/drivers_nrf/hal/nrf_gpio.h b/components/drivers_nrf/hal/nrf_gpio.h new file mode 100644 index 0000000..992bf55 --- /dev/null +++ b/components/drivers_nrf/hal/nrf_gpio.h @@ -0,0 +1,647 @@ +/* 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. +* +*/ +#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 pins must be configured as an output for this + * function to have any effect. + * + * @param pin_mask Specifies the pins to set. + * 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 pins must be configured as an output for this + * function to have any effect. + * + * @param pin_mask Specifies the pins to clear. + * set. + */ +__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 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) +{ + const uint32_t pin_bit = 1UL << pin_number; + const uint32_t pin_state = ((NRF_GPIO->OUT >> pin_number) & 1UL); + + if (pin_state == 0) + { + // Current state low, set high. + NRF_GPIO->OUTSET = pin_bit; + } + else + { + // Current state high, set low. + NRF_GPIO->OUTCLR = pin_bit; + } +} + +__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/components/drivers_nrf/hal/nrf_gpiote.h b/components/drivers_nrf/hal/nrf_gpiote.h new file mode 100644 index 0000000..e3e998a --- /dev/null +++ b/components/drivers_nrf/hal/nrf_gpiote.h @@ -0,0 +1,346 @@ +/* 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. + * + */ +#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.*/ + /*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.*/ + 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. */ + NRF_GPIOTE_INT_PORT_MASK = (int)GPIOTE_INTENSET_PORT_Msk, /**< GPIOTE interrupt from PORT event. */ +} nrf_gpiote_int_t; + +#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) +/** + * @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/components/drivers_nrf/hal/nrf_lpcomp.h b/components/drivers_nrf/hal/nrf_lpcomp.h new file mode 100644 index 0000000..73e4662 --- /dev/null +++ b/components/drivers_nrf/hal/nrf_lpcomp.h @@ -0,0 +1,367 @@ +/* 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. + * + */ + +/** + * @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 +#include +#include + +/** + * @enum nrf_lpcomp_ref_t + * @brief LPCOMP reference selection. + */ +typedef enum +{ +#ifdef NRF51 + 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 defined NRF52 + 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_Ref1_16Vdd, /**< Use supply with a 3/16 prescaler as reference. */ + NRF_LPCOMP_REF_SUPPLY_5_16 = LPCOMP_REFSEL_REFSEL_Ref1_16Vdd, /**< Use supply with a 5/16 prescaler as reference. */ + NRF_LPCOMP_REF_SUPPLY_7_16 = LPCOMP_REFSEL_REFSEL_Ref1_16Vdd, /**< Use supply with a 7/16 prescaler as reference. */ + NRF_LPCOMP_REF_SUPPLY_9_16 = LPCOMP_REFSEL_REFSEL_Ref1_16Vdd, /**< Use supply with a 9/16 prescaler as reference. */ + NRF_LPCOMP_REF_SUPPLY_11_16 = LPCOMP_REFSEL_REFSEL_Ref1_16Vdd, /**< Use supply with a 11/16 prescaler as reference. */ + NRF_LPCOMP_REF_SUPPLY_13_16 = LPCOMP_REFSEL_REFSEL_Ref1_16Vdd, /**< Use supply with a 13/16 prescaler as reference. */ + NRF_LPCOMP_REF_SUPPLY_15_16 = LPCOMP_REFSEL_REFSEL_Ref1_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; + + +/** @brief LPCOMP configuration. */ +typedef struct +{ + nrf_lpcomp_ref_t reference; /**< LPCOMP reference. */ + nrf_lpcomp_detect_t detection; /**< LPCOMP detection type. */ +} 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; + 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 LCOMP. + * + * @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; +} + + +/** + * @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)); +} + + +/** + *@} + **/ + +#endif /* NRF_LPCOMP_H_ */ diff --git a/components/drivers_nrf/hal/nrf_nvmc.c b/components/drivers_nrf/hal/nrf_nvmc.c new file mode 100644 index 0000000..34d5880 --- /dev/null +++ b/components/drivers_nrf/hal/nrf_nvmc.c @@ -0,0 +1,117 @@ +/* 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. +* +* $LastChangedRevision: 17685 $ +*/ + +/** + *@file + *@brief NMVC driver implementation + */ + +#include "stdbool.h" +#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/components/drivers_nrf/hal/nrf_nvmc.h b/components/drivers_nrf/hal/nrf_nvmc.h new file mode 100644 index 0000000..c1d7e41 --- /dev/null +++ b/components/drivers_nrf/hal/nrf_nvmc.h @@ -0,0 +1,90 @@ +/* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is confidential 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. + * + * $LastChangedRevision: 17685 $ + */ + +/** + * @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/components/drivers_nrf/hal/nrf_ppi.h b/components/drivers_nrf/hal/nrf_ppi.h new file mode 100644 index 0000000..ddea41d --- /dev/null +++ b/components/drivers_nrf/hal/nrf_ppi.h @@ -0,0 +1,354 @@ +/* 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 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. */ + 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. */ +} 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 */ + /*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 (register value). + * + * @param[in] tep Task register address (register value). + * + * @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; +} + + +/** + * @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/components/drivers_nrf/hal/nrf_qdec.h b/components/drivers_nrf/hal/nrf_qdec.h new file mode 100644 index 0000000..7b117ff --- /dev/null +++ b/components/drivers_nrf/hal/nrf_qdec.h @@ -0,0 +1,468 @@ +/* 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 NRF_QDEC_H__ +#define NRF_QDEC_H__ + +#include "stddef.h" +#include "nrf_error.h" +#include "nrf.h" + +/*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) +{ +#ifdef NRF51 + NRF_QDEC->PSELA = psela; + NRF_QDEC->PSELB = pselb; + NRF_QDEC->PSELLED = pselled; +#elif defined NRF52 + NRF_QDEC->PSEL.A = psela; + NRF_QDEC->PSEL.B = pselb; + NRF_QDEC->PSEL.LED = pselled; +#endif +} + +/** + * @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; +} + + +/** + * @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" */ +#endif diff --git a/components/drivers_nrf/hal/nrf_rng.h b/components/drivers_nrf/hal/nrf_rng.h new file mode 100644 index 0000000..00d5308 --- /dev/null +++ b/components/drivers_nrf/hal/nrf_rng.h @@ -0,0 +1,211 @@ +/* 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. + * + */ + +/** + * @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" + +#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) +{ + NRF_RNG->INTENSET = 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) +{ + NRF_RNG->INTENCLR = 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) +{ + return (bool)(NRF_RNG->INTENCLR & 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) +{ + return (uint32_t *)((uint8_t *)NRF_RNG + 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) +{ + *((volatile uint32_t *)((uint8_t *)NRF_RNG + rng_task)) = NRF_RNG_TASK_SET; +} + +/** + * @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) +{ + return (uint32_t *)((uint8_t *)NRF_RNG + 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) +{ + *((volatile uint32_t *)((uint8_t *)NRF_RNG + rng_event)) = NRF_RNG_EVENT_CLEAR; +} + +/** + * @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) +{ + return (bool)*((volatile uint32_t *)((uint8_t *)NRF_RNG + 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) +{ + NRF_RNG->SHORTS |= 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) +{ + NRF_RNG->SHORTS &= ~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) +{ + return (uint8_t)(NRF_RNG->VALUE & RNG_VALUE_VALUE_Msk); +} + +/** + * @brief Function for enabling digital error correction. + */ +__STATIC_INLINE void nrf_rng_error_correction_enable(void) +{ + NRF_RNG->CONFIG |= RNG_CONFIG_DERCEN_Msk; +} + +/** + * @brief Function for disabling digital error correction. + */ +__STATIC_INLINE void nrf_rng_error_correction_disable(void) +{ + NRF_RNG->CONFIG &= ~RNG_CONFIG_DERCEN_Msk; +} +/** + *@} + **/ +#endif /* NRF_RNG_H__ */ diff --git a/components/drivers_nrf/hal/nrf_rtc.h b/components/drivers_nrf/hal/nrf_rtc.h new file mode 100644 index 0000000..ecdc6a5 --- /dev/null +++ b/components/drivers_nrf/hal/nrf_rtc.h @@ -0,0 +1,298 @@ +/* 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. + * + */ + +/** + * @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" + +#define RTC_CHANNEL_NUM 4 /**< Number of compare channels in the RTC instance. */ + +#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) +{ + ASSERT(chCC[ch] = cc_val; +} + +__STATIC_INLINE uint32_t nrf_rtc_cc_get(NRF_RTC_Type * p_rtc, uint32_t ch) +{ + ASSERT(chCC[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/components/drivers_nrf/hal/nrf_saadc.c b/components/drivers_nrf/hal/nrf_saadc.c new file mode 100644 index 0000000..b2d5cc8 --- /dev/null +++ b/components/drivers_nrf/hal/nrf_saadc.c @@ -0,0 +1,31 @@ +/* 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 + * @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; +} diff --git a/components/drivers_nrf/hal/nrf_saadc.h b/components/drivers_nrf/hal/nrf_saadc.h new file mode 100644 index 0000000..6888977 --- /dev/null +++ b/components/drivers_nrf/hal/nrf_saadc.h @@ -0,0 +1,543 @@ +/* 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. + * + */ + + +#ifndef NRF_SAADC_H_ +#define NRF_SAADC_H_ + +/** + * @defgroup nrf_saadc_hal SAADC HAL + * @{ + * @ingroup nrf_saadc + * + * @brief 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_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 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 /* NRF_SAADC_H_ */ diff --git a/components/drivers_nrf/hal/nrf_spi.h b/components/drivers_nrf/hal/nrf_spi.h new file mode 100644 index 0000000..2d3897d --- /dev/null +++ b/components/drivers_nrf/hal/nrf_spi.h @@ -0,0 +1,334 @@ +/* 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_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/components/drivers_nrf/hal/nrf_spim.h b/components/drivers_nrf/hal/nrf_spim.h new file mode 100644 index 0000000..b7aeb91 --- /dev/null +++ b/components/drivers_nrf/hal/nrf_spim.h @@ -0,0 +1,459 @@ +/* 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_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); +#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); + + +#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); +} +#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; +} + +#endif // SUPPRESS_INLINE_IMPLEMENTATION + +#endif // NRF_SPIM_H__ + +/** @} */ diff --git a/components/drivers_nrf/hal/nrf_spis.h b/components/drivers_nrf/hal/nrf_spis.h new file mode 100644 index 0000000..077eb41 --- /dev/null +++ b/components/drivers_nrf/hal/nrf_spis.h @@ -0,0 +1,512 @@ +/* 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_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/components/drivers_nrf/hal/nrf_temp.h b/components/drivers_nrf/hal/nrf_temp.h new file mode 100644 index 0000000..8c4cf5a --- /dev/null +++ b/components/drivers_nrf/hal/nrf_temp.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#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/components/drivers_nrf/hal/nrf_timer.h b/components/drivers_nrf/hal/nrf_timer.h new file mode 100644 index 0000000..912d647 --- /dev/null +++ b/components/drivers_nrf/hal/nrf_timer.h @@ -0,0 +1,403 @@ +/* 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. + * + */ + + /** + * @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" + +#define TIMER_INSTANCE_NUMBER 3 +#define TIMER_CHANNEL_NUMBER 4 + + +/** + * @brief Macro for validating correctness of BIT_WIDTH setting. + */ +#define TIMER_IS_BIT_WIDTH_VALID(instance_id, mode) \ + (((instance_id>0) && (mode>NRF_TIMER_BIT_WIDTH_16)) ? false : true) + +#define TIMER_CC_SHORT(ch) ((TIMER_SHORTS_COMPARE0_STOP_Msk << ch) | \ + (TIMER_SHORTS_COMPARE0_CLEAR_Msk << ch)) +/** + * @enum nrf_timer_task_t + * @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 stoping 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. */ + /*lint -restore*/ +} nrf_timer_task_t; + +/** + * @enum nrf_timer_event_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. */ + /*lint -restore*/ +} nrf_timer_event_t; + +/** + * @enum nrf_timer_short_mask_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. */ + 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. */ +} nrf_timer_short_mask_t; + +/** + * @enum nrf_timer_mode_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. */ +} nrf_timer_mode_t; + +/** + * @enum nrf_timer_bit_width_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; + +/** + * @enum nrf_timer_frequency_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; + +/** + * @enum nrf_timer_cc_channel_t + * @brief Timer compare/capture channels. + */ +typedef enum +{ + NRF_TIMER_CC_CHANNEL0 = 0, /**< Timer compare/capture channel 0. */ + NRF_TIMER_CC_CHANNEL1, /**< Timer compare/capture channel 1. */ + NRF_TIMER_CC_CHANNEL2, /**< Timer compare/capture channel 2. */ + NRF_TIMER_CC_CHANNEL3 /**< Timer compare/capture channel 3. */ +} nrf_timer_cc_channel_t; + +/** + * @enum nrf_timer_int_mask_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. */ +} nrf_timer_int_mask_t; + +/** + * @brief Function for activating a specific timer task. + * + * @param NRF_TIMERx Timer instance. + * + * @param timer_task Timer task. + */ +__STATIC_INLINE void nrf_timer_task_trigger(NRF_TIMER_Type * NRF_TIMERx, nrf_timer_task_t timer_task) +{ + *((volatile uint32_t *)((uint8_t *)NRF_TIMERx + (uint32_t)timer_task)) = 0x1UL; +} + + +/** + * @brief Function for returning the address of a specific timer task register. + * + * @param NRF_TIMERx Timer instance. + * + * @param timer_task Timer task. + */ +__STATIC_INLINE uint32_t * nrf_timer_task_address_get(NRF_TIMER_Type * NRF_TIMERx, + nrf_timer_task_t timer_task) +{ + return (uint32_t *)((uint8_t *)NRF_TIMERx + (uint32_t)timer_task); +} + + +/** + * @brief Function for clearing a specific timer event. + * + * @param NRF_TIMERx Timer instance. + * + * @param timer_event Timer event to clear. + */ +__STATIC_INLINE void nrf_timer_event_clear(NRF_TIMER_Type * NRF_TIMERx, + nrf_timer_event_t timer_event) +{ + *((volatile uint32_t *)((uint8_t *)NRF_TIMERx + (uint32_t)timer_event)) = 0x0UL; +} + + +/** + * @brief Function for returning the state of a specific event. + * + * @param NRF_TIMERx Timer instance. + * + * @param timer_event Timer event to check. + */ +__STATIC_INLINE bool nrf_timer_event_check(NRF_TIMER_Type * NRF_TIMERx, + nrf_timer_event_t timer_event) +{ + return (bool)*(volatile uint32_t *)((uint8_t *)NRF_TIMERx + (uint32_t)timer_event); +} + + +/** + * @brief Function for returning the address of a specific timer event register. + * + * @param NRF_TIMERx Timer instance. + * + * @param timer_event Timer event. + */ +__STATIC_INLINE uint32_t * nrf_timer_event_address_get(NRF_TIMER_Type * NRF_TIMERx, + nrf_timer_event_t timer_event) +{ + return (uint32_t *)((uint8_t *)NRF_TIMERx + (uint32_t)timer_event); +} + + +/** + * @brief Function for seting a shortcut for a specific compare channel. + * + * @param NRF_TIMERx Timer instance. + * + * @param timer_short_mask Type of timer shortcut. + */ +__STATIC_INLINE void nrf_timer_shorts_enable(NRF_TIMER_Type * NRF_TIMERx, uint32_t timer_short_mask) +{ + NRF_TIMERx->SHORTS |= timer_short_mask; +} + + +/** + * @brief Function for clearing a shortcut for a specific compare channel. + * + * @param NRF_TIMERx Timer instance. + * + * @param timer_short_mask Type of timer shortcut. + */ +__STATIC_INLINE void nrf_timer_shorts_disable(NRF_TIMER_Type * NRF_TIMERx, uint32_t timer_short_mask) +{ + NRF_TIMERx->SHORTS &= ~(timer_short_mask); +} + + +/** + * @brief Function for setting the timer mode. + * + * @param NRF_TIMERx Timer instance. + * + * @param timer_mode Timer mode. + */ +__STATIC_INLINE void nrf_timer_mode_set(NRF_TIMER_Type * NRF_TIMERx, nrf_timer_mode_t timer_mode) +{ + NRF_TIMERx->MODE = (NRF_TIMERx->MODE & ~TIMER_MODE_MODE_Msk) | + ((timer_mode << TIMER_MODE_MODE_Pos) & TIMER_MODE_MODE_Msk); +} + + +/** + * @brief Function for retrieving the timer mode. + * + * @param NRF_TIMERx Timer instance. + * + */ +__STATIC_INLINE nrf_timer_mode_t nrf_timer_mode_get(NRF_TIMER_Type * NRF_TIMERx) +{ + return (nrf_timer_mode_t)(NRF_TIMERx->MODE); +} + + +/** + * @brief Function for setting the timer bit width. + * + * @param NRF_TIMERx Timer instance. + * @param timer_bit_width Timer bit width. + */ +__STATIC_INLINE void nrf_timer_bit_width_set(NRF_TIMER_Type * NRF_TIMERx, + nrf_timer_bit_width_t timer_bit_width) +{ + NRF_TIMERx->BITMODE = (NRF_TIMERx->BITMODE & ~TIMER_BITMODE_BITMODE_Msk) | + ((timer_bit_width << + TIMER_BITMODE_BITMODE_Pos) & TIMER_BITMODE_BITMODE_Msk); +} + + +/** + * @brief Function for retrieving the timer bit width. + * + * @param NRF_TIMERx Timer instance. + * + */ +__STATIC_INLINE nrf_timer_bit_width_t nrf_timer_bit_width_get(NRF_TIMER_Type * NRF_TIMERx) +{ + return (nrf_timer_bit_width_t)(NRF_TIMERx->BITMODE); +} + + +/** + * @brief Function for setting the timer frequency. + * + * @param NRF_TIMERx Timer instance. + * + * @param timer_frequency Timer frequency value. + */ +__STATIC_INLINE void nrf_timer_frequency_set(NRF_TIMER_Type * NRF_TIMERx, + nrf_timer_frequency_t timer_frequency) +{ + NRF_TIMERx->PRESCALER = (NRF_TIMERx->PRESCALER & ~TIMER_PRESCALER_PRESCALER_Msk) | + ((timer_frequency << + TIMER_PRESCALER_PRESCALER_Pos) & TIMER_PRESCALER_PRESCALER_Msk); +} + + +/** + * @brief Function for retrieving the timer frequency. + * + * @param NRF_TIMERx Timer instance. + * + */ +__STATIC_INLINE nrf_timer_frequency_t nrf_timer_frequency_get(NRF_TIMER_Type * NRF_TIMERx) +{ + return (nrf_timer_frequency_t)(NRF_TIMERx->PRESCALER); +} + + +/** + * @brief Function for retrieving the value of a given CC channel. + * + * @param NRF_TIMERx Timer instance. + * + * @param cc_channel CC channel to read. + */ +__STATIC_INLINE uint32_t nrf_timer_cc_read(NRF_TIMER_Type * NRF_TIMERx, + nrf_timer_cc_channel_t cc_channel) +{ + return (uint32_t)NRF_TIMERx->CC[cc_channel]; +} + + +/** + * @brief Function for writing to a specific CC channel. + * + * @param NRF_TIMERx Timer instance. + * @param cc_channel CC channel to write to. + * @param cc_value Value to write to the CC channel. + */ +__STATIC_INLINE void nrf_timer_cc_write(NRF_TIMER_Type * NRF_TIMERx, + nrf_timer_cc_channel_t cc_channel, + uint32_t cc_value) +{ + NRF_TIMERx->CC[cc_channel] = cc_value; +} + + +/** + * @brief Function for enableing a specific interrupt. + * + * @param NRF_TIMERx Timer instance. + * + * @param timer_int Interrupt to enable. + */ +__STATIC_INLINE void nrf_timer_int_enable(NRF_TIMER_Type * NRF_TIMERx, uint32_t timer_int) +{ + NRF_TIMERx->INTENSET = timer_int; +} + + +/** + * @brief Function for retrieving the state of a given interrupt. + * + * @param NRF_TIMERx Timer instance. + * @param 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 * NRF_TIMERx, uint32_t timer_int) +{ + return (bool)(NRF_TIMERx->INTENSET & timer_int); +} + + +/** + * @brief Function for disabling a specific interrupt. + * + * @param NRF_TIMERx Timer instance. + * + * @param timer_int Interrupt to disable. + */ +__STATIC_INLINE void nrf_timer_int_disable(NRF_TIMER_Type * NRF_TIMERx, uint32_t timer_int) +{ + NRF_TIMERx->INTENCLR = timer_int; +} + +/** + *@} + **/ + +#endif /* NRF_TIMER_H__ */ diff --git a/components/drivers_nrf/hal/nrf_twi.h b/components/drivers_nrf/hal/nrf_twi.h new file mode 100644 index 0000000..2caebee --- /dev/null +++ b/components/drivers_nrf/hal/nrf_twi.h @@ -0,0 +1,384 @@ +/* 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_twi_hal TWI HAL + * @{ + * @ingroup nrf_twi_master + * + * @brief Hardware access layer for the two-wire interface (TWI) peripheral. + */ +#ifndef NRF_TWI_H__ +#define NRF_TWI_H__ + +#include "nrf.h" +#include +#include +#include +/** + * @enum nrf_twi_tasks_t + * @brief TWI tasks. + */ +typedef enum +{ + /*lint -save -e30 -esym(628,__INTADDR__)*/ + NRF_TWI_TASKS_STARTRX = offsetof(NRF_TWI_Type, TASKS_STARTRX), /**< Start receive sequence. */ + NRF_TWI_TASKS_STARTTX = offsetof(NRF_TWI_Type, TASKS_STARTTX), /**< Start transmit sequence. */ + NRF_TWI_TASKS_STOP = offsetof(NRF_TWI_Type, TASKS_STOP), /**< Stop transaction. */ + NRF_TWI_TASKS_SUSPEND = offsetof(NRF_TWI_Type, TASKS_SUSPEND), /**< Suspend transaction. */ + NRF_TWI_TASKS_RESUME = offsetof(NRF_TWI_Type, TASKS_RESUME) /**< Resume transaction. */ + /*lint -restore*/ +} nrf_twi_tasks_t; + +/** + * @enum nrf_twi_events_t + * @brief TWI events. + */ +typedef enum +{ + /*lint -save -e30*/ + NRF_TWI_EVENTS_STOPPED = offsetof(NRF_TWI_Type, EVENTS_STOPPED), /**< Stopped. */ + NRF_TWI_EVENTS_RXDREADY = offsetof(NRF_TWI_Type, EVENTS_RXDREADY), /**< RXD byte received. */ + NRF_TWI_EVENTS_TXDSENT = offsetof(NRF_TWI_Type, EVENTS_TXDSENT), /**< TXD byte sent. */ + NRF_TWI_EVENTS_ERROR = offsetof(NRF_TWI_Type, EVENTS_ERROR), /**< Error. */ + NRF_TWI_EVENTS_BB = offsetof(NRF_TWI_Type, EVENTS_BB), /**< Byte boundary, generated before each byte that is sent or received. */ + NRF_TWI_EVENTS_SUSPENDED = offsetof(NRF_TWI_Type, EVENTS_SUSPENDED) /**< Entered the suspended state. */ + /*lint -restore*/ +} nrf_twi_events_t; + +/** + * @enum nrf_twi_int_mask_t + * @brief TWI interrupts. + */ +typedef enum +{ + NRF_TWI_INT_SUSPENDED_MASK = TWI_INTENSET_SUSPENDED_Msk, /**< TWI interrupt on suspend event. */ + NRF_TWI_INT_BB_MASK = TWI_INTENSET_BB_Msk, /**< TWI interrupt on byte boundary event. */ + NRF_TWI_INT_ERROR_MASK = TWI_INTENSET_ERROR_Msk, /**< TWI interrupt on error event. */ + NRF_TWI_INT_TXDSENT_MASK = TWI_INTENSET_TXDSENT_Msk, /**< TWI interrupt on txdsent event. */ + NRF_TWI_INT_RXDREADY_MASK = TWI_INTENSET_RXDREADY_Msk, /**< TWI interrupt on rxdready event. */ + NRF_TWI_INT_STOPPED_MASK = TWI_INTENSET_STOPPED_Msk, /**< TWI interrupt on stopped event. */ +} nrf_twi_int_mask_t; + +/** + * @enum nrf_twi_shorts_mask_t + * @brief Types of TWI shortcuts. + */ +typedef enum +{ + NRF_TWI_SHORTS_BB_SUSPEND_MASK = TWI_SHORTS_BB_SUSPEND_Msk, /**< Shortcut between bb event and suspend task. */ + NRF_TWI_SHORTS_BB_STOP_MASK = TWI_SHORTS_BB_STOP_Msk, /**< Shortcut between bb event and stop task. */ +} nrf_twi_shorts_mask_t; + +/** + * @enum nrf_twi_frequency_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; + +/** + * @enum nrf_twi_error_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_OVERRUN_NACK = TWI_ERRORSRC_OVERRUN_Msk, /**< Byte received in RXD register before read of the last received byte (data loss). */ + NRF_TWI_ERROR_DATA_NACK = TWI_ERRORSRC_DNACK_Msk, /**< NACK received after sending a data byte. */ +} nrf_twi_error_t; + +/** + * @brief Function for activating a specific TWI task. + * + * @param[in] p_twi TWI instance. + * @param[in] task Task. + */ +__STATIC_INLINE void nrf_twi_task_set(NRF_TWI_Type * p_twi, nrf_twi_tasks_t task); + +/** + * @brief Function for returning the address of a specific TWI task register. + * + * @param[in] p_twi TWI instance. + * @param[in] task Task. + * + * @return Task address. + */ +__STATIC_INLINE uint32_t * nrf_twi_task_address_get(NRF_TWI_Type * p_twi, + nrf_twi_tasks_t task); + +/** + * @brief Function for clearing a specific event. + * + * @param[in] p_twi TWI instance. + * @param[in] event Event. + */ +__STATIC_INLINE void nrf_twi_event_clear(NRF_TWI_Type * p_twi, + nrf_twi_events_t event); +/** + * @brief Function for returning the state of a specific event. + * + * @param[in] p_twi TWI instance. + * @param[in] event Event. + * + * @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_events_t event); + +/** + * @brief Function for returning the address of a specific TWI event register. + * + * @param[in] p_twi TWI instance. + * @param[in] event Event. + * + * @return Address. + */ +__STATIC_INLINE uint32_t * nrf_twi_event_address_get(NRF_TWI_Type * p_twi, + nrf_twi_events_t event); + +/** + * @brief Function for setting a shortcut. + * + * @param[in] p_twi TWI instance. + * @param[in] short_mask Shortcuts mask. + */ +__STATIC_INLINE void nrf_twi_shorts_set(NRF_TWI_Type * p_twi, uint32_t short_mask); + +/** + * @brief Function for clearing shortcuts. + * + * @param[in] p_twi TWI instance. + * @param[in] short_mask Shortcuts mask. + */ +__STATIC_INLINE void nrf_twi_shorts_clear(NRF_TWI_Type * p_twi, uint32_t short_mask); + +/** + * @brief Function for enabling a specific interrupt. + * + * @param[in] p_twi TWI instance. + * @param[in] int_mask Interrupts mask. + */ +__STATIC_INLINE void nrf_twi_int_enable(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 Interrupts mask. + * + * @retval true If the interrupts are enabled. + * @retval false If the interrupts are not enabled. + */ +__STATIC_INLINE bool nrf_twi_int_enable_check(NRF_TWI_Type * p_twi, uint32_t int_mask); + +/** + * @brief Function for disabling a specific interrupt. + * + * @param[in] p_twi TWI instance. + * @param[in] int_mask Interrupts mask. + */ +__STATIC_INLINE void nrf_twi_int_disable(NRF_TWI_Type * p_twi, uint32_t int_mask); + +/** + * @brief Function for setting the TWI master clock frequency. + * + * @param[in] p_twi TWI instance. + * @param[in] frequency TWI frequency value. + */ +__STATIC_INLINE void nrf_twi_frequency_set(NRF_TWI_Type * p_twi, + nrf_twi_frequency_t frequency); + +/** + * @brief Function for retrieving the TWI frequency. + * + * @param[in] p_twi TWI instance. + * + * @return Frequency. + */ +__STATIC_INLINE nrf_twi_frequency_t nrf_twi_frequency_get(NRF_TWI_Type * p_twi); + +/** + * @brief Function for retrieving the TWI error source. + * @details Error sources are cleared after read. + * + * @param[in] p_twi TWI instance. + * + * @return Error source mask. + */ +__STATIC_INLINE uint32_t nrf_twi_error_source_get(NRF_TWI_Type * p_twi); + +/** + * @brief Function for enabling TWI. + * + * @param[in] p_twi TWI instance. + */ +__STATIC_INLINE void nrf_twi_enable(NRF_TWI_Type * p_twi); + +/** + * @brief Function for disabling TWI. + * + * @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 SCL pin number. + * @param[in] sda SDA pin number. + */ +__STATIC_INLINE void nrf_twi_pins_set(NRF_TWI_Type * p_twi, uint32_t scl, uint32_t sda); + +/** + * @brief Function for reading RX data from TWI. + * + * @param[in] p_twi TWI instance. + * + * @return RX data. + */ +__STATIC_INLINE uint8_t nrf_twi_rxd_get(NRF_TWI_Type * p_twi); +/** + * @brief Function for writing data to 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); + +/** + * @brief Function for setting the slave address. + * + * @param[in] p_twi TWI instance. + * @param[in] addr Address of next transaction. + */ +__STATIC_INLINE void nrf_twi_address_set(NRF_TWI_Type * p_twi, uint8_t addr); + +/** + *@} + **/ + + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +__STATIC_INLINE void nrf_twi_task_set(NRF_TWI_Type * p_twi, nrf_twi_tasks_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_tasks_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_events_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_events_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_events_t event) +{ + return (uint32_t *)((uint8_t *)p_twi + (uint32_t)event); +} + +__STATIC_INLINE void nrf_twi_shorts_set(NRF_TWI_Type * p_twi, uint32_t short_mask) +{ + p_twi->SHORTS |= short_mask; +} + +__STATIC_INLINE void nrf_twi_shorts_clear(NRF_TWI_Type * p_twi, uint32_t short_mask) +{ + p_twi->SHORTS &= ~(short_mask); +} + +__STATIC_INLINE void nrf_twi_int_enable(NRF_TWI_Type * p_twi, uint32_t int_mask) +{ + p_twi->INTENSET = int_mask; +} + +__STATIC_INLINE bool nrf_twi_int_enable_check(NRF_TWI_Type * p_twi, uint32_t int_mask) +{ + return (bool)(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 void nrf_twi_frequency_set(NRF_TWI_Type * p_twi, + nrf_twi_frequency_t frequency) +{ + p_twi->FREQUENCY = frequency; +} + +__STATIC_INLINE nrf_twi_frequency_t nrf_twi_frequency_get(NRF_TWI_Type * p_twi) +{ + return (nrf_twi_frequency_t)(p_twi->FREQUENCY); +} + +__STATIC_INLINE uint32_t nrf_twi_error_source_get(NRF_TWI_Type * p_twi) +{ + uint32_t error_source = p_twi->ERRORSRC; + + p_twi->ERRORSRC = error_source; + return error_source; +} + +__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, uint32_t sda) +{ + p_twi->PSELSCL = scl; + p_twi->PSELSDA = sda; +} + +__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_address_set(NRF_TWI_Type * p_twi, uint8_t addr) +{ + p_twi->ADDRESS = addr; +} +#endif //SUPPRESS_INLINE_IMPLEMENTATION + +#endif //NRF_TWI_H__ diff --git a/components/drivers_nrf/hal/nrf_twis.h b/components/drivers_nrf/hal/nrf_twis.h new file mode 100644 index 0000000..551bf46 --- /dev/null +++ b/components/drivers_nrf/hal/nrf_twis.h @@ -0,0 +1,677 @@ +/* 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. + * + */ + +/** + * @ingroup nrf_twis + * @defgroup nrf_twis_hal TWIS HAL + * @{ + * + * @brief Hardware access layer for Two Wire Interface Slave with EasyDMA + * (TWIS) peripheral. + */ +#ifndef NRF_TWIS_H__ +#define NRF_TWIS_H__ + +#include "nrf.h" +#include "nrf_drv_config.h" +#include +#include +#include + + +/** + * @brief TWIS tasks + */ +typedef enum +{ + /*lint -save -e30*/ +#if !NRF_TWIS_PATCH_FOR_MPW3 /* STOP task is not functional in MPW3 (PAN-30) */ + /* Stop task is not working properly for first release */ + NRF_TWIS_TASK_STOP = offsetof(NRF_TWIS_Type, TASKS_STOP), /**< Stop TWIS transaction */ +#endif + 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 */ +#if NRF_TWIS_PATCH_FOR_MPW3 + /* Patched version of bit positions in ERRORSRC register (PAN-29) */ + NRF_TWIS_ERROR_DATA_NACK = 1U << 1, /**< NACK sent after receiving a data byte */ + NRF_TWIS_ERROR_OVERREAD = 1U << 2 /**< TX buffer over-read detected, and prevented */ +#else + /* Code that meets current documentation */ + 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 */ +#endif +} 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_twis TWIS instance. + * @param task Task. + */ +__STATIC_INLINE void nrf_twis_task_trigger(NRF_TWIS_Type * const p_twis, nrf_twis_task_t task); + +/** + * @brief Function for returning the address of a specific TWIS task register. + * + * @param[in] p_twis TWIS instance. + * @param task Task. + * + * @return Task address. + */ +__STATIC_INLINE uint32_t nrf_twis_task_address_get( + NRF_TWIS_Type const * const p_twis, + nrf_twis_task_t task); + +/** + * @brief Function for clearing a specific event. + * + * @param[in] p_twis TWIS instance. + * @param event Event. + */ +__STATIC_INLINE void nrf_twis_event_clear( + NRF_TWIS_Type * const p_twis, + nrf_twis_event_t event); +/** + * @brief Function for returning the state of a specific event. + * + * @param[in] p_twis TWIS instance. + * @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_twis, + 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_twis TWIS instance + * @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_twis, + nrf_twis_event_t event); + + +/** + * @brief Function for returning the address of a specific TWIS event register. + * + * @param[in] p_twis TWIS instance. + * @param event Event. + * + * @return Address. + */ +__STATIC_INLINE uint32_t nrf_twis_event_address_get( + NRF_TWIS_Type const * const p_twis, + nrf_twis_event_t event); + +/** + * @brief Function for setting a shortcut. + * + * @param[in] p_twis TWIS instance. + * @param short_mask Shortcuts mask. + */ +__STATIC_INLINE void nrf_twis_shorts_enable(NRF_TWIS_Type * const p_twis, uint32_t short_mask); + +/** + * @brief Function for clearing shortcuts. + * + * @param[in] p_twis TWIS instance. + * @param short_mask Shortcuts mask. + */ +__STATIC_INLINE void nrf_twis_shorts_disable(NRF_TWIS_Type * const p_twis, uint32_t short_mask); + +/** + * @brief Get the shorts mask + * + * Function returns shorts register. + * @param[in] p_twis TWIS instance. + * @return Flags of currently enabled shortcuts + */ +__STATIC_INLINE uint32_t nrf_twis_shorts_get(NRF_TWIS_Type * const p_twis); + +/** + * @brief Function for enabling selected interrupts. + * + * @param[in] p_twis TWIS instance. + * @param int_mask Interrupts mask. + */ +__STATIC_INLINE void nrf_twis_int_enable(NRF_TWIS_Type * const p_twis, uint32_t int_mask); + +/** + * @brief Function for retrieving the state of selected interrupts. + * + * @param[in] p_twis TWIS instance. + * @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_twis, uint32_t int_mask); + +/** + * @brief Function for disabling selected interrupts. + * + * @param[in] p_twis TWIS instance. + * @param int_mask Interrupts mask. + */ +__STATIC_INLINE void nrf_twis_int_disable(NRF_TWIS_Type * const p_twis, uint32_t int_mask); + +/** + * @brief Function for retrieving and clearing the TWIS error source. + * + * @attention Error sources are cleared after read. + * @param[in] p_twis TWIS instance + * @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_twis); + +/** + * @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_twis TWIS instance + * @return Index of matched address + */ +__STATIC_INLINE uint_fast8_t nrf_twis_match_get(NRF_TWIS_Type const * p_twis); + +/** + * @brief Function for enabling TWIS. + * + * @param[in] p_twis TWIS instance. + */ +__STATIC_INLINE void nrf_twis_enable(NRF_TWIS_Type * const p_twis); + +/** + * @brief Function for disabling TWIS. + * + * @param[in] p_twis TWIS instance. + */ +__STATIC_INLINE void nrf_twis_disable(NRF_TWIS_Type * const p_twis); + +/** + * @brief Function for configuring TWIS pins. + * + * @param[in] p_twis TWIS instance. + * @param scl SCL pin number. + * @param sda SDA pin number. + */ +__STATIC_INLINE void nrf_twis_pins_set(NRF_TWIS_Type * const p_twis, uint32_t scl, uint32_t sda); + +/** + * @brief Function for setting the receive buffer. + * + * @param[in] p_twis TWIS instance. + * @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_twis, + 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_twis TWIS instance. + * @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_twis, + uint8_t * p_buf, + nrf_twis_amount_t length); + +/** + * @brief Function for getting number of bytes received in the last transaction. + * + * @param[in] p_twis TWIS instance. + * @return Amount of bytes received. + * */ +__STATIC_INLINE nrf_twis_amount_t nrf_twis_rx_amount_get(NRF_TWIS_Type const * const p_twis); + +/** + * @brief Function for setting the transmit buffer. + * + * @param[in] p_twis TWIS instance. + * @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_twis, + 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_twis TWIS instance. + * @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_twis, + 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_twis TWIS instance. + * @return Amount of bytes transmitted. + */ +__STATIC_INLINE nrf_twis_amount_t nrf_twis_tx_amount_get(NRF_TWIS_Type const * const p_twis); + +/** + * @brief Function for setting slave address + * + * Function sets the selected address for this TWI interface. + * @param[in] p_twis TWIS instance. + * @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_twis, + 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_twis TWIS instance. + * @param n Index of address to get + */ +__STATIC_INLINE nrf_twis_address_t nrf_twis_address_get( + NRF_TWIS_Type const * const p_twis, + uint_fast8_t n); + +/** + * @brief Function for setting the device address configuration. + * + * @param[in] p_twis TWIS instance. + * @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_twis, + nrf_twis_config_addr_mask_t addr_mask); + +/** + * @brief Function for retrieving the device address configuration. + * + * @param[in] p_twis TWIS instance. + * + * @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_twis); + +/** + * @brief Function for setting the over-read character. + * + * @param[in] p_twis TWIS instance. + * @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_twis, + uint8_t orc); + +/** + * @brief Function for setting the over-read character. + * + * @param[in] p_twis TWIS instance. + * + * @return Over-read character configured for selected instance. + */ +__STATIC_INLINE uint8_t nrf_twis_orc_get(NRF_TWIS_Type const * const p_twis); + + +/** @} */ /* End of nrf_twis_hal */ + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION + +/* ------------------------------------------------------------------------------------------------ + * Internal functions + */ + +/** + * @internal + * @brief Internal function for getting task/event register address + * + * @param[in] p_twis TWIS instance. + * @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_twis, uint32_t offset) +{ + return (volatile uint32_t*)((uint8_t *)p_twis + (uint32_t)offset); +} + +/** + * @internal + * @brief Internal function for getting task/event register address - constant version + * + * @param[in] p_twis TWIS instance. + * @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_twis, uint32_t offset) +{ + return (volatile const uint32_t*)((uint8_t *)p_twis + (uint32_t)offset); +} + + +/* ------------------------------------------------------------------------------------------------ + * Interface functions definitions + */ + + +void nrf_twis_task_trigger(NRF_TWIS_Type * const p_twis, nrf_twis_task_t task) +{ + *(nrf_twis_getRegPtr(p_twis, (uint32_t)task)) = 1UL; +} + +uint32_t nrf_twis_task_address_get( + NRF_TWIS_Type const * const p_twis, + nrf_twis_task_t task) +{ + return (uint32_t)nrf_twis_getRegPtr_c(p_twis, (uint32_t)task); +} + +void nrf_twis_event_clear( + NRF_TWIS_Type * const p_twis, + nrf_twis_event_t event) +{ + *(nrf_twis_getRegPtr(p_twis, (uint32_t)event)) = 0UL; +} + +bool nrf_twis_event_check( + NRF_TWIS_Type const * const p_twis, + nrf_twis_event_t event) +{ + return (bool)*nrf_twis_getRegPtr_c(p_twis, (uint32_t)event); +} + +bool nrf_twis_event_get_and_clear( + NRF_TWIS_Type * const p_twis, + nrf_twis_event_t event) +{ + bool ret = nrf_twis_event_check(p_twis, event); + if(ret) + { + nrf_twis_event_clear(p_twis, event); + } + return ret; +} + +uint32_t nrf_twis_event_address_get( + NRF_TWIS_Type const * const p_twis, + nrf_twis_event_t event) +{ + return (uint32_t)nrf_twis_getRegPtr_c(p_twis, (uint32_t)event); +} + +void nrf_twis_shorts_enable(NRF_TWIS_Type * const p_twis, uint32_t short_mask) +{ + p_twis->SHORTS |= short_mask; +} + +void nrf_twis_shorts_disable(NRF_TWIS_Type * const p_twis, uint32_t short_mask) +{ + if(~0U == short_mask) + { + /* Optimized version for "disable all" */ + p_twis->SHORTS = 0; + } + else + { + p_twis->SHORTS &= ~short_mask; + } +} + +uint32_t nrf_twis_shorts_get(NRF_TWIS_Type * const p_twis) +{ + return p_twis->SHORTS; +} + +void nrf_twis_int_enable(NRF_TWIS_Type * const p_twis, uint32_t int_mask) +{ + p_twis->INTENSET = int_mask; +} + +bool nrf_twis_int_enable_check(NRF_TWIS_Type const * const p_twis, uint32_t int_mask) +{ + return (bool)(p_twis->INTENSET & int_mask); +} + +void nrf_twis_int_disable(NRF_TWIS_Type * const p_twis, uint32_t int_mask) +{ + p_twis->INTENCLR = int_mask; +} + +uint32_t nrf_twis_error_source_get_and_clear(NRF_TWIS_Type * const p_twis) +{ + uint32_t ret = p_twis->ERRORSRC; + p_twis->ERRORSRC = ret; + return ret; +} + +uint_fast8_t nrf_twis_match_get(NRF_TWIS_Type const * p_twis) +{ + return (uint_fast8_t)p_twis->MATCH; +} + +void nrf_twis_enable(NRF_TWIS_Type * const p_twis) +{ + p_twis->ENABLE = (TWIS_ENABLE_ENABLE_Enabled << TWIS_ENABLE_ENABLE_Pos); +} + +void nrf_twis_disable(NRF_TWIS_Type * const p_twis) +{ + p_twis->ENABLE = (TWIS_ENABLE_ENABLE_Disabled << TWIS_ENABLE_ENABLE_Pos); +} + +void nrf_twis_pins_set(NRF_TWIS_Type * const p_twis, uint32_t scl, uint32_t sda) +{ + p_twis->PSEL.SCL = scl; + p_twis->PSEL.SDA = sda; +} + +void nrf_twis_rx_buffer_set( + NRF_TWIS_Type * const p_twis, + uint8_t * p_buf, + nrf_twis_amount_t length) +{ + p_twis->RXD.PTR = (uint32_t)p_buf; + p_twis->RXD.MAXCNT = length; +} + +__STATIC_INLINE void nrf_twis_rx_prepare( + NRF_TWIS_Type * const p_twis, + uint8_t * p_buf, + nrf_twis_amount_t length) +{ + nrf_twis_rx_buffer_set(p_twis, p_buf, length); + nrf_twis_task_trigger(p_twis, NRF_TWIS_TASK_PREPARERX); +} + +nrf_twis_amount_t nrf_twis_rx_amount_get(NRF_TWIS_Type const * const p_twis) +{ + return (nrf_twis_amount_t)p_twis->RXD.AMOUNT; +} + +void nrf_twis_tx_buffer_set( + NRF_TWIS_Type * const p_twis, + uint8_t const * p_buf, + nrf_twis_amount_t length) +{ + p_twis->TXD.PTR = (uint32_t)p_buf; + p_twis->TXD.MAXCNT = length; +} + +__STATIC_INLINE void nrf_twis_tx_prepare( + NRF_TWIS_Type * const p_twis, + uint8_t const * p_buf, + nrf_twis_amount_t length) +{ + nrf_twis_tx_buffer_set(p_twis, p_buf, length); + nrf_twis_task_trigger(p_twis, NRF_TWIS_TASK_PREPARETX); +} + +nrf_twis_amount_t nrf_twis_tx_amount_get(NRF_TWIS_Type const * const p_twis) +{ + return (nrf_twis_amount_t)p_twis->TXD.AMOUNT; +} + +void nrf_twis_address_set( + NRF_TWIS_Type * const p_twis, + uint_fast8_t n, + nrf_twis_address_t addr) +{ + p_twis->ADDRESS[n] = addr; +} + +nrf_twis_address_t nrf_twis_address_get( + NRF_TWIS_Type const * const p_twis, + uint_fast8_t n) +{ + return (nrf_twis_address_t)p_twis->ADDRESS[n]; +} +void nrf_twis_config_address_set( + NRF_TWIS_Type * const p_twis, + nrf_twis_config_addr_mask_t addr_mask) +{ + /* This is the only configuration in TWIS - just write it without masking */ + p_twis->CONFIG = addr_mask; +} + +nrf_twis_config_addr_mask_t nrf_twis_config_address_get(NRF_TWIS_Type const * const p_twis) +{ + return (nrf_twis_config_addr_mask_t)(p_twis->CONFIG & TWIS_ADDRESS_ADDRESS_Msk); +} + +void nrf_twis_orc_set( + NRF_TWIS_Type * const p_twis, + uint8_t orc) +{ + p_twis->ORC = orc; +} + +uint8_t nrf_twis_orc_get(NRF_TWIS_Type const * const p_twis) +{ + return (uint8_t)p_twis->ORC; +} + +#endif /* SUPPRESS_INLINE_IMPLEMENTATION */ + +#endif /* NRF_TWIS_H__ */ + diff --git a/components/drivers_nrf/hal/nrf_uart.h b/components/drivers_nrf/hal/nrf_uart.h new file mode 100644 index 0000000..4cac940 --- /dev/null +++ b/components/drivers_nrf/hal/nrf_uart.h @@ -0,0 +1,471 @@ +/* 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. + * + */ +#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/components/drivers_nrf/hal/nrf_uarte.h b/components/drivers_nrf/hal/nrf_uarte.h new file mode 100644 index 0000000..cc79744 --- /dev/null +++ b/components/drivers_nrf/hal/nrf_uarte.h @@ -0,0 +1,508 @@ +/* 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. + * + */ +#ifndef NRF_UARTE_H__ +#define NRF_UARTE_H__ + +#include "nrf.h" +#include +#include +#include + +#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 UARTE instance. + * @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 UARTE instance. + * @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 UARTE instance. + * @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 interrupts. + * + * @param p_reg Instance. + * @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 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_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 Instance. + * @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 Instance. + */ +__STATIC_INLINE void nrf_uarte_enable(NRF_UARTE_Type * p_reg); + +/** + * @brief Function for disabling UARTE. + * + * @param p_reg Instance. + */ +__STATIC_INLINE void nrf_uarte_disable(NRF_UARTE_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_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 Instance. + */ +__STATIC_INLINE void nrf_uarte_txrx_pins_disconnect(NRF_UARTE_Type * p_reg); + +/** + * @brief Function for getting TX pin. + * + * @param p_reg Instance. + */ +__STATIC_INLINE uint32_t nrf_uarte_tx_pin_get(NRF_UARTE_Type * p_reg); + +/** + * @brief Function for getting RX pin. + * + * @param p_reg Instance. + */ +__STATIC_INLINE uint32_t nrf_uarte_rx_pin_get(NRF_UARTE_Type * p_reg); + +/** + * @brief Function for getting RTS pin. + * + * @param p_reg Instance. + */ +__STATIC_INLINE uint32_t nrf_uarte_rts_pin_get(NRF_UARTE_Type * p_reg); + +/** + * @brief Function for getting CTS pin. + * + * @param p_reg Instance. + */ +__STATIC_INLINE uint32_t nrf_uarte_cts_pin_get(NRF_UARTE_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_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 Instance. + */ +__STATIC_INLINE void nrf_uarte_hwfc_pins_disconnect(NRF_UARTE_Type * p_reg); + +/** + * @brief Function for starting an UARTE task. + * + * @param p_reg Instance. + * @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 Instance. + * @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 Instance. + * @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 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_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 Instance. + * + * @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; + +} + +__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_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 +/** @} */ +#endif //NRF_UARTE_H__ diff --git a/components/drivers_nrf/hal/nrf_wdt.h b/components/drivers_nrf/hal/nrf_wdt.h new file mode 100644 index 0000000..f797af5 --- /dev/null +++ b/components/drivers_nrf/hal/nrf_wdt.h @@ -0,0 +1,299 @@ +/* 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_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/components/drivers_nrf/lpcomp/nrf_drv_lpcomp.c b/components/drivers_nrf/lpcomp/nrf_drv_lpcomp.c new file mode 100644 index 0000000..a7bdaa2 --- /dev/null +++ b/components/drivers_nrf/lpcomp/nrf_drv_lpcomp.c @@ -0,0 +1,132 @@ +/* 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 "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 + +static lpcomp_events_handler_t m_lpcomp_events_handler = NULL; +static nrf_drv_state_t m_state = NRF_DRV_STATE_UNINITIALIZED; + +static const nrf_drv_lpcomp_config_t m_default_config = NRF_DRV_LPCONF_DEFAULT_CONFIG; + +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); + + m_lpcomp_events_handler(event); + } +} + + +void LPCOMP_IRQHandler(void) +{ + 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) +{ + if (m_state != NRF_DRV_STATE_UNINITIALIZED) + { // LPCOMP driver is already initialized + return NRF_ERROR_INVALID_STATE; + } + + if (p_config == NULL) + { + p_config = &m_default_config; + } + + nrf_lpcomp_configure(&(p_config->hal) ); + + if (events_handler) + { + m_lpcomp_events_handler = events_handler; + } + else + { + return NRF_ERROR_INVALID_PARAM; + } + + 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; + + return NRF_SUCCESS; +} + + +void nrf_drv_lpcomp_uninit(void) +{ + ASSERT(m_state != NRF_DRV_STATE_UNINITIALIZED); + nrf_drv_common_irq_disable(LPCOMP_IRQn); + nrf_drv_lpcomp_disable(); + m_state = NRF_DRV_STATE_UNINITIALIZED; + m_lpcomp_events_handler = NULL; +} + +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; +} + +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; +} + +void nrf_drv_lpcomp_event_handler_register(lpcomp_events_handler_t lpcomp_events_handler) +{ + m_lpcomp_events_handler = lpcomp_events_handler; +} + + diff --git a/components/drivers_nrf/lpcomp/nrf_drv_lpcomp.h b/components/drivers_nrf/lpcomp/nrf_drv_lpcomp.h new file mode 100644 index 0000000..65c1377 --- /dev/null +++ b/components/drivers_nrf/lpcomp/nrf_drv_lpcomp.h @@ -0,0 +1,106 @@ +/* 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 NRF_DRV_LPCOMP_H__ +#define NRF_DRV_LPCOMP_H__ + +#include "nrf_lpcomp.h" +#include "sdk_errors.h" +#include "nrf_drv_common.h" +#include "nrf_drv_config.h" +/** + * @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_drivers_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; + +/** LPCOMP driver default configuration, including the LPCOMP HAL configuration. */ +#define NRF_DRV_LPCONF_DEFAULT_CONFIG \ + { \ + .hal = {LPCOMP_CONFIG_REFERENCE , LPCOMP_CONFIG_DETECTION}, \ + .input = LPCOMP_CONFIG_INPUT, \ + .interrupt_priority = LPCOMP_CONFIG_IRQ_PRIORITY \ + } + +/** + * @brief Function for initializing the LCOMP driver. + * + * This function initializes the LPCOMP driver, but does not enable the peripheral nor any interrupts. + * To start the driver, the function nrf_drv_lpcomp_enable() should be executed after initialization. + * + * @note Driver will be initialized to default settings if configuration struct is not provided. + * + * @param[in] p_config Initial configuration. Default configuration used if NULL. + * @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 LCOMP 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); + +/** + *@} + **/ + + #endif /* NRF_DRV_LPCOMP_H__ */ diff --git a/components/drivers_nrf/nrf_soc_nosd/nrf_error.h b/components/drivers_nrf/nrf_soc_nosd/nrf_error.h new file mode 100644 index 0000000..1174ac2 --- /dev/null +++ b/components/drivers_nrf/nrf_soc_nosd/nrf_error.h @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2012 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. + * + */ + +/* Header guard */ +#ifndef NRF_ERROR_H__ +#define NRF_ERROR_H__ + +/// @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 + +#endif // NRF_ERROR_H__ + +/// @endcond +/** + @} +*/ diff --git a/components/drivers_nrf/nrf_soc_nosd/nrf_soc.c b/components/drivers_nrf/nrf_soc_nosd/nrf_soc.c new file mode 100644 index 0000000..1227109 --- /dev/null +++ b/components/drivers_nrf/nrf_soc_nosd/nrf_soc.c @@ -0,0 +1,102 @@ + /* 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 +#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, nrf_app_irq_priority_t priority) +{ + NVIC_SetPriority(IRQn, priority); + return NRF_SUCCESS; +} + +uint32_t sd_nvic_GetPriority(IRQn_Type IRQn, nrf_app_irq_priority_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; +} + +uint32_t sd_app_evt_wait(void) +{ + __WFE(); + return NRF_SUCCESS; +} diff --git a/components/drivers_nrf/nrf_soc_nosd/nrf_soc.h b/components/drivers_nrf/nrf_soc_nosd/nrf_soc.h new file mode 100644 index 0000000..267ab5e --- /dev/null +++ b/components/drivers_nrf/nrf_soc_nosd/nrf_soc.h @@ -0,0 +1,158 @@ +/* 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 NRF_SOC_H__ +#define NRF_SOC_H__ + +#include +#include "nrf.h" + +/**@brief The interrupt priorities available to the application while the softdevice is active. */ +typedef uint8_t nrf_app_irq_priority_t; + +/**@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, nrf_app_irq_priority_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, nrf_app_irq_priority_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); + +/**@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 + */ +uint32_t sd_app_evt_wait(void); + +#endif /* NRF_SOC_H__ */ diff --git a/components/drivers_nrf/ppi/nrf_drv_ppi.c b/components/drivers_nrf/ppi/nrf_drv_ppi.c new file mode 100644 index 0000000..585073a --- /dev/null +++ b/components/drivers_nrf/ppi/nrf_drv_ppi.c @@ -0,0 +1,412 @@ +/* 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 +#include + +#include "nrf.h" +#include "nrf_drv_ppi.h" +#include "nrf_drv_common.h" +#include "nrf_ppi.h" +#include "app_util_platform.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) +{ + if (((uint32_t *)eep == NULL) || ((uint32_t *)tep == NULL)) + { + return NRF_ERROR_NULL; + } + 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_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/components/drivers_nrf/ppi/nrf_drv_ppi.h b/components/drivers_nrf/ppi/nrf_drv_ppi.h new file mode 100644 index 0000000..06a4e60 --- /dev/null +++ b/components/drivers_nrf/ppi/nrf_drv_ppi.h @@ -0,0 +1,271 @@ +/* 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. + * + */ + +#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 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/components/drivers_nrf/pstorage/config/pstorage_platform.h b/components/drivers_nrf/pstorage/config/pstorage_platform.h new file mode 100644 index 0000000..910b99b --- /dev/null +++ b/components/drivers_nrf/pstorage/config/pstorage_platform.h @@ -0,0 +1,78 @@ +/* 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. + * + */ + + /** @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. */ + +#ifdef NRF51 +#define BOOTLOADER_ADDRESS (NRF_UICR->BOOTLOADERADDR) +#elif defined NRF52 +#define BOOTLOADER_ADDRESS (PSTORAGE_FLASH_EMPTY_MASK) +#endif + +static __INLINE uint32_t pstorage_flash_page_end() +{ + uint32_t bootloader_addr = BOOTLOADER_ADDRESS; + + 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/components/drivers_nrf/pstorage/pstorage.c b/components/drivers_nrf/pstorage/pstorage.c new file mode 100644 index 0000000..a1e08b7 --- /dev/null +++ b/components/drivers_nrf/pstorage/pstorage.c @@ -0,0 +1,1572 @@ +/* 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 "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/components/drivers_nrf/pstorage/pstorage.h b/components/drivers_nrf/pstorage/pstorage.h new file mode 100644 index 0000000..d500599 --- /dev/null +++ b/components/drivers_nrf/pstorage/pstorage.h @@ -0,0 +1,381 @@ +/* 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. + * + */ + +/**@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/components/drivers_nrf/pstorage/pstorage_nosd.c b/components/drivers_nrf/pstorage/pstorage_nosd.c new file mode 100644 index 0000000..7416da7 --- /dev/null +++ b/components/drivers_nrf/pstorage/pstorage_nosd.c @@ -0,0 +1,525 @@ +/* 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 "pstorage.h" +#include "nordic_common.h" +#include "nrf_error.h" +#include "ble_flash.h" +#include "app_util.h" +#include +#include +#include + + +#define no_SUPPORT_MODULES_LARGER_THAN_PAGE + +/** + * @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 versions of code to save execution and size. + * + * @{ + */ +/** + * @brief Checks if API parameters are null. Mostly used for pointer parameters. + */ +#define NULL_PARAM_CHECK(PARAM) \ + if ((PARAM) == NULL) \ + { \ + return NRF_ERROR_NULL; \ + } + +/**@brief Verifies the module identifier supplied by the application is within permissible + * range. + */ +#define MODULE_ID_RANGE_CHECK(ID) \ + if ((PSTORAGE_NUM_OF_PAGES <= ((ID)->module_id)) || \ + (m_app_table[(ID)->module_id].cb == NULL)) \ + { \ + return NRF_ERROR_INVALID_PARAM; \ + } + +/**@brief Verifies the block identifier supplied by the application is within the permissible + * range. + */ +#define BLOCK_ID_RANGE_CHECK(ID) \ + if ( \ + ( \ + m_app_table[(ID)->module_id].base_id \ + + \ + ( \ + m_app_table[(ID)->module_id].block_count \ + * \ + MODULE_BLOCK_SIZE(ID) \ + ) \ + ) \ + <= \ + ((ID)->block_id) \ + ) \ + { \ + return NRF_ERROR_INVALID_PARAM; \ + } + + +/**@brief Verifies 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 block size requested by Application in registration API */ +#define BLOCK_COUNT_CHECK(COUNT, SIZE) \ + if (((COUNT) == 0) || ((m_next_page_addr + ((COUNT) *(SIZE)) > PSTORAGE_DATA_END_ADDR))) \ + { \ + return NRF_ERROR_INVALID_PARAM; \ + } + +/**@brief Verifies size parameter provided by application in API. */ +#define SIZE_CHECK(ID, SIZE) \ + if(((SIZE) == 0) || ((SIZE) > MODULE_BLOCK_SIZE(ID))) \ + { \ + return NRF_ERROR_INVALID_PARAM; \ + } + +/**@brief Verifies offset parameter provided by application in API. */ +#define OFFSET_CHECK(ID, OFFSET, SIZE) \ + if(((SIZE) + (OFFSET)) > MODULE_BLOCK_SIZE(ID)) \ + { \ + return NRF_ERROR_INVALID_PARAM; \ + } + +/**@brief SET BASE by masking offset bits for a address within page */ +#define PAGE_BASE_ADDR(flash_address) ((flash_address)&(~((uint32_t)PSTORAGE_FLASH_PAGE_SIZE-1))) + +/**@brief Verifies the total module size requested by the application can be supported by the module. */ +#define MODULE_SIZE_CHECK(X) \ + if ((X) > PSTORAGE_FLASH_PAGE_SIZE) \ + { \ + return NRF_ERROR_INVALID_PARAM; \ + } + +/**@} */ + + /**@brief Verify module's initialization status. + * + * @details Verify module's initialization status. Returns NRF_ERROR_INVALID_STATE in case a + * module API is called without initializing the module. + */ +#define VERIFY_MODULE_INITIALIZED() \ + do \ + { \ + if (!m_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 Application registration information. + * + * @details Abstracts application specific information that application needs to maintain to be able + * to process requests from each one of them. + * + */ +typedef struct ps_module_table +{ + pstorage_ntf_cb_t cb; /**< Callback registered with the module to be notified of any error occurring in persistent memory management */ + pstorage_block_t base_id; /**< Base block id assigned to the module */ + uint16_t block_size; /**< Size of block for the module */ + uint16_t block_count; /**< Number of block requested by application */ + uint16_t no_of_pages; /**< Variable to remember how many pages have been allocated for this module. This information is used for clearing of block, so that application does not need to have knowledge of number of pages its using. */ +} pstorage_module_table_t; + +static pstorage_module_table_t m_app_table[PSTORAGE_NUM_OF_PAGES]; /**< Registered application information table. */ + +static uint32_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 can span across flash pages. */ + +static bool m_module_initialized = false; /**< Flag for checking if module has been initialized. */ + + +/** + * @brief Routine to notify application of any errors. + * + * @param[in] result Result of event being notified. + */ +static __INLINE void app_notify(pstorage_handle_t * p_handle, + uint8_t * p_addr, + uint8_t op_code, + pstorage_size_t size, + uint32_t result) +{ + pstorage_ntf_cb_t ntf_cb; + + ntf_cb = m_app_table[p_handle->module_id].cb; + + // Indicate result to client. + // For PSTORAGE_CLEAR_OP_CODE no size is returned as the size field is used only internally + // for clients registering multiple pages. + ntf_cb(p_handle, + op_code, + result, + p_addr, + size); +} + + +uint32_t pstorage_init(void) +{ + m_next_app_instance = 0; + m_next_page_addr = PSTORAGE_DATA_START_ADDR; + m_module_initialized = true; + 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); + +#ifndef SUPPORT_MODULES_LARGER_THAN_PAGE + MODULE_SIZE_CHECK(((uint16_t)(p_module_param->block_size)*(p_module_param->block_count))); +#endif + + + 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. + + +#ifdef SUPPORT_MODULES_LARGER_THAN_PAGE + uint16_t page_count = 0; + uint32_t total_size; + total_size = p_module_param->block_size * p_module_param->block_count; + do + { + page_count++; + + if (total_size > PSTORAGE_FLASH_PAGE_SIZE) + { + total_size -= PSTORAGE_FLASH_PAGE_SIZE; + } + else + { + total_size = 0; + } + + m_next_page_addr += PSTORAGE_FLASH_PAGE_SIZE; + + } while (total_size >= PSTORAGE_FLASH_PAGE_SIZE); + m_app_table[m_next_app_instance].no_of_pages = page_count; +#else + m_app_table[m_next_app_instance].no_of_pages = 1; + m_next_page_addr += PSTORAGE_FLASH_PAGE_SIZE; +#endif + 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); + + // Verify word alignment. + if ((!is_word_aligned(p_src)) || (!is_word_aligned((void *)(uint32_t)offset))) + { + return NRF_ERROR_INVALID_ADDR; + } + + uint32_t storage_addr = p_dest->block_id + offset; + + uint32_t retval = ble_flash_block_write((uint32_t *)storage_addr, + (uint32_t *)p_src, + (size /sizeof(uint32_t))); + + app_notify(p_dest, p_src, PSTORAGE_STORE_OP_CODE, size, retval); + + return retval; +} + +/** @brief Function for handling flash updates using swap page + * + * __________________________________________________ + * | Page1 | + * |_______________________________________________| + * | head | body (to be updated ) | tail | + * |______|_________________________________|______| + * + * ________________________________________________________________________________________ + * | Page1 | Page2 | + * |_______________________________________________|______________________________________| + * | head | body (to be updated ) | tail | + * |________________|________________________________________|____________________________| + * + * + * ToDo: pointers not uint32_t for addresses + * + */ + +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); + + uint32_t *p_swap_addr = (uint32_t *)PSTORAGE_SWAP_ADDR; + uint32_t *p_page_addr1 = (uint32_t *) PAGE_BASE_ADDR(p_dest->block_id + offset); +#ifdef SUPPORT_MODULES_LARGER_THAN_PAGE + uint32_t *p_page_addr2 = (uint32_t *) PAGE_BASE_ADDR(p_dest->block_id + offset + size-1); +#endif + // block may not be aligned with page, so head must include all trailing blocks + uint16_t head_word_count = (uint32_t)((uint32_t *)p_dest->block_id - p_page_addr1) + (offset)/sizeof(uint32_t); + uint16_t body_word_count = size/sizeof(uint32_t); + uint16_t tail_word_count; + uint32_t retval; + + // Verify word alignment. + if ((!is_word_aligned(p_src)) || (!is_word_aligned((void *)(uint32_t)offset))) + { + return NRF_ERROR_INVALID_ADDR; + } + // erase swap page + (void) ble_flash_page_erase(PSTORAGE_SWAP_ADDR / BLE_FLASH_PAGE_SIZE); +#ifdef SUPPORT_MODULES_LARGER_THAN_PAGE + if (p_page_addr1 == p_page_addr2) + { +#endif + // tail is in the same page as head + tail_word_count = BLE_FLASH_PAGE_SIZE/sizeof(uint32_t) - head_word_count - body_word_count; + // copy of the head + if (head_word_count) + { + retval = ble_flash_block_write(p_swap_addr, p_page_addr1, head_word_count ); + if (retval != NRF_SUCCESS) + { + app_notify(p_dest, p_src, PSTORAGE_UPDATE_OP_CODE, size, retval); + return retval; + } + } + // copy of the body + retval = ble_flash_block_write(p_swap_addr+head_word_count, (uint32_t *)p_src, body_word_count); + if (retval != NRF_SUCCESS) + { + app_notify(p_dest, p_src, PSTORAGE_UPDATE_OP_CODE, size, retval); + return retval; + } + // copy of the tail + if (tail_word_count) + { + retval = ble_flash_block_write(p_swap_addr+head_word_count+body_word_count, p_page_addr1+head_word_count+body_word_count, tail_word_count ); + if (retval != NRF_SUCCESS) + { + app_notify(p_dest, p_src, PSTORAGE_UPDATE_OP_CODE, size, retval); + return retval; + } + } + // erase active page + (void) ble_flash_page_erase((uint32_t)p_page_addr1 / BLE_FLASH_PAGE_SIZE); + // restore updated page + retval = ble_flash_block_write(p_page_addr1, p_swap_addr, BLE_FLASH_PAGE_SIZE/sizeof(uint32_t)); +#ifdef SUPPORT_MODULES_LARGER_THAN_PAGE + } + else + { + // tail is in NOT in the same page as head - need to swap twice + uint16_t body1_word_count = BLE_FLASH_PAGE_SIZE/sizeof(uint32_t) - head_word_count; + uint16_t body2_word_count = body_word_count - body1_word_count; + tail_word_count = BLE_FLASH_PAGE_SIZE/sizeof(uint32_t) - body2_word_count; + // copy head + retval = ble_flash_block_write(p_swap_addr, p_page_addr1, head_word_count ); + if (retval != NRF_SUCCESS) + { + app_notify(p_dest, p_src, PSTORAGE_UPDATE_OP_CODE, size, retval); + return retval; + } + // copy body1 + retval = ble_flash_block_write(p_swap_addr, (uint32_t *)p_src, body1_word_count ); + if (retval != NRF_SUCCESS) + { + app_notify(p_dest, p_src, PSTORAGE_UPDATE_OP_CODE, size, retval); + return retval; + } + // erase active page + (void) ble_flash_page_erase((uint32_t)p_page_addr1 / BLE_FLASH_PAGE_SIZE); + // restore updated page1 + retval = ble_flash_block_write(p_page_addr1, p_swap_addr, BLE_FLASH_PAGE_SIZE/sizeof(uint32_t)); + if (retval != NRF_SUCCESS) + { + app_notify(p_dest, p_src, PSTORAGE_UPDATE_OP_CODE, size, retval); + return retval; + } + // erase swap page + (void) ble_flash_page_erase(PSTORAGE_SWAP_ADDR / BLE_FLASH_PAGE_SIZE); + // copy body2 + retval = ble_flash_block_write(p_swap_addr, (uint32_t *)p_src + body1_word_count, body2_word_count ); + if (retval != NRF_SUCCESS) + { + app_notify(p_dest, p_src, PSTORAGE_UPDATE_OP_CODE, size, retval); + return retval; + } + // copy tail + retval = ble_flash_block_write(p_swap_addr, p_page_addr2+body2_word_count, tail_word_count ); + if (retval != NRF_SUCCESS) + { + app_notify(p_dest, p_src, PSTORAGE_UPDATE_OP_CODE, size, retval); + return retval; + } + // erase active page + (void) ble_flash_page_erase((uint32_t)p_page_addr2 / BLE_FLASH_PAGE_SIZE); + // restore updated page2 + retval = ble_flash_block_write(p_page_addr2, p_swap_addr, BLE_FLASH_PAGE_SIZE/sizeof(uint32_t)); + if (retval != NRF_SUCCESS) + { + app_notify(p_dest, p_src, PSTORAGE_UPDATE_OP_CODE, size, retval); + return retval; + } + } +#endif + app_notify(p_dest, p_src, PSTORAGE_UPDATE_OP_CODE, size, retval); + return retval; + +} + +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); + + // Verify word alignment. + if ((!is_word_aligned(p_dest)) || (!is_word_aligned((void *)(uint32_t)offset))) + { + return NRF_ERROR_INVALID_ADDR; + } + + memcpy(p_dest, (((uint8_t *)p_src->block_id) + offset), size); + + app_notify(p_src, p_dest, PSTORAGE_LOAD_OP_CODE, size, NRF_SUCCESS); + + return NRF_SUCCESS; +} + + +uint32_t pstorage_clear(pstorage_handle_t * p_dest, pstorage_size_t size) +{ + uint32_t page_addr; + uint32_t retval; + uint16_t page_count; + + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(p_dest); + MODULE_ID_RANGE_CHECK(p_dest); + + page_addr = p_dest->block_id / BLE_FLASH_PAGE_SIZE; + + retval = NRF_SUCCESS; + + for (page_count = 0; page_count < m_app_table[p_dest->module_id].no_of_pages; page_count++) + { + retval = ble_flash_page_erase(page_addr); + page_addr++; + if (retval != NRF_SUCCESS) + { + break; + } + } + app_notify(p_dest, NULL, PSTORAGE_CLEAR_OP_CODE, size, retval); + return retval; +} + +void pstorage_sys_event_handler(uint32_t sys_evt) +{ + +} + +uint32_t pstorage_access_status_get(uint32_t * p_count) +{ + if (p_count) + { + *p_count = 0; + } + return NRF_SUCCESS; +} diff --git a/components/drivers_nrf/pstorage/pstorage_raw.c b/components/drivers_nrf/pstorage/pstorage_raw.c new file mode 100644 index 0000000..2d70cdb --- /dev/null +++ b/components/drivers_nrf/pstorage/pstorage_raw.c @@ -0,0 +1,471 @@ +/* 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 "pstorage.h" +#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" + +/** @file + * + * @defgroup persistent_storage_raw Persistent Storage Interface - Raw Mode Implementation + * @{ + * @ingroup persistent_storage + * @brief Persistent Storage Interface - Raw Mode Implementation. + * + * @details This file contains the source code for raw mode implementation of pstorage. + * It is intended for special use cases where flash size is critical or the application must have + * full control of the flash, such as DFU. The registration function in this implementation only + * allocates a module id for the queue but does not locate any flash pages for the registrant. + * This implementation provides no safety checking of addresses when clearing or storing data into + * flash. The application is responsible for handling flash addresses and care must therefore be + * taken in application not to erase application area. + * This implementation does not support the @ref pstorage_update function. + */ + +#define INVALID_OPCODE 0x00 /**< Invalid op code identifier. */ + +#ifdef NRF51 +#define SOC_MAX_WRITE_SIZE 1024 /**< Maximum write size allowed for a single call to \ref sd_flash_write as specified in the SoC API on the nRF51. */ +#elif NRF52 +#define SOC_MAX_WRITE_SIZE 4096 /**< Maximum write size allowed for a single call to \ref sd_flash_write as specified in the SoC API on the nRF52. */ +#else +#error No target defined +#endif + + +/** + * @brief Application registration information. + * + * @details Define application specific information that 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_module_table_t; + + +/** + * @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 flash access operation being queued. Element is free is op-code is INVALID_OPCODE */ + pstorage_size_t size; /**< Identifies size in bytes requested for the operation. */ + pstorage_size_t offset; /**< Offset requested by the application for 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 is op_code field is not invalid. + * + * @details Defines commands enqueued for flash access. At any point of time, this queue has one or + * more flash access operation 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 to 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. */ + bool flash_access; /**< Flag to ensure an flash event received is for an request issued by the module. */ + 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_module_table_t m_app_table[PSTORAGE_NUM_OF_PAGES]; /**< Registered application information table. */ +static pstorage_size_t m_next_app_instance; /**< Points to the application module instance that can be allocated next */ +static pstorage_size_t m_round_val; /**< Round value for multiple round operations. For erase operations, the round value will contain current round counter which is identical to number of pages erased. For store operations, the round value contains current round of operation * SOC_MAX_WRITE_SIZE to ensure each store to the SoC Flash API is within the SoC limit. */ + +/** + * @brief Function for processing of commands and issuing flash access request to the SoftDevice. + * + * @return The return value received from SoftDevice. + */ +static uint32_t cmd_process(void); + + +/** + * @brief Function for notifying application of any errors. + * + * @param[in] result Result of event being notified. + * @param[in] p_elem Pointer to the element for which a notification should be given. + */ +static void app_notify(uint32_t result, cmd_queue_element_t * p_elem); + + +/** + * @defgroup utility_functions Utility internal functions. + * @{ + * @details Utility functions needed for interfacing with flash through SoC APIs. + * SoC APIs are non blocking and provide the result of flash access through an event. + * + * @note Only one flash access operation is permitted at a time by SoC. Hence a queue is + * maintained by this module. + */ + +/** + * @brief Function for initializing a command queue element. + * + * @param[in] index Index identifying 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) +{ + uint32_t cmd_index; + + m_round_val = 0; + m_cmd_queue.rp = 0; + m_cmd_queue.count = 0; + m_cmd_queue.flash_access = false; + + for(cmd_index = 0; cmd_index < PSTORAGE_CMD_QUEUE_SIZE; cmd_index++) + { + cmd_queue_element_init(cmd_index); + } +} + + +/** + * @brief Function for enqueueing a flash access operation. + * + * @param[in] opcode Operation code for the command to queue. + * @param[in] p_storage_addr Pointer to the destination address. + * @param[in] p_data_addr Pointer to the source address containing the data. + * @param[in] size Size of data clear or write. + * @param[in] offset Offset to the address identified by the source data address. + * + * @retval NRF_SUCCESS If the enqueueing succeeded. + * @retval NRF_ERROR_NO_MEM In case the queue is full. + * @return Any error returned by the SoftDevice flash API. + */ +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 retval; + + if (m_cmd_queue.count != PSTORAGE_CMD_QUEUE_SIZE) + { + uint8_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; + retval = NRF_SUCCESS; + if (m_cmd_queue.flash_access == false) + { + retval = cmd_process(); + if (retval == NRF_ERROR_BUSY) + { + // In case of busy error code, it is possible to attempt to access flash. + retval = NRF_SUCCESS; + } + } + m_cmd_queue.count++; + } + else + { + retval = NRF_ERROR_NO_MEM; + } + + return retval; +} + + +/** + * @brief Function for dequeueing a command element. + * + * @retval NRF_SUCCESS If the dequeueing succeeded and next command was processed. + * @return Any error returned by the SoftDevice flash API. + */ +static uint32_t cmd_queue_dequeue(void) +{ + uint32_t retval = NRF_SUCCESS; + + // If any flash operation is enqueued, schedule + if ((m_cmd_queue.count > 0) && (m_cmd_queue.flash_access == false)) + { + retval = cmd_process(); + if (retval != NRF_SUCCESS) + { + // Flash could be accessed by other modules, hence a busy error is + // acceptable, but any other error needs to be indicated. + if (retval == NRF_ERROR_BUSY) + { + // In case of busy error code, it is possible to attempt to access flash. + retval = NRF_SUCCESS; + } + } + } + else + { + // No flash access request pending. + } + + return retval; +} + + +/** + * @brief Function for notifying application of any errors. + * + * @param[in] result Result of event being notified. + * @param[in] p_elem Pointer to the element for which a notification should be given. + */ +static void app_notify(uint32_t result, cmd_queue_element_t * p_elem) +{ + pstorage_ntf_cb_t ntf_cb; + uint8_t op_code = p_elem->op_code; + + ntf_cb = m_app_table[p_elem->storage_addr.module_id].cb; + + // Indicate result to client. + ntf_cb(&p_elem->storage_addr, + op_code, + result, + p_elem->p_data_addr, + p_elem->size); +} + + +/** + * @brief Function for handling of system events from SoftDevice. + * + * @param[in] sys_evt System event received. + */ +void pstorage_sys_event_handler(uint32_t sys_evt) +{ + uint32_t retval = NRF_SUCCESS; + + // The event shall only be processed if requested by this module. + if (m_cmd_queue.flash_access == true) + { + cmd_queue_element_t * p_cmd; + m_cmd_queue.flash_access = false; + switch (sys_evt) + { + case NRF_EVT_FLASH_OPERATION_SUCCESS: + { + p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; + m_round_val++; + + bool command_finished = ((m_round_val * SOC_MAX_WRITE_SIZE) >= p_cmd->size); + + if (command_finished) + { + uint8_t queue_rp = m_cmd_queue.rp; + + m_round_val = 0; + m_cmd_queue.count--; + m_cmd_queue.rp++; + + if (m_cmd_queue.rp >= PSTORAGE_CMD_QUEUE_SIZE) + { + m_cmd_queue.rp -= PSTORAGE_CMD_QUEUE_SIZE; + } + + app_notify(retval, &m_cmd_queue.cmd[queue_rp]); + + // Initialize/free the element as it is now processed. + cmd_queue_element_init(queue_rp); + } + // Schedule any queued flash access operations. + retval = cmd_queue_dequeue(); + if (retval != NRF_SUCCESS) + { + app_notify(retval, &m_cmd_queue.cmd[m_cmd_queue.rp]); + } + } + break; + + case NRF_EVT_FLASH_OPERATION_ERROR: + app_notify(NRF_ERROR_TIMEOUT, &m_cmd_queue.cmd[m_cmd_queue.rp]); + break; + + default: + // No implementation needed. + break; + } + } +} + + +/** + * @brief Function for processing of commands and issuing flash access request to the SoftDevice. + * + * @return The return value received from SoftDevice. + */ +static uint32_t cmd_process(void) +{ + uint32_t retval; + uint32_t storage_addr; + cmd_queue_element_t * p_cmd; + + retval = NRF_ERROR_FORBIDDEN; + + p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; + + storage_addr = p_cmd->storage_addr.block_id; + + switch (p_cmd->op_code) + { + case PSTORAGE_STORE_OP_CODE: + { + uint32_t size; + uint32_t offset; + uint8_t * p_data_addr = p_cmd->p_data_addr; + + offset = (m_round_val * SOC_MAX_WRITE_SIZE); + size = p_cmd->size - offset; + p_data_addr += offset; + storage_addr += (p_cmd->offset + offset); + + if (size < SOC_MAX_WRITE_SIZE) + { + retval = sd_flash_write(((uint32_t *)storage_addr), + (uint32_t *)p_data_addr, + size / sizeof(uint32_t)); + } + else + { + retval = sd_flash_write(((uint32_t *)storage_addr), + (uint32_t *)p_data_addr, + SOC_MAX_WRITE_SIZE / sizeof(uint32_t)); + } + } + break; + + case PSTORAGE_CLEAR_OP_CODE: + { + uint32_t page_number; + + page_number = ((storage_addr / PSTORAGE_FLASH_PAGE_SIZE) + + m_round_val); + + retval = sd_flash_page_erase(page_number); + } + break; + + default: + // Should never reach here. + break; + } + + if (retval == NRF_SUCCESS) + { + m_cmd_queue.flash_access = true; + } + + return retval; +} +/** @} */ + + +uint32_t pstorage_init(void) +{ + cmd_queue_init(); + + m_next_app_instance = 0; + m_round_val = 0; + + for(unsigned int index = 0; index < PSTORAGE_NUM_OF_PAGES; index++) + { + m_app_table[index].cb = NULL; + } + + return NRF_SUCCESS; +} + + +uint32_t pstorage_register(pstorage_module_param_t * p_module_param, + pstorage_handle_t * p_block_id) +{ + if (m_next_app_instance == PSTORAGE_NUM_OF_PAGES) + { + return NRF_ERROR_NO_MEM; + } + + p_block_id->module_id = m_next_app_instance; + m_app_table[m_next_app_instance++].cb = p_module_param->cb; + + 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) +{ + return NRF_ERROR_NOT_SUPPORTED; +} + + +uint32_t pstorage_store(pstorage_handle_t * p_dest, + uint8_t * p_src, + pstorage_size_t size, + pstorage_size_t offset) +{ + // Verify word alignment. + if ((!is_word_aligned(p_src)) || (!is_word_aligned(p_src+offset))) + { + return NRF_ERROR_INVALID_ADDR; + } + + return cmd_queue_enqueue(PSTORAGE_STORE_OP_CODE, p_dest, p_src, size, offset); +} + + +uint32_t pstorage_clear(pstorage_handle_t * p_dest, pstorage_size_t size) +{ + return cmd_queue_enqueue(PSTORAGE_CLEAR_OP_CODE, p_dest, NULL , size, 0); +} + + +/** + * @} + */ diff --git a/components/drivers_nrf/qdec/nrf_drv_qdec.c b/components/drivers_nrf/qdec/nrf_drv_qdec.c new file mode 100644 index 0000000..87ac97b --- /dev/null +++ b/components/drivers_nrf/qdec/nrf_drv_qdec.c @@ -0,0 +1,168 @@ +/* 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 + +#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" + +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); + + 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); + + 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); + + 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) +{ + if (m_state != NRF_DRV_STATE_UNINITIALIZED) + { + return NRF_ERROR_INVALID_STATE; // qdec_event_handler has been already registered + } + + if (p_config == NULL) + { + p_config = &m_default_config; + } + + if (event_handler) + { + m_qdec_event_handler = event_handler; + } + else + { + return NRF_ERROR_INVALID_PARAM; + } + + 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; + + return NRF_SUCCESS; +} + +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; +} + +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; +} + +void nrf_drv_qdec_disable(void) +{ + ASSERT(m_state == NRF_DRV_STATE_POWERED_ON); + nrf_qdec_disable(); + nrf_qdec_task_trigger(NRF_QDEC_TASK_STOP); + m_state = NRF_DRV_STATE_INITIALIZED; +} + +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(); +} + +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); +} + diff --git a/components/drivers_nrf/qdec/nrf_drv_qdec.h b/components/drivers_nrf/qdec/nrf_drv_qdec.h new file mode 100644 index 0000000..f825d8d --- /dev/null +++ b/components/drivers_nrf/qdec/nrf_drv_qdec.h @@ -0,0 +1,149 @@ +/* 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. + * + */ + +#ifndef NRF_DRV_QDEC_H__ +#define NRF_DRV_QDEC_H__ + +#include "nrf_qdec.h" +#include "nrf_drv_config.h" +#include "sdk_errors.h" +#include +#include + +/** + * @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_drivers_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 = QDEC_CONFIG_REPORTPER, \ + .sampleper = QDEC_CONFIG_SAMPLEPER, \ + .psela = QDEC_CONFIG_PIO_A, \ + .pselb = QDEC_CONFIG_PIO_B, \ + .pselled = QDEC_CONFIG_PIO_LED, \ + .ledpre = QDEC_CONFIG_LEDPRE, \ + .ledpol = 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); + +/** + *@} + **/ +#endif /* NRF_DRV_QDEC_H__ */ diff --git a/components/drivers_nrf/radio_config/radio_config.c b/components/drivers_nrf/radio_config/radio_config.c new file mode 100644 index 0000000..a739025 --- /dev/null +++ b/components/drivers_nrf/radio_config/radio_config.c @@ -0,0 +1,160 @@ +/* Copyright (c) 2009 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_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/components/drivers_nrf/radio_config/radio_config.h b/components/drivers_nrf/radio_config/radio_config.h new file mode 100644 index 0000000..734ff14 --- /dev/null +++ b/components/drivers_nrf/radio_config/radio_config.h @@ -0,0 +1,21 @@ +/* Copyright (c) 2009 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 RADIO_CONFIG_H +#define RADIO_CONFIG_H + +#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 + +void radio_configure(void); + +#endif diff --git a/components/drivers_nrf/rng/nrf_drv_rng.c b/components/drivers_nrf/rng/nrf_drv_rng.c new file mode 100644 index 0000000..7294b9b --- /dev/null +++ b/components/drivers_nrf/rng/nrf_drv_rng.c @@ -0,0 +1,219 @@ +/* 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 + +#include "nrf_drv_rng.h" +#include "nrf_assert.h" +#include "nrf_drv_common.h" +#include "nordic_common.h" +#include "nrf_error.h" +#include "nrf_assert.h" +#ifdef SOFTDEVICE_PRESENT +#include "nrf_sdm.h" +#include "nrf_soc.h" +#else +#include "app_fifo.h" +#include "app_util_platform.h" + +static __INLINE uint32_t fifo_length(app_fifo_t * p_fifo) +{ + uint32_t tmp = p_fifo->read_pos; + return p_fifo->write_pos - tmp; +} + +#define FIFO_LENGTH(fifo) fifo_length(&(fifo)) /**< Macro for calculating the FIFO length. */ + +#endif // SOFTDEVICE_PRESENT +typedef struct +{ + nrf_drv_state_t state; +#ifndef SOFTDEVICE_PRESENT + app_fifo_t rand_pool; + uint8_t buffer[RNG_CONFIG_POOL_SIZE]; +#endif // SOFTDEVICE_PRESENT +} nrf_drv_rng_cb_t; + +static nrf_drv_rng_cb_t m_rng_cb; +#ifndef SOFTDEVICE_PRESENT +static const nrf_drv_rng_config_t m_default_config = NRF_DRV_RNG_DEFAULT_CONFIG; +static void rng_start(void) +{ + if (FIFO_LENGTH(m_rng_cb.rand_pool) <= m_rng_cb.rand_pool.buf_size_mask) + { + 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); + } +} + + +static void rng_stop(void) +{ + nrf_rng_int_disable(NRF_RNG_INT_VALRDY_MASK); + nrf_rng_task_trigger(NRF_RNG_TASK_STOP); +} + + +#endif // SOFTDEVICE_PRESENT + + +ret_code_t nrf_drv_rng_init(nrf_drv_rng_config_t const * p_config) +{ + uint32_t result; + + if (m_rng_cb.state == NRF_DRV_STATE_UNINITIALIZED) + { +#ifndef SOFTDEVICE_PRESENT + + result = app_fifo_init(&m_rng_cb.rand_pool, m_rng_cb.buffer, RNG_CONFIG_POOL_SIZE); + + if (p_config == NULL) + { + p_config = &m_default_config; + } + + if (result == NRF_SUCCESS) + { + if (p_config->error_correction) + { + nrf_rng_error_correction_enable(); + } + + nrf_drv_common_irq_enable(RNG_IRQn, p_config->interrupt_priority); + + nrf_rng_shorts_disable(NRF_RNG_SHORT_VALRDY_STOP_MASK); + + rng_start(); + m_rng_cb.state = NRF_DRV_STATE_INITIALIZED; + } +#else + UNUSED_VARIABLE(p_config); + uint8_t softdevice_is_enabled; + result = sd_softdevice_is_enabled(&softdevice_is_enabled); + + if (softdevice_is_enabled) + { + m_rng_cb.state = NRF_DRV_STATE_INITIALIZED; + } + else + { + result = NRF_ERROR_SOFTDEVICE_NOT_ENABLED; + } +#endif // SOFTDEVICE_PRESENT + } + else + { + result = NRF_ERROR_INVALID_STATE; + } + return result; +} + + +void nrf_drv_rng_uninit(void) +{ + ASSERT(m_rng_cb.state == NRF_DRV_STATE_INITIALIZED); + + m_rng_cb.state = NRF_DRV_STATE_UNINITIALIZED; +#ifndef SOFTDEVICE_PRESENT + rng_stop(); + nrf_drv_common_irq_disable(RNG_IRQn); +#endif // SOFTDEVICE_PRESENT +} + +ret_code_t nrf_drv_rng_bytes_available(uint8_t * p_bytes_available) +{ + ret_code_t result; + ASSERT(m_rng_cb.state == NRF_DRV_STATE_INITIALIZED); + +#ifndef SOFTDEVICE_PRESENT + + result = NRF_SUCCESS; + *p_bytes_available = FIFO_LENGTH(m_rng_cb.rand_pool); + +#else + + result = sd_rand_application_bytes_available_get(p_bytes_available); + +#endif // SOFTDEVICE_PRESENT + + return result; +} + +ret_code_t nrf_drv_rng_pool_capacity(uint8_t * p_pool_capacity) +{ + ret_code_t result; + ASSERT(m_rng_cb.state == NRF_DRV_STATE_INITIALIZED); + +#ifndef SOFTDEVICE_PRESENT + + result = NRF_SUCCESS; + *p_pool_capacity = RNG_CONFIG_POOL_SIZE; + +#else + + result = sd_rand_application_pool_capacity_get(p_pool_capacity); + +#endif // SOFTDEVICE_PRESENT + return result; +} + +ret_code_t nrf_drv_rng_rand(uint8_t * p_buff, uint8_t length) +{ + ret_code_t result; + + ASSERT(m_rng_cb.state == NRF_DRV_STATE_INITIALIZED); + +#ifndef SOFTDEVICE_PRESENT + if (FIFO_LENGTH(m_rng_cb.rand_pool) >= length) + { + result = NRF_SUCCESS; + + for (uint32_t i = 0; (i < length) && (result == NRF_SUCCESS); i++) + { + result = app_fifo_get(&(m_rng_cb.rand_pool), &p_buff[i]); + } + rng_start(); + } + else + { + result = NRF_ERROR_NO_MEM; + } +#else + + result = sd_rand_application_vector_get(p_buff, length); + +#endif // SOFTDEVICE_PRESENT + + + return result; +} + + +#ifndef SOFTDEVICE_PRESENT +void RNG_IRQHandler(void) +{ + if (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); + uint32_t nrf_error = app_fifo_put(&m_rng_cb.rand_pool, nrf_rng_random_value_get()); + + if ((FIFO_LENGTH(m_rng_cb.rand_pool) > m_rng_cb.rand_pool.buf_size_mask) || (nrf_error == NRF_ERROR_NO_MEM)) + { + rng_stop(); + } + } +} + +#endif // SOFTDEVICE_PRESENT diff --git a/components/drivers_nrf/rng/nrf_drv_rng.h b/components/drivers_nrf/rng/nrf_drv_rng.h new file mode 100644 index 0000000..52136eb --- /dev/null +++ b/components/drivers_nrf/rng/nrf_drv_rng.h @@ -0,0 +1,104 @@ +/* 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. + * + */ + +#ifndef NRF_DRV_RNG_H__ +#define NRF_DRV_RNG_H__ + +#include +#include + +#include "nrf_rng.h" +#include "sdk_errors.h" +#include "nrf_drv_config.h" + +/** + * @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; /**< 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_INVALID_STATE Driver was already initialized. + * @retval NRF_ERROR_INVALID_LENGTH Pool size have to be a power of 2. + * @retval NRF_ERROR_SOFTDEVICE_NOT_ENABLED SoftDevice is present, but not enabled. + */ +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. + * + * @retval NRF_SUCCESS If the number of available random bytes was written to p_bytes_available. + * @retval NRF_ERROR_INVALID_STATE If the driver was not initialized. + */ +ret_code_t nrf_drv_rng_bytes_available(uint8_t * p_bytes_available); + +/** + * @brief Function for querying the capacity of the application random pool. + * + * @param[out] p_pool_capacity The capacity of the pool. + * + * @retval NRF_SUCCESS If the capacity of the pool was written to p_pool_capacity. + * @retval NRF_ERROR_INVALID_STATE If the driver was not initialized. + */ +ret_code_t nrf_drv_rng_pool_capacity(uint8_t * p_pool_capacity); + +/** + * @brief Function for getting the vector of random numbers. + * + * @param[out] p_buff Pointer to unit8_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_INVALID_STATE If the driver was not initialized. + * @retval NRF_ERROR_NO_MEM If no bytes were written to the buffer + * because there were not enough bytes available in p_buff. + * @retval NRF_ERROR_SOC_RAND_NOT_ENOUGH_VALUES 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); +/** + *@} + **/ +#endif // NRF_DRV_RNG_H__ diff --git a/components/drivers_nrf/rtc/nrf_drv_rtc.c b/components/drivers_nrf/rtc/nrf_drv_rtc.c new file mode 100644 index 0000000..2588885 --- /dev/null +++ b/components/drivers_nrf/rtc/nrf_drv_rtc.c @@ -0,0 +1,278 @@ +/* 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 "nrf_drv_rtc.h" +#include "nrf_rtc.h" +#include "nrf_assert.h" +#include "app_util_platform.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[RTC_COUNT]; +static nrf_drv_rtc_cb_t m_cb[RTC_COUNT]; + +static const nrf_drv_rtc_config_t m_default_config[] = { +#if (RTC0_ENABLED == 1) + NRF_DRV_RTC_DEFAULT_CONFIG(0), +#endif +#if (RTC1_ENABLED == 1) + NRF_DRV_RTC_DEFAULT_CONFIG(1) +#endif +}; + +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) +{ + if (handler) + { + m_handlers[p_instance->instance_id] = handler; + } + else + { + return NRF_ERROR_INVALID_PARAM; + } + + if (p_config == NULL) + { + p_config = &m_default_config[p_instance->instance_id]; + } + + if (m_cb[p_instance->instance_id].state != NRF_DRV_STATE_UNINITIALIZED) + { + return NRF_ERROR_INVALID_STATE; + } + + 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; + + return NRF_SUCCESS; +} + +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; +} + +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; +} + +void nrf_drv_rtc_disable(nrf_drv_rtc_t const * const p_instance) +{ + ASSERT(m_cb[p_instance->instance_id].state == NRF_DRV_STATE_POWERED_ON); + + nrf_rtc_task_trigger(p_instance->p_reg, NRF_RTC_TASK_STOP); + m_cb[p_instance->instance_id].state = NRF_DRV_STATE_INITIALIZED; +} + +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(channelp_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); + return NRF_ERROR_TIMEOUT; + } + } + return NRF_SUCCESS; +} + +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(channelp_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) + { + return NRF_ERROR_TIMEOUT; + } + } + 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); + + return NRF_SUCCESS; +} + +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); + } +} + +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); +} + +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) +{ + ASSERT(m_cb[p_instance->instance_id].reliable); + 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 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 < RTC_CHANNEL_NUM; 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); + 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); + 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); + m_handlers[instance_id](NRF_DRV_RTC_INT_OVERFLOW); + } +} + +#if (RTC0_ENABLED == 1) +void RTC0_IRQHandler(void) +{ + nrf_drv_rtc_int_handler(NRF_RTC0,RTC0_INSTANCE_INDEX); +} +#endif + +#if (RTC1_ENABLED == 1) +void RTC1_IRQHandler(void) +{ + nrf_drv_rtc_int_handler(NRF_RTC1,RTC1_INSTANCE_INDEX); +} +#endif diff --git a/components/drivers_nrf/rtc/nrf_drv_rtc.h b/components/drivers_nrf/rtc/nrf_drv_rtc.h new file mode 100644 index 0000000..6b5d003 --- /dev/null +++ b/components/drivers_nrf/rtc/nrf_drv_rtc.h @@ -0,0 +1,323 @@ +/* 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 NRF_DRV_RTC_H +#define NRF_DRV_RTC_H + + +#include "nordic_common.h" +#include "nrf_drv_config.h" +#include "nrf_drv_common.h" +#include "nrf_rtc.h" +#include "sdk_errors.h" + +/** + * @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. */ +} nrf_drv_rtc_t; + +/**@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) \ +} + +/**@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(id) \ +{ \ + .prescaler = (uint16_t)(RTC_INPUT_FREQ / CONCAT_3(RTC, id, _CONFIG_FREQUENCY))-1, \ + .interrupt_priority = CONCAT_3(RTC, id, _CONFIG_IRQ_PRIORITY), \ + .reliable = CONCAT_3(RTC, id, _CONFIG_RELIABLE), \ + .tick_latency = RTC_US_TO_TICKS(NRF_MAXIMUM_LATENCY_US, CONCAT_3(RTC, id, _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 instance. + * @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 instance. + */ +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 instance. + */ +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 instance. + */ +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 instance. + * @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 instance. + * @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 instance. + * @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 instance. + */ +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 instance. + * @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 instance. + */ +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 instance. + * + * @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 instance. + * @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 instance. + * @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 instance. + * + * @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 instance. + */ +__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 instance. + * @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 */ + +/** + *@} + **/ +#endif /* NRF_DRV_RTC_H */ diff --git a/components/drivers_nrf/sdio/config/sdio_config.h b/components/drivers_nrf/sdio/config/sdio_config.h new file mode 100644 index 0000000..c3f1efb --- /dev/null +++ b/components/drivers_nrf/sdio/config/sdio_config.h @@ -0,0 +1,18 @@ +/* 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. + * + */ +#ifndef SDIO_CONFIG_H +#define SDIO_CONFIG_H + +#define SDIO_CONFIG_CLOCK_PIN_NUMBER 24 +#define SDIO_CONFIG_DATA_PIN_NUMBER 25 + +#endif diff --git a/components/drivers_nrf/sdio/sdio.c b/components/drivers_nrf/sdio/sdio.c new file mode 100644 index 0000000..cb88160 --- /dev/null +++ b/components/drivers_nrf/sdio/sdio.c @@ -0,0 +1,217 @@ +/* Copyright (c) 2009 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.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/components/drivers_nrf/sdio/sdio.h b/components/drivers_nrf/sdio/sdio.h new file mode 100644 index 0000000..5e6a9a7 --- /dev/null +++ b/components/drivers_nrf/sdio/sdio.h @@ -0,0 +1,69 @@ + /* Copyright (c) 2009 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 SDIO_H +#define SDIO_H + +/*lint ++flb "Enter library region" */ + +#include +#include + +/** @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" */ +#endif diff --git a/components/drivers_nrf/spi_master/nrf_drv_spi.c b/components/drivers_nrf/spi_master/nrf_drv_spi.c new file mode 100644 index 0000000..e2f5ca5 --- /dev/null +++ b/components/drivers_nrf/spi_master/nrf_drv_spi.c @@ -0,0 +1,506 @@ +/* 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 "nrf_drv_spi.h" +#include "nrf_drv_common.h" +#include "nrf_gpio.h" +#include "nrf_assert.h" +#include "app_util_platform.h" + +// This set of macros makes it possible to exclude parts of code when one type +// of supported peripherals is not used. +#if ((SPI0_ENABLED == 1 && SPI0_USE_EASY_DMA == 1 && defined(NRF52)) || \ + (SPI1_ENABLED == 1 && SPI1_USE_EASY_DMA == 1) || \ + (SPI2_ENABLED == 1 && SPI2_USE_EASY_DMA == 1)) + #define SPIM_IN_USE +#endif +#if ((SPI0_ENABLED == 1 && SPI0_USE_EASY_DMA == 0) || \ + (SPI0_ENABLED == 1 && defined(NRF51)) || \ + (SPI1_ENABLED == 1 && SPI1_USE_EASY_DMA == 0) || \ + (SPI2_ENABLED == 1 && SPI2_USE_EASY_DMA == 0)) + #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 + + +// Control block - driver instance local data. +typedef struct +{ + nrf_drv_spi_handler_t handler; + 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 tx_buffer_length; + uint8_t rx_buffer_length; + uint8_t bytes_transferred; + uint8_t const * p_tx_buffer; + uint8_t * p_rx_buffer; + + bool tx_done : 1; + bool rx_done : 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 == 1) + NRF_DRV_SPI_DEFAULT_CONFIG(0), +#endif +#if (SPI1_ENABLED == 1) + NRF_DRV_SPI_DEFAULT_CONFIG(1), +#endif +#if (SPI2_ENABLED == 1) + NRF_DRV_SPI_DEFAULT_CONFIG(2), +#endif +}; + + +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 (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 = 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, + NRF_SPIM_INT_ENDTX_MASK | NRF_SPIM_INT_ENDRX_MASK | + NRF_SPIM_INT_STOPPED_MASK); + } + + nrf_spim_enable(p_spim); + ) + CODE_FOR_SPI + ( + 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); + 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 = p_instance->p_registers; + if (p_cb->handler) + { + nrf_spim_int_disable(p_spim, DISABLE_ALL); + } + nrf_spim_disable(p_spim); + ) + CODE_FOR_SPI + ( + NRF_SPI_Type * p_spi = p_instance->p_registers; + if (p_cb->handler) + { + nrf_spi_int_disable(p_spi, DISABLE_ALL); + } + nrf_spi_disable(p_spi); + ) + #undef DISABLE_ALL + + p_cb->state = NRF_DRV_STATE_UNINITIALIZED; +} + +#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->rx_buffer_length) + { + p_cb->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 (bytes_used < p_cb->tx_buffer_length) + { + nrf_spi_txd_set(p_spi, p_cb->p_tx_buffer[bytes_used]); + return true; + } + else if (bytes_used < p_cb->rx_buffer_length) + { + nrf_spi_txd_set(p_spi, p_cb->orc); + return true; + } + + return (p_cb->bytes_transferred < p_cb->tx_buffer_length || + p_cb->bytes_transferred < p_cb->rx_buffer_length); +} +#endif // SPI_IN_USE + +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) +{ + spi_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; + ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED); + ASSERT(p_tx_buffer != NULL || tx_buffer_length == 0); + ASSERT(p_rx_buffer != NULL || rx_buffer_length == 0); + + if (p_cb->transfer_in_progress) + { + return NRF_ERROR_BUSY; + } + + // Finish zero-length transfers immediately. + if (tx_buffer_length == 0 && rx_buffer_length == 0) + { + return NRF_SUCCESS; + } + + // Activate Slave Select signal, if it is to be used. + if (p_cb->ss_pin != NRF_DRV_SPI_PIN_NOT_USED) + { + nrf_gpio_pin_clear(p_cb->ss_pin); + } + + CODE_FOR_SPIM + ( + // 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; + } + + NRF_SPIM_Type * p_spim = p_instance->p_registers; + + nrf_spim_tx_buffer_set(p_spim, p_tx_buffer, tx_buffer_length); + nrf_spim_rx_buffer_set(p_spim, p_rx_buffer, rx_buffer_length); + + nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_ENDTX); + nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_ENDRX); + p_cb->tx_done = false; + p_cb->rx_done = false; + + if (p_cb->handler) + { + p_cb->transfer_in_progress = true; + } + + nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_STOPPED); + nrf_spim_task_trigger(p_spim, NRF_SPIM_TASK_START); + + if (!p_cb->handler) + { + while (!nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_ENDTX) || + !nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_ENDRX)) {} + + // 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); + } + } + ) + CODE_FOR_SPI + ( + NRF_SPI_Type * p_spi = p_instance->p_registers; + + p_cb->p_tx_buffer = p_tx_buffer; + p_cb->tx_buffer_length = tx_buffer_length; + p_cb->p_rx_buffer = p_rx_buffer; + p_cb->rx_buffer_length = rx_buffer_length; + p_cb->bytes_transferred = 0; + + + + if (p_cb->handler) + { + p_cb->transfer_in_progress = true; + nrf_spi_int_disable(p_spi, NRF_SPI_INT_READY_MASK); + } + 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, + (tx_buffer_length > 0 ? 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 (tx_buffer_length > 1) + { + nrf_spi_txd_set(p_spi, p_tx_buffer[1]); + } + else if (rx_buffer_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); + } + } + ) + + return NRF_SUCCESS; +} + +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->handler(NRF_DRV_SPI_EVENT_DONE); +} + +#ifdef SPIM_IN_USE +static void irq_handler_spim(NRF_SPIM_Type * p_spim, spi_control_block_t * p_cb) +{ + ASSERT(p_cb->handler); + + 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); + } + } +} +#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 == 1) +void SPI0_IRQ_HANDLER(void) +{ + #if (SPI0_USE_EASY_DMA == 1) && defined(NRF52) + irq_handler_spim(NRF_SPIM0, + #else + irq_handler_spi(NRF_SPI0, + #endif + &m_cb[SPI0_INSTANCE_INDEX]); +} +#endif // (SPI0_ENABLED == 1) + +#if (SPI1_ENABLED == 1) +void SPI1_IRQ_HANDLER(void) +{ + #if (SPI1_USE_EASY_DMA == 1) + irq_handler_spim(NRF_SPIM1, + #else + irq_handler_spi(NRF_SPI1, + #endif + &m_cb[SPI1_INSTANCE_INDEX]); +} +#endif // (SPI1_ENABLED == 1) + +#if (SPI2_ENABLED == 1) +void SPI2_IRQ_HANDLER(void) +{ + #if (SPI2_USE_EASY_DMA == 1) + irq_handler_spim(NRF_SPIM2, + #else + irq_handler_spi(NRF_SPI2, + #endif + &m_cb[SPI2_INSTANCE_INDEX]); +} +#endif // (SPI2_ENABLED == 1) diff --git a/components/drivers_nrf/spi_master/nrf_drv_spi.h b/components/drivers_nrf/spi_master/nrf_drv_spi.h new file mode 100644 index 0000000..677f2cc --- /dev/null +++ b/components/drivers_nrf/spi_master/nrf_drv_spi.h @@ -0,0 +1,234 @@ +/* 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_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 @ref NRF_DRV_SPI_PIN_NOT_USED + * if this signal is not needed. */ + uint8_t miso_pin; ///< MISO pin number (optional). + /**< Set @ref NRF_DRV_SPI_PIN_NOT_USED + * if this signal is not needed. */ + uint8_t ss_pin; ///< Slave Select pin number (optional). + /**< Set @ref NRF_DRV_SPI_PIN_NOT_USED + * if this signal is not needed. */ + 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, \ +} + +/** + * @brief SPI master driver events, passed to the handler routine provided + * during initialization. + */ +typedef enum +{ + NRF_DRV_SPI_EVENT_DONE, ///< Transfer done. +} nrf_drv_spi_event_t; + +/** + * @brief SPI master driver event handler type. + */ +typedef void (*nrf_drv_spi_handler_t)(nrf_drv_spi_event_t 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. + */ +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); + +#endif // NRF_DRV_SPI_H__ + +/** @} */ diff --git a/components/drivers_nrf/spi_master/spi_5W_master.c b/components/drivers_nrf/spi_master/spi_5W_master.c new file mode 100644 index 0000000..3913c1b --- /dev/null +++ b/components/drivers_nrf/spi_master/spi_5W_master.c @@ -0,0 +1,604 @@ +/* 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. + * + */ + +/**@file + * + * @defgroup ser_phy_spi_5W_hw_driver_master spi_5W_master.c + * @{ + * @ingroup ser_phy_spi_5W_hw_driver_master + * + * @brief SPI_5W_RAW hardware driver. + */ + +#include "app_error.h" +#include "app_util_platform.h" +#include "nrf_gpio.h" +#include "nrf.h" +#include "spi_5W_master.h" +#include "ser_config_5W_app.h" +#include "ser_phy_debug_app.h" + + +#define _static + +#define DOUBLE_BUFFERED /**< A flag for enabling double buffering. */ + +#define SPI_PIN_DISCONNECTED 0xFFFFFFFF /**< A value used to the PIN deinitialization. */ +#define SPI_DEFAULT_TX_BYTE 0x00 /**< Default byte (used to clock transmission + from slave to the master) */ + +typedef struct +{ + NRF_SPI_Type * p_nrf_spi; /**< A pointer to the NRF SPI master */ + IRQn_Type irq_type; /**< A type of NVIC IRQn */ + + uint8_t * p_tx_buffer; /**< A pointer to TX buffer. */ + uint16_t tx_length; /**< A length of TX buffer. */ + uint16_t tx_index; /**< A index of the current element in the TX buffer. */ + + uint8_t * p_rx_buffer; /**< A pointer to RX buffer. */ + uint16_t rx_length; /**< A length RX buffer. */ + uint16_t rx_index; /**< A index of the current element in the RX buffer. */ + + uint16_t max_length; /**< Max length (Max of the TX and RX length). */ + uint16_t bytes_count; + uint8_t pin_slave_select; /**< A pin for Slave Select. */ + + spi_master_event_handler_t callback_event_handler; /**< A handler for event callback function. */ + spi_master_state_t state; /**< A state of an instance of SPI master. */ + bool start_flag; + bool abort_flag; + +} spi_master_instance_t; + +#ifdef _SPI_5W_ +typedef enum +{ + HOOK_STATE_DISABLED, + HOOK_STATE_IDLE, + HOOK_STATE_GUARDED, + HOOK_STATE_ABORTED, + HOOK_STATE_RESTARTED, + HOOK_STATE_PASSING +} spi_hook_state_t; + + +_static spi_master_event_handler_t m_ser_phy_event_handler; +_static spi_master_hw_instance_t m_spi_master_hw_instance; +_static spi_hook_state_t m_hook_state = HOOK_STATE_DISABLED; +#endif + +#ifdef SER_PHY_DEBUG_APP_ENABLE +_static spi_master_raw_callback_t m_debug_callback; +#endif + +_static spi_master_instance_t m_spi_master_instances[SPI_MASTER_HW_ENABLED_COUNT]; + +static __INLINE spi_master_instance_t * spi_master_get_instance( + const spi_master_hw_instance_t spi_master_hw_instance); +static __INLINE void spi_master_send_recv_irq(spi_master_instance_t * const p_spi_instance); +static __INLINE void spi_master_signal_evt(spi_master_instance_t * const p_spi_instance, + spi_master_evt_type_t event_type, + const uint16_t data); + +#ifdef SPI_MASTER_0_ENABLE +/** + * @brief SPI0 interrupt handler. + */ +void SPI0_TWI0_IRQHandler(void) +{ + if (NRF_SPI0->EVENTS_READY != 0) + { + NRF_SPI0->EVENTS_READY = 0; + + spi_master_instance_t * p_spi_instance = spi_master_get_instance(SPI_MASTER_0); + + spi_master_send_recv_irq(p_spi_instance); + } +} +#endif //SPI_MASTER_0_ENABLE + +#ifdef SPI_MASTER_1_ENABLE +/** + * @brief SPI0 interrupt handler. + */ +void SPI1_TWI1_IRQHandler(void) +{ + if (NRF_SPI1->EVENTS_READY != 0) + { + NRF_SPI1->EVENTS_READY = 0; + + spi_master_instance_t * p_spi_instance = spi_master_get_instance(SPI_MASTER_1); + + spi_master_send_recv_irq(p_spi_instance); + } +} +#endif //SPI_MASTER_1_ENABLE + +#if defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE) + +/**@brief Function for getting an instance of SPI master. */ +static __INLINE spi_master_instance_t * spi_master_get_instance( + const spi_master_hw_instance_t spi_master_hw_instance) +{ + return &(m_spi_master_instances[(uint8_t)spi_master_hw_instance]); +} + +/** @brief Function for initializing instance of SPI master by default values. */ +static __INLINE void spi_master_init_hw_instance(NRF_SPI_Type * p_nrf_spi, + IRQn_Type irq_type, + spi_master_instance_t * p_spi_instance) +{ + APP_ERROR_CHECK_BOOL(p_spi_instance != NULL); + + p_spi_instance->p_nrf_spi = p_nrf_spi; + p_spi_instance->irq_type = irq_type; + + p_spi_instance->p_tx_buffer = NULL; + p_spi_instance->tx_length = 0; + p_spi_instance->tx_index = 0; + + p_spi_instance->p_rx_buffer = NULL; + p_spi_instance->rx_length = 0; + p_spi_instance->rx_index = 0; + + p_spi_instance->bytes_count = 0; + p_spi_instance->max_length = 0; + p_spi_instance->pin_slave_select = 0; + + p_spi_instance->callback_event_handler = NULL; + + p_spi_instance->state = SPI_MASTER_STATE_DISABLED; + p_spi_instance->abort_flag = false; + p_spi_instance->start_flag = false; +} + +/**@brief Function for initializing TX or RX buffer. */ +static __INLINE void spi_master_buffer_init(uint8_t * const p_buf, + const uint16_t buf_len, + uint8_t * * pp_buf, + uint16_t * const p_buf_len, + uint16_t * const p_index) +{ + APP_ERROR_CHECK_BOOL(pp_buf != NULL); + APP_ERROR_CHECK_BOOL(p_buf_len != NULL); + APP_ERROR_CHECK_BOOL(p_index != NULL); + + *pp_buf = p_buf; + *p_buf_len = (p_buf != NULL) ? buf_len : 0; + *p_index = 0; +} + +/**@brief Function for releasing TX or RX buffer. */ +static __INLINE void spi_master_buffer_release(uint8_t * * const pp_buf, uint16_t * const p_buf_len) +{ + APP_ERROR_CHECK_BOOL(pp_buf != NULL); + APP_ERROR_CHECK_BOOL(p_buf_len != NULL); + + *pp_buf = NULL; + *p_buf_len = 0; +} + +/**@brief Function for sending events by callback. */ +static __INLINE void spi_master_signal_evt(spi_master_instance_t * const p_spi_instance, + spi_master_evt_type_t event_type, + const uint16_t data) +{ + APP_ERROR_CHECK_BOOL(p_spi_instance != NULL); + + if (p_spi_instance->callback_event_handler != NULL) + { + spi_master_evt_t event = {SPI_MASTER_EVT_TYPE_MAX, 0}; + event.type = event_type; + event.data = data; + p_spi_instance->callback_event_handler(event); + } +} + +/**@brief Function insert to a TX buffer another byte or two bytes (depends on flag @ref DOUBLE_BUFFERED). */ +static __INLINE void spi_master_send_initial_bytes(spi_master_instance_t * const p_spi_instance) +{ + APP_ERROR_CHECK_BOOL(p_spi_instance != NULL); + + p_spi_instance->p_nrf_spi->TXD = ((p_spi_instance->p_tx_buffer != NULL) && + (p_spi_instance->tx_index < p_spi_instance->tx_length)) ? + p_spi_instance->p_tx_buffer[p_spi_instance->tx_index] : + SPI_DEFAULT_TX_BYTE; + (p_spi_instance->tx_index)++; + + #ifdef DOUBLE_BUFFERED + + if (p_spi_instance->tx_index < p_spi_instance->max_length) + { + p_spi_instance->p_nrf_spi->TXD = ((p_spi_instance->p_tx_buffer != NULL) && + (p_spi_instance->tx_index < p_spi_instance->tx_length)) ? + p_spi_instance->p_tx_buffer[p_spi_instance->tx_index] : + SPI_DEFAULT_TX_BYTE; + (p_spi_instance->tx_index)++; + } + #endif +} + +/**@brief Function for receiving and sending data from IRQ. (The same for both IRQs). */ +static __INLINE void spi_master_send_recv_irq(spi_master_instance_t * const p_spi_instance) +{ + + uint8_t rx_byte; + + APP_ERROR_CHECK_BOOL(p_spi_instance != NULL); + APP_ERROR_CHECK_BOOL(p_spi_instance->state == SPI_MASTER_STATE_BUSY); + + p_spi_instance->bytes_count++; + rx_byte = p_spi_instance->p_nrf_spi->RXD; + + if (p_spi_instance->start_flag) + { + p_spi_instance->start_flag = false; + spi_master_signal_evt(p_spi_instance, SPI_MASTER_EVT_FIRST_BYTE_RECEIVED, (uint16_t)rx_byte); + } + else if (p_spi_instance->abort_flag ) //this is tricky, but callback for SPI_MASTER_EVT_FIRST_BYTE_RECEIVED will set this flag for a first byte, which is bad because there is still byte in a buffer + { //and for a single byte transaction you will get XFERDONE event to restart + p_spi_instance->abort_flag = false; + p_spi_instance->state = SPI_MASTER_STATE_ABORTED; + nrf_gpio_pin_set(p_spi_instance->pin_slave_select); + spi_master_signal_evt(p_spi_instance, SPI_MASTER_EVT_TRANSFER_ABORTED, 0); + return; + } + + if ((p_spi_instance->p_rx_buffer != NULL) && + (p_spi_instance->rx_index < p_spi_instance->rx_length)) + { + p_spi_instance->p_rx_buffer[p_spi_instance->rx_index++] = rx_byte; + } + + if ((p_spi_instance->tx_index < p_spi_instance->max_length) && (!(p_spi_instance->abort_flag))) //do not TX if you know that there is an abort to be done - this should work for a DOUBLE BUFFERING ??? + { + p_spi_instance->p_nrf_spi->TXD = ((p_spi_instance->p_tx_buffer != NULL) && + (p_spi_instance->tx_index < p_spi_instance->tx_length)) ? + p_spi_instance->p_tx_buffer[p_spi_instance->tx_index] : + SPI_DEFAULT_TX_BYTE; + (p_spi_instance->tx_index)++; + } + + if (p_spi_instance->bytes_count >= p_spi_instance->max_length) + { + APP_ERROR_CHECK_BOOL(p_spi_instance->bytes_count == p_spi_instance->max_length); + nrf_gpio_pin_set(p_spi_instance->pin_slave_select); + p_spi_instance->state = SPI_MASTER_STATE_IDLE; + spi_master_signal_evt(p_spi_instance, + SPI_MASTER_EVT_TRANSFER_COMPLETED, + p_spi_instance->tx_index); + } + return; +} +#endif //defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE) + + +/** + * @brief Function for opening and initializing a SPI master driver. */ +uint32_t spi_master_open(const spi_master_hw_instance_t spi_master_hw_instance, + spi_master_config_t const * const p_spi_master_config) +{ + #if defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE) + + + if (p_spi_master_config == NULL) + { + return NRF_ERROR_NULL; + } + + spi_master_instance_t * p_spi_instance = spi_master_get_instance(spi_master_hw_instance); + + switch (spi_master_hw_instance) + { + #ifdef SPI_MASTER_0_ENABLE + case SPI_MASTER_0: + spi_master_init_hw_instance(NRF_SPI0, SPI0_TWI0_IRQn, p_spi_instance); + break; + #endif //SPI_MASTER_0_ENABLE + + #ifdef SPI_MASTER_1_ENABLE + case SPI_MASTER_1: + spi_master_init_hw_instance(NRF_SPI1, SPI1_TWI1_IRQn, p_spi_instance); + break; + #endif //SPI_MASTER_1_ENABLE + + default: + break; + } + + //A Slave select must be set as high before setting it as output, + //because during connect it to the pin it causes glitches. + nrf_gpio_pin_set(p_spi_master_config->SPI_Pin_SS); + nrf_gpio_cfg_output(p_spi_master_config->SPI_Pin_SS); + nrf_gpio_pin_set(p_spi_master_config->SPI_Pin_SS); + + //Configure GPIO + nrf_gpio_cfg_output(p_spi_master_config->SPI_Pin_SCK); + nrf_gpio_cfg_output(p_spi_master_config->SPI_Pin_MOSI); + nrf_gpio_cfg_input(p_spi_master_config->SPI_Pin_MISO, NRF_GPIO_PIN_NOPULL); + p_spi_instance->pin_slave_select = p_spi_master_config->SPI_Pin_SS; + + /* Configure SPI hardware */ + p_spi_instance->p_nrf_spi->PSELSCK = p_spi_master_config->SPI_Pin_SCK; + p_spi_instance->p_nrf_spi->PSELMOSI = p_spi_master_config->SPI_Pin_MOSI; + p_spi_instance->p_nrf_spi->PSELMISO = p_spi_master_config->SPI_Pin_MISO; + + p_spi_instance->p_nrf_spi->FREQUENCY = p_spi_master_config->SPI_Freq; + + p_spi_instance->p_nrf_spi->CONFIG = + (uint32_t)(p_spi_master_config->SPI_CPHA << SPI_CONFIG_CPHA_Pos) | + (p_spi_master_config->SPI_CPOL << SPI_CONFIG_CPOL_Pos) | + (p_spi_master_config->SPI_ORDER << SPI_CONFIG_ORDER_Pos); + + + /* Clear waiting interrupts and events */ + p_spi_instance->p_nrf_spi->EVENTS_READY = 0; + + NVIC_ClearPendingIRQ(p_spi_instance->irq_type); + NVIC_SetPriority(p_spi_instance->irq_type, APP_IRQ_PRIORITY_MID); + + /* Clear event handler */ + p_spi_instance->callback_event_handler = NULL; + + /* Enable interrupt */ + p_spi_instance->p_nrf_spi->INTENSET = (SPI_INTENSET_READY_Set << SPI_INTENCLR_READY_Pos); + NVIC_EnableIRQ(p_spi_instance->irq_type); + + /* Enable SPI hardware */ + p_spi_instance->p_nrf_spi->ENABLE = (SPI_ENABLE_ENABLE_Enabled << SPI_ENABLE_ENABLE_Pos); + + /* Change state to IDLE */ + p_spi_instance->state = SPI_MASTER_STATE_IDLE; + + return NRF_SUCCESS; + #else + return NRF_ERROR_NOT_SUPPORTED; + #endif +} + +/** + * @brief Function for closing a SPI master driver. + */ +void spi_master_close(const spi_master_hw_instance_t spi_master_hw_instance) +{ + #if defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE) + spi_master_instance_t * p_spi_instance = spi_master_get_instance(spi_master_hw_instance); + + /* Disable interrupt */ + NVIC_ClearPendingIRQ(p_spi_instance->irq_type); + NVIC_DisableIRQ(p_spi_instance->irq_type); + + p_spi_instance->p_nrf_spi->ENABLE = (SPI_ENABLE_ENABLE_Disabled << SPI_ENABLE_ENABLE_Pos); + + /* Set Slave Select pin as input with pull-up. */ + nrf_gpio_pin_set(p_spi_instance->pin_slave_select); + nrf_gpio_cfg_input(p_spi_instance->pin_slave_select, NRF_GPIO_PIN_PULLUP); + p_spi_instance->pin_slave_select = (uint8_t)0xFF; + + /* Disconnect pins from SPI hardware */ + p_spi_instance->p_nrf_spi->PSELSCK = (uint32_t)SPI_PIN_DISCONNECTED; + p_spi_instance->p_nrf_spi->PSELMOSI = (uint32_t)SPI_PIN_DISCONNECTED; + p_spi_instance->p_nrf_spi->PSELMISO = (uint32_t)SPI_PIN_DISCONNECTED; + + /* Reset to default values */ + spi_master_init_hw_instance(NULL, (IRQn_Type)0, p_spi_instance); + #else + return; + #endif +} + +/** + * @brief Function for getting current state of the SPI master driver. + */ +__INLINE spi_master_state_t spi_master_get_state( + const spi_master_hw_instance_t spi_master_hw_instance) +{ + #if defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE) + spi_master_instance_t * spi_instance = spi_master_get_instance(spi_master_hw_instance); + return spi_instance->state; + #else + return SPI_MASTER_STATE_DISABLED; + #endif +} + +/** + * @brief Function for event handler registration. + */ +__INLINE void spi_master_evt_handler_reg(const spi_master_hw_instance_t spi_master_hw_instance, + spi_master_event_handler_t event_handler) +{ + #if defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE) + spi_master_instance_t * spi_instance = spi_master_get_instance(spi_master_hw_instance); + spi_instance->callback_event_handler = event_handler; + #else + return; + #endif +} + +/** + * @brief Function for transmitting data between SPI master and SPI slave. + */ +uint32_t spi_master_send_recv(const spi_master_hw_instance_t spi_master_hw_instance, + uint8_t * const p_tx_buf, const uint16_t tx_buf_len, + uint8_t * const p_rx_buf, const uint16_t rx_buf_len) +{ + #if defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE) + spi_master_instance_t * p_spi_instance = spi_master_get_instance(spi_master_hw_instance); + + uint32_t err_code = NRF_SUCCESS; + uint16_t max_length = 0; + + if (p_spi_instance->state == SPI_MASTER_STATE_IDLE) + { + NVIC_DisableIRQ(p_spi_instance->irq_type); + + max_length = (rx_buf_len > tx_buf_len) ? rx_buf_len : tx_buf_len; + + if (max_length > 0) + { + p_spi_instance->state = SPI_MASTER_STATE_BUSY; + p_spi_instance->start_flag = true; //abort_flag should set by abort and cleared only by restart + p_spi_instance->bytes_count = 0; + p_spi_instance->max_length = max_length; + spi_master_buffer_release(&(p_spi_instance->p_tx_buffer), &(p_spi_instance->tx_length)); + spi_master_buffer_release(&(p_spi_instance->p_rx_buffer), &(p_spi_instance->rx_length)); + /* Initialize buffers */ + spi_master_buffer_init(p_tx_buf, tx_buf_len, &(p_spi_instance->p_tx_buffer), + &(p_spi_instance->tx_length), &(p_spi_instance->tx_index)); + spi_master_buffer_init(p_rx_buf, rx_buf_len, &(p_spi_instance->p_rx_buffer), + &(p_spi_instance->rx_length), &(p_spi_instance->rx_index)); + nrf_gpio_pin_clear(p_spi_instance->pin_slave_select); + spi_master_send_initial_bytes(p_spi_instance); + spi_master_signal_evt(p_spi_instance, SPI_MASTER_EVT_TRANSFER_STARTED, max_length); + } + else + { + err_code = NRF_ERROR_INVALID_PARAM; + } + + NVIC_EnableIRQ(p_spi_instance->irq_type); + } + else + { + err_code = NRF_ERROR_BUSY; + } + + return err_code; + #else + return NRF_ERROR_NOT_SUPPORTED; + #endif +} + +#ifdef _SPI_5W_ + +/** + * @brief Function for aborting transfer + */ +uint32_t spi_master_abort(const spi_master_hw_instance_t spi_master_hw_instance) +{ + spi_master_instance_t * p_spi_instance = spi_master_get_instance(spi_master_hw_instance); + + NVIC_DisableIRQ(p_spi_instance->irq_type); + + if (p_spi_instance->state == SPI_MASTER_STATE_BUSY) + { + //set_flag - but only when there are events pending + //ignore when in IDLE - must be able to restart a completed transfer + p_spi_instance->abort_flag = true; + } + NVIC_EnableIRQ(p_spi_instance->irq_type); + return NRF_SUCCESS; +} + +/** + * @brief Function for restarting transfer + */ +uint32_t spi_master_restart(const spi_master_hw_instance_t spi_master_hw_instance) +{ + spi_master_instance_t * p_spi_instance = spi_master_get_instance(spi_master_hw_instance); + + NVIC_DisableIRQ(p_spi_instance->irq_type); + spi_master_signal_evt(p_spi_instance, SPI_MASTER_EVT_TRANSFER_RESTARTED, 0); + p_spi_instance->state = SPI_MASTER_STATE_BUSY; + p_spi_instance->bytes_count = 0; + p_spi_instance->tx_index = 0; + p_spi_instance->rx_index = 0; + p_spi_instance->start_flag = true; + p_spi_instance->abort_flag = false; //you should force clearing abort flag - no other way for 1 byte transfer + nrf_gpio_pin_clear(p_spi_instance->pin_slave_select); + spi_master_send_initial_bytes(p_spi_instance); + NVIC_EnableIRQ(p_spi_instance->irq_type); + + return NRF_SUCCESS; +} + +static void spi_5W_master_event_handler(spi_master_evt_t evt) +{ + + switch (m_hook_state) + { + case HOOK_STATE_IDLE: + + if (evt.type == SPI_MASTER_EVT_TRANSFER_STARTED) + { + DEBUG_EVT_SPI_MASTER_RAW_XFER_GUARDED(0); + m_hook_state = HOOK_STATE_GUARDED; + m_ser_phy_event_handler(evt); + } + break; + + case HOOK_STATE_GUARDED: + + if (evt.type == SPI_MASTER_EVT_FIRST_BYTE_RECEIVED) + { + if (evt.data == 0) + { + DEBUG_EVT_SPI_MASTER_RAW_XFER_PASSED(0); + m_hook_state = HOOK_STATE_PASSING; + } + else + { + DEBUG_EVT_SPI_MASTER_RAW_XFER_ABORTED(0); + m_hook_state = HOOK_STATE_ABORTED; + (void)spi_master_abort(m_spi_master_hw_instance); + } + } + break; + + case HOOK_STATE_ABORTED: + + if ((evt.type == SPI_MASTER_EVT_TRANSFER_ABORTED) || + (evt.type == SPI_MASTER_EVT_TRANSFER_COMPLETED)) + { + DEBUG_EVT_SPI_MASTER_RAW_XFER_RESTARTED(0); + m_hook_state = HOOK_STATE_RESTARTED; + (void)spi_master_restart(m_spi_master_hw_instance); + } + break; + + case HOOK_STATE_RESTARTED: + + if (evt.type == SPI_MASTER_EVT_TRANSFER_RESTARTED) + { + DEBUG_EVT_SPI_MASTER_RAW_XFER_GUARDED(0); + m_hook_state = HOOK_STATE_GUARDED; + } + break; + + case HOOK_STATE_PASSING: + + if (evt.type == SPI_MASTER_EVT_TRANSFER_COMPLETED) + { + m_hook_state = HOOK_STATE_IDLE; + m_ser_phy_event_handler(evt); //this is the only way to get a signal from complete transaction + } + break; + + default: + break; + } +} + +void spi_5W_master_evt_handler_reg(const spi_master_hw_instance_t spi_master_hw_instance, + spi_master_event_handler_t event_handler) +{ + m_ser_phy_event_handler = event_handler; + m_spi_master_hw_instance = spi_master_hw_instance; + m_hook_state = HOOK_STATE_IDLE; + spi_master_evt_handler_reg(spi_master_hw_instance, spi_5W_master_event_handler); + return; +} + +#endif + +/** @} */ diff --git a/components/drivers_nrf/spi_master/spi_5W_master.h b/components/drivers_nrf/spi_master/spi_5W_master.h new file mode 100644 index 0000000..940db8b --- /dev/null +++ b/components/drivers_nrf/spi_master/spi_5W_master.h @@ -0,0 +1,170 @@ +/* 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_SPI_MASTER_H +#define APP_SPI_MASTER_H + +#include +#include +#include "boards.h" + +#define _SPI_5W_ + +/**@brief Struct containing configuration parameters of the SPI master. */ +typedef struct +{ + uint32_t SPI_Freq; /**< SPI frequency. */ + uint32_t SPI_Pin_SCK; /**< SCK pin number. */ + uint32_t SPI_Pin_MISO; /**< MISO pin number. */ + uint32_t SPI_Pin_MOSI; /**< MOSI pin number .*/ + uint32_t SPI_Pin_SS; /**< Slave select pin number. */ + uint8_t SPI_ORDER; /**< Bytes order MSBFIRST or LSBFIRST. */ + uint8_t SPI_CPOL; /**< Serial clock polarity ACTIVEHIGH or ACTIVELOW. */ + uint8_t SPI_CPHA; /**< Serial clock phase LEADING or TRAILING. */ + } spi_master_config_t; + +/**@brief SPI master driver events types. */ +typedef enum +{ + SPI_MASTER_EVT_TRANSFER_STARTED = 0, /**< An event indicating that transfer has been started */ + SPI_MASTER_EVT_TRANSFER_COMPLETED, /**< An event indicating that transfer has been completed */ + SPI_MASTER_EVT_TRANSFER_ABORTED, /**< An event indicating that transfer has been aborted */ + SPI_MASTER_EVT_TRANSFER_RESTARTED, /**< An event indicating that transfer has been resumed */ + SPI_MASTER_EVT_FIRST_BYTE_RECEIVED, /**< An event indicating end of one byte transfer */ + SPI_MASTER_EVT_TYPE_MAX /**< Enumeration upper bound. */ +} spi_master_evt_type_t; + +/**@brief Struct containing parameters of the SPI MASTER event */ + typedef struct + { + spi_master_evt_type_t type; /**< Type of an event */ + uint16_t data; /**< event data - context dependent */ + } spi_master_evt_t; + + /**@brief SPI MASTER internal states types. */ + typedef enum + { + SPI_MASTER_STATE_DISABLED, /**< A state indicating that SPI master is disabled. */ + SPI_MASTER_STATE_BUSY, /**< A state indicating that SPI master is sending now. */ + SPI_MASTER_STATE_ABORTED, + SPI_MASTER_STATE_IDLE /**< A state indicating that SPI master is idle now. */ + } spi_master_state_t; + + /**@brief Instances of SPI master module. */ + typedef enum + { + #ifdef SPI_MASTER_0_ENABLE + SPI_MASTER_0, /**< A instance of SPI master 0. */ + #endif + + #ifdef SPI_MASTER_1_ENABLE + SPI_MASTER_1, /**< A instance of SPI master 1. */ + #endif + + SPI_MASTER_HW_ENABLED_COUNT /**< A number of enabled instances of SPI master. */ + } spi_master_hw_instance_t; + +/**@brief Type of generic callback function handler to be used by all SPI MASTER driver events. + * + * @param[in] spi_master_evt SPI MASTER driver event. + */ +typedef void (*spi_master_event_handler_t) (spi_master_evt_t spi_master_evt); + + +/**@brief Function for opening and initializing a SPI master driver. + * + * @note Function initializes SPI master hardware and internal module states, unregister events callback. + * + * @warning If the function has been already called, the function @ref spi_master_close has to be + * called before spi_master_open can be called again. + * + * @param[in] spi_master_hw_instance Instance of SPI master module. + * @param[in] p_spi_master_config Pointer to configuration structure which will be used + * to initialize SPI MASTER hardware. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_INVALID_STATE Operation failure. The function has been already called. + * To call it again the function @ref spi_master_close + * has to be called previously. + * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. + */ +uint32_t spi_master_open(const spi_master_hw_instance_t spi_master_hw_instance, + spi_master_config_t const * const p_spi_master_config); + + +/**@brief Function for closing a SPI MASTER driver. + * + * @note Function disable hardware, reset internal module states and unregister events callback + * function. + * + * @param[in] spi_master_hw_instance A instance of SPI master. + */ +void spi_master_close(const spi_master_hw_instance_t spi_master_hw_instance); + + +/**@brief Function for transferring data between SPI master and SPI slave + * + * @note Function registers buffers pointed by p_tx_buf and p_rx_buf parameters, after that starts transmission. + * Function generates an event of type @ref SPI_MASTER_EVT_TRANSFER_STARTED when transfer has been started + * and @ref SPI_MASTER_EVT_TRANSFER_COMPLETED when transfer has been completed. + * + * @param[in] spi_master_hw_instance Instance of SPI master module. + * @param[in] p_tx_buf Pointer to a transmit buffer. + * @param[in] tx_buf_len Number of octets to the transfer. + * @param[out] p_rx_buf Pointer to a receive buffer. + * @param[in] rx_buf_len Number of octets to be received. + * + * @retval NRF_SUCCESS Operation success. Packet was registered to the transmission + * and event will be send upon transmission completion. + * @retval NRF_ERROR_BUSY Operation failure. Transmitting of a data is in progress. + */ + uint32_t spi_master_send_recv(const spi_master_hw_instance_t spi_master_hw_instance, + uint8_t * const p_tx_buf, const uint16_t tx_buf_len, + uint8_t * const p_rx_buf, const uint16_t rx_buf_len); + + +/**@brief Function for registration event handler. +* +* @note Function registers a event handler to be used by SPI MASTER driver for sending events. +* @ref SPI_MASTER_EVT_TRANSFER_STARTED and @ref SPI_MASTER_EVT_TRANSFER_COMPLETED. +* +* @param[in] spi_master_hw_instance Instance of SPI master module. +* @param[in] event_handler Generic callback function handler to be used +* by all SPI master driver events. +*/ +void spi_master_evt_handler_reg(const spi_master_hw_instance_t spi_master_hw_instance, + spi_master_event_handler_t event_handler); + + +/**@brief Function for getting current state of the SPI master driver. + * + * @note Function gets current state of the SPI master driver. + * + * @param[in] spi_master_hw_instance Instance of SPI master module. + * + * @retval SPI_MASTER_STATE_DISABLED SPI MASTER is disabled. + * @retval SPI_MASTER_STATE_BUSY SPI_MASTER is sending now. + * @retval SPI_MASTER_STATE_IDLE SPI_MASTER is idle now. + */ +spi_master_state_t spi_master_get_state(const spi_master_hw_instance_t spi_master_hw_instance); + +#ifdef _SPI_5W_ + +uint32_t spi_master_abort(const spi_master_hw_instance_t spi_master_hw_instance); + +uint32_t spi_master_restart(const spi_master_hw_instance_t spi_master_hw_instance); + +void spi_5W_master_evt_handler_reg(const spi_master_hw_instance_t spi_master_hw_instance, + spi_master_event_handler_t event_handler); +#endif + +#endif diff --git a/components/drivers_nrf/spi_slave/nrf_drv_spis.c b/components/drivers_nrf/spi_slave/nrf_drv_spis.c new file mode 100644 index 0000000..098f210 --- /dev/null +++ b/components/drivers_nrf/spi_slave/nrf_drv_spis.c @@ -0,0 +1,354 @@ +/* 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 "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; + +#define SPIS_IRQHANDLER_TEMPLATE(NUM) void SPIS##NUM##_IRQ_HANDLER(void) \ + { \ + 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 == 1) + NRF_DRV_SPIS_DEFAULT_CONFIG(0), +#endif +#if (SPIS1_ENABLED == 1) + NRF_DRV_SPIS_DEFAULT_CONFIG(1), +#endif +#if (SPIS2_ENABLED == 1) + 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]; + + 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; + } + + NRF_SPIS_Type * p_spis = p_instance->p_reg; + + // 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); + + #define DISABLE_ALL 0xFFFFFFFF + nrf_spis_disable(p_instance->p_reg); + nrf_drv_common_irq_disable(p_instance->irq); + nrf_spis_int_disable(p_instance->p_reg, DISABLE_ALL); + #undef DISABLE_ALL + + 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; + + if ((p_tx_buffer == NULL) || (p_rx_buffer == NULL)) + { + return NRF_ERROR_NULL; + } + + // 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 == 1) + SPIS_IRQHANDLER_TEMPLATE(0) +#endif + +#if (SPIS1_ENABLED == 1) + SPIS_IRQHANDLER_TEMPLATE(1) +#endif + +#if (SPIS2_ENABLED == 1) + SPIS_IRQHANDLER_TEMPLATE(2) +#endif + +#endif // SPI_COUNT > 0 diff --git a/components/drivers_nrf/spi_slave/nrf_drv_spis.h b/components/drivers_nrf/spi_slave/nrf_drv_spis.h new file mode 100644 index 0000000..41088d0 --- /dev/null +++ b/components/drivers_nrf/spi_slave/nrf_drv_spis.h @@ -0,0 +1,219 @@ +/* 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 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. + * + * @defgroup lib_driver_spi_slave Software controlled SPI slave driver + * @{ + * @ingroup nrf_spis + * + * @brief Driver for the software controlled SPI slave. + */ + +#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" + +/** + * @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 + +#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. */ + +#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 + + +/** @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. + */ +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/components/drivers_nrf/swi/nrf_drv_swi.c b/components/drivers_nrf/swi/nrf_drv_swi.c new file mode 100644 index 0000000..687ed7c --- /dev/null +++ b/components/drivers_nrf/swi/nrf_drv_swi.c @@ -0,0 +1,326 @@ +/* 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 "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" + +STATIC_ASSERT(SWI_COUNT > 0); +STATIC_ASSERT(SWI_COUNT <= SWI_MAX); +STATIC_ASSERT(SWI_MAX_FLAGS <= sizeof(nrf_swi_flags_t) * 8); + +#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 + + +#if EGU_ENABLED > 0 + +/**@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 < NRF_EGU_CHANNEL_COUNT; ++i) + { + nrf_egu_event_t egu_event = nrf_egu_event_triggered_get(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) +{ + if (m_drv_state == NRF_DRV_STATE_UNINITIALIZED) + { + m_drv_state = NRF_DRV_STATE_INITIALIZED; + return NRF_SUCCESS; + } + return MODULE_ALREADY_INITIALIZED; +} + + +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 EGU_ENABLED > 0 + 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 EGU_ENABLED > 0 + 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) + { + break; + } + } + return err_code; +} + + +void nrf_drv_swi_trigger(nrf_swi_t swi, uint8_t flag_number) +{ + ASSERT(swi_is_allocated((uint32_t) swi)); +#if EGU_ENABLED > 0 + ASSERT(flag_number < NRF_EGU_CHANNEL_COUNT); + NRF_EGU_Type * NRF_EGUx = egu_instance_get(swi); + nrf_egu_task_trigger(NRF_EGUx, nrf_egu_task_trigger_get(flag_number)); +#else + ASSERT(flag_number < SWI_MAX_FLAGS); + m_swi_flags[swi - SWI_START_NUMBER] |= (1 << flag_number); + NVIC_SetPendingIRQ(nrf_drv_swi_irq_of(swi)); +#endif +} + + +#if EGU_ENABLED > 0 + +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/components/drivers_nrf/swi/nrf_drv_swi.h b/components/drivers_nrf/swi/nrf_drv_swi.h new file mode 100644 index 0000000..a83e8ff --- /dev/null +++ b/components/drivers_nrf/swi/nrf_drv_swi.h @@ -0,0 +1,167 @@ +/* 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 lib_driver_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 "nrf_drv_config.h" +#include "sdk_errors.h" + +#ifndef EGU_ENABLED + #define EGU_ENABLED 0 +#endif + +#if EGU_ENABLED > 0 +#include "nrf_egu.h" +#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 EGU_ENABLED > 0 +#define SWI_MAX NRF_EGU_COUNT +#else +#define SWI_MAX 6 +#endif + +/**@brief Number of flags per SWI (fixed number). */ +#if EGU_ENABLED > 0 +#define SWI_MAX_FLAGS NRF_EGU_CHANNEL_COUNT +#else +#define SWI_MAX_FLAGS 16 +#endif + +#ifndef SWI_COUNT +/** @brief Number of software interrupts available. + * + * This number can be set in the range from 1 to SWI_MAX. + */ +#define SWI_COUNT 4 +#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_LOW + + +/**@brief Function for initializing the SWI module. + * + * @retval NRF_SUCCESS If the module was successfully initialized. + * @retval 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 + +/**@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 // EGU_ENABLED > 0 + + +#endif // NRF_DRV_SWI_H__ + +/** @} */ diff --git a/components/drivers_nrf/timer/nrf_drv_timer.c b/components/drivers_nrf/timer/nrf_drv_timer.c new file mode 100644 index 0000000..888b1cd --- /dev/null +++ b/components/drivers_nrf/timer/nrf_drv_timer.c @@ -0,0 +1,361 @@ +/* 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 "nrf_drv_timer.h" +#include "nrf_assert.h" +#include "nrf_drv_common.h" +#include "app_util_platform.h" + +/**@brief Timer control block. */ +typedef struct +{ + nrf_drv_state_t state; +} nrf_drv_timer_cb_t; + +/**@brief Array for storing timers event handlers. */ +static nrf_timer_event_handler_t m_timer_event_handlers[TIMER_COUNT]; +static nrf_drv_timer_cb_t m_cb[TIMER_COUNT]; +static void* mp_contexts[TIMER_COUNT]; + +static const nrf_drv_timer_config_t m_default_config[] = { +#if (TIMER0_ENABLED == 1) + NRF_DRV_TIMER_DEFAULT_CONFIG(0), +#endif +#if (TIMER1_ENABLED == 1) + NRF_DRV_TIMER_DEFAULT_CONFIG(1), +#endif +#if (TIMER2_ENABLED == 1) + NRF_DRV_TIMER_DEFAULT_CONFIG(2) +#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) +{ + ASSERT((p_instance->instance_id) < TIMER_INSTANCE_NUMBER); + ASSERT(TIMER_IS_BIT_WIDTH_VALID(p_instance->instance_id, p_config->bit_width)); + + if (m_cb[p_instance->instance_id].state != NRF_DRV_STATE_UNINITIALIZED) + { + return NRF_ERROR_INVALID_STATE; // timer already initialized + } + + if (p_config == NULL) + { + p_config = &m_default_config[p_instance->instance_id]; + } + +#ifdef SOFTDEVICE_PRESENT + if (p_instance->p_reg == NRF_TIMER0) + { + return NRF_ERROR_INVALID_PARAM; + } +#endif + + nrf_drv_common_irq_enable(p_instance->irq, p_config->interrupt_priority); + + mp_contexts[p_instance->instance_id] = p_config->p_context; + + if (timer_event_handler != NULL) + { + m_timer_event_handlers[p_instance->instance_id] = timer_event_handler; + } + else + { + return NRF_ERROR_INVALID_PARAM; + } + + 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); + + m_cb[p_instance->instance_id].state = NRF_DRV_STATE_INITIALIZED; + + return NRF_SUCCESS; +} + +void nrf_drv_timer_uninit(nrf_drv_timer_t const * const p_instance) +{ + uint32_t i; + + nrf_drv_common_irq_disable(p_instance->irq); + + m_timer_event_handlers[p_instance->instance_id] = NULL; + + nrf_drv_timer_disable(p_instance); + + //lint -save -e655 + nrf_timer_shorts_disable(p_instance->p_reg, NRF_TIMER_SHORT_COMPARE0_STOP_MASK | + NRF_TIMER_SHORT_COMPARE1_STOP_MASK | + NRF_TIMER_SHORT_COMPARE2_STOP_MASK | + NRF_TIMER_SHORT_COMPARE3_STOP_MASK | + NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK | + NRF_TIMER_SHORT_COMPARE1_CLEAR_MASK | + NRF_TIMER_SHORT_COMPARE2_CLEAR_MASK | + NRF_TIMER_SHORT_COMPARE3_CLEAR_MASK); + //lint -restore + + for(i=0; ip_reg, NRF_TIMER_INT_COMPARE0_MASK << i); + } + + 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_COUNTER); + + nrf_timer_task_trigger(p_instance->p_reg, NRF_TIMER_TASK_COUNT); +} + +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); +} + +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); +} + +/** + * @brief Function for getting the specific timer capture task. + * + * @param[in] channel Capture channel number. + * + * @retval Capture task. + */ +__STATIC_INLINE nrf_timer_task_t nrf_drv_timer_capture_task_get(uint32_t channel) +{ + /* nrf_timer_tasks_t stores offset value and distance between two tasks equals to sizeof(uint32_t) = 4 */ + return (nrf_timer_task_t)((uint32_t) NRF_TIMER_TASK_CAPTURE0 + (channel * sizeof(uint32_t))); +} + +/** + * @brief Function for getting the specific timer compare event. + * + * @param[in] channel Compare channel number. + * + * @retval Compare event. + */ +__STATIC_INLINE nrf_timer_event_t nrf_drv_timer_compare_event_get(uint32_t channel) +{ + return (nrf_timer_event_t)((uint32_t) NRF_TIMER_EVENT_COMPARE0 + (channel * sizeof(uint32_t))); +} + +uint32_t nrf_drv_timer_capture_task_address_get(nrf_drv_timer_t const * const p_instance, + uint32_t channel) +{ + ASSERT(channel < TIMER_CHANNEL_NUMBER); + return (uint32_t)nrf_timer_task_address_get(p_instance->p_reg, + nrf_drv_timer_capture_task_get(channel)); +} + +uint32_t nrf_drv_timer_compare_event_address_get(nrf_drv_timer_t const * const p_instance, + uint32_t channel) +{ + ASSERT(channel < TIMER_CHANNEL_NUMBER); + return (uint32_t)nrf_timer_event_address_get(p_instance->p_reg, + nrf_drv_timer_compare_event_get(channel) ); +} + +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 < TIMER_CHANNEL_NUMBER); + + /*lint -save -e644*/ + nrf_timer_task_trigger(p_instance->p_reg, nrf_drv_timer_capture_task_get(cc_channel)); + /*lint -restore*/ + return nrf_timer_cc_read(p_instance->p_reg, cc_channel); +} + +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); +} + +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) +{ + nrf_timer_int_mask_t timer_int; + + timer_int = (nrf_timer_int_mask_t)((uint32_t)NRF_TIMER_INT_COMPARE0_MASK << cc_channel); + + if (enable == true) + { + /*lint -save -e644*/ + nrf_timer_int_enable(p_instance->p_reg, timer_int); + /*lint -restore*/ + } + 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) +{ + nrf_timer_shorts_disable(p_instance->p_reg, TIMER_CC_SHORT(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); +} + +uint32_t nrf_drv_timer_us_to_ticks(nrf_drv_timer_t const * const p_instance, + uint32_t time_us) +{ + uint32_t multiplier = 512UL; //must be divisible by 2^(PRESCALER_MAX) + uint32_t prescaler_value = nrf_timer_frequency_get(p_instance->p_reg); + ASSERT(prescaler_value <= 9); //maximum prescaler value + ASSERT((UINT32_MAX / (multiplier >> prescaler_value)) > time_us); + return (((multiplier >> prescaler_value) * time_us) / 32UL); //32 -> multiplier divided by clock freq. in MHz +} + + +uint32_t nrf_drv_timer_ms_to_ticks(nrf_drv_timer_t const * const p_instance, + uint32_t time_ms) +{ + uint32_t multiplier = 64000UL; //must be divisible by 2^(PRESCALER_MAX) + uint32_t prescaler_value = nrf_timer_frequency_get(p_instance->p_reg); + ASSERT(prescaler_value <= 9); //maximum prescaler value + ASSERT((UINT32_MAX / (multiplier >> prescaler_value)) > time_ms); + return (((multiplier >> prescaler_value) * time_ms) / 4UL); //4 -> multiplier divided by clock freq. in kHz +} + +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 < TIMER_CHANNEL_NUMBER); + nrf_timer_event_clear(p_instance->p_reg, nrf_drv_timer_compare_event_get(channel)); + nrf_timer_int_enable(p_instance->p_reg, (uint32_t) NRF_TIMER_INT_COMPARE0_MASK << 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 < TIMER_CHANNEL_NUMBER); + nrf_timer_int_disable(p_instance->p_reg, (uint32_t) NRF_TIMER_INT_COMPARE0_MASK << channel); +} + +/** + * @brief This function is generic interrupt handler + * + * @param[in] p_reg pointer to timer registers + * @param[in] timer_id specifies the timer id + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +static void nrf_drv_timer_interrupt_handle(NRF_TIMER_Type * p_reg, uint32_t timer_id) +{ + uint32_t i; + + for(i=0; i +#include +#include "nrf.h" +#include "nrf_delay.h" +#include "nrf_gpio.h" + +/* Max cycles approximately to wait on RXDREADY and TXDREADY event, + * This is optimized way instead of using timers, this is not power aware. */ +#define MAX_TIMEOUT_LOOPS (20000UL) /**< MAX while loops to wait for RXD/TXD event */ + +static bool twi_master_write(uint8_t * data, uint8_t data_length, bool issue_stop_condition) +{ + uint32_t timeout = MAX_TIMEOUT_LOOPS; /* max loops to wait for EVENTS_TXDSENT event*/ + + if (data_length == 0) + { + /* Return false for requesting data of size 0 */ + return false; + } + + NRF_TWI1->TXD = *data++; + NRF_TWI1->TASKS_STARTTX = 1; + + /** @snippet [TWI HW master write] */ + while (true) + { + while (NRF_TWI1->EVENTS_TXDSENT == 0 && NRF_TWI1->EVENTS_ERROR == 0 && (--timeout)) + { + // Do nothing. + } + + if (timeout == 0 || NRF_TWI1->EVENTS_ERROR != 0) + { + // Recover the peripheral as indicated by PAN 56: "TWI: TWI module lock-up." found at + // Product Anomaly Notification document found at + // https://www.nordicsemi.com/eng/Products/Bluetooth-R-low-energy/nRF51822/#Downloads + NRF_TWI1->EVENTS_ERROR = 0; + NRF_TWI1->ENABLE = TWI_ENABLE_ENABLE_Disabled << TWI_ENABLE_ENABLE_Pos; + NRF_TWI1->POWER = 0; + nrf_delay_us(5); + NRF_TWI1->POWER = 1; + NRF_TWI1->ENABLE = TWI_ENABLE_ENABLE_Enabled << TWI_ENABLE_ENABLE_Pos; + + (void)twi_master_init(); + + return false; + } + NRF_TWI1->EVENTS_TXDSENT = 0; + if (--data_length == 0) + { + break; + } + + NRF_TWI1->TXD = *data++; + } + /** @snippet [TWI HW master write] */ + + if (issue_stop_condition) + { + NRF_TWI1->EVENTS_STOPPED = 0; + NRF_TWI1->TASKS_STOP = 1; + /* Wait until stop sequence is sent */ + while(NRF_TWI1->EVENTS_STOPPED == 0) + { + // Do nothing. + } + } + return true; +} + + +/** @brief Function for read by twi_master. + */ +static bool twi_master_read(uint8_t * data, uint8_t data_length, bool issue_stop_condition) +{ + uint32_t timeout = MAX_TIMEOUT_LOOPS; /* max loops to wait for RXDREADY event*/ + + if (data_length == 0) + { + /* Return false for requesting data of size 0 */ + return false; + } + else if (data_length == 1) + { + NRF_PPI->CH[0].TEP = (uint32_t)&NRF_TWI1->TASKS_STOP; + } + else + { + NRF_PPI->CH[0].TEP = (uint32_t)&NRF_TWI1->TASKS_SUSPEND; + } + + NRF_PPI->CHENSET = PPI_CHENSET_CH0_Msk; + NRF_TWI1->EVENTS_RXDREADY = 0; + NRF_TWI1->TASKS_STARTRX = 1; + + /** @snippet [TWI HW master read] */ + while (true) + { + while (NRF_TWI1->EVENTS_RXDREADY == 0 && NRF_TWI1->EVENTS_ERROR == 0 && (--timeout)) + { + // Do nothing. + } + NRF_TWI1->EVENTS_RXDREADY = 0; + + if (timeout == 0 || NRF_TWI1->EVENTS_ERROR != 0) + { + // Recover the peripheral as indicated by PAN 56: "TWI: TWI module lock-up." found at + // Product Anomaly Notification document found at + // https://www.nordicsemi.com/eng/Products/Bluetooth-R-low-energy/nRF51822/#Downloads + NRF_TWI1->EVENTS_ERROR = 0; + NRF_TWI1->ENABLE = TWI_ENABLE_ENABLE_Disabled << TWI_ENABLE_ENABLE_Pos; + NRF_TWI1->POWER = 0; + nrf_delay_us(5); + NRF_TWI1->POWER = 1; + NRF_TWI1->ENABLE = TWI_ENABLE_ENABLE_Enabled << TWI_ENABLE_ENABLE_Pos; + + (void)twi_master_init(); + + return false; + } + + *data++ = NRF_TWI1->RXD; + + /* Configure PPI to stop TWI master before we get last BB event */ + if (--data_length == 1) + { + NRF_PPI->CH[0].TEP = (uint32_t)&NRF_TWI1->TASKS_STOP; + } + + if (data_length == 0) + { + break; + } + + // Recover the peripheral as indicated by PAN 56: "TWI: TWI module lock-up." found at + // Product Anomaly Notification document found at + // https://www.nordicsemi.com/eng/Products/Bluetooth-R-low-energy/nRF51822/#Downloads + nrf_delay_us(20); + NRF_TWI1->TASKS_RESUME = 1; + } + /** @snippet [TWI HW master read] */ + + /* Wait until stop sequence is sent */ + while(NRF_TWI1->EVENTS_STOPPED == 0) + { + // Do nothing. + } + NRF_TWI1->EVENTS_STOPPED = 0; + + NRF_PPI->CHENCLR = PPI_CHENCLR_CH0_Msk; + return true; +} + + +/** + * @brief Function for detecting stuck slaves (SDA = 0 and SCL = 1) and tries to clear the bus. + * + * @return + * @retval false Bus is stuck. + * @retval true Bus is clear. + */ +static bool twi_master_clear_bus(void) +{ + uint32_t twi_state; + bool bus_clear; + uint32_t clk_pin_config; + uint32_t data_pin_config; + + // Save and disable TWI hardware so software can take control over the pins. + twi_state = NRF_TWI1->ENABLE; + NRF_TWI1->ENABLE = TWI_ENABLE_ENABLE_Disabled << TWI_ENABLE_ENABLE_Pos; + + clk_pin_config = \ + NRF_GPIO->PIN_CNF[TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER]; + NRF_GPIO->PIN_CNF[TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER] = \ + (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); + + data_pin_config = \ + NRF_GPIO->PIN_CNF[TWI_MASTER_CONFIG_DATA_PIN_NUMBER]; + NRF_GPIO->PIN_CNF[TWI_MASTER_CONFIG_DATA_PIN_NUMBER] = \ + (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); + + TWI_SDA_HIGH(); + TWI_SCL_HIGH(); + TWI_DELAY(); + + if ((TWI_SDA_READ() == 1) && (TWI_SCL_READ() == 1)) + { + bus_clear = true; + } + else + { + uint_fast8_t i; + bus_clear = false; + + // Clock max 18 pulses worst case scenario(9 for master to send the rest of command and 9 + // for slave to respond) to SCL line and wait for SDA come high. + for (i=18; i--;) + { + TWI_SCL_LOW(); + TWI_DELAY(); + TWI_SCL_HIGH(); + TWI_DELAY(); + + if (TWI_SDA_READ() == 1) + { + bus_clear = true; + break; + } + } + } + + NRF_GPIO->PIN_CNF[TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER] = clk_pin_config; + NRF_GPIO->PIN_CNF[TWI_MASTER_CONFIG_DATA_PIN_NUMBER] = data_pin_config; + + NRF_TWI1->ENABLE = twi_state; + + return bus_clear; +} + + +/** @brief Function for initializing the twi_master. + */ +bool twi_master_init(void) +{ + /* 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[TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER] = \ + (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); + + NRF_GPIO->PIN_CNF[TWI_MASTER_CONFIG_DATA_PIN_NUMBER] = \ + (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); + + NRF_TWI1->EVENTS_RXDREADY = 0; + NRF_TWI1->EVENTS_TXDSENT = 0; + NRF_TWI1->PSELSCL = TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER; + NRF_TWI1->PSELSDA = TWI_MASTER_CONFIG_DATA_PIN_NUMBER; + NRF_TWI1->FREQUENCY = TWI_FREQUENCY_FREQUENCY_K100 << TWI_FREQUENCY_FREQUENCY_Pos; + NRF_PPI->CH[0].EEP = (uint32_t)&NRF_TWI1->EVENTS_BB; + NRF_PPI->CH[0].TEP = (uint32_t)&NRF_TWI1->TASKS_SUSPEND; + NRF_PPI->CHENCLR = PPI_CHENCLR_CH0_Msk; + NRF_TWI1->ENABLE = TWI_ENABLE_ENABLE_Enabled << TWI_ENABLE_ENABLE_Pos; + + return twi_master_clear_bus(); +} + + +/** @brief Function for transfer by twi_master. + */ +bool twi_master_transfer(uint8_t address, + uint8_t * data, + uint8_t data_length, + bool issue_stop_condition) +{ + bool transfer_succeeded = false; + if (data_length > 0 && twi_master_clear_bus()) + { + NRF_TWI1->ADDRESS = (address >> 1); + + if ((address & TWI_READ_BIT)) + { + transfer_succeeded = twi_master_read(data, data_length, issue_stop_condition); + } + else + { + transfer_succeeded = twi_master_write(data, data_length, issue_stop_condition); + } + } + return transfer_succeeded; +} + +/*lint --flb "Leave library region" */ diff --git a/components/drivers_nrf/twi_master/deprecated/twi_master.h b/components/drivers_nrf/twi_master/deprecated/twi_master.h new file mode 100644 index 0000000..4e83de7 --- /dev/null +++ b/components/drivers_nrf/twi_master/deprecated/twi_master.h @@ -0,0 +1,101 @@ + /* Copyright (c) 2009 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 TWI_MASTER_H +#define TWI_MASTER_H + +/*lint ++flb "Enter library region" */ + +#include +#include + +/** @file +* @brief Software controlled TWI Master driver. +* +* +* @defgroup lib_driver_twi_master Software controlled TWI Master driver +* @{ +* @ingroup nrf_twi +* @brief Software controlled TWI Master driver (deprecated). +* +* @warning This module is deprecated. +* +* Supported features: +* - Repeated start +* - No multi-master +* - Only 7-bit addressing +* - Supports clock stretching (with optional SMBus style slave timeout) +* - Tries to handle slaves stuck in the middle of transfer +*/ + +#define TWI_READ_BIT (0x01) //!< If this bit is set in the address field, transfer direction is from slave to master. + +#define TWI_ISSUE_STOP ((bool)true) //!< Parameter for @ref twi_master_transfer +#define TWI_DONT_ISSUE_STOP ((bool)false) //!< Parameter for @ref twi_master_transfer + +/* These macros are needed to see if the slave is stuck and we as master send dummy clock cycles to end its wait */ +/*lint -e717 -save "Suppress do {} while (0) for these macros" */ +/*lint ++flb "Enter library region" */ +#define TWI_SCL_HIGH() do { NRF_GPIO->OUTSET = (1UL << TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER); } while(0) /*!< Pulls SCL line high */ +#define TWI_SCL_LOW() do { NRF_GPIO->OUTCLR = (1UL << TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER); } while(0) /*!< Pulls SCL line low */ +#define TWI_SDA_HIGH() do { NRF_GPIO->OUTSET = (1UL << TWI_MASTER_CONFIG_DATA_PIN_NUMBER); } while(0) /*!< Pulls SDA line high */ +#define TWI_SDA_LOW() do { NRF_GPIO->OUTCLR = (1UL << TWI_MASTER_CONFIG_DATA_PIN_NUMBER); } while(0) /*!< Pulls SDA line low */ +#define TWI_SDA_INPUT() do { NRF_GPIO->DIRCLR = (1UL << TWI_MASTER_CONFIG_DATA_PIN_NUMBER); } while(0) /*!< Configures SDA pin as input */ +#define TWI_SDA_OUTPUT() do { NRF_GPIO->DIRSET = (1UL << TWI_MASTER_CONFIG_DATA_PIN_NUMBER); } while(0) /*!< Configures SDA pin as output */ +#define TWI_SCL_OUTPUT() do { NRF_GPIO->DIRSET = (1UL << TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER); } while(0) /*!< Configures SCL pin as output */ +/*lint -restore */ + +#define TWI_SDA_READ() ((NRF_GPIO->IN >> TWI_MASTER_CONFIG_DATA_PIN_NUMBER) & 0x1UL) /*!< Reads current state of SDA */ +#define TWI_SCL_READ() ((NRF_GPIO->IN >> TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER) & 0x1UL) /*!< Reads current state of SCL */ + +#define TWI_DELAY() nrf_delay_us(4) /*!< 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. */ + + +/** + * @brief Function for initializing TWI bus IO pins and checks if the bus is operational. + * + * Both pins are configured as Standard-0, No-drive-1 (open drain). + * + * @return + * @retval true TWI bus is clear for transfers. + * @retval false TWI bus is stuck. + */ +bool twi_master_init(void); + +/** + * @brief Function for transferring data over TWI bus. + * + * If TWI master detects even one NACK from the slave or timeout occurs, STOP condition is issued + * and the function returns false. + * Bit 0 (@ref TWI_READ_BIT) in the address parameter controls transfer direction; + * - If 1, master reads data_length number of bytes from the slave + * - If 0, master writes data_length number of bytes to the slave. + * + * @note Make sure at least data_length number of bytes is allocated in data if TWI_READ_BIT is set. + * @note @ref TWI_ISSUE_STOP + * + * @param address Data transfer direction (LSB) / Slave address (7 MSBs). + * @param data Pointer to data. + * @param data_length Number of bytes to transfer. + * @param issue_stop_condition If @ref TWI_ISSUE_STOP, STOP condition is issued before exiting function. If @ref TWI_DONT_ISSUE_STOP, STOP condition is not issued before exiting function. If transfer failed for any reason, STOP condition will be issued in any case. + * @return + * @retval true Data transfer succeeded without errors. + * @retval false Data transfer failed. + */ +bool twi_master_transfer(uint8_t address, uint8_t *data, uint8_t data_length, bool issue_stop_condition); + +/** + *@} + **/ + +/*lint --flb "Leave library region" */ +#endif //TWI_MASTER_H diff --git a/components/drivers_nrf/twi_master/deprecated/twi_sw_master.c b/components/drivers_nrf/twi_master/deprecated/twi_sw_master.c new file mode 100644 index 0000000..106ef81 --- /dev/null +++ b/components/drivers_nrf/twi_master/deprecated/twi_sw_master.c @@ -0,0 +1,492 @@ +/* Copyright (c) 2009 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 +#include "twi_master.h" +#include "nrf_delay.h" + +#include "twi_master_config.h" + +/*lint -e415 -e845 -save "Out of bounds access" */ +#define TWI_SDA_STANDARD0_NODRIVE1() do { \ + NRF_GPIO->PIN_CNF[TWI_MASTER_CONFIG_DATA_PIN_NUMBER] = (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); \ +} while (0) /*!< Configures SDA pin to Standard-0, No-drive 1 */ + + +#define TWI_SCL_STANDARD0_NODRIVE1() do { \ + NRF_GPIO->PIN_CNF[TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER] = (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); \ +} while (0) /*!< Configures SCL pin to Standard-0, No-drive 1 */ + + +/*lint -restore */ + +#ifndef TWI_MASTER_TIMEOUT_COUNTER_LOAD_VALUE +#define TWI_MASTER_TIMEOUT_COUNTER_LOAD_VALUE (0UL) //!< Unit is number of empty loops. Timeout for SMBus devices is 35 ms. Set to zero to disable slave timeout altogether. +#endif + +static bool twi_master_clear_bus(void); +static bool twi_master_issue_startcondition(void); +static bool twi_master_issue_stopcondition(void); +static bool twi_master_clock_byte(uint_fast8_t databyte); +static bool twi_master_clock_byte_in(uint8_t * databyte, bool ack); +static bool twi_master_wait_while_scl_low(void); + +bool twi_master_init(void) +{ + // Configure both pins to output Standard 0, No-drive (open-drain) 1 + TWI_SDA_STANDARD0_NODRIVE1(); /*lint !e416 "Creation of out of bounds pointer" */ + TWI_SCL_STANDARD0_NODRIVE1(); /*lint !e416 "Creation of out of bounds pointer" */ + + // Configure SCL as output + TWI_SCL_HIGH(); + TWI_SCL_OUTPUT(); + + // Configure SDA as output + TWI_SDA_HIGH(); + TWI_SDA_OUTPUT(); + + return twi_master_clear_bus(); +} + +bool twi_master_transfer(uint8_t address, uint8_t * data, uint8_t data_length, bool issue_stop_condition) +{ + bool transfer_succeeded = true; + + transfer_succeeded &= twi_master_issue_startcondition(); + transfer_succeeded &= twi_master_clock_byte(address); + + if (address & TWI_READ_BIT) + { + /* Transfer direction is from Slave to Master */ + while (data_length-- && transfer_succeeded) + { + // To indicate to slave that we've finished transferring last data byte + // we need to NACK the last transfer. + if (data_length == 0) + { + transfer_succeeded &= twi_master_clock_byte_in(data, (bool)false); + } + else + { + transfer_succeeded &= twi_master_clock_byte_in(data, (bool)true); + } + data++; + } + } + else + { + /* Transfer direction is from Master to Slave */ + while (data_length-- && transfer_succeeded) + { + transfer_succeeded &= twi_master_clock_byte(*data); + data++; + } + } + + if (issue_stop_condition || !transfer_succeeded) + { + transfer_succeeded &= twi_master_issue_stopcondition(); + } + + return transfer_succeeded; +} + +/** + * @brief Function for detecting stuck slaves and tries to clear the bus. + * + * @return + * @retval false Bus is stuck. + * @retval true Bus is clear. + */ +static bool twi_master_clear_bus(void) +{ + bool bus_clear; + + TWI_SDA_HIGH(); + TWI_SCL_HIGH(); + TWI_DELAY(); + + + if (TWI_SDA_READ() == 1 && TWI_SCL_READ() == 1) + { + bus_clear = true; + } + else if (TWI_SCL_READ() == 1) + { + bus_clear = false; + // Clock max 18 pulses worst case scenario(9 for master to send the rest of command and 9 for slave to respond) to SCL line and wait for SDA come high + for (uint_fast8_t i = 18; i--;) + { + TWI_SCL_LOW(); + TWI_DELAY(); + TWI_SCL_HIGH(); + TWI_DELAY(); + + if (TWI_SDA_READ() == 1) + { + bus_clear = true; + break; + } + } + } + else + { + bus_clear = false; + } + + return bus_clear; +} + +/** + * @brief Function for issuing TWI START condition to the bus. + * + * START condition is signaled by pulling SDA low while SCL is high. After this function SCL and SDA will be low. + * + * @return + * @retval false Timeout detected + * @retval true Clocking succeeded + */ +static bool twi_master_issue_startcondition(void) +{ +#if 0 + if (TWI_SCL_READ() == 1 && TWI_SDA_READ() == 1) + { + // Pull SDA low + TWI_SDA_LOW(); + } + else if (TWI_SCL_READ() == 1 && TWI_SDA_READ() == 0) + { + // Issue Stop by pulling SDA high + TWI_SDA_HIGH(); + TWI_DELAY(); + + // Then Start by pulling SDA low + TWI_SDA_LOW(); + } + else if (TWI_SCL_READ() == 0 && TWI_SDA_READ() == 0) + { + // First pull SDA high + TWI_SDA_HIGH(); + + // Then SCL high + if (!twi_master_wait_while_scl_low()) + { + return false; + } + + // Then SDA low + TWI_SDA_LOW(); + } + else if (TWI_SCL_READ() == 0 && TWI_SDA_READ() == 1) + { + // SCL high + if (!twi_master_wait_while_scl_low()) + { + return false; + } + + // Then SDA low + TWI_SDA_LOW(); + } + + TWI_DELAY(); + TWI_SCL_LOW(); +#endif + + // Make sure both SDA and SCL are high before pulling SDA low. + TWI_SDA_HIGH(); + TWI_DELAY(); + if (!twi_master_wait_while_scl_low()) + { + return false; + } + + TWI_SDA_LOW(); + TWI_DELAY(); + + // Other module function expect SCL to be low + TWI_SCL_LOW(); + TWI_DELAY(); + + return true; +} + +/** + * @brief Function for issuing TWI STOP condition to the bus. + * + * STOP condition is signaled by pulling SDA high while SCL is high. After this function SDA and SCL will be high. + * + * @return + * @retval false Timeout detected + * @retval true Clocking succeeded + */ +static bool twi_master_issue_stopcondition(void) +{ +#if 0 + if (TWI_SCL_READ() == 1 && TWI_SDA_READ() == 1) + { + // Issue start, then issue stop + + // Pull SDA low to issue START + TWI_SDA_LOW(); + TWI_DELAY(); + + // Pull SDA high while SCL is high to issue STOP + TWI_SDA_HIGH(); + } + else if (TWI_SCL_READ() == 1 && TWI_SDA_READ() == 0) + { + // Pull SDA high while SCL is high to issue STOP + TWI_SDA_HIGH(); + } + else if (TWI_SCL_READ() == 0 && TWI_SDA_READ() == 0) + { + if (!twi_master_wait_while_scl_low()) + { + return false; + } + + // Pull SDA high while SCL is high to issue STOP + TWI_SDA_HIGH(); + } + else if (TWI_SCL_READ() == 0 && TWI_SDA_READ() == 1) + { + TWI_SDA_LOW(); + TWI_DELAY(); + + // SCL high + if (!twi_master_wait_while_scl_low()) + { + return false; + } + + // Pull SDA high while SCL is high to issue STOP + TWI_SDA_HIGH(); + } + + TWI_DELAY(); +#endif + + TWI_SDA_LOW(); + TWI_DELAY(); + if (!twi_master_wait_while_scl_low()) + { + return false; + } + + TWI_SDA_HIGH(); + TWI_DELAY(); + + return true; +} + +/** + * @brief Function for clocking one data byte out and reads slave acknowledgment. + * + * Can handle clock stretching. + * After calling this function SCL is low and SDA low/high depending on the + * value of LSB of the data byte. + * SCL is expected to be output and low when entering this function. + * + * @param databyte Data byte to clock out. + * @return + * @retval true Slave acknowledged byte. + * @retval false Timeout or slave didn't acknowledge byte. + */ +static bool twi_master_clock_byte(uint_fast8_t databyte) +{ + bool transfer_succeeded = true; + + /** @snippet [TWI SW master write] */ + // Make sure SDA is an output + TWI_SDA_OUTPUT(); + + // MSB first + for (uint_fast8_t i = 0x80; i != 0; i >>= 1) + { + TWI_SCL_LOW(); + TWI_DELAY(); + + if (databyte & i) + { + TWI_SDA_HIGH(); + } + else + { + TWI_SDA_LOW(); + } + + if (!twi_master_wait_while_scl_low()) + { + transfer_succeeded = false; // Timeout + break; + } + } + + // Finish last data bit by pulling SCL low + TWI_SCL_LOW(); + TWI_DELAY(); + + /** @snippet [TWI SW master write] */ + + // Configure TWI_SDA pin as input for receiving the ACK bit + TWI_SDA_INPUT(); + + // Give some time for the slave to load the ACK bit on the line + TWI_DELAY(); + + // Pull SCL high and wait a moment for SDA line to settle + // Make sure slave is not stretching the clock + transfer_succeeded &= twi_master_wait_while_scl_low(); + + // Read ACK/NACK. NACK == 1, ACK == 0 + transfer_succeeded &= !(TWI_SDA_READ()); + + // Finish ACK/NACK bit clock cycle and give slave a moment to release control + // of the SDA line + TWI_SCL_LOW(); + TWI_DELAY(); + + // Configure TWI_SDA pin as output as other module functions expect that + TWI_SDA_OUTPUT(); + + return transfer_succeeded; +} + + +/** + * @brief Function for clocking one data byte in and sends ACK/NACK bit. + * + * Can handle clock stretching. + * SCL is expected to be output and low when entering this function. + * After calling this function, SCL is high and SDA low/high depending if ACK/NACK was sent. + * + * @param databyte Data byte to clock out. + * @param ack If true, send ACK. Otherwise send NACK. + * @return + * @retval true Byte read succesfully + * @retval false Timeout detected + */ +static bool twi_master_clock_byte_in(uint8_t *databyte, bool ack) +{ + uint_fast8_t byte_read = 0; + bool transfer_succeeded = true; + + /** @snippet [TWI SW master read] */ + // Make sure SDA is an input + TWI_SDA_INPUT(); + + // SCL state is guaranteed to be high here + + // MSB first + for (uint_fast8_t i = 0x80; i != 0; i >>= 1) + { + if (!twi_master_wait_while_scl_low()) + { + transfer_succeeded = false; + break; + } + + if (TWI_SDA_READ()) + { + byte_read |= i; + } + else + { + // No need to do anything + } + + TWI_SCL_LOW(); + TWI_DELAY(); + } + + // Make sure SDA is an output before we exit the function + TWI_SDA_OUTPUT(); + /** @snippet [TWI SW master read] */ + + *databyte = (uint8_t)byte_read; + + // Send ACK bit + + // SDA high == NACK, SDA low == ACK + if (ack) + { + TWI_SDA_LOW(); + } + else + { + TWI_SDA_HIGH(); + } + + // Let SDA line settle for a moment + TWI_DELAY(); + + // Drive SCL high to start ACK/NACK bit transfer + // Wait until SCL is high, or timeout occurs + if (!twi_master_wait_while_scl_low()) + { + transfer_succeeded = false; // Timeout + } + + // Finish ACK/NACK bit clock cycle and give slave a moment to react + TWI_SCL_LOW(); + TWI_DELAY(); + + return transfer_succeeded; +} + + +/** + * @brief Function for pulling SCL high and waits until it is high or timeout occurs. + * + * SCL is expected to be output before entering this function. + * @note If TWI_MASTER_TIMEOUT_COUNTER_LOAD_VALUE is set to zero, timeout functionality is not compiled in. + * @return + * @retval true SCL is now high. + * @retval false Timeout occurred and SCL is still low. + */ +static bool twi_master_wait_while_scl_low(void) +{ +#if TWI_MASTER_TIMEOUT_COUNTER_LOAD_VALUE != 0 + uint32_t volatile timeout_counter = TWI_MASTER_TIMEOUT_COUNTER_LOAD_VALUE; +#endif + + // Pull SCL high just in case if something left it low + TWI_SCL_HIGH(); + TWI_DELAY(); + + while (TWI_SCL_READ() == 0) + { + // If SCL is low, one of the slaves is busy and we must wait + +#if TWI_MASTER_TIMEOUT_COUNTER_LOAD_VALUE != 0 + if (timeout_counter-- == 0) + { + // If timeout_detected, return false + return false; + } +#endif + } + + return true; +} + +/*lint --flb "Leave library region" */ diff --git a/components/drivers_nrf/twi_master/nrf_drv_twi.c b/components/drivers_nrf/twi_master/nrf_drv_twi.c new file mode 100644 index 0000000..6a53d66 --- /dev/null +++ b/components/drivers_nrf/twi_master/nrf_drv_twi.c @@ -0,0 +1,746 @@ +/* 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 "nrf_drv_twi.h" +#include "nrf_assert.h" +#include "app_util_platform.h" +#include "nrf_delay.h" +#include "nrf_gpio.h" + +/**@brief Determine how long driver will be wait for event (in blocking mode). */ +#define BUSY_LOOP_TIMEOUT 0xFFF + +#define DISABLE_MASK UINT32_MAX + +#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 + +/**@brief TWI powered on substates. */ +typedef enum +{ + NRF_DRV_TWI_SUBSTATE_IDLE, /**< Idle state. Transmission is stoped. */ + NRF_DRV_TWI_SUBSTATE_SUSPEND, /**< Tx transmission is suspended. */ + NRF_DRV_TWI_SUBSTATE_RX_SUSPEND, /**< Rx transmission is suspended. */ + NRF_DRV_TWI_SUBSTATE_STOP, /**< Transmission will be stoped. */ + NRF_DRV_TWI_SUBSTATE_ERROR /**< Error condition. */ +} substate_t; + +/**@brief State machine events. */ +typedef enum +{ + TX_ADDR_REQ, + RX_ADDR_REQ, + TX_DONE, + RX_DONE, + TO_STOP, + ON_ERROR +} sm_evt_t; + +/**@brief TWI transfer structure. */ +typedef struct +{ + bool is_tx; /**< Transmission from master to slave (if is_tx is set) or from slave to master (if not). */ + bool xfer_pending; /**< Transmission will be suspended (if xfer_pending is set) or stopped (if not). */ + bool error_condition; /**< Error has occured. */ + uint8_t address; /**< Address of slave device. */ + uint8_t * p_data; /**< Pointer to data buffer. */ + uint16_t length; /**< Length of data buffer. */ + uint16_t count; /**< Count of already transferred bytes. */ + nrf_twi_tasks_t task; /**< Next task. */ + nrf_twi_events_t end_event; /**< Event for which the state machine waits. */ + nrf_twi_int_mask_t end_int; /**< Interrupt for which the state machine waits. */ +} transfer_t; + +/**@brief TWI driver instance control block structure. */ +typedef struct +{ + nrf_drv_state_t state; /**< Instance state. */ + substate_t substate; /**< Instance substate when powered on. */ + bool volatile transfer_in_progress; /**< Data transfer is in progress. */ + transfer_t transfer; /**< Transfer structure. */ +} control_block_t; + +/**@brief Macro for getting the number of elements of the array. */ +#define ARRAY_LENGTH(a) (sizeof(a) / sizeof(a[0])) + +/** @brief User callbacks storage. */ +static nrf_drv_twi_evt_handler_t m_handlers[TWI_COUNT]; + +/** @brief Context pointers, passed to user callbacks. */ +static void * mp_contexts[TWI_COUNT]; + +/** @brief Control blocks storage. */ +static control_block_t m_cb[TWI_COUNT]; + +/** @brief TWI instances pointers storage. */ +static nrf_drv_twi_t const * m_instances[TWI_COUNT]; + +static const nrf_drv_twi_config_t m_default_config[] = { +#if (TWI0_ENABLED == 1) + NRF_DRV_TWI_DEFAULT_CONFIG(0), +#endif +#if (TWI1_ENABLED == 1) + NRF_DRV_TWI_DEFAULT_CONFIG(1) +#endif +}; + +/**@brief TWI state machine action. */ +typedef void (* sm_action_t)(nrf_drv_twi_t const * const p_instance); + +/**@brief TWI transition structure. */ +typedef struct +{ + sm_evt_t evt; + substate_t next_state; + sm_action_t func; +} transition_t; + +/** + * @brief Function for initializing data transfer (from master to slave). + * + * @param[in] p_instance TWI. + */ +static void address_req(nrf_drv_twi_t const * const p_instance); + +/** + * @brief Function for initializing data transfer (from slave to master). + * + * @param[in] p_instance TWI. + */ +static void rx_address_req(nrf_drv_twi_t const * const p_instance); + +/** + * @brief Function for preparing byte transfer (from master to slave). + * + * @param[in] p_instance TWI. + */ +static void tx_prepare(nrf_drv_twi_t const * const p_instance); + +/** + * @brief Function for confirming byte transfer (from master to slave). + * + * @param[in] p_instance TWI. + */ +static void tx_done(nrf_drv_twi_t const * const p_instance); + +/** + * @brief Function for preparing byte transfer (from slave to master). + * + * @param[in] p_instance TWI. + */ +static void rx_prepare(nrf_drv_twi_t const * const p_instance); + +/** + * @brief Function for confirming byte transfer (from slave to master). + * + * @param[in] p_instance TWI. + */ +static void rx_done(nrf_drv_twi_t const * const p_instance); + +/** + * @brief Function for ending transfer after an error. + * + * @param[in] p_instance TWI. + */ +static void on_error(nrf_drv_twi_t const * const p_instance); + +/** + * @brief Function for ending transfer after an error. + * + * @param[in] p_instance TWI. + */ +static void ack_error(nrf_drv_twi_t const * const p_instance); + +/**@brief List of idle state transitions. */ +static const transition_t m_idle[] = { + {TX_ADDR_REQ, NRF_DRV_TWI_SUBSTATE_SUSPEND, address_req}, + {RX_ADDR_REQ, NRF_DRV_TWI_SUBSTATE_RX_SUSPEND, rx_address_req}, +}; + +/**@brief List of TX suspended state transitions. */ +static const transition_t m_tx_suspended[] = { + {TX_DONE, NRF_DRV_TWI_SUBSTATE_SUSPEND, tx_done}, + {RX_ADDR_REQ, NRF_DRV_TWI_SUBSTATE_RX_SUSPEND, rx_address_req}, + {TX_ADDR_REQ, NRF_DRV_TWI_SUBSTATE_SUSPEND, tx_prepare}, + {TO_STOP, NRF_DRV_TWI_SUBSTATE_STOP, NULL}, + {ON_ERROR, NRF_DRV_TWI_SUBSTATE_ERROR, on_error} +}; + +/**@brief List of RX suspended state transitions. */ +static const transition_t m_rx_suspended[] = { + {RX_ADDR_REQ, NRF_DRV_TWI_SUBSTATE_RX_SUSPEND, rx_prepare}, + {RX_DONE, NRF_DRV_TWI_SUBSTATE_RX_SUSPEND, rx_done}, + {TO_STOP, NRF_DRV_TWI_SUBSTATE_STOP, NULL}, + {ON_ERROR, NRF_DRV_TWI_SUBSTATE_ERROR, on_error} +}; + +/**@brief List of stopped state transitions. */ +static const transition_t m_stopped[] = { + {RX_DONE, NRF_DRV_TWI_SUBSTATE_IDLE, rx_done}, + {TX_DONE, NRF_DRV_TWI_SUBSTATE_IDLE, tx_done}, + {ON_ERROR, NRF_DRV_TWI_SUBSTATE_IDLE, ack_error} +}; + +/**@brief List of error state transitions. */ +static const transition_t m_error[] = { + {RX_DONE, NRF_DRV_TWI_SUBSTATE_IDLE, ack_error}, + {TX_DONE, NRF_DRV_TWI_SUBSTATE_IDLE, ack_error}, + {ON_ERROR, NRF_DRV_TWI_SUBSTATE_IDLE, ack_error} +}; + +/**@brief List of state machine states. */ +static const transition_t * mp_states[] = { + m_idle, + m_tx_suspended, + m_rx_suspended, + m_stopped, + m_error +}; + +/**@brief List of amounts for each state transitions. */ +static const uint32_t m_states_len[] = +{ + ARRAY_LENGTH(m_idle), + ARRAY_LENGTH(m_tx_suspended), + ARRAY_LENGTH(m_rx_suspended), + ARRAY_LENGTH(m_stopped), + ARRAY_LENGTH(m_error) +}; + +/** + * @brief Function for running state machine. + * + * @param[in] p_instance TWI. + * @param[in] evt State machine event. + */ +static void state_machine(nrf_drv_twi_t const * const p_instance, sm_evt_t evt) +{ + bool evt_found = false; + substate_t substate = m_cb[p_instance->instance_id].substate; + transition_t const * p_state = mp_states[substate]; + + for (uint32_t i = 0; i < m_states_len[substate]; i++) + { + if (evt == p_state[i].evt) + { + m_cb[p_instance->instance_id].substate = p_state[i].next_state; + + if (p_state[i].func) + { + p_state[i].func(p_instance); + } + evt_found = true; + break; + } + } + UNUSED_VARIABLE(evt_found); + ASSERT(evt_found); +} + + +/** + * @brief Function for prepering shortcut register. + * + * @param[in] p_instance TWI. + */ +static void txrx_shorts_set_task_start(nrf_drv_twi_t const * const p_instance) +{ + uint32_t short_mask; + transfer_t * p_transfer = &(m_cb[p_instance->instance_id].transfer); + + nrf_twi_shorts_clear(p_instance->p_reg, + NRF_TWI_SHORTS_BB_SUSPEND_MASK | NRF_TWI_SHORTS_BB_STOP_MASK); + + // if the last one and no pending transfer prepare to wait for stopped event + if (((p_transfer->count + 1) == p_transfer->length) && p_transfer->xfer_pending == false) + { + short_mask = NRF_TWI_SHORTS_BB_STOP_MASK; + + p_transfer->end_event = NRF_TWI_EVENTS_STOPPED; + nrf_twi_event_clear(p_instance->p_reg, p_transfer->end_event); + + if (m_handlers[p_instance->instance_id]) + { + nrf_twi_int_disable(p_instance->p_reg, p_transfer->end_int); + p_transfer->end_int = NRF_TWI_INT_STOPPED_MASK; + nrf_twi_int_enable(p_instance->p_reg, p_transfer->end_int); + } + + state_machine(p_instance, TO_STOP); + } + else + { + short_mask = NRF_TWI_SHORTS_BB_SUSPEND_MASK; + } + + nrf_twi_shorts_set(p_instance->p_reg, short_mask); + nrf_twi_tasks_t prev_task = p_transfer->task; + p_transfer->task = NRF_TWI_TASKS_RESUME; + nrf_twi_task_set(p_instance->p_reg, prev_task); +} + + +static void address_req(nrf_drv_twi_t const * const p_instance) +{ + transfer_t * p_transfer = &(m_cb[p_instance->instance_id].transfer); + nrf_twi_address_set(p_instance->p_reg, p_transfer->address); + + nrf_twi_task_set(p_instance->p_reg, NRF_TWI_TASKS_RESUME); + p_transfer->task = NRF_TWI_TASKS_STARTTX; + p_transfer->end_event = NRF_TWI_EVENTS_TXDSENT; + nrf_twi_event_clear(p_instance->p_reg, p_transfer->end_event); + + if (m_handlers[p_instance->instance_id]) + { + nrf_twi_int_disable(p_instance->p_reg, p_transfer->end_int); + p_transfer->end_int = NRF_TWI_INT_TXDSENT_MASK; + nrf_twi_int_enable(p_instance->p_reg, p_transfer->end_int); + } + + tx_prepare(p_instance); +} + + +static void rx_address_req(nrf_drv_twi_t const * const p_instance) +{ + transfer_t * p_transfer = &(m_cb[p_instance->instance_id].transfer); + + nrf_twi_address_set(p_instance->p_reg, p_transfer->address); + nrf_twi_task_set(p_instance->p_reg, NRF_TWI_TASKS_RESUME); + p_transfer->task = NRF_TWI_TASKS_STARTRX; + p_transfer->end_event = NRF_TWI_EVENTS_RXDREADY; + nrf_twi_event_clear(p_instance->p_reg, p_transfer->end_event); + if (m_handlers[p_instance->instance_id]) + { + nrf_twi_int_disable(p_instance->p_reg, p_transfer->end_int); + p_transfer->end_int = NRF_TWI_INT_RXDREADY_MASK; + nrf_twi_int_enable(p_instance->p_reg, p_transfer->end_int); + } + + rx_prepare(p_instance); +} + + +static void rx_prepare(nrf_drv_twi_t const * const p_instance) +{ + txrx_shorts_set_task_start(p_instance); +} + + +static void rx_done(nrf_drv_twi_t const * const p_instance) +{ + transfer_t * p_transfer = &(m_cb[p_instance->instance_id].transfer); + + p_transfer->p_data[p_transfer->count] = nrf_twi_rxd_get(p_instance->p_reg); + p_transfer->count++; + + if (p_transfer->count < p_transfer->length) + { + rx_prepare(p_instance); + } +} + + +static void tx_prepare(nrf_drv_twi_t const * const p_instance) +{ + transfer_t * p_transfer = &(m_cb[p_instance->instance_id].transfer); + + nrf_twi_txd_set(p_instance->p_reg, p_transfer->p_data[p_transfer->count]); + txrx_shorts_set_task_start(p_instance); +} + + +static void tx_done(nrf_drv_twi_t const * const p_instance) +{ + transfer_t * p_transfer = &(m_cb[p_instance->instance_id].transfer); + + p_transfer->count++; + + if (p_transfer->count < p_transfer->length) + { + tx_prepare(p_instance); + } +} + + +static void on_error(nrf_drv_twi_t const * const p_instance) +{ + transfer_t * p_transfer = &(m_cb[p_instance->instance_id].transfer); + + p_transfer->end_event = NRF_TWI_EVENTS_STOPPED; + nrf_twi_event_clear(p_instance->p_reg, p_transfer->end_event); + + if (m_handlers[p_instance->instance_id]) + { + nrf_twi_int_disable(p_instance->p_reg, p_transfer->end_int); + p_transfer->end_int = NRF_TWI_INT_STOPPED_MASK; + nrf_twi_int_enable(p_instance->p_reg, p_transfer->end_int); + } + + nrf_twi_task_set(p_instance->p_reg, NRF_TWI_TASKS_RESUME); + nrf_twi_task_set(p_instance->p_reg, NRF_TWI_TASKS_STOP); +} + +static void ack_error(nrf_drv_twi_t const * const p_instance) +{ + transfer_t * p_transfer = &(m_cb[p_instance->instance_id].transfer); + p_transfer->error_condition = true; +} + +/** + * @brief Function for blocking the module until desired event occurs. + * + * @param[in] p_instance TWI. + * + * @return False if any error has occurred. + */ +static bool twi_action_wait(nrf_drv_twi_t const * const p_instance) +{ + bool error; + bool done; + uint32_t timeout = 0; + transfer_t * p_transfer = &(m_cb[p_instance->instance_id].transfer); + + do + { + done = nrf_twi_event_check(p_instance->p_reg, p_transfer->end_event); + error = nrf_twi_event_check(p_instance->p_reg, NRF_TWI_EVENTS_ERROR); + error |= (++timeout < BUSY_LOOP_TIMEOUT) ? false : true; + } while (!(error | done)); + return !error; +} + +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); +} + +/** + * @brief Function for transferring data. + * + * @note Transmission will be stopped when error or timeout occurs. + * + * @param[in] p_instance TWI. + * @param[in] address Address of specific slave device (only 7 LSB). + * @param[in] p_data Pointer to a receive buffer. + * @param[in] length Number of bytes to be received. + * @param[in] xfer_pending After a specified number of bytes transmission will be + * suspended (if xfer_pending is set) or stopped (if not) + * @param[in] is_tx Indicate transfer direction (true for master to slave transmission). + * + * @retval NRF_SUCCESS If the procedure was successful. + * @retval NRF_ERROR_BUSY Driver is not ready for new transfer. + * @retval NRF_ERROR_INTERNAL NRF_TWI_EVENTS_ERROR or timeout has occured (only in blocking mode). + */ +static ret_code_t twi_transfer(nrf_drv_twi_t const * const p_instance, + uint8_t address, + uint8_t const * p_data, + uint32_t length, + bool xfer_pending, + bool is_tx) +{ + ASSERT(m_cb[p_instance->instance_id].state == NRF_DRV_STATE_POWERED_ON); + ASSERT(length > 0); + + control_block_t * p_cb = &m_cb[p_instance->instance_id]; + + bool is_busy = false; + CRITICAL_REGION_ENTER(); + if (p_cb->transfer_in_progress) + { + is_busy = true; + } + else + { + p_cb->transfer_in_progress = true; + } + CRITICAL_REGION_EXIT(); + if (is_busy) + { + return NRF_ERROR_BUSY; + } + + transfer_t * p_transfer = &p_cb->transfer; + p_transfer->address = address; + p_transfer->length = (uint16_t)length; + p_transfer->p_data = (uint8_t *)p_data; + p_transfer->count = 0; + p_transfer->xfer_pending = xfer_pending; + p_transfer->is_tx = is_tx; + p_transfer->error_condition = false; + + state_machine(p_instance, p_transfer->is_tx ? TX_ADDR_REQ : RX_ADDR_REQ); + + if (!m_handlers[p_instance->instance_id]) + { + // blocking mode + sm_evt_t evt = p_transfer->is_tx ? TX_DONE : RX_DONE; + do + { + if (twi_action_wait(p_instance) == false) + { + nrf_twi_event_clear(p_instance->p_reg, NRF_TWI_EVENTS_ERROR); + evt = ON_ERROR; + } + nrf_twi_event_clear(p_instance->p_reg, p_transfer->end_event); + state_machine(p_instance, evt); + + if (p_transfer->error_condition) + { + p_cb->transfer_in_progress = false; + return NRF_ERROR_INTERNAL; + } + } + while (p_transfer->count < p_transfer->length); + p_cb->transfer_in_progress = false; + } + return NRF_SUCCESS; +} + + +ret_code_t nrf_drv_twi_init(nrf_drv_twi_t const * const p_instance, + nrf_drv_twi_config_t const * p_config, + nrf_drv_twi_evt_handler_t event_handler, + void * p_context) +{ + if (m_cb[p_instance->instance_id].state != NRF_DRV_STATE_UNINITIALIZED) + { + return NRF_ERROR_INVALID_STATE; + } + + if (p_config == NULL) + { + p_config = &m_default_config[p_instance->instance_id]; + } + + + m_handlers[p_instance->instance_id] = event_handler; + mp_contexts[p_instance->instance_id] = p_context; + m_instances[p_instance->instance_id] = (nrf_drv_twi_t *)p_instance; + + 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; + + nrf_twi_frequency_set(p_instance->p_reg, p_config->frequency); + nrf_twi_pins_set(p_instance->p_reg, p_config->scl, p_config->sda); + + if (m_handlers[p_instance->instance_id]) + { + nrf_drv_common_irq_enable(p_instance->irq, p_config->interrupt_priority); + } + + m_cb[p_instance->instance_id].state = NRF_DRV_STATE_INITIALIZED; + + return NRF_SUCCESS; +} + + +void nrf_drv_twi_uninit(nrf_drv_twi_t const * const p_instance) +{ + ASSERT(m_cb[p_instance->instance_id].state != NRF_DRV_STATE_UNINITIALIZED); + + if (m_handlers[p_instance->instance_id]) + { + nrf_drv_common_irq_disable(p_instance->irq); + } + nrf_drv_twi_disable(p_instance); + nrf_twi_shorts_clear(p_instance->p_reg, DISABLE_MASK); + + m_cb[p_instance->instance_id].state = NRF_DRV_STATE_UNINITIALIZED; +} + + +void nrf_drv_twi_enable(nrf_drv_twi_t const * const p_instance) +{ + ASSERT(m_cb[p_instance->instance_id].state == NRF_DRV_STATE_INITIALIZED); + + nrf_twi_event_clear(p_instance->p_reg, NRF_TWI_EVENTS_STOPPED); + nrf_twi_event_clear(p_instance->p_reg, NRF_TWI_EVENTS_RXDREADY); + nrf_twi_event_clear(p_instance->p_reg, NRF_TWI_EVENTS_TXDSENT); + nrf_twi_event_clear(p_instance->p_reg, NRF_TWI_EVENTS_ERROR); + + if (m_handlers[p_instance->instance_id]) + { + nrf_twi_int_enable(p_instance->p_reg, NRF_TWI_INT_ERROR_MASK); + } + + nrf_twi_enable(p_instance->p_reg); + m_cb[p_instance->instance_id].state = NRF_DRV_STATE_POWERED_ON; + m_cb[p_instance->instance_id].substate = NRF_DRV_TWI_SUBSTATE_IDLE; +} + + +void nrf_drv_twi_disable(nrf_drv_twi_t const * const p_instance) +{ + ASSERT(m_cb[p_instance->instance_id].state != NRF_DRV_STATE_UNINITIALIZED); + + nrf_twi_task_set(p_instance->p_reg, NRF_TWI_TASKS_STOP); + nrf_twi_disable(p_instance->p_reg); + nrf_twi_int_disable(p_instance->p_reg, DISABLE_MASK); + m_cb[p_instance->instance_id].state = NRF_DRV_STATE_INITIALIZED; +} + + +ret_code_t nrf_drv_twi_tx(nrf_drv_twi_t const * const p_instance, + uint8_t address, + uint8_t const * p_data, + uint32_t length, + bool xfer_pending) +{ + return twi_transfer(p_instance, address, + p_data, length, + xfer_pending, true); +} + + +ret_code_t nrf_drv_twi_rx(nrf_drv_twi_t const * const p_instance, + uint8_t address, + uint8_t * p_data, + uint32_t length, + bool xfer_pending) +{ + return twi_transfer(p_instance, address, + p_data, length, + xfer_pending, false); +} + + +uint32_t nrf_drv_twi_data_count_get(nrf_drv_twi_t const * const p_instance) +{ + volatile transfer_t * p_transfer = &(m_cb[p_instance->instance_id].transfer); + + return p_transfer->count; +} + + +/**@brief Generic function for handling TWI interrupt + * + * @param[in] p_reg Pointer to instance register structure. + * @param[in] instance_id Index of instance. + */ +__STATIC_INLINE void nrf_drv_twi_int_handler(NRF_TWI_Type * p_reg, uint32_t instance_id) +{ + control_block_t * p_cb = &m_cb[instance_id]; + transfer_t * p_transfer = &p_cb->transfer; + sm_evt_t sm_event; + + bool error_occured = nrf_twi_event_check(p_reg, NRF_TWI_EVENTS_ERROR); + bool end_evt_occured = nrf_twi_event_check(p_reg, p_transfer->end_event); + + nrf_twi_event_clear(p_reg, NRF_TWI_EVENTS_ERROR); + nrf_twi_event_clear(p_reg, NRF_TWI_EVENTS_TXDSENT); + nrf_twi_event_clear(p_reg, NRF_TWI_EVENTS_RXDREADY); + nrf_twi_event_clear(p_reg, NRF_TWI_EVENTS_STOPPED); + + if (error_occured || end_evt_occured) + { + if (error_occured) + { + sm_event = ON_ERROR; + } + else + { + sm_event = p_transfer->is_tx ? TX_DONE : RX_DONE; + } + state_machine(m_instances[instance_id], sm_event); + + if (p_transfer->error_condition) + { + p_cb->transfer_in_progress = false; + nrf_drv_twi_evt_t evt = + { + .type = NRF_DRV_TWI_ERROR, + .p_data = p_transfer->p_data, + .length = p_transfer->count, + // Driver uses shortcuts, so NRF_TWI_ERROR_OVERRUN_NACK will not take place. + .error_src = (nrf_twi_error_source_get(p_reg) & + NRF_TWI_ERROR_ADDRESS_NACK) ? NRF_TWI_ERROR_ADDRESS_NACK + : NRF_TWI_ERROR_DATA_NACK, + }; + m_handlers[instance_id](&evt, mp_contexts[instance_id]); + } + else if (p_transfer->count >= p_transfer->length) + { + p_cb->transfer_in_progress = false; + nrf_drv_twi_evt_t evt = + { + .type = p_transfer->is_tx ? NRF_DRV_TWI_TX_DONE : NRF_DRV_TWI_RX_DONE, + .p_data = p_transfer->p_data, + .length = p_transfer->count, + }; + m_handlers[instance_id](&evt, mp_contexts[instance_id]); + } + } +} + + +#if (TWI0_ENABLED == 1) +void SPI0_TWI0_IRQHandler(void) +{ + nrf_drv_twi_int_handler(NRF_TWI0, TWI0_INSTANCE_INDEX); +} +#endif // (TWI0_ENABLED == 1) + +#if (TWI1_ENABLED == 1) +void SPI1_TWI1_IRQHandler(void) +{ + nrf_drv_twi_int_handler(NRF_TWI1, TWI1_INSTANCE_INDEX); +} +#endif // (TWI1_ENABLED == 1) diff --git a/components/drivers_nrf/twi_master/nrf_drv_twi.h b/components/drivers_nrf/twi_master/nrf_drv_twi.h new file mode 100644 index 0000000..2c374d2 --- /dev/null +++ b/components/drivers_nrf/twi_master/nrf_drv_twi.h @@ -0,0 +1,227 @@ +/* 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. + * + */ + +#ifndef NRF_DRV_TWI_H__ +#define NRF_DRV_TWI_H__ + +#include "nordic_common.h" +#include "nrf_drv_config.h" +#include "nrf_drv_common.h" +#include "nrf_twi.h" +#include "sdk_errors.h" + +#define TWI0_IRQ SPI0_TWI0_IRQn +#define TWI1_IRQ SPI1_TWI1_IRQn + +/** + * + * @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 TWIM HAL provides basic APIs for accessing the registers of the TWI. + * The TWIM master driver provides APIs on a higher level. + * + * @defgroup nrf_twi_drv TWI master driver + * @{ + * @ingroup nrf_twi_master + * @brief Driver for managing the TWI. + */ + +/**@brief TWI events. */ +typedef enum +{ + NRF_DRV_TWI_RX_DONE, + NRF_DRV_TWI_TX_DONE, + NRF_DRV_TWI_ERROR +} nrf_drv_twi_evt_type_t; + +/**@brief Structure for a TWI event. */ +typedef struct +{ + nrf_drv_twi_evt_type_t type; /**< Event type. */ + uint8_t * p_data; /**< Pointer to transferred data. */ + uint32_t length; /**< Number of bytes transferred. */ + nrf_twi_error_t error_src; /**< TWI error source (valid only for NRF_DRV_TWI_ERROR event). */ +} nrf_drv_twi_evt_t; + +/**@brief TWI driver instance structure. */ +typedef struct +{ + NRF_TWI_Type * p_reg; /**< Pointer to the instance register set. */ + IRQn_Type irq; /**< Instance IRQ ID. */ + uint8_t instance_id; /**< Instance index. */ +} nrf_drv_twi_t; + +/**@brief Macro for creating a TWI driver instance.*/ +#define NRF_DRV_TWI_INSTANCE(id) \ +{ \ + .p_reg = CONCAT_2(NRF_TWI, id), \ + .irq = CONCAT_3(TWI, id, _IRQ), \ + .instance_id = CONCAT_3(TWI, id, _INSTANCE_INDEX) \ +} + +/**@brief Structure for TWI instance configuration. */ +typedef struct +{ + uint32_t scl; /**< SCL pin number. */ + uint32_t sda; /**< SDA pin number. */ + nrf_twi_frequency_t frequency; /**< Frequency. */ + uint8_t interrupt_priority; /**< Interrupt priority. */ +} nrf_drv_twi_config_t; + +/**@brief TWI 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) \ +} + +/**@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 pointer, passed to event handler. + * + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR_INVALID_STATE If the driver is in invalid state. + */ +ret_code_t nrf_drv_twi_init(nrf_drv_twi_t const * 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. + * + * @param[in] p_instance TWI instance. + */ +void nrf_drv_twi_uninit(nrf_drv_twi_t const * 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 * 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 * const p_instance); + +/** + * @brief Function for sending data to a TWI slave. + * + * The transmission will be stopped when an error or time-out occurs. + * + * @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] xfer_pending After a specified number of bytes, transmission will + * be suspended (if xfer_pending is set) or stopped (if not). + * + * @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 @ref NRF_TWI_EVENTS_ERROR or a time-out has occurred (only in blocking mode). + */ +ret_code_t nrf_drv_twi_tx(nrf_drv_twi_t const * const p_instance, + uint8_t address, + uint8_t const * p_data, + uint32_t length, + bool xfer_pending); + +/** + * @brief Function for reading data from a TWI slave. + * + * Transmission will be stopped when error or time-out occurs. + * + * @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. + * @param[in] xfer_pending After a specified number of bytes, transmission will + * be suspended (if xfer_pending is set) or stopped (if not). + * + * @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 @ref NRF_TWI_EVENTS_ERROR or a time-out has occured (only in blocking mode). + */ +ret_code_t nrf_drv_twi_rx(nrf_drv_twi_t const * const p_instance, + uint8_t address, + uint8_t * p_data, + uint32_t length, + bool xfer_pending); + +/** + * @brief Function for getting transferred data count. + * + * @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 specific TWI task. + * + * @param[in] p_instance TWI instance. + * @param[in] task Task. + * + * @return Task address. + */ +__STATIC_INLINE uint32_t nrf_drv_twi_task_address_get(nrf_drv_twi_t const * const p_instance, + nrf_twi_tasks_t task); + +/** + * @brief Function for returning the address of a specific TWI event. + * + * @param[in] p_instance TWI instance. + * @param[in] event Event. + * + * @return Event address. + */ +__STATIC_INLINE uint32_t nrf_drv_twi_event_address_get(nrf_drv_twi_t const * const p_instance, + nrf_twi_events_t event); + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION +__STATIC_INLINE uint32_t nrf_drv_twi_task_address_get(nrf_drv_twi_t const * const p_instance, + nrf_twi_tasks_t task) +{ + return (uint32_t)nrf_twi_task_address_get(p_instance->p_reg, task); +} + +__STATIC_INLINE uint32_t nrf_drv_twi_event_address_get(nrf_drv_twi_t const * const p_instance, + nrf_twi_events_t event) +{ + return (uint32_t)nrf_twi_event_address_get(p_instance->p_reg, event); +} +#endif // SUPPRESS_INLINE_IMPLEMENTATION +/** + *@} + **/ + +#endif // NRF_DRV_TWI_H__ diff --git a/components/drivers_nrf/uart/nrf_drv_uart.c b/components/drivers_nrf/uart/nrf_drv_uart.c new file mode 100644 index 0000000..164259c --- /dev/null +++ b/components/drivers_nrf/uart/nrf_drv_uart.c @@ -0,0 +1,683 @@ +/* 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 "nrf_drv_uart.h" +#include "nrf_assert.h" +#include "nordic_common.h" +#include "nrf_drv_common.h" +#include "nrf_gpio.h" +#include "app_util_platform.h" + +// This set of macros makes it possible to exclude parts of code, when one type +// of supported peripherals is not used. +#ifdef NRF51 +#define UART_IN_USE +#elif defined(NRF52) +#if (UART_EASY_DMA_SUPPORT == 1) +#define UARTE_IN_USE +#endif +#if (UART_LEGACY_SUPPORT == 1) +#define UART_IN_USE +#endif +#endif + + +#if (defined(UARTE_IN_USE) && defined(UART_IN_USE)) + // UARTE and UART combined + #define CODE_FOR_UARTE(code) if (m_cb.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_UART(code) +#elif (!defined(UARTE_IN_USE) && defined(UART_IN_USE)) + // UART only + #define CODE_FOR_UARTE(code) + #define CODE_FOR_UART(code) { code } +#else + #error "Wrong configuration." +#endif + +#ifndef IS_EASY_DMA_RAM_ADDRESS + #define IS_EASY_DMA_RAM_ADDRESS(addr) (((uint32_t)addr & 0xFFFF0000) == 0x20000000) +#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; + volatile uint16_t tx_counter; + uint8_t tx_buffer_length; + uint8_t rx_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; +static const nrf_drv_uart_config_t m_default_config = NRF_DRV_UART_DEFAULT_CONFIG; + +__STATIC_INLINE void apply_config(nrf_drv_uart_config_t const * p_config) +{ + nrf_gpio_cfg_output(p_config->pseltxd); + nrf_gpio_pin_set(p_config->pseltxd); + nrf_gpio_cfg_input(p_config->pselrxd, NRF_GPIO_PIN_NOPULL); + + CODE_FOR_UARTE( + nrf_uarte_baudrate_set(NRF_UARTE0, (nrf_uarte_baudrate_t)p_config->baudrate); + nrf_uarte_configure(NRF_UARTE0, (nrf_uarte_parity_t)p_config->parity, + (nrf_uarte_hwfc_t)p_config->hwfc); + nrf_uarte_txrx_pins_set(NRF_UARTE0, p_config->pseltxd, p_config->pselrxd); + if (p_config->hwfc == NRF_UART_HWFC_ENABLED) + { + nrf_gpio_cfg_input(p_config->pselcts, NRF_GPIO_PIN_NOPULL); + nrf_gpio_cfg_output(p_config->pselrts); + nrf_gpio_pin_set(p_config->pselrts); + nrf_uarte_hwfc_pins_set(NRF_UARTE0, p_config->pselrts, p_config->pselcts); + } + ) + CODE_FOR_UART( + nrf_uart_baudrate_set(NRF_UART0, p_config->baudrate); + nrf_uart_configure(NRF_UART0, p_config->parity, p_config->hwfc); + nrf_uart_txrx_pins_set(NRF_UART0, p_config->pseltxd, p_config->pselrxd); + if (p_config->hwfc == NRF_UART_HWFC_ENABLED) + { + nrf_gpio_cfg_input(p_config->pselcts, NRF_GPIO_PIN_NOPULL); + nrf_gpio_cfg_output(p_config->pselrts); + nrf_gpio_pin_set(p_config->pselrts); + nrf_uart_hwfc_pins_set(NRF_UART0, p_config->pselrts, p_config->pselcts); + } + ) +} + +__STATIC_INLINE void interrupts_enable(uint8_t interrupt_priority) +{ + CODE_FOR_UARTE( + nrf_uarte_int_enable(NRF_UARTE0, NRF_UARTE_INT_ENDRX_MASK | + NRF_UARTE_INT_ENDTX_MASK | + NRF_UARTE_INT_ERROR_MASK | + NRF_UARTE_INT_RXTO_MASK); + ) + CODE_FOR_UART( + nrf_uart_int_enable(NRF_UART0, NRF_UART_INT_MASK_TXDRDY | + NRF_UART_INT_MASK_RXTO); + ) + nrf_drv_common_irq_enable(UART0_IRQn, interrupt_priority); +} + +__STATIC_INLINE void interrupts_disable(void) +{ + CODE_FOR_UARTE + ( + nrf_uarte_int_disable(NRF_UARTE0, NRF_UARTE_INT_ENDRX_MASK | + NRF_UARTE_INT_ENDTX_MASK | + NRF_UARTE_INT_ERROR_MASK | + NRF_UARTE_INT_RXTO_MASK); + ) + CODE_FOR_UART + ( + nrf_uart_int_disable(NRF_UART0, 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(UART0_IRQn); +} + +__STATIC_INLINE void pins_to_default(void) +{ + /* 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(NRF_UARTE0); + rxd = nrf_uarte_rx_pin_get(NRF_UARTE0); + rts = nrf_uarte_rts_pin_get(NRF_UARTE0); + cts = nrf_uarte_cts_pin_get(NRF_UARTE0); + nrf_uarte_txrx_pins_disconnect(NRF_UARTE0); + nrf_uarte_hwfc_pins_disconnect(NRF_UARTE0); + ) + CODE_FOR_UART + ( + txd = nrf_uart_tx_pin_get(NRF_UART0); + rxd = nrf_uart_rx_pin_get(NRF_UART0); + rts = nrf_uart_rts_pin_get(NRF_UART0); + cts = nrf_uart_cts_pin_get(NRF_UART0); + nrf_uart_txrx_pins_disconnect(NRF_UART0); + nrf_uart_hwfc_pins_disconnect(NRF_UART0); + ) + + nrf_gpio_cfg_default(txd); + 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(void) +{ + CODE_FOR_UARTE(nrf_uarte_enable(NRF_UARTE0);) + CODE_FOR_UART(nrf_uart_enable(NRF_UART0);); +} + +__STATIC_INLINE void uart_disable(void) +{ + CODE_FOR_UARTE(nrf_uarte_disable(NRF_UARTE0);) + CODE_FOR_UART(nrf_uart_disable(NRF_UART0);); +} + +ret_code_t nrf_drv_uart_init(nrf_drv_uart_config_t const * p_config, + nrf_uart_event_handler_t event_handler) +{ + if (m_cb.state != NRF_DRV_STATE_UNINITIALIZED) + { + return NRF_ERROR_INVALID_STATE; + } + + if (p_config == NULL) + { + p_config = &m_default_config; + } +#ifdef NRF52 + m_cb.use_easy_dma = p_config->use_easy_dma; +#endif + apply_config(p_config); + + m_cb.handler = event_handler; + m_cb.p_context = p_config->p_context; + + if (m_cb.handler) + { + interrupts_enable(p_config->interrupt_priority); + } + + uart_enable(); + m_cb.rx_buffer_length = 0; + m_cb.tx_buffer_length = 0; + m_cb.state = NRF_DRV_STATE_INITIALIZED; + m_cb.rx_enabled = false; + return NRF_SUCCESS; +} + +void nrf_drv_uart_uninit(void) +{ + uart_disable(); + + if (m_cb.handler) + { + interrupts_disable(); + } + + pins_to_default(); + + m_cb.state = NRF_DRV_STATE_UNINITIALIZED; + m_cb.handler = NULL; +} + +__STATIC_INLINE void tx_byte(void) +{ + nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_TXDRDY); + uint8_t txd = m_cb.p_tx_buffer[m_cb.tx_counter]; + m_cb.tx_counter++; + nrf_uart_txd_set(NRF_UART0, txd); +} + +#include "nrf_gpio.h" +ret_code_t nrf_drv_uart_tx(uint8_t const * const p_data, uint8_t length) +{ + ASSERT(m_cb.state == NRF_DRV_STATE_INITIALIZED); + ASSERT(length>0); + ASSERT(p_data); + + ret_code_t err_code = NRF_SUCCESS; + + //critical section begin + if (m_cb.tx_buffer_length != 0) + { + return NRF_ERROR_BUSY; + } + //critical section end + m_cb.tx_buffer_length = length; + m_cb.p_tx_buffer = p_data; + m_cb.tx_counter = 0; + + CODE_FOR_UARTE + ( + // EasyDMA requires that transfer buffers are placed in DataRAM, + // signal error if the are not. + if (!IS_EASY_DMA_RAM_ADDRESS(p_data)) + { + return NRF_ERROR_INVALID_ADDR; + } + nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_ENDTX); + nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_TXSTOPPED); + nrf_uarte_tx_buffer_set(NRF_UARTE0, p_data, length); + nrf_uarte_task_trigger(NRF_UARTE0, NRF_UARTE_TASK_STARTTX); + + if (m_cb.handler == NULL) + { + bool endtx; + bool txstopped; + do { + endtx = nrf_uarte_event_check(NRF_UARTE0, NRF_UARTE_EVENT_ENDTX); + txstopped = nrf_uarte_event_check(NRF_UARTE0, NRF_UARTE_EVENT_TXSTOPPED); + }while ((endtx == false) && (txstopped == false)); + + nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_ENDTX); + nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_TXSTOPPED); + if (txstopped) + { + err_code = NRF_ERROR_FORBIDDEN; + } + m_cb.tx_buffer_length = 0; + } + ) + CODE_FOR_UART + ( + nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_TXDRDY); + nrf_uart_task_trigger(NRF_UART0, NRF_UART_TASK_STARTTX); + + tx_byte(); + + if (m_cb.handler == NULL) + { + while ((uint16_t) m_cb.tx_buffer_length > m_cb.tx_counter) { + while (!nrf_uart_event_check(NRF_UART0, NRF_UART_EVENT_TXDRDY) && + m_cb.tx_counter != TX_COUNTER_ABORT_REQ_VALUE) {} + if (m_cb.tx_counter != TX_COUNTER_ABORT_REQ_VALUE) + { + tx_byte(); + } + } + + if (m_cb.tx_counter == TX_COUNTER_ABORT_REQ_VALUE) + { + err_code = NRF_ERROR_FORBIDDEN; + } + else + { + while (!nrf_uart_event_check(NRF_UART0, NRF_UART_EVENT_TXDRDY)) {} + nrf_uart_task_trigger(NRF_UART0, NRF_UART_TASK_STOPTX); + } + m_cb.tx_buffer_length = 0; + } + ) + + return err_code; +} + +__STATIC_INLINE void rx_byte(void) +{ + nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_RXDRDY); + m_cb.p_rx_buffer[m_cb.rx_counter] = nrf_uart_rxd_get(NRF_UART0); + m_cb.rx_counter++; +} + +__STATIC_INLINE void rx_enable(void) +{ + nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_ERROR); + nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_RXDRDY); + nrf_uart_task_trigger(NRF_UART0, NRF_UART_TASK_STARTRX); +} +ret_code_t nrf_drv_uart_rx(uint8_t * p_data, uint8_t length) +{ + ASSERT(m_cb.state == NRF_DRV_STATE_INITIALIZED); + ASSERT(length>0); + + //critical section begin + if (m_cb.rx_buffer_length != 0) + { + return NRF_ERROR_BUSY; + } + //critical section end + m_cb.rx_buffer_length = length; + m_cb.p_rx_buffer = p_data; + m_cb.rx_counter = 0; + + CODE_FOR_UARTE + ( + // EasyDMA requires that transfer buffers are placed in DataRAM, + // signal error if the are not. + if (!IS_EASY_DMA_RAM_ADDRESS(p_data)) + { + return NRF_ERROR_INVALID_ADDR; + } + nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_ENDRX); + nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_RXTO); + nrf_uarte_rx_buffer_set(NRF_UARTE0, p_data, length); + nrf_uarte_task_trigger(NRF_UARTE0, NRF_UARTE_TASK_STARTRX); + + if (m_cb.handler == NULL) + { + bool endrx; + bool rxto; + bool error; + do { + endrx = nrf_uarte_event_check(NRF_UARTE0, NRF_UARTE_EVENT_ENDRX); + rxto = nrf_uarte_event_check(NRF_UARTE0, NRF_UARTE_EVENT_RXTO); + error = nrf_uarte_event_check(NRF_UARTE0, NRF_UARTE_EVENT_ERROR); + }while ((endrx == false) && (rxto == false) && (error == false)); + + nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_ENDRX); + nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_RXTO); + nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_ERROR); + m_cb.rx_buffer_length = 0; + + if (error) + { + return NRF_ERROR_INTERNAL; + } + + if (rxto) + { + return NRF_ERROR_FORBIDDEN; + } + } + ) + CODE_FOR_UART + ( + if (!m_cb.rx_enabled) + { + rx_enable(); + } + if (m_cb.handler == NULL) + { + bool rxrdy; + bool rxto; + bool error; + do { + do + { + error = nrf_uart_event_check(NRF_UART0, NRF_UART_EVENT_ERROR); + rxrdy = nrf_uart_event_check(NRF_UART0, NRF_UART_EVENT_RXDRDY); + rxto = nrf_uart_event_check(NRF_UART0, NRF_UART_EVENT_RXTO); + } while ((rxrdy == false) && (rxto == false) && (error == false)); + + if (error || rxto) + { + break; + } + rx_byte(); + } while (m_cb.rx_buffer_length > m_cb.rx_counter); + + nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_RXTO); + nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_ERROR); + + m_cb.rx_buffer_length = 0; + if (error) + { + return NRF_ERROR_INTERNAL; + } + + if (rxto) + { + return NRF_ERROR_FORBIDDEN; + } + + if (m_cb.rx_enabled) + { + nrf_uart_task_trigger(NRF_UART0, NRF_UART_TASK_STARTRX); + } + else + { + // Skip stopping RX if driver is forced to be enabled. + nrf_uart_task_trigger(NRF_UART0, NRF_UART_TASK_STOPRX); + } + } + else + { + nrf_uart_int_enable(NRF_UART0, NRF_UART_INT_MASK_RXDRDY | NRF_UART_INT_MASK_ERROR); + } + ) + + return NRF_SUCCESS; +} + +void nrf_drv_uart_rx_enable(void) +{ + //Easy dma mode does not support enabling receiver without setting up buffer. + CODE_FOR_UARTE + ( + ASSERT(!m_cb.use_easy_dma); + ) + + if (!m_cb.rx_enabled) + { + rx_enable(); + m_cb.rx_enabled = true; + } +} + +void nrf_drv_uart_rx_disable(void) +{ + //Easy dma mode does not support enabling receiver without setting up buffer. + CODE_FOR_UARTE + ( + ASSERT(!m_cb.use_easy_dma); + ) + + nrf_uart_task_trigger(NRF_UART0, NRF_UART_TASK_STOPRX); + m_cb.rx_enabled = false; +} + +uint32_t nrf_drv_uart_errorsrc_get(void) +{ + uint32_t errsrc; + CODE_FOR_UARTE + ( + nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_ERROR); + errsrc = nrf_uarte_errorsrc_get_and_clear(NRF_UARTE0); + ) + CODE_FOR_UART + ( + nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_ERROR); + errsrc = nrf_uart_errorsrc_get_and_clear(NRF_UART0); + ) + return errsrc; +} + +__STATIC_INLINE void rx_done_event(uint8_t bytes) +{ + nrf_drv_uart_event_t event; + + event.type = NRF_DRV_UART_EVT_RX_DONE; + event.data.rxtx.bytes = bytes; + event.data.rxtx.p_data = m_cb.p_rx_buffer; + + m_cb.rx_buffer_length = 0; + + m_cb.handler(&event,m_cb.p_context); +} + +__STATIC_INLINE void tx_done_event(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 *)m_cb.p_tx_buffer; + + m_cb.tx_buffer_length = 0; + + m_cb.handler(&event,m_cb.p_context); +} + +void nrf_drv_uart_tx_abort(void) +{ + CODE_FOR_UARTE( + nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_TXSTOPPED); + nrf_uarte_task_trigger(NRF_UARTE0, NRF_UARTE_TASK_STOPTX); + if (m_cb.handler == NULL) + { + while(!nrf_uarte_event_check(NRF_UARTE0, NRF_UARTE_EVENT_TXSTOPPED)); + } + ) + CODE_FOR_UART( + nrf_uart_task_trigger(NRF_UART0, NRF_UART_TASK_STOPTX); + if (m_cb.handler) + { + tx_done_event(m_cb.tx_counter); + } + else + { + m_cb.tx_counter = TX_COUNTER_ABORT_REQ_VALUE; + } + ) +} + +void nrf_drv_uart_rx_abort(void) +{ + CODE_FOR_UARTE( + nrf_uarte_task_trigger(NRF_UARTE0, NRF_UARTE_TASK_STOPRX); + ) + CODE_FOR_UART( + nrf_uart_int_disable(NRF_UART0, NRF_UART_INT_MASK_RXDRDY | NRF_UART_INT_MASK_ERROR); + nrf_uart_task_trigger(NRF_UART0, NRF_UART_TASK_STOPRX); + ) +} + +void UART0_IRQHandler(void) +{ + CODE_FOR_UARTE + ( + if (nrf_uarte_event_check(NRF_UARTE0, NRF_UARTE_EVENT_ERROR)) + { + nrf_drv_uart_event_t event; + + nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_ERROR); + + event.type = NRF_DRV_UART_EVT_ERROR; + event.data.error.error_mask = nrf_uarte_errorsrc_get_and_clear(NRF_UARTE0); + event.data.error.rxtx.bytes = nrf_uarte_rx_amount_get(NRF_UARTE0); + event.data.error.rxtx.p_data = m_cb.p_rx_buffer; + + //abort transfer + m_cb.rx_buffer_length = 0; + + m_cb.handler(&event,m_cb.p_context); + } + else if (nrf_uarte_event_check(NRF_UARTE0, NRF_UARTE_EVENT_ENDRX)) + { + nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_ENDRX); + uint8_t amount = nrf_uarte_rx_amount_get(NRF_UARTE0); + if (amount == m_cb.rx_buffer_length) + { + rx_done_event(amount); + } + } + + if (nrf_uarte_event_check(NRF_UARTE0, NRF_UARTE_EVENT_RXTO)) + { + nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_RXTO); + if (m_cb.rx_buffer_length) + { + rx_done_event(nrf_uarte_rx_amount_get(NRF_UARTE0)); + } + } + + if (nrf_uarte_event_check(NRF_UARTE0, NRF_UARTE_EVENT_ENDTX)) + { + nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_ENDTX); + if (m_cb.tx_buffer_length) + { + tx_done_event(nrf_uarte_tx_amount_get(NRF_UARTE0)); + } + } + ) + CODE_FOR_UART( + if (nrf_uart_int_enable_check(NRF_UART0, NRF_UART_INT_MASK_ERROR) && + nrf_uart_event_check(NRF_UART0, NRF_UART_EVENT_ERROR)) + { + nrf_drv_uart_event_t event; + + nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_ERROR); + nrf_uart_int_disable(NRF_UART0, NRF_UART_INT_MASK_RXDRDY | NRF_UART_INT_MASK_ERROR); + if (!m_cb.rx_enabled) + { + nrf_uart_task_trigger(NRF_UART0, NRF_UART_TASK_STOPRX); + } + event.type = NRF_DRV_UART_EVT_ERROR; + event.data.error.error_mask = nrf_uart_errorsrc_get_and_clear(NRF_UART0); + event.data.error.rxtx.bytes = m_cb.rx_buffer_length; + event.data.error.rxtx.p_data = m_cb.p_rx_buffer; + + //abort transfer + m_cb.rx_buffer_length = 0; + + m_cb.handler(&event,m_cb.p_context); + + } + else if (nrf_uart_int_enable_check(NRF_UART0, NRF_UART_INT_MASK_RXDRDY) && + nrf_uart_event_check(NRF_UART0, NRF_UART_EVENT_RXDRDY)) + { + rx_byte(); + if (m_cb.rx_buffer_length == m_cb.rx_counter) + { + if (!m_cb.rx_enabled) + { + nrf_uart_task_trigger(NRF_UART0, NRF_UART_TASK_STOPRX); + } + nrf_uart_int_disable(NRF_UART0, NRF_UART_INT_MASK_RXDRDY | NRF_UART_INT_MASK_ERROR); + rx_done_event(m_cb.rx_counter); + } + } + + if (nrf_uart_event_check(NRF_UART0, NRF_UART_EVENT_TXDRDY)) + { + if ((m_cb.tx_buffer_length > m_cb.tx_counter)) + { + tx_byte(); + } + else + { + nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_TXDRDY); + if (m_cb.tx_buffer_length) + { + tx_done_event(m_cb.tx_buffer_length); + } + } + } + if (nrf_uart_event_check(NRF_UART0, NRF_UART_EVENT_RXTO)) + { + nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_RXTO); + + // RXTO event may be triggered as a result of abort call. In th + if (m_cb.rx_enabled) + { + nrf_uart_task_trigger(NRF_UART0, NRF_UART_TASK_STARTRX); + } + if (m_cb.rx_buffer_length) + { + rx_done_event(m_cb.rx_counter); + } + } + ) +} diff --git a/components/drivers_nrf/uart/nrf_drv_uart.h b/components/drivers_nrf/uart/nrf_drv_uart.h new file mode 100644 index 0000000..b5be64b --- /dev/null +++ b/components/drivers_nrf/uart/nrf_drv_uart.h @@ -0,0 +1,269 @@ +/* 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_uart UART driver and HAL + * @ingroup nrf_drivers + * @brief UART API. + * @details The UART driver provides APIs for utilizing 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 NRF52 +#include "nrf_uarte.h" +#endif + +#include "sdk_errors.h" +#include "nrf_drv_config.h" + +/** + * @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 NRF52 + bool use_easy_dma; +#endif +} nrf_drv_uart_config_t; + +/**@brief UART default configuration. */ +#ifdef NRF52 +#define NRF_DRV_UART_DEFAULT_CONFIG \ + { \ + .pseltxd = UART0_CONFIG_PSEL_TXD, \ + .pselrxd = UART0_CONFIG_PSEL_RXD, \ + .pselcts = UART0_CONFIG_PSEL_CTS, \ + .pselrts = UART0_CONFIG_PSEL_RTS, \ + .p_context = NULL, \ + .hwfc = UART0_CONFIG_HWFC, \ + .parity = UART0_CONFIG_PARITY, \ + .baudrate = UART0_CONFIG_BAUDRATE, \ + .interrupt_priority = UART0_CONFIG_IRQ_PRIORITY, \ + .use_easy_dma = UART0_CONFIG_USE_EASY_DMA \ + } +#else +#define NRF_DRV_UART_DEFAULT_CONFIG \ + { \ + .pseltxd = UART0_CONFIG_PSEL_TXD, \ + .pselrxd = UART0_CONFIG_PSEL_RXD, \ + .pselcts = UART0_CONFIG_PSEL_CTS, \ + .pselrts = UART0_CONFIG_PSEL_RTS, \ + .p_context = NULL, \ + .hwfc = UART0_CONFIG_HWFC, \ + .parity = UART0_CONFIG_PARITY, \ + .baudrate = UART0_CONFIG_BAUDRATE, \ + .interrupt_priority = UART0_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_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_config_t const * p_config, + nrf_uart_event_handler_t event_handler); + +/** + * @brief Function for uninitializing the UART driver. + */ +void nrf_drv_uart_uninit(void); + +/** + * @brief Function for getting the address of a specific UART task. + * + * @param[in] task Task. + * + * @retval Task address. + */ +__STATIC_INLINE uint32_t nrf_drv_uart_task_address_get(nrf_uart_task_t task); + +/** + * @brief Function for getting the address of a specific UART event. + * + * @param[in] event Event. + * + * @retval Event address. + */ +__STATIC_INLINE uint32_t nrf_drv_uart_event_address_get(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_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_INVALID_ADDR If p_data does not point to RAM buffer (UARTE only). + * @retval NRF_ERROR_FORBIDDEN If transfer was aborted (blocking mode only). + */ +ret_code_t nrf_drv_uart_tx(uint8_t const * const p_data, uint8_t length); + +/** + * @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. + */ +void nrf_drv_uart_tx_abort(void); + +/** + * @brief Function for receiving 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_data Pointer to data. + * @param[in] length Number of bytes to receive. + * + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR_BUSY If driver is already receiving. + * @retval NRF_ERROR_INVALID_ADDR If p_data does not point to RAM buffer (UARTE only). + * @retval NRF_ERROR_FORBIDDEN If transfer was aborted (blocking mode only). + */ +ret_code_t nrf_drv_uart_rx(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. + */ +void nrf_drv_uart_rx_enable(void); + +/** + * @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. + */ +void nrf_drv_uart_rx_disable(void); + +/** + * @brief Function for aborting any ongoing reception. + * @note @ref NRF_DRV_UART_EVT_RX_DONE event will be generated in non-blocking mode. Event will + * contain number of bytes received 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. + */ +void nrf_drv_uart_rx_abort(void); + +/** + * @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. + * + * @retval Mask of reported errors. + */ +uint32_t nrf_drv_uart_errorsrc_get(void); + +#ifndef SUPPRESS_INLINE_IMPLEMENTATION +__STATIC_INLINE uint32_t nrf_drv_uart_task_address_get(nrf_uart_task_t task) +{ + return nrf_uart_task_address_get(NRF_UART0, task); +} + +__STATIC_INLINE uint32_t nrf_drv_uart_event_address_get(nrf_uart_event_t event) +{ + return nrf_uart_event_address_get(NRF_UART0, event); +} +#endif //SUPPRESS_INLINE_IMPLEMENTATION +#endif //NRF_DRV_UART_H +/** @} */ diff --git a/components/drivers_nrf/wdt/nrf_drv_wdt.c b/components/drivers_nrf/wdt/nrf_drv_wdt.c new file mode 100644 index 0000000..7f021b6 --- /dev/null +++ b/components/drivers_nrf/wdt/nrf_drv_wdt.c @@ -0,0 +1,118 @@ +/* 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 "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 + +/**@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); + m_wdt_event_handler = wdt_event_handler; + + if (m_state == NRF_DRV_STATE_UNINITIALIZED) + { + m_state = NRF_DRV_STATE_INITIALIZED; + } + else + { + return NRF_ERROR_INVALID_STATE; // WDT already initialized + } + + 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); + + return NRF_SUCCESS; +} + + +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; +} + + +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(); + 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); +} diff --git a/components/drivers_nrf/wdt/nrf_drv_wdt.h b/components/drivers_nrf/wdt/nrf_drv_wdt.h new file mode 100644 index 0000000..194b40b --- /dev/null +++ b/components/drivers_nrf/wdt/nrf_drv_wdt.h @@ -0,0 +1,121 @@ +/* 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. + * + */ + +/**@file + * @addtogroup nrf_wdt WDT HAL and driver + * @ingroup nrf_drivers + * @defgroup lib_driver_wdt WDT driver + * @{ + * @ingroup nrf_wdt + * + * @brief WDT driver. + */ + +#ifndef NRF_DRV_WDT_H__ +#define NRF_DRV_WDT_H__ + +#include +#include +#include "sdk_errors.h" +#include "nrf_wdt.h" +#include "nrf_drv_config.h" + +/**@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 = 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, NRF_ERROR_INVALID_STATE if module ws already initialized. + */ +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); +} +#endif + +/** @} */ diff --git a/components/libraries/ant_fs/antfs.c b/components/libraries/ant_fs/antfs.c new file mode 100644 index 0000000..1e33d84 --- /dev/null +++ b/components/libraries/ant_fs/antfs.c @@ -0,0 +1,2339 @@ +/* +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 Dynastream Innovations Inc. 2012 +All rights reserved. +*/ + +#include "antfs.h" +#include +#include "defines.h" +#include "app_error.h" +#include "app_timer.h" +#include "ant_error.h" +#include "ant_parameters.h" +#include "ant_interface.h" +#include "crc.h" +#include "app_util.h" + +#ifdef LEDDRIVER_ACTIVE + #include "bsp.h" +#endif // LEDDRIVER_ACTIVE + +#define BURST_PACKET_SIZE 8u /**< The burst packet size. */ +#define ANTFS_NETWORK_KEY {0,0,0,0,0,0,0,0} /**< The used ANT-FS network key. */ + +#define ANTFS_CONNECTION_TYPE_OFFSET 0x00u /**< The connection type offset within ANT-FS message. */ +#define ANTFS_COMMAND_OFFSET 0x01u /**< The command offset within ANT-FS message. */ +#define ANTFS_RESPONSE_OFFSET 0x01u /**< The response offset within ANT-FS message. */ + +#define ANTFS_CONTROL_OFFSET 0x02u /**< The control offset within ANT-FS message. */ +#define ANTFS_DATA_OFFSET 0x03u /**< The data offset within ANT-FS message. */ + +#define ANTFS_BEACON_ID 0x43u /**< The ANT-FS beacon ID. */ +#define ANTFS_COMMAND_ID 0x44u /**< The ANT-FS command ID. */ + +// Beacon definitions. +#define STATUS1_OFFSET 0x01u /**< The beacon status1 field offset. */ +#define STATUS2_OFFSET 0x02u /**< The beacon status2 field offset. */ + #define DEVICE_STATE_SHIFT 0x00u /**< Shift value for device state bitfield. */ + #define DEVICE_STATE_MASK (0x0Fu << DEVICE_STATE_SHIFT) /**< Device state bitmask. */ + #define DEVICE_STATE_LINK (0x00u << DEVICE_STATE_SHIFT) /**< Device is in link state. */ + #define DEVICE_STATE_AUTHENTICATE (0x01u << DEVICE_STATE_SHIFT) /**< Device is in authenticate state. */ + #define DEVICE_STATE_TRANSPORT (0x02u << DEVICE_STATE_SHIFT) /**< Device is in transport state. */ + #define DEVICE_STATE_BUSY (0x03u << DEVICE_STATE_SHIFT) /**< Device is in busy state. */ + +#define DEVICE_DESCRIPTOR_OFFSET_0 0x04u /**< Beacon ANT-FS device descriptor LSB position. */ +#define DEVICE_DESCRIPTOR_OFFSET_1 0x05u /**< Beacon ANT-FS device descriptor LSB + 1 position. */ +#define DEVICE_DESCRIPTOR_OFFSET_2 0x06u /**< Beacon ANT-FS device descriptor LSB + 2 position. */ +#define DEVICE_DESCRIPTOR_OFFSET_3 0x07u /**< Beacon ANT-FS device descriptor MSB position. */ + +// Commands. +#define ANTFS_CMD_NONE 0x00u /**< Used to identify that no ANT-FS command is in progress. */ +#define ANTFS_CMD_LINK_ID 0x02u /**< ANT-FS link command ID. */ +#define ANTFS_CMD_DISCONNECT_ID 0x03u /**< ANT-FS disconnect command ID. */ +#define ANTFS_CMD_AUTHENTICATE_ID 0x04u /**< ANT-FS authenticate command ID. */ +#define ANTFS_CMD_PING_ID 0x05u /**< ANT-FS ping command ID. */ +#define ANTFS_CMD_DOWNLOAD_ID 0x09u /**< ANT-FS download request command ID. */ +#define ANTFS_CMD_UPLOAD_REQUEST_ID 0x0Au /**< ANT-FS upload request command ID. */ +#define ANTFS_CMD_ERASE_ID 0x0Bu /**< ANT-FS erase request command ID. */ +#define ANTFS_CMD_UPLOAD_DATA_ID 0x0Cu /**< ANT-FS upload command ID. */ + +// Responses. +#define ANTFS_RSP_AUTHENTICATE_ID 0x84u /**< ANT-FS authenticate response command ID. */ +#define ANTFS_RSP_DOWNLOAD_ID 0x89u /**< ANT-FS download request response command ID. */ +#define ANTFS_RSP_UPLOAD_REQ_ID 0x8Au /**< ANT-FS upload request response command ID. */ +#define ANTFS_RSP_ERASE_ID 0x8Bu /**< ANT-FS erase response command ID. */ +#define ANTFS_RSP_UPLOAD_DATA_ID 0x8Cu /**< ANT-FS upload data response command ID. */ + +// Link command. +#define TRANSPORT_CHANNEL_FREQUENCY_OFFSET 0x02u /**< Channel frequency field offset within link command. */ +#define TRANSPORT_MESSAGE_PERIOD_OFFSET 0x03u /**< Channel period field offset within link command. */ +#define HOST_ID_OFFSET_0 0x04u /**< Host serial number period field LSB offset within link command. */ +#define HOST_ID_OFFSET_1 0x05u /**< Host serial number period field LSB + 1 offset within link command. */ +#define HOST_ID_OFFSET_2 0x06u /**< Host serial number period field LSB + 2 offset within link command. */ +#define HOST_ID_OFFSET_3 0x07u /**< Host serial number period field MSB offset within link command. */ + +// Authenticate command. +#define COMMAND_TYPE_OFFSET 0x02u /**< Command type field offset within authenticate command. */ + #define COMMAND_TYPE_PROCEED 0x00u /**< Command type proceed to transport in the authenticate command. */ + #define COMMAND_TYPE_REQUEST_SERIAL 0x01u /**< Command type request client device serial number in the authenticate command. */ + #define COMMAND_TYPE_REQUEST_PAIR 0x02u /**< Command type request pairing in the authenticate command. */ + #define COMMAND_TYPE_REQUEST_PASSKEY 0x03u /**< Command type request passkey exchange in the authenticate command. */ + +// Authenticate response. +#define RESPONSE_TYPE_OFFSET 0x02u /**< Command type field offset within authenticate response command. */ + #define AUTH_RESPONSE_N_A 0x00u /**< Command response type N/A (response for client serial number request). */ + #define AUTH_RESPONSE_ACCEPT 0x01u /**< Command response type accept. */ + #define AUTH_RESPONSE_REJECT 0x02u /**< Command response type reject. */ + +// Authenticate command/response. +#define AUTH_STRING_LENGTH_OFFSET 0x03u /**< Authenticate Command/Response authentication string length offset. */ +#define SERIAL_NUMBER_OFFSET_0 0x04u /**< Authenticate Command/Response client/host serial number LSB offset. */ +#define SERIAL_NUMBER_OFFSET_1 0x05u /**< Authenticate Command/Response client/host serial number LSB + 1 offset. */ +#define SERIAL_NUMBER_OFFSET_2 0x06u /**< Authenticate Command/Response client/host serial number LSB + 2 offset. */ +#define SERIAL_NUMBER_OFFSET_3 0x07u /**< Authenticate Command/Response client/host serial number MSB offset. */ + +// Download/Upload/Erase commands. +#define INITIAL_REQUEST_OFFSET 0x01u /**< Download/Upload/Erase command initial request command offset. */ +#define DATA_INDEX_OFFSET_LOW 0x02u /**< Download/Upload/Erase command offset index low. */ +#define DATA_INDEX_OFFSET_HIGH 0x03u /**< Download/Upload/Erase command offset index high. */ + +#define ADDRESS_PARAMETER_OFFSET_0 0x04u /**< Download/Upload command parameter LSB offset. */ +#define ADDRESS_PARAMETER_OFFSET_1 0x05u /**< Download/Upload command parameter LSB + 1 offset. */ +#define ADDRESS_PARAMETER_OFFSET_2 0x06u /**< Download/Upload command parameter LSB + 2 offset. */ +#define ADDRESS_PARAMETER_OFFSET_3 0x07u /**< Download/Upload command parameter MSB offset. */ +#define UPLOAD_CRC_OFFSET_LOW 0x06u /**< Upload data CRC offset low. */ +#define UPLOAD_CRC_OFFSET_HIGH 0x07u /**< Upload data CRC offset high. */ + +// Below compile switches should be provided by antfs_config.h: +// - ANTFS_AUTH_TYPE_PAIRING /**< Use pairing and key exchange authentication. */ +// - ANTFS_AUTH_TYPE_PASSKEY /**< Use passkey authentication. */ +// - ANTFS_AUTH_TYPE_PASSTHROUGH /**< Allow host to bypass authentication. */ +// - ANTFS_INCLUDE_UPLOAD /**< Support upload operation. */ + +// Authentication type. The highest level of authentication available is included in the beacon. +#if defined (ANTFS_AUTH_TYPE_PASSKEY) + #define AUTHENTICATION_TYPE COMMAND_TYPE_REQUEST_PASSKEY /**< Passkey and pairing only mode set as authentication type in beacon. */ +#elif defined (ANTFS_AUTH_TYPE_PAIRING) + #define AUTHENTICATION_TYPE COMMAND_TYPE_REQUEST_PAIR /**< Pairing only mode set as authentication type in beacon. */ +#elif defined (ANTFS_AUTH_TYPE_PASSTHROUGH) + #define AUTHENTICATION_TYPE COMMAND_TYPE_PROCEED /**< Pass-through mode set as authentication type in beacon. */ +#else + #error "No valid auth type defined" +#endif + +#define AUTHENTICATION_RETRIES 0x05u /**< Max number of retries for authentication responses */ + +#define ANTFS_EVENT_QUEUE_SIZE 0x04u /**< ANT-FS event queue size. */ +#define SAVE_DISTANCE 256u /**< Save distance required because of nRF buffer to line up data offset on retry. */ + +// Buffer Indices. +#define BUFFER_INDEX_MESG_SIZE 0x00u /**< ANT message buffer index length offset. */ +#define BUFFER_INDEX_MESG_ID 0x01u /**< ANT message buffer index ID offset. */ +#define BUFFER_INDEX_CHANNEL_NUM 0x02u /**< ANT message buffer index channel number offset. */ +#define BUFFER_INDEX_MESG_DATA 0x03u /**< ANT message buffer index begin of data offset. */ +#define BUFFER_INDEX_RESPONSE_CODE 0x04u /**< ANT message buffer index response code offset. */ + +typedef struct +{ + char friendly_name[ANTFS_FRIENDLY_NAME_MAX]; /**< Friendly Name. */ + bool is_name_set; /**< Is the name set. */ + uint32_t index; /**< Current index (for reading the friendly name). */ + uint32_t friendly_name_size; /**< Friendly name size. */ +} friendly_name_t; + +typedef union +{ + antfs_link_substate_t link_sub_state; /**< Sub-state (Link layer). */ + antfs_authenticate_substate_t auth_sub_state; /**< Sub-state (Authentication layer). */ + antfs_transport_substate_t trans_sub_state; /**< Sub-state (Transport layer). */ +} antfs_substate_t; + +typedef struct +{ + antfs_state_t state; /**< ANT-FS state. */ + antfs_substate_t sub_state; /**< ANT-FS sub-state. */ +} antfs_states_t; + +typedef struct +{ + antfs_event_return_t * p_queue; /**< ANT-FS event queue. */ + uint32_t head; /**< ANT-FS event queue head index. */ + uint32_t tail; /**< ANT-FS event queue tail index. */ +} antfs_event_queue_t; + +static antfs_params_t m_initial_parameters; /**< Initial parameters. */ +static antfs_beacon_status_byte1_t m_active_beacon_status1_field; /**< Status 1 field in beacon. */ +static uint32_t m_active_beacon_frequency; /**< Active beacon frequency. */ +static antfs_states_t m_current_state; /**< Current state. */ +static friendly_name_t m_friendly_name; /**< Host's friendly name. */ +static ulong_union_t m_link_host_serial_number; /**< Host's serial number. */ +static uint32_t m_link_command_in_progress; /**< ANT-FS command in progress. */ +static uint32_t m_authenticate_command_type; /**< Authenticate command type in progress. */ +static volatile uint8_t m_burst_wait; /**< Polling status flag for data unlock on burst handler input. */ +static uint8_t m_retry; /**< Retry counter */ +APP_TIMER_DEF(m_timer_id); /**< Timer ID used with the timer module. */ + +#if defined (ANTFS_AUTH_TYPE_PASSKEY) + static uint32_t m_passkey_index; /**< Current location of Tx block (auth string). */ +#endif // ANTFS_AUTH_TYPE_PASSKEY + +// Download/upload. +static bool m_is_data_request_pending; /**< Requested data pending. */ +static bool m_is_crc_pending; /**< CRC for data packets pending. */ +static ushort_union_t m_file_index; /**< File index of current upload/download. */ +static ulong_union_t m_file_size; /**< File size of current upload/download (bytes). */ +static ulong_union_t m_max_block_size; /**< Maximum number of bytes expected to be downloaded in a single burst block of data (set by host). */ +static ulong_union_t m_link_burst_index; /**< Current location of Tx block (bytes). */ +static ulong_union_t m_bytes_remaining; /**< Total remaining data length (bytes). */ +static ulong_union_t m_max_transfer_index; /**< Upper limit of the current Tx burst block (bytes). */ +static uint32_t m_bytes_to_write; /**< Number of bytes to write to file (upload). */ +static const uint8_t * mp_upload_data; /**< Address of begin of the buffer that holds data received from upload. */ +#ifdef ANTFS_INCLUDE_UPLOAD + static ulong_union_t m_block_size; /**< Number of bytes the client can receive in a single burst. */ +#endif // ANTFS_INCLUDE_UPLOAD + +// CRC verification. +static uint32_t m_saved_crc_offset; /**< CRC data offset (bytes) saved at last CRC update (save point). */ +static uint32_t m_saved_buffer_crc_offset; /**< Data offset to track how much data has been buffered into nRF */ +static uint32_t m_temp_crc_offset; /**< Temporary CRC data offset used in CRC calculation. */ +static uint16_t m_compared_crc; /**< 16-bit CRC for all data packets in the block (provided by download request). */ +static uint16_t m_transfer_crc; /**< 16-bit CRC for all data packets in the block (calculated by client). */ +static uint16_t m_saved_transfer_crc; /**< 16-bit CRC saved at last CRC update (save point). */ +static uint16_t m_saved_buffer_crc; /**< 16-bit CRC saved at last CRC update (save point) for buffering the nRF */ + +// ANT-FS event handling. +static antfs_event_return_t m_event_queue_buffer[ANTFS_EVENT_QUEUE_SIZE]; /**< Event queue storage. */ +static antfs_event_queue_t m_event_queue; /**< Event queue. */ + +static antfs_burst_wait_handler_t m_burst_wait_handler = NULL; /**< Burst wait handler */ + + +const char * antfs_hostname_get(void) +{ + if (m_friendly_name.is_name_set) + { + return (m_friendly_name.friendly_name); + } + + return NULL; +} + + +/**@brief Function for waiting for the burst transmission request to complete. + */ +static void wait_burst_request_to_complete(void) +{ + while (m_burst_wait != 0) + { + if(m_burst_wait_handler != NULL) + { + m_burst_wait_handler(); + } + }; +} + + +/**@brief Function for stopping ANT-FS timeout, which is possibly currently running. + */ +static void timeout_disable(void) +{ + m_link_command_in_progress = ANTFS_CMD_NONE; + + const uint32_t err_code = app_timer_stop(m_timer_id); + APP_ERROR_CHECK(err_code); +} + + +/**@brief Function for transmitting a beacon. + * + * Transmits a beacon either using a broadcast or burst transmission mode. + * + * @param[in] message_type Defines the used transmission mode. + */ +static void beacon_transmit(uint32_t message_type) +{ + uint8_t beacon_status_byte2; + + // Set beacon status byte 2. + + if (m_link_command_in_progress == ANTFS_CMD_NONE) + { + switch (m_current_state.state) + { + case ANTFS_STATE_AUTH: + beacon_status_byte2 = DEVICE_STATE_AUTHENTICATE; + break; + + case ANTFS_STATE_TRANS: + beacon_status_byte2 = DEVICE_STATE_TRANSPORT; + break; + + default: + beacon_status_byte2 = DEVICE_STATE_LINK; + break; + } + } + else + { + beacon_status_byte2 = DEVICE_STATE_BUSY; + } + + // Set remaining beacon fields. + + uint8_t tx_buffer[BURST_PACKET_SIZE]; + + tx_buffer[0] = ANTFS_BEACON_ID; + tx_buffer[1] = m_active_beacon_status1_field.status; + tx_buffer[2] = beacon_status_byte2; + tx_buffer[3] = AUTHENTICATION_TYPE; + + if ((m_current_state.state == ANTFS_STATE_AUTH) || + (m_current_state.state == ANTFS_STATE_TRANS)) + { + tx_buffer[4] = m_link_host_serial_number.bytes.byte0; + tx_buffer[5] = m_link_host_serial_number.bytes.byte1; + tx_buffer[6] = m_link_host_serial_number.bytes.byte2; + tx_buffer[7] = m_link_host_serial_number.bytes.byte3; + } + else + { + tx_buffer[4] = m_initial_parameters.beacon_device_type; + tx_buffer[5] = (m_initial_parameters.beacon_device_type >> 8u); + tx_buffer[6] = m_initial_parameters.beacon_device_manufacturing_id; + tx_buffer[7] = (m_initial_parameters.beacon_device_manufacturing_id >> 8u); + } + + if (message_type == MESG_BROADCAST_DATA_ID) + { + if (sd_ant_broadcast_message_tx(ANTFS_CHANNEL, sizeof(tx_buffer), tx_buffer) != NRF_SUCCESS) + { + // @note: No implementation needed, as it is a valid and accepted use case for this call + // to fail. This call can fail if we are in middle of bursting. + } + } + else if(message_type == MESG_BURST_DATA_ID) + { + // Send as the first packet of a burst. + const uint32_t err_code = sd_ant_burst_handler_request(ANTFS_CHANNEL, + sizeof(tx_buffer), + tx_buffer, + BURST_SEGMENT_START); + APP_ERROR_CHECK(err_code); + + wait_burst_request_to_complete(); + + // This is the first packet of a burst response, disable command timeout while bursting. + timeout_disable(); + } + else + { + // This should not happen. + APP_ERROR_HANDLER(message_type); + } +} + + +/**@brief Function for transmitting a authenticate response message. + * + * @param[in] response_type Authenticate response code. + * @param[in] password_length Length of authentication string. + * @param[in] p_password Authentication string transmitted. + */ +static void authenticate_response_transmit(uint8_t response_type, + uint32_t password_length, + const uint8_t * p_password) +{ + ulong_union_t serial_number; + + serial_number.data = m_initial_parameters.client_serial_number; + + // First packet is beacon. + beacon_transmit(MESG_BURST_DATA_ID); + + uint8_t tx_buffer[BURST_PACKET_SIZE]; + + tx_buffer[ANTFS_CONNECTION_TYPE_OFFSET] = ANTFS_COMMAND_ID; + tx_buffer[ANTFS_RESPONSE_OFFSET] = ANTFS_RSP_AUTHENTICATE_ID; + tx_buffer[RESPONSE_TYPE_OFFSET] = response_type; + tx_buffer[AUTH_STRING_LENGTH_OFFSET] = password_length; + tx_buffer[SERIAL_NUMBER_OFFSET_0] = serial_number.bytes.byte0; + tx_buffer[SERIAL_NUMBER_OFFSET_1] = serial_number.bytes.byte1; + tx_buffer[SERIAL_NUMBER_OFFSET_2] = serial_number.bytes.byte2; + tx_buffer[SERIAL_NUMBER_OFFSET_3] = serial_number.bytes.byte3; + + uint32_t err_code; + if ((m_current_state.state == ANTFS_STATE_AUTH) && + ( + (response_type != AUTH_RESPONSE_REJECT) && + password_length && + (password_length <= ANTFS_AUTH_STRING_MAX) + ) + ) + { + // Send second packet (auth response). + err_code = sd_ant_burst_handler_request(ANTFS_CHANNEL, + sizeof(tx_buffer), + tx_buffer, + BURST_SEGMENT_CONTINUE); + APP_ERROR_CHECK(err_code); + + wait_burst_request_to_complete(); + + // Round size to a multiple of 8 bytes. + uint8_t tx_buffer_authenticate[ANTFS_AUTH_STRING_MAX + 1u]; + + memset(tx_buffer_authenticate, 0, ANTFS_AUTH_STRING_MAX + 1u); + memcpy(tx_buffer_authenticate, p_password, password_length); + + // Round up total number bytes to a multiple of 8 to be sent to burst handler. + if (password_length & (BURST_PACKET_SIZE - 1u)) + { + password_length &= ~(BURST_PACKET_SIZE - 1u); + password_length += BURST_PACKET_SIZE; + } + + // Send auth string (last packets of the burst). + err_code = sd_ant_burst_handler_request(ANTFS_CHANNEL, + password_length, + tx_buffer_authenticate, + BURST_SEGMENT_END); + APP_ERROR_CHECK(err_code); + + wait_burst_request_to_complete(); + + m_link_command_in_progress = ANTFS_RSP_AUTHENTICATE_ID; + } + else + { + // If the authorization is rejected or there is no valid password, the auth response is the + // last packet. + + err_code = sd_ant_burst_handler_request(ANTFS_CHANNEL, + sizeof(tx_buffer), + tx_buffer, + BURST_SEGMENT_END); + APP_ERROR_CHECK(err_code); + + wait_burst_request_to_complete(); + } + + // Switch to appropiate state. + if (response_type == AUTH_RESPONSE_REJECT) + { + m_current_state.sub_state.auth_sub_state = ANTFS_AUTH_SUBSTATE_REJECT; + } + else if (response_type == AUTH_RESPONSE_ACCEPT) + { + m_current_state.sub_state.auth_sub_state = ANTFS_AUTH_SUBSTATE_ACCEPT; + } + else + { + // No implementation needed. + } +} + + +bool antfs_pairing_resp_transmit(bool accept) +{ +#if defined(ANTFS_AUTH_TYPE_PAIRING) + // This function should only be called when ANT-FS is in PAIRING mode. + if ((m_current_state.state != ANTFS_STATE_AUTH) || + (m_current_state.sub_state.auth_sub_state != ANTFS_AUTH_SUBSTATE_PAIR)) + { + return false; + } + + m_link_command_in_progress = ANTFS_CMD_AUTHENTICATE_ID; + + if (accept) + { + // Accept request and send passkey if authentication passed. + authenticate_response_transmit(AUTH_RESPONSE_ACCEPT, + ANTFS_PASSKEY_SIZE, + m_initial_parameters.p_pass_key); + } + else + { + // Reject authentication request. + authenticate_response_transmit(AUTH_RESPONSE_REJECT, 0, NULL); + } + + return true; +#else + return false; +#endif // ANTFS_AUTH_TYPE_PAIRING +} + + +/**@brief Function for adding an ANT-FS event to the event queue. + * + * @param[in] event_code The event to be added. + */ +static void event_queue_write(antfs_event_t event_code) +{ + antfs_event_return_t * p_event = NULL; +#ifdef LEDDRIVER_ACTIVE + uint32_t err_code; +#endif + + // Check if there is room in the queue for a new event. + if (((m_event_queue.head + 1u) & (ANTFS_EVENT_QUEUE_SIZE - 1u)) != m_event_queue.tail) + { + p_event = &(m_event_queue.p_queue[m_event_queue.head]); + } + + if (p_event != NULL) + { + // Initialize event parameters. + p_event->event = event_code; + + // Set parameters depending on event type. + switch (event_code) + { + case ANTFS_EVENT_ERASE_REQUEST: + p_event->file_index = m_file_index.data; + p_event->offset = 0; + p_event->bytes = 0; + p_event->crc = 0; + break; + + case ANTFS_EVENT_DOWNLOAD_REQUEST: + p_event->file_index = m_file_index.data; + // Requested offset for the download. + p_event->offset = m_link_burst_index.data; + p_event->bytes = 0; + p_event->crc = 0; + break; + + case ANTFS_EVENT_DOWNLOAD_REQUEST_DATA: + p_event->file_index = m_file_index.data; + // Current offset. + p_event->offset = m_link_burst_index.data; + + if (m_bytes_remaining.data > (ANTFS_BURST_BLOCK_SIZE * BURST_PACKET_SIZE)) + { + // If remaining bytes > burst block size then grab one block at a time. + p_event->bytes = ANTFS_BURST_BLOCK_SIZE * BURST_PACKET_SIZE; + } + else + { + p_event->bytes = m_bytes_remaining.data; + } + + p_event->crc = 0; + break; + + case ANTFS_EVENT_UPLOAD_REQUEST: + p_event->file_index = m_file_index.data; + // Requested offset for the upload. + p_event->offset = m_link_burst_index.data; + // Upper limit of the download (offset + remaining bytes). + p_event->bytes = m_max_transfer_index.data; + // CRC Seed (from last save point if resuming). + p_event->crc = m_transfer_crc; + break; + + case ANTFS_EVENT_UPLOAD_DATA: + p_event->file_index = m_file_index.data; + // Current offset. + p_event->offset = m_link_burst_index.data; + // Current CRC. + p_event->crc = m_transfer_crc; + // Number of bytes to write. + p_event->bytes = m_bytes_to_write; + // Upload to appication data buffer. + memcpy(p_event->data, mp_upload_data, m_bytes_to_write); + break; + + case ANTFS_EVENT_PAIRING_REQUEST: +#ifdef LEDDRIVER_ACTIVE + err_code = bsp_indication_set(BSP_INDICATE_BONDING); + APP_ERROR_CHECK(err_code); +#endif // LEDDRIVER_ACTIVE + break; + + default: + // No parameters need to be set. + + p_event->file_index = 0; + p_event->offset = 0; + p_event->bytes = 0; + p_event->crc = 0; + break; + } + + // Put the event in the queue. + m_event_queue.head = ((m_event_queue.head + 1u) & (ANTFS_EVENT_QUEUE_SIZE - 1u)); + } + else + { + // No free space left in the queue. + APP_ERROR_HANDLER(0); + } +} + + +/**@brief Function for transmitting download request response message. + * + * @param[in] response Download response code. + */ +static void download_request_response_transmit(uint8_t response) +{ + // First burst packet is beacon. + beacon_transmit(MESG_BURST_DATA_ID); + + uint8_t tx_buffer[BURST_PACKET_SIZE]; + + // Next send the first part of the download response. + tx_buffer[0] = ANTFS_COMMAND_ID; + tx_buffer[1] = ANTFS_RSP_DOWNLOAD_ID; + tx_buffer[2] = response; + tx_buffer[3] = 0; + // Total number of bytes remaining in the data block. + tx_buffer[4] = m_bytes_remaining.bytes.byte0; + tx_buffer[5] = m_bytes_remaining.bytes.byte1; + tx_buffer[6] = m_bytes_remaining.bytes.byte2; + tx_buffer[7] = m_bytes_remaining.bytes.byte3; + + uint32_t err_code = sd_ant_burst_handler_request(ANTFS_CHANNEL, + sizeof(tx_buffer), + tx_buffer, + BURST_SEGMENT_CONTINUE); + APP_ERROR_CHECK(err_code); + + wait_burst_request_to_complete(); + + // Second part of the download response. + + // The offset the data will start from in this block. + tx_buffer[0] = m_link_burst_index.bytes.byte0; + tx_buffer[1] = m_link_burst_index.bytes.byte1; + tx_buffer[2] = m_link_burst_index.bytes.byte2; + tx_buffer[3] = m_link_burst_index.bytes.byte3; + // The file size in the client device. + tx_buffer[4] = m_file_size.bytes.byte0; + tx_buffer[5] = m_file_size.bytes.byte1; + tx_buffer[6] = m_file_size.bytes.byte2; + tx_buffer[7] = m_file_size.bytes.byte3; + + if (response || (m_bytes_remaining.data == 0)) + { + // If the download was rejected or there is no data to send. + + // Set response to end since we're not downloading any data. + err_code = sd_ant_burst_handler_request(ANTFS_CHANNEL, + sizeof(tx_buffer), + tx_buffer, + BURST_SEGMENT_END); + APP_ERROR_CHECK(err_code); + + wait_burst_request_to_complete(); + } + else + { + // Response will continue (data packets + CRC footer to follow). + err_code = sd_ant_burst_handler_request(ANTFS_CHANNEL, + sizeof(tx_buffer), + tx_buffer, + BURST_SEGMENT_CONTINUE); + APP_ERROR_CHECK(err_code); + + wait_burst_request_to_complete(); + } + + m_link_command_in_progress = ANTFS_CMD_DOWNLOAD_ID; + + if (response == 0) + { + // If we are going to download (response OK), enter the downloading substate. + m_current_state.sub_state.trans_sub_state = ANTFS_TRANS_SUBSTATE_DOWNLOADING; + event_queue_write(ANTFS_EVENT_DOWNLOAD_START); + } + else + { + // Download rejected. + event_queue_write(ANTFS_EVENT_DOWNLOAD_FAIL); + } +} + + +void antfs_download_req_resp_prepare(uint8_t response, + const antfs_request_info_t * const p_request_info) +{ + // This function should only be called after receiving a download request. + APP_ERROR_CHECK_BOOL((m_current_state.state == ANTFS_STATE_TRANS) && + (m_link_command_in_progress == ANTFS_CMD_DOWNLOAD_ID)); + + if (response == 0) + { + // Download request OK. + + // File size of the requested download. + m_file_size.data = p_request_info->file_size.data; + + if (m_link_burst_index.data > m_file_size.data) + { + // Offset should not exceed file size. + m_link_burst_index.data = m_file_size.data; + } + + // If the host is not limiting download size or the file size does not exceed the host's + // download size limit. + if ((m_max_block_size.data == 0) || (m_file_size.data < m_max_block_size.data)) + { + // Number of bytes remaining to be downloaded in this block is the file size. + m_bytes_remaining.data = m_file_size.data; + } + + if ((m_file_size.data - m_link_burst_index.data) < m_bytes_remaining.data) + { + // Calculate number of remaining bytes in this block based on the offset. + m_bytes_remaining.data = m_file_size.data - m_link_burst_index.data; + } + + // If the application is limiting the Tx block size. + if (m_bytes_remaining.data > p_request_info->max_burst_block_size.data) + { + // Number of remaining bytes in this block is the application defined block size. + m_bytes_remaining.data = p_request_info->max_burst_block_size.data; + } + + // Find upper limit of the burst Tx. + m_max_transfer_index.data = m_link_burst_index.data + m_bytes_remaining.data; + + if (m_saved_crc_offset == ANTFS_MAX_FILE_SIZE) + { + // CRC checking was set as invalid. An invalid download was requested, so reject it. + response = RESPONSE_INVALID_OPERATION; + } + } + + if ((response != 0) || (m_file_size.data == 0)) + { + // Send the response right away if the download request was rejected or there is no data to + // send. + download_request_response_transmit(response); + } + else + { + // Proceed to download data. + if (m_link_burst_index.data != m_saved_crc_offset) + { + uint32_t temp; + + // If requesting to resume exactly where we left off, we can start from the same block. + if (m_link_burst_index.data == m_temp_crc_offset) + { + // Move last save point to end of last block sent. + m_saved_crc_offset = m_link_burst_index.data; + m_saved_transfer_crc = m_transfer_crc; + } + + // To resume the download, request a block of data starting from the last save point. + // Update the remaining number of bytes per the last save point. + m_bytes_remaining.data += (m_link_burst_index.data - m_saved_crc_offset); + + // Swap the current burst Tx index with the saved CRC index, to make sure we do not + // start updating the CRC until we get to the requested index. + temp = m_link_burst_index.data; + m_link_burst_index.data = m_saved_crc_offset; + m_saved_crc_offset = temp; + + // Set CRC to previous save point, to check the CRC provided by the host. + m_transfer_crc = m_saved_transfer_crc; + } + + m_temp_crc_offset = m_saved_crc_offset; + + m_is_data_request_pending = true; + + // Request data from application. + event_queue_write(ANTFS_EVENT_DOWNLOAD_REQUEST_DATA); + + m_current_state.sub_state.trans_sub_state = ANTFS_TRANS_SUBSTATE_VERIFY_CRC; + } +} + + +uint32_t antfs_input_data_download(uint16_t index, + uint32_t offset, + uint32_t num_bytes, + const uint8_t * const p_message) +{ + // Verify that this is the requested data. + APP_ERROR_CHECK_BOOL((offset == m_link_burst_index.data) && (index == m_file_index.data)); + + // If file offset is greater than the upper limit, this is not data we need. + APP_ERROR_CHECK_BOOL(offset <= m_max_transfer_index.data); + + if ((m_current_state.state == ANTFS_STATE_TRANS) && + ( + (m_current_state.sub_state.trans_sub_state == ANTFS_TRANS_SUBSTATE_VERIFY_CRC) || + // Only send data if we were processing a download request. + (m_current_state.sub_state.trans_sub_state == ANTFS_TRANS_SUBSTATE_DOWNLOADING) + ) + ) + { + uint32_t block_offset = 0; + + if (m_current_state.sub_state.trans_sub_state == ANTFS_TRANS_SUBSTATE_VERIFY_CRC) + { + // Make sure download_request_response_transmit defaults to RESPONSE_INVALID_CRC. + uint32_t response = RESPONSE_MESSAGE_OK; + + // Check CRC. + if (m_link_burst_index.data == m_saved_crc_offset) + { + // If indexes match, we can compare CRC directly. + if (m_transfer_crc != m_compared_crc) + { + response = RESPONSE_INVALID_CRC; + } + else + { + // Set up the save point + m_temp_crc_offset = m_link_burst_index.data; // Reset save point counter + m_saved_crc_offset = m_link_burst_index.data; + m_saved_buffer_crc_offset = m_link_burst_index.data; + + // Set up the CRC save points + m_saved_transfer_crc = m_compared_crc; + m_saved_buffer_crc = m_compared_crc; + m_is_crc_pending = true; + } + // Start bursting beacon and the download response (3 burst packets). + download_request_response_transmit(response); + } + // If the data is in this block, advance to the requested offset + else if ((m_link_burst_index.data < m_saved_crc_offset) && + ((m_saved_crc_offset - m_link_burst_index.data) < num_bytes)) + { + // Update the offset within this block for the requested transmission. + block_offset = m_saved_crc_offset - m_link_burst_index.data; + // Update the number of bytes that will actually be transmitted. + num_bytes -= block_offset; + + // Update CRC calculation up to requested index. + m_transfer_crc = crc_crc16_update(m_transfer_crc, p_message, block_offset); + // Update the remaining number of bytes. + m_bytes_remaining.data -= block_offset; + + // Check CRC + if (m_transfer_crc != m_compared_crc) + { + response = RESPONSE_INVALID_CRC; + } + else + { + // Move index back to point where transmission will resume. + m_link_burst_index.data = m_saved_crc_offset; + + // Set up the save point + m_temp_crc_offset = m_link_burst_index.data; // Reset save point counter + m_saved_buffer_crc_offset = m_link_burst_index.data; + + // Set up the CRC save points + m_saved_transfer_crc = m_compared_crc; + m_saved_buffer_crc = m_compared_crc; + + m_is_crc_pending = true; + } + download_request_response_transmit(response); + } + // Data index has gone too far and it is not possible to check CRC, fail and let host retry + else if(m_link_burst_index.data > m_saved_crc_offset) + { + response = RESPONSE_INVALID_CRC; + download_request_response_transmit(response); + } + // Keep getting data and recalculate the CRC until the indexes match + else + { + m_is_data_request_pending = false; + + // Update the current burst index and bytes remaining + m_link_burst_index.data += num_bytes; + m_bytes_remaining.data -= num_bytes; + + // Update CRC + m_transfer_crc = crc_crc16_update(m_transfer_crc, p_message, num_bytes); + + // Request more data. + event_queue_write(ANTFS_EVENT_DOWNLOAD_REQUEST_DATA); + } + } + + // Append data. + if (m_current_state.sub_state.trans_sub_state == ANTFS_TRANS_SUBSTATE_DOWNLOADING) + { + uint32_t num_of_bytes_to_burst = num_bytes; + + if (num_of_bytes_to_burst & (BURST_PACKET_SIZE - 1u)) + { + // Round up total number bytes to a multiple of BURST_PACKET_SIZE to be sent to + // burst handler. + num_of_bytes_to_burst &= ~(BURST_PACKET_SIZE - 1u); + num_of_bytes_to_burst += BURST_PACKET_SIZE; + } + + uint32_t err_code = sd_ant_burst_handler_request(ANTFS_CHANNEL, + num_of_bytes_to_burst, + (uint8_t*)&(p_message[block_offset]), + BURST_SEGMENT_CONTINUE); + if(err_code != NRF_ANT_ERROR_TRANSFER_SEQUENCE_NUMBER_ERROR) + { + // If burst failed before we are able to catch it, we will get a TRANSFER_SEQUENCE_NUMBER_ERROR + // The message processing will send client back to correct state + APP_ERROR_CHECK(err_code); + } + + wait_burst_request_to_complete(); + + // Update current burst index. + m_link_burst_index.data += num_bytes; + // Update remaining bytes. + m_bytes_remaining.data -= num_bytes; + + m_is_data_request_pending = false; + + m_transfer_crc = crc_crc16_update(m_transfer_crc, + &(p_message[block_offset]), + num_bytes); + + if((m_link_burst_index.data - m_temp_crc_offset) > SAVE_DISTANCE) + { + // Set CRC save point + m_saved_transfer_crc = m_saved_buffer_crc; // Set CRC at buffer save point (will always be one behind to account for buffering) + m_saved_buffer_crc = m_transfer_crc; // Set CRC at save point + + // Set offset save point + m_saved_crc_offset = m_saved_buffer_crc_offset; // Set offset at buffer save point (will always be one behind to account for buffering) + m_saved_buffer_crc_offset = m_link_burst_index.data; // Set buffer offset to current data offset + + // Reset save counter offset + m_temp_crc_offset = m_link_burst_index.data; // Set to current location; next save point will take place after SAVE_DISTANCE bytes + } + + if (!m_is_data_request_pending && (m_link_burst_index.data < m_max_transfer_index.data)) + { + // If we have not finished the download. + + // Request more data. + event_queue_write(ANTFS_EVENT_DOWNLOAD_REQUEST_DATA); + + m_is_data_request_pending = true; + } + else if (m_link_burst_index.data >= m_max_transfer_index.data && m_is_crc_pending) + { + // We are done, send CRC footer. + + uint8_t tx_buffer[BURST_PACKET_SIZE]; + + tx_buffer[0] = 0; + tx_buffer[1] = 0; + tx_buffer[2] = 0; + tx_buffer[3] = 0; + tx_buffer[4] = 0; + tx_buffer[5] = 0; + tx_buffer[6] = (uint8_t)m_transfer_crc; + tx_buffer[7] = (uint8_t)(m_transfer_crc >> 8u); + + err_code = sd_ant_burst_handler_request(ANTFS_CHANNEL, + sizeof(tx_buffer), + tx_buffer, + BURST_SEGMENT_END); + if(err_code != NRF_ANT_ERROR_TRANSFER_SEQUENCE_NUMBER_ERROR) + { + // If burst failed before we are able to catch it, we will get a TRANSFER_SEQUENCE_NUMBER_ERROR + // The message processing will send client back to correct state + APP_ERROR_CHECK(err_code); + } + + wait_burst_request_to_complete(); + + m_is_crc_pending = false; + m_max_transfer_index.data = 0; + } + + // Return the number of bytes we accepted. + return num_bytes; + } + } + + // No bytes were accepted. + return 0; +} + + +bool antfs_upload_req_resp_transmit(uint8_t response, + const antfs_request_info_t * const p_request_info) +{ +#if defined(ANTFS_INCLUDE_UPLOAD) + if (m_current_state.state != ANTFS_STATE_TRANS || + // Only send the response if we were processing an upload request. + (m_link_command_in_progress != ANTFS_CMD_UPLOAD_REQUEST_ID)) + { + return false; + } + + // If the application is sending a response for a different file than requested, the upload + // will fail. + if (p_request_info->file_index.data != m_file_index.data) + { + event_queue_write(ANTFS_EVENT_UPLOAD_FAIL); + + return false; + } + + ulong_union_t max_mem_size; + // Set maximum number of bytes that can be written to the file. + max_mem_size.data = p_request_info->max_file_size; + + if (p_request_info->max_burst_block_size.data != 0) + { + // If the client is limiting the block size set the block size requested by the client. + m_block_size.data = p_request_info->max_burst_block_size.data; + } + else + { + // Try to get the entire file in a single block. + m_block_size.data = max_mem_size.data; + } + + if (response == 0) + { + if (m_max_transfer_index.data > max_mem_size.data) + { + // Not enough space to write file, reject download. + response = RESPONSE_MESSAGE_NOT_ENOUGH_SPACE; + } + } + + // Get last valid CRC and last valid offset. + m_transfer_crc = p_request_info->file_crc; + m_link_burst_index.data = p_request_info->file_size.data; + + // First packet to transmit is the beacon. + beacon_transmit(MESG_BURST_DATA_ID); + + // Second packet. + + uint8_t tx_buffer[BURST_PACKET_SIZE]; + + tx_buffer[0] = ANTFS_COMMAND_ID; + tx_buffer[1] = ANTFS_RSP_UPLOAD_REQ_ID; + tx_buffer[2] = response; + tx_buffer[3] = 0; + // Last valid data offset written to the file. + tx_buffer[4] = m_link_burst_index.bytes.byte0; + tx_buffer[5] = m_link_burst_index.bytes.byte1; + tx_buffer[6] = m_link_burst_index.bytes.byte2; + tx_buffer[7] = m_link_burst_index.bytes.byte3; + + + uint32_t err_code = sd_ant_burst_handler_request(ANTFS_CHANNEL, + sizeof(tx_buffer), + tx_buffer, + BURST_SEGMENT_CONTINUE); + APP_ERROR_CHECK(err_code); + + wait_burst_request_to_complete(); + + // Third packet. + + // Maximum number of bytes that can be written to the file. + tx_buffer[0] = max_mem_size.bytes.byte0; + tx_buffer[1] = max_mem_size.bytes.byte1; + tx_buffer[2] = max_mem_size.bytes.byte2; + tx_buffer[3] = max_mem_size.bytes.byte3; + // Maximum upload block size. + tx_buffer[4] = m_block_size.bytes.byte0; + tx_buffer[5] = m_block_size.bytes.byte1; + tx_buffer[6] = m_block_size.bytes.byte2; + tx_buffer[7] = m_block_size.bytes.byte3; + + err_code = sd_ant_burst_handler_request(ANTFS_CHANNEL, + sizeof(tx_buffer), + tx_buffer, + BURST_SEGMENT_CONTINUE); + APP_ERROR_CHECK(err_code); + + wait_burst_request_to_complete(); + + // Fourth packet. + + tx_buffer[0] = 0; + tx_buffer[1] = 0; + tx_buffer[2] = 0; + tx_buffer[3] = 0; + tx_buffer[4] = 0; + tx_buffer[5] = 0; + // Value of CRC at last data offset. + tx_buffer[6] = (uint8_t) m_transfer_crc; + tx_buffer[7] = (uint8_t)(m_transfer_crc >> 8); + + err_code = sd_ant_burst_handler_request(ANTFS_CHANNEL, + sizeof(tx_buffer), + tx_buffer, + BURST_SEGMENT_END); + APP_ERROR_CHECK(err_code); + + wait_burst_request_to_complete(); + + m_link_command_in_progress = ANTFS_CMD_UPLOAD_REQUEST_ID; + + if (response != 0) + { + // Failed upload request. Reset max transfer index to 0 (do not accept any data if the host + // sends it anyway). + m_max_transfer_index.data = 0; + } + else + { + // Wait for upload data request. + m_current_state.sub_state.trans_sub_state = ANTFS_TRANS_SUBSTATE_UPLOAD_WAIT_FOR_DATA; + } + + return true; +#else + return false; +#endif // ANTFS_INCLUDE_UPLOAD +} + + +bool antfs_upload_data_resp_transmit(bool data_upload_success) +{ +#if defined(ANTFS_INCLUDE_UPLOAD) + // Should be in TRANSPORT layer to send this response. + if (m_current_state.state != ANTFS_STATE_TRANS) + { + return false; + } + + uint8_t tx_buffer[BURST_PACKET_SIZE]; + + // Response. + tx_buffer[0] = ANTFS_COMMAND_ID; + tx_buffer[1] = ANTFS_RSP_UPLOAD_DATA_ID; + tx_buffer[2] = (data_upload_success) ? RESPONSE_MESSAGE_OK : RESPONSE_MESSAGE_FAIL; + tx_buffer[3] = 0; + tx_buffer[4] = 0; + tx_buffer[5] = 0; + tx_buffer[6] = 0; + tx_buffer[7] = 0; + + // First packet is beacon. + beacon_transmit(MESG_BURST_DATA_ID); + + // Send last packet. + uint32_t err_code = sd_ant_burst_handler_request(ANTFS_CHANNEL, + sizeof(tx_buffer), + tx_buffer, + BURST_SEGMENT_END); + APP_ERROR_CHECK(err_code); + + wait_burst_request_to_complete(); + + m_link_command_in_progress = ANTFS_CMD_UPLOAD_REQUEST_ID; + + // Reset maximum index. + m_max_transfer_index.data = 0; + + return true; +#else + return false; +#endif // ANTFS_INCLUDE_UPLOAD +} + + +void antfs_erase_req_resp_transmit(uint8_t response) +{ + // This function should only be called after receiving an erase request. + APP_ERROR_CHECK_BOOL((m_current_state.state == ANTFS_STATE_TRANS) && + (m_link_command_in_progress == ANTFS_CMD_ERASE_ID)); + + beacon_transmit(MESG_BURST_DATA_ID); + + uint8_t tx_buffer[BURST_PACKET_SIZE]; + + // Erase response. + tx_buffer[0] = ANTFS_COMMAND_ID; + tx_buffer[1] = ANTFS_RSP_ERASE_ID; + tx_buffer[2] = response; + tx_buffer[3] = 0; + tx_buffer[4] = 0; + tx_buffer[5] = 0; + tx_buffer[6] = 0; + tx_buffer[7] = 0; + + uint32_t err_code = sd_ant_burst_handler_request(ANTFS_CHANNEL, + sizeof(tx_buffer), + tx_buffer, + BURST_SEGMENT_END); + APP_ERROR_CHECK(err_code); + + wait_burst_request_to_complete(); +} + + +bool antfs_event_extract(antfs_event_return_t * const p_event) +{ + bool return_value = false; + + if (m_event_queue.head != m_event_queue.tail) + { + // Pending events exist. Copy event parameters into return event. + p_event->event = m_event_queue.p_queue[m_event_queue.tail].event; + p_event->file_index = m_event_queue.p_queue[m_event_queue.tail].file_index; + p_event->offset = m_event_queue.p_queue[m_event_queue.tail].offset; + p_event->bytes = m_event_queue.p_queue[m_event_queue.tail].bytes; + p_event->crc = m_event_queue.p_queue[m_event_queue.tail].crc; + memcpy(p_event->data, + m_event_queue.p_queue[m_event_queue.tail].data, + sizeof(p_event->data)); + + // Release the event queue. + m_event_queue.tail = ((m_event_queue.tail + 1u) & (ANTFS_EVENT_QUEUE_SIZE - 1u)); + + return_value = true; + } + + return return_value; +} + + +/**@brief Function for setting the channel period. + * + * Sets the channel period. The only allowed frequencies are 0.5, 1, 2, 4 and 8 Hz. + * + * @param[in] link_period Link period for the beacon transmission. + */ +static void channel_period_set(uint32_t link_period) +{ + uint32_t period; + + switch (link_period) + { + default: + // Shouldn't happen, but just in case default to 0,5Hz. + case BEACON_PERIOD_0_5_HZ: + period = 65535u; + break; + + case BEACON_PERIOD_1_HZ: + period = 32768u; + break; + + case BEACON_PERIOD_2_HZ: + period = 16384u; + break; + + case BEACON_PERIOD_4_HZ: + period = 8192u; + break; + + case BEACON_PERIOD_8_HZ: + period = 4096u; + break; + } + + const uint32_t err_code = sd_ant_channel_period_set(ANTFS_CHANNEL, period); + APP_ERROR_CHECK(err_code); +} + + +/**@brief Function for starting ANT-FS timeout. + * + * @param[in] timeout_in_secs Timeout requested in unit of seconds. + */ +static void timeout_start(uint32_t timeout_in_secs) +{ + uint32_t err_code = app_timer_stop(m_timer_id); + APP_ERROR_CHECK(err_code); + + err_code = app_timer_start(m_timer_id, + APP_TIMER_TICKS((uint32_t)(timeout_in_secs * 1000u), + APP_TIMER_PRESCALER), + NULL); + APP_ERROR_CHECK(err_code); +} + + +/**@brief Function for switching to authentication layer. + */ +static void authenticate_layer_transit(void) +{ + if (m_current_state.state != ANTFS_STATE_OFF) + { + m_current_state.state = ANTFS_STATE_AUTH; + m_current_state.sub_state.auth_sub_state = ANTFS_AUTH_SUBSTATE_NONE; + m_link_command_in_progress = ANTFS_CMD_NONE; + + timeout_start(ANTFS_LINK_COMMAND_TIMEOUT); + + uint32_t err_code = sd_ant_channel_radio_freq_set(ANTFS_CHANNEL, m_active_beacon_frequency); + APP_ERROR_CHECK(err_code); + + event_queue_write(ANTFS_EVENT_AUTH); + } +} + + +/**@brief Function for decoding an ANT-FS command received at the link layer. + * + * @param[in] p_command_buffer The ANT-FS command buffer. + */ +static void link_layer_cmd_decode(const uint8_t * p_command_buffer) +{ + if (p_command_buffer[ANTFS_CONNECTION_TYPE_OFFSET] != ANTFS_COMMAND_ID) + { + return; + } + + switch (p_command_buffer[ANTFS_COMMAND_OFFSET]) + { + case ANTFS_CMD_LINK_ID: + // Channel frequency. + m_active_beacon_frequency = + p_command_buffer[TRANSPORT_CHANNEL_FREQUENCY_OFFSET]; + // Channel message period. + m_active_beacon_status1_field.parameters.link_period = + p_command_buffer[TRANSPORT_MESSAGE_PERIOD_OFFSET]; + // Host serial Number. + m_link_host_serial_number.bytes.byte0 = + p_command_buffer[HOST_ID_OFFSET_0]; + m_link_host_serial_number.bytes.byte1 = + p_command_buffer[HOST_ID_OFFSET_1]; + m_link_host_serial_number.bytes.byte2 = + p_command_buffer[HOST_ID_OFFSET_2]; + m_link_host_serial_number.bytes.byte3 = + p_command_buffer[HOST_ID_OFFSET_3]; + + // Move to the channel period issued by the host. + channel_period_set(m_active_beacon_status1_field.parameters.link_period); + + authenticate_layer_transit(); + break; + + default: + break; + } +} + + +/**@brief Function for switching to link layer. + */ +static void link_layer_transit(void) +{ + if (m_current_state.state != ANTFS_STATE_OFF) + { + uint32_t err_code; +#ifdef LEDDRIVER_ACTIVE + err_code = bsp_indication_set(BSP_INDICATE_IDLE); + APP_ERROR_CHECK(err_code); +#endif // LEDDRIVER_ACTIVE + + m_current_state.state = ANTFS_STATE_LINK; + m_current_state.sub_state.link_sub_state = ANTFS_LINK_SUBSTATE_NONE; + m_link_command_in_progress = ANTFS_CMD_NONE; + m_active_beacon_status1_field = m_initial_parameters.beacon_status_byte1; + m_active_beacon_frequency = m_initial_parameters.beacon_frequency; + + timeout_disable(); + + err_code = sd_ant_channel_radio_freq_set(ANTFS_CHANNEL, m_active_beacon_frequency); + APP_ERROR_CHECK(err_code); + + event_queue_write(ANTFS_EVENT_LINK); + } +} + + +/**@brief Function for decoding an ANT-FS command received at the authenticate layer. + * + * @param[in] control_byte The command control byte. + * @param[in] p_command_buffer The ANT-FS command buffer. + */ +static void authenticate_layer_cmd_decode(uint8_t control_byte, + const uint8_t * p_command_buffer) +{ + // @note: Response variable must have a static storage allocation as it keeps track of the + // passkey authentication progress between multiple burst packets. +#if defined (ANTFS_AUTH_TYPE_PASSKEY) + static uint32_t response; +#endif // ANTFS_AUTH_TYPE_PASSKEY + + if((control_byte & ~SEQUENCE_LAST_MESSAGE) == 0 && m_link_command_in_progress != ANTFS_CMD_NONE) + { + // This is something new, and we're busy processing something already, so don't respond + return; + } + + if (p_command_buffer[ANTFS_CONNECTION_TYPE_OFFSET] == ANTFS_COMMAND_ID && + m_link_command_in_progress == ANTFS_CMD_NONE) + { + if (p_command_buffer[ANTFS_COMMAND_OFFSET] == ANTFS_CMD_AUTHENTICATE_ID) + { + // Make sure it is the correct host + if(m_link_host_serial_number.bytes.byte0 != p_command_buffer[HOST_ID_OFFSET_0] || + m_link_host_serial_number.bytes.byte1 != p_command_buffer[HOST_ID_OFFSET_1] || + m_link_host_serial_number.bytes.byte2 != p_command_buffer[HOST_ID_OFFSET_2] || + m_link_host_serial_number.bytes.byte3 != p_command_buffer[HOST_ID_OFFSET_3]) + return; + + m_link_command_in_progress = ANTFS_CMD_AUTHENTICATE_ID; + m_authenticate_command_type = p_command_buffer[COMMAND_TYPE_OFFSET]; + m_retry = AUTHENTICATION_RETRIES; + } + } + + if (m_link_command_in_progress == ANTFS_CMD_AUTHENTICATE_ID) + { + switch (m_authenticate_command_type) + { + case COMMAND_TYPE_REQUEST_SERIAL: + if (control_byte & SEQUENCE_LAST_MESSAGE) + { + // Don't do anything before the burst completes (last burst message received). + timeout_start(ANTFS_LINK_COMMAND_TIMEOUT); + authenticate_response_transmit(AUTH_RESPONSE_N_A, + ANTFS_REMOTE_FRIENDLY_NAME_MAX, + // Send device friendly name if it exists. + m_initial_parameters.p_remote_friendly_name); + } + break; + +#if defined (ANTFS_AUTH_TYPE_PASSTHROUGH) + case COMMAND_TYPE_PROCEED: + if (control_byte & SEQUENCE_LAST_MESSAGE) + { + // Don't do anything before the burst completes (last burst message received). + timeout_start(ANTFS_LINK_COMMAND_TIMEOUT); + // Proceed directly to transport layer (no authentication required). + authenticate_response_transmit(AUTH_RESPONSE_ACCEPT, 0, NULL); + } + break; + +#endif // ANTFS_AUTH_TYPE_PASSTHROUGH +#if defined (ANTFS_AUTH_TYPE_PAIRING) + case COMMAND_TYPE_REQUEST_PAIR: + if ((control_byte & SEQUENCE_NUMBER_ROLLOVER) == 0) + { + // First burst packet. + + // Friendly name length. + m_friendly_name.friendly_name_size = + p_command_buffer[AUTH_STRING_LENGTH_OFFSET]; + + if (m_friendly_name.friendly_name_size > 0) + { + if (m_friendly_name.friendly_name_size > ANTFS_FRIENDLY_NAME_MAX) + { + m_friendly_name.friendly_name_size = ANTFS_FRIENDLY_NAME_MAX; + } + + m_friendly_name.index = 0; + } + } + else + { + // Next burst packets: read host friendly name. + + if (m_friendly_name.index < ANTFS_FRIENDLY_NAME_MAX) + { + uint32_t num_of_bytes = ANTFS_FRIENDLY_NAME_MAX - m_friendly_name.index; + if (num_of_bytes > 8u) + { + num_of_bytes = 8u; + } + memcpy((uint8_t*)&m_friendly_name.friendly_name[m_friendly_name.index], + p_command_buffer, + num_of_bytes); + m_friendly_name.index += num_of_bytes; + } + } + + if (control_byte & SEQUENCE_LAST_MESSAGE) + { + // Last burst packet. + + timeout_start(ANTFS_PAIRING_TIMEOUT); + if (m_friendly_name.friendly_name_size > 0) + { + m_friendly_name.is_name_set = true; + } + + m_current_state.sub_state.auth_sub_state = ANTFS_AUTH_SUBSTATE_PAIR; + // If pairing is supported, send request to UI. + event_queue_write(ANTFS_EVENT_PAIRING_REQUEST); + } + break; + +#endif // ANTFS_AUTH_TYPE_PAIRING +#if defined (ANTFS_AUTH_TYPE_PASSKEY) + case COMMAND_TYPE_REQUEST_PASSKEY: + if ((control_byte & SEQUENCE_NUMBER_ROLLOVER) == 0) + { + // First burst packet. + + // Passkey length. + const uint32_t passkey_size = p_command_buffer[AUTH_STRING_LENGTH_OFFSET]; + + // Default the algorithm to accept. + response = AUTH_RESPONSE_ACCEPT; + + // Check if the passkey length is valid. + if (passkey_size == ANTFS_PASSKEY_SIZE) + { + m_passkey_index = 0; + } + else + { + // Invalid lenght supplied - the authentication will be rejected. + response = AUTH_RESPONSE_REJECT; + } + } + else + { + // Next burst packets: read host friendly name. + + if ((response == AUTH_RESPONSE_ACCEPT) && + // Prevent buffer overrun. + (m_passkey_index != ANTFS_PASSKEY_SIZE)) + { + // Passkey length was valid and the host supplied key matches so far. + uint32_t idx = 0; + + // Check the current received burst packet for passkey match. + do + { + if (m_initial_parameters.p_pass_key[m_passkey_index++] != + p_command_buffer[idx]) + { + // Reject the authentication request and further processing of + // passkey matching if a mismatch is found. + response = AUTH_RESPONSE_REJECT; + break; + } + + ++idx; + } + while (idx < BURST_PACKET_SIZE); + } + } + + if (control_byte & SEQUENCE_LAST_MESSAGE) + { + // Last burst packet. + + if (m_passkey_index < ANTFS_PASSKEY_SIZE) + { + // We did not get the complete passkey, reject authentication request. + response = AUTH_RESPONSE_REJECT; + } + + timeout_start(ANTFS_LINK_COMMAND_TIMEOUT); + m_current_state.sub_state.auth_sub_state = ANTFS_AUTH_SUBSTATE_PASSKEY; + authenticate_response_transmit(response, 0, NULL); + } + break; + +#endif // ANTFS_AUTH_TYPE_PASSKEY + default: + break; + } + } + else if (p_command_buffer[ANTFS_COMMAND_OFFSET] == ANTFS_CMD_DISCONNECT_ID) + { + if (control_byte & SEQUENCE_LAST_MESSAGE) + { + // Don't do anything before the burst completes (last burst message received). + link_layer_transit(); + } + } + else if (p_command_buffer[ANTFS_COMMAND_OFFSET] == ANTFS_CMD_PING_ID) + { + // Reset timeout. + timeout_start(ANTFS_LINK_COMMAND_TIMEOUT); + m_link_command_in_progress = ANTFS_CMD_NONE; + } + else + { + // No implementation needed. + } +} + + +/**@brief Function for decoding an ANT-FS command received at the transport layer. + * + * @param[in] control_byte The command control byte. + * @param[in] p_command_buffer The ANT-FS command buffer. + */ +static void transport_layer_cmd_decode(uint8_t control_byte, const uint8_t * p_command_buffer) +{ + ulong_union_t host_serial_number = {0}; + + if (p_command_buffer[ANTFS_CONNECTION_TYPE_OFFSET] == ANTFS_COMMAND_ID) + { + m_link_command_in_progress = p_command_buffer[ANTFS_COMMAND_OFFSET]; + } + + switch (m_link_command_in_progress) + { + case ANTFS_CMD_PING_ID: + // Reset timeout. + timeout_start(ANTFS_LINK_COMMAND_TIMEOUT); + m_link_command_in_progress = ANTFS_CMD_NONE; + break; + + case ANTFS_CMD_DISCONNECT_ID: + if(control_byte & SEQUENCE_LAST_MESSAGE) + { + // Don't do anything before the burst completes (last burst message received). + link_layer_transit(); + } + break; + + case ANTFS_CMD_ERASE_ID: + if(control_byte & SEQUENCE_LAST_MESSAGE) + { + // Don't do anything before the burst completes (last burst message received). + + // Requested index. + m_file_index.bytes.low = p_command_buffer[DATA_INDEX_OFFSET_LOW]; + m_file_index.bytes.high = p_command_buffer[DATA_INDEX_OFFSET_HIGH]; + + // Send erase request to the application. + event_queue_write(ANTFS_EVENT_ERASE_REQUEST); + timeout_start(ANTFS_LINK_COMMAND_TIMEOUT); + m_link_command_in_progress = ANTFS_CMD_ERASE_ID; + } + break; + + case ANTFS_CMD_DOWNLOAD_ID: + if (m_current_state.sub_state.trans_sub_state != ANTFS_TRANS_SUBSTATE_NONE) + { + // Ignore the command if we are busy. + break; + } + + if ((control_byte & ~SEQUENCE_LAST_MESSAGE) == 0x00) + { + // First burst packet. + + if ((m_file_index.bytes.low != p_command_buffer[DATA_INDEX_OFFSET_LOW]) || + (m_file_index.bytes.high != p_command_buffer[DATA_INDEX_OFFSET_HIGH])) + { + // This is a new index, so we can not check the CRC against the previous saved + // CRC. + + // CRC seed checking is made invalid by setting the last saved offset to the + // maximum file size. + m_saved_crc_offset = ANTFS_MAX_FILE_SIZE; + } + + // Requested data file index. + m_file_index.bytes.low = p_command_buffer[DATA_INDEX_OFFSET_LOW]; + m_file_index.bytes.high = p_command_buffer[DATA_INDEX_OFFSET_HIGH]; + + // Initialize current position in the TX burst to the requested offset. + m_link_burst_index.bytes.byte0 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_0]; + m_link_burst_index.bytes.byte1 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_1]; + m_link_burst_index.bytes.byte2 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_2]; + m_link_burst_index.bytes.byte3 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_3]; + } + else if (control_byte & SEQUENCE_LAST_MESSAGE) + { + // Last burst packet (download command should be two packets long). + + // Get CRC seed from host. + m_compared_crc = (uint16_t)p_command_buffer[DATA_INDEX_OFFSET_LOW]; + m_compared_crc |= ((uint16_t)p_command_buffer[DATA_INDEX_OFFSET_HIGH] << 8u); + + // Maximum block size allowed by host. + m_max_block_size.bytes.byte0 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_0]; + m_max_block_size.bytes.byte1 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_1]; + m_max_block_size.bytes.byte2 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_2]; + m_max_block_size.bytes.byte3 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_3]; + + // Initialize number of remaining bytes for this block to the maximum block size. + m_bytes_remaining.data = m_max_block_size.data; + + if (p_command_buffer[INITIAL_REQUEST_OFFSET]) + { + // This request is the start of a new transfer. + + // Initialize data offset for CRC calculation to the requested data offset. + m_saved_crc_offset = m_link_burst_index.data; + m_saved_buffer_crc_offset = m_link_burst_index.data; + + // Use CRC seed provided by host for CRC checking of the data. + m_transfer_crc = m_compared_crc; + m_saved_transfer_crc = m_compared_crc; + m_saved_buffer_crc = m_compared_crc; + m_current_state.sub_state.trans_sub_state = ANTFS_TRANS_SUBSTATE_VERIFY_CRC; + } + else + { + // This is a request to resume a partially completed transfer. + + if (m_saved_crc_offset > m_link_burst_index.data) + { + // We can not check the received CRC seed as the requested offset is before + // our last save point. + + // Set CRC checking as invalid. + m_saved_crc_offset = ANTFS_MAX_FILE_SIZE; + } + else + { + m_current_state.sub_state.trans_sub_state = ANTFS_TRANS_SUBSTATE_VERIFY_CRC; + } + } + + m_is_data_request_pending = false; + + // Send download request to the application for further handling. + event_queue_write(ANTFS_EVENT_DOWNLOAD_REQUEST); + + timeout_start(ANTFS_LINK_COMMAND_TIMEOUT); + m_link_command_in_progress = ANTFS_CMD_DOWNLOAD_ID; + } + break; + + case ANTFS_CMD_UPLOAD_REQUEST_ID: +#if defined(ANTFS_INCLUDE_UPLOAD) + if ((control_byte & ~SEQUENCE_LAST_MESSAGE) == 0x00) + { + // First burst packet. + + if ((m_file_index.bytes.low != p_command_buffer[DATA_INDEX_OFFSET_LOW]) || + ( + (m_file_index.bytes.high != p_command_buffer[DATA_INDEX_OFFSET_HIGH]) || + (m_current_state.sub_state.trans_sub_state == ANTFS_TRANS_SUBSTATE_NONE) + ) + ) + { + // If it is a new index or we completed the last upload. + + // Get the file index. + m_file_index.bytes.low = p_command_buffer[DATA_INDEX_OFFSET_LOW]; + m_file_index.bytes.high = p_command_buffer[DATA_INDEX_OFFSET_HIGH]; + + // As this is a new upload, reset save point to the beginning of the file. + + // Set CRC to zero. + m_saved_crc_offset = 0; + m_saved_transfer_crc = 0; + } + + // Get the upper limit of upload from request message. + m_max_transfer_index.bytes.byte0 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_0]; + m_max_transfer_index.bytes.byte1 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_1]; + m_max_transfer_index.bytes.byte2 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_2]; + m_max_transfer_index.bytes.byte3 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_3]; + } + else if (control_byte & SEQUENCE_LAST_MESSAGE) + { + // Last burst (second) packet. + + // Get data offset the requested upload will start at. + m_link_burst_index.bytes.byte0 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_0]; + m_link_burst_index.bytes.byte1 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_1]; + m_link_burst_index.bytes.byte2 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_2]; + m_link_burst_index.bytes.byte3 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_3]; + + if (m_link_burst_index.data != ANTFS_MAX_FILE_SIZE) + { + // If this is a new upload. + + // The data offset specified in the upload request will be used. + m_saved_crc_offset = m_link_burst_index.data; + + m_saved_transfer_crc = 0; + } + + m_transfer_crc = m_saved_transfer_crc; + + // Send upload request to the application for further handling. + event_queue_write(ANTFS_EVENT_UPLOAD_REQUEST); + + timeout_start(ANTFS_LINK_COMMAND_TIMEOUT); + m_link_command_in_progress = ANTFS_CMD_UPLOAD_REQUEST_ID; + } +#endif // ANTFS_INCLUDE_UPLOAD + break; + + case ANTFS_CMD_UPLOAD_DATA_ID: +#if defined(ANTFS_INCLUDE_UPLOAD) + if ((control_byte & ~SEQUENCE_LAST_MESSAGE) == 0x00) + { + // First burst packet. + + if (m_current_state.sub_state.trans_sub_state == + ANTFS_TRANS_SUBSTATE_UPLOAD_WAIT_FOR_DATA) + { + antfs_event_t event; + + // Get CRC Seed from host. + m_compared_crc = (uint16_t)p_command_buffer[DATA_INDEX_OFFSET_LOW]; + m_compared_crc |= ((uint16_t)p_command_buffer[DATA_INDEX_OFFSET_HIGH] << 8u); + + // Set download offset. + m_link_burst_index.bytes.byte0 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_0]; + m_link_burst_index.bytes.byte1 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_1]; + m_link_burst_index.bytes.byte2 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_2]; + m_link_burst_index.bytes.byte3 = p_command_buffer[ADDRESS_PARAMETER_OFFSET_3]; + + if ((m_link_burst_index.data + m_block_size.data) < m_max_transfer_index.data) + { + // Adjust block size as set by client. + m_max_transfer_index.data = m_link_burst_index.data + m_block_size.data; + } + + if (m_compared_crc != m_transfer_crc) + { + // Check that the request matches the CRC sent on the upload response. + + // Do not accept any data. + m_max_transfer_index.data = 0; + + // Failure will be reported when upload is done. + event = (antfs_event_t)0; + } + + // Set ready to receive a file. + m_current_state.sub_state.trans_sub_state = ANTFS_TRANS_SUBSTATE_UPLOADING; + + event = ANTFS_EVENT_UPLOAD_START; + m_transfer_crc = m_compared_crc; + + if (m_link_burst_index.data > m_max_transfer_index.data) + { + // If the requested offset is too high. + + // Clear the max transfer index, so we'll report fail when the transfer + // finishes. + m_max_transfer_index.data = 0; + // Clear the event because we normally would not send an event at this point + // in this case. + event = (antfs_event_t)0; + } + + if (control_byte & SEQUENCE_LAST_MESSAGE) + { + // If this upload contains no data. + + // Leave the upload state. + m_current_state.sub_state.trans_sub_state = ANTFS_TRANS_SUBSTATE_NONE; + + // if it was a valid index, report it as a successful upload, otherwise + // report it as a failure. + if (event == 0) + { + event = ANTFS_EVENT_UPLOAD_FAIL; + } + else + { + event = ANTFS_EVENT_UPLOAD_COMPLETE; + } + } + + if (event != 0) + { + event_queue_write(event); + } + } + } +#endif // ANTFS_INCLUDE_UPLOAD + break; + + case ANTFS_CMD_LINK_ID: + host_serial_number.bytes.byte0 = p_command_buffer[HOST_ID_OFFSET_0]; + host_serial_number.bytes.byte1 = p_command_buffer[HOST_ID_OFFSET_1]; + host_serial_number.bytes.byte2 = p_command_buffer[HOST_ID_OFFSET_2]; + host_serial_number.bytes.byte3 = p_command_buffer[HOST_ID_OFFSET_3]; + + if (m_link_host_serial_number.data == host_serial_number.data) + { + m_active_beacon_frequency = p_command_buffer[TRANSPORT_CHANNEL_FREQUENCY_OFFSET]; + m_active_beacon_status1_field.parameters.link_period = + p_command_buffer[TRANSPORT_MESSAGE_PERIOD_OFFSET]; + + const uint32_t err_code = sd_ant_channel_radio_freq_set(ANTFS_CHANNEL, + m_active_beacon_frequency); + APP_ERROR_CHECK(err_code); + + channel_period_set(m_active_beacon_status1_field.parameters.link_period); + } + + m_link_command_in_progress = 0; + break; + + default: + // Don't do anything, this is an invalid message. + m_link_command_in_progress = 0; + break; + } +} + + +/**@brief Function for handling data upload. + * + * @param[in] control_byte The command control byte. + * @param[in] p_buffer The data buffer. + */ +static void upload_data_process(uint8_t control_byte, const uint8_t * p_buffer) +{ +#if defined(ANTFS_INCLUDE_UPLOAD) + if (control_byte & SEQUENCE_LAST_MESSAGE) + { + // Last burst packet: upload complete. + + m_current_state.sub_state.trans_sub_state = ANTFS_TRANS_SUBSTATE_NONE; + + // CRC for data packets contained in this upload block. + m_compared_crc = p_buffer[UPLOAD_CRC_OFFSET_LOW ]; + m_compared_crc |= (p_buffer[UPLOAD_CRC_OFFSET_HIGH] << 8u); + + if (m_max_transfer_index.data && (m_compared_crc == m_transfer_crc)) + { + // CRC OK, upload was completed successfully. + event_queue_write(ANTFS_EVENT_UPLOAD_COMPLETE); + } + else + { + // CRC mismatch, upload failed. + event_queue_write(ANTFS_EVENT_UPLOAD_FAIL); + } + + m_max_transfer_index.data = 0; + } + else + { + // Not the last burst packet: upload not complete. + + // Set initial number of bytes to 8 (size of burst packet). + m_bytes_to_write = BURST_PACKET_SIZE; + timeout_start(ANTFS_LINK_COMMAND_TIMEOUT); + + if (m_link_burst_index.data > m_max_transfer_index.data) + { + // We are past the main index, we do not need to write any more data. + m_bytes_to_write = 0; + } + else + { + if ((m_bytes_to_write + m_link_burst_index.data) > m_max_transfer_index.data) + { + // if we're less than 8 bytes away from the end, adjust the number of bytes to write + // in this block. + m_bytes_to_write = m_max_transfer_index.data - m_link_burst_index.data; + } + } + + if (m_bytes_to_write != 0) + { + APP_ERROR_CHECK_BOOL(m_bytes_to_write <= BURST_PACKET_SIZE); + + // Store begin of upload data. + mp_upload_data = p_buffer; + + m_transfer_crc = crc_crc16_update(m_transfer_crc, p_buffer, m_bytes_to_write); + + // Send data to application. + event_queue_write(ANTFS_EVENT_UPLOAD_DATA); + + // Update current offset. + m_link_burst_index.data += m_bytes_to_write; + + // Store save point. + m_saved_crc_offset = m_link_burst_index.data; + m_saved_transfer_crc = m_transfer_crc; + } + } +#endif // ANTFS_INCLUDE_UPLOAD +} + + +/**@brief Function for switching to transport layer. + */ +static void transport_layer_transit(void) +{ + if (m_current_state.state != ANTFS_STATE_OFF) + { +#ifdef LEDDRIVER_ACTIVE + uint32_t err_code = bsp_indication_set(BSP_INDICATE_IDLE); + APP_ERROR_CHECK(err_code); +#endif // LEDDRIVER_ACTIVE + m_current_state.state = ANTFS_STATE_TRANS; + m_current_state.sub_state.trans_sub_state = ANTFS_TRANS_SUBSTATE_NONE; + + timeout_start(ANTFS_LINK_COMMAND_TIMEOUT); + + beacon_transmit(MESG_BROADCAST_DATA_ID); + + event_queue_write(ANTFS_EVENT_TRANS); + } +} + + +void antfs_message_process(uint8_t * p_message) +{ +#ifdef LEDDRIVER_ACTIVE + uint32_t err_code; +#endif + + if (p_message != NULL) + { + if ((p_message[BUFFER_INDEX_CHANNEL_NUM] & CHANNEL_NUMBER_MASK) != ANTFS_CHANNEL) + { + // Only process messages corresponding to the ANT-FS channel here. + return; + } + + if ((m_current_state.state == ANTFS_STATE_OFF) && + ( + !( + (p_message[BUFFER_INDEX_MESG_ID] == MESG_RESPONSE_EVENT_ID) && + (p_message[BUFFER_INDEX_RESPONSE_CODE] == NO_EVENT) + ) + ) + ) + { + return; + } + + switch (p_message[BUFFER_INDEX_MESG_ID]) + { + case MESG_BROADCAST_DATA_ID: + // We are not going to process broadcast messages or pass them to the app to handle. + break; + + case MESG_ACKNOWLEDGED_DATA_ID: + // Mark it as being the last message if it's an ack message. + p_message[ANTFS_CONTROL_OFFSET] |= SEQUENCE_LAST_MESSAGE; + + /* fall-through */ + case MESG_BURST_DATA_ID: + switch (m_current_state.state) + { + case ANTFS_STATE_LINK: + link_layer_cmd_decode(&p_message[ANTFS_DATA_OFFSET]); + break; + + case ANTFS_STATE_AUTH: + authenticate_layer_cmd_decode(p_message[ANTFS_CONTROL_OFFSET], + &p_message[ANTFS_DATA_OFFSET]); + break; + + case ANTFS_STATE_TRANS: + if (m_current_state.sub_state.trans_sub_state != + ANTFS_TRANS_SUBSTATE_UPLOADING) + { + transport_layer_cmd_decode(p_message[ANTFS_CONTROL_OFFSET], + &p_message[ANTFS_DATA_OFFSET]); + } + else + { + upload_data_process(p_message[ANTFS_CONTROL_OFFSET], + &p_message[ANTFS_DATA_OFFSET]); + } + break; + + default: + // If in any other state or sub-state, do nothing. + break; + } + break; + + case MESG_RESPONSE_EVENT_ID: + // Branch on event ID. + switch (p_message[BUFFER_INDEX_RESPONSE_CODE]) + { + case EVENT_TRANSFER_TX_FAILED: + m_link_command_in_progress = ANTFS_CMD_NONE; + // Switch into the appropriate state after the failure. Must be ready for + // the host to do a retry. + switch (m_current_state.state) + { + case ANTFS_STATE_LINK: + link_layer_transit(); + break; + + case ANTFS_STATE_AUTH: + // Burst failed, retry sending the response + if(!m_retry) + { + authenticate_layer_transit(); // Reload beacon + } + else + { + if(m_current_state.sub_state.auth_sub_state == ANTFS_AUTH_SUBSTATE_ACCEPT) + { + if(m_authenticate_command_type == COMMAND_TYPE_REQUEST_PAIR) + { + authenticate_response_transmit(AUTH_RESPONSE_ACCEPT, ANTFS_PASSKEY_SIZE, + m_initial_parameters.p_pass_key); + } + else + { + authenticate_response_transmit(AUTH_RESPONSE_ACCEPT, 0, NULL); + } + } + else if(m_current_state.sub_state.auth_sub_state == ANTFS_AUTH_SUBSTATE_REJECT) + { + authenticate_response_transmit(AUTH_RESPONSE_REJECT, 0, NULL); + } + else if(m_authenticate_command_type == COMMAND_TYPE_REQUEST_SERIAL) + { + authenticate_response_transmit(AUTH_RESPONSE_N_A, + ANTFS_REMOTE_FRIENDLY_NAME_MAX, + // Send device friendly name if it exists. + m_initial_parameters.p_remote_friendly_name); + } + else + { + // No implementation needed + } + + m_retry--; + } + + break; + + case ANTFS_STATE_TRANS: + if (m_current_state.sub_state.trans_sub_state == + ANTFS_TRANS_SUBSTATE_DOWNLOADING) + { + event_queue_write(ANTFS_EVENT_DOWNLOAD_FAIL); + } + transport_layer_transit(); + break; + + default: + // No implementation needed. + break; + } + break; + + case EVENT_TRANSFER_RX_FAILED: + m_link_command_in_progress = ANTFS_CMD_NONE; + + if (m_current_state.sub_state.trans_sub_state == + ANTFS_TRANS_SUBSTATE_UPLOADING) + { + event_queue_write(ANTFS_EVENT_UPLOAD_FAIL); + + m_current_state.sub_state.trans_sub_state = + ANTFS_TRANS_SUBSTATE_UPLOAD_RESUME; + } + else + { + // No implementation needed + } + + break; + + case EVENT_TRANSFER_TX_COMPLETED: + m_link_command_in_progress = ANTFS_CMD_NONE; + + // Switch into appropiate state after successful command. + switch (m_current_state.state) + { + case ANTFS_STATE_AUTH: + if (m_current_state.sub_state.auth_sub_state == + ANTFS_AUTH_SUBSTATE_ACCEPT) + { + // We passed authentication, so go to transport state. + transport_layer_transit(); + } + else if (m_current_state.sub_state.auth_sub_state == + ANTFS_AUTH_SUBSTATE_REJECT) + { + // We failed authentication, so go to link state. + link_layer_transit(); + } + else + { + // Reload beacon. + authenticate_layer_transit(); + } + break; + + case ANTFS_STATE_TRANS: + if (m_current_state.sub_state.trans_sub_state == + ANTFS_TRANS_SUBSTATE_DOWNLOADING) + { + event_queue_write(ANTFS_EVENT_DOWNLOAD_COMPLETE); + } + if (m_current_state.sub_state.trans_sub_state != + ANTFS_TRANS_SUBSTATE_UPLOAD_WAIT_FOR_DATA) + { + transport_layer_transit(); // Reload beacon. + } + break; + + default: + link_layer_transit(); // Reload beacon. + break; + } + break; + + case EVENT_TX: +#ifdef LEDDRIVER_ACTIVE + err_code = bsp_indication_set(BSP_INDICATE_SENT_OK); + APP_ERROR_CHECK(err_code); +#endif // LEDDRIVER_ACTIVE + // Load beacon. + beacon_transmit(MESG_BROADCAST_DATA_ID); + break; + + case EVENT_CHANNEL_CLOSED: + event_queue_write(ANTFS_EVENT_CLOSE_COMPLETE); + break; + + case NO_EVENT: + // This shouldn't happen... command responses should not occur. + APP_ERROR_HANDLER(p_message[BUFFER_INDEX_RESPONSE_CODE]); + break; + + default: + // No implementation needed. + return; + } + break; + + default: + // No implementation needed. + return; + } + } +} + + +void antfs_channel_setup(void) +{ + const uint8_t network_key[] = ANTFS_NETWORK_KEY; + + // Start channel configuration. + uint32_t err_code = sd_ant_network_address_set(ANTFS_NETWORK_NUMBER, (uint8_t*)network_key); + APP_ERROR_CHECK(err_code); + + err_code = sd_ant_channel_assign(ANTFS_CHANNEL, ANTFS_CHANNEL_TYPE, ANTFS_NETWORK_NUMBER, 0); + APP_ERROR_CHECK(err_code); + + // Use the lower 2 bytes of the ESN for device number. + uint16_t device_number = (uint16_t)(m_initial_parameters.client_serial_number & 0x0000FFFFu); + if (device_number == 0) + { + // Device number of 0 is not allowed. + device_number = 2; + } + + err_code = sd_ant_channel_id_set(ANTFS_CHANNEL, + device_number, + ANTFS_DEVICE_TYPE, + ANTFS_TRANS_TYPE); + APP_ERROR_CHECK(err_code); + + // Remain in initialization state until channel is open. + m_current_state.state = ANTFS_STATE_INIT; + // @note: Channel frequency is set by function below. + link_layer_transit(); + m_current_state.state = ANTFS_STATE_INIT; + + channel_period_set(m_active_beacon_status1_field.parameters.link_period); + + err_code = sd_ant_channel_open(ANTFS_CHANNEL); + APP_ERROR_CHECK(err_code); + + err_code = sd_ant_channel_radio_tx_power_set(ANTFS_CHANNEL, + ANTFS_TRANSMIT_POWER, + ANTFS_CUSTOM_TRANSMIT_POWER); + APP_ERROR_CHECK(err_code); + + m_current_state.state = ANTFS_STATE_LINK; + m_current_state.sub_state.link_sub_state = ANTFS_LINK_SUBSTATE_NONE; + + event_queue_write(ANTFS_EVENT_OPEN_COMPLETE); + + // Start beacon broadcast. + beacon_transmit(MESG_BROADCAST_DATA_ID); +} + + +/**@brief Function for resetting the ANT-FS state machine. + */ +static void state_machine_reset(void) +{ + m_current_state.state = ANTFS_STATE_OFF; + m_link_command_in_progress = ANTFS_CMD_NONE; + + timeout_disable(); + + // Reset the ANT-FS event queue. + m_event_queue.p_queue = m_event_queue_buffer; + m_event_queue.head = 0; + m_event_queue.tail = 0; + + // Set as invalid. + m_authenticate_command_type = 0xFFu; + m_retry = 0; + + m_saved_crc_offset = 0xFFFFFFFFu; + m_max_transfer_index.data = 0; + m_is_crc_pending = false; + m_is_data_request_pending = false; + + m_friendly_name.is_name_set = false; + m_friendly_name.index = 0; + + memset(m_friendly_name.friendly_name, 0, ANTFS_FRIENDLY_NAME_MAX); +} + + +/**@brief Function for ANT-FS timer event. + * + * Handles pairing and command timeouts. + * + * @param[in] p_context The callback context. + */ +static void timeout_handle(void * p_context) +{ + if (m_current_state.state == ANTFS_STATE_OFF) + { + return; + } + + if ((m_current_state.state == ANTFS_STATE_AUTH) && + // Pairing timeout. + (m_current_state.sub_state.auth_sub_state == ANTFS_AUTH_SUBSTATE_PAIR)) + { + // Reject authentication request and send pairing timeout event. + authenticate_response_transmit(AUTH_RESPONSE_REJECT, 0, NULL); + event_queue_write(ANTFS_EVENT_PAIRING_TIMEOUT); + } + + // Fall back to link layer when an ANT-FS event times out. + link_layer_transit(); +} + + +void antfs_init(const antfs_params_t * const p_params, + antfs_burst_wait_handler_t burst_wait_handler) +{ + m_initial_parameters = *p_params; + m_burst_wait_handler = burst_wait_handler; + m_active_beacon_status1_field = m_initial_parameters.beacon_status_byte1; + + uint32_t err_code = app_timer_create(&m_timer_id, APP_TIMER_MODE_SINGLE_SHOT, timeout_handle); + APP_ERROR_CHECK(err_code); + + state_machine_reset(); + + err_code = sd_ant_burst_handler_wait_flag_enable((uint8_t *)(&m_burst_wait)); + APP_ERROR_CHECK(err_code); +} diff --git a/components/libraries/ant_fs/antfs.h b/components/libraries/ant_fs/antfs.h new file mode 100644 index 0000000..f06cc8b --- /dev/null +++ b/components/libraries/ant_fs/antfs.h @@ -0,0 +1,350 @@ +/* +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 Dynastream Innovations Inc. 2012 +All rights reserved. +*/ + +/**@file + * @brief The ANT-FS client protocol interface. + * This file is based on implementation originally made by Dynastream Innovations Inc. - August 2012 + * @defgroup ant_fs_client_main ANT-FS client device simulator + * @{ + * @ingroup ant_sdk_utils + * + * @brief The ANT-FS client device simulator. + * + * @note The ANT-FS Network Key is available for ANT+ Adopters. Please refer to http://thisisant.com to become an ANT+ Adopter and access the key. + */ + +#ifndef ANTFS_H__ +#define ANTFS_H__ + +#include +#include +#include "defines.h" +#include "antfs_config.h" + +#define ANTFS_VERSION_MAJOR 1u /**< Version major number. */ +#define ANTFS_VERSION_MINOR 0 /**< Version minor number. */ +#define ANTFS_VERSION_ITERATION 0 /**< Version iteration. */ +#define ANTFS_VERSION_TYPE 'R' /**< Version type is release. */ +#define ANTFS_VERSION_SPEC '0.AK' /**< Version of the ANT-FS Technology Specification. */ +#define ANTFS_DIR_STRUCT_VERSION 1u /**< Version of the directory file structure. */ +#define ANTFS_VERSION_DATE 20090522u /**< Version date. */ + +// ANT-FS options. +#define ANTFS_NETWORK_NUMBER 0 /**< ANT-FS Network Number. */ +#define ANTFS_CHANNEL 0 /**< ANT Channel Number. */ +#define ANTFS_LINK_FREQ 50u /**< RF Frequency (+2400MHz). */ +#define ANTFS_PAIRING_TIMEOUT 120u /**< Pairing timeout (time the UI will wait for a response to the pairing request before switching to the link layer, in seconds). */ +#define ANTFS_LINK_COMMAND_TIMEOUT 10u /**< Command timeout (time the client will wait without receiving any commands before switching to the link layer, in seconds). */ +#define ANTFS_TRANS_TYPE 5u /**< ANT-FS Transmission Type. */ +#define ANTFS_CHANNEL_TYPE CHANNEL_TYPE_MASTER /**< ANT-FS Client Channel Type. */ +#define ANTFS_BEACON_PERIOD_STATUS BEACON_PERIOD_4_HZ /**< ANT-FS Beacon Message Period. */ +#define ANTFS_TRANSMIT_POWER 3u /**< ANT Transmit Power (0dBm). */ +#define ANTFS_CUSTOM_TRANSMIT_POWER 0u /**< ANT Custom Transmit Power (0dBm). */ +#define ANTFS_AUTH_STRING_MAX 255u /**< Maximum size of authentication strings (passkey/friendly name). */ +#define ANTFS_PASSKEY_SIZE 16u /**< Passkey size. */ +#define ANTFS_FRIENDLY_NAME_MAX 16u /**< Maximum size of friendly name received from host. */ +#define ANTFS_REMOTE_FRIENDLY_NAME_MAX 16u /**< Maximum size of client's friendly name. */ + +// Beacon definitions. +#define BEACON_PERIOD_SHIFT 0x00 /**< Shift value for masking out beacon period. */ +#define BEACON_PERIOD_MASK (0x07u << BEACON_PERIOD_SHIFT) /**< Beacon period bitmask. */ +#define BEACON_PERIOD_0_5_HZ (0x00 << BEACON_PERIOD_SHIFT) /**< Value for 0,5Hz beacon period. */ +#define BEACON_PERIOD_1_HZ (0x01u << BEACON_PERIOD_SHIFT) /**< Value for 1Hz beacon period. */ +#define BEACON_PERIOD_2_HZ (0x02u << BEACON_PERIOD_SHIFT) /**< Value for 2Hz beacon period. */ +#define BEACON_PERIOD_4_HZ (0x03u << BEACON_PERIOD_SHIFT) /**< Value for 4Hz beacon period. */ +#define BEACON_PERIOD_8_HZ (0x04u << BEACON_PERIOD_SHIFT) /**< Value for 8Hz beacon period. */ +#define PAIRING_AVAILABLE_FLAG_SHIFT 0x03u /**< Shift value for masking out pairing enabled bit. */ +#define PAIRING_AVAILABLE_FLAG_MASK (0x01u << PAIRING_AVAILABLE_FLAG_SHIFT) /**< Pairing enabled bitmask. */ +#define UPLOAD_ENABLED_FLAG_SHIFT 0x04u /**< Shift value for masking out upload enabled bit. */ +#define UPLOAD_ENABLED_FLAG_MASK (0x01u << UPLOAD_ENABLED_FLAG_SHIFT) /**< Upload enabled bitmask. */ +#define DATA_AVAILABLE_FLAG_SHIFT 0x05u /**< Shift value for masking out data available bit. */ +#define DATA_AVAILABLE_FLAG_MASK (0x01u << DATA_AVAILABLE_FLAG_SHIFT) /**< Data available bitmask. */ + +// Build the default beacon settings. +#if defined (ANTFS_AUTH_TYPE_PAIRING) + #define ANTFS_PAIRING_BIT PAIRING_AVAILABLE_FLAG_MASK /**< Build pairing enabled default beacon setting. */ +#else + #define ANTFS_PAIRING_BIT 0x00u /**< Build pairing disabled default beacon setting. */ +#endif // ANTFS_INCLUDE_PAIRING +#if defined (ANTFS_INCLUDE_UPLOAD) + #define ANTFS_UPLOAD_BIT UPLOAD_ENABLED_FLAG_MASK /**< Build upload enabled default beacon setting. */ +#else + #define ANTFS_UPLOAD_BIT 0x00u /**< Build upload disabled default beacon setting. */ +#endif // ANTFS_INCLUDE_UPLOAD + +#define ANTFS_DEFAULT_BEACON (ANTFS_BEACON_PERIOD_STATUS | ANTFS_UPLOAD_BIT | ANTFS_PAIRING_BIT | DATA_AVAILABLE_FLAG_MASK) /**< Define the default beacon setting. */ + +// Download/Upload responses. +#define RESPONSE_MESSAGE_OK 0x00u /**< Download request ok. */ +#define RESPONSE_MESSAGE_NOT_EXIST 0x01u /**< File does not exist. */ +#define RESPONSE_MESSAGE_NOT_AVAILABLE 0x02u /**< File can not be read/written to (download/upload respectively). */ +#define RESPONSE_INVALID_OPERATION 0x04u /**< Request invalid. */ +// Download responses. +#define RESPONSE_MESSAGE_NOT_READY 0x03u /**< Not ready to download. */ +#define RESPONSE_INVALID_CRC 0x05u /**< CRC incorrect. */ +// Upload responses. +#define RESPONSE_MESSAGE_NOT_ENOUGH_SPACE 0x03u /**< Not enough space to to complete write. */ +#define RESPONSE_MESSAGE_UPLOAD_NOT_READY 0x05u /**< Not ready to upload */ +// Upload/Erase responses. +#define RESPONSE_MESSAGE_FAIL 0x01u /**< Data File Index does not exist / Erase failed. */ + +// Directory general file flags. +#define ANTFS_DIR_READ_MASK 0x80u /**< Read (can download). */ +#define ANTFS_DIR_WRITE_MASK 0x40u /**< Write (can upload). */ +#define ANTFS_DIR_ERASE_MASK 0x20u /**< Erase (can erase). */ +#define ANTFS_DIR_ARCHIVE_MASK 0x10u /**< Archive (has been downloaded). */ +#define ANTFS_DIR_APPEND_MASK 0x08u /**< Append (can append to file only). */ + +#define ANTFS_MAX_FILE_SIZE 0xFFFFFFFFu /**< Maximum file size, as specified by directory structure. */ +#define ANTFS_BURST_BLOCK_SIZE 16u /**< Size of each block of burst data that the client attempts to send when it processes a data request event. */ + +/**@brief ANT-FS beacon status. */ +typedef union +{ + uint32_t status; /**< Beacon status byte 1. */ + + struct + { + uint32_t link_period : 3; /**< Beacon period (0.5 - 8 Hz). */ + bool is_pairing_enabled : 1; /**< Pairing is enabled/disabled. */ + bool is_upload_enabled : 1; /**< Upload is enabled/disabled. */ + bool is_data_available : 1; /**< Data is available for download / no data available. */ + bool reserved : 2; /**< Reserved. */ + } parameters; +} antfs_beacon_status_byte1_t; + +// ANT-FS states. +typedef enum +{ + ANTFS_STATE_OFF, /**< Off state. */ + ANTFS_STATE_INIT, /**< Init state. */ + ANTFS_STATE_LINK, /**< Link state. */ + ANTFS_STATE_AUTH, /**< Authenticate state. */ + ANTFS_STATE_TRANS /**< Transport state. */ +} antfs_state_t; + +// ANT-FS link layer substates. +typedef enum +{ + ANTFS_LINK_SUBSTATE_NONE /**< None state. */ +} antfs_link_substate_t; + +// ANT-FS authenticate layer substates. */ +typedef enum +{ + ANTFS_AUTH_SUBSTATE_NONE, /**< None state. */ + ANTFS_AUTH_SUBSTATE_PAIR, /**< Pairing state. */ + ANTFS_AUTH_SUBSTATE_PASSKEY, /**< Passkey state. */ + ANTFS_AUTH_SUBSTATE_ACCEPT, /**< Authenticate accept state. */ + ANTFS_AUTH_SUBSTATE_REJECT /**< Authenticate reject state. */ +} antfs_authenticate_substate_t; + +// ANT-FS transport layer substates. */ +typedef enum +{ + ANTFS_TRANS_SUBSTATE_NONE, /**< None state. */ + ANTFS_TRANS_SUBSTATE_VERIFY_CRC, /**< Verify CRC state. */ + ANTFS_TRANS_SUBSTATE_DOWNLOADING, /**< Downloading state. */ + ANTFS_TRANS_SUBSTATE_UPLOAD_WAIT_FOR_DATA, /**< Wait for upload data request state. */ + ANTFS_TRANS_SUBSTATE_UPLOADING, /**< Ready / receiving upload data state. */ + ANTFS_TRANS_SUBSTATE_UPLOAD_RESUME /**< RX failure upon receiving upload data state. */ +} antfs_transport_substate_t; + +// ANT-FS Events. +typedef enum +{ + ANTFS_EVENT_PAIRING_REQUEST = 0xB0, /**< Pairing request event. */ + ANTFS_EVENT_PAIRING_TIMEOUT = 0xB1, /**< Pairing timeout event. */ + ANTFS_EVENT_OPEN_COMPLETE = 0xB2, /**< Channel setup complete event. */ + ANTFS_EVENT_CLOSE_COMPLETE = 0xB4, /**< Channel closed event. */ + ANTFS_EVENT_LINK = 0xB6, /**< Enter link layer event. */ + ANTFS_EVENT_AUTH = 0xB7, /**< Enter authenticate layer event. */ + ANTFS_EVENT_TRANS = 0xB8, /**< Enter transport layer event. */ + ANTFS_EVENT_DOWNLOAD_REQUEST = 0xB9, /**< Download request event. */ + ANTFS_EVENT_DOWNLOAD_REQUEST_DATA = 0xBA, /**< Download request data event. */ + ANTFS_EVENT_DOWNLOAD_START = 0xBB, /**< Download started event. */ + ANTFS_EVENT_DOWNLOAD_COMPLETE = 0xBC, /**< Download completed event. */ + ANTFS_EVENT_DOWNLOAD_FAIL = 0xBD, /**< Download failed event. */ + ANTFS_EVENT_UPLOAD_REQUEST = 0xBE, /**< Upload request event. */ + ANTFS_EVENT_UPLOAD_DATA = 0xBF, /**< Upload data available for read event. */ + ANTFS_EVENT_UPLOAD_START = 0xC0, /**< Upload begin event. */ + ANTFS_EVENT_UPLOAD_COMPLETE = 0xC1, /**< Upload completed event. */ + ANTFS_EVENT_UPLOAD_FAIL = 0xC2, /**< Upload process failed event. */ + ANTFS_EVENT_ERASE_REQUEST = 0xC3 /**< Erase request event. */ +} antfs_event_t; + +/**@brief ANT-FS <-> application event communication object. */ +typedef struct +{ + antfs_event_t event; /**< ANT-FS event. */ + uint16_t file_index; /**< File index (download/upload/erase). */ + uint32_t offset; /**< Current offset (download/upload). */ + uint32_t bytes; /**< Number of bytes in block (download/upload). */ + uint16_t crc; /**< Current CRC (upload). */ + uint8_t data[8]; /**< Block of data (upload). */ +} antfs_event_return_t; + +/**@brief ANT-FS parameters. */ +typedef struct +{ + uint32_t client_serial_number; /**< Client serial number. */ + uint16_t beacon_device_type; /**< Client device type. */ + uint16_t beacon_device_manufacturing_id; /**< Client manufacturing ID. */ + uint8_t beacon_frequency; /**< Beacon RF Frequency. */ + antfs_beacon_status_byte1_t beacon_status_byte1; /**< Beacon status byte 1. */ + const uint8_t * p_pass_key; /**< Pass Key. */ + const uint8_t * p_remote_friendly_name; /**< Friendly Name. */ +} antfs_params_t; + +/**@brief ANT-FS directory header. */ +typedef struct +{ + uint8_t version; /**< Version of the directory file structure. */ + uint8_t length; /**< Length of each structure, in bytes. */ + uint8_t time_format; /**< Defines how system keeps track of date/time stamps. */ + uint8_t reserved01; + uint8_t reserved02; + uint8_t reserved03; + uint8_t reserved04; + uint8_t reserved05; + uint32_t system_time; /**< Number of seconds elapsed since system power up. */ + uint32_t date; /**< Number of seconds elapsed since 00:00 hrs Dec 31, 1989. If system time is unknown, used as counter. */ +} antfs_dir_header_t; + +/**@brief ANT-FS directory entry. */ +typedef struct +{ + uint16_t data_file_index; /**< Data file index. */ + uint8_t file_data_type; /**< File data type. */ + uint8_t user_defined1; /**< Identifier, first byte (structure defined by data type). */ + uint16_t user_defined2; /**< Identifier, last two bytes (structure defined by data type). */ + uint8_t user_flags; /**< File data type specific flags (bits defined by data type). */ + uint8_t general_flags; /**< Bit mapped flags of flag permissions. */ + uint32_t file_size_in_bytes; /**< File size, in bytes. */ + uint32_t date; /**< Number of seconds elapsed since 00:00 hrs Dec 31, 1980, if supported. */ +} antfs_dir_struct_t; + +/**@brief ANT-FS download/upload request context. */ +typedef struct +{ + ulong_union_t file_size; /**< Size of a file to download when reading, or the size of a partially completed upload when writing. */ + uint32_t max_file_size; /**< The maximum size of the file specified, this is the file size when reading, and the maximum allowed file size when writing. */ + ulong_union_t max_burst_block_size; /**< Maximum burst block size. */ + ushort_union_t file_index; /**< File index. */ + uint16_t file_crc; /**< CRC (uploads). */ +} antfs_request_info_t; + +/**@brief The burst wait handler can be configured by the application to customize the code that is + * executed while waiting for the burst busy flag. */ +typedef void(*antfs_burst_wait_handler_t)(void); + +/**@brief Function for setting initial ANT-FS configuration parameters. + * + * @param[in] p_params The initial ANT-FS configuration parameters. + * @param[in] burst_wait_handler Burst wait handler. + */ +void antfs_init(const antfs_params_t * const p_params, + antfs_burst_wait_handler_t burst_wait_handler); + +/**@brief Function for getting host name if received. + * + * @return Pointer to host name buffer if a host name was recieved, NULL otherwise. + */ +const char * antfs_hostname_get(void); + +/**@brief Function for transmitting a response to a pairing request issued by ANT-FS host. + * + * @param[in] accept The pairing response, true if pairing accepted. + * + * @retval true Operation success. Response to a pairing request was transmitted. + * @retval false Operation failure. Not in pairing mode or pairing not supported by the + * implementation. + */ +bool antfs_pairing_resp_transmit(bool accept); + +/**@brief Function for doing calculations prior downloading the data to the ANT-FS host. + * + * Function does the necessary pre processing calculations, which are required prior downloading the + * data, and also transmits the download request response right away in case of the download request + * was rejected or there is no data to send. + * + * @param[in] response The download request response code. + * @param[in] p_request_info ANT-FS request info structure. + */ +void antfs_download_req_resp_prepare(uint8_t response, + const antfs_request_info_t * const p_request_info); + +/**@brief Function for downloading requested data. + * + * @param[in] index Index of the current file downloaded. + * @param[in] offset Offset specified by client. + * @param[in] num_bytes Number of bytes requested to be transmitted from the buffer. + * @param[in] p_message Data buffer to be transmitted. + * + * @return Number of data bytes transmitted. + */ +uint32_t antfs_input_data_download(uint16_t index, + uint32_t offset, + uint32_t num_bytes, + const uint8_t * const p_message); + +/**@brief Function for transmitting upload request response to a upload request command by ANT-FS + * host. + * + * @param[in] response The upload response code. + * @param[in] p_request_info ANT-FS request info structure. + * + * @retval true Operation success. Response to upload request command was transmitted. + * @retval false Operation failure. Upload not supported by the implementation or not in correct + * state or application is sending a response for a different file + * than requested. + */ +bool antfs_upload_req_resp_transmit(uint8_t response, + const antfs_request_info_t * const p_request_info); + +/**@brief Function for transmitting upload data response to a upload data command by ANT-FS host. + * + * @param[in] data_upload_success The upload response code, true for success. + * + * @retval true Operation success. Response to upload data command was transmitted. + * @retval false Operation failure. Upload not supported by the implementation or not in correct + * state. + */ +bool antfs_upload_data_resp_transmit(bool data_upload_success); + +/**@brief Function for transmitting erase response to a erase request. + * + * @param[in] response The erase response code. + */ +void antfs_erase_req_resp_transmit(uint8_t response); + +/**@brief Function for extracting possible pending ANT-FS event. + * + * @param[out] p_event The output event structure. + * + * @retval true Operation success. Pending ANT-FS event available and it was copied to the output + * event structure. + * @retval false Operation failure. No pending ANT-FS event available. + */ +bool antfs_event_extract(antfs_event_return_t * const p_event); + +/**@brief Function for processing ANT events and data received from the ANT-FS channel. + * + * @param[in] p_message The message buffer containing the message received from the ANT-FS + * channel. + */ +void antfs_message_process(uint8_t * p_message); + +/**@brief Function for setting up the ANT-FS channel. + */ +void antfs_channel_setup(void); + +#endif // ANTFS_H__ + +/** + *@} + **/ diff --git a/components/libraries/ant_fs/crc.c b/components/libraries/ant_fs/crc.c new file mode 100644 index 0000000..cdc2bc3 --- /dev/null +++ b/components/libraries/ant_fs/crc.c @@ -0,0 +1,55 @@ +/* +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 Dynastream Innovations Inc. 2012 +All rights reserved. +*/ + +#include "crc.h" +#include "compiler_abstraction.h" + + +/**@brief Function for updating the current CRC-16 value for a single byte input. + * + * @param[in] current_crc The current calculated CRC-16 value. + * @param[in] byte The input data byte for the computation. + * + * @return The updated CRC-16 value, based on the input supplied. + */ +static __INLINE uint16_t crc16_get(uint16_t current_crc, uint8_t byte) +{ + static const uint16_t crc16_table[16] = + { + 0x0000, 0xCC01, 0xD801, 0x1400, 0xF001, 0x3C00, 0x2800, 0xE401, + 0xA001, 0x6C00, 0x7800, 0xB401, 0x5000, 0x9C01, 0x8801, 0x4400 + }; + + uint16_t temp; + + // Compute checksum of lower four bits of a byte. + temp = crc16_table[current_crc & 0xF]; + current_crc = (current_crc >> 4u) & 0x0FFFu; + current_crc = current_crc ^ temp ^ crc16_table[byte & 0xF]; + + // Now compute checksum of upper four bits of a byte. + temp = crc16_table[current_crc & 0xF]; + current_crc = (current_crc >> 4u) & 0x0FFFu; + current_crc = current_crc ^ temp ^ crc16_table[(byte >> 4u) & 0xF]; + + return current_crc; +} + + +uint16_t crc_crc16_update(uint16_t current_crc, const volatile void * p_data, uint32_t size) +{ + uint8_t * p_block = (uint8_t *)p_data; + + while (size != 0) + { + current_crc = crc16_get(current_crc, *p_block); + p_block++; + size--; + } + + return current_crc; +} diff --git a/components/libraries/ant_fs/crc.h b/components/libraries/ant_fs/crc.h new file mode 100644 index 0000000..fa1297b --- /dev/null +++ b/components/libraries/ant_fs/crc.h @@ -0,0 +1,42 @@ +/* +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 Dynastream Innovations Inc. 2012 +All rights reserved. +*/ + +/** @file + * @brief The CRC-16 interface. + * This file is based on implementation originally made by Dynastream Innovations Inc. - August 2012 + * @defgroup ant_fs_client_main ANT-FS client device simulator + * @{ + * @ingroup nrf_ant_fs_client + * + * @brief The ANT-FS client device simulator. + * + */ + +#ifndef CRC_H__ +#define CRC_H__ + +#include + +/**@brief Function for calculating CRC-16 in blocks. + * + * Feed each consecutive data block into this function, along with the current value of current_crc + * as returned by the previous call of this function. The first call of this function should pass + * the initial value (usually 0) of the crc in current_crc. + + * @param[in] current_crc The current calculated CRC-16 value. + * @param[in] p_data The input data block for computation. + * @param[in] size The size of the input data block in bytes. + * + * @return The updated CRC-16 value, based on the input supplied. + */ +uint16_t crc_crc16_update(uint16_t current_crc, const volatile void * p_data, uint32_t size); + +#endif // CRC_H__ + +/** + *@} + **/ diff --git a/components/libraries/ant_fs/defines.h b/components/libraries/ant_fs/defines.h new file mode 100644 index 0000000..1cb4a70 --- /dev/null +++ b/components/libraries/ant_fs/defines.h @@ -0,0 +1,60 @@ +/* +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 Dynastream Innovations Inc. 2012 +All rights reserved. +*/ + +/**@file + * @brief Definitions. + * This file is based on implementation originally made by Dynastream Innovations Inc. - August 2012 + * @defgroup ant_fs_client_main ANT-FS client device simulator + * @{ + * @ingroup nrf_ant_fs_client + * + * @brief The ANT-FS client device simulator. + * + */ + +#ifndef DEFINES_H__ +#define DEFINES_H__ + +#include + +#define MAX_ULONG 0xFFFFFFFFu /**< The Max value for the type. */ + +/**@brief uint16_t type presentation as an union. */ +typedef union +{ + uint16_t data; /**< The data content. */ + + struct + { + uint8_t low; /**< The low byte of the data content. */ + uint8_t high; /**< The high byte of the data content. */ + } bytes; +} ushort_union_t; + +/**@brief uint32_t type presentation as an union. */ +typedef union +{ + uint32_t data; /**< The data content as a single variable. */ + uint8_t data_bytes[sizeof(uint32_t)]; /**< The data content as a byte array. */ + + struct + { + // The least significant byte of the uint32_t in this structure is referenced by byte0. + uint8_t byte0; /**< Byte 0 of the data content. */ + uint8_t byte1; /**< Byte 1 of the data content. */ + uint8_t byte2; /**< Byte 2 of the data content. */ + uint8_t byte3; /**< Byte 3 of the data content. */ + } bytes; +} ulong_union_t; + +#define APP_TIMER_PRESCALER 0 /**< Value of the RTC1 PRESCALER register. */ + +#endif // DEFINES_H__ + +/** + *@} + **/ diff --git a/components/libraries/bootloader_dfu/ble_transport/hci_mem_pool_internal.h b/components/libraries/bootloader_dfu/ble_transport/hci_mem_pool_internal.h new file mode 100644 index 0000000..2e3e4fc --- /dev/null +++ b/components/libraries/bootloader_dfu/ble_transport/hci_mem_pool_internal.h @@ -0,0 +1,32 @@ +/* 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. + * + */ + +/** @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 4u /**< TX buffer size in bytes. */ +#define RX_BUF_SIZE 32u /**< RX buffer size in bytes. */ + +#define RX_BUF_QUEUE_SIZE 8u /**< RX buffer element size. */ + +#endif // MEM_POOL_INTERNAL_H__ + +/** @} */ diff --git a/components/libraries/bootloader_dfu/bootloader.c b/components/libraries/bootloader_dfu/bootloader.c new file mode 100644 index 0000000..e40ca76 --- /dev/null +++ b/components/libraries/bootloader_dfu/bootloader.c @@ -0,0 +1,387 @@ +/* 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 "bootloader.h" +#include +#include "bootloader_types.h" +#include "bootloader_util.h" +#include "bootloader_settings.h" +#include "dfu.h" +#include "dfu_transport.h" +#include "nrf.h" +#include "app_error.h" +#include "nrf_sdm.h" +#include "nordic_common.h" +#include "crc16.h" +#include "pstorage.h" +#include "app_scheduler.h" +#include "nrf_delay.h" + +#define IRQ_ENABLED 0x01 /**< Field identifying if an interrupt is enabled. */ +#define MAX_NUMBER_INTERRUPTS 32 /**< Maximum number of interrupts available. */ + +/**@brief Enumeration for specifying current bootloader status. + */ +typedef enum +{ + BOOTLOADER_UPDATING, /**< Bootloader status for indicating that an update is in progress. */ + BOOTLOADER_SETTINGS_SAVING, /**< Bootloader status for indicating that saving of bootloader settings is in progress. */ + BOOTLOADER_COMPLETE, /**< Bootloader status for indicating that all operations for the update procedure has completed and it is safe to reset the system. */ + BOOTLOADER_TIMEOUT, /**< Bootloader status field for indicating that a timeout has occured and current update process should be aborted. */ + BOOTLOADER_RESET, /**< Bootloader status field for indicating that a reset has been requested and current update process should be aborted. */ +} bootloader_status_t; + +static pstorage_handle_t m_bootsettings_handle; /**< Pstorage handle to use for registration and identifying the bootloader module on subsequent calls to the pstorage module for load and store of bootloader setting in flash. */ +static bootloader_status_t m_update_status; /**< Current update status for the bootloader module to ensure correct behaviour when updating settings and when update completes. */ + +/**@brief Function for handling callbacks from pstorage module. + * + * @details Handles pstorage results for clear and storage operation. For detailed description of + * the parameters provided with the callback, please refer to \ref pstorage_ntf_cb_t. + */ +static void pstorage_callback_handler(pstorage_handle_t * p_handle, + uint8_t op_code, + uint32_t result, + uint8_t * p_data, + uint32_t data_len) +{ + // If we are in BOOTLOADER_SETTINGS_SAVING state and we receive an PSTORAGE_STORE_OP_CODE + // response then settings has been saved and update has completed. + if ((m_update_status == BOOTLOADER_SETTINGS_SAVING) && (op_code == PSTORAGE_STORE_OP_CODE)) + { + m_update_status = BOOTLOADER_COMPLETE; + } + + APP_ERROR_CHECK(result); +} + + +/**@brief Function for waiting for events. + * + * @details This function will place the chip in low power mode while waiting for events from + * the SoftDevice or other peripherals. When interrupted by an event, it will call the + * @ref app_sched_execute function to process the received event. This function will return + * when the final state of the firmware update is reached OR when a tear down is in + * progress. + */ +static void wait_for_events(void) +{ + for (;;) + { + // Wait in low power state for any events. + uint32_t err_code = sd_app_evt_wait(); + APP_ERROR_CHECK(err_code); + + // Event received. Process it from the scheduler. + app_sched_execute(); + + if ((m_update_status == BOOTLOADER_COMPLETE) || + (m_update_status == BOOTLOADER_TIMEOUT) || + (m_update_status == BOOTLOADER_RESET)) + { + // When update has completed or a timeout/reset occured we will return. + return; + } + } +} + + +bool bootloader_app_is_valid(uint32_t app_addr) +{ + const bootloader_settings_t * p_bootloader_settings; + + // There exists an application in CODE region 1. + if (*((uint32_t *)app_addr) == EMPTY_FLASH_MASK) + { + return false; + } + + bool success = false; + + bootloader_util_settings_get(&p_bootloader_settings); + + // The application in CODE region 1 is flagged as valid during update. + if (p_bootloader_settings->bank_0 == BANK_VALID_APP) + { + uint16_t image_crc = 0; + + // A stored crc value of 0 indicates that CRC checking is not used. + if (p_bootloader_settings->bank_0_crc != 0) + { + image_crc = crc16_compute((uint8_t *)DFU_BANK_0_REGION_START, + p_bootloader_settings->bank_0_size, + NULL); + } + + success = (image_crc == p_bootloader_settings->bank_0_crc); + } + + return success; +} + + +static void bootloader_settings_save(bootloader_settings_t * p_settings) +{ + uint32_t err_code = pstorage_clear(&m_bootsettings_handle, sizeof(bootloader_settings_t)); + APP_ERROR_CHECK(err_code); + + err_code = pstorage_store(&m_bootsettings_handle, + (uint8_t *)p_settings, + sizeof(bootloader_settings_t), + 0); + APP_ERROR_CHECK(err_code); +} + + +void bootloader_dfu_update_process(dfu_update_status_t update_status) +{ + static bootloader_settings_t settings; + const bootloader_settings_t * p_bootloader_settings; + + bootloader_util_settings_get(&p_bootloader_settings); + + if (update_status.status_code == DFU_UPDATE_APP_COMPLETE) + { + settings.bank_0_crc = update_status.app_crc; + settings.bank_0_size = update_status.app_size; + settings.bank_0 = BANK_VALID_APP; + settings.bank_1 = BANK_INVALID_APP; + + m_update_status = BOOTLOADER_SETTINGS_SAVING; + bootloader_settings_save(&settings); + } + else if (update_status.status_code == DFU_UPDATE_SD_COMPLETE) + { + settings.bank_0_crc = update_status.app_crc; + settings.bank_0_size = update_status.sd_size + + update_status.bl_size + + update_status.app_size; + settings.bank_0 = BANK_VALID_SD; + settings.bank_1 = BANK_INVALID_APP; + settings.sd_image_size = update_status.sd_size; + settings.bl_image_size = update_status.bl_size; + settings.app_image_size = update_status.app_size; + settings.sd_image_start = update_status.sd_image_start; + + m_update_status = BOOTLOADER_SETTINGS_SAVING; + bootloader_settings_save(&settings); + } + else if (update_status.status_code == DFU_UPDATE_BOOT_COMPLETE) + { + settings.bank_0 = p_bootloader_settings->bank_0; + settings.bank_0_crc = p_bootloader_settings->bank_0_crc; + settings.bank_0_size = p_bootloader_settings->bank_0_size; + settings.bank_1 = BANK_VALID_BOOT; + settings.sd_image_size = update_status.sd_size; + settings.bl_image_size = update_status.bl_size; + settings.app_image_size = update_status.app_size; + + m_update_status = BOOTLOADER_SETTINGS_SAVING; + bootloader_settings_save(&settings); + } + else if (update_status.status_code == DFU_UPDATE_SD_SWAPPED) + { + if (p_bootloader_settings->bank_0 == BANK_VALID_SD) + { + settings.bank_0_crc = 0; + settings.bank_0_size = 0; + settings.bank_0 = BANK_INVALID_APP; + } + // This handles cases where SoftDevice was not updated, hence bank0 keeps its settings. + else + { + settings.bank_0 = p_bootloader_settings->bank_0; + settings.bank_0_crc = p_bootloader_settings->bank_0_crc; + settings.bank_0_size = p_bootloader_settings->bank_0_size; + } + + settings.bank_1 = BANK_INVALID_APP; + settings.sd_image_size = 0; + settings.bl_image_size = 0; + settings.app_image_size = 0; + + m_update_status = BOOTLOADER_SETTINGS_SAVING; + bootloader_settings_save(&settings); + } + else if (update_status.status_code == DFU_TIMEOUT) + { + // Timeout has occurred. Close the connection with the DFU Controller. + uint32_t err_code = dfu_transport_close(); + APP_ERROR_CHECK(err_code); + + m_update_status = BOOTLOADER_TIMEOUT; + } + else if (update_status.status_code == DFU_BANK_0_ERASED) + { + settings.bank_0_crc = 0; + settings.bank_0_size = 0; + settings.bank_0 = BANK_INVALID_APP; + settings.bank_1 = p_bootloader_settings->bank_1; + + bootloader_settings_save(&settings); + } + else if (update_status.status_code == DFU_RESET) + { + m_update_status = BOOTLOADER_RESET; + } + else + { + // No implementation needed. + } +} + + +uint32_t bootloader_init(void) +{ + uint32_t err_code; + pstorage_module_param_t storage_params = {.cb = pstorage_callback_handler}; + + err_code = pstorage_init(); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + m_bootsettings_handle.block_id = BOOTLOADER_SETTINGS_ADDRESS; + err_code = pstorage_register(&storage_params, &m_bootsettings_handle); + + return err_code; +} + + +uint32_t bootloader_dfu_start(void) +{ + uint32_t err_code; + + // Clear swap if banked update is used. + err_code = dfu_init(); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + err_code = dfu_transport_update_start(); + + wait_for_events(); + + return err_code; +} + + +/**@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 = 0; // We start from first interrupt, i.e. interrupt 0. + + // Fetch the current interrupt settings. + interrupt_setting_mask = NVIC->ISER[0]; + + for (; irq < MAX_NUMBER_INTERRUPTS; irq++) + { + if (interrupt_setting_mask & (IRQ_ENABLED << irq)) + { + // The interrupt was enabled, and hence disable it. + NVIC_DisableIRQ((IRQn_Type)irq); + } + } +} + + +void bootloader_app_start(uint32_t app_addr) +{ + // If the applications CRC has been checked and passed, the magic number will be written and we + // can start the application safely. + uint32_t err_code = sd_softdevice_disable(); + APP_ERROR_CHECK(err_code); + + interrupts_disable(); + + err_code = sd_softdevice_vector_table_base_set(CODE_REGION_1_START); + APP_ERROR_CHECK(err_code); + + bootloader_util_app_start(CODE_REGION_1_START); +} + + +bool bootloader_dfu_sd_in_progress(void) +{ + const bootloader_settings_t * p_bootloader_settings; + + bootloader_util_settings_get(&p_bootloader_settings); + + if (p_bootloader_settings->bank_0 == BANK_VALID_SD || + p_bootloader_settings->bank_1 == BANK_VALID_BOOT) + { + return true; + } + + return false; +} + + +uint32_t bootloader_dfu_sd_update_continue(void) +{ + uint32_t err_code; + + if ((dfu_sd_image_validate() == NRF_SUCCESS) && + (dfu_bl_image_validate() == NRF_SUCCESS)) + { + return NRF_SUCCESS; + } + + // Ensure that flash operations are not executed within the first 100 ms seconds to allow + // a debugger to be attached. + nrf_delay_ms(100); + + err_code = dfu_sd_image_swap(); + APP_ERROR_CHECK(err_code); + + err_code = dfu_sd_image_validate(); + APP_ERROR_CHECK(err_code); + + err_code = dfu_bl_image_swap(); + APP_ERROR_CHECK(err_code); + + return err_code; +} + + +uint32_t bootloader_dfu_sd_update_finalize(void) +{ + dfu_update_status_t update_status = {DFU_UPDATE_SD_SWAPPED, }; + + bootloader_dfu_update_process(update_status); + + wait_for_events(); + + return NRF_SUCCESS; +} + + +void bootloader_settings_get(bootloader_settings_t * const p_settings) +{ + const bootloader_settings_t * p_bootloader_settings; + + bootloader_util_settings_get(&p_bootloader_settings); + + p_settings->bank_0 = p_bootloader_settings->bank_0; + p_settings->bank_0_crc = p_bootloader_settings->bank_0_crc; + p_settings->bank_0_size = p_bootloader_settings->bank_0_size; + p_settings->bank_1 = p_bootloader_settings->bank_1; + p_settings->sd_image_size = p_bootloader_settings->sd_image_size; + p_settings->bl_image_size = p_bootloader_settings->bl_image_size; + p_settings->app_image_size = p_bootloader_settings->app_image_size; + p_settings->sd_image_start = p_bootloader_settings->sd_image_start; +} + diff --git a/components/libraries/bootloader_dfu/bootloader.h b/components/libraries/bootloader_dfu/bootloader.h new file mode 100644 index 0000000..aa61258 --- /dev/null +++ b/components/libraries/bootloader_dfu/bootloader.h @@ -0,0 +1,97 @@ +/* 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. + * + */ + +/**@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/components/libraries/bootloader_dfu/bootloader_settings.c b/components/libraries/bootloader_dfu/bootloader_settings.c new file mode 100644 index 0000000..a5e7759 --- /dev/null +++ b/components/libraries/bootloader_dfu/bootloader_settings.c @@ -0,0 +1,36 @@ +/* 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 "bootloader_settings.h" +#include +#include + +#if defined ( __CC_ARM ) +uint8_t m_boot_settings[CODE_PAGE_SIZE] __attribute__((at(BOOTLOADER_SETTINGS_ADDRESS))) __attribute__((used)); /**< This variable reserves a codepage for bootloader specific settings, to ensure the compiler doesn't locate any code or variables at his location. */ +uint32_t m_uicr_bootloader_start_address __attribute__((at(NRF_UICR_BOOT_START_ADDRESS))) = BOOTLOADER_REGION_START; /**< 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. */ +#elif defined ( __GNUC__ ) +__attribute__ ((section(".bootloaderSettings"))) uint8_t m_boot_settings[CODE_PAGE_SIZE]; /**< This variable reserves a codepage for bootloader specific settings, to ensure the compiler doesn't locate any code or variables at his location. */ +__attribute__ ((section(".uicrBootStartAddress"))) volatile uint32_t m_uicr_bootloader_start_address = BOOTLOADER_REGION_START; /**< 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. */ +#elif defined ( __ICCARM__ ) +__no_init uint8_t m_boot_settings[CODE_PAGE_SIZE] @ 0x0003FC00; /**< This variable reserves a codepage for bootloader specific settings, to ensure the compiler doesn't locate any code or variables at his location. */ +__root const uint32_t m_uicr_bootloader_start_address @ 0x10001014 = BOOTLOADER_REGION_START; /**< 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. */ +#endif + + +void bootloader_util_settings_get(const bootloader_settings_t ** pp_bootloader_settings) +{ + // Read only pointer to bootloader settings in flash. + bootloader_settings_t const * const p_bootloader_settings = + (bootloader_settings_t *)&m_boot_settings[0]; + + *pp_bootloader_settings = p_bootloader_settings; +} diff --git a/components/libraries/bootloader_dfu/bootloader_settings.h b/components/libraries/bootloader_dfu/bootloader_settings.h new file mode 100644 index 0000000..645b7f4 --- /dev/null +++ b/components/libraries/bootloader_dfu/bootloader_settings.h @@ -0,0 +1,35 @@ +/* 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. + * + */ + + /**@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/components/libraries/bootloader_dfu/bootloader_types.h b/components/libraries/bootloader_dfu/bootloader_types.h new file mode 100644 index 0000000..da3ce2c --- /dev/null +++ b/components/libraries/bootloader_dfu/bootloader_types.h @@ -0,0 +1,59 @@ +/* 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. + * + */ + +/**@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/components/libraries/bootloader_dfu/bootloader_util.c b/components/libraries/bootloader_dfu/bootloader_util.c new file mode 100644 index 0000000..afcdcec --- /dev/null +++ b/components/libraries/bootloader_dfu/bootloader_util.c @@ -0,0 +1,152 @@ +/* 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 "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 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/components/libraries/bootloader_dfu/bootloader_util.h b/components/libraries/bootloader_dfu/bootloader_util.h new file mode 100644 index 0000000..1e09e2d --- /dev/null +++ b/components/libraries/bootloader_dfu/bootloader_util.h @@ -0,0 +1,38 @@ +/* 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. + * + */ + + /**@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/components/libraries/bootloader_dfu/dfu.h b/components/libraries/bootloader_dfu/dfu.h new file mode 100644 index 0000000..9832180 --- /dev/null +++ b/components/libraries/bootloader_dfu/dfu.h @@ -0,0 +1,134 @@ +/* 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. + * + */ + +/**@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/components/libraries/bootloader_dfu/dfu_app_handler.c b/components/libraries/bootloader_dfu/dfu_app_handler.c new file mode 100644 index 0000000..2a644e4 --- /dev/null +++ b/components/libraries/bootloader_dfu/dfu_app_handler.c @@ -0,0 +1,192 @@ +/* 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 "dfu_app_handler.h" +#include +#include "bootloader_util.h" +#include "nrf.h" +#include "nrf_sdm.h" +#include "ble_gatt.h" +#include "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->BOOTLOADERADDR); + APP_ERROR_CHECK(err_code); + + dfu_app_peer_data_set(conn_handle); + + NVIC_ClearPendingIRQ(SWI2_IRQn); + interrupts_disable(); + bootloader_util_app_start(NRF_UICR->BOOTLOADERADDR); +} + + +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/components/libraries/bootloader_dfu/dfu_app_handler.h b/components/libraries/bootloader_dfu/dfu_app_handler.h new file mode 100644 index 0000000..e923186 --- /dev/null +++ b/components/libraries/bootloader_dfu/dfu_app_handler.h @@ -0,0 +1,86 @@ +/* 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. + * + */ + +/** @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/components/libraries/bootloader_dfu/dfu_bank_internal.h b/components/libraries/bootloader_dfu/dfu_bank_internal.h new file mode 100644 index 0000000..ac2b520 --- /dev/null +++ b/components/libraries/bootloader_dfu/dfu_bank_internal.h @@ -0,0 +1,87 @@ +/* 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. + * + */ + +/**@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/components/libraries/bootloader_dfu/dfu_ble_svc.h b/components/libraries/bootloader_dfu/dfu_ble_svc.h new file mode 100644 index 0000000..e05508f --- /dev/null +++ b/components/libraries/bootloader_dfu/dfu_ble_svc.h @@ -0,0 +1,80 @@ +/* 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. + * + */ + +/** @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->BOOTLOADERADDR. + */ + +#ifndef DFU_BLE_SVC_H__ +#define DFU_BLE_SVC_H__ + +#include "nrf_svc.h" +#include +#include "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/components/libraries/bootloader_dfu/dfu_ble_svc_internal.h b/components/libraries/bootloader_dfu/dfu_ble_svc_internal.h new file mode 100644 index 0000000..6f05fbf --- /dev/null +++ b/components/libraries/bootloader_dfu/dfu_ble_svc_internal.h @@ -0,0 +1,43 @@ +/* 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. + * + */ + +/** @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/components/libraries/bootloader_dfu/dfu_dual_bank.c b/components/libraries/bootloader_dfu/dfu_dual_bank.c new file mode 100644 index 0000000..5426f67 --- /dev/null +++ b/components/libraries/bootloader_dfu/dfu_dual_bank.c @@ -0,0 +1,869 @@ +/* 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 +#include +#include +#include "dfu.h" +#include +#include "dfu_bank_internal.h" +#include "nrf.h" +#include "nrf.h" +#include "app_util.h" +#include "nrf_sdm.h" +#include "app_error.h" +#include "nrf_error.h" +#include "app_timer.h" +#include "app_error.h" +#include "nordic_common.h" +#include "bootloader.h" +#include "bootloader_types.h" +#include "pstorage.h" +#include "nrf_mbr.h" +#include "dfu_init.h" + +static dfu_state_t m_dfu_state; /**< Current DFU state. */ +static uint32_t m_image_size; /**< Size of the image that will be transmitted. */ + +static dfu_start_packet_t m_start_packet; /**< Start packet received for this update procedure. Contains update mode and image sizes information to be used for image transfer. */ +static uint8_t m_init_packet[128]; /**< Init packet, can hold CRC, Hash, Signed Hash and similar, for image validation, integrety check and authorization checking. */ +static uint8_t m_init_packet_length; /**< Length of init packet received. */ +static uint16_t m_image_crc; /**< Calculated CRC of the image received. */ + +APP_TIMER_DEF(m_dfu_timer_id); /**< Application timer id. */ +static bool m_dfu_timed_out = false; /**< Boolean flag value for tracking DFU timer timeout state. */ + +static pstorage_handle_t m_storage_handle_swap; /**< Pstorage handle for the swap area (bank 1). Bank used when updating an application or bootloader without SoftDevice. */ +static pstorage_handle_t m_storage_handle_app; /**< Pstorage handle for the application area (bank 0). Bank used when updating a SoftDevice w/wo bootloader. Handle also used when swapping received application from bank 1 to bank 0. */ +static pstorage_handle_t * mp_storage_handle_active; /**< Pointer to the pstorage handle for the active bank for receiving of data packets. */ + +static dfu_callback_t m_data_pkt_cb; /**< Callback from DFU Bank module for notification of asynchronous operation such as flash prepare. */ +static dfu_bank_func_t m_functions; /**< Structure holding operations for the selected update process. */ + + +/**@brief Function for handling callbacks from pstorage module. + * + * @details Handles pstorage results for clear and storage operation. For detailed description of + * the parameters provided with the callback, please refer to \ref pstorage_ntf_cb_t. + */ +static void pstorage_callback_handler(pstorage_handle_t * p_handle, + uint8_t op_code, + uint32_t result, + uint8_t * p_data, + uint32_t data_len) +{ + switch (op_code) + { + case PSTORAGE_STORE_OP_CODE: + if ((m_dfu_state == DFU_STATE_RX_DATA_PKT) && (m_data_pkt_cb != NULL)) + { + m_data_pkt_cb(DATA_PACKET, result, p_data); + } + break; + + case PSTORAGE_CLEAR_OP_CODE: + if (m_dfu_state == DFU_STATE_PREPARING) + { + m_functions.cleared(); + m_dfu_state = DFU_STATE_RDY; + if (m_data_pkt_cb != NULL) + { + m_data_pkt_cb(START_PACKET, result, p_data); + } + } + break; + + default: + break; + } + APP_ERROR_CHECK(result); +} + + +/**@brief Function for handling the DFU timeout. + * + * @param[in] p_context The timeout context. + */ +static void dfu_timeout_handler(void * p_context) +{ + UNUSED_PARAMETER(p_context); + dfu_update_status_t update_status; + + m_dfu_timed_out = true; + update_status.status_code = DFU_TIMEOUT; + + bootloader_dfu_update_process(update_status); +} + + +/**@brief Function for restarting the DFU Timer. + * + * @details This function will stop and restart the DFU timer. This function will be called by the + * functions handling any DFU packet received from the peer that is transferring a firmware + * image. + */ +static uint32_t dfu_timer_restart(void) +{ + if (m_dfu_timed_out) + { + // The DFU timer had already timed out. + return NRF_ERROR_INVALID_STATE; + } + + uint32_t err_code = app_timer_stop(m_dfu_timer_id); + APP_ERROR_CHECK(err_code); + + err_code = app_timer_start(m_dfu_timer_id, DFU_TIMEOUT_INTERVAL, NULL); + APP_ERROR_CHECK(err_code); + + return err_code; +} + + +/**@brief Function for preparing of flash before receiving SoftDevice image. + * + * @details This function will erase current application area to ensure sufficient amount of + * storage for the SoftDevice image. Upon erase complete a callback will be done. + * See \ref dfu_bank_prepare_t for further details. + */ +static void dfu_prepare_func_app_erase(uint32_t image_size) +{ + uint32_t err_code; + + mp_storage_handle_active = &m_storage_handle_app; + + // Doing a SoftDevice update thus current application must be cleared to ensure enough space + // for new SoftDevice. + m_dfu_state = DFU_STATE_PREPARING; + err_code = pstorage_clear(&m_storage_handle_app, m_image_size); + APP_ERROR_CHECK(err_code); +} + + +/**@brief Function for preparing swap before receiving application or bootloader image. + * + * @details This function will erase current swap area to ensure flash is ready for storage of the + * Application or Bootloader image. Upon erase complete a callback will be done. + * See \ref dfu_bank_prepare_t for further details. + */ +static void dfu_prepare_func_swap_erase(uint32_t image_size) +{ + uint32_t err_code; + + mp_storage_handle_active = &m_storage_handle_swap; + + m_dfu_state = DFU_STATE_PREPARING; + err_code = pstorage_clear(&m_storage_handle_swap, DFU_IMAGE_MAX_SIZE_BANKED); + APP_ERROR_CHECK(err_code); +} + + +/**@brief Function for handling behaviour when clear operation has completed. + */ +static void dfu_cleared_func_swap(void) +{ + // Do nothing. +} + + +/**@brief Function for handling behaviour when clear operation has completed. + */ +static void dfu_cleared_func_app(void) +{ + dfu_update_status_t update_status = {DFU_BANK_0_ERASED, }; + bootloader_dfu_update_process(update_status); +} + + +/**@brief Function for calculating storage offset for receiving SoftDevice image. + * + * @details When a new SoftDevice is received it will be temporary stored in flash before moved to + * address 0x0. In order to succesfully validate transfer and relocation it is important + * that temporary image and final installed image does not ovwerlap hence an offset must + * be calculated in case new image is larger than currently installed SoftDevice. + */ +uint32_t offset_calculate(uint32_t sd_image_size) +{ + uint32_t offset = 0; + + if (m_start_packet.sd_image_size > DFU_BANK_0_REGION_START) + { + uint32_t page_mask = (CODE_PAGE_SIZE - 1); + uint32_t diff = m_start_packet.sd_image_size - DFU_BANK_0_REGION_START; + + offset = diff & ~page_mask; + + // Align offset to next page if image size is not page sized. + if ((diff & page_mask) > 0) + { + offset += CODE_PAGE_SIZE; + } + } + + return offset; +} + + +/**@brief Function for activating received SoftDevice image. + * + * @note This function will not move the SoftDevice image. + * The bootloader settings will be marked as SoftDevice update complete and the swapping of + * current SoftDevice will occur after system reset. + * + * @return NRF_SUCCESS on success. + */ +static uint32_t dfu_activate_sd(void) +{ + dfu_update_status_t update_status; + + update_status.status_code = DFU_UPDATE_SD_COMPLETE; + update_status.app_crc = m_image_crc; + update_status.sd_image_start = DFU_BANK_0_REGION_START; + update_status.sd_size = m_start_packet.sd_image_size; + update_status.bl_size = m_start_packet.bl_image_size; + update_status.app_size = m_start_packet.app_image_size; + + bootloader_dfu_update_process(update_status); + + return NRF_SUCCESS; +} + + +/**@brief Function for activating received Application image. + * + * @details This function will move the received application image fram swap (bank 1) to + * application area (bank 0). + * + * @return NRF_SUCCESS on success. Error code otherwise. + */ +static uint32_t dfu_activate_app(void) +{ + uint32_t err_code; + + // Erase BANK 0. + err_code = pstorage_clear(&m_storage_handle_app, m_start_packet.app_image_size); + APP_ERROR_CHECK(err_code); + + err_code = pstorage_store(&m_storage_handle_app, + (uint8_t *)m_storage_handle_swap.block_id, + m_start_packet.app_image_size, + 0); + + if (err_code == NRF_SUCCESS) + { + dfu_update_status_t update_status; + + memset(&update_status, 0, sizeof(dfu_update_status_t )); + update_status.status_code = DFU_UPDATE_APP_COMPLETE; + update_status.app_crc = m_image_crc; + update_status.app_size = m_start_packet.app_image_size; + + bootloader_dfu_update_process(update_status); + } + + return err_code; +} + + +/**@brief Function for activating received Bootloader image. + * + * @note This function will not move the bootloader image. + * The bootloader settings will be marked as Bootloader update complete and the swapping of + * current bootloader will occur after system reset. + * + * @return NRF_SUCCESS on success. + */ +static uint32_t dfu_activate_bl(void) +{ + dfu_update_status_t update_status; + + update_status.status_code = DFU_UPDATE_BOOT_COMPLETE; + update_status.app_crc = m_image_crc; + update_status.sd_size = m_start_packet.sd_image_size; + update_status.bl_size = m_start_packet.bl_image_size; + update_status.app_size = m_start_packet.app_image_size; + + bootloader_dfu_update_process(update_status); + + return NRF_SUCCESS; +} + + +uint32_t dfu_init(void) +{ + uint32_t err_code; + pstorage_module_param_t storage_module_param = {.cb = pstorage_callback_handler}; + + m_init_packet_length = 0; + m_image_crc = 0; + + err_code = pstorage_register(&storage_module_param, &m_storage_handle_app); + if (err_code != NRF_SUCCESS) + { + m_dfu_state = DFU_STATE_INIT_ERROR; + return err_code; + } + + m_storage_handle_app.block_id = DFU_BANK_0_REGION_START; + m_storage_handle_swap = m_storage_handle_app; + m_storage_handle_swap.block_id = DFU_BANK_1_REGION_START; + + // Create the timer to monitor the activity by the peer doing the firmware update. + err_code = app_timer_create(&m_dfu_timer_id, + APP_TIMER_MODE_SINGLE_SHOT, + dfu_timeout_handler); + APP_ERROR_CHECK(err_code); + + // Start the DFU timer. + err_code = app_timer_start(m_dfu_timer_id, DFU_TIMEOUT_INTERVAL, NULL); + APP_ERROR_CHECK(err_code); + + m_data_received = 0; + m_dfu_state = DFU_STATE_IDLE; + + return NRF_SUCCESS; +} + + +void dfu_register_callback(dfu_callback_t callback_handler) +{ + m_data_pkt_cb = callback_handler; +} + + +uint32_t dfu_start_pkt_handle(dfu_update_packet_t * p_packet) +{ + uint32_t err_code; + + m_start_packet = *(p_packet->params.start_packet); + + // Check that the requested update procedure is supported. + // Currently the following combinations are allowed: + // - Application + // - SoftDevice + // - Bootloader + // - SoftDevice with Bootloader + if (IS_UPDATING_APP(m_start_packet) && + (IS_UPDATING_SD(m_start_packet) || IS_UPDATING_BL(m_start_packet))) + { + // App update is only supported independently. + return NRF_ERROR_NOT_SUPPORTED; + } + + if (!(IS_WORD_SIZED(m_start_packet.sd_image_size) && + IS_WORD_SIZED(m_start_packet.bl_image_size) && + IS_WORD_SIZED(m_start_packet.app_image_size))) + { + // Image_sizes are not a multiple of 4 (word size). + return NRF_ERROR_NOT_SUPPORTED; + } + + m_image_size = m_start_packet.sd_image_size + m_start_packet.bl_image_size + + m_start_packet.app_image_size; + + if (m_start_packet.bl_image_size > DFU_BL_IMAGE_MAX_SIZE) + { + return NRF_ERROR_DATA_SIZE; + } + + if (IS_UPDATING_SD(m_start_packet)) + { + if (m_image_size > (DFU_IMAGE_MAX_SIZE_FULL)) + { + return NRF_ERROR_DATA_SIZE; + } + m_functions.prepare = dfu_prepare_func_app_erase; + m_functions.cleared = dfu_cleared_func_app; + m_functions.activate = dfu_activate_sd; + } + else + { + if (m_image_size > DFU_IMAGE_MAX_SIZE_BANKED) + { + return NRF_ERROR_DATA_SIZE; + } + + m_functions.prepare = dfu_prepare_func_swap_erase; + m_functions.cleared = dfu_cleared_func_swap; + if (IS_UPDATING_BL(m_start_packet)) + { + m_functions.activate = dfu_activate_bl; + } + else + { + m_functions.activate = dfu_activate_app; + } + } + + switch (m_dfu_state) + { + case DFU_STATE_IDLE: + // Valid peer activity detected. Hence restart the DFU timer. + err_code = dfu_timer_restart(); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + m_functions.prepare(m_image_size); + + break; + + default: + err_code = NRF_ERROR_INVALID_STATE; + break; + } + + return err_code; +} + + +uint32_t dfu_data_pkt_handle(dfu_update_packet_t * p_packet) +{ + uint32_t data_length; + uint32_t err_code; + uint32_t * p_data; + + if (p_packet == NULL) + { + return NRF_ERROR_NULL; + } + + // Check pointer alignment. + if (!is_word_aligned(p_packet->params.data_packet.p_data_packet)) + { + // The p_data_packet is not word aligned address. + return NRF_ERROR_INVALID_ADDR; + } + + switch (m_dfu_state) + { + case DFU_STATE_RDY: + case DFU_STATE_RX_INIT_PKT: + return NRF_ERROR_INVALID_STATE; + + case DFU_STATE_RX_DATA_PKT: + data_length = p_packet->params.data_packet.packet_length * sizeof(uint32_t); + + if ((m_data_received + data_length) > m_image_size) + { + // The caller is trying to write more bytes into the flash than the size provided to + // the dfu_image_size_set function. This is treated as a serious error condition and + // an unrecoverable one. Hence point the variable mp_app_write_address to the top of + // the flash area. This will ensure that all future application data packet writes + // will be blocked because of the above check. + m_data_received = 0xFFFFFFFF; + + return NRF_ERROR_DATA_SIZE; + } + + // Valid peer activity detected. Hence restart the DFU timer. + err_code = dfu_timer_restart(); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + p_data = (uint32_t *)p_packet->params.data_packet.p_data_packet; + + err_code = pstorage_store(mp_storage_handle_active, + (uint8_t *)p_data, + data_length, + m_data_received); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + m_data_received += data_length; + + if (m_data_received != m_image_size) + { + // The entire image is not received yet. More data is expected. + err_code = NRF_ERROR_INVALID_LENGTH; + } + else + { + // The entire image has been received. Return NRF_SUCCESS. + err_code = NRF_SUCCESS; + } + break; + + default: + err_code = NRF_ERROR_INVALID_STATE; + break; + } + + return err_code; +} + + +uint32_t dfu_init_pkt_complete(void) +{ + uint32_t err_code = NRF_ERROR_INVALID_STATE; + + // DFU initialization has been done and a start packet has been received. + if (IMAGE_WRITE_IN_PROGRESS()) + { + // Image write is already in progress. Cannot handle an init packet now. + return NRF_ERROR_INVALID_STATE; + } + + if (m_dfu_state == DFU_STATE_RX_INIT_PKT) + { + err_code = dfu_init_prevalidate(m_init_packet, m_init_packet_length); + if (err_code == NRF_SUCCESS) + { + m_dfu_state = DFU_STATE_RX_DATA_PKT; + } + else + { + m_init_packet_length = 0; + } + } + return err_code; +} + + +uint32_t dfu_init_pkt_handle(dfu_update_packet_t * p_packet) +{ + uint32_t err_code = NRF_SUCCESS; + uint32_t length; + + switch (m_dfu_state) + { + case DFU_STATE_RDY: + m_dfu_state = DFU_STATE_RX_INIT_PKT; + // When receiving init packet in state ready just update and fall through this case. + + case DFU_STATE_RX_INIT_PKT: + // DFU initialization has been done and a start packet has been received. + if (IMAGE_WRITE_IN_PROGRESS()) + { + // Image write is already in progress. Cannot handle an init packet now. + return NRF_ERROR_INVALID_STATE; + } + + // Valid peer activity detected. Hence restart the DFU timer. + err_code = dfu_timer_restart(); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + length = p_packet->params.data_packet.packet_length * sizeof(uint32_t); + if ((m_init_packet_length + length) > sizeof(m_init_packet)) + { + return NRF_ERROR_INVALID_LENGTH; + } + + memcpy(&m_init_packet[m_init_packet_length], + &p_packet->params.data_packet.p_data_packet[0], + length); + m_init_packet_length += length; + break; + + default: + // Either the start packet was not received or dfu_init function was not called before. + err_code = NRF_ERROR_INVALID_STATE; + break; + } + + return err_code; +} + + +uint32_t dfu_image_validate() +{ + uint32_t err_code; + + switch (m_dfu_state) + { + case DFU_STATE_RX_DATA_PKT: + // Check if the application image write has finished. + if (m_data_received != m_image_size) + { + // Image not yet fully transfered by the peer or the peer has attempted to write + // too much data. Hence the validation should fail. + err_code = NRF_ERROR_INVALID_STATE; + } + else + { + m_dfu_state = DFU_STATE_VALIDATE; + + // Valid peer activity detected. Hence restart the DFU timer. + err_code = dfu_timer_restart(); + if (err_code == NRF_SUCCESS) + { + err_code = dfu_init_postvalidate((uint8_t *)mp_storage_handle_active->block_id, + m_image_size); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + m_dfu_state = DFU_STATE_WAIT_4_ACTIVATE; + } + } + break; + + default: + err_code = NRF_ERROR_INVALID_STATE; + break; + } + + return err_code; +} + + +uint32_t dfu_image_activate() +{ + uint32_t err_code; + + switch (m_dfu_state) + { + case DFU_STATE_WAIT_4_ACTIVATE: + + // Stop the DFU Timer because the peer activity need not be monitored any longer. + err_code = app_timer_stop(m_dfu_timer_id); + APP_ERROR_CHECK(err_code); + + err_code = m_functions.activate(); + break; + + default: + err_code = NRF_ERROR_INVALID_STATE; + break; + } + + return err_code; +} + + +void dfu_reset(void) +{ + dfu_update_status_t update_status; + + update_status.status_code = DFU_RESET; + + bootloader_dfu_update_process(update_status); +} + + +static uint32_t dfu_compare_block(uint32_t * ptr1, uint32_t * ptr2, uint32_t len) +{ + sd_mbr_command_t sd_mbr_cmd; + + sd_mbr_cmd.command = SD_MBR_COMMAND_COMPARE; + sd_mbr_cmd.params.compare.ptr1 = ptr1; + sd_mbr_cmd.params.compare.ptr2 = ptr2; + sd_mbr_cmd.params.compare.len = len / sizeof(uint32_t); + + return sd_mbr_command(&sd_mbr_cmd); +} + + +static uint32_t dfu_copy_sd(uint32_t * src, uint32_t * dst, uint32_t len) +{ + sd_mbr_command_t sd_mbr_cmd; + + sd_mbr_cmd.command = SD_MBR_COMMAND_COPY_SD; + sd_mbr_cmd.params.copy_sd.src = src; + sd_mbr_cmd.params.copy_sd.dst = dst; + sd_mbr_cmd.params.copy_sd.len = len / sizeof(uint32_t); + + return sd_mbr_command(&sd_mbr_cmd); +} + + +static uint32_t dfu_sd_img_block_swap(uint32_t * src, + uint32_t * dst, + uint32_t len, + uint32_t block_size) +{ + // It is neccesarry to swap the new SoftDevice in 3 rounds to ensure correct copy of data + // and verifucation of data in case power reset occurs during write to flash. + // To ensure the robustness of swapping the images are compared backwards till start of + // image swap. If the back is identical everything is swapped. + uint32_t err_code = dfu_compare_block(src, dst, len); + if (err_code == NRF_SUCCESS) + { + return err_code; + } + + if ((uint32_t)dst > SOFTDEVICE_REGION_START) + { + err_code = dfu_sd_img_block_swap((uint32_t *)((uint32_t)src - block_size), + (uint32_t *)((uint32_t)dst - block_size), + block_size, + block_size); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + + err_code = dfu_copy_sd(src, dst, len); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + return dfu_compare_block(src, dst, len); +} + + +uint32_t dfu_sd_image_swap(void) +{ + bootloader_settings_t boot_settings; + + bootloader_settings_get(&boot_settings); + + if (boot_settings.sd_image_size == 0) + { + return NRF_SUCCESS; + } + + if ((SOFTDEVICE_REGION_START + boot_settings.sd_image_size) > boot_settings.sd_image_start) + { + uint32_t err_code; + uint32_t sd_start = SOFTDEVICE_REGION_START; + uint32_t block_size = (boot_settings.sd_image_start - sd_start) / 2; + uint32_t image_end = boot_settings.sd_image_start + boot_settings.sd_image_size; + + uint32_t img_block_start = boot_settings.sd_image_start + 2 * block_size; + uint32_t sd_block_start = sd_start + 2 * block_size; + + if (SD_SIZE_GET(MBR_SIZE) < boot_settings.sd_image_size) + { + // This will clear a page thus ensuring the old image is invalidated before swapping. + err_code = dfu_copy_sd((uint32_t *)(sd_start + block_size), + (uint32_t *)(sd_start + block_size), + sizeof(uint32_t)); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + err_code = dfu_copy_sd((uint32_t *)sd_start, (uint32_t *)sd_start, sizeof(uint32_t)); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + + return dfu_sd_img_block_swap((uint32_t *)img_block_start, + (uint32_t *)sd_block_start, + image_end - img_block_start, + block_size); + } + else + { + if (boot_settings.sd_image_size != 0) + { + return dfu_copy_sd((uint32_t *)boot_settings.sd_image_start, + (uint32_t *)SOFTDEVICE_REGION_START, + boot_settings.sd_image_size); + } + } + + return NRF_SUCCESS; +} + + +uint32_t dfu_bl_image_swap(void) +{ + bootloader_settings_t bootloader_settings; + sd_mbr_command_t sd_mbr_cmd; + + bootloader_settings_get(&bootloader_settings); + + if (bootloader_settings.bl_image_size != 0) + { + uint32_t bl_image_start = (bootloader_settings.sd_image_size == 0) ? + DFU_BANK_1_REGION_START : + bootloader_settings.sd_image_start + + bootloader_settings.sd_image_size; + + sd_mbr_cmd.command = SD_MBR_COMMAND_COPY_BL; + sd_mbr_cmd.params.copy_bl.bl_src = (uint32_t *)(bl_image_start); + sd_mbr_cmd.params.copy_bl.bl_len = bootloader_settings.bl_image_size / sizeof(uint32_t); + + return sd_mbr_command(&sd_mbr_cmd); + } + return NRF_SUCCESS; +} + + +uint32_t dfu_bl_image_validate(void) +{ + bootloader_settings_t bootloader_settings; + sd_mbr_command_t sd_mbr_cmd; + + bootloader_settings_get(&bootloader_settings); + + if (bootloader_settings.bl_image_size != 0) + { + uint32_t bl_image_start = (bootloader_settings.sd_image_size == 0) ? + DFU_BANK_1_REGION_START : + bootloader_settings.sd_image_start + + bootloader_settings.sd_image_size; + + sd_mbr_cmd.command = SD_MBR_COMMAND_COMPARE; + sd_mbr_cmd.params.compare.ptr1 = (uint32_t *)BOOTLOADER_REGION_START; + sd_mbr_cmd.params.compare.ptr2 = (uint32_t *)(bl_image_start); + sd_mbr_cmd.params.compare.len = bootloader_settings.bl_image_size / sizeof(uint32_t); + + return sd_mbr_command(&sd_mbr_cmd); + } + return NRF_SUCCESS; +} + + +uint32_t dfu_sd_image_validate(void) +{ + bootloader_settings_t bootloader_settings; + sd_mbr_command_t sd_mbr_cmd; + + bootloader_settings_get(&bootloader_settings); + + if (bootloader_settings.sd_image_size == 0) + { + return NRF_SUCCESS; + } + + if ((SOFTDEVICE_REGION_START + bootloader_settings.sd_image_size) > bootloader_settings.sd_image_start) + { + uint32_t sd_start = SOFTDEVICE_REGION_START; + uint32_t block_size = (bootloader_settings.sd_image_start - sd_start) / 2; + uint32_t image_end = bootloader_settings.sd_image_start + + bootloader_settings.sd_image_size; + + uint32_t img_block_start = bootloader_settings.sd_image_start + 2 * block_size; + uint32_t sd_block_start = sd_start + 2 * block_size; + + if (SD_SIZE_GET(MBR_SIZE) < bootloader_settings.sd_image_size) + { + return NRF_ERROR_NULL; + } + + return dfu_sd_img_block_swap((uint32_t *)img_block_start, + (uint32_t *)sd_block_start, + image_end - img_block_start, + block_size); + } + + sd_mbr_cmd.command = SD_MBR_COMMAND_COMPARE; + sd_mbr_cmd.params.compare.ptr1 = (uint32_t *)SOFTDEVICE_REGION_START; + sd_mbr_cmd.params.compare.ptr2 = (uint32_t *)bootloader_settings.sd_image_start; + sd_mbr_cmd.params.compare.len = bootloader_settings.sd_image_size / sizeof(uint32_t); + + return sd_mbr_command(&sd_mbr_cmd); +} diff --git a/components/libraries/bootloader_dfu/dfu_init.h b/components/libraries/bootloader_dfu/dfu_init.h new file mode 100644 index 0000000..33a85f2 --- /dev/null +++ b/components/libraries/bootloader_dfu/dfu_init.h @@ -0,0 +1,134 @@ +/* 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. + * + */ + +/**@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/components/libraries/bootloader_dfu/dfu_init_template.c b/components/libraries/bootloader_dfu/dfu_init_template.c new file mode 100644 index 0000000..598340c --- /dev/null +++ b/components/libraries/bootloader_dfu/dfu_init_template.c @@ -0,0 +1,155 @@ +/* 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. + * + */ + +/**@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/components/libraries/bootloader_dfu/dfu_single_bank.c b/components/libraries/bootloader_dfu/dfu_single_bank.c new file mode 100644 index 0000000..1f0d01b --- /dev/null +++ b/components/libraries/bootloader_dfu/dfu_single_bank.c @@ -0,0 +1,818 @@ +/* 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 +#include +#include +#include "dfu.h" +#include +#include "dfu_bank_internal.h" +#include "nrf.h" +#include "nrf.h" +#include "app_util.h" +#include "nrf_sdm.h" +#include "app_error.h" +#include "nrf_error.h" +#include "app_timer.h" +#include "app_error.h" +#include "nordic_common.h" +#include "bootloader.h" +#include "bootloader_types.h" +#include "pstorage.h" +#include "nrf_mbr.h" +#include "dfu_init.h" + +static dfu_state_t m_dfu_state; /**< Current DFU state. */ +static uint32_t m_image_size; /**< Size of the image that will be transmitted. */ + +static dfu_start_packet_t m_start_packet; /**< Start packet received for this update procedure. Contains update mode and image sizes information to be used for image transfer. */ +static uint8_t m_init_packet[64]; /**< Init packet, can hold CRC, Hash, Signed Hash and similar, for image validation, integrety check and authorization checking. */ +static uint8_t m_init_packet_length; /**< Length of init packet received. */ +static uint16_t m_image_crc; /**< Calculated CRC of the image received. */ + +APP_TIMER_DEF(m_dfu_timer_id); /**< Application timer id. */ +static bool m_dfu_timed_out = false; /**< Boolean flag value for tracking DFU timer timeout state. */ + +static pstorage_handle_t m_storage_handle_app; /**< Pstorage handle for the application area (bank 0). Bank used when updating a SoftDevice w/wo bootloader. Handle also used when swapping received application from bank 1 to bank 0. */ +static pstorage_handle_t * mp_storage_handle_active; /**< Pointer to the pstorage handle for the active bank for receiving of data packets. */ + +static dfu_callback_t m_data_pkt_cb; /**< Callback from DFU Bank module for notification of asynchronous operation such as flash prepare. */ +static dfu_bank_func_t m_functions; /**< Structure holding operations for the selected update process. */ + + +/**@brief Function for handling callbacks from pstorage module. + * + * @details Handles pstorage results for clear and storage operation. For detailed description of + * the parameters provided with the callback, please refer to \ref pstorage_ntf_cb_t. + */ +static void pstorage_callback_handler(pstorage_handle_t * p_handle, + uint8_t op_code, + uint32_t result, + uint8_t * p_data, + uint32_t data_len) +{ + switch (op_code) + { + case PSTORAGE_STORE_OP_CODE: + if ((m_dfu_state == DFU_STATE_RX_DATA_PKT) && (m_data_pkt_cb != NULL)) + { + m_data_pkt_cb(DATA_PACKET, result, p_data); + } + break; + + case PSTORAGE_CLEAR_OP_CODE: + if (m_dfu_state == DFU_STATE_PREPARING) + { + m_functions.cleared(); + m_dfu_state = DFU_STATE_RDY; + if (m_data_pkt_cb != NULL) + { + m_data_pkt_cb(START_PACKET, result, p_data); + } + } + break; + + default: + break; + } + APP_ERROR_CHECK(result); +} + + +/**@brief Function for handling the DFU timeout. + * + * @param[in] p_context The timeout context. + */ +static void dfu_timeout_handler(void * p_context) +{ + UNUSED_PARAMETER(p_context); + dfu_update_status_t update_status; + + m_dfu_timed_out = true; + update_status.status_code = DFU_TIMEOUT; + + bootloader_dfu_update_process(update_status); +} + + +/**@brief Function for restarting the DFU Timer. + * + * @details This function will stop and restart the DFU timer. This function will be called by the + * functions handling any DFU packet received from the peer that is transferring a firmware + * image. + */ +static uint32_t dfu_timer_restart(void) +{ + if (m_dfu_timed_out) + { + // The DFU timer had already timed out. + return NRF_ERROR_INVALID_STATE; + } + + uint32_t err_code = app_timer_stop(m_dfu_timer_id); + APP_ERROR_CHECK(err_code); + + err_code = app_timer_start(m_dfu_timer_id, DFU_TIMEOUT_INTERVAL, NULL); + APP_ERROR_CHECK(err_code); + + return err_code; +} + + +/**@brief Function for preparing of flash before receiving SoftDevice image. + * + * @details This function will erase current application area to ensure sufficient amount of + * storage for the SoftDevice image. Upon erase complete a callback will be done. + * See \ref dfu_bank_prepare_t for further details. + */ +static void dfu_prepare_func_app_erase(uint32_t image_size) +{ + uint32_t err_code; + + mp_storage_handle_active = &m_storage_handle_app; + + // Doing a SoftDevice update thus current application must be cleared to ensure enough space + // for new SoftDevice. + m_dfu_state = DFU_STATE_PREPARING; + err_code = pstorage_clear(&m_storage_handle_app, m_image_size); + APP_ERROR_CHECK(err_code); +} + + +/**@brief Function for handling behaviour when clear operation has completed. + */ +static void dfu_cleared_func_app(void) +{ + dfu_update_status_t update_status = {DFU_BANK_0_ERASED, }; + bootloader_dfu_update_process(update_status); +} + + +/**@brief Function for calculating storage offset for receiving SoftDevice image. + * + * @details When a new SoftDevice is received it will be temporary stored in flash before moved to + * address 0x0. In order to succesfully validate transfer and relocation it is important + * that temporary image and final installed image does not ovwerlap hence an offset must + * be calculated in case new image is larger than currently installed SoftDevice. + */ +uint32_t offset_calculate(uint32_t sd_image_size) +{ + uint32_t offset = 0; + + if (m_start_packet.sd_image_size > DFU_BANK_0_REGION_START) + { + uint32_t page_mask = (CODE_PAGE_SIZE - 1); + uint32_t diff = m_start_packet.sd_image_size - DFU_BANK_0_REGION_START; + + offset = diff & ~page_mask; + + // Align offset to next page if image size is not page sized. + if ((diff & page_mask) > 0) + { + offset += CODE_PAGE_SIZE; + } + } + + return offset; +} + + +/**@brief Function for activating received SoftDevice image. + * + * @note This function will not move the SoftDevice image. + * The bootloader settings will be marked as SoftDevice update complete and the swapping of + * current SoftDevice will occur after system reset. + * + * @return NRF_SUCCESS on success. + */ +static uint32_t dfu_activate_sd(void) +{ + dfu_update_status_t update_status; + + update_status.status_code = DFU_UPDATE_SD_COMPLETE; + update_status.app_crc = m_image_crc; + update_status.sd_image_start = DFU_BANK_0_REGION_START; + update_status.sd_size = m_start_packet.sd_image_size; + update_status.bl_size = m_start_packet.bl_image_size; + update_status.app_size = m_start_packet.app_image_size; + + bootloader_dfu_update_process(update_status); + + return NRF_SUCCESS; +} + + +/**@brief Function for activating received Application image. + * + * @details This function will move the received application image fram swap (bank 1) to + * application area (bank 0). + * + * @return NRF_SUCCESS on success. Error code otherwise. + */ +static uint32_t dfu_activate_app(void) +{ + uint32_t err_code = NRF_SUCCESS; + dfu_update_status_t update_status; + + memset(&update_status, 0, sizeof(dfu_update_status_t )); + update_status.status_code = DFU_UPDATE_APP_COMPLETE; + update_status.app_crc = m_image_crc; + update_status.app_size = m_start_packet.app_image_size; + + bootloader_dfu_update_process(update_status); + + return err_code; +} + + +/**@brief Function for activating received Bootloader image. + * + * @note This function will not move the bootloader image. + * The bootloader settings will be marked as Bootloader update complete and the swapping of + * current bootloader will occur after system reset. + * + * @return NRF_SUCCESS on success. + */ +static uint32_t dfu_activate_bl(void) +{ + dfu_update_status_t update_status; + + update_status.status_code = DFU_UPDATE_BOOT_COMPLETE; + update_status.app_crc = m_image_crc; + update_status.sd_size = m_start_packet.sd_image_size; + update_status.bl_size = m_start_packet.bl_image_size; + update_status.app_size = m_start_packet.app_image_size; + + bootloader_dfu_update_process(update_status); + + return NRF_SUCCESS; +} + + +uint32_t dfu_init(void) +{ + uint32_t err_code; + pstorage_module_param_t storage_module_param = {.cb = pstorage_callback_handler}; + + m_init_packet_length = 0; + m_image_crc = 0; + + err_code = pstorage_register(&storage_module_param, &m_storage_handle_app); + if (err_code != NRF_SUCCESS) + { + m_dfu_state = DFU_STATE_INIT_ERROR; + return err_code; + } + + m_storage_handle_app.block_id = DFU_BANK_0_REGION_START; + + // Create the timer to monitor the activity by the peer doing the firmware update. + err_code = app_timer_create(&m_dfu_timer_id, + APP_TIMER_MODE_SINGLE_SHOT, + dfu_timeout_handler); + APP_ERROR_CHECK(err_code); + + // Start the DFU timer. + err_code = app_timer_start(m_dfu_timer_id, DFU_TIMEOUT_INTERVAL, NULL); + APP_ERROR_CHECK(err_code); + + m_data_received = 0; + m_dfu_state = DFU_STATE_IDLE; + + return NRF_SUCCESS; +} + + +void dfu_register_callback(dfu_callback_t callback_handler) +{ + m_data_pkt_cb = callback_handler; +} + + +uint32_t dfu_start_pkt_handle(dfu_update_packet_t * p_packet) +{ + uint32_t err_code; + + m_start_packet = *(p_packet->params.start_packet); + + // Check that the requested update procedure is supported. + // Currently the following combinations are allowed: + // - Application + // - SoftDevice + // - Bootloader + // - SoftDevice with Bootloader + if (IS_UPDATING_APP(m_start_packet) && + (IS_UPDATING_SD(m_start_packet) || IS_UPDATING_BL(m_start_packet))) + { + // App update is only supported independently. + return NRF_ERROR_NOT_SUPPORTED; + } + + if (!(IS_WORD_SIZED(m_start_packet.sd_image_size) && + IS_WORD_SIZED(m_start_packet.bl_image_size) && + IS_WORD_SIZED(m_start_packet.app_image_size))) + { + // Image_sizes are not a multiple of 4 (word size). + return NRF_ERROR_NOT_SUPPORTED; + } + + m_image_size = m_start_packet.sd_image_size + m_start_packet.bl_image_size + + m_start_packet.app_image_size; + + if (m_start_packet.bl_image_size > DFU_BL_IMAGE_MAX_SIZE) + { + return NRF_ERROR_DATA_SIZE; + } + + if (m_image_size > (DFU_IMAGE_MAX_SIZE_FULL)) + { + return NRF_ERROR_DATA_SIZE; + } + m_functions.prepare = dfu_prepare_func_app_erase; + m_functions.cleared = dfu_cleared_func_app; + + if (IS_UPDATING_SD(m_start_packet)) + { + m_functions.activate = dfu_activate_sd; + } + else if (IS_UPDATING_BL(m_start_packet)) + { + m_functions.activate = dfu_activate_bl; + } + else + { + m_functions.activate = dfu_activate_app; + } + + switch (m_dfu_state) + { + case DFU_STATE_IDLE: + // Valid peer activity detected. Hence restart the DFU timer. + err_code = dfu_timer_restart(); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + m_functions.prepare(m_image_size); + + break; + + default: + err_code = NRF_ERROR_INVALID_STATE; + break; + } + + return err_code; +} + + +uint32_t dfu_data_pkt_handle(dfu_update_packet_t * p_packet) +{ + uint32_t data_length; + uint32_t err_code; + uint32_t * p_data; + + if (p_packet == NULL) + { + return NRF_ERROR_NULL; + } + + // Check pointer alignment. + if (!is_word_aligned(p_packet->params.data_packet.p_data_packet)) + { + // The p_data_packet is not word aligned address. + return NRF_ERROR_INVALID_ADDR; + } + + switch (m_dfu_state) + { + case DFU_STATE_RDY: + case DFU_STATE_RX_INIT_PKT: + return NRF_ERROR_INVALID_STATE; + + case DFU_STATE_RX_DATA_PKT: + data_length = p_packet->params.data_packet.packet_length * sizeof(uint32_t); + + if ((m_data_received + data_length) > m_image_size) + { + // The caller is trying to write more bytes into the flash than the size provided to + // the dfu_image_size_set function. This is treated as a serious error condition and + // an unrecoverable one. Hence point the variable mp_app_write_address to the top of + // the flash area. This will ensure that all future application data packet writes + // will be blocked because of the above check. + m_data_received = 0xFFFFFFFF; + + return NRF_ERROR_DATA_SIZE; + } + + // Valid peer activity detected. Hence restart the DFU timer. + err_code = dfu_timer_restart(); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + p_data = (uint32_t *)p_packet->params.data_packet.p_data_packet; + + err_code = pstorage_store(mp_storage_handle_active, + (uint8_t *)p_data, + data_length, + m_data_received); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + m_data_received += data_length; + + if (m_data_received != m_image_size) + { + // The entire image is not received yet. More data is expected. + err_code = NRF_ERROR_INVALID_LENGTH; + } + else + { + // The entire image has been received. Return NRF_SUCCESS. + err_code = NRF_SUCCESS; + } + break; + + default: + err_code = NRF_ERROR_INVALID_STATE; + break; + } + + return err_code; +} + + +uint32_t dfu_init_pkt_complete(void) +{ + uint32_t err_code = NRF_ERROR_INVALID_STATE; + + // DFU initialization has been done and a start packet has been received. + if (IMAGE_WRITE_IN_PROGRESS()) + { + // Image write is already in progress. Cannot handle an init packet now. + return NRF_ERROR_INVALID_STATE; + } + + if (m_dfu_state == DFU_STATE_RX_INIT_PKT) + { + err_code = dfu_init_prevalidate(m_init_packet, m_init_packet_length); + if (err_code == NRF_SUCCESS) + { + m_dfu_state = DFU_STATE_RX_DATA_PKT; + } + else + { + m_init_packet_length = 0; + } + } + return err_code; +} + + +uint32_t dfu_init_pkt_handle(dfu_update_packet_t * p_packet) +{ + uint32_t err_code = NRF_SUCCESS; + uint32_t length; + + switch (m_dfu_state) + { + case DFU_STATE_RDY: + m_dfu_state = DFU_STATE_RX_INIT_PKT; + // When receiving init packet in state ready just update and fall through this case. + + case DFU_STATE_RX_INIT_PKT: + // DFU initialization has been done and a start packet has been received. + if (IMAGE_WRITE_IN_PROGRESS()) + { + // Image write is already in progress. Cannot handle an init packet now. + return NRF_ERROR_INVALID_STATE; + } + + // Valid peer activity detected. Hence restart the DFU timer. + err_code = dfu_timer_restart(); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + length = p_packet->params.data_packet.packet_length * sizeof(uint32_t); + if ((m_init_packet_length + length) > sizeof(m_init_packet)) + { + return NRF_ERROR_INVALID_LENGTH; + } + + memcpy(&m_init_packet[m_init_packet_length], + &p_packet->params.data_packet.p_data_packet[0], + length); + m_init_packet_length += length; + break; + + default: + // Either the start packet was not received or dfu_init function was not called before. + err_code = NRF_ERROR_INVALID_STATE; + break; + } + + return err_code; +} + + +uint32_t dfu_image_validate() +{ + uint32_t err_code; + + switch (m_dfu_state) + { + case DFU_STATE_RX_DATA_PKT: + // Check if the application image write has finished. + if (m_data_received != m_image_size) + { + // Image not yet fully transfered by the peer or the peer has attempted to write + // too much data. Hence the validation should fail. + err_code = NRF_ERROR_INVALID_STATE; + } + else + { + m_dfu_state = DFU_STATE_VALIDATE; + + // Valid peer activity detected. Hence restart the DFU timer. + err_code = dfu_timer_restart(); + if (err_code == NRF_SUCCESS) + { + err_code = dfu_init_postvalidate((uint8_t *)mp_storage_handle_active->block_id, + m_image_size); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + m_dfu_state = DFU_STATE_WAIT_4_ACTIVATE; + } + } + break; + + default: + err_code = NRF_ERROR_INVALID_STATE; + break; + } + + return err_code; +} + + +uint32_t dfu_image_activate() +{ + uint32_t err_code; + + switch (m_dfu_state) + { + case DFU_STATE_WAIT_4_ACTIVATE: + + // Stop the DFU Timer because the peer activity need not be monitored any longer. + err_code = app_timer_stop(m_dfu_timer_id); + APP_ERROR_CHECK(err_code); + + err_code = m_functions.activate(); + break; + + default: + err_code = NRF_ERROR_INVALID_STATE; + break; + } + + return err_code; +} + + +void dfu_reset(void) +{ + dfu_update_status_t update_status; + + update_status.status_code = DFU_RESET; + + bootloader_dfu_update_process(update_status); +} + + +static uint32_t dfu_compare_block(uint32_t * ptr1, uint32_t * ptr2, uint32_t len) +{ + sd_mbr_command_t sd_mbr_cmd; + + sd_mbr_cmd.command = SD_MBR_COMMAND_COMPARE; + sd_mbr_cmd.params.compare.ptr1 = ptr1; + sd_mbr_cmd.params.compare.ptr2 = ptr2; + sd_mbr_cmd.params.compare.len = len / sizeof(uint32_t); + + return sd_mbr_command(&sd_mbr_cmd); +} + + +static uint32_t dfu_copy_sd(uint32_t * src, uint32_t * dst, uint32_t len) +{ + sd_mbr_command_t sd_mbr_cmd; + + sd_mbr_cmd.command = SD_MBR_COMMAND_COPY_SD; + sd_mbr_cmd.params.copy_sd.src = src; + sd_mbr_cmd.params.copy_sd.dst = dst; + sd_mbr_cmd.params.copy_sd.len = len / sizeof(uint32_t); + + return sd_mbr_command(&sd_mbr_cmd); +} + + +static uint32_t dfu_sd_img_block_swap(uint32_t * src, + uint32_t * dst, + uint32_t len, + uint32_t block_size) +{ + // It is neccesarry to swap the new SoftDevice in 3 rounds to ensure correct copy of data + // and verifucation of data in case power reset occurs during write to flash. + // To ensure the robustness of swapping the images are compared backwards till start of + // image swap. If the back is identical everything is swapped. + uint32_t err_code = dfu_compare_block(src, dst, len); + if (err_code == NRF_SUCCESS) + { + return err_code; + } + + if ((uint32_t)dst > SOFTDEVICE_REGION_START) + { + err_code = dfu_sd_img_block_swap((uint32_t *)((uint32_t)src - block_size), + (uint32_t *)((uint32_t)dst - block_size), + block_size, + block_size); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + + err_code = dfu_copy_sd(src, dst, len); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + return dfu_compare_block(src, dst, len); +} + + +uint32_t dfu_sd_image_swap(void) +{ + bootloader_settings_t boot_settings; + + bootloader_settings_get(&boot_settings); + + if (boot_settings.sd_image_size == 0) + { + return NRF_SUCCESS; + } + + if ((SOFTDEVICE_REGION_START + boot_settings.sd_image_size) > boot_settings.sd_image_start) + { + uint32_t err_code; + uint32_t sd_start = SOFTDEVICE_REGION_START; + uint32_t block_size = (boot_settings.sd_image_start - sd_start) / 2; + uint32_t image_end = boot_settings.sd_image_start + boot_settings.sd_image_size; + + uint32_t img_block_start = boot_settings.sd_image_start + 2 * block_size; + uint32_t sd_block_start = sd_start + 2 * block_size; + + if (SD_SIZE_GET(MBR_SIZE) < boot_settings.sd_image_size) + { + // This will clear a page thus ensuring the old image is invalidated before swapping. + err_code = dfu_copy_sd((uint32_t *)(sd_start + block_size), + (uint32_t *)(sd_start + block_size), + sizeof(uint32_t)); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + err_code = dfu_copy_sd((uint32_t *)sd_start, (uint32_t *)sd_start, sizeof(uint32_t)); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + + return dfu_sd_img_block_swap((uint32_t *)img_block_start, + (uint32_t *)sd_block_start, + image_end - img_block_start, + block_size); + } + else + { + if (boot_settings.sd_image_size != 0) + { + return dfu_copy_sd((uint32_t *)boot_settings.sd_image_start, + (uint32_t *)SOFTDEVICE_REGION_START, + boot_settings.sd_image_size); + } + } + + return NRF_SUCCESS; +} + + +uint32_t dfu_bl_image_swap(void) +{ + bootloader_settings_t bootloader_settings; + sd_mbr_command_t sd_mbr_cmd; + + bootloader_settings_get(&bootloader_settings); + + if (bootloader_settings.bl_image_size != 0) + { + uint32_t bl_image_start = (bootloader_settings.sd_image_size == 0) ? + DFU_BANK_0_REGION_START : + bootloader_settings.sd_image_start + + bootloader_settings.sd_image_size; + + sd_mbr_cmd.command = SD_MBR_COMMAND_COPY_BL; + sd_mbr_cmd.params.copy_bl.bl_src = (uint32_t *)(bl_image_start); + sd_mbr_cmd.params.copy_bl.bl_len = bootloader_settings.bl_image_size / sizeof(uint32_t); + + return sd_mbr_command(&sd_mbr_cmd); + } + return NRF_SUCCESS; +} + + +uint32_t dfu_bl_image_validate(void) +{ + bootloader_settings_t bootloader_settings; + sd_mbr_command_t sd_mbr_cmd; + + bootloader_settings_get(&bootloader_settings); + + if (bootloader_settings.bl_image_size != 0) + { + uint32_t bl_image_start = (bootloader_settings.sd_image_size == 0) ? + DFU_BANK_0_REGION_START : + bootloader_settings.sd_image_start + + bootloader_settings.sd_image_size; + + sd_mbr_cmd.command = SD_MBR_COMMAND_COMPARE; + sd_mbr_cmd.params.compare.ptr1 = (uint32_t *)BOOTLOADER_REGION_START; + sd_mbr_cmd.params.compare.ptr2 = (uint32_t *)(bl_image_start); + sd_mbr_cmd.params.compare.len = bootloader_settings.bl_image_size / sizeof(uint32_t); + + return sd_mbr_command(&sd_mbr_cmd); + } + return NRF_SUCCESS; +} + + +uint32_t dfu_sd_image_validate(void) +{ + bootloader_settings_t bootloader_settings; + sd_mbr_command_t sd_mbr_cmd; + + bootloader_settings_get(&bootloader_settings); + + if (bootloader_settings.sd_image_size == 0) + { + return NRF_SUCCESS; + } + + if ((SOFTDEVICE_REGION_START + bootloader_settings.sd_image_size) > bootloader_settings.sd_image_start) + { + uint32_t sd_start = SOFTDEVICE_REGION_START; + uint32_t block_size = (bootloader_settings.sd_image_start - sd_start) / 2; + uint32_t image_end = bootloader_settings.sd_image_start + + bootloader_settings.sd_image_size; + + uint32_t img_block_start = bootloader_settings.sd_image_start + 2 * block_size; + uint32_t sd_block_start = sd_start + 2 * block_size; + + if (SD_SIZE_GET(MBR_SIZE) < bootloader_settings.sd_image_size) + { + return NRF_ERROR_NULL; + } + + return dfu_sd_img_block_swap((uint32_t *)img_block_start, + (uint32_t *)sd_block_start, + image_end - img_block_start, + block_size); + } + + sd_mbr_cmd.command = SD_MBR_COMMAND_COMPARE; + sd_mbr_cmd.params.compare.ptr1 = (uint32_t *)SOFTDEVICE_REGION_START; + sd_mbr_cmd.params.compare.ptr2 = (uint32_t *)bootloader_settings.sd_image_start; + sd_mbr_cmd.params.compare.len = bootloader_settings.sd_image_size / sizeof(uint32_t); + + return sd_mbr_command(&sd_mbr_cmd); +} diff --git a/components/libraries/bootloader_dfu/dfu_transport.h b/components/libraries/bootloader_dfu/dfu_transport.h new file mode 100644 index 0000000..130beb3 --- /dev/null +++ b/components/libraries/bootloader_dfu/dfu_transport.h @@ -0,0 +1,40 @@ +/* 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. + * + */ + +/**@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/components/libraries/bootloader_dfu/dfu_transport_ble.c b/components/libraries/bootloader_dfu/dfu_transport_ble.c new file mode 100644 index 0000000..ac6bbbd --- /dev/null +++ b/components/libraries/bootloader_dfu/dfu_transport_ble.c @@ -0,0 +1,1109 @@ +/* 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 "dfu_transport.h" +#include "dfu.h" +#include +#include +#include +#include "boards.h" +#include "nrf.h" +#include "nrf_sdm.h" +#include "nrf_gpio.h" +#include "app_util.h" +#include "app_error.h" +#include "softdevice_handler.h" +#include "ble_stack_handler_types.h" +#include "ble_advdata.h" +#include "ble_l2cap.h" +#include "ble_gap.h" +#include "ble_gatt.h" +#include "ble_hci.h" +#include "ble_dfu.h" +#include "nordic_common.h" +#include "app_timer.h" +#include "ble_conn_params.h" +#include "hci_mem_pool.h" +#include "bootloader.h" +#include "dfu_ble_svc_internal.h" +#include "nrf_delay.h" + +#define DFU_REV_MAJOR 0x00 /** DFU Major revision number to be exposed. */ +#define DFU_REV_MINOR 0x08 /** DFU Minor revision number to be exposed. */ +#define DFU_REVISION ((DFU_REV_MAJOR << 8) | DFU_REV_MINOR) /** DFU Revision number to be exposed. Combined of major and minor versions. */ +#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 DFU_SERVICE_HANDLE 0x000C /**< Handle of DFU service when DFU service is first service initialized. */ +#define BLE_HANDLE_MAX 0xFFFF /**< Max handle value is BLE. */ + +#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 (11.25 milliseconds). */ +#define MAX_CONN_INTERVAL (uint16_t)(MSEC_TO_UNITS(30, UNIT_1_25_MS)) /**< Maximum acceptable connection interval (15 milliseconds). */ +#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 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_DIRECTED_ADV_TIMEOUT 50 /**< number of direct advertisement (each lasting 1.28seconds). */ +#define PEER_ADDRESS_TYPE_INVALID 0xFF /**< Value indicating that no valid peer address exists. This will be the case when a private resolvable address is used in which case there is no address available but instead an IRK is present. */ +#define PEER_ADDRESS_TYPE_INVALID 0xFF /**< Value indicating that no valid peer address exists. This will be the case when a private resolvable address is used in which case there is no address available but instead an IRK is present. */ + +#define SEC_PARAM_TIMEOUT 30 /**< Timeout for Pairing Request or Security Request (in seconds). */ +#define SEC_PARAM_BOND 0 /**< Perform bonding. */ +#define SEC_PARAM_MITM 0 /**< Man In The Middle protection not required. */ +#define SEC_PARAM_IO_CAPABILITIES BLE_GAP_IO_CAPS_NONE /**< No I/O capabilities. */ +#define SEC_PARAM_OOB 0 /**< Out Of Band data not available. */ +#define SEC_PARAM_MIN_KEY_SIZE 7 /**< Minimum encryption key size. */ +#define SEC_PARAM_MAX_KEY_SIZE 16 /**< Maximum encryption key size. */ + +#define MAX_SIZE_OF_BLE_STACK_EVT (sizeof(ble_evt_t) + BLE_L2CAP_MTU_DEF) /**< Maximum size (in bytes) of the event received from S110 SoftDevice.*/ +#define NUM_WORDS_RESERVED_FOR_BLE_EVENTS CEIL_DIV(MAX_SIZE_OF_BLE_STACK_EVT, sizeof(uint32_t)) /**< Size of the memory (in words) reserved for receiving S110 SoftDevice events. */ + +#define IS_CONNECTED() (m_conn_handle != BLE_CONN_HANDLE_INVALID) /**< Macro to determine if the device is in connected state. */ + +#define APP_FEATURE_NOT_SUPPORTED BLE_GATT_STATUS_ATTERR_APP_BEGIN + 2 /**< Reply when unsupported features are requested. */ +#define SD_IMAGE_SIZE_OFFSET 0 /**< Offset in start packet for the size information for SoftDevice. */ +#define BL_IMAGE_SIZE_OFFSET 4 /**< Offset in start packet for the size information for bootloader. */ +#define APP_IMAGE_SIZE_OFFSET 8 /**< Offset in start packet for the size information for application. */ + + +/**@brief Packet type enumeration. + */ +typedef enum +{ + PKT_TYPE_INVALID, /**< Invalid packet type. Used for initialization purpose.*/ + PKT_TYPE_START, /**< Start packet.*/ + PKT_TYPE_INIT, /**< Init packet.*/ + PKT_TYPE_FIRMWARE_DATA /**< Firmware data packet.*/ +} pkt_type_t; + +static ble_gap_sec_params_t m_sec_params; /**< Security requirements for this application. */ +static ble_gap_adv_params_t m_adv_params; /**< Parameters to be passed to the stack when starting advertising. */ +static ble_dfu_t m_dfu; /**< Structure used to identify the Device Firmware Update service. */ +static pkt_type_t m_pkt_type; /**< Type of packet to be expected from the DFU Controller. */ +static uint8_t m_update_mode; /**< Type of update mode specified by the DFU Controller. */ +static uint32_t m_num_of_firmware_bytes_rcvd; /**< Cumulative number of bytes of firmware data received. */ +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 uint8_t * mp_rx_buffer; /**< Pointer to a RX buffer.*/ +static bool m_tear_down_in_progress = false; /**< Variable 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 bool m_pkt_rcpt_notif_enabled = false; /**< Variable to denote whether packet receipt notification has been enabled by the DFU controller.*/ +static uint16_t m_conn_handle = BLE_CONN_HANDLE_INVALID; /**< Handle of the current connection. */ +static bool m_is_advertising = false; /**< Variable to indicate if advertising is ongoing.*/ +static dfu_ble_peer_data_t m_ble_peer_data; /**< BLE Peer data exchanged from application on buttonless update mode. */ +static bool m_ble_peer_data_valid = false; /**< True if BLE Peer data has been exchanged from application. */ +static uint32_t m_direct_adv_cnt = APP_DIRECTED_ADV_TIMEOUT; /**< Counter of direct advertisements. */ +static uint8_t * mp_final_packet; /**< Pointer to final data packet received. When callback for succesful packet handling is received from dfu bank handling a transfer complete response can be sent to peer. */ + + +/**@brief Function updating Service Changed CCCD and indicate a service change to peer. + * + * @details This function will verify the CCCD setting provided with \ref m_ble_peer_data and + * update the system attributes accordingly. If Service Change CCCD is set to indicate + * then a service change indication will be send to the peer. + * + * @retval NRF_INVALID_STATE if no connection has been established to a central. + * @return Any error code returned by SoftDevice function calls. + */ +static uint32_t service_change_indicate() +{ + uint32_t err_code; + + if (m_conn_handle == BLE_CONN_HANDLE_INVALID) + { + return NRF_ERROR_INVALID_STATE; + } + + if (m_ble_peer_data_valid) + { + err_code = sd_ble_gatts_sys_attr_set(m_conn_handle, + m_ble_peer_data.sys_serv_attr, + sizeof(m_ble_peer_data.sys_serv_attr), + BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + err_code = sd_ble_gatts_sys_attr_set(m_conn_handle, + NULL, + 0, + BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + err_code = sd_ble_gatts_service_changed(m_conn_handle, DFU_SERVICE_HANDLE, BLE_HANDLE_MAX); + if ((err_code == BLE_ERROR_INVALID_CONN_HANDLE) || + (err_code == NRF_ERROR_INVALID_STATE) || + (err_code == BLE_ERROR_NO_TX_BUFFERS)) + { + // 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 = sd_ble_gatts_sys_attr_set(m_conn_handle, NULL, 0, 0); + } + + return err_code; +} + + +/**@brief Function to convert an nRF51 error code to a DFU Response Value. + * + * @details This function will convert a given nRF51 error code to a DFU Response Value. The + * result of this function depends on the current DFU procedure in progress, given as + * input in current_dfu_proc parameter. + * + * @param[in] err_code The nRF51 error code to be converted. + * @param[in] current_dfu_proc Current DFU procedure in progress. + * + * @return Converted Response Value. + */ +static ble_dfu_resp_val_t nrf_err_code_translate(uint32_t err_code, + const ble_dfu_procedure_t current_dfu_proc) +{ + switch (err_code) + { + case NRF_SUCCESS: + return BLE_DFU_RESP_VAL_SUCCESS; + + case NRF_ERROR_INVALID_STATE: + return BLE_DFU_RESP_VAL_INVALID_STATE; + + case NRF_ERROR_NOT_SUPPORTED: + return BLE_DFU_RESP_VAL_NOT_SUPPORTED; + + case NRF_ERROR_DATA_SIZE: + return BLE_DFU_RESP_VAL_DATA_SIZE; + + case NRF_ERROR_INVALID_DATA: + if (current_dfu_proc == BLE_DFU_VALIDATE_PROCEDURE) + { + // When this error is received in Validation phase, then it maps to a CRC Error. + // Refer dfu_image_validate function for more information. + return BLE_DFU_RESP_VAL_CRC_ERROR; + } + return BLE_DFU_RESP_VAL_OPER_FAILED; + + default: + return BLE_DFU_RESP_VAL_OPER_FAILED; + } +} + + +/**@brief Function for handling the callback events from the dfu module. + * Callbacks are expected when \ref dfu_data_pkt_handle has been executed. + * + * @param[in] packet Packet type for which this callback is related. + * @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. + */ +static void dfu_cb_handler(uint32_t packet, uint32_t result, uint8_t * p_data) +{ + switch (packet) + { + ble_dfu_resp_val_t resp_val; + uint32_t err_code; + + case DATA_PACKET: + if (result != NRF_SUCCESS) + { + // Disconnect from peer. + if (IS_CONNECTED()) + { + err_code = sd_ble_gap_disconnect(m_conn_handle, + BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION); + APP_ERROR_CHECK(err_code); + } + } + else + { + err_code = hci_mem_pool_rx_consume(p_data); + APP_ERROR_CHECK(err_code); + + // If the callback matches final data packet received then the peer is notified. + if (mp_final_packet == p_data) + { + // Notify the DFU Controller about the success of the procedure. + err_code = ble_dfu_response_send(&m_dfu, + BLE_DFU_RECEIVE_APP_PROCEDURE, + BLE_DFU_RESP_VAL_SUCCESS); + APP_ERROR_CHECK(err_code); + } + } + break; + + case START_PACKET: + // Translate the err_code returned by the above function to DFU Response Value. + resp_val = nrf_err_code_translate(result, BLE_DFU_START_PROCEDURE); + + err_code = ble_dfu_response_send(&m_dfu, + BLE_DFU_START_PROCEDURE, + resp_val); + APP_ERROR_CHECK(err_code); + break; + + default: + // ignore. + break; + } +} + + +/**@brief Function for notifying a DFU Controller about error conditions in the DFU module. + * This function also ensures that an error is translated from nrf_errors to DFU Response + * Value. + * + * @param[in] p_dfu DFU Service Structure. + * @param[in] err_code Nrf error code that should be translated and send to the DFU Controller. + */ +static void dfu_error_notify(ble_dfu_t * p_dfu, uint32_t err_code) +{ + // An error has occurred. Notify the DFU Controller about this error condition. + // Translate the err_code returned to DFU Response Value. + ble_dfu_resp_val_t resp_val; + + resp_val = nrf_err_code_translate(err_code, BLE_DFU_RECEIVE_APP_PROCEDURE); + + err_code = ble_dfu_response_send(p_dfu, BLE_DFU_RECEIVE_APP_PROCEDURE, resp_val); + APP_ERROR_CHECK(err_code); +} + + +/**@brief Function for processing start data written by the peer to the DFU Packet + * Characteristic. + * + * @param[in] p_dfu DFU Service Structure. + * @param[in] p_evt Pointer to the event received from the S110 SoftDevice. + */ +static void start_data_process(ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt) +{ + uint32_t err_code; + + dfu_start_packet_t start_packet = {.dfu_update_mode = m_update_mode}; + dfu_update_packet_t update_packet = + { + .packet_type = START_PACKET, + .params.start_packet = &start_packet + }; + + uint32_t length = p_evt->evt.ble_dfu_pkt_write.len; + + // Verify that the data is exactly three * four bytes (three words) long. + if (length != (3 * sizeof(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); + } + else + { + // Extract the size of from the DFU Packet Characteristic. + uint8_t * p_length_data = p_evt->evt.ble_dfu_pkt_write.p_data; + + start_packet.sd_image_size = uint32_decode(p_length_data + SD_IMAGE_SIZE_OFFSET); + start_packet.bl_image_size = uint32_decode(p_length_data + BL_IMAGE_SIZE_OFFSET); + start_packet.app_image_size = uint32_decode(p_length_data + APP_IMAGE_SIZE_OFFSET); + + err_code = dfu_start_pkt_handle(&update_packet); + if (err_code != NRF_SUCCESS) + { + // Translate the err_code returned by the above function to DFU Response Value. + ble_dfu_resp_val_t resp_val; + + resp_val = nrf_err_code_translate(err_code, BLE_DFU_START_PROCEDURE); + err_code = ble_dfu_response_send(p_dfu, BLE_DFU_START_PROCEDURE, resp_val); + } + + APP_ERROR_CHECK(err_code); + } +} + + +/**@brief Function for processing initialization data written by the peer to the DFU Packet + * Characteristic. + * + * @param[in] p_dfu DFU Service Structure. + * @param[in] p_evt Pointer to the event received from the S110 SoftDevice. + */ +static void init_data_process(ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt) +{ + uint32_t err_code; + dfu_update_packet_t dfu_pkt; + + // The DFU module accepts the dfu_pkt.packet_length to be in 'number of words'. And so if the + // received data does not have a size which is a multiple of four, it should be padded with + // zeros and the packet_length should be incremented accordingly before calling + // dfu_init_pkt_handle. + if ((p_evt->evt.ble_dfu_pkt_write.len & (sizeof(uint32_t) - 1)) != 0) + { + uint32_t padding; + uint32_t i; + uint8_t pkt_length = p_evt->evt.ble_dfu_pkt_write.len; + + // Find out the number of bytes to be padded. + padding = sizeof(uint32_t) - (pkt_length & (sizeof(uint32_t) - 1)); + + for (i = 0; i < padding; i++) + { + p_evt->evt.ble_dfu_pkt_write.p_data[pkt_length++] = 0; + } + + p_evt->evt.ble_dfu_pkt_write.len = pkt_length; + } + + dfu_pkt.packet_type = INIT_PACKET; + + dfu_pkt.params.data_packet.p_data_packet = (uint32_t *)p_evt->evt.ble_dfu_pkt_write.p_data; + dfu_pkt.params.data_packet.packet_length = p_evt->evt.ble_dfu_pkt_write.len / sizeof(uint32_t); + + err_code = dfu_init_pkt_handle(&dfu_pkt); + + // Translate the err_code returned by the above function to DFU Response Value. + if (err_code != NRF_SUCCESS) + { + ble_dfu_resp_val_t resp_val = nrf_err_code_translate(err_code, BLE_DFU_INIT_PROCEDURE); + + err_code = ble_dfu_response_send(p_dfu, BLE_DFU_INIT_PROCEDURE, resp_val); + APP_ERROR_CHECK(err_code); + } +} + + +/**@brief Function for processing application data written by the peer to the DFU Packet + * Characteristic. + * + * @param[in] p_dfu DFU Service Structure. + * @param[in] p_evt Pointer to the event received from the S110 SoftDevice. + */ +static void app_data_process(ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt) +{ + uint32_t err_code; + + if ((p_evt->evt.ble_dfu_pkt_write.len & (sizeof(uint32_t) - 1)) != 0) + { + // Data length is not a multiple of 4 (word size). + err_code = ble_dfu_response_send(p_dfu, + BLE_DFU_RECEIVE_APP_PROCEDURE, + BLE_DFU_RESP_VAL_NOT_SUPPORTED); + APP_ERROR_CHECK(err_code); + return; + } + + uint32_t length = p_evt->evt.ble_dfu_pkt_write.len; + + err_code = hci_mem_pool_rx_produce(length, (void **) &mp_rx_buffer); + if (err_code != NRF_SUCCESS) + { + dfu_error_notify(p_dfu, err_code); + return; + } + + uint8_t * p_data_packet = p_evt->evt.ble_dfu_pkt_write.p_data; + + memcpy(mp_rx_buffer, p_data_packet, length); + + err_code = hci_mem_pool_rx_data_size_set(length); + if (err_code != NRF_SUCCESS) + { + dfu_error_notify(p_dfu, err_code); + return; + } + + err_code = hci_mem_pool_rx_extract(&mp_rx_buffer, &length); + if (err_code != NRF_SUCCESS) + { + dfu_error_notify(p_dfu, err_code); + return; + } + + dfu_update_packet_t dfu_pkt; + + dfu_pkt.packet_type = DATA_PACKET; + dfu_pkt.params.data_packet.packet_length = length / sizeof(uint32_t); + dfu_pkt.params.data_packet.p_data_packet = (uint32_t *)mp_rx_buffer; + + err_code = dfu_data_pkt_handle(&dfu_pkt); + + if (err_code == NRF_SUCCESS) + { + m_num_of_firmware_bytes_rcvd += p_evt->evt.ble_dfu_pkt_write.len; + + // All the expected firmware data has been received and processed successfully. + // Response will be sent when flash operation for final packet is completed. + mp_final_packet = mp_rx_buffer; + } + else if (err_code == NRF_ERROR_INVALID_LENGTH) + { + // Firmware data packet was handled successfully. And more firmware data is expected. + m_num_of_firmware_bytes_rcvd += p_evt->evt.ble_dfu_pkt_write.len; + + // Check if a packet receipt notification is needed to be sent. + if (m_pkt_rcpt_notif_enabled) + { + // Decrement the counter for the number firmware packets needed for sending the + // next packet receipt notification. + m_pkt_notif_target_cnt--; + + if (m_pkt_notif_target_cnt == 0) + { + err_code = ble_dfu_pkts_rcpt_notify(p_dfu, m_num_of_firmware_bytes_rcvd); + APP_ERROR_CHECK(err_code); + + // Reset the counter for the number of firmware packets. + m_pkt_notif_target_cnt = m_pkt_notif_target; + } + } + } + else + { + uint32_t hci_error = hci_mem_pool_rx_consume(mp_rx_buffer); + if (hci_error != NRF_SUCCESS) + { + dfu_error_notify(p_dfu, hci_error); + } + + dfu_error_notify(p_dfu, err_code); + } +} + + +/**@brief Function for processing data written by the peer to the DFU Packet Characteristic. + * + * @param[in] p_dfu DFU Service Structure. + * @param[in] p_evt Pointer to the event received from the S110 SoftDevice. + */ +static void on_dfu_pkt_write(ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt) +{ + // The peer has written to the DFU Packet characteristic. Depending on the value of + // the current value of the DFU Control Point, the appropriate action is taken. + switch (m_pkt_type) + { + case PKT_TYPE_START: + // The peer has written a start packet to the DFU Packet characteristic. + start_data_process(p_dfu, p_evt); + break; + + case PKT_TYPE_INIT: + // The peer has written an init packet to the DFU Packet characteristic. + init_data_process(p_dfu, p_evt); + break; + + case PKT_TYPE_FIRMWARE_DATA: + app_data_process(p_dfu, p_evt); + break; + + default: + // It is not possible to find out what packet it is. Ignore. There is no + // mechanism to notify the DFU Controller about this error condition. + break; + } +} + + +/**@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 void conn_params_init(void) +{ + uint32_t err_code; + ble_conn_params_init_t cp_init; + + memset(&cp_init, 0, sizeof(cp_init)); + + cp_init.p_conn_params = NULL; + 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.evt_handler = NULL; + cp_init.error_handler = conn_params_error_handler; + + err_code = ble_conn_params_init(&cp_init); + APP_ERROR_CHECK(err_code); +} + + +/**@brief Function for the Device Firmware Update Service event handler. + * + * @details This function will be called for all Device Firmware Update Service events which + * are passed to the application. + * + * @param[in] p_dfu Device Firmware Update Service structure. + * @param[in] p_evt Event received from the Device Firmware Update Service. + */ +static void on_dfu_evt(ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt) +{ + uint32_t err_code; + ble_dfu_resp_val_t resp_val; + + switch (p_evt->ble_dfu_evt_type) + { + case BLE_DFU_VALIDATE: + err_code = dfu_image_validate(); + + // Translate the err_code returned by the above function to DFU Response Value. + resp_val = nrf_err_code_translate(err_code, BLE_DFU_VALIDATE_PROCEDURE); + + err_code = ble_dfu_response_send(p_dfu, BLE_DFU_VALIDATE_PROCEDURE, resp_val); + APP_ERROR_CHECK(err_code); + break; + + case BLE_DFU_ACTIVATE_N_RESET: + err_code = dfu_transport_close(); + APP_ERROR_CHECK(err_code); + + // With the S110 Flash API it is safe to initiate the activate before connection is + // fully closed. + err_code = dfu_image_activate(); + if (err_code != NRF_SUCCESS) + { + dfu_reset(); + } + break; + + case BLE_DFU_SYS_RESET: + err_code = dfu_transport_close(); + APP_ERROR_CHECK(err_code); + + dfu_reset(); + break; + + case BLE_DFU_START: + m_pkt_type = PKT_TYPE_START; + m_update_mode = (uint8_t)p_evt->evt.ble_dfu_pkt_write.p_data[0]; + break; + + case BLE_DFU_RECEIVE_INIT_DATA: + m_pkt_type = PKT_TYPE_INIT; + if ((uint8_t)p_evt->evt.ble_dfu_pkt_write.p_data[0] == DFU_INIT_COMPLETE) + { + err_code = dfu_init_pkt_complete(); + + // Translate the err_code returned by the above function to DFU Response Value. + resp_val = nrf_err_code_translate(err_code, BLE_DFU_INIT_PROCEDURE); + + err_code = ble_dfu_response_send(p_dfu, BLE_DFU_INIT_PROCEDURE, resp_val); + APP_ERROR_CHECK(err_code); + } + break; + + case BLE_DFU_RECEIVE_APP_DATA: + m_pkt_type = PKT_TYPE_FIRMWARE_DATA; + break; + + case BLE_DFU_PACKET_WRITE: + on_dfu_pkt_write(p_dfu, p_evt); + break; + + case BLE_DFU_PKT_RCPT_NOTIF_ENABLED: + m_pkt_rcpt_notif_enabled = true; + m_pkt_notif_target = p_evt->evt.pkt_rcpt_notif_req.num_of_pkts; + m_pkt_notif_target_cnt = p_evt->evt.pkt_rcpt_notif_req.num_of_pkts; + break; + + case BLE_DFU_PKT_RCPT_NOTIF_DISABLED: + m_pkt_rcpt_notif_enabled = false; + m_pkt_notif_target = 0; + break; + + case BLE_DFU_BYTES_RECEIVED_SEND: + err_code = ble_dfu_bytes_rcvd_report(p_dfu, m_num_of_firmware_bytes_rcvd); + APP_ERROR_CHECK(err_code); + break; + + default: + // Unsupported event received from DFU Service. Ignore. + break; + } +} + + +/**@brief Function for the Advertising functionality initialization. + * + * @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. + */ +static void advertising_init(uint8_t adv_flags) +{ + uint32_t err_code; + ble_advdata_t advdata; + ble_uuid_t service_uuid; + + service_uuid.type = m_dfu.uuid_type; + service_uuid.uuid = BLE_DFU_SERVICE_UUID; + + // Build and set advertising data. + memset(&advdata, 0, sizeof(advdata)); + + advdata.name_type = BLE_ADVDATA_FULL_NAME; + advdata.include_appearance = false; + advdata.flags = adv_flags; + advdata.uuids_more_available.uuid_cnt = 1; + advdata.uuids_more_available.p_uuids = &service_uuid; + + err_code = ble_advdata_set(&advdata, NULL); + APP_ERROR_CHECK(err_code); +} + + +/**@brief Function for starting advertising. + */ +static void advertising_start(void) +{ + if (!m_is_advertising) + { + uint32_t err_code; + + // Initialize advertising parameters (used when starting advertising). + memset(&m_adv_params, 0, sizeof(m_adv_params)); + + if (m_ble_peer_data_valid) + { + ble_gap_irk_t empty_irk = {{0}}; + + if (memcmp(m_ble_peer_data.irk.irk, empty_irk.irk, sizeof(empty_irk.irk)) == 0) + { + advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE); + m_adv_params.type = BLE_GAP_ADV_TYPE_ADV_DIRECT_IND; + m_adv_params.p_peer_addr = &m_ble_peer_data.addr; + m_adv_params.fp = BLE_GAP_ADV_FP_ANY; + m_adv_params.interval = 0; + m_adv_params.timeout = 0; + } + else + { + ble_gap_irk_t * p_irk[1]; + ble_gap_addr_t * p_addr[1]; + + p_irk[0] = &m_ble_peer_data.irk; + p_addr[0] = &m_ble_peer_data.addr; + + ble_gap_whitelist_t whitelist; + whitelist.addr_count = 1; + whitelist.pp_addrs = p_addr; + whitelist.irk_count = 1; + whitelist.pp_irks = p_irk; + + advertising_init(BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED); + m_adv_params.type = BLE_GAP_ADV_TYPE_ADV_IND; + m_adv_params.fp = BLE_GAP_ADV_FP_FILTER_CONNREQ; + m_adv_params.p_whitelist = &whitelist; + m_adv_params.interval = APP_ADV_INTERVAL; + m_adv_params.timeout = APP_ADV_TIMEOUT_IN_SECONDS; + } + } + else + { + advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE); + m_adv_params.type = BLE_GAP_ADV_TYPE_ADV_IND; + m_adv_params.p_peer_addr = NULL; + m_adv_params.fp = BLE_GAP_ADV_FP_ANY; + m_adv_params.interval = APP_ADV_INTERVAL; + m_adv_params.timeout = APP_ADV_TIMEOUT_IN_SECONDS; + } + + err_code = sd_ble_gap_adv_start(&m_adv_params); + APP_ERROR_CHECK(err_code); + + nrf_gpio_pin_clear(ADVERTISING_LED_PIN_NO); + + m_is_advertising = true; + } +} + + +/**@brief Function for stopping advertising. + */ +static void advertising_stop(void) +{ + if (m_is_advertising) + { + uint32_t err_code; + + err_code = sd_ble_gap_adv_stop(); + APP_ERROR_CHECK(err_code); + + nrf_gpio_pin_set(ADVERTISING_LED_PIN_NO); + + m_is_advertising = false; + } +} + + +/**@brief Function for the Application's S110 SoftDevice event handler. + * + * @param[in] p_ble_evt S110 SoftDevice event. + */ +static void on_ble_evt(ble_evt_t * p_ble_evt) +{ + uint32_t err_code; + ble_gatts_rw_authorize_reply_params_t auth_reply; + + 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_is_advertising = false; + break; + + case BLE_GAP_EVT_DISCONNECTED: + { + uint8_t sys_attr[128]; + uint16_t sys_attr_len = 128; + + m_direct_adv_cnt = APP_DIRECTED_ADV_TIMEOUT; + nrf_gpio_pin_set(CONNECTED_LED_PIN_NO); + + err_code = sd_ble_gatts_sys_attr_get(m_conn_handle, + sys_attr, + &sys_attr_len, + BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS); + APP_ERROR_CHECK(err_code); + + } + if (!m_tear_down_in_progress) + { + // The Disconnected event is because of an external event. (Link loss or + // disconnect triggered by the DFU Controller before the firmware update was + // complete). + // Restart advertising so that the DFU Controller can reconnect if possible. + advertising_start(); + } + + m_conn_handle = BLE_CONN_HANDLE_INVALID; + + break; + + case BLE_GAP_EVT_SEC_PARAMS_REQUEST: + { + ble_gap_sec_keyset_t keys; + ble_gap_enc_key_t enc_key; + ble_gap_id_key_t id_key; + + id_key.id_addr_info = m_ble_peer_data.addr; + id_key.id_info = m_ble_peer_data.irk; + enc_key = m_ble_peer_data.enc_key; + + keys.keys_central.p_id_key = &id_key; + keys.keys_central.p_enc_key = &enc_key; + + err_code = sd_ble_gap_sec_params_reply(m_conn_handle, + BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP, + &m_sec_params, + &keys); + 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_GAP_EVT_TIMEOUT: + if (p_ble_evt->evt.gap_evt.params.timeout.src == BLE_GAP_TIMEOUT_SRC_ADVERTISING) + { + m_is_advertising = false; + m_direct_adv_cnt--; + if (m_direct_adv_cnt == 0) + { + dfu_update_status_t update_status = {.status_code = DFU_TIMEOUT}; + bootloader_dfu_update_process(update_status); + } + else + { + advertising_start(); + } + } + 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 ((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)) + { + if (p_ble_evt->evt.gatts_evt.params.authorize_request.type + == BLE_GATTS_AUTHORIZE_TYPE_WRITE) + { + auth_reply.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE; + } + else + { + auth_reply.type = BLE_GATTS_AUTHORIZE_TYPE_READ; + } + auth_reply.params.write.gatt_status = APP_FEATURE_NOT_SUPPORTED; + + err_code = sd_ble_gatts_rw_authorize_reply(m_conn_handle,&auth_reply); + APP_ERROR_CHECK(err_code); + } + } + break; + + case BLE_GAP_EVT_SEC_INFO_REQUEST: + { + ble_gap_enc_info_t * p_enc_info = NULL; + + // If there is a match in diversifier then set the correct keys. + if (p_ble_evt->evt.gap_evt.params.sec_info_request.master_id.ediv == + m_ble_peer_data.enc_key.master_id.ediv) + { + p_enc_info = &m_ble_peer_data.enc_key.enc_info; + } + + err_code = sd_ble_gap_sec_info_reply(p_ble_evt->evt.gap_evt.conn_handle, + p_enc_info, + &m_ble_peer_data.irk, + NULL); + APP_ERROR_CHECK(err_code); + } + break; + + case BLE_GATTS_EVT_SYS_ATTR_MISSING: + case BLE_GAP_EVT_CONN_SEC_UPDATE: + err_code = service_change_indicate(); + APP_ERROR_CHECK(err_code); + break; + + case BLE_GAP_EVT_AUTH_STATUS: + // No implementation needed. + break; + + default: + // No implementation needed. + break; + } +} + + +/**@brief Function for dispatching a S110 SoftDevice event to all modules with a S110 + * SoftDevice event handler. + * + * @details This function is called from the S110 SoftDevice event interrupt handler after a + * S110 SoftDevice event has been received. + * + * @param[in] p_ble_evt S110 SoftDevice event. + */ +static void ble_evt_dispatch(ble_evt_t * p_ble_evt) +{ + ble_conn_params_on_ble_evt(p_ble_evt); + ble_dfu_on_ble_evt(&m_dfu, 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); +} + + +/**@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 void gap_params_init(void) +{ + uint32_t err_code; + ble_gap_conn_params_t gap_conn_params; + ble_gap_conn_sec_mode_t sec_mode; + + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode); + + err_code = sd_ble_gap_device_name_set(&sec_mode, + (const uint8_t *)DEVICE_NAME, + strlen(DEVICE_NAME)); + APP_ERROR_CHECK(err_code); + + memset(&gap_conn_params, 0, sizeof(gap_conn_params)); + + 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); + APP_ERROR_CHECK(err_code); +} + + +/**@brief Function for handling Service errors. + * + * @details A pointer to this function will be passed to the DFU service which may need to inform + * the application about an error. + * + * @param[in] nrf_error Error code containing information about what went wrong. + */ +static void service_error_handler(uint32_t nrf_error) +{ + APP_ERROR_HANDLER(nrf_error); +} + + +/**@brief Function for initializing services that will be used by the application. + */ +static void services_init(void) +{ + uint32_t err_code; + ble_dfu_init_t dfu_init_obj; + + // Initialize the Device Firmware Update Service. + memset(&dfu_init_obj, 0, sizeof(dfu_init_obj)); + + dfu_init_obj.revision = DFU_REVISION; + dfu_init_obj.evt_handler = on_dfu_evt; + dfu_init_obj.error_handler = service_error_handler; + + err_code = ble_dfu_init(&m_dfu, &dfu_init_obj); + + APP_ERROR_CHECK(err_code); +} + + +/**@brief Function for initializing security parameters. + */ +static void sec_params_init(void) +{ + m_sec_params.bond = SEC_PARAM_BOND; + m_sec_params.mitm = SEC_PARAM_MITM; + m_sec_params.io_caps = SEC_PARAM_IO_CAPABILITIES; + m_sec_params.oob = SEC_PARAM_OOB; + m_sec_params.min_key_size = SEC_PARAM_MIN_KEY_SIZE; + m_sec_params.max_key_size = SEC_PARAM_MAX_KEY_SIZE; +} + + +uint32_t dfu_transport_update_start(void) +{ + uint32_t err_code; + + m_tear_down_in_progress = false; + m_pkt_type = PKT_TYPE_INVALID; + + leds_init(); + + err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + dfu_register_callback(dfu_cb_handler); + + err_code = hci_mem_pool_open(); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + err_code = dfu_ble_peer_data_get(&m_ble_peer_data); + if (err_code == NRF_SUCCESS) + { + m_ble_peer_data_valid = true; + } + else + { + ble_gap_addr_t addr; + + err_code = sd_ble_gap_address_get(&addr); + APP_ERROR_CHECK(err_code); + + // Increase the BLE address by one when advertising openly. + addr.addr[0] += 1; + + err_code = sd_ble_gap_address_set(BLE_GAP_ADDR_CYCLE_MODE_NONE, &addr); + APP_ERROR_CHECK(err_code); + } + + gap_params_init(); + services_init(); + conn_params_init(); + sec_params_init(); + advertising_start(); + + return NRF_SUCCESS; +} + + +uint32_t dfu_transport_close() +{ + uint32_t err_code; + + m_tear_down_in_progress = true; + + if (IS_CONNECTED()) + { + // Disconnect from peer. + err_code = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION); + APP_ERROR_CHECK(err_code); + } + else + { + // If not connected, then the device will be advertising. Hence stop the advertising. + advertising_stop(); + } + + err_code = ble_conn_params_stop(); + APP_ERROR_CHECK(err_code); + + return NRF_SUCCESS; +} diff --git a/components/libraries/bootloader_dfu/dfu_transport_serial.c b/components/libraries/bootloader_dfu/dfu_transport_serial.c new file mode 100644 index 0000000..51ef4e1 --- /dev/null +++ b/components/libraries/bootloader_dfu/dfu_transport_serial.c @@ -0,0 +1,306 @@ +/* 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 "dfu_transport.h" +#include +#include "dfu.h" +#include +#include "app_error.h" +#include "app_util.h" +#include "hci_transport.h" +#include "app_timer.h" +#include "app_scheduler.h" + +#define MAX_BUFFERS 4u /**< Maximum number of buffers that can be received queued without being consumed. */ + +/** + * defgroup Data Packet Queue Access Operation Macros + * @{ + */ + +/** Provides status showing if the queue is full or not. */ +#define DATA_QUEUE_FULL() \ + (((MAX_BUFFERS -1) == m_data_queue.count) ? true : false) + +/** Provides status showing if the queue is empty or not */ +#define DATA_QUEUE_EMPTY() \ + ((0 == m_data_queue.count) ? true : false) + +/** Initializes an element of the data queue. */ +#define DATA_QUEUE_ELEMENT_INIT(i) \ + m_data_queue.data_packet[(i)].packet_type = INVALID_PACKET + +/** Sets the packet type of an element of the data queue. */ +#define DATA_QUEUE_ELEMENT_SET_PTYPE(i, t) \ + m_data_queue.data_packet[(i)].packet_type = (t) + +/** Copies a data packet pointer of an element of the data queue. */ +#define DATA_QUEUE_ELEMENT_COPY_PDATA(i, dp) \ + m_data_queue.data_packet[(i)].params.data_packet.p_data_packet = (uint32_t *)(dp) + +/** Sets the packet length of an element in the data queue. */ +#define DATA_QUEUE_ELEMENT_SET_PLEN(i, l) \ + m_data_queue.data_packet[(i)].params.data_packet.packet_length = (l) + +/** Gets a data packet pointer of an element in the data queue. */ +#define DATA_QUEUE_ELEMENT_GET_PDATA(i) \ + (m_data_queue.data_packet[(i)].params.data_packet.p_data_packet) + +/** Gets the packet type of an element in the data queue. */ +#define DATA_QUEUE_ELEMENT_GET_PTYPE(i) \ + m_data_queue.data_packet[(i)].packet_type + +/* @} */ + +/** Abstracts data packet queue */ +typedef struct +{ + dfu_update_packet_t data_packet[MAX_BUFFERS]; /**< Bootloader data packets used when processing data from the UART. */ + volatile uint8_t count; /**< Counter to maintain number of elements in the queue. */ +} dfu_data_queue_t; + +static dfu_data_queue_t m_data_queue; /**< Received-data packet queue. */ + +/**@brief Initializes an element of the data buffer queue. + * + * @param[in] element_index index of the element. + */ +static void data_queue_element_init (uint8_t element_index) +{ + DATA_QUEUE_ELEMENT_INIT(element_index); + DATA_QUEUE_ELEMENT_SET_PTYPE(element_index, INVALID_PACKET); + DATA_QUEUE_ELEMENT_COPY_PDATA(element_index, NULL); + DATA_QUEUE_ELEMENT_SET_PLEN(element_index, 0); +} + +/** Initializes data buffer queue */ +static void data_queue_init(void) +{ + uint32_t index; + + m_data_queue.count = 0; + + for (index = 0; index < MAX_BUFFERS; index++) + { + data_queue_element_init(index); + } +} + +/**@brief Function for freeing an element. + * + * @param[in] element_index index of the element. + */ +static uint32_t data_queue_element_free(uint8_t element_index) +{ + uint8_t * p_data; + uint32_t retval; + + retval = NRF_ERROR_INVALID_PARAM; + + if (MAX_BUFFERS > element_index) + { + p_data = (uint8_t *)DATA_QUEUE_ELEMENT_GET_PDATA(element_index); + if (INVALID_PACKET != DATA_QUEUE_ELEMENT_GET_PTYPE(element_index)) + { + m_data_queue.count--; + data_queue_element_init (element_index); + retval = hci_transport_rx_pkt_consume((p_data - 4)); + APP_ERROR_CHECK(retval); + } + } + else + { + return NRF_ERROR_INVALID_PARAM; + } + + return NRF_SUCCESS; +} + +/**@brief Function for Allocating element. + * + * @param[in] packet_type packet type. + * @param[out] p_element_index index of the element. + */ +static uint32_t data_queue_element_alloc(uint8_t * p_element_index, uint8_t packet_type) +{ + uint32_t retval; + uint32_t index; + + retval = NRF_ERROR_NO_MEM; + + if (INVALID_PACKET == packet_type) + { + retval = NRF_ERROR_INVALID_PARAM; + } + else if (true == DATA_QUEUE_FULL()) + { + retval = NRF_ERROR_NO_MEM; + } + else + { + for (index = 0; index < MAX_BUFFERS; index++) + { + if (INVALID_PACKET == DATA_QUEUE_ELEMENT_GET_PTYPE(index)) + { + // Found a free element: allocate, and end search. + *p_element_index = index; + DATA_QUEUE_ELEMENT_SET_PTYPE(index, packet_type); + retval = NRF_SUCCESS; + m_data_queue.count++; + break; + } + } + } + + return retval; +} + +// Flush everything on disconnect or stop. +static void data_queue_flush(void) +{ + uint32_t index; + + for (index = 0; index < MAX_BUFFERS; index++) + { + // In this case it does not matter if free succeeded or not as data packets are being flushed because DFU Trnsport was closed + (void)data_queue_element_free(index); + } +} + + +/**@brief Function for handling the callback events from the dfu module. + * Callbacks are expected when \ref dfu_data_pkt_handle has been executed. + * + * @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. + */ +static void dfu_cb_handler(uint32_t packet, uint32_t result, uint8_t * p_data) +{ + APP_ERROR_CHECK(result); +} + + +static void process_dfu_packet(void * p_event_data, uint16_t event_size) +{ + uint32_t retval; + uint32_t index; + dfu_update_packet_t * packet; + + while (false == DATA_QUEUE_EMPTY()) + { + // Fetch the element to be processed. + for (index = 0; index < MAX_BUFFERS ; index++) + { + packet = &m_data_queue.data_packet[index]; + if (INVALID_PACKET != packet->packet_type) + { + + switch (DATA_QUEUE_ELEMENT_GET_PTYPE(index)) + { + case DATA_PACKET: + (void)dfu_data_pkt_handle(packet); + break; + + case START_PACKET: + packet->params.start_packet = + (dfu_start_packet_t*)packet->params.data_packet.p_data_packet; + retval = dfu_start_pkt_handle(packet); + APP_ERROR_CHECK(retval); + break; + + case INIT_PACKET: + (void)dfu_init_pkt_handle(packet); + retval = dfu_init_pkt_complete(); + APP_ERROR_CHECK(retval); + break; + + case STOP_DATA_PACKET: + (void)dfu_image_validate(); + (void)dfu_image_activate(); + + // Break the loop by returning. + return; + + default: + // No implementation needed. + break; + } + + // Free the processed element. + retval = data_queue_element_free(index); + APP_ERROR_CHECK(retval); + } + } + } +} + + +void rpc_transport_event_handler(hci_transport_evt_t event) +{ + uint32_t retval; + uint16_t rpc_cmd_length_read; + uint8_t * p_rpc_cmd_buffer; + uint8_t element_index; + + retval = hci_transport_rx_pkt_extract(&p_rpc_cmd_buffer, &rpc_cmd_length_read); + if (NRF_SUCCESS == retval) + { + // Verify if the data queue can buffer the packet. + retval = data_queue_element_alloc(&element_index, p_rpc_cmd_buffer[0]); + if (NRF_SUCCESS == retval) + { + //subtract 1 since we are interested in payload length and not the type field. + DATA_QUEUE_ELEMENT_SET_PLEN(element_index,(rpc_cmd_length_read / sizeof(uint32_t)) - 1); + DATA_QUEUE_ELEMENT_COPY_PDATA(element_index, &p_rpc_cmd_buffer[4]); + retval = app_sched_event_put(NULL, 0, process_dfu_packet); + } + } + + if (NRF_SUCCESS != retval) + { + // Free the packet that could not be processed. + retval = hci_transport_rx_pkt_consume(p_rpc_cmd_buffer); + APP_ERROR_CHECK(retval); + } +} + + +uint32_t dfu_transport_update_start(void) +{ + uint32_t err_code; + + // Initialize data buffer queue. + data_queue_init(); + + dfu_register_callback(dfu_cb_handler); + + // Open transport layer. + err_code = hci_transport_open(); + APP_ERROR_CHECK(err_code); + + // Register callback to be run when commands have been received by the transport layer. + err_code = hci_transport_evt_handler_reg(rpc_transport_event_handler); + APP_ERROR_CHECK(err_code); + + return NRF_SUCCESS; +} + + +uint32_t dfu_transport_close(void) +{ + // Remove all buffered packets. + data_queue_flush(); + + return hci_transport_close(); +} + diff --git a/components/libraries/bootloader_dfu/dfu_types.h b/components/libraries/bootloader_dfu/dfu_types.h new file mode 100644 index 0000000..c02f2d5 --- /dev/null +++ b/components/libraries/bootloader_dfu/dfu_types.h @@ -0,0 +1,147 @@ +/* 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. + * + */ + +/**@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.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. */ + +#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 +#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 + +#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. */ +#elif NRF52 +#define BOOTLOADER_REGION_START 0x0007B000 /**< 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 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. */ + +#define DFU_APP_DATA_RESERVED 0x0000 /**< 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. */ +#define DFU_BANK_PADDING (DFU_APP_DATA_RESERVED % (2 * CODE_PAGE_SIZE)) /**< Padding to ensure that image size banked is always page sized. */ +#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_REGION_TOTAL_SIZE - \ + DFU_APP_DATA_RESERVED - \ + DFU_BANK_PADDING) / 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/components/libraries/bootloader_dfu/experimental/dfu_init_template_signing.c b/components/libraries/bootloader_dfu/experimental/dfu_init_template_signing.c new file mode 100644 index 0000000..cb91cd4 --- /dev/null +++ b/components/libraries/bootloader_dfu/experimental/dfu_init_template_signing.c @@ -0,0 +1,210 @@ +/* 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. + * + */ + +/**@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_sec.h" +#include "nrf_error.h" +#include "crc16.h" + +// The following is the layout of the extended init packet if using image length and sha256 to validate image +// and NIST P-256 + SHA256 to sign the init_package including the extended part +#define DFU_INIT_PACKET_POS_EXT_IDENTIFIER 0 //< Position of the identifier for the ext package +#define DFU_INIT_PACKET_POS_EXT_IMAGE_LENGTH 4 //< Position of the image length +#define DFU_INIT_PACKET_POS_EXT_IMAGE_HASH256 8 //< Position of the 256 +#define DFU_INIT_PACKET_POS_EXT_INIT_SIGNATURE_R 40 //< Position of the Signature R +#define DFU_INIT_PACKET_POS_EXT_INIT_SIGNATURE_S 72 //< Position of the Signature S +#define DFU_INIT_PACKET_EXT_LENGTH_SIGNED 40 //< Length of the extended init packet that is part of the signed data +#define DFU_INIT_PACKET_EXT_BEGIN + +#define DFU_INIT_PACKET_EXT_LENGTH_MIN 6 //< Minimum length of the extended init packet. Init packet and CRC16 +#define DFU_INIT_PACKET_EXT_LENGTH_MAX 104 //< Identifier (4 bytes) + Image length (4 bytes) + SHA-256 digest (32 bytes) + NIST P-256 using SHA-256 (64 bytes) + +#define DFU_SHA256_DIGEST_LENGTH 32 //< Length of SHA-256 digest +#define DFU_SIGNATURE_R_LENGTH 32 //< Length of the signature part r +#define DFU_SIGNATURE_S_LENGTH 32 //< Length of the signature part s + +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. */ + + #define DFU_INIT_PACKET_USES_CRC16 (0) + #define DFU_INIT_PACKET_USES_HASH (1) + #define DFU_INIT_PACKET_USES_ECDS (2) + + +/** @snippet [DFU BLE Signing public key curve points] */ +static uint8_t Qx[] = { 0x39, 0xb0, 0x58, 0x3d, 0x27, 0x07, 0x91, 0x38, 0x6a, 0xa3, 0x36, 0x0f, 0xa2, 0xb5, 0x86, 0x7e, 0xae, 0xba, 0xf7, 0xa3, 0xf4, 0x81, 0x5f, 0x78, 0x02, 0xf2, 0xa1, 0x21, 0xd5, 0x21, 0x84, 0x12 }; +static uint8_t Qy[] = { 0x4a, 0x0d, 0xfe, 0xa4, 0x77, 0x50, 0xb1, 0xb5, 0x26, 0xc0, 0x9d, 0xdd, 0xf0, 0x24, 0x90, 0x57, 0x6c, 0x64, 0x3b, 0xd3, 0xdf, 0x92, 0x3b, 0xb3, 0x47, 0x97, 0x83, 0xd4, 0xfc, 0x76, 0xf5, 0x9d }; +/** @snippet [DFU BLE Signing public key curve points] */ + +static nrf_sec_ecc_point_t Q = {.p_x = Qx, + .x_len = sizeof(Qx), + .p_y = Qy, + .y_len = sizeof(Qy)}; + +uint32_t dfu_init_prevalidate(uint8_t * p_init_data, uint32_t init_data_len) +{ + uint32_t i = 0; + static uint32_t err_code; + nrf_sec_data_t init_data; + nrf_sec_ecc_signature_t signature; + + // In order to support 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)) + { + // Found a match. Break the loop. + break; + } + // No matching SoftDevice found - Return NRF_ERROR_INVALID_DATA. + return NRF_ERROR_INVALID_DATA; + } + + // Check that we have the correct identifier indicating that ECDS is used + if(*(uint32_t*)&m_extended_packet[DFU_INIT_PACKET_POS_EXT_IDENTIFIER] != DFU_INIT_PACKET_USES_ECDS) + { + return NRF_ERROR_INVALID_DATA; + } + + // init_data consists of the regular init-packet and all the extended packet data excluding the signing key + init_data.length = (init_data_len - m_extended_packet_length) + DFU_INIT_PACKET_EXT_LENGTH_SIGNED; + init_data.p_data = p_init_data; + + signature.p_r = &m_extended_packet[DFU_INIT_PACKET_POS_EXT_INIT_SIGNATURE_R]; + signature.r_len = DFU_SIGNATURE_R_LENGTH; + signature.p_s = &m_extended_packet[DFU_INIT_PACKET_POS_EXT_INIT_SIGNATURE_S]; + signature.s_len = DFU_SIGNATURE_S_LENGTH; + + err_code = nrf_sec_svc_verify(&init_data, &Q ,&signature, NRF_SEC_NIST256_SHA256); + return err_code; +} + +uint32_t dfu_init_postvalidate(uint8_t * p_image, uint32_t image_len) +{ + uint8_t image_digest[DFU_SHA256_DIGEST_LENGTH]; + uint8_t * received_digest; + + nrf_sec_data_t data = {.p_data = p_image, + .length = image_len}; + + + // Compare image size received with signed init_packet data + if(image_len != *(uint32_t*)&m_extended_packet[DFU_INIT_PACKET_POS_EXT_IMAGE_LENGTH]) + { + return NRF_ERROR_INVALID_DATA; + } + + // Calculate digest from active block. + nrf_sec_svc_hash(&data, image_digest, NRF_SEC_SHA256); + + received_digest = &m_extended_packet[DFU_INIT_PACKET_POS_EXT_IMAGE_HASH256]; + + // Compare the received and calculated digests. + if (memcmp(&image_digest[0], received_digest, DFU_SHA256_DIGEST_LENGTH) != 0) + { + return NRF_ERROR_INVALID_DATA; + } + + return NRF_SUCCESS; +} diff --git a/components/libraries/bootloader_dfu/experimental/nrf_sec.h b/components/libraries/bootloader_dfu/experimental/nrf_sec.h new file mode 100644 index 0000000..5fc2fcc --- /dev/null +++ b/components/libraries/bootloader_dfu/experimental/nrf_sec.h @@ -0,0 +1,108 @@ +/* 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. + * + */ + +#ifndef NRF_SEC_H__ +#define NRF_SEC_H__ + +#include "nrf_svc.h" +#include + +#define NRF_SEC_SVC_BASE 0x8 /**< The lowest SVC number reserved for the nRF Security library. */ + +/**@brief The SVC numbers used by the SVC functions in the security library. */ +enum NRF_SEC_SVCS +{ + NRF_SEC_SVC_HASH = NRF_SEC_SVC_BASE, /**< SVC number for generating a digest using a hash function over a dataset. */ + NRF_SEC_SVC_VERIFY, /**< SVC number for veryfying a signature for a given dataset using provided keys and signature. */ + NRF_SEC_SVC_LAST +}; + +/**@brief Enumeration containing list of supported ECC curve and hash functions in the nRF Security library. + */ +typedef enum +{ + NRF_SEC_NIST256_SHA256 = 0x00, /**< Selection of NIST P-256 curve with SHA-256 digest for verification of signature. */ + NRF_SEC_ALGO_LAST /**< Last element in enumeration closing valid algorithm list. */ +}nrf_sec_algo_t; + +/**@brief Enumeration containing list of supported hash functions in the nRF Security library. + */ +typedef enum +{ + NRF_SEC_SHA256 = 0x00, /**< Selection of SHA-256 hash function. */ + NRF_SEC_HASH_FUNC_LAST /**< Last element in enumeration closing valid hash function list. */ +}nrf_sec_hash_func_t; + +/**@brief Structure with length of data and pointer to data for signing or verification. + */ +typedef struct +{ + uint32_t length; /**< Length of data pointed to by @ref p_data. */ + uint8_t * p_data; /**< Pointer to data to be used. */ +} nrf_sec_data_t; + +/**@brief Structure with pointers to X and Y coordinates of a point on the curve. + */ +typedef struct +{ + uint8_t * p_x; /**< Pointer to X coordinate of point. */ + uint32_t x_len; /**< Length of data pointed to by p_x. */ + uint8_t * p_y; /**< Pointer to X coordinate of point. */ + uint32_t y_len; /**< Length of data pointed to by p_x. */ +} nrf_sec_ecc_point_t; + +/**@brief Structure with pointers to r and s parts of the ecc signature. + */ +typedef struct +{ + uint8_t * p_r; /**< Pointer to R part of signature */ + uint32_t r_len; /**< Length of data pointed to by p_r */ + uint8_t * p_s; /**< Pointer to S part of signature */ + uint32_t s_len; /**< Length to data pointed to by p_s */ +} nrf_sec_ecc_signature_t; + +/**@brief SVC Function for verifying a signature over a given dataset. + * + * @param[in] p_data Pointer to the data which must be verified. + * @param[in] p_Q Pointer to the public key, Q. + * @param[in] p_signature Pointer to the signature (r and s). + * @param[in] algorithm Curve and hash algorithm to be used for verifying the signature, for + example NIST P-256 with SHA-256. + * + * @retval NRF_ERROR_INVALID_DATA If the signature does not match the dataset provided. + * @retval NRF_ERROR_NOT_SUPPORTED If the selected algorithm is not supported in this version of + the library. + * @retval NRF_SUCCESS If the signature matches the dataset provided. + */ +SVCALL(NRF_SEC_SVC_VERIFY, uint32_t, nrf_sec_svc_verify (nrf_sec_data_t * p_data, + nrf_sec_ecc_point_t * p_Q, + nrf_sec_ecc_signature_t * p_signature, + nrf_sec_algo_t algorithm)); + +/**@brief SVC Function for generating a signature over a given dataset. + * + * @param[in] p_data Pointer to the data which must be verified. + * @param[out] p_digest Pointer to memory where generated digest shall be stored. Ensure + * sufficient memory is available, that is for a SHA-256 there must + * be at least 256 bits (8 words) available. + * @param[in] hash_func Type of fash function to use when generating the digest + * + * @retval NRF_ERROR_NULL If a null pointer is provided as data or hash. + * @retval NRF_ERROR_NOT_SUPPORTED If the selected hash functions is not supported in this version + * of the library. + * @retval NRF_SUCCESS If generation of a digest was successful. + */ +SVCALL(NRF_SEC_SVC_HASH, uint32_t, nrf_sec_svc_hash(nrf_sec_data_t * p_data, + uint8_t * p_digest, + nrf_sec_hash_func_t hash_func)); + +#endif // NRF_SEC_H__ diff --git a/components/libraries/bootloader_dfu/hci_transport/hci_mem_pool_internal.h b/components/libraries/bootloader_dfu/hci_transport/hci_mem_pool_internal.h new file mode 100644 index 0000000..f5c9638 --- /dev/null +++ b/components/libraries/bootloader_dfu/hci_transport/hci_mem_pool_internal.h @@ -0,0 +1,32 @@ +/* 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. + * + */ + +/** @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/components/libraries/bootloader_dfu/hci_transport/hci_transport_config.h b/components/libraries/bootloader_dfu/hci_transport/hci_transport_config.h new file mode 100644 index 0000000..748b1ce --- /dev/null +++ b/components/libraries/bootloader_dfu/hci_transport/hci_transport_config.h @@ -0,0 +1,45 @@ +/* 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. + * + */ + +/**@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/components/libraries/button/app_button.c b/components/libraries/button/app_button.c new file mode 100644 index 0000000..4b00b96 --- /dev/null +++ b/components/libraries/button/app_button.c @@ -0,0 +1,199 @@ +/* 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 "app_button.h" +#include +#include "nordic_common.h" +#include "app_util.h" +#include "app_timer.h" +#include "app_error.h" +#include "nrf_drv_gpiote.h" +#include "nrf_assert.h" + +static app_button_cfg_t * mp_buttons = NULL; /**< Button configuration. */ +static uint8_t m_button_count; /**< Number of configured buttons. */ +static uint32_t m_detection_delay; /**< Delay before a button is reported as pushed. */ +APP_TIMER_DEF(m_detection_delay_timer_id); /**< Polling timer id. */ + + +static uint32_t m_pin_state; +static uint32_t m_pin_transition; + +/**@brief Function for handling the timeout that delays reporting buttons as pushed. + * + * @details The detection_delay_timeout_handler(...) is a call-back issued from the app_timer + * module. It is called with the p_context parameter. The p_context parameter is + * provided to the app_timer module when a timer is started, using the call + * @ref app_timer_start. On @ref app_timer_start the p_context will be holding the + * currently pressed buttons. + * + * @param[in] p_context Pointer used for passing information app_start_timer() was called. + * In the app_button module the p_context holds information on pressed + * buttons. + */ +static void detection_delay_timeout_handler(void * p_context) +{ + uint8_t i; + + // Pushed button(s) detected, execute button handler(s). + for (i = 0; i < m_button_count; i++) + { + app_button_cfg_t * p_btn = &mp_buttons[i]; + uint32_t btn_mask = 1 << p_btn->pin_no; + if (btn_mask & m_pin_transition) + { + m_pin_transition &= ~btn_mask; + bool pin_is_set = nrf_drv_gpiote_in_is_set(p_btn->pin_no); + if ((m_pin_state & (1 << p_btn->pin_no)) == (pin_is_set << p_btn->pin_no)) + { + uint32_t transition = !(pin_is_set ^ (p_btn->active_state == APP_BUTTON_ACTIVE_HIGH)); + + if (p_btn->button_handler) + { + p_btn->button_handler(p_btn->pin_no, transition); + } + } + } + } +} + +static void gpiote_event_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action) +{ + uint32_t err_code; + uint32_t pin_mask = 1 << pin; + + // Start detection timer. If timer is already running, the detection period is restarted. + // NOTE: Using the p_context parameter of app_timer_start() to transfer the pin states to the + // timeout handler (by casting event_pins_mask into the equally sized void * p_context + // parameter). + err_code = app_timer_stop(m_detection_delay_timer_id); + if (err_code != NRF_SUCCESS) + { + // The impact in app_button of the app_timer queue running full is losing a button press. + // The current implementation ensures that the system will continue working as normal. + return; + } + + if (!(m_pin_transition & pin_mask)) + { + if (nrf_drv_gpiote_in_is_set(pin)) + { + m_pin_state |= pin_mask; + } + else + { + m_pin_state &= ~(pin_mask); + } + m_pin_transition |= (pin_mask); + + err_code = app_timer_start(m_detection_delay_timer_id, m_detection_delay, NULL); + if (err_code != NRF_SUCCESS) + { + // The impact in app_button of the app_timer queue running full is losing a button press. + // The current implementation ensures that the system will continue working as normal. + } + } + else + { + m_pin_transition &= ~pin_mask; + } +} + +uint32_t app_button_init(app_button_cfg_t * p_buttons, + uint8_t button_count, + uint32_t detection_delay) +{ + uint32_t err_code; + + if (detection_delay < APP_TIMER_MIN_TIMEOUT_TICKS) + { + return NRF_ERROR_INVALID_PARAM; + } + + if (!nrf_drv_gpiote_is_init()) + { + err_code = nrf_drv_gpiote_init(); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + + // Save configuration. + mp_buttons = p_buttons; + m_button_count = button_count; + m_detection_delay = detection_delay; + + m_pin_state = 0; + m_pin_transition = 0; + + while (button_count--) + { + app_button_cfg_t * p_btn = &p_buttons[button_count]; + + nrf_drv_gpiote_in_config_t config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(false); + config.pull = p_btn->pull_cfg; + + err_code = nrf_drv_gpiote_in_init(p_btn->pin_no, &config, gpiote_event_handler); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + } + + // Create polling timer. + return app_timer_create(&m_detection_delay_timer_id, + APP_TIMER_MODE_SINGLE_SHOT, + detection_delay_timeout_handler); +} + +uint32_t app_button_enable(void) +{ + ASSERT(mp_buttons); + + uint32_t i; + for (i = 0; i < m_button_count; i++) + { + nrf_drv_gpiote_in_event_enable(mp_buttons[i].pin_no, true); + } + + return NRF_SUCCESS; +} + + +uint32_t app_button_disable(void) +{ + ASSERT(mp_buttons); + + uint32_t i; + for (i = 0; i < m_button_count; i++) + { + nrf_drv_gpiote_in_event_disable(mp_buttons[i].pin_no); + } + + // Make sure polling timer is not running. + return app_timer_stop(m_detection_delay_timer_id); +} + + +uint32_t app_button_is_pushed(uint8_t button_id, bool * p_is_pushed) +{ + ASSERT(button_id <= m_button_count); + ASSERT(mp_buttons != NULL); + + app_button_cfg_t * p_btn = &mp_buttons[button_id]; + bool is_set = nrf_drv_gpiote_in_is_set(p_btn->pin_no); + + *p_is_pushed = !(is_set^(p_btn->active_state == APP_BUTTON_ACTIVE_HIGH)); + + return NRF_SUCCESS; +} diff --git a/components/libraries/button/app_button.h b/components/libraries/button/app_button.h new file mode 100644 index 0000000..727d3e2 --- /dev/null +++ b/components/libraries/button/app_button.h @@ -0,0 +1,112 @@ +/* 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_button Button Handler + * @{ + * @ingroup app_common + * + * @brief Buttons handling module. + * + * @details The button handler uses the @ref app_gpiote to detect that a button has been + * pushed. To handle debouncing, it will start a timer in the GPIOTE event handler. + * The button will only be reported as pushed if the corresponding pin is still active when + * the timer expires. If there is a new GPIOTE event while the timer is running, the timer + * is restarted. + * + * @note The app_button module uses the app_timer module. The user must ensure that the queue in + * app_timer is large enough to hold the app_timer_stop() / app_timer_start() operations + * which will be executed on each event from GPIOTE module (2 operations), as well as other + * app_timer operations queued simultaneously in the application. + * + * @note Even if the scheduler is not used, app_button.h will include app_scheduler.h, so when + * compiling, app_scheduler.h must be available in one of the compiler include paths. + */ + +#ifndef APP_BUTTON_H__ +#define APP_BUTTON_H__ + +#include +#include +#include "nrf.h" +#include "app_error.h" +#include "nrf_gpio.h" + +#define APP_BUTTON_PUSH 1 /**< Indicates that a button is pushed. */ +#define APP_BUTTON_RELEASE 0 /**< Indicates that a button is released. */ +#define APP_BUTTON_ACTIVE_HIGH 1 /**< Indicates that a button is active high. */ +#define APP_BUTTON_ACTIVE_LOW 0 /**< Indicates that a button is active low. */ + +/**@brief Button event handler type. */ +typedef void (*app_button_handler_t)(uint8_t pin_no, uint8_t button_action); + +/**@brief Button configuration structure. */ +typedef struct +{ + uint8_t pin_no; /**< Pin to be used as a button. */ + uint8_t active_state; /**< APP_BUTTON_ACTIVE_HIGH or APP_BUTTON_ACTIVE_LOW. */ + nrf_gpio_pin_pull_t pull_cfg; /**< Pull-up or -down configuration. */ + app_button_handler_t button_handler; /**< Handler to be called when button is pushed. */ +} app_button_cfg_t; + +/**@brief Pin transition direction struct. */ +typedef struct +{ + uint32_t high_to_low; /**Pin went from high to low */ + uint32_t low_to_high; /**Pin went from low to high */ +} pin_transition_t; + +/**@brief Function for initializing the Buttons. + * + * @details This function will initialize the specified pins as buttons, and configure the Button + * Handler module as a GPIOTE user (but it will not enable button detection). + * + * @note Normally initialization should be done using the APP_BUTTON_INIT() macro + * + * @note app_button_enable() function must be called in order to enable the button detection. + * + * @param[in] p_buttons Array of buttons to be used (NOTE: Must be static!). + * @param[in] button_count Number of buttons. + * @param[in] detection_delay Delay from a GPIOTE event until a button is reported as pushed. + * + * @return NRF_SUCCESS on success, otherwise an error code. + */ +uint32_t app_button_init(app_button_cfg_t * p_buttons, + uint8_t button_count, + uint32_t detection_delay); + +/**@brief Function for enabling button detection. + * + * @retval NRF_SUCCESS Module successfully enabled. + */ +uint32_t app_button_enable(void); + +/**@brief Function for disabling button detection. + * + * @retval NRF_SUCCESS Button detection successfully disabled. Error code otherwise. + */ +uint32_t app_button_disable(void); + +/**@brief Function for checking if a button is currently being pushed. + * + * @param[in] button_id Button index (in the app_button_cfg_t array given to app_button_init) to be checked. + * @param[out] p_is_pushed Button state. + * + * @retval NRF_SUCCESS State successfully read. + * @retval NRF_ERROR_INVALID_PARAM Invalid button index. + */ +uint32_t app_button_is_pushed(uint8_t button_id, bool * p_is_pushed); + +#endif // APP_BUTTON_H__ + +/** @} */ diff --git a/components/libraries/console/console.c b/components/libraries/console/console.c new file mode 100644 index 0000000..b6fe73a --- /dev/null +++ b/components/libraries/console/console.c @@ -0,0 +1,504 @@ +/* Copyright (c) 2007 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 + * + * Implementation of console.h. + * + */ +#include "console.h" +#include "uart_legacy.h" + +static const uint8_t newline_input[] = CONSOLE_NEWLINE_INPUT; /*!< Needed to compare input against to find end of line */ +#define NEWLINE_INPUT_LEN (sizeof CONSOLE_NEWLINE_INPUT - 1) /*!< Subtract one for the zero termination */ + +static const char hex_tab[] = "0123456789ABCDEF"; /*!< Table of ASCII hexadecimal digits */ + +// static uint8_t m_IEN_status; // not referenced + +/** Console init + */ +static enum +{ + CONSOLE_UNINIT = 0, + CONSOLE_AVAILABLE +} m_console = CONSOLE_UNINIT; + +void console_init(void) +{ + hal_uart_init(UART_BAUD_19K2); + m_console = CONSOLE_AVAILABLE; +} + +bool console_available(void) +{ + if ( m_console == CONSOLE_AVAILABLE ) + { + return (true); + } + else + { + return (false); + } +} + +void console_put_string(uint8_t const * string) +{ + if ( m_console == CONSOLE_AVAILABLE ) + { + while (*string != 0) + { + hal_uart_putchar(*string++); + } + } +} + + +void console_put_line(uint8_t const * string) +{ + if ( m_console == CONSOLE_AVAILABLE ) + { + while (*string != 0) + { + hal_uart_putchar(*string++); + } + console_put_string((uint8_t *)CONSOLE_NEWLINE_OUTPUT); + } +} + + +void console_put_newline(void) +{ + if ( m_console == CONSOLE_AVAILABLE ) + { + console_put_string((uint8_t *)CONSOLE_NEWLINE_OUTPUT); + } +} + + +void console_put_chars(uint8_t const * chars, uint8_t num_chars) +{ + if ( m_console == CONSOLE_AVAILABLE ) + { + for ( ; num_chars > 0; num_chars--) + { + hal_uart_putchar(*chars++); + } + } +} + + +void console_get_string(uint8_t * string, uint8_t num_chars) +{ + if ( m_console == CONSOLE_AVAILABLE ) + { + for ( ; num_chars > 0; num_chars--) + { + *string++ = hal_uart_getchar(); + #ifdef CONSOLE_ENABLE_ECHO + hal_uart_putchar(*(string-1)); + #endif + } + *string = 0; /* Add zero terminator */ + } +} + +void console_get_line(uint8_t * string, uint8_t max_len) +{ + uint8_t c, k, m; + + if ( m_console == CONSOLE_AVAILABLE ) + { + c = '\0'; + for ( k = 0; k < max_len - 1 ; k++ ) + { + c = hal_uart_getchar(); + if (c == newline_input[0]) + { + break; + } + string[k] = c; + #ifdef CONSOLE_ENABLE_ECHO + hal_uart_putchar(c); + #endif + } + string[k] = 0; + /* Read (and discard) also rest of newline sequence if we found the start of if */ + /* This is were we may discard characters we should not, se the comments in the header file. */ + /* NOTE: We really should check what we read, and notify the caller if it is not really the newline sequence. */ + if ( c == newline_input[0] ) + { + for( m = 0; m < NEWLINE_INPUT_LEN - 1; m++) /* We have already read the first character */ + { + c = hal_uart_getchar(); + } + #ifdef CONSOLE_ENABLE_ECHO + /* We have read a newline, and since echo is enabled, we should also echo back a newline. */ + /* But this should be the output newline, which may differ from the input newline we read. */ + console_put_string((uint8_t *)CONSOLE_NEWLINE_OUTPUT + #endif + } + } +} //lint !e438 Last value assigned to 'c' not used + +bool console_chars_available(void) +{ + return(hal_uart_chars_available()); +} + +void console_get_chars(uint8_t * chars, uint8_t num_chars) +{ + if ( m_console == CONSOLE_AVAILABLE ) + { + for ( ; num_chars > 0; num_chars--) + { + *chars++ = hal_uart_getchar(); + #ifdef CONSOLE_ENABLE_ECHO + hal_uart_putchar(*(chars-1)); + #endif + } + } +} + + +void console_put_char(uint8_t ch) +{ + if ( m_console == CONSOLE_AVAILABLE ) + { + hal_uart_putchar(ch); + } +} + + +uint8_t console_get_char(void) +{ + uint8_t ch = '\0'; + + if ( m_console == CONSOLE_AVAILABLE ) + { + ch = hal_uart_getchar(); + #ifdef CONSOLE_ENABLE_ECHO + hal_uart_putchar(ch); + #endif + } + return ch; +} + +void console_put_decbyte(uint8_t b) // b is in the range [0 255] +{ + uint8_t b0; + uint8_t b1; + + if ( m_console == CONSOLE_AVAILABLE ) + { + b0 = (b % 10); // Remainder of b when divided by 10 + b /= 10; // forces w into the range [0 25] + + b1 = (b % 10); // Remainder of b when divided by 10 + b /= 10; // forces w into the range [0 2] + + if (b != 0) + { + hal_uart_putchar(b + '0'); + hal_uart_putchar(b1 + '0'); + hal_uart_putchar(b0 + '0'); + } + else if (b1 != 0) + { + hal_uart_putchar(b1 + '0'); + hal_uart_putchar(b0 + '0'); + } + else + { + hal_uart_putchar(b0 + '0'); + } + } +} + +void console_put_decword(uint16_t w) // w is in the range [0 65535] +{ + uint8_t w0; + uint8_t w1; + uint8_t w2; + uint8_t w3; + + if ( m_console == CONSOLE_AVAILABLE ) + { + w0 = (w % 10); // Remainder of w when divided by 10 + w /= 10; // forces w into the range [0 6553] + + w1 = (w % 10); // Remainder of w when divided by 10 + w /= 10; // forces w into the range [0 655] + + w2 = (w % 10); // Remainder of w when divided by 10 + w /= 10; // forces w into the range [0 65] + + w3 = (w % 10); // Remainder of w when divided by 10 + w /= 10; // forces w into the range [0 6] + + if (w != 0) + { + hal_uart_putchar((uint8_t)w + '0'); /* We may safely cast w to the smaller type, as we have */ + /* made sure (above) that its value will fit. */ + hal_uart_putchar(w3 + '0'); + hal_uart_putchar(w2 + '0'); + hal_uart_putchar(w1 + '0'); + hal_uart_putchar(w0 + '0'); + } + else if (w3 != 0) + { + hal_uart_putchar(w3 + '0'); + hal_uart_putchar(w2 + '0'); + hal_uart_putchar(w1 + '0'); + hal_uart_putchar(w0 + '0'); + } + else if (w2 != 0) + { + hal_uart_putchar(w2 + '0'); + hal_uart_putchar(w1 + '0'); + hal_uart_putchar(w0 + '0'); + } + else if (w1 != 0) + { + hal_uart_putchar(w1 + '0'); + hal_uart_putchar(w0 + '0'); + } + else + { + hal_uart_putchar(w0 + '0'); + } + } +} + + +void console_put_dec32bit(uint32_t ww) // ww is in the range [0 4294967295] +{ + uint8_t ww0; + uint8_t ww1; + uint8_t ww2; + uint8_t ww3; + uint8_t ww4; + uint8_t ww5; + uint8_t ww6; + uint8_t ww7; + uint8_t ww8; + + if ( m_console == CONSOLE_AVAILABLE ) + { + ww0 = (ww % 10); // Remainder of ww when divided by 10 + ww /= 10; // forces ww into the range [0 429496729] + + ww1 = (ww % 10); // Remainder of ww when divided by 10 + ww /= 10; // forces ww into the range [0 42949672] + + ww2 = (ww % 10); // Remainder of ww when divided by 10 + ww /= 10; // forces ww into the range [0 4294967] + + ww3 = (ww % 10); // Remainder of ww when divided by 10 + ww /= 10; // forces ww into the range [0 429496] + + ww4 = (ww % 10); // Remainder of ww when divided by 10 + ww /= 10; // forces ww into the range [0 42949] + + ww5 = (ww % 10); // Remainder of ww when divided by 10 + ww /= 10; // forces ww into the range [0 4294] + + ww6 = (ww % 10); // Remainder of ww when divided by 10 + ww /= 10; // forces ww into the range [0 429] + + ww7 = (ww % 10); // Remainder of ww when divided by 10 + ww /= 10; // forces ww into the range [0 42] + + ww8 = (ww % 10); // Remainder of ww when divided by 10 + ww /= 10; // forces ww into the range [0 4] + + + if (ww != 0) + { + hal_uart_putchar((uint8_t)ww + '0'); /* We may safely cast ww to the smaller type, as we have */ + /* made sure (above) that its value will fit. */ + hal_uart_putchar(ww8 + '0'); + hal_uart_putchar(ww7 + '0'); + hal_uart_putchar(ww6 + '0'); + hal_uart_putchar(ww5 + '0'); + hal_uart_putchar(ww4 + '0'); + hal_uart_putchar(ww3 + '0'); + hal_uart_putchar(ww2 + '0'); + hal_uart_putchar(ww1 + '0'); + hal_uart_putchar(ww0 + '0'); + } + else if (ww8 != 0) + { + hal_uart_putchar(ww8 + '0'); + hal_uart_putchar(ww7 + '0'); + hal_uart_putchar(ww6 + '0'); + hal_uart_putchar(ww5 + '0'); + hal_uart_putchar(ww4 + '0'); + hal_uart_putchar(ww3 + '0'); + hal_uart_putchar(ww2 + '0'); + hal_uart_putchar(ww1 + '0'); + hal_uart_putchar(ww0 + '0'); + } + else if (ww7 != 0) + { + hal_uart_putchar(ww7 + '0'); + hal_uart_putchar(ww6 + '0'); + hal_uart_putchar(ww5 + '0'); + hal_uart_putchar(ww4 + '0'); + hal_uart_putchar(ww3 + '0'); + hal_uart_putchar(ww2 + '0'); + hal_uart_putchar(ww1 + '0'); + hal_uart_putchar(ww0 + '0'); + } + else if (ww6 != 0) + { + hal_uart_putchar(ww6 + '0'); + hal_uart_putchar(ww5 + '0'); + hal_uart_putchar(ww4 + '0'); + hal_uart_putchar(ww3 + '0'); + hal_uart_putchar(ww2 + '0'); + hal_uart_putchar(ww1 + '0'); + hal_uart_putchar(ww0 + '0'); + } + else if (ww5 != 0) + { + hal_uart_putchar(ww5 + '0'); + hal_uart_putchar(ww4 + '0'); + hal_uart_putchar(ww3 + '0'); + hal_uart_putchar(ww2 + '0'); + hal_uart_putchar(ww1 + '0'); + hal_uart_putchar(ww0 + '0'); + } + else if (ww4 != 0) + { + hal_uart_putchar(ww4 + '0'); + hal_uart_putchar(ww3 + '0'); + hal_uart_putchar(ww2 + '0'); + hal_uart_putchar(ww1 + '0'); + hal_uart_putchar(ww0 + '0'); + } + else if (ww3 != 0) + { + hal_uart_putchar(ww3 + '0'); + hal_uart_putchar(ww2 + '0'); + hal_uart_putchar(ww1 + '0'); + hal_uart_putchar(ww0 + '0'); + } + else if (ww2 != 0) + { + hal_uart_putchar(ww2 + '0'); + hal_uart_putchar(ww1 + '0'); + hal_uart_putchar(ww0 + '0'); + } + else if (ww1 != 0) + { + hal_uart_putchar(ww1 + '0'); + hal_uart_putchar(ww0 + '0'); + } + else + { + hal_uart_putchar(ww0 + '0'); + } + } +} + + +void console_put_hexnybble(uint8_t n) +{ + if ( m_console == CONSOLE_AVAILABLE ) + { + hal_uart_putchar((uint8_t)hex_tab[n & 0x0f]); + } +} + + +void console_put_hexbyte(uint8_t b) +{ + console_put_hexnybble(b >> 4); + console_put_hexnybble(b & 0x0f); +} + + +void console_put_hexword(uint16_t w) +{ + console_put_hexbyte((uint8_t)(w >> 8)); + console_put_hexbyte(w & 0xff); +} + +void console_put_hexbytearray(uint8_t * p, uint8_t n) +{ + uint8_t i; + if (n > 0) + { + console_put_hexbyte(p[0]); + } + for (i = 1; i < n; ++i) + { + console_put_string((uint8_t *)"-"); + console_put_hexbyte(p[i]); + } +} + +uint8_t console_get_hexnybble(void) +{ + uint8_t c; + if ( m_console == CONSOLE_AVAILABLE ) + { + c = hal_uart_getchar(); + #ifdef CONSOLE_ENABLE_ECHO + hal_uart_putchar(c); + #endif + + if (c >= '0' && c <= '9') + { + return c - '0'; + } + else if (c >= 'a' && c <= 'f') + { + return (c - 'a') + 10; + } + else if (c >= 'A' && c <= 'F') + { + return (c - 'A') + 10; + } + else + { + /** @note We have encountered something that is not a hexadecimal digit. + * This is an error, and it is not reported. An ASSERT(false) would be suitable here. */ + return 0; + } + + return 0; // @note This may not be the correct value, what should be returned if m_console != CONSOLE_AVAILABLE ? +} + + +uint8_t console_get_hexbyte(void) +{ + uint8_t nh = console_get_hexnybble(); + return (uint8_t)((nh << 4) | console_get_hexnybble()); +} + + +uint16_t console_get_hexword(void) +{ + uint16_t bh = console_get_hexbyte(); + return (bh << 8) | console_get_hexbyte(); +} +/* +bool console_tx_completed(void) +{ + return hal_uart_tx_buf_empty(); +} +*/ + + diff --git a/components/libraries/console/console.h b/components/libraries/console/console.h new file mode 100644 index 0000000..947ae94 --- /dev/null +++ b/components/libraries/console/console.h @@ -0,0 +1,343 @@ +/* Copyright (c) 2007 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 + * + * \section console_description Description + * + * Higher-level functions for writing to, and reading from, the UART. + * + * Lower-level functions are provided by hal_uart.h and its implementations, + * which this module uses to obtain hardware indpendency. + * + * Before the other functions of this module is used, the module must be initialized + * by calling console_init(). + * Also, the interrupt used by the UART must be enabled. + * + * Functions for writing to the UART have a "put" infix, functions for reading + * from he UART a "get" infix. + * + * The newline problem is of interest. See e.g. + * . + * The newline style used by default by this module is ASCII CR and LF (x0D x0A). + * The module may be configured to use other newline styles, including setting different + * newline styles for input and output, see the section on configuration further below. + * + * To print a newline only, call console_put_newline(), or console_put_line() with a + * properly casted empty string as argument: + * - console_put_newline() + * - console_put_line((uint8_t *)"") + * + * The newline solution is not completely general, see the comments to console_get_line(). + * + * End-of-file and end-of-file representation may also be of concern. This has not been + * dealt with in any way in this module. + * + * This module provides optional echo of input to output. This may e.g. be used to enable + * the other part to see what is sent from that side (if other part does not have local echo) + * or to ensure that the UART communication is working. See the configuration section for + * info on how to turn on this feature. + * + * A note on input-to-output echo and newline: If echo is enabled and an input newline is read, + * an output newline, which may be different (dependent upon module configuration), is echoed + * back. + * + * A note on terminology: In this file, what is meant by a "string" is a zero-terminated + * sequence (an array) of characters (or octets). This as opposed to a sequence of characters + * without such termination. + * + * String constants (like "this one") are (per the C standard) of type "array of character". + * Therefore, Lint may complain if string constants are used as arguments to the functions + * in this module. To avoid this, cast the string to uint8_t like this: + * console_put_string((uint8_t *)"this one"). + * + * \section console_configuration Configuration + * + * The module may be configured by the use of suitable defines. To change the newline style + * used, define CONSOLE_NEWLINE_INPUT and CONSOLE_NEWLINE_OUTPUT to suitable values. (See + * this file (console.h) for possible values.) To enable echoing of input to output, define + * CONSOLE_ENABLE_ECHO. + * + * \section console_note Note + * + * The console functions that access the UART driver will enable the rewired + * interrupts for the driver. This ensures that the driver will not stall and + * lock the program. The interrupts will be restored to their former value + * before returning to the caller in each instance that this is used. + * + */ + +#ifndef CONSOLE_H__ +#define CONSOLE_H__ + +#include +#include + +/* Newline character sequences */ +#define CONSOLE_NEWLINE_CRLF "\r\n" //!< CRLF newline +#define CONSOLE_NEWLINE_CR "\r" //!< CR newline +#define CONSOLE_NEWLINE_LF "\n" //!< LF newline +#define CONSOLE_NEWLINE_CRLF_NUMERIC "\x0D\x0A" //!< Hardcoded ASCII values for CRLF +#define CONSOLE_NEWLINE_CR_NUMERIC "\x0D" //!< It is possible, though unlikely, that +#define CONSOLE_NEWLINE_LF_NUMERIC "\x0A" //!< CR and LF do not equal these values. + +#define CONSOLE_NEWLINE_DEFAULT CONSOLE_NEWLINE_CRLF_NUMERIC /*!< Default newline style */ + +/* Newline style for input */ +#ifndef CONSOLE_NEWLINE_INPUT + /* CONSOLE_NEWLINE_INPUT was not defined in console_config.h */ + #define CONSOLE_NEWLINE_INPUT CONSOLE_NEWLINE_DEFAULT //!< Newline style for input +#endif + +/* Newline style for output */ +#ifndef CONSOLE_NEWLINE_OUTPUT + /* CONSOLE_NEWLINE_OUTPUT was not defined in console_config.h */ + #define CONSOLE_NEWLINE_OUTPUT CONSOLE_NEWLINE_DEFAULT //!< Newline style for output +#endif + +/** + * @brief Function for initializing the console. + * Init must be called prior to any other console functions. + * The success of init() can be tested using the console_available() function. + * console_init() is idempotent (can be called multiple times) + * \post Interrupts required for the console I/O device (UART) are enabled. +*/ +void console_init(void); + +/** \brief Function for testing if the console is available. + * + * \return true if console is initialised and I/O peripheral is initialised + * \return false if console is not initialised or I/O peripheral init failed. +*/ +bool console_available(void); + + +/** \brief Function for printing a string. + * + * Print a zero-terminated string of characters (octets). + * + * \param[in] string Pointer to the string. + * \pre only works if init() previously called + */ +void console_put_string(uint8_t const * string); + + +/** \brief Function for printing a string and newline. + * + * Print a zero-terminated string of characters (octets) + * and thereafter the output newline sequence. + * + * \param[in] string Pointer to the string. + * \pre only works if init() previously called + */ +void console_put_line(uint8_t const * string); + + +/** \brief Function for printing a newline (the newline output sequence). + * \pre only works if init() previously called + */ +void console_put_newline(void); + + +/** \brief Function for printing a number of characters (octets). + * + * \param[in] chars Pointer to the characters + * \param[in] num_chars Number of characters to print + * \pre only works if init() previously called + */ +void console_put_chars(uint8_t const * chars, uint8_t num_chars); + + +/** \brief Function for reading a number of characters (octets) and append zero-termination. + * + * \param[out] string Pointer to characters + * \param[in] num_chars Number of characters to read. + * \warning: Note that due to the appended zero termination, there must + * be room for num_chars + 1 octets in the space pointed to by argument chars. + * \pre only works if init() previously called + */ +void console_get_string(uint8_t * string, uint8_t num_chars); + +/** \brief Function for reading a line. + * + * Read characters until end of line or until a maximum number + * of characters have been read, whatever comes first. + * The characters read are returned as a zero-terminated string + * (withouth the newline). + * + * \warning The function has a limitation in that it assumes that if the + * start of a newline sequence is found, the rest of the newline sequence must + * follow. The consequence of this is that if a leading part of the newline + * sequence (the "leading part") is found in the input, followed by something + * that is not the rest of the newline sequence, both the leading part and + * the first part of what follows will be silently discarded. + * (The practical reason for this behaviour is the limitation on string length + * given by the max_len parameter combined with the fact that hal_uart does not + * provide a means of "putting back" already read characters. It is + * possible to implement the function is such a way that this limitation would + * apply only when the string is too full to fit a number of characters equal to + * the number of characters in a newline sequence. Letting it apply all the time + * seems more consistent, though.) + * + * \param[out] string Pointer to the string + * \param[in] max_len Maximum length of string, including zero terminator. + * Note that max_len must be at least two (max_len >= 2). + * \pre only works if init() previously called + */ +void console_get_line(uint8_t * string, uint8_t max_len); + +/** \brief Function for getting number of characters sent to console. + * + * + * \return Number of characters (0..255) +*/ +bool console_chars_available(void); + +/** \brief Function for reading a number of characters (octets). + * + * \param[out] chars Pointer to characters + * \param[in] num_chars Number of characters to read + * \pre only works if init() previously called + */ +void console_get_chars(uint8_t * chars, uint8_t num_chars); + + +/** \brief Function for writing a single character (octet). + * + * This function is nothing but a direct wrapper for hal_uart_putchar(). + * It is provided here for completeness only. You may consider to use + * hal_uart_putchar() directly instead. + * \param ch Character to write + * \pre only works if init() previously called + */ +void console_put_char(uint8_t ch); + + +/** \brief Function for reading a single character (octet). + * + * This function is a wrapper for hal_uart_getchar(), with the additional opption + * of echo of input to output (if the console module is so configured, see the + * module documentation). + * \pre only works if init() previously called + * \return Read character + */ +uint8_t console_get_char(void); + + +/** \brief Function for printing the decimal ASCII representation of an 8-bit number. + * + * \warning: This function is larger and more complex than the corresponding + * functions to write hexadecimal representations. + * + * \param b Number in the range [0 255] + * \pre only works if init() previously called + */ +void console_put_decbyte(uint8_t b); + + +/** \brief Function for printing the decimal ASCII representation of a 16-bit number. + * + * \warning: This function is larger and more complex than the corresponding + * functions to write hexadecimal representations. + * + * \param w Number in the range [0 65535] + * \pre only works if init() previously called + */ +void console_put_decword(uint16_t w); + + +/** \brief Function for printing the decimal ASCII representation of a 32-bit number. + * + * \warning: This function is larger and more complex than the corresponding + * functions to write hexadecimal representations. + * + * \param ww Number in the range [0 4294967295] + * \pre only works if init() previously called + */ +void console_put_dec32bit(uint32_t ww); + + +/** \brief Function for printing the hexadecimal ASCII representation of a nibble (half an octet, four bits). + * + * Four bits (a nibble) equals one hexadecimal digit. + * + * \param n A number from zero to 15, both inclusive + * \pre only works if init() previously called + */ +void console_put_hexnybble(uint8_t n); + + +/** \brief Function for printing the hexadecimal ASCII representation of a byte (an octet). + * + * \param b A byte (an octet) + */ +void console_put_hexbyte(uint8_t b); + + +/** \brief Function for printing the hexadecimal ASCII representation of a word (two octets). + * + * \param w A word (sixten-bits, two octets) + */ +void console_put_hexword(uint16_t w); + +/** \brief Function for printing a string of hexbytes. + * + * \param p a pointer to the first element + * \param n the length of the array + */ +void console_put_hexbytearray(uint8_t* p, uint8_t n); + +/** \brief Function for reading one hexadecimal digit. + * + * Read the hexadecimal ASCII representation of a nibble (half an octet, four bits) + * + * \warning: The function returns zero on invalid input (i.e. input that is not an + * hexadecimal digit). + * + * \return A number from zero to 15, both inclusive + * \pre only works if init() previously called + */ +uint8_t console_get_hexnybble(void); + + +/** \brief Function for reading two hexadecimal digits. + * + * Read the hexadecimal ASCII representation of a byte (an octet) + * + * \warning: Invalid input: Input characters that are not hexadecimal digits + * are treated as the hexadecimal digit zero. + * + * \return A number from zero to 255, both inclusive + */ +uint8_t console_get_hexbyte(void); + + +/** \brief Function for reading four hexadecimal digits. + * + * Read the hexadecimal ASCII representation of a word (16 bits) + * + * \warning: Invalid input: Input characters that are not hexadecimal digits + * are treated as the hexadecimal digit zero. + * + * \return A number from zero to 65535, both inclusive + */ +uint16_t console_get_hexword(void); + +/** \brief Function for checking if the last tx is completed. + * + * \return TRUE, if the tx is completed, FALSE, is the Tx is in progress + */ +bool console_tx_completed(void); + +#endif + diff --git a/components/libraries/crc16/crc16.c b/components/libraries/crc16/crc16.c new file mode 100644 index 0000000..24669b1 --- /dev/null +++ b/components/libraries/crc16/crc16.c @@ -0,0 +1,31 @@ +/* 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 "crc16.h" +#include + +uint16_t crc16_compute(const uint8_t * p_data, uint32_t size, const uint16_t * p_crc) +{ + uint32_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; +} diff --git a/components/libraries/crc16/crc16.h b/components/libraries/crc16/crc16.h new file mode 100644 index 0000000..1ecd012 --- /dev/null +++ b/components/libraries/crc16/crc16.h @@ -0,0 +1,43 @@ +/* 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. + * + */ + +/** @file + * + * @defgroup crc_compute CRC compute + * @{ + * @ingroup hci_transport + * + * @brief This module implements the CRC-16 calculation in the 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(const uint8_t * p_data, uint32_t size, const uint16_t * p_crc); + +#endif // CRC16_H__ + +/** @} */ diff --git a/components/libraries/experimental_section_vars/section_vars.h b/components/libraries/experimental_section_vars/section_vars.h new file mode 100644 index 0000000..4d7f0e2 --- /dev/null +++ b/components/libraries/experimental_section_vars/section_vars.h @@ -0,0 +1,291 @@ +#ifndef SECTION_VARS_H__ +#define SECTION_VARS_H__ + +#include "app_util.h" + +#if defined __ICC_ARM__ + +// turn on language extensions for iar +#pragma language=extended + +#endif + +/** + * @defgroup section_vars Section variables + * @ingroup app_common + * @{ + * @brief Section variables. + */ + +/**@brief Macro to delay macro expression of pragma + * + */ +#define NRF_PRAGMA(x) _Pragma(#x) + + +/**@brief Macro to register section by name in code + * + * @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 ) + +#else + +#error TODO + +#endif + +/*lint -save -e27 */ + +/**@brief Macro for accessing start of a named data section by symbol + * + * @details The symbol that this macro resolves to is used to access the section + * by 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) + +#else + +#error TODO + +#endif + + +/**@brief Macro for accessing end of a named data section by symbol + * + * @details The symbol that this macro resolves to is used to access the section + * by 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 accessing Length of a named section + * + * @details This macro is used to get the size of a named section. + * + * @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)) + +#else + +#error TODO + +#endif + + +/**@brief Macro for accessing the start address of a named section + * + * param[in] section_name Name of the section to get the start address from + */ +#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 + +#else + +#error TODO + +#endif + + +/*@brief Macro for accessing the end address of a named section + * + * @param[in] section_name Name of the section to get end address from + */ +#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 + +#else + +#error TODO + +#endif + + +/**@brief Macro for declaring symbols for named sections + * + * @note These external declarations of section specific symbols are required for the linker in GCC and Keil (not IAR) + * + * @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) + +#else + +#error TODO + +#endif + + +/**@brief Macro to add symbols to a named section + * + * @details The symbols are placed in a named section. All calls to this macro + * will result in symbols being placed in a contiguous manner in the named section. + * This macro ensures that the symbol is not removed because of optimization level. + * + * @warning There is no guarantee for ordering of placement. If ordering is required + * + * @warning The symbols added in the named section must be word aligned to + * ensure that compilers do not pad the section during symbol placement. + * + * @param[in] section_name Name of the section + * @param[in] type_def Datatype of the symbol 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 + +#else + +#error TODO + +#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*)iar_ ## section_name ## _start + (i * sizeof(type_name)) + +#else + +#error TODO + +#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/components/libraries/fds/fds.c b/components/libraries/fds/fds.c new file mode 100644 index 0000000..0a019b2 --- /dev/null +++ b/components/libraries/fds/fds.c @@ -0,0 +1,2070 @@ +/* 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 "fds.h" +#include +#include +#include +#include "fds_config.h" +#include "fds_types_internal.h" +#include "fstorage.h" +#include "nrf_error.h" +#include "app_util.h" + + +/** Our fstorage configuration. + * The other fields will be assigned automatically during compilation. */ +FS_SECTION_VARS_ADD(fs_config_t fs_config) = { .cb = fs_callback, .num_pages = FDS_MAX_PAGES }; + +static uint32_t const fds_page_tag_swap[] = {FDS_PAGE_TAG_WORD_0_SWAP, FDS_PAGE_TAG_WORD_1, + FDS_PAGE_TAG_WORD_2, FDS_PAGE_TAG_WORD_3}; + +static uint32_t const fds_page_tag_valid[] = {FDS_PAGE_TAG_WORD_0_VALID, FDS_PAGE_TAG_WORD_1, + FDS_PAGE_TAG_WORD_2, FDS_PAGE_TAG_WORD_3}; + +static uint32_t const fds_page_tag_gc = FDS_PAGE_TAG_WORD_3_GC; + +static fds_tl_t const m_fds_tl_invalid = { .type = FDS_TYPE_ID_INVALID, + .length_words = 0xFFFF }; + +/**@brief Internal status flags. */ +static uint8_t volatile m_flags; + +static uint8_t m_users; +static fds_cb_t m_cb_table[FDS_MAX_USERS]; + +/**@brief The last record ID. Setup page by page_scan() during pages_init(). */ +static fds_record_id_t m_last_rec_id; + +/**@brief The internal queues. */ +static fds_cmd_queue_t m_cmd_queue; +static fds_chunk_queue_t m_chunk_queue; + +/**@brief Holds the state of pages. Setup by fds_init(). */ +static fds_page_t m_pages[FDS_MAX_PAGES]; +static bool m_swap_page_avail = false; + +static fds_gc_data_t m_gc; +static uint16_t m_gc_runs; + +static uint8_t volatile m_counter; + + +static void app_notify(ret_code_t result, + fds_cmd_id_t cmd, + fds_record_id_t record_id, + fds_record_key_t record_key) +{ + for (uint8_t user = 0; user < FDS_MAX_USERS; user++) + { + if (m_cb_table[user] != NULL) + { + m_cb_table[user](result, cmd, record_id, record_key); + } + } +} + + +static void atomic_counter_inc() +{ + CRITICAL_SECTION_ENTER(); + m_counter++; + CRITICAL_SECTION_EXIT(); +} + + +static void atomic_counter_dec() +{ + CRITICAL_SECTION_ENTER(); + m_counter--; + CRITICAL_SECTION_EXIT(); +} + + +static bool atomic_counter_is_zero() +{ + bool ret; + CRITICAL_SECTION_ENTER(); + ret = (m_counter == 0); + CRITICAL_SECTION_EXIT(); + return ret; +} + + +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) +{ + bool ret; + CRITICAL_SECTION_ENTER(); + ret = (m_flags & flag); + CRITICAL_SECTION_EXIT(); + return ret; +} + + +/**@brief Function to check if a header has valid information. */ +static __INLINE bool header_is_valid(fds_header_t const * const p_header) +{ + return ((p_header->tl.type != FDS_TYPE_ID_INVALID) && + (p_header->ic.instance != FDS_INSTANCE_ID_INVALID)); +} + + +static bool address_within_page_bounds(uint32_t const * const p_addr) +{ + return (p_addr >= fs_config.p_start_addr) && + (p_addr <= fs_config.p_end_addr) && + (is_word_aligned(p_addr)); +} + + +/**@brief Internal function to identify the page type. */ +static fds_page_type_t page_identify(uint16_t page_number) +{ + uint32_t const * const p_page_addr = m_pages[page_number].start_addr; + + uint32_t const word0 = *(p_page_addr); + uint32_t const word1 = *(p_page_addr + 1); + uint32_t const word2 = *(p_page_addr + 2); + uint32_t const word3 = *(p_page_addr + 3); + + if (word1 != FDS_PAGE_TAG_WORD_1) + { + return FDS_PAGE_UNDEFINED; + } + + if (word2 != FDS_PAGE_TAG_WORD_2) + { + return FDS_PAGE_UNDEFINED; + } + + if (word3 == FDS_PAGE_TAG_WORD_3) + { + if (word0 == FDS_PAGE_TAG_WORD_0_SWAP) + { + return FDS_PAGE_SWAP; + } + + if (word0 == FDS_PAGE_TAG_WORD_0_VALID) + { + return FDS_PAGE_VALID; + } + } + else if (word3 == FDS_PAGE_TAG_WORD_3_GC) + { + if (word0 == FDS_PAGE_TAG_WORD_0_SWAP || word0 == FDS_PAGE_TAG_WORD_0_VALID) + { + return FDS_PAGE_GC; + } + } + + return FDS_PAGE_UNDEFINED; +} + + +static uint16_t page_by_addr(uint32_t const * const p_addr) +{ + if (p_addr == NULL) + { + return 0; + } + + // Compute the BYTES offset from the beginning of the first page. + uint32_t const byte_offset = (uint32_t)p_addr - (uint32_t)m_pages[0].start_addr; + +// See nrf.h. +#if defined (NRF51) + return byte_offset >> 10; // Divide by page size (1024). +#elif defined (NRF52) + return byte_offset >> 12; // Divide by page size (4096). +#else + #error "Device family must be defined. See nrf.h." +#endif +} + + +// NOTE: depends on m_pages.write_offset to function. +static bool page_has_space(uint16_t page, fds_length_t length_words) +{ + if (page >= FDS_MAX_PAGES) + { + return false; + } + + CRITICAL_SECTION_ENTER(); + length_words += m_pages[page].write_offset; + length_words += m_pages[page].words_reserved; + CRITICAL_SECTION_EXIT(); + + return (length_words < FS_PAGE_SIZE_WORDS); +} + + +/**@brief This function scans a page to determine how many words have + * been written to it. This information is used to set the page + * write offset during initialization (mount). Additionally, this + * function will update the last known record ID as it proceeds. + */ +static void page_scan(uint16_t page, uint16_t volatile * words_written) +{ + uint32_t const * p_addr = (m_pages[page].start_addr + FDS_PAGE_TAG_SIZE); + + *words_written = FDS_PAGE_TAG_SIZE; + + // A corrupt TL might cause problems. + while ((p_addr < m_pages[page].start_addr + FS_PAGE_SIZE_WORDS) && + (*p_addr != FDS_ERASED_WORD)) + { + fds_header_t const * const p_header = (fds_header_t*)p_addr; + + /** Note: DO NOT check for the validity of the header using + * header_is_valid() here. If an header has an invalid type (0x0000) + * or a missing instance (0xFFFF) then we WANT to skip it. + */ + + // Update the last known record id. + if (p_header->id > m_last_rec_id) + { + m_last_rec_id = p_header->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); + } +} + + +static bool page_is_empty(uint16_t page) +{ + uint32_t const * const p_addr = m_pages[page].start_addr; + + for (uint16_t i = 0; i < FS_PAGE_SIZE_WORDS; i++) + { + if (*(p_addr + i) != FDS_ERASED_WORD) + { + return false; + } + } + + return true; +} + + +static ret_code_t page_id_from_virtual_id(uint16_t vpage_id, uint16_t * p_page_id) +{ + for (uint16_t i = 0; i < FDS_MAX_PAGES; i++) + { + if (m_pages[i].vpage_id == vpage_id) + { + *p_page_id = i; + return NRF_SUCCESS; + } + } + + return NRF_ERROR_NOT_FOUND; +} + + +static ret_code_t page_from_virtual_id(uint16_t vpage_id, fds_page_t ** p_page) +{ + for (uint16_t i = 0; i < FDS_MAX_PAGES; i++) + { + if (m_pages[i].vpage_id == vpage_id) + { + *p_page = &m_pages[i]; + return NRF_SUCCESS; + } + } + + return NRF_ERROR_NOT_FOUND; +} + + +static uint32_t record_id_new() +{ + return ++m_last_rec_id; +} + + +/**@brief Tags a page as swap, i.e., reserved for GC. */ +static ret_code_t page_tag_write_swap(uint16_t page) +{ + return fs_store(&fs_config, + m_pages[page].start_addr, + (uint32_t const *)&fds_page_tag_swap, + FDS_PAGE_TAG_SIZE); +} + + +/**@brief Tags a page as valid, i.e, ready for storage. */ +static ret_code_t page_tag_write_valid(uint16_t page) +{ + return fs_store(&fs_config, + m_pages[page].start_addr, + (uint32_t const *)&fds_page_tag_valid, + FDS_PAGE_TAG_SIZE); +} + + +/**@brief Tags a valid page as being garbage collected. */ +static ret_code_t page_tag_write_gc(uint16_t page) +{ + return fs_store(&fs_config, + m_pages[page].start_addr + 3, + (uint32_t const *)&fds_page_tag_gc, + 1 /*Words*/); +} + + +/**@brief Given a page and a record, finds the next valid record. */ +static ret_code_t scan_next_valid(uint16_t page, uint32_t const ** p_record) +{ + uint32_t const * p_next_rec = (*p_record); + + if (p_next_rec == NULL) + { + // This if the first invocation on this page, start from the beginning. + p_next_rec = m_pages[page].start_addr + FDS_PAGE_TAG_SIZE; + } + else + { + // Jump to the next record. + p_next_rec += (FDS_HEADER_SIZE + ((fds_header_t*)(*p_record))->tl.length_words); + } + + // Scan until we find a valid record or until the end of the page. + + /** README: We might seek until the write_offset is reached, but it might not + * known at this point. */ + while ((p_next_rec < (m_pages[page].start_addr + FS_PAGE_SIZE_WORDS)) && + (*p_next_rec != FDS_ERASED_WORD)) // Did we jump to an erased word? + { + fds_header_t const * const p_header = (fds_header_t*)p_next_rec; + + if (header_is_valid(p_header)) + { + // Bingo! + *p_record = p_next_rec; + return NRF_SUCCESS; + } + else + { + // The item is not valid, jump to the next. + p_next_rec += (FDS_HEADER_SIZE + (p_header->tl.length_words)); + } + } + + return NRF_ERROR_NOT_FOUND; +} + + +static ret_code_t seek_record(fds_record_desc_t * const p_desc) +{ + uint32_t const * p_record; + uint16_t page; + bool seek_all_pages = false; + + if ((p_desc->ptr_magic == FDS_MAGIC_HWORD) && + (p_desc->gc_magic == m_gc_runs)) + { + // No need to seek the file. + return NRF_SUCCESS; + } + + /** The pointer in the descriptor is not initialized, or GC + * has been run since the last time it was retrieved. + * We must seek the record again. */ + + // Obtain the physical page ID. + if (page_id_from_virtual_id(p_desc->vpage_id, &page) != NRF_SUCCESS) + { + page = 0; + seek_all_pages = true; + } + + do { + // Let's find the address from where we should start seeking the record. + p_record = m_pages[page].start_addr + FDS_PAGE_TAG_SIZE; + + /** Seek for a record with matching ID. + * We might get away with seeking to the page write offset, if it is known. */ + + while ((p_record < (m_pages[page].start_addr + FS_PAGE_SIZE_WORDS)) && + (*p_record != FDS_ERASED_WORD)) + { + fds_header_t const * const p_header = (fds_header_t*)p_record; + + if ((p_header->id != p_desc->record_id) || + (!header_is_valid(p_header))) + { + // ID doesnt't match or the record has been cleared. Jump to the next record. + p_record += FDS_HEADER_SIZE + p_header->tl.length_words; + } + else + { + // Update the pointer in the descriptor. + p_desc->p_rec = p_record; + p_desc->ptr_magic = FDS_MAGIC_HWORD; + p_desc->gc_magic = m_gc_runs; + + return NRF_SUCCESS; + } + } + } while (seek_all_pages ? page++ < FDS_MAX_PAGES : 0); + + return NRF_ERROR_NOT_FOUND; +} + + +static ret_code_t find_record(fds_type_id_t const * const p_type, + fds_instance_id_t const * const p_inst, + fds_record_desc_t * const p_desc, + fds_find_token_t * const p_token) +{ + if (!flag_is_set(FDS_FLAG_INITIALIZED)) + { + return NRF_ERROR_INVALID_STATE; + } + + // Here we distinguish between the first invocation and the and the others. + if ((p_token->magic != FDS_MAGIC_WORD) || + !address_within_page_bounds(p_token->p_addr)) // Is the address is really okay? + { + // Initialize the token. + p_token->magic = FDS_MAGIC_WORD; + p_token->vpage_id = 0; + p_token->p_addr = NULL; + } + else + { + // Look past the last record address. + p_token->p_addr += (FDS_HEADER_SIZE + ((fds_header_t*)p_token->p_addr)->tl.length_words); + } + + // Begin (or resume) searching for a record. + for (; p_token->vpage_id < FDS_MAX_PAGES; p_token->vpage_id++) + { + uint16_t page = 0; + + // Obtain the physical page ID. + page_id_from_virtual_id(p_token->vpage_id, &page); + + if (m_pages[page].page_type != FDS_PAGE_VALID) + { + // Skip this page. + continue; + } + + if (p_token->p_addr == NULL) + { + // If it's the first time the function is run, initialize the pointer. + p_token->p_addr = m_pages[page].start_addr + FDS_PAGE_TAG_SIZE; + } + + // Seek a valid record on this page, starting from the address stored in the token. + while ((p_token->p_addr < (m_pages[page].start_addr + FS_PAGE_SIZE_WORDS)) && + (*p_token->p_addr != FDS_ERASED_WORD)) // Did we jump to an erased word? + { + fds_header_t const * const p_header = (fds_header_t*)p_token->p_addr; + + if (header_is_valid(p_header)) + { + // A valid record was found, check its header for a match. + bool item_match = false; + + if (p_type != NULL) + { + if (p_header->tl.type == *p_type) + { + item_match = true; + } + } + + if (p_inst != NULL) + { + if (p_header->ic.instance == *p_inst) + { + item_match = (p_type == NULL) ? true : item_match && true; + } + else + { + item_match = false; + } + } + + if (item_match) + { + // We found the record! Update the descriptor. + p_desc->vpage_id = m_pages[page].vpage_id; + p_desc->record_id = p_header->id; + + p_desc->p_rec = p_token->p_addr; + p_desc->ptr_magic = FDS_MAGIC_HWORD; + p_desc->gc_magic = m_gc_runs; + + return NRF_SUCCESS; + } + } + // Jump to the next record. + p_token->p_addr += (FDS_HEADER_SIZE + (p_header->tl.length_words)); + } + + /** We have seeked an entire page. Set the address in the token to NULL + * so that it will be set again on the next iteration. */ + p_token->p_addr = NULL; + } + + /** If we couldn't find the record, zero the token structure + * so that it can be reused. */ + p_token->magic = 0x00; + + return NRF_ERROR_NOT_FOUND; +} + + +static void gc_init() +{ + // Set which pages to GC. + for (uint16_t i = 0; i < FDS_MAX_PAGES; i++) + { + m_gc.do_gc_page[i] = (m_pages[i].page_type == FDS_PAGE_VALID); + } +} + + +static void gc_reset() +{ + m_gc.state = BEGIN; + m_gc.cur_page = 0; + m_gc.p_scan_addr = NULL; +} + + +static void gc_set_state(fds_gc_state_t new_state) +{ + m_gc.state = new_state; +} + + +static ret_code_t gc_get_next_page(uint16_t * const next_page) +{ + for (uint16_t i = 0; i < FDS_MAX_PAGES; i++) + { + if (m_gc.do_gc_page[i]) + { + uint16_t records_open; + + CRITICAL_SECTION_ENTER(); + records_open = m_pages[i].records_open; + CRITICAL_SECTION_EXIT(); + + // Do not attempt to GC this page anymore. + m_gc.do_gc_page[i] = false; + + // Only GC pages with no open records. + if (records_open == 0) + { + *next_page = i; + return NRF_SUCCESS; + } + } + } + + return NRF_ERROR_NOT_FOUND; +} + + +static ret_code_t gc_page() +{ + ret_code_t ret; + + ret = gc_get_next_page(&m_gc.cur_page); + + // No pages left to GC. GC has terminated. Reset GC data. + if (ret != NRF_SUCCESS) + { + gc_reset(); + + return COMMAND_COMPLETED; + } + + // Prepare to GC the page. + gc_set_state(GC_PAGE); + + // Flag the page as being garbage collected. + ret = page_tag_write_gc(m_gc.cur_page); + + if (ret != NRF_SUCCESS) + { + return ret; + } + + return COMMAND_EXECUTING; +} + + +static ret_code_t gc_copy_record() +{ + ret_code_t fs_ret; + + // We have found a record to copy. + fds_record_t const * const p_record = (fds_record_t*)m_gc.p_scan_addr; + + gc_set_state(COPY_RECORD); + + // Copy the item to swap. + fs_ret = fs_store(&fs_config, + m_pages[m_gc.swap_page].start_addr + m_pages[m_gc.swap_page].write_offset, + (uint32_t*)p_record, + FDS_HEADER_SIZE + p_record->header.tl.length_words); + + if (fs_ret != NRF_SUCCESS) + { + // Oops :( + // This is an error. Can we recover? + } + + // Remember to update the swap page write offset. + m_pages[m_gc.swap_page].write_offset += (FDS_HEADER_SIZE + p_record->header.tl.length_words); + + return COMMAND_EXECUTING; +} + + +static ret_code_t gc_ready_swap_page() +{ + ret_code_t fs_ret; + + /** A page has been scanned through. All valid records found were copied to swap. + * The swap page can now be flagged as a valid page. */ + gc_set_state(READY_SWAP); + + fs_ret = page_tag_write_valid(m_gc.swap_page); + if (fs_ret != NRF_SUCCESS) + { + return fs_ret; + } + + /** Do not update the page type in the internal page structure (m_pages) + * right away. (why?) */ + return COMMAND_EXECUTING; +} + + +static ret_code_t gc_seek_record() +{ + // Let's find a valid record which has not been copied yet. + if (scan_next_valid(m_gc.cur_page, &m_gc.p_scan_addr) == NRF_SUCCESS) + { + /** The record is guaranteed to fit in the destination page, + * so we don't need to check its size. */ + return gc_copy_record(); + } + else + { + /** No more (uncopied) records left on this page. + * The swap page can now be marked as a valid page. */ + return gc_ready_swap_page(); + } +} + + +static ret_code_t gc_new_swap_page() +{ + ret_code_t fs_ret; + uint16_t vpage_id; + + gc_set_state(NEW_SWAP); + + // Save the swap page virtual page ID. + vpage_id = m_pages[m_gc.swap_page].vpage_id; + + /** The swap page has been marked as valid in Flash. We copy the GC'ed page + * write_offset and virtual page ID. */ + m_pages[m_gc.swap_page].page_type = FDS_PAGE_VALID; + m_pages[m_gc.swap_page].vpage_id = m_pages[m_gc.cur_page].vpage_id; + m_pages[m_gc.swap_page].words_reserved = m_pages[m_gc.cur_page].words_reserved; + + // The new swap page is now the page we just GC. + m_gc.swap_page = m_gc.cur_page; + + // Update the write_offset, words_reserved and vpage_id fields for the new swap page. + m_pages[m_gc.swap_page].page_type = FDS_PAGE_SWAP; + m_pages[m_gc.swap_page].vpage_id = vpage_id; + m_pages[m_gc.swap_page].write_offset = FDS_PAGE_TAG_SIZE; + m_pages[m_gc.swap_page].words_reserved = 0; + + /** Finally, erase the new swap page. Remember we still have to flag this + * new page as swap, but we'll wait the callback for this operation to do so. */ + fs_ret = fs_erase(&fs_config, + (uint32_t*)m_pages[m_gc.swap_page].start_addr, + FS_PAGE_SIZE_WORDS); + + if (fs_ret != NRF_SUCCESS) + { + return fs_ret; + } + + return COMMAND_EXECUTING; +} + + +static ret_code_t gc_new_swap_page_init() +{ + ret_code_t fs_ret; + + gc_set_state(INIT_SWAP); + + fs_ret = page_tag_write_swap(m_gc.swap_page); + if (fs_ret != NRF_SUCCESS) + { + return fs_ret; + } + + return COMMAND_EXECUTING; +} + + +static ret_code_t gc_execute(uint32_t result) +{ + // TODO: Handle resuming GC. + + ret_code_t ret; + + if (result != NRF_SUCCESS) + { + // An operation failed. Report to the application. + return result; + } + + switch (m_gc.state) + { + case BEGIN: + { + // Increment the number of times the GC has been run. + m_gc_runs++; + // Sets up a list of pages to GC. + gc_init(); + // Go ! + ret = gc_page(); + } break; + + case GC_PAGE: + /** A page has been successfully flagged as being GC. + * Look for valid records to copy. */ + ret = gc_seek_record(); + break; + + case COPY_RECORD: + /** A record has been copied to swap. + * Look for more records to copy. */ + ret = gc_seek_record(); + break; + + case READY_SWAP: + /** The swap page has been flagged as 'valid' (ready). + * Let's prepare a new swap page. */ + ret = gc_new_swap_page(); + break; + + case NEW_SWAP: + // A new swap page has been prepared. Let's flag it as swap. + ret = gc_new_swap_page_init(); + break; + + case INIT_SWAP: + /** The swap was flagged as swap in flash. Let's compress another page. + * Be sure to update the address where to scan from. */ + m_gc.p_scan_addr = NULL; + ret = gc_page(); + break; + + default: + // Should really not happen. + ret = NRF_ERROR_INTERNAL; + break; + } + + return ret; +} + + +/**@brief Function for initializing the command queue. */ +static void queues_init(void) +{ + memset(&m_cmd_queue, 0, sizeof(fds_cmd_queue_t)); + memset(&m_chunk_queue, 0, sizeof(fds_chunk_queue_t)); +} + + +void cmd_queue_next(fds_cmd_t ** pp_cmd) +{ + if (*pp_cmd != &m_cmd_queue.cmd[FDS_CMD_QUEUE_SIZE - 1]) + { + (*pp_cmd)++; + return; + } + + *pp_cmd = &m_cmd_queue.cmd[0]; +} + + +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]; +} + + +/**@brief Advances one position in the command queue. Returns true if the queue is not empty. */ +static bool cmd_queue_advance(void) +{ + // Reset the current element. + memset(&m_cmd_queue.cmd[m_cmd_queue.rp], 0, sizeof(fds_cmd_t)); + + CRITICAL_SECTION_ENTER(); + if (m_cmd_queue.count != 0) + { + // Advance in the queue, wrapping around if necessary. + m_cmd_queue.rp = (m_cmd_queue.rp + 1) % FDS_CMD_QUEUE_SIZE; + m_cmd_queue.count--; + } + CRITICAL_SECTION_EXIT(); + + return m_cmd_queue.count != 0; +} + + +/**@brief Returns the current chunk, and advances to the next in the queue. */ +static bool chunk_queue_get_and_advance(fds_record_chunk_t ** pp_chunk) +{ + bool chunk_popped = false; + + CRITICAL_SECTION_ENTER(); + 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--; + + chunk_popped = true; + } + CRITICAL_SECTION_EXIT(); + + return chunk_popped; +} + + +static bool chunk_queue_skip(uint8_t num_op) +{ + bool chunk_skipped = false; + + CRITICAL_SECTION_ENTER(); + if (num_op <= m_chunk_queue.count) + { + m_chunk_queue.count -= num_op; + chunk_skipped = true; + } + CRITICAL_SECTION_EXIT(); + + return chunk_skipped; +} + + +/**@brief Reserves resources on both queues. */ +static ret_code_t queue_reserve(uint8_t num_cmd, + uint8_t num_chunks, + fds_cmd_t ** pp_cmd, + fds_record_chunk_t ** pp_chunk) +{ + uint8_t cmd_index; + uint8_t chunk_index; + + // This is really just being safe. + if (pp_cmd == NULL || ((pp_chunk == NULL) && (num_chunks != 0))) + { + return NRF_ERROR_NULL; + } + + if (num_cmd == 0) + { + return NRF_ERROR_INVALID_DATA; + } + + CRITICAL_SECTION_ENTER(); + + // Ensure there is enough space in the queues. + if ((m_cmd_queue.count > FDS_CMD_QUEUE_SIZE - num_cmd) || + (m_chunk_queue.count > FDS_CHUNK_QUEUE_SIZE - num_chunks)) + { + CRITICAL_SECTION_EXIT(); + return NRF_ERROR_BUSY; + } + + // Find the write position in the commands queue. + cmd_index = m_cmd_queue.count; + cmd_index += m_cmd_queue.rp; + cmd_index = cmd_index % FDS_CMD_QUEUE_SIZE; + + *pp_cmd = &m_cmd_queue.cmd[cmd_index]; + m_cmd_queue.count += num_cmd; + + /* If no operations are associated with the command, such as is the case + * for initialization and compression, pp_chunk can be NULL. */ + if (num_chunks != 0) + { + chunk_index = m_chunk_queue.count; + chunk_index += m_chunk_queue.rp; + chunk_index = chunk_index % FDS_CHUNK_QUEUE_SIZE; + + *pp_chunk = &m_chunk_queue.chunk[chunk_index]; + m_chunk_queue.count += num_chunks; + } + + CRITICAL_SECTION_EXIT(); + + return NRF_SUCCESS; +} + + +/**@brief Cancel the reservation on resources on queues. */ +static void queue_reserve_cancel(uint8_t num_cmd, uint8_t num_chunks) +{ + CRITICAL_SECTION_ENTER(); + m_cmd_queue.count -= num_cmd; + m_chunk_queue.count -= num_chunks; + CRITICAL_SECTION_EXIT(); +} + + +static void pages_init(uint16_t * const p_pages_avail, + bool * const p_write_page_tag, + bool * const p_resume_comp) +{ + *p_pages_avail = 0; + *p_write_page_tag = false; + *p_resume_comp = false; + + /** Scan pages and setup page data. + * This function does NOT perform write operations in flash. */ + for (uint16_t i = 0; i < FDS_MAX_PAGES; i++) + { + // Initialize page data. Note that start_addr must be set BEFORE invoking page_identify(). + m_pages[i].start_addr = fs_config.p_start_addr + (i * FS_PAGE_SIZE_WORDS); + m_pages[i].write_offset = FDS_PAGE_TAG_SIZE; + m_pages[i].vpage_id = i; + m_pages[i].records_open = 0; + m_pages[i].words_reserved = 0; + + m_pages[i].page_type = page_identify(i); + + switch (m_pages[i].page_type) + { + case FDS_PAGE_UNDEFINED: + { + if (page_is_empty(i)) + { + /* We have found an erased page, which can be initialized. + * This will require a write in flash. */ + m_pages[i].page_type = FDS_PAGE_ERASED; + *p_write_page_tag = true; + } + } break; + + case FDS_PAGE_VALID: + { + /** If a page is valid, we update its write offset. + * Additionally, page_scan will update the last known record ID. */ + page_scan(i, &m_pages[i].write_offset); + (*p_pages_avail)++; + } break; + + case FDS_PAGE_SWAP: + { + m_gc.swap_page = i; + m_swap_page_avail = true; + } break; + + case FDS_PAGE_GC: + { + /** There is an ongoing garbage collection. + * We should resume the operation, which we don't yet. */ + m_gc.cur_page = i; + m_gc.state = GC_PAGE; + *p_resume_comp = true; + } break; + + default: + break; + } + } +} + + +// NOTE: Adds FDS_HEADER_SIZE automatically. +static ret_code_t write_space_reserve(uint16_t length_words, uint16_t * vpage_id) +{ + bool space_reserved = false; + uint16_t total_len_words = length_words + FDS_HEADER_SIZE; + + if (total_len_words >= FS_PAGE_SIZE_WORDS - FDS_PAGE_TAG_SIZE) + { + return NRF_ERROR_INVALID_LENGTH; + } + + for (uint16_t page = 0; page < FDS_MAX_PAGES; page++) + { + if ((m_pages[page].page_type == FDS_PAGE_VALID) && + (page_has_space(page, total_len_words))) + { + space_reserved = true; + *vpage_id = m_pages[page].vpage_id; + + CRITICAL_SECTION_ENTER(); + m_pages[page].words_reserved += total_len_words; + CRITICAL_SECTION_EXIT(); + + break; + } + } + + return space_reserved ? NRF_SUCCESS : NRF_ERROR_NO_MEM; +} + + +static bool chunk_is_aligned(fds_record_chunk_t const * const p_chunk, uint8_t num_parts) +{ + for (uint8_t i = 0; i < num_parts; i++) + { + if (!is_word_aligned(p_chunk[i].p_data)) + { + return false; + } + } + + return true; +} + + +static ret_code_t init_execute(uint32_t result, uint32_t const * p_page_addr) +{ + uint16_t cur_page; + bool page_tag_written = false; + + if (result != NRF_SUCCESS) + { + // Oops. Error. + return result; + } + + // Here we just distinguish between the first invocation and the others. + cur_page = p_page_addr == NULL ? 0 : page_by_addr(p_page_addr) + 1; + + if (cur_page == FDS_MAX_PAGES) + { + // We have finished. We'd need to set some flags. + flag_set(FDS_FLAG_INITIALIZED); + flag_clear(FDS_FLAG_INITIALIZING); + + return COMMAND_COMPLETED; + } + + while (cur_page < FDS_MAX_PAGES && !page_tag_written) + { + if (m_pages[cur_page].page_type == FDS_PAGE_ERASED) + { + page_tag_written = true; + + if (m_swap_page_avail) + { + if (page_tag_write_valid(cur_page) != NRF_SUCCESS) + { + // Oops. Error. + } + // Update the page type. + m_pages[cur_page].page_type = FDS_PAGE_VALID; + } + else + { + if (page_tag_write_swap(cur_page) != NRF_SUCCESS) + { + // Oops. Error. + } + // Update the page type. + m_pages[cur_page].page_type = FDS_PAGE_SWAP; + + /** Update compression data. We set this information in init_pages + * if it is available, otherwise, we should set it here. */ + m_swap_page_avail = true; + m_gc.swap_page = cur_page; + } + } + + cur_page++; + } + + if (!page_tag_written) + { + if (m_swap_page_avail) + { + return COMMAND_COMPLETED; + } + else + { + // There is no empty space to use as swap. + // Notify user that no compression is available? + } + } + + return COMMAND_EXECUTING; +} + + +/**@brief Function to execute write and update commands. + * + */ +static ret_code_t store_execute(uint32_t result, fds_cmd_t * const p_cmd) +{ + ret_code_t fs_ret; + fds_record_chunk_t * p_chunk = NULL; + fds_page_t * p_page = NULL; + uint32_t * p_write_addr; + + // Using virtual page IDs allows other operations to be queued even if GC has been requested. + page_from_virtual_id(p_cmd->vpage_id, &p_page); + + if (result != NRF_SUCCESS) + { + // The previous operation has failed, update the page data. + p_page->write_offset += (FDS_HEADER_SIZE + (p_cmd->chunk_offset - FDS_WRITE_OFFSET_DATA)); + p_page->words_reserved -= (FDS_HEADER_SIZE + (p_cmd->chunk_offset - FDS_WRITE_OFFSET_DATA)); + + return result; + } + + // Compute the write address (just syntatic sugar). + p_write_addr = (uint32_t*)(p_page->start_addr + p_page->write_offset); + + // Execute the operation. + switch (p_cmd->op_code) + { + case FDS_OP_WRITE_TL: + { + fs_ret = fs_store(&fs_config, + p_write_addr + FDS_WRITE_OFFSET_TL, + (uint32_t*)&p_cmd->record_header.tl, + FDS_HEADER_SIZE_TL /*Words*/); + + // Set the next operation to be executed. + p_cmd->op_code = FDS_OP_WRITE_ID; + + } break; + + case FDS_OP_WRITE_ID: + { + fs_ret = fs_store(&fs_config, + p_write_addr + FDS_WRITE_OFFSET_ID, + (uint32_t*)&p_cmd->record_header.id, + FDS_HEADER_SIZE_ID /*Words*/); + + p_cmd->op_code = FDS_OP_WRITE_CHUNK; + + } break; + + case FDS_OP_WRITE_CHUNK: + { + // Decrement the number of chunks left to write. + p_cmd->num_chunks--; + + // Retrieve the chunk to be written. + chunk_queue_get_and_advance(&p_chunk); + + fs_ret = fs_store(&fs_config, + p_write_addr + p_cmd->chunk_offset, + p_chunk->p_data, + p_chunk->length_words); + + // Accumulate the offset. + p_cmd->chunk_offset += p_chunk->length_words; + + if (p_cmd->num_chunks == 0) + { + /** We have written all the record chunks; we'll write + * IC last as a mean to 'validate' the record. */ + p_cmd->op_code = FDS_OP_WRITE_IC; + } + + } break; + + case FDS_OP_WRITE_IC: + { + fs_ret = fs_store(&fs_config, + p_write_addr + FDS_WRITE_OFFSET_IC, + (uint32_t*)&p_cmd->record_header.ic, + FDS_HEADER_SIZE_IC /*Words*/); + + // This is the final operation. + p_cmd->op_code = FDS_OP_DONE; + + } break; + + case FDS_OP_DONE: + { + // We have successfully written down the IC. The command has completed successfully. + p_page->write_offset += (FDS_HEADER_SIZE + (p_cmd->chunk_offset - FDS_WRITE_OFFSET_DATA)); + p_page->words_reserved -= (FDS_HEADER_SIZE + (p_cmd->chunk_offset - FDS_WRITE_OFFSET_DATA)); + + return COMMAND_COMPLETED; + + }; + + default: + fs_ret = NRF_ERROR_INTERNAL; + break; + } + + // If fs_store did not succeed, the command has failed. + if (fs_ret != NRF_SUCCESS) + { + /** We're not going to receive a callback from fstorage + * so we update the page data right away. */ + p_page->write_offset += (FDS_HEADER_SIZE + (p_cmd->chunk_offset - FDS_WRITE_OFFSET_DATA)); + p_page->words_reserved -= (FDS_HEADER_SIZE + (p_cmd->chunk_offset - FDS_WRITE_OFFSET_DATA)); + + // We should propagate the error from fstorage. + return fs_ret; + } + + // An operation has successfully been executed. Wait for the callback. + return COMMAND_EXECUTING; +} + + +static ret_code_t clear_execute(ret_code_t result, fds_cmd_t * const p_cmd) +{ + ret_code_t ret; + fds_record_desc_t desc; + + // This must persist across calls. + static fds_find_token_t tok; + + if (result != NRF_SUCCESS) + { + // A previous operation has failed. Propagate the error. + return result; + } + + switch (p_cmd->op_code) + { + case FDS_OP_CLEAR_TL: + { + // We were provided a descriptor for the record. + desc.vpage_id = p_cmd->vpage_id; + desc.record_id = p_cmd->record_header.id; + + /** Unfortunately, we always seek the record in this case, + * because we don't buffer an entire record descriptor in the + * fds_cmd_t structure. Keep in mind though, that we will + * seek one page at most. */ + if (seek_record(&desc) != NRF_SUCCESS) + { + // The record never existed, or it is already cleared. + ret = NRF_ERROR_NOT_FOUND; + } + else + { + // Copy the record key, so that it may be returned in the callback. + p_cmd->record_header.tl.type = ((fds_header_t*)desc.p_rec)->tl.type; + p_cmd->record_header.ic.instance = ((fds_header_t*)desc.p_rec)->ic.instance; + + ret = fs_store(&fs_config, + desc.p_rec, + (uint32_t*)&m_fds_tl_invalid, + FDS_HEADER_SIZE_TL); + } + + p_cmd->op_code = FDS_OP_DONE; + + } break; + + case FDS_OP_CLEAR_INSTANCE: + { + if (find_record(NULL, &p_cmd->record_header.ic.instance, + &desc, &tok) != NRF_SUCCESS) + { + // No more records to be found. + p_cmd->op_code = FDS_OP_DONE; + + // Zero the token, so that we may reuse it. + memset(&tok, 0, sizeof(fds_find_token_t)); + + /** We won't receive a callback, since no flash operation + * was initiated. The command has finished. */ + ret = COMMAND_COMPLETED; + } + else + { + ret = fs_store(&fs_config, + desc.p_rec, + (uint32_t*)&m_fds_tl_invalid, + FDS_HEADER_SIZE_TL); + } + } break; + + case FDS_OP_DONE: + { + /** The last operation completed successfully. + * The command has finished. Return. */ + ret = COMMAND_COMPLETED; + } break; + + default: + ret = NRF_ERROR_INVALID_DATA; + break; + } + + // Await for the operation result. + return ret; +} + + +static ret_code_t cmd_queue_process(void) +{ + ret_code_t ret; + fds_cmd_t * const p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; + + switch (p_cmd->id) + { + case FDS_CMD_INIT: + ret = init_execute(NRF_SUCCESS, NULL); + break; + + case FDS_CMD_WRITE: + case FDS_CMD_UPDATE: + ret = store_execute(NRF_SUCCESS, p_cmd); + break; + + case FDS_CMD_CLEAR: + case FDS_CMD_CLEAR_INST: + ret = clear_execute(NRF_SUCCESS, p_cmd); + break; + + case FDS_CMD_GC: + ret = gc_execute(NRF_SUCCESS); + break; + + default: + ret = NRF_ERROR_FORBIDDEN; + break; + } + + if ((ret == COMMAND_EXECUTING) || (ret == COMMAND_COMPLETED)) + { + return NRF_SUCCESS; + } + + // This is an error. + return ret; +} + + +static ret_code_t cmd_queue_process_start(void) +{ + bool start_processing = false; + + if (!flag_is_set(FDS_FLAG_PROCESSING)) + { + flag_set(FDS_FLAG_PROCESSING); + start_processing = true; + } + + if (!start_processing) + { + // We are awaiting a callback, so there is no need to manually start queue processing. + return NRF_SUCCESS; + } + + return cmd_queue_process(); +} + + +static void fs_callback(uint8_t op_code, + uint32_t result, + uint32_t const * p_data, + fs_length_t length) +{ + ret_code_t ret; + fds_cmd_t * p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; + fds_record_key_t record_key; + + switch (p_cmd->id) + { + case FDS_CMD_INIT: + ret = init_execute(result, p_data); + break; + + case FDS_CMD_WRITE: + case FDS_CMD_UPDATE: + ret = store_execute(result, p_cmd); + break; + + case FDS_CMD_CLEAR: + case FDS_CMD_CLEAR_INST: + ret = clear_execute(result, p_cmd); + break; + + case FDS_CMD_GC: + ret = gc_execute(result); + break; + + default: + // Should not happen. + ret = NRF_ERROR_INTERNAL; + break; + } + + if (ret == COMMAND_EXECUTING /*=NRF_SUCCESS*/) + { + /** The current command is still being processed. + * The command queue does not need to advance. */ + return; + } + + // Initialize the fds_record_key_t structure needed for the callback. + record_key.type = p_cmd->record_header.tl.type; + record_key.instance = p_cmd->record_header.ic.instance; + + // The command has either completed or an operation (and thus the command) has failed. + if (ret == COMMAND_COMPLETED) + { + // The command has completed successfully. Notify the application. + app_notify(NRF_SUCCESS, p_cmd->id, p_cmd->record_header.id, record_key); + } + else + { + /** An operation has failed. This is fatal for the execution of a command. + * Skip other operations associated with the current command. + * Notify the user of the failure. */ + chunk_queue_skip(p_cmd->num_chunks); + app_notify(ret /*=result*/, p_cmd->id, p_cmd->record_header.id, record_key); + } + + // Advance the command queue, and if there is still something in the queue, process it. + if (cmd_queue_advance()) + { + /** Only process the queue if there are no pending commands being queued, since they + * will begin to process the queue on their own. Be sure to clear + * the flag FDS_FLAG_PROCESSING though ! */ + if (atomic_counter_is_zero()) + { + cmd_queue_process(); + } + else + { + flag_clear(FDS_FLAG_PROCESSING); + } + } + else + { + /** No more elements in the queue. Clear the FDS_FLAG_PROCESSING flag, + * so that new commands can start the queue processing. */ + flag_clear(FDS_FLAG_PROCESSING); + } +} + + +ret_code_t fds_init() +{ + ret_code_t fs_ret; + fds_cmd_t * p_cmd; + uint16_t pages_avail; + bool write_page_tag; + bool resume_compression; + + fds_record_key_t const dummy_key = {.type = FDS_TYPE_ID_INVALID, + .instance = FDS_INSTANCE_ID_INVALID}; + + if (flag_is_set(FDS_FLAG_INITIALIZED)) + { + // Notify immediately. + app_notify(NRF_SUCCESS, FDS_CMD_INIT, 0 /*unused*/, dummy_key /*unused*/); + return NRF_SUCCESS; + } + + if (flag_is_set(FDS_FLAG_INITIALIZING)) + { + return NRF_ERROR_INVALID_STATE; + } + + fs_ret = fs_init(); + if (fs_ret != NRF_SUCCESS) + { + // fs_init() failed, propagate the error. + return fs_ret; + } + + queues_init(); + + /** Initialize the last known record to zero. + * Its value will be updated by page_scan() called in pages_init(). */ + m_last_rec_id = 0; + + // Initialize the page table containing all info on pages (address, type etc). + pages_init(&pages_avail, &write_page_tag, &resume_compression); + + if (pages_avail == 0 && !write_page_tag) + { + return NRF_ERROR_NO_MEM; + } + + /** This flag means fds_init() has been called. However, + * the module is NOT yet initialized. */ + flag_set(FDS_FLAG_INITIALIZING); + + if (resume_compression) + { + return NRF_SUCCESS; + } + + if (write_page_tag) + { + if (queue_reserve(FDS_CMD_QUEUE_SIZE_INIT, 0, &p_cmd, NULL) != NRF_SUCCESS) + { + // Should never happen. + return NRF_ERROR_BUSY; + } + + // Initialize the command in the queue. + p_cmd->id = FDS_CMD_INIT; + + return cmd_queue_process_start(); + } + else + { + /* No flash operation is necessary for initialization. + * We can notify the application immediately. */ + flag_set (FDS_FLAG_INITIALIZED); + flag_clear(FDS_FLAG_INITIALIZING); + app_notify(NRF_SUCCESS, FDS_CMD_INIT, 0 /*unused*/, dummy_key /*unused*/); + } + + return NRF_SUCCESS; +} + + +ret_code_t fds_open(fds_record_desc_t * const p_desc, + fds_record_t * const p_record) +{ + uint16_t page; + + if (p_desc == NULL || p_record == NULL) + { + return NRF_ERROR_NULL; + } + + if (page_id_from_virtual_id(p_desc->vpage_id, &page) != NRF_SUCCESS) + { + // Should not happen. + return NRF_ERROR_INVALID_DATA; + } + + // Seek the record if necessary. + if (seek_record(p_desc) == NRF_SUCCESS) + { + if (header_is_valid((fds_header_t*)p_desc->p_rec)) + { + CRITICAL_SECTION_ENTER(); + m_pages[page].records_open++; + CRITICAL_SECTION_EXIT(); + + p_record->header = *((fds_header_t*)p_desc->p_rec); + p_record->p_data = (p_desc->p_rec + FDS_HEADER_SIZE); + + return NRF_SUCCESS; + } + } + + /** The record could not be found. + * It either never existed or it has been cleared. */ + return NRF_ERROR_NOT_FOUND; +} + + +ret_code_t fds_close(fds_record_desc_t const * const p_desc) +{ + uint16_t page; + + if (p_desc == NULL) + { + return NRF_ERROR_NULL; + } + + if (page_id_from_virtual_id(p_desc->vpage_id, &page) != NRF_SUCCESS) + { + return NRF_ERROR_INVALID_DATA; + } + + CRITICAL_SECTION_ENTER(); + m_pages[page].records_open--; + CRITICAL_SECTION_EXIT(); + + return NRF_SUCCESS; +} + + +static ret_code_t write_enqueue(fds_record_desc_t * const p_desc, + fds_record_key_t key, + uint8_t num_chunks, + fds_record_chunk_t chunks[], + fds_write_token_t const * const p_tok, + bool do_update) +{ + ret_code_t ret; + fds_cmd_t * p_cmd; + fds_record_chunk_t * p_chunk = NULL; + uint16_t vpage_id; + uint16_t length_words = 0; + uint8_t cmd_queue_elems; + + if (!flag_is_set(FDS_FLAG_INITIALIZED)) + { + return NRF_ERROR_INVALID_STATE; + } + + if ((key.type == FDS_TYPE_ID_INVALID) || + (key.instance == FDS_INSTANCE_ID_INVALID)) + { + return NRF_ERROR_INVALID_DATA; + } + + if (!chunk_is_aligned(chunks, num_chunks)) + { + return NRF_ERROR_INVALID_ADDR; + } + + cmd_queue_elems = do_update ? FDS_CMD_QUEUE_SIZE_UPDATE : FDS_CMD_QUEUE_SIZE_WRITE; + + // Reserve space on both queues, and obtain pointers to the first elements reserved. + ret = queue_reserve(cmd_queue_elems, + num_chunks, + &p_cmd, + &p_chunk); + + if (ret != NRF_SUCCESS) + { + return ret; + } + + // No space was previously reserved for this operation. + if (p_tok == NULL) + { + // Compute the total length of the record. + for (uint8_t i = 0; i < num_chunks; i++) + { + length_words += chunks[i].length_words; + } + + /** Find a page where we can write the data. Reserve the space necessary + * to write the metadata as well. */ + ret = write_space_reserve(length_words, &vpage_id); + if (ret != NRF_SUCCESS) + { + // If there is no space available, cancel the queue reservation. + queue_reserve_cancel(cmd_queue_elems, num_chunks); + return ret; + } + } + else + { + length_words = p_tok->length_words; + vpage_id = p_tok->vpage_id; + } + + // Initialize the command. + p_cmd->id = do_update ? FDS_CMD_UPDATE : FDS_CMD_WRITE; + p_cmd->op_code = FDS_OP_WRITE_TL; + p_cmd->num_chunks = num_chunks; + p_cmd->chunk_offset = FDS_WRITE_OFFSET_DATA; + p_cmd->vpage_id = vpage_id; + + // Fill in the header information. + p_cmd->record_header.id = record_id_new(); + p_cmd->record_header.tl.type = key.type; + p_cmd->record_header.tl.length_words = length_words; + p_cmd->record_header.ic.instance = key.instance; + p_cmd->record_header.ic.checksum = 0; + + // Buffer the record chunks in the queue. + for (uint8_t i = 0; i < num_chunks; i++) + { + p_chunk->p_data = chunks[i].p_data; + p_chunk->length_words = chunks[i].length_words; + chunk_queue_next(&p_chunk); + } + + if (do_update) + { + // Clear + cmd_queue_next(&p_cmd); + p_cmd->id = FDS_CMD_CLEAR; + p_cmd->op_code = FDS_OP_CLEAR_TL; + + p_cmd->vpage_id = p_desc->vpage_id; + p_cmd->record_header.id = p_desc->record_id; + } + + // Initialize the record descriptor, if provided. + if (p_desc != NULL) + { + p_desc->vpage_id = vpage_id; + // Don't invoke record_id_new() again. + p_desc->record_id = p_cmd->record_header.id; + } + + return cmd_queue_process_start(); +} + + +ret_code_t fds_reserve(fds_write_token_t * const p_tok, uint16_t length_words) +{ + uint16_t vpage_id; + + if (!flag_is_set(FDS_FLAG_INITIALIZED)) + { + return NRF_ERROR_INVALID_STATE; + } + + if (p_tok == NULL) + { + return NRF_ERROR_NULL; + } + + // Reserve space on the page. write_space_reserve() accounts for the header. + if (write_space_reserve(length_words, &vpage_id) == NRF_SUCCESS) + { + p_tok->vpage_id = vpage_id; + p_tok->length_words = length_words; + + return NRF_SUCCESS; + } + + return NRF_ERROR_NO_MEM; +} + + +ret_code_t fds_reserve_cancel(fds_write_token_t * const p_tok) +{ + fds_page_t * p_page; + + if (!flag_is_set(FDS_FLAG_INITIALIZED)) + { + return NRF_ERROR_INVALID_STATE; + } + + if (p_tok == NULL) + { + return NRF_ERROR_NULL; + } + + if (page_from_virtual_id(p_tok->vpage_id, &p_page) != NRF_SUCCESS) + { + // Could not find the virtual page. This shouldn't happen. + return NRF_ERROR_INVALID_DATA; + } + + if ((p_page->words_reserved - p_tok->length_words) < 0) + { + /** We are trying to cancel a reservation for more words than how many are + * currently reserved on the page. This is shouldn't happen. */ + return NRF_ERROR_INVALID_DATA; + } + + // Free the space which had been reserved. + p_page->words_reserved -= p_tok->length_words; + + // Clean the token. + p_tok->vpage_id = 0; + p_tok->length_words = 0; + + return NRF_SUCCESS; +} + + +ret_code_t fds_write(fds_record_desc_t * const p_desc, + fds_record_key_t key, + uint8_t num_chunks, + fds_record_chunk_t chunks[]) +{ + ret_code_t ret; + atomic_counter_inc(); + ret = write_enqueue(p_desc, key, num_chunks, chunks, NULL, false /*not an update*/); + atomic_counter_dec(); + return ret; +} + + +ret_code_t fds_write_reserved(fds_write_token_t const * const p_tok, + fds_record_desc_t * const p_desc, + fds_record_key_t key, + uint8_t num_chunks, + fds_record_chunk_t chunks[]) +{ + ret_code_t ret; + atomic_counter_inc(); + ret = write_enqueue(p_desc, key, num_chunks, chunks, p_tok, false /*not an update*/); + atomic_counter_dec(); + return ret; +} + + +static ret_code_t clear_enqueue(fds_record_desc_t * const p_desc) +{ + ret_code_t ret; + fds_cmd_t * p_cmd; + + if (!flag_is_set(FDS_FLAG_INITIALIZED)) + { + return NRF_ERROR_INVALID_STATE; + } + + if (p_desc == NULL) + { + return NRF_ERROR_NULL; + } + + ret = queue_reserve(FDS_CMD_QUEUE_SIZE_CLEAR, 0, &p_cmd, NULL); + + if (ret != NRF_SUCCESS) + { + return ret; + } + + // Initialize the command. + p_cmd->id = FDS_CMD_CLEAR; + p_cmd->op_code = FDS_OP_CLEAR_TL; + + p_cmd->record_header.id = p_desc->record_id; + p_cmd->vpage_id = p_desc->vpage_id; + + return cmd_queue_process_start(); +} + + +ret_code_t fds_clear(fds_record_desc_t * const p_desc) +{ + ret_code_t ret; + atomic_counter_inc(); + ret = clear_enqueue(p_desc); + atomic_counter_dec(); + return ret; +} + + +static ret_code_t clear_by_instance_enqueue(fds_instance_id_t instance) +{ + ret_code_t ret; + fds_cmd_t * p_cmd; + + if (!flag_is_set(FDS_FLAG_INITIALIZED)) + { + return NRF_ERROR_INVALID_STATE; + } + + ret = queue_reserve(FDS_CMD_QUEUE_SIZE_CLEAR, 0, &p_cmd, NULL); + + if (ret != NRF_SUCCESS) + { + return ret; + } + + p_cmd->id = FDS_CMD_CLEAR_INST; + p_cmd->op_code = FDS_OP_CLEAR_INSTANCE; + + p_cmd->record_header.ic.instance = instance; + + return cmd_queue_process_start(); +} + +ret_code_t fds_clear_by_instance(fds_instance_id_t instance) +{ + ret_code_t ret; + atomic_counter_inc(); + ret = clear_by_instance_enqueue(instance); + atomic_counter_dec(); + return ret; +} + + +ret_code_t fds_update(fds_record_desc_t * const p_desc, + fds_record_key_t key, + uint8_t num_chunks, + fds_record_chunk_t chunks[]) +{ + ret_code_t ret; + atomic_counter_inc(); + ret = write_enqueue(p_desc, key, num_chunks, chunks, NULL, true /*update*/); + atomic_counter_dec(); + return ret; +} + + +static ret_code_t gc_enqueue() +{ + ret_code_t ret; + fds_cmd_t * p_cmd; + + if (!flag_is_set(FDS_FLAG_INITIALIZED)) + { + return NRF_ERROR_INVALID_STATE; + } + + ret = queue_reserve(FDS_CMD_QUEUE_SIZE_GC, 0, &p_cmd, NULL); + if (ret != NRF_SUCCESS) + { + return ret; + } + + p_cmd->id = FDS_CMD_GC; + + // Set compression parameters. + m_gc.state = BEGIN; + + return cmd_queue_process_start(); +} + + +ret_code_t fds_gc() +{ + ret_code_t ret; + atomic_counter_inc(); + ret = gc_enqueue(); + atomic_counter_dec(); + return ret; +} + + +ret_code_t fds_find(fds_type_id_t type, + fds_instance_id_t instance, + fds_record_desc_t * const p_desc, + fds_find_token_t * const p_token) +{ + if (p_desc == NULL || p_token == NULL) + { + return NRF_ERROR_NULL; + } + + return find_record(&type, &instance, p_desc, p_token); +} + + +ret_code_t fds_find_by_type(fds_type_id_t type, + fds_record_desc_t * const p_desc, + fds_find_token_t * const p_token) +{ + if (p_desc == NULL || p_token == NULL) + { + return NRF_ERROR_NULL; + } + + return find_record(&type, NULL, p_desc, p_token); +} + + +ret_code_t fds_find_by_instance(fds_instance_id_t instance, + fds_record_desc_t * const p_desc, + fds_find_token_t * const p_token) +{ + if (p_desc == NULL || p_token == NULL) + { + return NRF_ERROR_NULL; + } + + return find_record(NULL, &instance, p_desc, p_token); +} + + +ret_code_t fds_register(fds_cb_t cb) +{ + if (m_users == FDS_MAX_USERS) + { + return NRF_ERROR_NO_MEM; + } + + m_cb_table[m_users] = cb; + m_users++; + + return NRF_SUCCESS; +} + + +bool fds_descriptor_match(fds_record_desc_t const * const p_desc1, + fds_record_desc_t const * const p_desc2) +{ + if ((p_desc1 == NULL) || (p_desc2 == NULL)) + { + return false; + } + + return (p_desc1->record_id == p_desc2->record_id); +} + + +ret_code_t fds_descriptor_from_rec_id(fds_record_desc_t * const p_desc, + fds_record_id_t record_id) +{ + if (p_desc == NULL) + { + return NRF_ERROR_NULL; + } + + p_desc->record_id = record_id; + p_desc->vpage_id = FDS_VPAGE_ID_UNKNOWN; + + return NRF_SUCCESS; +} + +ret_code_t fds_record_id_from_desc(fds_record_desc_t const * const p_desc, + fds_record_id_t * const p_record_id) +{ + if (p_desc == NULL || p_record_id == NULL) + { + return NRF_ERROR_NULL; + } + + *p_record_id = p_desc->record_id; + + return NRF_SUCCESS; +} + diff --git a/components/libraries/fds/fds.h b/components/libraries/fds/fds.h new file mode 100644 index 0000000..3d4a561 --- /dev/null +++ b/components/libraries/fds/fds.h @@ -0,0 +1,546 @@ +/* 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. + * + */ + +#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 (FDS) is a minimalistic filesystem for the on-chip flash. + * It can be used to manipulate @e records, which consist of a piece of data, made up + * of one or more chunks, and an associated key pair. + */ + +#include +#include +#include "sdk_errors.h" + + +/**@brief */ +#define SIZEOF_WORDS(val) (sizeof(val) / 4) + +/**@brief Reserved type key used to flag cleared records. + * May not be used as a record key by the application. */ +#define FDS_TYPE_ID_INVALID (0x0000) +/**@brief Reserved instance key used to check for missing or corrupted metadata. + * May not be used as a record key by the application. */ +#define FDS_INSTANCE_ID_INVALID (0xFFFF) + + +typedef uint32_t fds_record_id_t; +typedef uint16_t fds_type_id_t; +typedef uint16_t fds_length_t; +typedef uint16_t fds_instance_id_t; +typedef uint16_t fds_checksum_t; + + +/**@brief A piece of a record metadata, keeping information about one of its keys (type) and its + * lenght, expressed in 4 byte words. */ +typedef struct +{ + fds_type_id_t type; /**< The record type ID. */ + fds_length_t length_words; /**< Length of the record's data, in 4 byte words. */ +} fds_tl_t; + + +/**@brief A piece of a record metadata, keeping information about one of its keys (instance) and + * its checksum. */ +typedef struct +{ + fds_instance_id_t instance; /**< The record instance ID. */ + fds_checksum_t checksum; /**< Checksum of the entire record, including the metadata. */ +} fds_ic_t; + + +/**@brief The record metadata. */ +typedef struct +{ + fds_tl_t tl; /**< See @ref fds_tl_t. */ + fds_ic_t ic; /**< See @ref fds_ic_t. */ + fds_record_id_t id; /**< The unique record ID (32 bits). */ +} fds_header_t; + + +typedef fds_header_t fds_record_header_t; + +/**@brief The record descriptor structure, used to manipulate a record. + * @note This structure is meant to be opaque to the user, who does not need to access + * any of its fields. + * @note This structure does not need special initialization. + * @warning Do not reuse the same descriptor for different records. If you do, be sure to set + * its fields to zero. */ +typedef struct +{ + uint32_t record_id; /**< The unique record ID. */ + uint32_t const * p_rec; /**< The last known record address in flash. */ + uint16_t vpage_id; /**< The virtual page ID in which the record is stored. */ + uint16_t gc_magic; /**< Number of times the GC algorithm has been run. */ + uint16_t ptr_magic; /**< Used to verify the validity of p_rec. */ +} fds_record_desc_t; + + +/**@brief The record key, used to lookup records. + * @note The uniqueness of either field is not enforced by the system. */ +typedef struct +{ + uint16_t type; + uint16_t instance; +} fds_record_key_t; + + +/**@brief Structure used for reading a record back from flash memory. */ +typedef struct +{ + // TODO: the header should be a pointer. + fds_header_t header; /**< The record header (metadata), as stored in flash. */ + uint32_t const * p_data; /**< The record data. */ +} fds_record_t; + + +/**@brief A record chunk, containing a piece of data to be stored in a record. + * + * @note p_data must be aligned on a (4 bytes) word boundary. + */ +typedef struct +{ + void const * p_data; /**< Pointer to the data to store. Must be word aligned. */ + fds_length_t length_words; /**< Length of data pointed by p_data, in 4 byte words. */ +} fds_record_chunk_t; + + +/**@brief A token to a reserved space in flash, created by @ref fds_reserve. + * Use @ref fds_write_reserved to write the record in the reserved space, + * or @ref fds_reserve_cancel to cancel the reservation. + */ +typedef struct +{ + uint16_t vpage_id; /**< The virtual ID of the page where space was reserved. */ + fds_length_t length_words; /**< The amount of space reserved, in 4 byte words. */ +} fds_write_token_t; + + +/**@brief A token to keep information about the progress of @ref fds_find, @ref fds_find_by_type + * and @ref fds_find_by_instance operations. + * @note This structure is meant to be opaque to the user, who does not need to access any of its + * fields. + * @note The token does not need special initialization. + * @warning Do not reuse the same token to search for different records. If you do, be sure to set + * its fields to zero. */ +typedef struct +{ + uint32_t const * p_addr; + uint32_t magic; + uint16_t vpage_id; +} fds_find_token_t; + + +typedef enum +{ + FDS_CMD_NONE, /**< No command. */ + FDS_CMD_INIT, /**< Module initialization commnad. Used in @ref fds_init */ + FDS_CMD_WRITE, /**< Write command. Used in @ref fds_write and @ref fds_write_reserved. */ + FDS_CMD_UPDATE, /**< Update command. Used in @ref fds_update. */ + FDS_CMD_CLEAR, /**< Clear record command. Used in @ref fds_clear and @ref fds_update. */ + FDS_CMD_CLEAR_INST, /**< Clear instance command. Used in @ref fds_clear_by_instance. */ + FDS_CMD_GC /**< Garbage collection. Used in @ref fds_gc. */ +} fds_cmd_id_t; + + +/**@brief Flash data storage callback function. + * + * @param result Result of the command. + * @param cmd The command associated with the callback. + * @param record_id The unique ID of the record associated with the callback. + * @param record_key The key pair of the record associated with the callback. + */ +typedef void (*fds_cb_t)(ret_code_t result, + fds_cmd_id_t cmd, + fds_record_id_t record_id, + fds_record_key_t record_key); + + +/**@brief Function to register a callback for the module events. + * @details The maximum amount of callback which can be registered can be configured by + * changing the FDS_MAX_USERS macro in fds_config.h. + * + * @param[in] cb The callback function. + * + * + * @retval NRF_SUCCESS Success. + * @retval NRF_ERROR_NO_MEM Error. Maximum number of registered callbacks reached. + */ +ret_code_t fds_register(fds_cb_t cb); + + +/**@brief Function to initialize the module. + * + * @details This function initializes the module and installs the filesystem, if it is not + * installed yet. + * + * @note This function is asynchronous. Completion is reported with a callback through the + * registered event handler. To be able to receive such callback, be sure to call + * @ref fds_register before calling @ref fds_init. + * + * @retval NRF_SUCCESS Success. The command was queued. + * @retval NRF_ERROR_INVALID_STATE Error. The module is currently undergoing initialization. + * @retval NRF_ERROR_NO_MEM Error. Insufficient space to install the filesystem, or + * insufficient resources to perform the installation. + */ +ret_code_t fds_init(void); + + +/**@brief Function to write a record to flash. + * + * @details This function can be used to write a record to flash. A record data consists of + * multiple chunks and is supplied to the function as an array of fds_record_chunk_t + * structures. The maximum lenght of a record data may not exceed the size of one flash + * page minus FDS_HEADER_SIZE words. + * + * @note This function is asynchronous, therefore, completion is reported with a callback + * through the registered event handler. + * + * @note The record data must be aligned on a 4 byte boundary, and because it is not buffered + * internally, it must be kept in memory by the application until the callback for the + * command has been received, i.e., the command completed. + * + * @param[out] p_desc The record descriptor. It may be NULL. + * @param[in] key The record key pair. + * @param[in] num_chunks The number of elements in the chunks array. + * @param[in] chunks An array of chunks making up the record data. + * + * @retval NRF_SUCCESS Success. The command was queued. + * @retval NRF_ERROR_INVALID_STATE Error. The module is not initialized. + * @retval NRF_ERROR_INVALID_DATA Error. The key contains an invalid type or instance. + * @retval NRF_ERROR_INVALID_ADDR Error. The record data is not aligned on a 4 byte boundary. + * @retval NRF_ERROR_INVALID_LENGTH Error. The record length exceeds the maximum lenght. + * @retval NRF_ERROR_BUSY Error. Insufficient internal resources to queue the operation. + * @retval NRF_ERROR_NO_MEM Error. No flash space available to store the record. + */ +ret_code_t fds_write(fds_record_desc_t * const p_desc, + fds_record_key_t key, + uint8_t num_chunks, + fds_record_chunk_t chunks[]); + + +/**@brief Function to reserve space for a record. + * + * @details This function can be used to reserve flash space to store a record, which can be + * later written down using @ref fds_write_reserved. It is possible to cancel a + * reservation by using @ref fds_reserve_cancel. + * + * @param[out] p_tok A token which can be used to write a record in the reserved space + * using @ref fds_write_reserved. + * @param[in] length_words The lenght of the record data, in 4 byte words. + * + * @retval NRF_SUCCESS Success. Flash space was successfully reserved. + * @retval NRF_ERROR_NULL Error. p_tok is NULL. + * @retval NRF_ERROR_INVALID_STATE Error. The module is not initialized. + * @retval NRF_ERROR_NO_MEM Error. Insufficient space. + */ +ret_code_t fds_reserve(fds_write_token_t * const p_tok, uint16_t length_words); + + +/**@brief Function to cancel a space reservation. + * + * @param[in] p_tok The token produced by @ref fds_reserve, identifying the reservation to cancel. + * + * @retval NRF_SUCCESS Success. The reservation was canceled. + * @retval NRF_ERROR_INVALID_STATE Error. The module is not initialized. + * @retval NRF_ERROR_NULL Error. p_tok is NULL. + * @retval NRF_ERROR_INVALID_DATA Error. p_tok contains invalid data. + */ +ret_code_t fds_reserve_cancel(fds_write_token_t * const p_tok); + + +/**@brief Function to write a record to flash, the space for which has been previously reserved + * using @ref fds_reserve. + * + * @details This function behaves similarly to @ref fds_write, with the exception that it never + * fails with NRF_ERROR_NO_MEM. + * + * @note This function is asynchronous, therefore, completion is reported with a callback + * through the registered event handler. + * + * @note The record data must be aligned on a 4 byte boundary, and because it is not buffered + * internally, it must be kept in memory by the application until the callback for the + * command has been received, i.e., the command completed. + * + * @param[in] p_tok The token return by @ref fds_reserve. + * @param[out] p_desc The record descriptor. It may be NULL. + * @param[in] key The record key pair. + * @param[in] num_chunks The number of elements in the chunks array. + * @param[in] chunks An array of chunks making up the record data. + * + * @retval NRF_SUCCESS Success. The command was queued. + * @retval NRF_ERROR_INVALID_STATE Error. The module is not initialized. + * @retval NRF_ERROR_INVALID_DATA Error. The key contains an invalid type or instance. + * @retval NRF_ERROR_INVALID_ADDR Error. The record data is not aligned on a 4 byte boundary. + * @retval NRF_ERROR_INVALID_LENGTH Error. The record length exceeds the maximum lenght. + * @retval NRF_ERROR_BUSY Error. Insufficient internal resources to queue the operation. + */ +ret_code_t fds_write_reserved(fds_write_token_t const * const p_tok, + fds_record_desc_t * const p_desc, + fds_record_key_t key, + uint8_t num_chunks, + fds_record_chunk_t chunks[]); + + +/**@brief Function to clear a record. + * + * @details Clearing a record has the effect of preventing the system from retrieving the record + * descriptor using the @ref fds_find, @ref fds_find_by_type and @ref fds_find_by_instance + * functions. Additionally, @ref fds_open calls shall fail when supplied a descritpor for + * a record which has been cleared. Clearing a record does not free the space it occupies + * in flash. The reclaim flash space used by cleared records, use @ref fds_gc. + * + * @note This function is asynchronous, therefore, completion is reported with a callback + * through the registered event handler. + * + * @param[in] p_desc The descriptor of the record to clear. + * + * @retval NRF_SUCCESS Success. The command was queued. + * @retval NRF_ERROR_INVALID_STATE Error. The module is not initialized. + * @retval NRF_ERROR_NULL Error. p_desc is NULL. + * @retval NRF_ERROR_BUSY Error. Insufficient internal resources to queue the operation. + */ +ret_code_t fds_clear(fds_record_desc_t * const p_desc); + + +/**@brief Function to clear all records with a given instance. + * + * @details Clearing a record has the effect of preventing the system from retrieving the record + * descriptor using the @ref fds_find, @ref fds_find_by_type and @ref fds_find_by_instance + * functions. Additionally, @ref fds_open calls shall fail when supplied a descritpor for + * a record which has been cleared. Clearing a record does not free the space it occupies + * in flash. The reclaim flash space used by cleared records, use @ref fds_gc. + * + * @note This function is asynchronous, therefore, completion is reported with a callback + * through the registered event handler. Only one callback will be issued. The record + * instance ID in the key parameter of the callback will contain the instance ID passed as + * parameter to this function. The record ID parameter will be zero, and the type ID equal + * to FDS_TYPE_ID_INVALID. + * + * @param[in] instance The instance ID of the records to clear. + * + * @retval NRF_SUCCESS Success. The command was queued. + * @retval NRF_ERROR_INVALID_STATE Error. The module is not initialized. + * @retval NRF_ERROR_NULL Error. p_desc is NULL. + * @retval NRF_ERROR_BUSY Error. Insufficient internal resources to queue the operation. + */ +ret_code_t fds_clear_by_instance(fds_instance_id_t instance); + + +/**@brief Function to update an existing record. + * + * @details Updating a record writes a new record with the given key and data in flash, and then + * clears the old record. + * + * @note This function is asynchronous, therefore, completion is reported with a callback + * through the registered event handler. Two callbacks will be issued, one to signal that + * the updated record has been written down, and another to signal that the old one has been + * cleared. + * + * @note The record data must be aligned on a 4 byte boundary, and because it is not buffered + * internally, it must be kept in memory by the application until the callback for the + * command has been received, i.e., the command completed. + * + * @param[in, out] p_desc The descriptor of the record to update. The descriptor of the updated + * record, after the function has returned with NRF_SUCCESS. + * @param[in] key The record new key pair. + * @param[in] num_chunks The number of elements in the chunks array. + * @param[in] chunks An array of chunks making up the record new data. + * + * @retval NRF_SUCCESS Success. The command was queued. + * @retval NRF_ERROR_INVALID_STATE Error. The module is not initialized. + * @retval NRF_ERROR_INVALID_DATA Error. The key contains an invalid type or instance. + * @retval NRF_ERROR_INVALID_ADDR Error. The record data is not aligned on a 4 byte boundary. + * @retval NRF_ERROR_INVALID_LENGTH Error. The record length exceeds the maximum lenght. + * @retval NRF_ERROR_BUSY Error. Insufficient internal resources to queue the operation. + * @retval NRF_ERROR_NO_MEM Error. No flash space available to store the record. + */ +ret_code_t fds_update(fds_record_desc_t * const p_desc, + fds_record_key_t key, + uint8_t num_chunks, + fds_record_chunk_t chunks[]); + + +/**@brief Function to search for records with a given key pair. + * + * @details Because types are not unique, to search for the next record with the given key call + * the function again and supply the same fds_find_token_t structure to resume searching + * from the last record found. + * + * @param[in] type The record type ID. + * @param[in] instance The record instance ID. + * @param[out] p_desc The descriptor of the record found. + * @param[out] p_token A token containing information about the progress of the operation. + * + * @retval NRF_SUCCESS Success. A record was found. + * @retval NRF_ERROR_INVALID_STATE Error. The module is not initialized. + * @retval NRF_ERROR_NULL Error. Either p_desc or p_token are NULL. + * @retval NRF_ERROR_NOT_FOUND Error. No record with the given key pair was found. + */ +ret_code_t fds_find(fds_type_id_t type, + fds_instance_id_t instance, + fds_record_desc_t * const p_desc, + fds_find_token_t * const p_token); + + +/**@brief Function to search for records with a given type. + * + * @details Because types are not unique, to search for the next record with the given key call + * the function again and supply the same fds_find_token_t structure to resume searching + * from the last record found. + * + * @param[in] type The type ID in the record key. + * @param[out] p_desc The descriptor of the record found. + * @param[out] p_token A token containing information about the progress of the operation. + * + * @retval NRF_SUCCESS Success. A record was found. + * @retval NRF_ERROR_INVALID_STATE Error. The module is not initialized. + * @retval NRF_ERROR_NULL Error. Either p_desc or p_token are NULL. + * @retval NRF_ERROR_NOT_FOUND Error. No record with the given type was found. + */ + ret_code_t fds_find_by_type(fds_type_id_t type, + fds_record_desc_t * const p_desc, + fds_find_token_t * const p_token); + + +/**@brief Function to search for records with a given instance. + * + * @details Because types are not unique, to search for the next record with the given key call + * the function again and supply the same fds_find_token_t structure to resume searching + * from the last record found. + * + * @param[in] instance The instance ID in the record key. + * @param[out] p_desc The descriptor of the record found. + * @param[out] p_token A token containing information about the progress of the operation. + * + * @retval NRF_SUCCESS Success. A record was found. + * @retval NRF_ERROR_INVALID_STATE Error. The module is not initialized. + * @retval NRF_ERROR_NULL Error. Either p_desc or p_token are NULL. + * @retval NRF_ERROR_NOT_FOUND Error. No record with the given instance was found. + */ +ret_code_t fds_find_by_instance(fds_instance_id_t instance, + fds_record_desc_t * const p_desc, + fds_find_token_t * const p_token); + + +/**@brief Function to open a record for reading. + * + * @details Function to read a record which has been written to flash. This function initializes + * a fds_record_t structure which can be used to access the record data as well as + * its associated metadata. The pointers provided in the fds_record_t structure are + * pointers to flash memory. Opening a record with @ref fds_open prevents the garbage + * collection to run on the flash page in which record is stored, therefore the contents + * of the memory pointed by the fds_record_t p_data field is guaranteed to remain + * unmodified, as long as the record is kept open. + * + * @note When you are done reading a record, close it using @ref fds_close so that successive + * garbage collections can reclaim space on the page where the record is stored, if necessary. + * + * @param[in] p_desc The descriptor of the record to open. + * @param[out] p_record The record data and metadata, as stored in flash. + * + * @retval NRF_SUCCESS Success. The record was opened. + * @retval NRF_ERROR_NOT_FOUND Error. The record was not found. It may have been cleared, or it + * may have not been written yet. + * @retval NRF_ERROR_INVALID_DATA Error. The descriptor contains invalid data. + * @retval NRF_ERROR_NULL Error. Either p_desc or p_record are NULL. + */ +ret_code_t fds_open(fds_record_desc_t * const p_desc, + fds_record_t * const p_record); + + +/**@brief Function to close a record, after its contents have been read. + * + * @details Closing a record allows garbage collection to be run on the page in which the + * record being closed is stored (if no other records remain open on that page). + * + * @note Closing a record, does NOT invalidate its descriptor, which can be safely supplied to + * all functions which accept a descriptor as a parameter. + * + * @param[in] p_desc The descriptor of the record to close. + * + * @retval NRF_SUCCESS Success. The record was closed. + * @retval NRF_ERROR_NULL Error. p_desc is NULL. + * @retval NRF_ERROR_INVALID_DATA Error. The descriptor contains invalid data. + */ +ret_code_t fds_close(fds_record_desc_t const * const p_desc); + + +/**@brief Function to perform a garbage collection. + * + * @details Garbage collection reclaims the flash space occupied by records which have been cleared + * using @ref fds_clear. + * + * @note This function is asynchronous, therefore, completion is reported with a callback + * through the registered event handler. + */ +ret_code_t fds_gc(void); + + +/**@brief Function to compare two record descriptors. + * + * @param[in] p_desc_one First descriptor. + * @param[in] p_desc_two Second descriptor. + * + * @retval true If the descriptors identify the same record. + * @retval false Otherwise. + */ +bool fds_descriptor_match(fds_record_desc_t const * const p_desc_one, + fds_record_desc_t const * const p_desc_two); + + +/**@brief Function to obtain a descriptor from a record ID. + * + * @details This function can be used to reconstruct a descriptor from a record ID, such as the + * one passed to the callback function. + * + * @warning This function does not check if a record with the given record ID exists or not. If a + * non-existing record ID is supplied, the resulting descriptor will cause other functions + * to fail when used as parameter. + * + * @param[out] p_desc The descriptor of the record with given record ID. + * @param[in] record_id The record ID for which to provide a descriptor. + * + * @retval NRF_SUCCESS Success. + * @retval NRF_ERROR_NULL Error. p_desc is NULL. + */ +ret_code_t fds_descriptor_from_rec_id(fds_record_desc_t * const p_desc, + fds_record_id_t record_id); + +/**@brief Function to obtain a record ID from a record descriptor. + * + * @details This function can be used to extract a record ID from a descriptor. It may be used + * in the callback function to determine which record the callback is associated to, if + * you have its descriptor. + * + * @warning This function does not check the record descriptor sanity. If the descriptor is + * uninitialized, or has been tampered with, the resulting record ID may be invalid. + * + * @param[in] p_desc The descriptor from which to extract the record ID. + * @param[out] p_record_id The record ID contained in the given descriptor. + * + * @retval NRF_SUCCESS Success. + * @retval NRF_ERROR_NULL Error. Either p_desc is NULL or p_record_id is NULL. + */ +ret_code_t fds_record_id_from_desc(fds_record_desc_t const * const p_desc, + fds_record_id_t * const p_record_id); + +/** @} */ + +#endif // FDS_H__ diff --git a/components/libraries/fds/fds_config.h b/components/libraries/fds/fds_config.h new file mode 100644 index 0000000..d038948 --- /dev/null +++ b/components/libraries/fds/fds_config.h @@ -0,0 +1,45 @@ +/* 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. + * + */ + +#ifndef FDS_CONFIG_H__ +#define FDS_CONFIG_H__ + + /** + * @file fds_config.h + * + * @addtogroup flash_data_storage + * @{ + */ + +/**@brief Configures the size of the internal queue. */ +#define FDS_CMD_QUEUE_SIZE (8) +/**@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 number of physical flash pages to use. Out of the total, one is reserved + * for garbage collection, hence, two pages is the minimum: one for the application data + * and one for the system. */ +#define FDS_MAX_PAGES (2) +/**@brief Configures the maximum number of callbacks which can be registred. */ +#define FDS_MAX_USERS (10) + +/** Page tag definitions. */ +#define FDS_PAGE_TAG_WORD_0_SWAP (0xA5A5A5A5) +#define FDS_PAGE_TAG_WORD_0_VALID (0xA4A4A4A4) +#define FDS_PAGE_TAG_WORD_1 (0xAABBCCDD) +#define FDS_PAGE_TAG_WORD_2 (0xAABB01DD) /**< Includes version. */ +#define FDS_PAGE_TAG_WORD_3 (0x1CEB00DA) +#define FDS_PAGE_TAG_WORD_3_GC (0x1CEB00D8) + +/** @} */ + +#endif // FDS_CONFIG_H__ diff --git a/components/libraries/fds/fds_types_internal.h b/components/libraries/fds/fds_types_internal.h new file mode 100644 index 0000000..50287dd --- /dev/null +++ b/components/libraries/fds/fds_types_internal.h @@ -0,0 +1,158 @@ +/* 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. + * + */ + +#ifndef FDS_TYPES_INTERNAL__ +#define FDS_TYPES_INTERNAL__ + +#include "fds.h" +#include +#include +#include "nrf_soc.h" + + +#define COMMAND_EXECUTING (NRF_SUCCESS) +#define COMMAND_COMPLETED (0x1234) +//#define COMMAND_FAILED (0x1236) + +#define FDS_MAGIC_HWORD (0xF11E) +#define FDS_MAGIC_WORD (0x15ABE11A) +#define FDS_ERASED_WORD (0xFFFFFFFF) + +#define FDS_PAGE_TAG_SIZE (4) /**< Page tag size, in 4 byte words. */ + +#define FDS_VPAGE_ID_UNKNOWN (0xFFFF) + +#define FDS_WRITE_OFFSET_TL (0) /**< Offset of TL from the record base address, in 4 byte words. */ +#define FDS_WRITE_OFFSET_IC (1) /**< Offset of IC from the record base address, in 4 byte words. */ +#define FDS_WRITE_OFFSET_ID (2) /**< Offset of ID from the record base address, in 4 byte words. */ +#define FDS_WRITE_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_ID (1) /**< Size of the IC 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 (3) /**< Size of the whole header, in 4 byte words. */ + +#define FDS_CMD_QUEUE_SIZE_INIT (1) +#define FDS_CMD_QUEUE_SIZE_WRITE (1) +#define FDS_CMD_QUEUE_SIZE_CLEAR (1) +#define FDS_CMD_QUEUE_SIZE_UPDATE (2) +#define FDS_CMD_QUEUE_SIZE_GC (1) + + +static uint8_t m_nested_critical; + +/** Macros to enable and disable application interrupts. */ +#define CRITICAL_SECTION_ENTER() //sd_nvic_critical_region_enter(&m_nested_critical) +#define CRITICAL_SECTION_EXIT() //sd_nvic_critical_region_exit ( m_nested_critical) + +/**@brief Page types. */ +typedef enum +{ + FDS_PAGE_UNDEFINED, /**< Undefined page type. */ + FDS_PAGE_ERASED, /**< Page is erased. */ + FDS_PAGE_VALID, /**< Page is ready for storage. */ + FDS_PAGE_SWAP, /**< Page is reserved for GC. */ + FDS_PAGE_GC /**< Page is being garbage collected. */ +} fds_page_type_t; + + +typedef enum +{ + FDS_OP_NONE = 0x00, /**< No operation. */ + FDS_OP_WRITE_TL, /**< Write the type and length. */ + FDS_OP_WRITE_ID, /**< Write the record ID. */ + FDS_OP_WRITE_CHUNK, /**< Write the record value. */ + FDS_OP_WRITE_IC, /**< Write the instance and checksum. */ + FDS_OP_CLEAR_TL, + FDS_OP_CLEAR_INSTANCE, + FDS_OP_DONE, +} fds_opcode_t; + + +typedef enum +{ + FDS_FLAG_INITIALIZING = (1 << 0), /**< TODO: Not really needed atm? */ + FDS_FLAG_INITIALIZED = (1 << 1), /**< Flag indicating that flash data storage has been initialized. */ + FDS_FLAG_PROCESSING = (1 << 2), /**< Flag indicating that queue is being processed. */ + FDS_FLAG_CAN_GC = (1 << 3), /**< Flag indicating that fds can regain data by performing garbage collection. */ +} fds_flags_t; + + +typedef struct +{ + uint32_t const * start_addr; + uint16_t vpage_id; /**< The page logical ID. */ + uint16_t volatile write_offset; /**< The page write offset, in 4 bytes words. */ + uint16_t volatile words_reserved; /**< The amount of words reserved by fds_write_reserve() on this page. */ + uint16_t volatile records_open; + fds_page_type_t page_type : 4; /**< The page type. */ +} fds_page_t; + + +typedef struct +{ + fds_cmd_id_t id : 4; /**< The ID of the command. */ + fds_opcode_t op_code : 4; + uint8_t num_chunks; /**< Number of operations this command has left in the operation queue. */ + uint16_t chunk_offset; /**< Offset used for writing the record value(s), in 4 byte words. */ + uint16_t vpage_id; /**< The virtual page ID where we reserved the flash space for this command. */ + fds_record_header_t record_header; +} fds_cmd_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 +{ + fds_cmd_t cmd[FDS_CMD_QUEUE_SIZE]; /**< Array to maintain flash access operation details. */ + uint8_t volatile rp; /**< The index of the command being executed. */ + uint8_t volatile count; /**< Number of elements in the queue. */ +} fds_cmd_queue_t; + + +typedef struct +{ + fds_record_chunk_t chunk[FDS_CHUNK_QUEUE_SIZE]; + uint8_t volatile rp; + uint8_t volatile count; +} fds_chunk_queue_t; + + +typedef enum +{ + NONE, + BEGIN, + RESUME, + GC_PAGE, + COPY_RECORD, + READY_SWAP, + NEW_SWAP, + INIT_SWAP +} fds_gc_state_t; + + +typedef struct +{ + uint16_t cur_page; + uint16_t swap_page; + uint32_t const * p_scan_addr; + fds_gc_state_t state; + bool do_gc_page[FDS_MAX_PAGES]; +} fds_gc_data_t; + +#endif // FDS_TYPES_INTERNAL__ diff --git a/components/libraries/fifo/app_fifo.c b/components/libraries/fifo/app_fifo.c new file mode 100644 index 0000000..44b7157 --- /dev/null +++ b/components/libraries/fifo/app_fifo.c @@ -0,0 +1,199 @@ +/* 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 "app_fifo.h" +#include "nrf_error.h" +#include "app_util.h" + +/** + * @brief Verify NULL parameters are not passed to an API by application. + */ +#define NULL_PARAM_CHECK(PARAM) \ + if ((PARAM) == NULL) \ + { \ + return (NRF_ERROR_NULL); \ + } + + +static __INLINE uint32_t fifo_length(app_fifo_t * p_fifo) +{ + uint32_t tmp = p_fifo->read_pos; + return p_fifo->write_pos - tmp; +} + + +#define FIFO_LENGTH fifo_length(p_fifo) /**< Macro for calculating the FIFO length. */ + + +/**@brief Put one byte to the FIFO. */ +static __INLINE void fifo_put(app_fifo_t * p_fifo, uint8_t byte) +{ + p_fifo->p_buf[p_fifo->write_pos & p_fifo->buf_size_mask] = byte; + p_fifo->write_pos++; +} + + +/**@brief Get one byte to the FIFO. */ +static __INLINE void fifo_get(app_fifo_t * p_fifo, uint8_t * p_byte) +{ + *p_byte = p_fifo->p_buf[p_fifo->read_pos & p_fifo->buf_size_mask]; + p_fifo->read_pos++; +} + + +uint32_t app_fifo_init(app_fifo_t * p_fifo, uint8_t * p_buf, uint16_t buf_size) +{ + // Check buffer for null pointer. + if (p_buf == NULL) + { + return NRF_ERROR_NULL; + } + + // Check that the buffer size is a power of two. + if (!IS_POWER_OF_TWO(buf_size)) + { + return NRF_ERROR_INVALID_LENGTH; + } + + p_fifo->p_buf = p_buf; + p_fifo->buf_size_mask = buf_size - 1; + p_fifo->read_pos = 0; + p_fifo->write_pos = 0; + + return NRF_SUCCESS; +} + + +uint32_t app_fifo_put(app_fifo_t * p_fifo, uint8_t byte) +{ + if (FIFO_LENGTH <= p_fifo->buf_size_mask) + { + fifo_put(p_fifo, byte); + return NRF_SUCCESS; + } + + return NRF_ERROR_NO_MEM; +} + + +uint32_t app_fifo_get(app_fifo_t * p_fifo, uint8_t * p_byte) +{ + if (FIFO_LENGTH != 0) + { + fifo_get(p_fifo, p_byte); + return NRF_SUCCESS; + } + + return NRF_ERROR_NOT_FOUND; + +} + + +uint32_t app_fifo_flush(app_fifo_t * p_fifo) +{ + p_fifo->read_pos = p_fifo->write_pos; + return NRF_SUCCESS; +} + + +uint32_t app_fifo_read(app_fifo_t * p_fifo, uint8_t * p_byte_array, uint32_t * p_size) +{ + NULL_PARAM_CHECK(p_fifo); + NULL_PARAM_CHECK(p_size); + + const uint32_t byte_count = fifo_length(p_fifo); + const uint32_t requested_len = (*p_size); + uint32_t index = 0; + uint32_t read_size = 0; + + (*p_size) = byte_count; + + // Check if the FIFO is empty. + if (byte_count == 0) + { + return NRF_ERROR_NOT_FOUND; + } + + // Check if application has requested only the size. + if (p_byte_array == NULL) + { + (*p_size) = byte_count; + return NRF_SUCCESS; + } + + // Check is available bytes in FIFO less than requested. + if (requested_len < byte_count) + { + read_size = requested_len; + } + else + { + read_size = byte_count; + } + + // Fetch bytes from the FIFO. + do + { + fifo_get(p_fifo, &p_byte_array[index++]); + } while (index < read_size); + + (*p_size) = read_size; + + return NRF_SUCCESS; +} + + +uint32_t app_fifo_write(app_fifo_t * p_fifo, uint8_t const * p_byte_array, uint32_t * p_size) +{ + NULL_PARAM_CHECK(p_fifo); + NULL_PARAM_CHECK(p_size); + + const uint32_t available_count = p_fifo->buf_size_mask - fifo_length(p_fifo) + 1; + const uint32_t requested_len = (*p_size); + uint32_t index = 0; + uint32_t write_size = 0; + + (*p_size) = available_count; + + // Check if the FIFO is FULL. + if (available_count == 0) + { + return NRF_ERROR_NO_MEM; + } + + // Check if application has requested only the size. + if (p_byte_array == NULL) + { + (*p_size) = available_count; + return NRF_SUCCESS; + } + + // Check is available bytes in FIFO less than requested. + if (requested_len < available_count) + { + write_size = requested_len; + } + else + { + write_size = available_count; + } + + //Fetch bytes from the FIFO. + do + { + fifo_put(p_fifo, p_byte_array[index++]); + } while (index < write_size); + + (*p_size) = write_size; + + return NRF_SUCCESS; +} diff --git a/components/libraries/fifo/app_fifo.h b/components/libraries/fifo/app_fifo.h new file mode 100644 index 0000000..ff9315b --- /dev/null +++ b/components/libraries/fifo/app_fifo.h @@ -0,0 +1,133 @@ +/* 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. + * + */ + +/**@file + * + * @defgroup app_fifo FIFO implementation + * @{ + * @ingroup app_common + * + * @brief FIFO implementation. + */ + +#ifndef APP_FIFO_H__ +#define APP_FIFO_H__ + +#include +#include + +/**@brief A FIFO instance structure. + * @details Keeps track of which bytes to read and write next. + * Also, it keeps the information about which memory is allocated for the buffer + * and its size. This structure must be initialized by app_fifo_init() before use. + */ +typedef struct +{ + uint8_t * p_buf; /**< Pointer to FIFO buffer memory. */ + uint16_t buf_size_mask; /**< Read/write index mask. Also used for size checking. */ + volatile uint32_t read_pos; /**< Next read position in the FIFO buffer. */ + volatile uint32_t write_pos; /**< Next write position in the FIFO buffer. */ +} app_fifo_t; + +/**@brief Function for initializing the FIFO. + * + * @param[out] p_fifo FIFO object. + * @param[in] p_buf FIFO buffer for storing data. The buffer size must be a power of two. + * @param[in] buf_size Size of the FIFO buffer provided. This size must be a power of two. + * + * @retval NRF_SUCCESS If initialization was successful. + * @retval NRF_ERROR_NULL If a NULL pointer is provided as buffer. + * @retval NRF_ERROR_INVALID_LENGTH If size of buffer provided is not a power of two. + */ +uint32_t app_fifo_init(app_fifo_t * p_fifo, uint8_t * p_buf, uint16_t buf_size); + +/**@brief Function for adding an element to the FIFO. + * + * @param[in] p_fifo Pointer to the FIFO. + * @param[in] byte Data byte to add to the FIFO. + * + * @retval NRF_SUCCESS If an element has been successfully added to the FIFO. + * @retval NRF_ERROR_NO_MEM If the FIFO is full. + */ +uint32_t app_fifo_put(app_fifo_t * p_fifo, uint8_t byte); + +/**@brief Function for getting the next element from the FIFO. + * + * @param[in] p_fifo Pointer to the FIFO. + * @param[out] p_byte Byte fetched from the FIFO. + * + * @retval NRF_SUCCESS If an element was returned. + * @retval NRF_ERROR_NOT_FOUND If there are no more elements in the queue. + */ +uint32_t app_fifo_get(app_fifo_t * p_fifo, uint8_t * p_byte); + +/**@brief Function for flushing the FIFO. + * + * @param[in] p_fifo Pointer to the FIFO. + * + * @retval NRF_SUCCESS If the FIFO was flushed successfully. + */ +uint32_t app_fifo_flush(app_fifo_t * p_fifo); + +/**@brief Function for reading bytes from the FIFO. + * + * This function can also be used to get the number of bytes in the FIFO. + * + * @param[in] p_fifo Pointer to the FIFO. Must not be NULL. + * @param[out] p_byte_array Memory pointer where the read bytes are fetched from the FIFO. + * Can be NULL. If NULL, the number of bytes that can be read in the FIFO + * are returned in the p_size parameter. + * @param[inout] p_size Address to memory indicating the maximum number of bytes to be read. + * The provided memory is overwritten with the actual number of bytes + * read if the procedure was successful. This field must not be NULL. + * If p_byte_array is set to NULL by the application, this parameter + * returns the number of bytes in the FIFO. + * + * @retval NRF_SUCCESS If the procedure is successful. The actual number of bytes read might + * be less than the requested maximum, depending on how many elements exist + * in the FIFO. Even if less bytes are returned, the procedure is considered + * successful. + * @retval NRF_ERROR_NULL If a NULL parameter was passed for a parameter that must not + * be NULL. + * @retval NRF_ERROR_NOT_FOUND If the FIFO is empty. + */ +uint32_t app_fifo_read(app_fifo_t * p_fifo, uint8_t * p_byte_array, uint32_t * p_size); + +/**@brief Function for writing bytes to the FIFO. + * + * This function can also be used to get the available size on the FIFO. + * + * @param[in] p_fifo Pointer to the FIFO. Must not be NULL. + * @param[in] p_byte_array Memory pointer containing the bytes to be written to the FIFO. + * Can be NULL. If NULL, this function returns the number of bytes + * that can be written to the FIFO. + * @param[inout] p_size Address to memory indicating the maximum number of bytes to be written. + * The provided memory is overwritten with the number of bytes that were actually + * written if the procedure is successful. This field must not be NULL. + * If p_byte_array is set to NULL by the application, this parameter + * returns the number of bytes available in the FIFO. + * + * @retval NRF_SUCCESS If the procedure is successful. The actual number of bytes written might + * be less than the requested maximum, depending on how much room there is in + * the FIFO. Even if less bytes are written, the procedure is considered + * successful. If the write was partial, the application should use + * subsequent calls to attempt writing the data again. + * @retval NRF_ERROR_NULL If a NULL parameter was passed for a parameter that must not + * be NULL. + * @retval NRF_ERROR_NO_MEM If the FIFO is full. + * + */ +uint32_t app_fifo_write(app_fifo_t * p_fifo, uint8_t const * p_byte_array, uint32_t * p_size); + +#endif // APP_FIFO_H__ + +/** @} */ diff --git a/components/libraries/fstorage/fstorage.c b/components/libraries/fstorage/fstorage.c new file mode 100644 index 0000000..592cf37 --- /dev/null +++ b/components/libraries/fstorage/fstorage.c @@ -0,0 +1,549 @@ +/* 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 "fstorage.h" +#include +#include +#include +#include "fstorage_config.h" +#include "nrf_error.h" +#include "nrf_soc.h" + + +#define FS_FLAG_INIT (1 << 0) /**< fstorage has been initialized. */ +#define FS_FLAG_PROCESSING (1 << 1) /**< fstorage is executing queued flash operations. */ +#define FS_FLAG_FLASH_REQ_PENDING (1 << 2) /**< fstorage is waiting for a flash operation initiated by another module to complete. */ + + +/**@brief Macro invocation that registers section fs_data. + * + * @details Required for compilation. + */ +NRF_SECTION_VARS_REGISTER_SECTION(fs_data); + + +/**@brief Macro invocation that declares symbols used to find the beginning and end of the section fs_data. + * + * @details Required for compilation. + */ +NRF_SECTION_VARS_REGISTER_SYMBOLS(fs_config_t, fs_data); + + +/**@defgroup Section vars helper macros. + * + * @details Macros used to manipulate registered section variables. + */ + /**@brief Get section variable with fstorage configuration by index. */ +#define FS_SECTION_VARS_GET(i) NRF_SECTION_VARS_GET(i, fs_config_t, fs_data) + /**@brief Get the number of registered section variables. */ +#define FS_SECTION_VARS_COUNT NRF_SECTION_VARS_COUNT(fs_config_t, fs_data) + /**@brief Get the start address of the registered section variables. */ +#define FS_SECTION_VARS_START_ADDR NRF_SECTION_VARS_START_ADDR(fs_data) + /**@brief Get the end address of the registered section variables. */ +#define FS_SECTION_VARS_END_ADDR NRF_SECTION_VARS_END_ADDR(fs_data) + +/** @} */ + + +/**@brief The command queue element. + * + * @details Encapsulate details of a command requested to this module. + */ +typedef struct +{ + fs_config_t const * p_config; /**< The configuration of the user who requested the operation. */ + uint8_t op_code; /**< Operation code. */ + uint32_t const * p_src; /**< Pointer to the data to be written to flash. The data must be kept in memory until the operation has finished. */ + uint32_t const * p_addr; /**< Destination of the data in flash. */ + fs_length_t length_words; /**< Length of the operation */ + fs_length_t offset; /**< Offset of the operation if operation is done in chunks */ +} fs_cmd_t; + + +/**@brief Structure that defines the command queue + * + * @details This queue holds flash operations requested to the module. + * The data to be written must be kept in memory until the write operation is completed, + * i.e., a callback indicating completion is received by the application. + */ +typedef struct +{ + uint8_t rp; /**< The current element being processed. */ + uint8_t count; /**< Number of elements in the queue. */ + fs_cmd_t cmd[FS_CMD_QUEUE_SIZE]; /**< Array to maintain flash access operation details. */ +} fs_cmd_queue_t; + + +static uint8_t m_flags; /**< FStorage status flags. */ +static fs_cmd_queue_t m_cmd_queue; /**< Flash operation request queue. */ +static uint16_t m_retry_count = 0; /**< Number of times a single flash operation was retried. */ + + +// Function prototypes +static ret_code_t queue_process(void); +static ret_code_t queue_process_impl(void); +static void app_notify(uint32_t result, fs_cmd_t const * p_cmd); + + +/**@brief Macro to check that the configuration is non-NULL and within +* valid section variable memory bounds. + * + * @param[in] config Configuration to check. + */ +#define FS_CHECK_CONFIG(config) \ + ((FS_SECTION_VARS_START_ADDR < config) && (config < FS_SECTION_VARS_END_ADDR)) + + +/**@brief Function to check that the configuration is non-NULL and within +* valid section variable memory bounds. + * + * @param[in] config Configuration to check. + */ +static bool check_config(fs_config_t const * const config) +{ + if (config == NULL) + { + return false; + } + + if ((FS_SECTION_VARS_START_ADDR <= (uint32_t)config) && ((uint32_t)config < FS_SECTION_VARS_END_ADDR)) + { + return true; + } + else + { + return false; + } +} + + +/**@brief Function to initialize the queue. */ +static void queue_init(void) +{ + memset(&m_cmd_queue, 0, sizeof(fs_cmd_queue_t)); +} + + +/**@brief Function to reset a queue item to its default values. + * + * @param index Index of the queue element. + */ +static void cmd_reset(uint32_t index) +{ + memset(&m_cmd_queue.cmd[index], 0, sizeof(fs_cmd_t)); +} + + +/**@brief Function to enqueue flash access command + * + * @param[in] config Registered configuration. + * @param[in] op_code Operation code. + * @param[in] address Destination of the data. + * @param[in] p_src Source of data or NULL if n/a. + * @param[in] length Length of the data, in 4 byte words. + * + * @retval NRF_SUCCESS Success. Command enqueued. + * @retval NRF_ERROR_NO_MEM Error. Queue is full. + * @retval Any error returned by the SoftDevice flash API. + */ +static ret_code_t cmd_enqueue(fs_config_t const * p_config, + uint8_t op_code, + uint32_t const * p_addr, + uint32_t const * p_src, + fs_length_t length_words) +{ + fs_cmd_t * p_cmd; + uint8_t write_pos; + + if (m_cmd_queue.count == FS_CMD_QUEUE_SIZE - 1) + { + return NRF_ERROR_NO_MEM; + } + + write_pos = (m_cmd_queue.rp + m_cmd_queue.count) % FS_CMD_QUEUE_SIZE; + + p_cmd = &m_cmd_queue.cmd[write_pos]; + + p_cmd->p_config = p_config; + p_cmd->op_code = op_code; + p_cmd->p_src = p_src; + p_cmd->p_addr = p_addr; + p_cmd->length_words = length_words; + + m_cmd_queue.count++; + + return queue_process(); +} + + +/**@brief Function to consume queue item and notify the return value of the operation. + * + * @details This function will report the result and remove the command from the queue after + * notification. + */ +static void cmd_consume(uint32_t result, const fs_cmd_t * p_cmd) +{ + // Consume the current item on the queue. + uint8_t rp = m_cmd_queue.rp; + + m_cmd_queue.count--; + if (m_cmd_queue.count == 0) + { + // There are no elements left. Stop processing the queue. + m_flags &= ~FS_FLAG_PROCESSING; + } + + if (++(m_cmd_queue.rp) == FS_CMD_QUEUE_SIZE) + { + m_cmd_queue.rp = 0; + } + + // Notify upon successful operation. + app_notify(result, p_cmd); + + // Reset the queue element. + cmd_reset(rp); +} + + +/**@brief Function to store data to flash. + * + * @param[in] p_cmd The queue element associated with the operation. + * + * @retval NRF_SUCCESS Success. The request was sent to the SoftDevice. + * @retval Any error returned by the SoftDevice flash API. + */ +static __INLINE uint32_t store_execute(fs_cmd_t const * const p_cmd) +{ + // Write in chunks if write-size is larger than FS_MAX_WRITE_SIZE. + fs_length_t const length = ((p_cmd->length_words - p_cmd->offset) < FS_MAX_WRITE_SIZE_WORDS) ? + (p_cmd->length_words - p_cmd->offset) : FS_MAX_WRITE_SIZE_WORDS; + + return sd_flash_write((uint32_t*)p_cmd->p_addr + p_cmd->offset /* destination */, + (uint32_t*)p_cmd->p_src + p_cmd->offset /* source */, + length); +} + + +/**@brief Function to erase a page. + * + * @param[in] p_cmd The queue element associated with the operation. + * + * @retval NRF_SUCCESS Success. The request was sent to the SoftDevice. + * @retval Any error returned by the SoftDevice flash API. + */ +static __INLINE uint32_t erase_execute(fs_cmd_t const * const p_cmd) +{ + // Erase the page. + return sd_flash_page_erase((uint32_t)(p_cmd->p_addr + p_cmd->offset) / FS_PAGE_SIZE); +} + + +/**@brief Function to process the current element in the queue and return the result. + * + * @retval NRF_SUCCESS Success. + * @retval NRF_ERROR_FORBIDDEN Error. Undefined command. + * @retval Any error returned by the SoftDevice flash API. + */ +static uint32_t queue_process_impl(void) +{ + uint32_t ret; + + fs_cmd_t const * const p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; + + switch (p_cmd->op_code) + { + case FS_OP_STORE: + ret = store_execute(p_cmd); + break; + + case FS_OP_ERASE: + ret = erase_execute(p_cmd); + break; + + case FS_OP_NONE: + ret = NRF_SUCCESS; + break; + + default: + ret = NRF_ERROR_FORBIDDEN; + break; + } + + return ret; +} + + +/**@brief Starts processing the queue if there are no pending flash operations + * for which we are awaiting a callback. + */ +static ret_code_t queue_process(void) +{ + ret_code_t ret = NRF_SUCCESS; + + /** If the queue is not being processed, and there are still + * some elements in it, then start processing. */ + if ( !(m_flags & FS_FLAG_PROCESSING) && + (m_cmd_queue.count > 0)) + { + m_flags |= FS_FLAG_PROCESSING; + + ret = queue_process_impl(); + + /** There is ongoing flash-operation which was not + * initiated by fstorage. */ + if (ret == NRF_ERROR_BUSY) + { + // Wait for a system callback. + m_flags |= FS_FLAG_FLASH_REQ_PENDING; + + // Stop processing the queue. + m_flags &= ~FS_FLAG_PROCESSING; + + ret = NRF_SUCCESS; + } + else if (ret != NRF_SUCCESS) + { + // Another error has occurred. + app_notify(ret, &m_cmd_queue.cmd[m_cmd_queue.rp]); + } + } + + // If we are already processing the queue, return immediately. + return ret; +} + + +/**@brief Flash operation success callback handler. + * + * @details This function updates read/write pointers. + * This function resets retry count. + */ +static __INLINE void on_operation_success(void) +{ + fs_cmd_t * const p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; + + m_retry_count = 0; + + switch (p_cmd->op_code) + { + case FS_OP_STORE: + // Update the offset on successful write. + p_cmd->offset += FS_MAX_WRITE_SIZE_WORDS; + break; + + case FS_OP_ERASE: + // Update the offset to correspond to the page that has been erased. + p_cmd->offset += FS_PAGE_SIZE_WORDS; + break; + } + + // If offset is equal to or larger than length, then the operation has finished. + if (p_cmd->offset >= p_cmd->length_words) + { + cmd_consume(NRF_SUCCESS, p_cmd); + } + + queue_process(); +} + + +/**@brief Flash operation failure callback handler. + * + * @details Function to keep track of retries and notify failures. + */ +static __INLINE void on_operation_failure(uint32_t sys_evt) +{ + const fs_cmd_t * p_cmd; + + if (++m_retry_count > FS_CMD_MAX_RETRIES) + { + p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; + cmd_consume(NRF_ERROR_TIMEOUT, p_cmd); + } + + queue_process(); +} + + +/**@brief Function to notify users. + * + * @param[in] result Result of the flash operation. + * @param[in] p_cmd The command associated with the callback. + */ +static void app_notify(uint32_t result, fs_cmd_t const * const p_cmd) +{ + p_cmd->p_config->cb(p_cmd->op_code, result, p_cmd->p_addr, p_cmd->length_words); +} + + +ret_code_t fs_init(void) +{ + uint16_t lowest_index = 0; + uint16_t lowest_order = 0xFFFF; + uint32_t * current_end = (uint32_t*)FS_PAGE_END_ADDR; + uint32_t num_left = FS_SECTION_VARS_COUNT; + + queue_init(); + + /** Assign pages to registered users, beginning with the ones with the lowest + * order, which will be assigned pages with the lowest memory address. */ + do + { + fs_config_t * p_config; + for (uint16_t i = 0; i < FS_SECTION_VARS_COUNT; i++) + { + p_config = FS_SECTION_VARS_GET(i); + + // Skip the ones which have the end-address already set. + if (p_config->p_end_addr != NULL) + continue; + + if (p_config->page_order < lowest_order) + { + lowest_order = p_config->page_order; + lowest_index = i; + } + } + + p_config = FS_SECTION_VARS_GET(lowest_index); + + p_config->p_end_addr = current_end; + p_config->p_start_addr = p_config->p_end_addr - (p_config->num_pages * FS_PAGE_SIZE_WORDS); + + current_end = p_config->p_start_addr; + lowest_order = 0xFFFF; + + } while ( --num_left > 0 ); + + m_flags |= FS_FLAG_INIT; + + return NRF_SUCCESS; +} + + +ret_code_t fs_store(fs_config_t const * p_config, + uint32_t const * p_addr, + uint32_t const * const p_data, + fs_length_t length_words) +{ + if ((m_flags & FS_FLAG_INIT) == 0) + { + return NRF_ERROR_INVALID_STATE; + } + + if (!check_config(p_config)) + { + return NRF_ERROR_FORBIDDEN; + } + + if (!is_word_aligned(p_addr)) + { + return NRF_ERROR_INVALID_ADDR; + } + + // Check that the erase operation is on pages owned by this user (configuration). + if ((p_addr < p_config->p_start_addr) || ((p_addr + length_words) > p_config->p_end_addr)) + { + return NRF_ERROR_INVALID_ADDR; + } + + return cmd_enqueue(p_config, FS_OP_STORE, p_addr, p_data, length_words); +} + + +ret_code_t fs_erase(fs_config_t const * p_config, + uint32_t * const p_addr, + fs_length_t const length_words) +{ + if ((m_flags & FS_FLAG_INIT) == 0) + { + return NRF_ERROR_INVALID_STATE; + } + + if (!check_config(p_config)) + { + return NRF_ERROR_FORBIDDEN; + } + + /** Check that the address is aligned on a page boundary and the length to erase + * is a multiple of the page size. */ + if (((uint32_t)p_addr & (FS_PAGE_SIZE - 1)) || + (length_words & (FS_PAGE_SIZE_WORDS - 1))) + { + return NRF_ERROR_INVALID_ADDR; + } + + // Check that the erase operation is on pages owned by this user (configuration). + if ((p_addr < p_config->p_start_addr) || ((p_addr + length_words) > p_config->p_end_addr)) + { + return NRF_ERROR_INVALID_ADDR; + } + + return cmd_enqueue(p_config, FS_OP_ERASE, p_addr, NULL, length_words); +} + + +/**@brief Function to handle system events from the SoftDevice. + * + * @details This function should be dispatched system events if any of the modules used by + * the application rely on FStorage. Examples include @ref Peer Manager and + * @ref Flash Data Storage. + * + * @param[in] sys_evt System Event received. + */ +void fs_sys_event_handler(uint32_t sys_evt) +{ + if (m_flags & FS_FLAG_PROCESSING) + { + /** A flash operation was initiated by this module. + * Handle its result. */ + switch (sys_evt) + { + case NRF_EVT_FLASH_OPERATION_SUCCESS: + on_operation_success(); + break; + + case NRF_EVT_FLASH_OPERATION_ERROR: + on_operation_failure(sys_evt); + break; + } + } + else if ((m_flags & FS_FLAG_FLASH_REQ_PENDING)) + { + /** A flash operation was initiated outside this module. + * We have now receveid a callback which indicates it has + * finished. Clear the FS_FLAG_FLASH_REQ_PENDING flag. */ + m_flags &= ~FS_FLAG_FLASH_REQ_PENDING; + + // Resume processing the queue, if necessary. + queue_process(); + } +} + + +// Just for testing out section vars (across many compilers). +void fs_debug_print() +{ + printf("fs start address: 0x%08lx\r\n", (unsigned long)FS_SECTION_VARS_START_ADDR); + printf("fs end address: 0x%08lx\r\n", (unsigned long)FS_SECTION_VARS_END_ADDR); + printf("Num items: 0x%08lx\r\n", (unsigned long)FS_SECTION_VARS_COUNT); + printf("===== ITEMS %lu =====\r\n", (unsigned long)FS_SECTION_VARS_COUNT); + + for(int i = 0; i < FS_SECTION_VARS_COUNT; i++) + { + fs_config_t* config = FS_SECTION_VARS_GET(i); + printf( "Address: 0x%08lx, CB: 0x%08lx\r\n", + (unsigned long)config, (unsigned long)config->cb ); + } + printf("\r\n"); +} diff --git a/components/libraries/fstorage/fstorage.h b/components/libraries/fstorage/fstorage.h new file mode 100644 index 0000000..aad4b96 --- /dev/null +++ b/components/libraries/fstorage/fstorage.h @@ -0,0 +1,156 @@ +/* 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. + * + */ + + +#ifndef FS_H__ +#define FS_H__ + + /** @file + * + * @defgroup fstorage FStorage + * @{ + * @ingroup app_common + * @brief Module which provides low level functionality to store data to flash. + * + */ + + +#include +#include "section_vars.h" +#include "fstorage_config.h" +#include "sdk_errors.h" + + +typedef uint16_t fs_length_t; + + +typedef enum +{ + FS_OP_NONE = 0, + FS_OP_STORE = 1, + FS_OP_ERASE = 2 +} fs_oper_t; + + +/**@brief Callback for flash operations. + * + * @param[in] op_code Flash access operation code. + * @param[in] result Result of the operation. + * @param[in] data Pointer to resulting data (or NULL if not in use). + * @param[in] length_words Length of data in words. + */ +typedef void (*fs_cb_t)(uint8_t op_code, + uint32_t result, + uint32_t const * p_data, + fs_length_t length_words); + + +/**@brief Function prototype for a callback handler. + * + * @details This function is expected to be implemented by the module that + * registers for fstorage usage. Its usage is described + * in the function pointer type fs_cb_t. + * + * @param[in] op_code Flash operation code. + * @param[in] result Result of the flash operation. + * @param[in] p_data Pointer to the resulting data (or NULL if not in use). + * @param[in] length_words Length of data in words. + */ +static void fs_callback(uint8_t op_code, + uint32_t result, + uint32_t const * p_data, + fs_length_t length_words); + + +/**@brief Flash storage config variable. + * + * @details The fstorage module will update the start_addr and end_address according to + * ordering rules and the number of pages requested by the fstorage module user. + */ +typedef struct +{ + const fs_cb_t cb; /**< Callback to run when flash operation has completed. */ + const uint8_t num_pages; /**< The number of pages to reserve for flash storage. */ + const uint8_t page_order; /**< The order used to allocate pages. */ + uint32_t * p_start_addr; /**< Pointer to the start address of the allocated flash storage. Set by running @ref fs_init. */ + uint32_t * p_end_addr; /**< Pointer to the end address of the allcoated flash storage. Set by running @ref fs_init. */ +} fs_config_t; + + +/**@brief Macro for registering of flash storage configuration variable. + * + * @details This macro is expected to be invoked in the code unit that that require + * flash storage. Invoking this places the registered configuration variable + * in a section named "fs_data" that the fstorage module uses during initialization + * and regular operation. + */ +#define FS_SECTION_VARS_ADD(type_def) NRF_SECTION_VARS_ADD(fs_data, type_def) + + +/**@brief Function to initialize FStorage. + * + * @details This function allocates flash data pages according to the + * number requested in the config variable. The data used to initialize. + * the fstorage is section placed variables in the data section "fs_data". + */ +ret_code_t fs_init(void); + + +/**@brief Function to store data in flash. + * + * @warning The data to be written to flash has to be kept in memory until the operation has + * terminated, i.e., a callback is received. + * + * @param[in] p_config Const pointer to configiguration of module user that requests a store operation. + * @param[in] p_addr Write address of store operation. + * @param[in] p_data Pointer to the data to store. + * @param[in] length_words Length of the data to store. + * + * @retval NRF_SUCCESS Success. Command queued. + * @retval NRF_ERROR_INVALID_STATE Error. The module is not initialized. + * @retval NRF_ERROR_INVALID_ADDR Error. Data is unaligned or invalid configuration. + * @retval Any error returned by the SoftDevice flash API. + */ +ret_code_t fs_store(fs_config_t const * p_config, + uint32_t const * p_addr, + uint32_t const * const p_data, + fs_length_t length_words); + + +/** Function to erase a page in flash. + * + * @note The erase address must be aligned on a page boundary. The length in words must be + * equivalent to the page size. + * + * @param[in] p_config Pointer to the configuration of the user that requests the operation. + * @param[in] p_addr Address of page to erase (the same as first word in the page). + * @param[in] length_words Length (in 4 byte words) of the area to erase. + * + * @retval NRF_SUCCESS Success. Command queued. + * @retval NRF_ERROR_INVALID_STATE Error. The module is not initialized. + * @retval NRF_ERROR_INVALID_ADDR Error. Data is unaligned or invalid configuration. + * @retval Any error returned by the SoftDevice flash API. + */ +ret_code_t fs_erase(fs_config_t const * p_config, + uint32_t * const p_addr, + fs_length_t length_words); + + +/**@brief Function to call to handle events from the SoftDevice + * + * @param sys_evt System event from the SoftDevice + */ +void fs_sys_event_handler(uint32_t sys_evt); + +/** @} */ + +#endif // FS_H__ diff --git a/components/libraries/fstorage/fstorage_config.h b/components/libraries/fstorage/fstorage_config.h new file mode 100644 index 0000000..e222f9b --- /dev/null +++ b/components/libraries/fstorage/fstorage_config.h @@ -0,0 +1,81 @@ +#ifndef FS_CONFIG_H__ +#define FS_CONFIG_H__ + +#include +#include "nrf.h" + +/** + * @defgroup fstorage_config FStorage configuration + * @ingroup fstorage + * @{ + * @brief FStorage configuration. + */ + + +/**@brief Macro for max number of operations in the fs cmd queue. + */ +#define FS_CMD_QUEUE_SIZE (8) + + +/**@brief Macro for max number of retries for a flash command before it notifies as failed. + */ +#define FS_CMD_MAX_RETRIES (3) + + +/**@brief Macro for the content of a flash address that has not been written to. + */ +#define FS_EMPTY_MASK (0xFFFFFFFF) + + +/**@brief Macro for flash page size according to chip family + */ +#if defined (NRF51) + #define FS_PAGE_SIZE (1024) +#elif defined (NRF52) + #define FS_PAGE_SIZE (4096) +#else + #error "Device family must be defined. See nrf.h." +#endif + + +/*@brief Macro for flash page size according to chip family +*/ +#define FS_PAGE_SIZE_WORDS (FS_PAGE_SIZE/4) + + +/**@brief Static inline function that provides last page address + * + * @note 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 + */ +static __INLINE uint32_t fs_flash_page_end_addr() +{ + uint32_t const bootloader_addr = NRF_UICR->NRFFW[0]; + return ((bootloader_addr != FS_EMPTY_MASK) ? + bootloader_addr : NRF_FICR->CODESIZE * FS_PAGE_SIZE); +} + + +/**@brief Macro for last page address + * + * @note 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() + + +/**@brief Macro to describe the write + * + */ +#if defined (NRF51) + #define FS_MAX_WRITE_SIZE_WORDS (256) +#elif defined (NRF52) + #define FS_MAX_WRITE_SIZE_WORDS (1024) +#else + #error "Device family must be defined. see nrf.h" +#endif + +/** @} */ + +#endif // FS_CONFIG_H__ + diff --git a/components/libraries/fstorage/fstorage_nosd.c b/components/libraries/fstorage/fstorage_nosd.c new file mode 100644 index 0000000..e69de29 diff --git a/components/libraries/gpiote/app_gpiote.c b/components/libraries/gpiote/app_gpiote.c new file mode 100644 index 0000000..a0e00e5 --- /dev/null +++ b/components/libraries/gpiote/app_gpiote.c @@ -0,0 +1,268 @@ +/* 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 "app_gpiote.h" +#include "nrf_drv_gpiote.h" +#include +#include +#include +/**@brief GPIOTE user type. */ +typedef struct +{ + uint32_t pins_mask; /**< Mask defining which pins user wants to monitor. */ + uint32_t pins_low_to_high_mask; /**< Mask defining which pins will generate events to this user when toggling low->high. */ + uint32_t pins_high_to_low_mask; /**< Mask defining which pins will generate events to this user when toggling high->low. */ + uint32_t sense_high_pins; /**< Mask defining which pins are configured to generate GPIOTE interrupt on transition to high level. */ + app_gpiote_event_handler_t event_handler; /**< Pointer to function to be executed when an event occurs. */ + bool enabled; /**< Flag indicating whether user is enabled. */ +} gpiote_user_t; + +STATIC_ASSERT(sizeof(gpiote_user_t) <= GPIOTE_USER_NODE_SIZE); +STATIC_ASSERT(sizeof(gpiote_user_t) % 4 == 0); + +static uint8_t m_user_array_size; /**< Size of user array. */ +static uint8_t m_user_count; /**< Number of registered users. */ +static gpiote_user_t * mp_users = NULL; /**< Array of GPIOTE users. */ +static uint32_t m_pins; /**< Mask of initialized pins. */ +static uint32_t m_last_pins_state; /**< Most recent state of pins. */ + +void gpiote_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action) +{ + int i; + uint32_t pin_mask = 1 << pin; + bool hitolo = (m_last_pins_state & pin_mask) ? true : false; + m_last_pins_state = nrf_gpio_pins_read(); + + for (i = 0; i < m_user_count; i++) + { + if (mp_users[i].enabled && (pin_mask & mp_users[i].pins_mask)) + { + if ((pin_mask & mp_users[i].pins_high_to_low_mask) && hitolo) + { + mp_users[i].event_handler(0,pin_mask); + } + else if ((pin_mask & mp_users[i].pins_low_to_high_mask) && !hitolo) + { + mp_users[i].event_handler(pin_mask,0); + } + } + } +} + +uint32_t app_gpiote_init(uint8_t max_users, void * p_buffer) +{ + uint32_t ret_code = NRF_SUCCESS; + + if (p_buffer == NULL) + { + return NRF_ERROR_INVALID_PARAM; + } + + // Check that buffer is correctly aligned. + if (!is_word_aligned(p_buffer)) + { + return NRF_ERROR_INVALID_PARAM; + } + + // Initialize file globals. + mp_users = (gpiote_user_t *)p_buffer; + m_user_array_size = max_users; + m_user_count = 0; + m_pins = 0; + + memset(mp_users, 0, m_user_array_size * sizeof(gpiote_user_t)); + + if (nrf_drv_gpiote_is_init()==false) + { + ret_code = nrf_drv_gpiote_init(); + } + + return ret_code; +} + +uint32_t app_gpiote_user_register(app_gpiote_user_id_t * p_user_id, + uint32_t pins_low_to_high_mask, + uint32_t pins_high_to_low_mask, + app_gpiote_event_handler_t event_handler) +{ + uint32_t user_pin_mask; + uint32_t ret_val = NRF_SUCCESS; + // Check state and parameters. + if (mp_users == NULL) + { + return NRF_ERROR_INVALID_STATE; + } + if (event_handler == NULL) + { + return NRF_ERROR_INVALID_PARAM; + } + if (m_user_count >= m_user_array_size) + { + return NRF_ERROR_NO_MEM; + } + + user_pin_mask = pins_low_to_high_mask | pins_high_to_low_mask; + // Allocate new user. + mp_users[m_user_count].pins_mask = user_pin_mask; + mp_users[m_user_count].pins_low_to_high_mask = pins_low_to_high_mask; + mp_users[m_user_count].pins_high_to_low_mask = pins_high_to_low_mask; + mp_users[m_user_count].event_handler = event_handler; + mp_users[m_user_count].enabled = false; + + *p_user_id = m_user_count++; + + uint32_t mask = 1; + uint32_t i; + const nrf_drv_gpiote_in_config_t config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(false); + for (i = 0; i < 32; i++) + { + if ((mask & user_pin_mask) & ~m_pins) + { + ret_val = nrf_drv_gpiote_in_init(i, &config, gpiote_handler); + if (ret_val != NRF_SUCCESS) + { + return ret_val; + } + m_pins |= mask; + } + mask <<= 1; + } + return ret_val; +} + +__STATIC_INLINE uint32_t error_check(app_gpiote_user_id_t user_id) +{ + // Check state and parameters. + if (mp_users == NULL) + { + return NRF_ERROR_INVALID_STATE; + } + if (user_id >= m_user_count) + { + return NRF_ERROR_INVALID_PARAM; + } + return NRF_SUCCESS; +} +/** + * @brief Function for enabling event on pin (if not yet enabled) or disabling the event if no other + * user requires it. + * + * @param pin Pin to enable + * @param enable If true function will attempt to enable the pin else it will attempt to disable it. + */ +static void pin_event_enable(uint32_t pin, bool enable) +{ + uint32_t i; + uint32_t pin_mask = 1UL << pin; + bool enabled = false; + //search if any user already enabled given pin + for (i = 0; i < m_user_count; i++) + { + if (mp_users[i].enabled && (mp_users[i].pins_mask & pin_mask)) + { + enabled = true; + break; + } + } + if (!enabled) + { + if (enable) + { + m_last_pins_state = nrf_gpio_pins_read(); + nrf_drv_gpiote_in_event_enable(pin, true); + } + else + { + nrf_drv_gpiote_in_event_disable(pin); + } + } +} + +/** + * @brief Function for enabling or disabling events for pins used by the user. + * + * Function will enable pin events only if they are not yet enabled. Function will disable pin + * events only if there is no other enabled user that is using them. + * + * @param user_id User id. + * @param enable If true function will attempt to enable the pin else it will attempt to disable it. + */ +static uint32_t user_enable(app_gpiote_user_id_t user_id, bool enable) +{ + uint32_t ret_code = error_check(user_id); + + if (ret_code == NRF_SUCCESS) + { + uint32_t i; + uint32_t mask = 1UL; + for (i = 0; i < 32; i++) + { + if (mp_users[user_id].pins_mask & mask) + { + pin_event_enable(i, enable); + } + mask <<= 1; + } + } + return ret_code; +} + +uint32_t app_gpiote_user_enable(app_gpiote_user_id_t user_id) +{ + uint32_t ret_code = NRF_SUCCESS; + + if (mp_users[user_id].enabled == false) + { + ret_code = user_enable(user_id, true); + if (ret_code != NRF_SUCCESS) + { + return ret_code; + } + else + { + mp_users[user_id].enabled = true; + return ret_code; + } + } + else + { + return ret_code; + } +} + +uint32_t app_gpiote_user_disable(app_gpiote_user_id_t user_id) +{ + uint32_t ret_code = NRF_SUCCESS; + + if (mp_users[user_id].enabled) + { + mp_users[user_id].enabled = false; + ret_code = user_enable(user_id, false); + } + + return ret_code; +} + +uint32_t app_gpiote_pins_state_get(app_gpiote_user_id_t user_id, uint32_t * p_pins) +{ + gpiote_user_t * p_user; + uint32_t ret_code = error_check(user_id); + + if (ret_code == NRF_SUCCESS) + { + p_user = &mp_users[user_id]; + // Get pins. + *p_pins = nrf_gpio_pins_read() & p_user->pins_mask; + + } + return ret_code; +} diff --git a/components/libraries/gpiote/app_gpiote.h b/components/libraries/gpiote/app_gpiote.h new file mode 100644 index 0000000..a063d5b --- /dev/null +++ b/components/libraries/gpiote/app_gpiote.h @@ -0,0 +1,219 @@ +/* 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_gpiote GPIOTE Handler + * @{ + * @ingroup app_common + * + * @brief GPIOTE handler module. + * + * @details The GPIOTE handler allows several modules ("users") to share the GPIOTE interrupt, + * each user defining a set of pins able to generate events to the user. + * When a GPIOTE interrupt occurs, the GPIOTE interrupt handler will call the event handler + * of each user for which at least one of the pins generated an event. + * + * The GPIOTE users are responsible for configuring all their corresponding pins, except + * the SENSE field, which should be initialized to GPIO_PIN_CNF_SENSE_Disabled. + * The SENSE field will be updated by the GPIOTE module when it is enabled or disabled, + * and also while it is enabled. + * + * The module specifies on which pins events should be generated if the pin(s) goes + * from low->high or high->low or both directions. + * + * @note Even if the application is using the @ref app_scheduler, the GPIOTE event handlers will + * be called directly from the GPIOTE interrupt handler. + * + * @warning If multiple users registers for the same pins the behavior for those pins are undefined. + */ + +#ifndef APP_GPIOTE_H__ +#define APP_GPIOTE_H__ + +#include +#include +#include "nrf.h" +#include "app_error.h" +#include "app_util.h" + +#define GPIOTE_USER_NODE_SIZE 24 /**< Size of app_gpiote.gpiote_user_t (only for use inside APP_GPIOTE_BUF_SIZE()). */ +#define NO_OF_PINS 32 /**< Number of GPIO pins on the \nRFXX chip. */ + +/**@brief Compute number of bytes required to hold the GPIOTE data structures. + * + * @param[in] MAX_USERS Maximum number of GPIOTE users. + * + * @retval Required buffer size (in bytes). + */ +#define APP_GPIOTE_BUF_SIZE(MAX_USERS) ((MAX_USERS) * GPIOTE_USER_NODE_SIZE) + +typedef uint8_t app_gpiote_user_id_t; + +/**@brief GPIOTE event handler type. */ +typedef void (*app_gpiote_event_handler_t)(uint32_t event_pins_low_to_high, + uint32_t event_pins_high_to_low); + +/**@brief GPIOTE input event handler type. */ +typedef void (*app_gpiote_input_event_handler_t)(void); + +/**@brief Macro for initializing the GPIOTE module. + * + * @details It will handle dimensioning and allocation of the memory buffer required by the module, + * making sure that the buffer is correctly aligned. + * + * @param[in] MAX_USERS Maximum number of GPIOTE users. + * + * @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). + */ +/*lint -emacro(506, APP_GPIOTE_INIT) */ /* Suppress "Constant value Boolean */ +#define APP_GPIOTE_INIT(MAX_USERS) \ + do \ + { \ + static uint32_t app_gpiote_buf[CEIL_DIV(APP_GPIOTE_BUF_SIZE(MAX_USERS), sizeof(uint32_t))];\ + uint32_t ERR_CODE = app_gpiote_init((MAX_USERS), app_gpiote_buf); \ + APP_ERROR_CHECK(ERR_CODE); \ + } while (0) + +/**@brief Function for initializing the GPIOTE module. + * + * @note Normally initialization should be done using the APP_GPIOTE_INIT() macro, as that will + * allocate the buffer needed by the GPIOTE module (including aligning the buffer correctly). + * + * @param[in] max_users Maximum number of GPIOTE users. + * @param[in] p_buffer Pointer to memory buffer for internal use in the app_gpiote + * module. The size of the buffer can be computed using the + * APP_GPIOTE_BUF_SIZE() macro. The buffer must be aligned to + * a 4 byte boundary. + * + * @retval NRF_SUCCESS Successful initialization. + * @retval NRF_ERROR_INVALID_PARAM Invalid parameter (buffer not aligned to a 4 byte + * boundary). + */ +uint32_t app_gpiote_init(uint8_t max_users, void * p_buffer); + +/**@brief Function for registering a GPIOTE user. + * + * @param[out] p_user_id Id for the new GPIOTE user. + * @param[in] pins_low_to_high_mask Mask defining which pins will generate events to this user + * when state is changed from low->high. + * @param[in] pins_high_to_low_mask Mask defining which pins will generate events to this user + * when state is changed from high->low. + * @param[in] event_handler Pointer to function to be executed when an event occurs. + * + * @retval NRF_SUCCESS Successful initialization. + * @retval NRF_ERROR_INVALID_PARAM Invalid parameter (buffer not aligned to a 4 byte boundary). + * @retval NRF_ERROR_INALID_STATE If @ref app_gpiote_init has not been called on the GPIOTE + * module. + * @retval NRF_ERROR_NO_MEM Returned if the application tries to register more users + * than defined when the GPIOTE module was initialized in + * @ref app_gpiote_init. + */ +uint32_t app_gpiote_user_register(app_gpiote_user_id_t * p_user_id, + uint32_t pins_low_to_high_mask, + uint32_t pins_high_to_low_mask, + app_gpiote_event_handler_t event_handler); + +/**@brief Function for informing the GPIOTE module that the specified user wants to use the GPIOTE module. + * + * @param[in] user_id Id of user to enable. + * + * @retval NRF_SUCCESS On success. + * @retval NRF_ERROR_INVALID_PARAM Invalid user_id provided, No a valid user. + * @retval NRF_ERROR_INALID_STATE If @ref app_gpiote_init has not been called on the GPIOTE + * module. + */ +uint32_t app_gpiote_user_enable(app_gpiote_user_id_t user_id); + +/**@brief Function for informing the GPIOTE module that the specified user is done using the GPIOTE module. + * + * @param[in] user_id Id of user to enable. + * + * @retval NRF_SUCCESS On success. + * @retval NRF_ERROR_INVALID_PARAM Invalid user_id provided, No a valid user. + * @retval NRF_ERROR_INALID_STATE If @ref app_gpiote_init has not been called on the GPIOTE + * module. + */ +uint32_t app_gpiote_user_disable(app_gpiote_user_id_t user_id); + +/**@brief Function for getting the state of the pins which are registered for the specified user. + * + * @param[in] user_id Id of user to check. + * @param[out] p_pins Bit mask corresponding to the pins configured to generate events to + * the specified user. All bits corresponding to pins in the state + * 'high' will have value '1', all others will have value '0'. + * + * @retval NRF_SUCCESS On success. + * @retval NRF_ERROR_INVALID_PARAM Invalid user_id provided, No a valid user. + * @retval NRF_ERROR_INALID_STATE If @ref app_gpiote_init has not been called on the GPIOTE + * module. + */ +uint32_t app_gpiote_pins_state_get(app_gpiote_user_id_t user_id, uint32_t * p_pins); + +/**@brief Function for registering event handlers for GPIOTE IN events. + * + * @param[in] channel GPIOTE channel [0..3]. + * @param[in] pin Pins associated with GPIOTE channel. Changes on following pins will generate events. + * @param[in] polarity Specify operation on input that shall trigger IN event. + * @param[in] event_handler Event handler invoked on the IN event in the GPIOTE interrupt. + * + * @retval NRF_SUCCESS On success. + * @retval NRF_ERROR_INVALID_PARAM Invalid channel or pin number. + * @retval NRF_ERROR_NOT_SUPPORTED Driver doesn't support IN events. + */ +uint32_t app_gpiote_input_event_handler_register(const uint8_t channel, + const uint32_t pin, + const uint32_t polarity, + app_gpiote_input_event_handler_t event_handler); + +/**@brief Function for unregistering event handlers for GPIOTE IN events. + * + * @retval NRF_SUCCESS On success. + * @retval NRF_ERROR_NOT_SUPPORTED Driver doesn't support IN events. + */ +uint32_t app_gpiote_input_event_handler_unregister(const uint8_t channel); + +/**@brief Function for registering event handler invoked at the end of a GPIOTE interrupt. + * + * @param[in] event_handler Event handler invoked at the end of the GPIOTE interrupt. + * + * @retval NRF_SUCCESS On success. + * @retval NRF_ERROR_NOT_SUPPORTED Driver doesn't support IN events. + */ +uint32_t app_gpiote_end_irq_event_handler_register(app_gpiote_input_event_handler_t event_handler); + +/**@brief Function for unregistering event handler invoked at the end of a GPIOTE interrupt. + * + * @retval NRF_SUCCESS On success. + * @retval NRF_ERROR_NOT_SUPPORTED Driver doesn't support IN events. + */ +uint32_t app_gpiote_end_irq_event_handler_unregister(void); + +/**@brief Function for enabling interrupts in the GPIOTE driver. + * + * @retval NRF_SUCCESS On success. + * @retval NRF_ERROR_NOT_SUPPORTED Driver doesn't support. + */ +uint32_t app_gpiote_enable_interrupts(void); + +/**@brief Function for disabling interrupts in the GPIOTE driver. + * + * @retval NRF_SUCCESS On success. + * @retval NRF_ERROR_NOT_SUPPORTED Driver doesn't support. + */ +uint32_t app_gpiote_disable_interrupts(void); + + +#endif // APP_GPIOTE_H__ + +/** @} */ diff --git a/components/libraries/gpiote/app_gpiote_fast_detect.c b/components/libraries/gpiote/app_gpiote_fast_detect.c new file mode 100644 index 0000000..acec54e --- /dev/null +++ b/components/libraries/gpiote/app_gpiote_fast_detect.c @@ -0,0 +1,539 @@ +/* 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 "app_gpiote.h" +#include +#include +#include "app_util.h" +#include "app_util_platform.h" +#include "nrf_error.h" +#include "nrf_gpio.h" + +#define NRF51_GPIOTE_CHANNEL 4 +#define NRF51_PINS 31 + +#ifdef NRF51 +#define SWI_IRQHandler SWI1_IRQHandler +#define SWI_IRQn SWI1_IRQn +#elif defined NRF52 +#define SWI_IRQHandler SWI1_EGU1_IRQHAndler +#define SWI_IRQn SWI1_EGU1_IRQn +#endif + +/**@brief GPIOTE user type. */ +typedef struct +{ + uint32_t pins_mask; /**< Mask defining which pins user wants to monitor. */ + uint32_t pins_low_to_high_mask; /**< Mask defining which pins will generate events to this user when toggling low->high. */ + uint32_t pins_high_to_low_mask; /**< Mask defining which pins will generate events to this user when toggling high->low. */ + uint32_t sense_high_pins; /**< Mask defining which pins are configured to generate GPIOTE interrupt on transition to high level. */ + app_gpiote_event_handler_t event_handler; /**< Pointer to function to be executed when an event occurs. */ +} gpiote_user_t; + +STATIC_ASSERT(sizeof (gpiote_user_t) <= GPIOTE_USER_NODE_SIZE); +STATIC_ASSERT(sizeof (gpiote_user_t) % 4 == 0); + +static uint32_t m_enabled_users_mask; /**< Mask for tracking which users are enabled. */ +static uint8_t m_user_array_size; /**< Size of user array. */ +static uint8_t m_user_count; /**< Number of registered users. */ +static gpiote_user_t * mp_users = NULL; /**< Array of GPIOTE users. */ + + +static app_gpiote_input_event_handler_t m_app_gpiote_input_event_handlers[4] = {0}; + +static app_gpiote_input_event_handler_t m_app_gpiote_end_irq_event_handler = NULL; + +/**@brief Function for toggling sense level for specified pins. + * + * @param[in] p_user Pointer to user structure. + * @param[in] pins Bitmask specifying for which pins the sense level is to be toggled. + */ +static void sense_level_toggle(gpiote_user_t * p_user, uint32_t pins) +{ + uint32_t pin_no; + + for (pin_no = 0; pin_no < NO_OF_PINS; pin_no++) + { + uint32_t pin_mask = (1 << pin_no); + + if ((pins & pin_mask) != 0) + { + uint32_t sense; + + //Invert sensing. + if ((p_user->sense_high_pins & pin_mask) == 0) + { + sense = GPIO_PIN_CNF_SENSE_High << GPIO_PIN_CNF_SENSE_Pos; + p_user->sense_high_pins |= pin_mask; + } + else + { + sense = GPIO_PIN_CNF_SENSE_Low << GPIO_PIN_CNF_SENSE_Pos; + p_user->sense_high_pins &= ~pin_mask; + } + + NRF_GPIO->PIN_CNF[pin_no] &= ~GPIO_PIN_CNF_SENSE_Msk; + NRF_GPIO->PIN_CNF[pin_no] |= sense; + } + } +} + + +/**@brief Function for handling the GPIOTE interrupt. + */ +void GPIOTE_IRQHandler(void) +{ + bool gpiote_in_evt = false; + bool gpiote_port_evt = false; + + if ((NRF_GPIOTE->EVENTS_IN[0] == 1) && (NRF_GPIOTE->INTENSET & GPIOTE_INTENSET_IN0_Msk)) + { + NRF_GPIOTE->EVENTS_IN[0] = 0; + gpiote_in_evt = true; + + if (m_app_gpiote_input_event_handlers[0]) + { + m_app_gpiote_input_event_handlers[0](); + } + } + + if ((NRF_GPIOTE->EVENTS_IN[1] == 1) && (NRF_GPIOTE->INTENSET & GPIOTE_INTENSET_IN1_Msk)) + { + NRF_GPIOTE->EVENTS_IN[1] = 0; + gpiote_in_evt = true; + + if (m_app_gpiote_input_event_handlers[1]) + { + m_app_gpiote_input_event_handlers[1](); + } + } + + if ((NRF_GPIOTE->EVENTS_IN[2] == 1) && (NRF_GPIOTE->INTENSET & GPIOTE_INTENSET_IN2_Msk)) + { + NRF_GPIOTE->EVENTS_IN[2] = 0; + gpiote_in_evt = true; + + if (m_app_gpiote_input_event_handlers[2]) + { + m_app_gpiote_input_event_handlers[2](); + } + } + + if ((NRF_GPIOTE->EVENTS_IN[3] == 1) && (NRF_GPIOTE->INTENSET & GPIOTE_INTENSET_IN3_Msk)) + { + NRF_GPIOTE->EVENTS_IN[3] = 0; + gpiote_in_evt = true; + + if (m_app_gpiote_input_event_handlers[3]) + { + m_app_gpiote_input_event_handlers[3](); + } + } + + if ((NRF_GPIOTE->EVENTS_PORT == 1) && (NRF_GPIOTE->INTENSET & GPIOTE_INTENSET_PORT_Msk)) + { + //Clear event. + NRF_GPIOTE->EVENTS_PORT = 0; + + gpiote_port_evt = true; + } + + if (m_app_gpiote_end_irq_event_handler && gpiote_in_evt) + { + m_app_gpiote_end_irq_event_handler(); + } + + if (gpiote_port_evt) + { + NVIC_SetPendingIRQ(SWI_IRQn); + } +} + + +/**@brief Function for handling the SWI1 interrupt. + */ +void SWI_IRQHandler(void) +{ + uint8_t i; + uint32_t pins_changed; + uint32_t pins_state = NRF_GPIO->IN; + + //Check all users. + for (i = 0; i < m_user_count; i++) + { + gpiote_user_t * p_user = &mp_users[i]; + + //Check if user is enabled. + if (((1 << i) & m_enabled_users_mask) != 0) + { + uint32_t transition_pins; + uint32_t event_low_to_high; + uint32_t event_high_to_low; + + //Find set of pins on which there has been a transition. + transition_pins = (pins_state ^ ~p_user->sense_high_pins) & p_user->pins_mask; + + //Toggle SENSE level for all pins that have changed state. + sense_level_toggle(p_user, transition_pins); + + //Second read after setting sense. + //Check if any pins have changed while serving this interrupt. + pins_changed = NRF_GPIO->IN ^ pins_state; + + if (pins_changed) + { + //Transition pins detected in late stage. + uint32_t late_transition_pins; + + pins_state |= pins_changed; + + //Find set of pins on which there has been a transition. + late_transition_pins = (pins_state ^ ~p_user->sense_high_pins) & p_user->pins_mask; + + //Toggle SENSE level for all pins that have changed state in last phase. + sense_level_toggle(p_user, late_transition_pins); + + //Update pins that has changed state since the interrupt occurred. + transition_pins |= late_transition_pins; + } + + //Call user event handler if an event has occurred. + event_high_to_low = (~pins_state & p_user->pins_high_to_low_mask) & transition_pins; + event_low_to_high = (pins_state & p_user->pins_low_to_high_mask) & transition_pins; + + if ((event_low_to_high | event_high_to_low) != 0) + { + p_user->event_handler(event_low_to_high, event_high_to_low); + } + } + } +} + + +/**@brief Function for enabling interrupt SWI1. + */ +static void app_gpiote_swi1_enable_irq(void) +{ + NVIC_ClearPendingIRQ(SWI_IRQn); + NVIC_SetPriority(SWI_IRQn, APP_IRQ_PRIORITY_LOW); + NVIC_EnableIRQ(SWI_IRQn); +} + +/**@brief Function for disabling interrupt SWI1. + */ +static void app_gpiote_swi1_disable_irq(void) +{ + NVIC_DisableIRQ(SWI_IRQn); +} + +/**@brief Function for sense disabling for all pins for specified user. + * + * @param[in] user_id User id. + */ +static void pins_sense_disable(app_gpiote_user_id_t user_id) +{ + uint32_t pin_no; + + for (pin_no = 0; pin_no < 32; pin_no++) + { + if ((mp_users[user_id].pins_mask & (1 << pin_no)) != 0) + { + NRF_GPIO->PIN_CNF[pin_no] &= ~GPIO_PIN_CNF_SENSE_Msk; + NRF_GPIO->PIN_CNF[pin_no] |= GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos; + } + } +} + + +uint32_t app_gpiote_init(uint8_t max_users, void * p_buffer) +{ + if (p_buffer == NULL) + { + return NRF_ERROR_INVALID_PARAM; + } + + //Check that buffer is correctly aligned. + if (!is_word_aligned(p_buffer)) + { + return NRF_ERROR_INVALID_PARAM; + } + + //Initialize file globals. + mp_users = (gpiote_user_t *)p_buffer; + m_user_array_size = max_users; + m_user_count = 0; + m_enabled_users_mask = 0; + + memset(mp_users, 0, m_user_array_size * sizeof (gpiote_user_t)); + + (void)app_gpiote_enable_interrupts(); + + return NRF_SUCCESS; +} + +uint32_t app_gpiote_user_register(app_gpiote_user_id_t * p_user_id, + uint32_t pins_low_to_high_mask, + uint32_t pins_high_to_low_mask, + app_gpiote_event_handler_t event_handler) +{ + //Check state and parameters. + if (mp_users == NULL) + { + return NRF_ERROR_INVALID_STATE; + } + + if (event_handler == NULL) + { + return NRF_ERROR_INVALID_PARAM; + } + + if (m_user_count >= m_user_array_size) + { + return NRF_ERROR_NO_MEM; + } + + //Allocate new user. + mp_users[m_user_count].pins_mask = pins_low_to_high_mask | pins_high_to_low_mask; + mp_users[m_user_count].pins_low_to_high_mask = pins_low_to_high_mask; + mp_users[m_user_count].pins_high_to_low_mask = pins_high_to_low_mask; + mp_users[m_user_count].event_handler = event_handler; + + *p_user_id = m_user_count++; + + //Make sure SENSE is disabled for all pins. + pins_sense_disable(*p_user_id); + + return NRF_SUCCESS; +} + +uint32_t app_gpiote_enable_interrupts(void) +{ + NVIC_ClearPendingIRQ(GPIOTE_IRQn); + NVIC_SetPriority(GPIOTE_IRQn, APP_IRQ_PRIORITY_HIGH); + NVIC_EnableIRQ(GPIOTE_IRQn); + + //Enable interrupt SWI1. + app_gpiote_swi1_enable_irq(); + + return NRF_SUCCESS; +} + +uint32_t app_gpiote_disable_interrupts(void) +{ + NVIC_DisableIRQ(GPIOTE_IRQn); + + //Disable interrupt SWI1. + app_gpiote_swi1_disable_irq(); + + return NRF_SUCCESS; +} + +uint32_t app_gpiote_input_event_handler_register(const uint8_t channel, + const uint32_t pin, + const uint32_t polarity, + app_gpiote_input_event_handler_t event_handler) +{ + if (channel < NRF51_GPIOTE_CHANNEL && pin < NRF51_PINS) + { + NRF_GPIOTE->CONFIG[channel] = (GPIOTE_CONFIG_MODE_Event << GPIOTE_CONFIG_MODE_Pos) | + (pin << GPIOTE_CONFIG_PSEL_Pos) | + (polarity << GPIOTE_CONFIG_POLARITY_Pos); + + switch (channel) + { + case 0: + NRF_GPIOTE->INTENSET |= (GPIOTE_INTENSET_IN0_Enabled << GPIOTE_INTENSET_IN0_Pos); + break; + + case 1: + NRF_GPIOTE->INTENSET |= (GPIOTE_INTENSET_IN1_Enabled << GPIOTE_INTENSET_IN1_Pos); + break; + + case 2: + NRF_GPIOTE->INTENSET |= (GPIOTE_INTENSET_IN2_Enabled << GPIOTE_INTENSET_IN2_Pos); + break; + + case 3: + NRF_GPIOTE->INTENSET |= (GPIOTE_INTENSET_IN3_Enabled << GPIOTE_INTENSET_IN3_Pos); + break; + + default: + break; + } + + m_app_gpiote_input_event_handlers[channel] = event_handler; + + return NRF_SUCCESS; + } + + return NRF_ERROR_INVALID_PARAM; +} + +uint32_t app_gpiote_input_event_handler_unregister(const uint8_t channel) +{ + if (channel < NRF51_GPIOTE_CHANNEL) + { + const uint32_t pin_not_connected = 31UL; + + NRF_GPIOTE->CONFIG[channel] = (GPIOTE_CONFIG_MODE_Disabled << GPIOTE_CONFIG_MODE_Pos) | + (pin_not_connected << GPIOTE_CONFIG_PSEL_Pos) | + (GPIOTE_CONFIG_POLARITY_Toggle << GPIOTE_CONFIG_POLARITY_Pos); + + switch (channel) + { + case 0: + NRF_GPIOTE->INTENSET |= (GPIOTE_INTENSET_IN0_Disabled << GPIOTE_INTENSET_IN0_Pos); + break; + + case 1: + NRF_GPIOTE->INTENSET |= (GPIOTE_INTENSET_IN1_Disabled << GPIOTE_INTENSET_IN1_Pos); + break; + + case 2: + NRF_GPIOTE->INTENSET |= (GPIOTE_INTENSET_IN2_Disabled << GPIOTE_INTENSET_IN2_Pos); + break; + + case 3: + NRF_GPIOTE->INTENSET |= (GPIOTE_INTENSET_IN3_Disabled << GPIOTE_INTENSET_IN3_Pos); + break; + + default: + break; + } + + m_app_gpiote_input_event_handlers[channel] = NULL; + + return NRF_SUCCESS; + } + + return NRF_ERROR_INVALID_PARAM; +} + +uint32_t app_gpiote_end_irq_event_handler_register(app_gpiote_input_event_handler_t event_handler) +{ + m_app_gpiote_end_irq_event_handler = event_handler; + return NRF_SUCCESS; +} + +uint32_t app_gpiote_end_irq_event_handler_unregister(void) +{ + m_app_gpiote_end_irq_event_handler = NULL; + return NRF_SUCCESS; +} + +uint32_t app_gpiote_user_enable(app_gpiote_user_id_t user_id) +{ + uint32_t pin_no; + uint32_t pins_state; + + //Check state and parameters. + if (mp_users == NULL) + { + return NRF_ERROR_INVALID_STATE; + } + + if (user_id >= m_user_count) + { + return NRF_ERROR_INVALID_PARAM; + } + + //Clear any pending event. + NRF_GPIOTE->EVENTS_PORT = 0; + pins_state = NRF_GPIO->IN; + + //Enable user. + if (m_enabled_users_mask == 0) + { + NRF_GPIOTE->INTENSET = GPIOTE_INTENSET_PORT_Msk; + } + m_enabled_users_mask |= (1 << user_id); + + //Enable sensing for all pins for specified user. + mp_users[user_id].sense_high_pins = 0; + + for (pin_no = 0; pin_no < 32; pin_no++) + { + uint32_t pin_mask = (1 << pin_no); + + if ((mp_users[user_id].pins_mask & pin_mask) != 0) + { + uint32_t sense; + + if ((pins_state & pin_mask) != 0) + { + sense = GPIO_PIN_CNF_SENSE_Low << GPIO_PIN_CNF_SENSE_Pos; + } + else + { + sense = GPIO_PIN_CNF_SENSE_High << + GPIO_PIN_CNF_SENSE_Pos; + mp_users[user_id].sense_high_pins |= pin_mask; + } + + NRF_GPIO->PIN_CNF[pin_no] &= ~GPIO_PIN_CNF_SENSE_Msk; + NRF_GPIO->PIN_CNF[pin_no] |= sense; + } + } + + return NRF_SUCCESS; +} + + +uint32_t app_gpiote_user_disable(app_gpiote_user_id_t user_id) +{ + //Check state and parameters. + if (mp_users == NULL) + { + return NRF_ERROR_INVALID_STATE; + } + + if (user_id >= m_user_count) + { + return NRF_ERROR_INVALID_PARAM; + } + + //Disable sensing for all pins for specified user. + pins_sense_disable(user_id); + + //Disable user. + m_enabled_users_mask &= ~(1UL << user_id); + + if (m_enabled_users_mask == 0) + { + NRF_GPIOTE->INTENCLR = GPIOTE_INTENSET_PORT_Msk; + } + + return NRF_SUCCESS; +} + + +uint32_t app_gpiote_pins_state_get(app_gpiote_user_id_t user_id, uint32_t * p_pins) +{ + gpiote_user_t * p_user; + + //Check state and parameters. + if (mp_users == NULL) + { + return NRF_ERROR_INVALID_STATE; + } + + if (user_id >= m_user_count) + { + return NRF_ERROR_INVALID_PARAM; + } + + //Get pins. + p_user = &mp_users[user_id]; + *p_pins = NRF_GPIO->IN & p_user->pins_mask; + + return NRF_SUCCESS; +} diff --git a/components/libraries/hci/config/hci_mem_pool_internal.h b/components/libraries/hci/config/hci_mem_pool_internal.h new file mode 100644 index 0000000..f1fa77f --- /dev/null +++ b/components/libraries/hci/config/hci_mem_pool_internal.h @@ -0,0 +1,32 @@ +/* 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. + * + */ + +/** @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/components/libraries/hci/config/hci_transport_config.h b/components/libraries/hci/config/hci_transport_config.h new file mode 100644 index 0000000..86a55e3 --- /dev/null +++ b/components/libraries/hci/config/hci_transport_config.h @@ -0,0 +1,40 @@ +/* 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. + * + */ + +/** @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/components/libraries/hci/hci_mem_pool.c b/components/libraries/hci/hci_mem_pool.c new file mode 100644 index 0000000..5213f32 --- /dev/null +++ b/components/libraries/hci/hci_mem_pool.c @@ -0,0 +1,235 @@ +/* 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 "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/components/libraries/hci/hci_mem_pool.h b/components/libraries/hci/hci_mem_pool.h new file mode 100644 index 0000000..bc178d0 --- /dev/null +++ b/components/libraries/hci/hci_mem_pool.h @@ -0,0 +1,132 @@ +/* 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. + * + */ + +/** @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/components/libraries/hci/hci_slip.c b/components/libraries/hci/hci_slip.c new file mode 100644 index 0000000..2ef69c3 --- /dev/null +++ b/components/libraries/hci/hci_slip.c @@ -0,0 +1,428 @@ +/* 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 "hci_slip.h" +#include +#include "hci_transport_config.h" +#include "app_uart.h" +#include "nrf_error.h" + +#define APP_SLIP_END 0xC0 /**< SLIP code for identifying the beginning and end of a packet frame.. */ +#define APP_SLIP_ESC 0xDB /**< SLIP escape code. This code is used to specify that the following character is specially encoded. */ +#define APP_SLIP_ESC_END 0xDC /**< SLIP special code. When this code follows 0xDB, this character is interpreted as payload data 0xC0.. */ +#define APP_SLIP_ESC_ESC 0xDD /**< SLIP special code. When this code follows 0xDB, this character is interpreted as payload data 0xDB. */ + +/** @brief States for the SLIP state machine. */ +typedef enum +{ + SLIP_OFF, /**< SLIP state OFF. */ + SLIP_READY, /**< SLIP state ON. */ + SLIP_TRANSMITTING, /**< SLIP state is transmitting indicating write() has been called but data transmission has not completed. */ +} slip_states_t; + +static slip_states_t m_current_state = SLIP_OFF; /** Current state for the SLIP TX state machine. */ + +static hci_slip_event_handler_t m_slip_event_handler; /** Event callback function for handling of SLIP events, @ref hci_slip_evt_type_t . */ + +static const uint8_t * mp_tx_buffer; /** Pointer to the current TX buffer that is in transmission. */ +static uint32_t m_tx_buffer_length; /** Length of the current TX buffer that is in transmission. */ +static volatile uint32_t m_tx_buffer_index; /** Current index for next byte to transmit in the mp_tx_buffer. */ + +static uint8_t * mp_rx_buffer; /** Pointer to the current RX buffer where the next SLIP decoded packet will be stored. */ +static uint32_t m_rx_buffer_length; /** Length of the current RX buffer. */ +static uint32_t m_rx_received_count; /** Number of SLIP decoded bytes received and stored in mp_rx_buffer. */ + + +/**@brief Function for parsing bytes received on the UART until a SLIP escape byte is received. + * + * @param[in] byte Byte received in UART module. + */ +static void handle_rx_byte_default(uint8_t byte); + +/**@brief Function for parsing bytes received on the UART until SLIP end byte is received. + * + * @param[in] byte Byte received in UART module. + */ +static void handle_rx_byte_wait_start(uint8_t byte); + +/**@brief Function for decoding a received SLIP escape byte. + * It will ensure correct decoding of the byte following the SLIP escape byte. + * + * @param[in] byte Byte received in UART module. + */ +static void handle_rx_byte_esc(uint8_t byte); + +/**@brief Function pointer for parsing and decoding SLIP bytes from the UART module. + * + * @param[in] byte Byte received in UART module. + */ +static void (*handle_rx_byte) (uint8_t byte) = handle_rx_byte_wait_start; + +/**@brief Function pointer for sending a byte through the UART module. + */ +static uint32_t send_tx_byte_default(void); + +/**@brief Function for transferring a SLIP escape byte (0xDB) when special bytes are transferred, + * that is 0xC0 and 0xDB. + */ +static uint32_t send_tx_byte_esc(void); + +/**@brief Function for transferring a byte when it collides with SLIP commands and follows the SLIP + * escape byte, that is 0xC0 => 0xDC and 0xDB => 0xDD. + */ +static uint32_t send_tx_byte_encoded(void); + +/**@brief Function for transferring the SLIP end frame byte, 0xC0. + */ +static uint32_t send_tx_byte_end(void); + +/**@brief Function pointer for sending a byte through the UART module. + */ +uint32_t (*send_tx_byte) (void) = send_tx_byte_default; + + +static uint32_t send_tx_byte_end(void) +{ + uint32_t err_code = app_uart_put(APP_SLIP_END); + + if ((err_code == NRF_SUCCESS) && (m_tx_buffer_index == 0)) + { + // Packet transmission started. + send_tx_byte = send_tx_byte_default; + } + + return err_code; +} + + +static uint32_t send_tx_byte_default(void) +{ + uint32_t err_code = app_uart_put(mp_tx_buffer[m_tx_buffer_index]); + + if (err_code == NRF_SUCCESS) + { + m_tx_buffer_index++; + } + + return err_code; +} + + +static uint32_t send_tx_byte_encoded(void) +{ + uint32_t err_code; + + switch(mp_tx_buffer[m_tx_buffer_index]) + { + case APP_SLIP_END: + err_code = app_uart_put(APP_SLIP_ESC_END); + break; + + case APP_SLIP_ESC: + err_code = app_uart_put(APP_SLIP_ESC_ESC); + break; + + default: + err_code = NRF_ERROR_NO_MEM; + break; + } + + if (err_code == NRF_SUCCESS) + { + m_tx_buffer_index++; + send_tx_byte = send_tx_byte_default; + } + + return err_code; +} + + +static uint32_t send_tx_byte_esc(void) +{ + uint32_t err_code = app_uart_put(APP_SLIP_ESC); + + if (err_code == NRF_SUCCESS) + { + send_tx_byte = send_tx_byte_encoded; + } + + return err_code; +} + + +/** @brief Function for transferring the content of the mp_tx_buffer to the UART. + * It continues to transfer bytes until the UART buffer is full or the complete buffer is + * transferred. + */ +static void transmit_buffer(void) +{ + uint32_t err_code = NRF_SUCCESS; + + while (m_tx_buffer_index < m_tx_buffer_length) + { + if ((mp_tx_buffer[m_tx_buffer_index] == APP_SLIP_END || + mp_tx_buffer[m_tx_buffer_index] == APP_SLIP_ESC) && + send_tx_byte == send_tx_byte_default) + { + send_tx_byte = send_tx_byte_esc; + } + + err_code = send_tx_byte(); + + if (err_code == NRF_ERROR_NO_MEM || err_code == NRF_ERROR_BUSY) + { + // No memory left in UART TX buffer. Abort and wait for APP_UART_TX_EMPTY to continue. + return; + } + } + + send_tx_byte = send_tx_byte_end; + + err_code = send_tx_byte(); + + if (err_code == NRF_SUCCESS) + { + // Packet transmission ended. Notify higher level. + m_current_state = SLIP_READY; + + if (m_slip_event_handler != NULL) + { + hci_slip_evt_t event = {HCI_SLIP_TX_DONE, mp_tx_buffer, m_tx_buffer_index}; + + m_slip_event_handler(event); + } + } +} + + +/** @brief Function for handling the reception of a SLIP end byte. + * If the number of bytes received is greater than zero it will call m_slip_event_handler + * with number of bytes received and invalidate the mp_rx_buffer to protect against data + * corruption. + * No new bytes can be received until a new RX buffer is supplied. + */ +static void handle_slip_end(void) +{ + if (m_rx_received_count > 0) + { + // Full packet received, push it up. + if (m_slip_event_handler != NULL) + { + hci_slip_evt_t event = {HCI_SLIP_RX_RDY, mp_rx_buffer, m_rx_received_count}; + + m_rx_received_count = 0; + mp_rx_buffer = NULL; + + m_slip_event_handler(event); + } + } +} + + +static void handle_rx_byte_esc(uint8_t byte) +{ + switch (byte) + { + case APP_SLIP_END: + handle_slip_end(); + break; + + case APP_SLIP_ESC_END: + mp_rx_buffer[m_rx_received_count++] = APP_SLIP_END; + break; + + case APP_SLIP_ESC_ESC: + mp_rx_buffer[m_rx_received_count++] = APP_SLIP_ESC; + break; + + default: + mp_rx_buffer[m_rx_received_count++] = byte; + break; + } + + handle_rx_byte = handle_rx_byte_default; +} + + +static void handle_rx_byte_default(uint8_t byte) +{ + switch (byte) + { + case APP_SLIP_END: + handle_slip_end(); + break; + + case APP_SLIP_ESC: + handle_rx_byte = handle_rx_byte_esc; + break; + + default: + mp_rx_buffer[m_rx_received_count++] = byte; + break; + } +} + + +static void handle_rx_byte_wait_start(uint8_t byte) +{ + if (byte == APP_SLIP_END) + { + handle_rx_byte = handle_rx_byte_default; + } +} + + +/** @brief Function for checking the current index and length of the RX buffer to determine if the + * buffer is full. If an event handler has been registered, the callback function will + * be executed.. + * + * @retval true If RX buffer has overflowed. + * @retval false otherwise. + * + */ +static bool rx_buffer_overflowed(void) +{ + if (mp_rx_buffer == NULL || m_rx_received_count >= m_rx_buffer_length) + { + if (m_slip_event_handler != NULL) + { + hci_slip_evt_t event = {HCI_SLIP_RX_OVERFLOW, mp_rx_buffer, m_rx_received_count}; + m_slip_event_handler(event); + } + + return true; + } + + return false; +} + + +/** @brief Function for handling the UART module event. It parses events from the UART when + * bytes are received/transmitted. + * + * @param[in] uart_event Event received from app_uart module. + */ +static void slip_uart_eventhandler(app_uart_evt_t * uart_event) +{ + if (uart_event->evt_type == APP_UART_TX_EMPTY && m_current_state == SLIP_TRANSMITTING) + { + transmit_buffer(); + } + + if ((uart_event->evt_type == APP_UART_DATA) && (!rx_buffer_overflowed())) + { + handle_rx_byte(uart_event->data.value); + } +} + + +/** @brief Function for enabling the UART module when the SLIP layer is opened. + */ +static uint32_t slip_uart_open(void) +{ + uint32_t err_code; + + app_uart_comm_params_t comm_params = + { + HCI_SLIP_UART_RX_PIN_NUMBER, + HCI_SLIP_UART_TX_PIN_NUMBER, + HCI_SLIP_UART_RTS_PIN_NUMBER, + HCI_SLIP_UART_CTS_PIN_NUMBER, + HCI_SLIP_UART_MODE, + false, + HCI_SLIP_UART_BAUDRATE + }; + + err_code = app_uart_init(&comm_params, + NULL, + slip_uart_eventhandler, + APP_IRQ_PRIORITY_LOW); + + if (err_code == NRF_SUCCESS) + { + m_current_state = SLIP_READY; + } + + return err_code; +} + + +uint32_t hci_slip_evt_handler_register(hci_slip_event_handler_t event_handler) +{ + m_slip_event_handler = event_handler; + + return NRF_SUCCESS; +} + + +uint32_t hci_slip_open() +{ + switch (m_current_state) + { + case SLIP_OFF: + return slip_uart_open(); + + default: + // Do nothing. + break; + } + + return NRF_SUCCESS; +} + + +uint32_t hci_slip_close() +{ + m_current_state = SLIP_OFF; + uint32_t err_code = app_uart_close(); + + return err_code; +} + + +uint32_t hci_slip_write(const uint8_t * p_buffer, uint32_t length) +{ + if (p_buffer == NULL) + { + return NRF_ERROR_INVALID_ADDR; + } + + switch (m_current_state) + { + case SLIP_READY: + m_tx_buffer_index = 0; + m_tx_buffer_length = length; + mp_tx_buffer = p_buffer; + m_current_state = SLIP_TRANSMITTING; + send_tx_byte = send_tx_byte_end; + + transmit_buffer(); + return NRF_SUCCESS; + + case SLIP_TRANSMITTING: + return NRF_ERROR_NO_MEM; + + case SLIP_OFF: + default: + return NRF_ERROR_INVALID_STATE; + } +} + + +uint32_t hci_slip_rx_buffer_register(uint8_t * p_buffer, uint32_t length) +{ + mp_rx_buffer = p_buffer; + m_rx_buffer_length = length; + m_rx_received_count = 0; + handle_rx_byte = handle_rx_byte_wait_start; + return NRF_SUCCESS; +} diff --git a/components/libraries/hci/hci_slip.h b/components/libraries/hci/hci_slip.h new file mode 100644 index 0000000..ad26f3b --- /dev/null +++ b/components/libraries/hci/hci_slip.h @@ -0,0 +1,129 @@ +/* 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. + * + */ + +/** @file + * + * @defgroup hci_slip SLIP module + * @{ + * @ingroup app_common + * + * @brief SLIP layer for supporting packet framing in HCI transport. + * + * @details This module implements SLIP packet framing as described in the Bluetooth Core + * Specification 4.0, Volume 4, Part D, Chapter 3 SLIP Layer. + * + * SLIP framing ensures that all packets sent on the UART are framed as: + * <0xC0> SLIP packet 1 <0xC0> <0xC0> SLIP packet 2 <0xC0>. + * + * The SLIP layer uses events to notify the upper layer when data transmission is complete + * and when a SLIP packet is received. + */ + +#ifndef HCI_SLIP_H__ +#define HCI_SLIP_H__ + +#include + +/**@brief Event types from the SLIP Layer. */ +typedef enum +{ + HCI_SLIP_RX_RDY, /**< An event indicating that an RX packet is ready to be read. */ + HCI_SLIP_TX_DONE, /**< An event indicating write completion of the TX packet provided in the function call \ref hci_slip_write . */ + HCI_SLIP_RX_OVERFLOW, /**< An event indicating that RX data has been discarded due to lack of free RX memory. */ + HCI_SLIP_ERROR, /**< An event indicating that an unrecoverable error has occurred. */ + HCI_SLIP_EVT_TYPE_MAX /**< Enumeration upper bound. */ +} hci_slip_evt_type_t; + +/**@brief Structure containing an event from the SLIP layer. + */ +typedef struct +{ + hci_slip_evt_type_t evt_type; /**< Type of event. */ + const uint8_t * packet; /**< This field contains a pointer to the packet for which the event relates, i.e. SLIP_TX_DONE: the packet transmitted, SLIP_RX_RDY: the packet received, SLIP_RX_OVERFLOW: The packet which overflow/or NULL if no receive buffer is available. */ + uint32_t packet_length; /**< Packet length, i.e. SLIP_TX_DONE: Bytes transmitted, SLIP_RX_RDY: Bytes received, SLIP_RX_OVERFLOW: index at which the packet overflowed. */ +} hci_slip_evt_t; + +/**@brief Function for the SLIP layer event callback. + */ +typedef void (*hci_slip_event_handler_t)(hci_slip_evt_t event); + +/**@brief Function for registering the event handler provided as parameter and this event handler + * will be used by SLIP layer to send events described in \ref hci_slip_evt_type_t. + * + * @note Multiple registration requests will overwrite any existing registration. + * + * @param[in] event_handler This function is called by the SLIP layer upon an event. + * + * @retval NRF_SUCCESS Operation success. + */ +uint32_t hci_slip_evt_handler_register(hci_slip_event_handler_t event_handler); + +/**@brief Function for opening the SLIP layer. This function must be called before + * \ref hci_slip_write and before any data can be received. + * + * @note Can be called multiple times. + * + * @retval NRF_SUCCESS Operation success. + * + * The SLIP layer module will propagate errors from underlying sub-modules. + * This implementation is using UART module as a physical transmission layer, and hci_slip_open + * executes \ref app_uart_init . For an extended error list, please refer to \ref app_uart_init . + */ +uint32_t hci_slip_open(void); + +/**@brief Function for closing the SLIP layer. After this function is called no data can be + * transmitted or received in this layer. + * + * @note This function can be called multiple times and also for an unopened channel. + * + * @retval NRF_SUCCESS Operation success. + */ +uint32_t hci_slip_close(void); + +/**@brief Function for writing a packet with SLIP encoding. Packet transmission is confirmed when + * the HCI_SLIP_TX_DONE event is received by the function caller. + * + * @param[in] p_buffer Pointer to the packet to transmit. + * @param[in] length Packet length, in bytes. + * + * @retval NRF_SUCCESS Operation success. Packet was encoded and added to the + * transmission queue and an event will be sent upon transmission + * completion. + * @retval NRF_ERROR_NO_MEM Operation failure. Transmission queue is full and packet was not + * added to the transmission queue. Application shall wait for + * the \ref HCI_SLIP_TX_DONE event. After HCI_SLIP_TX_DONE this + * function can be executed for transmission of next packet. + * @retval NRF_ERROR_INVALID_ADDR If a NULL pointer is provided. + * @retval NRF_ERROR_INVALID_STATE Operation failure. Module is not open. + */ +uint32_t hci_slip_write(const uint8_t * p_buffer, uint32_t length); + +/**@brief Function for registering a receive buffer. The receive buffer will be used for storage of + * received and SLIP decoded data. + * No data can be received by the SLIP layer until a receive buffer has been registered. + * + * @note The lifetime of the buffer must be valid during complete reception of data. A static + * buffer is recommended. + * + * @warning Multiple registration requests will overwrite any existing registration. + * + * @param[in] p_buffer Pointer to receive buffer. The received and SLIP decoded packet + * will be placed in this buffer. + * @param[in] length Buffer length, in bytes. + * + * @retval NRF_SUCCESS Operation success. + */ +uint32_t hci_slip_rx_buffer_register(uint8_t * p_buffer, uint32_t length); + +#endif // HCI_SLIP_H__ + +/** @} */ diff --git a/components/libraries/hci/hci_transport.c b/components/libraries/hci/hci_transport.c new file mode 100644 index 0000000..0d68fd4 --- /dev/null +++ b/components/libraries/hci/hci_transport.c @@ -0,0 +1,788 @@ +/* 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 "hci_transport_config.h" +#include "hci_transport.h" +#include "hci_slip.h" +#include "crc16.h" +#include "hci_mem_pool.h" +#include "hci_mem_pool_internal.h" +#include "nordic_common.h" +#include "compiler_abstraction.h" +#include "app_util.h" +#include "app_timer.h" +#include "app_error.h" +#include +#include + +#define PKT_HDR_SIZE 4u /**< Packet header size in number of bytes. */ +#define PKT_CRC_SIZE 2u /**< Packet CRC size in number of bytes. */ +#define PKT_TYPE_VENDOR_SPECIFIC 14u /**< Packet type vendor specific. */ +#define PKT_TYPE_ACK 0 /**< Packet type acknowledgement. */ +#define DATA_INTEGRITY_MASK (1u << 6u) /**< Mask for data integrity bit in the packet header. */ +#define RELIABLE_PKT_MASK (1u << 7u) /**< Mask for reliable packet bit in the packet header. */ +#define INITIAL_ACK_NUMBER_EXPECTED 1u /**< Initial acknowledge number expected. */ +#define INITIAL_ACK_NUMBER_TX INITIAL_ACK_NUMBER_EXPECTED /**< Initial acknowledge number transmitted. */ +#define INVALID_PKT_TYPE 0xFFFFFFFFu /**< Internal invalid packet type value. */ +#define MAX_TRANSMISSION_TIME (ROUNDED_DIV((MAX_PACKET_SIZE_IN_BITS * 1000u), USED_BAUD_RATE)) /**< Max transmission time of a single application packet over UART in units of mseconds. */ +#define RETRANSMISSION_TIMEOUT_IN_MS (3u * MAX_TRANSMISSION_TIME) /**< Retransmission timeout for application packet in units of mseconds. */ +#define APP_TIMER_PRESCALER 0 /**< Value of the RTC1 PRESCALER register. */ +#define RETRANSMISSION_TIMEOUT_IN_TICKS APP_TIMER_TICKS(RETRANSMISSION_TIMEOUT_IN_MS, APP_TIMER_PRESCALER) /**< Retransmission timeout for application packet in units of timer ticks. */ +#define MAX_RETRY_COUNT 5u /**< Max retransmission retry count for application packets. */ +#define ACK_BUF_SIZE 5u /**< Length of module internal RX buffer which is big enough to hold an acknowledgement packet. */ + +/**@brief States of the TX state machine. */ +typedef enum +{ + TX_STATE_IDLE, /**< State for: no application transmission packet processing in progress. */ + TX_STATE_PENDING, /**< State for: TX in progress in slip layer and TX-done event is waited for to signal the end of transmission. */ + TX_STATE_ACTIVE /**< State for: application packet has been delivered to slip for transmission and peer transport entity acknowledgement packet is waited for. */ +} tx_state_t; + +/**@brief TX state machine events. */ +typedef enum +{ + TX_EVENT_STATE_ENTRY, /**< Event for: state entry use case. */ + TX_EVENT_SLIP_TX_DONE, /**< Event for: HCI_SLIP_TX_DONE event use case. */ + TX_EVENT_TIMEOUT, /**< Event for: retransmission timeout use case. */ + TX_EVENT_VALID_RX_ACK /**< Event for: valid acknowledgement received for TX packet use case. */ +} tx_event_t; + +static void tx_sm_state_change(tx_state_t new_state); + +static tx_state_t m_tx_state; /**< Current TX state. */ +static hci_transport_tx_done_handler_t m_transport_tx_done_handle; /**< TX done event callback function. */ +static hci_transport_event_handler_t m_transport_event_handle; /**< Event handler callback function. */ +static uint8_t * mp_slip_used_rx_buffer; /**< Reference to RX buffer used by the slip layer. */ +static uint32_t m_packet_expected_seq_number; /**< Sequence number counter of the packet expected to be received . */ +static uint32_t m_packet_transmit_seq_number; /**< Sequence number counter of the transmitted packet for which acknowledgement packet is waited for. */ +static uint8_t * mp_tx_buffer; /**< Pointer to TX application buffer to be transmitted. */ +static uint32_t m_tx_buffer_length; /**< Length of application TX packet data to be transmitted in bytes. */ +static bool m_is_slip_decode_ready; /**< Boolean to determine has slip decode been completed or not. */ +APP_TIMER_DEF(m_app_timer_id); /**< Application timer id. */ +static uint32_t m_tx_retry_counter; /**< Application packet retransmission counter. */ +static hci_transport_tx_done_result_t m_tx_done_result_code; /**< TX done event callback function result code. */ +static uint8_t m_rx_ack_buffer[ACK_BUF_SIZE];/**< RX buffer big enough to hold an acknowledgement packet and which is taken in use upon receiving HCI_SLIP_RX_OVERFLOW event. */ + + +/**@brief Function for validating a received packet. + * + * @param[in] p_buffer Pointer to the packet data. + * @param[in] length Length of packet data in bytes. + * + * @return true if received packet is valid, false in other case. + */ +static bool is_rx_pkt_valid(const uint8_t * p_buffer, uint32_t length) +{ + // Executed packet filtering algorithm order: + // - verify packet overall length + // - verify data integrity bit set + // - verify reliable packet bit set + // - verify supported packet type + // - verify header checksum + // - verify payload length field + // - verify CRC + if (length <= PKT_HDR_SIZE) + { + return false; + } + + if (!(p_buffer[0] & DATA_INTEGRITY_MASK)) + { + return false; + } + + if (!(p_buffer[0] & RELIABLE_PKT_MASK)) + { + return false; + } + + if ((p_buffer[1] & 0x0Fu) != PKT_TYPE_VENDOR_SPECIFIC) + { + return false; + } + + const uint32_t expected_checksum = + ((p_buffer[0] + p_buffer[1] + p_buffer[2] + p_buffer[3])) & 0xFFu; + if (expected_checksum != 0) + { + return false; + } + + const uint16_t crc_calculated = crc16_compute(p_buffer, (length - PKT_CRC_SIZE), NULL); + const uint16_t crc_received = uint16_decode(&p_buffer[length - PKT_CRC_SIZE]); + if (crc_calculated != crc_received) + { + return false; + } + + return true; +} + + +/**@brief Function for getting the sequence number of the next reliable packet expected. + * + * @return sequence number of the next reliable packet expected. + */ +static __INLINE uint8_t packet_number_expected_get(void) +{ + return (uint8_t) m_packet_expected_seq_number; +} + + +/**@brief Function for calculating a packet header checksum. + * + * @param[in] p_hdr Pointer to the packet header. + * + * @return Calculated checksum. + */ +static uint8_t header_checksum_calculate(const uint8_t * p_hdr) +{ + // @note: no pointer validation check needed as already checked by calling function. + uint32_t checksum; + + checksum = p_hdr[0]; + checksum += p_hdr[1]; + checksum += p_hdr[2]; + checksum &= 0xFFu; + checksum = (~checksum + 1u); + + return (uint8_t)checksum; +} + + +/**@brief Function for writing an acknowledgment packet for transmission. + */ +static void ack_transmit(void) +{ + static uint8_t ack_packet[PKT_HDR_SIZE]; + + // TX ACK packet format: + // - Unreliable Packet type + // - Payload Length set to 0 + // - Sequence Number set to 0 + // - Header checksum calculated + // - Acknowledge Number set correctly + ack_packet[0] = (packet_number_expected_get() << 3u); + ack_packet[1] = 0; + ack_packet[2] = 0; + ack_packet[3] = header_checksum_calculate(ack_packet); + + // @note: no return value check needed for hci_slip_write(...) call as acknowledgement packets + // are considered to be from system design point of view unreliable packets.Use case where + // underlying slip layer does not accept a packet for transmission is managed either by: + // - acknowledged by possible future application packet as acknowledgement number header field + // is included + // - protocol peer entity will retransmit the packet + UNUSED_VARIABLE(hci_slip_write(ack_packet, sizeof(ack_packet))); +} + + +/**@brief Function for validating a received packet. + * + * @param[in] p_buffer Pointer to the packet data. + * + * @return sequence number field of the packet header with unrelated data masked out. + */ +static __INLINE uint8_t packet_seq_nmbr_extract(const uint8_t * p_buffer) +{ + return (p_buffer[0] & 0x07u); +} + + +/**@brief Function for incrementing the sequence number counter for next reliable packet expected. + */ +static __INLINE void packet_number_expected_inc(void) +{ + ++m_packet_expected_seq_number; + m_packet_expected_seq_number &= 0x07u; +} + + +/**@brief Function for decoding a packet type field. + * + * @param[in] p_buffer Pointer to the packet data. + * @param[in] length Length of packet data in bytes. + * + * @return Packet type field or INVALID_PKT_TYPE in case of decode error. + */ +static __INLINE uint32_t packet_type_decode(const uint8_t * p_buffer, uint32_t length) +{ + // @note: no pointer validation check needed as allready checked by calling function. + uint32_t return_value; + + if (length >= PKT_HDR_SIZE) + { + return_value = (p_buffer[1] & 0x0Fu); + } + else + { + return_value = INVALID_PKT_TYPE; + } + + return return_value; +} + + +/**@brief Function for processing a received vendor specific packet. + * + * @param[in] p_buffer Pointer to the packet data. + * @param[in] length Length of packet data in bytes. + */ +static void rx_vendor_specific_pkt_type_handle(const uint8_t * p_buffer, uint32_t length) +{ + // @note: no pointer validation check needed as allready checked by calling function. + uint32_t err_code; + + if (is_rx_pkt_valid(p_buffer, length)) + { + // RX packet is valid: validate sequence number. + const uint8_t rx_seq_number = packet_seq_nmbr_extract(p_buffer); + if (packet_number_expected_get() == rx_seq_number) + { + // Sequence number is valid: transmit acknowledgement. + packet_number_expected_inc(); + ack_transmit(); + + m_is_slip_decode_ready = true; + + err_code = hci_mem_pool_rx_data_size_set(length); + APP_ERROR_CHECK(err_code); + + err_code = hci_mem_pool_rx_produce(RX_BUF_SIZE, (void **)&mp_slip_used_rx_buffer); + APP_ERROR_CHECK_BOOL((err_code == NRF_SUCCESS) || (err_code == NRF_ERROR_NO_MEM)); + + // If memory pool RX buffer produce succeeded we register that buffer to slip layer + // otherwise we register the internal acknowledgement buffer. + err_code = hci_slip_rx_buffer_register( + (err_code == NRF_SUCCESS) ? mp_slip_used_rx_buffer : m_rx_ack_buffer, + (err_code == NRF_SUCCESS) ? RX_BUF_SIZE : ACK_BUF_SIZE); + + APP_ERROR_CHECK(err_code); + + if (m_transport_event_handle != NULL) + { + // Send application event of RX packet reception. + const hci_transport_evt_t evt = {HCI_TRANSPORT_RX_RDY}; + m_transport_event_handle(evt); + } + } + else + { + // RX packet discarded: sequence number not valid, set the same buffer to slip layer in + // order to avoid buffer overrun. + err_code = hci_slip_rx_buffer_register(mp_slip_used_rx_buffer, RX_BUF_SIZE); + APP_ERROR_CHECK(err_code); + + // As packet did not have expected sequence number: send acknowledgement with the + // current expected sequence number. + ack_transmit(); + } + } + else + { + // RX packet discarded: reset the same buffer to slip layer in order to avoid buffer + // overrun. + err_code = hci_slip_rx_buffer_register(mp_slip_used_rx_buffer, RX_BUF_SIZE); + APP_ERROR_CHECK(err_code); + } +} + + +/**@brief Function for getting the sequence number of a reliable TX packet for which peer protocol + * entity acknowledgment is pending. + * + * @return sequence number of a reliable TX packet for which peer protocol entity acknowledgement + * is pending. + */ +static __INLINE uint8_t packet_number_to_transmit_get(void) +{ + return m_packet_transmit_seq_number; +} + + +/**@brief Function for getting the expected acknowledgement number. + * + * @return expected acknowledgement number. + */ +static __INLINE uint8_t expected_ack_number_get(void) +{ + uint8_t seq_nmbr = packet_number_to_transmit_get(); + ++seq_nmbr; + seq_nmbr &= 0x07u; + + return seq_nmbr; +} + + +/**@brief Function for processing a received acknowledgement packet. + * + * Verifies does the received acknowledgement packet has the expected acknowledgement number and + * that the header checksum is correct. + * + * @param[in] p_buffer Pointer to the packet data. + * + * @return true if valid acknowledgement packet received. + */ +static __INLINE bool rx_ack_pkt_type_handle(const uint8_t * p_buffer) +{ + // @note: no pointer validation check needed as allready checked by calling function. + + // Verify header checksum. + const uint32_t expected_checksum = + ((p_buffer[0] + p_buffer[1] + p_buffer[2] + p_buffer[3])) & 0xFFu; + if (expected_checksum != 0) + { + return false; + } + + const uint8_t ack_number = (p_buffer[0] >> 3u) & 0x07u; + + // Verify expected acknowledgment number. + return (ack_number == expected_ack_number_get()); +} + + +/**@brief Function for incrementing the sequence number counter of the TX packet. + */ +static __INLINE void packet_number_tx_inc(void) +{ + ++m_packet_transmit_seq_number; + m_packet_transmit_seq_number &= 0x07u; +} + + +/**@brief Function for TX state machine event processing in a state centric manner. + * + * @param[in] event Type of event occurred. + */ +static void tx_sm_event_handle(tx_event_t event) +{ + uint32_t err_code; + + switch (m_tx_state) + { + case TX_STATE_IDLE: + if (event == TX_EVENT_STATE_ENTRY) + { + err_code = app_timer_stop(m_app_timer_id); + APP_ERROR_CHECK(err_code); + + // Send TX-done event if registered handler exists. + if (m_transport_tx_done_handle != NULL) + { + m_transport_tx_done_handle(m_tx_done_result_code); + } + } + break; + + case TX_STATE_PENDING: + if (event == TX_EVENT_SLIP_TX_DONE) + { + // @note: this call should always succeed as called from HCI_SLIP_TX_DONE context + // and error cases are managed by dedicated error event from the slip layer. + err_code = hci_slip_write(mp_tx_buffer, + (m_tx_buffer_length + PKT_HDR_SIZE + PKT_CRC_SIZE)); + APP_ERROR_CHECK(err_code); + tx_sm_state_change(TX_STATE_ACTIVE); + } + break; + + case TX_STATE_ACTIVE: + switch (event) + { + case TX_EVENT_VALID_RX_ACK: + // Tx sequence number counter incremented as packet transmission + // acknowledged by peer transport entity. + packet_number_tx_inc(); + tx_sm_state_change(TX_STATE_IDLE); + break; + + case TX_EVENT_STATE_ENTRY: + m_tx_retry_counter = 0; + err_code = app_timer_start(m_app_timer_id, + RETRANSMISSION_TIMEOUT_IN_TICKS, + NULL); + APP_ERROR_CHECK(err_code); + break; + + case TX_EVENT_TIMEOUT: + if (m_tx_retry_counter != MAX_RETRY_COUNT) + { + ++m_tx_retry_counter; + // @note: no return value check done for hci_slip_write(...) call as current + // system design allows use case where retransmission is not accepted by the + // slip layer due to existing acknowledgement packet transmission in the + // slip layer. + UNUSED_VARIABLE(hci_slip_write(mp_tx_buffer, + (m_tx_buffer_length + + PKT_HDR_SIZE + + PKT_CRC_SIZE))); + } + else + { + // Application packet retransmission count reached: + // - set correct TX done event callback function result code + // - execute state change + // @note: m_tx_retry_counter is reset in TX_STATE_ACTIVE state entry. + m_tx_done_result_code = HCI_TRANSPORT_TX_DONE_FAILURE; + tx_sm_state_change(TX_STATE_IDLE); + } + break; + + default: + // No implementation needed. + break; + } + break; + + default: + // No implementation needed. + break; + } +} + + +/**@brief Function for changing the state of the TX state machine. + * + * @param[in] new_state State TX state machine transits to. + */ +static void tx_sm_state_change(tx_state_t new_state) +{ + m_tx_state = new_state; + tx_sm_event_handle(TX_EVENT_STATE_ENTRY); +} + + +/**@brief Function for handling slip events. + * + * @param[in] event The event structure. + */ +void slip_event_handle(hci_slip_evt_t event) +{ + uint32_t return_code; + uint32_t err_code; + + switch (event.evt_type) + { + case HCI_SLIP_TX_DONE: + tx_sm_event_handle(TX_EVENT_SLIP_TX_DONE); + break; + + case HCI_SLIP_RX_RDY: + return_code = packet_type_decode(event.packet, event.packet_length); + + switch (return_code) + { + case PKT_TYPE_VENDOR_SPECIFIC: + rx_vendor_specific_pkt_type_handle(event.packet, event.packet_length); + break; + + case PKT_TYPE_ACK: + if (rx_ack_pkt_type_handle(event.packet)) + { + // Valid expected acknowledgement packet received: set correct TX done event + // callback function result code and execute state change. + m_tx_done_result_code = HCI_TRANSPORT_TX_DONE_SUCCESS; + tx_sm_event_handle(TX_EVENT_VALID_RX_ACK); + } + + /* fall-through */ + default: + // RX packet dropped: reset memory buffer to slip in order to avoid RX buffer + // overflow. + // If existing mem pool produced RX buffer exists reuse that one. If existing + // mem pool produced RX buffer does not exist try to produce new one. If + // producing fails use the internal acknowledgement buffer. + if (mp_slip_used_rx_buffer != NULL) + { + err_code = hci_slip_rx_buffer_register(mp_slip_used_rx_buffer, RX_BUF_SIZE); + APP_ERROR_CHECK(err_code); + } + else + { + err_code = hci_mem_pool_rx_produce(RX_BUF_SIZE, + (void **)&mp_slip_used_rx_buffer); + APP_ERROR_CHECK_BOOL((err_code == NRF_SUCCESS) || + (err_code == NRF_ERROR_NO_MEM)); + + err_code = hci_slip_rx_buffer_register( + (err_code == NRF_SUCCESS) ? mp_slip_used_rx_buffer : m_rx_ack_buffer, + (err_code == NRF_SUCCESS) ? RX_BUF_SIZE : ACK_BUF_SIZE); + APP_ERROR_CHECK(err_code); + } + break; + } + break; + + case HCI_SLIP_RX_OVERFLOW: + err_code = hci_slip_rx_buffer_register(m_rx_ack_buffer, ACK_BUF_SIZE); + APP_ERROR_CHECK(err_code); + break; + + case HCI_SLIP_ERROR: + APP_ERROR_HANDLER(event.evt_type); + break; + + default: + APP_ERROR_HANDLER(event.evt_type); + break; + } +} + + +uint32_t hci_transport_evt_handler_reg(hci_transport_event_handler_t event_handler) +{ + uint32_t err_code; + + m_transport_event_handle = event_handler; + err_code = hci_slip_evt_handler_register(slip_event_handle); + APP_ERROR_CHECK(err_code); + + return (event_handler != NULL) ? NRF_SUCCESS : NRF_ERROR_NULL; +} + + +uint32_t hci_transport_tx_done_register(hci_transport_tx_done_handler_t event_handler) +{ + uint32_t err_code; + + m_transport_tx_done_handle = event_handler; + err_code = hci_slip_evt_handler_register(slip_event_handle); + APP_ERROR_CHECK(err_code); + + return (event_handler != NULL) ? NRF_SUCCESS : NRF_ERROR_NULL; +} + + +/**@brief Function for handling the application packet retransmission timeout. + * + * This function is registered in the @ref app_timer module when a timer is created on + * @ref hci_transport_open. + * + * @note This function must be executed in APP-LO context otherwise retransmission behaviour is + * undefined, see @ref nrf51_system_integration_serialization. + * + * @param[in] p_context The timeout context. + */ +void hci_transport_timeout_handle(void * p_context) +{ + tx_sm_event_handle(TX_EVENT_TIMEOUT); +} + + +uint32_t hci_transport_open(void) +{ + mp_tx_buffer = NULL; + m_tx_buffer_length = 0; + m_tx_retry_counter = 0; + m_is_slip_decode_ready = false; + m_tx_state = TX_STATE_IDLE; + m_packet_expected_seq_number = INITIAL_ACK_NUMBER_EXPECTED; + m_packet_transmit_seq_number = INITIAL_ACK_NUMBER_TX; + m_tx_done_result_code = HCI_TRANSPORT_TX_DONE_FAILURE; + + uint32_t err_code = app_timer_create(&m_app_timer_id, + APP_TIMER_MODE_REPEATED, + hci_transport_timeout_handle); + if (err_code != NRF_SUCCESS) + { + // @note: conduct required interface adjustment. + return NRF_ERROR_INTERNAL; + } + + err_code = hci_mem_pool_open(); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + err_code = hci_slip_open(); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + err_code = hci_mem_pool_rx_produce(RX_BUF_SIZE, (void **)&mp_slip_used_rx_buffer); + if (err_code != NRF_SUCCESS) + { + // @note: conduct required interface adjustment. + return NRF_ERROR_INTERNAL; + } + + err_code = hci_slip_rx_buffer_register(mp_slip_used_rx_buffer, RX_BUF_SIZE); + + return err_code; +} + + +uint32_t hci_transport_close(void) +{ + uint32_t err_code; + + m_transport_tx_done_handle = NULL; + m_transport_event_handle = NULL; + + err_code = hci_mem_pool_close(); + APP_ERROR_CHECK(err_code); + err_code = hci_slip_close(); + APP_ERROR_CHECK(err_code); + + // @note: NRF_ERROR_NO_MEM is the only return value which should never be returned. + err_code = app_timer_stop(m_app_timer_id); + APP_ERROR_CHECK_BOOL(err_code != NRF_ERROR_NO_MEM); + + return NRF_SUCCESS; +} + + +uint32_t hci_transport_tx_alloc(uint8_t ** pp_memory) +{ + const uint32_t err_code = hci_mem_pool_tx_alloc((void **)pp_memory); + if (err_code == NRF_SUCCESS) + { + // @note: no need to validate pp_memory against null as validation has already been done + // by hci_mem_pool_tx_alloc(...) and visible to us from the method return code. + //lint -e(413) "Likely use of null pointer" + *pp_memory += PKT_HDR_SIZE; + } + + return err_code; +} + + +uint32_t hci_transport_tx_free(void) +{ + return hci_mem_pool_tx_free(); +} + + +/**@brief Function for constructing 1st byte of the packet header of the packet to be transmitted. + * + * @return 1st byte of the packet header of the packet to be transmitted + */ +static __INLINE uint8_t tx_packet_byte_zero_construct(void) +{ + const uint32_t value = DATA_INTEGRITY_MASK | + RELIABLE_PKT_MASK | + (packet_number_expected_get() << 3u) | + packet_number_to_transmit_get(); + + return (uint8_t) value; +} + + +/**@brief Function for handling the application packet write request in tx-idle state. + */ +static uint32_t pkt_write_handle(void) +{ + uint32_t err_code; + + // Set packet header fields. + + mp_tx_buffer -= PKT_HDR_SIZE; + mp_tx_buffer[0] = tx_packet_byte_zero_construct(); + + const uint16_t type_and_length_fields = ((m_tx_buffer_length << 4u) | PKT_TYPE_VENDOR_SPECIFIC); + // @note: no use case for uint16_encode(...) return value. + UNUSED_VARIABLE(uint16_encode(type_and_length_fields, &(mp_tx_buffer[1]))); + mp_tx_buffer[3] = header_checksum_calculate(mp_tx_buffer); + + // Calculate, append CRC to the packet and write it. + + const uint16_t crc = crc16_compute(mp_tx_buffer, (PKT_HDR_SIZE + m_tx_buffer_length), NULL); + // @note: no use case for uint16_encode(...) return value. + UNUSED_VARIABLE(uint16_encode(crc, &(mp_tx_buffer[PKT_HDR_SIZE + m_tx_buffer_length]))); + err_code = hci_slip_write(mp_tx_buffer, (m_tx_buffer_length + PKT_HDR_SIZE + PKT_CRC_SIZE)); + switch (err_code) + { + case NRF_SUCCESS: + tx_sm_state_change(TX_STATE_ACTIVE); + break; + + case NRF_ERROR_NO_MEM: + tx_sm_state_change(TX_STATE_PENDING); + err_code = NRF_SUCCESS; + break; + + default: + // No implementation needed. + break; + } + + return err_code; +} + + +uint32_t hci_transport_pkt_write(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t err_code; + + if (p_buffer) + { + switch (m_tx_state) + { + case TX_STATE_IDLE: + mp_tx_buffer = (uint8_t *)p_buffer; + m_tx_buffer_length = length; + err_code = pkt_write_handle(); + break; + + default: + err_code = NRF_ERROR_NO_MEM; + break; + } + } + else + { + err_code = NRF_ERROR_NULL; + } + + return err_code; +} + + +uint32_t hci_transport_rx_pkt_extract(uint8_t ** pp_buffer, uint16_t * p_length) +{ + uint32_t err_code; + + if (pp_buffer != NULL && p_length != NULL) + { + uint32_t length = 0; + + if (m_is_slip_decode_ready) + { + m_is_slip_decode_ready = false; + err_code = hci_mem_pool_rx_extract(pp_buffer, &length); + length -= (PKT_HDR_SIZE + PKT_CRC_SIZE); + + *p_length = (uint16_t)length; + *pp_buffer += PKT_HDR_SIZE; + } + else + { + err_code = NRF_ERROR_NO_MEM; + } + } + else + { + err_code = NRF_ERROR_NULL; + } + + return err_code; +} + + +uint32_t hci_transport_rx_pkt_consume(uint8_t * p_buffer) +{ + return (hci_mem_pool_rx_consume(p_buffer - PKT_HDR_SIZE)); +} diff --git a/components/libraries/hci/hci_transport.h b/components/libraries/hci/hci_transport.h new file mode 100644 index 0000000..965cfd8 --- /dev/null +++ b/components/libraries/hci/hci_transport.h @@ -0,0 +1,220 @@ +/* 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. + * + */ + +/**@file + * + * @defgroup hci_transport HCI Transport + * @{ + * @ingroup app_common + * + * @brief HCI transport module implementation. + * + * This module implements certain specific features from the three-wire UART transport layer, + * defined by the Bluetooth specification version 4.0 [Vol 4] part D. + * + * \par Features supported + * - Transmission and reception of Vendor Specific HCI packet type application packets. + * - Transmission and reception of reliable packets: defined by chapter 6 of the specification. + * + * \par Features not supported + * - Link establishment procedure: defined by chapter 8 of the specification. + * - Low power: defined by chapter 9 of the specification. + * + * \par Implementation specific behaviour + * - As Link establishment procedure is not supported following static link configuration parameters + * are used: + * + TX window size is 1. + * + 16 bit CCITT-CRC must be used. + * + Out of frame software flow control not supported. + * + Parameters specific for resending reliable packets are compile time configurable (clarifed + * later in this document). + * + Acknowledgement packet transmissions are not timeout driven , meaning they are delivered for + * transmission within same context which the corresponding application packet was received. + * + * \par Implementation specific limitations + * Current implementation has the following limitations which will have impact to system wide + * behaviour: + * - Delayed acknowledgement scheduling not implemented: + * There exists a possibility that acknowledgement TX packet and application TX packet will collide + * in the TX pipeline having the end result that acknowledgement packet will be excluded from the TX + * pipeline which will trigger the retransmission algorithm within the peer protocol entity. + * - Delayed retransmission scheduling not implemented: + * There exists a possibility that retransmitted application TX packet and acknowledgement TX packet + * will collide in the TX pipeline having the end result that retransmitted application TX packet + * will be excluded from the TX pipeline. + * - Processing of the acknowledgement number from RX application packets: + * Acknowledgement number is not processed from the RX application packets having the end result + * that unnecessary application packet retransmissions can occur. + * + * The application TX packet processing flow is illustrated by the statemachine below. + * + * @image html hci_transport_tx_sm.png "TX - application packet statemachine" + * + * \par Component specific configuration options + * + * The following compile time configuration options are available, and used to configure the + * application TX packet retransmission interval, in order to suite various application specific + * implementations: + * - MAC_PACKET_SIZE_IN_BITS Maximum size of a single application packet in bits. + * - USED_BAUD_RATE Used uart baudrate. + * + * The following compile time configuration option is available to configure module specific + * behaviour: + * - MAX_RETRY_COUNT Max retransmission retry count for applicaton packets. + */ + +#ifndef HCI_TRANSPORT_H__ +#define HCI_TRANSPORT_H__ + +#include +#include "nrf_error.h" + +/**@brief Generic event callback function events. */ +typedef enum +{ + HCI_TRANSPORT_RX_RDY, /**< An event indicating that RX packet is ready for read. */ + HCI_TRANSPORT_EVT_TYPE_MAX /**< Enumeration upper bound. */ +} hci_transport_evt_type_t; + +/**@brief Struct containing events from the Transport layer. + */ +typedef struct +{ + hci_transport_evt_type_t evt_type; /**< Type of event. */ +} hci_transport_evt_t; + +/**@brief Transport layer generic event callback function type. + * + * @param[in] event Transport layer event. + */ +typedef void (*hci_transport_event_handler_t)(hci_transport_evt_t event); + +/**@brief TX done event callback function result codes. */ +typedef enum +{ + HCI_TRANSPORT_TX_DONE_SUCCESS, /**< Transmission success, peer transport entity has acknowledged the transmission. */ + HCI_TRANSPORT_TX_DONE_FAILURE /**< Transmission failure. */ +} hci_transport_tx_done_result_t; + +/**@brief Transport layer TX done event callback function type. + * + * @param[in] result TX done event result code. + */ +typedef void (*hci_transport_tx_done_handler_t)(hci_transport_tx_done_result_t result); + +/**@brief Function for registering a generic event handler. + * + * @note Multiple registration requests will overwrite any possible existing registration. + * + * @param[in] event_handler The function to be called by the transport layer upon an event. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. + */ +uint32_t hci_transport_evt_handler_reg(hci_transport_event_handler_t event_handler); + +/**@brief Function for registering a handler for TX done event. + * + * @note Multiple registration requests will overwrite any possible existing registration. + * + * @param[in] event_handler The function to be called by the transport layer upon TX done + * event. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. + */ +uint32_t hci_transport_tx_done_register(hci_transport_tx_done_handler_t event_handler); + +/**@brief Function for opening the transport channel and initializing the transport layer. + * + * @warning Must not be called for a channel which has been allready opened. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_INTERNAL Operation failure. Internal error ocurred. + */ +uint32_t hci_transport_open(void); + +/**@brief Function for closing the transport channel. + * + * @note Can be called multiple times and also for not opened channel. + * + * @retval NRF_SUCCESS Operation success. + */ +uint32_t hci_transport_close(void); + +/**@brief Function for allocating tx packet memory. + * + * @param[out] pp_memory Pointer to the packet data. + * + * @retval NRF_SUCCESS Operation success. Memory was allocated. + * @retval NRF_ERROR_NO_MEM Operation failure. No memory available. + * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. + */ +uint32_t hci_transport_tx_alloc(uint8_t ** pp_memory); + +/**@brief Function for freeing tx packet memory. + * + * @note Memory management works in FIFO principle meaning that free order must match the alloc + * order. + * + * @retval NRF_SUCCESS Operation success. Memory was freed. + */ +uint32_t hci_transport_tx_free(void); + +/**@brief Function for writing a packet. + * + * @note Completion of this method does not guarantee that actual peripheral transmission would + * have completed. + * + * @note In case of 0 byte packet length write request, message will consist of only transport + * module specific headers. + * + * @retval NRF_SUCCESS Operation success. Packet was added to the transmission queue + * and an event will be send upon transmission completion. + * @retval NRF_ERROR_NO_MEM Operation failure. Transmission queue is full and packet was not + * added to the transmission queue. User should wait for + * a appropriate event prior issuing this operation again. + * @retval NRF_ERROR_DATA_SIZE Operation failure. Packet size exceeds limit. + * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_STATE Operation failure. Channel is not open. + */ +uint32_t hci_transport_pkt_write(const uint8_t * p_buffer, uint16_t length); + +/**@brief Function for extracting received packet. + * + * @note Extracted memory can't be reused by the underlying transport layer untill freed by call to + * hci_transport_rx_pkt_consume(). + * + * @param[out] pp_buffer Pointer to the packet data. + * @param[out] p_length Length of packet data in bytes. + * + * @retval NRF_SUCCESS Operation success. Packet was extracted. + * @retval NRF_ERROR_NO_MEM Operation failure. No packet available to extract. + * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. + */ +uint32_t hci_transport_rx_pkt_extract(uint8_t ** pp_buffer, uint16_t * p_length); + +/**@brief Function for consuming extracted packet described by p_buffer. + * + * RX memory pointed to by p_buffer is freed and can be reused by the underlying transport layer. + * + * @param[in] p_buffer Pointer to the buffer that has been consumed. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_NO_MEM Operation failure. No packet available to consume. + * @retval NRF_ERROR_INVALID_ADDR Operation failure. Not a valid pointer. + */ +uint32_t hci_transport_rx_pkt_consume(uint8_t * p_buffer); + +#endif // HCI_TRANSPORT_H__ + +/** @} */ diff --git a/components/libraries/ic_info/nrf51_ic_info.c b/components/libraries/ic_info/nrf51_ic_info.c new file mode 100644 index 0000000..b68f9a7 --- /dev/null +++ b/components/libraries/ic_info/nrf51_ic_info.c @@ -0,0 +1,49 @@ +/* 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 "nrf_ic_info.h" +#include "nrf.h" + +void nrf_ic_info_get(nrf_ic_info_t * p_ic_info) +{ + uint32_t ic_data; + + ic_data = (((*((uint32_t volatile *)0xF0000FE8)) & 0x000000F0) >> 4); + + p_ic_info->ram_size = (uint16_t) NRF_FICR->NUMRAMBLOCK * (NRF_FICR->SIZERAMBLOCKS / 1024); + p_ic_info->flash_size = (uint16_t) NRF_FICR->CODESIZE; + switch (ic_data) + { + /** IC revision 1 */ + case 1: + p_ic_info->ic_revision = IC_REVISION_NRF51_REV1; + break; + + /** IC revision 2 */ + case 4: + p_ic_info->ic_revision = IC_REVISION_NRF51_REV2; + break; + + /** IC revision 3 */ + case 7: + /* fall through */ + case 8: + /* fall through */ + case 9: + p_ic_info->ic_revision = IC_REVISION_NRF51_REV3; + break; + + default: + p_ic_info->ic_revision = IC_REVISION_NRF51_UNKNOWN; + break; + } +} diff --git a/components/libraries/ic_info/nrf_ic_info.h b/components/libraries/ic_info/nrf_ic_info.h new file mode 100644 index 0000000..a220973 --- /dev/null +++ b/components/libraries/ic_info/nrf_ic_info.h @@ -0,0 +1,44 @@ +/* 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. + * + */ + +#ifndef NRF51_IC_INFO_H__ +#define NRF51_IC_INFO_H__ + +#include + +/**@brief Enum identifying the IC revision as described in the nRF51 Series Compatibility Matrix. */ +typedef enum +{ + IC_REVISION_NRF51_REV1, /**< IC Revision 1. */ + IC_REVISION_NRF51_REV2, /**< IC Revision 2. */ + IC_REVISION_NRF51_REV3, /**< IC Revision 3. */ + IC_REVISION_NRF51_UNKNOWN /**< IC Revision unknown. */ +} nrf_ic_revision_t; + + /**@brief IC information struct containing the IC revision, RAM size, and FLASH size. */ +typedef struct +{ + nrf_ic_revision_t ic_revision; /**< IC revision. */ + uint16_t ram_size; /**< RAM size in kB (16 = 16 kB RAM). */ + uint16_t flash_size; /**< FLASH size in kB (256 = 256 kB FLASH). */ +} nrf_ic_info_t; + + +/**@brief Function for returning information about the IC revision, the RAM size, and the FLASH size. + * + * @param[out] p_ic_info Struct containing IC revision, RAM size, and FLASH size. + * + */ +void nrf_ic_info_get(nrf_ic_info_t* p_ic_info); + + +#endif // NRF51_IC_INFO_H__ diff --git a/components/libraries/led_softblink/led_softblink.c b/components/libraries/led_softblink/led_softblink.c new file mode 100644 index 0000000..ba7997e --- /dev/null +++ b/components/libraries/led_softblink/led_softblink.c @@ -0,0 +1,201 @@ +/* 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 "led_softblink.h" +#include "nrf_gpio.h" +#include "app_timer.h" +#include "nrf_assert.h" +#include "low_power_pwm.h" + +/* Period for LED softblink PWM. */ +#define PWM_PERIOD UINT8_MAX + +/**@bref Structure to handle timer time-outs + * + */ +typedef struct +{ + bool leds_is_on; /**< Flag for indicating if LEDs are on. */ + bool is_counting_up; /**< Flag for indicating if counter is incrementing or decrementing. */ + nrf_drv_state_t led_sb_state; /**< Indicates current state of instance. */ + uint16_t duty_cycle; /**< Current pulse width. */ + uint32_t bit_mask; /**< Mask of used pins. */ + led_sb_init_params_t params; /**< Structure holding initialization parameters. */ + low_power_pwm_config_t pwm_config; /**< Structure holding parameters for initializing low level layer. */ + low_power_pwm_t pwm_instance; /**< Structure holding low-power PWM instance parameters. */ +}led_sb_context_t; + +static led_sb_context_t m_led_sb = {0}; + +/**@brief Timer event handler for softblink. + * + * @param[in] p_context General purpose pointer. Will be passed to the time-out handler + * when the timer expires. + * + */ +static void led_softblink_on_timeout(void * p_context) +{ + static int32_t pause_ticks; + ASSERT(m_led_sb.led_sb_state != NRF_DRV_STATE_UNINITIALIZED); + ret_code_t err_code; + + if(pause_ticks <= 0) + { + if (m_led_sb.is_counting_up) + { + if (m_led_sb.duty_cycle >= (m_led_sb.params.duty_cycle_max - m_led_sb.params.duty_cycle_step)) + { + // Max PWM duty cycle is reached, start decrementing. + m_led_sb.is_counting_up = false; + m_led_sb.duty_cycle = m_led_sb.params.duty_cycle_max; + pause_ticks = m_led_sb.params.on_time_ticks ? m_led_sb.params.on_time_ticks + APP_TIMER_MIN_TIMEOUT_TICKS : 0; + } + else + { + m_led_sb.duty_cycle += m_led_sb.params.duty_cycle_step; + } + } + else + { + if (m_led_sb.duty_cycle <= (m_led_sb.params.duty_cycle_min + m_led_sb.params.duty_cycle_step)) + { + // Min PWM duty cycle is reached, start incrementing. + m_led_sb.is_counting_up = true; + m_led_sb.duty_cycle = m_led_sb.params.duty_cycle_min; + pause_ticks = m_led_sb.params.off_time_ticks ? m_led_sb.params.off_time_ticks + APP_TIMER_MIN_TIMEOUT_TICKS : 0; + } + else + { + m_led_sb.duty_cycle -= m_led_sb.params.duty_cycle_step; + } + } + } + else + { + pause_ticks -= PWM_PERIOD; + } + + err_code = low_power_pwm_duty_set(&m_led_sb.pwm_instance, m_led_sb.duty_cycle); + + APP_ERROR_CHECK(err_code); +} + + +ret_code_t led_softblink_init(led_sb_init_params_t * p_init_params) +{ + ret_code_t err_code; + + ASSERT(m_led_sb.led_sb_state == NRF_DRV_STATE_UNINITIALIZED); + + ASSERT(p_init_params); + + if ( (p_init_params->duty_cycle_max == 0) || + (p_init_params->duty_cycle_max <= p_init_params->duty_cycle_min) || + (p_init_params->duty_cycle_step == 0) || + (p_init_params->leds_pin_bm == 0)) + { + return NRF_ERROR_INVALID_PARAM; + } + + + + memset(&m_led_sb, 0, sizeof(led_sb_context_t)); + memcpy(&m_led_sb.params, p_init_params, sizeof(led_sb_init_params_t)); + + m_led_sb.is_counting_up = true; + m_led_sb.duty_cycle = p_init_params->duty_cycle_min + p_init_params->duty_cycle_step; + m_led_sb.leds_is_on = false; + m_led_sb.bit_mask = p_init_params->leds_pin_bm; + + APP_TIMER_DEF(led_softblink_timer); + + m_led_sb.pwm_config.active_high = m_led_sb.params.active_high; + m_led_sb.pwm_config.bit_mask = p_init_params->leds_pin_bm; + m_led_sb.pwm_config.period = PWM_PERIOD; + m_led_sb.pwm_config.p_timer_id = &led_softblink_timer; + + err_code = low_power_pwm_init( &m_led_sb.pwm_instance, &m_led_sb.pwm_config, led_softblink_on_timeout); + + if (err_code == NRF_SUCCESS) + { + m_led_sb.led_sb_state = NRF_DRV_STATE_INITIALIZED; + } + else + { + return err_code; + } + + err_code = low_power_pwm_duty_set( &m_led_sb.pwm_instance, p_init_params->duty_cycle_min + p_init_params->duty_cycle_step); + + return err_code; +} + + +ret_code_t led_softblink_start(uint32_t leds_pin_bit_mask) +{ + ret_code_t err_code; + + ASSERT(m_led_sb.led_sb_state == NRF_DRV_STATE_INITIALIZED); + + err_code = low_power_pwm_start(&m_led_sb.pwm_instance, leds_pin_bit_mask); + + return err_code; +} + + +ret_code_t led_softblink_stop(void) +{ + ret_code_t err_code; + + err_code = low_power_pwm_stop(&m_led_sb.pwm_instance); + + return err_code; +} + + +void led_softblink_off_time_set(uint32_t off_time_ticks) +{ + ASSERT(m_led_sb.led_sb_state != NRF_DRV_STATE_UNINITIALIZED); + + m_led_sb.params.off_time_ticks = off_time_ticks; +} + + +void led_softblink_on_time_set(uint32_t on_time_ticks) +{ + ASSERT(m_led_sb.led_sb_state != NRF_DRV_STATE_UNINITIALIZED); + + m_led_sb.params.on_time_ticks = on_time_ticks; +} + + +ret_code_t led_softblink_uninit(void) +{ + ASSERT(m_led_sb.led_sb_state != NRF_DRV_STATE_UNINITIALIZED); + + ret_code_t err_code; + + err_code = led_softblink_stop(); + + if (err_code == NRF_SUCCESS) + { + m_led_sb.led_sb_state = NRF_DRV_STATE_UNINITIALIZED; + } + else + { + return err_code; + } + + memset(&m_led_sb, 0, sizeof(m_led_sb)); + + return NRF_SUCCESS; +} diff --git a/components/libraries/led_softblink/led_softblink.h b/components/libraries/led_softblink/led_softblink.h new file mode 100644 index 0000000..826003a --- /dev/null +++ b/components/libraries/led_softblink/led_softblink.h @@ -0,0 +1,131 @@ +/* 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 led_softblink LED softblink + * @{ + * @ingroup app_common + * + * @brief Module for generating a changing pulse-width modulated output signal that is used to smoothly blink LEDs. + * + * @details This module provides an LED softblink implementation using timers and GPIO. + * + * LED softblink needs one timer. It can use any number of output channels that are available. + * + * Only one instance of LED softblink can run at a time. + */ + +#ifndef LED_SOFTBLINK_H__ +#define LED_SOFTBLINK_H__ + +#include +#include +#include "sdk_errors.h" + +/** + * @brief Structure holding the initialization parameters. + */ +typedef struct +{ + bool active_high; /**< Activate negative polarity. */ + uint8_t duty_cycle_max; /**< Maximum impulse width. */ + uint8_t duty_cycle_min; /**< Minimum impulse width. */ + uint8_t duty_cycle_step; /**< Cycle step. */ + uint32_t off_time_ticks; /**< Ticks to stay in low impulse state. */ + uint32_t on_time_ticks; /**< Ticks to stay in high impulse state. */ + uint32_t leds_pin_bm; /**< Mask of used LEDs. */ +}led_sb_init_params_t; + +/** + * @name Default settings + * @brief Default settings for LED softblink. + * @{ + */ +#define LED_SB_INIT_PARAMS_ACTIVE_HIGH false +#define LED_SB_INIT_PARAMS_DUTY_CYCLE_MAX 220 +#define LED_SB_INIT_PARAMS_DUTY_CYCLE_MIN 0 +#define LED_SB_INIT_PARAMS_DUTY_CYCLE_STEP 5 +#define LED_SB_INIT_PARAMS_OFF_TIME_TICKS 65536 +#define LED_SB_INIT_PARAMS_ON_TIME_TICKS 0 +#define LED_SB_INIT_PARAMS_LEDS_PIN_BM(mask) (mask) +/** @} */ + +/** + * @brief LED softblink default configuration. + */ +#define LED_SB_INIT_DEFAULT_PARAMS(mask) \ +{ \ + .active_high = LED_SB_INIT_PARAMS_ACTIVE_HIGH, \ + .duty_cycle_max = LED_SB_INIT_PARAMS_DUTY_CYCLE_MAX, \ + .duty_cycle_min = LED_SB_INIT_PARAMS_DUTY_CYCLE_MIN, \ + .duty_cycle_step = LED_SB_INIT_PARAMS_DUTY_CYCLE_STEP, \ + .off_time_ticks = LED_SB_INIT_PARAMS_OFF_TIME_TICKS, \ + .on_time_ticks = LED_SB_INIT_PARAMS_ON_TIME_TICKS, \ + .leds_pin_bm = LED_SB_INIT_PARAMS_LEDS_PIN_BM(mask) \ +} + +/** + * @brief Function for initializing LED softblink. + * + * @param[in] p_init_params Pointer to the initialization structure. + * + * @return Values returned by @ref app_timer_create. + */ +ret_code_t led_softblink_init(led_sb_init_params_t * p_init_params); + +/** + * @brief Function for starting to blink LEDs. + * + * @param[in] leds_pin_bit_mask Bit mask containing the pins for the LEDs to be blinked. + * + * @return Values returned by @ref app_timer_start. + */ +ret_code_t led_softblink_start(uint32_t leds_pin_bit_mask); + +/** + * @brief Function for stopping to blink LEDs. + * + * @return Values returned by @ref app_timer_stop. + */ +ret_code_t led_softblink_stop(void); + +/** + * @brief Function for setting the off time. + * + * This function configures the time that the LEDs will be off between each blink. + * + * @param[in] off_time_ticks Off time in ticks. + * + */ +void led_softblink_off_time_set(uint32_t off_time_ticks); + +/** + * @brief Function for setting the on time. + * + * This function configures the time that the LEDs will be on between each blink. + * + * @param[in] on_time_ticks On time in ticks. + * + */ +void led_softblink_on_time_set(uint32_t on_time_ticks); + +/** + * @brief Function for uninitializing LED softblink. + * + * @retval NRF_SUCCESS If LED softblink was uninitialized successfully. + */ +ret_code_t led_softblink_uninit(void); +#endif // LED_SOFTBLINK_H__ + +/** @} */ + diff --git a/components/libraries/low_power_pwm/low_power_pwm.c b/components/libraries/low_power_pwm/low_power_pwm.c new file mode 100644 index 0000000..c776091 --- /dev/null +++ b/components/libraries/low_power_pwm/low_power_pwm.c @@ -0,0 +1,211 @@ +/* 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 "low_power_pwm.h" +#include "nrf_gpio.h" +#include "app_timer.h" +#include "nrf_assert.h" + +/** + * @brief Function for turning on LEDs. + * + * Sets the pin high state according to active_high parameter. + * + * @param[in] p_pwm_instance Pointer to instance of low-power PWM. + */ +__STATIC_INLINE void led_on(low_power_pwm_t * p_pwm_instance) +{ + if (p_pwm_instance->active_high) + { + nrf_gpio_pins_set(p_pwm_instance->bit_mask); + } + else + { + nrf_gpio_pins_clear(p_pwm_instance->bit_mask); + } + p_pwm_instance->led_is_on = true; +} + + +/** + * @brief Function for turning off LEDs. + * + * Sets the pin low state according to active_high parameter. + * + * @param[in] p_pwm_instance Pointer to instance of low-power PWM. + */ +__STATIC_INLINE void led_off(low_power_pwm_t * p_pwm_instance) +{ + if (p_pwm_instance->active_high) + { + nrf_gpio_pins_clear(p_pwm_instance->bit_mask); + } + else + { + nrf_gpio_pins_set(p_pwm_instance->bit_mask); + } + p_pwm_instance->led_is_on = false; +} + + +/** + * @brief Timer event handler for PWM. + * + * @param[in] p_context General purpose pointer. Will be passed to the time-out handler + * when the timer expires. + * + */ +static void pwm_timeout_handler(void * p_context) +{ + ret_code_t err_code; + uint8_t duty_cycle; + + low_power_pwm_t * p_pwm_instance = (low_power_pwm_t *)p_context; + + p_pwm_instance->pwm_state = NRF_DRV_STATE_INITIALIZED; + + if(p_pwm_instance->evt_type == LOW_POWER_PWM_EVENT_PERIOD) + { + if (p_pwm_instance->handler) + { + p_pwm_instance->handler(p_pwm_instance); + } + + duty_cycle = p_pwm_instance->duty_cycle; + + if(duty_cycle == p_pwm_instance->period) // Process duty cycle 100% + { + led_on(p_pwm_instance); + p_pwm_instance->timeout_ticks = p_pwm_instance->period + APP_TIMER_MIN_TIMEOUT_TICKS; + } + else if (duty_cycle == 0) // Process duty cycle 0% + { + led_off(p_pwm_instance); + p_pwm_instance->timeout_ticks = p_pwm_instance->period + APP_TIMER_MIN_TIMEOUT_TICKS; + } + else // Process any other duty cycle than 0 or 100% + { + led_on(p_pwm_instance); + p_pwm_instance->timeout_ticks = ((duty_cycle*p_pwm_instance->period)>>8) + + APP_TIMER_MIN_TIMEOUT_TICKS; + // setting next state + p_pwm_instance->evt_type = LOW_POWER_PWM_EVENT_DUTY_CYCLE; + } + } + else + { + led_off(p_pwm_instance); + p_pwm_instance->evt_type = LOW_POWER_PWM_EVENT_PERIOD; + p_pwm_instance->timeout_ticks = (((p_pwm_instance->period - p_pwm_instance->duty_cycle)*p_pwm_instance->period)>>8) + + APP_TIMER_MIN_TIMEOUT_TICKS; + } + + if (p_pwm_instance->pwm_state == NRF_DRV_STATE_INITIALIZED) + { + err_code = app_timer_start(*p_pwm_instance->p_timer_id, p_pwm_instance->timeout_ticks, p_pwm_instance); + APP_ERROR_CHECK(err_code); + } +} + + +ret_code_t low_power_pwm_init(low_power_pwm_t * p_pwm_instance, low_power_pwm_config_t const * p_pwm_config, app_timer_timeout_handler_t handler) +{ + ASSERT(p_pwm_instance->pwm_state == NRF_DRV_STATE_UNINITIALIZED); + ASSERT(p_pwm_config->bit_mask != 0); + ASSERT(p_pwm_config->period != 0); + + ret_code_t err_code; + uint32_t bit_mask; + uint32_t pin_number = 0; + + p_pwm_instance->handler = handler; + + bit_mask = p_pwm_config->bit_mask; + + p_pwm_instance->active_high = p_pwm_config->active_high; + p_pwm_instance->bit_mask = p_pwm_config->bit_mask; + p_pwm_instance->period = p_pwm_config->period; + p_pwm_instance->p_timer_id = p_pwm_config->p_timer_id; + + err_code = app_timer_create(p_pwm_instance->p_timer_id, APP_TIMER_MODE_SINGLE_SHOT, pwm_timeout_handler); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + while (bit_mask) + { + if (bit_mask & 0x1UL) + { + nrf_gpio_cfg_output(pin_number); + } + + pin_number++; + bit_mask >>= 1UL; + } + + led_off(p_pwm_instance); + + p_pwm_instance->pwm_state = NRF_DRV_STATE_INITIALIZED; + + return NRF_SUCCESS; +} + + +ret_code_t low_power_pwm_start(low_power_pwm_t * p_pwm_instance, + uint32_t leds_pin_bit_mask) +{ + ASSERT(p_pwm_instance->pwm_state == NRF_DRV_STATE_INITIALIZED); + + p_pwm_instance->evt_type = LOW_POWER_PWM_EVENT_PERIOD; + pwm_timeout_handler(p_pwm_instance); + + p_pwm_instance->pwm_state = NRF_DRV_STATE_POWERED_ON; + + return NRF_SUCCESS; +} + + +ret_code_t low_power_pwm_stop(low_power_pwm_t * p_pwm_instance) +{ + ASSERT(p_pwm_instance->pwm_state == NRF_DRV_STATE_POWERED_ON); + + ret_code_t err_code; + + led_off(p_pwm_instance); + + err_code = app_timer_stop(*p_pwm_instance->p_timer_id); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + p_pwm_instance->pwm_state = NRF_DRV_STATE_INITIALIZED; + + + return NRF_SUCCESS; +} + + +ret_code_t low_power_pwm_duty_set(low_power_pwm_t * p_pwm_instance, uint8_t duty_cycle) +{ + if ( p_pwm_instance->period < duty_cycle) + { + return NRF_ERROR_INVALID_PARAM; + } + + p_pwm_instance->duty_cycle = duty_cycle; + + return NRF_SUCCESS; +} diff --git a/components/libraries/low_power_pwm/low_power_pwm.h b/components/libraries/low_power_pwm/low_power_pwm.h new file mode 100644 index 0000000..b3711c8 --- /dev/null +++ b/components/libraries/low_power_pwm/low_power_pwm.h @@ -0,0 +1,166 @@ +/* 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 low_power_pwm Low-power PWM + * @{ + * @ingroup app_common + * + * @brief Module for generating a low-power pulse-width modulated output signal. + * + * This module provides a low-power PWM implementation using timers and GPIO. + * + * Each low-power PWM instance utilizes one timer. There can be any + * number of output channels per instance. + */ + +#ifndef LOW_POWER_PWM_H__ +#define LOW_POWER_PWM_H__ + +#include +#include +#include "app_timer.h" +#include "nrf_drv_common.h" +#include "sdk_errors.h" + +/** + * @brief Event types. + */ +typedef enum +{ + LOW_POWER_PWM_EVENT_PERIOD = 0, + LOW_POWER_PWM_EVENT_DUTY_CYCLE +}low_power_pwm_evt_type_t; + +/**@brief Application time-out handler type. */ +typedef void (*low_power_pwm_timeout_user)(void * p_context, low_power_pwm_evt_type_t evt_type); + +/** + * @brief Structure holding the initialization parameters. + */ +typedef struct +{ + bool active_high; /**< Activate negative polarity. */ + uint8_t period; /**< Width of the low_power_pwm period. */ + uint32_t bit_mask; /**< Pins to be toggled. */ + app_timer_id_t const * p_timer_id; /**< Pointer to the timer ID of low_power_pwm. */ +} low_power_pwm_config_t; + + +/** + * @name Default settings + * @{ + * + * @brief Default parameters for the @ref low_power_pwm_config_t structure. + * + */ +#define LOW_POWER_PWM_CONFIG_ACTIVE_HIGH false +#define LOW_POWER_PWM_CONFIG_PERIOD UINT8_MAX +#define LOW_POWER_PWM_CONFIG_BIT_MASK(mask) (mask) +/** @} */ + +/** + * @brief Low-power PWM default configuration. + */ +#define LOW_POWER_PWM_DEFAULT_CONFIG(mask) \ +{ \ + .active_high = LOW_POWER_PWM_CONFIG_ACTIVE_HIGH , \ + .period = LOW_POWER_PWM_CONFIG_PERIOD , \ + .bit_mask = LOW_POWER_PWM_CONFIG_BIT_MASK(mask) \ +} +/** + * @cond (NODOX) + * @defgroup low_power_pwm_internal Auxiliary internal types declarations + * @brief Module for internal usage inside the library only. + * @details These definitions are available to the user, but they should not + * be accessed directly. Use @ref low_power_pwm_duty_set instead. + * @{ + * + */ + + /** + * @brief Structure holding parameters of a given low-power PWM instance. + */ + struct low_power_pwm_s + { + bool active_high; /**< Activate negative polarity. */ + bool led_is_on; /**< Indicates the current state of the LED. */ + uint8_t period; /**< Width of the low_power_pwm period. */ + uint8_t duty_cycle; /**< Width of high pulse. */ + nrf_drv_state_t pwm_state; /**< Indicates the current state of the PWM instance. */ + uint32_t bit_mask; /**< Pins to be toggled. */ + uint32_t timeout_ticks; /**< Value to start the next app_timer. */ + low_power_pwm_evt_type_t evt_type; /**< Slope that triggered time-out. */ + app_timer_timeout_handler_t handler; /**< User handler to be called in the time-out handler. */ + app_timer_id_t const * p_timer_id; /**< Pointer to the timer ID of low_power_pwm. */ + }; + +/** @} + * @endcond + */ + +/** + * @brief Internal structure holding parameters of a low-power PWM instance. + */ +typedef struct low_power_pwm_s low_power_pwm_t; + + +/** + * @brief Function for initializing a low-power PWM instance. + * + * @param[in] p_pwm_instance Pointer to the instance to be started. + * @param[in] p_pwm_config Pointer to the configuration structure. + * @param[in] handler User function to be called in case of time-out. + * + * @return Values returned by @ref app_timer_create. + */ +ret_code_t low_power_pwm_init(low_power_pwm_t * p_pwm_instance, low_power_pwm_config_t const * p_pwm_config, app_timer_timeout_handler_t handler); + + +/** + * @brief Function for starting a low-power PWM instance. + * + * @param[in] p_pwm_instance Pointer to the instance to be started. + * @param[in] leds_pin_bit_mask Bit mask of pins to be started. + * + * @return Values returned by @ref app_timer_start. + */ +ret_code_t low_power_pwm_start(low_power_pwm_t * p_pwm_instance, + uint32_t leds_pin_bit_mask); + +/** + * @brief Function for stopping a low-power PWM instance. + * + * @param[in] p_pwm_instance Pointer to the instance to be stopped. + * + * @return Values returned by @ref app_timer_stop. + */ +ret_code_t low_power_pwm_stop(low_power_pwm_t * p_pwm_instance); + + +/** + * @brief Function for setting a new high pulse width for a given instance. + * + * This function can be called from the timer handler. + * + * @param[in] p_pwm_instance Pointer to the instance to be changed. + * @param[in] duty_cycle New high pulse width. 0 means that the LED is always off. 255 means that it is always on. + * + * @retval NRF_SUCCESS If the function completed successfully. + * @retval NRF_ERROR_INVALID_PARAM If the function returned an error because of invalid parameters. + */ +ret_code_t low_power_pwm_duty_set(low_power_pwm_t * p_pwm_instance, uint8_t duty_cycle); + +#endif // LOW_POWER_PWM_H__ + +/** @} */ diff --git a/components/libraries/mailbox/app_mailbox.c b/components/libraries/mailbox/app_mailbox.c new file mode 100644 index 0000000..2d3ff0a --- /dev/null +++ b/components/libraries/mailbox/app_mailbox.c @@ -0,0 +1,152 @@ +/* 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 +#include "app_mailbox.h" +#include "nrf_error.h" +#include "app_util_platform.h" +#include "app_util.h" +#include "nrf_assert.h" + +ret_code_t app_mailbox_create(const app_mailbox_t * queue_def) +{ + queue_def->p_cb->r_idx = 0; + queue_def->p_cb->w_idx = 0; + queue_def->p_cb->len = 0; + queue_def->p_cb->mode = APP_MAILBOX_MODE_NO_OVERFLOW; + + return NRF_SUCCESS; +} + +static __INLINE void dequeue(app_mailbox_cb_t * p_cb, uint8_t queue_sz) +{ + uint8_t r_idx = p_cb->r_idx + 1; + p_cb->len--; + + //Handle index wrapping. + p_cb->r_idx = (r_idx == queue_sz) ? 0 : r_idx; +} + +static __INLINE void enqueue(app_mailbox_cb_t * p_cb, uint8_t queue_sz) +{ + uint8_t w_idx = p_cb->w_idx + 1; + p_cb->len++; + + //Handle index wrapping. + p_cb->w_idx = (w_idx == queue_sz) ? 0 : w_idx; +} + +ret_code_t app_mailbox_put(const app_mailbox_t * p_mailbox, void * p_item) +{ + ASSERT(p_mailbox); + return app_mailbox_sized_put(p_mailbox, p_item, p_mailbox->item_sz); +} + +ret_code_t app_mailbox_sized_put(const app_mailbox_t * p_mailbox, void * p_item, uint16_t size) +{ + ASSERT((uint32_t)p_item>0); + ASSERT(p_mailbox); + uint32_t err_code = NRF_ERROR_INTERNAL; + uint32_t * p_dst = p_mailbox->p_pool; + bool do_put = true; + uint8_t queue_sz = p_mailbox->queue_sz; + uint16_t item_sz = p_mailbox->item_sz; + app_mailbox_cb_t * p_cb = p_mailbox->p_cb; + + CRITICAL_REGION_ENTER(); + + if (p_cb->len == queue_sz) + { + if (p_cb->mode == APP_MAILBOX_MODE_NO_OVERFLOW) + { + do_put = false; + } + else + { + // Remove the oldest element. + dequeue(p_cb, queue_sz); + } + err_code = NRF_ERROR_NO_MEM; + } + else + { + err_code = NRF_SUCCESS; + } + + if (do_put) + { + p_dst = (uint32_t *)((uint32_t)p_dst + (p_cb->w_idx * (item_sz + sizeof(uint32_t)))); + enqueue(p_cb, queue_sz); + + //Put data in mailbox. + *p_dst = (uint32_t)size; + p_dst++; + memcpy(p_dst, p_item, size); + } + + CRITICAL_REGION_EXIT(); + + return err_code; +} + +ret_code_t app_mailbox_get(const app_mailbox_t * p_mailbox, void * p_item) +{ + uint16_t size; + return app_mailbox_sized_get(p_mailbox, p_item, &size); +} + +ret_code_t app_mailbox_sized_get(const app_mailbox_t * p_mailbox, void * p_item, uint16_t * p_size) +{ + ASSERT(p_mailbox); + ASSERT((uint32_t)p_item>0); + uint32_t * p_src = p_mailbox->p_pool; + ret_code_t err_code = NRF_SUCCESS; + uint16_t item_sz = p_mailbox->item_sz; + uint8_t queue_sz = p_mailbox->queue_sz; + app_mailbox_cb_t * p_cb = p_mailbox->p_cb; + + CRITICAL_REGION_ENTER(); + + if (p_cb->len == 0) + { + err_code = NRF_ERROR_NO_MEM; + } + else + { + p_src = (void *)((uint32_t)p_src + (p_cb->r_idx * (item_sz + sizeof(uint32_t)))); + dequeue(p_cb, queue_sz); + } + + if (err_code == NRF_SUCCESS) + { + uint16_t size = (uint16_t)*p_src; + *p_size = size; + p_src++; + memcpy(p_item, p_src, size); + } + + CRITICAL_REGION_EXIT(); + + return err_code; +} + +uint32_t app_mailbox_length_get (const app_mailbox_t * p_mailbox) +{ + ASSERT(p_mailbox); + return p_mailbox->p_cb->len; +} + +void app_mailbox_mode_set(const app_mailbox_t * p_mailbox, app_mailbox_overflow_mode_t mode) +{ + ASSERT(p_mailbox); + p_mailbox->p_cb->mode = mode; +} diff --git a/components/libraries/mailbox/app_mailbox.h b/components/libraries/mailbox/app_mailbox.h new file mode 100644 index 0000000..967e5c3 --- /dev/null +++ b/components/libraries/mailbox/app_mailbox.h @@ -0,0 +1,143 @@ +/* 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 app_mailbox Mailbox library + * @{ + * @ingroup app_common + * + * @brief Mailbox for safely queuing items. + * + */ + +#ifndef _APP_MAILBOX_H +#define _APP_MAILBOX_H + +#include +#include "sdk_errors.h" +#include "app_util.h" +#include "nordic_common.h" + +/** + * @brief Supported overflow modes. + */ +typedef enum +{ + APP_MAILBOX_MODE_NO_OVERFLOW, //!< If the mailbox is full, @ref app_mailbox_put does not add a new element. + APP_MAILBOX_MODE_OVERFLOW //!< If the mailbox is full, the oldest element is lost and a new one is added. +} app_mailbox_overflow_mode_t; + +#include "app_mailbox_local.h" + +/** + * @brief Mailbox definition structure. + */ +typedef struct +{ + void * p_pool; /**< Memory array for mail. */ + app_mailbox_cb_t * p_cb; /**< Mailbox handle. */ + uint16_t item_sz; /**< Size of a single item. */ + uint8_t queue_sz; /**< Capacity of the queue. */ +} app_mailbox_t; + +/** + * @brief Macro to statically allocate memory for a given mailbox queue. + */ +#define APP_MAILBOX_DEF(name, QUEUE_SZ, ITEM_SZ) \ +static uint32_t STRING_CONCATENATE(mailbox_items_,name)[(1+CEIL_DIV((ITEM_SZ),4))*(QUEUE_SZ)];\ +static app_mailbox_cb_t STRING_CONCATENATE(mailbox_cb_,name); \ +const app_mailbox_t name = \ + { \ + .p_pool = STRING_CONCATENATE(mailbox_items_,name), \ + .p_cb = STRING_CONCATENATE(&mailbox_cb_,name), \ + .queue_sz = (uint8_t)(QUEUE_SZ), \ + .item_sz = (uint16_t)(ITEM_SZ), \ + } + +/** + * @brief Function for creating a mailbox queue. + * + * This function creates and initializes a mailbox queue. + * + * @param[in] p_mailbox Pointer to the mailbox. + * + * @retval NRF_SUCCESS If the queue was successfully created. + */ +ret_code_t app_mailbox_create(const app_mailbox_t * p_mailbox); + +/** + * @brief Function for putting an item in the mailbox queue. + * + * @param[in] p_mailbox Pointer to the mailbox. + * @param[in] p_item Pointer to the item to be queued. + * + * @retval NRF_SUCCESS If the item was enqueued. + * @retval NRF_ERROR_NO_MEM If the queue is full. + */ +ret_code_t app_mailbox_put (const app_mailbox_t * p_mailbox, void * p_item); + +/** + * @brief Function for putting an item with a specified size in the mailbox queue. + * + * @param[in] p_mailbox Pointer to the mailbox. + * @param[in] p_item Pointer to the item to be queued. + * @param[in] size Size of the item. + * + * @retval NRF_SUCCESS If the item was enqueued. + * @retval NRF_ERROR_NO_MEM If the queue is full. + */ +ret_code_t app_mailbox_sized_put (const app_mailbox_t * p_mailbox, void * p_item, uint16_t size); + +/** + * @brief Function for getting an item from the mailbox queue. + * + * @param[in] p_mailbox Pointer to the mailbox. + * @param[out] p_item Pointer to the output location for the dequeued item. + * + * @retval NRF_SUCCESS If the item was retrieved successfully. + * @retval NRF_ERROR_NO_MEM If the queue is empty. + */ +ret_code_t app_mailbox_get (const app_mailbox_t * p_mailbox, void * p_item); + +/** + * @brief Function for getting an item and its size from the mailbox queue. + * + * @param[in] p_mailbox Pointer to the mailbox. + * @param[out] p_item Pointer to the output location for the dequeued item. + * @param[out] p_size Pointer to the item size. + * + * @retval NRF_SUCCESS If the item was retrieved successfully. + * @retval NRF_ERROR_NO_MEM If the queue is empty. + */ +ret_code_t app_mailbox_sized_get (const app_mailbox_t * p_mailbox, void * p_item, uint16_t * p_size); + +/** + * @brief Function for getting the current length of the mailbox queue. + * + * @param[in] p_mailbox Pointer to the mailbox. + * + * @return Current number of elements in the queue. + * + */ +uint32_t app_mailbox_length_get (const app_mailbox_t * p_mailbox); + +/** + * @brief Function for changing the mode of overflow handling. + * + * @param[in] p_mailbox Pointer to the mailbox. + * @param mode New mode to set. + */ +void app_mailbox_mode_set(const app_mailbox_t * p_mailbox, app_mailbox_overflow_mode_t mode); + +#endif //_APP_MAILBOX_H +/** @} */ diff --git a/components/libraries/mailbox/app_mailbox_local.h b/components/libraries/mailbox/app_mailbox_local.h new file mode 100644 index 0000000..ed8ddc4 --- /dev/null +++ b/components/libraries/mailbox/app_mailbox_local.h @@ -0,0 +1,41 @@ +/* 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. + * + */ + +/** + * @cond (NODOX) + * @defgroup app_mailbox_internal Auxiliary internal types declarations + * @{ + * @ingroup app_mailbox + * @internal + * + * @brief Module for internal usage inside the library only + * + * Some definitions 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 Mailbox handle used for managing a mailbox queue. + */ + typedef struct + { + uint8_t r_idx; /**< Read index for the mailbox queue. */ + uint8_t w_idx; /**< Write index for the mailbox queue. */ + uint8_t len; /**< Number of elements currently in the mailbox queue. */ + app_mailbox_overflow_mode_t mode; /**< Mode of overflow handling. */ + } app_mailbox_cb_t; + + +/** @} + * @endcond + */ diff --git a/components/libraries/mem_manager/mem_manager.c b/components/libraries/mem_manager/mem_manager.c new file mode 100644 index 0000000..587d985 --- /dev/null +++ b/components/libraries/mem_manager/mem_manager.c @@ -0,0 +1,918 @@ +/* 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_config.h" +#include "sdk_common.h" +#include "mem_manager.h" +#include "app_trace.h" +#include "nrf_assert.h" + +/** + * @defgroup mem_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 enabled by defining the MEM_MANAGER_ENABLE_LOGS. + * + * @note If ENABLE_DEBUG_LOG_SUPPORT is disabled, having MEM_MANAGER_ENABLE_LOGS has no effect. + * @{ + */ +#if (MEM_MANAGER_ENABLE_LOGS == 1) + +#define MM_LOG app_trace_log /**< Used for logging details. */ +#define MM_ERR app_trace_log /**< Used for logging errors in the module. */ +#define MM_TRC app_trace_log /**< Used for getting trace of execution in the module. */ +#define MM_DUMP app_trace_dump /**< Used for dumping octet information. */ + +#else //MEM_MANAGER_ENABLE_LOGS + +#define MM_DUMP(...) /**< Disables dumping of octet streams. */ +#define MM_LOG(...) /**< Disables detailed logs. */ +#define MM_ERR(...) /**< Disables error logs. */ +#define MM_TRC(...) /**< Disables traces. */ + +#endif //MEM_MANAGER_ENABLE_LOGS +/** @} */ + +#ifdef MEM_MANAGER_ENABLE_DIAGNOSTICS +#if (MEM_MANAGER_DIAGNOSTICS_LOGS_ONLY == 1) +#define MMD_LOG app_trace_log /**< Used for logging diagnostic details. */ +#else +#define MMD_LOG MM_LOG /**< Diagnostoc logs same as other module logs, and depend on definition of MEM_MANAGER_ENABLE_LOGS */ +#endif //MEM_MANAGER_DIAGNOSTICS_LOGS_ONLY +#endif //MEM_MANAGER_ENABLE_DIAGNOSTICS + +/** + * @defgroup memory_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 MM_MUTEX_LOCK() SDK_MUTEX_LOCK(m_mm_mutex) /**< Lock module using mutex. */ +#define MM_MUTEX_UNLOCK() SDK_MUTEX_UNLOCK(m_mm_mutex) /**< Unlock module using mutex. */ +/** @} */ + +#if (MEM_MANAGER_DISABLE_API_PARAM_CHECK == 0) + +/** + * @brief Macro for verifying NULL parameters. + * Returning with an appropriate error code on failure. + * + * @param[in] PARAM Parameter checked for NULL. + * + * @retval (NRF_ERROR_NULL | MEMORY_MANAGER_ERR_BASE) when @ref PARAM is NULL. + */ +#define NULL_PARAM_CHECK(PARAM) \ + if ((PARAM) == NULL) \ + { \ + return (NRF_ERROR_NULL | MEMORY_MANAGER_ERR_BASE); \ + } + +/** + * @brief Macro for verifying NULL parameters are not passed to API and returning on failure. + * + * @param[in] PARAM Parameter checked for NULL. + */ +#define NULL_PARAM_CHECK_VOID(PARAM) \ + if ((PARAM) == NULL) \ + { \ + return; \ + } + + +/** + * @brief Macro for verifying module's initialization status. + * Returning with an appropriate error code on failure. + * + * @retval (NRF_ERROR_INVALID_STATE | MEMORY_MANAGER_ERR_BASE) module is uninitialized. + */ +#define VERIFY_MODULE_INITIALIZED() \ + do \ + { \ + if (!m_module_initialized) \ + { \ + return (NRF_ERROR_INVALID_STATE | MEMORY_MANAGER_ERR_BASE); \ + } \ + } while (0) + +/** + * @brief Macro for verifying module's initialization status and returning on failure. + */ +#define VERIFY_MODULE_INITIALIZED_VOID() \ + do \ + { \ + if (!m_module_initialized) \ + { \ + return; \ + } \ + } while (0) + + +/** + * @brief Macro for verifying requested size of memory does not exceed maximum block + * size supported by the module. Returning with appropriate error code on failure. + * + * @param[in] SIZE Requested size to be allocated. + * + * @retval (NRF_ERROR_INVALID_PARAM | MEMORY_MANAGER_ERR_BASE) if requested size is greater + * than the largest block size managed by the module. + */ +#define VERIFY_REQUESTED_SIZE(SIZE) \ + do \ + { \ + if (((SIZE) == 0) ||((SIZE) > MAX_MEM_SIZE)) \ + { \ + return (NRF_ERROR_INVALID_PARAM | MEMORY_MANAGER_ERR_BASE); \ + } \ + } while (0) + + +/** + * @brief Macro for verifying requested size of memory does not exceed maximum block + * size supported by the module. Returnson failure. + * + * @param[in] SIZE Requested size to be allocated. + */ +#define VERIFY_REQUESTED_SIZE_VOID(SIZE) \ + do \ + { \ + if (((SIZE) == 0) ||((SIZE) > MAX_MEM_SIZE)) \ + { \ + return; \ + } \ + } while (0) + + +/**@} */ +#else //MEM_MANAGER_DISABLE_API_PARAM_CHECK + +#define NULL_PARAM_CHECK(PARAM) +#define VERIFY_MODULE_INITIALIZED() +#define VERIFY_REQUESTED_SIZE(SIZE) + +#endif //MEM_MANAGER_DISABLE_API_PARAM_CHECK + + +/**@brief Setting defualts in case XXSmall block not used by application. */ +#ifndef MEMORY_MANAGER_XXSMALL_BLOCK_COUNT + #define MEMORY_MANAGER_XXSMALL_BLOCK_COUNT 0 + #define MEMORY_MANAGER_XXSMALL_BLOCK_SIZE 0 + #define XXSMALL_BLOCK_START 0 + #define XXSMALL_BLOCK_END 0 + #define XXSMALL_MEMORY_START 0 +#endif // MEMORY_MANAGER_XXSMALL_BLOCK_SIZE + + +/**@brief Setting defualts in case XSmall block not used by application. */ +#ifndef MEMORY_MANAGER_XSMALL_BLOCK_COUNT + #define MEMORY_MANAGER_XSMALL_BLOCK_COUNT 0 + #define MEMORY_MANAGER_XSMALL_BLOCK_SIZE 0 + #define XSMALL_BLOCK_START 0 + #define XSMALL_BLOCK_END 0 + #define XSMALL_MEMORY_START 0 +#endif // MEMORY_MANAGER_XSMALL_BLOCK_SIZE + + +/**@brief Setting defualts in case Small block not used by application. */ +#ifndef MEMORY_MANAGER_SMALL_BLOCK_COUNT + #define MEMORY_MANAGER_SMALL_BLOCK_COUNT 0 + #define MEMORY_MANAGER_SMALL_BLOCK_SIZE 0 + #define SMALL_BLOCK_START 0 + #define SMALL_BLOCK_END 0 + #define SMALL_MEMORY_START 0 +#endif // MEMORY_MANAGER_SMALL_BLOCK_COUNT + + +/**@brief Setting defualts in case Medium block not used by application. */ +#ifndef MEMORY_MANAGER_MEDIUM_BLOCK_COUNT + #define MEMORY_MANAGER_MEDIUM_BLOCK_COUNT 0 + #define MEMORY_MANAGER_MEDIUM_BLOCK_SIZE 0 + #define MEDIUM_BLOCK_START 0 + #define MEDIUM_BLOCK_END 0 + #define MEDIUM_MEMORY_START 0 +#endif // MEMORY_MANAGER_MEDIUM_BLOCK_COUNT + + +/**@brief Setting defualts in case Large block not used by application. */ +#ifndef MEMORY_MANAGER_LARGE_BLOCK_COUNT + #define MEMORY_MANAGER_LARGE_BLOCK_COUNT 0 + #define MEMORY_MANAGER_LARGE_BLOCK_SIZE 0 + #define LARGE_BLOCK_START 0 + #define LARGE_BLOCK_END 0 + #define LARGE_MEMORY_START 0 +#endif // MEMORY_MANAGER_LARGE_BLOCK_COUNT + + +/**@brief Setting defualts in case XLarge block not used by application. */ +#ifndef MEMORY_MANAGER_XLARGE_BLOCK_COUNT + #define MEMORY_MANAGER_XLARGE_BLOCK_COUNT 0 + #define MEMORY_MANAGER_XLARGE_BLOCK_SIZE 0 + #define XLARGE_BLOCK_START 0 + #define XLARGE_BLOCK_END 0 + #define XLARGE_MEMORY_START 0 +#endif // MEMORY_MANAGER_XLARGE_BLOCK_COUNT + + +/**@brief Setting defualts in case XXLarge block not used by application. */ +#ifndef MEMORY_MANAGER_XXLARGE_BLOCK_COUNT + #define MEMORY_MANAGER_XXLARGE_BLOCK_COUNT 0 + #define MEMORY_MANAGER_XXLARGE_BLOCK_SIZE 0 + #define XXLARGE_BLOCK_START 0 + #define XXLARGE_BLOCK_END 0 + #define XXLARGE_MEMORY_START 0 +#endif // MEMORY_MANAGER_XXLARGE_BLOCK_COUNT + + +/**@brief Based on which blocks are defined, MAX_MEM_SIZE is determined. + * + * @note Also, in case none of these are defined, a compile time error is indicated. + */ +#if (MEMORY_MANAGER_XXLARGE_BLOCK_COUNT != 0) + #define MAX_MEM_SIZE MEMORY_MANAGER_XXLARGE_BLOCK_SIZE +#elif (MEMORY_MANAGER_XLARGE_BLOCK_COUNT != 0) + #define MAX_MEM_SIZE MEMORY_MANAGER_XLARGE_BLOCK_SIZE +#elif (MEMORY_MANAGER_LARGE_BLOCK_COUNT != 0) + #define MAX_MEM_SIZE MEMORY_MANAGER_LARGE_BLOCK_SIZE +#elif (MEMORY_MANAGER_MEDIUM_BLOCK_COUNT != 0) + #define MAX_MEM_SIZE MEMORY_MANAGER_MEDIUM_BLOCK_SIZE +#elif (MEMORY_MANAGER_SMALL_BLOCK_COUNT != 0) + #define MAX_MEM_SIZE MEMORY_MANAGER_SMALL_BLOCK_SIZE +#elif (MEMORY_MANAGER_XSMALL_BLOCK_COUNT != 0) + #define MAX_MEM_SIZE MEMORY_MANAGER_XSMALL_BLOCK_SIZE +#elif (MEMORY_MANAGER_XXSMALL_BLOCK_COUNT != 0) + #define MAX_MEM_SIZE MEMORY_MANAGER_XXSMALL_BLOCK_SIZE +#else + #err "One of MEMORY_MANAGER_SMALL_BLOCK_COUNT, MEMORY_MANAGER_MEDIUM_BLOCK_COUNT or \ + or MEMORY_MANAGER_LARGE_BLOCK_COUNT should be defined." +#endif + +/**@brief XXSmall block start index in case XXSmall Block is defined. */ +#ifndef XXSMALL_BLOCK_START +#define XXSMALL_BLOCK_START 0 +#endif // XXSMALL_BLOCK_START + + +/**@brief XSmall block start index in case XSmall Block is defined. */ +#ifndef XSMALL_BLOCK_START +#define XSMALL_BLOCK_START (XXSMALL_BLOCK_START + MEMORY_MANAGER_XXSMALL_BLOCK_COUNT) +#endif // XSMALL_BLOCK_START + + +/**@brief Small block start index in case Small Block is defined. */ +#ifndef SMALL_BLOCK_START +#define SMALL_BLOCK_START (XSMALL_BLOCK_START + MEMORY_MANAGER_XSMALL_BLOCK_COUNT) +#endif // SMALL_BLOCK_START + + +/**@brief Medium block start index in case Medium Block is defined. */ +#ifndef MEDIUM_BLOCK_START +#define MEDIUM_BLOCK_START (SMALL_BLOCK_START + MEMORY_MANAGER_SMALL_BLOCK_COUNT) +#endif // MEDIUM_BLOCK_START + + +/**@brief Large block start index in case Large Block is defined. */ +#ifndef LARGE_BLOCK_START +#define LARGE_BLOCK_START (MEDIUM_BLOCK_START + MEMORY_MANAGER_MEDIUM_BLOCK_COUNT) +#endif // LARGE_BLOCK_START + + +/**@brief XLarge block start index in case XLarge Block is defined. */ +#ifndef XLARGE_BLOCK_START +#define XLARGE_BLOCK_START (LARGE_BLOCK_START + MEMORY_MANAGER_LARGE_BLOCK_COUNT) +#endif // XLARGE_BLOCK_START + +/**@brief XXLarge block start index in case XXLarge Block is defined. */ +#ifndef XXLARGE_BLOCK_START +#define XXLARGE_BLOCK_START (XLARGE_BLOCK_START + MEMORY_MANAGER_XLARGE_BLOCK_COUNT) +#endif //XXLARGE_BLOCK_START + + +/**@brief XXSmall block end index in case XXSmall Block is defined. */ +#ifndef XXSMALL_BLOCK_END +#define XXSMALL_BLOCK_END (XXSMALL_BLOCK_START + MEMORY_MANAGER_XXSMALL_BLOCK_COUNT) +#endif // XXSMALL_BLOCK_END + +/**@brief XSmall block end index in case XSmall Block is defined. */ +#ifndef XSMALL_BLOCK_END +#define XSMALL_BLOCK_END (XSMALL_BLOCK_START + MEMORY_MANAGER_XSMALL_BLOCK_COUNT) +#endif // XSMALL_BLOCK_END + + +/**@brief Small block end index in case Small Block is defined. */ +#ifndef SMALL_BLOCK_END +#define SMALL_BLOCK_END (SMALL_BLOCK_START + MEMORY_MANAGER_SMALL_BLOCK_COUNT) +#endif // SMALL_BLOCK_END + + +/**@brief Medium block end index in case Medium Block is defined. */ +#ifndef MEDIUM_BLOCK_END +#define MEDIUM_BLOCK_END (MEDIUM_BLOCK_START + MEMORY_MANAGER_MEDIUM_BLOCK_COUNT) +#endif // MEDIUM_BLOCK_END + + +/**@brief Large block end index in case Large Block is defined. */ +#ifndef LARGE_BLOCK_END +#define LARGE_BLOCK_END (LARGE_BLOCK_START + MEMORY_MANAGER_LARGE_BLOCK_COUNT) +#endif // LARGE_BLOCK_END + + +/**@brief XLarge block end index in case XLarge Block is defined. */ +#ifndef XLARGE_BLOCK_END +#define XLARGE_BLOCK_END (XLARGE_BLOCK_START + MEMORY_MANAGER_XLARGE_BLOCK_COUNT) +#endif // XLARGE_BLOCK_END + + +/**@brief XXLarge block end index in case XXLarge Block is defined. */ +#ifndef XXLARGE_BLOCK_END +#define XXLARGE_BLOCK_END (XXLARGE_BLOCK_START + MEMORY_MANAGER_XXLARGE_BLOCK_COUNT) +#endif //XXLARGE_BLOCK_END + + +#define XXSMALL_MEMORY_SIZE (MEMORY_MANAGER_XXSMALL_BLOCK_COUNT * MEMORY_MANAGER_XXSMALL_BLOCK_SIZE) +#define XSMALL_MEMORY_SIZE (MEMORY_MANAGER_XSMALL_BLOCK_COUNT * MEMORY_MANAGER_XSMALL_BLOCK_SIZE) +#define SMALL_MEMORY_SIZE (MEMORY_MANAGER_SMALL_BLOCK_COUNT * MEMORY_MANAGER_SMALL_BLOCK_SIZE) +#define MEDIUM_MEMORY_SIZE (MEMORY_MANAGER_MEDIUM_BLOCK_COUNT * MEMORY_MANAGER_MEDIUM_BLOCK_SIZE) +#define LARGE_MEMORY_SIZE (MEMORY_MANAGER_LARGE_BLOCK_COUNT * MEMORY_MANAGER_LARGE_BLOCK_SIZE) +#define XLARGE_MEMORY_SIZE (MEMORY_MANAGER_XLARGE_BLOCK_COUNT * MEMORY_MANAGER_XLARGE_BLOCK_SIZE) +#define XXLARGE_MEMORY_SIZE (MEMORY_MANAGER_XXLARGE_BLOCK_COUNT * MEMORY_MANAGER_XXLARGE_BLOCK_SIZE) + + +/**@brief XXSmall memory start index in case XXSmall Block is defined. */ +#ifndef XXSMALL_MEMORY_START +#define XXSMALL_MEMORY_START 0 +#endif // XXSMALL_MEMORY_START + + +/**@brief XSmall memory start index in case XSmall Block is defined. */ +#ifndef XSMALL_MEMORY_START +#define XSMALL_MEMORY_START (XXSMALL_MEMORY_START + XXSMALL_MEMORY_SIZE) +#endif // XSMALL_MEMORY_START + + +/**@brief Small memory start index in case Small Block is defined. */ +#ifndef SMALL_MEMORY_START +#define SMALL_MEMORY_START (XSMALL_MEMORY_START + XSMALL_MEMORY_SIZE) +#endif // SMALL_MEMORY_START + + +/**@brief Medium memory start index in case Medium Block is defined. */ +#ifndef MEDIUM_MEMORY_START +#define MEDIUM_MEMORY_START (SMALL_MEMORY_START + SMALL_MEMORY_SIZE) +#endif // MEDIUM_MEMORY_START + + +/**@brief Large memory start index in case Large Block is defined. */ +#ifndef LARGE_MEMORY_START +#define LARGE_MEMORY_START (MEDIUM_MEMORY_START + MEDIUM_MEMORY_SIZE) +#endif // LARGE_MEMORY_START + + +/**@brief XLarge memory start index in case XLarge Block is defined. */ +#ifndef XLARGE_MEMORY_START +#define XLARGE_MEMORY_START (LARGE_MEMORY_START + LARGE_MEMORY_SIZE) +#endif // XLARGE_MEMORY_START + + +/**@brief XXLarge memory start index in case XXLarge Block is defined. */ +#ifndef XXLARGE_MEMORY_START +#define XXLARGE_MEMORY_START (XLARGE_MEMORY_START + XLARGE_MEMORY_SIZE) +#endif // XLARGE_MEMORY_START + + +/**@brief Total count of block managed by the module. */ +#define TOTAL_BLOCK_COUNT (MEMORY_MANAGER_XXSMALL_BLOCK_COUNT + \ + MEMORY_MANAGER_XSMALL_BLOCK_COUNT + \ + MEMORY_MANAGER_SMALL_BLOCK_COUNT + \ + MEMORY_MANAGER_MEDIUM_BLOCK_COUNT + \ + MEMORY_MANAGER_LARGE_BLOCK_COUNT + \ + MEMORY_MANAGER_XLARGE_BLOCK_COUNT + \ + MEMORY_MANAGER_XLARGE_BLOCK_COUNT) + + +/**@brief Total memory managed by the module. */ +#define TOTAL_MEMORY_SIZE (XXSMALL_MEMORY_SIZE + \ + XSMALL_MEMORY_SIZE + \ + SMALL_MEMORY_SIZE + \ + MEDIUM_MEMORY_SIZE + \ + LARGE_MEMORY_SIZE + \ + XLARGE_MEMORY_SIZE + \ + XXLARGE_MEMORY_SIZE) + + +#define BLOCK_CAT_COUNT 7 /**< Block category count is 7 (xxsmall, xsmall, small, medium, large, xlarge, xxlarge). Having one of the block count to zero has no impact on this count. */ +#define BLOCK_CAT_XXS 0 /**< Extra Extra Small category identifier. */ +#define BLOCK_CAT_XS 1 /**< Extra Small category identifier. */ +#define BLOCK_CAT_SMALL 2 /**< Small category identifier. */ +#define BLOCK_CAT_MEDIUM 3 /**< Medium category identifier. */ +#define BLOCK_CAT_LARGE 4 /**< Large category identifier. */ +#define BLOCK_CAT_XL 5 /**< Extra Large category identifier. */ +#define BLOCK_CAT_XXL 6 /**< Extra Extra Large category identifier. */ + +#define BITMAP_SIZE 32 /**< Bitmap size for each word used to contain block information. */ +#define BLOCK_BITMAP_ARRAY_SIZE CEIL_DIV(TOTAL_BLOCK_COUNT, BITMAP_SIZE) /**< Determines number of blocks needed for book keeping availability status of all blocks. */ + + +/**@brief Lookup table for maximum memory size per block category. */ +static const uint32_t m_block_size[BLOCK_CAT_COUNT] = +{ + MEMORY_MANAGER_XXSMALL_BLOCK_SIZE, + MEMORY_MANAGER_XSMALL_BLOCK_SIZE, + MEMORY_MANAGER_SMALL_BLOCK_SIZE, + MEMORY_MANAGER_MEDIUM_BLOCK_SIZE, + MEMORY_MANAGER_LARGE_BLOCK_SIZE, + MEMORY_MANAGER_XLARGE_BLOCK_SIZE, + MEMORY_MANAGER_XXLARGE_BLOCK_SIZE +}; + +/**@brief Lookup table for block start index for each block caetgory. */ +static const uint32_t m_block_start[BLOCK_CAT_COUNT] = +{ + XXSMALL_BLOCK_START, + XSMALL_BLOCK_START, + SMALL_BLOCK_START, + MEDIUM_BLOCK_START, + LARGE_BLOCK_START, + XLARGE_BLOCK_START, + XXLARGE_BLOCK_START +}; + +/**@brief Lookup table for last block index for each block category. */ +static const uint32_t m_block_end[BLOCK_CAT_COUNT] = +{ + XXSMALL_BLOCK_END, + XSMALL_BLOCK_END, + SMALL_BLOCK_END, + MEDIUM_BLOCK_END, + LARGE_BLOCK_END, + XLARGE_BLOCK_END, + XXLARGE_BLOCK_END +}; + +/**@brief Lookup table for memory start range for each block category. */ +static const uint32_t m_block_mem_start[BLOCK_CAT_COUNT] = +{ + XXSMALL_MEMORY_START, + XSMALL_MEMORY_START, + SMALL_MEMORY_START, + MEDIUM_MEMORY_START, + LARGE_MEMORY_START, + XLARGE_MEMORY_START, + XXLARGE_MEMORY_START +}; + +static uint8_t m_memory[TOTAL_MEMORY_SIZE]; /**< Memory managed by the module. */ +static uint32_t m_mem_pool[BLOCK_BITMAP_ARRAY_SIZE]; /**< Bitmap used for book-keeping availability of all blocks managed by the module. */ + +#ifdef MEM_MANAGER_ENABLE_DIAGNOSTICS + +/**@brief Lookup table for descriptive strings for each block category. */ +static const char * m_block_desc_str[BLOCK_CAT_COUNT] = +{ + "XXSmall", + "XSmall", + "Small", + "Medium", + "Large", + "XLarge", + "XXLarge" +}; + +/**@brief Table for book keeping smallest size allocated in each block range. */ +static uint32_t m_min_size[BLOCK_CAT_COUNT] = +{ + MEMORY_MANAGER_XXSMALL_BLOCK_SIZE, + MEMORY_MANAGER_XSMALL_BLOCK_SIZE, + MEMORY_MANAGER_SMALL_BLOCK_SIZE, + MEMORY_MANAGER_MEDIUM_BLOCK_SIZE, + MEMORY_MANAGER_LARGE_BLOCK_SIZE, + MEMORY_MANAGER_XLARGE_BLOCK_SIZE, + MEMORY_MANAGER_XXLARGE_BLOCK_SIZE +}; + +/**@brief Table for book keeping largest size allocated in each block range. */ +static uint32_t m_max_size[BLOCK_CAT_COUNT]; + +/**@brief Global pointing to minimum size holder for block type being allocated. */ +static uint32_t * p_min_size; + +/**@brief Global pointing to maximum size holder for block type being allocated. */ +static uint32_t * p_max_size; + +/**@brief Lookup table for count of block available in each block category. */ +static uint32_t m_block_count[BLOCK_CAT_COUNT] = +{ + MEMORY_MANAGER_XXSMALL_BLOCK_COUNT, + MEMORY_MANAGER_XSMALL_BLOCK_COUNT, + MEMORY_MANAGER_SMALL_BLOCK_COUNT, + MEMORY_MANAGER_MEDIUM_BLOCK_COUNT, + MEMORY_MANAGER_LARGE_BLOCK_COUNT, + MEMORY_MANAGER_XLARGE_BLOCK_COUNT, + MEMORY_MANAGER_XXLARGE_BLOCK_COUNT +}; + +#endif // MEM_MANAGER_ENABLE_DIAGNOSTICS + +SDK_MUTEX_DEFINE(m_mm_mutex) /**< Mutex variable. Currently unused, this declaration does not occupy any space in RAM. */ +#if (MEM_MANAGER_DISABLE_API_PARAM_CHECK == 0) +static bool m_module_initialized = false; /**< State indicating if module is initialized or not. */ +#endif // MEM_MANAGER_DISABLE_API_PARAM_CHECK + + +/**@brief Function to get X and Y coordinates. + * + * @details Function to get X and Y co-ordinates for the block identified by index. + * Here, X determines relevant word for the block. Y determines the actual bit in the word. + * + * @param[in] index Identifies the block. + * @param[out] p_x Points to the word that contains the bit representing the block. + * @param[out] p_y Contains the bitnumber in the the word 'X' relevant to the block. + */ +static __INLINE void get_block_coordinates(uint32_t block_index, uint32_t * p_x, uint32_t * p_y) +{ + // Determine position of the block in the bitmap. + // X determines relevant word for the block. Y determines the actual bit in the word. + const uint32_t x = block_index/BITMAP_SIZE; + const uint32_t y = (block_index - x*BITMAP_SIZE); + + (*p_x) = x; + (*p_y) = y; +} + + +/**@brief Initializes the block by setting it to be free. */ +static void block_init (uint32_t block_index) +{ + uint32_t x; + uint32_t y; + + // Determine position of the block in the bitmap. + // X determines relevant word for the block. Y determines the actual bit in the word. + get_block_coordinates(block_index, &x, &y); + + // Set bit related to the block to indicate that the block is free. + SET_BIT(m_mem_pool[x], y); +} + + +/**@brief Function to get the category of the block of size 'size' or block number 'block_index'.*/ +static __INLINE uint32_t get_block_cat(uint32_t size, uint32_t block_index) +{ + for (uint32_t block_cat = 0; block_cat < BLOCK_CAT_COUNT; block_cat++) + { + if (((size != 0) && (size <= m_block_size[block_cat]) && + (m_block_end[block_cat] != m_block_start[block_cat])) || + (block_index < m_block_end[block_cat])) + { + return block_cat; + } + } + + return 0; +} + + +/**@brief Function to get the size of the block number 'block_index'. */ +static __INLINE uint32_t get_block_size(uint32_t block_index) +{ + const uint32_t block_cat = get_block_cat(0, block_index); + + #ifdef MEM_MANAGER_ENABLE_DIAGNOSTICS + p_min_size = &m_min_size[block_cat]; + p_max_size = &m_max_size[block_cat]; + #endif // MEM_MANAGER_ENABLE_DIAGNOSTICS + + return m_block_size[block_cat]; +} + + +/**@brief Function to free the block identified by block number 'block_index'. */ +static bool is_block_free(uint32_t block_index) +{ + uint32_t x; + uint32_t y; + + // Determine position of the block in the bitmap. + // X determines relevant word for the block. Y determines the actual bit in the word. + get_block_coordinates(block_index, &x, &y); + + return IS_SET(m_mem_pool[x], y); +} + + +/**@brief Function to allocate the block identified by block number 'block_index'. */ +static void block_allocate(uint32_t block_index) +{ + uint32_t x; + uint32_t y; + + // Determine position of the block in the bitmap. + // X determines relevant word for the block. Y determines the actual bit in the word. + get_block_coordinates(block_index, &x, &y); + + CLR_BIT(m_mem_pool[x], y); +} + + +uint32_t nrf_mem_init(void) +{ + MM_LOG("[MM]: >> nrf_mem_init.\r\n"); + + SDK_MUTEX_INIT(m_mm_mutex); + + MM_MUTEX_LOCK(); + + uint32_t block_index = 0; + + for(block_index = 0; block_index < TOTAL_BLOCK_COUNT; block_index++) + { + block_init(block_index); + } + +#if (MEM_MANAGER_DISABLE_API_PARAM_CHECK == 0) + m_module_initialized = true; +#endif // MEM_MANAGER_DISABLE_API_PARAM_CHECK + +#ifdef MEM_MANAGER_ENABLE_DIAGNOSTICS + nrf_mem_diagnose(); +#endif // MEM_MANAGER_ENABLE_DIAGNOSTICS + + MM_MUTEX_UNLOCK(); + + MM_LOG("[MM]: << nrf_mem_init.\r\n"); + + return NRF_SUCCESS; +} + + +uint32_t nrf_mem_reserve(uint8_t ** pp_buffer, uint32_t * p_size) +{ + VERIFY_MODULE_INITIALIZED(); + NULL_PARAM_CHECK(pp_buffer); + NULL_PARAM_CHECK(p_size); + + const uint32_t requested_size = (*p_size); + + VERIFY_REQUESTED_SIZE(requested_size); + + MM_LOG("[MM]: >> nrf_mem_reserve, size 0x%04lX.\r\n", requested_size); + + MM_MUTEX_LOCK(); + + const uint32_t block_cat = get_block_cat(requested_size, TOTAL_BLOCK_COUNT); + uint32_t block_index = m_block_start[block_cat]; + uint32_t memory_index = m_block_mem_start[block_cat]; + uint32_t err_code = (NRF_ERROR_NO_MEM | MEMORY_MANAGER_ERR_BASE); + + MM_LOG("[MM]: Start index for the pool = 0x%08lX, total block count 0x%08X\r\n", + block_index, + TOTAL_BLOCK_COUNT); + + for (; block_index < TOTAL_BLOCK_COUNT; block_index++) + { + uint32_t block_size = get_block_size(block_index); + + if (is_block_free(block_index) == true) + { + MM_LOG("[MM]: Reserving block 0x%08lX\r\n", block_index); + + // Search succeeded, found free block. + err_code = NRF_SUCCESS; + + // Allocate block. + block_allocate(block_index); + + (*pp_buffer) = &m_memory[memory_index]; + (*p_size) = block_size; + + #ifdef MEM_MANAGER_ENABLE_DIAGNOSTICS + (*p_min_size) = MIN((*p_min_size), requested_size); + (*p_max_size) = MAX((*p_max_size), requested_size); + #endif // MEM_MANAGER_ENABLE_DIAGNOSTICS + + break; + } + memory_index += block_size; + } + if (err_code != NRF_SUCCESS) + { + MM_LOG ("[MM]: Memory reservation result %d, memory %p, size %d!", + err_code, + (*pp_buffer), + (*p_size)); + + #ifdef MEM_MANAGER_ENABLE_DIAGNOSTICS + nrf_mem_diagnose(); + #endif // MEM_MANAGER_ENABLE_DIAGNOSTICS + } + + MM_MUTEX_UNLOCK(); + + MM_LOG("[MM]: << nrf_mem_reserve %p, result 0x%08lX.\r\n", (*pp_buffer), err_code); + + return err_code; +} + + +void * nrf_malloc(uint32_t size) +{ + uint8_t * buffer = NULL; + uint32_t allocated_size = size; + + uint32_t retval = nrf_mem_reserve(&buffer, &allocated_size); + + if (retval != NRF_SUCCESS) + { + buffer = NULL; + } + + return buffer; +} + + +void * nrf_calloc(uint32_t count, uint32_t size) +{ + uint8_t * buffer = NULL; + uint32_t allocated_size = (size * count); + + MM_LOG ("[nrf_calloc]: Requested size %d, count %d\r\n", allocated_size, count); + + uint32_t retval = nrf_mem_reserve(&buffer,&allocated_size); + if (retval == NRF_SUCCESS) + { + MM_LOG ("[nrf_calloc]: buffer %p, total size %d\r\n", buffer, allocated_size); + memset(buffer,0, allocated_size); + } + else + { + MM_LOG("[nrf_calloc]: Failed to allocate memory %d\r\n", allocated_size); + buffer = NULL; + } + + return buffer; +} + + +void nrf_free(void * p_mem) +{ + VERIFY_MODULE_INITIALIZED_VOID(); + NULL_PARAM_CHECK_VOID(p_mem); + + MM_LOG("[MM]: >> nrf_free %p.\r\n", p_mem); + + MM_MUTEX_LOCK(); + + uint32_t index; + uint32_t memory_index = 0; + + for (index = 0; index < TOTAL_BLOCK_COUNT; index++) + { + if (&m_memory[memory_index] == p_mem) + { + // Found a free block of memory, assign. + MM_LOG("[MM]: << Freeing block %d.\r\n", index); + block_init(index); + break; + } + memory_index += get_block_size(index); + } + + MM_MUTEX_UNLOCK(); + + MM_LOG("[MM]: << nrf_free.\r\n"); + return; +} + + +void * nrf_realloc(void * p_mem, uint32_t size) +{ + return p_mem; +} + + +#ifdef MEM_MANAGER_ENABLE_DIAGNOSTICS + +/**@brief Function to format and print information with respect to each block. + * + * @details Internal function that formats and prints information related to the block category + * identified by 'block_cat'. This function also appends the number of bytes in use to + * p_mem_in_use based on current count of block in the category. + * + * @param[in] block_cat Identifies the category of block. + * @param[out] p_mem_in_use Updates the memory in use based on count in use. + */ +void print_block_info(uint32_t block_cat, uint32_t * p_mem_in_use) +{ + #define PRINT_COLUMN_WIDTH 13 + #define PRINT_BUFFER_SIZE 80 + #define ASCII_VALUE_FOR_SPACE 32 + + char print_buffer[PRINT_BUFFER_SIZE]; + const uint32_t total_count = (m_block_start[block_cat] + m_block_count[block_cat]); + uint32_t in_use = 0; + uint32_t num_of_blocks = 0; + uint32_t index = m_block_start[block_cat]; + uint32_t column_number; + + // No statistic provided in case block category is not included. + if (m_block_count[block_cat] != 0) + { + memset(print_buffer, ASCII_VALUE_FOR_SPACE, PRINT_BUFFER_SIZE); + + for (; index < total_count; index++) + { + if (is_block_free(index) == false) + { + num_of_blocks++; + in_use += m_block_size[block_cat]; + } + } + + column_number = 0; + snprintf(&print_buffer[column_number * PRINT_COLUMN_WIDTH], + PRINT_COLUMN_WIDTH, + "| %s", + m_block_desc_str[block_cat]); + + column_number++; + snprintf(&print_buffer[column_number * PRINT_COLUMN_WIDTH], + PRINT_COLUMN_WIDTH, + "| %d", + m_block_size[block_cat]); + + column_number++; + snprintf(&print_buffer[column_number * PRINT_COLUMN_WIDTH], + PRINT_COLUMN_WIDTH, + "| %d", + m_block_count[block_cat]); + + column_number++; + snprintf(&print_buffer[column_number * PRINT_COLUMN_WIDTH], + PRINT_COLUMN_WIDTH, + "| %d", + num_of_blocks); + + column_number++; + snprintf(&print_buffer[column_number * PRINT_COLUMN_WIDTH], + PRINT_COLUMN_WIDTH, + "| %d", + m_min_size[block_cat]); + + column_number++; + snprintf(&print_buffer[column_number * PRINT_COLUMN_WIDTH], + PRINT_COLUMN_WIDTH, + "| %d", + m_max_size[block_cat]); + + column_number++; + const uint32_t column_end = (column_number * PRINT_COLUMN_WIDTH); + + for (int j = 0; j < column_end; j ++) + { + if (print_buffer[j] == 0) + { + print_buffer[j] = 0x20; + } + } + snprintf(&print_buffer[column_end], 2, "|"); + + MMD_LOG("%s\r\n", print_buffer); + + (*p_mem_in_use) += in_use; + } +} + + +void nrf_mem_diagnose(void) +{ + uint32_t in_use = 0; + + MMD_LOG ("\r\n"); + MMD_LOG ("+------------+------------+------------+------------+------------+------------+\r\n"); + MMD_LOG ("| Block | Size | Total | In Use | Min Alloc | Max Alloc |\r\n"); + MMD_LOG ("+------------+------------+------------+------------+------------+------------+\r\n"); + + print_block_info(BLOCK_CAT_XXS, &in_use); + print_block_info(BLOCK_CAT_XS, &in_use); + print_block_info(BLOCK_CAT_SMALL, &in_use); + print_block_info(BLOCK_CAT_MEDIUM, &in_use); + print_block_info(BLOCK_CAT_LARGE, &in_use); + print_block_info(BLOCK_CAT_XL, &in_use); + print_block_info(BLOCK_CAT_XXL, &in_use); + + MMD_LOG ("+------------+------------+------------+------------+------------+------------+\r\n"); + MMD_LOG ("| Total | %d | %d | %d\r\n", + TOTAL_MEMORY_SIZE, TOTAL_BLOCK_COUNT,in_use); + MMD_LOG ("+------------+------------+------------+------------+------------+------------+\r\n"); +} + +#endif // MEM_MANAGER_ENABLE_DIAGNOSTICS +/** @} */ diff --git a/components/libraries/mem_manager/mem_manager.h b/components/libraries/mem_manager/mem_manager.h new file mode 100644 index 0000000..c65f7d7 --- /dev/null +++ b/components/libraries/mem_manager/mem_manager.h @@ -0,0 +1,139 @@ +/* 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. + * + */ + +/** @file + * + * @defgroup mem_manager Memory Manager + * @{ + * @ingroup app_common + * @brief Memory Manager for the \nRFXX SDK + * + * @details This module allows for dynamic use of memory. Currently, + * this module can be used only to allocate and free memory in the RAM. + * + * The Memory Manager manages static memory blocks of fixed sizes. These blocks can be requested for + * usage, and freed when the application no longer needs them. A maximum of seven block categories + * can be managed by the module. These block categories are identified by xxsmall, xmall, small, + * medium, large, xlarge, and xxlarge. They are ordered in increasing block sizes. + * The size and the count of each of the block categories can be configured based on the application + * requirements in the configuration file @c sdk_config.h. + * To use fewer than seven buffer pools, do not define the count for the unwanted block + * or explicitly set it to zero. At least one block category must be configured + * for this module to function as expected. + */ + +#ifndef MEM_MANAGER_H__ +#define MEM_MANAGER_H__ + +#include "sdk_common.h" + + +/**@brief Initializes Memory Manager. + * + * @details API to initialize the Memory Manager. Always call this API before using any of the other + * APIs of the module. This API should be called only once. + * + * @retval NRF_SUCCESS If initialization was successful. + * Otherwise, an error code that indicates the reason for the failure is returned. + * + * @warning If this API fails, the application shall not proceed with using other APIs of this + * module. + */ +uint32_t nrf_mem_init(void); + + +/**@brief Reserves a block of memory for the application. + * + * @details API to request a contiguous memory block of the given length. If + * the memory allocation succeeds, pp_buffer points to the memory block. If + * the memory allocation fails, pp_buffer points to NULL and the return value of + * the API indicates the reason for the failure. The memory block reserved using this API can + * be freed using the @ref nrf_free function. + * + * @param[out] pp_buffer Pointer to the allocated memory block if memory allocation + * succeeds; otherwise points to NULL. + * @param[inout] p_size Requested memory size. This parameter returns the actual size + * allocated. If the procedure was successful, the actual size + * returned is always greater than or equal to requested size, + * never less. + * + * @retval NRF_SUCCESS If memory was successfully allocated. + * Otherwise, an error code indicating the reason for failure. + * @retval NRF_ERROR_INVALID_PARAM If the requested memory size is zero or greater than the + * largest memory block that the module is configured to + * support. + * @retval NRF_ERROR_NO_MEM If there is no memory available of the requested size. + */ +uint32_t nrf_mem_reserve(uint8_t ** pp_buffer, uint32_t * p_size); + + +/**@brief 'malloc' styled memory allocation function. + * + * @details API to allocate memory, same as nrf_mem_reserve but uses malloc signature. + * + * @param[in] size Requested memory size. + * + * @retval Valid memory location if the procedure was successful, else, NULL. + */ +void * nrf_malloc(uint32_t size); + + +/**@brief 'calloc' styled memory allocation function. + * + * @details API to allocate zero-initialized memory of size count*size. + * + * @param[in] nmemb Number of elements of 'size' bytes. + * @param[in] size Size of each element allocated. + * + * @retval Valid, zero-initialized memory location if the procedure was successful, else, NULL. + */ +void * nrf_calloc(uint32_t nmemb, uint32_t size); + + +/**@brief Free allocated memory - standard 'free' styles API. + * + * @details API to resubmit memory allocated, same in functionality nrf_free. + * + * @param[out] p_buffer Pointer to the memory block that is being freed. + */ +void nrf_free(void * p_buffer); + + +/**@brief Memory reallocation (trim) function. + * + * @details API to reallocate memory or to trim it. Trim is mentioned here to avoid use of API to + * request memory size larger than original memory allocated. + * + * @param[in] p_buffer Pointer to the memory block that needs to be trimmed. + * @param[in] size Size of memory at the beginning of the buffer to be left untrimmed. + * + * @retval Pointer to memory location with trimmed size, else, NULL. + */ +void * nrf_realloc(void *p_buffer, uint32_t size); + +#ifdef MEM_MANAGER_ENABLE_DIAGNOSTICS + +/**@brief Function to print statstics related to memory blocks managed by memory manager. + * + * @details This API prints information with respects to each block function, including size, total + * block count, number of blocks in use at the time of printing, smallest memory size + * allocated in the block and the largest one. This API is intended to help developers + * tune the block sizes to make optimal use of memory for the application. + * This functionality is never needed in final application and therefore, is disabled by + * default. + */ +void nrf_mem_diagnose(void); + +#endif // MEM_MANAGER_ENABLE_DIAGNOSTICS + +#endif // MEM_MANAGER_H__ +/** @} */ diff --git a/components/libraries/pwm/app_pwm.c b/components/libraries/pwm/app_pwm.c new file mode 100644 index 0000000..9ad4a7a --- /dev/null +++ b/components/libraries/pwm/app_pwm.c @@ -0,0 +1,847 @@ +/* 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 "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 + +/** + * @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)); + + if (ticks + ((nrf_timer_frequency_get(p_instance->p_timer->p_reg) == NRF_TIMER_FREQ_16MHz) ? 1 : 0) + < p_ch_cb->pulsewidth) + { + // For lower value, we need one more transition. Timer task delay is included. + // If prescaler is enabled, 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. + */ +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; + } + 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; + } + } + + // 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, + .interrupt_priority = APP_IRQ_PRIORITY_LOW, + .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/components/libraries/pwm/app_pwm.h b/components/libraries/pwm/app_pwm.h new file mode 100644 index 0000000..7c619f1 --- /dev/null +++ b/components/libraries/pwm/app_pwm.h @@ -0,0 +1,295 @@ +/* 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 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/components/libraries/scheduler/app_scheduler.c b/components/libraries/scheduler/app_scheduler.c new file mode 100644 index 0000000..c170a4d --- /dev/null +++ b/components/libraries/scheduler/app_scheduler.c @@ -0,0 +1,192 @@ +/* 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 "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. */ + +/**@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; + + return NRF_SUCCESS; +} + + +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); + } + + 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/components/libraries/scheduler/app_scheduler.h b/components/libraries/scheduler/app_scheduler.h new file mode 100644 index 0000000..da2fa6c --- /dev/null +++ b/components/libraries/scheduler/app_scheduler.h @@ -0,0 +1,153 @@ +/* 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_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_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/components/libraries/scheduler/app_scheduler_serconn.c b/components/libraries/scheduler/app_scheduler_serconn.c new file mode 100644 index 0000000..fc3babf --- /dev/null +++ b/components/libraries/scheduler/app_scheduler_serconn.c @@ -0,0 +1,229 @@ +/* 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 "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. */ + +static uint32_t m_scheduler_paused_counter = 0; /**< Counter storing the difference between pausing + and resuming the scheduler. */ + +/**@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(void) +{ + 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(void) +{ + 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; + + return NRF_SUCCESS; +} + + +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); + } + + 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_pause(void) +{ + CRITICAL_REGION_ENTER(); + + if (m_scheduler_paused_counter < UINT32_MAX) + { + m_scheduler_paused_counter++; + } + CRITICAL_REGION_EXIT(); +} + + +void app_sched_resume(void) +{ + CRITICAL_REGION_ENTER(); + + if (m_scheduler_paused_counter > 0) + { + m_scheduler_paused_counter--; + } + CRITICAL_REGION_EXIT(); +} + +/**@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) +{ + return (m_scheduler_paused_counter > 0); +} + + +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 ((!is_app_sched_paused()) && + (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/components/libraries/sensorsim/sensorsim.c b/components/libraries/sensorsim/sensorsim.c new file mode 100644 index 0000000..7a0b35d --- /dev/null +++ b/components/libraries/sensorsim/sensorsim.c @@ -0,0 +1,73 @@ +/* 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 "sensorsim.h" + + +void sensorsim_init(sensorsim_state_t * p_state, + const sensorsim_cfg_t * p_cfg) +{ + if (p_cfg->start_at_max) + { + p_state->current_val = p_cfg->max; + p_state->is_increasing = false; + } + else + { + p_state->current_val = p_cfg->min; + p_state->is_increasing = true; + } +} + + +uint32_t sensorsim_measure(sensorsim_state_t * p_state, + const sensorsim_cfg_t * p_cfg) +{ + if (p_state->is_increasing) + { + sensorsim_increment(p_state, p_cfg); + } + else + { + sensorsim_decrement(p_state, p_cfg); + } + return p_state->current_val; +} + +void sensorsim_increment(sensorsim_state_t * p_state, + const sensorsim_cfg_t * p_cfg) +{ + if (p_cfg->max - p_state->current_val > p_cfg->incr) + { + p_state->current_val += p_cfg->incr; + } + else + { + p_state->current_val = p_cfg->max; + p_state->is_increasing = false; + } +} + + +void sensorsim_decrement(sensorsim_state_t * p_state, + const sensorsim_cfg_t * p_cfg) +{ + if (p_state->current_val - p_cfg->min > p_cfg->incr) + { + p_state->current_val -= p_cfg->incr; + } + else + { + p_state->current_val = p_cfg->min; + p_state->is_increasing = true; + } +} diff --git a/components/libraries/sensorsim/sensorsim.h b/components/libraries/sensorsim/sensorsim.h new file mode 100644 index 0000000..3d2674b --- /dev/null +++ b/components/libraries/sensorsim/sensorsim.h @@ -0,0 +1,85 @@ +/* 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 ble_sdk_lib_sensorsim Sensor Data Simulator + * @{ + * @ingroup ble_sdk_lib + * @brief Functions for simulating sensor data. + * + * @details Currently only a triangular waveform simulator is implemented. + */ + +#ifndef SENSORSIM_H__ +#define SENSORSIM_H__ + +#include +#include + +/**@brief Triangular waveform sensor simulator configuration. */ +typedef struct +{ + uint32_t min; /**< Minimum simulated value. */ + uint32_t max; /**< Maximum simulated value. */ + uint32_t incr; /**< Increment between each measurement. */ + bool start_at_max; /**< TRUE is measurement is to start at the maximum value, FALSE if it is to start at the minimum. */ +} sensorsim_cfg_t; + +/**@brief Triangular waveform sensor simulator state. */ +typedef struct +{ + uint32_t current_val; /**< Current sensor value. */ + bool is_increasing; /**< TRUE if the simulator is in increasing state, FALSE otherwise. */ +} sensorsim_state_t; + +/**@brief Function for initializing a triangular waveform sensor simulator. + * + * @param[out] p_state Current state of simulator. + * @param[in] p_cfg Simulator configuration. + */ +void sensorsim_init(sensorsim_state_t * p_state, + const sensorsim_cfg_t * p_cfg); + +/**@brief Function for generating a simulated sensor measurement using a triangular waveform generator. + * + * @param[in,out] p_state Current state of simulator. + * @param[in] p_cfg Simulator configuration. + * + * @return Simulator output. + */ +uint32_t sensorsim_measure(sensorsim_state_t * p_state, + const sensorsim_cfg_t * p_cfg); + +/**@brief Function for incrementing a simulated sensor measurement value. + * + * @param[in,out] p_state Current state of simulator. + * @param[in] p_cfg Simulator configuration. + * + * @return Simulator output. + */ +void sensorsim_increment(sensorsim_state_t * p_state, + const sensorsim_cfg_t * p_cfg); + +/**@brief Function for decrementing a simulated sensor measurement value. + * + * @param[in,out] p_state Current state of simulator. + * @param[in] p_cfg Simulator configuration. + * + * @return Simulator output. + */ +void sensorsim_decrement(sensorsim_state_t * p_state, + const sensorsim_cfg_t * p_cfg); + +#endif // SENSORSIM_H__ + +/** @} */ diff --git a/components/libraries/sha256/sha256.c b/components/libraries/sha256/sha256.c new file mode 100644 index 0000000..df574c5 --- /dev/null +++ b/components/libraries/sha256/sha256.c @@ -0,0 +1,188 @@ + +/* 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 +#include +#include "sha256.h" +#include "sdk_errors.h" + + +#define ROTLEFT(a,b) (((a) << (b)) | ((a) >> (32-(b)))) +#define ROTRIGHT(a,b) (((a) >> (b)) | ((a) << (32-(b)))) + +#define CH(x,y,z) (((x) & (y)) ^ (~(x) & (z))) +#define MAJ(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) +#define EP0(x) (ROTRIGHT(x,2) ^ ROTRIGHT(x,13) ^ ROTRIGHT(x,22)) +#define EP1(x) (ROTRIGHT(x,6) ^ ROTRIGHT(x,11) ^ ROTRIGHT(x,25)) +#define SIG0(x) (ROTRIGHT(x,7) ^ ROTRIGHT(x,18) ^ ((x) >> 3)) +#define SIG1(x) (ROTRIGHT(x,17) ^ ROTRIGHT(x,19) ^ ((x) >> 10)) + + +static const uint32_t k[64] = { + 0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5, + 0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174, + 0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da, + 0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967, + 0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85, + 0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070, + 0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3, + 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2 +}; + + +/**@brief Function for calculating the hash of a 64-byte section of data. + * + * @param[in,out] ctx Hash instance. + * @param[in] data Aray with data to be hashed. Assumed to be 64 bytes long. + */ +void sha256_transform(sha256_context_t *ctx, const uint8_t * data) +{ + uint32_t a, b, c, d, e, f, g, h, i, j, t1, t2, m[64]; + + for (i = 0, j = 0; i < 16; ++i, j += 4) + m[i] = (data[j] << 24) | (data[j + 1] << 16) | (data[j + 2] << 8) | (data[j + 3]); + for ( ; i < 64; ++i) + m[i] = SIG1(m[i - 2]) + m[i - 7] + SIG0(m[i - 15]) + m[i - 16]; + + a = ctx->state[0]; + b = ctx->state[1]; + c = ctx->state[2]; + d = ctx->state[3]; + e = ctx->state[4]; + f = ctx->state[5]; + g = ctx->state[6]; + h = ctx->state[7]; + + for (i = 0; i < 64; ++i) { + t1 = h + EP1(e) + CH(e,f,g) + k[i] + m[i]; + t2 = EP0(a) + MAJ(a,b,c); + h = g; + g = f; + f = e; + e = d + t1; + d = c; + c = b; + b = a; + a = t1 + t2; + } + + ctx->state[0] += a; + ctx->state[1] += b; + ctx->state[2] += c; + ctx->state[3] += d; + ctx->state[4] += e; + ctx->state[5] += f; + ctx->state[6] += g; + ctx->state[7] += h; +} + + +ret_code_t sha256_init(sha256_context_t *ctx) +{ + if (ctx == NULL) + { + return NRF_ERROR_NULL; + } + + ctx->datalen = 0; + ctx->bitlen = 0; + ctx->state[0] = 0x6a09e667; + ctx->state[1] = 0xbb67ae85; + ctx->state[2] = 0x3c6ef372; + ctx->state[3] = 0xa54ff53a; + ctx->state[4] = 0x510e527f; + ctx->state[5] = 0x9b05688c; + ctx->state[6] = 0x1f83d9ab; + ctx->state[7] = 0x5be0cd19; + + return NRF_SUCCESS; +} + + +ret_code_t sha256_update(sha256_context_t *ctx, const uint8_t * data, size_t len) +{ + if ((ctx == NULL) || ((len > 0) && (data == NULL))) + { + return NRF_ERROR_NULL; + } + + uint32_t i; + + for (i = 0; i < len; ++i) { + ctx->data[ctx->datalen] = data[i]; + ctx->datalen++; + if (ctx->datalen == 64) { + sha256_transform(ctx, ctx->data); + ctx->bitlen += 512; + ctx->datalen = 0; + } + } + + return NRF_SUCCESS; +} + + +ret_code_t sha256_final(sha256_context_t *ctx, uint8_t * hash) +{ + if ((ctx == NULL) || (hash == NULL)) + { + return NRF_ERROR_NULL; + } + + uint32_t i; + + i = ctx->datalen; + + // Pad whatever data is left in the buffer. + if (ctx->datalen < 56) { + ctx->data[i++] = 0x80; + while (i < 56) + ctx->data[i++] = 0x00; + } + else { + ctx->data[i++] = 0x80; + while (i < 64) + ctx->data[i++] = 0x00; + sha256_transform(ctx, ctx->data); + memset(ctx->data, 0, 56); + } + + // Append to the padding the total message's length in bits and transform. + ctx->bitlen += (uint64_t)ctx->datalen * 8; + ctx->data[63] = ctx->bitlen; + ctx->data[62] = ctx->bitlen >> 8; + ctx->data[61] = ctx->bitlen >> 16; + ctx->data[60] = ctx->bitlen >> 24; + ctx->data[59] = ctx->bitlen >> 32; + ctx->data[58] = ctx->bitlen >> 40; + ctx->data[57] = ctx->bitlen >> 48; + ctx->data[56] = ctx->bitlen >> 56; + sha256_transform(ctx, ctx->data); + + // Since this implementation uses little endian uint8_t ordering and SHA uses big endian, + // reverse all the uint8_ts when copying the final state to the output hash. + for (i = 0; i < 4; ++i) { + hash[i] = (ctx->state[0] >> (24 - i * 8)) & 0x000000ff; + hash[i + 4] = (ctx->state[1] >> (24 - i * 8)) & 0x000000ff; + hash[i + 8] = (ctx->state[2] >> (24 - i * 8)) & 0x000000ff; + hash[i + 12] = (ctx->state[3] >> (24 - i * 8)) & 0x000000ff; + hash[i + 16] = (ctx->state[4] >> (24 - i * 8)) & 0x000000ff; + hash[i + 20] = (ctx->state[5] >> (24 - i * 8)) & 0x000000ff; + hash[i + 24] = (ctx->state[6] >> (24 - i * 8)) & 0x000000ff; + hash[i + 28] = (ctx->state[7] >> (24 - i * 8)) & 0x000000ff; + } + + return NRF_SUCCESS; +} diff --git a/components/libraries/sha256/sha256.h b/components/libraries/sha256/sha256.h new file mode 100644 index 0000000..56d70d3 --- /dev/null +++ b/components/libraries/sha256/sha256.h @@ -0,0 +1,91 @@ + +/* 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 sha256 SHA-256 hash library + * @{ + * @ingroup app_common + * + * @brief This module calculates SHA-256 (SHA-2, FIPS-180) hashes. + * + * @details To use this module, first call @ref sha256_init on a @ref sha256_context_t instance. Then call @ref + * sha256_update with the data to be hashed. This step can optionally be done with multiple + * calls to @ref sha256_update, each with a section of the data (in the correct order). + * After all data has been passed to @ref sha256_update, call @ref sha256_final to finalize + * and extract the hash value. + * + * This code is adapted from code by Brad Conte, retrieved from + * https://github.com/B-Con/crypto-algorithms. + * + */ + +#ifndef SHA256_H +#define SHA256_H + + +#include +#include "sdk_errors.h" + + +/**@brief Current state of a hash operation. + */ +typedef struct { + uint8_t data[64]; + uint32_t datalen; + uint64_t bitlen; + uint32_t state[8]; +} sha256_context_t; + + +/**@brief Function for initializing a @ref sha256_context_t instance. + * + * @param[out] ctx Context instance to be initialized. + * + * @retval NRF_SUCCESS If the instance was successfully initialized. + * @retval NRF_ERROR_NULL If the parameter was NULL. + */ +ret_code_t sha256_init(sha256_context_t *ctx); + +/**@brief Function for calculating the hash of an array of uint8_t data. + * + * @details This function can be called multiple times in sequence. This is equivalent to calling + * the function once on a concatenation of the data from the different calls. + * + * @param[in,out] ctx Hash instance. + * @param[in] data Data to be hashed. + * @param[in] len Length of the data to be hashed. + * + * @retval NRF_SUCCESS If the data was successfully hashed. + * @retval NRF_ERROR_NULL If the ctx parameter was NULL or the data parameter was NULL, while the len parameter was not zero. + */ +ret_code_t sha256_update(sha256_context_t *ctx, const uint8_t * data, const size_t len); + +/**@brief Function for extracting the hash value from a hash instance. + * + * @details This function should be called after all data to be hashed has been passed to the hash + * instance (by one or more calls to @ref sha256_update). + * + * Do not call @ref sha256_update again after @ref sha256_final has been called. + * + * @param[in,out] ctx Hash instance. + * @param[out] hash Array to hold the extracted hash value (assumed to be 32 bytes long). + * + * @retval NRF_SUCCESS If the has value was successfully extracted. + * @retval NRF_ERROR_NULL If a parameter was NULL. + */ +ret_code_t sha256_final(sha256_context_t *ctx, uint8_t * hash); + +#endif // SHA256_H + +/** @} */ diff --git a/components/libraries/simple_timer/app_simple_timer.c b/components/libraries/simple_timer/app_simple_timer.c new file mode 100644 index 0000000..9890fce --- /dev/null +++ b/components/libraries/simple_timer/app_simple_timer.c @@ -0,0 +1,192 @@ +/* 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 "app_simple_timer.h" +#include "nrf.h" +#include "nordic_common.h" +#include "app_util_platform.h" +#include "app_error.h" +#include "nrf_timer.h" +#include "nrf_drv_timer.h" +#include +#include + +/**@brief States of simple timer state machine. + */ +typedef enum +{ + SIMPLE_TIMER_STATE_IDLE = 0, + SIMPLE_TIMER_STATE_INITIALIZED, + SIMPLE_TIMER_STATE_STOPPED, + SIMPLE_TIMER_STATE_STARTED +}simple_timer_states_t; + +static app_simple_timer_mode_t m_mode; /**< Registered timer mode. */ +static app_simple_timer_timeout_handler_t m_timeout_handler = NULL; /**< Registered time-out handler. */ +static void * mp_timeout_handler_context = NULL; /**< Registered time-out handler context. */ +static simple_timer_states_t m_simple_timer_state = SIMPLE_TIMER_STATE_IDLE; /**< State machine state. */ + +#define APP_SIMPLE_TIMER_INSTANCE 1 + +#if (APP_SIMPLE_TIMER_INSTANCE == 0) + #if (TIMER_CONFIG_MODE(0) != TIMER_MODE_MODE_Timer) + #error "Unsupported timer mode." + #endif + #if (TIMER_CONFIG_BIT_WIDTH(0) != TIMER_BITMODE_BITMODE_16Bit) + #error "Unsupported timer bit width." + #endif + const nrf_drv_timer_t SIMPLE_TIMER = NRF_DRV_TIMER_INSTANCE(0); +#elif (APP_SIMPLE_TIMER_INSTANCE == 1) + #if (TIMER_CONFIG_MODE(1) != TIMER_MODE_MODE_Timer) + #error "Unsupported timer mode." + #endif + #if (TIMER_CONFIG_BIT_WIDTH(1) != TIMER_BITMODE_BITMODE_16Bit) + #error "Unsupported timer bit width." + #endif + const nrf_drv_timer_t SIMPLE_TIMER = NRF_DRV_TIMER_INSTANCE(1); +#elif (APP_SIMPLE_TIMER_INSTANCE == 2) + #if (TIMER_CONFIG_MODE(2) != TIMER_MODE_MODE_Timer) + #error "Unsupported timer mode." + #endif + #if (TIMER_CONFIG_BIT_WIDTH(2) != TIMER_BITMODE_BITMODE_16Bit) + #error "Unsupported timer bit width." + #endif + const nrf_drv_timer_t SIMPLE_TIMER = NRF_DRV_TIMER_INSTANCE(2); +#else + #error "Wrong timer instance id." +#endif + +/** + * @brief Handler for timer events. + */ +static void app_simple_timer_event_handler(nrf_timer_event_t event_type, void * p_context) +{ + switch(event_type) + { + case NRF_TIMER_EVENT_COMPARE0: + if (m_mode == APP_SIMPLE_TIMER_MODE_SINGLE_SHOT) + { + m_simple_timer_state = SIMPLE_TIMER_STATE_STOPPED; + } + + //@note: No NULL check required as performed in timer_start(...). + m_timeout_handler(mp_timeout_handler_context); + break; + + default: + //Do nothing. + break; + } +} + +uint32_t app_simple_timer_init(void) +{ + uint32_t err_code = NRF_SUCCESS; + + err_code = nrf_drv_timer_init(&SIMPLE_TIMER, NULL, app_simple_timer_event_handler); + + if(NRF_SUCCESS == err_code) + { + m_simple_timer_state = SIMPLE_TIMER_STATE_INITIALIZED; + } + + return err_code; +} + +uint32_t app_simple_timer_start(app_simple_timer_mode_t mode, + app_simple_timer_timeout_handler_t timeout_handler, + uint16_t timeout_ticks, + void * p_context) +{ + uint32_t err_code = NRF_SUCCESS; + nrf_timer_short_mask_t timer_short; + + if (NULL == timeout_handler) + { + return NRF_ERROR_NULL; + } + + if (APP_SIMPLE_TIMER_MODE_REPEATED == mode) + { + timer_short = NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK; + } + else if(APP_SIMPLE_TIMER_MODE_SINGLE_SHOT == mode) + { + timer_short = NRF_TIMER_SHORT_COMPARE0_STOP_MASK; + } + else + { + return NRF_ERROR_INVALID_PARAM; + } + + if(SIMPLE_TIMER_STATE_IDLE == m_simple_timer_state) + { + return NRF_ERROR_INVALID_STATE; + } + + if(SIMPLE_TIMER_STATE_STARTED == m_simple_timer_state) + { + err_code = app_simple_timer_stop(); + APP_ERROR_CHECK(err_code); + } + + if(SIMPLE_TIMER_STATE_STOPPED == m_simple_timer_state) + { + nrf_drv_timer_clear(&SIMPLE_TIMER); + } + + m_mode = mode; + m_timeout_handler = timeout_handler; + mp_timeout_handler_context = p_context; + + nrf_drv_timer_extended_compare( + &SIMPLE_TIMER, NRF_TIMER_CC_CHANNEL0, (uint32_t)timeout_ticks, timer_short, true); + + if (m_simple_timer_state == SIMPLE_TIMER_STATE_STOPPED) + { + nrf_drv_timer_resume(&SIMPLE_TIMER); + } + else + { + nrf_drv_timer_enable(&SIMPLE_TIMER); + } + + + m_simple_timer_state = SIMPLE_TIMER_STATE_STARTED; + + return NRF_SUCCESS; +} + +uint32_t app_simple_timer_stop(void) +{ + if(SIMPLE_TIMER_STATE_STARTED == m_simple_timer_state) + { + nrf_drv_timer_pause(&SIMPLE_TIMER); + + m_simple_timer_state = SIMPLE_TIMER_STATE_STOPPED; + } + + return NRF_SUCCESS; +} + +uint32_t app_simple_timer_uninit(void) +{ + uint32_t err_code = NRF_SUCCESS; + + if(SIMPLE_TIMER_STATE_IDLE != m_simple_timer_state) + { + nrf_drv_timer_uninit(&SIMPLE_TIMER); + m_simple_timer_state = SIMPLE_TIMER_STATE_IDLE; + } + + return err_code; +} diff --git a/components/libraries/simple_timer/app_simple_timer.h b/components/libraries/simple_timer/app_simple_timer.h new file mode 100644 index 0000000..e8a4377 --- /dev/null +++ b/components/libraries/simple_timer/app_simple_timer.h @@ -0,0 +1,98 @@ +/* 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 lib_driver_simple_timer Simple Timer + * @{ + * @ingroup app_common + * + * @brief Simple timer module. + * + * Supported features and limitations: + * - Two modes: single shot mode and repeated mode. + * - No more than one timer can run simultaneously. + * - The timer is hard-coded to use the TIMER1 peripheral and compare channel 0. + */ + +#ifndef TIMER_H__ +#define TIMER_H__ + +#include + +/**@brief Timer time-out handler type. */ +typedef void (*app_simple_timer_timeout_handler_t)(void * p_context); + +/**@brief Timer modes. */ +typedef enum +{ + APP_SIMPLE_TIMER_MODE_SINGLE_SHOT, /**< The timer will expire only once. */ + APP_SIMPLE_TIMER_MODE_REPEATED /**< The timer will restart each time it expires. */ +} app_simple_timer_mode_t; + +/**@brief Function for configuring and setting up the timer hardware. + * + * @note Configuration parameters should be set in nrf_drv_config.h file. + * The TIMER1_CONFIG_MODE has to be set to NRF_TIMER_MODE_TIMER value. + * The TIMER1_CONFIG_BIT_WIDTH has to be set to NRF_TIMER_BIT_WIDTH_16 value. + * + * @retval NRF_SUCCESS If the operation is successful. + * @retval NRF_ERROR_INVALID_STATE If the operation fails because the timer is already initialized. + * @retval NRF_ERROR_INVALID_PARAM If the operation fails because some configuration parameter is + * not valid. + */ +uint32_t app_simple_timer_init(void); + +/**@brief Function for starting a timer. + * + * @note If this function is called for a timer that is already running, the currently running + * timer is stopped before starting the new one. + * + * @param[in] mode Timer mode (see @ref app_simple_timer_mode_t). + * @param[in] timeout_handler Function to be executed when the timer expires + * (see @ref app_simple_timer_timeout_handler_t). + * @param[in] timeout_ticks Number of timer ticks to time-out event. + * @param[in] p_context General purpose pointer. Will be passed to the time-out handler + * when the timer expires. + * + * @retval NRF_SUCCESS If the operation is successful. + * @retval NRF_ERROR_INVALID_STATE If the operation fails because @ref app_simple_timer_init has not + * been called and the operation is not allowed in this state. + * @retval NRF_ERROR_NULL If the operation fails because timeout_handler is NULL. + * @retval NRF_ERROR_INVALID_PARAM If the operation fails because "mode" parameter is not valid. + */ + +uint32_t app_simple_timer_start(app_simple_timer_mode_t mode, + app_simple_timer_timeout_handler_t timeout_handler, + uint16_t timeout_ticks, + void * p_context); + +/**@brief Function for stopping the timer. + * + * @retval NRF_SUCCESS If the operation is successful. + */ +uint32_t app_simple_timer_stop(void); + +/**@brief Function for uninitializing the timer. Should be called also when the timer is not used + * anymore to reach lowest power consumption in system. + * + * @note The function switches off the internal core of the timer to reach lowest power consumption + * in system. The startup time from this state may be longer compared to starting the timer + * from the stopped state. + * + * @retval NRF_SUCCESS If the operation is successful. + */ +uint32_t app_simple_timer_uninit(void); + +#endif // TIMER_H__ + +/** @} */ diff --git a/components/libraries/slip/slip.c b/components/libraries/slip/slip.c new file mode 100644 index 0000000..2337b43 --- /dev/null +++ b/components/libraries/slip/slip.c @@ -0,0 +1,112 @@ +/* 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 "slip.h" +#include "nrf_error.h" + +#define SLIP_END 0300 /* indicates end of packet */ +#define SLIP_ESC 0333 /* indicates byte stuffing */ +#define SLIP_ESC_END 0334 /* ESC ESC_END means END data byte */ +#define SLIP_ESC_ESC 0335 /* ESC ESC_ESC means ESC data byte */ + + +uint32_t slip_encode(uint8_t * p_output, uint8_t * p_input, uint32_t input_length, uint32_t output_buffer_length) +{ + uint32_t input_index; + uint32_t output_index; + + for (input_index = 0, output_index = 0; input_index < input_length && output_index < output_buffer_length; input_index++) + { + switch (p_input[input_index]) + { + case SLIP_END: + p_output[output_index++] = SLIP_END; + p_output[output_index++] = SLIP_ESC_END; + break; + + case SLIP_ESC: + p_output[output_index++] = SLIP_ESC; + p_output[output_index++] = SLIP_ESC_ESC; + break; + + default: + p_output[output_index++] = p_input[input_index]; + } + } + p_output[output_index++] = (uint8_t)SLIP_END; + p_output[output_index++] = (uint8_t)SLIP_END; // clarify that the packet has ended. + + return output_index; +} + + +uint32_t slip_decoding_add_char(uint8_t c, buffer_t * p_buf, slip_state_t * current_state) +{ + switch (*current_state) + { + case SLIP_DECODING: + if (c == SLIP_END) + { + *current_state = SLIP_END_RECEIVED; + } + else if (c == SLIP_ESC) + { + *current_state = SLIP_END_RECEIVED; + } + else + { + p_buf->p_buffer[p_buf->current_index++] = c; + p_buf->current_length++; + } + break; + + case SLIP_ESC_RECEIVED: + if (c == SLIP_ESC_ESC) + { + p_buf->p_buffer[p_buf->current_index++] = SLIP_ESC; + p_buf->current_length++; + *current_state = SLIP_DECODING; + } + else + { + // violation of protocol + *current_state = SLIP_CLEARING_INVALID_PACKET; + return NRF_ERROR_INVALID_DATA; + } + break; + + case SLIP_END_RECEIVED: + if (c == SLIP_ESC_END) + { + p_buf->p_buffer[p_buf->current_index++] = SLIP_END; + p_buf->current_length++; + *current_state = SLIP_DECODING; + } + else + { + // packet is finished + *current_state = SLIP_DECODING; + return NRF_SUCCESS; + } + break; + + case SLIP_CLEARING_INVALID_PACKET: + if (c == SLIP_END) + { + *current_state = SLIP_DECODING; + p_buf->current_index = 0; + p_buf->current_length = 0; + } + break; + } + return NRF_ERROR_BUSY; +} diff --git a/components/libraries/slip/slip.h b/components/libraries/slip/slip.h new file mode 100644 index 0000000..f4768a9 --- /dev/null +++ b/components/libraries/slip/slip.h @@ -0,0 +1,66 @@ +/* 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. + * + */ + +#ifndef SLIP_H__ +#define SLIP_H__ + +#include +#include "app_fifo.h" + +/** @file + * + * @defgroup slip SLIP encoding decoding + * @{ + * @ingroup app_common + * + * @brief This module encodes and decodes slip packages (RFC1055). + * + * @details The standard is described in https://tools.ietf.org/html/rfc1055 + */ + +typedef enum { + SLIP_DECODING, + SLIP_END_RECEIVED, + SLIP_ESC_RECEIVED, + SLIP_CLEARING_INVALID_PACKET, +} slip_state_t; + +typedef struct { + uint8_t * p_buffer; + uint32_t current_index; + uint32_t current_length; + uint32_t len; +} buffer_t; + +/**@brief Encodes a slip packet. + * + * @details Note that the encoded output data will be longer than the input data. + * + * @retval The length of the encoded packet. If it is smaller than the input length, an error has occurred. + */ +uint32_t slip_encode(uint8_t * p_output, uint8_t * p_input, uint32_t input_length, uint32_t output_buffer_length); + +/**@brief Decodes a slip packet. + * + * @details When decoding a slip packet, a state must be preserved. Initial state must be set to SLIP_DECODING. + * + * @retval NRF_SUCCESS when a packet is parsed. The length of the packet can be read out from p_buf->current_index + * @retval NRF_ERROR_BUSY when packet is not finished parsing + * @retval NRF_ERROR_INVALID_DATA when packet is encoded wrong. + This moves the decoding to SLIP_CLEARING_INVALID_PACKET, and will stay in this state until SLIP_END is encountered. + */ +uint32_t slip_decoding_add_char(uint8_t c, buffer_t * p_buf, slip_state_t * current_state); + + +#endif // SLIP_H__ + +/** @} */ diff --git a/components/libraries/timer/app_timer.c b/components/libraries/timer/app_timer.c new file mode 100644 index 0000000..b343184 --- /dev/null +++ b/components/libraries/timer/app_timer.c @@ -0,0 +1,1124 @@ +/* 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 "app_timer.h" +#include +#include "nrf.h" +#include "nrf_soc.h" +#include "app_error.h" +#include "nrf_delay.h" +#include "app_util.h" +#include "app_util_platform.h" + +#define RTC1_IRQ_PRI APP_IRQ_PRIORITY_LOW /**< Priority of the RTC1 interrupt (used for checking for timeouts and executing timeout handlers). */ +#define SWI_IRQ_PRI APP_IRQ_PRIORITY_LOW /**< 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 APP_HIGH_USER_ID 0 /**< User Id for the Application High "user". */ +#define APP_LOW_USER_ID 1 /**< User Id for the Application Low "user". */ +#define THREAD_MODE_USER_ID 2 /**< User Id for the Thread Mode "user". */ + +#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. */ + +#ifdef NRF51 +#define SWI_IRQn SWI0_IRQn +#define SWI_IRQHandler SWI0_IRQHandler +#elif defined NRF52 +#define SWI_IRQn SWI0_EGU0_IRQn +#define SWI_IRQHandler SWI0_EGU0_IRQHandler +#endif + +/**@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 user. + * + * @details For each user of the timer module, there will be a timer operations queue. This queue + * will hold timer operations issued by this user until the timer interrupt handler + * processes these operations. For the current implementation, there will be one user for + * each interrupt level available to the application (APP_HIGH, APP_LOW and THREAD_MODE), + * but the module can easily be modified to e.g. have one queue per process when using an + * RTOS. The purpose of the queues is to be able to have a completely lockless timer + * implementation. + */ +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 user_op_queue_size; /**< Queue size. */ + timer_user_op_t * p_user_op_queue; /**< Queue buffer. */ +} timer_user_t; + +STATIC_ASSERT(sizeof(timer_user_t) == APP_TIMER_USER_SIZE); +STATIC_ASSERT(sizeof(timer_user_t) % 4 == 0); + +/**@brief User id type. + * + * @details In the current implementation, this will automatically be generated from the current + * interrupt level. + */ +typedef uint32_t timer_user_id_t; + +#define CONTEXT_QUEUE_SIZE_MAX (2) + +static uint8_t m_user_array_size; /**< Size of timer user array. */ +static timer_user_t * mp_users = NULL; /**< Array of timer users. */ +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. */ + + +/**@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_id; + + // Remember the old head, so as to decide if new compare needs to be set. + p_timer_old_head = mp_timer_id_head; + + user_id = m_user_array_size; + while (user_id--) + { + timer_user_t * p_user = &mp_users[user_id]; + uint8_t user_ops_first = p_user->first; + + while (user_ops_first != p_user->last) + { + timer_user_op_t * p_user_op = &p_user->p_user_op_queue[user_ops_first]; + + // Traverse to next operation in queue. + user_ops_first++; + if (user_ops_first == p_user->user_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; + uint8_t user_id; + + // Remember the old head, so as to decide if new compare needs to be set. + p_timer_id_old_head = mp_timer_id_head; + + user_id = m_user_array_size; + while (user_id--) + { + timer_user_t * p_user = &mp_users[user_id]; + + // Handle insertions of timers. + while ((p_restart_list_head != NULL) || (p_user->first != p_user->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 = &p_user->p_user_op_queue[p_user->first]; + + p_user->first++; + if (p_user->first == p_user->user_op_queue_size) + { + p_user->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 + { + // No timers are running, stop RTC + rtc1_stop(); + } +} + + +/**@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; + + // 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] p_user User that the entry is to be enqueued for. + * @param[in] last_index Index of the next last index to be enqueued. + */ +static void user_op_enque(timer_user_t * p_user, uint8_t last_index) +{ + p_user->last = last_index; +} + + +/**@brief Function for allocating a new operations queue entry. + * + * @param[in] p_user User that the entry is to be allocated for. + * @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(timer_user_t * p_user, uint8_t * p_last_index) +{ + uint8_t last; + timer_user_op_t * p_user_op; + + last = p_user->last + 1; + if (last == p_user->user_op_queue_size) + { + // Overflow case. + last = 0; + } + if (last == p_user->first) + { + // Queue is full. + return NULL; + } + + *p_last_index = last; + p_user_op = &p_user->p_user_op_queue[p_user->last]; + + return p_user_op; +} + + +/**@brief Function for scheduling a Timer Start operation. + * + * @param[in] user_id Id of user calling this function. + * @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_user_id_t user_id, + timer_node_t * p_node, + uint32_t timeout_initial, + uint32_t timeout_periodic, + void * p_context) +{ + uint8_t last_index; + + timer_user_op_t * p_user_op = user_op_alloc(&mp_users[user_id], &last_index); + if (p_user_op == NULL) + { + return NRF_ERROR_NO_MEM; + } + + 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(&mp_users[user_id], last_index); + + timer_list_handler_sched(); + + return NRF_SUCCESS; +} + + +/**@brief Function for scheduling a Timer Stop operation. + * + * @param[in] user_id Id of user calling this function. + * @param[in] timer_id Id of timer to stop. + * + * @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_user_id_t user_id, timer_node_t * p_node) +{ + uint8_t last_index; + + timer_user_op_t * p_user_op = user_op_alloc(&mp_users[user_id], &last_index); + if (p_user_op == NULL) + { + return NRF_ERROR_NO_MEM; + } + + p_user_op->op_type = TIMER_USER_OP_TYPE_STOP; + p_user_op->p_node = p_node; + + user_op_enque(&mp_users[user_id], last_index); + + timer_list_handler_sched(); + + return NRF_SUCCESS; +} + + +/**@brief Function for scheduling a Timer Stop All operation. + * + * @param[in] user_id Id of user calling this function. + */ +static uint32_t timer_stop_all_op_schedule(timer_user_id_t user_id) +{ + uint8_t last_index; + + timer_user_op_t * p_user_op = user_op_alloc(&mp_users[user_id], &last_index); + if (p_user_op == NULL) + { + return NRF_ERROR_NO_MEM; + } + + p_user_op->op_type = TIMER_USER_OP_TYPE_STOP_ALL; + p_user_op->p_node = NULL; + + user_op_enque(&mp_users[user_id], last_index); + + timer_list_handler_sched(); + + return NRF_SUCCESS; +} + + +/**@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_queues_size, + void * p_buffer, + app_timer_evt_schedule_func_t evt_schedule_func) +{ + int i; + + // 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) + { + mp_users = 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 users array + m_user_array_size = APP_TIMER_INT_LEVELS; + mp_users = p_buffer; + + // Skip user array + p_buffer = &((uint8_t *)p_buffer)[APP_TIMER_INT_LEVELS * sizeof(timer_user_t)]; + + // Initialize operation queues + for (i = 0; i < APP_TIMER_INT_LEVELS; i++) + { + timer_user_t * p_user = &mp_users[i]; + + p_user->first = 0; + p_user->last = 0; + p_user->user_op_queue_size = op_queues_size; + p_user->p_user_op_queue = p_buffer; + + // Skip operation queue + p_buffer = &((uint8_t *)p_buffer)[op_queues_size * sizeof(timer_user_op_t)]; + } + + mp_timer_id_head = NULL; + m_ticks_elapsed_q_read_ind = 0; + m_ticks_elapsed_q_write_ind = 0; + + 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 + if (mp_users == NULL) + { + return NRF_ERROR_INVALID_STATE; + } + 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; +} + + +/**@brief Function for creating a timer user id from the current interrupt level. + * + * @return Timer user id. +*/ +static timer_user_id_t user_id_get(void) +{ + timer_user_id_t ret; + + STATIC_ASSERT(APP_TIMER_INT_LEVELS == 3); + + switch (current_int_priority_get()) + { + case APP_IRQ_PRIORITY_HIGH: + ret = APP_HIGH_USER_ID; + break; + + case APP_IRQ_PRIORITY_LOW: + ret = APP_LOW_USER_ID; + break; + + default: + ret = THREAD_MODE_USER_ID; + break; + } + + return ret; +} + + +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 + if (mp_users == NULL) + { + return NRF_ERROR_INVALID_STATE; + } + 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(user_id_get(), + 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 + if (mp_users == NULL) + { + return NRF_ERROR_INVALID_STATE; + } + 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(user_id_get(), p_node); +} + + +uint32_t app_timer_stop_all(void) +{ + // Check state + if (mp_users == NULL) + { + return NRF_ERROR_INVALID_STATE; + } + return timer_stop_all_op_schedule(user_id_get()); +} + + +uint32_t app_timer_cnt_get(uint32_t * p_ticks) +{ + *p_ticks = rtc1_counter_get(); + return NRF_SUCCESS; +} + + +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; +} + diff --git a/components/libraries/timer/app_timer.h b/components/libraries/timer/app_timer.h new file mode 100644 index 0000000..594cf63 --- /dev/null +++ b/components/libraries/timer/app_timer.h @@ -0,0 +1,277 @@ +/* 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 invokation 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 +#include +#include +#include "app_error.h" +#include "app_util.h" +#include "compiler_abstraction.h" + +#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(). */ + +#define APP_TIMER_NODE_SIZE 32 /**< Size of app_timer.timer_node_t (used to allocate data). */ +#define APP_TIMER_USER_OP_SIZE 24 /**< Size of app_timer.timer_user_op_t (only for use inside APP_TIMER_BUF_SIZE()). */ +#define APP_TIMER_USER_SIZE 8 /**< Size of app_timer.timer_user_t (only for use inside APP_TIMER_BUF_SIZE()). */ +#define APP_TIMER_INT_LEVELS 3 /**< Number of interrupt levels from where timer operations may be initiated (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 queues 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) \ + ( \ + ( \ + APP_TIMER_INT_LEVELS \ + * \ + (APP_TIMER_USER_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_QUEUES_SIZE Size of queues 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_QUEUES_SIZE, SCHEDULER_FUNC) \ + do \ + { \ + static uint32_t APP_TIMER_BUF[CEIL_DIV(APP_TIMER_BUF_SIZE((OP_QUEUES_SIZE) + 1), \ + sizeof(uint32_t))]; \ + uint32_t ERR_CODE = app_timer_init((PRESCALER), \ + (OP_QUEUES_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_queues_size Size of queues 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_queues_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. + * + * @param[out] p_ticks Current value of the RTC1 counter. + * + * @retval NRF_SUCCESS If the counter was successfully read. + */ +uint32_t app_timer_cnt_get(uint32_t * p_ticks); + +/**@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); + +#endif // APP_TIMER_H__ + +/** @} */ diff --git a/components/libraries/timer/app_timer_appsh.c b/components/libraries/timer/app_timer_appsh.c new file mode 100644 index 0000000..e4bf6ed --- /dev/null +++ b/components/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/components/libraries/timer/app_timer_appsh.h b/components/libraries/timer/app_timer_appsh.h new file mode 100644 index 0000000..a75d70b --- /dev/null +++ b/components/libraries/timer/app_timer_appsh.h @@ -0,0 +1,44 @@ +/* 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" + +#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); +#endif // APP_TIMER_APPSH_H + diff --git a/components/libraries/timer/app_timer_ble_gzll.c b/components/libraries/timer/app_timer_ble_gzll.c new file mode 100644 index 0000000..3f01859 --- /dev/null +++ b/components/libraries/timer/app_timer_ble_gzll.c @@ -0,0 +1,1124 @@ +/* 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 "app_timer.h" +#include +#include "nrf.h" +#include "nrf_soc.h" +#include "app_error.h" +#include "nrf_delay.h" +#include "app_util.h" +#include "app_util_platform.h" + +#define RTC1_IRQ_PRI APP_IRQ_PRIORITY_LOW /**< Priority of the RTC1 interrupt (used for checking for timeouts and executing timeout handlers). */ +#define SWI_IRQ_PRI APP_IRQ_PRIORITY_LOW /**< 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 APP_HIGH_USER_ID 0 /**< User Id for the Application High "user". */ +#define APP_LOW_USER_ID 1 /**< User Id for the Application Low "user". */ +#define THREAD_MODE_USER_ID 2 /**< User Id for the Thread Mode "user". */ + +#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. */ + +#ifdef NRF51 +#define SWI_IRQn SWI1_IRQn +#define SWI_IRQHandler SWI1_IRQHandler +#elif defined NRF52 +#define SWI_IRQn SWI1_EGU1_IRQn +#define SWI_IRQHandler SWI1_EGU1_IRQHandler +#endif + +/**@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 user. + * + * @details For each user of the timer module, there will be a timer operations queue. This queue + * will hold timer operations issued by this user until the timer interrupt handler + * processes these operations. For the current implementation, there will be one user for + * each interrupt level available to the application (APP_HIGH, APP_LOW and THREAD_MODE), + * but the module can easily be modified to e.g. have one queue per process when using an + * RTOS. The purpose of the queues is to be able to have a completely lockless timer + * implementation. + */ +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 user_op_queue_size; /**< Queue size. */ + timer_user_op_t * p_user_op_queue; /**< Queue buffer. */ +} timer_user_t; + +STATIC_ASSERT(sizeof(timer_user_t) == APP_TIMER_USER_SIZE); +STATIC_ASSERT(sizeof(timer_user_t) % 4 == 0); + +/**@brief User id type. + * + * @details In the current implementation, this will automatically be generated from the current + * interrupt level. + */ +typedef uint32_t timer_user_id_t; + +#define CONTEXT_QUEUE_SIZE_MAX (2) + +static uint8_t m_user_array_size; /**< Size of timer user array. */ +static timer_user_t * mp_users = NULL; /**< Array of timer users. */ +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. */ + + +/**@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. + 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_id; + + // Remember the old head, so as to decide if new compare needs to be set. + p_timer_old_head = mp_timer_id_head; + + user_id = m_user_array_size; + while (user_id--) + { + timer_user_t * p_user = &mp_users[user_id]; + uint8_t user_ops_first = p_user->first; + + while (user_ops_first != p_user->last) + { + timer_node_t * p_timer; + timer_user_op_t * p_user_op = &p_user->p_user_op_queue[user_ops_first]; + + // Traverse to next operation in queue. + user_ops_first++; + if (user_ops_first == p_user->user_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. + p_timer = p_user_op->p_node; + if (p_timer->is_running) + { + timer_list_remove(p_user_op->p_node); + p_timer->is_running = false; + } + 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; + p_timer->is_running = false; + + // 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; + uint8_t user_id; + + // Remember the old head, so as to decide if new compare needs to be set. + p_timer_id_old_head = mp_timer_id_head; + + user_id = m_user_array_size; + while (user_id--) + { + timer_user_t * p_user = &mp_users[user_id]; + + // Handle insertions of timers. + while ((p_restart_list_head != NULL) || (p_user->first != p_user->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 = &p_user->p_user_op_queue[p_user->first]; + + p_user->first++; + if (p_user->first == p_user->user_op_queue_size) + { + p_user->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. + timer_timeouts_check_sched(); + } + } + else + { + // No timers are running, stop RTC + rtc1_stop(); + } +} + + +/**@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; + + // 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] p_user User that the entry is to be enqueued for. + * @param[in] last_index Index of the next last index to be enqueued. + */ +static void user_op_enque(timer_user_t * p_user, uint8_t last_index) +{ + p_user->last = last_index; +} + + +/**@brief Function for allocating a new operations queue entry. + * + * @param[in] p_user User that the entry is to be allocated for. + * @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(timer_user_t * p_user, uint8_t * p_last_index) +{ + uint8_t last; + timer_user_op_t * p_user_op; + + last = p_user->last + 1; + if (last == p_user->user_op_queue_size) + { + // Overflow case. + last = 0; + } + if (last == p_user->first) + { + // Queue is full. + return NULL; + } + + *p_last_index = last; + p_user_op = &p_user->p_user_op_queue[p_user->last]; + + return p_user_op; +} + + +/**@brief Function for scheduling a Timer Start operation. + * + * @param[in] user_id Id of user calling this function. + * @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_user_id_t user_id, + timer_node_t * p_node, + uint32_t timeout_initial, + uint32_t timeout_periodic, + void * p_context) +{ + uint8_t last_index; + + timer_user_op_t * p_user_op = user_op_alloc(&mp_users[user_id], &last_index); + if (p_user_op == NULL) + { + return NRF_ERROR_NO_MEM; + } + + 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(&mp_users[user_id], last_index); + + timer_list_handler_sched(); + + return NRF_SUCCESS; +} + + +/**@brief Function for scheduling a Timer Stop operation. + * + * @param[in] user_id Id of user calling this function. + * @param[in] timer_id Id of timer to stop. + * + * @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_user_id_t user_id, timer_node_t * p_node) +{ + uint8_t last_index; + + timer_user_op_t * p_user_op = user_op_alloc(&mp_users[user_id], &last_index); + if (p_user_op == NULL) + { + return NRF_ERROR_NO_MEM; + } + + p_user_op->op_type = TIMER_USER_OP_TYPE_STOP; + p_user_op->p_node = p_node; + + user_op_enque(&mp_users[user_id], last_index); + + timer_list_handler_sched(); + + return NRF_SUCCESS; +} + + +/**@brief Function for scheduling a Timer Stop All operation. + * + * @param[in] user_id Id of user calling this function. + */ +static uint32_t timer_stop_all_op_schedule(timer_user_id_t user_id) +{ + uint8_t last_index; + + timer_user_op_t * p_user_op = user_op_alloc(&mp_users[user_id], &last_index); + if (p_user_op == NULL) + { + return NRF_ERROR_NO_MEM; + } + + p_user_op->op_type = TIMER_USER_OP_TYPE_STOP_ALL; + p_user_op->p_node = NULL; + + user_op_enque(&mp_users[user_id], last_index); + + timer_list_handler_sched(); + + return NRF_SUCCESS; +} + + +/**@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_queues_size, + void * p_buffer, + app_timer_evt_schedule_func_t evt_schedule_func) +{ + int i; + + // 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) + { + mp_users = 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 users array + m_user_array_size = APP_TIMER_INT_LEVELS; + mp_users = p_buffer; + + // Skip user array + p_buffer = &((uint8_t *)p_buffer)[APP_TIMER_INT_LEVELS * sizeof(timer_user_t)]; + + // Initialize operation queues + for (i = 0; i < APP_TIMER_INT_LEVELS; i++) + { + timer_user_t * p_user = &mp_users[i]; + + p_user->first = 0; + p_user->last = 0; + p_user->user_op_queue_size = op_queues_size; + p_user->p_user_op_queue = p_buffer; + + // Skip operation queue + p_buffer = &((uint8_t *)p_buffer)[op_queues_size * sizeof(timer_user_op_t)]; + } + + mp_timer_id_head = NULL; + m_ticks_elapsed_q_read_ind = 0; + m_ticks_elapsed_q_write_ind = 0; + + 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 + if (mp_users == NULL) + { + return NRF_ERROR_INVALID_STATE; + } + 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; +} + + +/**@brief Function for creating a timer user id from the current interrupt level. + * + * @return Timer user id. +*/ +static timer_user_id_t user_id_get(void) +{ + timer_user_id_t ret; + + STATIC_ASSERT(APP_TIMER_INT_LEVELS == 3); + + switch (current_int_priority_get()) + { + case APP_IRQ_PRIORITY_HIGH: + ret = APP_HIGH_USER_ID; + break; + + case APP_IRQ_PRIORITY_LOW: + ret = APP_LOW_USER_ID; + break; + + default: + ret = THREAD_MODE_USER_ID; + break; + } + + return ret; +} + + +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 + if (mp_users == NULL) + { + return NRF_ERROR_INVALID_STATE; + } + 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(user_id_get(), + 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 + if (mp_users == NULL) + { + return NRF_ERROR_INVALID_STATE; + } + if ((timer_id == NULL) || (p_node->p_timeout_handler == NULL)) + { + return NRF_ERROR_INVALID_STATE; + } + + // Schedule timer stop operation + return timer_stop_op_schedule(user_id_get(), p_node); +} + + +uint32_t app_timer_stop_all(void) +{ + // Check state + if (mp_users == NULL) + { + return NRF_ERROR_INVALID_STATE; + } + return timer_stop_all_op_schedule(user_id_get()); +} + + +uint32_t app_timer_cnt_get(uint32_t * p_ticks) +{ + *p_ticks = rtc1_counter_get(); + return NRF_SUCCESS; +} + + +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; +} + diff --git a/components/libraries/timer/app_timer_freertos.c b/components/libraries/timer/app_timer_freertos.c new file mode 100644 index 0000000..78e4645 --- /dev/null +++ b/components/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 "FreeRTOS.h" +#include "task.h" +#include "timers.h" + +#include "app_timer.h" +#include +#include +#include "nrf.h" +#include "app_error.h" +#include "app_util.h" +#include "nordic_common.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(pinfo)); + + 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; +} diff --git a/components/libraries/timer/app_timer_rtx.c b/components/libraries/timer/app_timer_rtx.c new file mode 100644 index 0000000..1c01708 --- /dev/null +++ b/components/libraries/timer/app_timer_rtx.c @@ -0,0 +1,235 @@ +#include "app_timer.h" +#include +#include "nrf.h" +#include "nrf_soc.h" +#include "app_error.h" +#include "app_util.h" +#include "cmsis_os.h" + +#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[5]; + 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; + uint8_t state; + uint8_t type; + uint16_t reserved; + uint16_t tcnt; + uint16_t icnt; + void * arg; + const osTimerDef_t * timer; +} 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 & 3) + return NULL; + +#ifdef OS_SECTIONS_LINK_INFO + + if ((os_section_id$$Base != 0) && (os_section_id$$Limit != 0)) + { + 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; + + 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(uint32_t * p_ticks) +{ + *p_ticks = os_tick_val(); + return NRF_SUCCESS; +} + + +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; +} + + diff --git a/components/libraries/trace/app_trace.c b/components/libraries/trace/app_trace.c new file mode 100644 index 0000000..2ca3a1f --- /dev/null +++ b/components/libraries/trace/app_trace.c @@ -0,0 +1,83 @@ +/* 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 +#include +#include +#include + + +#ifdef ENABLE_DEBUG_LOG_SUPPORT +#include "app_uart.h" +#include "nordic_common.h" +#include "boards.h" +#include "app_trace.h" +#include "app_error.h" + +#ifndef UART_TX_BUF_SIZE + #define UART_TX_BUF_SIZE 1024 /**< UART TX buffer size. */ +#endif +#ifndef UART_RX_BUF_SIZE + #define UART_RX_BUF_SIZE 1 /**< UART RX buffer size. */ +#endif +__WEAK void uart_error_handle(app_uart_evt_t * p_event) +{ + if (p_event->evt_type == APP_UART_COMMUNICATION_ERROR) + { + //Skipping communication errors, they are only for Rx and app_trace is Tx only. + //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); + } +} + +void app_trace_init(void) +{ + uint32_t err_code = NRF_SUCCESS; + const app_uart_comm_params_t comm_params = + { + RX_PIN_NUMBER, + TX_PIN_NUMBER, + RTS_PIN_NUMBER, + CTS_PIN_NUMBER, + APP_UART_FLOW_CONTROL_DISABLED, + false, + UART_BAUDRATE_BAUDRATE_Baud38400 + }; + + APP_UART_FIFO_INIT(&comm_params, + UART_RX_BUF_SIZE, + UART_TX_BUF_SIZE, + uart_error_handle, + APP_IRQ_PRIORITY_LOW, + err_code); + UNUSED_VARIABLE(err_code); +} + +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/components/libraries/trace/app_trace.h b/components/libraries/trace/app_trace.h new file mode 100644 index 0000000..d138a42 --- /dev/null +++ b/components/libraries/trace/app_trace.h @@ -0,0 +1,55 @@ +#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 +/** + * @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 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/components/libraries/twi/app_twi.c b/components/libraries/twi/app_twi.c new file mode 100644 index 0000000..5662bfa --- /dev/null +++ b/components/libraries/twi/app_twi.c @@ -0,0 +1,354 @@ +/* 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 "app_twi.h" +#include "nrf_assert.h" +#include "app_util_platform.h" + + +// Increase specified queue index and when it goes outside the queue move it +// on the beginning of the queue. +#define INCREASE_IDX(idx, p_queue) \ + do { \ + ++idx; \ + p_queue->idx = (idx > p_queue->size) ? 0 : idx; \ + } while (0) + + +static bool queue_put(app_twi_queue_t * p_queue, + app_twi_transaction_t const * p_transaction) +{ + // [use a local variable to avoid using two volatile variables in one + // expression] + uint8_t write_idx = p_queue->write_idx; + + // If the queue is already full, we cannot put any more elements into it. + if ((write_idx == p_queue->size && p_queue->read_idx == 0) || + write_idx == p_queue->read_idx-1) + { + return false; + } + + // Write the new element on the position specified by the write index. + p_queue->p_buffer[write_idx] = p_transaction; + // Increase the write index and when it goes outside the queue move it + // on the beginning. + INCREASE_IDX(write_idx, p_queue); + + return true; +} + + +static app_twi_transaction_t const * queue_get(app_twi_queue_t * p_queue) +{ + // [use a local variable to avoid using two volatile variables in one + // expression] + uint8_t read_idx = p_queue->read_idx; + + // If the queue is empty, we cannot return any more elements from it. + if (read_idx == p_queue->write_idx) + { + return NULL; + } + + // Read the element from the position specified by the read index. + app_twi_transaction_t const * p_transaction = p_queue->p_buffer[read_idx]; + // Increase the read index and when it goes outside the queue move it + // on the beginning. + INCREASE_IDX(read_idx, p_queue); + + return p_transaction; +} + + +static ret_code_t start_transfer(app_twi_t const * p_app_twi) +{ + ASSERT(p_app_twi != NULL); + + // [use a local variable to avoid using two volatile variables in one + // expression] + uint8_t current_transfer_idx = p_app_twi->current_transfer_idx; + app_twi_transfer_t const * p_transfer = + &p_app_twi->p_current_transaction->p_transfers[current_transfer_idx]; + uint8_t address = APP_TWI_OP_ADDRESS(p_transfer->operation); + + if (APP_TWI_IS_READ_OP(p_transfer->operation)) + { + return nrf_drv_twi_rx(&p_app_twi->twi, address, + p_transfer->p_data, p_transfer->length, + (p_transfer->flags & APP_TWI_NO_STOP)); + } + else + { + return nrf_drv_twi_tx(&p_app_twi->twi, address, + p_transfer->p_data, p_transfer->length, + (p_transfer->flags & APP_TWI_NO_STOP)); + } +} + + +static void signal_end_of_transaction(app_twi_t const * p_app_twi, + ret_code_t result) +{ + ASSERT(p_app_twi != NULL); + + if (p_app_twi->p_current_transaction->callback) + { + // [use a local variable to avoid using two volatile variables in one + // expression] + void * p_user_data = p_app_twi->p_current_transaction->p_user_data; + p_app_twi->p_current_transaction->callback(result, p_user_data); + } +} + + +// This function starts pending transaction if there is no current one or +// when 'switch_transaction' parameter is set to true. It is important to +// switch to new transaction without setting 'p_app_twi->p_current_transaction' +// to NULL in between, since this pointer is used to check idle status - see +// 'app_twi_is_idle()'. +static void start_pending_transaction(app_twi_t * p_app_twi, + bool switch_transaction) +{ + ASSERT(p_app_twi != NULL); + + for (;;) + { + bool start_transaction = false; + + CRITICAL_REGION_ENTER(); + if (switch_transaction || app_twi_is_idle(p_app_twi)) + { + p_app_twi->p_current_transaction = queue_get(&p_app_twi->queue); + if (p_app_twi->p_current_transaction != NULL) + { + start_transaction = true; + } + } + CRITICAL_REGION_EXIT(); + + if (!start_transaction) + { + return; + } + else + { + ret_code_t result; + + // Try to start first transfer for this new transaction. + p_app_twi->current_transfer_idx = 0; + result = start_transfer(p_app_twi); + + // If it started successfully there is nothing more to do here now. + if (result == NRF_SUCCESS) + { + return; + } + + // Transfer failed to start - notify user that this transaction + // cannot be started and try with next one (in next iteration of + // the loop). + signal_end_of_transaction(p_app_twi, result); + + switch_transaction = true; + } + } +} + + +static void twi_event_handler(nrf_drv_twi_evt_t const * p_event, + void * p_context) +{ + ASSERT(p_event != NULL); + + app_twi_t * p_app_twi = (app_twi_t *)p_context; + ret_code_t result; + + // This callback should be called only during transaction. + ASSERT(p_app_twi->p_current_transaction != NULL); + + if (p_event->type != NRF_DRV_TWI_ERROR) + { + result = NRF_SUCCESS; + + // Transfer finished successfully. If there is another one to be + // performed in the current transaction, start it now. + // [use a local variable to avoid using two volatile variables in one + // expression] + uint8_t current_transfer_idx = p_app_twi->current_transfer_idx; + ++current_transfer_idx; + if (current_transfer_idx < + p_app_twi->p_current_transaction->number_of_transfers) + { + p_app_twi->current_transfer_idx = current_transfer_idx; + + result = start_transfer(p_app_twi); + + if (result == NRF_SUCCESS) + { + // The current transaction goes on and we've successfully + // started its next transfer -> there is nothing more to do. + return; + } + + // [if the next transfer could not be started due to some error + // we finish the transaction with this error code as the result] + } + } + else + { + result = NRF_ERROR_INTERNAL; + } + + // The current transaction has been completed or interrupted by some error. + // Notify the user and start next one (if there is any). + signal_end_of_transaction(p_app_twi, result); + // [we switch transactions here ('p_app_twi->p_current_transaction' is set + // to NULL only if there is nothing more to do) in order to not generate + // spurious idle status (even for a moment)] + start_pending_transaction(p_app_twi, true); +} + + +ret_code_t app_twi_init(app_twi_t * p_app_twi, + nrf_drv_twi_config_t const * p_twi_config, + uint8_t queue_size, + app_twi_transaction_t const * * p_queue_buffer) +{ + ASSERT(p_app_twi != NULL); + ASSERT(queue_size != 0); + ASSERT(p_queue_buffer != NULL); + + ret_code_t err_code; + + err_code = nrf_drv_twi_init(&p_app_twi->twi, + p_twi_config, + twi_event_handler, + p_app_twi); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + nrf_drv_twi_enable(&p_app_twi->twi); + + p_app_twi->queue.p_buffer = p_queue_buffer; + p_app_twi->queue.size = queue_size; + p_app_twi->queue.read_idx = 0; + p_app_twi->queue.write_idx = 0; + + p_app_twi->internal_transaction_in_progress = false; + p_app_twi->p_current_transaction = NULL; + + return NRF_SUCCESS; +} + + +void app_twi_uninit(app_twi_t * p_app_twi) +{ + ASSERT(p_app_twi != NULL); + + nrf_drv_twi_uninit(&(p_app_twi->twi)); + + p_app_twi->p_current_transaction = NULL; +} + + +ret_code_t app_twi_schedule(app_twi_t * p_app_twi, + app_twi_transaction_t const * p_transaction) +{ + ASSERT(p_app_twi != NULL); + ASSERT(p_transaction != NULL); + ASSERT(p_transaction->p_transfers != NULL); + ASSERT(p_transaction->number_of_transfers != 0); + + ret_code_t result = NRF_SUCCESS; + + CRITICAL_REGION_ENTER(); + if (!queue_put(&p_app_twi->queue, p_transaction)) + { + result = NRF_ERROR_BUSY; + } + CRITICAL_REGION_EXIT(); + + if (result == NRF_SUCCESS) + { + // New transaction has been successfully added to queue, + // so if we are currently idle it's time to start the job. + start_pending_transaction(p_app_twi, false); + } + + return result; +} + + +static void internal_transaction_cb(ret_code_t result, void * p_user_data) +{ + app_twi_t * p_app_twi = (app_twi_t *)p_user_data; + + p_app_twi->internal_transaction_result = result; + p_app_twi->internal_transaction_in_progress = false; +} + + +ret_code_t app_twi_perform(app_twi_t * p_app_twi, + app_twi_transfer_t const * p_transfers, + uint8_t number_of_transfers, + void (* user_function)(void)) +{ + ASSERT(p_app_twi != NULL); + ASSERT(p_transfers != NULL); + ASSERT(number_of_transfers != 0); + + bool busy = false; + + CRITICAL_REGION_ENTER(); + if (p_app_twi->internal_transaction_in_progress) + { + busy = true; + } + else + { + p_app_twi->internal_transaction_in_progress = true; + } + CRITICAL_REGION_EXIT(); + + if (busy) + { + return NRF_ERROR_BUSY; + } + else + { + app_twi_transaction_t internal_transaction = + { + .callback = internal_transaction_cb, + .p_user_data = p_app_twi, + .p_transfers = p_transfers, + .number_of_transfers = number_of_transfers, + }; + ret_code_t result = app_twi_schedule(p_app_twi, &internal_transaction); + if (result != NRF_SUCCESS) + { + return result; + } + + while (p_app_twi->internal_transaction_in_progress) + { + if (user_function) + { + user_function(); + } + } + + return p_app_twi->internal_transaction_result; + } +} diff --git a/components/libraries/twi/app_twi.h b/components/libraries/twi/app_twi.h new file mode 100644 index 0000000..f21e2b9 --- /dev/null +++ b/components/libraries/twi/app_twi.h @@ -0,0 +1,290 @@ +/* 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. + * + */ + +#ifndef APP_TWI_H__ +#define APP_TWI_H__ + +#include +#include "nrf_drv_twi.h" +#include "sdk_errors.h" + +/** + * @defgroup app_twi TWI transaction manager + * @{ + * @ingroup app_common + * + * @brief Module for scheduling TWI transactions. + */ + +/** + * @brief Flag indicating that a given transfer should not be ended + * with a stop condition. + * + * Use this flag when a stop condition is undesirable between two transfers, + * for example, when the first transfer is a write that sets an address in the slave + * device and the second one is a read that fetches certain data using this + * address. In this case, the second transfer should follow directly after the + * first transfer, with a repeated start condition instead of a stop and then + * a new start condition. + */ +#define APP_TWI_NO_STOP 0x01 + +/** + * @brief Macro for creating a write transfer. + * + * @param address Slave address. + * @param[in] p_data Pointer to the data to be sent. + * @param length Number of bytes to transfer. + * @param flags Transfer flags (see @ref APP_TWI_NO_STOP). + */ +#define APP_TWI_WRITE(address, p_data, length, flags) \ + APP_TWI_TRANSFER(APP_TWI_WRITE_OP(address), p_data, length, flags) + +/** + * @brief Macro for creating a read transfer. + * + * @param address Slave address. + * @param[in] p_data Pointer to the buffer where received data should be placed. + * @param length Number of bytes to transfer. + * @param flags Transfer flags (see @ref APP_TWI_NO_STOP). + */ +#define APP_TWI_READ(address, p_data, length, flags) \ + APP_TWI_TRANSFER(APP_TWI_READ_OP(address), p_data, length, flags) + +/** + * @brief Helper macro, should not be used directly. + */ +#define APP_TWI_TRANSFER(_operation, _p_data, _length, _flags) \ +{ \ + .p_data = (uint8_t *)(_p_data), \ + .length = _length, \ + .operation = _operation, \ + .flags = _flags \ +} +/** + * @brief Helper macro, should not be used directly. + */ +#define APP_TWI_WRITE_OP(address) (((address) << 1) | 0) +/** + * @brief Helper macro, should not be used directly. + */ +#define APP_TWI_READ_OP(address) (((address) << 1) | 1) +/** + * @brief Helper macro, should not be used directly. + */ +#define APP_TWI_IS_READ_OP(operation) ((operation) & 1) +/** + * @brief Helper macro, should not be used directly. + */ +#define APP_TWI_OP_ADDRESS(operation) ((operation) >> 1) + +/** + * @brief TWI transaction callback prototype. + * + * @param result Result of operation (NRF_SUCCESS on success, + * otherwise a relevant error code). + * @param[in] p_user_data Pointer to user data defined in transaction + * descriptor. + */ +typedef void (* app_twi_callback_t)(ret_code_t result, void * p_user_data); + +/** + * @brief TWI transfer descriptor. + */ +typedef struct { + uint8_t * p_data; ///< Pointer to the buffer holding the data. + uint8_t length; ///< Number of bytes to transfer. + uint8_t operation; ///< Device address combined with transfer direction. + uint8_t flags; ///< Transfer flags (see @ref APP_TWI_NO_STOP). +} app_twi_transfer_t; + +/** + * @brief TWI transaction descriptor. + */ +typedef struct { + app_twi_callback_t callback; + ///< User-specified function to be called after the transaction is finished. + + void * p_user_data; + ///< Pointer to user data to be passed to the callback. + + app_twi_transfer_t const * p_transfers; + ///< Pointer to the array of transfers that make up the transaction. + + uint8_t number_of_transfers; + ///< Number of transfers that make up the transaction. +} app_twi_transaction_t; + +/** + * @brief TWI transaction queue. + */ +typedef struct { + app_twi_transaction_t const * volatile * p_buffer; + uint8_t size; + uint8_t volatile read_idx; + uint8_t volatile write_idx; +} app_twi_queue_t; + +/** + * @brief TWI transaction manager instance. + */ +typedef struct { + app_twi_queue_t queue; + ///< Transaction queue. + + uint8_t volatile current_transfer_idx; + ///< Index of currently performed transfer (within current transaction). + + bool volatile internal_transaction_in_progress; + ///< Informs that an internal transaction is being performed (by app_twi_perform()). + + uint8_t volatile internal_transaction_result; + ///< Used to pass the result of the internal transaction realized by app_twi_perform(). + + app_twi_transaction_t const * volatile p_current_transaction; + ///< Currently realized transaction. + + nrf_drv_twi_t const twi; + ///< TWI master driver instance. +} app_twi_t; + +/** + * @brief Macro for creating an instance of the TWI transaction manager. + * + * @param[in] twi_idx Index of the TWI master driver instance to be utilized + * by this manager instance. + */ +#define APP_TWI_INSTANCE(twi_idx) \ +{ \ + .twi = NRF_DRV_TWI_INSTANCE(twi_idx) \ +} + +/** + * @brief Macro that simplifies the initialization of a TWI transaction manager + * instance. + * + * This macro allocates a static buffer for the transaction queue. + * Therefore, it should be used in only one place in the code for a given + * instance. + * + * @param[in] p_app_twi Pointer to the instance to be initialized. + * @param[in] p_twi_config Pointer to the TWI master driver configuration. + * @param queue_size Size of the transaction queue (maximum number + * of pending transactions). + * See @ref app_twi_init_note "this note". + * @param[out] err_code The result of the app_twi_init() function call + * is written to this parameter. + */ +#define APP_TWI_INIT(p_app_twi, p_twi_config, queue_size, err_code) \ + do { \ + static app_twi_transaction_t const * queue_buffer[queue_size + 1]; \ + err_code = app_twi_init(p_app_twi, p_twi_config, \ + queue_size, queue_buffer); \ + } while (0) + +/** + * @brief Function for initializing a TWI transaction manager instance. + * + * This function initializes the utilized TWI master driver instance and + * prepares the transaction queue. + * + * @anchor app_twi_init_note + * @note The queue size is the maximum number of pending transactions + * not counting the one that is currently realized. This means that + * for an empty queue with size of, for example, 4 elements, it is + * possible to schedule up to 5 transactions. + * + * @param[in] p_app_twi Pointer to the instance to be initialized. + * @param[in] p_twi_config Pointer to the TWI master driver configuration. + * @param queue_size Size of the transaction queue (maximum number + * of pending transactions). + * @param[in] p_queue_buffer Pointer to a buffer for queued transactions + * storage. Due to the queue implementation, the buffer must + * be big enough to hold queue_size + 1 entries + * (pointers to transaction descriptors). + * + * @retval NRF_SUCCESS If initialization was successful. Otherwise, the error code + * returned by the nrf_drv_twi_init() function is returned. + */ +ret_code_t app_twi_init(app_twi_t * p_app_twi, + nrf_drv_twi_config_t const * p_twi_config, + uint8_t queue_size, + app_twi_transaction_t const * * p_queue_buffer); + +/** + * @brief Function for uninitializing a TWI transaction manager instance. + * + * @param[in] p_app_twi Pointer to the instance to be uninitialized. + */ +void app_twi_uninit(app_twi_t * p_app_twi); + +/** + * @brief Function for scheduling a TWI transaction. + * + * The transaction is enqueued and started as soon as the TWI bus is + * available, thus when all previously scheduled transactions have been + * finished (possibly immediately). + * + * @param[in] p_app_twi Pointer to the TWI transaction manager instance. + * @param[in] p_transaction Pointer to the descriptor of the transaction to be + * scheduled. + * + * @retval NRF_SUCCESS If the transaction has been successfully scheduled. + * @retval NRF_ERROR_BUSY If the limit of pending transactions has been reached + * (the transaction queue is full). + */ +ret_code_t app_twi_schedule(app_twi_t * p_app_twi, + app_twi_transaction_t const * p_transaction); + +/** + * @brief Function for scheduling a transaction and waiting until it is finished. + * + * This function schedules a transaction that consists of one or more transfers + * and waits until it is finished. + * + * @param[in] p_app_twi Pointer to the TWI transaction manager instance. + * @param[in] p_transfers Pointer to an array of transfers to be performed. + * @param number_of_transfers Number of transfers to be performed. + * @param user_function User-specified function to be called while + * waiting. NULL if such functionality + * is not needed. + * + * @retval NRF_SUCCESS If the transfers have been successfully realized. + * @retval NRF_ERROR_BUSY If some transfers are already performed (if this function + * was called from another context). + * @retval - Other error codes mean that the transaction has ended + * with the error that is specified in the error code. + */ +ret_code_t app_twi_perform(app_twi_t * p_app_twi, + app_twi_transfer_t const * p_transfers, + uint8_t number_of_transfers, + void (* user_function)(void)); + +/** + * @brief Function for getting the current state of a TWI transaction manager + * instance. + * + * @param[in] p_app_twi Pointer to the TWI transaction manager instance. + * + * @retval true If all scheduled transactions have been finished. + * @retval false Otherwise. + */ +__STATIC_INLINE bool app_twi_is_idle(app_twi_t * p_app_twi) +{ + return (p_app_twi->p_current_transaction == NULL); +} + +/** + *@} + **/ + +#endif // APP_TWI_H__ diff --git a/components/libraries/uart/app_uart.c b/components/libraries/uart/app_uart.c new file mode 100644 index 0000000..40c85c8 --- /dev/null +++ b/components/libraries/uart/app_uart.c @@ -0,0 +1,128 @@ +/* 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 "app_uart.h" +#include "nrf_drv_uart.h" +#include "nrf_assert.h" +static uint8_t tx_buffer[1]; +static uint8_t rx_buffer[1]; +static volatile bool rx_done; +static app_uart_event_handler_t m_event_handler; /**< Event handler function. */ + +void uart_event_handler(nrf_drv_uart_event_t * p_event, void* p_context) +{ + if (p_event->type == NRF_DRV_UART_EVT_RX_DONE) + { + app_uart_evt_t app_uart_event; + app_uart_event.evt_type = APP_UART_DATA; + app_uart_event.data.value = p_event->data.rxtx.p_data[0]; + (void)nrf_drv_uart_rx(rx_buffer,1); + rx_done = true; + m_event_handler(&app_uart_event); + } + else if (p_event->type == NRF_DRV_UART_EVT_ERROR) + { + app_uart_evt_t app_uart_event; + app_uart_event.evt_type = APP_UART_COMMUNICATION_ERROR; + app_uart_event.data.error_communication = p_event->data.error.error_mask; + (void)nrf_drv_uart_rx(rx_buffer,1); + m_event_handler(&app_uart_event); + } + else if (p_event->type == NRF_DRV_UART_EVT_TX_DONE) + { + // Last byte from FIFO transmitted, notify the application. + // Notify that new data is available if this was first byte put in the buffer. + app_uart_evt_t app_uart_event; + app_uart_event.evt_type = APP_UART_TX_EMPTY; + m_event_handler(&app_uart_event); + } +} + +uint32_t app_uart_init(const app_uart_comm_params_t * p_comm_params, + app_uart_buffers_t * p_buffers, + app_uart_event_handler_t event_handler, + app_irq_priority_t irq_priority) +{ + nrf_drv_uart_config_t config = NRF_DRV_UART_DEFAULT_CONFIG; + config.baudrate = (nrf_uart_baudrate_t)p_comm_params->baud_rate; + config.hwfc = (p_comm_params->flow_control == APP_UART_FLOW_CONTROL_DISABLED) ? + NRF_UART_HWFC_DISABLED : NRF_UART_HWFC_ENABLED; + config.interrupt_priority = irq_priority; + config.parity = p_comm_params->use_parity ? NRF_UART_PARITY_INCLUDED : NRF_UART_PARITY_EXCLUDED; + config.pselcts = p_comm_params->cts_pin_no; + config.pselrts = p_comm_params->rts_pin_no; + config.pselrxd = p_comm_params->rx_pin_no; + config.pseltxd = p_comm_params->tx_pin_no; + + m_event_handler = event_handler; + + rx_done = false; + + if (p_comm_params->flow_control == APP_UART_FLOW_CONTROL_LOW_POWER) + { + return NRF_ERROR_NOT_SUPPORTED; + } + + uint32_t err_code = nrf_drv_uart_init(&config, uart_event_handler); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + nrf_drv_uart_rx_enable(); + return nrf_drv_uart_rx(rx_buffer,1); +} + + +uint32_t app_uart_get(uint8_t * p_byte) +{ + ASSERT(p_byte); + uint32_t err_code = NRF_SUCCESS; + if (rx_done) + { + *p_byte = rx_buffer[0]; + } + else + { + err_code = NRF_ERROR_NOT_FOUND; + } + return err_code; +} + +uint32_t app_uart_put(uint8_t byte) +{ + tx_buffer[0] = byte; + ret_code_t ret = nrf_drv_uart_tx(tx_buffer,1); + if (NRF_ERROR_BUSY == ret) + { + return NRF_ERROR_NO_MEM; + } + else if (ret != NRF_SUCCESS) + { + return NRF_ERROR_INTERNAL; + } + else + { + return NRF_SUCCESS; + } +} + +uint32_t app_uart_flush(void) +{ + return NRF_SUCCESS; +} + +uint32_t app_uart_close(void) +{ + nrf_drv_uart_uninit(); + return NRF_SUCCESS; +} diff --git a/components/libraries/uart/app_uart.h b/components/libraries/uart/app_uart.h new file mode 100644 index 0000000..3e1729f --- /dev/null +++ b/components/libraries/uart/app_uart.h @@ -0,0 +1,227 @@ +/* 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. + * + */ + +/**@file + * + * @defgroup app_uart UART module + * @{ + * @ingroup app_common + * + * @brief UART module interface. + */ + +#ifndef APP_UART_H__ +#define APP_UART_H__ + +#include +#include +#include "app_util_platform.h" + +#define UART_PIN_DISCONNECTED 0xFFFFFFFF /**< Value indicating that no pin is connected to this UART register. */ + +/**@brief UART Flow Control modes for the peripheral. + */ +typedef enum +{ + APP_UART_FLOW_CONTROL_DISABLED, /**< UART Hw Flow Control is disabled. */ + APP_UART_FLOW_CONTROL_ENABLED, /**< Standard UART Hw Flow Control is enabled. */ + APP_UART_FLOW_CONTROL_LOW_POWER /**< Specialized UART Hw Flow Control is used. The Low Power setting allows the \nRFXX to Power Off the UART module when CTS is in-active, and re-enabling the UART when the CTS signal becomes active. This allows the \nRFXX to safe power by only using the UART module when it is needed by the remote site. */ +} app_uart_flow_control_t; + +/**@brief UART communication structure holding configuration settings for the peripheral. + */ +typedef struct +{ + uint8_t rx_pin_no; /**< RX pin number. */ + uint8_t tx_pin_no; /**< TX pin number. */ + uint8_t rts_pin_no; /**< RTS pin number, only used if flow control is enabled. */ + uint8_t cts_pin_no; /**< CTS pin number, only used if flow control is enabled. */ + app_uart_flow_control_t flow_control; /**< Flow control setting, if flow control is used, the system will use low power UART mode, based on CTS signal. */ + bool use_parity; /**< Even parity if TRUE, no parity if FALSE. */ + uint32_t baud_rate; /**< Baud rate configuration. */ +} app_uart_comm_params_t; + +/**@brief UART buffer for transmitting/receiving data. + */ +typedef struct +{ + uint8_t * rx_buf; /**< Pointer to the RX buffer. */ + uint32_t rx_buf_size; /**< Size of the RX buffer. */ + uint8_t * tx_buf; /**< Pointer to the TX buffer. */ + uint32_t tx_buf_size; /**< Size of the TX buffer. */ +} app_uart_buffers_t; + +/**@brief Enumeration which defines events used by the UART module upon data reception or error. + * + * @details The event type is used to indicate the type of additional information in the event + * @ref app_uart_evt_t. + */ +typedef enum +{ + APP_UART_DATA_READY, /**< An event indicating that UART data has been received. The data is available in the FIFO and can be fetched using @ref app_uart_get. */ + APP_UART_FIFO_ERROR, /**< An error in the FIFO module used by the app_uart module has occured. The FIFO error code is stored in app_uart_evt_t.data.error_code field. */ + APP_UART_COMMUNICATION_ERROR, /**< An communication error has occured during reception. The error is stored in app_uart_evt_t.data.error_communication field. */ + APP_UART_TX_EMPTY, /**< An event indicating that UART has completed transmission of all available data in the TX FIFO. */ + APP_UART_DATA, /**< An event indicating that UART data has been received, and data is present in data field. This event is only used when no FIFO is configured. */ +} app_uart_evt_type_t; + +/**@brief Struct containing events from the UART module. + * + * @details The app_uart_evt_t is used to notify the application of asynchronous events when data + * are received on the UART peripheral or in case an error occured during data reception. + */ +typedef struct +{ + app_uart_evt_type_t evt_type; /**< Type of event. */ + union + { + uint32_t error_communication; /**< Field used if evt_type is: APP_UART_COMMUNICATION_ERROR. This field contains the value in the ERRORSRC register for the UART peripheral. The UART_ERRORSRC_x defines from nrf5x_bitfields.h can be used to parse the error code. See also the \nRFXX Series Reference Manual for specification. */ + uint32_t error_code; /**< Field used if evt_type is: NRF_ERROR_x. Additional status/error code if the error event type is APP_UART_FIFO_ERROR. This error code refer to errors defined in nrf_error.h. */ + uint8_t value; /**< Field used if evt_type is: NRF_ERROR_x. Additional status/error code if the error event type is APP_UART_FIFO_ERROR. This error code refer to errors defined in nrf_error.h. */ + } data; +} app_uart_evt_t; + +/**@brief Function for handling app_uart event callback. + * + * @details Upon an event in the app_uart module this callback function will be called to notify + * the application about the event. + * + * @param[in] p_app_uart_event Pointer to UART event. + */ +typedef void (* app_uart_event_handler_t) (app_uart_evt_t * p_app_uart_event); + +/**@brief Macro for safe initialization of the UART module in a single user instance when using + * a FIFO together with UART. + * + * @param[in] P_COMM_PARAMS Pointer to a UART communication structure: app_uart_comm_params_t + * @param[in] RX_BUF_SIZE Size of desired RX buffer, must be a power of 2 or ZERO (No FIFO). + * @param[in] TX_BUF_SIZE Size of desired TX buffer, must be a power of 2 or ZERO (No FIFO). + * @param[in] EVT_HANDLER Event handler function to be called when an event occurs in the + * UART module. + * @param[in] IRQ_PRIO IRQ priority, app_irq_priority_t, for the UART module irq handler. + * @param[out] ERR_CODE The return value of the UART initialization function will be + * written to this parameter. + * + * @note Since this macro allocates a buffer and registers the module as a GPIOTE user when flow + * control is enabled, it must only be called once. + */ +#define APP_UART_FIFO_INIT(P_COMM_PARAMS, RX_BUF_SIZE, TX_BUF_SIZE, EVT_HANDLER, IRQ_PRIO, ERR_CODE) \ + do \ + { \ + app_uart_buffers_t buffers; \ + static uint8_t rx_buf[RX_BUF_SIZE]; \ + static uint8_t tx_buf[TX_BUF_SIZE]; \ + \ + buffers.rx_buf = rx_buf; \ + buffers.rx_buf_size = sizeof (rx_buf); \ + buffers.tx_buf = tx_buf; \ + buffers.tx_buf_size = sizeof (tx_buf); \ + ERR_CODE = app_uart_init(P_COMM_PARAMS, &buffers, EVT_HANDLER, IRQ_PRIO); \ + } while (0) + +/**@brief Macro for safe initialization of the UART module in a single user instance. + * + * @param[in] P_COMM_PARAMS Pointer to a UART communication structure: app_uart_comm_params_t + * @param[in] EVT_HANDLER Event handler function to be called when an event occurs in the + * UART module. + * @param[in] IRQ_PRIO IRQ priority, app_irq_priority_t, for the UART module irq handler. + * @param[out] ERR_CODE The return value of the UART initialization function will be + * written to this parameter. + * + * @note Since this macro allocates registers the module as a GPIOTE user when flow control is + * enabled, it must only be called once. + */ +#define APP_UART_INIT(P_COMM_PARAMS, EVT_HANDLER, IRQ_PRIO, ERR_CODE) \ + do \ + { \ + ERR_CODE = app_uart_init(P_COMM_PARAMS, NULL, EVT_HANDLER, IRQ_PRIO); \ + } while (0) + +/**@brief Function for initializing the UART module. Use this initialization when several instances of the UART + * module are needed. + * + * + * @note Normally single initialization should be done using the APP_UART_INIT() or + * APP_UART_INIT_FIFO() macro depending on whether the FIFO should be used by the UART, as + * that will allocate the buffers needed by the UART module (including aligning the buffer + * correctly). + + * @param[in] p_comm_params Pin and communication parameters. + * @param[in] p_buffers RX and TX buffers, NULL is FIFO is not used. + * @param[in] error_handler Function to be called in case of an error. + * @param[in] irq_priority Interrupt priority level. + * + * @retval NRF_SUCCESS If successful initialization. + * @retval NRF_ERROR_INVALID_LENGTH If a provided buffer is not a power of two. + * @retval NRF_ERROR_NULL If one of the provided buffers is a NULL pointer. + * + * The below errors are propagated by the UART module to the caller upon registration when Hardware + * Flow Control is enabled. When Hardware Flow Control is not used, these errors cannot occur. + * @retval NRF_ERROR_INVALID_STATE The GPIOTE module is not in a valid state when registering + * the UART module as a user. + * @retval NRF_ERROR_INVALID_PARAM The UART module provides an invalid callback function when + * registering the UART module as a user. + * Or the value pointed to by *p_uart_uid is not a valid + * GPIOTE number. + * @retval NRF_ERROR_NO_MEM GPIOTE module has reached the maximum number of users. + */ +uint32_t app_uart_init(const app_uart_comm_params_t * p_comm_params, + app_uart_buffers_t * p_buffers, + app_uart_event_handler_t error_handler, + app_irq_priority_t irq_priority); + +/**@brief Function for getting a byte from the UART. + * + * @details This function will get the next byte from the RX buffer. If the RX buffer is empty + * an error code will be returned and the app_uart module will generate an event upon + * reception of the first byte which is added to the RX buffer. + * + * @param[out] p_byte Pointer to an address where next byte received on the UART will be copied. + * + * @retval NRF_SUCCESS If a byte has been received and pushed to the pointer provided. + * @retval NRF_ERROR_NOT_FOUND If no byte is available in the RX buffer of the app_uart module. + */ +uint32_t app_uart_get(uint8_t * p_byte); + +/**@brief Function for putting a byte on the UART. + * + * @details This call is non-blocking. + * + * @param[in] byte Byte to be transmitted on the UART. + * + * @retval NRF_SUCCESS If the byte was successfully put on the TX buffer for transmission. + * @retval NRF_ERROR_NO_MEM If no more space is available in the TX buffer. + * NRF_ERROR_NO_MEM may occur if flow control is enabled and CTS signal + * is high for a long period and the buffer fills up. + * @retval NRF_ERROR_INTERNAL If UART driver reported error. + */ +uint32_t app_uart_put(uint8_t byte); + +/**@brief Function for flushing the RX and TX buffers (Only valid if FIFO is used). + * This function does nothing if FIFO is not used. + * + * @retval NRF_SUCCESS Flushing completed (Current implementation will always succeed). + */ +uint32_t app_uart_flush(void); + +/**@brief Function for closing the UART module. + * + * @retval NRF_SUCCESS If successfully closed. + * @retval NRF_ERROR_INVALID_PARAM If an invalid user id is provided or the user id differs from + * the current active user. + */ +uint32_t app_uart_close(void); + + +#endif //APP_UART_H__ + +/** @} */ diff --git a/components/libraries/uart/app_uart_fifo.c b/components/libraries/uart/app_uart_fifo.c new file mode 100644 index 0000000..1059100 --- /dev/null +++ b/components/libraries/uart/app_uart_fifo.c @@ -0,0 +1,192 @@ +/* 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 "app_uart.h" +#include "app_fifo.h" +#include "nrf_drv_uart.h" +#include "nrf_assert.h" + +static __INLINE uint32_t fifo_length(app_fifo_t * const fifo) +{ + uint32_t tmp = fifo->read_pos; + return fifo->write_pos - tmp; +} + +#define FIFO_LENGTH(F) fifo_length(&F) /**< Macro to calculate length of a FIFO. */ + + +static app_uart_event_handler_t m_event_handler; /**< Event handler function. */ +static uint8_t tx_buffer[1]; +static uint8_t tx_tmp; +static uint8_t rx_buffer[1]; + +static app_fifo_t m_rx_fifo; /**< RX FIFO buffer for storing data received on the UART until the application fetches them using app_uart_get(). */ +static app_fifo_t m_tx_fifo; /**< TX FIFO buffer for storing data to be transmitted on the UART when TXD is ready. Data is put to the buffer on using app_uart_put(). */ + +static void uart_event_handler(nrf_drv_uart_event_t * p_event, void* p_context) +{ + app_uart_evt_t app_uart_event; + + if (p_event->type == NRF_DRV_UART_EVT_RX_DONE) + { + // Write received byte to FIFO + uint32_t err_code = app_fifo_put(&m_rx_fifo, p_event->data.rxtx.p_data[0]); + if (err_code != NRF_SUCCESS) + { + app_uart_event.evt_type = APP_UART_FIFO_ERROR; + app_uart_event.data.error_code = err_code; + m_event_handler(&app_uart_event); + } + // Notify that new data is available if this was first byte put in the buffer. + else if (FIFO_LENGTH(m_rx_fifo) == 1) + { + app_uart_event.evt_type = APP_UART_DATA_READY; + m_event_handler(&app_uart_event); + } + else + { + // Do nothing, only send event if first byte was added or overflow in FIFO occurred. + } + if (FIFO_LENGTH(m_rx_fifo) <= m_rx_fifo.buf_size_mask) + { + (void)nrf_drv_uart_rx(rx_buffer,1); + } + } + else if (p_event->type == NRF_DRV_UART_EVT_ERROR) + { + app_uart_event.evt_type = APP_UART_COMMUNICATION_ERROR; + app_uart_event.data.error_communication = p_event->data.error.error_mask; + m_event_handler(&app_uart_event); + } + else if (p_event->type == NRF_DRV_UART_EVT_TX_DONE) + { + // Get next byte from FIFO. + if (app_fifo_get(&m_tx_fifo, tx_buffer) == NRF_SUCCESS) + { + (void)nrf_drv_uart_tx(tx_buffer,1); + } + if (FIFO_LENGTH(m_tx_fifo) == 0) + { + // Last byte from FIFO transmitted, notify the application. + // Notify that new data is available if this was first byte put in the buffer. + app_uart_event.evt_type = APP_UART_TX_EMPTY; + m_event_handler(&app_uart_event); + } + } +} + +uint32_t app_uart_init(const app_uart_comm_params_t * p_comm_params, + app_uart_buffers_t * p_buffers, + app_uart_event_handler_t event_handler, + app_irq_priority_t irq_priority) +{ + uint32_t err_code; + + m_event_handler = event_handler; + + if (p_buffers == NULL) + { + return NRF_ERROR_INVALID_PARAM; + } + + // Configure buffer RX buffer. + err_code = app_fifo_init(&m_rx_fifo, p_buffers->rx_buf, p_buffers->rx_buf_size); + if (err_code != NRF_SUCCESS) + { + // Propagate error code. + return err_code; + } + + // Configure buffer TX buffer. + err_code = app_fifo_init(&m_tx_fifo, p_buffers->tx_buf, p_buffers->tx_buf_size); + if (err_code != NRF_SUCCESS) + { + // Propagate error code. + return err_code; + } + + nrf_drv_uart_config_t config = NRF_DRV_UART_DEFAULT_CONFIG; + config.baudrate = (nrf_uart_baudrate_t)p_comm_params->baud_rate; + config.hwfc = (p_comm_params->flow_control == APP_UART_FLOW_CONTROL_DISABLED) ? + NRF_UART_HWFC_DISABLED : NRF_UART_HWFC_ENABLED; + config.interrupt_priority = irq_priority; + config.parity = p_comm_params->use_parity ? NRF_UART_PARITY_INCLUDED : NRF_UART_PARITY_EXCLUDED; + config.pselcts = p_comm_params->cts_pin_no; + config.pselrts = p_comm_params->rts_pin_no; + config.pselrxd = p_comm_params->rx_pin_no; + config.pseltxd = p_comm_params->tx_pin_no; + + err_code = nrf_drv_uart_init(&config, uart_event_handler); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + nrf_drv_uart_rx_enable(); + return nrf_drv_uart_rx(rx_buffer,1); +} + +uint32_t app_uart_flush(void) +{ + uint32_t err_code; + + err_code = app_fifo_flush(&m_rx_fifo); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + err_code = app_fifo_flush(&m_tx_fifo); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + return NRF_SUCCESS; +} + +uint32_t app_uart_get(uint8_t * p_byte) +{ + ASSERT(p_byte); + // If FIFO was full new request to receive one byte was not scheduled. Must be done here. + if (FIFO_LENGTH(m_rx_fifo) == m_rx_fifo.buf_size_mask) + { + uint32_t err_code = nrf_drv_uart_rx(rx_buffer,1); + if (err_code != NRF_SUCCESS) + { + return NRF_ERROR_NOT_FOUND; + } + } + return app_fifo_get(&m_rx_fifo, p_byte); +} + +uint32_t app_uart_put(uint8_t byte) +{ + uint32_t err_code; + + tx_tmp = byte; + err_code = nrf_drv_uart_tx(&tx_tmp, 1); + + if (err_code == NRF_ERROR_BUSY) + { + err_code = app_fifo_put(&m_tx_fifo, byte); + } + + return err_code; +} + +uint32_t app_uart_close(void) +{ + nrf_drv_uart_uninit(); + return NRF_SUCCESS; +} diff --git a/components/libraries/uart/retarget.c b/components/libraries/uart/retarget.c new file mode 100644 index 0000000..fdfb895 --- /dev/null +++ b/components/libraries/uart/retarget.c @@ -0,0 +1,81 @@ +/* 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 NRF_LOG_USES_RTT + +#include +#include +#include "app_uart.h" +#include "nordic_common.h" +#include "nrf_error.h" + +#if !defined(__ICCARM__) +struct __FILE +{ + int handle; +}; +#endif + +FILE __stdout; +FILE __stdin; + + +#if defined(__CC_ARM) || defined(__ICCARM__) +int fgetc(FILE * p_file) +{ + uint8_t input; + while (app_uart_get(&input) == NRF_ERROR_NOT_FOUND) + { + // No implementation needed. + } + return input; +} + + +int fputc(int ch, FILE * p_file) +{ + UNUSED_PARAMETER(p_file); + + UNUSED_VARIABLE(app_uart_put((uint8_t)ch)); + return ch; +} +#elif defined(__GNUC__) + + +int _write(int file, const char * p_char, int len) +{ + int i; + + UNUSED_PARAMETER(file); + + for (i = 0; i < len; i++) + { + UNUSED_VARIABLE(app_uart_put(*p_char++)); + } + + return len; +} + + +int _read(int file, char * p_char, int len) +{ + UNUSED_PARAMETER(file); + while (app_uart_get((uint8_t *)p_char) == NRF_ERROR_NOT_FOUND) + { + // No implementation needed. + } + + return 1; +} +#endif + +#endif // #ifndef NRF_LOG_USES_RTT diff --git a/components/libraries/util/app_error.c b/components/libraries/util/app_error.c new file mode 100644 index 0000000..108ee88 --- /dev/null +++ b/components/libraries/util/app_error.c @@ -0,0 +1,87 @@ +/* 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. + * + */ + +/** @file + * + * @defgroup app_error Common application error handler + * @{ + * @ingroup app_common + * + * @brief Common application error handler. + */ + +#include "nrf.h" +#include "app_error.h" +#include "compiler_abstraction.h" +#include "nordic_common.h" +#ifdef DEBUG +#include "bsp.h" + +/* global error variables - in order to prevent removal by optimizers */ +uint32_t m_error_code; +uint32_t m_line_num; +const uint8_t * m_p_file_name; +#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. + * + * Function is implemented as weak so that it can be overwritten by custom application error handler + * when needed. + */ + +/*lint -save -e14 */ +__WEAK void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name) +{ + // 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 + + // 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_code = error_code; + m_line_num = line_num; + m_p_file_name = p_file_name; + + UNUSED_VARIABLE(m_error_code); + UNUSED_VARIABLE(m_line_num); + UNUSED_VARIABLE(m_p_file_name); + __disable_irq(); + + while(loop); +#endif // DEBUG +} +/*lint -restore */ diff --git a/components/libraries/util/app_error.h b/components/libraries/util/app_error.h new file mode 100644 index 0000000..616634c --- /dev/null +++ b/components/libraries/util/app_error.h @@ -0,0 +1,84 @@ +/* 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. + * + */ + +/** @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 "nrf_error.h" + +/**@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 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((ERR_CODE), 0, 0); \ + } 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/components/libraries/util/app_util.h b/components/libraries/util/app_util.h new file mode 100644 index 0000000..8ed3a44 --- /dev/null +++ b/components/libraries/util/app_util.h @@ -0,0 +1,315 @@ +/* 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_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" + +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_MSG 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 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 Perform 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 Check if the integer provided 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 To convert 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 Perform 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 Function 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 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 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 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 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); +} + +#endif // APP_UTIL_H__ + +/** @} */ diff --git a/components/libraries/util/app_util_bds.h b/components/libraries/util/app_util_bds.h new file mode 100644 index 0000000..50bb30e --- /dev/null +++ b/components/libraries/util/app_util_bds.h @@ -0,0 +1,411 @@ +/* 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_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 = *p_decoded_val; + return bds_uint16_decode(len, p_encoded_data, &tmp); +} + + +/**@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/components/libraries/util/app_util_platform.c b/components/libraries/util/app_util_platform.c new file mode 100644 index 0000000..5555002 --- /dev/null +++ b/components/libraries/util/app_util_platform.c @@ -0,0 +1,30 @@ +/* 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_util_platform.h" + +static uint32_t m_in_critical_region = 0; + +void critical_region_enter(void) +{ + __disable_irq(); + m_in_critical_region++; +} + +void critical_region_exit(void) +{ + m_in_critical_region--; + if (m_in_critical_region == 0) + { + __enable_irq(); + } +} diff --git a/components/libraries/util/app_util_platform.h b/components/libraries/util/app_util_platform.h new file mode 100644 index 0000000..bf25d5c --- /dev/null +++ b/components/libraries/util/app_util_platform.h @@ -0,0 +1,129 @@ +/* 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. + * + */ + +/**@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 "app_error.h" +#endif +/**@brief The interrupt priorities available to the application while the SoftDevice is active. */ +typedef enum +{ +#ifndef SOFTDEVICE_PRESENT + APP_IRQ_PRIORITY_HIGHEST = 0, +#endif + APP_IRQ_PRIORITY_HIGH = 1, +#ifndef SOFTDEVICE_PRESENT + APP_IRQ_PRIORITY_MID = 2, +#endif + APP_IRQ_PRIORITY_LOW = 3 +} app_irq_priority_t; + +#define NRF_APP_PRIORITY_THREAD 4 /**< "Interrupt level" when running in Thread Mode. */ + +/**@cond NO_DOXYGEN */ +#define EXTERNAL_INT_VECTOR_OFFSET 16 +/**@endcond */ + +#define PACKED(TYPE) __packed TYPE + +void critical_region_enter (void); +void critical_region_exit (void); + +/**@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 IS_NESTED_CRITICAL_REGION = 0; \ + uint32_t CURRENT_INT_PRI = current_int_priority_get(); \ + if (CURRENT_INT_PRI != APP_IRQ_PRIORITY_HIGH) \ + { \ + uint32_t ERR_CODE = sd_nvic_critical_region_enter(&IS_NESTED_CRITICAL_REGION); \ + if (ERR_CODE == NRF_ERROR_SOFTDEVICE_NOT_ENABLED) \ + { \ + __disable_irq(); \ + } \ + else \ + { \ + APP_ERROR_CHECK(ERR_CODE); \ + } \ + } +#else +#define CRITICAL_REGION_ENTER() critical_region_enter() +#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() \ + if (CURRENT_INT_PRI != APP_IRQ_PRIORITY_HIGH) \ + { \ + uint32_t ERR_CODE; \ + __enable_irq(); \ + ERR_CODE = sd_nvic_critical_region_exit(IS_NESTED_CRITICAL_REGION); \ + if (ERR_CODE != NRF_ERROR_SOFTDEVICE_NOT_ENABLED) \ + { \ + APP_ERROR_CHECK(ERR_CODE); \ + } \ + } \ + } +#else +#define CRITICAL_REGION_EXIT() critical_region_exit() +#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 = (SCB->ICSR & SCB_ICSR_VECTACTIVE_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 NRF_APP_PRIORITY_THREAD; + } +} + +#endif // APP_UTIL_PLATFORM_H__ + +/** @} */ diff --git a/components/libraries/util/common.h b/components/libraries/util/common.h new file mode 100644 index 0000000..44abd5b --- /dev/null +++ b/components/libraries/util/common.h @@ -0,0 +1,38 @@ + /* Copyright (c) 2009 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 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/components/libraries/util/nordic_common.h b/components/libraries/util/nordic_common.h new file mode 100644 index 0000000..b9e97da --- /dev/null +++ b/components/libraries/util/nordic_common.h @@ -0,0 +1,107 @@ +/* Copyright (c) 2008 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 + * @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(a) (((a) & 0xFF000000) >> 24) +/** The lower 8 bits (of a 32 bit value) */ +#define LSB(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) + +#endif // NORDIC_COMMON_H__ diff --git a/components/libraries/util/nrf_assert.c b/components/libraries/util/nrf_assert.c new file mode 100644 index 0000000..b443bc8 --- /dev/null +++ b/components/libraries/util/nrf_assert.c @@ -0,0 +1,22 @@ +/* Copyright (c) 2006 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 "nrf_assert.h" + +#if defined(DEBUG_NRF) +void assert_nrf_callback(uint16_t line_num, const uint8_t * file_name) +{ + (void) file_name; /* Unused parameter */ + (void) line_num; /* Unused parameter */ + + while (1) ; +} +#endif /* DEBUG_NRF */ diff --git a/components/libraries/util/nrf_assert.h b/components/libraries/util/nrf_assert.h new file mode 100644 index 0000000..a053833 --- /dev/null +++ b/components/libraries/util/nrf_assert.h @@ -0,0 +1,59 @@ +/* + * 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. + * + */ + +/** @file + * @brief Utilities for verifying program logic + */ + +#ifndef NRF_ASSERT_H_ +#define NRF_ASSERT_H_ + +#include +#include "compiler_abstraction.h" + +#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 +#define ASSERT(expr) //!< Assert empty when disabled +__WEAK void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name); +#endif /* defined(DEBUG_NRF) || defined(DEBUG_NRF_USER) */ + +#endif /* NRF_ASSERT_H_ */ diff --git a/components/libraries/util/nrf_log.c b/components/libraries/util/nrf_log.c new file mode 100644 index 0000000..32016ed --- /dev/null +++ b/components/libraries/util/nrf_log.c @@ -0,0 +1,380 @@ +#include "nrf.h" +#include "nrf_log.h" +#include "nrf_error.h" +#include +#include +#include + +#if 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) +{ + if(SEGGER_RTT_ConfigUpBuffer(LOG_TERMINAL_NORMAL, "Normal", buf_normal_up, BUFFER_SIZE_UP, SEGGER_RTT_MODE_NO_BLOCK_SKIP) != 0) + { + return NRF_ERROR_INVALID_STATE; + } + + if(SEGGER_RTT_ConfigDownBuffer(LOG_TERMINAL_INPUT, "Input", buf_down, BUFFER_SIZE_DOWN, SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL) != 0) + { + return NRF_ERROR_INVALID_STATE; + } + + 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, ...) +{ + va_list p_args = {0}; + //lint -save -e526 -e628 + 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; + va_list p_args = {0}; + //lint -save -e516 + va_start(p_args, num_args); + //lint -restore + + for(int i = 0; i < num_args; i++) + { + //lint -save -e26 -e10 -e64 -e526 -e628 + 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; +} + +#endif // LOG_USES_RTT == 1 + +#if 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 256 /**< UART TX buffer size. */ +#define UART_RX_BUF_SIZE 1 /**< UART RX buffer size. */ + +void uart_error_handle(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() +{ + 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_Baud38400 + }; + + APP_UART_FIFO_INIT(&comm_params, + UART_RX_BUF_SIZE, + UART_TX_BUF_SIZE, + uart_error_handle, + APP_IRQ_PRIORITY_LOW, + err_code); + + return err_code; +} + +void log_uart_printf(const char * format_msg, ...) +{ + va_list p_args; + va_start(p_args, format_msg); + 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 ) + { + app_uart_put(*msg++); + } +} + +void log_uart_write_hex(uint32_t value) +{ + uint8_t nibble; + uint8_t i = 8; + + app_uart_put('0'); + app_uart_put('x'); + while( i-- != 0 ) + { + nibble = (value >> (4 * i)) & 0x0F; + 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; + app_uart_put( (nibble > 9) ? ('A' + nibble - 10) : ('0' + nibble) ); + } +} + +__INLINE int log_uart_has_input() +{ + return 0; +} + +uint32_t log_uart_read_input(char * c) +{ + return NRF_ERROR_NULL; +} + +#endif // NRF_LOG_USES_UART == 1 + +#if NRF_LOG_USES_RAW_UART == 1 + +#include "nrf_gpio.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 38400 + NRF_UART0->PSELTXD = TX_PIN_NUMBER; + NRF_UART0->BAUDRATE = UART_BAUDRATE_BAUDRATE_Baud38400; + + 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/components/libraries/util/nrf_log.h b/components/libraries/util/nrf_log.h new file mode 100644 index 0000000..1419cbb --- /dev/null +++ b/components/libraries/util/nrf_log.h @@ -0,0 +1,518 @@ +#ifndef NRF_LOG_H_ +#define NRF_LOG_H_ + +#include +#include +#include + +#define NUM_VA_ARGS(...) (sizeof((const char*[]){ 0, ##__VA_ARGS__ })/sizeof(const char*)-1) + +#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 + +#if NRF_LOG_USES_RTT == 1 + +#define LOG_TERMINAL_NORMAL (0) +#define LOG_TERMINAL_ERROR (1) +#define LOG_TERMINAL_INPUT (0) + +/**@brief Function to initialize Segger Real-Time Terminal logger + * + * @details The Segger Real-Time Terminal stores I/O data in a ring buffer + * consumable by the onboard JLink debugging probe. + * To learn more about the Segger RTT, please visit the following web-page: + * Segger RTT website + * + * @warning This function is only available when LOG_USES_RTT is defined as 1 + * + * @warning Do not call this function directly. Use the macro NRF_LOG_INIT + * + * @returns NRF_SUCCESS If initialization was successful + * @returns NRF_ERROR + */ +uint32_t log_rtt_init(void); + +/**@brief Function to write printf string using Segger Real-Time Terminal logger + * + * @details The printf implementation is more efficient than the standard implementation + * To learn more about the Segger RTT, please visit the following web-page: + * Segger RTT website + * + * @warning This function is only available when LOG_USES_RTT is defined as 1 + * + * @warning Do not call this function directly. Use one of the following macros: + * NRF_LOG/NRF_LOG_DEBUG/NRF_LOG_ERROR + * + * @param terminal_index Segger RTT terminal index to use as output + * format_msg Printf format string + * ... Variable length arguments + */ +void log_rtt_printf(int terminal_index, char * format_msg, ...); + +/**@brief Function to write string using Segger Real-Time Terminal logger + * + * @details The string sent in must be null-terminated but the null-termination will not be stored + * in the ring-buffer. + * The impact of running this application should be very low compared to writing to UART + * To learn more about the Segger RTT, please visit the following web-page: + * Segger RTT website + * + * @warning This function is only available when LOG_USES_RTT is defined as 1 + * + * @warning Do not call this function directly. Use one of the following macros: + * NRF_LOG_STR/NRF_LOG_DEBUG_STR/NRF_LOG_ERROR_STR + * + * @param terminal_index Segger RTT terminal index to use as output + * @param num_args Number of arguments + * @param msg Null-terminated character array to use be printed + */ +void log_rtt_write_string(int terminal_index, int num_args, ...); + +/**@brief Function to write integer as hex using Segger Real-Time Terminal logger + * + * @details Insert + * To learn more about the Segger RTT, please visit the following web-page: + * Segger RTT website + * + * @warning This function is only available when LOG_USES_RTT is defined as 1 + * + * @warning Do not call this function directly. Use one of the following macros: + * NRF_LOG_HEX/NRF_LOG_DEBUG_HEX/NRF_LOG_ERROR_HEX + * + * @param terminal_index Segger RTT terminal index to use as output + * @param value Integer value to be printed has hex + */ +void log_rtt_write_hex(int terminal_index, uint32_t value); + +/**@brief Function to write character as hex using Segger Real-Time Terminal logger + * + * @details Insert + * To learn more about the Segger RTT, please visit the following web-page: + * Segger RTT website + * + * @warning This function is only available when LOG_USES_RTT is defined as 1 + * + * @warning Do not call this function directly. Use one of the following macros: + * NRF_LOG_HEX_CHAR/NRF_LOG_HEX_CHAR_DEBUG/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 to check if there is available data in the input-buffer + * + * @retval 1 if character(s) available to read + * @retval 0 if no character(s) available to read + */ +int log_rtt_has_input(void); + +/**@brief Function to read one character from the input-buffer + * + * @param[out] pointer to put the character to store + * + * @retval NRF_SUCCESS if character was read out + * @retval NRF_ERROR_INVALID_DATA if a character could not be read + */ +uint32_t log_rtt_read_input(char* p_char); + +#define NRF_LOG_INIT() log_rtt_init() /*!< Initialize the nrf_log submodule*/ + +#define NRF_LOG_PRINTF(...) log_rtt_printf(LOG_TERMINAL_NORMAL, ##__VA_ARGS__) /*!< nrf log utilizing printf*/ +#define NRF_LOG_PRINTF_DEBUG(...) log_rtt_printf(LOG_TERMINAL_NORMAL, ##__VA_ARGS__) /*!< nrf log utilzinging printf. Will only log if DEBUG is set*/ +#define NRF_LOG_PRINTF_ERROR(...) log_rtt_printf(LOG_TERMINAL_ERROR, ##__VA_ARGS__) /*!< nrf log utilizing printf */ + +#define NRF_LOG(...) log_rtt_write_string(LOG_TERMINAL_NORMAL, NUM_VA_ARGS(__VA_ARGS__), ##__VA_ARGS__) /*!< nrf log for null-terminated strings */ +#define NRF_LOG_DEBUG(...) log_rtt_write_string(LOG_TERMINAL_NORMAL, NUM_VA_ARGS(__VA_ARGS__), ##__VA_ARGS__) /*!< nrf log for null-terminated strings. Will only log if DEBUG is set*/ +#define NRF_LOG_ERROR(...) log_rtt_write_string(LOG_TERMINAL_ERROR, NUM_VA_ARGS(__VA_ARGS__), ##__VA_ARGS__) /*!< nrf log for null-terminated strings.*/ + +#define NRF_LOG_HEX(val) log_rtt_write_hex(LOG_TERMINAL_NORMAL, val) /*!< nrf log for integers logged as hex. Formats as 0x89ABCDEF (ex)*/ +#define NRF_LOG_HEX_DEBUG(val) log_rtt_write_hex(LOG_TERMINAL_NORMAL, val) /*!< nrf log for integers logged as hex. Formats as 0x89ABCDEF (ex). Will only log if DEBUG is set*/ +#define NRF_LOG_HEX_ERROR(val) log_rtt_write_hex(LOG_TERMINAL_ERROR, val) /*!< nrf log for integers logged as hex. Formats as 0x89ABCDEF (ex).*/ + +#define NRF_LOG_HEX_CHAR(val) log_rtt_write_hex_char(LOG_TERMINAL_NORMAL, val) /*!< nrf log characters logged as hex. Formats as AA (ex).*/ +#define NRF_LOG_HEX_CHAR_DEBUG(val) log_rtt_write_hex_char(LOG_TERMINAL_NORMAL, val) /*!< nrf log characters logged as hex. Formats as AA (ex).Will only log if DEBUG is set*/ +#define NRF_LOG_HEX_CHAR_ERROR(val) log_rtt_write_hex_char(LOG_TERMINAL_ERROR, val) /*!< nrf log characters logged as hex. Formats as AA (ex).*/ + +#define NRF_LOG_HAS_INPUT() log_rtt_has_input() /*!< Check if input buffer has unconsumed characters */ +#define NRF_LOG_READ_INPUT(p_char) log_rtt_read_input(p_char) /*!< Consume character from 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 NRF_LOG_USES_UART == 1 + +/**@brief Function to initialize UART logger + * + * @warning This function is only available when LOG_USES_UART is defined as 1 + * + * @warning Do not call this function directly. Use the macro NRF_LOG_INIT + * + * @returns NRF_SUCCESS If initialization was successful + * @returns NRF_ERROR + */ +uint32_t log_uart_init(void); + +/**@brief Function to log to uart using printf + * + * @details The Segger RTT has its own implementation of printf + * that is more efficient than the standard + * + * @warning This function is only available when LOG_USES_UART is defined as 1 + * + * @warning This function is non-blocking. If too much data is sent to the UART, + * some characters may be skipped + * + * @warning Do not call this function directly. Use one of the following macros: + * NRF_LOG/NRF_LOG_DEBUG/NRF_LOG_ERROR + * + * @params format_msg printf format string + * @params ... variable length arguments + */ +void log_uart_printf(const char * format_msg, ...); + +/**@brief Function to log single character + * + * @warning This function is only available when LOG_USES_UART is defined as 1 + * + * @params c character + */ +void log_uart_write_char(const char c); + +/**@brief Function to log null-terminated strings + * + * @defails This function is more efficient than using printf + * The null-termination will not be logged + * + * @warning This function is only available when LOG_USES_UART is defined as 1 + * + * @warning Do not call this function directly. Use one of the following macros: + * NRF_LOG/NRF_LOG_DEBUG/NRF_LOG_ERROR + * + * @params str Null-terminated string + */ +void log_uart_write_string_many(int num_args, ...); + + +/**@brief Function to log null-terminated string + * + * @defails This function is more efficient than using printf + * The null-termination will not be logged + * + * @warning This function is only available when LOG_USES_UART is defined as 1 + * + * @warning Do not call this function directly. Use one of the following macros: + * NRF_LOG/NRF_LOG_DEBUG/NRF_LOG_ERROR + * + * @params str Null-terminated string + */ +void log_uart_write_string(const char* msg); + + +/**@brief Function to log integer value as string + * + * @details The formatted data sent on the UART will be formatted as 0x89ABCDEF (example) + * This function is more efficient than printf + * + * @warning This function is only available when LOG_USES_UART is defined as 1 + * + * @warning This function is non-blocking. If too much data is sent to the UART, + * some characters may be skipped + * + * @warning Do not call this function directly. Use one of the following macros: + * NRF_LOG_HEX/NRF_LOG_DEBUG_HEX/NRF_LOG_ERROR_HEX + * + * @param value Integer value to be printed as hex + */ +void log_uart_write_hex(uint32_t value); + +/**@brief Function to log single character using hex formatting + * + * @details The formatted string sent on the UART will be formatted as AA (ex.) + * + * @warning This function is only available when LOG_USES_UART is defined as 1 + * + * @warning This function is non-blocking. If too much data is sent to the UART, + * some characters may be skipped + * + * @warning Do not call this function directly. Use one of the following macros: + * NRF_LOG_HEX_CHAR/NRF_LOG_DEBUG_HEX_CHAR/NRF_LOG_ERROR_HEX_CHAR + */ +void log_uart_write_hex_char(uint8_t c); + +/**@brief Function to check if there is available data in the input-buffer + * + * @warning This function is only available when LOG_USES_UART is defined as 1 + * + * @warning Do not call this function directly. Use NRF_LOG_HAS_INPUT + * + * @retval 1 if character(s) available to read + * @retval 0 if no character(s) available to read + */ +int log_uart_has_input(void); + +/**@brief Function to read one character from the input-buffer + * + * @param[out] pointer to put the character to store + * + * @warning This function is only available when LOG_USES_UART is defined as 1 + * + * @warning Do not call this function directly. Use NRF_LOG_HAS_INPUT + * + * @retval NRF_SUCCESS if character was read out + * @retval NRF_ERROR_INVALID_DATA if a character could not be read + */ +uint32_t log_uart_read_input(char* p_char); + + +#define NRF_LOG_INIT() log_uart_init() /*!< Initialize the nrf_log submodule*/ + +#define NRF_LOG_PRINTF(...) log_uart_printf(__VA_ARGS__) /*!< nrf log utilizing printf*/ +#define NRF_LOG_PRINTF_DEBUG(...) log_uart_printf(__VA_ARGS__) /*!< nrf log utilzinging printf. Will only log if DEBUG is set*/ +#define NRF_LOG_PRINTF_ERROR(...) log_uart_printf(__VA_ARGS__) /*!< nrf log utilizing printf */ + +#define NRF_LOG(...) log_uart_write_string_many(NUM_VA_ARGS(__VA_ARGS__), ##__VA_ARGS__) /*!< nrf log for null-terminated strings */ +#define NRF_LOG_DEBUG(...) log_uart_write_string_many(NUM_VA_ARGS(__VA_ARGS__), ##__VA_ARGS__) /*!< nrf log for null-terminated strings. Will only log if DEBUG is set*/ +#define NRF_LOG_ERROR(...) log_uart_write_string_many(NUM_VA_ARGS(__VA_ARGS__), ##__VA_ARGS__) /*!< nrf log for null-terminated strings.*/ + +#define NRF_LOG_HEX(val) log_uart_write_hex(val) /*!< nrf log for integers logged as hex. Formats as 0x89ABCDEF (ex)*/ +#define NRF_LOG_HEX_DEBUG(val) log_uart_write_hex(val) /*!< nrf log for integers logged as hex. Formats as 0x89ABCDEF (ex). Will only log if DEBUG is set*/ +#define NRF_LOG_HEX_ERROR(val) log_uart_write_hex(val) /*!< nrf log for integers logged as hex. Formats as 0x89ABCDEF (ex).*/ + +#define NRF_LOG_HEX_CHAR(val) log_uart_write_hex_char(val) /*!< nrf log characters logged as hex. Formats as AA (ex).*/ +#define NRF_LOG_HEX_CHAR_DEBUG(val) log_uart_write_hex_char(val) /*!< nrf log characters logged as hex. Formats as AA (ex).Will only log if DEBUG is set*/ +#define NRF_LOG_HEX_CHAR_ERROR(val) log_uart_write_hex_char(val) /*!< nrf log characters logged as hex. Formats as AA (ex).*/ + +#define NRF_LOG_HAS_INPUT() log_uart_has_input() /*!< Check if input buffer has unconsumed characters */ +#define NRF_LOG_READ_INPUT(p_char) log_uart_read_input(p_char) /*!< Consume character from 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 NRF_LOG_USES_RAW_UART + +/**@brief Function to initialize raw UART logger + * + * @warning Do not call this function directly. Use the macro NRF_LOG_INIT + * + * @returns NRF_SUCCESS If initialization was successful + * @returns NRF_ERROR + */ +uint32_t log_raw_uart_init(void); + +/**@brief Function to log to raw uart using printf + * + * @details The Segger RTT has its own implementation of printf + * that is more efficient than the standard + * + * @warning This function is only available when LOG_USES_UART is defined as 1 + * + * @warning This function is non-blocking. If too much data is sent to the UART, + * some characters may be skipped + * + * @warning Do not call this function directly. Use one of the following macros: + * NRF_LOG/NRF_LOG_DEBUG/NRF_LOG_ERROR + * + * @params format_msg printf format string + * @params ... variable length arguments + */ +void log_raw_uart_printf(const char * format_msg, ...); + +/**@brief Function to log single character + * + * @params c character + */ +void log_raw_uart_write_char(const char c); + +/**@brief Function to log null-terminated strings + * + * @defails This function is more efficient than using printf + * The null-termination will not be logged + * + * @params str Null-terminated string + */ +void log_raw_uart_write_string_many(int num_args, ...); + + +/**@brief Function to log null-terminated string + * + * @defails This function is more efficient than using printf + * The null-termination will not be logged + * + * @params str Null-terminated string + */ +void log_raw_uart_write_string(const char * str); + +/**@brief Function to log integer value as string + * + * @details The formatted data sent on the UART will be formatted as 0x89ABCDEF (example) + * This function is more efficient than printf + * + * @warning This function is only available when LOG_USES_UART is defined as 1 + * + * @warning This function is non-blocking. If too much data is sent to the UART, + * some characters may be skipped + * + * @warning Do not call this function directly. Use one of the following macros: + * NRF_LOG_HEX/NRF_LOG_DEBUG_HEX/NRF_LOG_ERROR_HEX + * + * @param value Integer value to be printed as hex + */ +void log_raw_uart_write_hex(uint32_t value); + +/**@brief Function to log single character using hex formatting + * + * @details The formatted string sent on the UART will be formatted as AA (ex.) + * + * @warning This function is only available when LOG_USES_UART is defined as 1 + * + * @warning This function is non-blocking. If too much data is sent to the UART, + * some characters may be skipped + * + * @warning Do not call this function directly. Use one of the following macros: + * NRF_LOG_HEX_CHAR/NRF_LOG_DEBUG_HEX_CHAR/NRF_LOG_ERROR_HEX_CHAR + */ +void log_raw_uart_write_hex_char(uint8_t c); + +/**@brief Function to check if there is available data in the input-buffer + * + * @retval 1 if character(s) available to read + * @retval 0 if no character(s) available to read + */ +int log_raw_uart_has_input(void); + +/**@brief Function to read one character from the input-buffer + * + * @param[out] pointer to put the character to store + * + * @retval NRF_SUCCESS if character was read out + * @retval NRF_ERROR_INVALID_DATA if a character could not be read + */ +uint32_t log_raw_uart_read_input(char* p_char); + +#define NRF_LOG_INIT() log_raw_uart_init() /*!< Initialize the nrf_log submodule*/ + +#define NRF_LOG_PRINTF(...) log_raw_uart_printf(__VA_ARGS__) /*!< nrf log utilizing printf*/ +#define NRF_LOG_PRINTF_DEBUG(...) log_raw_uart_printf(__VA_ARGS__) /*!< nrf log utilzinging printf. Will only log if DEBUG is set*/ +#define NRF_LOG_PRINTF_ERROR(...) log_raw_uart_printf(__VA_ARGS__) /*!< nrf log utilizing printf */ + +#define NRF_LOG(...) log_raw_uart_write_string_many(NUM_VA_ARGS(__VA_ARGS__), ##__VA_ARGS__) /*!< nrf log for null-terminated strings */ +#define NRF_LOG_DEBUG(...) log_raw_uart_write_string_many(NUM_VA_ARGS(__VA_ARGS__), ##__VA_ARGS__) /*!< nrf log for null-terminated strings. Will only log if DEBUG is set*/ +#define NRF_LOG_ERROR(...) log_raw_uart_write_string_many(NUM_VA_ARGS(__VA_ARGS__), ##__VA_ARGS__) /*!< nrf log for null-terminated strings.*/ + +#define NRF_LOG_HEX(val) log_raw_uart_write_hex(val) /*!< nrf log for integers logged as hex. Formats as 0x89ABCDEF (ex)*/ +#define NRF_LOG_HEX_DEBUG(val) log_raw_uart_write_hex(val) /*!< nrf log for integers logged as hex. Formats as 0x89ABCDEF (ex). Will only log if DEBUG is set*/ +#define NRF_LOG_HEX_ERROR(val) log_raw_uart_write_hex(val) /*!< nrf log for integers logged as hex. Formats as 0x89ABCDEF (ex).*/ + +#define NRF_LOG_HEX_CHAR(val) log_raw_uart_write_hex_char(val) /*!< nrf log characters logged as hex. Formats as AB (ex).*/ +#define NRF_LOG_HEX_CHAR_DEBUG(val) log_raw_uart_write_hex_char(val) /*!< nrf log characters logged as hex. Formats as AB (ex).Will only log if DEBUG is set*/ +#define NRF_LOG_HEX_CHAR_ERROR(val) log_raw_uart_write_hex_char(val) /*!< nrf log characters logged as hex. Formats as AB (ex).*/ + +#define NRF_LOG_HAS_INPUT() log_raw_uart_has_input() /*!< Check if input buffer has unconsumed characters */ +#define NRF_LOG_READ_INPUT(p_char) log_raw_uart_read_input(p_char) /*!< Consume character from 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) + +#else + +#include "nrf_error.h" +#include "nordic_common.h" + +// Empty definitions + +__INLINE int dummy_func(void* ignore) +{ + UNUSED_PARAMETER(ignore); + return NRF_SUCCESS; +} + +#define NRF_LOG_INIT() dummy_func(0) +#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) dummy_func(ignore) + +#endif + +/**@brief Function to write hex-values + * + * @warning This function is by no means tread-safe. It is written for convenience + * If you log from different application-contexts you may get different results + * + * @returns NULL by default + */ +const char* log_hex(uint32_t value); + +/**@brief Function to write hex-char + * + * @warning This function is by no means tread-safe. It is written for convenience + * If you log from different application-contexts you may get different results + * + * @returns NULL by default + */ +const char* log_hex_char(const char value); + +#endif // NRF_LOG_H_ diff --git a/components/libraries/util/sdk_common.h b/components/libraries/util/sdk_common.h new file mode 100644 index 0000000..8e4644c --- /dev/null +++ b/components/libraries/util/sdk_common.h @@ -0,0 +1,38 @@ +/* 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. + * + */ + +/** @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" + +/** @} */ +/** @endcond */ +#endif // SDK_COMMON_H__ + diff --git a/components/libraries/util/sdk_errors.h b/components/libraries/util/sdk_errors.h new file mode 100644 index 0000000..757c10f --- /dev/null +++ b/components/libraries/util/sdk_errors.h @@ -0,0 +1,115 @@ +/* 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. + * + */ + +/**@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/components/libraries/util/sdk_mapped_flags.c b/components/libraries/util/sdk_mapped_flags.c new file mode 100644 index 0000000..12c20c2 --- /dev/null +++ b/components/libraries/util/sdk_mapped_flags.c @@ -0,0 +1,161 @@ +/* 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 "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 (int i = 0; i < SDK_MAPPED_FLAGS_N_KEYS; i++) + { + if (p_keys[i] == key) + { + for (int 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 (int 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 (int 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 (int 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/components/libraries/util/sdk_mapped_flags.h b/components/libraries/util/sdk_mapped_flags.h new file mode 100644 index 0000000..6007eb2 --- /dev/null +++ b/components/libraries/util/sdk_mapped_flags.h @@ -0,0 +1,153 @@ +/* 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. + * + */ + +#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/components/libraries/util/sdk_os.h b/components/libraries/util/sdk_os.h new file mode 100644 index 0000000..ff871cf --- /dev/null +++ b/components/libraries/util/sdk_os.h @@ -0,0 +1,40 @@ +/* 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. + * + */ + + /** @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/components/libraries/util/sdk_resources.h b/components/libraries/util/sdk_resources.h new file mode 100644 index 0000000..98d8657 --- /dev/null +++ b/components/libraries/util/sdk_resources.h @@ -0,0 +1,51 @@ +/* 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 + * @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/components/properitary_rf/esb/arm/esb_arm.lib b/components/properitary_rf/esb/arm/esb_arm.lib new file mode 100644 index 0000000000000000000000000000000000000000..d88c7ce2b1d0f7c4eb39d396ac789f2b50575b41 GIT binary patch literal 80618 zcmeEv3t&{$ng6+WCdniO2mv)<#7PJ+V1P*o&tf~tgkc848k0Ay zv?&p5ZH>1?H^*9Io8s-!rs&-2rg&rZ#(9v5u33C} z)m(9|Ue<<%RJ}QxY)y9BNW44V)YTb}b|hOjwZx;H$);-t@rc-AQyGhPwRR?3?3i|J zO?EaVh7@UzcO={6&6enpGEH6W?eW%5guXf6(bCq5C`Q|3t()TKCLL{SjSd&wrg&%6 z3P$Cxt-NC}4>4$tciR#}_|B4W>adbAq<5QXm0*>h3w>j9V;hz9Mt@B_Ry}8MNuO2@ z#cL)_6k}(sv#Uc$Wo@mU$kh%J+Y(E*#2Qh&W~}L&I4BZE&9=6dLELCl8w!`>&T8!H z!dQE}Bi_En(v+6k*d8BDG`l)gkZD1)%^XB)kH?w^5jVDUb;v5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sM~m3w-40Cre`(X8pMoqo z5x4<2Sh~M9hSTl&s)kh^CC?sED>*hWiO0&``uS9bUC<5z8wO(CI0M%?z3WjW*iIzn zL3a$+-?E=g1RFHxme=|u*(`gBshtf~J?s|QWRr9Rmh+2a8}a2il1Oa{3onC+%^vtuvGV8ahe zaE+AW4>W24JVCU@aD>wcJ{ytU97hI`WC7BOb|q&IEv`37jxz!mX!JPt&PV$Ffs3~2 gb!MFm!W7)&f^ryB>Lib-%m-;j=Nz!2GvWCE0A9`0jQ{`u literal 0 HcmV?d00001 diff --git a/components/properitary_rf/esb/arm/esb_sd_resources_arm.lib b/components/properitary_rf/esb/arm/esb_sd_resources_arm.lib new file mode 100644 index 0000000000000000000000000000000000000000..7dbdf5cf37a9ce7d0e0ac8b7a11a48a34bb9e149 GIT binary patch literal 81270 zcmeEv3w%^po&ULaCdnkcLcliA6ekcMP@qW&uZlW(Fw8)B6ljZz&YdI!Gd3jCJRsDz z21?ts_ODp0wpv~4)^4k)viv!b-P>bMz;#aLoJO8q`ps8y*~dToQB*ZTG8Zlzwy^|dFJ8teLppDXppxc=`xr7qyI3cjTN zzr1R0QkK3Vk!a7(NF-8M8|m!c9%+k5J3C_?k)6@b=#E%-q%E?vt}WJDw|yC8BAZrS zUAt7hQZJiBN~_)(NpvQ9(@3m8*4Eb>i}WNqcXY%ey@|GKNAO7ONmB)j^mX}`KUYT^Ht1~iIa64kX z5jPlE)VYJ6OqI)99xC`-+{|MHeL%GPJaJu_C zSv0yrZ|~Thc?gMs)opTIu&$)eFCa|P2+zIIo@*nC9#nQjJJzn&Zwf}JC)piKM!RE? zwrEF3j)qu2YJW7@+Xp5+=P>D$J|eMQs4i+tc-^W^HIeY9D?`!F_KsM0CR6Gpvl2U# z(T*tcFcz&@R=)zz_J~%g_S}-l5Gd(DCiKR-JEI*awC?Cm-NXpPRO61eE~cidb9-Wk z_7Uyb)7d7qTxaEuWTFe%(Au{nl0>7iyE|d>SgYZK-Q5=Hh;{Dh)paRNM_z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tOQKX+`g+Nf50HDLR?C0>7ZQ`hDW%e%P#>PnkTUw`!m?B=6Vq!4`DS3MWH1Nirv ze$z^%**R9M({~{5TGUU7OuCn50ou7~-R|EF~$NhijEZktYzv3L_aoyT?*zgL&p6us1I`s|wX$z6q zrTv;C!sj>DF+kuG;t+b=j#D4j?J4gW z)9LQIb4y{;UOUx{W&hM(8c6Y_?$^E@BJF>1Fa= zI_T)9AgktsJ$RH5K{oX40kxPDrICkYLj_(aCd^9=a$`$8NNi#&MoBBD$h-lK?7fa>qLlK0sTB%!f;P8>==|gfOPa~)2%4H0@0C2 z*|~9)a5I0>^1MLAURw4`{h?@X~;KVZoiUnCkgXCdr;oi-wga06(jP z&+w$8$MXD{FlZVP$OZrsve#MKId}~cv%d8RT8K6|64wio8j_lkuVzB%(djh17I=m4 oKL*?G&NbroDUexx+Yu@P?%)kJxgjd~s0$JjD9ECp?!?Le1;v!OPyhe` literal 0 HcmV?d00001 diff --git a/components/properitary_rf/esb/gcc/esb_gcc.a b/components/properitary_rf/esb/gcc/esb_gcc.a new file mode 100644 index 0000000000000000000000000000000000000000..ea813f82ea70ac47a0f0262a2b7998a5ca0a4897 GIT binary patch literal 50420 zcmeIb3w)GEy*ED3?j~850O8s|w{)|c(B&2q!mSiFB$Vb#mqL%BQnQ<6Vb=z-orCJp^jn@C$`lhv>gSDQsvDHI8>e+g0)v6rr5!6cF?|0^zCzDNR zqyO{1pa1{7on-d+eCPL@`#dxA%(ZAutg|)oR^O7qNL5~O<&|X>OP8%$5eSq?miZe9 zEMKv5nX(b}2_e2A#3cbCF7^L)y5wmg{uW&p6=FR4%IAgn|C4UoD#ZV-`tBJ*ypcYN z{LI!5y(Yx}N&VG!Azn`pGzp>fhU?Zhuidoi>gzT)*KXK+^>rK8HZ-SVon7(f*v_`* zZ5^F^Vx4VbXXm!&*2IqHGhT zLFhoDifrR9VY5>m9qrP^ZOLsNDic%56mqUR*4?ABM{+vjUGdJ{+SOqj+dAW;4O2bc zw)a9>Zt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VTz@ks?eVG`@!78aR%#G0b$6_4p!CrsXypqpL3! t(}nf=$jU^|KW~;bOf|NsRJV7u-h6{R^+qVu+Fi+R`_U1w>o_>~zW{8Bjz|Ci literal 0 HcmV?d00001 diff --git a/components/properitary_rf/esb/iar/esb_iar.a b/components/properitary_rf/esb/iar/esb_iar.a new file mode 100644 index 0000000000000000000000000000000000000000..0d573431b83db4b0ad2d123be56f9e8ff81182e2 GIT binary patch literal 128574 zcmeFa31D1Ry+3~LOgfpSTe<*k2{7qK3Z-PyBy9mPO}7Nv0&Ur(I5SBmouOIAEG0#j z6biHoSP+m+X=Sk}YC)=?Rttg_MNO$Yf)U~2hO+nspFHyae9m&`+?z?8^zrV>lltf#7>ePZ0Bi<`oURGH;Z_b>GXe3f9S?X_PdAURtmC-U4 zB3>YbctVK7UlbzJHMHL;B|`jf`d#;o5Qp-6;7TC|^LwgNi2tAdoaR%-L4UVqgyaA1 zC=$-U^7qnp!WsCtV&#(9f>o;)uUs9gU9o!c$`uQi#WIPu_GB#4(hzHGZM!(p)*xEi z8e{dT=2)^TS>M@_jJ2m*);1+$9qIaY{dn|jcYW6;J7V>nZEeXG&{U$OCE0W!UM$_x zknGAS(UERWwl}qQxXg4*It$wS$K%swOZ3wvjgED;bflY%nX&eZ(;f9GH#(1qPLa`r zsA6r2mbJ;DNyl1SVhzdmbX&5)#F|rqUnbGso@_&Yw!&bMZq78t+B*^*oyhgpj&x(X zKGBhe=K4CRObe%5I+ATI2_!Gk)Kr(y1($5EizONwP~`RNkb@nqv5u}-W4f_b1|_#4 z-JYmxQVFwgtYJe-%+``@@rWtdPpUDAEH$w;wzW3L+I;afHg&eA2JrRU#>xfj+mh|= zu}oXCG2Iob+t87#`Oqb(7VP6&;w>lx$hsp(+A%Kvrq1D!YDd^|2hH4T+9K zTf%3R${yr9lAlRulB&TNP0fj}SW9PfU9v6K+Q&3}7Pioqd9jKk{&FKzQx2D7fFH;qODHK(y*x-#d1I4dPW8i>Yt?l)(`VQ6Lsm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L`eS~+ewXl}8kk(Xl%C_I?=G)zg5(mt7!K z+rn*y^7gi_XEgI|Ic*E~Q?6ZCLihjDi9)q4+#AsP*so{sPJFHK1A`vaj+wDvPm^As z-;eO_N2g~n5Z*a$^Ol`I6~Pf%;k|-mviQp2G>_LO%mq389Xb3r;q{q2kY9h&r)}O2 zU0vkuJxFT-^-;= zvS)5(rPJcJ_LZ&1hB(V-j|-jZRKF+0OLMZTyBps`9EjuuF#}`gQ+)tsAn)BL zpJ;7BRO+a|Sf_?E&hZaAd5)g#CRJ_J1}LcAD(ib7nUTq7w+W}Y zs?f#@duRPs$$ff9CwSfHGc?hIKXOpLyMmOtG%qE+_cV^Ldo&-QcbOQ|>pLXsu8Zj> ze_oVkN}-RPQlO(@hP|q-h31gb=1Mgj?wsDAzQG9HUZXni&ArVACCy|5X);(O>+i;5 zxYuBjC4Vz=nW7^tZLoAEG%=Jvp_x(BOdE`9C*MjY8pWtuXeusQZE7jm)KmVX zPMRos^Kqo;bDVM^pHuBOao9k~{W*`Io&wvEGofR+u?Y{|OG1r9jol`6bnN^*|3)jT z`3%MF+&4+sNM8{fpd9n%UL~Q*wOpqjte=*H$q4hrT0xV4Tx-Hhawh+vM<6#3>YS51 z0S`ak3y^bRl6BW}tei{Y#ijrx5jlr(F08KKOKy#oi|)q67rc~XJi38vhb`~VAeV1| z;6}oHm3|7Na*`e{e^htw&XIcsxi%|jT0pKPmmBY?)X6FM=epc@Z$i$+%TsP#KD@h; zD<&N;dU!nKd&GOANW76G(&^_~;e7fXi(E1Kt@H5A8v+gU;a!Q`B&)wqa`W#89^Qdg zPJq(((9fD;cd&28;9IX{8V2|TLYEc^Zfk!cQJBg Y^=@t_K7PDcAlHPS@OU{IC%nr42NMtB9RL6T literal 0 HcmV?d00001 diff --git a/components/properitary_rf/esb/iar/esb_sd_resource_iar.a b/components/properitary_rf/esb/iar/esb_sd_resource_iar.a new file mode 100644 index 0000000000000000000000000000000000000000..1397662eb93566df80a5c16a447823616838af8b GIT bin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Vf%qD7O(DV0H3zwMB=f`KbVSewm?f}fW&M+J^wE;TkIzJmM9_Bhf z5`g8L49<{oRCvhV2Ag%}Sr+XB51YkEs!c98)iRZ4SG`hGEVjhmJ*{FgS744y=Dctt z;4qbERS1m1gTQbT?{P5OYgL0v(y`VUTf zL=+Y2R6;W!W2TK0)8T24Rlvl5NE04h7&&SG5=ZHAokBE@;$x?(_ ze;&~IxgZIgR-+JoMSf9k^JWKiXxfVSOm;(t=jHd0_@swLzuo_!!cWHVj8SEF3pib$ zZ%qaux<2>dL)faN7LOIlkiTERRK8nq!LK_Y+VEE<4g(YRi{*nXW+DaaG$SE? Lm%oY&&qn`0O><@X literal 0 HcmV?d00001 diff --git a/components/properitary_rf/gzll/config/nrf_gzp_config.h b/components/properitary_rf/gzll/config/nrf_gzp_config.h new file mode 100644 index 0000000..35f5b2d --- /dev/null +++ b/components/properitary_rf/gzll/config/nrf_gzp_config.h @@ -0,0 +1,124 @@ +/* Copyright (c) 2008 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. + * + * $LastChangedRevision: 25419 $ + */ + + +#ifndef __GZP_CONFIG_H +#define __GZP_CONFIG_H + + +/** + * Definition of "secret key" used during "Host ID exchange". + */ + +#define GZP_SECRET_KEY {1, 23, 45, 57, 26, 68, 12, 64, 13, 73, 13, 62, 26, 45, 12, 77} + +//----------------------------------------------------------------------------- + +/** + Definition of the first static selected pairing channel. Should be located in + the lower Nth of the channel range, where N is the size if the channel subset + selected by the application. +*/ +#define GZP_CHANNEL_LOW 2 + +/** + Definition of the second static selected pairing channel. Should be located in + the upper Nth of the channel range, where N is the size if the channel subset + selected by the application. +*/ +#define GZP_CHANNEL_HIGH 79 + +/** + Definition of the static "global" pairing address. +*/ +#define GZP_ADDRESS 4, 6, 8, 10 + +/** + Reduced TX power for use during close proximity pairing. + */ +#define GZP_POWER NRF_GZLL_TX_POWER_N16_DBM + +/** + Definition of pairing request timeout. +*/ +#define GZP_REQ_TX_TIMEOUT 200 + +/** + Definition of the maximimum number of "backoff" packets (step 0) to be transmitted. +*/ +#define GZP_MAX_BACKOFF_PACKETS 100 + +/** + Definition of the period a device shall wait before attempting to send the packet for + fetching the pairing response (step 1). +*/ +#define GZP_TX_ACK_WAIT_TIMEOUT (GZP_CLOSE_PROXIMITY_BACKOFF_RX_TIMEOUT + 50) + +/** + Definition of the period a device in close proximity shall back off on the pairing + address after a backoff packet has been received. +*/ +#define GZP_CLOSE_PROXIMITY_BACKOFF_RX_TIMEOUT ((GZP_REQ_TX_TIMEOUT / 2) + 50) + +/** + Definition of the period a device NOT in close proximity shall back off on the pairing + address after a backoff packet has been received. +*/ +#define GZP_NOT_PROXIMITY_BACKOFF_RX_TIMEOUT (GZP_CLOSE_PROXIMITY_BACKOFF_RX_TIMEOUT + GZP_STEP1_RX_TIMEOUT) + +/** + Definition of the time the host waits for a device to complete + transmission of the pairing request step 1 packet. +*/ +#define GZP_STEP1_RX_TIMEOUT (((GZP_REQ_TX_TIMEOUT / 2) + GZP_TX_ACK_WAIT_TIMEOUT) + 50) + +/** + Definition of the lowest boundary for the channel range to be used. +*/ +#define GZP_CHANNEL_MIN 2 + +/** + Definition of the upper boundary for the channel range to be used. +*/ +#define GZP_CHANNEL_MAX 80 + +/** + Definition of the minimum channel spacing for the channel subset generated + during pairing. +*/ +#define GZP_CHANNEL_SPACING_MIN 5 + +/** + Non volatile memory (Flash or OTP) storage address. A device will + require GZP_DEVICE_PARAMS_STORAGE_SIZE bytes of memory, and + Host 11 bytes. +*/ +#define GZP_PARAMS_STORAGE_ADR 0x00001000 + +/** + Number of bytes available for parameter storage in Device. +*/ +#define GZP_DEVICE_PARAMS_STORAGE_SIZE 1024 + +/** + Maximum Device TX payload length [bytes]. + */ +#define GZP_MAX_FW_PAYLOAD_LENGTH 17 + +/** + Maximum Host ACK payload length [bytes]. + */ +#define GZP_MAX_ACK_PAYLOAD_LENGTH 10 + + +#endif diff --git a/components/properitary_rf/gzll/gcc/gzll_gcc.a b/components/properitary_rf/gzll/gcc/gzll_gcc.a new file mode 100644 index 0000000000000000000000000000000000000000..a6f8dd7a161dd7bcde3f61621a51c51cf5082f33 GIT binary patch literal 53732 zcmeIb3w)H-oj-h@nMpE)5W-CZ4mdMOFx-=H5fs~yAm)mLU>huMW=Mw2Xdn-{U~q*7 zwJo-`i`KeeZ3RWe7F$Zq)_qs|N7wF4t$lY=?Jl^zjNP`{u5H<^Td=j{{eI6m&y$l$ zxU~Q6|MPzO_Q1*S`JUhJ{Lb|`=RD^&q2;m8mc;vV7X*i!@`cNml`X7TT)sFMER!tr zZ!ox|eA!avBbqCONC`1@t`O5p|1f(6{QWVuqFsoKu~(;s_;a;!pAi3lwT~d}7qU;k zBt)kD>f1v6pS1t9L5TC&Z`TN+?CKjj)klyIfa^ntQf% zC)=Sewq;Aay}9eQWOqwqRFT$rSF$tS>WGdi)6&z~8Q;>4&^O1s+B>=t#pce~mbUmG zCf(ezrTJXJwZ*%eonUmVUFBUPd5A%4yw{Z&#dn5;sl!ResNP*>Y+EeZ9@~gaw_`20 zG725YRFUc2B{bXa=xCQ3HzhZ9s6w=pHcGBL*4?9uM{+vjUGdIsj@BU`n>yno9qpcO z9lVg9TROIMqa+M6-##)_hZtm`A?(UVjKcsh4950=d=bJh^HaB->iZEZaKSxki zGiJODROX!Wb{>iDj_z1{Gg9Btf)a6Km7%NSR>t!}v1Um-kunk^okt{q@73mEImZYO zcaiU&Zi%{w=OBfhM(RQ=w1Kx9B}A5?r%z5G5AV<1V7M05GxXrBf)IZWy z$~w)u9q&wb7!_W6ITw>YyS8s>X>L!VqC;wUHlBlJhS$}M0NvuhEfHt;ur1jVZ|*>| z*Re^eAFkDDo&P|u=M42Cv=50;%jQ@wb1~N49p7y0cGxY7b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!Nw|3<5;+9AK4`4$n=z5v-qDdy{q zA%aS^Y@^PvAD1)GGd0#Kn)KsZgJse)=?5-C?_|&!r*|wCzQ0eQ=iH?0uIF1l7sY4M z^Nr&;zd*fCtLHexmvn-M8@YDevVH@-TpufL#mx`WV9Jp4N#S+rqq6gbEWJ_awOKvW z0&*?AY=5suZwB_+CfnbC@%*Kh8=0 The number of packets in the TX FIFO for the pipe. + * @retval -1 If the pipe number is invalid. + */ +int32_t nrf_gzll_get_tx_fifo_packet_count(uint32_t pipe); + + +/** + * @brief Get the number of packets in the RX FIFO on a specific pipe. + * + * @param pipe The pipe for which to check. This value must be < NRF_GZLL_CONST_PIPE_COUNT. + * @retval >=0 The number of packets in the RX FIFO for the pipe. + * @retval -1 If the pipe number is invalid. + */ +int32_t nrf_gzll_get_rx_fifo_packet_count(uint32_t pipe); + + +/** + * @brief Get the total number of packets residing in all TX and RX FIFOs. + * + * Can be used to check against NRF_GZLL_CONST_MAX_TOTAL_PACKETS to + * determine if there is free space in the memory pool for more packets. + * + * @return The number of packets residing in all TX and RX FIFOs. + */ +uint32_t nrf_gzll_get_total_allocated_packet_count(void); + + +/** + * @brief Check if adding a packet to a pipe's TX FIFO should be successful. + * + * Checks if there is another space in the pipe's TX and RX FIFOs + * as well as enough overall space in the packet pool. + * + * @param pipe The pip for which to check. This value must be < NRF_GZLL_CONST_PIPE_COUNT. + * + * @retval true If there is another space. + * @retval false If there is not enough space, or the pipe is invalid. + */ +bool nrf_gzll_ok_to_add_packet_to_tx_fifo(uint32_t pipe); + +/** + * @brief Flush the RX FIFO for a specific pipe. + * + * Delete all the packets and free the memory of the TX FIFO for a + * specific pipe. + * + * Note that it is not allowed to flush a TX FIFO when + * Gazell is enabled. + * + * @param pipe is the pipe for which to flush. This value must be < NRF_GZLL_CONST_PIPE_COUNT. + * @retval true if the pipe was flushed. + * @retval false if the pipe was not flushed. + */ +bool nrf_gzll_flush_tx_fifo(uint32_t pipe); + + +/** + * @brief Flush the RX FIFO for a specific pipe. + * + * Delete all the packets and free the memory of the RX FIFO for a + * specific pipe. + * + * @param pipe is the pipe for which to flush. This value must be < NRF_GZLL_CONST_PIPE_COUNT. + * @retval true if the pipe was flushed. + * @retval false if the pipe was not flushed. + */ +bool nrf_gzll_flush_rx_fifo(uint32_t pipe); + + +/** @} */ + + +/******************************************************************************/ +/** @name Configuration functions + * + * Configuration 'set' functions may only be called while Gazell is disabled. The + * new parameter comes into effect when Gazell is enabled again. + * + * Configuration 'get' functions may be called at any time. + * + * @{ */ +/******************************************************************************/ + + +/** + * @brief Set the mode. + * + * @param mode The mode to be used. + * See nrf_gzll_mode_t for a list of valid modes. + * + * It is allowed to change mode when Gazell is enabled. If the mode is + * being changed while Gazell is enabled, the mode will not change right away. + * In this case the callback function nrf_gzll_mode_changed() will be called + * after the mdoe has changed. + * + * @retval true If the parameter was set. + */ +bool nrf_gzll_set_mode(nrf_gzll_mode_t mode); + + +/** + * @brief Get function counterpart to nrf_gzll_set_mode(). + * + * @return The current mode. + */ +nrf_gzll_mode_t nrf_gzll_get_mode(void); + + +/** + * @brief Set the base address for pipe 0. + * + * The full on-air address for each pipe is composed of a multi-byte base address + * prepended to a prefix byte. + * + * For packets to be received correctly, the most significant byte of + * the base address should not be an alternating sequence of 0s and 1s i.e. + * it should not be 0x55 or 0xAA. + * + * @param base_address The 4 byte base address. All bytes are used. + * + * @retval true If the parameter was set. + * @return false If Gazell was enabled. + */ +bool nrf_gzll_set_base_address_0(uint32_t base_address); + + +/** + * @brief Get function counterpart to nrf_gzll_set_base_address_0(). + * + * @return Base address 0. + */ +uint32_t nrf_gzll_get_base_address_0(void); + + +/** + * @brief Set the base address for pipes 1-7. + * + * Pipes 1 through 7 share base_address_1. @sa nrf_gzll_set_base_address_0. + * + * @param base_address The 4 byte base address. + * + * @retval true If the parameter was set. + * @retval false If Gazell was enabled. + */ +bool nrf_gzll_set_base_address_1(uint32_t base_address); + + +/** + * @brief Get function counterpart to nrf_gzll_set_base_address_1(). + * + * @return Base address 1. + */ +uint32_t nrf_gzll_get_base_address_1(void); + + +/** + * @brief Set the address prefix byte for a specific pipe. + * + * Each pipe should have its own unique prefix byte. + * + * @param pipe The pipe that the address should apply to. + * This value must be < NRF_GZLL_CONST_PIPE_COUNT. + * @param address_prefix_byte The address prefix byte. + * + * @retval true If the parameter was set. + * @retval false If Gazell was enabled, or if the pipe was invalid. + */ +bool nrf_gzll_set_address_prefix_byte(uint32_t pipe, uint8_t address_prefix_byte); + + +/** + * @brief Get function counterpart to nrf_gzll_set_address_prefix_byte(). + * + * @param pipe The pipe for which to get the address. + * This value must be < NRF_GZLL_CONST_PIPE_COUNT. + * @param out_address_prefix_byte The pointer in which to return the + * address prefix byte. + * + * @retval true If the parameter was returned. + * @retval false If Gazell was enabled, the pipe was invalid or + * out_address was a NULL pointer. + */ +bool nrf_gzll_get_address_prefix_byte(uint32_t pipe, uint8_t* out_address_prefix_byte); + + +/** + * @brief Set which pipes shall listen for packets in Host mode. + * + * This value is a bitmap, and each bit corresponds to a given pipe number. + * Bit 0 set to "1" enables pipes 0, bit 1 set to "1" enables pipe 1 + * and so forth. + * The maximum number of pipes is defined by NRF_GZLL_CONST_PIPE_COUNT. + * + * @param pipes A bitmap specifying which pipes to monitor. + * + * @retval true If the parameter was set. + * @retval false If Gazell was enabled. + */ +bool nrf_gzll_set_rx_pipes_enabled(uint32_t pipes); + + +/** + * @brief Get function counterpart to nrf_gzll_set_rx_pipes_enabled(). + * + * @return Bitmap holding the current enabled pipes. + */ +uint32_t nrf_gzll_get_rx_pipes_enabled(void); + + +/** + * @brief Set the timeslot period. + * + * The length in microseconds of a Gazell link layer timeslot. + * + * The minimum value of the timeslot period is dependent of the + * radio data rate (@sa nrf_gzll_set_datarate()). + * + * - For NRF_GZLL_DATARATE_2MBIT the timeslot period must be >= 600 us. + * - For NRF_GZLL_DATARATE_1MBIT the timeslot period must be >= 900 us. + * - For NRF_GZLL_DATARATE_250KBIT the timeslot period must be >= 2700 us. + * + * @param period_us The timeslot period in microseconds. + * + * @retval true If the parameter was set. + * @retval false If Gazell was enabled. + */ +bool nrf_gzll_set_timeslot_period(uint32_t period_us); + + +/** + * @brief Get function counterpart to nrf_gzll_get_timeslot_period(). + * + * @return The current timeslot period. + */ +uint32_t nrf_gzll_get_timeslot_period(void); + + +/** + * @brief Set the Device channel selection policy + * + * The policy determines the initial channel when starting a new packet. + * transmission. + * + * @param policy The channel selection policy. + * + * @arg NRF_GZLL_DEVICE_CHANNEL_SELECTION_POLICY_USE_SUCCESSFUL specifies + * that a new packet transmission always shall use the previous + * successful channel from the channel table. If Gazell is "in sync", Gazell + * will wait until this channel is being monitored by the Host before starting + * the transmission. + * + * @arg NRF_GZLL_DEVICE_CHANNEL_SELECTION_POLICY_USE_CURRENT specifies that + * Gazell shall transmit on the channel that is currently being monitored by the + * Host. This parameter is only used when Gazell is "in sync". When "out of" sync, + * Gazell will always start using the "previous successful" channel. + * + * @retval true If the parameter was set. + * @retval false If Gazell was enabled or the policy was invalid. + */ +bool nrf_gzll_set_device_channel_selection_policy(nrf_gzll_device_channel_selection_policy_t policy); + + +/** + * @brief Get function counterpart to nrf_gzll_set_device_channel_selection_policy(). + * + * @return the Device channel selection policy. + */ +nrf_gzll_device_channel_selection_policy_t nrf_gzll_get_device_channel_selection_policy(void); + + +/** + * @brief Set the number of timeslots that Gazell shall + * reside on a single channel before switching to another channel. + * + * This parameter applies in Host mode and for a Device that is + * in the "in sync" state. + * + * Since the Device and Host can not be in perfect synchronization, a + * transmission should overlap to adjacent timeslots on the Host. + * Therefore this value should be at least 2. + * + * @sa nrf_gzll_set_timeslots_per_channel_when_device_out_of_sync + * + * @param timeslots The number of timeslots to reside on + * each channel before channel switch. + * + * @retval true If the parameter was set. + * @retval false If Gazell was enabled. + */ +bool nrf_gzll_set_timeslots_per_channel(uint32_t timeslots); + + +/** + * @brief Get function counterpart to nrf_gzll_set_timeslots_per_channel(). + * + * @return The current number of timeslots. + */ +uint32_t nrf_gzll_get_timeslots_per_channel(void); + + +/** + * @brief Set the number of timeslots that a Gazell shall + * reside on a single channel before switching to another channel when + * in the "out of sync" state. + * + * This value should be set so that the Device transmits on one channel + * while the Host goes through a full channel rotation, i.e., + * channel_table_size*timeslots_per_channel. + * This ensures that the channels on the Device and Host will coincide + * at some point. + * Further increasing the value has been observed to provide better performance + * in the presence of interferers. + * + * @param timeslots The number of timeslots to reside on + * each channel before channel switch. + * + * @retval true If the parameter was set. + * @retval false If Gazell was enabled. + */ +bool nrf_gzll_set_timeslots_per_channel_when_device_out_of_sync(uint32_t timeslots); + + +/** + * @brief Get function counterpart to + * nrf_gzll_set_timeslots_per_channel_when_device_out_of_sync(). + * + * @return The current number of timeslots. + */ +uint32_t nrf_gzll_get_timeslots_per_channel_when_device_out_of_sync(void); + + +/** + * @brief Set the number of timeslots after a successful + * reception of a Device or Host packet that the Gazell Link Layer shall assume + * that the link is synchronized. A value of 0 implies that the + * link is always out of sync. + * + * @param lifetime The sync lifetime in number of timeslots. + * + * @retval true If the sync lifetime was set. + * @retval false If Gazell was enabled. + */ +bool nrf_gzll_set_sync_lifetime(uint32_t lifetime); + + +/** + * @brief Get function counterpart to nrf_gzll_set_sync_lifetime(). + * + * @return The sync lifetime measured in number of timeslots. + */ +uint32_t nrf_gzll_get_sync_lifetime(void); + + +/** + * @brief Set the maximum number of TX attempts + * that can be used for a single packet. + * + * After the maximum number of attempts have been spent without + * receiving any ACK from the Host, the transmission will be terminated + * and the nrf_gzll_device_tx_failed() callback will be called. + * + * @param max_tx_attempts The maximum number of TX attempts. + * + * @retval true If the parameter was set. + * @retval false If Gazell was enabled. + */ +bool nrf_gzll_set_max_tx_attempts(uint16_t max_tx_attempts); + + +/** + * @brief Get function counterpart to nrf_gzll_set_max_tx_attempts(). + * + * @return The current max Device TX attempts. + */ +uint16_t nrf_gzll_get_max_tx_attempts(void); + + +/** + * @brief Set the table of Radio Frequency (RF) channels. + * + * The valid channels are in the range 0 <= channel <= 125, where the + * actual centre frequency is (2400 + channel) MHz. + * The maximum channel table size is defined by + * NRF_GZLL_CONST_MAX_CHANNEL_TABLE_SIZE. + * + * @param channel_table Pointer to the channel table. + * @param size The size of the channel table. + * + * @retval true If the channel table was set. + * @retval false If Gazell was enabled, or the channel_table pointer was NULL, + * or the size was invalid. + */ +bool nrf_gzll_set_channel_table(uint8_t* channel_table, uint32_t size); + + +/** + * @brief Get the table of Radio Frequency (RF) channels. + * + * @param channel_table Pointer to copy the channel table to. + * @param size Pointer to copy the size of the channel table to. + * The value already at size must be at least the size + * of the channel table. + * + * @retval true If the channel table was copied to channel_table. + * @retval false If the channel_table pointer was NULL, + * or the size was not large enough. + */ +bool nrf_gzll_get_channel_table(uint8_t* channel_table, uint32_t* size); + + +/** + * @brief Get the current channel table size. + * + * @return The current channel table size. + */ +uint32_t nrf_gzll_get_channel_table_size(void); + + +/** + * @brief Set the radio TX power. + * + * @param tx_power TX power. + * + * @retval true If the parameter was set. + * @retval false If Gazell was enabled or the TX power was invalid. +*/ +bool nrf_gzll_set_tx_power(nrf_gzll_tx_power_t tx_power); + + +/** + * @brief Get function counterpart to nrf_gzll_set_tx_power(). + * + * @return The current TX power. + */ +nrf_gzll_tx_power_t nrf_gzll_get_tx_power(void); + + +/** + * @brief Set the radio datarate. + * + * @param data_rate Datarate. + * + * @retval true If the parameter was set. + * @retval false If Gazell was enabled or the datarate was invalid. + */ +bool nrf_gzll_set_datarate(nrf_gzll_datarate_t data_rate); + + +/** + * @brief Get function counterpart to nrf_gzll_set_datarate(). + * + * @return The current datarate. + */ +nrf_gzll_datarate_t nrf_gzll_get_datarate(void); + + +/** + * @brief Set whether start/stop of external oscillator (XOSC) shall be handled + * automatically inside Gazell or manually by the application. + * + * When controlling the XOSC manually from the application it is + * required that the XOSC is started before Gazell is enabled. + * + * When start/stop of the XOSC is handled automatically by Gazell, + * the XOSC will only be running when needed, that is when the radio + * is being used or when Gazell needs to maintain synchronization. + * + * It is required that the XOSC is started in order for the radio to be + * able to send or receive any packets. + * + * @param xosc_ctl setting for XOSC control. + * + * @retval true if the parameter was set. + * @retval false if Gazell was enabled or the xosc_ctl value was invalid. + */ +bool nrf_gzll_set_xosc_ctl(nrf_gzll_xosc_ctl_t xosc_ctl); + + +/** + * Get function counterpart for nrf_gzll_set_xosc_ctl(); + * + * @return The XOSC control setting. + */ +nrf_gzll_xosc_ctl_t nrf_gzll_get_xosc_ctl(void); + + +/** + * @brief Set Gazell to disable automatically after a certain number of timeslot ticks. + * + * @param num_ticks Number of timeslot ticks. + * + */ +void nrf_gzll_set_auto_disable(uint32_t num_ticks); + + +/** + * @brief Get the number of timeslot ticks that have occurred since + * nrf_gzll_init() was called. + * + * @return Number of timeslot ticks. + * + */ +uint32_t nrf_gzll_get_tick_count(void); + + +/** + * @brief Clear the internal timeslot tick count variable that is read + * by nrf_gzll_get_tick_count(). + * + */ +void nrf_gzll_clear_tick_count(void); + +/** @} */ + + +/******************************************************************************/ +/** @name Error handling functions + * @{ */ +/******************************************************************************/ + + +/** + * @brief Gets the Gazell error code. + * + * @return The current error code. + */ +nrf_gzll_error_code_t nrf_gzll_get_error_code(void); + + +/** + * @brief Reset the Gazell error code. + * + * The error code is reset to NRF_GZLL_ERROR_CODE_NO_ERRROR. + */ +void nrf_gzll_reset_error_code(void); + +/** @} */ + +/** @} */ +#endif diff --git a/components/properitary_rf/gzll/nrf_gzll_constants.h b/components/properitary_rf/gzll/nrf_gzll_constants.h new file mode 100644 index 0000000..e6babc4 --- /dev/null +++ b/components/properitary_rf/gzll/nrf_gzll_constants.h @@ -0,0 +1,165 @@ +/* Copyright (c) 2011 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. + * + * $LastChangedRevision: 32956 $ + */ + + +/** + * @file + * @brief Gazell Link Layer constants and default values. + * + * NOTE! Changing values here has no effect. They are only provided as a reference. + */ + +#ifndef NRF_GZLL_CONSTANTS_H__ +#define NRF_GZLL_CONSTANTS_H__ + + +/** + * @addtogroup gzll_02_api + * @{ + */ + + +/*****************************************************************************/ +/** @name Hardware resources used by Gazell */ +/*****************************************************************************/ +#define NRF_GZLL_HIGH_IRQ_PRIORITY 0 ///< Interrupt priority the Gazell timer and the radio +#define NRF_GZLL_LOW_IRQ_PRIORITY 1 ///< Interrupt priority for Gazell callback functions. + +#ifndef USE_SD_HW_RESOURCES +#define NRF_GZLL_SWI_IRQn SWI0_IRQn ///< Software interrupt # used for callback functions. +#define NRF_GZLL_SWI_IRQ_HANDLER SWI0_IRQHandler ///< Software interrupt handler used for callback functions. + +#define NRF_GZLL_TIMER NRF_TIMER2 ///< Timer to be used as flywheel timer. +#define NRF_GZLL_TIMER_PERPOWER_Msk POWER_PERPOWER_TIMER2_Msk ///< PERPOWER mask for the timer. +#define NRF_GZLL_TIMER_IRQn TIMER2_IRQn ///< Interrupt # for the timer. +#define NRF_GZLL_TIMER_IRQ_HANDLER TIMER2_IRQHandler ///< Interrupt handler for the timer. + +// In addition, Gazell uses the radio peripheral and radio interrupts. + +/* + * PPI configuration + */ +#define NRF_GZLL_PPI_EEP0 (NRF_PPI -> CH0_EEP) ///< Gazell PPI event endpoint 0 +#define NRF_GZLL_PPI_TEP0 (NRF_PPI -> CH0_TEP) ///< Gazell PPI task endpoint 0 +#define NRF_GZLL_PPI_EEP1 (NRF_PPI -> CH1_EEP) ///< Gazell PPI event endpoint 1 +#define NRF_GZLL_PPI_TEP1 (NRF_PPI -> CH1_TEP) ///< Gazell PPI task endpoint 1 +#define NRF_GZLL_PPI_EEP2 (NRF_PPI -> CH2_EEP) ///< Gazell PPI event endpoint 2 +#define NRF_GZLL_PPI_TEP2 (NRF_PPI -> CH2_TEP) ///< Gazell PPI task endpoint 2 + +#define NRF_GZLL_PPI_CHEN_MSK_0_AND_1 (0x03) ///< Channel enable/disable mask for PPI endpoint 0 and 1. +#define NRF_GZLL_PPI_CHEN_MSK_2 (0x04) ///< Channel enable/disable mask for PPI endpoint 2. + +#else + +#define NRF_GZLL_SWI_IRQn SWI1_IRQn ///< Software interrupt # used for callback functions. +#define NRF_GZLL_SWI_IRQ_HANDLER SWI1_IRQHandler ///< Software interrupt handler used for callback functions. + +#define NRF_GZLL_TIMER NRF_TIMER0 ///< Timer to be used as flywheel timer. +#define NRF_GZLL_TIMER_PERPOWER_Msk POWER_PERPOWER_TIMER0_Msk ///< PERPOWER mask for the timer. +#define NRF_GZLL_TIMER_IRQn TIMER0_IRQn ///< Interrupt # for the timer. +#define NRF_GZLL_TIMER_IRQ_HANDLER TIMER0_IRQHandler ///< Interrupt handler for the timer. + +// In addition, Gazell uses the radio peripheral and radio interrupts. + +/* + * PPI configuration + */ +#define NRF_GZLL_PPI_EEP0 (NRF_PPI -> CH8_EEP) ///< Gazell PPI event endpoint 0 +#define NRF_GZLL_PPI_TEP0 (NRF_PPI -> CH8_TEP) ///< Gazell PPI task endpoint 0 +#define NRF_GZLL_PPI_EEP1 (NRF_PPI -> CH9_EEP) ///< Gazell PPI event endpoint 1 +#define NRF_GZLL_PPI_TEP1 (NRF_PPI -> CH9_TEP) ///< Gazell PPI task endpoint 1 +#define NRF_GZLL_PPI_EEP2 (NRF_PPI -> CH10_EEP) ///< Gazell PPI event endpoint 2 +#define NRF_GZLL_PPI_TEP2 (NRF_PPI -> CH10_TEP) ///< Gazell PPI task endpoint 2 + +#define NRF_GZLL_PPI_CHEN_MSK_0_AND_1 (0x300) ///< Channel enable/disable mask for PPI endpoint 0 and 1. +#define NRF_GZLL_PPI_CHEN_MSK_2 (0x400) ///< Channel enable/disable mask for PPI endpoint 2. + +#endif + +#define NRF_GZLL_CONST_PIPE_COUNT 8 ///< Number of TX pipes (at least one for each Device-Host pairs). +#define NRF_GZLL_CONST_FIFO_LENGTH 3 ///< Maximum number of packets allowed in a TX or RX FIFO. +#define NRF_GZLL_CONST_MAX_TOTAL_PACKETS 6 ///< Maximum number of packets available for reservation at any one time. +#define NRF_GZLL_CONST_MAX_PAYLOAD_LENGTH 32 ///< Maximum allowed payload length in bytes. +#define NRF_GZLL_CONST_CALLBACK_QUEUE_LENGTH 10 ///< Maximum number of notifications allowed in the callback queue. +/** @} */ + + + +/*****************************************************************************/ +/** @name Constant pipe and FIFO configuration */ +/*****************************************************************************/ +#define NRF_GZLL_CONST_PIPE_COUNT 8 ///< Number of TX pipes (at least one for each Device-Host pairs). +#define NRF_GZLL_CONST_FIFO_LENGTH 3 ///< Maximum number of packets allowed in a TX or RX FIFO. +#define NRF_GZLL_CONST_MAX_TOTAL_PACKETS 6 ///< Maximum number of packets available for reservation at any one time. +#define NRF_GZLL_CONST_MAX_PAYLOAD_LENGTH 32 ///< Maximum allowed payload length in bytes. +#define NRF_GZLL_CONST_CALLBACK_QUEUE_LENGTH 10 ///< Maximum number of notifications allowed in the callback queue. +/** @} */ + + + +/*****************************************************************************/ +/** @name Default radio configuration */ +/*****************************************************************************/ +#define NRF_GZLL_DEFAULT_TX_POWER NRF_GZLL_TX_POWER_0_DBM ///< Default TX power. +#define NRF_GZLL_DEFAULT_DATARATE NRF_GZLL_DATARATE_2MBIT ///< Default data rate. +#define NRF_GZLL_DEFAULT_CHANNEL_TABLE {4, 25, 42, 63, 77} ///< Default channel table. +#define NRF_GZLL_DEFAULT_CHANNEL_TABLE_SIZE 5 ///< Default channel table size. +#define NRF_GZLL_CONST_MAX_CHANNEL_TABLE_SIZE 16 ///< Maximum channel table size allowed by Gazell. +/** @} */ + + +/*****************************************************************************/ +/** @name Default Address configuration */ +/*****************************************************************************/ +/* +Corresponds to Legacy nRFgo SDK Gazell config: +#define GZLL_DEFAULT_ADDRESS_PIPE0 {0x01, 0x04, 0x07, 0x0A, 0x0D} // {1, 4, 7, 10, 13} +#define GZLL_DEFAULT_ADDRESS_PIPE1 {0x02, 0x05, 0x08, 0x0B, 0x0E} // {2, 5, 8, 11, 14} +#define GZLL_DEFAULT_ADDRESS_PIPE2 3 +#define GZLL_DEFAULT_ADDRESS_PIPE3 4 +#define GZLL_DEFAULT_ADDRESS_PIPE4 5 +#define GZLL_DEFAULT_ADDRESS_PIPE5 6 +*/ +#define NRF_GZLL_DEFAULT_FULL_ADDRESS_PIPE0 {0x01, 0x04, 0x07, 0x0A, 0x0D} ///< Corresponding legacy Gazell pipe 0 address. +#define NRF_GZLL_DEFAULT_BASE_ADDRESS_0 0x0D0A0704 ///< Default base address 0. +#define NRF_GZLL_DEFAULT_BASE_ADDRESS_1 0x0E0B0805 ///< Default base address 1. +#define NRF_GZLL_DEFAULT_PREFIX_BYTE_0 1 ///< Default prefix address pipe 0. +#define NRF_GZLL_DEFAULT_PREFIX_BYTE_1 2 ///< Default prefix address pipe 1. +#define NRF_GZLL_DEFAULT_PREFIX_BYTE_2 3 ///< Default prefix address pipe 2. +#define NRF_GZLL_DEFAULT_PREFIX_BYTE_3 4 ///< Default prefix address pipe 3. +#define NRF_GZLL_DEFAULT_PREFIX_BYTE_4 5 ///< Default prefix address pipe 4. +#define NRF_GZLL_DEFAULT_PREFIX_BYTE_5 6 ///< Default prefix address pipe 5. +#define NRF_GZLL_DEFAULT_PREFIX_BYTE_6 7 ///< Default prefix address pipe 6. +#define NRF_GZLL_DEFAULT_PREFIX_BYTE_7 8 ///< Default prefix address pipe 7. +#define NRF_GZLL_DEFAULT_BASE_ADDRESS_LENGTH NRF_GZLL_BASE_ADDRESS_LENGTH_4B ///< Default on-air base address length. + +#define NRF_GZLL_DEFAULT_RX_PIPES_ENABLED 0x000000FF ///< Enabled Rx pipes. See nrf_gzll_set_rx_pipes_enabled(). + +/** @} */ + + +/*****************************************************************************/ +/** @name Default timeslot and synchronization configuration */ +/*****************************************************************************/ +#define NRF_GZLL_DEFAULT_TIMESLOT_PERIOD 600 ///< Default timeslot period. +#define NRF_GZLL_DEFAULT_TIMESLOTS_PER_CHANNEL 2 ///< Timeslots use by the Host and by the Device when communication is in sync. +#define NRF_GZLL_DEFAULT_TIMESLOTS_PER_CHANNEL_WHEN_DEVICE_OUT_OF_SYNC 15 ///< Timeslots use by the Device before communication is in sync. +#define NRF_GZLL_DEFAULT_SYNC_LIFETIME (3*NRF_GZLL_DEFAULT_CHANNEL_TABLE_SIZE*NRF_GZLL_DEFAULT_TIMESLOTS_PER_CHANNEL) ///< Number of timeslots to keep the timer running so that communication remains synchronized. +#define NRF_GZLL_DEFAULT_DEVICE_CHANNEL_SELECTION_POLICY NRF_GZLL_DEVICE_CHANNEL_SELECTION_POLICY_USE_SUCCESSFUL ///< Default channel Gazell Device channel selection policy +#define NRF_GZLL_DEFAULT_MAX_TX_ATTEMPTS 0 ///< Default maximum TX attempts for each packet. A value of zero implies maximum +#define NRF_GZLL_DEFAULT_XOSC_CTL NRF_GZLL_XOSC_CTL_AUTO ///< Deafult setting for controlling the XOSC +/** @} */ + + +/** @} */ +#endif diff --git a/components/properitary_rf/gzll/nrf_gzll_resources.h b/components/properitary_rf/gzll/nrf_gzll_resources.h new file mode 100644 index 0000000..ee076d8 --- /dev/null +++ b/components/properitary_rf/gzll/nrf_gzll_resources.h @@ -0,0 +1,30 @@ +/* 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. + * + */ + +#ifndef NRF_GZLL_RESOURCES_H__ +#define NRF_GZLL_RESOURCES_H__ + +#include + +#ifndef GAZELL_ALTERNATIVE_RESOURCES + #define GZLL_PPI_CHANNELS_USED 0x00000007uL /**< PPI channels utilized by Gazell (not available to th spplication). */ + #define GZLL_TIMERS_USED 0x00000004uL /**< Timers used by Gazell. */ + #define GZLL_SWI_USED 0x00000001uL /**< Software interrupts used by Gazell */ +#else + #define GZLL_PPI_CHANNELS_USED 0x00000700uL /**< PPI channels utilized by Gazell (not available to th spplication). */ + #define GZLL_TIMERS_USED 0x00000001uL /**< Timers used by Gazell. */ + #define GZLL_SWI_USED 0x00000002uL /**< Software interrupts used by Gazell */ +#endif + + + +#endif /* NRF_GZLL_RESOURCES_H__ */ diff --git a/components/properitary_rf/gzll/nrf_gzp.c b/components/properitary_rf/gzll/nrf_gzp.c new file mode 100644 index 0000000..6ab5f59 --- /dev/null +++ b/components/properitary_rf/gzll/nrf_gzp.c @@ -0,0 +1,338 @@ +/* Copyright (c) 2009 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is confidential 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 + * WARRENTY of ANY KIND is provided. This heading must NOT be removed from + * the file. + * + * $LastChangedRevision: 25890 $ + */ + + +/** + * @file + * @brief Implementation of Gazell Pairing Library (gzp), Common functions. + * @defgroup gzp_source_common Gazell Pairing common functions implementation + * @{ + * @ingroup gzp_04_source + */ + + +#include "nrf_gzp.h" +#include "nrf_gzll.h" +#include "nrf_ecb.h" +#include + + +#define SOURCE_FILE NRF_SOURCE_FILE_GZP ///< File identifer for asserts. + + +/******************************************************************************/ +/** @name Global variables + * @{ */ +/******************************************************************************/ + +/** + * Constant holding base address part of the pairing address. + */ +static const uint8_t pairing_base_address[4] = { GZP_ADDRESS }; + +/** + * Constant holding prefix byte of the pairing address. + */ +static const uint8_t pairing_address_prefix_byte = 0; + +/** + * Constant holding pre-defined "validation ID". + */ +static const uint8_t gzp_validation_id[GZP_VALIDATION_ID_LENGTH] = GZP_VALIDATION_ID; + +/** + * Constant holding pre-defined "secret key". + */ +static const uint8_t gzp_secret_key[16] = GZP_SECRET_KEY; + +/** + * Variable used for AES key selection + */ +static gzp_key_select_t gzp_key_select; + + +/** @} */ + + +/******************************************************************************/ +/** @name Misc. external variables. + * @{ */ +/******************************************************************************/ +static uint8_t gzp_session_token[GZP_SESSION_TOKEN_LENGTH]; +static uint8_t gzp_dyn_key[GZP_DYN_KEY_LENGTH]; + +/** @} */ + +/******************************************************************************/ +/** @name Implementation common internal GZP functions + * @{ */ +/******************************************************************************/ +bool gzp_update_radio_params(const uint8_t* system_address) +{ + uint8_t i; + uint8_t channels[NRF_GZLL_CONST_MAX_CHANNEL_TABLE_SIZE]; + uint32_t channel_table_size; + uint32_t pairing_base_address_32, system_address_32; + bool update_ok = true; + bool gzll_enabled_state; + + gzll_enabled_state = nrf_gzll_is_enabled(); + + // Configure "global" pairing address + pairing_base_address_32 = (pairing_base_address[0]) + + ((uint32_t)pairing_base_address[1] << 8) + + ((uint32_t)pairing_base_address[2] << 16) + + ((uint32_t)pairing_base_address[3] << 24) ; + if(system_address != NULL) + { + system_address_32 = (system_address[0]) + + ((uint32_t)system_address[1] << 8) + + ((uint32_t)system_address[2] << 16) + + ((uint32_t)system_address[3] << 24) ; + } + else + { + return false; + } + + nrf_gzp_disable_gzll(); + update_ok = update_ok && nrf_gzll_set_base_address_0(pairing_base_address_32); + update_ok = update_ok && nrf_gzll_set_address_prefix_byte(GZP_PAIRING_PIPE, pairing_address_prefix_byte); + update_ok = update_ok && nrf_gzll_set_base_address_1(system_address_32); + + // Configure address for pipe 1 - 5. Address byte set to equal pipe number. + for(i = 1; i < NRF_GZLL_CONST_PIPE_COUNT; i++) + { + update_ok = update_ok && nrf_gzll_set_address_prefix_byte(i,i); + } + + channel_table_size = nrf_gzll_get_channel_table_size(); + gzp_generate_channels(&channels[0], system_address, channel_table_size); + + // Write generated channel subset to Gazell Link Layer + update_ok = update_ok && nrf_gzll_set_channel_table(&channels[0], channel_table_size); + if(gzll_enabled_state) + { + update_ok = update_ok && nrf_gzll_enable(); + } + return update_ok; +} + +void gzp_generate_channels(uint8_t* ch_dst, const uint8_t* system_address, uint8_t channel_tab_size) +{ + uint8_t binsize, spacing, i; + + binsize = (GZP_CHANNEL_MAX - GZP_CHANNEL_MIN) / channel_tab_size; + + ch_dst[0] = GZP_CHANNEL_LOW; + ch_dst[channel_tab_size - 1] = GZP_CHANNEL_HIGH; + + if(system_address != NULL) + { + for(i = 1; i < (channel_tab_size - 1); i++) + { + ch_dst[i] = (binsize * i) + (system_address[i % 4] % binsize); + } + } + + // If channels are too close, shift them to better positions + for(i = 1; i < channel_tab_size; i++) + { + spacing = (ch_dst[i] - ch_dst[i - 1]); + if(spacing < GZP_CHANNEL_SPACING_MIN) + { + ch_dst[i] += (GZP_CHANNEL_SPACING_MIN - spacing); + } + } +} + +__INLINE void nrf_gzp_disable_gzll(void) +{ + if(nrf_gzll_is_enabled()) + { + nrf_gzll_disable(); + __WFI(); + while(nrf_gzll_is_enabled()) + { + } + } +} + +#ifndef GZP_CRYPT_DISABLE + +void gzp_xor_cipher(uint8_t* dst, const uint8_t* src, const uint8_t* pad, uint8_t length) +{ + uint8_t i; + + for(i = 0; i < length; i++) + { + *dst = *src ^ *pad; + dst++; + src++; + pad++; + } +} + +bool gzp_validate_id(const uint8_t* id) +{ + return (memcmp(id, (void*)gzp_validation_id, GZP_VALIDATION_ID_LENGTH) == 0); +} + +void gzp_add_validation_id(uint8_t* dst) +{ + memcpy(dst, (void const*)gzp_validation_id, GZP_VALIDATION_ID_LENGTH); +} + +void gzp_crypt_set_session_token(const uint8_t * token) +{ + memcpy(gzp_session_token, (void const*)token, GZP_SESSION_TOKEN_LENGTH); +} + +void gzp_crypt_set_dyn_key(const uint8_t* key) +{ + memcpy(gzp_dyn_key, (void const*)key, GZP_DYN_KEY_LENGTH); +} + +void gzp_crypt_get_session_token(uint8_t * dst_token) +{ + memcpy(dst_token, (void const*)gzp_session_token, GZP_SESSION_TOKEN_LENGTH); +} + +void gzp_crypt_get_dyn_key(uint8_t* dst_key) +{ + memcpy(dst_key, (void const*)gzp_dyn_key, GZP_DYN_KEY_LENGTH); +} + +void gzp_crypt_select_key(gzp_key_select_t key_select) +{ + gzp_key_select = key_select; +} + +void gzp_crypt(uint8_t* dst, const uint8_t* src, uint8_t length) +{ + uint8_t i; + uint8_t key[16]; + uint8_t iv[16]; + + // Build AES key based on "gzp_key_select" + + switch(gzp_key_select) + { + case GZP_ID_EXCHANGE: + memcpy(key, (void const*)gzp_secret_key, 16); + break; + case GZP_KEY_EXCHANGE: + memcpy(key, (void const*)gzp_secret_key, 16); + gzp_get_host_id(key); + break; + case GZP_DATA_EXCHANGE: + memcpy(key, (void const*)gzp_secret_key, 16); + memcpy(key, (void const*)gzp_dyn_key, GZP_DYN_KEY_LENGTH); + break; + default: + return; + } + + // Build init vector from "gzp_session_token" + for(i = 0; i < 16; i++) + { + if(i < GZP_SESSION_TOKEN_LENGTH) + { + iv[i] = gzp_session_token[i]; + } + else + { + iv[i] = 0; + } + } + + // Set up hal_aes using new key and init vector + (void)nrf_ecb_init(); + nrf_ecb_set_key(key); + //hal_aes_setup(false, ECB, key, NULL); // Note, here we skip the IV as we use ECB mode + + // Encrypt IV using ECB mode + (void)nrf_ecb_crypt(iv, iv); + + // Encrypt data by XOR'ing with AES output + gzp_xor_cipher(dst, src, iv, length); + +} + +void gzp_random_numbers_generate(uint8_t * dst, uint8_t n) +{ + uint8_t i; + + NRF_RNG->EVENTS_VALRDY=0; + NRF_RNG->TASKS_START = 1; + for(i = 0; i < n; i++) + { + while(NRF_RNG->EVENTS_VALRDY==0) + {} + dst[i] = (uint8_t)NRF_RNG->VALUE; + NRF_RNG->EVENTS_VALRDY=0; + } + NRF_RNG->TASKS_STOP = 1; +} + + +/******************************************************************************/ +/** @name Implementation of nRF51 specific GZP functions + * @{ */ +/******************************************************************************/ + +/** +* @brief Function for setting the Primask variable. Only necessary if ARMCC +* compiler skips __set_PRIMASK at high optimization levels. +* +* @param primask The primask value. 1 to disable interrupts, 0 otherwise. +*/ +static void nrf_gzp_set_primask(uint32_t primask) +{ + #if defined(__CC_ARM) + //lint -save -e10 -e618 -e438 -e550 -e526 -e628 -e526 + volatile register uint32_t __regPriMask __ASM("primask"); + __regPriMask = (primask); + #else + __set_PRIMASK(primask); + #endif + //lint -restore +} + +void nrf_gzp_flush_rx_fifo(uint32_t pipe) +{ + static uint8_t dummy_packet[NRF_GZLL_CONST_MAX_PAYLOAD_LENGTH]; + uint32_t length; + + nrf_gzp_set_primask(1); + while(nrf_gzll_get_rx_fifo_packet_count(pipe) >0) + { + length = NRF_GZLL_CONST_MAX_PAYLOAD_LENGTH; + (void)nrf_gzll_fetch_packet_from_rx_fifo(pipe,dummy_packet,&length); + } + nrf_gzp_set_primask(0); +} +/** @} */ + + + +/******************************************************************************/ +/** @name Implementation of debug functions + * @{ */ +/******************************************************************************/ + + +/** @} */ + +/** @} */ +#endif diff --git a/components/properitary_rf/gzll/nrf_gzp.h b/components/properitary_rf/gzll/nrf_gzp.h new file mode 100644 index 0000000..a771cda --- /dev/null +++ b/components/properitary_rf/gzll/nrf_gzp.h @@ -0,0 +1,630 @@ +/* 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. +* +* $LastChangedRevision: 25678 $ +*/ + +/** + * @file + * @brief Gazell Pairing API + */ + +#ifndef __GZP_H +#define __GZP_H + +#include "nrf.h" +#include "nrf_gzp_config.h" +#include + + +/** +* @defgroup gzp_02_api Application Programming Interface (API) +* @{ +* @ingroup modules_02_gzp +* @brief Gazell Pairing API. +*/ + + +/******************************************************************************/ +/** @name Pairing configuration defines + * @{ */ +/******************************************************************************/ + + +#define GZP_PAIRING_PIPE 0 ///< Pipe reserved for initial pairing communication. +#define GZP_DATA_PIPE 1 ///< Pipe reserved for GZP encrypted data communication (one pipe only). +#define GZP_TX_RX_TRANS_DELAY 10 ///< Time to wait between request and fetch packets in RX_PERIODS (2 timeslot periods) +#define GZP_SYSTEM_ADDRESS_WIDTH 4 ///< Must equal Gazell base address length. + + +#define GZP_VALIDATION_ID {0x32, 0x53, 0x66} ///< Validation ID. Required to be shared by Host and Device. Not a secret. +#define GZP_VALIDATION_ID_LENGTH 3 ///< Validation ID length in bytes. +#define GZP_HOST_ID_LENGTH 5 ///< Host ID length in bytes. +#define GZP_SESSION_TOKEN_LENGTH GZP_HOST_ID_LENGTH ///< Session token length in bytes. +#define GZP_DYN_KEY_LENGTH (16 - GZP_VALIDATION_ID_LENGTH) ///< Dynamic key length in bytes. + +#define GZP_HOST_RX_POWER_THRESHOLD -64 ///< RSSI threshold for when signal strength in RX packet power is high enough. + +/** @} */ + + +/******************************************************************************/ +/** @name Device -> Host packet definitions + * @{ */ +/******************************************************************************/ + +#define GZP_CMD_HOST_ADDRESS_REQ_PAYLOAD_LENGTH 1 ///< "Host address request" packet, payload length + +#define GZP_CMD_HOST_ADDRESS_FETCH_PAYLOAD_LENGTH 1 ///< "Host address fetch" packet, payload length + +#define GZP_CMD_HOST_ID_REQ_SESSION_TOKEN 1 ///< "Host ID request" packet, session token position +#define GZP_CMD_HOST_ID_REQ_PAYLOAD_LENGTH (GZP_CMD_HOST_ID_REQ_SESSION_TOKEN + GZP_SESSION_TOKEN_LENGTH) ///< "Host ID request" payload length + +#if (GZP_CMD_HOST_ID_REQ_PAYLOAD_LENGTH > 17) +#error GZP_SESSION_TOKEN_LENGTH too long. +#endif + + +#define GZP_CMD_HOST_ID_FETCH_VALIDATION_ID 1 ///< "Host ID fetch" packet +#define GZP_CMD_HOST_ID_FETCH_PAYLOAD_LENGTH (GZP_CMD_HOST_ID_FETCH_VALIDATION_ID + GZP_VALIDATION_ID_LENGTH) ///< "Host ID fetch" payload length + +#if (GZP_CMD_HOST_ID_FETCH_PAYLOAD_LENGTH > 17) +#error GZP_VALIDATION_ID_LENGTH set too long. +#endif + +#define GZP_CMD_KEY_UPDATE_PREPARE_PAYLOAD_LENGTH 1 ///< "Key update prepare" payload length + +#define GZP_CMD_KEY_UPDATE_VALIDATION_ID 1 ///< "Key update" packet, validation ID position +#define GZP_CMD_KEY_UPDATE_NEW_KEY (GZP_CMD_KEY_UPDATE_VALIDATION_ID + GZP_VALIDATION_ID_LENGTH) ///< "Key update" packet, new key position +#define GZP_CMD_KEY_UPDATE_PAYLOAD_LENGTH (GZP_CMD_KEY_UPDATE_NEW_KEY + GZP_DYN_KEY_LENGTH) ///< "Key update" packet, payload length + +#if (GZP_CMD_KEY_UPDATE_PAYLOAD_LENGTH > 17) +#error Sum (GZP_VALIDATION_ID_LENGTH + GZP_DYN_KEY_LENGTH) too high. +#endif + + +#define GZP_CMD_ENCRYPTED_USER_DATA_VALIDATION_ID 1 ///< "Encrypted user data" packet, validation ID position +#define GZP_CMD_ENCRYPTED_USER_DATA_PAYLOAD ((GZP_CMD_ENCRYPTED_USER_DATA_VALIDATION_ID + GZP_VALIDATION_ID_LENGTH)) ///< "Encrypted user data" packet, user data position +#define GZP_ENCRYPTED_USER_DATA_PACKET_OVERHEAD ( GZP_CMD_ENCRYPTED_USER_DATA_VALIDATION_ID + GZP_VALIDATION_ID_LENGTH) ///< "Encrypted user data" packet, packet overhead length +#define GZP_ENCRYPTED_USER_DATA_MAX_LENGTH (17 - GZP_ENCRYPTED_USER_DATA_PACKET_OVERHEAD) ///< "Encrypted user data" packet, max payload length + +#if(GZP_MAX_FW_PAYLOAD_LENGTH < 17) + #error GZP_MAX_FW_PAYLOAD_LENGTH must be greater or equal to 17. +#endif + +#define GZP_CMD_FETCH_RESP_PAYLOAD_LENGTH 1 ///< General "fetch response" packet, payload_length + +/** @} */ + + +/******************************************************************************/ +/** @name Host -> Device packet definitions + * @{ */ +/******************************************************************************/ + + +#define GZP_CMD_HOST_ADDRESS_RESP_ADDRESS 1 ///< "Host address fetch" response packet, address position +#define GZP_CMD_HOST_ADDRESS_RESP_PAYLOAD_LENGTH (GZP_CMD_HOST_ADDRESS_RESP_ADDRESS + GZP_SYSTEM_ADDRESS_WIDTH) ///< ///< "Host address fetch" response packet, payload length + +#if(GZP_MAX_ACK_PAYLOAD_LENGTH < GZP_CMD_HOST_ADDRESS_RESP_PAYLOAD_LENGTH) + #error GZP_MAX_ACK_PAYLOAD_LENGTH must be greater or equal to GZP_CMD_HOST_ADDRESS_RESP_PAYLOAD_LENGTH. +#endif + + +#define GZP_CMD_HOST_ID_FETCH_RESP_VALIDATION_ID 1 ///< "Host ID fetch" response packet, validation ID position +#define GZP_CMD_HOST_ID_FETCH_RESP_STATUS (GZP_CMD_HOST_ID_FETCH_RESP_VALIDATION_ID + GZP_VALIDATION_ID_LENGTH) ///< "Host ID fetch" response packet, status position +#define GZP_CMD_HOST_ID_FETCH_RESP_HOST_ID (GZP_CMD_HOST_ID_FETCH_RESP_STATUS + 1) ///< "Host ID fetch" response packet, Host ID position +#define GZP_CMD_HOST_ID_FETCH_RESP_PAYLOAD_LENGTH (GZP_CMD_HOST_ID_FETCH_RESP_HOST_ID + GZP_HOST_ID_LENGTH) ///< "Host ID fetch" response packet, payload length + +#if(GZP_MAX_ACK_PAYLOAD_LENGTH < GZP_CMD_HOST_ID_FETCH_RESP_PAYLOAD_LENGTH) + #error GZP_MAX_ACK_PAYLOAD_LENGTH must be greater or equal to GZP_CMD_HOST_ID_FETCH_RESP_PAYLOAD_LENGTH. +#endif + + +#define GZP_CMD_KEY_UPDATE_PREPARE_RESP_SESSION_TOKEN 1 ///< "Key update prepare" response packet, session token position +#define GZP_CMD_KEY_UPDATE_PREPARE_RESP_PAYLOAD_LENGTH (GZP_CMD_KEY_UPDATE_PREPARE_RESP_SESSION_TOKEN + GZP_SESSION_TOKEN_LENGTH) ///< "Key update prepare" response packet, payload length position + +#if(GZP_MAX_ACK_PAYLOAD_LENGTH < GZP_CMD_KEY_UPDATE_PREPARE_RESP_PAYLOAD_LENGTH) + #error GZP_MAX_ACK_PAYLOAD_LENGTH must be greater or equal to GZP_CMD_KEY_UPDATE_PREPARE_RESP_PAYLOAD_LENGTH. +#endif + + +#define GZP_CMD_ENCRYPTED_USER_DATA_RESP_SESSION_TOKEN 1 ///< "Encrypted user data" response packet, session token position +#define GZP_CMD_ENCRYPTED_USER_DATA_RESP_VALIDATION_ID (GZP_CMD_ENCRYPTED_USER_DATA_RESP_SESSION_TOKEN + GZP_SESSION_TOKEN_LENGTH) ///< "Encrypted user data" response packet, validation ID position +#define GZP_CMD_ENCRYPTED_USER_DATA_RESP_PAYLOAD_LENGTH (GZP_CMD_ENCRYPTED_USER_DATA_RESP_VALIDATION_ID + GZP_VALIDATION_ID_LENGTH) ///< "Encrypted user data" response packet, payload length position + +#if(GZP_MAX_ACK_PAYLOAD_LENGTH < GZP_CMD_ENCRYPTED_USER_DATA_RESP_PAYLOAD_LENGTH) + #error GZP_MAX_ACK_PAYLOAD_LENGTH must be greater or equal to GZP_CMD_ENCRYPTED_USER_DATA_RESP_PAYLOAD_LENGTH. +#endif + +#if(GZP_VALIDATION_ID_LENGTH > GZP_HOST_ID_LENGTH) + #error GZP_HOST_ID_LENGTH should be greater or equal to GZP_VALIDATION_ID_LENGTH. +#endif + +#if(GZP_SESSION_TOKEN_LENGTH != GZP_HOST_ID_LENGTH) + #error GZP_SESSION_TOKEN_LENGTH must equal GZP_HOST_ID_LENGTH. +#endif + +#ifdef GZLL_CRYPT_ENABLE + #error Gazell encryption can not be enabled when using the Gazell pairing library. \ + GZLL_CRYPT_ENABLE must be undefined. +#endif + +/** @} */ + + +/******************************************************************************/ +/** @name Typedefs + * @{ */ +/******************************************************************************/ + + +/** + * @enum gzp_key_select_t + * @brief Enumerator used for selecting the key to be used for encryption. + */ +typedef enum +{ + GZP_ID_EXCHANGE, ///< "Secret key" only + GZP_KEY_EXCHANGE, ///< "Secret key" and "Host ID" + GZP_DATA_EXCHANGE ///< "Dynamic key" and "Host ID" +} gzp_key_select_t; + + +/** + * @enum gzp_cmd_t + * @brief Enumerator used in the first payload byte of each packet to + * indicate the packet type. + */ +typedef enum +{ + GZP_CMD_HOST_ADDRESS_REQ = 0, ///< Host address request + GZP_CMD_HOST_ADDRESS_FETCH, ///< Host address fetch + GZP_CMD_HOST_ID_REQ, ///< Host ID request + GZP_CMD_HOST_ID_FETCH, ///< Host ID fetch request + GZP_CMD_KEY_UPDATE_PREPARE, ///< Key update prepare + GZP_CMD_KEY_UPDATE, ///< Key update + GZP_CMD_ENCRYPTED_USER_DATA, ///< Encrypted user data + GZP_CMD_FETCH_RESP, ///< Fetch response + GZP_CMD_HOST_ADDRESS_RESP, ///< Host address response + GZP_CMD_HOST_ID_FETCH_RESP, ///< Host ID fetch response + GZP_CMD_KEY_UPDATE_PREPARE_RESP, ///< Key update prepare + GZP_CMD_ENCRYPTED_USER_DATA_RESP, ///< Encrypted user data response +} gzp_cmd_t; + + +/** + * @enum gzp_id_req_res_t + * @brief Enumerator used to identify the state of the current + * Host ID request. + */ +typedef enum +{ + GZP_ID_RESP_PENDING, ///< ID response pending + GZP_ID_RESP_GRANTED, ///< ID response granted + GZP_ID_RESP_REJECTED, ///< ID response rejected + GZP_ID_RESP_FAILED, ///< ID response failed + GZP_ID_RESP_NO_REQUEST ///< Default value. No ID request has yet been received. +} gzp_id_req_res_t; + + +/** @} */ + + +/******************************************************************************/ +/** @name Misc. function prototypes + * @{ */ +/******************************************************************************/ + +/** + * Set the session token. + * + * @param token Pointer to the session token to set. + */ +void gzp_crypt_set_session_token(const uint8_t *token); + + +/** + * Get the session token. + * + * @param dst_token Pointer to write the session token. + */ +void gzp_crypt_get_session_token(uint8_t *dst_token); + + +/** + * Set the dynamic key. + * + * @param dyn_key Pointer to the dynamic key to set. + */ +void gzp_crypt_set_dyn_key(const uint8_t* dyn_key); + + +/** + * Get the dynamic key. + * + * @param dst_key Pointer to write the dynamic key too. + */ +void gzp_crypt_get_dyn_key(uint8_t *dst_key); + + +/** + * Set the Host ID. + * + * @param src Pointer to the Host ID to set. + */ +static void gzp_set_host_id(const uint8_t* src); + + +/** + * Get the Host ID. + * + * @param dst Pointer to write the Host ID to. + */ +void gzp_get_host_id(uint8_t *dst); + + +/** + * Selecting what key-set that should be used when encrypting data + * using gzp_crypt(). + * + * @param key_select Key-set to use. + */ +void gzp_crypt_select_key(gzp_key_select_t key_select); + + +/** + * Encypt / decrypt data. + * + * The current "session token" will be used as initialization vector (IV). + * The AES key to be used is selected by gzp_crypt_select_key(). + * AES is a symmetric encryption scheme, this function can be used + * to perform both encryption and decryption. + * + * @param dst Destination to write encrypted data to. Should be 16 bytes long. + * @param src Source data to encrypt. + * @param length Length in bytes of src. + */ +void gzp_crypt(uint8_t* dst, const uint8_t* src, uint8_t length); + + +/** + * Compare the *src_id with a pre-defined validation ID. + * + * @param src_id Pointer to the source validation ID to compare to. + * + * @retval true If *src_id equals the pre-defined ID. + * @retval false If *src_id does not equal the pre-defined ID. + */ +bool gzp_validate_id(const uint8_t *src_id); + + +/** + * Add the pre-defined validation ID to dst_id. + * GZP_VALIDATION_ID_LENGTH bytes will be added. + * + * @param dst_id Pointer to add the GZP validation ID to. + */ +void gzp_add_validation_id(uint8_t *dst_id); + + +/** + * Generate random bytes. + * + * @param dst Destination to write the random bytes to. + * @param n Number of bytes to generate. + */ +void gzp_random_numbers_generate(uint8_t *dst, uint8_t n); + + +/** + * Update the channel table and the system address. + * + * The channel table is updated to pseudo-random set generated using the + * system address. The channel table still includes GZP_CHANNEL_MAX and + * GZP_CHANNEL_MIN. + * The system address is applied to base address 1 and therefore applies + * to pipes 1-7. + * + * @param system_address Pointer to the system_address to set. + * + * @retval true If theradio parameters were updated successfully. + * @retval false If there was an error updated the radio parameters. + */ +bool gzp_update_radio_params(const uint8_t *system_address); + + +/** + * Generate a set of channels from a 4 byte address. + * + * @param ch_dst Destination to write the channel set to. The channel set + * includes GZP_CHANNEL_MAX and GZP_CHANNEL_MIN. + * @param address Four byte address to generate the channel set from. + * @param channel_set_size Size of the channel set to generate. + */ +void gzp_generate_channels(uint8_t *ch_dst, const uint8_t * address, uint8_t channel_set_size); + + +/** + * Perform an XOR on two byte strings. + * + * @param dst Destination to write the result to. Should be of size length. + * @param src + * @param pad + * @param length Number of bytes to perform the XOR operation on. + */ +void gzp_xor_cipher(uint8_t* dst, const uint8_t* src, const uint8_t* pad, uint8_t length); + + +/******************************************************************************/ +/** @name Common Device and Host functions + * @{ */ +/******************************************************************************/ + + +/** + * Initialization function. This function initializes the Gazell Pairing Library. + + * This function must be called before any of the other Gazell Pairing Library functions are + * used and must be called @b after gzll_init() is called. + * + */ +void gzp_init(void); + +/** + * Function for erasing all pairing data. + */ +void gzp_erase_pairing_data(void); + +/** + * Disable Gazell and sleep while waiting for nrf_gzll_disabled callback. + */ +void nrf_gzp_disable_gzll(void); + +/** + Function for cancelling an ongoing (pending) "Host ID request". + + After calling this function the "Host ID request" status will go to + "ID request Idle". +*/ +void gzp_id_req_cancel(void); + +/** + * Flush the GZLL RX FIFO for a specific pipe while GZLL is disabled. + * + * @param pipe Pipe. + */ +void nrf_gzp_flush_rx_fifo(uint32_t pipe); + +/** +@name Device functions +*/ + +/** + * Check whether current GZP packet transaction has completed. + * + * @retval true + * @retval false + */ +bool nrf_gzp_tx_complete(void); + +/** + * Check whether previous GZP packet transaction was successful. + * + * @retval true + * @retval false + */ +bool nrf_gzp_tx_success(void); + +/** + * Reset tx_complete status. + */ +void nrf_gzp_reset_tx_complete(void); + +/** + * Reset tx_success status. + */ +void nrf_gzp_reset_tx_success(void); + +/** +* Function to check whether a Device has existing pairing data, implying that it is +* paired to a Host. +* +* @retval -2 The pairing database is empty. +* @retval -1 The device has a system address but no Host ID. +* @retval >=0 The device has a system address and HostID at this index value in the database. +*/ +int8_t gzp_get_pairing_status(void); + +/** + Function for sending a "system address" request to a Host. + + When calling this function the Device will attempt acquiring the "system address" from + any Host within close proximity. + + If a host is located within close proximity and pairing is enabled in the Host, + a "system address" will be sent in return to the Device. + + The new "system address" will apply immediately in the Device, and the new "system address" + will be stored in non volatile (NV) memory. + + Note. Using OTP devices limits the number of times a new "system address" can + be stored in NV memory. + + @return + + @retval true if new "system address" was received from a Host. + @retval false if no "system address" was received from a Host. +*/ +bool gzp_address_req_send(void); + +/** + Function for sending a "Host ID request" to a Host. + + The "Host ID" is needed to be able to send encrypted data using + gzp_crypt_data_send(). + + The request will be sent using the "system address" previously received using + gzp_address_req_send(). + + It is not required that the Host is within close proximity in order to acquire the + "Host ID". + + The new "Host ID" will apply immediately for the Device, and the new "Host ID" + will be stored in non volatile (NV) memory. + + Note. Using OTP devices limits the number of times a new "Host ID" can + be stored in NV memory. + + @return + + @retval GZP_ID_RESP_PENDING if a "Host ID request" has been sent to the Host, but the Host application has + not yet decided whether to Grant or Reject the "ID request". + @retval GZP_ID_RESP_GRANTED if the "Host ID" has been received from the Host. The received "Host ID" will be stored + in non volatile memory. + @retval GZP_ID_RESP_REJECTED if the Host application has rejected the "Host ID request". + @retval GZP_ID_RESP_FAILED if failing to send a request or receive a response from the Host. +*/ +gzp_id_req_res_t gzp_id_req_send(void); + +/** + Function for sending encrypted user data to the Host. + + Before any data can be sent the Device must acquire both the Host's + "system address" by using gzp_address_req_send() and the "Host ID" by using + gzp_id_req_send(). + + @param *src is a pointer to the data packet to be sent. + @param length is the length of the data packet to be sent. + + + @return + @retval true if the data was successfully transmitted and decrypted by the Host. + @retval false if data transmission failed or Host failed to decryption data correctly. +*/ +bool gzp_crypt_data_send(const uint8_t *src, uint8_t length); + + +/** +@name Host functions +*/ + +/** + Function for enabling/disabling pairing in a host. When pairing is enabled the host will + be monitoring for "system address" and "Host ID" requests from Devices. + + A "system address request" received from a Device will always be granted. + When a "host ID request" has been received, the Host application have to grant, + reject or cancel this by using one of the following functions: + + - gzp_id_req_grant() + - gzp_id_req_reject() + - gzp_id_req_cancel() + + @param enable + @arg true enables pairing. + @arg false disables pairing. +*/ +void gzp_pairing_enable(bool enable); + +/** + * Execute the Gazell Pairing Library Host operation. + * + * This function must be called regularly by the Host application. + */ +void gzp_host_execute(void); + +/** + * Address exchanged check. + * + * @retval true If a "system address" was delivered to a requesting Device during the + * previous call to gzp_host_execute(); + * @retval false Otherwise. +*/ +bool gzp_address_exchanged(void); + +/** + Function for checking if a "Host ID request" has been received from a Device. + + If a request has been received, the Pairing library will enter "ID request pending" + state. + + The application is responsible for responding to this request by calling + one of the following functions: + + - gzp_id_req_grant() + - gzp_id_req_reject() + - gzp_id_req_cancel() + + @retval true if a "Host ID request" has been received (internal state is "ID request pending") + @retval false if no "Host ID request" has been received (internal state is "ID request idle") +*/ +bool gzp_id_req_received(void); + +/** + Function for rejecting the previously received "Host ID request". This function should be called + only when a "Host ID request" has been received (internal state is "ID request pending"). + + The internal state of the Pairing library will remain "ID request pending" until the a "reject" message + has been successfully transmitted to the requesting Device. After this the internal state will + change to "ID request idle". +*/ +void gzp_id_req_reject(void); + +/** + * Function for granting the previously received "Host ID request". This function should be called + only when a "Host ID request" has been received (internal state is "ID request pending"). + + The internal state of the Pairing library will remain "ID request pending" until the "Host ID" has + been successfully transmitted to the requesting Device. After this the internal state will + change to "ID request idle". +*/ +void gzp_id_req_grant(void); + + +/** + * Check if user data has been received. + * + * @retval true If encrypted user data has been received. + * @retval false Otherwise. +*/ +bool gzp_crypt_user_data_received(void); + +/** + Function for reading encrypted user data. + + Note that the read user data will be automatically decrypted. Only data + that was decrypted correctly will be presented. + + @param dst* is a pointer to where the received data will be written. + @param length* is a pointer for returning the number of bytes received. Only 1 byte will + be writtem to length*. + + @return + @retval true if data has been received and is written to dst* + @retval false if no data has been received. +*/ +bool gzp_crypt_user_data_read(uint8_t* dst, uint8_t* length); + + +/** + Function emulating behavior of gzll_rx_start() in legeacy nRF24xx Gaell + linbrary. + + This functions sets Gazell in Host mode and starts reception (enable). +*/ +void gzll_rx_start(void); + + +/** @} */ +/** @} */ +/** @} */ + +#endif diff --git a/components/properitary_rf/gzll/nrf_gzp_device.c b/components/properitary_rf/gzll/nrf_gzp_device.c new file mode 100644 index 0000000..c42870e --- /dev/null +++ b/components/properitary_rf/gzll/nrf_gzp_device.c @@ -0,0 +1,1118 @@ +/* Copyright (c) 2009 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is confidential 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. + * + * $LastChangedRevision: 29442 $ + */ + + +/** + * @file + * @brief Implementation of Gazell Pairing Library (gzp), Device functions. + * @defgroup gzp_source_device Gazell Pairing Device implementation. + * @{ + * @ingroup gzp_04_source + */ + + +#include +#include +#include + +#include "nrf_gzll.h" +#include "nrf_gzp.h" +#include "nrf_delay.h" +#include "nrf_nvmc.h" + +#define SOURCE_FILE NRF_SOURCE_FILE_GZP_DEVICE ///< File identifer for asserts. + +/******************************************************************************/ +/** @name Misc. defines + * @{ */ +/******************************************************************************/ + +#define GZP_PARAMS_DB_ELEMENT_SYSTEM_ADDRESS 0 ///< System address position. +#define GZP_PARAMS_DB_ELEMENT_HOST_ID (GZP_PARAMS_DB_ELEMENT_SYSTEM_ADDRESS + GZP_SYSTEM_ADDRESS_WIDTH) ///< Host ID position +#define GZP_PARAMS_DB_ELEMENT_SIZE (GZP_SYSTEM_ADDRESS_WIDTH + GZP_HOST_ID_LENGTH)///< Total size +#define GZP_PARAMS_DB_MAX_ENTRIES 14 ///< Maximum allowed entries in the database. + +/** @} */ + +/******************************************************************************/ +/** @name Derived parameters + * @{ */ +/******************************************************************************/ + +//lint -esym(40, GZP_PARAMS_STORAGE_ADR) "Undeclare identifier" +#define GZP_PARAMS_DB_ADR GZP_PARAMS_STORAGE_ADR ///< +#define GZP_PARAMS_DB_SIZE (GZP_PARAMS_DB_MAX_ENTRIES * GZP_PARAMS_DB_ELEMENT_SIZE) ///< + +#define GZP_INDEX_DB_ADR (GZP_PARAMS_STORAGE_ADR + GZP_PARAMS_DB_SIZE) ///< +#define GZP_INDEX_DB_SIZE (GZP_DEVICE_PARAMS_STORAGE_SIZE - GZP_PARAMS_DB_SIZE) ///< + +#if(GZP_DEVICE_PARAMS_STORAGE_SIZE < GZP_PARAMS_DB_SIZE) + #error GZP_DEVICE_PARAMS_STORAGE_SIZE must be greater or equal to GZP_PAIRING_PARAMS_DB_SIZE +#elif(GZP_DEVICE_PARAMS_STORAGE_SIZE == GZP_PARAMS_DB_SIZE ) + #warning GZP_DEVICE_PARAMS_STORAGE_SIZE to low to be able store any pairing parameters NV memory +#endif +/** @} */ + + +/******************************************************************************/ +/** @name Typedefs + * @{ */ +/******************************************************************************/ + + +/** + * Possible return values for the function gzp_tx_rx_transaction() + */ +typedef enum +{ + GZP_TX_RX_SUCCESS, ///< ACK received. Transaction successful. + GZP_TX_RX_FAILED_TO_SEND, ///< + GZP_TX_RX_NO_RESPONSE ///< +} gzp_tx_rx_trans_result_t; +/** @} */ + + +/******************************************************************************/ +/** @name Internal variables + * @{ */ +/******************************************************************************/ + +static uint8_t gzp_system_address[GZP_SYSTEM_ADDRESS_WIDTH]; ///< +static uint8_t gzp_host_id[GZP_HOST_ID_LENGTH]; ///< +static uint8_t dyn_key[GZP_DYN_KEY_LENGTH]; +static bool gzp_id_req_pending = false; + +/** @} */ + + +/******************************************************************************/ +/** @name Internal (static) function prototypes + * @{ */ +/******************************************************************************/ + +/** + * Function for sending an encrypted packet. + * + * The function waits for the transmission to complete. + * + * @param tx_packet Pointer to the packet to be sent. + * @param length Length of the packet to be sent. + * @param pipe Pipe on which the packet should be sent. + * + * @retval true If the transmission succeeded. + * @retval false If the transmission failed (timed out). + */ +static bool gzp_tx_packet(const uint8_t* tx_packet, uint8_t length, uint8_t pipe); + +/** + * Function sending the packet *tx_packet and a subsequent packet fetching the response + * to *tx_packet. + * + * @param tx_packet is a pointer to the packet to be sent. + * @param tx_length is the length of the packet to be sent. + * @param rx_dst is a pointer to where the received response packet should be stored. + * @param rx_length is a pointer to where the length of the received packet should be stored. + * @param pipe is the pipe on which the packet should be sent. + * + * @return result of the transaction. + */ + static gzp_tx_rx_trans_result_t gzp_tx_rx_transaction(const uint8_t *tx_packet, uint8_t tx_length, uint8_t *rx_dst, uint32_t *rx_length, uint8_t pipe); + +/** + * Function for sending an encrypted packet. The function detects whether the correct + * key was used, and attempts to send a "key update" to the host if the wrong key was being + * used. + + * @param tx_packet is a pointer to the packet to be sent. + * @param length is the length of the packet to be sent. + + * @retval true if transmission succeeded and packet was decrypted correctly by host. + * @retval false if transmission failed or packet was not decrypted correctly by host. + */ +static bool gzp_crypt_tx_transaction(const uint8_t *tx_packet, uint8_t length); + +/** + * Function updateing the "dynamic key" and sending a "key update" to the host. + * + * @retval true if key update succeeded. + * @retval false if if key update failed. + */ +static bool gzp_key_update(void); + +/** + * Function for adding an element to "parameters data base" in non volatile (NV) memory. An element is + * GZP_PARAMS_ELEMENT_SYSTEM_ADDRESS bytes long, holding the "system address" and "host ID". + * + * The "parameters data base" can store up to GZP_DEVICE_PAIRING_PARAMS_DB_MAX_ENTRIES + * elements. + * + * @param src_element is a pointer to the element. + * @param index is a number between 0 and (GZP_PARAMS_DB_MAX_ENTRIES - 1) + * selecting the location in which the element will be stored. + */ +static void gzp_params_db_add(const uint8_t *src_element, uint8_t index); + +/** + * Function for reading an element from "parameters data base" in non volatile (NV) memory. An element is + * GZP_PARAMS_ELEMENT_SYSTEM_ADDRESS bytes long, holding the "system address" and "host ID". + * + * @param dst_element is a pointer where the read element should be stored. + * @param index is a number between 0 and (GZP_PARAMS_DB_MAX_ENTRIES - 1). + * selecting the location that should be read. + */ +static void gzp_params_db_read(uint8_t* dst_element, uint8_t index); + +/** + * Function for writing an index to the "index data base" in non volatile (NV) memory. + * + * @param index is the index to be written to the data base. + */ +static void gzp_index_db_add(uint8_t index); + +/** + * Function for reading the index previously written to the "index data base" in NV memory. + * + * @return + */ +static uint8_t gzp_index_db_read(void); + +/** + * Check "index data base" is full. + * + * @retval true + * @retval false + */ +static bool gzp_index_db_full(void); + +/** + * Function returning @b true if the "index data base" is empty. + * + * @retval true + * @retval false + */ +static bool gzp_index_db_empty(void); + +/** + * Function returning @b true if array contains only 1s (0xff). + * + * @param *src is a pointer to the array to be evaluated. + * @param length is the length of the array to be evaluated. + * + * @retval true + * @retval false + */ +static bool gzp_array_is_set(const uint8_t* src, uint8_t length); + +/** + * Function for storing the current "system address" and "host ID" in NV memory. + * + * @param store_all selects whether only "system address" or both "system address" and + * "host ID" should be stored. + * @arg true selects that both should be stored. + * @arg false selects that only "system address" should be stored. + * + * @retval true + * @retval false + */ +static bool gzp_params_store(bool store_all); + +/** + * Restore the "system address" and "host ID" from NV memory. + * @retval true + * @retval false + */ +static bool gzp_params_restore(void); + +/** + * Delay function. Will add a delay equal to GZLL_RX_PERIOD * rx_periods [us]. + * + * @param rx_periods + */ +void gzp_delay_rx_periods(uint32_t rx_periods); + +/** + * Delay function. Will add a delay equal to GZLL_RX_PERIOD * rx_periods [us] using the + * gazell timer and not a delay loop. + * + * @param rx_periods + */ +void gzp_tick_sleep_rx_periods(uint32_t rx_periods); + +/* + * Print debug string. By default does nothing. + * + * If GZP_DEBUG is defined then the print string function is required to + * be implemented. + */ +void print_string(char* p_expr); + +/** @} */ + +/******************************************************************************/ +/** @name Internal (static) variables + * @{ */ +/******************************************************************************/ + +static nrf_gzll_device_tx_info_t latest_tx_info; ///< Information about the last TX attempt, e.g. RSSI of ACK. + +static volatile bool tx_complete; ///< Flag to indicate whether a GZLL TX attempt has completed. +static bool tx_success; ///< Flag to indicate whether a GZLL TX attempt was successful. + +#if defined(__ICCARM__) + #if GZP_PARAMS_DB_ADR == 0x1000 + static const uint32_t database[GZP_DEVICE_PARAMS_STORAGE_SIZE/4] @ "gzp_dev_data" + #elif GZP_PARAMS_DB_ADR == 0x15000 + static const uint32_t database[GZP_DEVICE_PARAMS_STORAGE_SIZE/4] @ "gzp_dev_data_sd" + #else + #error + #endif +#else +static const uint32_t database[GZP_DEVICE_PARAMS_STORAGE_SIZE/4] __attribute__((at(GZP_PARAMS_DB_ADR))) +#endif += { +0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFF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FFFF,0xFFFFFFFF, +0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, +0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, +0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, +0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF +}; ///< Database for storing keys. + + +/** @} */ + + +/******************************************************************************/ +// Implementation: Device-specific API functions +/******************************************************************************/ + + +void gzp_init() +{ + gzp_id_req_pending = false; + +#ifndef GZP_NV_STORAGE_DISABLE + (void)gzp_params_restore(); +#endif + + // Update radio parameters from gzp_system_address + (void)gzp_update_radio_params(gzp_system_address); +} + + +void gzp_erase_pairing_data(void) +{ + // Erase database flash page so that it can be later written to. + nrf_nvmc_page_erase((uint32_t)database); +} + +bool gzp_address_req_send() +{ + //lint -save -e514 Unusual use of a Boolean expression (gzll_update_ok &= ...) + uint8_t i; + bool retval = false; + bool success; + uint8_t address_req[GZP_CMD_HOST_ADDRESS_REQ_PAYLOAD_LENGTH]; + uint8_t rx_payload[NRF_GZLL_CONST_MAX_PAYLOAD_LENGTH]; + uint32_t rx_payload_length = NRF_GZLL_CONST_MAX_PAYLOAD_LENGTH; + nrf_gzll_tx_power_t temp_power; + uint32_t temp_max_tx_attempts; + bool gzll_update_ok = true; + + + // Store parameters that are temporarily changed + temp_max_tx_attempts = nrf_gzll_get_max_tx_attempts(); + temp_power = nrf_gzll_get_tx_power(); + + // Modify parameters + nrf_gzp_disable_gzll(); + gzll_update_ok &= nrf_gzll_set_max_tx_attempts(GZP_REQ_TX_TIMEOUT); + gzll_update_ok &= nrf_gzll_set_tx_power(GZP_POWER); + + // Flush RX FIFO + gzll_update_ok &= nrf_gzll_flush_rx_fifo(GZP_PAIRING_PIPE); + gzll_update_ok &= nrf_gzll_enable(); + // Build "request" packet + address_req[0] = (uint8_t)GZP_CMD_HOST_ADDRESS_REQ; + + // Send a number of packets in order to broadcast that devices not within + // close proximity must back off. + for(i = 0; i < GZP_MAX_BACKOFF_PACKETS; i++) + { + success = gzp_tx_packet(address_req, GZP_CMD_HOST_ADDRESS_REQ_PAYLOAD_LENGTH, GZP_PAIRING_PIPE); + if(success) + { + nrf_gzp_flush_rx_fifo(GZP_PAIRING_PIPE); + } + else + { + break; + } + } + + gzp_delay_rx_periods(GZP_TX_ACK_WAIT_TIMEOUT); + // Send message for fetching pairing response from host. + address_req[0] = (uint8_t)GZP_CMD_HOST_ADDRESS_FETCH; + + success = gzp_tx_packet(address_req, GZP_CMD_HOST_ADDRESS_REQ_PAYLOAD_LENGTH, GZP_PAIRING_PIPE); + if(success && latest_tx_info.payload_received_in_ack) + { + // If pairing response received + if(nrf_gzll_get_rx_fifo_packet_count(GZP_PAIRING_PIPE) > 0) + { + rx_payload_length = NRF_GZLL_CONST_MAX_PAYLOAD_LENGTH; //dummy placeholder + if(nrf_gzll_fetch_packet_from_rx_fifo(GZP_PAIRING_PIPE, rx_payload, &rx_payload_length)) + { + if(rx_payload[0] == (uint8_t)GZP_CMD_HOST_ADDRESS_RESP) + { + memcpy(gzp_system_address, &rx_payload[GZP_CMD_HOST_ADDRESS_RESP_ADDRESS], GZP_SYSTEM_ADDRESS_WIDTH); + gzll_update_ok &= gzp_update_radio_params(&rx_payload[GZP_CMD_HOST_ADDRESS_RESP_ADDRESS]); + #ifndef GZP_NV_STORAGE_DISABLE + (void)gzp_params_store(false); // "False" indicates that only "system address" part of DB element will be stored + #endif + retval = true; + } + } + } + } + else + { + gzp_delay_rx_periods(GZP_NOT_PROXIMITY_BACKOFF_RX_TIMEOUT - GZP_TX_ACK_WAIT_TIMEOUT); + } + gzp_delay_rx_periods(GZP_STEP1_RX_TIMEOUT); + + // Clean-up and restore parameters temporarily modified + nrf_gzp_disable_gzll(); + gzll_update_ok &= nrf_gzll_flush_rx_fifo(GZP_PAIRING_PIPE); + gzll_update_ok &= nrf_gzll_flush_tx_fifo(GZP_PAIRING_PIPE); + gzll_update_ok &= nrf_gzll_set_max_tx_attempts(temp_max_tx_attempts); + gzll_update_ok &= nrf_gzll_set_tx_power(temp_power); + gzll_update_ok &= nrf_gzll_enable(); + + if(!gzll_update_ok) + { + /* + The update of the Gazell parameters failed. Use nrf_gzll_get_error_code() + to investigate the cause. + */ + } + + return retval; + //lint -restore +} + +#ifndef GZP_CRYPT_DISABLE + +gzp_id_req_res_t gzp_id_req_send() +{ + uint8_t tx_packet[GZP_CMD_HOST_ID_REQ_PAYLOAD_LENGTH]; + uint8_t rx_packet[GZP_MAX_ACK_PAYLOAD_LENGTH]; + gzp_tx_rx_trans_result_t trans_result; + + // If no ID request is pending, send new "ID request" + if(!gzp_id_req_pending) + { + // Build "Host ID request packet" + tx_packet[0] = (uint8_t)GZP_CMD_HOST_ID_REQ; + + // Generate new session token + gzp_random_numbers_generate(&tx_packet[GZP_CMD_HOST_ID_REQ_SESSION_TOKEN], GZP_SESSION_TOKEN_LENGTH); + + // Send "Host ID request" + if(gzp_tx_packet(tx_packet, GZP_CMD_HOST_ID_REQ_PAYLOAD_LENGTH, GZP_DATA_PIPE)) + { + // Update session token if "Host ID request" was successfully transmitted + gzp_crypt_set_session_token(&tx_packet[GZP_CMD_HOST_ID_REQ_SESSION_TOKEN]); + gzp_id_req_pending = true; + + return GZP_ID_RESP_PENDING; + } + } + else // If "ID request is pending" send "fetch ID" packet + { + // Build "host ID fetch" packet + tx_packet[0] = (uint8_t)GZP_CMD_HOST_ID_FETCH; + gzp_add_validation_id(&tx_packet[GZP_CMD_HOST_ID_FETCH_VALIDATION_ID]); + + // Encrypt "host ID fetch" packet + gzp_crypt_select_key(GZP_ID_EXCHANGE); + gzp_crypt(&tx_packet[1], &tx_packet[1], GZP_CMD_HOST_ID_FETCH_PAYLOAD_LENGTH - 1); + + trans_result = gzp_tx_rx_transaction(tx_packet, GZP_CMD_HOST_ID_FETCH_PAYLOAD_LENGTH, rx_packet, NULL, GZP_DATA_PIPE); + // If packet was successfully sent AND a response packet was received + if(trans_result == GZP_TX_RX_SUCCESS) + { + // Validate response packet + if(rx_packet[0] == (uint8_t)GZP_CMD_HOST_ID_FETCH_RESP) + { + gzp_crypt(&rx_packet[1], &rx_packet[1], GZP_CMD_HOST_ID_FETCH_RESP_PAYLOAD_LENGTH - 1); + if(gzp_validate_id(&rx_packet[GZP_CMD_HOST_ID_FETCH_RESP_VALIDATION_ID])) + { + switch(rx_packet[GZP_CMD_HOST_ID_FETCH_RESP_STATUS]) + { + case GZP_ID_RESP_PENDING: + break; + case GZP_ID_RESP_REJECTED: + gzp_id_req_pending = false; + break; + case GZP_ID_RESP_GRANTED: + gzp_set_host_id(&rx_packet[GZP_CMD_HOST_ID_FETCH_RESP_HOST_ID]); + gzp_random_numbers_generate(dyn_key, GZP_DYN_KEY_LENGTH); + gzp_crypt_set_dyn_key(dyn_key); + #ifndef GZP_NV_STORAGE_DISABLE + (void)gzp_params_store(true); + #endif + gzp_id_req_pending = false; + break; + default: + break; + } + + return (gzp_id_req_res_t)rx_packet[GZP_CMD_HOST_ID_FETCH_RESP_STATUS]; + } + else + { + gzp_id_req_pending = false; + return GZP_ID_RESP_REJECTED; + } + } + } + } + + gzp_id_req_pending = false; + return GZP_ID_RESP_FAILED; +} + +void gzp_id_req_cancel() +{ + gzp_id_req_pending = false; +} + +bool gzp_crypt_data_send(const uint8_t *src, uint8_t length) +{ + if(length <= GZP_ENCRYPTED_USER_DATA_MAX_LENGTH) + { + if(gzp_crypt_tx_transaction(src, length)) + { + return true; + } + else + { + //print_string("GZP_CRYPT_TX failed\r\n"); + // Attempt key update if user data transmission failed + // during normal operation (!gzp_id_req_pending) + if(!gzp_id_req_pending) + { + //print_string("KEY UPDATE\r\n"); + if(gzp_key_update()) + { + return gzp_crypt_tx_transaction(src, length); + } + } + return false; + } + } + else + { + return false; + } +} + +#endif +/** @} */ + + +/******************************************************************************/ +// Implementation: Internal (static) functions +/******************************************************************************/ + +static bool gzp_tx_packet(const uint8_t* tx_packet, uint8_t length, uint8_t pipe) +{ + tx_complete = false; + tx_success = false; + + if(nrf_gzll_add_packet_to_tx_fifo(pipe,(uint8_t *)tx_packet, length)) + { + while(tx_complete == false) + { + __WFI(); + } + return tx_success; + } + else + { + return false; + } +} + +static gzp_tx_rx_trans_result_t gzp_tx_rx_transaction(const uint8_t *tx_packet, uint8_t tx_length, uint8_t *rx_dst, uint32_t *rx_length, uint8_t pipe) +{ + + gzp_tx_rx_trans_result_t retval; + uint8_t fetch_packet[GZP_CMD_FETCH_RESP_PAYLOAD_LENGTH]; + bool tx_packet_success; + bool fetch_success; + uint32_t local_rx_length = GZP_MAX_ACK_PAYLOAD_LENGTH; + uint32_t temp_lifetime; + + nrf_gzp_flush_rx_fifo(pipe); + + retval = GZP_TX_RX_FAILED_TO_SEND; + + (void)nrf_gzll_disable(); + while(nrf_gzll_is_enabled()) + {} + temp_lifetime = nrf_gzll_get_sync_lifetime(); + (void)nrf_gzll_set_sync_lifetime(GZP_TX_RX_TRANS_DELAY * 3); // 3 = RXPERIOD * 2 + margin + (void)nrf_gzll_enable(); + + tx_packet_success = gzp_tx_packet(tx_packet, tx_length, pipe); + + if(tx_packet_success) + { + retval = GZP_TX_RX_NO_RESPONSE; + + nrf_gzp_flush_rx_fifo(pipe); + + fetch_packet[0] = (uint8_t)GZP_CMD_FETCH_RESP; + + gzp_tick_sleep_rx_periods(GZP_TX_RX_TRANS_DELAY); + + tx_packet_success = gzp_tx_packet(fetch_packet, GZP_CMD_FETCH_RESP_PAYLOAD_LENGTH, pipe); + + if(tx_packet_success) + { + if(nrf_gzll_get_rx_fifo_packet_count(pipe)) + { + local_rx_length = NRF_GZLL_CONST_MAX_PAYLOAD_LENGTH; + fetch_success = nrf_gzll_fetch_packet_from_rx_fifo(pipe, rx_dst, &local_rx_length); + } + else + { + fetch_success = false; + } + + if(fetch_success) + { + retval = GZP_TX_RX_SUCCESS; + } + else + { + //print_string("GZP_TX_FETCH_FAILED\r\n"); + } + } + else + { + //print_string("GZP_TX_FETCH_NO_ACK\r\n"); + } + } + + (void)nrf_gzll_disable(); + while(nrf_gzll_is_enabled()) + {} + (void)nrf_gzll_set_sync_lifetime(temp_lifetime); + (void)nrf_gzll_enable(); + + return retval; +} + +#ifndef GZP_CRYPT_DISABLE + +static bool gzp_crypt_tx_transaction(const uint8_t *src, uint8_t length) +{ + uint8_t tx_packet[GZP_MAX_FW_PAYLOAD_LENGTH]; + uint8_t rx_packet[GZP_MAX_ACK_PAYLOAD_LENGTH]; + uint8_t tx_packet_length; + + gzp_tx_rx_trans_result_t result; + + tx_packet_length = length + (uint8_t)GZP_ENCRYPTED_USER_DATA_PACKET_OVERHEAD; + + // Assemble tx packet + tx_packet[0] = (uint8_t)GZP_CMD_ENCRYPTED_USER_DATA; + gzp_add_validation_id(&tx_packet[GZP_CMD_ENCRYPTED_USER_DATA_VALIDATION_ID]); + memcpy(&tx_packet[GZP_CMD_ENCRYPTED_USER_DATA_PAYLOAD], (uint8_t*)src, length); + + // Encrypt tx packet + if(gzp_id_req_pending) + { + gzp_crypt_select_key(GZP_ID_EXCHANGE); + } + else + { + gzp_crypt_select_key(GZP_DATA_EXCHANGE); + } + gzp_crypt(&tx_packet[1], &tx_packet[1], tx_packet_length - 1); + + // If packet was successfully sent AND a response packet was received + result = gzp_tx_rx_transaction(tx_packet, tx_packet_length, rx_packet, NULL, GZP_DATA_PIPE); + if(result == GZP_TX_RX_SUCCESS) + { + if(rx_packet[0] == (uint8_t)GZP_CMD_ENCRYPTED_USER_DATA_RESP) + { + gzp_crypt(&rx_packet[GZP_CMD_ENCRYPTED_USER_DATA_RESP_VALIDATION_ID], &rx_packet[GZP_CMD_ENCRYPTED_USER_DATA_RESP_VALIDATION_ID], GZP_VALIDATION_ID_LENGTH); + + // Validate response in order to know whether packet was correctly decrypted by host + if(gzp_validate_id(&rx_packet[GZP_CMD_ENCRYPTED_USER_DATA_RESP_VALIDATION_ID])) + { + // Update session token if normal operation (!gzp_id_req_pending) + if(!gzp_id_req_pending) + { + gzp_crypt_set_session_token(&rx_packet[GZP_CMD_ENCRYPTED_USER_DATA_RESP_SESSION_TOKEN]); + } + return true; + } + else + { + //print_string("GZP_CRYPT_TX_TRANS: Validation ID bad\r\n"); + return false; + } + } + else + { + //print_string("GZP_CRYPT_TX_TRANS: Bad CMD. \r\n"); + return false; + } + } + else + { + //print_string("GZP_CRYPT_TX_TRANS: gzp_tx_rx_trans not SUCCESS\r\n"); + return false; + } +} + +static bool gzp_key_update(void) +{ + uint8_t tx_packet[GZP_CMD_KEY_UPDATE_PAYLOAD_LENGTH], rx_packet[GZP_MAX_ACK_PAYLOAD_LENGTH]; + + // Send "prepare packet" to get session token to be used for key update + tx_packet[0] = (uint8_t)GZP_CMD_KEY_UPDATE_PREPARE; + + // If packet was successfully sent AND a response packet was received + if(gzp_tx_rx_transaction(tx_packet, GZP_CMD_KEY_UPDATE_PREPARE_PAYLOAD_LENGTH, rx_packet, NULL, GZP_DATA_PIPE) == GZP_TX_RX_SUCCESS) + { + if(rx_packet[0] == (uint8_t)GZP_CMD_KEY_UPDATE_PREPARE_RESP) + { + gzp_crypt_set_session_token(&rx_packet[GZP_CMD_KEY_UPDATE_PREPARE_RESP_SESSION_TOKEN]); + + // Build "key update" packet + tx_packet[0] = (uint8_t)GZP_CMD_KEY_UPDATE; + gzp_add_validation_id(&tx_packet[GZP_CMD_KEY_UPDATE_VALIDATION_ID]); + gzp_random_numbers_generate(&tx_packet[GZP_CMD_KEY_UPDATE_NEW_KEY], GZP_DYN_KEY_LENGTH); + gzp_crypt_set_dyn_key(&tx_packet[GZP_CMD_KEY_UPDATE_NEW_KEY]); + + // Encrypt "key update packet" + gzp_crypt_select_key(GZP_KEY_EXCHANGE); + gzp_crypt(&tx_packet[1], &tx_packet[1], GZP_CMD_KEY_UPDATE_PAYLOAD_LENGTH - 1); + + // Send "key update" packet + if(gzp_tx_packet(tx_packet, GZP_CMD_KEY_UPDATE_PAYLOAD_LENGTH, GZP_DATA_PIPE)) + { + return true; + } + } + } + + return false; +} + +#endif + +void gzp_set_host_id(const uint8_t * id) +{ + memcpy(gzp_host_id, id, GZP_HOST_ID_LENGTH); +} + +void gzp_get_host_id(uint8_t * dst_id) +{ + memcpy(dst_id, gzp_host_id, GZP_HOST_ID_LENGTH); +} + +static void gzp_params_db_add(const uint8_t* src_element, uint8_t index) +{ + nrf_nvmc_write_bytes((GZP_PARAMS_DB_ADR + (index * GZP_PARAMS_DB_ELEMENT_SIZE)), src_element, (uint32_t)GZP_PARAMS_DB_ELEMENT_SIZE); +} + + +static void gzp_params_db_read(uint8_t* dst_element, uint8_t index) +{ + memcpy(dst_element,(uint8_t*)(GZP_PARAMS_DB_ADR + (index * GZP_PARAMS_DB_ELEMENT_SIZE)), GZP_PARAMS_DB_ELEMENT_SIZE); +} + + +static void gzp_index_db_add(uint8_t val) +{ + int16_t i; + uint8_t temp_val; + uint32_t addr; + + // Search for unwritten loacation in index DB + for(i = 0; i < GZP_INDEX_DB_SIZE; i++) + { + temp_val = *(uint8_t*)(GZP_INDEX_DB_ADR + i); + + // Lower nibble + if(i != (GZP_INDEX_DB_SIZE - 1)) + { + if((temp_val & 0x0f) == 0x0f) + { + temp_val = (temp_val & 0xf0) | val; + break; + } + // Upper nibble + else if((temp_val & 0xf0) == 0xf0) + { + temp_val = (temp_val & 0x0f) | (val << 4); + break; + } + } + else + { + temp_val = (GZP_PARAMS_DB_MAX_ENTRIES << 4) | val; + break; + } + } + + // Write index DB + addr = (GZP_INDEX_DB_ADR + i); + nrf_nvmc_write_byte(addr, temp_val); +} + +static uint8_t gzp_index_db_read() +{ + uint8_t retval; + int16_t i; + + // Search for previously written location + for(i = (GZP_INDEX_DB_SIZE - 1); i >= 0; i--) + { + retval = *(uint8_t*)(GZP_INDEX_DB_ADR + i); + + if(retval != 0xff) + { + break; + } + } + + if(retval == 0xff) + { + retval = GZP_PARAMS_DB_MAX_ENTRIES; // index db empty + } + else if((retval & 0xf0) != 0xf0) + { + retval >>= 4; + } + else + { + retval &= 0x0f; + } + + return retval; +} + +int8_t gzp_get_pairing_status(void) +{ + uint8_t db_byte; + int8_t db_index; + int16_t i; + uint8_t temp_element[GZP_PARAMS_DB_ELEMENT_SIZE]; + uint8_t default_host_id[GZP_HOST_ID_LENGTH]; + + db_index = -2; + + // Populate default Host ID with F's. + for(i=0; i< GZP_HOST_ID_LENGTH; i++) + { + default_host_id[i] = 0xFF; + } + + // Search for previously written location + for(i = (GZP_INDEX_DB_SIZE - 1); i >= 0; i--) + { + db_byte = *(uint8_t*)(GZP_INDEX_DB_ADR + i); + + // Check if idx has been written to + if(db_byte != 0xff) + { + // Convert 4-bit nibble to index + if((db_byte & 0xf0) != 0xf0) + { + db_byte = (db_byte >> 4) & 0x0f; + } + else + { + db_byte = db_byte & 0x0f; + } + + // Retrieve database entry + gzp_params_db_read(temp_element, db_byte); + + // Check if database entry is all F's + if( memcmp(&temp_element[GZP_PARAMS_DB_ELEMENT_HOST_ID], default_host_id, GZP_HOST_ID_LENGTH) != 0) + { + + db_index = db_byte; + } + else + { + db_index = -1; + } + break; + } + } + + return db_index; +} + + +static bool gzp_index_db_full() +{ +#if (GZP_INDEX_DB_SIZE != 0) + return ((*(uint8_t*)(GZP_INDEX_DB_ADR + (GZP_INDEX_DB_SIZE - 1)) != 0xff)); +#else + return true; +#endif +} + +//lint -save -e506 Constant value boolean +static bool gzp_index_db_empty() +{ +#if (GZP_INDEX_DB_SIZE != 0) + return ((GZP_INDEX_DB_SIZE == 0) || ((*(uint8_t*)(GZP_INDEX_DB_ADR)) == 0xff)); +#else + return true; +#endif +} +//lint -restore + +static bool gzp_array_is_set(const uint8_t* src, uint8_t length) +{ + uint8_t i; + + for(i = 0; i < length; i++) + { + if(*(src++) != 0xff) + { + return false; + } + } + return true; +} + +static bool gzp_params_store(bool store_all) +{ + uint8_t i; + bool write_index_db = false; + bool write_param_db = false; + uint8_t new_db_index = 0; + uint8_t temp_element[GZP_PARAMS_DB_ELEMENT_SIZE]; + + // Search param DB to see if current setup exists + if(store_all) + { + // Search for: Current system address and host ID exists + for(i = 0; i < GZP_PARAMS_DB_MAX_ENTRIES; i++) + { + gzp_params_db_read(temp_element, i); + + if(((memcmp(&temp_element[GZP_PARAMS_DB_ELEMENT_SYSTEM_ADDRESS], gzp_system_address, GZP_SYSTEM_ADDRESS_WIDTH)) == 0) && ((memcmp(&temp_element[GZP_PARAMS_DB_ELEMENT_HOST_ID], gzp_host_id, GZP_HOST_ID_LENGTH)) == 0)) + { + write_index_db = true; + new_db_index = i; + break; // System address + host_id allready exists in database + } + } + + // Search for: Current system address and cleared host ID + if(!write_index_db) + { + for(i = 0; i < GZP_PARAMS_DB_MAX_ENTRIES; i++) + { + gzp_params_db_read(temp_element, i); + + if(((memcmp(&temp_element[GZP_PARAMS_DB_ELEMENT_SYSTEM_ADDRESS], gzp_system_address, GZP_SYSTEM_ADDRESS_WIDTH)) == 0) && \ + (gzp_array_is_set(&temp_element[GZP_PARAMS_DB_ELEMENT_HOST_ID], GZP_HOST_ID_LENGTH))) + { + memcpy(&temp_element[GZP_PARAMS_DB_ELEMENT_HOST_ID], gzp_host_id, GZP_HOST_ID_LENGTH); + new_db_index = i; + write_index_db = true; + write_param_db = true; + break; + } + } + } + + // Search for: Cleared system address and cleared host ID + if(!write_index_db) + { + for(i = 0; i < GZP_PARAMS_DB_MAX_ENTRIES; i++) + { + gzp_params_db_read(temp_element, i); + + if(gzp_array_is_set(temp_element, GZP_PARAMS_DB_ELEMENT_SIZE)) + { + memcpy(&temp_element[GZP_PARAMS_DB_ELEMENT_SYSTEM_ADDRESS], gzp_system_address, GZP_SYSTEM_ADDRESS_WIDTH); + memcpy(&temp_element[GZP_PARAMS_DB_ELEMENT_HOST_ID], gzp_host_id, GZP_HOST_ID_LENGTH); + new_db_index = i; + write_index_db = true; + write_param_db = true; + break; + } + } + } + } + else + { + // Search for: System address + any host ID + for(i = 0; i < GZP_PARAMS_DB_MAX_ENTRIES; i++) + { + gzp_params_db_read(temp_element, i); + + if((memcmp(&temp_element[GZP_PARAMS_DB_ELEMENT_SYSTEM_ADDRESS], gzp_system_address, GZP_SYSTEM_ADDRESS_WIDTH)) == 0) + { + //memcpy(&temp_element[GZP_PARAMS_DB_ELEMENT_HOST_ID], gzp_host_id, GZP_HOST_ID_LENGTH); + write_index_db = true; + new_db_index = i; + break; + } + } + + // Search for: System address cleared + if(!write_index_db) + { + for(i = 0; i < GZP_PARAMS_DB_MAX_ENTRIES; i++) + { + gzp_params_db_read(temp_element, i); + + if(gzp_array_is_set(&temp_element[GZP_PARAMS_DB_ELEMENT_SYSTEM_ADDRESS], GZP_SYSTEM_ADDRESS_WIDTH)) + { + memcpy(&temp_element[GZP_PARAMS_DB_ELEMENT_SYSTEM_ADDRESS], gzp_system_address, GZP_SYSTEM_ADDRESS_WIDTH); + write_index_db = true; + write_param_db = true; + new_db_index = i; + break; + } + } + } + } + + if(write_param_db) + { + gzp_params_db_add(temp_element, new_db_index); + } + + if(write_index_db) + { + if(!gzp_index_db_full() && (new_db_index != gzp_index_db_read()) && (new_db_index != GZP_PARAMS_DB_MAX_ENTRIES)) + { + gzp_index_db_add(new_db_index); + return true; + } + } + + return false; +} + +static bool gzp_params_restore(void) +{ + uint8_t i; + uint8_t temp_element[GZP_PARAMS_DB_ELEMENT_SIZE]; + + if(!gzp_index_db_full() && !gzp_index_db_empty()) + { + i = gzp_index_db_read(); + + if(i < GZP_PARAMS_DB_MAX_ENTRIES) + { + gzp_params_db_read(temp_element, i); + memcpy(gzp_system_address, &temp_element[GZP_PARAMS_DB_ELEMENT_SYSTEM_ADDRESS], GZP_SYSTEM_ADDRESS_WIDTH); + gzp_set_host_id(&temp_element[GZP_PARAMS_DB_ELEMENT_HOST_ID]); + return true; + } + } + + return false; +} + +void gzp_delay_rx_periods(uint32_t rx_periods) +{ + nrf_delay_us(rx_periods*2*nrf_gzll_get_timeslot_period()); +} + +void gzp_tick_sleep_rx_periods(uint32_t rx_periods) +{ + nrf_gzll_clear_tick_count(); + + while(nrf_gzll_get_tick_count() < 2*rx_periods) + { + __WFI(); + } +} + + +void nrf_gzll_device_tx_success(uint32_t pipe, nrf_gzll_device_tx_info_t tx_info) +{ + latest_tx_info = tx_info; + + tx_complete = true; + tx_success = true; +} + +void nrf_gzll_device_tx_failed(uint32_t pipe, nrf_gzll_device_tx_info_t tx_info) +{ + latest_tx_info = tx_info; + + tx_complete = true; + tx_success = false; +} + +bool nrf_gzp_tx_complete(void) +{ + return tx_complete; +} + +bool nrf_gzp_tx_success(void) +{ + return tx_success; +} + +void nrf_gzp_reset_tx_complete() +{ + tx_complete = false; +} + +void nrf_gzp_reset_tx_success() +{ + tx_success = false; +} + +void nrf_gzll_disabled(void) +{ +} + +void nrf_gzll_host_rx_data_ready(uint32_t pipe, nrf_gzll_host_rx_info_t rx_info) +{ +} + +/** @} */ +/** @} */ diff --git a/components/properitary_rf/gzll/nrf_gzp_host.c b/components/properitary_rf/gzll/nrf_gzp_host.c new file mode 100644 index 0000000..6171d43 --- /dev/null +++ b/components/properitary_rf/gzll/nrf_gzp_host.c @@ -0,0 +1,767 @@ +/* Copyright (c) 2009 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is confidential 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 + * WARRENTY of ANY KIND is provided. This heading must NOT be removed from + * the file. + * + * $LastChangedRevision: 230 $ + */ + + +/** + * @file + * @brief Implementation of Gazell Pairing Library (gzp), Host functions. + * @defgroup gzp_source_host Gazell Pairing Host implementation + * @{ + * @ingroup gzp_04_source + */ + + +#include "nrf_gzp.h" +#include "nrf_gzll.h" +#include "string.h" +#include "stdint.h" +#include "stdbool.h" +#include "nrf_assert.h" +#include "nrf_ecb.h" +#include "nrf_nvmc.h" + + +//lint -esym(40, GZP_PARAMS_STORAGE_ADR) "Undeclared identifier" + + +/******************************************************************************/ +/** @name Typedefs + * @{ */ +/******************************************************************************/ + +/** + * Definition of internal states. + */ +typedef enum +{ + GZP_ID_REQ_IDLE, ///< No Host ID request received from Device. + GZP_ID_REQ_PENDING, ///< Host ID request received and waiting on application to grant/reject. + GZP_ID_REQ_PENDING_AND_GRANTED, ///< Host ID request received and granted by application. + GZP_ID_REQ_PENDING_AND_REJECTED, ///< Host ID request received and rejected by application. +} gzp_id_req_stat_t; + +/** @} */ + + +/******************************************************************************/ +/** @name Internal (static) function prototypes + * @{ */ +/******************************************************************************/ + + +/** + * Function for incrementing internal session counter. + */ +static void gzp_session_counter_inc(void); + + +/** + * Function for reading value of internal session counter. + * @param dst Current session counter. + */ +static void gzp_get_session_counter(uint8_t* dst); + + +/** + * Function processing received "system address request" from Device. + * + * @param gzp_req Pointer to RX payload containing system address request. + */ +static void gzp_process_address_req(uint8_t* gzp_req); + + +/** + * Function to process Host ID request from device. + * + * The Host shall retrieve the Host ID from NVM, or shall generate if + * it does not yet exist. + * + * @param rx_payload Pointer to rx_payload contaning Host ID request. + */ +static void gzp_process_id_req(uint8_t* rx_payload); + +/** + * Function to process Host ID fetch request from Device. + * + * The Device fetches the Host ID after the Host has generated/retrieved + * the Host ID. + * + * @param rx_payload Pointer to rx_payload contaning Host ID fetch request. + */ +static void gzp_process_id_fetch(uint8_t* rx_payload); + + +/** + * Function to process Key Update Prepare packet. + * + * Device requests the Session Token to be used for the Key Update request. + */ +static void gzp_process_key_update_prepare(void); + + +/** + * Function to process Key Update packet. + * + * Device requests a Key Update and sends a new Dynamic Key. The Dynamic Key is + * updated on the Host. + * + * @param rx_payload Pointer to rx_payload containing Key Update request. + */ +static void gzp_process_key_update(uint8_t* rx_payload); + + +/** + * Function to process received Encrypted User packet. + * + * @param rx_payload Pointer to rx_payload containing the encrypted user data. + * @param length Length of encrypted user data. + */ +static void gzp_process_encrypted_user_data(uint8_t* rx_payload, uint8_t length); + + +/** + * Function to preload the payload for the next ACK. + * + * @param src Pointer to source payload. + * @param length Length of source payload. + * @param pipe Pipe for the ACK payload. + */ +static void gzp_preload_ack(uint8_t* src, uint8_t length, uint8_t pipe); + + +/** + * Function for reading the Chip ID from non-volatile memory. + * + * The chip ID is used for the system address. + * + * If the Chip ID is not yet created a random Chip ID is created and + * written to non-volatile memory. Note that the term chip ID is used as + * the factory programmed chip sequence number was used for the system + * address in nRF24LU ICs. + * + * @param dst Address to copy Host ID to. + * @param[in] n Number of bytes in the Host ID. + */ +void gzp_host_chip_id_read(uint8_t *dst, uint8_t n); + + +/** + * Function to set the Host ID. + * + * Writes the Host ID to non-volatile memory. + * @param src Address of the Host ID to copy from. + */ +static void gzp_set_host_id(const uint8_t* src); + + +/** + * Function to request disabling of Gazell and wait for it to be disabled. + * + * Emulates legacy gzll_goto_idle(). + */ +static void gzll_goto_idle(void); + + +/** + * Flush all TX FIFOs. + * + * Emulates legacy gzll_tx_fifo_flush(). + */ +static void gzll_tx_fifo_flush(void); + + +/** + * Flush all RX FIFOs. + * + * Emulates legacy gzll_rx_fifo_flush(). + */ +static void gzll_rx_fifo_flush(void); + + +/** + * Set a timeout for the reception of packets on the Gazell Host. + * + * Emulates legacy Gazell function: gzll_set_param(GZLL_PARAM_RX_TIMEOUT, x). + * + * @param timeout Timeout in number of legacy "RX periods" + * (1 RX period = 2 timeslot periods). + */ +static void gzll_set_rx_timeout(uint32_t timeout); + +/** @} */ + + +/******************************************************************************/ +/** @name Internal (static) variabls + * @{ */ +/******************************************************************************/ + +static gzp_id_req_stat_t gzp_id_req_stat; ///< Current state of Host ID request. +static bool gzp_pairing_enabled_f; ///< True if Host is paired with a device. +static bool gzp_address_exchanged_f; ///< True if Host has exchanged a system address with a device and thus pairing has begun. + +static uint8_t gzp_session_counter[GZP_SESSION_TOKEN_LENGTH]; ///< Session counter used for key generation and update. + +static bool gzp_encrypted_user_data[GZP_ENCRYPTED_USER_DATA_MAX_LENGTH]; ///< Placeholder for encrypted data from Device. +static uint8_t gzp_encrypted_user_data_length; ///< Length of gzp_encrypted_user_data. Zero implies no data received. + +static nrf_gzll_host_rx_info_t prev_gzp_rx_info = {0, 0}; ///< RSSI and status of ACK payload transmission of previous Gazell packet. + +/** @} */ + + +/******************************************************************************/ +// Implementation: Host-specific API functions +/******************************************************************************/ + +void gzp_init() +{ + uint8_t system_address[GZP_SYSTEM_ADDRESS_WIDTH]; + + // Read "chip id", of which 4 bytes (GZP_SYSTEM_ADDRESS_WIDTH) + // are used as system address + gzp_host_chip_id_read(system_address, GZP_SYSTEM_ADDRESS_WIDTH); + + // Set up radio parameters (addresses and channel subset) from system_address + (void)gzp_update_radio_params(system_address); + + // Only "data pipe" enabled by default + + (void)nrf_gzll_set_rx_pipes_enabled(nrf_gzll_get_rx_pipes_enabled() | (1 << GZP_DATA_PIPE)); + + gzp_pairing_enabled_f = false; + gzp_address_exchanged_f = false; + gzp_id_req_stat = GZP_ID_REQ_IDLE; + gzp_encrypted_user_data_length = 0; + + // Infinite RX timeout + gzll_set_rx_timeout(0); +} + +void gzp_pairing_enable(bool enable) +{ + if(gzp_pairing_enabled_f != enable) + { + gzll_goto_idle(); + + if(enable) + { + (void)nrf_gzll_set_rx_pipes_enabled(nrf_gzll_get_rx_pipes_enabled() | (1 << GZP_PAIRING_PIPE)); + } + else + { + (void)nrf_gzll_set_rx_pipes_enabled(nrf_gzll_get_rx_pipes_enabled() & ~(1 << GZP_PAIRING_PIPE)); + + gzp_id_req_stat = GZP_ID_REQ_IDLE; + } + + gzp_pairing_enabled_f = enable; + + gzll_rx_start(); + } +} + +void gzp_host_execute() +{ + bool gzp_packet_received = false; + uint32_t payload_length = NRF_GZLL_CONST_MAX_PAYLOAD_LENGTH; + uint8_t rx_payload[NRF_GZLL_CONST_MAX_PAYLOAD_LENGTH]; + + gzp_address_exchanged_f = false; + + if(nrf_gzll_get_rx_fifo_packet_count(GZP_PAIRING_PIPE) > 0) + { + gzp_packet_received = nrf_gzll_fetch_packet_from_rx_fifo(GZP_PAIRING_PIPE, rx_payload, &payload_length); + } + + if(!gzp_packet_received && (gzp_encrypted_user_data_length == 0)) + { + if(nrf_gzll_get_rx_fifo_packet_count(GZP_DATA_PIPE) > 0) + { + gzp_packet_received = nrf_gzll_fetch_packet_from_rx_fifo(GZP_DATA_PIPE, rx_payload, &payload_length); + } + } + + if(gzp_packet_received) + { + //lint -save -esym(644,rx_payload) //may not have been initialized + switch(rx_payload[0]) + { + case GZP_CMD_HOST_ADDRESS_REQ: + gzp_process_address_req(rx_payload); + break; + + #ifndef GZP_CRYPT_DISABLE + + case GZP_CMD_HOST_ID_REQ: + gzp_process_id_req(rx_payload); + break; + case GZP_CMD_HOST_ID_FETCH: + gzp_process_id_fetch(rx_payload); + break; + case GZP_CMD_KEY_UPDATE_PREPARE: + gzp_process_key_update_prepare(); + break; + case GZP_CMD_KEY_UPDATE: + gzp_process_key_update(rx_payload); + break; + case GZP_CMD_ENCRYPTED_USER_DATA: + gzp_process_encrypted_user_data(rx_payload, payload_length); + break; + + #endif + + case GZP_CMD_FETCH_RESP: + default: + break; + } + } + + // Restart reception if "not proximity backoff" period has elapsed + if(!nrf_gzll_is_enabled()) + { + gzll_set_rx_timeout(0); + + if(gzp_pairing_enabled_f) + { + (void)nrf_gzll_set_rx_pipes_enabled(nrf_gzll_get_rx_pipes_enabled() | (1 << GZP_PAIRING_PIPE)); + } + + gzll_rx_start(); + } + + #ifndef GZP_CRYPT_DISABLE + gzp_session_counter_inc(); + #endif +} + +void gzll_rx_start(void) +{ + if(nrf_gzll_get_mode() != NRF_GZLL_MODE_HOST) + { + gzll_goto_idle(); + (void)nrf_gzll_set_mode(NRF_GZLL_MODE_HOST); + } + + if(!nrf_gzll_is_enabled()) + { + (void)nrf_gzll_enable(); + } +} + +bool gzp_id_req_received() +{ + return (gzp_id_req_stat != GZP_ID_REQ_IDLE); +} + +void gzp_id_req_reject() +{ + if(gzp_id_req_received()) + { + gzp_id_req_stat = GZP_ID_REQ_PENDING_AND_REJECTED; + } +} + +void gzp_id_req_grant() +{ + if(gzp_id_req_received()) + { + gzp_id_req_stat = GZP_ID_REQ_PENDING_AND_GRANTED; + } +} + +void gzp_id_req_cancel() +{ + if(gzp_id_req_received()) + { + gzp_id_req_stat = GZP_ID_REQ_IDLE; + } +} + +//----------------------------------------------------------------------------- +// Implementation: Static functions +//----------------------------------------------------------------------------- + +static void gzp_process_address_req(uint8_t* gzp_req) +{ + uint8_t temp_rx_pipes; + uint8_t pairing_resp[GZP_CMD_HOST_ADDRESS_RESP_PAYLOAD_LENGTH]; + uint32_t rx_payload_length = NRF_GZLL_CONST_MAX_PAYLOAD_LENGTH; + + gzp_address_exchanged_f = false; + + gzll_goto_idle(); + ASSERT(nrf_gzll_get_error_code() == NRF_GZLL_ERROR_CODE_NO_ERROR); + + temp_rx_pipes = nrf_gzll_get_rx_pipes_enabled(); + ASSERT(nrf_gzll_get_error_code() == NRF_GZLL_ERROR_CODE_NO_ERROR); + + // If requesting Device within close proximity + if(prev_gzp_rx_info.rssi >= GZP_HOST_RX_POWER_THRESHOLD) + { + (void)nrf_gzll_set_rx_pipes_enabled(0); + ASSERT(nrf_gzll_get_error_code() == NRF_GZLL_ERROR_CODE_NO_ERROR); + + gzll_set_rx_timeout(GZP_CLOSE_PROXIMITY_BACKOFF_RX_TIMEOUT); + ASSERT(nrf_gzll_get_error_code() == NRF_GZLL_ERROR_CODE_NO_ERROR); + + gzll_rx_fifo_flush(); + ASSERT(nrf_gzll_get_error_code() == NRF_GZLL_ERROR_CODE_NO_ERROR); + + // Start "proximity" back off period + gzll_rx_start(); + ASSERT(nrf_gzll_get_error_code() == NRF_GZLL_ERROR_CODE_NO_ERROR); + + while(nrf_gzll_is_enabled()) + {} + + // Build pairing response packet + pairing_resp[0] = (uint8_t)GZP_CMD_HOST_ADDRESS_RESP; + gzp_host_chip_id_read(&pairing_resp[GZP_CMD_HOST_ADDRESS_RESP_ADDRESS], GZP_SYSTEM_ADDRESS_WIDTH); + + (void)nrf_gzll_add_packet_to_tx_fifo(0, &pairing_resp[0], GZP_CMD_HOST_ADDRESS_RESP_PAYLOAD_LENGTH); + ASSERT(nrf_gzll_get_error_code() == NRF_GZLL_ERROR_CODE_NO_ERROR); + gzll_set_rx_timeout(GZP_STEP1_RX_TIMEOUT); + + // Enable only pairing pipe when waiting for pairing request step 1 + (void)nrf_gzll_set_rx_pipes_enabled((1 << GZP_PAIRING_PIPE)); + + gzll_rx_start(); + + while(nrf_gzll_is_enabled()) + { + if(nrf_gzll_get_rx_fifo_packet_count(GZP_PAIRING_PIPE)) + { + (void)nrf_gzll_fetch_packet_from_rx_fifo(GZP_PAIRING_PIPE, &gzp_req[0], &rx_payload_length); + + // Validate step 1 of pairing request + if(gzp_req[0] == (uint8_t)GZP_CMD_HOST_ADDRESS_FETCH) + { + gzp_address_exchanged_f = true; + } + } + } + + gzll_tx_fifo_flush(); + gzll_rx_fifo_flush(); + + gzll_set_rx_timeout(0); + + (void)nrf_gzll_set_rx_pipes_enabled(temp_rx_pipes); + + // Return to normal operation + gzll_rx_start(); + } + else + { + (void)nrf_gzll_set_rx_pipes_enabled(temp_rx_pipes & ~(1 << GZP_PAIRING_PIPE)); + + gzll_set_rx_timeout(GZP_NOT_PROXIMITY_BACKOFF_RX_TIMEOUT); + + // Start "not proximity" backoff period + gzll_rx_start(); + } +} + +static void gzp_preload_ack(uint8_t* src, uint8_t length, uint8_t pipe) +{ + gzll_goto_idle(); + + gzll_tx_fifo_flush(); + + (void)nrf_gzll_add_packet_to_tx_fifo(pipe, src, length); + + gzll_rx_start(); +} + +static void gzll_set_rx_timeout(uint32_t timeout) +{ + timeout *= 2; // * 2 as gzll_set_rx_timeout() takes RX_PERIODS as input, which equals 2 timeslots. + nrf_gzll_set_auto_disable(timeout); +} + +bool gzp_address_exchanged() +{ + return gzp_address_exchanged_f; +} + +#ifndef GZP_CRYPT_DISABLE + +bool gzp_crypt_user_data_received() +{ + return (gzp_encrypted_user_data_length > 0); +} + +bool gzp_crypt_user_data_read(uint8_t* dst, uint8_t* length) +{ + if(gzp_encrypted_user_data_length > 0) + { + memcpy(dst, (void*)gzp_encrypted_user_data, gzp_encrypted_user_data_length); + + if(length != NULL) + { + *length = gzp_encrypted_user_data_length; + } + gzp_encrypted_user_data_length = 0; + + return true; + } + else + { + return false; + } +} + +static void gzp_session_counter_inc() +{ + uint8_t i; + + for(i = 0; i < GZP_SESSION_TOKEN_LENGTH; i++) + { + gzp_session_counter[i]++; + if(gzp_session_counter[i] != 0) + { + break; + } + } +} + +static void gzp_get_session_counter(uint8_t* dst) +{ + memcpy(dst, (void*)gzp_session_counter, GZP_SESSION_TOKEN_LENGTH); +} + +static void gzp_set_host_id(const uint8_t* src) +{ + if(*((uint8_t*)GZP_PARAMS_STORAGE_ADR) == 0xff) + { + nrf_nvmc_write_bytes(GZP_PARAMS_STORAGE_ADR + 1, src, GZP_HOST_ID_LENGTH); + nrf_nvmc_write_byte(GZP_PARAMS_STORAGE_ADR, 0x00); + } +} + +void gzp_get_host_id(uint8_t *dst) +{ + memcpy(dst, (uint8_t*)GZP_PARAMS_STORAGE_ADR + 1, GZP_HOST_ID_LENGTH); +} + +static void gzp_process_id_req(uint8_t* rx_payload) +{ + int i; + uint8_t temp_host_id[GZP_HOST_ID_LENGTH]; + + if(gzp_pairing_enabled_f) + { + if(!gzp_id_req_received()) + { + gzp_crypt_set_session_token(&rx_payload[GZP_CMD_HOST_ID_REQ_SESSION_TOKEN]); + gzp_id_req_stat = GZP_ID_REQ_PENDING; + } + + gzp_get_host_id(temp_host_id); + + // Added: + for(i = 0; i < GZP_HOST_ID_LENGTH; i++) + { + if(temp_host_id[i] != 0xFF) + { + break; + } + } + + if(i == GZP_HOST_ID_LENGTH) // If host not generated yet + { + gzp_get_session_counter(temp_host_id); + + //lint -save -e506 Constantvalue Boolean + if(GZP_HOST_ID_LENGTH > GZP_SESSION_TOKEN_LENGTH) + { + //lint -restore + gzp_xor_cipher(temp_host_id, temp_host_id, &rx_payload[GZP_CMD_HOST_ID_REQ_SESSION_TOKEN], GZP_SESSION_TOKEN_LENGTH); + } + else + { + gzp_xor_cipher(temp_host_id, temp_host_id, &rx_payload[GZP_CMD_HOST_ID_REQ_SESSION_TOKEN], GZP_HOST_ID_LENGTH); + } + + gzp_set_host_id(temp_host_id); + } + } +} + +static void gzp_process_id_fetch(uint8_t* rx_payload) +{ + uint8_t tx_payload[GZP_CMD_HOST_ID_FETCH_RESP_PAYLOAD_LENGTH]; + + if(gzp_id_req_received()) + { + gzp_crypt_select_key(GZP_ID_EXCHANGE); + gzp_crypt(&rx_payload[1], &rx_payload[1], GZP_CMD_HOST_ID_FETCH_PAYLOAD_LENGTH - 1); + if(gzp_validate_id(&rx_payload[GZP_CMD_HOST_ID_FETCH_VALIDATION_ID])) + { + switch(gzp_id_req_stat) + { + case GZP_ID_REQ_PENDING_AND_GRANTED: + tx_payload[GZP_CMD_HOST_ID_FETCH_RESP_STATUS] = (uint8_t)GZP_ID_RESP_GRANTED; + gzp_get_host_id(&tx_payload[GZP_CMD_HOST_ID_FETCH_RESP_HOST_ID]); + gzp_id_req_stat = GZP_ID_REQ_IDLE; + break; + case GZP_ID_REQ_PENDING_AND_REJECTED: + tx_payload[GZP_CMD_HOST_ID_FETCH_RESP_STATUS] = (uint8_t)GZP_ID_RESP_REJECTED; + gzp_id_req_stat = GZP_ID_REQ_IDLE; + break; + case GZP_ID_REQ_PENDING: + default: + tx_payload[GZP_CMD_HOST_ID_FETCH_RESP_STATUS] = (uint8_t)GZP_ID_RESP_PENDING; + break; + } + + tx_payload[0] = (uint8_t)GZP_CMD_HOST_ID_FETCH_RESP; + gzp_add_validation_id(&tx_payload[GZP_CMD_HOST_ID_FETCH_RESP_VALIDATION_ID]); + gzp_crypt(&tx_payload[1], &tx_payload[1], GZP_CMD_HOST_ID_FETCH_RESP_PAYLOAD_LENGTH - 1); + + ASSERT(nrf_gzll_get_error_code() == NRF_GZLL_ERROR_CODE_NO_ERROR); + gzp_preload_ack(tx_payload, GZP_CMD_HOST_ID_FETCH_RESP_PAYLOAD_LENGTH, GZP_DATA_PIPE); + ASSERT(nrf_gzll_get_error_code() == NRF_GZLL_ERROR_CODE_NO_ERROR); + } + } +} + +static void gzp_process_key_update_prepare() +{ + uint8_t tx_payload[GZP_CMD_KEY_UPDATE_PREPARE_RESP_PAYLOAD_LENGTH]; + + tx_payload[0] = (uint8_t)GZP_CMD_KEY_UPDATE_PREPARE_RESP; + + gzp_get_session_counter(&tx_payload[GZP_CMD_KEY_UPDATE_PREPARE_RESP_SESSION_TOKEN]); + + // Update session token if no ID request is pending + if(!gzp_id_req_received()) + { + gzp_crypt_set_session_token(&tx_payload[GZP_CMD_KEY_UPDATE_PREPARE_RESP_SESSION_TOKEN]); + } + + gzp_preload_ack(tx_payload, GZP_CMD_KEY_UPDATE_PREPARE_RESP_PAYLOAD_LENGTH, GZP_DATA_PIPE); + ASSERT(nrf_gzll_get_error_code() == NRF_GZLL_ERROR_CODE_NO_ERROR); +} + +static void gzp_process_key_update(uint8_t* rx_payload) +{ + gzp_crypt_select_key(GZP_KEY_EXCHANGE); + gzp_crypt(&rx_payload[1], &rx_payload[1], GZP_CMD_KEY_UPDATE_PAYLOAD_LENGTH - 1); + if(gzp_validate_id(&rx_payload[GZP_CMD_KEY_UPDATE_VALIDATION_ID])) + { + gzp_crypt_set_dyn_key(&rx_payload[GZP_CMD_KEY_UPDATE_NEW_KEY]); + } +} + +static void gzp_process_encrypted_user_data(uint8_t* rx_payload, uint8_t length) +{ + uint8_t tx_payload[GZP_CMD_ENCRYPTED_USER_DATA_RESP_PAYLOAD_LENGTH]; + + if(gzp_id_req_received()) + { + gzp_crypt_select_key(GZP_ID_EXCHANGE); + } + else + { + gzp_crypt_select_key(GZP_DATA_EXCHANGE); + } + + gzp_crypt(&rx_payload[1], &rx_payload[1], length - 1); + if(gzp_validate_id(&rx_payload[GZP_CMD_ENCRYPTED_USER_DATA_VALIDATION_ID])) + { + gzp_encrypted_user_data_length = length - GZP_ENCRYPTED_USER_DATA_PACKET_OVERHEAD; + memcpy((void*)gzp_encrypted_user_data, &rx_payload[GZP_CMD_ENCRYPTED_USER_DATA_PAYLOAD], gzp_encrypted_user_data_length); + } + + // Build response packet + tx_payload[0] = (uint8_t)GZP_CMD_ENCRYPTED_USER_DATA_RESP; + gzp_add_validation_id(&tx_payload[GZP_CMD_ENCRYPTED_USER_DATA_RESP_VALIDATION_ID]); + gzp_crypt(&tx_payload[GZP_CMD_ENCRYPTED_USER_DATA_RESP_VALIDATION_ID], &tx_payload[GZP_CMD_ENCRYPTED_USER_DATA_RESP_VALIDATION_ID], GZP_VALIDATION_ID_LENGTH); + gzp_get_session_counter(&tx_payload[GZP_CMD_ENCRYPTED_USER_DATA_RESP_SESSION_TOKEN]); + + // Update "session token" only if no ID request is pending + if(!gzp_id_req_received()) + { + gzp_crypt_set_session_token(&tx_payload[GZP_CMD_ENCRYPTED_USER_DATA_RESP_SESSION_TOKEN]); + } + + ASSERT(nrf_gzll_get_error_code() == NRF_GZLL_ERROR_CODE_NO_ERROR); + gzp_preload_ack(tx_payload, GZP_CMD_ENCRYPTED_USER_DATA_RESP_PAYLOAD_LENGTH, GZP_DATA_PIPE); + ASSERT(nrf_gzll_get_error_code() == NRF_GZLL_ERROR_CODE_NO_ERROR); +} + +//----------------------------------------------------------------------------- +// Function added during LE1 -> nRF51 port +//----------------------------------------------------------------------------- + +static void gzll_goto_idle() +{ + nrf_gzll_disable(); + while(nrf_gzll_is_enabled()) + {} +} + +static void gzll_tx_fifo_flush(void) +{ + int i; + + for(i = 0; i < NRF_GZLL_CONST_PIPE_COUNT; i++) + { + (void)nrf_gzll_flush_tx_fifo(i); + } +} + +static void gzll_rx_fifo_flush(void) +{ + int i; + + for(i = 0; i < NRF_GZLL_CONST_PIPE_COUNT; i++) + { + (void)nrf_gzll_flush_rx_fifo(i); + } +} + + +/******************************************************************************/ +// Implementation: Gazell callback functions +/******************************************************************************/ + +void nrf_gzll_device_tx_failed(uint32_t pipe, nrf_gzll_device_tx_info_t tx_info) +{ +} + + +void nrf_gzll_device_tx_success(uint32_t pipe, nrf_gzll_device_tx_info_t tx_info) +{ +} + + +void nrf_gzll_disabled(void) +{ +} + + +void nrf_gzll_host_rx_data_ready(uint32_t pipe, nrf_gzll_host_rx_info_t rx_info) +{ + if(pipe == GZP_PAIRING_PIPE) + { + prev_gzp_rx_info = rx_info; + } +} + +/** @} */ +/** @} */ + +#endif diff --git a/components/properitary_rf/gzll/nrf_gzp_host_nrf51.c b/components/properitary_rf/gzll/nrf_gzp_host_nrf51.c new file mode 100644 index 0000000..e2a7ebe --- /dev/null +++ b/components/properitary_rf/gzll/nrf_gzp_host_nrf51.c @@ -0,0 +1,49 @@ +/* Copyright (c) 2009 Nordic Semiconductor. All Rights Reserved. + * + * The information contained herein is confidential 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 + * WARRENTY of ANY KIND is provided. This heading must NOT be removed from + * the file. + * + * $LastChangedRevision: 133 $ + */ + + +#include "nrf_gzp.h" +#include "nrf_nvmc.h" + +/** + * @file + * @brief Implementation of Gazell Pairing Library (gzp), nRF51 specific Host functions. + * @defgroup gzp_source_host_nrf51 Gazell Pairing Host nRF51 specific implementation + * @{ + * @ingroup gzp_04_source + */ + + +void gzp_host_chip_id_read(uint8_t *dst, uint8_t n) +{ + uint8_t i; + uint8_t random_number; + + if( *((uint8_t*)(GZP_PARAMS_STORAGE_ADR + GZP_HOST_ID_LENGTH + 1)) == 0xff) + { + nrf_nvmc_write_byte((GZP_PARAMS_STORAGE_ADR + GZP_HOST_ID_LENGTH + 1) , 0x00); + + for(i = 0; i < n; i++) + { + gzp_random_numbers_generate(&random_number, 1); + nrf_nvmc_write_byte((GZP_PARAMS_STORAGE_ADR + GZP_HOST_ID_LENGTH + 2 + i) , random_number); + } + } + + for(i = 0; i < n; i++) + { + *(dst++) = *((uint8_t*)(GZP_PARAMS_STORAGE_ADR + GZP_HOST_ID_LENGTH + 2 + i)); + } +} + +/** @} */ diff --git a/components/serialization/application/codecs/common/ble_dtm_app.c b/components/serialization/application/codecs/common/ble_dtm_app.c new file mode 100644 index 0000000..e58198a --- /dev/null +++ b/components/serialization/application/codecs/common/ble_dtm_app.c @@ -0,0 +1,73 @@ +/* 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 +#include "app_error.h" +#include "ble_dtm_app.h" +#include "ble_serialization.h" +#include "nrf_error.h" +#include "ser_config.h" +#include "ser_hal_transport.h" +#include "ser_sd_transport.h" + + +static uint32_t dtm_init_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_dtm_init_rsp_dec(p_buffer, length, &result_code); + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t ble_dtm_init(app_uart_stream_comm_params_t * p_uart_comm_params) +{ + if (p_uart_comm_params == NULL) + { + return NRF_ERROR_NULL; + } + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = 0; + + uint8_t * p_tx_buf = NULL; + uint32_t tx_buf_len = 0; + + err_code = ser_hal_transport_tx_pkt_alloc(&p_tx_buf, (uint16_t *)&tx_buf_len); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + p_tx_buf[index++] = SER_PKT_TYPE_DTM_CMD; + tx_buf_len -= SER_PKT_TYPE_SIZE; + + err_code = ble_dtm_init_req_enc(p_uart_comm_params, &(p_tx_buf[SER_PKT_TYPE_SIZE]), &tx_buf_len); + if (err_code == NRF_SUCCESS) + { + tx_buf_len += SER_PKT_TYPE_SIZE; + + err_code = ser_sd_transport_cmd_write(p_tx_buf, tx_buf_len, dtm_init_rsp_dec); + if (err_code != NRF_SUCCESS) + { + err_code = NRF_ERROR_INTERNAL; + } + } + else + { + err_code = NRF_ERROR_INTERNAL; + } + + return err_code; +} diff --git a/components/serialization/application/codecs/common/ble_dtm_app.h b/components/serialization/application/codecs/common/ble_dtm_app.h new file mode 100644 index 0000000..b3c0423 --- /dev/null +++ b/components/serialization/application/codecs/common/ble_dtm_app.h @@ -0,0 +1,84 @@ +/* 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 BLE_DTM_APP_H__ +#define BLE_DTM_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_common_codecs Application common codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_dtm_app DTM Application command request encoders and command response decoders + * @{ + * @ingroup ser_app_common_codecs + * + * @brief DTM Application command request encoders and command response decoders. + */ + +#include "dtm_uart_params.h" + +/**@brief Encodes @ref ble_dtm_init command request. + * + * @sa @ref nrf51_dtm_init_encoding_sec for packet format, + * @ref ble_dtm_init_rsp_dec for command response decoder. + * + * @param[in] p_uart_comm_params Pointer to UART configuration parameters. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_dtm_init_req_enc(app_uart_stream_comm_params_t const * const p_uart_comm_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + + +/**@brief Decodes response @ref ble_dtm_init command. + * + * @sa @ref nrf51_dtm_init_encoding_sec for packet format, + * @ref ble_dtm_init_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_dtm_init_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + + +/**@brief Function to initializing DTM mode. + * + * @param[in] p_uart_comm_params Pointer to the DTM UART configuration parameters. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + */ +uint32_t ble_dtm_init(app_uart_stream_comm_params_t * p_uart_comm_params); + +/** @} */ +#endif // BLE_DTM_APP_H__ diff --git a/components/serialization/application/codecs/common/ble_dtm_init.c b/components/serialization/application/codecs/common/ble_dtm_init.c new file mode 100644 index 0000000..9d6f4e6 --- /dev/null +++ b/components/serialization/application/codecs/common/ble_dtm_init.c @@ -0,0 +1,56 @@ +/* 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 "ble_dtm_app.h" +#include "ble_serialization.h" +#include "nrf_error.h" + +uint32_t ble_dtm_init_req_enc(app_uart_stream_comm_params_t const * const p_uart_comm_params, uint8_t * const p_buf, uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + SER_ASSERT_NOT_NULL(p_uart_comm_params); + + uint32_t index = 0; + uint32_t buf_len = *p_buf_len; + uint32_t err_code; + + err_code = uint8_t_enc(&p_uart_comm_params->tx_pin_no, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&p_uart_comm_params->rx_pin_no, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&p_uart_comm_params->baud_rate, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_dtm_init_rsp_dec(uint8_t const * const p_buf, uint32_t packet_len, uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t err_code; + uint32_t index = 0; + + err_code = uint32_t_dec(p_buf, packet_len, &index, p_result_code); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT(packet_len == index, NRF_ERROR_INVALID_LENGTH); + + return err_code; +} diff --git a/components/serialization/application/codecs/common/conn_systemreset.c b/components/serialization/application/codecs/common/conn_systemreset.c new file mode 100644 index 0000000..509e3f1 --- /dev/null +++ b/components/serialization/application/codecs/common/conn_systemreset.c @@ -0,0 +1,42 @@ +/* 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 +#include "ble_serialization.h" +#include "ser_hal_transport.h" +#include "ser_sd_transport.h" + + +uint32_t conn_systemreset(void) +{ + uint32_t err_code = NRF_SUCCESS; + uint8_t * p_tx_buf = NULL; + uint32_t tx_buf_len = 0; + + err_code = ser_hal_transport_tx_pkt_alloc(&p_tx_buf, (uint16_t *)&tx_buf_len); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + SER_ASSERT_LENGTH_LEQ(SER_PKT_TYPE_SIZE, tx_buf_len); + p_tx_buf[SER_PKT_TYPE_POS] = SER_PKT_TYPE_RESET_CMD; + tx_buf_len = SER_PKT_TYPE_SIZE; + + err_code = ser_sd_transport_cmd_write(p_tx_buf, tx_buf_len, NULL); + if (err_code != NRF_SUCCESS) + { + err_code = NRF_ERROR_INTERNAL; + } + + return err_code; +} diff --git a/components/serialization/application/codecs/common/conn_systemreset.h b/components/serialization/application/codecs/common/conn_systemreset.h new file mode 100644 index 0000000..f573418 --- /dev/null +++ b/components/serialization/application/codecs/common/conn_systemreset.h @@ -0,0 +1,43 @@ +/* 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 CONN_SYSTEMRESET_H__ +#define CONN_SYSTEMRESET_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_common_codecs Application common codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup conn_systemreset Connectivity chip reset command request encoder. + * @{ + * @ingroup ser_app_common_codecs + * + * @brief Connectivity chip reset command request encoder. + */ + +/**@brief Function for performing the connectivity chip reset. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_INTERNAL Encoding failure. Transport error. + */ +uint32_t conn_systemreset(void); + +/** @} */ +#endif // CONN_SYSTEMRESET_H__ diff --git a/components/serialization/application/codecs/s110/middleware/app_mw_ble.c b/components/serialization/application/codecs/s110/middleware/app_mw_ble.c new file mode 100644 index 0000000..51c73c3 --- /dev/null +++ b/components/serialization/application/codecs/s110/middleware/app_mw_ble.c @@ -0,0 +1,501 @@ +/* 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 "ble.h" +#include "ble_serialization.h" +#include +#include "ble_app.h" +#include "ser_sd_transport.h" +#include "app_error.h" +#include "app_ble_user_mem.h" + +extern ser_ble_user_mem_t m_app_user_mem_table[]; + +/**@brief Structure containing @ref sd_ble_uuid_encode output parameters. */ +typedef struct +{ + uint8_t * p_uuid_le_len; /**< @ref sd_ble_uuid_encode appearance p_uuid_le_len output parameter. */ + uint8_t * p_uuid_le; /**< @ref sd_ble_uuid_encode appearance p_uuid_le output parameter. */ +} ble_uuid_encode_out_params_t; + +/**@brief Structure containing @ref sd_ble_tx_buffer_count_get output parameters. */ +typedef struct +{ + uint8_t * p_count; /**< @ref sd_ble_tx_buffer_count_get p_count output parameter. */ +} ble_tx_buffer_count__get_out_params_t; + +/**@brief Structure containing @ref sd_ble_user_mem_reply output parameters. */ +typedef struct +{ + uint16_t conn_handle; /**< @ref sd_ble_user_mem_reply conn_handle. */ + uint8_t context_allocated; /**< @ref sd_ble_user_mem_reply user memory context allocated flag. */ +} ble_user_mem_reply_out_params_t; + +/**@brief Union containing BLE command output parameters. */ +typedef union +{ + ble_uuid_encode_out_params_t ble_uuid_encode_out_params; /**< @ref sd_ble_uuid_encode output parameters. */ + ble_tx_buffer_count__get_out_params_t ble_tx_buffer_count_get_out_params; /**< @ref sd_ble_uuid_encode output parameters. */ + ble_user_mem_reply_out_params_t ble_user_mem_reply_out_params; /**< @ref sd_ble_user_mem_reply output parameters. */ +} ble_command_output_params_t; + +static ble_command_output_params_t m_output_params; /**< BLE command output parameters. */ + +static void * mp_out_params[3]; +static uint32_t m_uint32_param; + +static void tx_buf_alloc(uint8_t * * p_data, uint32_t * p_len) +{ + uint32_t err_code; + uint16_t len16; + + do + { + err_code = ser_sd_transport_tx_alloc(p_data, &len16); + } + while (err_code != NRF_SUCCESS); + + *p_data[0] = SER_PKT_TYPE_CMD; + *p_len = (uint32_t)len16 - 1; +} + +/**@brief Command response callback function for @ref sd_ble_uuid_encode BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t uuid_encode_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = + ble_uuid_encode_rsp_dec(p_buffer, + length, + m_output_params.ble_uuid_encode_out_params.p_uuid_le_len, + m_output_params.ble_uuid_encode_out_params.p_uuid_le, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + return result_code; +} + + +uint32_t sd_ble_uuid_encode(ble_uuid_t const * const p_uuid, + uint8_t * const p_uuid_le_len, + uint8_t * const p_uuid_le) +{ + uint8_t * p_buffer; + uint32_t buffer_length; + + tx_buf_alloc(&p_buffer, &buffer_length); + + m_output_params.ble_uuid_encode_out_params.p_uuid_le_len = p_uuid_le_len; + m_output_params.ble_uuid_encode_out_params.p_uuid_le = p_uuid_le; + + uint32_t err_code = ble_uuid_encode_req_enc(p_uuid, + p_uuid_le_len, + p_uuid_le, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + uuid_encode_rsp_dec); + +} + +/**@brief Command response callback function for @ref sd_ble_tx_buffer_count_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t tx_buffer_count_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_tx_buffer_count_get_rsp_dec(p_buffer, + length, + (uint8_t * *)&mp_out_params[0], + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + return result_code; +} + +uint32_t sd_ble_tx_buffer_count_get(uint8_t * p_count) +{ + uint8_t * p_buffer; + uint32_t buffer_length; + + tx_buf_alloc(&p_buffer, &buffer_length); + mp_out_params[0] = p_count; + + const uint32_t err_code = ble_tx_buffer_count_get_req_enc(p_count, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + tx_buffer_count_get_rsp_dec); + +} + +/**@brief Command response callback function for @ref sd_ble_uuid_vs_add BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t uuid_vs_add_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_uuid_vs_add_rsp_dec(p_buffer, + length, + (uint8_t * *)&mp_out_params[0], + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + return result_code; +} + +uint32_t sd_ble_uuid_vs_add(ble_uuid128_t const * const p_vs_uuid, uint8_t * const p_uuid_type) +{ + uint8_t * p_buffer; + uint32_t buffer_length; + + tx_buf_alloc(&p_buffer, &buffer_length); + mp_out_params[0] = p_uuid_type; + + const uint32_t err_code = ble_uuid_vs_add_req_enc(p_vs_uuid, p_uuid_type, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + uuid_vs_add_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_uuid_decode BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t uuid_decode_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_uuid_decode_rsp_dec(p_buffer, + length, + (ble_uuid_t * *)&mp_out_params[0], + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + return result_code; +} + +uint32_t sd_ble_uuid_decode(uint8_t uuid_le_len, + uint8_t const * const p_uuid_le, + ble_uuid_t * const p_uuid) +{ + uint8_t * p_buffer; + uint32_t buffer_length; + + tx_buf_alloc(&p_buffer, &buffer_length); + mp_out_params[0] = p_uuid; + + const uint32_t err_code = ble_uuid_decode_req_enc(uuid_le_len, p_uuid_le, p_uuid, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + uuid_decode_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_version_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t version_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_version_get_rsp_dec(p_buffer, + length, + (ble_version_t *)mp_out_params[0], + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + return result_code; +} + +uint32_t sd_ble_version_get(ble_version_t * p_version) +{ + uint8_t * p_buffer; + uint32_t buffer_length; + + tx_buf_alloc(&p_buffer, &buffer_length); + mp_out_params[0] = p_version; + + const uint32_t err_code = ble_version_get_req_enc(p_version, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + version_get_rsp_dec); + +} + +/**@brief Command response callback function for @ref sd_ble_opt_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t opt_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + uint32_t uint32_param; + + uint32_t err_code = ble_opt_get_rsp_dec(p_buffer, + length, + &uint32_param, + (ble_opt_t *)mp_out_params[0], + &result_code); + + APP_ERROR_CHECK(err_code); + if (m_uint32_param != uint32_param) // decoded id should be the same as encoded one + { + err_code = NRF_ERROR_INVALID_PARAM; + } + APP_ERROR_CHECK(err_code); + + return result_code; +} + +uint32_t sd_ble_opt_get(uint32_t opt_id, ble_opt_t *p_opt) +{ + uint8_t * p_buffer; + uint32_t buffer_length; + + tx_buf_alloc(&p_buffer, &buffer_length); + mp_out_params[0] = p_opt; + m_uint32_param = opt_id; + + const uint32_t err_code = ble_opt_get_req_enc(opt_id, + p_opt, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + opt_get_rsp_dec); + +} + +/**@brief Command response callback function for @ref sd_ble_opt_set BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t opt_set_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_opt_set_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + +uint32_t sd_ble_opt_set(uint32_t opt_id, ble_opt_t const *p_opt) +{ + uint8_t * p_buffer; + uint32_t buffer_length; + + tx_buf_alloc(&p_buffer, &buffer_length); + + const uint32_t err_code = ble_opt_set_req_enc(opt_id, + p_opt, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + opt_set_rsp_dec); + +} + +/**@brief Command response callback function for @ref sd_ble_enable BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t enable_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_enable_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + return result_code; +} + +uint32_t sd_ble_enable(ble_enable_params_t * p_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length; + + tx_buf_alloc(&p_buffer, &buffer_length); + mp_out_params[0] = p_params; + + const uint32_t err_code = ble_enable_req_enc(p_params, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + enable_rsp_dec); + +} + +/**@brief Command response callback function for @ref sd_ble_user_mem_reply BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t user_mem_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + uint32_t err_code = ble_user_mem_reply_rsp_dec(p_buffer, + length, + &result_code); + APP_ERROR_CHECK(err_code); + + if ((result_code != NRF_SUCCESS) && + (m_output_params.ble_user_mem_reply_out_params.context_allocated)) + { + err_code = app_ble_user_mem_context_destroy( + m_output_params.ble_user_mem_reply_out_params.conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + + return result_code; +} + +uint32_t sd_ble_user_mem_reply(uint16_t conn_handle, ble_user_mem_block_t const *p_block) +{ + uint8_t * p_buffer; + uint32_t buffer_length, user_mem_table_index; + uint32_t err_code = NRF_SUCCESS; + + tx_buf_alloc(&p_buffer, &buffer_length); + + // Prepare User Memory Block context for later synchronization when SoftDevice updates + // the data in the memory block + if(p_block != NULL) + { + err_code = app_ble_user_mem_context_create(conn_handle, &user_mem_table_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + m_app_user_mem_table[user_mem_table_index].mem_block.len = p_block->len; + m_app_user_mem_table[user_mem_table_index].mem_block.p_mem = p_block->p_mem; + // Save connection handle and context allocation flag for case if context destroy was needed + m_output_params.ble_user_mem_reply_out_params.conn_handle = conn_handle; + m_output_params.ble_user_mem_reply_out_params.context_allocated = 1; + } + else + { + m_output_params.ble_user_mem_reply_out_params.context_allocated = 0; + } + + err_code = ble_user_mem_reply_req_enc(conn_handle, + p_block, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + user_mem_reply_rsp_dec); +} diff --git a/components/serialization/application/codecs/s110/middleware/app_mw_ble_gap.c b/components/serialization/application/codecs/s110/middleware/app_mw_ble_gap.c new file mode 100644 index 0000000..9fc4660 --- /dev/null +++ b/components/serialization/application/codecs/s110/middleware/app_mw_ble_gap.c @@ -0,0 +1,1286 @@ +/* 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 "ble_gap.h" +#include +#include +#include "ble_serialization.h" +#include "ser_sd_transport.h" +#include "ser_config.h" +#include "ble_gap_app.h" +#include "app_error.h" +#include "app_ble_gap_sec_keys.h" + +extern ser_ble_gap_app_keyset_t m_app_keys_table[SER_MAX_CONNECTIONS]; +/**@brief Structure containing @ref sd_ble_gap_device_name_get output parameters. */ +typedef struct +{ + uint8_t * p_dev_name; /**< @ref sd_ble_gap_device_name_get p_dev_name output parameter. */ + uint16_t * p_len; /**< @ref sd_ble_gap_device_name_get p_len output parameter. */ +} gap_device_name_get_output_params_t; + +/**@brief Structure containing @ref sd_ble_gap_appearance_get output parameters. */ +typedef struct +{ + uint16_t * p_appearance; /**< @ref sd_ble_gap_appearance_get p_appearance output parameter. */ +} gap_appearance_get_output_params_t; + +/**@brief Structure containing @ref sd_ble_gap_ppcp_get output parameters. */ +typedef struct +{ + ble_gap_conn_params_t * p_conn_params; /**< @ref sd_ble_gap_ppcp_get p_conn_params output parameter. */ +} gap_ppcp_get_out_params_t; + +/**@brief Structure containing @ref sd_ble_gap_sec_params_reply output parameters. */ +typedef struct +{ + ble_gap_sec_keyset_t const * p_sec_keyset; /**< @ref sd_ble_gap_sec_params_reply p_sec_keyset output parameter. */ + uint16_t conn_handle; /**< @ref sd_ble_gap_sec_params_reply p_conn_handle output parameter. */ +} gap_sec_params_reply_out_params_t; + +/**@brief Union containing BLE command output parameters. */ +typedef union +{ + gap_device_name_get_output_params_t gap_device_name_get_out_params; /**< @ref sd_ble_gap_device_name_get output parameters. */ + gap_appearance_get_output_params_t gap_appearance_get_out_params; /**< @ref sd_ble_gap_appearance_get output parameters. */ + gap_ppcp_get_out_params_t gap_ppcp_get_out_params; /**< @ref sd_ble_gap_ppcp_get output parameters. */ + gap_sec_params_reply_out_params_t gap_sec_params_reply_out_params;/**< @ref sd_ble_sec_params_reply output parameters. */ +} gap_command_output_params_t; + +static gap_command_output_params_t m_output_params; /**< BLE command output parameters. */ + +static void * mp_out_params[1]; + +static void tx_buf_alloc(uint8_t * * p_data, uint16_t * p_len) +{ + uint32_t err_code; + + do + { + err_code = ser_sd_transport_tx_alloc(p_data, p_len); + } + while (err_code != NRF_SUCCESS); + *p_data[0] = SER_PKT_TYPE_CMD; + *p_len -= 1; +} +/**@brief Command response callback function for @ref sd_ble_gap_adv_start BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_adv_start_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gap_adv_start_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_adv_start(ble_gap_adv_params_t const * const p_adv_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gap_adv_start_req_enc(p_adv_params, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_adv_start_rsp_dec); +} + + +/**@brief Command response callback function for @ref ble_gap_device_name_get_req_enc BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_device_name_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = + ble_gap_device_name_get_rsp_dec(p_buffer, + length, + m_output_params.gap_device_name_get_out_params.p_dev_name, + m_output_params.gap_device_name_get_out_params.p_len, + &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_device_name_get(uint8_t * const p_dev_name, uint16_t * const p_len) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + m_output_params.gap_device_name_get_out_params.p_dev_name = p_dev_name; + m_output_params.gap_device_name_get_out_params.p_len = p_len; + + const uint32_t err_code = ble_gap_device_name_get_req_enc(p_dev_name, + p_len, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_device_name_get_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_appearance_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_appearance_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = + ble_gap_appearance_get_rsp_dec(p_buffer, + length, + m_output_params.gap_appearance_get_out_params.p_appearance, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_appearance_get(uint16_t * const p_appearance) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + m_output_params.gap_appearance_get_out_params.p_appearance = p_appearance; + + const uint32_t err_code = ble_gap_appearance_get_req_enc(p_appearance, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_appearance_get_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_device_name_set BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_device_name_set_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gap_device_name_set_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_device_name_set(ble_gap_conn_sec_mode_t const * const p_write_perm, + uint8_t const * const p_dev_name, + uint16_t len) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_device_name_set_req_enc(p_write_perm, + p_dev_name, + len, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_device_name_set_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_appearance_set BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_appearance_set_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gap_appearance_set_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_appearance_set(uint16_t appearance) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_appearance_set_req_enc(appearance, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_appearance_set_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_ppcp_set BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_ppcp_set_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gap_ppcp_set_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + + return result_code; +} + + +uint32_t sd_ble_gap_ppcp_set(ble_gap_conn_params_t const * const p_conn_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_ppcp_set_req_enc(p_conn_params, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_ppcp_set_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_adv_data_set BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_adv_data_set_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gap_adv_data_set_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_adv_data_set(uint8_t const * const p_data, + uint8_t dlen, + uint8_t const * const p_sr_data, + uint8_t srdlen) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_adv_data_set_req_enc(p_data, + dlen, + p_sr_data, + srdlen, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_adv_data_set_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_conn_param_update BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_conn_param_update_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gap_conn_param_update_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_conn_param_update(uint16_t conn_handle, + ble_gap_conn_params_t const * const p_conn_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_conn_param_update_req_enc(conn_handle, + p_conn_params, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_conn_param_update_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_disconnect BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_disconnect_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gap_disconnect_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_disconnect(uint16_t conn_handle, uint8_t hci_status_code) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_disconnect_req_enc(conn_handle, + hci_status_code, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_disconnect_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_sec_info_reply BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_sec_info_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gap_sec_info_reply_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + +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) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_sec_info_reply_req_enc(conn_handle, + p_enc_info, + p_id_info, + p_sign_info, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_sec_info_reply_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_sec_params_reply BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_sec_params_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + uint32_t err_code = ble_gap_sec_params_reply_rsp_dec(p_buffer, length, + m_output_params.gap_sec_params_reply_out_params.p_sec_keyset, &result_code); + APP_ERROR_CHECK(err_code); + + // If soft device returned error free security context + if (result_code) + { + err_code = app_ble_gap_sec_context_destroy(m_output_params.gap_sec_params_reply_out_params.conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + + return result_code; +} + + +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) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + uint32_t sec_tab_index = 0; + uint32_t err_code = NRF_SUCCESS; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + m_output_params.gap_sec_params_reply_out_params.p_sec_keyset = p_sec_keyset; + m_output_params.gap_sec_params_reply_out_params.conn_handle = conn_handle; + + // First allocate security context for serialization + if (p_sec_keyset) + { + err_code = app_ble_gap_sec_context_create(conn_handle, &sec_tab_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + memcpy(&(m_app_keys_table[sec_tab_index].keyset), p_sec_keyset, sizeof(ble_gap_sec_keyset_t)); + } + + err_code = ble_gap_sec_params_reply_req_enc(conn_handle, + sec_status, + p_sec_params, + p_sec_keyset, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_sec_params_reply_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_ppcp_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_ppcp_get_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_ppcp_get_rsp_dec( + p_buffer, + length, + m_output_params.gap_ppcp_get_out_params. + p_conn_params, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_ppcp_get(ble_gap_conn_params_t * const p_conn_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + m_output_params.gap_ppcp_get_out_params.p_conn_params = p_conn_params; + + const uint32_t err_code = ble_gap_ppcp_get_req_enc(p_conn_params, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_ppcp_get_reply_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_address_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_address_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_address_get_rsp_dec(p_buffer, + length, + (ble_gap_addr_t *)mp_out_params[0], + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_address_get(ble_gap_addr_t * const p_addr) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_addr; + + const uint32_t err_code = ble_gap_address_get_req_enc(p_addr, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + + gap_address_get_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_address_set BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_address_set_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_address_set_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_address_set(uint8_t addr_cycle_mode, ble_gap_addr_t const * const p_addr) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_address_set_req_enc(addr_cycle_mode, + p_addr, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_address_set_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_adv_stop BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_adv_stop_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_adv_stop_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_adv_stop(void) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_adv_stop_req_enc(&(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_adv_stop_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_auth_key_reply BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_auth_key_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_auth_key_reply_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_auth_key_reply(uint16_t conn_handle, + uint8_t key_type, + uint8_t const * const key) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_auth_key_reply_req_enc(conn_handle, key_type, key, + &(p_buffer[1]), &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_auth_key_reply_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_authenticate BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_authenticate_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_authenticate_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_authenticate(uint16_t conn_handle, + ble_gap_sec_params_t const * const p_sec_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_authenticate_req_enc(conn_handle, p_sec_params, + &(p_buffer[1]), &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_authenticate_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_conn_sec_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_conn_sec_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_conn_sec_get_rsp_dec( + p_buffer, + length, + (ble_gap_conn_sec_t * *)&mp_out_params[0 + ], + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_conn_sec_get(uint16_t conn_handle, ble_gap_conn_sec_t * const p_conn_sec) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_conn_sec; + + const uint32_t err_code = ble_gap_conn_sec_get_req_enc(conn_handle, p_conn_sec, + &(p_buffer[1]), &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_conn_sec_get_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_rssi_start BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_rssi_start_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_rssi_start_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_rssi_start(uint16_t conn_handle, uint8_t threshold_dbm, uint8_t skip_count) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_rssi_start_req_enc(conn_handle, + threshold_dbm, + skip_count, + &(p_buffer[1]), &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_rssi_start_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_rssi_stop BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_rssi_stop_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_rssi_stop_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_rssi_stop(uint16_t conn_handle) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_rssi_stop_req_enc(conn_handle, + &(p_buffer[1]), &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_rssi_stop_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_tx_power_set BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_tx_power_set_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_tx_power_set_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_tx_power_set(int8_t tx_power) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_tx_power_set_req_enc(tx_power, + &(p_buffer[1]), &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_tx_power_set_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_connect BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_connect_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_connect_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_connect(ble_gap_addr_t const * const p_addr, + ble_gap_scan_params_t const * const p_scan_params, + ble_gap_conn_params_t const * const p_conn_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_connect_req_enc(p_addr, + p_scan_params, + p_conn_params, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_connect_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_connect_cancel BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_connect_cancel_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_connect_cancel_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_connect_cancel(void) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_connect_cancel_req_enc(&(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_connect_cancel_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_encrypt BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_encrypt_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_encrypt_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +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) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_encrypt_req_enc( conn_handle, p_master_id, p_enc_info, &(p_buffer[1]), &buffer_length ); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_encrypt_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_rssi_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_rssi_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_rssi_get_rsp_dec(p_buffer, + length, + (int8_t *) mp_out_params[0], + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_rssi_get(uint16_t conn_handle, + int8_t * p_rssi) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_rssi; + + const uint32_t err_code = ble_gap_rssi_get_req_enc(conn_handle, p_rssi, &(p_buffer[1]), &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_rssi_get_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_scan_start BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_scan_start_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_scan_start_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_scan_start(ble_gap_scan_params_t const * const p_scan_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_scan_start_req_enc(p_scan_params, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_scan_start_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_scan_stop BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_scan_stop_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_scan_stop_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_scan_stop(void) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_scan_stop_req_enc(&(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_scan_stop_rsp_dec); +} + diff --git a/components/serialization/application/codecs/s110/middleware/app_mw_ble_gattc.c b/components/serialization/application/codecs/s110/middleware/app_mw_ble_gattc.c new file mode 100644 index 0000000..26cfab9 --- /dev/null +++ b/components/serialization/application/codecs/s110/middleware/app_mw_ble_gattc.c @@ -0,0 +1,426 @@ +/* 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 +#include "ble_gattc.h" +#include "ble_gattc_app.h" +#include "ble_serialization.h" +#include "ser_sd_transport.h" +#include "app_error.h" + +static void tx_buf_alloc(uint8_t * * p_data, uint16_t * p_len) +{ + uint32_t err_code; + + do + { + err_code = ser_sd_transport_tx_alloc(p_data, p_len); + } + while (err_code != NRF_SUCCESS); + *p_data[0] = SER_PKT_TYPE_CMD; + *p_len -= 1; +} +/**@brief Command response callback function for @ref sd_ble_gattc_primary_services_discover BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gattc_primary_services_discover_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gattc_primary_services_discover_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gattc_primary_services_discover(uint16_t conn_handle, + uint16_t start_handle, + ble_uuid_t const * const p_srvc_uuid) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gattc_primary_services_discover_req_enc(conn_handle, + start_handle, + p_srvc_uuid, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gattc_primary_services_discover_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gattc_relationships_discover BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gattc_relationships_discover_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gattc_relationships_discover_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gattc_relationships_discover(uint16_t conn_handle, + ble_gattc_handle_range_t const * const p_handle_range) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gattc_relationships_discover_req_enc(conn_handle, + p_handle_range, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gattc_relationships_discover_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gattc_characteristics_discover BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gattc_characteristics_discover_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gattc_characteristics_discover_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gattc_characteristics_discover( + uint16_t conn_handle, + ble_gattc_handle_range_t const * const + p_handle_range) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gattc_characteristics_discover_req_enc(conn_handle, + p_handle_range, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gattc_characteristics_discover_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gattc_descriptors_discover BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gattc_descriptors_discover_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gattc_descriptors_discover_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gattc_descriptors_discover(uint16_t conn_handle, + ble_gattc_handle_range_t const * const p_handle_range) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gattc_descriptors_discover_req_enc(conn_handle, + p_handle_range, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gattc_descriptors_discover_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gattc_char_value_by_uuid_read BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gattc_char_value_by_uuid_read_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gattc_char_value_by_uuid_read_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gattc_char_value_by_uuid_read(uint16_t conn_handle, + ble_uuid_t const * const p_uuid, + ble_gattc_handle_range_t const * const p_handle_range) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gattc_char_value_by_uuid_read_req_enc(conn_handle, + p_uuid, + p_handle_range, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gattc_char_value_by_uuid_read_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gattc_read BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gattc_read_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gattc_read_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gattc_read(uint16_t conn_handle, + uint16_t handle, + uint16_t offset) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gattc_read_req_enc(conn_handle, + handle, + offset, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gattc_read_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gattc_char_values_read BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gattc_char_values_read_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gattc_char_values_read_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gattc_char_values_read(uint16_t conn_handle, + uint16_t const * const p_handles, + uint16_t handle_count) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gattc_char_values_read_req_enc(conn_handle, + p_handles, + handle_count, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gattc_char_values_read_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gattc_write BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gattc_write_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gattc_write_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gattc_write(uint16_t conn_handle, + ble_gattc_write_params_t const * const p_write_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gattc_write_req_enc(conn_handle, + p_write_params, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gattc_write_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gattc_hv_confirm BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gattc_hv_confirm_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gattc_hv_confirm_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gattc_hv_confirm(uint16_t conn_handle, + uint16_t handle) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gattc_hv_confirm_req_enc(conn_handle, + handle, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gattc_hv_confirm_rsp_dec); +} diff --git a/components/serialization/application/codecs/s110/middleware/app_mw_ble_gatts.c b/components/serialization/application/codecs/s110/middleware/app_mw_ble_gatts.c new file mode 100644 index 0000000..abc1120 --- /dev/null +++ b/components/serialization/application/codecs/s110/middleware/app_mw_ble_gatts.c @@ -0,0 +1,571 @@ +/* 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 "ble_gatts.h" +#include +#include "ble_serialization.h" +#include "ser_sd_transport.h" +#include "ble_gatts_app.h" +#include "app_error.h" + + +//Pointer for sd calls output params +static void * mp_out_params[3]; + +static void tx_buf_alloc(uint8_t * * p_data, uint16_t * p_len) +{ + uint32_t err_code; + + do + { + err_code = ser_sd_transport_tx_alloc(p_data, p_len); + } + while (err_code != NRF_SUCCESS); + *p_data[0] = SER_PKT_TYPE_CMD; + *p_len -= 1; +} + +/**@brief Command response callback function for @ref sd_ble_gatts_sys_attr_set BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_sys_attr_set_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gatts_sys_attr_set_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gatts_sys_attr_set(uint16_t conn_handle, + uint8_t const * const p_sys_attr_data, + uint16_t len, + uint32_t flags) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gatts_sys_attr_set_req_enc(conn_handle, + p_sys_attr_data, + len, + flags, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_sys_attr_set_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gatts_hvx BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_hvx_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gatts_hvx_rsp_dec(p_buffer, length, &result_code, + (uint16_t * *)&mp_out_params[0]); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gatts_hvx(uint16_t conn_handle, ble_gatts_hvx_params_t const * const p_hvx_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = (p_hvx_params) ? p_hvx_params->p_len : NULL; + + const uint32_t err_code = ble_gatts_hvx_req_enc(conn_handle, + p_hvx_params, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_hvx_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gatts_service_add BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_service_add_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = + ble_gatts_service_add_rsp_dec(p_buffer, + length, + (uint16_t *)mp_out_params[0], + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gatts_service_add(uint8_t type, + ble_uuid_t const * const p_uuid, + uint16_t * const p_handle) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_handle; + + const uint32_t err_code = ble_gatts_service_add_req_enc(type, + p_uuid, + p_handle, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_service_add_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gatts_service_add BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_service_changed_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = NRF_SUCCESS; + + const uint32_t err_code = ble_gatts_service_changed_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gatts_service_changed(uint16_t conn_handle, + uint16_t start_handle, + uint16_t end_handle) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gatts_service_changed_req_enc(conn_handle, + start_handle, + end_handle, + &(p_buffer[1]), + &buffer_length); + + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_service_changed_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gatts_include_add BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_include_add_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = NRF_SUCCESS; + + const uint32_t err_code = + ble_gatts_include_add_rsp_dec(p_buffer, + length, + (uint16_t *) mp_out_params[0], + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gatts_include_add(uint16_t service_handle, + uint16_t inc_serv_handle, + uint16_t * const p_include_handle) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_include_handle; + + const uint32_t err_code = ble_gatts_include_add_req_enc(service_handle, + inc_serv_handle, + p_include_handle, + &(p_buffer[1]), + &buffer_length); + + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_include_add_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gatts_characteristic_add BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_characteristic_add_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gatts_characteristic_add_rsp_dec( + p_buffer, + length, + (uint16_t * *)&mp_out_params[0], + &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gatts_characteristic_add(uint16_t service_handle, + ble_gatts_char_md_t const * const p_char_md, + ble_gatts_attr_t const * const p_attr_char_value, + ble_gatts_char_handles_t * const p_handles) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_handles; + + const uint32_t err_code = ble_gatts_characteristic_add_req_enc(service_handle, + p_char_md, + p_attr_char_value, + p_handles, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_characteristic_add_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gatts_descriptor_add BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_descriptor_add_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = NRF_SUCCESS; + + const uint32_t err_code = + ble_gatts_descriptor_add_rsp_dec(p_buffer, + length, + (uint16_t *) mp_out_params[0], + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gatts_descriptor_add(uint16_t char_handle, + ble_gatts_attr_t const * const p_attr, + uint16_t * const p_handle) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_handle; + + const uint32_t err_code = ble_gatts_descriptor_add_req_enc(char_handle, + p_attr, + p_handle, + &(p_buffer[1]), + &buffer_length); + + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_descriptor_add_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gatts_rw_authorize_reply BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_rw_authorize_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = NRF_SUCCESS; + + const uint32_t err_code = ble_gatts_rw_authorize_reply_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gatts_rw_authorize_reply( + uint16_t conn_handle, + ble_gatts_rw_authorize_reply_params_t const * const + p_rw_authorize_reply_params) +{ + + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gatts_rw_authorize_reply_req_enc(conn_handle, + p_rw_authorize_reply_params, + &(p_buffer[1]), + &buffer_length); + + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_rw_authorize_reply_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gatts_value_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_value_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gatts_value_get_rsp_dec(p_buffer, + length, + (ble_gatts_value_t *)mp_out_params[0], + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gatts_value_get(uint16_t conn_handle, + uint16_t handle, + ble_gatts_value_t * p_value) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_value; + + const uint32_t err_code = ble_gatts_value_get_req_enc(conn_handle, + handle, + p_value, + &(p_buffer[1]), + &buffer_length); + + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_value_get_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gatts_value_set BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_value_set_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gatts_value_set_rsp_dec( + p_buffer, + length, + (ble_gatts_value_t *)mp_out_params[0], + &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gatts_value_set(uint16_t conn_handle, + uint16_t handle, + ble_gatts_value_t * p_value) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_value; + + const uint32_t err_code = ble_gatts_value_set_req_enc(conn_handle, + handle, + p_value, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_value_set_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gatts_sys_attr_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_sys_attr_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gatts_sys_attr_get_rsp_dec( + p_buffer, + length, + (uint8_t *) mp_out_params[0], + (uint16_t *) mp_out_params[1], + &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gatts_sys_attr_get(uint16_t conn_handle, + uint8_t * const p_sys_attr_data, + uint16_t * const p_len, + uint32_t flags) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_sys_attr_data; + mp_out_params[1] = p_len; + + const uint32_t err_code = ble_gatts_sys_attr_get_req_enc(conn_handle, + p_sys_attr_data, + p_len, + flags, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_sys_attr_get_rsp_dec); +} diff --git a/components/serialization/application/codecs/s110/middleware/app_mw_ble_l2cap.c b/components/serialization/application/codecs/s110/middleware/app_mw_ble_l2cap.c new file mode 100644 index 0000000..436d5a2 --- /dev/null +++ b/components/serialization/application/codecs/s110/middleware/app_mw_ble_l2cap.c @@ -0,0 +1,165 @@ +/* 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 "ble_gap.h" +#include +#include "ble_serialization.h" +#include "ser_sd_transport.h" +#include "ble_l2cap_app.h" +#include "app_error.h" + +static void tx_buf_alloc(uint8_t * * p_data, uint16_t * p_len) +{ + uint32_t err_code; + + do + { + err_code = ser_sd_transport_tx_alloc(p_data, p_len); + } + while (err_code != NRF_SUCCESS); + *p_data[0] = SER_PKT_TYPE_CMD; + *p_len -= 1; +} +/**@brief Command response callback function for @ref ble_l2cap_cid_register_req_enc BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t l2cap_cid_register_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = + ble_l2cap_cid_register_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_l2cap_cid_register(uint16_t cid) +{ + + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_l2cap_cid_register_req_enc(cid, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + l2cap_cid_register_rsp_dec); +} + +/**@brief Command response callback function for @ref ble_l2cap_cid_unregister_req_enc BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t l2cap_cid_unregister_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = + ble_l2cap_cid_unregister_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_l2cap_cid_unregister(uint16_t cid) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_l2cap_cid_unregister_req_enc(cid, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + l2cap_cid_unregister_rsp_dec); +} + +/**@brief Command response callback function for @ref ble_l2cap_tx_req_enc BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t l2cap_tx_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = + ble_l2cap_tx_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_l2cap_tx(uint16_t conn_handle, + ble_l2cap_header_t const * const p_header, + uint8_t const * const p_data) +{ + + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_l2cap_tx_req_enc(conn_handle, p_header, p_data, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + l2cap_tx_rsp_dec); +} + diff --git a/components/serialization/application/codecs/s110/middleware/app_mw_nrf_soc.c b/components/serialization/application/codecs/s110/middleware/app_mw_nrf_soc.c new file mode 100644 index 0000000..6a636c8 --- /dev/null +++ b/components/serialization/application/codecs/s110/middleware/app_mw_nrf_soc.c @@ -0,0 +1,100 @@ +/* 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 "nrf_soc.h" +#include +#include +#include "ser_sd_transport.h" +#include "nrf_soc_app.h" +#include "nrf_error_soc.h" +#include "app_error.h" +#include "ble_serialization.h" + +#include "ser_app_power_system_off.h" + +static void * mp_out_param; + +static void tx_buf_alloc(uint8_t * * p_data, uint16_t * p_len) +{ + uint32_t err_code; + + do + { + err_code = ser_sd_transport_tx_alloc(p_data, p_len); + } + while (err_code != NRF_SUCCESS); + *p_data[0] = SER_PKT_TYPE_CMD; + *p_len -= 1; +} + + +uint32_t sd_power_system_off(void) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = power_system_off_req_enc(&(p_buffer[1]), &buffer_length); + APP_ERROR_CHECK(err_code); + + ser_app_power_system_off_set(); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + NULL); +} + + +/**@brief Command response callback function for @ref sd_temp_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ + +static uint32_t mw_temp_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = temp_get_rsp_dec(p_buffer, + length, + &result_code, + (int32_t *)mp_out_param); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + +uint32_t sd_temp_get(int32_t * p_temp) +{ + mp_out_param = p_temp; + + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = temp_get_req_enc(p_temp, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + mw_temp_get_rsp_dec); +} diff --git a/components/serialization/application/codecs/s110/serializers/app_ble_gap_sec_keys.c b/components/serialization/application/codecs/s110/serializers/app_ble_gap_sec_keys.c new file mode 100644 index 0000000..59bbdae --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/app_ble_gap_sec_keys.c @@ -0,0 +1,74 @@ +/* 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_ble_gap_sec_keys.h" +#include "ser_config.h" +#include "nrf_error.h" +#include + +ser_ble_gap_app_keyset_t m_app_keys_table[SER_MAX_CONNECTIONS]; + +uint32_t app_ble_gap_sec_context_create(uint16_t conn_handle, uint32_t *p_index) +{ + uint32_t err_code = NRF_ERROR_NO_MEM; + uint32_t i; + + for (i=0; i + +/**@brief GAP connection - keyset mapping structure. + * + * @note This structure is used to map keysets to connection instances, and will be stored in a static table. + */ +typedef struct +{ + uint16_t conn_handle; /**< Connection handle.*/ + uint8_t conn_active; /**< Indication that keys for this connection are used by soft device. 0: keys used; 1: keys not used*/ + ble_gap_sec_keyset_t keyset; /**< Keyset structure, see @ref ble_gap_sec_keyset_t.*/ +} ser_ble_gap_app_keyset_t; + +/**@brief allocates instance in m_app_keys_table[] for storage of encryption keys. + * + * @param[in] conn_handle conn_handle + * @param[out] p_index pointer to the index of allocated instance + * + * @retval NRF_SUCCESS Context allocated. + * @retval NRF_ERROR_NO_MEM No free instance available. + */ +uint32_t app_ble_gap_sec_context_create(uint16_t conn_handle, uint32_t *p_index); + +/**@brief release instance identified by a connection handle. + * + * @param[in] conn_handle conn_handle + * + * @retval NRF_SUCCESS Context released. + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t app_ble_gap_sec_context_destroy(uint16_t conn_handle); + +/**@brief finds index of instance identified by a connection handle in m_app_keys_table[]. + * + * @param[in] conn_handle conn_handle + * + * @param[out] p_index Pointer to the index of the entry in the context table corresponding to the given conn_handle + * + * @retval NRF_SUCCESS Context found + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t app_ble_gap_sec_context_find(uint16_t conn_handle, uint32_t *p_index); +/** @} */ + +#endif //_APP_BLE_GAP_SEC_KEYS_H diff --git a/components/serialization/application/codecs/s110/serializers/app_ble_user_mem.c b/components/serialization/application/codecs/s110/serializers/app_ble_user_mem.c new file mode 100644 index 0000000..c476020 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/app_ble_user_mem.c @@ -0,0 +1,74 @@ +/* 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_ble_user_mem.h" +#include "ser_config.h" +#include "nrf_error.h" +#include + +ser_ble_user_mem_t m_app_user_mem_table[SER_MAX_CONNECTIONS]; + +uint32_t app_ble_user_mem_context_create(uint16_t conn_handle, uint32_t *p_index) +{ + uint32_t err_code = NRF_ERROR_NO_MEM; + uint32_t i; + + for (i=0; i + +/**@brief Connection - user memory mapping structure. + * + * @note This structure is used to map user memory to connection instances, and will be stored in a static table. + */ +//lint -esym(452,ser_ble_user_mem_t) +typedef struct +{ + uint16_t conn_handle; /**< Connection handle.*/ + uint8_t conn_active; /**< Indication that user memory for this connection is used by soft device. 0: memory used; 1: memory not used*/ + ble_user_mem_block_t mem_block; /**< User memory block structure, see @ref ble_user_mem_block_t.*/ +} ser_ble_user_mem_t; + +/**@brief allocates instance in m_user_mem_table[] for storage. + * + * @param[in] conn_handle conn_handle + * @param[out] p_index pointer to the index of allocated instance + * + * @retval NRF_SUCCESS Context allocated. + * @retval NRF_ERROR_NO_MEM No free instance available. + */ +uint32_t app_ble_user_mem_context_create(uint16_t conn_handle, uint32_t *p_index); + +/**@brief release instance identified by a connection handle. + * + * @param[in] conn_handle conn_handle + * + * @retval NRF_SUCCESS Context released. + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t app_ble_user_mem_context_destroy(uint16_t conn_handle); + +/**@brief finds index of instance identified by a connection handle in m_user_mem_table[]. + * + * @param[in] conn_handle conn_handle + * + * @param[out] p_index Pointer to the index of the entry in the context table corresponding to the given conn_handle + * + * @retval NRF_SUCCESS Context found + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t app_ble_user_mem_context_find(uint16_t conn_handle, uint32_t *p_index); +/** @} */ + +#endif //_APP_BLE_USER_MEM_H diff --git a/components/serialization/application/codecs/s110/serializers/ble_app.h b/components/serialization/application/codecs/s110/serializers/ble_app.h new file mode 100644 index 0000000..c9852b0 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_app.h @@ -0,0 +1,445 @@ +/* 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. + * + */ +#ifndef BLE_APP_H__ +#define BLE_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s110_codecs Application s110 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_app Application command request encoders and command response decoders + * @{ + * @ingroup ser_app_s110_codecs + * + * @brief Application command request encoders and command response decoders. + */ +#include "ble.h" +/** + * @brief Encodes @ref sd_ble_tx_buffer_count_get command request. + * + * @sa @ref nrf51_tx_buffer_count_get_encoding for packet format, + * @ref ble_tx_buffer_count_get_rsp_dec for command response decoder. + * + * @param[in] p_count Pointer to count value to be filled. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_count will not be updated by the command + * request encoder. Updated values are set by @ref ble_tx_buffer_count_get_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_tx_buffer_count_get_req_enc(uint8_t const * const p_count, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_tx_buffer_count_get command. + * + * @sa @ref nrf51_tx_buffer_count_get_encoding for packet format, + * @ref ble_tx_buffer_count_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_count Pointer to pointer to count value. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_tx_buffer_count_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * * const pp_count, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_uuid_encode command request. + * + * @sa @ref nrf51_uuid_encode_encoding for packet format, + * @ref ble_uuid_encode_rsp_dec for command response decoder. + * + * @param[in] p_uuid Pointer to a @ref ble_uuid_t structure that will be encoded into bytes. + * @param[in] p_uuid_le_len Size of \p p_uuid_le if \p p_uuid_le is not NULL + * @param[in] p_uuid_le Pointer to a buffer where the little endian raw UUID bytes(2 or 16) + * will be stored. Can be NULL to calculate required size. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_uuid_le_len and \p p_uuid_le will not be updated by the command + * request encoder. Updated values are set by @ref ble_uuid_encode_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_uuid_encode_req_enc(ble_uuid_t const * const p_uuid, + uint8_t const * const p_uuid_le_len, + uint8_t const * const p_uuid_le, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_uuid_encode command. + * + * @sa @ref nrf51_uuid_encode_encoding for packet format, + * @ref ble_uuid_encode_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[in,out] p_uuid_le_len \c in: Size (in bytes) of \p p_uuid_le buffer. + * \c out: Length of decoded contents of \p p_uuid_le. + * @param[out] p_uuid_le Pointer to a buffer where the encoded UUID will be stored. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Length of \p p_uuid_le is too small to hold decoded + * value from response. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_uuid_encode_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * const p_uuid_le_len, + uint8_t * const p_uuid_le, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_uuid_decode command request. + * + * @sa @ref nrf51_uuid_decode_encoding for packet format, + * @ref ble_uuid_decode_rsp_dec for command response decoder. + * + * @param[in] uuid_le_len Size of \p p_uuid_le if \p p_uuid_le is not NULL + * @param[in] p_uuid_le Pointer to a buffer where the little endian raw UUID bytes(2 or 16) + * is stored. + * @param[out] p_uuid Pointer to a @ref ble_uuid_t structure were raw UUID will be decoded. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_uuid will not be updated by the command request encoder. + * Updated values are set by @ref ble_uuid_decode_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_uuid_decode_req_enc(uint8_t uuid_le_len, + uint8_t const * const p_uuid_le, + ble_uuid_t * const p_uuid, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_uuid_decode command. + * + * @sa @ref nrf51_uuid_decode_encoding for packet format, + * @ref ble_uuid_decode_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_uuid Pointer to a buffer where the decoded UUID will be stored. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_uuid_decode_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_uuid_t * * const p_uuid, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_uuid_vs_add command request. + * + * @sa @ref nrf51_uuid_vs_add_encoding for packet format, + * @ref ble_uuid_vs_add_rsp_dec for command response decoder. + * + * @param[in] p_vs_uuid Pointer to a @ref ble_uuid128_t structure. + * @param[in] p_uuid_type Pointer to uint8_t where UUID type will be returned. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_uuid_type will not be updated by the command request encoder. + * Updated values are set by @ref ble_uuid_vs_add_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_uuid_vs_add_req_enc(ble_uuid128_t const * const p_vs_uuid, + uint8_t * const p_uuid_type, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_uuid_vs_add command. + * + * @sa @ref nrf51_uuid_vs_add_encoding for packet format, + * @ref ble_uuid_vs_add_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] buf_len Length (in bytes) of response packet. + * @param[out] pp_uuid_type Pointer to a pointer to uint8_t where the decoded UUID type will be stored. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_uuid_vs_add_rsp_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint8_t * * const pp_uuid_type, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_version_get command request. + * + * @sa @ref nrf51_version_get_encoding for packet format, + * @ref ble_version_get_rsp_dec for command response decoder. + * + * @param[in] p_version Pointer to a @ref ble_version_t structure to be filled by the response. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_version_get_req_enc(ble_version_t const * const p_version, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_version_get command. + * + * @sa @ref nrf51_version_get_encoding for packet format, + * @ref ble_version_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_version Pointer to a @ref ble_version_t where decoded version will be stored. + * @param[out] p_result_code Command result code. + * + * @return NRF_SUCCESS Version information stored successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_version_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_version_t * p_version, + uint32_t * const p_result_code); + + +/**@brief Encodes @ref sd_ble_opt_set command request. + * + * @sa @ref nrf51_opt_set_encoding for packet format, + * @ref ble_opt_set_rsp_dec for command response decoder. + * + * @param[in] opt_id Identifies type of parameter in ble_opt_t union. + * @param[in] p_opt Pointer to ble_opt_t union. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Invalid opt id. + */ +uint32_t ble_opt_set_req_enc(uint32_t const opt_id, + ble_opt_t const * const p_opt, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_opt_set command. + * + * @sa @ref nrf51_opt_set_encoding for packet format, + * @ref ble_opt_set_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @return NRF_SUCCESS Version information stored successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_opt_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_enable command request. + * + * @sa @ref nrf51_enable_encoding for packet format, + * @ref ble_enable_rsp_dec for command response decoder. + * + * @param[in] p_ble_enable_params Pointer to a @ref ble_enable_params_t structure. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_enable_req_enc(ble_enable_params_t * p_ble_enable_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_enable command. + * + * @sa @ref nrf51_enable_encoding for packet format, + * @ref ble_enable_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @return NRF_SUCCESS Success. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_enable_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + + +/**@brief Encodes @ref sd_ble_opt_get command request. + * + * @sa @ref nrf51_opt_get_encoding for packet format, + * @ref ble_opt_get_rsp_dec for command response decoder. + * + * @param[in] opt_id Identifies type of parameter in ble_opt_t union. + * @param[in] p_opt Pointer to a @ref ble_opt_t union to be filled by the response. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Invalid opt id. + */ +uint32_t ble_opt_get_req_enc(uint32_t opt_id, + ble_opt_t const * const p_opt, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_opt_get command. + * + * @sa @ref nrf51_opt_get_encoding for packet format, + * @ref ble_opt_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_opt_id Pointer to a decoded opt_id + * @param[out] p_opt Pointer to a decoded @ref ble_opt_t union + * @param[out] p_result_code Command result code. + * + * @return NRF_SUCCESS Opt stored successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + * @retval NRF_ERROR_INVALID_PARAM Invalid opt id. + */ +uint32_t ble_opt_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_opt_id, + ble_opt_t * const p_opt, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_user_mem_reply command request. + * + * @sa @ref nrf51_user_mem_reply_encoding for packet format, + * @ref ble_user_mem_reply_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection Handle. + * @param[in] p_block Pointer to a @ref ble_user_mem_block_t structure. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Invalid opt id. + */ +uint32_t ble_user_mem_reply_req_enc(uint16_t conn_handle, + ble_user_mem_block_t const * p_block, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_user_mem_reply command. + * + * @sa @ref nrf51_user_mem_reply_encoding for packet format, + * @ref ble_user_mem_reply_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @return NRF_SUCCESS Opt stored successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + * @retval NRF_ERROR_INVALID_PARAM Invalid opt id. + */ +uint32_t ble_user_mem_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Event decoding dispatcher. + * + * The event decoding dispatcher will route the event packet to the correct decoder which in turn + * decodes the contents of the event and updates the \p p_event struct. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to beginning of event packet. + * @param[in] packet_len Length (in bytes) of event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + * @retval NRF_ERROR_NOT_FOUND Decoding failure. No event decoder is available. + */ +uint32_t ble_event_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** @} */ +#endif diff --git a/components/serialization/application/codecs/s110/serializers/ble_enable.c b/components/serialization/application/codecs/s110/serializers/ble_enable.c new file mode 100644 index 0000000..c49d68a --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_enable.c @@ -0,0 +1,50 @@ +/* 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 +#include +#include "ble_app.h" +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + + +uint32_t ble_enable_req_enc(ble_enable_params_t * p_ble_enable_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len); + + p_buf[index++] = SD_BLE_ENABLE; + + err_code = cond_field_enc(p_ble_enable_params, p_buf, *p_buf_len, &index, ble_enable_params_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_enable_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_ENABLE, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_event.c b/components/serialization/application/codecs/s110/serializers/ble_event.c new file mode 100644 index 0000000..72bc67e --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_event.c @@ -0,0 +1,238 @@ +/* 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 "ble_app.h" +#include "ble_evt_app.h" +#include "ble_gap_evt_app.h" +#include "ble_gattc_evt_app.h" +#include "ble_gatts_evt_app.h" +#include "ble_l2cap_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_event_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + SER_ASSERT_LENGTH_LEQ(SER_EVT_HEADER_SIZE, packet_len); + + + const uint16_t event_id = uint16_decode(&p_buf[SER_EVT_ID_POS]); + const uint8_t * p_sub_buffer = &p_buf[SER_EVT_HEADER_SIZE]; + const uint32_t sub_packet_len = packet_len - SER_EVT_HEADER_SIZE; + + if (p_event) + { + SER_ASSERT_LENGTH_LEQ(sizeof (ble_evt_hdr_t), *p_event_len); + *p_event_len -= sizeof (ble_evt_hdr_t); + } + + switch (event_id) + { + case BLE_EVT_TX_COMPLETE: + err_code = ble_evt_tx_complete_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_EVT_USER_MEM_REQUEST: + err_code = ble_evt_user_mem_request_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_EVT_USER_MEM_RELEASE: + err_code = ble_evt_user_mem_release_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GAP_EVT_PASSKEY_DISPLAY: + err_code = ble_gap_evt_passkey_display_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GAP_EVT_AUTH_KEY_REQUEST: + err_code = ble_gap_evt_auth_key_request_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GAP_EVT_CONN_PARAM_UPDATE: + err_code = ble_gap_evt_conn_param_update_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST: + err_code = ble_gap_evt_conn_param_update_request_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GAP_EVT_CONN_SEC_UPDATE: + err_code = ble_gap_evt_conn_sec_update_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GAP_EVT_CONNECTED: + err_code = ble_gap_evt_connected_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GAP_EVT_DISCONNECTED: + err_code = ble_gap_evt_disconnected_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GAP_EVT_TIMEOUT: + err_code = ble_gap_evt_timeout_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GAP_EVT_RSSI_CHANGED: + err_code = ble_gap_evt_rssi_changed_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GAP_EVT_SEC_INFO_REQUEST: + err_code = ble_gap_evt_sec_info_request_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GAP_EVT_SEC_PARAMS_REQUEST: + err_code = ble_gap_evt_sec_params_request_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GAP_EVT_AUTH_STATUS: + err_code = ble_gap_evt_auth_status_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GATTC_EVT_CHAR_DISC_RSP: + err_code = ble_gattc_evt_char_disc_rsp_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP: + err_code = ble_gattc_evt_char_val_by_uuid_read_rsp_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GATTC_EVT_DESC_DISC_RSP: + err_code = ble_gattc_evt_desc_disc_rsp_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP: + err_code = ble_gattc_evt_prim_srvc_disc_rsp_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GATTC_EVT_READ_RSP: + err_code = ble_gattc_evt_read_rsp_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GATTC_EVT_HVX: + err_code = ble_gattc_evt_hvx_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GATTC_EVT_TIMEOUT: + err_code = ble_gattc_evt_timeout_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GATTC_EVT_WRITE_RSP: + err_code = ble_gattc_evt_write_rsp_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GATTC_EVT_CHAR_VALS_READ_RSP: + err_code = ble_gattc_evt_char_vals_read_rsp_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GATTC_EVT_REL_DISC_RSP: + err_code = ble_gattc_evt_rel_disc_rsp_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GATTS_EVT_WRITE: + err_code = ble_gatts_evt_write_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GATTS_EVT_TIMEOUT: + err_code = ble_gatts_evt_timeout_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GATTS_EVT_SC_CONFIRM: + err_code = ble_gatts_evt_sc_confirm_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GATTS_EVT_HVC: + err_code = ble_gatts_evt_hvc_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GATTS_EVT_SYS_ATTR_MISSING: + err_code = ble_gatts_evt_sys_attr_missing_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST: + err_code = ble_gatts_evt_rw_authorize_request_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_L2CAP_EVT_RX: + err_code = ble_l2cap_evt_rx_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GAP_EVT_ADV_REPORT: + err_code = ble_gap_evt_adv_report_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GAP_EVT_SCAN_REQ_REPORT: + err_code = ble_gap_evt_scan_req_report_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GAP_EVT_SEC_REQUEST: + err_code = ble_gap_evt_sec_request_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + default: + err_code = NRF_ERROR_NOT_FOUND; + break; + } + + if (p_event != NULL) + { + p_event->header.evt_id = (err_code == NRF_SUCCESS) ? event_id : 0; + p_event->header.evt_len = (err_code == NRF_SUCCESS) ? + (uint16_t)*p_event_len : 0; + } + *p_event_len += sizeof(ble_evt_hdr_t); + return err_code; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_evt_app.h b/components/serialization/application/codecs/s110/serializers/ble_evt_app.h new file mode 100644 index 0000000..e607fd4 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_evt_app.h @@ -0,0 +1,110 @@ +/* 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 BLE_EVT_APP_H__ +#define BLE_EVT_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s110_codecs Application s110 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_evt_app Application event decoders + * @{ + * @ingroup ser_app_s110_codecs + * + * @brief Application event decoders. + */ +#include "ble.h" + +/** + * @brief Decodes ble_evt_tx_complete event. + * + * @sa @ref nrf51_evt_tx_complete_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_evt_tx_complete_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_evt_user_mem_request event. + * + * @sa @ref nrf51_evt_user_mem_request_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ + uint32_t ble_evt_user_mem_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_evt_user_mem_release event. + * + * @sa @ref nrf51_evt_user_mem_release_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ + uint32_t ble_evt_user_mem_release_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); +/** @} */ +#endif diff --git a/components/serialization/application/codecs/s110/serializers/ble_evt_tx_complete.c b/components/serialization/application/codecs/s110/serializers/ble_evt_tx_complete.c new file mode 100644 index 0000000..4abf73c --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_evt_tx_complete.c @@ -0,0 +1,49 @@ +/* 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 "ble_evt_app.h" +#include "ble_serialization.h" + + +uint32_t ble_evt_tx_complete_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 1, packet_len); + + uint32_t event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_evt_tx_complete_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_EVT_TX_COMPLETE; + p_event->header.evt_len = event_len; + + uint16_dec(p_buf, packet_len, &index, &p_event->evt.common_evt.conn_handle); + uint8_dec(p_buf, packet_len, &index, &p_event->evt.common_evt.params.tx_complete.count); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_evt_user_mem_release.c b/components/serialization/application/codecs/s110/serializers/ble_evt_user_mem_release.c new file mode 100644 index 0000000..aab4fa5 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_evt_user_mem_release.c @@ -0,0 +1,78 @@ +/* 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 "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" +#include "ble_evt_app.h" +#include "app_ble_user_mem.h" + +extern ser_ble_user_mem_t m_app_user_mem_table[]; + +uint32_t ble_evt_user_mem_release_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.common_evt.params.user_mem_release)) + + sizeof (ble_evt_user_mem_release_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + p_event->header.evt_id = BLE_EVT_USER_MEM_RELEASE; + p_event->header.evt_len = event_len; + ble_evt_user_mem_release_t * p_user_mem_rel = &(p_event->evt.common_evt.params.user_mem_release); + + err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.common_evt.conn_handle)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, packet_len, &index, &(p_user_mem_rel->type)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + // Decoding order of mem block is different than structure elements order - length is decoded first + err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_user_mem_rel->mem_block.len)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (p_buf[index++] == SER_FIELD_PRESENT) + { + // Using connection handle find which mem block to release in Application Processor + uint32_t user_mem_table_index; + err_code = app_ble_user_mem_context_find(p_event->evt.common_evt.conn_handle, &user_mem_table_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_user_mem_rel->mem_block.p_mem = m_app_user_mem_table[user_mem_table_index].mem_block.p_mem; + } + else + { + p_user_mem_rel->mem_block.p_mem = NULL; + } + + // Now user memory context can be released + err_code = app_ble_user_mem_context_destroy(p_event->evt.common_evt.conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return err_code; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_evt_user_mem_request.c b/components/serialization/application/codecs/s110/serializers/ble_evt_user_mem_request.c new file mode 100644 index 0000000..9ba8b1b --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_evt_user_mem_request.c @@ -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. + * + */ + +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" +#include "ble_evt_app.h" + +uint32_t ble_evt_user_mem_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.common_evt.params.user_mem_request)) + + sizeof (ble_evt_user_mem_request_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + p_event->header.evt_id = BLE_EVT_USER_MEM_REQUEST; + p_event->header.evt_len = event_len; + + err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.common_evt.conn_handle)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, packet_len, &index, &(p_event->evt.common_evt.params.user_mem_request.type)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return err_code; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_address_get.c b/components/serialization/application/codecs/s110/serializers/ble_gap_address_get.c new file mode 100644 index 0000000..4af2bc4 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_address_get.c @@ -0,0 +1,75 @@ +/* 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 "ble_gap_app.h" +#include +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_address_get_req_enc(ble_gap_addr_t const * const p_address, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_ADDRESS_GET; + p_buf[index++] = (p_address == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_address_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_addr_t * const p_address, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t index = 0; + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, + &index, + packet_len, + SD_BLE_GAP_ADDRESS_GET, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + SER_ASSERT_LENGTH_LEQ(index + 1 + BLE_GAP_ADDR_LEN, packet_len); + SER_ASSERT_NOT_NULL(p_address); + + p_address->addr_type = p_buf[index++]; + memcpy(p_address->addr, &p_buf[index], BLE_GAP_ADDR_LEN); + index += BLE_GAP_ADDR_LEN; + + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_address_set.c b/components/serialization/application/codecs/s110/serializers/ble_gap_address_set.c new file mode 100644 index 0000000..0f0b396 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_address_set.c @@ -0,0 +1,56 @@ +/* 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 "ble_gap_app.h" +#include +#include +#include "ble_serialization.h" +#include "ble_gap.h" +#include "app_util.h" + + +uint32_t ble_gap_address_set_req_enc(uint8_t addr_cycle_mode, + ble_gap_addr_t const * const p_addr, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 1 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_ADDRESS_SET; + p_buf[index++] = addr_cycle_mode; + p_buf[index++] = (p_addr == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + if (p_addr != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 1 + BLE_GAP_ADDR_LEN, *p_buf_len); + p_buf[index++] = p_addr->addr_type; + memcpy(&p_buf[index], p_addr->addr, BLE_GAP_ADDR_LEN); + index += BLE_GAP_ADDR_LEN; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_address_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_ADDRESS_SET, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_adv_data_set.c b/components/serialization/application/codecs/s110/serializers/ble_gap_adv_data_set.c new file mode 100644 index 0000000..a59f271 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_adv_data_set.c @@ -0,0 +1,52 @@ +/* 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 "ble_gap_app.h" +#include +#include "ble_serialization.h" +#include "nrf_error.h" + + +uint32_t ble_gap_adv_data_set_req_enc(uint8_t const * const p_data, + uint8_t dlen, + uint8_t const * const p_sr_data, + uint8_t srdlen, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint8_t opcode = SD_BLE_GAP_ADV_DATA_SET; + uint32_t err_code; + err_code = uint8_t_enc(&opcode, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = len8data_enc(p_data, dlen, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = len8data_enc(p_sr_data, srdlen, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gap_adv_data_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_ADV_DATA_SET, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_adv_start.c b/components/serialization/application/codecs/s110/serializers/ble_gap_adv_start.c new file mode 100644 index 0000000..115a447 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_adv_start.c @@ -0,0 +1,72 @@ +/* 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 "ble_gap_app.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gap.h" +#include "app_util.h" + +uint32_t ble_gap_adv_start_req_enc(ble_gap_adv_params_t const * const p_adv_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + SER_ASSERT_LENGTH_LEQ(index + 2, total_len); + p_buf[index++] = SD_BLE_GAP_ADV_START; + p_buf[index++] = (p_adv_params == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + if (p_adv_params != NULL) + { + err_code = uint8_t_enc(&(p_adv_params->type), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_adv_params->p_peer_addr, p_buf, total_len, &index, ble_gap_addr_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&(p_adv_params->fp), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_adv_params->p_whitelist, p_buf, total_len, &index, ble_gap_whitelist_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_adv_params->interval), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_adv_params->timeout), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_adv_ch_mask_t_enc(&(p_adv_params->channel_mask), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gap_adv_start_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_ADV_START, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_adv_stop.c b/components/serialization/application/codecs/s110/serializers/ble_gap_adv_stop.c new file mode 100644 index 0000000..c633a4b --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_adv_stop.c @@ -0,0 +1,40 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" + +uint32_t ble_gap_adv_stop_req_enc(uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GAP_ADV_STOP; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gap_adv_stop_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_ADV_STOP, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_app.h b/components/serialization/application/codecs/s110/serializers/ble_gap_app.h new file mode 100644 index 0000000..13c4fd1 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_app.h @@ -0,0 +1,1158 @@ +/* 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. + * + */ +#ifndef BLE_GAP_APP_H__ +#define BLE_GAP_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s110_codecs Application s110 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gap_app GAP Application command request encoders and command response decoders + * @{ + * @ingroup ser_app_s110_codecs + * + * @brief GAP Application command request encoders and command response decoders. + */ +#include "ble.h" +#include "ble_gap.h" + +/** + * @brief Encodes @ref sd_ble_gap_address_get command request. + * + * @sa @ref nrf51_address_get_encoding for packet format, + * @ref ble_gap_address_get_rsp_dec for command response decoder. + * + * @param[in] p_address Pointer to address. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_address will not be updated by the command + * request encoder. Updated values are set by @ref ble_gap_address_get_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_address_get_req_enc(ble_gap_addr_t const * const p_address, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_address_get command. + * + * @sa @ref nrf51_address_get_encoding for packet format, + * @ref ble_gap_address_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_address Pointer to address. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_address_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_addr_t * const p_address, + uint32_t * const p_result_code); + +/** + * @brief Encodes @ref sd_ble_gap_address_set command request. + * + * @sa @ref nrf51_gap_address_set_encoding for packet format, + * @ref ble_gap_address_set_rsp_dec for command response decoder. + * + * @param[in] addr_cycle_mode Address cycle mode. + * @param[in] p_addr Pointer to address structure. + * @param[in,out] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_address_set_req_enc(uint8_t addr_cycle_mode, + ble_gap_addr_t const * const p_addr, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_address_set command. + * + * @sa @ref nrf51_gap_address_set_encoding for packet format, + * @ref ble_gap_address_set_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_address_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/** + * @brief Encodes @ref sd_ble_gap_adv_data_set command request. + * + * @sa @ref nrf51_adv_set_encoding for packet format, + * @ref ble_gap_adv_data_set_rsp_dec for command response decoder. + * + * @param[in] p_data Raw data to be placed in advertisement packet. If NULL, no changes + * are made to the current advertisement 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. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_adv_data_set_req_enc(uint8_t const * const p_data, + uint8_t dlen, + uint8_t const * const p_sr_data, + uint8_t srdlen, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_adv_data_set command. + * + * @sa @ref nrf51_adv_set_encoding for packet format, + * @ref ble_gap_adv_data_set_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_adv_data_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/** + * @brief Encodes @ref sd_ble_gap_adv_start command request. + * + * @sa @ref nrf51_adv_start_encoding for packet format, + * @ref ble_gap_adv_start_rsp_dec for command response decoder. + * + * @param[in] p_adv_params Pointer to advertising parameters structure. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_adv_start_req_enc(ble_gap_adv_params_t const * const p_adv_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_adv_start command. + * + * @sa @ref nrf51_adv_start_encoding for packet format, + * @ref ble_gap_adv_start_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_adv_start_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/** + * @brief Encodes @ref sd_ble_gap_tx_power_set command request. + * + * @sa @ref nrf51_tx_power_set_encoding for packet format, + * @ref ble_gap_tx_power_set_rsp_dec for command response decoder. + * + * @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] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_tx_power_set_req_enc(int8_t tx_power, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_tx_power_set command. + * + * @sa @ref nrf51_tx_power_set_encoding for packet format, + * @ref ble_gap_tx_power_set_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_tx_power_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/** + * @brief Encodes @ref sd_ble_gap_appearance_get command request. + * + * @sa @ref nrf51_appearance_get_encoding for packet format, + * @ref ble_gap_appearance_get_rsp_dec for command response decoder. + * + * @param[in] p_appearance Appearance (16-bit), see @ref BLE_APPEARANCES + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_appearance will not be updated by the command + * request encoder. Updated values are set by @ref ble_gap_appearance_get_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_appearance_get_req_enc(uint16_t const * const p_appearance, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_appearance_get command. + * + * @sa @ref nrf51_appearance_get_encoding for packet format, + * @ref ble_gap_appearance_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_appearance Appearance (16-bit), see @ref BLE_APPEARANCES. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_appearance_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_appearance, + uint32_t * const p_result_code); + +/** + * @brief Encodes @ref sd_ble_gap_appearance_set command request. + * + * @sa @ref nrf51_appearance_set_encoding for packet format, + * @ref ble_gap_appearance_set_rsp_dec for command response decoder. + * + * @param[in] appearance Appearance (16-bit), see @ref BLE_APPEARANCES. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_appearance_set_req_enc(uint16_t appearance, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_appearance_set command. + * + * @sa @ref nrf51_appearance_set_encoding for packet format, + * @ref ble_gap_appearance_set_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_appearance_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/** + * @brief Encodes @ref sd_ble_gap_device_name_get command request. + * + * @sa @ref nrf51_device_name_get_encoding for packet format, + * @ref ble_gap_device_name_get_rsp_dec for command response decoder. + * + * @param[in] 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] p_dev_name_len Length of the buffer pointed by p_dev_name. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_dev_name and \p p_len will not be updated by the command + * request encoder. Updated values are set by @ref ble_gap_device_name_get_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_device_name_get_req_enc(uint8_t const * const p_dev_name, + uint16_t const * const p_dev_name_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_device_name_get command. + * + * @sa @ref nrf51_device_name_get_encoding for packet format, + * @ref ble_gap_device_name_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_dev_name Pointer to an empty buffer where the UTF-8 + * non NULL-terminated string will be placed. + * @param[in,out] p_dev_name_len Length of the buffer pointed by p_dev_name, complete device name + * length on output. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_device_name_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * const p_dev_name, + uint16_t * const p_dev_name_len, + uint32_t * const p_result_code); + +/** + * @brief Encodes @ref sd_ble_gap_device_name_set command request. + * + * @sa @ref nrf51_device_name_set_encoding for packet format, + * @ref ble_gap_device_name_set_rsp_dec for command response decoder. + * + * @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). + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_device_name_set_req_enc(ble_gap_conn_sec_mode_t const * const p_write_perm, + uint8_t const * const p_dev_name, + uint16_t len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_device_name_set command. + * + * @sa @ref nrf51_device_name_set_encoding for packet format, + * @ref ble_gap_device_name_set_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_device_name_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/** + * @brief Encodes @ref sd_ble_gap_ppcp_set command request. + * + * @sa @ref nrf51_ppcp_set_encoding for packet format, + * @ref ble_gap_ppcp_set_rsp_dec for command response decoder. + * + * @param[in] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure with the + * desired parameters. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_ppcp_set_req_enc(ble_gap_conn_params_t const * const p_conn_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_ppcp_set command. + * + * @sa @ref nrf51_ppcp_set_encoding for packet format, + * @ref ble_gap_ppcp_set_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_ppcp_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_conn_param_update command request. + * + * @sa @ref nrf51_gap_conn_param_update_encoding for packet format, + * @ref ble_gap_conn_param_update_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_conn_params Pointer to desired connection parameters.. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_conn_param_update_req_enc(uint16_t conn_handle, + ble_gap_conn_params_t const * const p_conn_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_conn_param_update command. + * + * @sa @ref nrf51_gap_conn_param_update_encoding for packet format, + * @ref ble_gap_conn_param_update_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_conn_param_update_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_disconnect command request. + * + * @sa @ref nrf51_disconnect_encoding for packet format, + * @ref ble_gap_disconnect_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] hci_status_code HCI status code, see @ref BLE_HCI_STATUS_CODES. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_disconnect_req_enc(uint16_t conn_handle, + uint8_t hci_status_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_disconnect command. + * + * @sa @ref nrf51_disconnect_encoding for packet format, + * @ref ble_gap_disconnect_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_disconnect_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + + +/**@brief Encodes @ref sd_ble_gap_rssi_stop command request. + * + * @sa @ref nrf51_rssi_stop_encoding for packet format, + * @ref ble_gap_rssi_stop_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_rssi_stop_req_enc(uint16_t conn_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_rssi_stop command. + * + * @sa @ref nrf51_rssi_stop_encoding for packet format, + * @ref ble_gap_rssi_stop_rsp_dec for command response decoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_rssi_stop_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + + + + +/**@brief Encodes @ref sd_ble_gap_ppcp_get command request. + * + * @sa @ref nrf51_gap_ppcp_get_encoding for packet format, + * @ref ble_gap_ppcp_get_rsp_dec for command response decoder. + * + * @param[in] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure where the + * parameters will be stored. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_conn_params will not be updated by the command request encoder. Updated values are + * set by @ref ble_gap_ppcp_get_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_ppcp_get_req_enc(ble_gap_conn_params_t const * const p_conn_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_ppcp_get command. + * + * @sa @ref nrf51_gap_ppcp_get_encoding for packet format, + * @ref ble_gap_ppcp_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure where the parameters + * will be stored. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_ppcp_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_conn_params_t * const p_conn_params, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_auth_key_reply command request. + * + * @sa @ref nrf51_auth_key_reply_encoding for packet format, + * @ref ble_gap_auth_key_reply_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] key_type Key type which defines length of key data as defined for + * @ref sd_ble_gap_auth_key_reply . + * @param[in] p_key Pointer to a buffer which contains key + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Encoding failure. Incorrect param provided (key_type). + */ +uint32_t ble_gap_auth_key_reply_req_enc(uint16_t conn_handle, + uint8_t key_type, + uint8_t const * const p_key, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_auth_key_reply command. + * + * @sa @ref nrf51_auth_key_reply_encoding for packet format, + * @ref ble_gap_auth_key_reply_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_auth_key_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_sec_info_reply command request. + * + * @sa @ref nrf51_gap_sec_info_reply_encoding for packet format, + * @ref ble_gap_sec_info_reply_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_enc_info Pointer to a @ref ble_gap_enc_info_t encryption information + * structure. + * @param[in] p_id_info Pointer to a @ref ble_gap_irk_t id information + * structure. + * @param[in] p_sign_info Pointer to a @ref ble_gap_sign_info_t signing information + * structure. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_sec_info_reply_req_enc(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, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_sec_info_reply command. + * + * @sa @ref nrf51_gap_sec_info_reply_encoding for packet format, + * @ref ble_gap_sec_info_reply_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_sec_info_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_sec_params_reply command request. + * + * @sa @ref nrf51_sec_params_reply_encoding for packet format, + * @ref ble_gap_sec_params_reply_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] sec_status Security status, see @ref BLE_GAP_SEC_STATUS. + * @param[in] p_sec_params Pointer to @ref ble_gap_sec_params_t security parameters + * structure. + * @param[in] p_sec_keyset Pointer to @ref ble_gap_sec_keyset_t security keys + * structure. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_sec_params_reply_req_enc(uint16_t conn_handle, + uint8_t sec_status, + ble_gap_sec_params_t const * const p_sec_params, + ble_gap_sec_keyset_t const * const p_sec_keyset, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_sec_params_reply command. + * + * @sa @ref nrf51_sec_params_reply_encoding for packet format, + * @ref ble_gap_sec_params_reply_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[in] p_sec_keyset Pointer to @ref ble_gap_sec_keyset_t security keys + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_sec_params_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_sec_keyset_t const * const p_sec_keyset, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_authenticate command request. + * + * @sa @ref nrf51_ble_gap_authenticate_encoding for packet format, + * @ref ble_gap_authenticate_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_sec_params Pointer to a @ref ble_gap_sec_params_t security parameters + * structure. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_authenticate_req_enc(uint16_t conn_handle, + ble_gap_sec_params_t const * const p_sec_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_authenticate command. + * + * @sa @ref nrf51_ble_gap_authenticate_encoding for packet format, + * @ref ble_gap_authenticate_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_authenticate_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_adv_stop command request. + * + * @sa @ref nrf51_sd_ble_gap_adv_stop for packet format, + * @ref ble_gap_adv_stop_rsp_dec for command response decoder. + * + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_adv_stop_req_enc(uint8_t * const p_buf, uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_adv_stop command. + * + * @sa @ref nrf51_sd_ble_gap_adv_stop for packet format, + * @ref ble_gap_adv_stop_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_adv_stop_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_conn_sec_get command request. + * + * @sa @ref nrf51_gap_conn_sec_get_encoding for packet format, + * @ref ble_gap_conn_sec_get_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_conn_sec Pointer to \ref ble_gap_conn_sec_t which will be filled in + * response. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_conn_sec_get_req_enc(uint16_t conn_handle, + ble_gap_conn_sec_t const * const p_conn_sec, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_conn_sec_get command. + * + * @sa @ref nrf51_gap_conn_sec_get_encoding for packet format, + * @ref ble_gap_conn_sec_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_conn_sec Pointer to pointer to \ref ble_gap_conn_sec_t which will be filled by + * the decoded data (if present). + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_conn_sec_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_conn_sec_t * * const pp_conn_sec, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_rssi_start command request. + * + * @sa @ref nrf51_rssi_start_encoding for packet format, + * @ref ble_gap_rssi_start_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] threshold_dbm Threshold in dBm. + * @param[in] skip_count Sample skip count. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_rssi_start_req_enc(uint16_t conn_handle, + uint8_t threshold_dbm, + uint8_t skip_count, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_rssi_start command. + * + * @sa @ref nrf51_rssi_start_encoding for packet format, + * @ref ble_gap_rssi_start_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_rssi_start_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_encrypt command request. + * + * @sa @ref nrf51_gap_encrypt_encoding for packet format, + * @ref ble_gap_encrypt_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle. + * @param[in] p_master_id Pointer to a master identification structure. + * @param[in] p_enc_info Pointer to desired connection parameters. + * @param[in] p_buf Pointer to a ble_gap_enc_info_t encryption information structure. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ + +uint32_t ble_gap_encrypt_req_enc( uint16_t conn_handle, + ble_gap_master_id_t const * const p_master_id, + ble_gap_enc_info_t const * const p_enc_info, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + + +/**@brief Decodes response to @ref sd_ble_gap_encrypt command. + * + * @sa @ref nrf51_gap_encrypt_encoding for packet format, + * @ref ble_gap_encrypt_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_encrypt_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_rssi_get command request. + * + * @sa @ref nrf51_rssi_get_encoding for packet format, + * @ref ble_gap_rssi_get_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle. + * @param[in] p_rssi Pointer to the rssi value. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_rssi_get_req_enc(uint16_t conn_handle, + int8_t const * const p_rssi, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_rssi_get command. + * + * @sa @ref nrf51_rssi_get_encoding for packet format, + * @ref ble_gap_rssi_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_rssi Pointer to rssi value. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_rssi_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + int8_t * const p_rssi, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_connect command request. + * + * @sa @ref nrf51_connect_encoding for packet format, + * @ref ble_gap_connect_rsp_dec for command response decoder. + * + * @param[in] p_peer_addr Pointer to peer address. + * @param[in] p_scan_params Pointer to scan params structure. + * @param[in] p_conn_params Pointer to desired connection parameters. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_connect_req_enc(ble_gap_addr_t const * const p_peer_addr, + ble_gap_scan_params_t const * const p_scan_params, + ble_gap_conn_params_t const * const p_conn_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_connect command. + * + * @sa @ref nrf51_connect_encoding for packet format, + * @ref ble_gap_connect_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_connect_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_connect_cancel command request. + * + * @sa @ref nrf51_connect_cancel_encoding for packet format, + * @ref ble_gap_connect_cancel_rsp_dec for command response decoder. + * + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_connect_cancel_req_enc(uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_connect_cancel command. + * + * @sa @ref nrf51_connect_cancel_encoding for packet format, + * @ref ble_gap_connect_cancel_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_connect_cancel_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_scan_start command request. + * + * @sa @ref nrf51_scan_start_encoding for packet format, + * @ref ble_gap_scan_start_rsp_dec for command response decoder. + * + * @param[in] p_scan_params Pointer to scan params structure. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_scan_start_req_enc(ble_gap_scan_params_t const * p_scan_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_scan_start command. + * + * @sa @ref nrf51_scan_start_encoding for packet format, + * @ref ble_gap_scan_start_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_scan_start_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_scan_stop command request. + * + * @sa @ref nrf51_scan_stop_encoding for packet format, + * @ref ble_gap_scan_stop_rsp_dec for command response decoder. + * + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_scan_stop_req_enc(uint8_t * const p_buf, uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_scan_stop command. + * + * @sa @ref nrf51_scan_stop_encoding for packet format, + * @ref ble_gap_scan_stop_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_scan_stop_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/** @} */ +#endif diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_appearance_get.c b/components/serialization/application/codecs/s110/serializers/ble_gap_appearance_get.c new file mode 100644 index 0000000..cc55dd6 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_appearance_get.c @@ -0,0 +1,70 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_appearance_get_req_enc(uint16_t const * const p_appearance, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_APPEARANCE_GET; + p_buf[index++] = (p_appearance == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_appearance_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_appearance, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t index = 0; + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_GAP_APPEARANCE_GET, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; + } + + SER_ASSERT_LENGTH_LEQ(index + sizeof (uint16_t), packet_len); + + uint16_dec(p_buf, packet_len, &index, p_appearance); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_appearance_set.c b/components/serialization/application/codecs/s110/serializers/ble_gap_appearance_set.c new file mode 100644 index 0000000..8038b76 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_appearance_set.c @@ -0,0 +1,44 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "ble_gap.h" +#include "app_util.h" + + +uint32_t ble_gap_appearance_set_req_enc(uint16_t appearance, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 2, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_APPEARANCE_SET; + index += uint16_encode(appearance, &p_buf[index]); + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_appearance_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_APPEARANCE_SET, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_auth_key_reply.c b/components/serialization/application/codecs/s110/serializers/ble_gap_auth_key_reply.c new file mode 100644 index 0000000..58861e0 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_auth_key_reply.c @@ -0,0 +1,76 @@ +/* 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 "ble_gap_app.h" +#include +#include "ble_serialization.h" +#include "ble_gap.h" +#include "app_util.h" + + +uint32_t ble_gap_auth_key_reply_req_enc(uint16_t conn_handle, + uint8_t key_type, + uint8_t const * const p_key, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t buf_len = *p_buf_len; + uint8_t opcode = SD_BLE_GAP_AUTH_KEY_REPLY; + uint32_t err_code = NRF_SUCCESS; + uint8_t key_len; + + err_code = uint8_t_enc(&opcode, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&key_type, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + switch (key_type) + { + case BLE_GAP_AUTH_KEY_TYPE_NONE: + key_len = 0; + break; + + case BLE_GAP_AUTH_KEY_TYPE_PASSKEY: + key_len = 6; + break; + + case BLE_GAP_AUTH_KEY_TYPE_OOB: + key_len = 16; + break; + + default: + return NRF_ERROR_INVALID_PARAM; + } + + err_code = buf_enc(p_key, key_len, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gap_auth_key_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_AUTH_KEY_REPLY, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_authenticate.c b/components/serialization/application/codecs/s110/serializers/ble_gap_authenticate.c new file mode 100644 index 0000000..028b3f0 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_authenticate.c @@ -0,0 +1,52 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_authenticate_req_enc(uint16_t conn_handle, + ble_gap_sec_params_t const * const p_sec_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(1, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_AUTHENTICATE; + + err_code = uint16_t_enc(&conn_handle, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_sec_params, p_buf, *p_buf_len, &index, ble_gap_sec_params_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gap_authenticate_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_AUTHENTICATE, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_conn_param_update.c b/components/serialization/application/codecs/s110/serializers/ble_gap_conn_param_update.c new file mode 100644 index 0000000..3d81edf --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_conn_param_update.c @@ -0,0 +1,55 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_conn_param_update_req_enc(uint16_t conn_handle, + ble_gap_conn_params_t const * const p_conn_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 2 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_CONN_PARAM_UPDATE; + index += uint16_encode(conn_handle, &p_buf[index]); + + p_buf[index++] = (p_conn_params != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_conn_params != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 1 + 2 * 4, *p_buf_len); + index += uint16_encode(p_conn_params->min_conn_interval, &p_buf[index]); + index += uint16_encode(p_conn_params->max_conn_interval, &p_buf[index]); + index += uint16_encode(p_conn_params->slave_latency, &p_buf[index]); + index += uint16_encode(p_conn_params->conn_sup_timeout, &p_buf[index]); + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_conn_param_update_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_CONN_PARAM_UPDATE, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_conn_sec_get.c b/components/serialization/application/codecs/s110/serializers/ble_gap_conn_sec_get.c new file mode 100644 index 0000000..b3850b1 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_conn_sec_get.c @@ -0,0 +1,74 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "app_util.h" +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" + +uint32_t ble_gap_conn_sec_get_req_enc(uint16_t conn_handle, + ble_gap_conn_sec_t const * const p_conn_sec, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + uint8_t opcode = SD_BLE_GAP_CONN_SEC_GET; + + + err_code = uint8_t_enc(&opcode, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_conn_sec, p_buf, total_len, &index, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gap_conn_sec_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_conn_sec_t * * const pp_conn_sec, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + uint32_t index = 0; + uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_GAP_CONN_SEC_GET, + p_result_code); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_conn_sec, + ble_gap_conn_sec_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_connect.c b/components/serialization/application/codecs/s110/serializers/ble_gap_connect.c new file mode 100644 index 0000000..5f13670 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_connect.c @@ -0,0 +1,54 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" + +uint32_t ble_gap_connect_req_enc(ble_gap_addr_t const * const p_peer_addr, + ble_gap_scan_params_t const * const p_scan_params, + ble_gap_conn_params_t const * const p_conn_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GAP_CONNECT; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_peer_addr, p_buf, buf_len, &index, ble_gap_addr_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_scan_params, p_buf, buf_len, &index, ble_gap_scan_params_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_conn_params, p_buf, buf_len, &index, ble_gap_conn_params_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gap_connect_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_CONNECT, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_connect_cancel.c b/components/serialization/application/codecs/s110/serializers/ble_gap_connect_cancel.c new file mode 100644 index 0000000..0730ade --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_connect_cancel.c @@ -0,0 +1,42 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" + +uint32_t ble_gap_connect_cancel_req_enc(uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GAP_CONNECT_CANCEL; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gap_connect_cancel_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_CONNECT_CANCEL, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_device_name_get.c b/components/serialization/application/codecs/s110/serializers/ble_gap_device_name_get.c new file mode 100644 index 0000000..0d12b4a --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_device_name_get.c @@ -0,0 +1,84 @@ +/* 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 "ble_gap_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_device_name_get_req_enc(uint8_t const * const p_dev_name, + uint16_t const * const p_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 2, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_DEVICE_NAME_GET; + p_buf[index++] = (p_len != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_len != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 2, *p_buf_len); + index += uint16_encode(*p_len, &p_buf[index]); + } + + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + p_buf[index++] = (p_dev_name != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_device_name_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * const p_dev_name, + uint16_t * const p_dev_name_len, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + uint32_t index = 0; + uint32_t status_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_GAP_DEVICE_NAME_GET, + p_result_code); + + if (status_code != NRF_SUCCESS) + { + return status_code; + } + + if (*p_result_code != NRF_SUCCESS) + { + + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_dev_name_len); + status_code = len16data_dec(p_buf, packet_len, &index, (uint8_t * *)&p_dev_name, p_dev_name_len); + + if (status_code != NRF_SUCCESS) + { + return status_code; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return status_code; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_device_name_set.c b/components/serialization/application/codecs/s110/serializers/ble_gap_device_name_set.c new file mode 100644 index 0000000..c265c4f --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_device_name_set.c @@ -0,0 +1,66 @@ +/* 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 "ble_gap_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_device_name_set_req_enc(ble_gap_conn_sec_mode_t const * const p_write_perm, + uint8_t const * const p_dev_name, + uint16_t len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(2, *p_buf_len); + p_buf[index++] = SD_BLE_GAP_DEVICE_NAME_SET; + + p_buf[index++] = (p_write_perm != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_write_perm != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + p_buf[index++] = (uint8_t) ((p_write_perm->sm) | (p_write_perm->lv << 4)); + } + + SER_ERROR_CHECK(len <= BLE_GAP_DEVNAME_MAX_LEN, NRF_ERROR_INVALID_PARAM); + + SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len); + index += uint16_encode(len, &p_buf[index]); + + p_buf[index++] = (p_dev_name != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_dev_name != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + len, *p_buf_len); + memcpy(&p_buf[index], p_dev_name, len); + index += len; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_device_name_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_DEVICE_NAME_SET, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_disconnect.c b/components/serialization/application/codecs/s110/serializers/ble_gap_disconnect.c new file mode 100644 index 0000000..d3064d6 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_disconnect.c @@ -0,0 +1,45 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_disconnect_req_enc(uint16_t conn_handle, + uint8_t hci_status_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 4, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_DISCONNECT; + index += uint16_encode(conn_handle, &p_buf[index]); + p_buf[index++] = hci_status_code; + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_disconnect_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_DISCONNECT, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_encrypt.c b/components/serialization/application/codecs/s110/serializers/ble_gap_encrypt.c new file mode 100644 index 0000000..0abf029 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_encrypt.c @@ -0,0 +1,68 @@ +/* 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 "ble_gap_app.h" +#include +#include "ble_serialization.h" +#include "ble_gap.h" +#include "app_util.h" + + +uint32_t ble_gap_encrypt_req_enc( uint16_t conn_handle, + ble_gap_master_id_t const * const p_master_id, + ble_gap_enc_info_t const * const p_enc_info, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 2 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_ENCRYPT; + index += uint16_encode(conn_handle, &p_buf[index]); + + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + p_buf[index++] = (p_master_id != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_master_id != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + BLE_GAP_SEC_RAND_LEN + 2, *p_buf_len); + index += uint16_encode(p_master_id->ediv, &p_buf[index]); + memcpy(&p_buf[index], p_master_id->rand, BLE_GAP_SEC_RAND_LEN); + index += BLE_GAP_SEC_RAND_LEN; + } + + p_buf[index++] = (p_enc_info != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_enc_info != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + BLE_GAP_SEC_KEY_LEN + 1, *p_buf_len); + memcpy(&p_buf[index], p_enc_info->ltk, BLE_GAP_SEC_KEY_LEN); + index += BLE_GAP_SEC_KEY_LEN; + p_buf[index++] = (p_enc_info->auth | (p_enc_info->ltk_len << 1)); + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_encrypt_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_ENCRYPT, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_evt_adv_report.c b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_adv_report.c new file mode 100644 index 0000000..256919b --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_adv_report.c @@ -0,0 +1,72 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_adv_report_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE+7+1+1, packet_len); // assumed size(data) = 0 + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.adv_report)) + + sizeof (ble_gap_evt_adv_report_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_ADV_REPORT; + p_event->header.evt_len = event_len; + + err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.conn_handle)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_addr_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.adv_report.peer_addr)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.adv_report.rssi)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, packet_len, &index, &byte); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + p_event->evt.gap_evt.params.adv_report.scan_rsp = byte & 0x01; + p_event->evt.gap_evt.params.adv_report.type = (byte >> 1) & 0x03; + p_event->evt.gap_evt.params.adv_report.dlen = (byte >> 3) & 0x1F; + + err_code = uint8_vector_dec(p_buf, packet_len, &index, + p_event->evt.gap_evt.params.adv_report.data, (uint16_t)(p_event->evt.gap_evt.params.adv_report.dlen)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return err_code; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_evt_app.h b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_app.h new file mode 100644 index 0000000..287dc93 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_app.h @@ -0,0 +1,411 @@ +/* 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 BLE_GAP_EVT_APP_H__ +#define BLE_GAP_EVT_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s110_codecs Application s110 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gap_evt_app GAP Application event decoders + * @{ + * @ingroup ser_app_s110_codecs + * + * @brief GAP Application event decoders. + */ +#include "ble.h" + +/** + * @brief Decodes ble_gap_evt_auth_key_request event. + * + * @sa @ref nrf51_evt_auth_key_request_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_auth_key_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_auth_status event. + * + * @sa @ref nrf51_evt_auth_status_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_auth_status_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_conn_param_update event. + * + * @sa @ref nrf51_evt_conn_param_update_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_conn_param_update_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_adv_report event. + * + * @sa @ref nrf51_evt_adv_report_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_adv_report_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_conn_param_update_request event. + * + * @sa @ref nrf51_evt_conn_param_update_request_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_conn_param_update_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_conn_sec_update event. + * + * @sa @ref nrf51_evt_conn_sec_update_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_conn_sec_update_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_connected event. + * + * @sa @ref nrf51_evt_connected_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_connected_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_disconnected event. + * + * @sa @ref nrf51_evt_disconnected_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_disconnected_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_passkey_display event. + * + * @sa @ref nrf51_evt_passkey_display for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_passkey_display_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_rssi_changed event. + * + * @sa @ref nrf51_evt_rssi_changed_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_rssi_changed_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_sec_info_request event. + * + * @sa @ref nrf51_evt_sec_info_request_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_sec_info_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_sec_params_request event. + * + * @sa @ref nrf51_evt_sec_param_request_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_sec_params_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_timeout event. + * + * @sa @ref nrf51_evt_timeout_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_timeout_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_scan_req_report event. + * + * @sa @ref nrf51_evt_scan_req_report_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_scan_req_report_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_sec_request event. + * + * @sa @ref nrf51_evt_sec_request_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_sec_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** @} */ +#endif diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_evt_auth_key_request.c b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_auth_key_request.c new file mode 100644 index 0000000..090b431 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_auth_key_request.c @@ -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. + * + */ + +#include "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_auth_key_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t event_len; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(3, packet_len); + + event_len = SER_EVT_CONN_HANDLE_SIZE + 1; + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_AUTH_KEY_REQUEST; + p_event->header.evt_len = event_len; + + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + + uint8_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.params.auth_key_request.key_type); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_evt_auth_status.c b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_auth_status.c new file mode 100644 index 0000000..6f54d6a --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_auth_status.c @@ -0,0 +1,69 @@ +/* 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 "ble_gap_evt_app.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" +#include "app_ble_gap_sec_keys.h" + +extern ser_ble_gap_app_keyset_t m_app_keys_table[]; + +uint32_t ble_gap_evt_auth_status_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + uint32_t conn_index; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 6, packet_len); + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.auth_status)) + + sizeof (ble_gap_evt_adv_report_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + p_event->header.evt_id = BLE_GAP_EVT_AUTH_STATUS; + p_event->header.evt_len = event_len; + + err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.conn_handle)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_auth_status_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.auth_status)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + // keyset is an extension of standard event data - used to synchronize keys at application + err_code = app_ble_gap_sec_context_find(p_event->evt.gap_evt.conn_handle, &conn_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_keyset_t_dec(p_buf, packet_len, &index, &(m_app_keys_table[conn_index].keyset)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = app_ble_gap_sec_context_destroy(p_event->evt.gap_evt.conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return err_code; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_evt_conn_param_update.c b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_conn_param_update.c new file mode 100644 index 0000000..33cacdc --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_conn_param_update.c @@ -0,0 +1,59 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_conn_param_update_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 2, packet_len); + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.conn_param_update)) + + sizeof (ble_gap_evt_conn_param_update_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_CONN_PARAM_UPDATE; + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gap_evt.params.conn_param_update.conn_params.min_conn_interval); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gap_evt.params.conn_param_update.conn_params.max_conn_interval); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gap_evt.params.conn_param_update.conn_params.slave_latency); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gap_evt.params.conn_param_update.conn_params.conn_sup_timeout); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_evt_conn_param_update_request.c b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_conn_param_update_request.c new file mode 100644 index 0000000..7bede0f --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_conn_param_update_request.c @@ -0,0 +1,59 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_conn_param_update_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 2, packet_len); + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.conn_param_update_request)) + + sizeof (ble_gap_evt_conn_param_update_request_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST; + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gap_evt.params.conn_param_update_request.conn_params.min_conn_interval); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gap_evt.params.conn_param_update_request.conn_params.max_conn_interval); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gap_evt.params.conn_param_update_request.conn_params.slave_latency); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gap_evt.params.conn_param_update_request.conn_params.conn_sup_timeout); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_evt_conn_sec_update.c b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_conn_sec_update.c new file mode 100644 index 0000000..6802173 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_conn_sec_update.c @@ -0,0 +1,57 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_conn_sec_update_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 2, packet_len); + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.conn_sec_update)) + + sizeof (ble_gap_evt_conn_sec_update_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_CONN_SEC_UPDATE; + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + + p_event->evt.gap_evt.params.conn_sec_update.conn_sec.sec_mode.sm = p_buf[index] & 0x0F; + p_event->evt.gap_evt.params.conn_sec_update.conn_sec.sec_mode.lv = (p_buf[index] >> 4) & 0x0F; + index++; + + uint8_dec(p_buf, packet_len, + &index, &p_event->evt.gap_evt.params.conn_sec_update.conn_sec.encr_key_size); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_evt_connected.c b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_connected.c new file mode 100644 index 0000000..0dfcd5a --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_connected.c @@ -0,0 +1,53 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_connected_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + uint32_t event_len = sizeof (ble_gap_evt_connected_t) + + sizeof (p_event->evt.gap_evt.conn_handle); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_len = event_len; + + err_code = uint16_t_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_connected_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.connected)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return err_code; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_evt_disconnected.c b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_disconnected.c new file mode 100644 index 0000000..fa29107 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_disconnected.c @@ -0,0 +1,48 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_disconnected_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(3, packet_len); + + uint32_t event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gap_evt_disconnected_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_DISCONNECTED; + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + uint8_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.params.disconnected.reason); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_evt_passkey_display.c b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_passkey_display.c new file mode 100644 index 0000000..7a2f155 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_passkey_display.c @@ -0,0 +1,57 @@ +/* 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 "ble_gap_evt_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + +#define PASSKEY_LEN sizeof (p_event->evt.gap_evt.params.passkey_display.passkey) + + +uint32_t ble_gap_evt_passkey_display_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t event_len; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + PASSKEY_LEN, packet_len); + + event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gap_evt_passkey_display_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_PASSKEY_DISPLAY; + p_event->header.evt_len = event_len; + + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + memcpy(p_event->evt.gap_evt.params.passkey_display.passkey, &p_buf[index], PASSKEY_LEN); + index += PASSKEY_LEN; + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + *p_event_len = event_len; + + return NRF_SUCCESS; +} + diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_evt_rssi_changed.c b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_rssi_changed.c new file mode 100644 index 0000000..b7de4cc --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_rssi_changed.c @@ -0,0 +1,53 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_rssi_changed_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t event_len; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 1, packet_len); + + event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gap_evt_rssi_changed_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_RSSI_CHANGED; + p_event->header.evt_len = event_len; + + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + int8_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.params.rssi_changed.rssi); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + *p_event_len = event_len; + + return NRF_SUCCESS; +} + diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_evt_scan_req_report.c b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_scan_req_report.c new file mode 100644 index 0000000..118fcf2 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_scan_req_report.c @@ -0,0 +1,58 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_scan_req_report_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.scan_req_report)) + + sizeof (ble_gap_evt_scan_req_report_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_SCAN_REQ_REPORT; + p_event->header.evt_len = event_len; + + err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.conn_handle)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_addr_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.scan_req_report.peer_addr)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.scan_req_report.rssi)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return err_code; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_evt_sec_info_request.c b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_sec_info_request.c new file mode 100644 index 0000000..ff3d0af --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_sec_info_request.c @@ -0,0 +1,55 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_sec_info_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 2, packet_len); + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.sec_info_request)) + + sizeof (ble_gap_evt_sec_info_request_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_SEC_INFO_REQUEST; + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + + err_code = ble_gap_evt_sec_info_request_t_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.params.sec_info_request); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_evt_sec_params_request.c b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_sec_params_request.c new file mode 100644 index 0000000..beaa49a --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_sec_params_request.c @@ -0,0 +1,56 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_sec_params_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t event_len; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(7, packet_len); + + event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gap_evt_sec_params_request_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + p_event->header.evt_id = BLE_GAP_EVT_SEC_PARAMS_REQUEST; + p_event->header.evt_len = event_len; + + err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.conn_handle)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_sec_params_request_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.sec_params_request)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + *p_event_len = event_len; + + return err_code; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_evt_sec_request.c b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_sec_request.c new file mode 100644 index 0000000..f080405 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_sec_request.c @@ -0,0 +1,59 @@ +/* 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 + +#include "ble_gap_evt_app.h" +#include "ble_gap_struct_serialization.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_sec_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(3, packet_len); + + uint32_t event_len = sizeof (ble_gap_evt_sec_request_t) + + sizeof (p_event->evt.gap_evt.conn_handle); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + + ble_gap_evt_sec_request_t * p_decoded_evt = &(p_event->evt.gap_evt.params.sec_request); + + uint32_t err_code = ble_gap_evt_sec_request_t_dec(p_buf, packet_len, &index, p_decoded_evt); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_evt_timeout.c b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_timeout.c new file mode 100644 index 0000000..8fdb83b --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_evt_timeout.c @@ -0,0 +1,52 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_timeout_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t event_len; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_EQ(SER_EVT_CONN_HANDLE_SIZE + 1, packet_len); + + event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gap_evt_timeout_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_TIMEOUT; + p_event->header.evt_len = event_len; + + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + uint8_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.params.timeout.src); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_ppcp_get.c b/components/serialization/application/codecs/s110/serializers/ble_gap_ppcp_get.c new file mode 100644 index 0000000..e3c8b07 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_ppcp_get.c @@ -0,0 +1,68 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" + + +uint32_t ble_gap_ppcp_get_req_enc(ble_gap_conn_params_t const * const p_conn_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_PPCP_GET; + p_buf[index++] = (p_conn_params != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_ppcp_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_conn_params_t * const p_conn_params, + uint32_t * const p_result_code) +{ + uint32_t index = 0; + + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_GAP_PPCP_GET, p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_conn_params); + + SER_ASSERT_LENGTH_LEQ(index + 8, packet_len); + uint16_dec(p_buf, packet_len, &index, &p_conn_params->min_conn_interval); + uint16_dec(p_buf, packet_len, &index, &p_conn_params->max_conn_interval); + uint16_dec(p_buf, packet_len, &index, &p_conn_params->slave_latency); + uint16_dec(p_buf, packet_len, &index, &p_conn_params->conn_sup_timeout); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return decode_result; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_ppcp_set.c b/components/serialization/application/codecs/s110/serializers/ble_gap_ppcp_set.c new file mode 100644 index 0000000..15e5528 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_ppcp_set.c @@ -0,0 +1,54 @@ +/* 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 "ble_gap_app.h" +#include +#include "nrf_error.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_ppcp_set_req_enc(ble_gap_conn_params_t const * const p_conn_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(1 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_PPCP_SET; + p_buf[index++] = (p_conn_params != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_conn_params != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 8, *p_buf_len); + index += uint16_encode(p_conn_params->min_conn_interval, &p_buf[index]); + index += uint16_encode(p_conn_params->max_conn_interval, &p_buf[index]); + index += uint16_encode(p_conn_params->slave_latency, &p_buf[index]); + index += uint16_encode(p_conn_params->conn_sup_timeout, &p_buf[index]); + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_ppcp_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_PPCP_SET, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_rssi_get.c b/components/serialization/application/codecs/s110/serializers/ble_gap_rssi_get.c new file mode 100644 index 0000000..24b4b2c --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_rssi_get.c @@ -0,0 +1,80 @@ +/* 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 "ble_gap_app.h" +#include +#include +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_rssi_get_req_enc(uint16_t conn_handle, + int8_t const * const p_rssi, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + SER_ASSERT_LENGTH_LEQ(index + 1, total_len); + + p_buf[index++] = SD_BLE_GAP_RSSI_GET; + + err_code = uint16_t_enc(&conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_rssi, p_buf, total_len, &index, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gap_rssi_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + int8_t * const p_rssi, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t index = 0; + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, + &index, + packet_len, + SD_BLE_GAP_RSSI_GET, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + decode_result = uint8_t_dec(p_buf, packet_len, &index, (uint8_t *) p_rssi); + SER_ASSERT(decode_result == NRF_SUCCESS, decode_result); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return decode_result; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_rssi_start.c b/components/serialization/application/codecs/s110/serializers/ble_gap_rssi_start.c new file mode 100644 index 0000000..539b8b6 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_rssi_start.c @@ -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. + * + */ + +#include "ble_gap_app.h" +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_rssi_start_req_enc(uint16_t conn_handle, + uint8_t threshold_dbm, + uint8_t skip_count, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GAP_RSSI_START; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&threshold_dbm, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&skip_count, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gap_rssi_start_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_RSSI_START, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_rssi_stop.c b/components/serialization/application/codecs/s110/serializers/ble_gap_rssi_stop.c new file mode 100644 index 0000000..49ef65e --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_rssi_stop.c @@ -0,0 +1,45 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_rssi_stop_req_enc(uint16_t conn_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + uint8_t op_code = SD_BLE_GAP_RSSI_STOP; + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gap_rssi_stop_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_RSSI_STOP, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_scan_start.c b/components/serialization/application/codecs/s110/serializers/ble_gap_scan_start.c new file mode 100644 index 0000000..a92ab3b --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_scan_start.c @@ -0,0 +1,45 @@ +/* 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 "ble_gap_app.h" +#include "cond_field_serialization.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" + +uint32_t ble_gap_scan_start_req_enc(ble_gap_scan_params_t const * p_scan_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GAP_SCAN_START; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + err_code = cond_field_enc(p_scan_params, p_buf, buf_len, &index, ble_gap_scan_params_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gap_scan_start_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_SCAN_START, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_scan_stop.c b/components/serialization/application/codecs/s110/serializers/ble_gap_scan_stop.c new file mode 100644 index 0000000..72e7c4a --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_scan_stop.c @@ -0,0 +1,40 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" + +uint32_t ble_gap_scan_stop_req_enc(uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GAP_SCAN_STOP; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gap_scan_stop_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_SCAN_STOP, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_sec_info_reply.c b/components/serialization/application/codecs/s110/serializers/ble_gap_sec_info_reply.c new file mode 100644 index 0000000..0739b31 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_sec_info_reply.c @@ -0,0 +1,78 @@ +/* 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 "ble_gap_app.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "ble_gap.h" +#include "cond_field_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_sec_info_reply_req_enc(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, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GAP_SEC_INFO_REPLY; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(index + 1, buf_len); + p_buf[index++] = (p_enc_info != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_enc_info != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + BLE_GAP_SEC_KEY_LEN + 1, buf_len); + memcpy(&p_buf[index], p_enc_info->ltk, BLE_GAP_SEC_KEY_LEN); + index += BLE_GAP_SEC_KEY_LEN; + p_buf[index++] = (p_enc_info->auth | (p_enc_info->ltk_len << 1)); + } + + err_code = cond_field_enc(p_id_info, p_buf, buf_len, &index, ble_gap_irk_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(index + 1, buf_len); + p_buf[index++] = (p_sign_info != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_sign_info != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + BLE_GAP_SEC_KEY_LEN, buf_len); + memcpy(&p_buf[index], p_sign_info->csrk, BLE_GAP_SEC_KEY_LEN); + index += BLE_GAP_SEC_KEY_LEN; + } + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gap_sec_info_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_SEC_INFO_REPLY, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_sec_params_reply.c b/components/serialization/application/codecs/s110/serializers/ble_gap_sec_params_reply.c new file mode 100644 index 0000000..d04189d --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_sec_params_reply.c @@ -0,0 +1,87 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_sec_params_reply_req_enc(uint16_t conn_handle, + uint8_t sec_status, + ble_gap_sec_params_t const * const p_sec_params, + ble_gap_sec_keyset_t const * const p_sec_keyset, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GAP_SEC_PARAMS_REPLY; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&sec_status, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_sec_params, p_buf, buf_len, &index, ble_gap_sec_params_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_sec_keyset, p_buf, buf_len, &index, ble_gap_sec_keyset_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gap_sec_params_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_sec_keyset_t const * const p_sec_keyset, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = 0; + + err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, SD_BLE_GAP_SEC_PARAMS_REPLY, p_result_code); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_sec_keyset); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void **)&p_sec_keyset, ble_gap_sec_keyset_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gap_tx_power_set.c b/components/serialization/application/codecs/s110/serializers/ble_gap_tx_power_set.c new file mode 100644 index 0000000..807eb78 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gap_tx_power_set.c @@ -0,0 +1,45 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_tx_power_set_req_enc(int8_t tx_power, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GAP_TX_POWER_SET; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&tx_power, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gap_tx_power_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_TX_POWER_SET, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gattc_app.h b/components/serialization/application/codecs/s110/serializers/ble_gattc_app.h new file mode 100644 index 0000000..c7bbf9a --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gattc_app.h @@ -0,0 +1,406 @@ +/* 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. + * + */ +#ifndef BLE_GATTC_APP_H__ +#define BLE_GATTC_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s110_codecs Application s110 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gattc_app GATTC Application command request encoders and command response decoders + * @{ + * @ingroup ser_app_s110_codecs + * + * @brief GATTC Application command request encoders and command response decoders. + */ +#include "ble_gattc.h" +#include "ble.h" + +/**@brief Encodes @ref sd_ble_gattc_primary_services_discover command request. + * + * @sa @ref nrf51_sd_ble_gattc_primary_services_discover_encoding for packet format, + * @ref ble_gattc_primary_services_discover_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] start_handle Handle to start searching from. + * @param[in] p_srvc_uuid Pointer to a @ref ble_uuid_t which indicates the service UUID to + * be found. If it is NULL, all primary services will be returned. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_primary_services_discover_req_enc(uint16_t conn_handle, + uint16_t start_handle, + ble_uuid_t const * const p_srvc_uuid, + uint8_t * const p_buf, + uint32_t * p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gattc_primary_services_discover command. + * + * @sa @ref nrf51_sd_ble_gattc_primary_services_discover_encoding for packet format, + * @ref ble_gattc_primary_services_discover_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gattc_primary_services_discover_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gattc_descriptors_discover command request. + * + * @sa @ref nrf51_sd_ble_gattc_descriptors_discover_encoding for packet format, + * @ref ble_gattc_descriptors_discover_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_handle_range A pointer to the range of handles of the Service to perform + * this procedure on. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_descriptors_discover_req_enc( + uint16_t conn_handle, + ble_gattc_handle_range_t const * const p_handle_range, + uint8_t * const p_buf, + uint32_t * p_buf_len); + + +/**@brief Decodes response to @ref sd_ble_gattc_descriptors_discover command. + * + * @sa @ref nrf51_sd_ble_gattc_descriptors_discover_encoding for packet format, + * @ref ble_gattc_primary_services_discover_rsp_dec for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gattc_descriptors_discover_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gattc_relationships_discover command request. + * + * @sa @ref nrf51_sd_ble_gattc_relationships_discover_encoding for packet format, + * @ref ble_gattc_relationships_discover_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_handle_range A pointer to the range of handles of the Service to perform + * this procedure on. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_relationships_discover_req_enc( + uint16_t conn_handle, + ble_gattc_handle_range_t const * const p_handle_range, + uint8_t * const p_buf, + uint32_t * p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gattc_relationships_discover command. + * + * @sa @ref nrf51_sd_ble_gattc_relationships_discover_encoding for packet format, + * @ref ble_gattc_relationships_discover_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gattc_relationships_discover_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gattc_characteristics_discover command request. + * + * @sa @ref nrf51_sd_ble_gattc_characteristics_discover_encoding for packet format, + * @ref ble_gattc_characteristics_discover_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_handle_range A pointer to the range of handles of the Service to perform + * this procedure on. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_characteristics_discover_req_enc + (uint16_t conn_handle, + ble_gattc_handle_range_t const * const p_handle_range, + uint8_t * const p_buf, + uint32_t * p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gattc_characteristics_discover command. + * + * @sa @ref nrf51_sd_ble_gattc_characteristics_discover_encoding for packet format, + * @ref ble_gattc_primary_services_discover_rsp_dec for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gattc_characteristics_discover_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gattc_read command request. + * + * @sa @ref nrf51_sd_ble_gattc_read_encoding for packet format, + * @ref ble_gattc_read_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] handle The handle of the attribute to be read. + * @param[in] offset Offset into the attribute value to be read. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_read_req_enc(uint16_t conn_handle, + uint16_t handle, + uint16_t offset, + uint8_t * const p_buf, + uint32_t * p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gattc_read command. + * + * @sa @ref nrf51_sd_ble_gattc_read_encoding for packet format, + * @ref ble_gattc_read_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gattc_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gattc_char_values_read command request. + * + * @sa @ref nrf51_sd_ble_gattc_char_values_read for packet format, + * @ref ble_gattc_char_values_read_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @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. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_char_values_read_req_enc(uint16_t conn_handle, + uint16_t const * const p_handles, + uint16_t handle_count, + uint8_t * const p_buf, + uint32_t * p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gattc_char_values_read command. + * + * @sa @ref nrf51_sd_ble_gattc_char_values_read for packet format, + * @ref ble_gattc_char_values_read_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gattc_char_values_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gattc_write command request. + * + * @sa @ref nrf51_sd_ble_gattc_write_encoding for packet format, + * @ref ble_gattc_write_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_write_params Pointer to \ref sd_ble_gattc_write params. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_write_req_enc(uint16_t conn_handle, + ble_gattc_write_params_t const * const p_write_params, + uint8_t * const p_buf, + uint32_t * p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gattc_write command. + * + * @sa @ref nrf51_sd_ble_gattc_write_encoding for packet format, + * @ref ble_gattc_write_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gattc_write_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gattc_hv_confirm command request. + * + * @sa @ref nrf51_sd_ble_gattc_hv_confirm for packet format, + * @ref ble_gattc_hv_confirm_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] handle Handle of the attribute in the indication. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_hv_confirm_req_enc(uint16_t conn_handle, + uint16_t handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gattc_hv_confirm command. + * + * @sa @ref nrf51_sd_ble_gattc_hv_confirm for packet format, + * @ref ble_gattc_hv_confirm_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Pointer to command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gattc_hv_confirm_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gattc_char_value_by_uuid_read command request. + * + * @sa @ref nrf51_sd_ble_gattc_char_value_by_uuid_read_encoding for packet format, + * @ref ble_gattc_char_value_by_uuid_read_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_uuid Pointer to a characteristic value UUID to read. + * @param[in] p_handle_range Pointer to the range of handles to perform this procedure on. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_char_value_by_uuid_read_req_enc + (uint16_t conn_handle, + ble_uuid_t const * const p_uuid, + ble_gattc_handle_range_t const * const p_handle_range, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gattc_char_value_by_uuid_read command. + * + * @sa @ref nrf51_sd_ble_gattc_char_value_by_uuid_read_encoding for packet format, + * @ref ble_gattc_char_value_by_uuid_read_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Pointer to command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gattc_char_value_by_uuid_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); +/** @} */ +#endif + + diff --git a/components/serialization/application/codecs/s110/serializers/ble_gattc_char_value_by_uuid_read.c b/components/serialization/application/codecs/s110/serializers/ble_gattc_char_value_by_uuid_read.c new file mode 100644 index 0000000..7b75815 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gattc_char_value_by_uuid_read.c @@ -0,0 +1,61 @@ +/* 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 "ble_gattc_app.h" +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "ble_gattc_struct_serialization.h" +#include "cond_field_serialization.h" +#include "ble_types.h" +#include + +uint32_t ble_gattc_char_value_by_uuid_read_req_enc + (uint16_t conn_handle, + ble_uuid_t const * const p_uuid, + ble_gattc_handle_range_t const * const p_handle_range, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t err_code; + uint32_t index = 0; + uint32_t buf_len = *p_buf_len; + uint8_t opcode = SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ; + + err_code = uint8_t_enc(&opcode, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_uuid, p_buf, buf_len, &index, ble_uuid_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_handle_range, p_buf, buf_len, &index, ble_gattc_handle_range_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gattc_char_value_by_uuid_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, + packet_len, + SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, + p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gattc_char_values_read.c b/components/serialization/application/codecs/s110/serializers/ble_gattc_char_values_read.c new file mode 100644 index 0000000..6dc1e17 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gattc_char_values_read.c @@ -0,0 +1,48 @@ +/* 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 "ble_gattc_app.h" +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gattc_char_values_read_req_enc(uint16_t conn_handle, + uint16_t const * const p_handles, + uint16_t handle_count, + uint8_t * const p_buf, + uint32_t * p_buf_len) +{ + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t buf_len = *p_buf_len; + uint32_t err_code; + uint8_t opCode = SD_BLE_GATTC_CHAR_VALUES_READ; + + err_code = uint8_t_enc(&opCode, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + err_code = count16_cond_data16_enc(p_handles, handle_count, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + *p_buf_len = index; + return err_code; +} + + +uint32_t ble_gattc_char_values_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_CHAR_VALUES_READ, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gattc_characteristics_discover.c b/components/serialization/application/codecs/s110/serializers/ble_gattc_characteristics_discover.c new file mode 100644 index 0000000..b98d142 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gattc_characteristics_discover.c @@ -0,0 +1,57 @@ +/* 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 "ble_gattc_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_characteristics_discover_req_enc( + uint16_t conn_handle, + ble_gattc_handle_range_t const * const p_handle_range, + uint8_t * const p_buf, + uint32_t * p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 2, *p_buf_len); + + p_buf[index++] = SD_BLE_GATTC_CHARACTERISTICS_DISCOVER; + index += uint16_encode(conn_handle, &p_buf[index]); + + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + p_buf[index++] = (p_handle_range != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_handle_range != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 2 + 2, *p_buf_len); + + index += uint16_encode(p_handle_range->start_handle, &p_buf[index]); + index += uint16_encode(p_handle_range->end_handle, &p_buf[index]); + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_characteristics_discover_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_CHARACTERISTICS_DISCOVER, + p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gattc_descriptors_discover.c b/components/serialization/application/codecs/s110/serializers/ble_gattc_descriptors_discover.c new file mode 100644 index 0000000..28e1a21 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gattc_descriptors_discover.c @@ -0,0 +1,53 @@ +/* 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 "ble_gattc_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_descriptors_discover_req_enc( + uint16_t conn_handle, + ble_gattc_handle_range_t const * const p_handle_range, + uint8_t * const p_buf, + uint32_t * p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 2 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GATTC_DESCRIPTORS_DISCOVER; + index += uint16_encode(conn_handle, &p_buf[index]); + p_buf[index++] = (p_handle_range == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + if (p_handle_range != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 2 + 2, *p_buf_len); + index += uint16_encode(p_handle_range->start_handle, &p_buf[index]); + index += uint16_encode(p_handle_range->end_handle, &p_buf[index]); + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_descriptors_discover_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_DESCRIPTORS_DISCOVER, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_app.h b/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_app.h new file mode 100644 index 0000000..8ec3f63 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_app.h @@ -0,0 +1,286 @@ +/* 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 BLE_GATTC_EVT_APP_H__ +#define BLE_GATTC_EVT_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s110_codecs Application s110 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gattc_evt_app GATTC Application event decoders + * @{ + * @ingroup ser_app_s110_codecs + * + * @brief GATTC Application event decoders. + */ +#include "ble.h" + +/** + * @brief Decodes ble_gattc_evt_char_disc_rsp event. + * + * @sa @ref nrf51_gattc_evt_char_disc_rsp_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_char_disc_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gattc_evt_char_val_by_uuid_read_rsp event. + * + * @sa @ref nrf51_gattc_evt_char_val_by_uuid_read_rsp_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gattc_evt_char_vals_read_rsp event. + * + * @sa @ref nrf51_gattc_evt_char_vals_read_rsp_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_char_vals_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gattc_evt_desc_disc_rsp event. + * + * @sa @ref nrf51_gattc_evt_desc_disc_rsp_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_desc_disc_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gattc_evt_hvx event. + * + * @sa @ref nrf51_gattc_evt_hvx_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_hvx_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gattc_evt_prim_srvc_disc_rsp event. + * + * @sa @ref nrf51_gattc_evt_prim_srvc_disc_rsp_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_prim_srvc_disc_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gattc_evt_read_rsp event. + * + * @sa @ref nrf51_gattc_evt_read_rsp_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gattc_evt_rel_disc_rsp_dec event. + * + * @sa @ref nrf51_gattc_evt_rel_disc_rsp_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_rel_disc_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gattc_evt_timeout event. + * + * @sa @ref nrf51_gattc_evt_timeout_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_timeout_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gattc_evt_write_rsp event. + * + * @sa @ref nrf51_gattc_evt_write_rsp_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_write_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** @} */ +#endif diff --git a/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_char_disc_rsp.c b/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_char_disc_rsp.c new file mode 100644 index 0000000..cdc6532 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_char_disc_rsp.c @@ -0,0 +1,103 @@ +/* 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 "ble_gattc_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" +#include "nordic_common.h" + + +uint32_t ble_gattc_evt_char_disc_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(2 + 2 + 2 + 2, packet_len); + + uint16_t tmp_conn_handle; + uint16_t tmp_gatt_status; + uint16_t tmp_error_handle; + uint16_t tmp_service_count; + uint16_dec(p_buf, packet_len, &index, &tmp_conn_handle); + uint16_dec(p_buf, packet_len, &index, &tmp_gatt_status); + uint16_dec(p_buf, packet_len, &index, &tmp_error_handle); + uint16_dec(p_buf, packet_len, &index, &tmp_service_count); + + + uint32_t event_len = offsetof(ble_evt_t, evt.gattc_evt.params.char_disc_rsp) + + sizeof (uint16_t) + tmp_service_count * sizeof (ble_gattc_char_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTC_EVT_CHAR_DISC_RSP; + p_event->header.evt_len = event_len; + p_event->evt.gattc_evt.conn_handle = tmp_conn_handle; + p_event->evt.gattc_evt.gatt_status = tmp_gatt_status; + p_event->evt.gattc_evt.error_handle = tmp_error_handle; + p_event->evt.gattc_evt.params.char_disc_rsp.count = tmp_service_count; + + SER_ASSERT_LENGTH_LEQ(index + (tmp_service_count * 9), packet_len); + + for (uint16_t i = 0; i < tmp_service_count; i++) + { + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].uuid.uuid); + uint8_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].uuid.type); + + uint8_t characteristic_props; + uint8_dec(p_buf, packet_len, &index, &characteristic_props); + + p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.broadcast = + !!(characteristic_props & BIT_0); + p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.read = + !!(characteristic_props & BIT_1); + p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.write_wo_resp = + !!(characteristic_props & BIT_2); + p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.write = + !!(characteristic_props & BIT_3); + p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.notify = + !!(characteristic_props & BIT_4); + p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.indicate = + !!(characteristic_props & BIT_5); + p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.auth_signed_wr = + !!(characteristic_props & BIT_6); + + uint8_t characteristic_ext_props; + uint8_dec(p_buf, packet_len, &index, &characteristic_ext_props); + + p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_ext_props = + characteristic_ext_props & BIT_0; + + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].handle_decl); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].handle_value); + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c b/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c new file mode 100644 index 0000000..93d89dc --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c @@ -0,0 +1,78 @@ +/* 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_util.h" +#include "ble.h" +#include "ble_serialization.h" +#include "ble_gattc_struct_serialization.h" +#include "ble_gattc_evt_app.h" + + +uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + uint32_t index = 0; + uint32_t err_code; + uint16_t conn_handle; + uint16_t gatt_status; + uint16_t error_handle; + + SER_ASSERT_LENGTH_LEQ(6, packet_len - index); + + uint32_t in_event_len = *p_event_len; + + *p_event_len = (offsetof(ble_evt_t, evt.gattc_evt.params)) - sizeof (ble_evt_hdr_t); + + uint16_dec(p_buf, packet_len, &index, &conn_handle); + uint16_dec(p_buf, packet_len, &index, &gatt_status); + uint16_dec(p_buf, packet_len, &index, &error_handle); + + void * p_data = NULL; + + if (p_event) + { + SER_ASSERT_LENGTH_LEQ(*p_event_len, in_event_len); + + p_event->header.evt_id = BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP; + p_event->evt.gattc_evt.conn_handle = conn_handle; + p_event->evt.gattc_evt.gatt_status = gatt_status; + p_event->evt.gattc_evt.error_handle = error_handle; + + p_data = &p_event->evt.gattc_evt.params.char_val_by_uuid_read_rsp; + } + else + { + p_data = NULL; + } + + //call struct decoder with remaining size of event struct + uint32_t temp_event_len = in_event_len - *p_event_len; + err_code = ble_gattc_evt_char_val_by_uuid_read_rsp_t_dec(p_buf, packet_len, &index, + &temp_event_len, p_data); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + //update event length with the amount processed by struct decoder + *p_event_len += temp_event_len; + + if (p_event) + { + p_event->header.evt_len = *p_event_len; + } + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_char_vals_read_rsp.c b/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_char_vals_read_rsp.c new file mode 100644 index 0000000..4e99a17 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_char_vals_read_rsp.c @@ -0,0 +1,66 @@ +/* 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 "ble_gattc_evt_app.h" +#include "ble_gattc_struct_serialization.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + +#define BLE_GATTC_EVT_CHAR_VALS_READ_RSP_LEN_POSITION 6 + + +uint32_t ble_gattc_evt_char_vals_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t event_len = 0; + + uint32_t error_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(10, packet_len); + + event_len = (uint16_t) (offsetof(ble_evt_t, evt.gattc_evt.params.char_vals_read_rsp.values)) - + sizeof (ble_evt_hdr_t) + + uint16_decode(&p_buf[BLE_GATTC_EVT_CHAR_VALS_READ_RSP_LEN_POSITION]); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + else + { + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + *p_event_len = event_len; + } + + p_event->header.evt_id = BLE_GATTC_EVT_CHAR_VALS_READ_RSP; + + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.conn_handle)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.gatt_status)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.error_handle)); + + //Event structure for BLE_GATTC_EVT_CHAR_VALS_READ_RSP + error_code = + ble_gattc_evt_char_vals_read_rsp_t_dec(p_buf, packet_len, &index, + &(p_event->evt.gattc_evt.params.char_vals_read_rsp)); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return error_code; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_desc_disc_rsp.c b/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_desc_disc_rsp.c new file mode 100644 index 0000000..6e44502 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_desc_disc_rsp.c @@ -0,0 +1,95 @@ +/* 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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_gattc_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_desc_disc_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 6, packet_len); + + uint16_t tmp_conn_handle; + uint16_t tmp_gatt_status; + uint16_t tmp_error_handle; + uint16_t tmp_service_count; + uint16_dec(p_buf, packet_len, &index, &tmp_conn_handle); + uint16_dec(p_buf, packet_len, &index, &tmp_gatt_status); + uint16_dec(p_buf, packet_len, &index, &tmp_error_handle); + uint16_dec(p_buf, packet_len, &index, &tmp_service_count); + + uint32_t event_len = offsetof(ble_evt_t, evt.gattc_evt.params.desc_disc_rsp) + + sizeof (uint16_t) + tmp_service_count * sizeof (ble_gattc_desc_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTC_EVT_DESC_DISC_RSP; + p_event->header.evt_len = event_len; + p_event->evt.gattc_evt.conn_handle = tmp_conn_handle; + p_event->evt.gattc_evt.gatt_status = tmp_gatt_status; + p_event->evt.gattc_evt.error_handle = tmp_error_handle; + p_event->evt.gattc_evt.params.desc_disc_rsp.count = tmp_service_count; + + SER_ASSERT_LENGTH_LEQ(index + (tmp_service_count * 5), packet_len); + + for (uint16_t i = 0; i < tmp_service_count; i++) + { + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.desc_disc_rsp.descs[i].handle); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.desc_disc_rsp.descs[i].uuid.uuid); + uint8_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.desc_disc_rsp.descs[i].uuid.type); + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_hvx.c b/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_hvx.c new file mode 100644 index 0000000..f20f499 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_hvx.c @@ -0,0 +1,66 @@ +/* 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 "ble_gattc_evt_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_hvx_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint16_t tmp_attr_len; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(11, packet_len); + + tmp_attr_len = uint16_decode(&(p_buf[9])); + + uint32_t event_len = offsetof(ble_evt_t, evt.gattc_evt.params.hvx) + + sizeof (ble_gattc_evt_hvx_t) - 1 + tmp_attr_len; + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTC_EVT_HVX; + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.conn_handle)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.gatt_status)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.error_handle)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.hvx.handle)); + uint8_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.hvx.type)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.hvx.len)); + + SER_ASSERT_LENGTH_LEQ(index + tmp_attr_len, packet_len); + + if (tmp_attr_len > 0) + { + memcpy(&(p_event->evt.gattc_evt.params.hvx.data[0]), &(p_buf[index]), tmp_attr_len); + index += tmp_attr_len; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c b/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c new file mode 100644 index 0000000..85d43c0 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c @@ -0,0 +1,78 @@ +/* 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 "ble_gattc_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_prim_srvc_disc_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 6, packet_len); + + uint16_t tmp_conn_handle; + uint16_t tmp_gatt_status; + uint16_t tmp_error_handle; + uint16_t tmp_service_count; + uint16_dec(p_buf, packet_len, &index, &tmp_conn_handle); + uint16_dec(p_buf, packet_len, &index, &tmp_gatt_status); + uint16_dec(p_buf, packet_len, &index, &tmp_error_handle); + uint16_dec(p_buf, packet_len, &index, &tmp_service_count); + + uint32_t event_len = offsetof(ble_evt_t, evt.gattc_evt.params.prim_srvc_disc_rsp) + + sizeof (uint16_t) + tmp_service_count * sizeof (ble_gattc_service_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP; + p_event->header.evt_len = event_len; + p_event->evt.gattc_evt.conn_handle = tmp_conn_handle; + p_event->evt.gattc_evt.gatt_status = tmp_gatt_status; + p_event->evt.gattc_evt.error_handle = tmp_error_handle; + p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.count = tmp_service_count; + + SER_ASSERT_LENGTH_LEQ(index + (tmp_service_count * 7), packet_len); + + for (uint16_t i = 0; i < tmp_service_count; i++) + { + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].uuid.uuid); + uint8_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].uuid.type); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].handle_range. + start_handle); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].handle_range. + end_handle); + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_read_rsp.c b/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_read_rsp.c new file mode 100644 index 0000000..a851447 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_read_rsp.c @@ -0,0 +1,66 @@ +/* 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 "ble_gattc_evt_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint16_t tmp_attr_len; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(12, packet_len); + + tmp_attr_len = uint16_decode(&(p_buf[10])); + + uint32_t event_len = offsetof(ble_evt_t, evt.gattc_evt.params.read_rsp) + + sizeof (ble_gattc_evt_read_rsp_t) - 1 + tmp_attr_len; + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTC_EVT_READ_RSP; + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.conn_handle)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.gatt_status)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.error_handle)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.read_rsp.handle)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.read_rsp.offset)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.read_rsp.len)); + + SER_ASSERT_LENGTH_LEQ(index + tmp_attr_len, packet_len); + + if (tmp_attr_len > 0) + { + memcpy(&(p_event->evt.gattc_evt.params.read_rsp.data[0]), &(p_buf[index]), tmp_attr_len); + index += tmp_attr_len; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_rel_disc_rsp.c b/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_rel_disc_rsp.c new file mode 100644 index 0000000..7f0bd9f --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_rel_disc_rsp.c @@ -0,0 +1,65 @@ +/* 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 "ble_gattc_evt_app.h" +#include "ble_gattc_struct_serialization.h" +#include "ble_serialization.h" +#include "app_util.h" + +#define BLE_GATTC_EVT_REL_DISC_RSP_COUNT_POSITION 6 + + +uint32_t ble_gattc_evt_rel_disc_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t event_len = 0; + uint16_t include_count = 0; + + uint32_t error_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(8, packet_len); + + include_count = uint16_decode(&p_buf[BLE_GATTC_EVT_REL_DISC_RSP_COUNT_POSITION]); + event_len = (uint16_t) (offsetof(ble_evt_t, evt.gattc_evt.params.rel_disc_rsp.includes)) - + sizeof (ble_evt_hdr_t) + (include_count * sizeof (ble_gattc_include_t)); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTC_EVT_REL_DISC_RSP; + error_code = + uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.conn_handle)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.gatt_status)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.error_handle)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = + ble_gattc_evt_rel_disc_rsp_t_dec(p_buf, packet_len, &index, + &(p_event->evt.gattc_evt.params.rel_disc_rsp)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return error_code; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_timeout.c b/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_timeout.c new file mode 100644 index 0000000..8f831d3 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_timeout.c @@ -0,0 +1,75 @@ +/* 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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_gattc_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_timeout_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t event_len; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 1, packet_len); + + event_len = offsetof(ble_evt_t, evt.gattc_evt.params.timeout) + + sizeof (ble_gattc_evt_timeout_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTC_EVT_TIMEOUT; + p_event->header.evt_len = event_len; + + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gattc_evt.conn_handle); + uint8_dec(p_buf, packet_len, &index, &p_event->evt.gattc_evt.params.timeout.src); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_write_rsp.c b/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_write_rsp.c new file mode 100644 index 0000000..bfed5e2 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gattc_evt_write_rsp.c @@ -0,0 +1,66 @@ +/* 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 "ble_gattc_evt_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_write_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(13, packet_len); + + uint16_t tmp_attr_len = uint16_decode(&(p_buf[11])); + + uint32_t event_len = offsetof(ble_evt_t, evt.gattc_evt.params.write_rsp) + + sizeof (ble_gattc_evt_write_rsp_t) - 1 + tmp_attr_len; + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTC_EVT_WRITE_RSP; + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.conn_handle)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.gatt_status)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.error_handle)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.write_rsp.handle)); + uint8_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.write_rsp.write_op)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.write_rsp.offset)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.write_rsp.len)); + + SER_ASSERT_LENGTH_LEQ(index + tmp_attr_len, packet_len); + + if (tmp_attr_len > 0) + { + memcpy(&(p_event->evt.gattc_evt.params.write_rsp.data[0]), &(p_buf[index]), tmp_attr_len); + index += tmp_attr_len; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gattc_hv_confirm.c b/components/serialization/application/codecs/s110/serializers/ble_gattc_hv_confirm.c new file mode 100644 index 0000000..f745640 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gattc_hv_confirm.c @@ -0,0 +1,49 @@ +/* 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 "ble_gattc_app.h" +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gattc_hv_confirm_req_enc(uint16_t conn_handle, + uint16_t handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GATTC_HV_CONFIRM; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return NRF_SUCCESS; +} + +uint32_t ble_gattc_hv_confirm_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_HV_CONFIRM, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gattc_primary_services_discover.c b/components/serialization/application/codecs/s110/serializers/ble_gattc_primary_services_discover.c new file mode 100644 index 0000000..762508b --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gattc_primary_services_discover.c @@ -0,0 +1,59 @@ +/* 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 "ble_gattc_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_primary_services_discover_req_enc(uint16_t conn_handle, + uint16_t start_handle, + ble_uuid_t const * const p_srvc_uuid, + uint8_t * const p_buf, + uint32_t * p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 5, *p_buf_len); + + p_buf[index++] = SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER; + index += uint16_encode(conn_handle, &p_buf[index]); + index += uint16_encode(start_handle, &p_buf[index]); + + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + + p_buf[index++] = (p_srvc_uuid != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_srvc_uuid != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len); + + index += uint16_encode(p_srvc_uuid->uuid, &p_buf[index]); + p_buf[index++] = p_srvc_uuid->type; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_primary_services_discover_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER, + p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gattc_read.c b/components/serialization/application/codecs/s110/serializers/ble_gattc_read.c new file mode 100644 index 0000000..1d4b5ec --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gattc_read.c @@ -0,0 +1,47 @@ +/* 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 "ble_gattc_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_read_req_enc(uint16_t conn_handle, + uint16_t handle, + uint16_t offset, + uint8_t * const p_buf, + uint32_t * p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 7, *p_buf_len); + + p_buf[index++] = SD_BLE_GATTC_READ; + index += uint16_encode(conn_handle, &p_buf[index]); + index += uint16_encode(handle, &p_buf[index]); + index += uint16_encode(offset, &p_buf[index]); + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_READ, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gattc_relationships_discover.c b/components/serialization/application/codecs/s110/serializers/ble_gattc_relationships_discover.c new file mode 100644 index 0000000..943457e --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gattc_relationships_discover.c @@ -0,0 +1,57 @@ +/* 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 "ble_gattc_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_relationships_discover_req_enc( + uint16_t conn_handle, + ble_gattc_handle_range_t const * const p_handle_range, + uint8_t * const p_buf, + uint32_t * p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len); + + p_buf[index++] = SD_BLE_GATTC_RELATIONSHIPS_DISCOVER; + index += uint16_encode(conn_handle, &p_buf[index]); + + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + p_buf[index++] = (p_handle_range != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_handle_range != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 4, *p_buf_len); + + index += uint16_encode(p_handle_range->start_handle, &p_buf[index]); + index += uint16_encode(p_handle_range->end_handle, &p_buf[index]); + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_relationships_discover_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, + p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gattc_write.c b/components/serialization/application/codecs/s110/serializers/ble_gattc_write.c new file mode 100644 index 0000000..edfe93a --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gattc_write.c @@ -0,0 +1,68 @@ +/* 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 "ble_gattc_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gattc_write_req_enc(uint16_t conn_handle, + ble_gattc_write_params_t const * const p_write_params, + uint8_t * const p_buf, + uint32_t * p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 4, *p_buf_len); + + p_buf[index++] = SD_BLE_GATTC_WRITE; + index += uint16_encode(conn_handle, &p_buf[index]); + p_buf[index++] = (p_write_params == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + if (p_write_params != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 9, *p_buf_len); + p_buf[index++] = p_write_params->write_op; + p_buf[index++] = p_write_params->flags; + index += uint16_encode(p_write_params->handle, &p_buf[index]); + index += uint16_encode(p_write_params->offset, &p_buf[index]); + index += uint16_encode(p_write_params->len, &p_buf[index]); + + SER_ERROR_CHECK(p_write_params->len <= BLE_GATTC_WRITE_P_VALUE_LEN_MAX, + NRF_ERROR_INVALID_PARAM); + + p_buf[index++] = (p_write_params->p_value == NULL) ? + SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + if (p_write_params->p_value != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + p_write_params->len, *p_buf_len); + memcpy(&p_buf[index], p_write_params->p_value, p_write_params->len); + index += p_write_params->len; + } + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_write_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_WRITE, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gatts_app.h b/components/serialization/application/codecs/s110/serializers/ble_gatts_app.h new file mode 100644 index 0000000..ab889d7 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gatts_app.h @@ -0,0 +1,554 @@ +/* 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. + * + */ +#ifndef BLE_GATTS_APP_H__ +#define BLE_GATTS_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s110_codecs Application s110 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gatts_app GATTS Application command request encoders and command response decoders + * @{ + * @ingroup ser_app_s110_codecs + * + * @brief GATTS Application command request encoders and command response decoders. + */ +#include "ble_gatts.h" +#include "ble.h" + +/**@brief Encodes @ref sd_ble_gatts_value_get command request. + * + * @sa @ref nrf51_gatts_value_get_encoding for packet format, + * @ref ble_gatts_value_get_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle. + * @param[in] handle Attribute handle. + * @param[in] p_value Pointer to attribute value information. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_data_len and \p p_data will not be updated by the command + * request encoder. Updated values are set by @ref ble_gatts_value_get_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_value_get_req_enc(uint16_t conn_handle, + uint16_t handle, + ble_gatts_value_t const * const p_value, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_value_get command. + * + * @sa @ref nrf51_gatts_value_get_encoding for packet format, + * @ref ble_gatts_value_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_value Pointer to structure where the attribute value will be stored. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Length of \p p_value is too small to hold decoded + * value from response. + */ +uint32_t ble_gatts_value_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gatts_value_t * const p_value, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gatts_hvx command request. + * + * @sa @ref nrf51_gatts_hvx_encoding for packet format, + * @ref ble_gatts_hvx_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle. + * @param[in] p_hvx_params Pointer to an HVx parameters structure to be encoded. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_hvx_params will not be updated by the command + * request encoder. Updated values are set by @ref ble_gatts_hvx_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_hvx_req_enc(uint16_t conn_handle, + ble_gatts_hvx_params_t const * const p_hvx_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_hvx command. + * + * @sa @ref nrf51_gatts_hvx_encoding for packet format, + * @ref ble_gatts_hvx_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * @param[out] pp_bytes_written Pointer to pointer to location where number of bytes is written. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_hvx_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code, + uint16_t * * const pp_bytes_written); + +/**@brief Encodes @ref sd_ble_gatts_characteristic_add command request. + * + * @sa @ref nrf51_characteristics_add_encoding for packet format, + * @ref ble_gatts_characteristic_add_rsp_dec for command response decoder. + * + * @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 Pointer to a @ref ble_gatts_char_md_t structure, characteristic + * metadata. + * @param[in] p_attr_char_value Pointer to a @ref ble_gatts_attr_t structure, corresponding to + * the characteristic value. + * @param[in] p_handles Pointer to a @ref ble_gatts_char_handles_t structure, where the + * assigned handles will be stored. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_handles will not be updated by the command + * request encoder. Updated values are set by @ref ble_gatts_characteristic_add_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_characteristic_add_req_enc + (uint16_t service_handle, + ble_gatts_char_md_t const * const p_char_md, + ble_gatts_attr_t const * const p_attr_char_value, + ble_gatts_char_handles_t const * const p_handles, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_characteristic_add command. + * + * @sa @ref nrf51_characteristics_add_encoding for packet format, + * @ref ble_gatts_characteristic_add_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_handles Pointer to pointer to location where handles should be decoded. + * @param[out] p_result_code Pointer to command result code decode location. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_characteristic_add_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * * const pp_handles, + uint32_t * const p_result_code); + + +/**@brief Encodes @ref sd_ble_gatts_service_add command request. + * + * @sa @ref nrf51_gatts_service_add_encoding for packet format, + * @ref ble_gatts_service_add_rsp_dec for command response decoder. + * + * @param[in] type Toggles between primary and secondary services, + * see @ref BLE_GATTS_SRVC_TYPES. + * @param[in] p_uuid Pointer to service UUID. + * @param[in] p_conn_handle Pointer to a 16-bit word where the assigned handle will be stored. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_conn_handle will not be updated by the command + * request encoder. Updated values are set by @ref ble_gatts_service_add_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_service_add_req_enc(uint8_t type, + ble_uuid_t const * const p_uuid, + uint16_t const * const p_conn_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_service_add command. + * + * @sa @ref nrf51_gatts_service_add_encoding for packet format, + * @ref ble_gatts_service_add_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Connection handle. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_service_add_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gatts_sys_attr_set command request. + * + * @sa @ref nrf51_gatts_sys_attr_set_encoding for packet format, + * @ref ble_gatts_sys_attr_set_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle. + * @param[in] p_sys_attr_data Pointer to a buffer (at least \p sys_attr_data_len bytes long) + * containing the attribute value to write. + * @param[in] sys_attr_data_len Length (in bytes) of \p p_sys_attr_data. + * @param[in] flags Optional additional flags. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_sys_attr_set_req_enc(uint16_t conn_handle, + uint8_t const * const p_sys_attr_data, + uint16_t sys_attr_data_len, + uint32_t flags, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_sys_attr_set command. + * + * @sa @ref nrf51_gatts_sys_attr_set_encoding for packet format, + * @ref ble_gatts_sys_attr_set_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_sys_attr_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gatts_value_set command request. + * + * @sa @ref nrf51_gatts_value_set_encoding for packet format, + * @ref ble_gatts_value_set_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle. + * @param[in] handle Attribute handle. + * @param[in] p_value Pointer to attribute value information. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_value_set_req_enc(uint16_t conn_handle, + uint16_t handle, + ble_gatts_value_t * p_value, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_value_set command. + * + * @sa @ref nrf51_gatts_value_set_encoding for packet format, + * @ref ble_gatts_value_set_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_value Pointer to attribute value information.. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_value_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gatts_value_t * const p_value, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gatts_sys_attr_get command request. + * + * @sa @ref nrf51_gatts_sys_attr_get_encoding for packet format, + * @ref ble_gatts_sys_attr_get_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_sys_attr_data Pointer to buffer where updated information about system + * attributes will be stored. Can be NULL to calculate required + * size. + * @param[in] p_sys_attr_data_len Size of p_sys_attr_data buffer if \p p_sys_attr_data is + * not NULL. + * @param[in] flags Additional optional flags. + * @param[in,out] p_buf Pointer to buffer where encoded data command will + * be returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_sys_attr_data and \p p_sys_attr_data_len will not be updated by the command + * request encoder. Updated values are set by @ref ble_gatts_sys_attr_get_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_sys_attr_get_req_enc(uint16_t conn_handle, + uint8_t const * const p_sys_attr_data, + uint16_t const * const p_sys_attr_data_len, + uint32_t flags, + uint8_t * const p_buf, + uint32_t * p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_sys_attr_get command. + * + * @sa @ref nrf51_gatts_sys_attr_get_encoding for packet format, + * @ref ble_gatts_sys_attr_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_sys_attr_data Pointer to a buffer where updated information about system + * attributes will be stored. + * @param[in,out] p_sys_attr_data_len \c in: Size (in bytes) of \p p_sys_attr_data buffer. + * \c out: Length of decoded contents of \p p_sys_attr_data. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Length of \p p_sys_attr_data is too small to hold decoded + * value from response. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_sys_attr_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * const p_sys_attr_data, + uint16_t * const p_sys_attr_data_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gatts_descriptor_add command request. + * + * @sa @ref nrf51_descriptor_add_encoding for packet format, + * @ref ble_gatts_descriptor_add_rsp_dec for command response decoder. + * + * @param[in] char_handle Handle of the characteristic where the description is to be placed. + * If @ref BLE_GATT_HANDLE_INVALID is used, it will be placed + * sequentially. + * @param[in] p_attr Pointer to a @ref ble_gatts_attr_t structure, characteristic + * metadata. + * @param[in] p_handle Pointer to a @ref ble_gatts_char_handles_t structure, where the + * assigned handles will be stored. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_descriptor_add_req_enc(uint16_t char_handle, + ble_gatts_attr_t const * const p_attr, + uint16_t * const p_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_descriptor_add command. + * + * @sa @ref nrf51_descriptor_add_encoding for packet format, + * @ref ble_gatts_descriptor_add_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_handle Pointer to bufer where descriptor handle will be + returned. + * @param[out] p_result_code Pointer to command result code decode location. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_descriptor_add_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_handle, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gatts_include_add command request. + * + * @sa @ref nrf51_gatts_include_add_encoding for packet format, + * @ref ble_gatts_include_add_rsp_dec for command response decoder. + * + * @param[in] service_handle Handle of the service where the included service is to be placed. + * @param[in] inc_srvc_handle Handle of the included service + * @param[in] p_include_handle Pointer to Pointer to a 16-bit word where the assigned handle will be stored. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_include_add_req_enc(uint16_t service_handle, + uint16_t inc_srvc_handle, + uint16_t * const p_include_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_include_add command. + * + * @sa @ref nrf51_gatts_include_add_encoding for packet format, + * @ref ble_gatts_include_add_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_include_handle Pointer to a 16-bit word where the assigned handle will be stored. + * @param[out] p_result_code Pointer to command result code decode location. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_include_add_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_include_handle, + uint32_t * const p_result_code); + + +/**@brief Encodes @ref sd_ble_gatts_rw_authorize_reply command request. + * + * @sa @ref nrf51_gatts_rw_authorize_reply_encoding for packet format, + * @ref ble_gatts_rw_authorize_reply_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle. + * @param[in] p_reply_params Pointer to \ref ble_gatts_rw_authorize_reply_params_t + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Encoding failure. Invalid param provided in p_reply_params. + */ +uint32_t ble_gatts_rw_authorize_reply_req_enc( + uint16_t conn_handle, + ble_gatts_rw_authorize_reply_params_t const * const + p_reply_params, + uint8_t * const + p_buf, + uint32_t * const + p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_rw_authorize_reply command. + * + * @sa @ref nrf51_gatts_rw_authorize_reply_encoding for packet format, + * @ref ble_gatts_rw_authorize_reply_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_rw_authorize_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gatts_service_changed command request. + * + * @sa @ref nrf51_service_changed_encoding for packet format, + * @ref ble_gatts_service_changed_rsp_dec for command response decoder. + * + * @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. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Encoding failure. Invalid param provided in p_reply_params. + */ +uint32_t ble_gatts_service_changed_req_enc(uint16_t conn_handle, + uint16_t start_handle, + uint16_t end_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_service_changed command. + * + * @sa @ref nrf51_service_changed_encoding for packet format, + * @ref ble_gatts_service_changed_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_service_changed_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/** @} */ +#endif //BLE_GATTS_APP_H__ + + diff --git a/components/serialization/application/codecs/s110/serializers/ble_gatts_characteristic_add.c b/components/serialization/application/codecs/s110/serializers/ble_gatts_characteristic_add.c new file mode 100644 index 0000000..75e164d --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gatts_characteristic_add.c @@ -0,0 +1,89 @@ +/* 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 "ble_gatts_app.h" +#include +#include "ble_serialization.h" +#include "ble_gatts.h" +#include "app_util.h" +#include "cond_field_serialization.h" +#include "ble_gatts_struct_serialization.h" + +uint32_t ble_gatts_characteristic_add_req_enc( + uint16_t service_handle, + ble_gatts_char_md_t const * const p_char_md, + ble_gatts_attr_t const * const p_attr_char_value, + ble_gatts_char_handles_t const * const p_handles, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + uint8_t opcode = SD_BLE_GATTS_CHARACTERISTIC_ADD; + uint32_t buf_len = *p_buf_len; + + err_code = uint8_t_enc(&opcode, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&service_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_char_md, p_buf, buf_len, &index, ble_gatts_char_md_enc); + SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_attr_char_value, p_buf, buf_len, &index, ble_gatts_attr_enc); + SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_handles, p_buf, buf_len, &index, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gatts_characteristic_add_rsp_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * * const pp_handles, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t index = 0; + + uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, buf_len, + SD_BLE_GATTS_CHARACTERISTIC_ADD, + p_result_code); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, buf_len); + return NRF_SUCCESS; + } + + err_code = cond_field_dec(p_buf, + buf_len, + &index, + (void * *)pp_handles, + ble_gatts_char_handles_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gatts_descriptor_add.c b/components/serialization/application/codecs/s110/serializers/ble_gatts_descriptor_add.c new file mode 100644 index 0000000..ea895bb --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gatts_descriptor_add.c @@ -0,0 +1,91 @@ +/* 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 "ble_gatts_app.h" +#include +#include +#include "ble_serialization.h" +#include "ble_gap.h" +#include "app_util.h" +#include "cond_field_serialization.h" +#include "ble_gatts_struct_serialization.h" + + +uint32_t ble_gatts_descriptor_add_req_enc(uint16_t char_handle, + ble_gatts_attr_t const * const p_attr, + uint16_t * const p_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(1, *p_buf_len); + p_buf[index++] = SD_BLE_GATTS_DESCRIPTOR_ADD; + + uint32_t err_code = uint16_t_enc(&char_handle, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_attr, + p_buf, + *p_buf_len, + &index, + ble_gatts_attr_enc); + SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + p_buf[index++] = (p_handle != NULL) ? SER_FIELD_PRESENT : + SER_FIELD_NOT_PRESENT; + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gatts_descriptor_add_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_handle, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t index = 0; + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, + &index, + packet_len, + SD_BLE_GATTS_DESCRIPTOR_ADD, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + SER_ASSERT_LENGTH_LEQ(index + 2, packet_len); + SER_ASSERT_NOT_NULL(p_handle); + + uint16_dec(p_buf, packet_len, &index, p_handle); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gatts_evt_app.h b/components/serialization/application/codecs/s110/serializers/ble_gatts_evt_app.h new file mode 100644 index 0000000..7ea133e --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gatts_evt_app.h @@ -0,0 +1,186 @@ +/* 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 BLE_GATTS_EVT_APP_H__ +#define BLE_GATTS_EVT_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s110_codecs Application s110 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gatts_evt_app GATTS Application event decoders + * @{ + * @ingroup ser_app_s110_codecs + * + * @brief GATTS Application event decoders. + */ +#include "ble.h" + +/** + * @brief Decodes ble_gatts_evt_hvc event. + * + * @sa @ref nrf51_gatts_evt_hvc_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gatts_evt_hvc_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gatts_evt_rw_authorize_request event. + * + * @sa @ref nrf51_evt_rw_authorize_request for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gatts_evt_rw_authorize_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gatts_evt_sc_confirm event. + * + * @sa @ref nrf51_gatts_evt_sc_confirm_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gatts_evt_sc_confirm_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gatts_evt_sys_attr_missing event. + * + * @sa @ref nrf51_evt_sys_attr_missing_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gatts_evt_sys_attr_missing_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gatts_evt_timeout event. + * + * @sa @ref nrf51_gatts_evt_timeout_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gatts_evt_timeout_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gatts_evt_write event. + * + * @sa @ref nrf51_evt_write_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gatts_evt_write_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** @} */ +#endif diff --git a/components/serialization/application/codecs/s110/serializers/ble_gatts_evt_hvc.c b/components/serialization/application/codecs/s110/serializers/ble_gatts_evt_hvc.c new file mode 100644 index 0000000..2c1c5aa --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gatts_evt_hvc.c @@ -0,0 +1,51 @@ +/* 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 "ble_gatts_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_evt_hvc_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 1, packet_len); + + uint32_t event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gatts_evt_hvc_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTS_EVT_HVC; + p_event->header.evt_len = event_len; + + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gatts_evt.conn_handle); + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gatts_evt.params.hvc.handle); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gatts_evt_rw_authorize_request.c b/components/serialization/application/codecs/s110/serializers/ble_gatts_evt_rw_authorize_request.c new file mode 100644 index 0000000..86f1b35 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gatts_evt_rw_authorize_request.c @@ -0,0 +1,78 @@ +/* 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 "ble_gatts_evt_app.h" +#include "ble_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "app_ble_user_mem.h" +#include "app_util.h" + +extern ser_ble_user_mem_t m_app_user_mem_table[]; + +uint32_t ble_gatts_evt_rw_authorize_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + uint32_t in_event_len = *p_event_len; + + *p_event_len = offsetof(ble_evt_t, evt.gatts_evt.params) - sizeof (ble_evt_hdr_t); + + uint16_t conn_handle; + err_code = uint16_t_dec(p_buf, packet_len, &index, &conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + void * p_void_authorize_request = NULL; + + if (p_event != NULL) + { + SER_ASSERT_LENGTH_LEQ(*p_event_len, in_event_len); + + p_event->header.evt_id = BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST; + p_event->evt.gatts_evt.conn_handle = conn_handle; + + p_void_authorize_request = &(p_event->evt.gatts_evt.params.authorize_request); + } + uint32_t tmp_event_len = in_event_len - *p_event_len; + err_code = ble_gatts_evt_rw_authorize_request_t_dec(p_buf, + packet_len, + &index, + &tmp_event_len, + p_void_authorize_request); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_event_len += tmp_event_len; + + if(p_event != NULL) + { + if((p_event->evt.gatts_evt.params.authorize_request.type == BLE_GATTS_AUTHORIZE_TYPE_WRITE) && (p_event->evt.gatts_evt.params.authorize_request.request.write.op == BLE_GATTS_OP_EXEC_WRITE_REQ_NOW)) + { + uint32_t conn_index; + + if(app_ble_user_mem_context_find(p_event->evt.gatts_evt.conn_handle, &conn_index) != NRF_ERROR_NOT_FOUND) + { + err_code = len16data_dec(p_buf, packet_len, &index, &m_app_user_mem_table[conn_index].mem_block.p_mem, &m_app_user_mem_table[conn_index].mem_block.len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + } + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gatts_evt_sc_confirm.c b/components/serialization/application/codecs/s110/serializers/ble_gatts_evt_sc_confirm.c new file mode 100644 index 0000000..d8d440f --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gatts_evt_sc_confirm.c @@ -0,0 +1,49 @@ +/* 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 "ble_gatts_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_evt_sc_confirm_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE, packet_len); + + uint32_t event_len = SER_EVT_CONN_HANDLE_SIZE; + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTS_EVT_SC_CONFIRM; + p_event->header.evt_len = event_len; + + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gatts_evt.conn_handle); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gatts_evt_sys_attr_missing.c b/components/serialization/application/codecs/s110/serializers/ble_gatts_evt_sys_attr_missing.c new file mode 100644 index 0000000..8b17268 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gatts_evt_sys_attr_missing.c @@ -0,0 +1,51 @@ +/* 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 "ble_gatts_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_evt_sys_attr_missing_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(3, packet_len); + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gatts_evt.params.sys_attr_missing)) + + sizeof (ble_gatts_evt_sys_attr_missing_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTS_EVT_SYS_ATTR_MISSING; + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + uint8_dec(p_buf, packet_len, &index, &p_event->evt.gatts_evt.params.sys_attr_missing.hint); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gatts_evt_timeout.c b/components/serialization/application/codecs/s110/serializers/ble_gatts_evt_timeout.c new file mode 100644 index 0000000..fba0b11 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gatts_evt_timeout.c @@ -0,0 +1,50 @@ +/* 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 "ble_gatts_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_evt_timeout_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 1, packet_len); + + uint32_t event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gatts_evt_timeout_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTS_EVT_TIMEOUT; + p_event->header.evt_len = event_len; + + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gatts_evt.conn_handle); + uint8_dec(p_buf, packet_len, &index, &p_event->evt.gatts_evt.params.timeout.src); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gatts_evt_write.c b/components/serialization/application/codecs/s110/serializers/ble_gatts_evt_write.c new file mode 100644 index 0000000..d6e7918 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gatts_evt_write.c @@ -0,0 +1,78 @@ +/* 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 "ble_gatts_evt_app.h" +#include +#include "ble_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "app_ble_user_mem.h" +#include "app_util.h" + +extern ser_ble_user_mem_t m_app_user_mem_table[]; + +uint32_t ble_gatts_evt_write_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = 0; + + uint32_t in_event_len = *p_event_len; + + *p_event_len = offsetof(ble_evt_t, evt.gatts_evt.params) - sizeof (ble_evt_hdr_t); + + uint16_t conn_handle; + err_code = uint16_t_dec(p_buf, packet_len, &index, &conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + void * p_void_write = NULL; + + if (p_event != NULL) + { + SER_ASSERT_LENGTH_LEQ(*p_event_len, in_event_len); + p_event->evt.gatts_evt.conn_handle = conn_handle; + + p_void_write = &(p_event->evt.gatts_evt.params.write); + } + + uint32_t tmp_struct_len = in_event_len - *p_event_len; + err_code = ble_gatts_evt_write_t_dec(p_buf, + packet_len, + &index, + &tmp_struct_len, + p_void_write); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_event_len += tmp_struct_len; + + if(p_event != NULL) + { + if(p_event->evt.gatts_evt.params.write.op == BLE_GATTS_OP_EXEC_WRITE_REQ_NOW) + { + uint32_t conn_index; + + if(app_ble_user_mem_context_find(p_event->evt.gatts_evt.conn_handle, &conn_index) != NRF_ERROR_NOT_FOUND) + { + err_code = len16data_dec(p_buf, packet_len, &index, &m_app_user_mem_table[conn_index].mem_block.p_mem, &m_app_user_mem_table[conn_index].mem_block.len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + } + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gatts_hvx.c b/components/serialization/application/codecs/s110/serializers/ble_gatts_hvx.c new file mode 100644 index 0000000..4682af8 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gatts_hvx.c @@ -0,0 +1,115 @@ +/* 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 "ble_gatts_app.h" +#include +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gap.h" +#include "app_util.h" + + +uint32_t ble_gatts_hvx_req_enc(uint16_t conn_handle, + ble_gatts_hvx_params_t const * const p_hvx_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT(p_hvx_params == NULL || + !(p_hvx_params->p_len == NULL && p_hvx_params->p_data != NULL), NRF_ERROR_NULL); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 2 + 1 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GATTS_HVX; + index += uint16_encode(conn_handle, &p_buf[index]); + + p_buf[index++] = (p_hvx_params != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_hvx_params != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 2 + 1 + 2 + 2, *p_buf_len); + index += uint16_encode(p_hvx_params->handle, &p_buf[index]); + p_buf[index++] = p_hvx_params->type; + index += uint16_encode(p_hvx_params->offset, &p_buf[index]); + + if (p_hvx_params->p_len != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 1 + 2 + 1, *p_buf_len); + + SER_ERROR_CHECK(*p_hvx_params->p_len <= BLE_GATTS_VAR_ATTR_LEN_MAX, + NRF_ERROR_INVALID_PARAM); + p_buf[index++] = SER_FIELD_PRESENT; + index += uint16_encode(*(p_hvx_params->p_len), &p_buf[index]); + + if (p_hvx_params->p_data != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 1 + *(p_hvx_params->p_len), *p_buf_len); + p_buf[index++] = SER_FIELD_PRESENT; + memcpy(&(p_buf[index]), p_hvx_params->p_data, *(p_hvx_params->p_len)); + index += *(p_hvx_params->p_len); + } + else + { + p_buf[index++] = SER_FIELD_NOT_PRESENT; + } + } + else + { + p_buf[index++] = SER_FIELD_NOT_PRESENT; + p_buf[index++] = SER_FIELD_NOT_PRESENT; + } + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gatts_hvx_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code, + uint16_t * * const pp_bytes_written) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t err_code; + uint32_t index = 0; + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, + &index, + packet_len, + SD_BLE_GATTS_HVX, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_bytes_written, uint16_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gatts_include_add.c b/components/serialization/application/codecs/s110/serializers/ble_gatts_include_add.c new file mode 100644 index 0000000..cb991a8 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gatts_include_add.c @@ -0,0 +1,74 @@ +/* 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 "ble_gatts_app.h" +#include "ble_serialization.h" +#include "ble_gatts.h" +#include "app_util.h" + + +uint32_t ble_gatts_include_add_req_enc(uint16_t service_handle, + uint16_t inc_srvc_handle, + uint16_t * const p_include_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + SER_ASSERT_LENGTH_LEQ(6, *p_buf_len); + + uint32_t index = 0; + uint32_t buf_len = *p_buf_len; + uint32_t err_code; + uint8_t opCode = SD_BLE_GATTS_INCLUDE_ADD; + uint8_t presenceFlag; + + err_code = uint8_t_enc(&opCode, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + err_code = uint16_t_enc(&service_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + err_code = uint16_t_enc(&inc_srvc_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + presenceFlag = (p_include_handle != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + err_code = uint8_t_enc(&presenceFlag, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + *p_buf_len = index; + return err_code; + +} + + +uint32_t ble_gatts_include_add_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_include_handle, + uint32_t * const p_result_code) +{ + uint32_t index = 0; + uint32_t err_code; + + err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_GATTS_INCLUDE_ADD, + p_result_code); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + SER_ASSERT_NOT_NULL(p_include_handle); + SER_ASSERT_LENGTH_LEQ(index + 2, packet_len); + err_code = uint16_t_dec(p_buf, packet_len, &index, p_include_handle); + SER_ASSERT_LENGTH_EQ(index, packet_len); + return err_code; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gatts_rw_authorize_reply.c b/components/serialization/application/codecs/s110/serializers/ble_gatts_rw_authorize_reply.c new file mode 100644 index 0000000..f792b7e --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gatts_rw_authorize_reply.c @@ -0,0 +1,57 @@ +/* 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 "ble_gatts_app.h" +#include "ble_serialization.h" +#include "app_util.h" +#include "cond_field_serialization.h" +#include "ble_gatts_struct_serialization.h" + +uint32_t ble_gatts_rw_authorize_reply_req_enc( + uint16_t conn_handle, + ble_gatts_rw_authorize_reply_params_t const * const + p_reply_params, + uint8_t * const + p_buf, + uint32_t * const + p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t buf_len = *p_buf_len; + uint8_t opcode = SD_BLE_GATTS_RW_AUTHORIZE_REPLY; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint8_t_enc(&opcode, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_reply_params, p_buf, buf_len, &index, + ble_gatts_rw_authorize_reply_params_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gatts_rw_authorize_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTS_RW_AUTHORIZE_REPLY, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gatts_service_add.c b/components/serialization/application/codecs/s110/serializers/ble_gatts_service_add.c new file mode 100644 index 0000000..443c660 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gatts_service_add.c @@ -0,0 +1,83 @@ +/* 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 "ble_gatts_app.h" +#include "ble_serialization.h" +#include "ble_gatts.h" +#include "app_util.h" + + +uint32_t ble_gatts_service_add_req_enc(uint8_t type, + ble_uuid_t const * const p_uuid, + uint16_t const * const p_conn_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 1 + 1 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GATTS_SERVICE_ADD; + p_buf[index++] = type; + + p_buf[index++] = (p_uuid != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_uuid != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len); + index += uint16_encode(p_uuid->uuid, &p_buf[index]); + p_buf[index++] = p_uuid->type; + } + + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + p_buf[index++] = (p_conn_handle != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gatts_service_add_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint32_t * const p_result_code) +{ + uint32_t index = 0; + + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_GATTS_SERVICE_ADD, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_conn_handle); + + SER_ASSERT_LENGTH_LEQ(index + 2, packet_len); + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return decode_result; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gatts_service_changed.c b/components/serialization/application/codecs/s110/serializers/ble_gatts_service_changed.c new file mode 100644 index 0000000..aba707e --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gatts_service_changed.c @@ -0,0 +1,55 @@ +/* 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 "ble_gatts_app.h" +#include "ble_serialization.h" +#include "ble_gatts.h" +#include "app_util.h" + + +uint32_t ble_gatts_service_changed_req_enc(uint16_t conn_handle, + uint16_t start_handle, + uint16_t end_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code; + uint8_t opcode = SD_BLE_GATTS_SERVICE_CHANGED; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + err_code = uint8_t_enc(&opcode, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&start_handle, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&end_handle, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gatts_service_changed_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTS_SERVICE_CHANGED, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gatts_sys_attr_get.c b/components/serialization/application/codecs/s110/serializers/ble_gatts_sys_attr_get.c new file mode 100644 index 0000000..6f36b20 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gatts_sys_attr_get.c @@ -0,0 +1,113 @@ +/* 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 "ble_gatts_app.h" +#include +#include +#include "ble_serialization.h" +#include "ble_gap.h" +#include "app_util.h" + + +uint32_t ble_gatts_sys_attr_get_req_enc(uint16_t conn_handle, + uint8_t const * const p_sys_attr_data, + uint16_t const * const p_sys_attr_data_len, + uint32_t flags, + uint8_t * const p_buf, + uint32_t * p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 2 + 1 + 4, *p_buf_len); + p_buf[index++] = SD_BLE_GATTS_SYS_ATTR_GET; + index += uint16_encode(conn_handle, &p_buf[index]); + + p_buf[index++] = (p_sys_attr_data_len != NULL) ? SER_FIELD_PRESENT : + SER_FIELD_NOT_PRESENT; + + if (p_sys_attr_data_len != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 2, *p_buf_len); + index += uint16_encode(*p_sys_attr_data_len, &p_buf[index]); + } + + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + p_buf[index++] = (p_sys_attr_data != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + err_code = uint32_t_enc(&flags, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gatts_sys_attr_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * const p_sys_attr_data, + uint16_t * const p_sys_attr_data_len, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t index = 0; + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, + &index, + packet_len, + SD_BLE_GATTS_SYS_ATTR_GET, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + SER_ASSERT_LENGTH_LEQ(index + 2 + 1, packet_len); + + uint16_t sys_attr_len; + uint16_dec(p_buf, packet_len, &index, &sys_attr_len); + + if (p_buf[index++] == SER_FIELD_PRESENT) + { + SER_ASSERT_NOT_NULL(p_sys_attr_data); + SER_ASSERT_NOT_NULL(p_sys_attr_data_len); + SER_ASSERT(sys_attr_len <= *p_sys_attr_data_len, NRF_ERROR_DATA_SIZE); + + SER_ASSERT_LENGTH_LEQ(index + sys_attr_len, packet_len); + memcpy(p_sys_attr_data, &p_buf[index], sys_attr_len); + *p_sys_attr_data_len = sys_attr_len; + index += sys_attr_len; + } + else + { + if (p_sys_attr_data_len != NULL) + { + *p_sys_attr_data_len = sys_attr_len; + } + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gatts_sys_attr_set.c b/components/serialization/application/codecs/s110/serializers/ble_gatts_sys_attr_set.c new file mode 100644 index 0000000..b8830a6 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gatts_sys_attr_set.c @@ -0,0 +1,65 @@ +/* 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 "ble_gatts_app.h" +#include +#include "ble_serialization.h" +#include "ble_gatts.h" +#include "app_util.h" + + +uint32_t ble_gatts_sys_attr_set_req_enc(uint16_t conn_handle, + uint8_t const * const p_sys_attr_data, + uint16_t sys_attr_data_len, + uint32_t flags, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 8, *p_buf_len); + + p_buf[index++] = SD_BLE_GATTS_SYS_ATTR_SET; + index += uint16_encode(conn_handle, &p_buf[index]); + + p_buf[index++] = (p_sys_attr_data != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_sys_attr_data != NULL) + { + //lint -save -esym(670,memcpy) + SER_ERROR_CHECK(sys_attr_data_len <= BLE_GATTS_VAR_ATTR_LEN_MAX, NRF_ERROR_INVALID_PARAM); + SER_ASSERT_LENGTH_LEQ(index + 2 + sys_attr_data_len + 4, *p_buf_len); + index += uint16_encode(sys_attr_data_len, &p_buf[index]); + memcpy(&(p_buf[index]), p_sys_attr_data, sys_attr_data_len); + //lint -restore + index += sys_attr_data_len; + } + + err_code = uint32_t_enc(&flags, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gatts_sys_attr_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTS_SYS_ATTR_SET, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gatts_value_get.c b/components/serialization/application/codecs/s110/serializers/ble_gatts_value_get.c new file mode 100644 index 0000000..54d5844 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gatts_value_get.c @@ -0,0 +1,126 @@ +/* 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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_gatts_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" +#include "cond_field_serialization.h" +#include "ble_gatts_struct_serialization.h" + +uint32_t ble_gatts_value_get_req_enc(uint16_t conn_handle, + uint16_t handle, + ble_gatts_value_t const * const p_value, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + uint32_t total_len = *p_buf_len; + + SER_ASSERT_LENGTH_LEQ(1 + 2 + 2 + 1, total_len); + p_buf[index++] = SD_BLE_GATTS_VALUE_GET; + + err_code = uint16_t_enc(&conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (p_value != NULL) + { + p_buf[index++] = SER_FIELD_PRESENT; + err_code = uint16_t_enc(&(p_value->len), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_value->offset), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(1, total_len - index); + if (p_value->p_value != NULL) + { + p_buf[index++] = SER_FIELD_PRESENT; + } + else + { + p_buf[index++] = SER_FIELD_NOT_PRESENT; + } + } + else + { + p_buf[index++] = SER_FIELD_NOT_PRESENT; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gatts_value_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gatts_value_t * const p_value, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + SER_ASSERT_NOT_NULL(p_value); + + uint32_t err_code; + uint32_t index = 0; + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, + packet_len, SD_BLE_GATTS_VALUE_GET, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + err_code = ble_gatts_value_t_dec(p_buf, packet_len, &index, p_value); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_gatts_value_set.c b/components/serialization/application/codecs/s110/serializers/ble_gatts_value_set.c new file mode 100644 index 0000000..e11cffc --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_gatts_value_set.c @@ -0,0 +1,84 @@ +/* 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 "ble_gatts_app.h" +#include +#include "nrf_error.h" +#include "cond_field_serialization.h" +#include "ble_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_gatts_value_set_req_enc(uint16_t conn_handle, + uint16_t handle, + ble_gatts_value_t * p_value, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(1 + 2 + 2, *p_buf_len); + p_buf[index++] = SD_BLE_GATTS_VALUE_SET; + index += uint16_encode(conn_handle, &p_buf[index]); + index += uint16_encode(handle, &p_buf[index]); + + if(p_value != NULL) + { + SER_ERROR_CHECK(p_value->len <= BLE_GATTS_VAR_ATTR_LEN_MAX, NRF_ERROR_INVALID_PARAM); + } + err_code = cond_field_enc(p_value, p_buf, *p_buf_len, &index, ble_gatts_value_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gatts_value_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gatts_value_t * const p_value, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, + &index, + packet_len, + SD_BLE_GATTS_VALUE_SET, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + err_code = ble_gatts_value_t_dec(p_buf, packet_len, &index, p_value); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_l2cap_app.h b/components/serialization/application/codecs/s110/serializers/ble_l2cap_app.h new file mode 100644 index 0000000..9a20fae --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_l2cap_app.h @@ -0,0 +1,163 @@ +/* Copyright (c) 2014 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. + * + */ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s110_codecs Application s110 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_l2cap_app L2CAP Application command request encoders and command response decoders + * @{ + * @ingroup ser_app_s110_codecs + * + * @brief L2CAP Application command request encoders and command response decoders. + */ + +#ifndef BLE_L2CAP_APP_H__ +#define BLE_L2CAP_APP_H__ + +#include "ble.h" +#include "ble_types.h" +#include "ble_ranges.h" +#include "ble_err.h" +#include "ble_l2cap.h" + +/**@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. + * + * @param[in] cid L2CAP CID. + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_l2cap_cid_register_req_enc(uint16_t cid, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_l2cap_cid_register command. + * + * @sa @ref nrf51_adv_start_encoding for packet format, + * @ref ble_l2cap_cid_register_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_l2cap_cid_register_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Unregister a CID with L2CAP. + * + * @details This unregisters a previously registered higher protocol layer with the L2CAP multiplexer. + * + * @param[in] cid L2CAP CID. + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_l2cap_cid_unregister_req_enc(uint16_t cid, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_l2cap_cid_unregister command. + * + * @sa @ref nrf51_adv_start_encoding for packet format, + * @ref ble_l2cap_cid_unregister_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_l2cap_cid_unregister_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Transmit an L2CAP packet. + * + * @note It is important to note that a call to this function will consume an application buffer, 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_buffer_count_get for more details. + * + * @param[in] conn_handle Connection Handle. + * @param[in] p_l2cap_header Pointer to a packet header containing length and CID. + * @param[in] p_data Pointer to the data to be transmitted. + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @return @ref NRF_SUCCESS Successfully queued an L2CAP packet for transmission. + * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @return @ref NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, CIDs must be registered beforehand with @ref sd_ble_l2cap_cid_register. + * @return @ref NRF_ERROR_NOT_FOUND CID not found. + * @return @ref NRF_ERROR_NO_MEM Not enough memory to complete operation. + * @return @ref BLE_ERROR_NO_TX_BUFFERS Not enough application buffers available. + * @return @ref NRF_ERROR_DATA_SIZE Invalid data size(s) supplied, see @ref BLE_L2CAP_MTU_DEF. + */ +uint32_t ble_l2cap_tx_req_enc(uint16_t conn_handle, + ble_l2cap_header_t const * const p_l2cap_header, + uint8_t const * const p_data, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_l2cap_tx command. + * + * @sa @ref nrf51_adv_start_encoding for packet format, + * @ref ble_l2cap_tx_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_l2cap_tx_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + + +#endif //BLE_L2CAP_APP_H__ + +/** + @} + */ diff --git a/components/serialization/application/codecs/s110/serializers/ble_l2cap_cid_register.c b/components/serialization/application/codecs/s110/serializers/ble_l2cap_cid_register.c new file mode 100644 index 0000000..de597fe --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_l2cap_cid_register.c @@ -0,0 +1,45 @@ +/* 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 "ble_gap_app.h" +#include +#include "ble_serialization.h" +#include "ble_gap.h" +#include "app_util.h" + +uint32_t ble_l2cap_cid_register_req_enc(uint16_t cid, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len); + + p_buf[index++] = SD_BLE_L2CAP_CID_REGISTER; + err_code = uint16_t_enc(&cid, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_l2cap_cid_register_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_L2CAP_CID_REGISTER, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_l2cap_cid_unregister.c b/components/serialization/application/codecs/s110/serializers/ble_l2cap_cid_unregister.c new file mode 100644 index 0000000..cd6e65a --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_l2cap_cid_unregister.c @@ -0,0 +1,45 @@ +/* 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 "ble_gap_app.h" +#include +#include "ble_serialization.h" +#include "ble_gap.h" +#include "app_util.h" + +uint32_t ble_l2cap_cid_unregister_req_enc(uint16_t cid, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len); + + p_buf[index++] = SD_BLE_L2CAP_CID_UNREGISTER; + err_code = uint16_t_enc(&cid, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_l2cap_cid_unregister_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_L2CAP_CID_UNREGISTER, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_l2cap_evt_app.h b/components/serialization/application/codecs/s110/serializers/ble_l2cap_evt_app.h new file mode 100644 index 0000000..8076030 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_l2cap_evt_app.h @@ -0,0 +1,61 @@ +/* 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 BLE_L2CAP_EVT_APP_H__ +#define BLE_L2CAP_EVT_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s110_codecs Application s110 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_l2cap_evt_app L2CAP Application event decoders + * @{ + * @ingroup ser_app_s110_codecs + * + * @brief L2CAP Application event decoders. + */ +#include "ble.h" + +/** + * @brief Decodes ble_l2cap_evt_rx event. + * + * @sa @ref nrf51_l2cap_evt_rx_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_l2cap_evt_rx_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** @} */ +#endif diff --git a/components/serialization/application/codecs/s110/serializers/ble_l2cap_evt_rx.c b/components/serialization/application/codecs/s110/serializers/ble_l2cap_evt_rx.c new file mode 100644 index 0000000..d54682a --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_l2cap_evt_rx.c @@ -0,0 +1,56 @@ +/* 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 "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" +#include "ble_l2cap_evt_app.h" + +uint32_t ble_l2cap_evt_rx_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_event_len); + + uint32_t index = 0; + uint32_t in_event_len = *p_event_len; + + *p_event_len = offsetof(ble_l2cap_evt_t, params); + + uint16_t evt_id; + + uint32_t err_code = uint16_t_dec(p_buf, packet_len, &index, &evt_id); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + void * p_rx = NULL; + + if (p_event) + { + err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.l2cap_evt.conn_handle)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + p_rx = &(p_event->evt.l2cap_evt.params.rx); + } + + uint32_t struct_len = in_event_len - *p_event_len; + err_code = ble_l2cap_evt_rx_t_dec(p_buf, packet_len, &index, &struct_len, p_rx); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_event_len += struct_len; + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_l2cap_tx.c b/components/serialization/application/codecs/s110/serializers/ble_l2cap_tx.c new file mode 100644 index 0000000..83baa90 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_l2cap_tx.c @@ -0,0 +1,61 @@ +/* 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 +#include "ble_l2cap_app.h" +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "ble_gap.h" +#include "app_util.h" +#include "cond_field_serialization.h" + +uint32_t ble_l2cap_tx_req_enc(uint16_t conn_handle, + ble_l2cap_header_t const * const p_l2cap_header, + uint8_t const * const p_data, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(1, *p_buf_len); + p_buf[index++] = SD_BLE_L2CAP_TX; + + err_code = uint16_t_enc(&conn_handle, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_l2cap_header, p_buf, *p_buf_len, &index, ble_l2cap_header_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (p_l2cap_header != NULL) + { + err_code = buf_enc(p_data, p_l2cap_header->len, p_buf, *p_buf_len, &index); + } + else + { + err_code = buf_enc(NULL, 0, p_buf, *p_buf_len, &index); + } + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_l2cap_tx_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_L2CAP_TX, p_result_code); +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_opt_get.c b/components/serialization/application/codecs/s110/serializers/ble_opt_get.c new file mode 100644 index 0000000..7728d66 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_opt_get.c @@ -0,0 +1,126 @@ +/* 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 "ble_app.h" +#include +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_opt_get_req_enc(uint32_t opt_id, + ble_opt_t const * const p_opt, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + SER_ASSERT_LENGTH_LEQ(1+4+1, *p_buf_len); // [OPCODE][OP_ID][PRESENT] + SER_ASSERT(((opt_id == BLE_COMMON_OPT_RADIO_CPU_MUTEX) || + (opt_id == BLE_GAP_OPT_CH_MAP) || + (opt_id == BLE_GAP_OPT_LOCAL_CONN_LATENCY) || + (opt_id == BLE_GAP_OPT_PASSKEY) || + (opt_id == BLE_GAP_OPT_PRIVACY) || + (opt_id == BLE_GAP_OPT_SCAN_REQ_REPORT) || + (opt_id == BLE_GAP_OPT_COMPAT_MODE)) , NRF_ERROR_INVALID_PARAM); + + p_buf[index++] = SD_BLE_OPT_GET; + + err_code = uint32_t_enc(&opt_id, p_buf, *p_buf_len, &index); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + p_buf[index++] = (p_opt == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + *p_buf_len = index; + + return NRF_SUCCESS; +} + +uint32_t ble_opt_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_opt_id, + ble_opt_t * const p_opt, + uint32_t * const p_result_code) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_opt_id); + SER_ASSERT_NOT_NULL(p_opt); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_OPT_GET, + p_result_code); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + (void) uint32_t_dec(p_buf, packet_len, &index, p_opt_id); + SER_ASSERT(((*p_opt_id == BLE_COMMON_OPT_RADIO_CPU_MUTEX) || + (*p_opt_id == BLE_GAP_OPT_CH_MAP) || + (*p_opt_id == BLE_GAP_OPT_LOCAL_CONN_LATENCY) || + (*p_opt_id == BLE_GAP_OPT_PASSKEY) || + (*p_opt_id == BLE_GAP_OPT_PRIVACY) || + (*p_opt_id == BLE_GAP_OPT_SCAN_REQ_REPORT) || + (*p_opt_id == BLE_GAP_OPT_COMPAT_MODE)), NRF_ERROR_INVALID_PARAM); + + switch (*p_opt_id) + { + case BLE_COMMON_OPT_RADIO_CPU_MUTEX: + err_code = ble_common_opt_radio_cpu_mutex_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->common_opt.radio_cpu_mutex)); + break; + case BLE_GAP_OPT_CH_MAP: + err_code = ble_gap_opt_ch_map_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.ch_map)); + break; + case BLE_GAP_OPT_LOCAL_CONN_LATENCY: + err_code = ble_gap_opt_local_conn_latency_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.local_conn_latency)); + break; + case BLE_GAP_OPT_PASSKEY: + err_code = ble_gap_opt_passkey_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.passkey)); + break; + case BLE_GAP_OPT_PRIVACY: + err_code = ble_gap_opt_privacy_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.privacy)); + break; + case BLE_GAP_OPT_SCAN_REQ_REPORT: + err_code = ble_gap_opt_scan_req_report_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.scan_req_report)); + break; + case BLE_GAP_OPT_COMPAT_MODE: + err_code = ble_gap_opt_compat_mode_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.compat_mode)); + break; + } + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + diff --git a/components/serialization/application/codecs/s110/serializers/ble_opt_set.c b/components/serialization/application/codecs/s110/serializers/ble_opt_set.c new file mode 100644 index 0000000..d6772b0 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_opt_set.c @@ -0,0 +1,117 @@ +/* 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 "ble_app.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_opt_set_req_enc(uint32_t const opt_id, + ble_opt_t const * const p_opt, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t initial_buf_len = *p_buf_len; + + SER_ASSERT_LENGTH_LEQ(1 + 4 + 1, initial_buf_len); + + SER_ASSERT(((opt_id == BLE_COMMON_OPT_RADIO_CPU_MUTEX) || + (opt_id == BLE_GAP_OPT_CH_MAP) || + (opt_id == BLE_GAP_OPT_LOCAL_CONN_LATENCY) || + (opt_id == BLE_GAP_OPT_PASSKEY) || + (opt_id == BLE_GAP_OPT_PRIVACY) || + (opt_id == BLE_GAP_OPT_SCAN_REQ_REPORT) || + (opt_id == BLE_GAP_OPT_COMPAT_MODE)), NRF_ERROR_INVALID_PARAM); + + p_buf[index++] = SD_BLE_OPT_SET; + + err_code = uint32_t_enc(&opt_id, p_buf, initial_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (p_opt != NULL) + { + p_buf[index++] = SER_FIELD_PRESENT; + + switch(opt_id) + { + case BLE_COMMON_OPT_RADIO_CPU_MUTEX: + err_code = ble_common_opt_radio_cpu_mutex_t_enc(&(p_opt->common_opt.radio_cpu_mutex),p_buf, initial_buf_len, &index); + break; + case BLE_GAP_OPT_CH_MAP: + err_code = ble_gap_opt_ch_map_t_enc(&(p_opt->gap_opt.ch_map),p_buf, initial_buf_len, &index); + break; + case BLE_GAP_OPT_LOCAL_CONN_LATENCY: + err_code = ble_gap_opt_local_conn_latency_t_enc(&(p_opt->gap_opt.local_conn_latency),p_buf, initial_buf_len, &index); + break; + case BLE_GAP_OPT_PASSKEY: + err_code = ble_gap_opt_passkey_t_enc(&(p_opt->gap_opt.passkey),p_buf, initial_buf_len, &index); + break; + case BLE_GAP_OPT_PRIVACY: + err_code = ble_gap_opt_privacy_t_enc(&(p_opt->gap_opt.privacy),p_buf, initial_buf_len, &index); + break; + case BLE_GAP_OPT_SCAN_REQ_REPORT: + err_code = ble_gap_opt_scan_req_report_t_enc(&(p_opt->gap_opt.scan_req_report),p_buf, initial_buf_len, &index); + break; + case BLE_GAP_OPT_COMPAT_MODE: + err_code = ble_gap_opt_compat_mode_t_enc(&(p_opt->gap_opt.compat_mode),p_buf, initial_buf_len, &index); + break; + } + } + else + { + p_buf[index++] = SER_FIELD_NOT_PRESENT; + } + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_opt_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + uint32_t index = 0; + uint32_t error_code; + + error_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_OPT_SET, p_result_code); + + if (error_code != NRF_SUCCESS) + { + return error_code; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_tx_buffer_count_get.c b/components/serialization/application/codecs/s110/serializers/ble_tx_buffer_count_get.c new file mode 100644 index 0000000..944fe63 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_tx_buffer_count_get.c @@ -0,0 +1,68 @@ +/* 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 "ble_app.h" +#include "ble_serialization.h" +#include "app_util.h" +#include "cond_field_serialization.h" + +uint32_t ble_tx_buffer_count_get_req_enc(uint8_t const * const p_count, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint8_t opcode = SD_BLE_TX_BUFFER_COUNT_GET; + uint32_t err_code; + uint32_t total_len = *p_buf_len; + + err_code = uint8_t_enc(&opcode, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_count, p_buf, total_len, &index, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_tx_buffer_count_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * * const pp_count, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t index = 0; + uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_TX_BUFFER_COUNT_GET, p_result_code); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; + } + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_count, uint8_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_user_mem_reply.c b/components/serialization/application/codecs/s110/serializers/ble_user_mem_reply.c new file mode 100644 index 0000000..ce19d40 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_user_mem_reply.c @@ -0,0 +1,66 @@ +/* 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 "ble_app.h" +#include +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + +uint32_t ble_user_mem_reply_req_enc(uint16_t conn_handle, + ble_user_mem_block_t const * p_block, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + p_buf[index++] = SD_BLE_USER_MEM_REPLY; + + err_code = uint16_t_enc(&conn_handle, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(1, *p_buf_len - index); + if(p_block != NULL) + { + p_buf[index++] = SER_FIELD_PRESENT; + + // Encoding order is different than structure elements order because + // mem block length should be sent first + err_code = uint16_t_enc(&(p_block->len), p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_block->p_mem, p_buf, *p_buf_len, &index, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + else + { + p_buf[index++] = SER_FIELD_NOT_PRESENT; + } + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_user_mem_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_USER_MEM_REPLY, p_result_code); +} + + diff --git a/components/serialization/application/codecs/s110/serializers/ble_uuid_decode.c b/components/serialization/application/codecs/s110/serializers/ble_uuid_decode.c new file mode 100644 index 0000000..5c3e006 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_uuid_decode.c @@ -0,0 +1,84 @@ +/* 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 "ble_app.h" +#include +#include +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_uuid_decode_req_enc(uint8_t uuid_le_len, + uint8_t const * const p_uuid_le, + ble_uuid_t * const p_uuid, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t err_code; + uint32_t index = 0; + uint32_t buf_len = *p_buf_len; + uint8_t opcode = SD_BLE_UUID_DECODE; + + err_code = uint8_t_enc((void *)&opcode, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = len8data_enc(p_uuid_le, uuid_le_len, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc((void *)p_uuid, p_buf, buf_len, &index, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_uuid_decode_rsp_dec(uint8_t const * const p_buf, + uint32_t buf_len, + ble_uuid_t * * const pp_uuid, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t err_code; + uint32_t index = 0; + + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, + &index, + buf_len, + SD_BLE_UUID_DECODE, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, buf_len); + return NRF_SUCCESS; + } + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_uuid, ble_uuid_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_uuid_encode.c b/components/serialization/application/codecs/s110/serializers/ble_uuid_encode.c new file mode 100644 index 0000000..5eb8099 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_uuid_encode.c @@ -0,0 +1,93 @@ +/* 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 "ble_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_uuid_encode_req_enc(ble_uuid_t const * const p_uuid, + uint8_t const * const p_uuid_le_len, + uint8_t const * const p_uuid_le, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(1 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_UUID_ENCODE; + + p_buf[index++] = (p_uuid != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_uuid != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len); + index += uint16_encode(p_uuid->uuid, &p_buf[index]); + p_buf[index++] = p_uuid->type; + } + + SER_ASSERT_LENGTH_LEQ(index + 2, *p_buf_len); + p_buf[index++] = (p_uuid_le_len == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + p_buf[index++] = (p_uuid_le == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_uuid_encode_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * const p_uuid_le_len, + uint8_t * const p_uuid_le, + uint32_t * const p_result_code) +{ + uint32_t index = 0; + uint32_t error_code; + + error_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_UUID_ENCODE, p_result_code); + + if (error_code != NRF_SUCCESS) + { + return error_code; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + SER_ASSERT_LENGTH_LEQ(index + 1, packet_len); + uint8_t uuid_le_len = p_buf[index++]; + + if (p_uuid_le_len != NULL) + { + if (p_uuid_le != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + uuid_le_len, packet_len); + memcpy(p_uuid_le, &(p_buf[index]), uuid_le_len); + index += uuid_le_len; + } + *p_uuid_le_len = uuid_le_len; + } + + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_uuid_vs_add.c b/components/serialization/application/codecs/s110/serializers/ble_uuid_vs_add.c new file mode 100644 index 0000000..0f686f1 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_uuid_vs_add.c @@ -0,0 +1,83 @@ +/* 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 "ble_app.h" +#include +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_uuid_vs_add_req_enc(ble_uuid128_t const * const p_vs_uuid, + uint8_t * const p_uuid_type, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t err_code; + uint32_t index = 0; + uint32_t buf_len = *p_buf_len; + uint8_t opcode = SD_BLE_UUID_VS_ADD; + + err_code = uint8_t_enc(&opcode, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc((void *)p_vs_uuid, p_buf, buf_len, &index, ble_uuid128_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc((void *)p_uuid_type, p_buf, buf_len, &index, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_uuid_vs_add_rsp_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint8_t * * const pp_uuid_type, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + SER_ASSERT_NOT_NULL(pp_uuid_type); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = 0; + + err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, + &index, + buf_len, + SD_BLE_UUID_VS_ADD, + p_result_code); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, buf_len); + return NRF_SUCCESS; + } + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_uuid_type, uint8_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s110/serializers/ble_version_get.c b/components/serialization/application/codecs/s110/serializers/ble_version_get.c new file mode 100644 index 0000000..0485b4f --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/ble_version_get.c @@ -0,0 +1,73 @@ +/* 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 "ble_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_version_get_req_enc(ble_version_t const * const p_version, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 2, *p_buf_len); + + p_buf[index++] = SD_BLE_VERSION_GET; + + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + + p_buf[index++] = (p_version == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + *p_buf_len = index; + + return NRF_SUCCESS; +} + +uint32_t ble_version_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_version_t * p_version, + uint32_t * const p_result_code) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t status_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_VERSION_GET, + p_result_code); + + if (status_code != NRF_SUCCESS) + { + return status_code; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + uint8_dec(p_buf, packet_len, &index, &(p_version->version_number)); + uint16_dec(p_buf, packet_len, &index, &(p_version->company_id)); + uint16_dec(p_buf, packet_len, &index, &p_version->subversion_number); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return status_code; +} + + diff --git a/components/serialization/application/codecs/s110/serializers/nrf_soc_app.h b/components/serialization/application/codecs/s110/serializers/nrf_soc_app.h new file mode 100644 index 0000000..1f89530 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/nrf_soc_app.h @@ -0,0 +1,90 @@ +/* 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. + * + */ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s110_codecs Application s110 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup soc_app SOC Application command request encoders and command response decoders + * @{ + * @ingroup ser_app_s110_codecs + * + * @brief SOC Application command request encoders and command response decoders. + */ + +#ifndef NRF_SOC_APP_H__ +#define NRF_SOC_APP_H__ + +#include + +/**@brief Encodes @ref sd_power_system_off command request. + * + * @sa @ref nrf51_sd_power_off for packet format. + * + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: size of p_buf buffer. \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t power_system_off_req_enc(uint8_t * const p_buf, uint32_t * const p_buf_len); + + +/**@brief Encodes @ref sd_temp_get command request. + * + * @sa @ref nrf51_sd_temp_get for packet format. + @ref temp_get_rsp_dec for command response decoder. + * + * @param[in] p_temp Pointer to result of temperature measurement. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: size of p_buf buffer. \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t temp_get_req_enc(int32_t const * const p_temp, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_temp_get command. + * + * @sa @ref nrf51_sd_temp_get for packet format, + * @ref temp_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * @param[out] p_temp Pointer to result of temperature measurement. + * + * @return NRF_SUCCESS Version information stored successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t temp_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code, + int32_t * const p_temp); + +/** @} */ + +#endif // NRF_SOC_APP_H__ diff --git a/components/serialization/application/codecs/s110/serializers/power_system_off.c b/components/serialization/application/codecs/s110/serializers/power_system_off.c new file mode 100644 index 0000000..c81b1ca --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/power_system_off.c @@ -0,0 +1,32 @@ +/* + * 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 "nrf_soc_app.h" +#include "ble_serialization.h" +#include "nrf_soc.h" + + +uint32_t power_system_off_req_enc(uint8_t * const p_buf, uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(1, *p_buf_len); + + p_buf[index++] = SD_POWER_SYSTEM_OFF; + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s110/serializers/temp_get.c b/components/serialization/application/codecs/s110/serializers/temp_get.c new file mode 100644 index 0000000..e50a799 --- /dev/null +++ b/components/serialization/application/codecs/s110/serializers/temp_get.c @@ -0,0 +1,71 @@ +/* + * 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 "nrf_soc.h" +#include "nrf_error.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" + +uint32_t temp_get_req_enc(int32_t const * const p_temp, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + uint32_t total_len = *p_buf_len; + + SER_ASSERT_LENGTH_LEQ(1, total_len); + p_buf[index++] = SD_TEMP_GET; + + err_code = cond_field_enc(p_temp, p_buf, total_len, &index, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t temp_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code, + int32_t * const p_temp) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + SER_ASSERT_NOT_NULL(p_temp); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, + &index, + packet_len, + SD_TEMP_GET, + p_result_code); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (*p_result_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + err_code = uint32_t_dec(p_buf, packet_len, &index, p_temp); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s120/middleware/app_mw_ble.c b/components/serialization/application/codecs/s120/middleware/app_mw_ble.c new file mode 100644 index 0000000..51c73c3 --- /dev/null +++ b/components/serialization/application/codecs/s120/middleware/app_mw_ble.c @@ -0,0 +1,501 @@ +/* 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 "ble.h" +#include "ble_serialization.h" +#include +#include "ble_app.h" +#include "ser_sd_transport.h" +#include "app_error.h" +#include "app_ble_user_mem.h" + +extern ser_ble_user_mem_t m_app_user_mem_table[]; + +/**@brief Structure containing @ref sd_ble_uuid_encode output parameters. */ +typedef struct +{ + uint8_t * p_uuid_le_len; /**< @ref sd_ble_uuid_encode appearance p_uuid_le_len output parameter. */ + uint8_t * p_uuid_le; /**< @ref sd_ble_uuid_encode appearance p_uuid_le output parameter. */ +} ble_uuid_encode_out_params_t; + +/**@brief Structure containing @ref sd_ble_tx_buffer_count_get output parameters. */ +typedef struct +{ + uint8_t * p_count; /**< @ref sd_ble_tx_buffer_count_get p_count output parameter. */ +} ble_tx_buffer_count__get_out_params_t; + +/**@brief Structure containing @ref sd_ble_user_mem_reply output parameters. */ +typedef struct +{ + uint16_t conn_handle; /**< @ref sd_ble_user_mem_reply conn_handle. */ + uint8_t context_allocated; /**< @ref sd_ble_user_mem_reply user memory context allocated flag. */ +} ble_user_mem_reply_out_params_t; + +/**@brief Union containing BLE command output parameters. */ +typedef union +{ + ble_uuid_encode_out_params_t ble_uuid_encode_out_params; /**< @ref sd_ble_uuid_encode output parameters. */ + ble_tx_buffer_count__get_out_params_t ble_tx_buffer_count_get_out_params; /**< @ref sd_ble_uuid_encode output parameters. */ + ble_user_mem_reply_out_params_t ble_user_mem_reply_out_params; /**< @ref sd_ble_user_mem_reply output parameters. */ +} ble_command_output_params_t; + +static ble_command_output_params_t m_output_params; /**< BLE command output parameters. */ + +static void * mp_out_params[3]; +static uint32_t m_uint32_param; + +static void tx_buf_alloc(uint8_t * * p_data, uint32_t * p_len) +{ + uint32_t err_code; + uint16_t len16; + + do + { + err_code = ser_sd_transport_tx_alloc(p_data, &len16); + } + while (err_code != NRF_SUCCESS); + + *p_data[0] = SER_PKT_TYPE_CMD; + *p_len = (uint32_t)len16 - 1; +} + +/**@brief Command response callback function for @ref sd_ble_uuid_encode BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t uuid_encode_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = + ble_uuid_encode_rsp_dec(p_buffer, + length, + m_output_params.ble_uuid_encode_out_params.p_uuid_le_len, + m_output_params.ble_uuid_encode_out_params.p_uuid_le, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + return result_code; +} + + +uint32_t sd_ble_uuid_encode(ble_uuid_t const * const p_uuid, + uint8_t * const p_uuid_le_len, + uint8_t * const p_uuid_le) +{ + uint8_t * p_buffer; + uint32_t buffer_length; + + tx_buf_alloc(&p_buffer, &buffer_length); + + m_output_params.ble_uuid_encode_out_params.p_uuid_le_len = p_uuid_le_len; + m_output_params.ble_uuid_encode_out_params.p_uuid_le = p_uuid_le; + + uint32_t err_code = ble_uuid_encode_req_enc(p_uuid, + p_uuid_le_len, + p_uuid_le, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + uuid_encode_rsp_dec); + +} + +/**@brief Command response callback function for @ref sd_ble_tx_buffer_count_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t tx_buffer_count_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_tx_buffer_count_get_rsp_dec(p_buffer, + length, + (uint8_t * *)&mp_out_params[0], + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + return result_code; +} + +uint32_t sd_ble_tx_buffer_count_get(uint8_t * p_count) +{ + uint8_t * p_buffer; + uint32_t buffer_length; + + tx_buf_alloc(&p_buffer, &buffer_length); + mp_out_params[0] = p_count; + + const uint32_t err_code = ble_tx_buffer_count_get_req_enc(p_count, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + tx_buffer_count_get_rsp_dec); + +} + +/**@brief Command response callback function for @ref sd_ble_uuid_vs_add BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t uuid_vs_add_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_uuid_vs_add_rsp_dec(p_buffer, + length, + (uint8_t * *)&mp_out_params[0], + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + return result_code; +} + +uint32_t sd_ble_uuid_vs_add(ble_uuid128_t const * const p_vs_uuid, uint8_t * const p_uuid_type) +{ + uint8_t * p_buffer; + uint32_t buffer_length; + + tx_buf_alloc(&p_buffer, &buffer_length); + mp_out_params[0] = p_uuid_type; + + const uint32_t err_code = ble_uuid_vs_add_req_enc(p_vs_uuid, p_uuid_type, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + uuid_vs_add_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_uuid_decode BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t uuid_decode_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_uuid_decode_rsp_dec(p_buffer, + length, + (ble_uuid_t * *)&mp_out_params[0], + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + return result_code; +} + +uint32_t sd_ble_uuid_decode(uint8_t uuid_le_len, + uint8_t const * const p_uuid_le, + ble_uuid_t * const p_uuid) +{ + uint8_t * p_buffer; + uint32_t buffer_length; + + tx_buf_alloc(&p_buffer, &buffer_length); + mp_out_params[0] = p_uuid; + + const uint32_t err_code = ble_uuid_decode_req_enc(uuid_le_len, p_uuid_le, p_uuid, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + uuid_decode_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_version_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t version_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_version_get_rsp_dec(p_buffer, + length, + (ble_version_t *)mp_out_params[0], + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + return result_code; +} + +uint32_t sd_ble_version_get(ble_version_t * p_version) +{ + uint8_t * p_buffer; + uint32_t buffer_length; + + tx_buf_alloc(&p_buffer, &buffer_length); + mp_out_params[0] = p_version; + + const uint32_t err_code = ble_version_get_req_enc(p_version, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + version_get_rsp_dec); + +} + +/**@brief Command response callback function for @ref sd_ble_opt_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t opt_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + uint32_t uint32_param; + + uint32_t err_code = ble_opt_get_rsp_dec(p_buffer, + length, + &uint32_param, + (ble_opt_t *)mp_out_params[0], + &result_code); + + APP_ERROR_CHECK(err_code); + if (m_uint32_param != uint32_param) // decoded id should be the same as encoded one + { + err_code = NRF_ERROR_INVALID_PARAM; + } + APP_ERROR_CHECK(err_code); + + return result_code; +} + +uint32_t sd_ble_opt_get(uint32_t opt_id, ble_opt_t *p_opt) +{ + uint8_t * p_buffer; + uint32_t buffer_length; + + tx_buf_alloc(&p_buffer, &buffer_length); + mp_out_params[0] = p_opt; + m_uint32_param = opt_id; + + const uint32_t err_code = ble_opt_get_req_enc(opt_id, + p_opt, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + opt_get_rsp_dec); + +} + +/**@brief Command response callback function for @ref sd_ble_opt_set BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t opt_set_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_opt_set_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + +uint32_t sd_ble_opt_set(uint32_t opt_id, ble_opt_t const *p_opt) +{ + uint8_t * p_buffer; + uint32_t buffer_length; + + tx_buf_alloc(&p_buffer, &buffer_length); + + const uint32_t err_code = ble_opt_set_req_enc(opt_id, + p_opt, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + opt_set_rsp_dec); + +} + +/**@brief Command response callback function for @ref sd_ble_enable BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t enable_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_enable_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + return result_code; +} + +uint32_t sd_ble_enable(ble_enable_params_t * p_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length; + + tx_buf_alloc(&p_buffer, &buffer_length); + mp_out_params[0] = p_params; + + const uint32_t err_code = ble_enable_req_enc(p_params, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + enable_rsp_dec); + +} + +/**@brief Command response callback function for @ref sd_ble_user_mem_reply BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t user_mem_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + uint32_t err_code = ble_user_mem_reply_rsp_dec(p_buffer, + length, + &result_code); + APP_ERROR_CHECK(err_code); + + if ((result_code != NRF_SUCCESS) && + (m_output_params.ble_user_mem_reply_out_params.context_allocated)) + { + err_code = app_ble_user_mem_context_destroy( + m_output_params.ble_user_mem_reply_out_params.conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + + return result_code; +} + +uint32_t sd_ble_user_mem_reply(uint16_t conn_handle, ble_user_mem_block_t const *p_block) +{ + uint8_t * p_buffer; + uint32_t buffer_length, user_mem_table_index; + uint32_t err_code = NRF_SUCCESS; + + tx_buf_alloc(&p_buffer, &buffer_length); + + // Prepare User Memory Block context for later synchronization when SoftDevice updates + // the data in the memory block + if(p_block != NULL) + { + err_code = app_ble_user_mem_context_create(conn_handle, &user_mem_table_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + m_app_user_mem_table[user_mem_table_index].mem_block.len = p_block->len; + m_app_user_mem_table[user_mem_table_index].mem_block.p_mem = p_block->p_mem; + // Save connection handle and context allocation flag for case if context destroy was needed + m_output_params.ble_user_mem_reply_out_params.conn_handle = conn_handle; + m_output_params.ble_user_mem_reply_out_params.context_allocated = 1; + } + else + { + m_output_params.ble_user_mem_reply_out_params.context_allocated = 0; + } + + err_code = ble_user_mem_reply_req_enc(conn_handle, + p_block, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + user_mem_reply_rsp_dec); +} diff --git a/components/serialization/application/codecs/s120/middleware/app_mw_ble_gap.c b/components/serialization/application/codecs/s120/middleware/app_mw_ble_gap.c new file mode 100644 index 0000000..c3fcb9e --- /dev/null +++ b/components/serialization/application/codecs/s120/middleware/app_mw_ble_gap.c @@ -0,0 +1,1285 @@ +/* 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 "ble_gap.h" +#include +#include +#include "ble_serialization.h" +#include "ser_sd_transport.h" +#include "ble_gap_app.h" +#include "app_error.h" +#include "app_ble_gap_sec_keys.h" + +extern ser_ble_gap_app_keyset_t m_app_keys_table[SER_MAX_CONNECTIONS]; + +/**@brief Structure containing @ref sd_ble_gap_device_name_get output parameters. */ +typedef struct +{ + uint8_t * p_dev_name; /**< @ref sd_ble_gap_device_name_get p_dev_name output parameter. */ + uint16_t * p_len; /**< @ref sd_ble_gap_device_name_get p_len output parameter. */ +} gap_device_name_get_output_params_t; + +/**@brief Structure containing @ref sd_ble_gap_appearance_get output parameters. */ +typedef struct +{ + uint16_t * p_appearance; /**< @ref sd_ble_gap_appearance_get p_appearance output parameter. */ +} gap_appearance_get_output_params_t; + +/**@brief Structure containing @ref sd_ble_gap_ppcp_get output parameters. */ +typedef struct +{ + ble_gap_conn_params_t * p_conn_params; /**< @ref sd_ble_gap_ppcp_get p_conn_params output parameter. */ +} gap_ppcp_get_out_params_t; + +/**@brief Structure containing @ref sd_ble_gap_sec_params_reply output parameters. */ +typedef struct +{ + ble_gap_sec_keyset_t const * p_sec_keyset; /**< @ref sd_ble_gap_sec_params_reply p_sec_keyset output parameter. */ + uint16_t conn_handle; /**< @ref sd_ble_gap_sec_params_reply p_conn_handle output parameter. */ +} gap_sec_params_reply_out_params_t; + +/**@brief Union containing BLE command output parameters. */ +typedef union +{ + gap_device_name_get_output_params_t gap_device_name_get_out_params; /**< @ref sd_ble_gap_device_name_get output parameters. */ + gap_appearance_get_output_params_t gap_appearance_get_out_params; /**< @ref sd_ble_gap_appearance_get output parameters. */ + gap_ppcp_get_out_params_t gap_ppcp_get_out_params; /**< @ref sd_ble_gap_ppcp_get output parameters. */ + gap_sec_params_reply_out_params_t gap_sec_params_reply_out_params;/**< @ref sd_ble_sec_params_reply output parameters. */ +} gap_command_output_params_t; + +static gap_command_output_params_t m_output_params; /**< BLE command output parameters. */ + +static void * mp_out_params[1]; + +static void tx_buf_alloc(uint8_t * * p_data, uint16_t * p_len) +{ + uint32_t err_code; + + do + { + err_code = ser_sd_transport_tx_alloc(p_data, p_len); + } + while (err_code != NRF_SUCCESS); + *p_data[0] = SER_PKT_TYPE_CMD; + *p_len -= 1; +} +/**@brief Command response callback function for @ref sd_ble_gap_adv_start BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_adv_start_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gap_adv_start_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_adv_start(ble_gap_adv_params_t const * const p_adv_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gap_adv_start_req_enc(p_adv_params, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_adv_start_rsp_dec); +} + + +/**@brief Command response callback function for @ref ble_gap_device_name_get_req_enc BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_device_name_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = + ble_gap_device_name_get_rsp_dec(p_buffer, + length, + m_output_params.gap_device_name_get_out_params.p_dev_name, + m_output_params.gap_device_name_get_out_params.p_len, + &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_device_name_get(uint8_t * const p_dev_name, uint16_t * const p_len) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + m_output_params.gap_device_name_get_out_params.p_dev_name = p_dev_name; + m_output_params.gap_device_name_get_out_params.p_len = p_len; + + const uint32_t err_code = ble_gap_device_name_get_req_enc(p_dev_name, + p_len, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_device_name_get_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_appearance_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_appearance_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = + ble_gap_appearance_get_rsp_dec(p_buffer, + length, + m_output_params.gap_appearance_get_out_params.p_appearance, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_appearance_get(uint16_t * const p_appearance) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + m_output_params.gap_appearance_get_out_params.p_appearance = p_appearance; + + const uint32_t err_code = ble_gap_appearance_get_req_enc(p_appearance, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_appearance_get_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_device_name_set BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_device_name_set_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gap_device_name_set_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_device_name_set(ble_gap_conn_sec_mode_t const * const p_write_perm, + uint8_t const * const p_dev_name, + uint16_t len) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_device_name_set_req_enc(p_write_perm, + p_dev_name, + len, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_device_name_set_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_appearance_set BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_appearance_set_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gap_appearance_set_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_appearance_set(uint16_t appearance) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_appearance_set_req_enc(appearance, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_appearance_set_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_ppcp_set BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_ppcp_set_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gap_ppcp_set_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + + return result_code; +} + + +uint32_t sd_ble_gap_ppcp_set(ble_gap_conn_params_t const * const p_conn_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_ppcp_set_req_enc(p_conn_params, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_ppcp_set_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_adv_data_set BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_adv_data_set_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gap_adv_data_set_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_adv_data_set(uint8_t const * const p_data, + uint8_t dlen, + uint8_t const * const p_sr_data, + uint8_t srdlen) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_adv_data_set_req_enc(p_data, + dlen, + p_sr_data, + srdlen, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_adv_data_set_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_conn_param_update BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_conn_param_update_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gap_conn_param_update_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_conn_param_update(uint16_t conn_handle, + ble_gap_conn_params_t const * const p_conn_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_conn_param_update_req_enc(conn_handle, + p_conn_params, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_conn_param_update_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_disconnect BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_disconnect_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gap_disconnect_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_disconnect(uint16_t conn_handle, uint8_t hci_status_code) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_disconnect_req_enc(conn_handle, + hci_status_code, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_disconnect_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_sec_info_reply BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_sec_info_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gap_sec_info_reply_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + +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) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_sec_info_reply_req_enc(conn_handle, + p_enc_info, + p_id_info, + p_sign_info, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_sec_info_reply_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_sec_params_reply BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_sec_params_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + uint32_t err_code = ble_gap_sec_params_reply_rsp_dec(p_buffer, length, + m_output_params.gap_sec_params_reply_out_params.p_sec_keyset, &result_code); + APP_ERROR_CHECK(err_code); + + // If soft device returned error free security context + if (result_code) + { + err_code = app_ble_gap_sec_context_destroy(m_output_params.gap_sec_params_reply_out_params.conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + + return result_code; +} + + +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) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + uint32_t sec_tab_index = 0; + uint32_t err_code = NRF_SUCCESS; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + m_output_params.gap_sec_params_reply_out_params.p_sec_keyset = p_sec_keyset; + m_output_params.gap_sec_params_reply_out_params.conn_handle = conn_handle; + + // First allocate security context for serialization + if (p_sec_keyset) + { + err_code = app_ble_gap_sec_context_create(conn_handle, &sec_tab_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + memcpy(&(m_app_keys_table[sec_tab_index].keyset), p_sec_keyset, sizeof(ble_gap_sec_keyset_t)); + } + + err_code = ble_gap_sec_params_reply_req_enc(conn_handle, + sec_status, + p_sec_params, + p_sec_keyset, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_sec_params_reply_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_ppcp_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_ppcp_get_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_ppcp_get_rsp_dec( + p_buffer, + length, + m_output_params.gap_ppcp_get_out_params. + p_conn_params, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_ppcp_get(ble_gap_conn_params_t * const p_conn_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + m_output_params.gap_ppcp_get_out_params.p_conn_params = p_conn_params; + + const uint32_t err_code = ble_gap_ppcp_get_req_enc(p_conn_params, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_ppcp_get_reply_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_address_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_address_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_address_get_rsp_dec(p_buffer, + length, + (ble_gap_addr_t *)mp_out_params[0], + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_address_get(ble_gap_addr_t * const p_addr) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_addr; + + const uint32_t err_code = ble_gap_address_get_req_enc(p_addr, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + + gap_address_get_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_address_set BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_address_set_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_address_set_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_address_set(uint8_t addr_cycle_mode, ble_gap_addr_t const * const p_addr) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_address_set_req_enc(addr_cycle_mode, + p_addr, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_address_set_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_adv_stop BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_adv_stop_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_adv_stop_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_adv_stop(void) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_adv_stop_req_enc(&(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_adv_stop_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_auth_key_reply BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_auth_key_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_auth_key_reply_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_auth_key_reply(uint16_t conn_handle, + uint8_t key_type, + uint8_t const * const key) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_auth_key_reply_req_enc(conn_handle, key_type, key, + &(p_buffer[1]), &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_auth_key_reply_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_authenticate BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_authenticate_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_authenticate_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_authenticate(uint16_t conn_handle, + ble_gap_sec_params_t const * const p_sec_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_authenticate_req_enc(conn_handle, p_sec_params, + &(p_buffer[1]), &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_authenticate_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_conn_sec_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_conn_sec_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_conn_sec_get_rsp_dec( + p_buffer, + length, + (ble_gap_conn_sec_t * *)&mp_out_params[0 + ], + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_conn_sec_get(uint16_t conn_handle, ble_gap_conn_sec_t * const p_conn_sec) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_conn_sec; + + const uint32_t err_code = ble_gap_conn_sec_get_req_enc(conn_handle, p_conn_sec, + &(p_buffer[1]), &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_conn_sec_get_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_rssi_start BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_rssi_start_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_rssi_start_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_rssi_start(uint16_t conn_handle, uint8_t threshold_dbm, uint8_t skip_count) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_rssi_start_req_enc(conn_handle, + threshold_dbm, + skip_count, + &(p_buffer[1]), &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_rssi_start_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_rssi_stop BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_rssi_stop_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_rssi_stop_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_rssi_stop(uint16_t conn_handle) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_rssi_stop_req_enc(conn_handle, + &(p_buffer[1]), &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_rssi_stop_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_tx_power_set BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_tx_power_set_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_tx_power_set_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_tx_power_set(int8_t tx_power) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_tx_power_set_req_enc(tx_power, + &(p_buffer[1]), &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_tx_power_set_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_scan_stop BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_scan_stop_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_scan_stop_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_scan_stop(void) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_scan_stop_req_enc(&(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_scan_stop_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_connect BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_connect_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_connect_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_connect(ble_gap_addr_t const * const p_addr, + ble_gap_scan_params_t const * const p_scan_params, + ble_gap_conn_params_t const * const p_conn_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_connect_req_enc(p_addr, + p_scan_params, + p_conn_params, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_connect_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_connect_cancel BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_connect_cancel_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_connect_cancel_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_connect_cancel(void) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_connect_cancel_req_enc(&(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_connect_cancel_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_scan_start BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_scan_start_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_scan_start_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_scan_start(ble_gap_scan_params_t const * const p_scan_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_scan_start_req_enc(p_scan_params, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_scan_start_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_encrypt BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_encrypt_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_encrypt_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +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) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_encrypt_req_enc( conn_handle, p_master_id, p_enc_info, &(p_buffer[1]), &buffer_length ); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_encrypt_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_rssi_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_rssi_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_rssi_get_rsp_dec(p_buffer, + length, + (int8_t *) mp_out_params[0], + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_rssi_get(uint16_t conn_handle, + int8_t * p_rssi) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_rssi; + + const uint32_t err_code = ble_gap_rssi_get_req_enc(conn_handle, p_rssi, &(p_buffer[1]), &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_rssi_get_rsp_dec); +} diff --git a/components/serialization/application/codecs/s120/middleware/app_mw_ble_gattc.c b/components/serialization/application/codecs/s120/middleware/app_mw_ble_gattc.c new file mode 100644 index 0000000..26cfab9 --- /dev/null +++ b/components/serialization/application/codecs/s120/middleware/app_mw_ble_gattc.c @@ -0,0 +1,426 @@ +/* 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 +#include "ble_gattc.h" +#include "ble_gattc_app.h" +#include "ble_serialization.h" +#include "ser_sd_transport.h" +#include "app_error.h" + +static void tx_buf_alloc(uint8_t * * p_data, uint16_t * p_len) +{ + uint32_t err_code; + + do + { + err_code = ser_sd_transport_tx_alloc(p_data, p_len); + } + while (err_code != NRF_SUCCESS); + *p_data[0] = SER_PKT_TYPE_CMD; + *p_len -= 1; +} +/**@brief Command response callback function for @ref sd_ble_gattc_primary_services_discover BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gattc_primary_services_discover_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gattc_primary_services_discover_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gattc_primary_services_discover(uint16_t conn_handle, + uint16_t start_handle, + ble_uuid_t const * const p_srvc_uuid) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gattc_primary_services_discover_req_enc(conn_handle, + start_handle, + p_srvc_uuid, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gattc_primary_services_discover_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gattc_relationships_discover BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gattc_relationships_discover_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gattc_relationships_discover_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gattc_relationships_discover(uint16_t conn_handle, + ble_gattc_handle_range_t const * const p_handle_range) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gattc_relationships_discover_req_enc(conn_handle, + p_handle_range, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gattc_relationships_discover_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gattc_characteristics_discover BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gattc_characteristics_discover_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gattc_characteristics_discover_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gattc_characteristics_discover( + uint16_t conn_handle, + ble_gattc_handle_range_t const * const + p_handle_range) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gattc_characteristics_discover_req_enc(conn_handle, + p_handle_range, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gattc_characteristics_discover_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gattc_descriptors_discover BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gattc_descriptors_discover_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gattc_descriptors_discover_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gattc_descriptors_discover(uint16_t conn_handle, + ble_gattc_handle_range_t const * const p_handle_range) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gattc_descriptors_discover_req_enc(conn_handle, + p_handle_range, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gattc_descriptors_discover_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gattc_char_value_by_uuid_read BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gattc_char_value_by_uuid_read_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gattc_char_value_by_uuid_read_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gattc_char_value_by_uuid_read(uint16_t conn_handle, + ble_uuid_t const * const p_uuid, + ble_gattc_handle_range_t const * const p_handle_range) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gattc_char_value_by_uuid_read_req_enc(conn_handle, + p_uuid, + p_handle_range, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gattc_char_value_by_uuid_read_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gattc_read BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gattc_read_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gattc_read_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gattc_read(uint16_t conn_handle, + uint16_t handle, + uint16_t offset) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gattc_read_req_enc(conn_handle, + handle, + offset, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gattc_read_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gattc_char_values_read BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gattc_char_values_read_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gattc_char_values_read_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gattc_char_values_read(uint16_t conn_handle, + uint16_t const * const p_handles, + uint16_t handle_count) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gattc_char_values_read_req_enc(conn_handle, + p_handles, + handle_count, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gattc_char_values_read_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gattc_write BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gattc_write_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gattc_write_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gattc_write(uint16_t conn_handle, + ble_gattc_write_params_t const * const p_write_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gattc_write_req_enc(conn_handle, + p_write_params, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gattc_write_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gattc_hv_confirm BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gattc_hv_confirm_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gattc_hv_confirm_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gattc_hv_confirm(uint16_t conn_handle, + uint16_t handle) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gattc_hv_confirm_req_enc(conn_handle, + handle, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gattc_hv_confirm_rsp_dec); +} diff --git a/components/serialization/application/codecs/s120/middleware/app_mw_ble_gatts.c b/components/serialization/application/codecs/s120/middleware/app_mw_ble_gatts.c new file mode 100644 index 0000000..abc1120 --- /dev/null +++ b/components/serialization/application/codecs/s120/middleware/app_mw_ble_gatts.c @@ -0,0 +1,571 @@ +/* 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 "ble_gatts.h" +#include +#include "ble_serialization.h" +#include "ser_sd_transport.h" +#include "ble_gatts_app.h" +#include "app_error.h" + + +//Pointer for sd calls output params +static void * mp_out_params[3]; + +static void tx_buf_alloc(uint8_t * * p_data, uint16_t * p_len) +{ + uint32_t err_code; + + do + { + err_code = ser_sd_transport_tx_alloc(p_data, p_len); + } + while (err_code != NRF_SUCCESS); + *p_data[0] = SER_PKT_TYPE_CMD; + *p_len -= 1; +} + +/**@brief Command response callback function for @ref sd_ble_gatts_sys_attr_set BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_sys_attr_set_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gatts_sys_attr_set_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gatts_sys_attr_set(uint16_t conn_handle, + uint8_t const * const p_sys_attr_data, + uint16_t len, + uint32_t flags) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gatts_sys_attr_set_req_enc(conn_handle, + p_sys_attr_data, + len, + flags, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_sys_attr_set_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gatts_hvx BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_hvx_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gatts_hvx_rsp_dec(p_buffer, length, &result_code, + (uint16_t * *)&mp_out_params[0]); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gatts_hvx(uint16_t conn_handle, ble_gatts_hvx_params_t const * const p_hvx_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = (p_hvx_params) ? p_hvx_params->p_len : NULL; + + const uint32_t err_code = ble_gatts_hvx_req_enc(conn_handle, + p_hvx_params, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_hvx_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gatts_service_add BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_service_add_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = + ble_gatts_service_add_rsp_dec(p_buffer, + length, + (uint16_t *)mp_out_params[0], + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gatts_service_add(uint8_t type, + ble_uuid_t const * const p_uuid, + uint16_t * const p_handle) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_handle; + + const uint32_t err_code = ble_gatts_service_add_req_enc(type, + p_uuid, + p_handle, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_service_add_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gatts_service_add BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_service_changed_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = NRF_SUCCESS; + + const uint32_t err_code = ble_gatts_service_changed_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gatts_service_changed(uint16_t conn_handle, + uint16_t start_handle, + uint16_t end_handle) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gatts_service_changed_req_enc(conn_handle, + start_handle, + end_handle, + &(p_buffer[1]), + &buffer_length); + + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_service_changed_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gatts_include_add BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_include_add_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = NRF_SUCCESS; + + const uint32_t err_code = + ble_gatts_include_add_rsp_dec(p_buffer, + length, + (uint16_t *) mp_out_params[0], + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gatts_include_add(uint16_t service_handle, + uint16_t inc_serv_handle, + uint16_t * const p_include_handle) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_include_handle; + + const uint32_t err_code = ble_gatts_include_add_req_enc(service_handle, + inc_serv_handle, + p_include_handle, + &(p_buffer[1]), + &buffer_length); + + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_include_add_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gatts_characteristic_add BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_characteristic_add_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gatts_characteristic_add_rsp_dec( + p_buffer, + length, + (uint16_t * *)&mp_out_params[0], + &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gatts_characteristic_add(uint16_t service_handle, + ble_gatts_char_md_t const * const p_char_md, + ble_gatts_attr_t const * const p_attr_char_value, + ble_gatts_char_handles_t * const p_handles) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_handles; + + const uint32_t err_code = ble_gatts_characteristic_add_req_enc(service_handle, + p_char_md, + p_attr_char_value, + p_handles, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_characteristic_add_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gatts_descriptor_add BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_descriptor_add_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = NRF_SUCCESS; + + const uint32_t err_code = + ble_gatts_descriptor_add_rsp_dec(p_buffer, + length, + (uint16_t *) mp_out_params[0], + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gatts_descriptor_add(uint16_t char_handle, + ble_gatts_attr_t const * const p_attr, + uint16_t * const p_handle) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_handle; + + const uint32_t err_code = ble_gatts_descriptor_add_req_enc(char_handle, + p_attr, + p_handle, + &(p_buffer[1]), + &buffer_length); + + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_descriptor_add_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gatts_rw_authorize_reply BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_rw_authorize_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = NRF_SUCCESS; + + const uint32_t err_code = ble_gatts_rw_authorize_reply_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gatts_rw_authorize_reply( + uint16_t conn_handle, + ble_gatts_rw_authorize_reply_params_t const * const + p_rw_authorize_reply_params) +{ + + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gatts_rw_authorize_reply_req_enc(conn_handle, + p_rw_authorize_reply_params, + &(p_buffer[1]), + &buffer_length); + + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_rw_authorize_reply_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gatts_value_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_value_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gatts_value_get_rsp_dec(p_buffer, + length, + (ble_gatts_value_t *)mp_out_params[0], + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gatts_value_get(uint16_t conn_handle, + uint16_t handle, + ble_gatts_value_t * p_value) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_value; + + const uint32_t err_code = ble_gatts_value_get_req_enc(conn_handle, + handle, + p_value, + &(p_buffer[1]), + &buffer_length); + + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_value_get_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gatts_value_set BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_value_set_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gatts_value_set_rsp_dec( + p_buffer, + length, + (ble_gatts_value_t *)mp_out_params[0], + &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gatts_value_set(uint16_t conn_handle, + uint16_t handle, + ble_gatts_value_t * p_value) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_value; + + const uint32_t err_code = ble_gatts_value_set_req_enc(conn_handle, + handle, + p_value, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_value_set_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gatts_sys_attr_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_sys_attr_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gatts_sys_attr_get_rsp_dec( + p_buffer, + length, + (uint8_t *) mp_out_params[0], + (uint16_t *) mp_out_params[1], + &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gatts_sys_attr_get(uint16_t conn_handle, + uint8_t * const p_sys_attr_data, + uint16_t * const p_len, + uint32_t flags) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_sys_attr_data; + mp_out_params[1] = p_len; + + const uint32_t err_code = ble_gatts_sys_attr_get_req_enc(conn_handle, + p_sys_attr_data, + p_len, + flags, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_sys_attr_get_rsp_dec); +} diff --git a/components/serialization/application/codecs/s120/middleware/app_mw_ble_l2cap.c b/components/serialization/application/codecs/s120/middleware/app_mw_ble_l2cap.c new file mode 100644 index 0000000..436d5a2 --- /dev/null +++ b/components/serialization/application/codecs/s120/middleware/app_mw_ble_l2cap.c @@ -0,0 +1,165 @@ +/* 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 "ble_gap.h" +#include +#include "ble_serialization.h" +#include "ser_sd_transport.h" +#include "ble_l2cap_app.h" +#include "app_error.h" + +static void tx_buf_alloc(uint8_t * * p_data, uint16_t * p_len) +{ + uint32_t err_code; + + do + { + err_code = ser_sd_transport_tx_alloc(p_data, p_len); + } + while (err_code != NRF_SUCCESS); + *p_data[0] = SER_PKT_TYPE_CMD; + *p_len -= 1; +} +/**@brief Command response callback function for @ref ble_l2cap_cid_register_req_enc BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t l2cap_cid_register_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = + ble_l2cap_cid_register_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_l2cap_cid_register(uint16_t cid) +{ + + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_l2cap_cid_register_req_enc(cid, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + l2cap_cid_register_rsp_dec); +} + +/**@brief Command response callback function for @ref ble_l2cap_cid_unregister_req_enc BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t l2cap_cid_unregister_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = + ble_l2cap_cid_unregister_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_l2cap_cid_unregister(uint16_t cid) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_l2cap_cid_unregister_req_enc(cid, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + l2cap_cid_unregister_rsp_dec); +} + +/**@brief Command response callback function for @ref ble_l2cap_tx_req_enc BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t l2cap_tx_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = + ble_l2cap_tx_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_l2cap_tx(uint16_t conn_handle, + ble_l2cap_header_t const * const p_header, + uint8_t const * const p_data) +{ + + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_l2cap_tx_req_enc(conn_handle, p_header, p_data, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + l2cap_tx_rsp_dec); +} + diff --git a/components/serialization/application/codecs/s120/middleware/app_mw_nrf_soc.c b/components/serialization/application/codecs/s120/middleware/app_mw_nrf_soc.c new file mode 100644 index 0000000..6a636c8 --- /dev/null +++ b/components/serialization/application/codecs/s120/middleware/app_mw_nrf_soc.c @@ -0,0 +1,100 @@ +/* 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 "nrf_soc.h" +#include +#include +#include "ser_sd_transport.h" +#include "nrf_soc_app.h" +#include "nrf_error_soc.h" +#include "app_error.h" +#include "ble_serialization.h" + +#include "ser_app_power_system_off.h" + +static void * mp_out_param; + +static void tx_buf_alloc(uint8_t * * p_data, uint16_t * p_len) +{ + uint32_t err_code; + + do + { + err_code = ser_sd_transport_tx_alloc(p_data, p_len); + } + while (err_code != NRF_SUCCESS); + *p_data[0] = SER_PKT_TYPE_CMD; + *p_len -= 1; +} + + +uint32_t sd_power_system_off(void) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = power_system_off_req_enc(&(p_buffer[1]), &buffer_length); + APP_ERROR_CHECK(err_code); + + ser_app_power_system_off_set(); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + NULL); +} + + +/**@brief Command response callback function for @ref sd_temp_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ + +static uint32_t mw_temp_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = temp_get_rsp_dec(p_buffer, + length, + &result_code, + (int32_t *)mp_out_param); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + +uint32_t sd_temp_get(int32_t * p_temp) +{ + mp_out_param = p_temp; + + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = temp_get_req_enc(p_temp, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + mw_temp_get_rsp_dec); +} diff --git a/components/serialization/application/codecs/s120/serializers/app_ble_gap_sec_keys.c b/components/serialization/application/codecs/s120/serializers/app_ble_gap_sec_keys.c new file mode 100644 index 0000000..066deb3 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/app_ble_gap_sec_keys.c @@ -0,0 +1,73 @@ +/* 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_ble_gap_sec_keys.h" +#include "nrf_error.h" +#include + +ser_ble_gap_app_keyset_t m_app_keys_table[SER_MAX_CONNECTIONS]; + +uint32_t app_ble_gap_sec_context_create(uint16_t conn_handle, uint32_t *p_index) +{ + uint32_t err_code = NRF_ERROR_NO_MEM; + uint32_t i; + + for (i=0; i + +#define SER_MAX_CONNECTIONS 2 + +/**@brief GAP connection - keyset mapping structure. + * + * @note This structure is used to map keysets to connection instances, and will be stored in a static table. + */ +typedef struct +{ + uint16_t conn_handle; /**< Connection handle.*/ + uint8_t conn_active; /**< Indication that keys for this connection are used by soft device. 0: keys used; 1: keys not used*/ + ble_gap_sec_keyset_t keyset; /**< Keyset structure, see @ref ble_gap_sec_keyset_t.*/ +} ser_ble_gap_app_keyset_t; + +/**@brief allocates instance in m_app_keys_table[] for storage of encryption keys. + * + * @param[in] conn_handle conn_handle + * @param[out] p_index pointer to the index of allocated instance + * + * @retval NRF_SUCCESS Context allocated. + * @retval NRF_ERROR_NO_MEM No free instance available. + */ +uint32_t app_ble_gap_sec_context_create(uint16_t conn_handle, uint32_t *p_index); + +/**@brief release instance identified by a connection handle. + * + * @param[in] conn_handle conn_handle + * + * @retval NRF_SUCCESS Context released. + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t app_ble_gap_sec_context_destroy(uint16_t conn_handle); + +/**@brief finds index of instance identified by a connection handle in m_app_keys_table[]. + * + * @param[in] conn_handle conn_handle + * + * @param[out] p_index Pointer to the index of the entry in the context table corresponding to the given conn_handle + * + * @retval NRF_SUCCESS Context found + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t app_ble_gap_sec_context_find(uint16_t conn_handle, uint32_t *p_index); +/** @} */ + +#endif //_APP_BLE_GAP_SEC_KEYS_H diff --git a/components/serialization/application/codecs/s120/serializers/app_ble_user_mem.c b/components/serialization/application/codecs/s120/serializers/app_ble_user_mem.c new file mode 100644 index 0000000..c476020 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/app_ble_user_mem.c @@ -0,0 +1,74 @@ +/* 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_ble_user_mem.h" +#include "ser_config.h" +#include "nrf_error.h" +#include + +ser_ble_user_mem_t m_app_user_mem_table[SER_MAX_CONNECTIONS]; + +uint32_t app_ble_user_mem_context_create(uint16_t conn_handle, uint32_t *p_index) +{ + uint32_t err_code = NRF_ERROR_NO_MEM; + uint32_t i; + + for (i=0; i + +/**@brief Connection - user memory mapping structure. + * + * @note This structure is used to map user memory to connection instances, and will be stored in a static table. + */ +//lint -esym(452,ser_ble_user_mem_t) +typedef struct +{ + uint16_t conn_handle; /**< Connection handle.*/ + uint8_t conn_active; /**< Indication that user memory for this connection is used by soft device. 0: memory used; 1: memory not used*/ + ble_user_mem_block_t mem_block; /**< User memory block structure, see @ref ble_user_mem_block_t.*/ +} ser_ble_user_mem_t; + +/**@brief allocates instance in m_user_mem_table[] for storage. + * + * @param[in] conn_handle conn_handle + * @param[out] p_index pointer to the index of allocated instance + * + * @retval NRF_SUCCESS Context allocated. + * @retval NRF_ERROR_NO_MEM No free instance available. + */ +uint32_t app_ble_user_mem_context_create(uint16_t conn_handle, uint32_t *p_index); + +/**@brief release instance identified by a connection handle. + * + * @param[in] conn_handle conn_handle + * + * @retval NRF_SUCCESS Context released. + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t app_ble_user_mem_context_destroy(uint16_t conn_handle); + +/**@brief finds index of instance identified by a connection handle in m_user_mem_table[]. + * + * @param[in] conn_handle conn_handle + * + * @param[out] p_index Pointer to the index of the entry in the context table corresponding to the given conn_handle + * + * @retval NRF_SUCCESS Context found + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t app_ble_user_mem_context_find(uint16_t conn_handle, uint32_t *p_index); +/** @} */ + +#endif //_APP_BLE_USER_MEM_H diff --git a/components/serialization/application/codecs/s120/serializers/ble_app.h b/components/serialization/application/codecs/s120/serializers/ble_app.h new file mode 100644 index 0000000..9346002 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_app.h @@ -0,0 +1,445 @@ +/* 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. + * + */ +#ifndef BLE_APP_H__ +#define BLE_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s120_codecs Application s120 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_app Application command request encoders and command response decoders + * @{ + * @ingroup ser_app_s120_codecs + * + * @brief Application command request encoders and command response decoders. + */ +#include "ble.h" +/** + * @brief Encodes @ref sd_ble_tx_buffer_count_get command request. + * + * @sa @ref nrf51_tx_buffer_count_get_encoding for packet format, + * @ref ble_tx_buffer_count_get_rsp_dec for command response decoder. + * + * @param[in] p_count Pointer to count value to be filled. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_count will not be updated by the command + * request encoder. Updated values are set by @ref ble_tx_buffer_count_get_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_tx_buffer_count_get_req_enc(uint8_t const * const p_count, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_tx_buffer_count_get command. + * + * @sa @ref nrf51_tx_buffer_count_get_encoding for packet format, + * @ref ble_tx_buffer_count_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_count Pointer to pointer to count value. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_tx_buffer_count_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * * const pp_count, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_uuid_encode command request. + * + * @sa @ref nrf51_uuid_encode_encoding for packet format, + * @ref ble_uuid_encode_rsp_dec for command response decoder. + * + * @param[in] p_uuid Pointer to a @ref ble_uuid_t structure that will be encoded into bytes. + * @param[in] p_uuid_le_len Size of \p p_uuid_le if \p p_uuid_le is not NULL + * @param[in] p_uuid_le Pointer to a buffer where the little endian raw UUID bytes(2 or 16) + * will be stored. Can be NULL to calculate required size. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_uuid_le_len and \p p_uuid_le will not be updated by the command + * request encoder. Updated values are set by @ref ble_uuid_encode_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_uuid_encode_req_enc(ble_uuid_t const * const p_uuid, + uint8_t const * const p_uuid_le_len, + uint8_t const * const p_uuid_le, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_uuid_encode command. + * + * @sa @ref nrf51_uuid_encode_encoding for packet format, + * @ref ble_uuid_encode_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[in,out] p_uuid_le_len \c in: Size (in bytes) of \p p_uuid_le buffer. + * \c out: Length of decoded contents of \p p_uuid_le. + * @param[out] p_uuid_le Pointer to a buffer where the encoded UUID will be stored. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Length of \p p_uuid_le is too small to hold decoded + * value from response. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_uuid_encode_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * const p_uuid_le_len, + uint8_t * const p_uuid_le, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_uuid_decode command request. + * + * @sa @ref nrf51_uuid_decode_encoding for packet format, + * @ref ble_uuid_decode_rsp_dec for command response decoder. + * + * @param[in] uuid_le_len Size of \p p_uuid_le if \p p_uuid_le is not NULL + * @param[in] p_uuid_le Pointer to a buffer where the little endian raw UUID bytes(2 or 16) + * is stored. + * @param[out] p_uuid Pointer to a @ref ble_uuid_t structure were raw UUID will be decoded. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_uuid will not be updated by the command request encoder. + * Updated values are set by @ref ble_uuid_decode_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_uuid_decode_req_enc(uint8_t uuid_le_len, + uint8_t const * const p_uuid_le, + ble_uuid_t * const p_uuid, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_uuid_decode command. + * + * @sa @ref nrf51_uuid_decode_encoding for packet format, + * @ref ble_uuid_decode_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_uuid Pointer to a buffer where the decoded UUID will be stored. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_uuid_decode_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_uuid_t * * const p_uuid, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_uuid_vs_add command request. + * + * @sa @ref nrf51_uuid_vs_add_encoding for packet format, + * @ref ble_uuid_vs_add_rsp_dec for command response decoder. + * + * @param[in] p_vs_uuid Pointer to a @ref ble_uuid128_t structure. + * @param[in] p_uuid_type Pointer to uint8_t where UUID type will be returned. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_uuid_type will not be updated by the command request encoder. + * Updated values are set by @ref ble_uuid_vs_add_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_uuid_vs_add_req_enc(ble_uuid128_t const * const p_vs_uuid, + uint8_t * const p_uuid_type, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_uuid_vs_add command. + * + * @sa @ref nrf51_uuid_vs_add_encoding for packet format, + * @ref ble_uuid_vs_add_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] buf_len Length (in bytes) of response packet. + * @param[out] pp_uuid_type Pointer to a pointer to uint8_t where the decoded UUID type will be stored. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_uuid_vs_add_rsp_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint8_t * * const pp_uuid_type, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_version_get command request. + * + * @sa @ref nrf51_version_get_encoding for packet format, + * @ref ble_version_get_rsp_dec for command response decoder. + * + * @param[in] p_version Pointer to a @ref ble_version_t structure to be filled by the response. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_version_get_req_enc(ble_version_t const * const p_version, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_version_get command. + * + * @sa @ref nrf51_version_get_encoding for packet format, + * @ref ble_version_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_version Pointer to a @ref ble_version_t where decoded version will be stored. + * @param[out] p_result_code Command result code. + * + * @return NRF_SUCCESS Version information stored successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_version_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_version_t * p_version, + uint32_t * const p_result_code); + + +/**@brief Encodes @ref sd_ble_opt_set command request. + * + * @sa @ref nrf51_opt_set_encoding for packet format, + * @ref ble_opt_set_rsp_dec for command response decoder. + * + * @param[in] opt_id Identifies type of parameter in ble_opt_t union. + * @param[in] p_opt Pointer to ble_opt_t union. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Invalid opt id. + */ +uint32_t ble_opt_set_req_enc(uint32_t const opt_id, + ble_opt_t const * const p_opt, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_opt_set command. + * + * @sa @ref nrf51_opt_set_encoding for packet format, + * @ref ble_opt_set_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @return NRF_SUCCESS Version information stored successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_opt_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_enable command request. + * + * @sa @ref nrf51_enable_encoding for packet format, + * @ref ble_enable_rsp_dec for command response decoder. + * + * @param[in] p_ble_enable_params Pointer to a @ref ble_enable_params_t structure. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_enable_req_enc(ble_enable_params_t * p_ble_enable_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_enable command. + * + * @sa @ref nrf51_enable_encoding for packet format, + * @ref ble_enable_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @return NRF_SUCCESS Success. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_enable_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_opt_get command request. + * + * @sa @ref nrf51_opt_get_encoding for packet format, + * @ref ble_opt_get_rsp_dec for command response decoder. + * + * @param[in] opt_id Identifies type of parameter in ble_opt_t union. + * @param[in] p_opt Pointer to a @ref ble_opt_t union to be filled by the response. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Invalid opt id. + */ +uint32_t ble_opt_get_req_enc(uint32_t opt_id, + ble_opt_t const * const p_opt, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_opt_get command. + * + * @sa @ref nrf51_opt_get_encoding for packet format, + * @ref ble_opt_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_opt_id Pointer to a decoded opt_id + * @param[out] p_opt Pointer to a decoded @ref ble_opt_t union + * @param[out] p_result_code Command result code. + * + * @return NRF_SUCCESS Opt stored successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + * @retval NRF_ERROR_INVALID_PARAM Invalid opt id. + */ + +uint32_t ble_opt_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_opt_id, + ble_opt_t * const p_opt, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_user_mem_reply command request. + * + * @sa @ref nrf51_user_mem_reply_encoding for packet format, + * @ref ble_user_mem_reply_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection Handle. + * @param[in] p_block Pointer to a @ref ble_user_mem_block_t structure. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Invalid opt id. + */ +uint32_t ble_user_mem_reply_req_enc(uint16_t conn_handle, + ble_user_mem_block_t const * p_block, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_user_mem_reply command. + * + * @sa @ref nrf51_user_mem_reply_encoding for packet format, + * @ref ble_user_mem_reply_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @return NRF_SUCCESS Opt stored successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + * @retval NRF_ERROR_INVALID_PARAM Invalid opt id. + */ +uint32_t ble_user_mem_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Event decoding dispatcher. + * + * The event decoding dispatcher will route the event packet to the correct decoder which in turn + * decodes the contents of the event and updates the \p p_event struct. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to beginning of event packet. + * @param[in] packet_len Length (in bytes) of event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + * @retval NRF_ERROR_NOT_FOUND Decoding failure. No event decoder is available. + */ +uint32_t ble_event_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** @} */ +#endif diff --git a/components/serialization/application/codecs/s120/serializers/ble_enable.c b/components/serialization/application/codecs/s120/serializers/ble_enable.c new file mode 100644 index 0000000..09db16a --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_enable.c @@ -0,0 +1,50 @@ +/* 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 +#include +#include "ble_app.h" +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + + +uint32_t ble_enable_req_enc(ble_enable_params_t * p_ble_enable_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 2, *p_buf_len); + + p_buf[index++] = SD_BLE_ENABLE; + + err_code = cond_field_enc(p_ble_enable_params, p_buf, *p_buf_len, &index, ble_enable_params_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_enable_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_ENABLE, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_event.c b/components/serialization/application/codecs/s120/serializers/ble_event.c new file mode 100644 index 0000000..6573cd6 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_event.c @@ -0,0 +1,241 @@ +/* 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 "ble_app.h" +#include "ble_evt_app.h" +#include "ble_gap_evt_app.h" +#include "ble_gattc_evt_app.h" +#include "ble_gatts_evt_app.h" +#include "ble_l2cap_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_event_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + SER_ASSERT_LENGTH_LEQ(SER_EVT_HEADER_SIZE, packet_len); + + + const uint16_t event_id = uint16_decode(&p_buf[SER_EVT_ID_POS]); + const uint8_t * p_sub_buffer = &p_buf[SER_EVT_HEADER_SIZE]; + const uint32_t sub_packet_len = packet_len - SER_EVT_HEADER_SIZE; + + if (p_event) + { + SER_ASSERT_LENGTH_LEQ(sizeof (ble_evt_hdr_t), *p_event_len); + *p_event_len -= sizeof (ble_evt_hdr_t); + } + + switch (event_id) + { + case BLE_EVT_TX_COMPLETE: + err_code = ble_evt_tx_complete_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_EVT_USER_MEM_REQUEST: + err_code = ble_evt_user_mem_request_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_EVT_USER_MEM_RELEASE: + err_code = ble_evt_user_mem_release_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GAP_EVT_PASSKEY_DISPLAY: + err_code = ble_gap_evt_passkey_display_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GAP_EVT_AUTH_KEY_REQUEST: + err_code = ble_gap_evt_auth_key_request_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GAP_EVT_CONN_PARAM_UPDATE: + err_code = ble_gap_evt_conn_param_update_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST: + err_code = ble_gap_evt_conn_param_update_request_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GAP_EVT_CONN_SEC_UPDATE: + err_code = ble_gap_evt_conn_sec_update_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GAP_EVT_CONNECTED: + err_code = ble_gap_evt_connected_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GAP_EVT_DISCONNECTED: + err_code = ble_gap_evt_disconnected_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GAP_EVT_TIMEOUT: + err_code = ble_gap_evt_timeout_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GAP_EVT_RSSI_CHANGED: + err_code = ble_gap_evt_rssi_changed_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GAP_EVT_SEC_INFO_REQUEST: + err_code = ble_gap_evt_sec_info_request_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GAP_EVT_SEC_PARAMS_REQUEST: + err_code = ble_gap_evt_sec_params_request_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GAP_EVT_AUTH_STATUS: + err_code = ble_gap_evt_auth_status_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GAP_EVT_SEC_REQUEST: + err_code = ble_gap_evt_sec_request_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GATTC_EVT_CHAR_DISC_RSP: + err_code = ble_gattc_evt_char_disc_rsp_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP: + err_code = ble_gattc_evt_char_val_by_uuid_read_rsp_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GATTC_EVT_DESC_DISC_RSP: + err_code = ble_gattc_evt_desc_disc_rsp_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP: + err_code = ble_gattc_evt_prim_srvc_disc_rsp_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GATTC_EVT_READ_RSP: + err_code = ble_gattc_evt_read_rsp_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GATTC_EVT_HVX: + err_code = ble_gattc_evt_hvx_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GATTC_EVT_TIMEOUT: + err_code = ble_gattc_evt_timeout_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GATTC_EVT_WRITE_RSP: + err_code = ble_gattc_evt_write_rsp_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GATTC_EVT_CHAR_VALS_READ_RSP: + err_code = ble_gattc_evt_char_vals_read_rsp_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GATTC_EVT_REL_DISC_RSP: + err_code = ble_gattc_evt_rel_disc_rsp_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GATTS_EVT_WRITE: + err_code = ble_gatts_evt_write_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GATTS_EVT_TIMEOUT: + err_code = ble_gatts_evt_timeout_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GATTS_EVT_SC_CONFIRM: + err_code = ble_gatts_evt_sc_confirm_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GATTS_EVT_HVC: + err_code = ble_gatts_evt_hvc_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GATTS_EVT_SYS_ATTR_MISSING: + err_code = ble_gatts_evt_sys_attr_missing_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST: + err_code = ble_gatts_evt_rw_authorize_request_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_L2CAP_EVT_RX: + err_code = ble_l2cap_evt_rx_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GAP_EVT_ADV_REPORT: + err_code = ble_gap_evt_adv_report_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GAP_EVT_SCAN_REQ_REPORT: + err_code = ble_gap_evt_scan_req_report_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + default: + err_code = NRF_ERROR_NOT_FOUND; + break; + } + + if (p_event != NULL) + { + p_event->header.evt_id = (err_code == NRF_SUCCESS) ? event_id : 0; + p_event->header.evt_len = (err_code == NRF_SUCCESS) ? + (uint16_t)*p_event_len : 0; + } + *p_event_len += sizeof(ble_evt_hdr_t); + return err_code; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_evt_app.h b/components/serialization/application/codecs/s120/serializers/ble_evt_app.h new file mode 100644 index 0000000..887d44f --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_evt_app.h @@ -0,0 +1,111 @@ +/* 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 BLE_EVT_APP_H__ +#define BLE_EVT_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s120_codecs Application s120 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_evt_app Application event decoders + * @{ + * @ingroup ser_app_s120_codecs + * + * @brief Application event decoders. + */ +#include "ble.h" + +/** + * @brief Decodes ble_evt_tx_complete event. + * + * @sa @ref nrf51_evt_tx_complete_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_evt_tx_complete_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_evt_user_mem_request event. + * + * @sa @ref nrf51_evt_user_mem_request_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ + uint32_t ble_evt_user_mem_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_evt_user_mem_release event. + * + * @sa @ref nrf51_evt_user_mem_release_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ + uint32_t ble_evt_user_mem_release_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** @} */ +#endif diff --git a/components/serialization/application/codecs/s120/serializers/ble_evt_tx_complete.c b/components/serialization/application/codecs/s120/serializers/ble_evt_tx_complete.c new file mode 100644 index 0000000..4abf73c --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_evt_tx_complete.c @@ -0,0 +1,49 @@ +/* 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 "ble_evt_app.h" +#include "ble_serialization.h" + + +uint32_t ble_evt_tx_complete_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 1, packet_len); + + uint32_t event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_evt_tx_complete_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_EVT_TX_COMPLETE; + p_event->header.evt_len = event_len; + + uint16_dec(p_buf, packet_len, &index, &p_event->evt.common_evt.conn_handle); + uint8_dec(p_buf, packet_len, &index, &p_event->evt.common_evt.params.tx_complete.count); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_evt_user_mem_release.c b/components/serialization/application/codecs/s120/serializers/ble_evt_user_mem_release.c new file mode 100644 index 0000000..54efc5f --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_evt_user_mem_release.c @@ -0,0 +1,79 @@ +/* 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 "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" +#include "ble_evt_app.h" +#include "app_ble_user_mem.h" + +extern ser_ble_user_mem_t m_app_user_mem_table[]; + +uint32_t ble_evt_user_mem_release_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_event_len); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.common_evt.params.user_mem_release)) + + sizeof (ble_evt_user_mem_release_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + p_event->header.evt_id = BLE_EVT_USER_MEM_RELEASE; + p_event->header.evt_len = event_len; + ble_evt_user_mem_release_t * p_user_mem_rel = &(p_event->evt.common_evt.params.user_mem_release); + + err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.common_evt.conn_handle)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, packet_len, &index, &(p_user_mem_rel->type)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + // Decoding order of mem block is different than structure elements order - length is decoded first + err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_user_mem_rel->mem_block.len)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (p_buf[index++] == SER_FIELD_PRESENT) + { + // Using connection handle find which mem block to release in Application Processor + uint32_t user_mem_table_index; + err_code = app_ble_user_mem_context_find(p_event->evt.common_evt.conn_handle, &user_mem_table_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_user_mem_rel->mem_block.p_mem = m_app_user_mem_table[user_mem_table_index].mem_block.p_mem; + } + else + { + p_user_mem_rel->mem_block.p_mem = NULL; + } + + // Now user memory context can be released + err_code = app_ble_user_mem_context_destroy(p_event->evt.common_evt.conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return err_code; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_evt_user_mem_request.c b/components/serialization/application/codecs/s120/serializers/ble_evt_user_mem_request.c new file mode 100644 index 0000000..891f759 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_evt_user_mem_request.c @@ -0,0 +1,53 @@ +/* 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 "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" +#include "ble_evt_app.h" + +uint32_t ble_evt_user_mem_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_event_len); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.common_evt.params.user_mem_request)) + + sizeof (ble_evt_user_mem_request_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + p_event->header.evt_id = BLE_EVT_USER_MEM_REQUEST; + p_event->header.evt_len = event_len; + + err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.common_evt.conn_handle)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, packet_len, &index, &(p_event->evt.common_evt.params.user_mem_request.type)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return err_code; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_address_get.c b/components/serialization/application/codecs/s120/serializers/ble_gap_address_get.c new file mode 100644 index 0000000..4af2bc4 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_address_get.c @@ -0,0 +1,75 @@ +/* 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 "ble_gap_app.h" +#include +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_address_get_req_enc(ble_gap_addr_t const * const p_address, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_ADDRESS_GET; + p_buf[index++] = (p_address == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_address_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_addr_t * const p_address, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t index = 0; + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, + &index, + packet_len, + SD_BLE_GAP_ADDRESS_GET, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + SER_ASSERT_LENGTH_LEQ(index + 1 + BLE_GAP_ADDR_LEN, packet_len); + SER_ASSERT_NOT_NULL(p_address); + + p_address->addr_type = p_buf[index++]; + memcpy(p_address->addr, &p_buf[index], BLE_GAP_ADDR_LEN); + index += BLE_GAP_ADDR_LEN; + + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_address_set.c b/components/serialization/application/codecs/s120/serializers/ble_gap_address_set.c new file mode 100644 index 0000000..8acaa61 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_address_set.c @@ -0,0 +1,60 @@ +/* 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 "ble_gap_app.h" +#include +#include +#include "ble_serialization.h" +#include "ble_gap.h" +#include "app_util.h" + + +uint32_t ble_gap_address_set_req_enc(uint8_t addr_cycle_mode, + ble_gap_addr_t const * const p_addr, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 1 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_ADDRESS_SET; + + err_code = uint8_t_enc(&addr_cycle_mode, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + p_buf[index++] = (p_addr == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + if (p_addr != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 1 + BLE_GAP_ADDR_LEN, *p_buf_len); + p_buf[index++] = p_addr->addr_type; + memcpy(&p_buf[index], p_addr->addr, BLE_GAP_ADDR_LEN); + index += BLE_GAP_ADDR_LEN; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_address_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_ADDRESS_SET, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_adv_data_set.c b/components/serialization/application/codecs/s120/serializers/ble_gap_adv_data_set.c new file mode 100644 index 0000000..a59f271 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_adv_data_set.c @@ -0,0 +1,52 @@ +/* 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 "ble_gap_app.h" +#include +#include "ble_serialization.h" +#include "nrf_error.h" + + +uint32_t ble_gap_adv_data_set_req_enc(uint8_t const * const p_data, + uint8_t dlen, + uint8_t const * const p_sr_data, + uint8_t srdlen, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint8_t opcode = SD_BLE_GAP_ADV_DATA_SET; + uint32_t err_code; + err_code = uint8_t_enc(&opcode, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = len8data_enc(p_data, dlen, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = len8data_enc(p_sr_data, srdlen, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gap_adv_data_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_ADV_DATA_SET, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_adv_start.c b/components/serialization/application/codecs/s120/serializers/ble_gap_adv_start.c new file mode 100644 index 0000000..115a447 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_adv_start.c @@ -0,0 +1,72 @@ +/* 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 "ble_gap_app.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gap.h" +#include "app_util.h" + +uint32_t ble_gap_adv_start_req_enc(ble_gap_adv_params_t const * const p_adv_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + SER_ASSERT_LENGTH_LEQ(index + 2, total_len); + p_buf[index++] = SD_BLE_GAP_ADV_START; + p_buf[index++] = (p_adv_params == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + if (p_adv_params != NULL) + { + err_code = uint8_t_enc(&(p_adv_params->type), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_adv_params->p_peer_addr, p_buf, total_len, &index, ble_gap_addr_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&(p_adv_params->fp), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_adv_params->p_whitelist, p_buf, total_len, &index, ble_gap_whitelist_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_adv_params->interval), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_adv_params->timeout), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_adv_ch_mask_t_enc(&(p_adv_params->channel_mask), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gap_adv_start_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_ADV_START, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_adv_stop.c b/components/serialization/application/codecs/s120/serializers/ble_gap_adv_stop.c new file mode 100644 index 0000000..c633a4b --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_adv_stop.c @@ -0,0 +1,40 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" + +uint32_t ble_gap_adv_stop_req_enc(uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GAP_ADV_STOP; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gap_adv_stop_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_ADV_STOP, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_app.h b/components/serialization/application/codecs/s120/serializers/ble_gap_app.h new file mode 100644 index 0000000..433fbfa --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_app.h @@ -0,0 +1,1159 @@ +/* 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. + * + */ +#ifndef BLE_GAP_APP_H__ +#define BLE_GAP_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s120_codecs Application s120 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gap_app GAP Application command request encoders and command response decoders + * @{ + * @ingroup ser_app_s120_codecs + * + * @brief GAP Application command request encoders and command response decoders. + */ +#include "ble.h" +#include "ble_gap.h" + +/** + * @brief Encodes @ref sd_ble_gap_address_get command request. + * + * @sa @ref nrf51_address_get_encoding for packet format, + * @ref ble_gap_address_get_rsp_dec for command response decoder. + * + * @param[in] p_address Pointer to address. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_address will not be updated by the command + * request encoder. Updated values are set by @ref ble_gap_address_get_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_address_get_req_enc(ble_gap_addr_t const * const p_address, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_address_get command. + * + * @sa @ref nrf51_address_get_encoding for packet format, + * @ref ble_gap_address_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_address Pointer to address. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_address_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_addr_t * const p_address, + uint32_t * const p_result_code); + +/** + * @brief Encodes @ref sd_ble_gap_address_set command request. + * + * @sa @ref nrf51_gap_address_set_encoding for packet format, + * @ref ble_gap_address_set_rsp_dec for command response decoder. + * + * @param[in] addr_cycle_mode Address cycle mode. + * @param[in] p_addr Pointer to address structure. + * @param[in,out] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_address_set_req_enc(uint8_t addr_cycle_mode, + ble_gap_addr_t const * const p_addr, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_address_set command. + * + * @sa @ref nrf51_gap_address_set_encoding for packet format, + * @ref ble_gap_address_set_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_address_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/** + * @brief Encodes @ref sd_ble_gap_adv_data_set command request. + * + * @sa @ref nrf51_adv_set_encoding for packet format, + * @ref ble_gap_adv_data_set_rsp_dec for command response decoder. + * + * @param[in] p_data Raw data to be placed in advertisement packet. If NULL, no changes + * are made to the current advertisement 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. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_adv_data_set_req_enc(uint8_t const * const p_data, + uint8_t dlen, + uint8_t const * const p_sr_data, + uint8_t srdlen, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_adv_data_set command. + * + * @sa @ref nrf51_adv_set_encoding for packet format, + * @ref ble_gap_adv_data_set_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_adv_data_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/** + * @brief Encodes @ref sd_ble_gap_adv_start command request. + * + * @sa @ref nrf51_adv_start_encoding for packet format, + * @ref ble_gap_adv_start_rsp_dec for command response decoder. + * + * @param[in] p_adv_params Pointer to advertising parameters structure. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_adv_start_req_enc(ble_gap_adv_params_t const * const p_adv_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_adv_start command. + * + * @sa @ref nrf51_adv_start_encoding for packet format, + * @ref ble_gap_adv_start_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_adv_start_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/** + * @brief Encodes @ref sd_ble_gap_tx_power_set command request. + * + * @sa @ref nrf51_tx_power_set_encoding for packet format, + * @ref ble_gap_tx_power_set_rsp_dec for command response decoder. + * + * @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] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_tx_power_set_req_enc(int8_t tx_power, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_tx_power_set command. + * + * @sa @ref nrf51_tx_power_set_encoding for packet format, + * @ref ble_gap_tx_power_set_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_tx_power_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/** + * @brief Encodes @ref sd_ble_gap_appearance_get command request. + * + * @sa @ref nrf51_appearance_get_encoding for packet format, + * @ref ble_gap_appearance_get_rsp_dec for command response decoder. + * + * @param[in] p_appearance Appearance (16-bit), see @ref BLE_APPEARANCES + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_appearance will not be updated by the command + * request encoder. Updated values are set by @ref ble_gap_appearance_get_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_appearance_get_req_enc(uint16_t const * const p_appearance, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_appearance_get command. + * + * @sa @ref nrf51_appearance_get_encoding for packet format, + * @ref ble_gap_appearance_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_appearance Appearance (16-bit), see @ref BLE_APPEARANCES. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_appearance_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_appearance, + uint32_t * const p_result_code); + +/** + * @brief Encodes @ref sd_ble_gap_appearance_set command request. + * + * @sa @ref nrf51_appearance_set_encoding for packet format, + * @ref ble_gap_appearance_set_rsp_dec for command response decoder. + * + * @param[in] appearance Appearance (16-bit), see @ref BLE_APPEARANCES. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_appearance_set_req_enc(uint16_t appearance, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_appearance_set command. + * + * @sa @ref nrf51_appearance_set_encoding for packet format, + * @ref ble_gap_appearance_set_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_appearance_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/** + * @brief Encodes @ref sd_ble_gap_device_name_get command request. + * + * @sa @ref nrf51_device_name_get_encoding for packet format, + * @ref ble_gap_device_name_get_rsp_dec for command response decoder. + * + * @param[in] 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] p_dev_name_len Length of the buffer pointed by p_dev_name. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_dev_name and \p p_len will not be updated by the command + * request encoder. Updated values are set by @ref ble_gap_device_name_get_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_device_name_get_req_enc(uint8_t const * const p_dev_name, + uint16_t const * const p_dev_name_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_device_name_get command. + * + * @sa @ref nrf51_device_name_get_encoding for packet format, + * @ref ble_gap_device_name_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_dev_name Pointer to an empty buffer where the UTF-8 + * non NULL-terminated string will be placed. + * @param[in,out] p_dev_name_len Length of the buffer pointed by p_dev_name, complete device name + * length on output. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_device_name_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * const p_dev_name, + uint16_t * const p_dev_name_len, + uint32_t * const p_result_code); + +/** + * @brief Encodes @ref sd_ble_gap_device_name_set command request. + * + * @sa @ref nrf51_device_name_set_encoding for packet format, + * @ref ble_gap_device_name_set_rsp_dec for command response decoder. + * + * @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). + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_device_name_set_req_enc(ble_gap_conn_sec_mode_t const * const p_write_perm, + uint8_t const * const p_dev_name, + uint16_t len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_device_name_set command. + * + * @sa @ref nrf51_device_name_set_encoding for packet format, + * @ref ble_gap_device_name_set_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_device_name_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/** + * @brief Encodes @ref sd_ble_gap_ppcp_set command request. + * + * @sa @ref nrf51_ppcp_set_encoding for packet format, + * @ref ble_gap_ppcp_set_rsp_dec for command response decoder. + * + * @param[in] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure with the + * desired parameters. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_ppcp_set_req_enc(ble_gap_conn_params_t const * const p_conn_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_ppcp_set command. + * + * @sa @ref nrf51_ppcp_set_encoding for packet format, + * @ref ble_gap_ppcp_set_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_ppcp_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_conn_param_update command request. + * + * @sa @ref nrf51_gap_conn_param_update_encoding for packet format, + * @ref ble_gap_conn_param_update_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_conn_params Pointer to desired connection parameters.. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_conn_param_update_req_enc(uint16_t conn_handle, + ble_gap_conn_params_t const * const p_conn_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_conn_param_update command. + * + * @sa @ref nrf51_gap_conn_param_update_encoding for packet format, + * @ref ble_gap_conn_param_update_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_conn_param_update_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_disconnect command request. + * + * @sa @ref nrf51_disconnect_encoding for packet format, + * @ref ble_gap_disconnect_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] hci_status_code HCI status code, see @ref BLE_HCI_STATUS_CODES. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_disconnect_req_enc(uint16_t conn_handle, + uint8_t hci_status_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_disconnect command. + * + * @sa @ref nrf51_disconnect_encoding for packet format, + * @ref ble_gap_disconnect_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_disconnect_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + + +/**@brief Encodes @ref sd_ble_gap_rssi_stop command request. + * + * @sa @ref nrf51_rssi_stop_encoding for packet format, + * @ref ble_gap_rssi_stop_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_rssi_stop_req_enc(uint16_t conn_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_rssi_stop command. + * + * @sa @ref nrf51_rssi_stop_encoding for packet format, + * @ref ble_gap_rssi_stop_rsp_dec for command response decoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_rssi_stop_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + + + + +/**@brief Encodes @ref sd_ble_gap_ppcp_get command request. + * + * @sa @ref nrf51_gap_ppcp_get_encoding for packet format, + * @ref ble_gap_ppcp_get_rsp_dec for command response decoder. + * + * @param[in] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure where the + * parameters will be stored. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_conn_params will not be updated by the command request encoder. Updated values are + * set by @ref ble_gap_ppcp_get_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_ppcp_get_req_enc(ble_gap_conn_params_t const * const p_conn_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_ppcp_get command. + * + * @sa @ref nrf51_gap_ppcp_get_encoding for packet format, + * @ref ble_gap_ppcp_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure where the parameters + * will be stored. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_ppcp_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_conn_params_t * const p_conn_params, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_auth_key_reply command request. + * + * @sa @ref nrf51_auth_key_reply_encoding for packet format, + * @ref ble_gap_auth_key_reply_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] key_type Key type which defines length of key data as defined for + * @ref sd_ble_gap_auth_key_reply . + * @param[in] p_key Pointer to a buffer which contains key + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Encoding failure. Incorrect param provided (key_type). + */ +uint32_t ble_gap_auth_key_reply_req_enc(uint16_t conn_handle, + uint8_t key_type, + uint8_t const * const p_key, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_auth_key_reply command. + * + * @sa @ref nrf51_auth_key_reply_encoding for packet format, + * @ref ble_gap_auth_key_reply_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_auth_key_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_sec_info_reply command request. + * + * @sa @ref nrf51_gap_sec_info_reply_encoding for packet format, + * @ref ble_gap_sec_info_reply_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_enc_info Pointer to a @ref ble_gap_enc_info_t encryption information + * structure. + * @param[in] p_id_info Pointer to a @ref ble_gap_irk_t id information + * structure. + * @param[in] p_sign_info Pointer to a @ref ble_gap_sign_info_t signing information + * structure. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_sec_info_reply_req_enc(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, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_sec_info_reply command. + * + * @sa @ref nrf51_gap_sec_info_reply_encoding for packet format, + * @ref ble_gap_sec_info_reply_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_sec_info_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_sec_params_reply command request. + * + * @sa @ref nrf51_sec_params_reply_encoding for packet format, + * @ref ble_gap_sec_params_reply_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] sec_status Security status, see @ref BLE_GAP_SEC_STATUS. + * @param[in] p_sec_params Pointer to @ref ble_gap_sec_params_t security parameters + * structure. + * @param[in] p_sec_keyset Pointer to @ref ble_gap_sec_keyset_t security keys + * structure. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_sec_params_reply_req_enc(uint16_t conn_handle, + uint8_t sec_status, + ble_gap_sec_params_t const * const p_sec_params, + ble_gap_sec_keyset_t const * const p_sec_keyset, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_sec_params_reply command. + * + * @sa @ref nrf51_sec_params_reply_encoding for packet format, + * @ref ble_gap_sec_params_reply_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[in] p_sec_keyset Pointer to @ref ble_gap_sec_keyset_t security keys + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_sec_params_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_sec_keyset_t const * const p_sec_keyset, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_authenticate command request. + * + * @sa @ref nrf51_ble_gap_authenticate_encoding for packet format, + * @ref ble_gap_authenticate_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_sec_params Pointer to a @ref ble_gap_sec_params_t security parameters + * structure. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_authenticate_req_enc(uint16_t conn_handle, + ble_gap_sec_params_t const * const p_sec_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_authenticate command. + * + * @sa @ref nrf51_ble_gap_authenticate_encoding for packet format, + * @ref ble_gap_authenticate_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_authenticate_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_adv_stop command request. + * + * @sa @ref nrf51_sd_ble_gap_adv_stop for packet format, + * @ref ble_gap_adv_stop_rsp_dec for command response decoder. + * + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_adv_stop_req_enc(uint8_t * const p_buf, uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_adv_stop command. + * + * @sa @ref nrf51_sd_ble_gap_adv_stop for packet format, + * @ref ble_gap_adv_stop_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_adv_stop_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_conn_sec_get command request. + * + * @sa @ref nrf51_gap_conn_sec_get_encoding for packet format, + * @ref ble_gap_conn_sec_get_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_conn_sec Pointer to \ref ble_gap_conn_sec_t which will be filled in + * response. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_conn_sec_get_req_enc(uint16_t conn_handle, + ble_gap_conn_sec_t const * const p_conn_sec, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_conn_sec_get command. + * + * @sa @ref nrf51_gap_conn_sec_get_encoding for packet format, + * @ref ble_gap_conn_sec_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_conn_sec Pointer to pointer to \ref ble_gap_conn_sec_t which will be filled by + * the decoded data (if present). + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_conn_sec_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_conn_sec_t * * const pp_conn_sec, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_rssi_start command request. + * + * @sa @ref nrf51_rssi_start_encoding for packet format, + * @ref ble_gap_rssi_start_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] threshold_dbm Threshold in dBm. + * @param[in] skip_count Sample skip count. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_rssi_start_req_enc(uint16_t conn_handle, + uint8_t threshold_dbm, + uint8_t skip_count, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_rssi_start command. + * + * @sa @ref nrf51_rssi_start_encoding for packet format, + * @ref ble_gap_rssi_start_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_rssi_start_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_scan_stop command request. + * + * @sa @ref nrf51_scan_stop_encoding for packet format, + * @ref ble_gap_scan_stop_rsp_dec for command response decoder. + * + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_scan_stop_req_enc(uint8_t * const p_buf, uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_scan_stop command. + * + * @sa @ref nrf51_scan_stop_encoding for packet format, + * @ref ble_gap_scan_stop_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_scan_stop_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_scan_start command request. + * + * @sa @ref nrf51_scan_start_encoding for packet format, + * @ref ble_gap_scan_start_rsp_dec for command response decoder. + * + * @param[in] p_scan_params Pointer to scan params structure. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_scan_start_req_enc(ble_gap_scan_params_t const * p_scan_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_scan_start command. + * + * @sa @ref nrf51_scan_start_encoding for packet format, + * @ref ble_gap_scan_start_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_scan_start_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_connect command request. + * + * @sa @ref nrf51_connect_encoding for packet format, + * @ref ble_gap_connect_rsp_dec for command response decoder. + * + * @param[in] p_peer_addr Pointer to peer address. + * @param[in] p_scan_params Pointer to scan params structure. + * @param[in] p_conn_params Pointer to desired connection parameters. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_connect_req_enc(ble_gap_addr_t const * const p_peer_addr, + ble_gap_scan_params_t const * const p_scan_params, + ble_gap_conn_params_t const * const p_conn_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_connect command. + * + * @sa @ref nrf51_connect_encoding for packet format, + * @ref ble_gap_connect_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_connect_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_connect_cancel command request. + * + * @sa @ref nrf51_connect_cancel_encoding for packet format, + * @ref ble_gap_connect_cancel_rsp_dec for command response decoder. + * + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_connect_cancel_req_enc(uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_connect_cancel command. + * + * @sa @ref nrf51_connect_cancel_encoding for packet format, + * @ref ble_gap_connect_cancel_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_connect_cancel_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + + +/**@brief Encodes @ref sd_ble_gap_encrypt command request. + * + * @sa @ref nrf51_gap_encrypt_encoding for packet format, + * @ref ble_gap_encrypt_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle. + * @param[in] p_master_id Pointer to a master identification structure. + * @param[in] p_enc_info Pointer to desired connection parameters. + * @param[in] p_buf Pointer to a ble_gap_enc_info_t encryption information structure. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ + +uint32_t ble_gap_encrypt_req_enc( uint16_t conn_handle, + ble_gap_master_id_t const * const p_master_id, + ble_gap_enc_info_t const * const p_enc_info, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + + +/**@brief Decodes response to @ref sd_ble_gap_encrypt command. + * + * @sa @ref nrf51_gap_encrypt_encoding for packet format, + * @ref ble_gap_encrypt_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_encrypt_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_rssi_get command request. + * + * @sa @ref nrf51_rssi_get_encoding for packet format, + * @ref ble_gap_rssi_get_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle. + * @param[in] p_rssi Pointer to the rssi value. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_rssi_get_req_enc(uint16_t conn_handle, + int8_t const * const p_rssi, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_rssi_get command. + * + * @sa @ref nrf51_rssi_get_encoding for packet format, + * @ref ble_gap_rssi_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_rssi Pointer to rssi value. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_rssi_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + int8_t * const p_rssi, + uint32_t * const p_result_code); + +/** @} */ +#endif diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_appearance_get.c b/components/serialization/application/codecs/s120/serializers/ble_gap_appearance_get.c new file mode 100644 index 0000000..cc55dd6 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_appearance_get.c @@ -0,0 +1,70 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_appearance_get_req_enc(uint16_t const * const p_appearance, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_APPEARANCE_GET; + p_buf[index++] = (p_appearance == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_appearance_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_appearance, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t index = 0; + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_GAP_APPEARANCE_GET, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; + } + + SER_ASSERT_LENGTH_LEQ(index + sizeof (uint16_t), packet_len); + + uint16_dec(p_buf, packet_len, &index, p_appearance); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_appearance_set.c b/components/serialization/application/codecs/s120/serializers/ble_gap_appearance_set.c new file mode 100644 index 0000000..8038b76 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_appearance_set.c @@ -0,0 +1,44 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "ble_gap.h" +#include "app_util.h" + + +uint32_t ble_gap_appearance_set_req_enc(uint16_t appearance, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 2, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_APPEARANCE_SET; + index += uint16_encode(appearance, &p_buf[index]); + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_appearance_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_APPEARANCE_SET, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_auth_key_reply.c b/components/serialization/application/codecs/s120/serializers/ble_gap_auth_key_reply.c new file mode 100644 index 0000000..58861e0 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_auth_key_reply.c @@ -0,0 +1,76 @@ +/* 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 "ble_gap_app.h" +#include +#include "ble_serialization.h" +#include "ble_gap.h" +#include "app_util.h" + + +uint32_t ble_gap_auth_key_reply_req_enc(uint16_t conn_handle, + uint8_t key_type, + uint8_t const * const p_key, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t buf_len = *p_buf_len; + uint8_t opcode = SD_BLE_GAP_AUTH_KEY_REPLY; + uint32_t err_code = NRF_SUCCESS; + uint8_t key_len; + + err_code = uint8_t_enc(&opcode, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&key_type, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + switch (key_type) + { + case BLE_GAP_AUTH_KEY_TYPE_NONE: + key_len = 0; + break; + + case BLE_GAP_AUTH_KEY_TYPE_PASSKEY: + key_len = 6; + break; + + case BLE_GAP_AUTH_KEY_TYPE_OOB: + key_len = 16; + break; + + default: + return NRF_ERROR_INVALID_PARAM; + } + + err_code = buf_enc(p_key, key_len, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gap_auth_key_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_AUTH_KEY_REPLY, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_authenticate.c b/components/serialization/application/codecs/s120/serializers/ble_gap_authenticate.c new file mode 100644 index 0000000..1f93c74 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_authenticate.c @@ -0,0 +1,52 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_authenticate_req_enc(uint16_t conn_handle, + ble_gap_sec_params_t const * const p_sec_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(1, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_AUTHENTICATE; + + err_code = uint16_t_enc(&conn_handle, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_sec_params, p_buf, *p_buf_len, &index, ble_gap_sec_params_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gap_authenticate_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_AUTHENTICATE, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_conn_param_update.c b/components/serialization/application/codecs/s120/serializers/ble_gap_conn_param_update.c new file mode 100644 index 0000000..3d81edf --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_conn_param_update.c @@ -0,0 +1,55 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_conn_param_update_req_enc(uint16_t conn_handle, + ble_gap_conn_params_t const * const p_conn_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 2 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_CONN_PARAM_UPDATE; + index += uint16_encode(conn_handle, &p_buf[index]); + + p_buf[index++] = (p_conn_params != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_conn_params != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 1 + 2 * 4, *p_buf_len); + index += uint16_encode(p_conn_params->min_conn_interval, &p_buf[index]); + index += uint16_encode(p_conn_params->max_conn_interval, &p_buf[index]); + index += uint16_encode(p_conn_params->slave_latency, &p_buf[index]); + index += uint16_encode(p_conn_params->conn_sup_timeout, &p_buf[index]); + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_conn_param_update_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_CONN_PARAM_UPDATE, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_conn_sec_get.c b/components/serialization/application/codecs/s120/serializers/ble_gap_conn_sec_get.c new file mode 100644 index 0000000..b3850b1 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_conn_sec_get.c @@ -0,0 +1,74 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "app_util.h" +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" + +uint32_t ble_gap_conn_sec_get_req_enc(uint16_t conn_handle, + ble_gap_conn_sec_t const * const p_conn_sec, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + uint8_t opcode = SD_BLE_GAP_CONN_SEC_GET; + + + err_code = uint8_t_enc(&opcode, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_conn_sec, p_buf, total_len, &index, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gap_conn_sec_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_conn_sec_t * * const pp_conn_sec, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + uint32_t index = 0; + uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_GAP_CONN_SEC_GET, + p_result_code); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_conn_sec, + ble_gap_conn_sec_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_connect.c b/components/serialization/application/codecs/s120/serializers/ble_gap_connect.c new file mode 100644 index 0000000..5f13670 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_connect.c @@ -0,0 +1,54 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" + +uint32_t ble_gap_connect_req_enc(ble_gap_addr_t const * const p_peer_addr, + ble_gap_scan_params_t const * const p_scan_params, + ble_gap_conn_params_t const * const p_conn_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GAP_CONNECT; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_peer_addr, p_buf, buf_len, &index, ble_gap_addr_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_scan_params, p_buf, buf_len, &index, ble_gap_scan_params_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_conn_params, p_buf, buf_len, &index, ble_gap_conn_params_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gap_connect_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_CONNECT, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_connect_cancel.c b/components/serialization/application/codecs/s120/serializers/ble_gap_connect_cancel.c new file mode 100644 index 0000000..0730ade --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_connect_cancel.c @@ -0,0 +1,42 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" + +uint32_t ble_gap_connect_cancel_req_enc(uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GAP_CONNECT_CANCEL; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gap_connect_cancel_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_CONNECT_CANCEL, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_device_name_get.c b/components/serialization/application/codecs/s120/serializers/ble_gap_device_name_get.c new file mode 100644 index 0000000..0d12b4a --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_device_name_get.c @@ -0,0 +1,84 @@ +/* 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 "ble_gap_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_device_name_get_req_enc(uint8_t const * const p_dev_name, + uint16_t const * const p_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 2, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_DEVICE_NAME_GET; + p_buf[index++] = (p_len != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_len != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 2, *p_buf_len); + index += uint16_encode(*p_len, &p_buf[index]); + } + + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + p_buf[index++] = (p_dev_name != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_device_name_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * const p_dev_name, + uint16_t * const p_dev_name_len, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + uint32_t index = 0; + uint32_t status_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_GAP_DEVICE_NAME_GET, + p_result_code); + + if (status_code != NRF_SUCCESS) + { + return status_code; + } + + if (*p_result_code != NRF_SUCCESS) + { + + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_dev_name_len); + status_code = len16data_dec(p_buf, packet_len, &index, (uint8_t * *)&p_dev_name, p_dev_name_len); + + if (status_code != NRF_SUCCESS) + { + return status_code; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return status_code; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_device_name_set.c b/components/serialization/application/codecs/s120/serializers/ble_gap_device_name_set.c new file mode 100644 index 0000000..c265c4f --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_device_name_set.c @@ -0,0 +1,66 @@ +/* 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 "ble_gap_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_device_name_set_req_enc(ble_gap_conn_sec_mode_t const * const p_write_perm, + uint8_t const * const p_dev_name, + uint16_t len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(2, *p_buf_len); + p_buf[index++] = SD_BLE_GAP_DEVICE_NAME_SET; + + p_buf[index++] = (p_write_perm != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_write_perm != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + p_buf[index++] = (uint8_t) ((p_write_perm->sm) | (p_write_perm->lv << 4)); + } + + SER_ERROR_CHECK(len <= BLE_GAP_DEVNAME_MAX_LEN, NRF_ERROR_INVALID_PARAM); + + SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len); + index += uint16_encode(len, &p_buf[index]); + + p_buf[index++] = (p_dev_name != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_dev_name != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + len, *p_buf_len); + memcpy(&p_buf[index], p_dev_name, len); + index += len; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_device_name_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_DEVICE_NAME_SET, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_disconnect.c b/components/serialization/application/codecs/s120/serializers/ble_gap_disconnect.c new file mode 100644 index 0000000..d3064d6 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_disconnect.c @@ -0,0 +1,45 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_disconnect_req_enc(uint16_t conn_handle, + uint8_t hci_status_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 4, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_DISCONNECT; + index += uint16_encode(conn_handle, &p_buf[index]); + p_buf[index++] = hci_status_code; + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_disconnect_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_DISCONNECT, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_encrypt.c b/components/serialization/application/codecs/s120/serializers/ble_gap_encrypt.c new file mode 100644 index 0000000..0abf029 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_encrypt.c @@ -0,0 +1,68 @@ +/* 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 "ble_gap_app.h" +#include +#include "ble_serialization.h" +#include "ble_gap.h" +#include "app_util.h" + + +uint32_t ble_gap_encrypt_req_enc( uint16_t conn_handle, + ble_gap_master_id_t const * const p_master_id, + ble_gap_enc_info_t const * const p_enc_info, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 2 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_ENCRYPT; + index += uint16_encode(conn_handle, &p_buf[index]); + + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + p_buf[index++] = (p_master_id != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_master_id != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + BLE_GAP_SEC_RAND_LEN + 2, *p_buf_len); + index += uint16_encode(p_master_id->ediv, &p_buf[index]); + memcpy(&p_buf[index], p_master_id->rand, BLE_GAP_SEC_RAND_LEN); + index += BLE_GAP_SEC_RAND_LEN; + } + + p_buf[index++] = (p_enc_info != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_enc_info != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + BLE_GAP_SEC_KEY_LEN + 1, *p_buf_len); + memcpy(&p_buf[index], p_enc_info->ltk, BLE_GAP_SEC_KEY_LEN); + index += BLE_GAP_SEC_KEY_LEN; + p_buf[index++] = (p_enc_info->auth | (p_enc_info->ltk_len << 1)); + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_encrypt_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_ENCRYPT, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_evt_adv_report.c b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_adv_report.c new file mode 100644 index 0000000..256919b --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_adv_report.c @@ -0,0 +1,72 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_adv_report_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE+7+1+1, packet_len); // assumed size(data) = 0 + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.adv_report)) + + sizeof (ble_gap_evt_adv_report_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_ADV_REPORT; + p_event->header.evt_len = event_len; + + err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.conn_handle)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_addr_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.adv_report.peer_addr)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.adv_report.rssi)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, packet_len, &index, &byte); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + p_event->evt.gap_evt.params.adv_report.scan_rsp = byte & 0x01; + p_event->evt.gap_evt.params.adv_report.type = (byte >> 1) & 0x03; + p_event->evt.gap_evt.params.adv_report.dlen = (byte >> 3) & 0x1F; + + err_code = uint8_vector_dec(p_buf, packet_len, &index, + p_event->evt.gap_evt.params.adv_report.data, (uint16_t)(p_event->evt.gap_evt.params.adv_report.dlen)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return err_code; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_evt_app.h b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_app.h new file mode 100644 index 0000000..736e228 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_app.h @@ -0,0 +1,409 @@ +/* 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 BLE_GAP_EVT_APP_H__ +#define BLE_GAP_EVT_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s120_codecs Application s120 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gap_evt_app GAP Application event decoders + * @{ + * @ingroup ser_app_s120_codecs + * + * @brief GAP Application event decoders. + */ +#include "ble.h" + +/** + * @brief Decodes ble_gap_evt_auth_key_request event. + * + * @sa @ref nrf51_evt_auth_key_request_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_auth_key_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_auth_status event. + * + * @sa @ref nrf51_evt_auth_status_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_auth_status_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_conn_param_update event. + * + * @sa @ref nrf51_evt_conn_param_update_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_conn_param_update_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_conn_sec_update event. + * + * @sa @ref nrf51_evt_conn_sec_update_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_conn_sec_update_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_connected event. + * + * @sa @ref nrf51_evt_connected_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_connected_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_disconnected event. + * + * @sa @ref nrf51_evt_disconnected_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_disconnected_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_passkey_display event. + * + * @sa @ref nrf51_evt_passkey_display for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_passkey_display_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_rssi_changed event. + * + * @sa @ref nrf51_evt_rssi_changed_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_rssi_changed_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_sec_info_request event. + * + * @sa @ref nrf51_evt_sec_info_request_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_sec_info_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_sec_params_request event. + * + * @sa @ref nrf51_evt_sec_param_request_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_sec_params_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_timeout event. + * + * @sa @ref nrf51_evt_timeout_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_timeout_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_sec_request event. + * + * @sa @ref nrf51_evt_sec_request_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_sec_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_conn_param_update_request event. + * + * @sa @ref nrf51_evt_conn_param_update_request_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_conn_param_update_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); +/** + * @brief Decodes ble_gap_evt_adv_report event. + * + * @sa @ref nrf51_evt_adv_report_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_adv_report_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_scan_req_report event. + * + * @sa @ref nrf51_evt_scan_req_report_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_scan_req_report_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); +/** @} */ +#endif diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_evt_auth_key_request.c b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_auth_key_request.c new file mode 100644 index 0000000..090b431 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_auth_key_request.c @@ -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. + * + */ + +#include "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_auth_key_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t event_len; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(3, packet_len); + + event_len = SER_EVT_CONN_HANDLE_SIZE + 1; + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_AUTH_KEY_REQUEST; + p_event->header.evt_len = event_len; + + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + + uint8_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.params.auth_key_request.key_type); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_evt_auth_status.c b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_auth_status.c new file mode 100644 index 0000000..6f54d6a --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_auth_status.c @@ -0,0 +1,69 @@ +/* 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 "ble_gap_evt_app.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" +#include "app_ble_gap_sec_keys.h" + +extern ser_ble_gap_app_keyset_t m_app_keys_table[]; + +uint32_t ble_gap_evt_auth_status_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + uint32_t conn_index; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 6, packet_len); + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.auth_status)) + + sizeof (ble_gap_evt_adv_report_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + p_event->header.evt_id = BLE_GAP_EVT_AUTH_STATUS; + p_event->header.evt_len = event_len; + + err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.conn_handle)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_auth_status_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.auth_status)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + // keyset is an extension of standard event data - used to synchronize keys at application + err_code = app_ble_gap_sec_context_find(p_event->evt.gap_evt.conn_handle, &conn_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_keyset_t_dec(p_buf, packet_len, &index, &(m_app_keys_table[conn_index].keyset)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = app_ble_gap_sec_context_destroy(p_event->evt.gap_evt.conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return err_code; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_evt_conn_param_update.c b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_conn_param_update.c new file mode 100644 index 0000000..33cacdc --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_conn_param_update.c @@ -0,0 +1,59 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_conn_param_update_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 2, packet_len); + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.conn_param_update)) + + sizeof (ble_gap_evt_conn_param_update_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_CONN_PARAM_UPDATE; + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gap_evt.params.conn_param_update.conn_params.min_conn_interval); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gap_evt.params.conn_param_update.conn_params.max_conn_interval); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gap_evt.params.conn_param_update.conn_params.slave_latency); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gap_evt.params.conn_param_update.conn_params.conn_sup_timeout); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_evt_conn_param_update_request.c b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_conn_param_update_request.c new file mode 100644 index 0000000..7bede0f --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_conn_param_update_request.c @@ -0,0 +1,59 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_conn_param_update_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 2, packet_len); + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.conn_param_update_request)) + + sizeof (ble_gap_evt_conn_param_update_request_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST; + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gap_evt.params.conn_param_update_request.conn_params.min_conn_interval); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gap_evt.params.conn_param_update_request.conn_params.max_conn_interval); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gap_evt.params.conn_param_update_request.conn_params.slave_latency); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gap_evt.params.conn_param_update_request.conn_params.conn_sup_timeout); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_evt_conn_sec_update.c b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_conn_sec_update.c new file mode 100644 index 0000000..6802173 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_conn_sec_update.c @@ -0,0 +1,57 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_conn_sec_update_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 2, packet_len); + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.conn_sec_update)) + + sizeof (ble_gap_evt_conn_sec_update_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_CONN_SEC_UPDATE; + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + + p_event->evt.gap_evt.params.conn_sec_update.conn_sec.sec_mode.sm = p_buf[index] & 0x0F; + p_event->evt.gap_evt.params.conn_sec_update.conn_sec.sec_mode.lv = (p_buf[index] >> 4) & 0x0F; + index++; + + uint8_dec(p_buf, packet_len, + &index, &p_event->evt.gap_evt.params.conn_sec_update.conn_sec.encr_key_size); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_evt_connected.c b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_connected.c new file mode 100644 index 0000000..0dfcd5a --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_connected.c @@ -0,0 +1,53 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_connected_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + uint32_t event_len = sizeof (ble_gap_evt_connected_t) + + sizeof (p_event->evt.gap_evt.conn_handle); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_len = event_len; + + err_code = uint16_t_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_connected_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.connected)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return err_code; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_evt_disconnected.c b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_disconnected.c new file mode 100644 index 0000000..fa29107 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_disconnected.c @@ -0,0 +1,48 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_disconnected_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(3, packet_len); + + uint32_t event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gap_evt_disconnected_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_DISCONNECTED; + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + uint8_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.params.disconnected.reason); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_evt_passkey_display.c b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_passkey_display.c new file mode 100644 index 0000000..7a2f155 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_passkey_display.c @@ -0,0 +1,57 @@ +/* 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 "ble_gap_evt_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + +#define PASSKEY_LEN sizeof (p_event->evt.gap_evt.params.passkey_display.passkey) + + +uint32_t ble_gap_evt_passkey_display_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t event_len; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + PASSKEY_LEN, packet_len); + + event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gap_evt_passkey_display_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_PASSKEY_DISPLAY; + p_event->header.evt_len = event_len; + + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + memcpy(p_event->evt.gap_evt.params.passkey_display.passkey, &p_buf[index], PASSKEY_LEN); + index += PASSKEY_LEN; + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + *p_event_len = event_len; + + return NRF_SUCCESS; +} + diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_evt_rssi_changed.c b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_rssi_changed.c new file mode 100644 index 0000000..b7de4cc --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_rssi_changed.c @@ -0,0 +1,53 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_rssi_changed_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t event_len; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 1, packet_len); + + event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gap_evt_rssi_changed_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_RSSI_CHANGED; + p_event->header.evt_len = event_len; + + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + int8_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.params.rssi_changed.rssi); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + *p_event_len = event_len; + + return NRF_SUCCESS; +} + diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_evt_scan_req_report.c b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_scan_req_report.c new file mode 100644 index 0000000..118fcf2 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_scan_req_report.c @@ -0,0 +1,58 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_scan_req_report_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.scan_req_report)) + + sizeof (ble_gap_evt_scan_req_report_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_SCAN_REQ_REPORT; + p_event->header.evt_len = event_len; + + err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.conn_handle)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_addr_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.scan_req_report.peer_addr)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.scan_req_report.rssi)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return err_code; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_evt_sec_info_request.c b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_sec_info_request.c new file mode 100644 index 0000000..ff3d0af --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_sec_info_request.c @@ -0,0 +1,55 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_sec_info_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 2, packet_len); + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.sec_info_request)) + + sizeof (ble_gap_evt_sec_info_request_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_SEC_INFO_REQUEST; + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + + err_code = ble_gap_evt_sec_info_request_t_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.params.sec_info_request); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_evt_sec_params_request.c b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_sec_params_request.c new file mode 100644 index 0000000..0386291 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_sec_params_request.c @@ -0,0 +1,55 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_evt_sec_params_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t event_len; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(7, packet_len); + + event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gap_evt_sec_params_request_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + p_event->header.evt_id = BLE_GAP_EVT_SEC_PARAMS_REQUEST; + p_event->header.evt_len = event_len; + + err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.conn_handle)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_sec_params_request_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.sec_params_request)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + *p_event_len = event_len; + + return err_code; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_evt_sec_request.c b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_sec_request.c new file mode 100644 index 0000000..f080405 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_sec_request.c @@ -0,0 +1,59 @@ +/* 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 + +#include "ble_gap_evt_app.h" +#include "ble_gap_struct_serialization.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_sec_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(3, packet_len); + + uint32_t event_len = sizeof (ble_gap_evt_sec_request_t) + + sizeof (p_event->evt.gap_evt.conn_handle); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + + ble_gap_evt_sec_request_t * p_decoded_evt = &(p_event->evt.gap_evt.params.sec_request); + + uint32_t err_code = ble_gap_evt_sec_request_t_dec(p_buf, packet_len, &index, p_decoded_evt); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_evt_timeout.c b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_timeout.c new file mode 100644 index 0000000..8fdb83b --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_evt_timeout.c @@ -0,0 +1,52 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_timeout_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t event_len; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_EQ(SER_EVT_CONN_HANDLE_SIZE + 1, packet_len); + + event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gap_evt_timeout_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_TIMEOUT; + p_event->header.evt_len = event_len; + + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + uint8_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.params.timeout.src); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_ppcp_get.c b/components/serialization/application/codecs/s120/serializers/ble_gap_ppcp_get.c new file mode 100644 index 0000000..e3c8b07 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_ppcp_get.c @@ -0,0 +1,68 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" + + +uint32_t ble_gap_ppcp_get_req_enc(ble_gap_conn_params_t const * const p_conn_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_PPCP_GET; + p_buf[index++] = (p_conn_params != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_ppcp_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_conn_params_t * const p_conn_params, + uint32_t * const p_result_code) +{ + uint32_t index = 0; + + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_GAP_PPCP_GET, p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_conn_params); + + SER_ASSERT_LENGTH_LEQ(index + 8, packet_len); + uint16_dec(p_buf, packet_len, &index, &p_conn_params->min_conn_interval); + uint16_dec(p_buf, packet_len, &index, &p_conn_params->max_conn_interval); + uint16_dec(p_buf, packet_len, &index, &p_conn_params->slave_latency); + uint16_dec(p_buf, packet_len, &index, &p_conn_params->conn_sup_timeout); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return decode_result; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_ppcp_set.c b/components/serialization/application/codecs/s120/serializers/ble_gap_ppcp_set.c new file mode 100644 index 0000000..15e5528 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_ppcp_set.c @@ -0,0 +1,54 @@ +/* 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 "ble_gap_app.h" +#include +#include "nrf_error.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_ppcp_set_req_enc(ble_gap_conn_params_t const * const p_conn_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(1 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_PPCP_SET; + p_buf[index++] = (p_conn_params != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_conn_params != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 8, *p_buf_len); + index += uint16_encode(p_conn_params->min_conn_interval, &p_buf[index]); + index += uint16_encode(p_conn_params->max_conn_interval, &p_buf[index]); + index += uint16_encode(p_conn_params->slave_latency, &p_buf[index]); + index += uint16_encode(p_conn_params->conn_sup_timeout, &p_buf[index]); + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_ppcp_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_PPCP_SET, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_rssi_get.c b/components/serialization/application/codecs/s120/serializers/ble_gap_rssi_get.c new file mode 100644 index 0000000..24b4b2c --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_rssi_get.c @@ -0,0 +1,80 @@ +/* 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 "ble_gap_app.h" +#include +#include +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_rssi_get_req_enc(uint16_t conn_handle, + int8_t const * const p_rssi, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + SER_ASSERT_LENGTH_LEQ(index + 1, total_len); + + p_buf[index++] = SD_BLE_GAP_RSSI_GET; + + err_code = uint16_t_enc(&conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_rssi, p_buf, total_len, &index, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gap_rssi_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + int8_t * const p_rssi, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t index = 0; + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, + &index, + packet_len, + SD_BLE_GAP_RSSI_GET, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + decode_result = uint8_t_dec(p_buf, packet_len, &index, (uint8_t *) p_rssi); + SER_ASSERT(decode_result == NRF_SUCCESS, decode_result); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return decode_result; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_rssi_start.c b/components/serialization/application/codecs/s120/serializers/ble_gap_rssi_start.c new file mode 100644 index 0000000..539b8b6 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_rssi_start.c @@ -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. + * + */ + +#include "ble_gap_app.h" +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_rssi_start_req_enc(uint16_t conn_handle, + uint8_t threshold_dbm, + uint8_t skip_count, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GAP_RSSI_START; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&threshold_dbm, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&skip_count, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gap_rssi_start_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_RSSI_START, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_rssi_stop.c b/components/serialization/application/codecs/s120/serializers/ble_gap_rssi_stop.c new file mode 100644 index 0000000..49ef65e --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_rssi_stop.c @@ -0,0 +1,45 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_rssi_stop_req_enc(uint16_t conn_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + uint8_t op_code = SD_BLE_GAP_RSSI_STOP; + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gap_rssi_stop_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_RSSI_STOP, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_scan_start.c b/components/serialization/application/codecs/s120/serializers/ble_gap_scan_start.c new file mode 100644 index 0000000..a92ab3b --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_scan_start.c @@ -0,0 +1,45 @@ +/* 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 "ble_gap_app.h" +#include "cond_field_serialization.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" + +uint32_t ble_gap_scan_start_req_enc(ble_gap_scan_params_t const * p_scan_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GAP_SCAN_START; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + err_code = cond_field_enc(p_scan_params, p_buf, buf_len, &index, ble_gap_scan_params_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gap_scan_start_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_SCAN_START, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_scan_stop.c b/components/serialization/application/codecs/s120/serializers/ble_gap_scan_stop.c new file mode 100644 index 0000000..72e7c4a --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_scan_stop.c @@ -0,0 +1,40 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" + +uint32_t ble_gap_scan_stop_req_enc(uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GAP_SCAN_STOP; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gap_scan_stop_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_SCAN_STOP, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_sec_info_reply.c b/components/serialization/application/codecs/s120/serializers/ble_gap_sec_info_reply.c new file mode 100644 index 0000000..0739b31 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_sec_info_reply.c @@ -0,0 +1,78 @@ +/* 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 "ble_gap_app.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "ble_gap.h" +#include "cond_field_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_sec_info_reply_req_enc(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, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GAP_SEC_INFO_REPLY; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(index + 1, buf_len); + p_buf[index++] = (p_enc_info != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_enc_info != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + BLE_GAP_SEC_KEY_LEN + 1, buf_len); + memcpy(&p_buf[index], p_enc_info->ltk, BLE_GAP_SEC_KEY_LEN); + index += BLE_GAP_SEC_KEY_LEN; + p_buf[index++] = (p_enc_info->auth | (p_enc_info->ltk_len << 1)); + } + + err_code = cond_field_enc(p_id_info, p_buf, buf_len, &index, ble_gap_irk_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(index + 1, buf_len); + p_buf[index++] = (p_sign_info != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_sign_info != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + BLE_GAP_SEC_KEY_LEN, buf_len); + memcpy(&p_buf[index], p_sign_info->csrk, BLE_GAP_SEC_KEY_LEN); + index += BLE_GAP_SEC_KEY_LEN; + } + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gap_sec_info_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_SEC_INFO_REPLY, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_sec_params_reply.c b/components/serialization/application/codecs/s120/serializers/ble_gap_sec_params_reply.c new file mode 100644 index 0000000..d04189d --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_sec_params_reply.c @@ -0,0 +1,87 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_sec_params_reply_req_enc(uint16_t conn_handle, + uint8_t sec_status, + ble_gap_sec_params_t const * const p_sec_params, + ble_gap_sec_keyset_t const * const p_sec_keyset, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GAP_SEC_PARAMS_REPLY; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&sec_status, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_sec_params, p_buf, buf_len, &index, ble_gap_sec_params_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_sec_keyset, p_buf, buf_len, &index, ble_gap_sec_keyset_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gap_sec_params_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_sec_keyset_t const * const p_sec_keyset, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = 0; + + err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, SD_BLE_GAP_SEC_PARAMS_REPLY, p_result_code); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_sec_keyset); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void **)&p_sec_keyset, ble_gap_sec_keyset_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gap_tx_power_set.c b/components/serialization/application/codecs/s120/serializers/ble_gap_tx_power_set.c new file mode 100644 index 0000000..807eb78 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gap_tx_power_set.c @@ -0,0 +1,45 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_tx_power_set_req_enc(int8_t tx_power, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GAP_TX_POWER_SET; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&tx_power, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gap_tx_power_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_TX_POWER_SET, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gattc_app.h b/components/serialization/application/codecs/s120/serializers/ble_gattc_app.h new file mode 100644 index 0000000..5ec92e8 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gattc_app.h @@ -0,0 +1,406 @@ +/* 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. + * + */ +#ifndef BLE_GATTC_APP_H__ +#define BLE_GATTC_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s120_codecs Application s120 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gattc_app GATTC Application command request encoders and command response decoders + * @{ + * @ingroup ser_app_s120_codecs + * + * @brief GATTC Application command request encoders and command response decoders. + */ +#include "ble_gattc.h" +#include "ble.h" + +/**@brief Encodes @ref sd_ble_gattc_primary_services_discover command request. + * + * @sa @ref nrf51_sd_ble_gattc_primary_services_discover_encoding for packet format, + * @ref ble_gattc_primary_services_discover_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] start_handle Handle to start searching from. + * @param[in] p_srvc_uuid Pointer to a @ref ble_uuid_t which indicates the service UUID to + * be found. If it is NULL, all primary services will be returned. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_primary_services_discover_req_enc(uint16_t conn_handle, + uint16_t start_handle, + ble_uuid_t const * const p_srvc_uuid, + uint8_t * const p_buf, + uint32_t * p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gattc_primary_services_discover command. + * + * @sa @ref nrf51_sd_ble_gattc_primary_services_discover_encoding for packet format, + * @ref ble_gattc_primary_services_discover_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gattc_primary_services_discover_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gattc_descriptors_discover command request. + * + * @sa @ref nrf51_sd_ble_gattc_descriptors_discover_encoding for packet format, + * @ref ble_gattc_descriptors_discover_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_handle_range A pointer to the range of handles of the Service to perform + * this procedure on. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_descriptors_discover_req_enc( + uint16_t conn_handle, + ble_gattc_handle_range_t const * const p_handle_range, + uint8_t * const p_buf, + uint32_t * p_buf_len); + + +/**@brief Decodes response to @ref sd_ble_gattc_descriptors_discover command. + * + * @sa @ref nrf51_sd_ble_gattc_descriptors_discover_encoding for packet format, + * @ref ble_gattc_primary_services_discover_rsp_dec for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gattc_descriptors_discover_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gattc_relationships_discover command request. + * + * @sa @ref nrf51_sd_ble_gattc_relationships_discover_encoding for packet format, + * @ref ble_gattc_relationships_discover_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_handle_range A pointer to the range of handles of the Service to perform + * this procedure on. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_relationships_discover_req_enc( + uint16_t conn_handle, + ble_gattc_handle_range_t const * const p_handle_range, + uint8_t * const p_buf, + uint32_t * p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gattc_relationships_discover command. + * + * @sa @ref nrf51_sd_ble_gattc_relationships_discover_encoding for packet format, + * @ref ble_gattc_relationships_discover_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gattc_relationships_discover_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gattc_characteristics_discover command request. + * + * @sa @ref nrf51_sd_ble_gattc_characteristics_discover_encoding for packet format, + * @ref ble_gattc_characteristics_discover_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_handle_range A pointer to the range of handles of the Service to perform + * this procedure on. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_characteristics_discover_req_enc + (uint16_t conn_handle, + ble_gattc_handle_range_t const * const p_handle_range, + uint8_t * const p_buf, + uint32_t * p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gattc_characteristics_discover command. + * + * @sa @ref nrf51_sd_ble_gattc_characteristics_discover_encoding for packet format, + * @ref ble_gattc_primary_services_discover_rsp_dec for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gattc_characteristics_discover_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gattc_read command request. + * + * @sa @ref nrf51_sd_ble_gattc_read_encoding for packet format, + * @ref ble_gattc_read_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] handle The handle of the attribute to be read. + * @param[in] offset Offset into the attribute value to be read. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_read_req_enc(uint16_t conn_handle, + uint16_t handle, + uint16_t offset, + uint8_t * const p_buf, + uint32_t * p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gattc_read command. + * + * @sa @ref nrf51_sd_ble_gattc_read_encoding for packet format, + * @ref ble_gattc_read_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gattc_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gattc_char_values_read command request. + * + * @sa @ref nrf51_sd_ble_gattc_char_values_read for packet format, + * @ref ble_gattc_char_values_read_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @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. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_char_values_read_req_enc(uint16_t conn_handle, + uint16_t const * const p_handles, + uint16_t handle_count, + uint8_t * const p_buf, + uint32_t * p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gattc_char_values_read command. + * + * @sa @ref nrf51_sd_ble_gattc_char_values_read for packet format, + * @ref ble_gattc_char_values_read_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gattc_char_values_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gattc_write command request. + * + * @sa @ref nrf51_sd_ble_gattc_write_encoding for packet format, + * @ref ble_gattc_write_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_write_params Pointer to \ref sd_ble_gattc_write params. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_write_req_enc(uint16_t conn_handle, + ble_gattc_write_params_t const * const p_write_params, + uint8_t * const p_buf, + uint32_t * p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gattc_write command. + * + * @sa @ref nrf51_sd_ble_gattc_write_encoding for packet format, + * @ref ble_gattc_write_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gattc_write_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gattc_hv_confirm command request. + * + * @sa @ref nrf51_sd_ble_gattc_hv_confirm for packet format, + * @ref ble_gattc_hv_confirm_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] handle Handle of the attribute in the indication. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_hv_confirm_req_enc(uint16_t conn_handle, + uint16_t handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gattc_hv_confirm command. + * + * @sa @ref nrf51_sd_ble_gattc_hv_confirm for packet format, + * @ref ble_gattc_hv_confirm_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Pointer to command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gattc_hv_confirm_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gattc_char_value_by_uuid_read command request. + * + * @sa @ref nrf51_sd_ble_gattc_char_value_by_uuid_read_encoding for packet format, + * @ref ble_gattc_char_value_by_uuid_read_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_uuid Pointer to a characteristic value UUID to read. + * @param[in] p_handle_range Pointer to the range of handles to perform this procedure on. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_char_value_by_uuid_read_req_enc + (uint16_t conn_handle, + ble_uuid_t const * const p_uuid, + ble_gattc_handle_range_t const * const p_handle_range, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gattc_char_value_by_uuid_read command. + * + * @sa @ref nrf51_sd_ble_gattc_char_value_by_uuid_read_encoding for packet format, + * @ref ble_gattc_char_value_by_uuid_read_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Pointer to command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gattc_char_value_by_uuid_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); +/** @} */ +#endif + + diff --git a/components/serialization/application/codecs/s120/serializers/ble_gattc_char_value_by_uuid_read.c b/components/serialization/application/codecs/s120/serializers/ble_gattc_char_value_by_uuid_read.c new file mode 100644 index 0000000..7b75815 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gattc_char_value_by_uuid_read.c @@ -0,0 +1,61 @@ +/* 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 "ble_gattc_app.h" +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "ble_gattc_struct_serialization.h" +#include "cond_field_serialization.h" +#include "ble_types.h" +#include + +uint32_t ble_gattc_char_value_by_uuid_read_req_enc + (uint16_t conn_handle, + ble_uuid_t const * const p_uuid, + ble_gattc_handle_range_t const * const p_handle_range, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t err_code; + uint32_t index = 0; + uint32_t buf_len = *p_buf_len; + uint8_t opcode = SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ; + + err_code = uint8_t_enc(&opcode, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_uuid, p_buf, buf_len, &index, ble_uuid_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_handle_range, p_buf, buf_len, &index, ble_gattc_handle_range_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gattc_char_value_by_uuid_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, + packet_len, + SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, + p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gattc_char_values_read.c b/components/serialization/application/codecs/s120/serializers/ble_gattc_char_values_read.c new file mode 100644 index 0000000..6dc1e17 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gattc_char_values_read.c @@ -0,0 +1,48 @@ +/* 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 "ble_gattc_app.h" +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gattc_char_values_read_req_enc(uint16_t conn_handle, + uint16_t const * const p_handles, + uint16_t handle_count, + uint8_t * const p_buf, + uint32_t * p_buf_len) +{ + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t buf_len = *p_buf_len; + uint32_t err_code; + uint8_t opCode = SD_BLE_GATTC_CHAR_VALUES_READ; + + err_code = uint8_t_enc(&opCode, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + err_code = count16_cond_data16_enc(p_handles, handle_count, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + *p_buf_len = index; + return err_code; +} + + +uint32_t ble_gattc_char_values_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_CHAR_VALUES_READ, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gattc_characteristics_discover.c b/components/serialization/application/codecs/s120/serializers/ble_gattc_characteristics_discover.c new file mode 100644 index 0000000..b98d142 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gattc_characteristics_discover.c @@ -0,0 +1,57 @@ +/* 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 "ble_gattc_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_characteristics_discover_req_enc( + uint16_t conn_handle, + ble_gattc_handle_range_t const * const p_handle_range, + uint8_t * const p_buf, + uint32_t * p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 2, *p_buf_len); + + p_buf[index++] = SD_BLE_GATTC_CHARACTERISTICS_DISCOVER; + index += uint16_encode(conn_handle, &p_buf[index]); + + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + p_buf[index++] = (p_handle_range != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_handle_range != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 2 + 2, *p_buf_len); + + index += uint16_encode(p_handle_range->start_handle, &p_buf[index]); + index += uint16_encode(p_handle_range->end_handle, &p_buf[index]); + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_characteristics_discover_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_CHARACTERISTICS_DISCOVER, + p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gattc_descriptors_discover.c b/components/serialization/application/codecs/s120/serializers/ble_gattc_descriptors_discover.c new file mode 100644 index 0000000..28e1a21 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gattc_descriptors_discover.c @@ -0,0 +1,53 @@ +/* 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 "ble_gattc_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_descriptors_discover_req_enc( + uint16_t conn_handle, + ble_gattc_handle_range_t const * const p_handle_range, + uint8_t * const p_buf, + uint32_t * p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 2 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GATTC_DESCRIPTORS_DISCOVER; + index += uint16_encode(conn_handle, &p_buf[index]); + p_buf[index++] = (p_handle_range == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + if (p_handle_range != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 2 + 2, *p_buf_len); + index += uint16_encode(p_handle_range->start_handle, &p_buf[index]); + index += uint16_encode(p_handle_range->end_handle, &p_buf[index]); + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_descriptors_discover_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_DESCRIPTORS_DISCOVER, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_app.h b/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_app.h new file mode 100644 index 0000000..f8ed84b --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_app.h @@ -0,0 +1,286 @@ +/* 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 BLE_GATTC_EVT_APP_H__ +#define BLE_GATTC_EVT_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s120_codecs Application s120 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gattc_evt_app GATTC Application event decoders + * @{ + * @ingroup ser_app_s120_codecs + * + * @brief GATTC Application event decoders. + */ +#include "ble.h" + +/** + * @brief Decodes ble_gattc_evt_char_disc_rsp event. + * + * @sa @ref nrf51_gattc_evt_char_disc_rsp_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_char_disc_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gattc_evt_char_val_by_uuid_read_rsp event. + * + * @sa @ref nrf51_gattc_evt_char_val_by_uuid_read_rsp_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gattc_evt_char_vals_read_rsp event. + * + * @sa @ref nrf51_gattc_evt_char_vals_read_rsp_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_char_vals_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gattc_evt_desc_disc_rsp event. + * + * @sa @ref nrf51_gattc_evt_desc_disc_rsp_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_desc_disc_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gattc_evt_hvx event. + * + * @sa @ref nrf51_gattc_evt_hvx_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_hvx_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gattc_evt_prim_srvc_disc_rsp event. + * + * @sa @ref nrf51_gattc_evt_prim_srvc_disc_rsp_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_prim_srvc_disc_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gattc_evt_read_rsp event. + * + * @sa @ref nrf51_gattc_evt_read_rsp_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gattc_evt_rel_disc_rsp_dec event. + * + * @sa @ref nrf51_gattc_evt_rel_disc_rsp_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_rel_disc_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gattc_evt_timeout event. + * + * @sa @ref nrf51_gattc_evt_timeout_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_timeout_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gattc_evt_write_rsp event. + * + * @sa @ref nrf51_gattc_evt_write_rsp_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_write_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** @} */ +#endif diff --git a/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_char_disc_rsp.c b/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_char_disc_rsp.c new file mode 100644 index 0000000..cdc6532 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_char_disc_rsp.c @@ -0,0 +1,103 @@ +/* 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 "ble_gattc_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" +#include "nordic_common.h" + + +uint32_t ble_gattc_evt_char_disc_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(2 + 2 + 2 + 2, packet_len); + + uint16_t tmp_conn_handle; + uint16_t tmp_gatt_status; + uint16_t tmp_error_handle; + uint16_t tmp_service_count; + uint16_dec(p_buf, packet_len, &index, &tmp_conn_handle); + uint16_dec(p_buf, packet_len, &index, &tmp_gatt_status); + uint16_dec(p_buf, packet_len, &index, &tmp_error_handle); + uint16_dec(p_buf, packet_len, &index, &tmp_service_count); + + + uint32_t event_len = offsetof(ble_evt_t, evt.gattc_evt.params.char_disc_rsp) + + sizeof (uint16_t) + tmp_service_count * sizeof (ble_gattc_char_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTC_EVT_CHAR_DISC_RSP; + p_event->header.evt_len = event_len; + p_event->evt.gattc_evt.conn_handle = tmp_conn_handle; + p_event->evt.gattc_evt.gatt_status = tmp_gatt_status; + p_event->evt.gattc_evt.error_handle = tmp_error_handle; + p_event->evt.gattc_evt.params.char_disc_rsp.count = tmp_service_count; + + SER_ASSERT_LENGTH_LEQ(index + (tmp_service_count * 9), packet_len); + + for (uint16_t i = 0; i < tmp_service_count; i++) + { + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].uuid.uuid); + uint8_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].uuid.type); + + uint8_t characteristic_props; + uint8_dec(p_buf, packet_len, &index, &characteristic_props); + + p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.broadcast = + !!(characteristic_props & BIT_0); + p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.read = + !!(characteristic_props & BIT_1); + p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.write_wo_resp = + !!(characteristic_props & BIT_2); + p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.write = + !!(characteristic_props & BIT_3); + p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.notify = + !!(characteristic_props & BIT_4); + p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.indicate = + !!(characteristic_props & BIT_5); + p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.auth_signed_wr = + !!(characteristic_props & BIT_6); + + uint8_t characteristic_ext_props; + uint8_dec(p_buf, packet_len, &index, &characteristic_ext_props); + + p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_ext_props = + characteristic_ext_props & BIT_0; + + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].handle_decl); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].handle_value); + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c b/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c new file mode 100644 index 0000000..93d89dc --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c @@ -0,0 +1,78 @@ +/* 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_util.h" +#include "ble.h" +#include "ble_serialization.h" +#include "ble_gattc_struct_serialization.h" +#include "ble_gattc_evt_app.h" + + +uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + uint32_t index = 0; + uint32_t err_code; + uint16_t conn_handle; + uint16_t gatt_status; + uint16_t error_handle; + + SER_ASSERT_LENGTH_LEQ(6, packet_len - index); + + uint32_t in_event_len = *p_event_len; + + *p_event_len = (offsetof(ble_evt_t, evt.gattc_evt.params)) - sizeof (ble_evt_hdr_t); + + uint16_dec(p_buf, packet_len, &index, &conn_handle); + uint16_dec(p_buf, packet_len, &index, &gatt_status); + uint16_dec(p_buf, packet_len, &index, &error_handle); + + void * p_data = NULL; + + if (p_event) + { + SER_ASSERT_LENGTH_LEQ(*p_event_len, in_event_len); + + p_event->header.evt_id = BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP; + p_event->evt.gattc_evt.conn_handle = conn_handle; + p_event->evt.gattc_evt.gatt_status = gatt_status; + p_event->evt.gattc_evt.error_handle = error_handle; + + p_data = &p_event->evt.gattc_evt.params.char_val_by_uuid_read_rsp; + } + else + { + p_data = NULL; + } + + //call struct decoder with remaining size of event struct + uint32_t temp_event_len = in_event_len - *p_event_len; + err_code = ble_gattc_evt_char_val_by_uuid_read_rsp_t_dec(p_buf, packet_len, &index, + &temp_event_len, p_data); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + //update event length with the amount processed by struct decoder + *p_event_len += temp_event_len; + + if (p_event) + { + p_event->header.evt_len = *p_event_len; + } + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_char_vals_read_rsp.c b/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_char_vals_read_rsp.c new file mode 100644 index 0000000..4e99a17 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_char_vals_read_rsp.c @@ -0,0 +1,66 @@ +/* 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 "ble_gattc_evt_app.h" +#include "ble_gattc_struct_serialization.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + +#define BLE_GATTC_EVT_CHAR_VALS_READ_RSP_LEN_POSITION 6 + + +uint32_t ble_gattc_evt_char_vals_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t event_len = 0; + + uint32_t error_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(10, packet_len); + + event_len = (uint16_t) (offsetof(ble_evt_t, evt.gattc_evt.params.char_vals_read_rsp.values)) - + sizeof (ble_evt_hdr_t) + + uint16_decode(&p_buf[BLE_GATTC_EVT_CHAR_VALS_READ_RSP_LEN_POSITION]); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + else + { + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + *p_event_len = event_len; + } + + p_event->header.evt_id = BLE_GATTC_EVT_CHAR_VALS_READ_RSP; + + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.conn_handle)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.gatt_status)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.error_handle)); + + //Event structure for BLE_GATTC_EVT_CHAR_VALS_READ_RSP + error_code = + ble_gattc_evt_char_vals_read_rsp_t_dec(p_buf, packet_len, &index, + &(p_event->evt.gattc_evt.params.char_vals_read_rsp)); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return error_code; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_desc_disc_rsp.c b/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_desc_disc_rsp.c new file mode 100644 index 0000000..6e44502 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_desc_disc_rsp.c @@ -0,0 +1,95 @@ +/* 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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_gattc_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_desc_disc_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 6, packet_len); + + uint16_t tmp_conn_handle; + uint16_t tmp_gatt_status; + uint16_t tmp_error_handle; + uint16_t tmp_service_count; + uint16_dec(p_buf, packet_len, &index, &tmp_conn_handle); + uint16_dec(p_buf, packet_len, &index, &tmp_gatt_status); + uint16_dec(p_buf, packet_len, &index, &tmp_error_handle); + uint16_dec(p_buf, packet_len, &index, &tmp_service_count); + + uint32_t event_len = offsetof(ble_evt_t, evt.gattc_evt.params.desc_disc_rsp) + + sizeof (uint16_t) + tmp_service_count * sizeof (ble_gattc_desc_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTC_EVT_DESC_DISC_RSP; + p_event->header.evt_len = event_len; + p_event->evt.gattc_evt.conn_handle = tmp_conn_handle; + p_event->evt.gattc_evt.gatt_status = tmp_gatt_status; + p_event->evt.gattc_evt.error_handle = tmp_error_handle; + p_event->evt.gattc_evt.params.desc_disc_rsp.count = tmp_service_count; + + SER_ASSERT_LENGTH_LEQ(index + (tmp_service_count * 5), packet_len); + + for (uint16_t i = 0; i < tmp_service_count; i++) + { + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.desc_disc_rsp.descs[i].handle); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.desc_disc_rsp.descs[i].uuid.uuid); + uint8_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.desc_disc_rsp.descs[i].uuid.type); + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_hvx.c b/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_hvx.c new file mode 100644 index 0000000..f20f499 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_hvx.c @@ -0,0 +1,66 @@ +/* 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 "ble_gattc_evt_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_hvx_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint16_t tmp_attr_len; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(11, packet_len); + + tmp_attr_len = uint16_decode(&(p_buf[9])); + + uint32_t event_len = offsetof(ble_evt_t, evt.gattc_evt.params.hvx) + + sizeof (ble_gattc_evt_hvx_t) - 1 + tmp_attr_len; + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTC_EVT_HVX; + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.conn_handle)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.gatt_status)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.error_handle)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.hvx.handle)); + uint8_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.hvx.type)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.hvx.len)); + + SER_ASSERT_LENGTH_LEQ(index + tmp_attr_len, packet_len); + + if (tmp_attr_len > 0) + { + memcpy(&(p_event->evt.gattc_evt.params.hvx.data[0]), &(p_buf[index]), tmp_attr_len); + index += tmp_attr_len; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c b/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c new file mode 100644 index 0000000..85d43c0 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c @@ -0,0 +1,78 @@ +/* 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 "ble_gattc_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_prim_srvc_disc_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 6, packet_len); + + uint16_t tmp_conn_handle; + uint16_t tmp_gatt_status; + uint16_t tmp_error_handle; + uint16_t tmp_service_count; + uint16_dec(p_buf, packet_len, &index, &tmp_conn_handle); + uint16_dec(p_buf, packet_len, &index, &tmp_gatt_status); + uint16_dec(p_buf, packet_len, &index, &tmp_error_handle); + uint16_dec(p_buf, packet_len, &index, &tmp_service_count); + + uint32_t event_len = offsetof(ble_evt_t, evt.gattc_evt.params.prim_srvc_disc_rsp) + + sizeof (uint16_t) + tmp_service_count * sizeof (ble_gattc_service_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP; + p_event->header.evt_len = event_len; + p_event->evt.gattc_evt.conn_handle = tmp_conn_handle; + p_event->evt.gattc_evt.gatt_status = tmp_gatt_status; + p_event->evt.gattc_evt.error_handle = tmp_error_handle; + p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.count = tmp_service_count; + + SER_ASSERT_LENGTH_LEQ(index + (tmp_service_count * 7), packet_len); + + for (uint16_t i = 0; i < tmp_service_count; i++) + { + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].uuid.uuid); + uint8_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].uuid.type); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].handle_range. + start_handle); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].handle_range. + end_handle); + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_read_rsp.c b/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_read_rsp.c new file mode 100644 index 0000000..a851447 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_read_rsp.c @@ -0,0 +1,66 @@ +/* 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 "ble_gattc_evt_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint16_t tmp_attr_len; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(12, packet_len); + + tmp_attr_len = uint16_decode(&(p_buf[10])); + + uint32_t event_len = offsetof(ble_evt_t, evt.gattc_evt.params.read_rsp) + + sizeof (ble_gattc_evt_read_rsp_t) - 1 + tmp_attr_len; + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTC_EVT_READ_RSP; + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.conn_handle)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.gatt_status)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.error_handle)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.read_rsp.handle)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.read_rsp.offset)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.read_rsp.len)); + + SER_ASSERT_LENGTH_LEQ(index + tmp_attr_len, packet_len); + + if (tmp_attr_len > 0) + { + memcpy(&(p_event->evt.gattc_evt.params.read_rsp.data[0]), &(p_buf[index]), tmp_attr_len); + index += tmp_attr_len; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_rel_disc_rsp.c b/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_rel_disc_rsp.c new file mode 100644 index 0000000..7f0bd9f --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_rel_disc_rsp.c @@ -0,0 +1,65 @@ +/* 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 "ble_gattc_evt_app.h" +#include "ble_gattc_struct_serialization.h" +#include "ble_serialization.h" +#include "app_util.h" + +#define BLE_GATTC_EVT_REL_DISC_RSP_COUNT_POSITION 6 + + +uint32_t ble_gattc_evt_rel_disc_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t event_len = 0; + uint16_t include_count = 0; + + uint32_t error_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(8, packet_len); + + include_count = uint16_decode(&p_buf[BLE_GATTC_EVT_REL_DISC_RSP_COUNT_POSITION]); + event_len = (uint16_t) (offsetof(ble_evt_t, evt.gattc_evt.params.rel_disc_rsp.includes)) - + sizeof (ble_evt_hdr_t) + (include_count * sizeof (ble_gattc_include_t)); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTC_EVT_REL_DISC_RSP; + error_code = + uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.conn_handle)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.gatt_status)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.error_handle)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = + ble_gattc_evt_rel_disc_rsp_t_dec(p_buf, packet_len, &index, + &(p_event->evt.gattc_evt.params.rel_disc_rsp)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return error_code; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_timeout.c b/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_timeout.c new file mode 100644 index 0000000..8f831d3 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_timeout.c @@ -0,0 +1,75 @@ +/* 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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_gattc_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_timeout_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t event_len; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 1, packet_len); + + event_len = offsetof(ble_evt_t, evt.gattc_evt.params.timeout) + + sizeof (ble_gattc_evt_timeout_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTC_EVT_TIMEOUT; + p_event->header.evt_len = event_len; + + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gattc_evt.conn_handle); + uint8_dec(p_buf, packet_len, &index, &p_event->evt.gattc_evt.params.timeout.src); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_write_rsp.c b/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_write_rsp.c new file mode 100644 index 0000000..bfed5e2 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gattc_evt_write_rsp.c @@ -0,0 +1,66 @@ +/* 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 "ble_gattc_evt_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_write_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(13, packet_len); + + uint16_t tmp_attr_len = uint16_decode(&(p_buf[11])); + + uint32_t event_len = offsetof(ble_evt_t, evt.gattc_evt.params.write_rsp) + + sizeof (ble_gattc_evt_write_rsp_t) - 1 + tmp_attr_len; + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTC_EVT_WRITE_RSP; + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.conn_handle)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.gatt_status)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.error_handle)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.write_rsp.handle)); + uint8_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.write_rsp.write_op)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.write_rsp.offset)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.write_rsp.len)); + + SER_ASSERT_LENGTH_LEQ(index + tmp_attr_len, packet_len); + + if (tmp_attr_len > 0) + { + memcpy(&(p_event->evt.gattc_evt.params.write_rsp.data[0]), &(p_buf[index]), tmp_attr_len); + index += tmp_attr_len; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gattc_hv_confirm.c b/components/serialization/application/codecs/s120/serializers/ble_gattc_hv_confirm.c new file mode 100644 index 0000000..f745640 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gattc_hv_confirm.c @@ -0,0 +1,49 @@ +/* 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 "ble_gattc_app.h" +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gattc_hv_confirm_req_enc(uint16_t conn_handle, + uint16_t handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GATTC_HV_CONFIRM; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return NRF_SUCCESS; +} + +uint32_t ble_gattc_hv_confirm_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_HV_CONFIRM, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gattc_primary_services_discover.c b/components/serialization/application/codecs/s120/serializers/ble_gattc_primary_services_discover.c new file mode 100644 index 0000000..762508b --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gattc_primary_services_discover.c @@ -0,0 +1,59 @@ +/* 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 "ble_gattc_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_primary_services_discover_req_enc(uint16_t conn_handle, + uint16_t start_handle, + ble_uuid_t const * const p_srvc_uuid, + uint8_t * const p_buf, + uint32_t * p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 5, *p_buf_len); + + p_buf[index++] = SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER; + index += uint16_encode(conn_handle, &p_buf[index]); + index += uint16_encode(start_handle, &p_buf[index]); + + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + + p_buf[index++] = (p_srvc_uuid != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_srvc_uuid != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len); + + index += uint16_encode(p_srvc_uuid->uuid, &p_buf[index]); + p_buf[index++] = p_srvc_uuid->type; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_primary_services_discover_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER, + p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gattc_read.c b/components/serialization/application/codecs/s120/serializers/ble_gattc_read.c new file mode 100644 index 0000000..1d4b5ec --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gattc_read.c @@ -0,0 +1,47 @@ +/* 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 "ble_gattc_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_read_req_enc(uint16_t conn_handle, + uint16_t handle, + uint16_t offset, + uint8_t * const p_buf, + uint32_t * p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 7, *p_buf_len); + + p_buf[index++] = SD_BLE_GATTC_READ; + index += uint16_encode(conn_handle, &p_buf[index]); + index += uint16_encode(handle, &p_buf[index]); + index += uint16_encode(offset, &p_buf[index]); + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_READ, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gattc_relationships_discover.c b/components/serialization/application/codecs/s120/serializers/ble_gattc_relationships_discover.c new file mode 100644 index 0000000..943457e --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gattc_relationships_discover.c @@ -0,0 +1,57 @@ +/* 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 "ble_gattc_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_relationships_discover_req_enc( + uint16_t conn_handle, + ble_gattc_handle_range_t const * const p_handle_range, + uint8_t * const p_buf, + uint32_t * p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len); + + p_buf[index++] = SD_BLE_GATTC_RELATIONSHIPS_DISCOVER; + index += uint16_encode(conn_handle, &p_buf[index]); + + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + p_buf[index++] = (p_handle_range != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_handle_range != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 4, *p_buf_len); + + index += uint16_encode(p_handle_range->start_handle, &p_buf[index]); + index += uint16_encode(p_handle_range->end_handle, &p_buf[index]); + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_relationships_discover_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, + p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gattc_write.c b/components/serialization/application/codecs/s120/serializers/ble_gattc_write.c new file mode 100644 index 0000000..edfe93a --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gattc_write.c @@ -0,0 +1,68 @@ +/* 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 "ble_gattc_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gattc_write_req_enc(uint16_t conn_handle, + ble_gattc_write_params_t const * const p_write_params, + uint8_t * const p_buf, + uint32_t * p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 4, *p_buf_len); + + p_buf[index++] = SD_BLE_GATTC_WRITE; + index += uint16_encode(conn_handle, &p_buf[index]); + p_buf[index++] = (p_write_params == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + if (p_write_params != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 9, *p_buf_len); + p_buf[index++] = p_write_params->write_op; + p_buf[index++] = p_write_params->flags; + index += uint16_encode(p_write_params->handle, &p_buf[index]); + index += uint16_encode(p_write_params->offset, &p_buf[index]); + index += uint16_encode(p_write_params->len, &p_buf[index]); + + SER_ERROR_CHECK(p_write_params->len <= BLE_GATTC_WRITE_P_VALUE_LEN_MAX, + NRF_ERROR_INVALID_PARAM); + + p_buf[index++] = (p_write_params->p_value == NULL) ? + SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + if (p_write_params->p_value != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + p_write_params->len, *p_buf_len); + memcpy(&p_buf[index], p_write_params->p_value, p_write_params->len); + index += p_write_params->len; + } + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_write_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_WRITE, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gatts_app.h b/components/serialization/application/codecs/s120/serializers/ble_gatts_app.h new file mode 100644 index 0000000..7b837b1 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gatts_app.h @@ -0,0 +1,554 @@ +/* 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. + * + */ +#ifndef BLE_GATTS_APP_H__ +#define BLE_GATTS_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s120_codecs Application s120 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gatts_app GATTS Application command request encoders and command response decoders + * @{ + * @ingroup ser_app_s120_codecs + * + * @brief GATTS Application command request encoders and command response decoders. + */ +#include "ble_gatts.h" +#include "ble.h" + +/**@brief Encodes @ref sd_ble_gatts_value_get command request. + * + * @sa @ref nrf51_gatts_value_get_encoding for packet format, + * @ref ble_gatts_value_get_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle. + * @param[in] handle Attribute handle. + * @param[in] p_value Pointer to attribute value information. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_data_len and \p p_data will not be updated by the command + * request encoder. Updated values are set by @ref ble_gatts_value_get_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_value_get_req_enc(uint16_t conn_handle, + uint16_t handle, + ble_gatts_value_t const * const p_value, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_value_get command. + * + * @sa @ref nrf51_gatts_value_get_encoding for packet format, + * @ref ble_gatts_value_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_value Pointer to structure where the attribute value will be stored. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Length of \p p_value is too small to hold decoded + * value from response. + */ +uint32_t ble_gatts_value_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gatts_value_t * const p_value, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gatts_hvx command request. + * + * @sa @ref nrf51_gatts_hvx_encoding for packet format, + * @ref ble_gatts_hvx_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle. + * @param[in] p_hvx_params Pointer to an HVx parameters structure to be encoded. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_hvx_params will not be updated by the command + * request encoder. Updated values are set by @ref ble_gatts_hvx_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_hvx_req_enc(uint16_t conn_handle, + ble_gatts_hvx_params_t const * const p_hvx_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_hvx command. + * + * @sa @ref nrf51_gatts_hvx_encoding for packet format, + * @ref ble_gatts_hvx_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * @param[out] pp_bytes_written Pointer to pointer to location where number of bytes is written. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_hvx_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code, + uint16_t * * const pp_bytes_written); + +/**@brief Encodes @ref sd_ble_gatts_characteristic_add command request. + * + * @sa @ref nrf51_characteristics_add_encoding for packet format, + * @ref ble_gatts_characteristic_add_rsp_dec for command response decoder. + * + * @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 Pointer to a @ref ble_gatts_char_md_t structure, characteristic + * metadata. + * @param[in] p_attr_char_value Pointer to a @ref ble_gatts_attr_t structure, corresponding to + * the characteristic value. + * @param[in] p_handles Pointer to a @ref ble_gatts_char_handles_t structure, where the + * assigned handles will be stored. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_handles will not be updated by the command + * request encoder. Updated values are set by @ref ble_gatts_characteristic_add_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_characteristic_add_req_enc + (uint16_t service_handle, + ble_gatts_char_md_t const * const p_char_md, + ble_gatts_attr_t const * const p_attr_char_value, + ble_gatts_char_handles_t const * const p_handles, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_characteristic_add command. + * + * @sa @ref nrf51_characteristics_add_encoding for packet format, + * @ref ble_gatts_characteristic_add_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_handles Pointer to pointer to location where handles should be decoded. + * @param[out] p_result_code Pointer to command result code decode location. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_characteristic_add_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * * const pp_handles, + uint32_t * const p_result_code); + + +/**@brief Encodes @ref sd_ble_gatts_service_add command request. + * + * @sa @ref nrf51_gatts_service_add_encoding for packet format, + * @ref ble_gatts_service_add_rsp_dec for command response decoder. + * + * @param[in] type Toggles between primary and secondary services, + * see @ref BLE_GATTS_SRVC_TYPES. + * @param[in] p_uuid Pointer to service UUID. + * @param[in] p_conn_handle Pointer to a 16-bit word where the assigned handle will be stored. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_conn_handle will not be updated by the command + * request encoder. Updated values are set by @ref ble_gatts_service_add_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_service_add_req_enc(uint8_t type, + ble_uuid_t const * const p_uuid, + uint16_t const * const p_conn_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_service_add command. + * + * @sa @ref nrf51_gatts_service_add_encoding for packet format, + * @ref ble_gatts_service_add_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Connection handle. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_service_add_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gatts_sys_attr_set command request. + * + * @sa @ref nrf51_gatts_sys_attr_set_encoding for packet format, + * @ref ble_gatts_sys_attr_set_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle. + * @param[in] p_sys_attr_data Pointer to a buffer (at least \p sys_attr_data_len bytes long) + * containing the attribute value to write. + * @param[in] sys_attr_data_len Length (in bytes) of \p p_sys_attr_data. + * @param[in] flags Optional additional flags. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_sys_attr_set_req_enc(uint16_t conn_handle, + uint8_t const * const p_sys_attr_data, + uint16_t sys_attr_data_len, + uint32_t flags, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_sys_attr_set command. + * + * @sa @ref nrf51_gatts_sys_attr_set_encoding for packet format, + * @ref ble_gatts_sys_attr_set_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_sys_attr_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gatts_value_set command request. + * + * @sa @ref nrf51_gatts_value_set_encoding for packet format, + * @ref ble_gatts_value_set_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle. + * @param[in] handle Attribute handle. + * @param[in] p_value Pointer to attribute value information. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_value_set_req_enc(uint16_t conn_handle, + uint16_t handle, + ble_gatts_value_t * p_value, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_value_set command. + * + * @sa @ref nrf51_gatts_value_set_encoding for packet format, + * @ref ble_gatts_value_set_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_value Pointer to attribute value information.. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_value_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gatts_value_t * const p_value, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gatts_sys_attr_get command request. + * + * @sa @ref nrf51_gatts_sys_attr_get_encoding for packet format, + * @ref ble_gatts_sys_attr_get_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_sys_attr_data Pointer to buffer where updated information about system + * attributes will be stored. Can be NULL to calculate required + * size. + * @param[in] p_sys_attr_data_len Size of p_sys_attr_data buffer if \p p_sys_attr_data is + * not NULL. + * @param[in] flags Additional optional flags. + * @param[in,out] p_buf Pointer to buffer where encoded data command will + * be returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_sys_attr_data and \p p_sys_attr_data_len will not be updated by the command + * request encoder. Updated values are set by @ref ble_gatts_sys_attr_get_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_sys_attr_get_req_enc(uint16_t conn_handle, + uint8_t const * const p_sys_attr_data, + uint16_t const * const p_sys_attr_data_len, + uint32_t flags, + uint8_t * const p_buf, + uint32_t * p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_sys_attr_get command. + * + * @sa @ref nrf51_gatts_sys_attr_get_encoding for packet format, + * @ref ble_gatts_sys_attr_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_sys_attr_data Pointer to a buffer where updated information about system + * attributes will be stored. + * @param[in,out] p_sys_attr_data_len \c in: Size (in bytes) of \p p_sys_attr_data buffer. + * \c out: Length of decoded contents of \p p_sys_attr_data. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Length of \p p_sys_attr_data is too small to hold decoded + * value from response. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_sys_attr_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * const p_sys_attr_data, + uint16_t * const p_sys_attr_data_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gatts_descriptor_add command request. + * + * @sa @ref nrf51_descriptor_add_encoding for packet format, + * @ref ble_gatts_descriptor_add_rsp_dec for command response decoder. + * + * @param[in] char_handle Handle of the characteristic where the description is to be placed. + * If @ref BLE_GATT_HANDLE_INVALID is used, it will be placed + * sequentially. + * @param[in] p_attr Pointer to a @ref ble_gatts_attr_t structure, characteristic + * metadata. + * @param[in] p_handle Pointer to a @ref ble_gatts_char_handles_t structure, where the + * assigned handles will be stored. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_descriptor_add_req_enc(uint16_t char_handle, + ble_gatts_attr_t const * const p_attr, + uint16_t * const p_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_descriptor_add command. + * + * @sa @ref nrf51_descriptor_add_encoding for packet format, + * @ref ble_gatts_descriptor_add_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_handle Pointer to bufer where descriptor handle will be + returned. + * @param[out] p_result_code Pointer to command result code decode location. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_descriptor_add_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_handle, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gatts_include_add command request. + * + * @sa @ref nrf51_gatts_include_add_encoding for packet format, + * @ref ble_gatts_include_add_rsp_dec for command response decoder. + * + * @param[in] service_handle Handle of the service where the included service is to be placed. + * @param[in] inc_srvc_handle Handle of the included service + * @param[in] p_include_handle Pointer to Pointer to a 16-bit word where the assigned handle will be stored. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_include_add_req_enc(uint16_t service_handle, + uint16_t inc_srvc_handle, + uint16_t * const p_include_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_include_add command. + * + * @sa @ref nrf51_gatts_include_add_encoding for packet format, + * @ref ble_gatts_include_add_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_include_handle Pointer to a 16-bit word where the assigned handle will be stored. + * @param[out] p_result_code Pointer to command result code decode location. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_include_add_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_include_handle, + uint32_t * const p_result_code); + + +/**@brief Encodes @ref sd_ble_gatts_rw_authorize_reply command request. + * + * @sa @ref nrf51_gatts_rw_authorize_reply_encoding for packet format, + * @ref ble_gatts_rw_authorize_reply_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle. + * @param[in] p_reply_params Pointer to \ref ble_gatts_rw_authorize_reply_params_t + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Encoding failure. Invalid param provided in p_reply_params. + */ +uint32_t ble_gatts_rw_authorize_reply_req_enc( + uint16_t conn_handle, + ble_gatts_rw_authorize_reply_params_t const * const + p_reply_params, + uint8_t * const + p_buf, + uint32_t * const + p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_rw_authorize_reply command. + * + * @sa @ref nrf51_gatts_rw_authorize_reply_encoding for packet format, + * @ref ble_gatts_rw_authorize_reply_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_rw_authorize_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gatts_service_changed command request. + * + * @sa @ref nrf51_service_changed_encoding for packet format, + * @ref ble_gatts_service_changed_rsp_dec for command response decoder. + * + * @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. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Encoding failure. Invalid param provided in p_reply_params. + */ +uint32_t ble_gatts_service_changed_req_enc(uint16_t conn_handle, + uint16_t start_handle, + uint16_t end_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_service_changed command. + * + * @sa @ref nrf51_service_changed_encoding for packet format, + * @ref ble_gatts_service_changed_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_service_changed_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/** @} */ +#endif //BLE_GATTS_APP_H__ + + diff --git a/components/serialization/application/codecs/s120/serializers/ble_gatts_characteristic_add.c b/components/serialization/application/codecs/s120/serializers/ble_gatts_characteristic_add.c new file mode 100644 index 0000000..75e164d --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gatts_characteristic_add.c @@ -0,0 +1,89 @@ +/* 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 "ble_gatts_app.h" +#include +#include "ble_serialization.h" +#include "ble_gatts.h" +#include "app_util.h" +#include "cond_field_serialization.h" +#include "ble_gatts_struct_serialization.h" + +uint32_t ble_gatts_characteristic_add_req_enc( + uint16_t service_handle, + ble_gatts_char_md_t const * const p_char_md, + ble_gatts_attr_t const * const p_attr_char_value, + ble_gatts_char_handles_t const * const p_handles, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + uint8_t opcode = SD_BLE_GATTS_CHARACTERISTIC_ADD; + uint32_t buf_len = *p_buf_len; + + err_code = uint8_t_enc(&opcode, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&service_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_char_md, p_buf, buf_len, &index, ble_gatts_char_md_enc); + SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_attr_char_value, p_buf, buf_len, &index, ble_gatts_attr_enc); + SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_handles, p_buf, buf_len, &index, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gatts_characteristic_add_rsp_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * * const pp_handles, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t index = 0; + + uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, buf_len, + SD_BLE_GATTS_CHARACTERISTIC_ADD, + p_result_code); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, buf_len); + return NRF_SUCCESS; + } + + err_code = cond_field_dec(p_buf, + buf_len, + &index, + (void * *)pp_handles, + ble_gatts_char_handles_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gatts_descriptor_add.c b/components/serialization/application/codecs/s120/serializers/ble_gatts_descriptor_add.c new file mode 100644 index 0000000..ea895bb --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gatts_descriptor_add.c @@ -0,0 +1,91 @@ +/* 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 "ble_gatts_app.h" +#include +#include +#include "ble_serialization.h" +#include "ble_gap.h" +#include "app_util.h" +#include "cond_field_serialization.h" +#include "ble_gatts_struct_serialization.h" + + +uint32_t ble_gatts_descriptor_add_req_enc(uint16_t char_handle, + ble_gatts_attr_t const * const p_attr, + uint16_t * const p_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(1, *p_buf_len); + p_buf[index++] = SD_BLE_GATTS_DESCRIPTOR_ADD; + + uint32_t err_code = uint16_t_enc(&char_handle, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_attr, + p_buf, + *p_buf_len, + &index, + ble_gatts_attr_enc); + SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + p_buf[index++] = (p_handle != NULL) ? SER_FIELD_PRESENT : + SER_FIELD_NOT_PRESENT; + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gatts_descriptor_add_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_handle, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t index = 0; + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, + &index, + packet_len, + SD_BLE_GATTS_DESCRIPTOR_ADD, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + SER_ASSERT_LENGTH_LEQ(index + 2, packet_len); + SER_ASSERT_NOT_NULL(p_handle); + + uint16_dec(p_buf, packet_len, &index, p_handle); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gatts_evt_app.h b/components/serialization/application/codecs/s120/serializers/ble_gatts_evt_app.h new file mode 100644 index 0000000..537e92b --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gatts_evt_app.h @@ -0,0 +1,186 @@ +/* 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 BLE_GATTS_EVT_APP_H__ +#define BLE_GATTS_EVT_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s120_codecs Application s120 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gatts_evt_app GATTS Application event decoders + * @{ + * @ingroup ser_app_s120_codecs + * + * @brief GATTS Application event decoders. + */ +#include "ble.h" + +/** + * @brief Decodes ble_gatts_evt_hvc event. + * + * @sa @ref nrf51_gatts_evt_hvc_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gatts_evt_hvc_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gatts_evt_rw_authorize_request event. + * + * @sa @ref nrf51_evt_rw_authorize_request for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gatts_evt_rw_authorize_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gatts_evt_sc_confirm event. + * + * @sa @ref nrf51_gatts_evt_sc_confirm_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gatts_evt_sc_confirm_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gatts_evt_sys_attr_missing event. + * + * @sa @ref nrf51_evt_sys_attr_missing_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gatts_evt_sys_attr_missing_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gatts_evt_timeout event. + * + * @sa @ref nrf51_gatts_evt_timeout_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gatts_evt_timeout_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gatts_evt_write event. + * + * @sa @ref nrf51_evt_write_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gatts_evt_write_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** @} */ +#endif diff --git a/components/serialization/application/codecs/s120/serializers/ble_gatts_evt_hvc.c b/components/serialization/application/codecs/s120/serializers/ble_gatts_evt_hvc.c new file mode 100644 index 0000000..2c1c5aa --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gatts_evt_hvc.c @@ -0,0 +1,51 @@ +/* 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 "ble_gatts_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_evt_hvc_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 1, packet_len); + + uint32_t event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gatts_evt_hvc_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTS_EVT_HVC; + p_event->header.evt_len = event_len; + + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gatts_evt.conn_handle); + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gatts_evt.params.hvc.handle); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gatts_evt_rw_authorize_request.c b/components/serialization/application/codecs/s120/serializers/ble_gatts_evt_rw_authorize_request.c new file mode 100644 index 0000000..86f1b35 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gatts_evt_rw_authorize_request.c @@ -0,0 +1,78 @@ +/* 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 "ble_gatts_evt_app.h" +#include "ble_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "app_ble_user_mem.h" +#include "app_util.h" + +extern ser_ble_user_mem_t m_app_user_mem_table[]; + +uint32_t ble_gatts_evt_rw_authorize_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + uint32_t in_event_len = *p_event_len; + + *p_event_len = offsetof(ble_evt_t, evt.gatts_evt.params) - sizeof (ble_evt_hdr_t); + + uint16_t conn_handle; + err_code = uint16_t_dec(p_buf, packet_len, &index, &conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + void * p_void_authorize_request = NULL; + + if (p_event != NULL) + { + SER_ASSERT_LENGTH_LEQ(*p_event_len, in_event_len); + + p_event->header.evt_id = BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST; + p_event->evt.gatts_evt.conn_handle = conn_handle; + + p_void_authorize_request = &(p_event->evt.gatts_evt.params.authorize_request); + } + uint32_t tmp_event_len = in_event_len - *p_event_len; + err_code = ble_gatts_evt_rw_authorize_request_t_dec(p_buf, + packet_len, + &index, + &tmp_event_len, + p_void_authorize_request); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_event_len += tmp_event_len; + + if(p_event != NULL) + { + if((p_event->evt.gatts_evt.params.authorize_request.type == BLE_GATTS_AUTHORIZE_TYPE_WRITE) && (p_event->evt.gatts_evt.params.authorize_request.request.write.op == BLE_GATTS_OP_EXEC_WRITE_REQ_NOW)) + { + uint32_t conn_index; + + if(app_ble_user_mem_context_find(p_event->evt.gatts_evt.conn_handle, &conn_index) != NRF_ERROR_NOT_FOUND) + { + err_code = len16data_dec(p_buf, packet_len, &index, &m_app_user_mem_table[conn_index].mem_block.p_mem, &m_app_user_mem_table[conn_index].mem_block.len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + } + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gatts_evt_sc_confirm.c b/components/serialization/application/codecs/s120/serializers/ble_gatts_evt_sc_confirm.c new file mode 100644 index 0000000..d8d440f --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gatts_evt_sc_confirm.c @@ -0,0 +1,49 @@ +/* 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 "ble_gatts_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_evt_sc_confirm_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE, packet_len); + + uint32_t event_len = SER_EVT_CONN_HANDLE_SIZE; + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTS_EVT_SC_CONFIRM; + p_event->header.evt_len = event_len; + + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gatts_evt.conn_handle); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gatts_evt_sys_attr_missing.c b/components/serialization/application/codecs/s120/serializers/ble_gatts_evt_sys_attr_missing.c new file mode 100644 index 0000000..8b17268 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gatts_evt_sys_attr_missing.c @@ -0,0 +1,51 @@ +/* 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 "ble_gatts_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_evt_sys_attr_missing_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(3, packet_len); + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gatts_evt.params.sys_attr_missing)) + + sizeof (ble_gatts_evt_sys_attr_missing_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTS_EVT_SYS_ATTR_MISSING; + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + uint8_dec(p_buf, packet_len, &index, &p_event->evt.gatts_evt.params.sys_attr_missing.hint); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gatts_evt_timeout.c b/components/serialization/application/codecs/s120/serializers/ble_gatts_evt_timeout.c new file mode 100644 index 0000000..fba0b11 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gatts_evt_timeout.c @@ -0,0 +1,50 @@ +/* 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 "ble_gatts_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_evt_timeout_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 1, packet_len); + + uint32_t event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gatts_evt_timeout_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTS_EVT_TIMEOUT; + p_event->header.evt_len = event_len; + + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gatts_evt.conn_handle); + uint8_dec(p_buf, packet_len, &index, &p_event->evt.gatts_evt.params.timeout.src); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gatts_evt_write.c b/components/serialization/application/codecs/s120/serializers/ble_gatts_evt_write.c new file mode 100644 index 0000000..d6e7918 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gatts_evt_write.c @@ -0,0 +1,78 @@ +/* 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 "ble_gatts_evt_app.h" +#include +#include "ble_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "app_ble_user_mem.h" +#include "app_util.h" + +extern ser_ble_user_mem_t m_app_user_mem_table[]; + +uint32_t ble_gatts_evt_write_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = 0; + + uint32_t in_event_len = *p_event_len; + + *p_event_len = offsetof(ble_evt_t, evt.gatts_evt.params) - sizeof (ble_evt_hdr_t); + + uint16_t conn_handle; + err_code = uint16_t_dec(p_buf, packet_len, &index, &conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + void * p_void_write = NULL; + + if (p_event != NULL) + { + SER_ASSERT_LENGTH_LEQ(*p_event_len, in_event_len); + p_event->evt.gatts_evt.conn_handle = conn_handle; + + p_void_write = &(p_event->evt.gatts_evt.params.write); + } + + uint32_t tmp_struct_len = in_event_len - *p_event_len; + err_code = ble_gatts_evt_write_t_dec(p_buf, + packet_len, + &index, + &tmp_struct_len, + p_void_write); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_event_len += tmp_struct_len; + + if(p_event != NULL) + { + if(p_event->evt.gatts_evt.params.write.op == BLE_GATTS_OP_EXEC_WRITE_REQ_NOW) + { + uint32_t conn_index; + + if(app_ble_user_mem_context_find(p_event->evt.gatts_evt.conn_handle, &conn_index) != NRF_ERROR_NOT_FOUND) + { + err_code = len16data_dec(p_buf, packet_len, &index, &m_app_user_mem_table[conn_index].mem_block.p_mem, &m_app_user_mem_table[conn_index].mem_block.len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + } + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gatts_hvx.c b/components/serialization/application/codecs/s120/serializers/ble_gatts_hvx.c new file mode 100644 index 0000000..4682af8 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gatts_hvx.c @@ -0,0 +1,115 @@ +/* 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 "ble_gatts_app.h" +#include +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gap.h" +#include "app_util.h" + + +uint32_t ble_gatts_hvx_req_enc(uint16_t conn_handle, + ble_gatts_hvx_params_t const * const p_hvx_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT(p_hvx_params == NULL || + !(p_hvx_params->p_len == NULL && p_hvx_params->p_data != NULL), NRF_ERROR_NULL); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 2 + 1 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GATTS_HVX; + index += uint16_encode(conn_handle, &p_buf[index]); + + p_buf[index++] = (p_hvx_params != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_hvx_params != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 2 + 1 + 2 + 2, *p_buf_len); + index += uint16_encode(p_hvx_params->handle, &p_buf[index]); + p_buf[index++] = p_hvx_params->type; + index += uint16_encode(p_hvx_params->offset, &p_buf[index]); + + if (p_hvx_params->p_len != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 1 + 2 + 1, *p_buf_len); + + SER_ERROR_CHECK(*p_hvx_params->p_len <= BLE_GATTS_VAR_ATTR_LEN_MAX, + NRF_ERROR_INVALID_PARAM); + p_buf[index++] = SER_FIELD_PRESENT; + index += uint16_encode(*(p_hvx_params->p_len), &p_buf[index]); + + if (p_hvx_params->p_data != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 1 + *(p_hvx_params->p_len), *p_buf_len); + p_buf[index++] = SER_FIELD_PRESENT; + memcpy(&(p_buf[index]), p_hvx_params->p_data, *(p_hvx_params->p_len)); + index += *(p_hvx_params->p_len); + } + else + { + p_buf[index++] = SER_FIELD_NOT_PRESENT; + } + } + else + { + p_buf[index++] = SER_FIELD_NOT_PRESENT; + p_buf[index++] = SER_FIELD_NOT_PRESENT; + } + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gatts_hvx_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code, + uint16_t * * const pp_bytes_written) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t err_code; + uint32_t index = 0; + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, + &index, + packet_len, + SD_BLE_GATTS_HVX, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_bytes_written, uint16_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gatts_include_add.c b/components/serialization/application/codecs/s120/serializers/ble_gatts_include_add.c new file mode 100644 index 0000000..cb991a8 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gatts_include_add.c @@ -0,0 +1,74 @@ +/* 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 "ble_gatts_app.h" +#include "ble_serialization.h" +#include "ble_gatts.h" +#include "app_util.h" + + +uint32_t ble_gatts_include_add_req_enc(uint16_t service_handle, + uint16_t inc_srvc_handle, + uint16_t * const p_include_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + SER_ASSERT_LENGTH_LEQ(6, *p_buf_len); + + uint32_t index = 0; + uint32_t buf_len = *p_buf_len; + uint32_t err_code; + uint8_t opCode = SD_BLE_GATTS_INCLUDE_ADD; + uint8_t presenceFlag; + + err_code = uint8_t_enc(&opCode, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + err_code = uint16_t_enc(&service_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + err_code = uint16_t_enc(&inc_srvc_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + presenceFlag = (p_include_handle != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + err_code = uint8_t_enc(&presenceFlag, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + *p_buf_len = index; + return err_code; + +} + + +uint32_t ble_gatts_include_add_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_include_handle, + uint32_t * const p_result_code) +{ + uint32_t index = 0; + uint32_t err_code; + + err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_GATTS_INCLUDE_ADD, + p_result_code); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + SER_ASSERT_NOT_NULL(p_include_handle); + SER_ASSERT_LENGTH_LEQ(index + 2, packet_len); + err_code = uint16_t_dec(p_buf, packet_len, &index, p_include_handle); + SER_ASSERT_LENGTH_EQ(index, packet_len); + return err_code; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gatts_rw_authorize_reply.c b/components/serialization/application/codecs/s120/serializers/ble_gatts_rw_authorize_reply.c new file mode 100644 index 0000000..f792b7e --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gatts_rw_authorize_reply.c @@ -0,0 +1,57 @@ +/* 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 "ble_gatts_app.h" +#include "ble_serialization.h" +#include "app_util.h" +#include "cond_field_serialization.h" +#include "ble_gatts_struct_serialization.h" + +uint32_t ble_gatts_rw_authorize_reply_req_enc( + uint16_t conn_handle, + ble_gatts_rw_authorize_reply_params_t const * const + p_reply_params, + uint8_t * const + p_buf, + uint32_t * const + p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t buf_len = *p_buf_len; + uint8_t opcode = SD_BLE_GATTS_RW_AUTHORIZE_REPLY; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint8_t_enc(&opcode, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_reply_params, p_buf, buf_len, &index, + ble_gatts_rw_authorize_reply_params_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gatts_rw_authorize_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTS_RW_AUTHORIZE_REPLY, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gatts_service_add.c b/components/serialization/application/codecs/s120/serializers/ble_gatts_service_add.c new file mode 100644 index 0000000..443c660 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gatts_service_add.c @@ -0,0 +1,83 @@ +/* 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 "ble_gatts_app.h" +#include "ble_serialization.h" +#include "ble_gatts.h" +#include "app_util.h" + + +uint32_t ble_gatts_service_add_req_enc(uint8_t type, + ble_uuid_t const * const p_uuid, + uint16_t const * const p_conn_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 1 + 1 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GATTS_SERVICE_ADD; + p_buf[index++] = type; + + p_buf[index++] = (p_uuid != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_uuid != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len); + index += uint16_encode(p_uuid->uuid, &p_buf[index]); + p_buf[index++] = p_uuid->type; + } + + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + p_buf[index++] = (p_conn_handle != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gatts_service_add_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint32_t * const p_result_code) +{ + uint32_t index = 0; + + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_GATTS_SERVICE_ADD, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_conn_handle); + + SER_ASSERT_LENGTH_LEQ(index + 2, packet_len); + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return decode_result; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gatts_service_changed.c b/components/serialization/application/codecs/s120/serializers/ble_gatts_service_changed.c new file mode 100644 index 0000000..aba707e --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gatts_service_changed.c @@ -0,0 +1,55 @@ +/* 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 "ble_gatts_app.h" +#include "ble_serialization.h" +#include "ble_gatts.h" +#include "app_util.h" + + +uint32_t ble_gatts_service_changed_req_enc(uint16_t conn_handle, + uint16_t start_handle, + uint16_t end_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code; + uint8_t opcode = SD_BLE_GATTS_SERVICE_CHANGED; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + err_code = uint8_t_enc(&opcode, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&start_handle, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&end_handle, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gatts_service_changed_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTS_SERVICE_CHANGED, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gatts_sys_attr_get.c b/components/serialization/application/codecs/s120/serializers/ble_gatts_sys_attr_get.c new file mode 100644 index 0000000..6f36b20 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gatts_sys_attr_get.c @@ -0,0 +1,113 @@ +/* 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 "ble_gatts_app.h" +#include +#include +#include "ble_serialization.h" +#include "ble_gap.h" +#include "app_util.h" + + +uint32_t ble_gatts_sys_attr_get_req_enc(uint16_t conn_handle, + uint8_t const * const p_sys_attr_data, + uint16_t const * const p_sys_attr_data_len, + uint32_t flags, + uint8_t * const p_buf, + uint32_t * p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 2 + 1 + 4, *p_buf_len); + p_buf[index++] = SD_BLE_GATTS_SYS_ATTR_GET; + index += uint16_encode(conn_handle, &p_buf[index]); + + p_buf[index++] = (p_sys_attr_data_len != NULL) ? SER_FIELD_PRESENT : + SER_FIELD_NOT_PRESENT; + + if (p_sys_attr_data_len != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 2, *p_buf_len); + index += uint16_encode(*p_sys_attr_data_len, &p_buf[index]); + } + + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + p_buf[index++] = (p_sys_attr_data != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + err_code = uint32_t_enc(&flags, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gatts_sys_attr_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * const p_sys_attr_data, + uint16_t * const p_sys_attr_data_len, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t index = 0; + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, + &index, + packet_len, + SD_BLE_GATTS_SYS_ATTR_GET, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + SER_ASSERT_LENGTH_LEQ(index + 2 + 1, packet_len); + + uint16_t sys_attr_len; + uint16_dec(p_buf, packet_len, &index, &sys_attr_len); + + if (p_buf[index++] == SER_FIELD_PRESENT) + { + SER_ASSERT_NOT_NULL(p_sys_attr_data); + SER_ASSERT_NOT_NULL(p_sys_attr_data_len); + SER_ASSERT(sys_attr_len <= *p_sys_attr_data_len, NRF_ERROR_DATA_SIZE); + + SER_ASSERT_LENGTH_LEQ(index + sys_attr_len, packet_len); + memcpy(p_sys_attr_data, &p_buf[index], sys_attr_len); + *p_sys_attr_data_len = sys_attr_len; + index += sys_attr_len; + } + else + { + if (p_sys_attr_data_len != NULL) + { + *p_sys_attr_data_len = sys_attr_len; + } + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gatts_sys_attr_set.c b/components/serialization/application/codecs/s120/serializers/ble_gatts_sys_attr_set.c new file mode 100644 index 0000000..b8830a6 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gatts_sys_attr_set.c @@ -0,0 +1,65 @@ +/* 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 "ble_gatts_app.h" +#include +#include "ble_serialization.h" +#include "ble_gatts.h" +#include "app_util.h" + + +uint32_t ble_gatts_sys_attr_set_req_enc(uint16_t conn_handle, + uint8_t const * const p_sys_attr_data, + uint16_t sys_attr_data_len, + uint32_t flags, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 8, *p_buf_len); + + p_buf[index++] = SD_BLE_GATTS_SYS_ATTR_SET; + index += uint16_encode(conn_handle, &p_buf[index]); + + p_buf[index++] = (p_sys_attr_data != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_sys_attr_data != NULL) + { + //lint -save -esym(670,memcpy) + SER_ERROR_CHECK(sys_attr_data_len <= BLE_GATTS_VAR_ATTR_LEN_MAX, NRF_ERROR_INVALID_PARAM); + SER_ASSERT_LENGTH_LEQ(index + 2 + sys_attr_data_len + 4, *p_buf_len); + index += uint16_encode(sys_attr_data_len, &p_buf[index]); + memcpy(&(p_buf[index]), p_sys_attr_data, sys_attr_data_len); + //lint -restore + index += sys_attr_data_len; + } + + err_code = uint32_t_enc(&flags, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gatts_sys_attr_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTS_SYS_ATTR_SET, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gatts_value_get.c b/components/serialization/application/codecs/s120/serializers/ble_gatts_value_get.c new file mode 100644 index 0000000..54d5844 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gatts_value_get.c @@ -0,0 +1,126 @@ +/* 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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_gatts_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" +#include "cond_field_serialization.h" +#include "ble_gatts_struct_serialization.h" + +uint32_t ble_gatts_value_get_req_enc(uint16_t conn_handle, + uint16_t handle, + ble_gatts_value_t const * const p_value, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + uint32_t total_len = *p_buf_len; + + SER_ASSERT_LENGTH_LEQ(1 + 2 + 2 + 1, total_len); + p_buf[index++] = SD_BLE_GATTS_VALUE_GET; + + err_code = uint16_t_enc(&conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (p_value != NULL) + { + p_buf[index++] = SER_FIELD_PRESENT; + err_code = uint16_t_enc(&(p_value->len), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_value->offset), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(1, total_len - index); + if (p_value->p_value != NULL) + { + p_buf[index++] = SER_FIELD_PRESENT; + } + else + { + p_buf[index++] = SER_FIELD_NOT_PRESENT; + } + } + else + { + p_buf[index++] = SER_FIELD_NOT_PRESENT; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gatts_value_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gatts_value_t * const p_value, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + SER_ASSERT_NOT_NULL(p_value); + + uint32_t err_code; + uint32_t index = 0; + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, + packet_len, SD_BLE_GATTS_VALUE_GET, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + err_code = ble_gatts_value_t_dec(p_buf, packet_len, &index, p_value); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_gatts_value_set.c b/components/serialization/application/codecs/s120/serializers/ble_gatts_value_set.c new file mode 100644 index 0000000..e11cffc --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_gatts_value_set.c @@ -0,0 +1,84 @@ +/* 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 "ble_gatts_app.h" +#include +#include "nrf_error.h" +#include "cond_field_serialization.h" +#include "ble_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_gatts_value_set_req_enc(uint16_t conn_handle, + uint16_t handle, + ble_gatts_value_t * p_value, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(1 + 2 + 2, *p_buf_len); + p_buf[index++] = SD_BLE_GATTS_VALUE_SET; + index += uint16_encode(conn_handle, &p_buf[index]); + index += uint16_encode(handle, &p_buf[index]); + + if(p_value != NULL) + { + SER_ERROR_CHECK(p_value->len <= BLE_GATTS_VAR_ATTR_LEN_MAX, NRF_ERROR_INVALID_PARAM); + } + err_code = cond_field_enc(p_value, p_buf, *p_buf_len, &index, ble_gatts_value_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gatts_value_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gatts_value_t * const p_value, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, + &index, + packet_len, + SD_BLE_GATTS_VALUE_SET, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + err_code = ble_gatts_value_t_dec(p_buf, packet_len, &index, p_value); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_l2cap_app.h b/components/serialization/application/codecs/s120/serializers/ble_l2cap_app.h new file mode 100644 index 0000000..f10d577 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_l2cap_app.h @@ -0,0 +1,163 @@ +/* Copyright (c) 2014 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. + * + */ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s120_codecs Application s120 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_l2cap_app L2CAP Application command request encoders and command response decoders + * @{ + * @ingroup ser_app_s120_codecs + * + * @brief L2CAP Application command request encoders and command response decoders. + */ + +#ifndef BLE_L2CAP_APP_H__ +#define BLE_L2CAP_APP_H__ + +#include "ble.h" +#include "ble_types.h" +#include "ble_ranges.h" +#include "ble_err.h" +#include "ble_l2cap.h" + +/**@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. + * + * @param[in] cid L2CAP CID. + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_l2cap_cid_register_req_enc(uint16_t cid, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_l2cap_cid_register command. + * + * @sa @ref nrf51_adv_start_encoding for packet format, + * @ref ble_l2cap_cid_register_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_l2cap_cid_register_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Unregister a CID with L2CAP. + * + * @details This unregisters a previously registered higher protocol layer with the L2CAP multiplexer. + * + * @param[in] cid L2CAP CID. + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_l2cap_cid_unregister_req_enc(uint16_t cid, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_l2cap_cid_unregister command. + * + * @sa @ref nrf51_adv_start_encoding for packet format, + * @ref ble_l2cap_cid_unregister_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_l2cap_cid_unregister_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Transmit an L2CAP packet. + * + * @note It is important to note that a call to this function will consume an application buffer, 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_buffer_count_get for more details. + * + * @param[in] conn_handle Connection Handle. + * @param[in] p_l2cap_header Pointer to a packet header containing length and CID. + * @param[in] p_data Pointer to the data to be transmitted. + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @return @ref NRF_SUCCESS Successfully queued an L2CAP packet for transmission. + * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @return @ref NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, CIDs must be registered beforehand with @ref sd_ble_l2cap_cid_register. + * @return @ref NRF_ERROR_NOT_FOUND CID not found. + * @return @ref NRF_ERROR_NO_MEM Not enough memory to complete operation. + * @return @ref BLE_ERROR_NO_TX_BUFFERS Not enough application buffers available. + * @return @ref NRF_ERROR_DATA_SIZE Invalid data size(s) supplied, see @ref BLE_L2CAP_MTU_DEF. + */ +uint32_t ble_l2cap_tx_req_enc(uint16_t conn_handle, + ble_l2cap_header_t const * const p_l2cap_header, + uint8_t const * const p_data, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_l2cap_tx command. + * + * @sa @ref nrf51_adv_start_encoding for packet format, + * @ref ble_l2cap_tx_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_l2cap_tx_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + + +#endif //BLE_L2CAP_APP_H__ + +/** + @} + */ diff --git a/components/serialization/application/codecs/s120/serializers/ble_l2cap_cid_register.c b/components/serialization/application/codecs/s120/serializers/ble_l2cap_cid_register.c new file mode 100644 index 0000000..de597fe --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_l2cap_cid_register.c @@ -0,0 +1,45 @@ +/* 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 "ble_gap_app.h" +#include +#include "ble_serialization.h" +#include "ble_gap.h" +#include "app_util.h" + +uint32_t ble_l2cap_cid_register_req_enc(uint16_t cid, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len); + + p_buf[index++] = SD_BLE_L2CAP_CID_REGISTER; + err_code = uint16_t_enc(&cid, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_l2cap_cid_register_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_L2CAP_CID_REGISTER, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_l2cap_cid_unregister.c b/components/serialization/application/codecs/s120/serializers/ble_l2cap_cid_unregister.c new file mode 100644 index 0000000..cd6e65a --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_l2cap_cid_unregister.c @@ -0,0 +1,45 @@ +/* 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 "ble_gap_app.h" +#include +#include "ble_serialization.h" +#include "ble_gap.h" +#include "app_util.h" + +uint32_t ble_l2cap_cid_unregister_req_enc(uint16_t cid, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len); + + p_buf[index++] = SD_BLE_L2CAP_CID_UNREGISTER; + err_code = uint16_t_enc(&cid, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_l2cap_cid_unregister_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_L2CAP_CID_UNREGISTER, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_l2cap_evt_app.h b/components/serialization/application/codecs/s120/serializers/ble_l2cap_evt_app.h new file mode 100644 index 0000000..cde00e3 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_l2cap_evt_app.h @@ -0,0 +1,61 @@ +/* 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 BLE_L2CAP_EVT_APP_H__ +#define BLE_L2CAP_EVT_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s120_codecs Application s120 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_l2cap_evt_app L2CAP Application event decoders + * @{ + * @ingroup ser_app_s120_codecs + * + * @brief L2CAP Application event decoders. + */ +#include "ble.h" + +/** + * @brief Decodes ble_l2cap_evt_rx event. + * + * @sa @ref nrf51_l2cap_evt_rx_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_l2cap_evt_rx_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** @} */ +#endif diff --git a/components/serialization/application/codecs/s120/serializers/ble_l2cap_evt_rx.c b/components/serialization/application/codecs/s120/serializers/ble_l2cap_evt_rx.c new file mode 100644 index 0000000..d54682a --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_l2cap_evt_rx.c @@ -0,0 +1,56 @@ +/* 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 "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" +#include "ble_l2cap_evt_app.h" + +uint32_t ble_l2cap_evt_rx_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_event_len); + + uint32_t index = 0; + uint32_t in_event_len = *p_event_len; + + *p_event_len = offsetof(ble_l2cap_evt_t, params); + + uint16_t evt_id; + + uint32_t err_code = uint16_t_dec(p_buf, packet_len, &index, &evt_id); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + void * p_rx = NULL; + + if (p_event) + { + err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.l2cap_evt.conn_handle)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + p_rx = &(p_event->evt.l2cap_evt.params.rx); + } + + uint32_t struct_len = in_event_len - *p_event_len; + err_code = ble_l2cap_evt_rx_t_dec(p_buf, packet_len, &index, &struct_len, p_rx); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_event_len += struct_len; + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_l2cap_tx.c b/components/serialization/application/codecs/s120/serializers/ble_l2cap_tx.c new file mode 100644 index 0000000..83baa90 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_l2cap_tx.c @@ -0,0 +1,61 @@ +/* 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 +#include "ble_l2cap_app.h" +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "ble_gap.h" +#include "app_util.h" +#include "cond_field_serialization.h" + +uint32_t ble_l2cap_tx_req_enc(uint16_t conn_handle, + ble_l2cap_header_t const * const p_l2cap_header, + uint8_t const * const p_data, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(1, *p_buf_len); + p_buf[index++] = SD_BLE_L2CAP_TX; + + err_code = uint16_t_enc(&conn_handle, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_l2cap_header, p_buf, *p_buf_len, &index, ble_l2cap_header_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (p_l2cap_header != NULL) + { + err_code = buf_enc(p_data, p_l2cap_header->len, p_buf, *p_buf_len, &index); + } + else + { + err_code = buf_enc(NULL, 0, p_buf, *p_buf_len, &index); + } + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_l2cap_tx_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_L2CAP_TX, p_result_code); +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_opt_get.c b/components/serialization/application/codecs/s120/serializers/ble_opt_get.c new file mode 100644 index 0000000..7728d66 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_opt_get.c @@ -0,0 +1,126 @@ +/* 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 "ble_app.h" +#include +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_opt_get_req_enc(uint32_t opt_id, + ble_opt_t const * const p_opt, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + SER_ASSERT_LENGTH_LEQ(1+4+1, *p_buf_len); // [OPCODE][OP_ID][PRESENT] + SER_ASSERT(((opt_id == BLE_COMMON_OPT_RADIO_CPU_MUTEX) || + (opt_id == BLE_GAP_OPT_CH_MAP) || + (opt_id == BLE_GAP_OPT_LOCAL_CONN_LATENCY) || + (opt_id == BLE_GAP_OPT_PASSKEY) || + (opt_id == BLE_GAP_OPT_PRIVACY) || + (opt_id == BLE_GAP_OPT_SCAN_REQ_REPORT) || + (opt_id == BLE_GAP_OPT_COMPAT_MODE)) , NRF_ERROR_INVALID_PARAM); + + p_buf[index++] = SD_BLE_OPT_GET; + + err_code = uint32_t_enc(&opt_id, p_buf, *p_buf_len, &index); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + p_buf[index++] = (p_opt == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + *p_buf_len = index; + + return NRF_SUCCESS; +} + +uint32_t ble_opt_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_opt_id, + ble_opt_t * const p_opt, + uint32_t * const p_result_code) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_opt_id); + SER_ASSERT_NOT_NULL(p_opt); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_OPT_GET, + p_result_code); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + (void) uint32_t_dec(p_buf, packet_len, &index, p_opt_id); + SER_ASSERT(((*p_opt_id == BLE_COMMON_OPT_RADIO_CPU_MUTEX) || + (*p_opt_id == BLE_GAP_OPT_CH_MAP) || + (*p_opt_id == BLE_GAP_OPT_LOCAL_CONN_LATENCY) || + (*p_opt_id == BLE_GAP_OPT_PASSKEY) || + (*p_opt_id == BLE_GAP_OPT_PRIVACY) || + (*p_opt_id == BLE_GAP_OPT_SCAN_REQ_REPORT) || + (*p_opt_id == BLE_GAP_OPT_COMPAT_MODE)), NRF_ERROR_INVALID_PARAM); + + switch (*p_opt_id) + { + case BLE_COMMON_OPT_RADIO_CPU_MUTEX: + err_code = ble_common_opt_radio_cpu_mutex_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->common_opt.radio_cpu_mutex)); + break; + case BLE_GAP_OPT_CH_MAP: + err_code = ble_gap_opt_ch_map_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.ch_map)); + break; + case BLE_GAP_OPT_LOCAL_CONN_LATENCY: + err_code = ble_gap_opt_local_conn_latency_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.local_conn_latency)); + break; + case BLE_GAP_OPT_PASSKEY: + err_code = ble_gap_opt_passkey_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.passkey)); + break; + case BLE_GAP_OPT_PRIVACY: + err_code = ble_gap_opt_privacy_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.privacy)); + break; + case BLE_GAP_OPT_SCAN_REQ_REPORT: + err_code = ble_gap_opt_scan_req_report_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.scan_req_report)); + break; + case BLE_GAP_OPT_COMPAT_MODE: + err_code = ble_gap_opt_compat_mode_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.compat_mode)); + break; + } + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + diff --git a/components/serialization/application/codecs/s120/serializers/ble_opt_set.c b/components/serialization/application/codecs/s120/serializers/ble_opt_set.c new file mode 100644 index 0000000..d6772b0 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_opt_set.c @@ -0,0 +1,117 @@ +/* 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 "ble_app.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_opt_set_req_enc(uint32_t const opt_id, + ble_opt_t const * const p_opt, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t initial_buf_len = *p_buf_len; + + SER_ASSERT_LENGTH_LEQ(1 + 4 + 1, initial_buf_len); + + SER_ASSERT(((opt_id == BLE_COMMON_OPT_RADIO_CPU_MUTEX) || + (opt_id == BLE_GAP_OPT_CH_MAP) || + (opt_id == BLE_GAP_OPT_LOCAL_CONN_LATENCY) || + (opt_id == BLE_GAP_OPT_PASSKEY) || + (opt_id == BLE_GAP_OPT_PRIVACY) || + (opt_id == BLE_GAP_OPT_SCAN_REQ_REPORT) || + (opt_id == BLE_GAP_OPT_COMPAT_MODE)), NRF_ERROR_INVALID_PARAM); + + p_buf[index++] = SD_BLE_OPT_SET; + + err_code = uint32_t_enc(&opt_id, p_buf, initial_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (p_opt != NULL) + { + p_buf[index++] = SER_FIELD_PRESENT; + + switch(opt_id) + { + case BLE_COMMON_OPT_RADIO_CPU_MUTEX: + err_code = ble_common_opt_radio_cpu_mutex_t_enc(&(p_opt->common_opt.radio_cpu_mutex),p_buf, initial_buf_len, &index); + break; + case BLE_GAP_OPT_CH_MAP: + err_code = ble_gap_opt_ch_map_t_enc(&(p_opt->gap_opt.ch_map),p_buf, initial_buf_len, &index); + break; + case BLE_GAP_OPT_LOCAL_CONN_LATENCY: + err_code = ble_gap_opt_local_conn_latency_t_enc(&(p_opt->gap_opt.local_conn_latency),p_buf, initial_buf_len, &index); + break; + case BLE_GAP_OPT_PASSKEY: + err_code = ble_gap_opt_passkey_t_enc(&(p_opt->gap_opt.passkey),p_buf, initial_buf_len, &index); + break; + case BLE_GAP_OPT_PRIVACY: + err_code = ble_gap_opt_privacy_t_enc(&(p_opt->gap_opt.privacy),p_buf, initial_buf_len, &index); + break; + case BLE_GAP_OPT_SCAN_REQ_REPORT: + err_code = ble_gap_opt_scan_req_report_t_enc(&(p_opt->gap_opt.scan_req_report),p_buf, initial_buf_len, &index); + break; + case BLE_GAP_OPT_COMPAT_MODE: + err_code = ble_gap_opt_compat_mode_t_enc(&(p_opt->gap_opt.compat_mode),p_buf, initial_buf_len, &index); + break; + } + } + else + { + p_buf[index++] = SER_FIELD_NOT_PRESENT; + } + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_opt_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + uint32_t index = 0; + uint32_t error_code; + + error_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_OPT_SET, p_result_code); + + if (error_code != NRF_SUCCESS) + { + return error_code; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_tx_buffer_count_get.c b/components/serialization/application/codecs/s120/serializers/ble_tx_buffer_count_get.c new file mode 100644 index 0000000..944fe63 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_tx_buffer_count_get.c @@ -0,0 +1,68 @@ +/* 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 "ble_app.h" +#include "ble_serialization.h" +#include "app_util.h" +#include "cond_field_serialization.h" + +uint32_t ble_tx_buffer_count_get_req_enc(uint8_t const * const p_count, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint8_t opcode = SD_BLE_TX_BUFFER_COUNT_GET; + uint32_t err_code; + uint32_t total_len = *p_buf_len; + + err_code = uint8_t_enc(&opcode, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_count, p_buf, total_len, &index, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_tx_buffer_count_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * * const pp_count, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t index = 0; + uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_TX_BUFFER_COUNT_GET, p_result_code); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; + } + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_count, uint8_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_user_mem_reply.c b/components/serialization/application/codecs/s120/serializers/ble_user_mem_reply.c new file mode 100644 index 0000000..7a39b6b --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_user_mem_reply.c @@ -0,0 +1,65 @@ +/* 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 "ble_app.h" +#include +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + +uint32_t ble_user_mem_reply_req_enc(uint16_t conn_handle, + ble_user_mem_block_t const * p_block, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + p_buf[index++] = SD_BLE_USER_MEM_REPLY; + + err_code = uint16_t_enc(&conn_handle, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if(p_block != NULL) + { + p_buf[index++] = SER_FIELD_PRESENT; + + // Encoding order is different than structure elements order because + // mem block length should be sent first + err_code = uint16_t_enc(&(p_block->len), p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_block->p_mem, p_buf, *p_buf_len, &index, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + else + { + p_buf[index++] = SER_FIELD_NOT_PRESENT; + } + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_user_mem_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_USER_MEM_REPLY, p_result_code); +} + + diff --git a/components/serialization/application/codecs/s120/serializers/ble_uuid_decode.c b/components/serialization/application/codecs/s120/serializers/ble_uuid_decode.c new file mode 100644 index 0000000..5c3e006 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_uuid_decode.c @@ -0,0 +1,84 @@ +/* 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 "ble_app.h" +#include +#include +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_uuid_decode_req_enc(uint8_t uuid_le_len, + uint8_t const * const p_uuid_le, + ble_uuid_t * const p_uuid, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t err_code; + uint32_t index = 0; + uint32_t buf_len = *p_buf_len; + uint8_t opcode = SD_BLE_UUID_DECODE; + + err_code = uint8_t_enc((void *)&opcode, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = len8data_enc(p_uuid_le, uuid_le_len, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc((void *)p_uuid, p_buf, buf_len, &index, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_uuid_decode_rsp_dec(uint8_t const * const p_buf, + uint32_t buf_len, + ble_uuid_t * * const pp_uuid, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t err_code; + uint32_t index = 0; + + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, + &index, + buf_len, + SD_BLE_UUID_DECODE, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, buf_len); + return NRF_SUCCESS; + } + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_uuid, ble_uuid_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_uuid_encode.c b/components/serialization/application/codecs/s120/serializers/ble_uuid_encode.c new file mode 100644 index 0000000..5eb8099 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_uuid_encode.c @@ -0,0 +1,93 @@ +/* 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 "ble_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_uuid_encode_req_enc(ble_uuid_t const * const p_uuid, + uint8_t const * const p_uuid_le_len, + uint8_t const * const p_uuid_le, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(1 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_UUID_ENCODE; + + p_buf[index++] = (p_uuid != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_uuid != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len); + index += uint16_encode(p_uuid->uuid, &p_buf[index]); + p_buf[index++] = p_uuid->type; + } + + SER_ASSERT_LENGTH_LEQ(index + 2, *p_buf_len); + p_buf[index++] = (p_uuid_le_len == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + p_buf[index++] = (p_uuid_le == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_uuid_encode_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * const p_uuid_le_len, + uint8_t * const p_uuid_le, + uint32_t * const p_result_code) +{ + uint32_t index = 0; + uint32_t error_code; + + error_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_UUID_ENCODE, p_result_code); + + if (error_code != NRF_SUCCESS) + { + return error_code; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + SER_ASSERT_LENGTH_LEQ(index + 1, packet_len); + uint8_t uuid_le_len = p_buf[index++]; + + if (p_uuid_le_len != NULL) + { + if (p_uuid_le != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + uuid_le_len, packet_len); + memcpy(p_uuid_le, &(p_buf[index]), uuid_le_len); + index += uuid_le_len; + } + *p_uuid_le_len = uuid_le_len; + } + + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_uuid_vs_add.c b/components/serialization/application/codecs/s120/serializers/ble_uuid_vs_add.c new file mode 100644 index 0000000..0f686f1 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_uuid_vs_add.c @@ -0,0 +1,83 @@ +/* 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 "ble_app.h" +#include +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_uuid_vs_add_req_enc(ble_uuid128_t const * const p_vs_uuid, + uint8_t * const p_uuid_type, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t err_code; + uint32_t index = 0; + uint32_t buf_len = *p_buf_len; + uint8_t opcode = SD_BLE_UUID_VS_ADD; + + err_code = uint8_t_enc(&opcode, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc((void *)p_vs_uuid, p_buf, buf_len, &index, ble_uuid128_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc((void *)p_uuid_type, p_buf, buf_len, &index, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_uuid_vs_add_rsp_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint8_t * * const pp_uuid_type, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + SER_ASSERT_NOT_NULL(pp_uuid_type); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = 0; + + err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, + &index, + buf_len, + SD_BLE_UUID_VS_ADD, + p_result_code); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, buf_len); + return NRF_SUCCESS; + } + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_uuid_type, uint8_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s120/serializers/ble_version_get.c b/components/serialization/application/codecs/s120/serializers/ble_version_get.c new file mode 100644 index 0000000..0485b4f --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/ble_version_get.c @@ -0,0 +1,73 @@ +/* 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 "ble_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_version_get_req_enc(ble_version_t const * const p_version, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 2, *p_buf_len); + + p_buf[index++] = SD_BLE_VERSION_GET; + + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + + p_buf[index++] = (p_version == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + *p_buf_len = index; + + return NRF_SUCCESS; +} + +uint32_t ble_version_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_version_t * p_version, + uint32_t * const p_result_code) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t status_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_VERSION_GET, + p_result_code); + + if (status_code != NRF_SUCCESS) + { + return status_code; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + uint8_dec(p_buf, packet_len, &index, &(p_version->version_number)); + uint16_dec(p_buf, packet_len, &index, &(p_version->company_id)); + uint16_dec(p_buf, packet_len, &index, &p_version->subversion_number); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return status_code; +} + + diff --git a/components/serialization/application/codecs/s120/serializers/nrf_soc_app.h b/components/serialization/application/codecs/s120/serializers/nrf_soc_app.h new file mode 100644 index 0000000..4b2cbcc --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/nrf_soc_app.h @@ -0,0 +1,90 @@ +/* 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. + * + */ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s120_codecs Application s120 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup soc_app SOC Application command request encoders and command response decoders + * @{ + * @ingroup ser_app_s120_codecs + * + * @brief SOC Application command request encoders and command response decoders. + */ + +#ifndef NRF_SOC_APP_H__ +#define NRF_SOC_APP_H__ + +#include + +/**@brief Encodes @ref sd_power_system_off command request. + * + * @sa @ref nrf51_sd_power_off for packet format. + * + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: size of p_buf buffer. \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t power_system_off_req_enc(uint8_t * const p_buf, uint32_t * const p_buf_len); + + +/**@brief Encodes @ref sd_temp_get command request. + * + * @sa @ref nrf51_sd_temp_get for packet format. + @ref temp_get_rsp_dec for command response decoder. + * + * @param[in] p_temp Pointer to result of temperature measurement. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: size of p_buf buffer. \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t temp_get_req_enc(int32_t const * const p_temp, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_temp_get command. + * + * @sa @ref nrf51_sd_temp_get for packet format, + * @ref temp_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * @param[out] p_temp Pointer to result of temperature measurement. + * + * @return NRF_SUCCESS Version information stored successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t temp_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code, + int32_t * const p_temp); + +/** @} */ + +#endif // NRF_SOC_APP_H__ diff --git a/components/serialization/application/codecs/s120/serializers/power_system_off.c b/components/serialization/application/codecs/s120/serializers/power_system_off.c new file mode 100644 index 0000000..c81b1ca --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/power_system_off.c @@ -0,0 +1,32 @@ +/* + * 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 "nrf_soc_app.h" +#include "ble_serialization.h" +#include "nrf_soc.h" + + +uint32_t power_system_off_req_enc(uint8_t * const p_buf, uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(1, *p_buf_len); + + p_buf[index++] = SD_POWER_SYSTEM_OFF; + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s120/serializers/temp_get.c b/components/serialization/application/codecs/s120/serializers/temp_get.c new file mode 100644 index 0000000..e50a799 --- /dev/null +++ b/components/serialization/application/codecs/s120/serializers/temp_get.c @@ -0,0 +1,71 @@ +/* + * 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 "nrf_soc.h" +#include "nrf_error.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" + +uint32_t temp_get_req_enc(int32_t const * const p_temp, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + uint32_t total_len = *p_buf_len; + + SER_ASSERT_LENGTH_LEQ(1, total_len); + p_buf[index++] = SD_TEMP_GET; + + err_code = cond_field_enc(p_temp, p_buf, total_len, &index, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t temp_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code, + int32_t * const p_temp) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + SER_ASSERT_NOT_NULL(p_temp); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, + &index, + packet_len, + SD_TEMP_GET, + p_result_code); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (*p_result_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + err_code = uint32_t_dec(p_buf, packet_len, &index, p_temp); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s130/middleware/app_mw_ble.c b/components/serialization/application/codecs/s130/middleware/app_mw_ble.c new file mode 100644 index 0000000..51c73c3 --- /dev/null +++ b/components/serialization/application/codecs/s130/middleware/app_mw_ble.c @@ -0,0 +1,501 @@ +/* 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 "ble.h" +#include "ble_serialization.h" +#include +#include "ble_app.h" +#include "ser_sd_transport.h" +#include "app_error.h" +#include "app_ble_user_mem.h" + +extern ser_ble_user_mem_t m_app_user_mem_table[]; + +/**@brief Structure containing @ref sd_ble_uuid_encode output parameters. */ +typedef struct +{ + uint8_t * p_uuid_le_len; /**< @ref sd_ble_uuid_encode appearance p_uuid_le_len output parameter. */ + uint8_t * p_uuid_le; /**< @ref sd_ble_uuid_encode appearance p_uuid_le output parameter. */ +} ble_uuid_encode_out_params_t; + +/**@brief Structure containing @ref sd_ble_tx_buffer_count_get output parameters. */ +typedef struct +{ + uint8_t * p_count; /**< @ref sd_ble_tx_buffer_count_get p_count output parameter. */ +} ble_tx_buffer_count__get_out_params_t; + +/**@brief Structure containing @ref sd_ble_user_mem_reply output parameters. */ +typedef struct +{ + uint16_t conn_handle; /**< @ref sd_ble_user_mem_reply conn_handle. */ + uint8_t context_allocated; /**< @ref sd_ble_user_mem_reply user memory context allocated flag. */ +} ble_user_mem_reply_out_params_t; + +/**@brief Union containing BLE command output parameters. */ +typedef union +{ + ble_uuid_encode_out_params_t ble_uuid_encode_out_params; /**< @ref sd_ble_uuid_encode output parameters. */ + ble_tx_buffer_count__get_out_params_t ble_tx_buffer_count_get_out_params; /**< @ref sd_ble_uuid_encode output parameters. */ + ble_user_mem_reply_out_params_t ble_user_mem_reply_out_params; /**< @ref sd_ble_user_mem_reply output parameters. */ +} ble_command_output_params_t; + +static ble_command_output_params_t m_output_params; /**< BLE command output parameters. */ + +static void * mp_out_params[3]; +static uint32_t m_uint32_param; + +static void tx_buf_alloc(uint8_t * * p_data, uint32_t * p_len) +{ + uint32_t err_code; + uint16_t len16; + + do + { + err_code = ser_sd_transport_tx_alloc(p_data, &len16); + } + while (err_code != NRF_SUCCESS); + + *p_data[0] = SER_PKT_TYPE_CMD; + *p_len = (uint32_t)len16 - 1; +} + +/**@brief Command response callback function for @ref sd_ble_uuid_encode BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t uuid_encode_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = + ble_uuid_encode_rsp_dec(p_buffer, + length, + m_output_params.ble_uuid_encode_out_params.p_uuid_le_len, + m_output_params.ble_uuid_encode_out_params.p_uuid_le, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + return result_code; +} + + +uint32_t sd_ble_uuid_encode(ble_uuid_t const * const p_uuid, + uint8_t * const p_uuid_le_len, + uint8_t * const p_uuid_le) +{ + uint8_t * p_buffer; + uint32_t buffer_length; + + tx_buf_alloc(&p_buffer, &buffer_length); + + m_output_params.ble_uuid_encode_out_params.p_uuid_le_len = p_uuid_le_len; + m_output_params.ble_uuid_encode_out_params.p_uuid_le = p_uuid_le; + + uint32_t err_code = ble_uuid_encode_req_enc(p_uuid, + p_uuid_le_len, + p_uuid_le, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + uuid_encode_rsp_dec); + +} + +/**@brief Command response callback function for @ref sd_ble_tx_buffer_count_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t tx_buffer_count_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_tx_buffer_count_get_rsp_dec(p_buffer, + length, + (uint8_t * *)&mp_out_params[0], + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + return result_code; +} + +uint32_t sd_ble_tx_buffer_count_get(uint8_t * p_count) +{ + uint8_t * p_buffer; + uint32_t buffer_length; + + tx_buf_alloc(&p_buffer, &buffer_length); + mp_out_params[0] = p_count; + + const uint32_t err_code = ble_tx_buffer_count_get_req_enc(p_count, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + tx_buffer_count_get_rsp_dec); + +} + +/**@brief Command response callback function for @ref sd_ble_uuid_vs_add BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t uuid_vs_add_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_uuid_vs_add_rsp_dec(p_buffer, + length, + (uint8_t * *)&mp_out_params[0], + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + return result_code; +} + +uint32_t sd_ble_uuid_vs_add(ble_uuid128_t const * const p_vs_uuid, uint8_t * const p_uuid_type) +{ + uint8_t * p_buffer; + uint32_t buffer_length; + + tx_buf_alloc(&p_buffer, &buffer_length); + mp_out_params[0] = p_uuid_type; + + const uint32_t err_code = ble_uuid_vs_add_req_enc(p_vs_uuid, p_uuid_type, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + uuid_vs_add_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_uuid_decode BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t uuid_decode_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_uuid_decode_rsp_dec(p_buffer, + length, + (ble_uuid_t * *)&mp_out_params[0], + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + return result_code; +} + +uint32_t sd_ble_uuid_decode(uint8_t uuid_le_len, + uint8_t const * const p_uuid_le, + ble_uuid_t * const p_uuid) +{ + uint8_t * p_buffer; + uint32_t buffer_length; + + tx_buf_alloc(&p_buffer, &buffer_length); + mp_out_params[0] = p_uuid; + + const uint32_t err_code = ble_uuid_decode_req_enc(uuid_le_len, p_uuid_le, p_uuid, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + uuid_decode_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_version_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t version_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_version_get_rsp_dec(p_buffer, + length, + (ble_version_t *)mp_out_params[0], + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + return result_code; +} + +uint32_t sd_ble_version_get(ble_version_t * p_version) +{ + uint8_t * p_buffer; + uint32_t buffer_length; + + tx_buf_alloc(&p_buffer, &buffer_length); + mp_out_params[0] = p_version; + + const uint32_t err_code = ble_version_get_req_enc(p_version, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + version_get_rsp_dec); + +} + +/**@brief Command response callback function for @ref sd_ble_opt_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t opt_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + uint32_t uint32_param; + + uint32_t err_code = ble_opt_get_rsp_dec(p_buffer, + length, + &uint32_param, + (ble_opt_t *)mp_out_params[0], + &result_code); + + APP_ERROR_CHECK(err_code); + if (m_uint32_param != uint32_param) // decoded id should be the same as encoded one + { + err_code = NRF_ERROR_INVALID_PARAM; + } + APP_ERROR_CHECK(err_code); + + return result_code; +} + +uint32_t sd_ble_opt_get(uint32_t opt_id, ble_opt_t *p_opt) +{ + uint8_t * p_buffer; + uint32_t buffer_length; + + tx_buf_alloc(&p_buffer, &buffer_length); + mp_out_params[0] = p_opt; + m_uint32_param = opt_id; + + const uint32_t err_code = ble_opt_get_req_enc(opt_id, + p_opt, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + opt_get_rsp_dec); + +} + +/**@brief Command response callback function for @ref sd_ble_opt_set BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t opt_set_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_opt_set_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + +uint32_t sd_ble_opt_set(uint32_t opt_id, ble_opt_t const *p_opt) +{ + uint8_t * p_buffer; + uint32_t buffer_length; + + tx_buf_alloc(&p_buffer, &buffer_length); + + const uint32_t err_code = ble_opt_set_req_enc(opt_id, + p_opt, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + opt_set_rsp_dec); + +} + +/**@brief Command response callback function for @ref sd_ble_enable BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t enable_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_enable_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + return result_code; +} + +uint32_t sd_ble_enable(ble_enable_params_t * p_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length; + + tx_buf_alloc(&p_buffer, &buffer_length); + mp_out_params[0] = p_params; + + const uint32_t err_code = ble_enable_req_enc(p_params, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + enable_rsp_dec); + +} + +/**@brief Command response callback function for @ref sd_ble_user_mem_reply BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t user_mem_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + uint32_t err_code = ble_user_mem_reply_rsp_dec(p_buffer, + length, + &result_code); + APP_ERROR_CHECK(err_code); + + if ((result_code != NRF_SUCCESS) && + (m_output_params.ble_user_mem_reply_out_params.context_allocated)) + { + err_code = app_ble_user_mem_context_destroy( + m_output_params.ble_user_mem_reply_out_params.conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + + return result_code; +} + +uint32_t sd_ble_user_mem_reply(uint16_t conn_handle, ble_user_mem_block_t const *p_block) +{ + uint8_t * p_buffer; + uint32_t buffer_length, user_mem_table_index; + uint32_t err_code = NRF_SUCCESS; + + tx_buf_alloc(&p_buffer, &buffer_length); + + // Prepare User Memory Block context for later synchronization when SoftDevice updates + // the data in the memory block + if(p_block != NULL) + { + err_code = app_ble_user_mem_context_create(conn_handle, &user_mem_table_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + m_app_user_mem_table[user_mem_table_index].mem_block.len = p_block->len; + m_app_user_mem_table[user_mem_table_index].mem_block.p_mem = p_block->p_mem; + // Save connection handle and context allocation flag for case if context destroy was needed + m_output_params.ble_user_mem_reply_out_params.conn_handle = conn_handle; + m_output_params.ble_user_mem_reply_out_params.context_allocated = 1; + } + else + { + m_output_params.ble_user_mem_reply_out_params.context_allocated = 0; + } + + err_code = ble_user_mem_reply_req_enc(conn_handle, + p_block, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + user_mem_reply_rsp_dec); +} diff --git a/components/serialization/application/codecs/s130/middleware/app_mw_ble_gap.c b/components/serialization/application/codecs/s130/middleware/app_mw_ble_gap.c new file mode 100644 index 0000000..27f95ba --- /dev/null +++ b/components/serialization/application/codecs/s130/middleware/app_mw_ble_gap.c @@ -0,0 +1,1285 @@ +/* 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 "ble_gap.h" +#include +#include +#include "ble_serialization.h" +#include "ser_sd_transport.h" +#include "ble_gap_app.h" +#include "app_error.h" +#include "app_ble_gap_sec_keys.h" + +extern ser_ble_gap_app_keyset_t m_app_keys_table[SER_MAX_CONNECTIONS]; + +/**@brief Structure containing @ref sd_ble_gap_device_name_get output parameters. */ +typedef struct +{ + uint8_t * p_dev_name; /**< @ref sd_ble_gap_device_name_get p_dev_name output parameter. */ + uint16_t * p_len; /**< @ref sd_ble_gap_device_name_get p_len output parameter. */ +} gap_device_name_get_output_params_t; + +/**@brief Structure containing @ref sd_ble_gap_appearance_get output parameters. */ +typedef struct +{ + uint16_t * p_appearance; /**< @ref sd_ble_gap_appearance_get p_appearance output parameter. */ +} gap_appearance_get_output_params_t; + +/**@brief Structure containing @ref sd_ble_gap_ppcp_get output parameters. */ +typedef struct +{ + ble_gap_conn_params_t * p_conn_params; /**< @ref sd_ble_gap_ppcp_get p_conn_params output parameter. */ +} gap_ppcp_get_out_params_t; + +/**@brief Structure containing @ref sd_ble_gap_sec_params_reply output parameters. */ +typedef struct +{ + ble_gap_sec_keyset_t const * p_sec_keyset; /**< @ref sd_ble_gap_sec_params_reply p_sec_keyset output parameter. */ + uint16_t conn_handle; /**< @ref sd_ble_gap_sec_params_reply p_conn_handle output parameter. */ +} gap_sec_params_reply_out_params_t; + +/**@brief Union containing BLE command output parameters. */ +typedef union +{ + gap_device_name_get_output_params_t gap_device_name_get_out_params; /**< @ref sd_ble_gap_device_name_get output parameters. */ + gap_appearance_get_output_params_t gap_appearance_get_out_params; /**< @ref sd_ble_gap_appearance_get output parameters. */ + gap_ppcp_get_out_params_t gap_ppcp_get_out_params; /**< @ref sd_ble_gap_ppcp_get output parameters. */ + gap_sec_params_reply_out_params_t gap_sec_params_reply_out_params;/**< @ref sd_ble_sec_params_reply output parameters. */ +} gap_command_output_params_t; + +static gap_command_output_params_t m_output_params; /**< BLE command output parameters. */ + +static void * mp_out_params[1]; + +static void tx_buf_alloc(uint8_t * * p_data, uint16_t * p_len) +{ + uint32_t err_code; + + do + { + err_code = ser_sd_transport_tx_alloc(p_data, p_len); + } + while (err_code != NRF_SUCCESS); + *p_data[0] = SER_PKT_TYPE_CMD; + *p_len -= 1; +} +/**@brief Command response callback function for @ref sd_ble_gap_adv_start BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_adv_start_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gap_adv_start_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_adv_start(ble_gap_adv_params_t const * const p_adv_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gap_adv_start_req_enc(p_adv_params, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_adv_start_rsp_dec); +} + + +/**@brief Command response callback function for @ref ble_gap_device_name_get_req_enc BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_device_name_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = + ble_gap_device_name_get_rsp_dec(p_buffer, + length, + m_output_params.gap_device_name_get_out_params.p_dev_name, + m_output_params.gap_device_name_get_out_params.p_len, + &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_device_name_get(uint8_t * const p_dev_name, uint16_t * const p_len) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + m_output_params.gap_device_name_get_out_params.p_dev_name = p_dev_name; + m_output_params.gap_device_name_get_out_params.p_len = p_len; + + const uint32_t err_code = ble_gap_device_name_get_req_enc(p_dev_name, + p_len, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_device_name_get_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_appearance_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_appearance_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = + ble_gap_appearance_get_rsp_dec(p_buffer, + length, + m_output_params.gap_appearance_get_out_params.p_appearance, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_appearance_get(uint16_t * const p_appearance) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + m_output_params.gap_appearance_get_out_params.p_appearance = p_appearance; + + const uint32_t err_code = ble_gap_appearance_get_req_enc(p_appearance, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_appearance_get_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_device_name_set BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_device_name_set_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gap_device_name_set_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_device_name_set(ble_gap_conn_sec_mode_t const * const p_write_perm, + uint8_t const * const p_dev_name, + uint16_t len) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_device_name_set_req_enc(p_write_perm, + p_dev_name, + len, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_device_name_set_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_appearance_set BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_appearance_set_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gap_appearance_set_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_appearance_set(uint16_t appearance) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_appearance_set_req_enc(appearance, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_appearance_set_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_ppcp_set BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_ppcp_set_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gap_ppcp_set_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + + return result_code; +} + + +uint32_t sd_ble_gap_ppcp_set(ble_gap_conn_params_t const * const p_conn_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_ppcp_set_req_enc(p_conn_params, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_ppcp_set_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_adv_data_set BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_adv_data_set_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gap_adv_data_set_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_adv_data_set(uint8_t const * const p_data, + uint8_t dlen, + uint8_t const * const p_sr_data, + uint8_t srdlen) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_adv_data_set_req_enc(p_data, + dlen, + p_sr_data, + srdlen, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_adv_data_set_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_conn_param_update BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_conn_param_update_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gap_conn_param_update_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_conn_param_update(uint16_t conn_handle, + ble_gap_conn_params_t const * const p_conn_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_conn_param_update_req_enc(conn_handle, + p_conn_params, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_conn_param_update_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_disconnect BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_disconnect_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gap_disconnect_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_disconnect(uint16_t conn_handle, uint8_t hci_status_code) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_disconnect_req_enc(conn_handle, + hci_status_code, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_disconnect_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_sec_info_reply BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_sec_info_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gap_sec_info_reply_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + +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) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_sec_info_reply_req_enc(conn_handle, + p_enc_info, + p_id_info, + p_sign_info, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_sec_info_reply_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_sec_params_reply BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_sec_params_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + uint32_t err_code = ble_gap_sec_params_reply_rsp_dec(p_buffer, length, + m_output_params.gap_sec_params_reply_out_params.p_sec_keyset, &result_code); + APP_ERROR_CHECK(err_code); + + // If soft device returned error free security context + if (result_code) + { + err_code = app_ble_gap_sec_context_destroy(m_output_params.gap_sec_params_reply_out_params.conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + + return result_code; +} + + +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) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + uint32_t sec_tab_index = 0; + uint32_t err_code = NRF_SUCCESS; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + m_output_params.gap_sec_params_reply_out_params.p_sec_keyset = p_sec_keyset; + m_output_params.gap_sec_params_reply_out_params.conn_handle = conn_handle; + + // First allocate security context for serialization + if (p_sec_keyset) + { + err_code = app_ble_gap_sec_context_create(conn_handle, &sec_tab_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + memcpy(&(m_app_keys_table[sec_tab_index].keyset), p_sec_keyset, sizeof(ble_gap_sec_keyset_t)); + } + + err_code = ble_gap_sec_params_reply_req_enc(conn_handle, + sec_status, + p_sec_params, + p_sec_keyset, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_sec_params_reply_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gap_ppcp_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_ppcp_get_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_ppcp_get_rsp_dec( + p_buffer, + length, + m_output_params.gap_ppcp_get_out_params. + p_conn_params, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_ppcp_get(ble_gap_conn_params_t * const p_conn_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + m_output_params.gap_ppcp_get_out_params.p_conn_params = p_conn_params; + + const uint32_t err_code = ble_gap_ppcp_get_req_enc(p_conn_params, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_ppcp_get_reply_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_address_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_address_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_address_get_rsp_dec(p_buffer, + length, + (ble_gap_addr_t *)mp_out_params[0], + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_address_get(ble_gap_addr_t * const p_addr) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_addr; + + const uint32_t err_code = ble_gap_address_get_req_enc(p_addr, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + + gap_address_get_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_address_set BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_address_set_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_address_set_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_address_set(uint8_t addr_cycle_mode, ble_gap_addr_t const * const p_addr) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_address_set_req_enc(addr_cycle_mode, + p_addr, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_address_set_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_adv_stop BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_adv_stop_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_adv_stop_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_adv_stop(void) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_adv_stop_req_enc(&(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_adv_stop_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_auth_key_reply BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_auth_key_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_auth_key_reply_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_auth_key_reply(uint16_t conn_handle, + uint8_t key_type, + uint8_t const * const key) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_auth_key_reply_req_enc(conn_handle, key_type, key, + &(p_buffer[1]), &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_auth_key_reply_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_authenticate BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_authenticate_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_authenticate_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_authenticate(uint16_t conn_handle, + ble_gap_sec_params_t const * const p_sec_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_authenticate_req_enc(conn_handle, p_sec_params, + &(p_buffer[1]), &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_authenticate_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_conn_sec_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_conn_sec_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_conn_sec_get_rsp_dec( + p_buffer, + length, + (ble_gap_conn_sec_t * *)&mp_out_params[0 + ], + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_conn_sec_get(uint16_t conn_handle, ble_gap_conn_sec_t * const p_conn_sec) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_conn_sec; + + const uint32_t err_code = ble_gap_conn_sec_get_req_enc(conn_handle, p_conn_sec, + &(p_buffer[1]), &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_conn_sec_get_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_rssi_start BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_rssi_start_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_rssi_start_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_rssi_start(uint16_t conn_handle, uint8_t threshold_dbm, uint8_t skip_count) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_rssi_start_req_enc(conn_handle, + threshold_dbm, + skip_count, + &(p_buffer[1]), &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_rssi_start_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_rssi_stop BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_rssi_stop_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_rssi_stop_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_rssi_stop(uint16_t conn_handle) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_rssi_stop_req_enc(conn_handle, + &(p_buffer[1]), &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_rssi_stop_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_tx_power_set BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_tx_power_set_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_tx_power_set_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_tx_power_set(int8_t tx_power) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_tx_power_set_req_enc(tx_power, + &(p_buffer[1]), &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_tx_power_set_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_scan_stop BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_scan_stop_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_scan_stop_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_scan_stop(void) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_scan_stop_req_enc(&(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_scan_stop_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_connect BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_connect_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_connect_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_connect(ble_gap_addr_t const * const p_addr, + ble_gap_scan_params_t const * const p_scan_params, + ble_gap_conn_params_t const * const p_conn_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_connect_req_enc(p_addr, + p_scan_params, + p_conn_params, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_connect_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_connect_cancel BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_connect_cancel_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_connect_cancel_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gap_connect_cancel(void) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_connect_cancel_req_enc(&(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_connect_cancel_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_scan_start BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_scan_start_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_scan_start_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_scan_start(ble_gap_scan_params_t const * const p_scan_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_scan_start_req_enc(p_scan_params, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_scan_start_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_encrypt BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_encrypt_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_encrypt_rsp_dec(p_buffer, + length, + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +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) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gap_encrypt_req_enc( conn_handle, p_master_id, p_enc_info, &(p_buffer[1]), &buffer_length ); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_encrypt_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gap_rssi_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gap_rssi_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = 0; + + const uint32_t err_code = ble_gap_rssi_get_rsp_dec(p_buffer, + length, + (int8_t *) mp_out_params[0], + &result_code); + + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gap_rssi_get(uint16_t conn_handle, + int8_t * p_rssi) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_rssi; + + const uint32_t err_code = ble_gap_rssi_get_req_enc(conn_handle, p_rssi, &(p_buffer[1]), &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gap_rssi_get_rsp_dec); +} diff --git a/components/serialization/application/codecs/s130/middleware/app_mw_ble_gattc.c b/components/serialization/application/codecs/s130/middleware/app_mw_ble_gattc.c new file mode 100644 index 0000000..26cfab9 --- /dev/null +++ b/components/serialization/application/codecs/s130/middleware/app_mw_ble_gattc.c @@ -0,0 +1,426 @@ +/* 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 +#include "ble_gattc.h" +#include "ble_gattc_app.h" +#include "ble_serialization.h" +#include "ser_sd_transport.h" +#include "app_error.h" + +static void tx_buf_alloc(uint8_t * * p_data, uint16_t * p_len) +{ + uint32_t err_code; + + do + { + err_code = ser_sd_transport_tx_alloc(p_data, p_len); + } + while (err_code != NRF_SUCCESS); + *p_data[0] = SER_PKT_TYPE_CMD; + *p_len -= 1; +} +/**@brief Command response callback function for @ref sd_ble_gattc_primary_services_discover BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gattc_primary_services_discover_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gattc_primary_services_discover_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gattc_primary_services_discover(uint16_t conn_handle, + uint16_t start_handle, + ble_uuid_t const * const p_srvc_uuid) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gattc_primary_services_discover_req_enc(conn_handle, + start_handle, + p_srvc_uuid, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gattc_primary_services_discover_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gattc_relationships_discover BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gattc_relationships_discover_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gattc_relationships_discover_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gattc_relationships_discover(uint16_t conn_handle, + ble_gattc_handle_range_t const * const p_handle_range) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gattc_relationships_discover_req_enc(conn_handle, + p_handle_range, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gattc_relationships_discover_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gattc_characteristics_discover BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gattc_characteristics_discover_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gattc_characteristics_discover_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gattc_characteristics_discover( + uint16_t conn_handle, + ble_gattc_handle_range_t const * const + p_handle_range) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gattc_characteristics_discover_req_enc(conn_handle, + p_handle_range, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gattc_characteristics_discover_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gattc_descriptors_discover BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gattc_descriptors_discover_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gattc_descriptors_discover_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gattc_descriptors_discover(uint16_t conn_handle, + ble_gattc_handle_range_t const * const p_handle_range) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gattc_descriptors_discover_req_enc(conn_handle, + p_handle_range, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gattc_descriptors_discover_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gattc_char_value_by_uuid_read BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gattc_char_value_by_uuid_read_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gattc_char_value_by_uuid_read_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gattc_char_value_by_uuid_read(uint16_t conn_handle, + ble_uuid_t const * const p_uuid, + ble_gattc_handle_range_t const * const p_handle_range) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gattc_char_value_by_uuid_read_req_enc(conn_handle, + p_uuid, + p_handle_range, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gattc_char_value_by_uuid_read_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gattc_read BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gattc_read_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gattc_read_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gattc_read(uint16_t conn_handle, + uint16_t handle, + uint16_t offset) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gattc_read_req_enc(conn_handle, + handle, + offset, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gattc_read_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gattc_char_values_read BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gattc_char_values_read_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gattc_char_values_read_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gattc_char_values_read(uint16_t conn_handle, + uint16_t const * const p_handles, + uint16_t handle_count) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gattc_char_values_read_req_enc(conn_handle, + p_handles, + handle_count, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gattc_char_values_read_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gattc_write BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gattc_write_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gattc_write_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gattc_write(uint16_t conn_handle, + ble_gattc_write_params_t const * const p_write_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gattc_write_req_enc(conn_handle, + p_write_params, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gattc_write_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gattc_hv_confirm BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gattc_hv_confirm_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gattc_hv_confirm_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gattc_hv_confirm(uint16_t conn_handle, + uint16_t handle) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gattc_hv_confirm_req_enc(conn_handle, + handle, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gattc_hv_confirm_rsp_dec); +} diff --git a/components/serialization/application/codecs/s130/middleware/app_mw_ble_gatts.c b/components/serialization/application/codecs/s130/middleware/app_mw_ble_gatts.c new file mode 100644 index 0000000..abc1120 --- /dev/null +++ b/components/serialization/application/codecs/s130/middleware/app_mw_ble_gatts.c @@ -0,0 +1,571 @@ +/* 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 "ble_gatts.h" +#include +#include "ble_serialization.h" +#include "ser_sd_transport.h" +#include "ble_gatts_app.h" +#include "app_error.h" + + +//Pointer for sd calls output params +static void * mp_out_params[3]; + +static void tx_buf_alloc(uint8_t * * p_data, uint16_t * p_len) +{ + uint32_t err_code; + + do + { + err_code = ser_sd_transport_tx_alloc(p_data, p_len); + } + while (err_code != NRF_SUCCESS); + *p_data[0] = SER_PKT_TYPE_CMD; + *p_len -= 1; +} + +/**@brief Command response callback function for @ref sd_ble_gatts_sys_attr_set BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_sys_attr_set_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gatts_sys_attr_set_rsp_dec(p_buffer, length, &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gatts_sys_attr_set(uint16_t conn_handle, + uint8_t const * const p_sys_attr_data, + uint16_t len, + uint32_t flags) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gatts_sys_attr_set_req_enc(conn_handle, + p_sys_attr_data, + len, + flags, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_sys_attr_set_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gatts_hvx BLE command. + * + * Callback for decoding the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_hvx_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gatts_hvx_rsp_dec(p_buffer, length, &result_code, + (uint16_t * *)&mp_out_params[0]); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gatts_hvx(uint16_t conn_handle, ble_gatts_hvx_params_t const * const p_hvx_params) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = (p_hvx_params) ? p_hvx_params->p_len : NULL; + + const uint32_t err_code = ble_gatts_hvx_req_enc(conn_handle, + p_hvx_params, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_hvx_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gatts_service_add BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_service_add_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = + ble_gatts_service_add_rsp_dec(p_buffer, + length, + (uint16_t *)mp_out_params[0], + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_gatts_service_add(uint8_t type, + ble_uuid_t const * const p_uuid, + uint16_t * const p_handle) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_handle; + + const uint32_t err_code = ble_gatts_service_add_req_enc(type, + p_uuid, + p_handle, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_service_add_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gatts_service_add BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_service_changed_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = NRF_SUCCESS; + + const uint32_t err_code = ble_gatts_service_changed_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gatts_service_changed(uint16_t conn_handle, + uint16_t start_handle, + uint16_t end_handle) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_gatts_service_changed_req_enc(conn_handle, + start_handle, + end_handle, + &(p_buffer[1]), + &buffer_length); + + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_service_changed_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gatts_include_add BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_include_add_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = NRF_SUCCESS; + + const uint32_t err_code = + ble_gatts_include_add_rsp_dec(p_buffer, + length, + (uint16_t *) mp_out_params[0], + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gatts_include_add(uint16_t service_handle, + uint16_t inc_serv_handle, + uint16_t * const p_include_handle) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_include_handle; + + const uint32_t err_code = ble_gatts_include_add_req_enc(service_handle, + inc_serv_handle, + p_include_handle, + &(p_buffer[1]), + &buffer_length); + + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_include_add_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gatts_characteristic_add BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_characteristic_add_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gatts_characteristic_add_rsp_dec( + p_buffer, + length, + (uint16_t * *)&mp_out_params[0], + &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gatts_characteristic_add(uint16_t service_handle, + ble_gatts_char_md_t const * const p_char_md, + ble_gatts_attr_t const * const p_attr_char_value, + ble_gatts_char_handles_t * const p_handles) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_handles; + + const uint32_t err_code = ble_gatts_characteristic_add_req_enc(service_handle, + p_char_md, + p_attr_char_value, + p_handles, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_characteristic_add_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gatts_descriptor_add BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_descriptor_add_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = NRF_SUCCESS; + + const uint32_t err_code = + ble_gatts_descriptor_add_rsp_dec(p_buffer, + length, + (uint16_t *) mp_out_params[0], + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gatts_descriptor_add(uint16_t char_handle, + ble_gatts_attr_t const * const p_attr, + uint16_t * const p_handle) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_handle; + + const uint32_t err_code = ble_gatts_descriptor_add_req_enc(char_handle, + p_attr, + p_handle, + &(p_buffer[1]), + &buffer_length); + + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_descriptor_add_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gatts_rw_authorize_reply BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_rw_authorize_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code = NRF_SUCCESS; + + const uint32_t err_code = ble_gatts_rw_authorize_reply_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gatts_rw_authorize_reply( + uint16_t conn_handle, + ble_gatts_rw_authorize_reply_params_t const * const + p_rw_authorize_reply_params) +{ + + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = ble_gatts_rw_authorize_reply_req_enc(conn_handle, + p_rw_authorize_reply_params, + &(p_buffer[1]), + &buffer_length); + + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_rw_authorize_reply_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gatts_value_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_value_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gatts_value_get_rsp_dec(p_buffer, + length, + (ble_gatts_value_t *)mp_out_params[0], + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + +uint32_t sd_ble_gatts_value_get(uint16_t conn_handle, + uint16_t handle, + ble_gatts_value_t * p_value) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_value; + + const uint32_t err_code = ble_gatts_value_get_req_enc(conn_handle, + handle, + p_value, + &(p_buffer[1]), + &buffer_length); + + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_value_get_rsp_dec); +} + +/**@brief Command response callback function for @ref sd_ble_gatts_value_set BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_value_set_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gatts_value_set_rsp_dec( + p_buffer, + length, + (ble_gatts_value_t *)mp_out_params[0], + &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gatts_value_set(uint16_t conn_handle, + uint16_t handle, + ble_gatts_value_t * p_value) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_value; + + const uint32_t err_code = ble_gatts_value_set_req_enc(conn_handle, + handle, + p_value, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_value_set_rsp_dec); +} + + +/**@brief Command response callback function for @ref sd_ble_gatts_sys_attr_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t gatts_sys_attr_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = ble_gatts_sys_attr_get_rsp_dec( + p_buffer, + length, + (uint8_t *) mp_out_params[0], + (uint16_t *) mp_out_params[1], + &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_gatts_sys_attr_get(uint16_t conn_handle, + uint8_t * const p_sys_attr_data, + uint16_t * const p_len, + uint32_t flags) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + mp_out_params[0] = p_sys_attr_data; + mp_out_params[1] = p_len; + + const uint32_t err_code = ble_gatts_sys_attr_get_req_enc(conn_handle, + p_sys_attr_data, + p_len, + flags, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + gatts_sys_attr_get_rsp_dec); +} diff --git a/components/serialization/application/codecs/s130/middleware/app_mw_ble_l2cap.c b/components/serialization/application/codecs/s130/middleware/app_mw_ble_l2cap.c new file mode 100644 index 0000000..436d5a2 --- /dev/null +++ b/components/serialization/application/codecs/s130/middleware/app_mw_ble_l2cap.c @@ -0,0 +1,165 @@ +/* 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 "ble_gap.h" +#include +#include "ble_serialization.h" +#include "ser_sd_transport.h" +#include "ble_l2cap_app.h" +#include "app_error.h" + +static void tx_buf_alloc(uint8_t * * p_data, uint16_t * p_len) +{ + uint32_t err_code; + + do + { + err_code = ser_sd_transport_tx_alloc(p_data, p_len); + } + while (err_code != NRF_SUCCESS); + *p_data[0] = SER_PKT_TYPE_CMD; + *p_len -= 1; +} +/**@brief Command response callback function for @ref ble_l2cap_cid_register_req_enc BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t l2cap_cid_register_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = + ble_l2cap_cid_register_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + + +uint32_t sd_ble_l2cap_cid_register(uint16_t cid) +{ + + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_l2cap_cid_register_req_enc(cid, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + l2cap_cid_register_rsp_dec); +} + +/**@brief Command response callback function for @ref ble_l2cap_cid_unregister_req_enc BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t l2cap_cid_unregister_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = + ble_l2cap_cid_unregister_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_l2cap_cid_unregister(uint16_t cid) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_l2cap_cid_unregister_req_enc(cid, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + l2cap_cid_unregister_rsp_dec); +} + +/**@brief Command response callback function for @ref ble_l2cap_tx_req_enc BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ +static uint32_t l2cap_tx_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = + ble_l2cap_tx_rsp_dec(p_buffer, + length, + &result_code); + + APP_ERROR_CHECK(err_code); + + + + return result_code; +} + + +uint32_t sd_ble_l2cap_tx(uint16_t conn_handle, + ble_l2cap_header_t const * const p_header, + uint8_t const * const p_data) +{ + + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = ble_l2cap_tx_req_enc(conn_handle, p_header, p_data, + &(p_buffer[1]), + &buffer_length); + //@note: Should never fail. + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + l2cap_tx_rsp_dec); +} + diff --git a/components/serialization/application/codecs/s130/middleware/app_mw_nrf_soc.c b/components/serialization/application/codecs/s130/middleware/app_mw_nrf_soc.c new file mode 100644 index 0000000..6a636c8 --- /dev/null +++ b/components/serialization/application/codecs/s130/middleware/app_mw_nrf_soc.c @@ -0,0 +1,100 @@ +/* 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 "nrf_soc.h" +#include +#include +#include "ser_sd_transport.h" +#include "nrf_soc_app.h" +#include "nrf_error_soc.h" +#include "app_error.h" +#include "ble_serialization.h" + +#include "ser_app_power_system_off.h" + +static void * mp_out_param; + +static void tx_buf_alloc(uint8_t * * p_data, uint16_t * p_len) +{ + uint32_t err_code; + + do + { + err_code = ser_sd_transport_tx_alloc(p_data, p_len); + } + while (err_code != NRF_SUCCESS); + *p_data[0] = SER_PKT_TYPE_CMD; + *p_len -= 1; +} + + +uint32_t sd_power_system_off(void) +{ + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + const uint32_t err_code = power_system_off_req_enc(&(p_buffer[1]), &buffer_length); + APP_ERROR_CHECK(err_code); + + ser_app_power_system_off_set(); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + NULL); +} + + +/**@brief Command response callback function for @ref sd_temp_get BLE command. + * + * Callback for decoding the output parameters and the command response return code. + * + * @param[in] p_buffer Pointer to begin of command response buffer. + * @param[in] length Length of data in bytes. + * + * @return Decoded command response return code. + */ + +static uint32_t mw_temp_get_rsp_dec(const uint8_t * p_buffer, uint16_t length) +{ + uint32_t result_code; + + const uint32_t err_code = temp_get_rsp_dec(p_buffer, + length, + &result_code, + (int32_t *)mp_out_param); + + APP_ERROR_CHECK(err_code); + + return result_code; +} + +uint32_t sd_temp_get(int32_t * p_temp) +{ + mp_out_param = p_temp; + + uint8_t * p_buffer; + uint32_t buffer_length = 0; + + tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length); + + const uint32_t err_code = temp_get_req_enc(p_temp, + &(p_buffer[1]), + &buffer_length); + APP_ERROR_CHECK(err_code); + + //@note: Increment buffer length as internally managed packet type field must be included. + return ser_sd_transport_cmd_write(p_buffer, + (++buffer_length), + mw_temp_get_rsp_dec); +} diff --git a/components/serialization/application/codecs/s130/serializers/app_ble_gap_sec_keys.c b/components/serialization/application/codecs/s130/serializers/app_ble_gap_sec_keys.c new file mode 100644 index 0000000..066deb3 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/app_ble_gap_sec_keys.c @@ -0,0 +1,73 @@ +/* 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_ble_gap_sec_keys.h" +#include "nrf_error.h" +#include + +ser_ble_gap_app_keyset_t m_app_keys_table[SER_MAX_CONNECTIONS]; + +uint32_t app_ble_gap_sec_context_create(uint16_t conn_handle, uint32_t *p_index) +{ + uint32_t err_code = NRF_ERROR_NO_MEM; + uint32_t i; + + for (i=0; i + +#define SER_MAX_CONNECTIONS 2 + +/**@brief GAP connection - keyset mapping structure. + * + * @note This structure is used to map keysets to connection instances, and will be stored in a static table. + */ +typedef struct +{ + uint16_t conn_handle; /**< Connection handle.*/ + uint8_t conn_active; /**< Indication that keys for this connection are used by soft device. 0: keys used; 1: keys not used*/ + ble_gap_sec_keyset_t keyset; /**< Keyset structure, see @ref ble_gap_sec_keyset_t.*/ +} ser_ble_gap_app_keyset_t; + +/**@brief allocates instance in m_app_keys_table[] for storage of encryption keys. + * + * @param[in] conn_handle conn_handle + * @param[out] p_index pointer to the index of allocated instance + * + * @retval NRF_SUCCESS Context allocated. + * @retval NRF_ERROR_NO_MEM No free instance available. + */ +uint32_t app_ble_gap_sec_context_create(uint16_t conn_handle, uint32_t *p_index); + +/**@brief release instance identified by a connection handle. + * + * @param[in] conn_handle conn_handle + * + * @retval NRF_SUCCESS Context released. + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t app_ble_gap_sec_context_destroy(uint16_t conn_handle); + +/**@brief finds index of instance identified by a connection handle in m_app_keys_table[]. + * + * @param[in] conn_handle conn_handle + * + * @param[out] p_index Pointer to the index of the entry in the context table corresponding to the given conn_handle + * + * @retval NRF_SUCCESS Context found + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t app_ble_gap_sec_context_find(uint16_t conn_handle, uint32_t *p_index); +/** @} */ + +#endif //_APP_BLE_GAP_SEC_KEYS_H diff --git a/components/serialization/application/codecs/s130/serializers/app_ble_user_mem.c b/components/serialization/application/codecs/s130/serializers/app_ble_user_mem.c new file mode 100644 index 0000000..c476020 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/app_ble_user_mem.c @@ -0,0 +1,74 @@ +/* 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_ble_user_mem.h" +#include "ser_config.h" +#include "nrf_error.h" +#include + +ser_ble_user_mem_t m_app_user_mem_table[SER_MAX_CONNECTIONS]; + +uint32_t app_ble_user_mem_context_create(uint16_t conn_handle, uint32_t *p_index) +{ + uint32_t err_code = NRF_ERROR_NO_MEM; + uint32_t i; + + for (i=0; i + +/**@brief Connection - user memory mapping structure. + * + * @note This structure is used to map user memory to connection instances, and will be stored in a static table. + */ +//lint -esym(452,ser_ble_user_mem_t) +typedef struct +{ + uint16_t conn_handle; /**< Connection handle.*/ + uint8_t conn_active; /**< Indication that user memory for this connection is used by soft device. 0: memory used; 1: memory not used*/ + ble_user_mem_block_t mem_block; /**< User memory block structure, see @ref ble_user_mem_block_t.*/ +} ser_ble_user_mem_t; + +/**@brief allocates instance in m_user_mem_table[] for storage. + * + * @param[in] conn_handle conn_handle + * @param[out] p_index pointer to the index of allocated instance + * + * @retval NRF_SUCCESS Context allocated. + * @retval NRF_ERROR_NO_MEM No free instance available. + */ +uint32_t app_ble_user_mem_context_create(uint16_t conn_handle, uint32_t *p_index); + +/**@brief release instance identified by a connection handle. + * + * @param[in] conn_handle conn_handle + * + * @retval NRF_SUCCESS Context released. + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t app_ble_user_mem_context_destroy(uint16_t conn_handle); + +/**@brief finds index of instance identified by a connection handle in m_user_mem_table[]. + * + * @param[in] conn_handle conn_handle + * + * @param[out] p_index Pointer to the index of the entry in the context table corresponding to the given conn_handle + * + * @retval NRF_SUCCESS Context found + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t app_ble_user_mem_context_find(uint16_t conn_handle, uint32_t *p_index); +/** @} */ + +#endif //_APP_BLE_USER_MEM_H diff --git a/components/serialization/application/codecs/s130/serializers/ble_app.h b/components/serialization/application/codecs/s130/serializers/ble_app.h new file mode 100644 index 0000000..5bce44c --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_app.h @@ -0,0 +1,445 @@ +/* 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. + * + */ +#ifndef BLE_APP_H__ +#define BLE_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s130_codecs Application s130 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_app Application command request encoders and command response decoders + * @{ + * @ingroup ser_app_s130_codecs + * + * @brief Application command request encoders and command response decoders. + */ +#include "ble.h" +/** + * @brief Encodes @ref sd_ble_tx_buffer_count_get command request. + * + * @sa @ref nrf51_tx_buffer_count_get_encoding for packet format, + * @ref ble_tx_buffer_count_get_rsp_dec for command response decoder. + * + * @param[in] p_count Pointer to count value to be filled. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_count will not be updated by the command + * request encoder. Updated values are set by @ref ble_tx_buffer_count_get_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_tx_buffer_count_get_req_enc(uint8_t const * const p_count, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_tx_buffer_count_get command. + * + * @sa @ref nrf51_tx_buffer_count_get_encoding for packet format, + * @ref ble_tx_buffer_count_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_count Pointer to pointer to count value. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_tx_buffer_count_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * * const pp_count, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_uuid_encode command request. + * + * @sa @ref nrf51_uuid_encode_encoding for packet format, + * @ref ble_uuid_encode_rsp_dec for command response decoder. + * + * @param[in] p_uuid Pointer to a @ref ble_uuid_t structure that will be encoded into bytes. + * @param[in] p_uuid_le_len Size of \p p_uuid_le if \p p_uuid_le is not NULL + * @param[in] p_uuid_le Pointer to a buffer where the little endian raw UUID bytes(2 or 16) + * will be stored. Can be NULL to calculate required size. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_uuid_le_len and \p p_uuid_le will not be updated by the command + * request encoder. Updated values are set by @ref ble_uuid_encode_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_uuid_encode_req_enc(ble_uuid_t const * const p_uuid, + uint8_t const * const p_uuid_le_len, + uint8_t const * const p_uuid_le, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_uuid_encode command. + * + * @sa @ref nrf51_uuid_encode_encoding for packet format, + * @ref ble_uuid_encode_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[in,out] p_uuid_le_len \c in: Size (in bytes) of \p p_uuid_le buffer. + * \c out: Length of decoded contents of \p p_uuid_le. + * @param[out] p_uuid_le Pointer to a buffer where the encoded UUID will be stored. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Length of \p p_uuid_le is too small to hold decoded + * value from response. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_uuid_encode_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * const p_uuid_le_len, + uint8_t * const p_uuid_le, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_uuid_decode command request. + * + * @sa @ref nrf51_uuid_decode_encoding for packet format, + * @ref ble_uuid_decode_rsp_dec for command response decoder. + * + * @param[in] uuid_le_len Size of \p p_uuid_le if \p p_uuid_le is not NULL + * @param[in] p_uuid_le Pointer to a buffer where the little endian raw UUID bytes(2 or 16) + * is stored. + * @param[out] p_uuid Pointer to a @ref ble_uuid_t structure were raw UUID will be decoded. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_uuid will not be updated by the command request encoder. + * Updated values are set by @ref ble_uuid_decode_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_uuid_decode_req_enc(uint8_t uuid_le_len, + uint8_t const * const p_uuid_le, + ble_uuid_t * const p_uuid, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_uuid_decode command. + * + * @sa @ref nrf51_uuid_decode_encoding for packet format, + * @ref ble_uuid_decode_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_uuid Pointer to a buffer where the decoded UUID will be stored. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_uuid_decode_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_uuid_t * * const p_uuid, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_uuid_vs_add command request. + * + * @sa @ref nrf51_uuid_vs_add_encoding for packet format, + * @ref ble_uuid_vs_add_rsp_dec for command response decoder. + * + * @param[in] p_vs_uuid Pointer to a @ref ble_uuid128_t structure. + * @param[in] p_uuid_type Pointer to uint8_t where UUID type will be returned. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_uuid_type will not be updated by the command request encoder. + * Updated values are set by @ref ble_uuid_vs_add_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_uuid_vs_add_req_enc(ble_uuid128_t const * const p_vs_uuid, + uint8_t * const p_uuid_type, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_uuid_vs_add command. + * + * @sa @ref nrf51_uuid_vs_add_encoding for packet format, + * @ref ble_uuid_vs_add_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] buf_len Length (in bytes) of response packet. + * @param[out] pp_uuid_type Pointer to a pointer to uint8_t where the decoded UUID type will be stored. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_uuid_vs_add_rsp_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint8_t * * const pp_uuid_type, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_version_get command request. + * + * @sa @ref nrf51_version_get_encoding for packet format, + * @ref ble_version_get_rsp_dec for command response decoder. + * + * @param[in] p_version Pointer to a @ref ble_version_t structure to be filled by the response. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_version_get_req_enc(ble_version_t const * const p_version, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_version_get command. + * + * @sa @ref nrf51_version_get_encoding for packet format, + * @ref ble_version_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_version Pointer to a @ref ble_version_t where decoded version will be stored. + * @param[out] p_result_code Command result code. + * + * @return NRF_SUCCESS Version information stored successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_version_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_version_t * p_version, + uint32_t * const p_result_code); + + +/**@brief Encodes @ref sd_ble_opt_set command request. + * + * @sa @ref nrf51_opt_set_encoding for packet format, + * @ref ble_opt_set_rsp_dec for command response decoder. + * + * @param[in] opt_id Identifies type of parameter in ble_opt_t union. + * @param[in] p_opt Pointer to ble_opt_t union. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Invalid opt id. + */ +uint32_t ble_opt_set_req_enc(uint32_t const opt_id, + ble_opt_t const * const p_opt, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_opt_set command. + * + * @sa @ref nrf51_opt_set_encoding for packet format, + * @ref ble_opt_set_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @return NRF_SUCCESS Version information stored successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_opt_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_enable command request. + * + * @sa @ref nrf51_enable_encoding for packet format, + * @ref ble_enable_rsp_dec for command response decoder. + * + * @param[in] p_ble_enable_params Pointer to a @ref ble_enable_params_t structure. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_enable_req_enc(ble_enable_params_t * p_ble_enable_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_enable command. + * + * @sa @ref nrf51_enable_encoding for packet format, + * @ref ble_enable_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @return NRF_SUCCESS Success. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_enable_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_opt_get command request. + * + * @sa @ref nrf51_opt_get_encoding for packet format, + * @ref ble_opt_get_rsp_dec for command response decoder. + * + * @param[in] opt_id Identifies type of parameter in ble_opt_t union. + * @param[in] p_opt Pointer to a @ref ble_opt_t union to be filled by the response. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Invalid opt id. + */ +uint32_t ble_opt_get_req_enc(uint32_t opt_id, + ble_opt_t const * const p_opt, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_opt_get command. + * + * @sa @ref nrf51_opt_get_encoding for packet format, + * @ref ble_opt_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_opt_id Pointer to a decoded opt_id + * @param[out] p_opt Pointer to a decoded @ref ble_opt_t union + * @param[out] p_result_code Command result code. + * + * @return NRF_SUCCESS Opt stored successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + * @retval NRF_ERROR_INVALID_PARAM Invalid opt id. + */ + +uint32_t ble_opt_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_opt_id, + ble_opt_t * const p_opt, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_user_mem_reply command request. + * + * @sa @ref nrf51_user_mem_reply_encoding for packet format, + * @ref ble_user_mem_reply_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection Handle. + * @param[in] p_block Pointer to a @ref ble_user_mem_block_t structure. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Invalid opt id. + */ +uint32_t ble_user_mem_reply_req_enc(uint16_t conn_handle, + ble_user_mem_block_t const * p_block, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_user_mem_reply command. + * + * @sa @ref nrf51_user_mem_reply_encoding for packet format, + * @ref ble_user_mem_reply_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @return NRF_SUCCESS Opt stored successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + * @retval NRF_ERROR_INVALID_PARAM Invalid opt id. + */ +uint32_t ble_user_mem_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Event decoding dispatcher. + * + * The event decoding dispatcher will route the event packet to the correct decoder which in turn + * decodes the contents of the event and updates the \p p_event struct. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to beginning of event packet. + * @param[in] packet_len Length (in bytes) of event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + * @retval NRF_ERROR_NOT_FOUND Decoding failure. No event decoder is available. + */ +uint32_t ble_event_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** @} */ +#endif diff --git a/components/serialization/application/codecs/s130/serializers/ble_enable.c b/components/serialization/application/codecs/s130/serializers/ble_enable.c new file mode 100644 index 0000000..09db16a --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_enable.c @@ -0,0 +1,50 @@ +/* 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 +#include +#include "ble_app.h" +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + + +uint32_t ble_enable_req_enc(ble_enable_params_t * p_ble_enable_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 2, *p_buf_len); + + p_buf[index++] = SD_BLE_ENABLE; + + err_code = cond_field_enc(p_ble_enable_params, p_buf, *p_buf_len, &index, ble_enable_params_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_enable_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_ENABLE, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_event.c b/components/serialization/application/codecs/s130/serializers/ble_event.c new file mode 100644 index 0000000..6573cd6 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_event.c @@ -0,0 +1,241 @@ +/* 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 "ble_app.h" +#include "ble_evt_app.h" +#include "ble_gap_evt_app.h" +#include "ble_gattc_evt_app.h" +#include "ble_gatts_evt_app.h" +#include "ble_l2cap_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_event_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + SER_ASSERT_LENGTH_LEQ(SER_EVT_HEADER_SIZE, packet_len); + + + const uint16_t event_id = uint16_decode(&p_buf[SER_EVT_ID_POS]); + const uint8_t * p_sub_buffer = &p_buf[SER_EVT_HEADER_SIZE]; + const uint32_t sub_packet_len = packet_len - SER_EVT_HEADER_SIZE; + + if (p_event) + { + SER_ASSERT_LENGTH_LEQ(sizeof (ble_evt_hdr_t), *p_event_len); + *p_event_len -= sizeof (ble_evt_hdr_t); + } + + switch (event_id) + { + case BLE_EVT_TX_COMPLETE: + err_code = ble_evt_tx_complete_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_EVT_USER_MEM_REQUEST: + err_code = ble_evt_user_mem_request_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_EVT_USER_MEM_RELEASE: + err_code = ble_evt_user_mem_release_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GAP_EVT_PASSKEY_DISPLAY: + err_code = ble_gap_evt_passkey_display_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GAP_EVT_AUTH_KEY_REQUEST: + err_code = ble_gap_evt_auth_key_request_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GAP_EVT_CONN_PARAM_UPDATE: + err_code = ble_gap_evt_conn_param_update_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST: + err_code = ble_gap_evt_conn_param_update_request_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GAP_EVT_CONN_SEC_UPDATE: + err_code = ble_gap_evt_conn_sec_update_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GAP_EVT_CONNECTED: + err_code = ble_gap_evt_connected_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GAP_EVT_DISCONNECTED: + err_code = ble_gap_evt_disconnected_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GAP_EVT_TIMEOUT: + err_code = ble_gap_evt_timeout_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GAP_EVT_RSSI_CHANGED: + err_code = ble_gap_evt_rssi_changed_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GAP_EVT_SEC_INFO_REQUEST: + err_code = ble_gap_evt_sec_info_request_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GAP_EVT_SEC_PARAMS_REQUEST: + err_code = ble_gap_evt_sec_params_request_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GAP_EVT_AUTH_STATUS: + err_code = ble_gap_evt_auth_status_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GAP_EVT_SEC_REQUEST: + err_code = ble_gap_evt_sec_request_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GATTC_EVT_CHAR_DISC_RSP: + err_code = ble_gattc_evt_char_disc_rsp_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP: + err_code = ble_gattc_evt_char_val_by_uuid_read_rsp_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GATTC_EVT_DESC_DISC_RSP: + err_code = ble_gattc_evt_desc_disc_rsp_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP: + err_code = ble_gattc_evt_prim_srvc_disc_rsp_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GATTC_EVT_READ_RSP: + err_code = ble_gattc_evt_read_rsp_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GATTC_EVT_HVX: + err_code = ble_gattc_evt_hvx_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GATTC_EVT_TIMEOUT: + err_code = ble_gattc_evt_timeout_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GATTC_EVT_WRITE_RSP: + err_code = ble_gattc_evt_write_rsp_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GATTC_EVT_CHAR_VALS_READ_RSP: + err_code = ble_gattc_evt_char_vals_read_rsp_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GATTC_EVT_REL_DISC_RSP: + err_code = ble_gattc_evt_rel_disc_rsp_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GATTS_EVT_WRITE: + err_code = ble_gatts_evt_write_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GATTS_EVT_TIMEOUT: + err_code = ble_gatts_evt_timeout_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GATTS_EVT_SC_CONFIRM: + err_code = ble_gatts_evt_sc_confirm_dec(p_sub_buffer, + sub_packet_len, + p_event, + p_event_len); + break; + + case BLE_GATTS_EVT_HVC: + err_code = ble_gatts_evt_hvc_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GATTS_EVT_SYS_ATTR_MISSING: + err_code = ble_gatts_evt_sys_attr_missing_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST: + err_code = ble_gatts_evt_rw_authorize_request_dec(p_sub_buffer, sub_packet_len, p_event, + p_event_len); + break; + + case BLE_L2CAP_EVT_RX: + err_code = ble_l2cap_evt_rx_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GAP_EVT_ADV_REPORT: + err_code = ble_gap_evt_adv_report_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + case BLE_GAP_EVT_SCAN_REQ_REPORT: + err_code = ble_gap_evt_scan_req_report_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len); + break; + + default: + err_code = NRF_ERROR_NOT_FOUND; + break; + } + + if (p_event != NULL) + { + p_event->header.evt_id = (err_code == NRF_SUCCESS) ? event_id : 0; + p_event->header.evt_len = (err_code == NRF_SUCCESS) ? + (uint16_t)*p_event_len : 0; + } + *p_event_len += sizeof(ble_evt_hdr_t); + return err_code; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_evt_app.h b/components/serialization/application/codecs/s130/serializers/ble_evt_app.h new file mode 100644 index 0000000..318a91a --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_evt_app.h @@ -0,0 +1,111 @@ +/* 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 BLE_EVT_APP_H__ +#define BLE_EVT_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s130_codecs Application s130 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_evt_app Application event decoders + * @{ + * @ingroup ser_app_s130_codecs + * + * @brief Application event decoders. + */ +#include "ble.h" + +/** + * @brief Decodes ble_evt_tx_complete event. + * + * @sa @ref nrf51_evt_tx_complete_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_evt_tx_complete_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_evt_user_mem_request event. + * + * @sa @ref nrf51_evt_user_mem_request_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ + uint32_t ble_evt_user_mem_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_evt_user_mem_release event. + * + * @sa @ref nrf51_evt_user_mem_release_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ + uint32_t ble_evt_user_mem_release_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** @} */ +#endif diff --git a/components/serialization/application/codecs/s130/serializers/ble_evt_tx_complete.c b/components/serialization/application/codecs/s130/serializers/ble_evt_tx_complete.c new file mode 100644 index 0000000..4abf73c --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_evt_tx_complete.c @@ -0,0 +1,49 @@ +/* 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 "ble_evt_app.h" +#include "ble_serialization.h" + + +uint32_t ble_evt_tx_complete_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 1, packet_len); + + uint32_t event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_evt_tx_complete_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_EVT_TX_COMPLETE; + p_event->header.evt_len = event_len; + + uint16_dec(p_buf, packet_len, &index, &p_event->evt.common_evt.conn_handle); + uint8_dec(p_buf, packet_len, &index, &p_event->evt.common_evt.params.tx_complete.count); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_evt_user_mem_release.c b/components/serialization/application/codecs/s130/serializers/ble_evt_user_mem_release.c new file mode 100644 index 0000000..54efc5f --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_evt_user_mem_release.c @@ -0,0 +1,79 @@ +/* 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 "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" +#include "ble_evt_app.h" +#include "app_ble_user_mem.h" + +extern ser_ble_user_mem_t m_app_user_mem_table[]; + +uint32_t ble_evt_user_mem_release_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_event_len); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.common_evt.params.user_mem_release)) + + sizeof (ble_evt_user_mem_release_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + p_event->header.evt_id = BLE_EVT_USER_MEM_RELEASE; + p_event->header.evt_len = event_len; + ble_evt_user_mem_release_t * p_user_mem_rel = &(p_event->evt.common_evt.params.user_mem_release); + + err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.common_evt.conn_handle)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, packet_len, &index, &(p_user_mem_rel->type)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + // Decoding order of mem block is different than structure elements order - length is decoded first + err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_user_mem_rel->mem_block.len)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (p_buf[index++] == SER_FIELD_PRESENT) + { + // Using connection handle find which mem block to release in Application Processor + uint32_t user_mem_table_index; + err_code = app_ble_user_mem_context_find(p_event->evt.common_evt.conn_handle, &user_mem_table_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_user_mem_rel->mem_block.p_mem = m_app_user_mem_table[user_mem_table_index].mem_block.p_mem; + } + else + { + p_user_mem_rel->mem_block.p_mem = NULL; + } + + // Now user memory context can be released + err_code = app_ble_user_mem_context_destroy(p_event->evt.common_evt.conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return err_code; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_evt_user_mem_request.c b/components/serialization/application/codecs/s130/serializers/ble_evt_user_mem_request.c new file mode 100644 index 0000000..891f759 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_evt_user_mem_request.c @@ -0,0 +1,53 @@ +/* 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 "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" +#include "ble_evt_app.h" + +uint32_t ble_evt_user_mem_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_event_len); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.common_evt.params.user_mem_request)) + + sizeof (ble_evt_user_mem_request_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + p_event->header.evt_id = BLE_EVT_USER_MEM_REQUEST; + p_event->header.evt_len = event_len; + + err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.common_evt.conn_handle)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, packet_len, &index, &(p_event->evt.common_evt.params.user_mem_request.type)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return err_code; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_address_get.c b/components/serialization/application/codecs/s130/serializers/ble_gap_address_get.c new file mode 100644 index 0000000..4af2bc4 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_address_get.c @@ -0,0 +1,75 @@ +/* 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 "ble_gap_app.h" +#include +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_address_get_req_enc(ble_gap_addr_t const * const p_address, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_ADDRESS_GET; + p_buf[index++] = (p_address == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_address_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_addr_t * const p_address, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t index = 0; + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, + &index, + packet_len, + SD_BLE_GAP_ADDRESS_GET, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + SER_ASSERT_LENGTH_LEQ(index + 1 + BLE_GAP_ADDR_LEN, packet_len); + SER_ASSERT_NOT_NULL(p_address); + + p_address->addr_type = p_buf[index++]; + memcpy(p_address->addr, &p_buf[index], BLE_GAP_ADDR_LEN); + index += BLE_GAP_ADDR_LEN; + + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_address_set.c b/components/serialization/application/codecs/s130/serializers/ble_gap_address_set.c new file mode 100644 index 0000000..8acaa61 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_address_set.c @@ -0,0 +1,60 @@ +/* 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 "ble_gap_app.h" +#include +#include +#include "ble_serialization.h" +#include "ble_gap.h" +#include "app_util.h" + + +uint32_t ble_gap_address_set_req_enc(uint8_t addr_cycle_mode, + ble_gap_addr_t const * const p_addr, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 1 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_ADDRESS_SET; + + err_code = uint8_t_enc(&addr_cycle_mode, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + p_buf[index++] = (p_addr == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + if (p_addr != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 1 + BLE_GAP_ADDR_LEN, *p_buf_len); + p_buf[index++] = p_addr->addr_type; + memcpy(&p_buf[index], p_addr->addr, BLE_GAP_ADDR_LEN); + index += BLE_GAP_ADDR_LEN; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_address_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_ADDRESS_SET, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_adv_data_set.c b/components/serialization/application/codecs/s130/serializers/ble_gap_adv_data_set.c new file mode 100644 index 0000000..a59f271 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_adv_data_set.c @@ -0,0 +1,52 @@ +/* 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 "ble_gap_app.h" +#include +#include "ble_serialization.h" +#include "nrf_error.h" + + +uint32_t ble_gap_adv_data_set_req_enc(uint8_t const * const p_data, + uint8_t dlen, + uint8_t const * const p_sr_data, + uint8_t srdlen, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint8_t opcode = SD_BLE_GAP_ADV_DATA_SET; + uint32_t err_code; + err_code = uint8_t_enc(&opcode, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = len8data_enc(p_data, dlen, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = len8data_enc(p_sr_data, srdlen, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gap_adv_data_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_ADV_DATA_SET, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_adv_start.c b/components/serialization/application/codecs/s130/serializers/ble_gap_adv_start.c new file mode 100644 index 0000000..115a447 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_adv_start.c @@ -0,0 +1,72 @@ +/* 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 "ble_gap_app.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gap.h" +#include "app_util.h" + +uint32_t ble_gap_adv_start_req_enc(ble_gap_adv_params_t const * const p_adv_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + SER_ASSERT_LENGTH_LEQ(index + 2, total_len); + p_buf[index++] = SD_BLE_GAP_ADV_START; + p_buf[index++] = (p_adv_params == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + if (p_adv_params != NULL) + { + err_code = uint8_t_enc(&(p_adv_params->type), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_adv_params->p_peer_addr, p_buf, total_len, &index, ble_gap_addr_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&(p_adv_params->fp), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_adv_params->p_whitelist, p_buf, total_len, &index, ble_gap_whitelist_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_adv_params->interval), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_adv_params->timeout), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_adv_ch_mask_t_enc(&(p_adv_params->channel_mask), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gap_adv_start_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_ADV_START, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_adv_stop.c b/components/serialization/application/codecs/s130/serializers/ble_gap_adv_stop.c new file mode 100644 index 0000000..c633a4b --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_adv_stop.c @@ -0,0 +1,40 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" + +uint32_t ble_gap_adv_stop_req_enc(uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GAP_ADV_STOP; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gap_adv_stop_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_ADV_STOP, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_app.h b/components/serialization/application/codecs/s130/serializers/ble_gap_app.h new file mode 100644 index 0000000..56b936a --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_app.h @@ -0,0 +1,1159 @@ +/* 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. + * + */ +#ifndef BLE_GAP_APP_H__ +#define BLE_GAP_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s130_codecs Application s130 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gap_app GAP Application command request encoders and command response decoders + * @{ + * @ingroup ser_app_s130_codecs + * + * @brief GAP Application command request encoders and command response decoders. + */ +#include "ble.h" +#include "ble_gap.h" + +/** + * @brief Encodes @ref sd_ble_gap_address_get command request. + * + * @sa @ref nrf51_address_get_encoding for packet format, + * @ref ble_gap_address_get_rsp_dec for command response decoder. + * + * @param[in] p_address Pointer to address. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_address will not be updated by the command + * request encoder. Updated values are set by @ref ble_gap_address_get_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_address_get_req_enc(ble_gap_addr_t const * const p_address, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_address_get command. + * + * @sa @ref nrf51_address_get_encoding for packet format, + * @ref ble_gap_address_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_address Pointer to address. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_address_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_addr_t * const p_address, + uint32_t * const p_result_code); + +/** + * @brief Encodes @ref sd_ble_gap_address_set command request. + * + * @sa @ref nrf51_gap_address_set_encoding for packet format, + * @ref ble_gap_address_set_rsp_dec for command response decoder. + * + * @param[in] addr_cycle_mode Address cycle mode. + * @param[in] p_addr Pointer to address structure. + * @param[in,out] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_address_set_req_enc(uint8_t addr_cycle_mode, + ble_gap_addr_t const * const p_addr, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_address_set command. + * + * @sa @ref nrf51_gap_address_set_encoding for packet format, + * @ref ble_gap_address_set_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_address_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/** + * @brief Encodes @ref sd_ble_gap_adv_data_set command request. + * + * @sa @ref nrf51_adv_set_encoding for packet format, + * @ref ble_gap_adv_data_set_rsp_dec for command response decoder. + * + * @param[in] p_data Raw data to be placed in advertisement packet. If NULL, no changes + * are made to the current advertisement 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. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_adv_data_set_req_enc(uint8_t const * const p_data, + uint8_t dlen, + uint8_t const * const p_sr_data, + uint8_t srdlen, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_adv_data_set command. + * + * @sa @ref nrf51_adv_set_encoding for packet format, + * @ref ble_gap_adv_data_set_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_adv_data_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/** + * @brief Encodes @ref sd_ble_gap_adv_start command request. + * + * @sa @ref nrf51_adv_start_encoding for packet format, + * @ref ble_gap_adv_start_rsp_dec for command response decoder. + * + * @param[in] p_adv_params Pointer to advertising parameters structure. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_adv_start_req_enc(ble_gap_adv_params_t const * const p_adv_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_adv_start command. + * + * @sa @ref nrf51_adv_start_encoding for packet format, + * @ref ble_gap_adv_start_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_adv_start_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/** + * @brief Encodes @ref sd_ble_gap_tx_power_set command request. + * + * @sa @ref nrf51_tx_power_set_encoding for packet format, + * @ref ble_gap_tx_power_set_rsp_dec for command response decoder. + * + * @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] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_tx_power_set_req_enc(int8_t tx_power, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_tx_power_set command. + * + * @sa @ref nrf51_tx_power_set_encoding for packet format, + * @ref ble_gap_tx_power_set_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_tx_power_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/** + * @brief Encodes @ref sd_ble_gap_appearance_get command request. + * + * @sa @ref nrf51_appearance_get_encoding for packet format, + * @ref ble_gap_appearance_get_rsp_dec for command response decoder. + * + * @param[in] p_appearance Appearance (16-bit), see @ref BLE_APPEARANCES + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_appearance will not be updated by the command + * request encoder. Updated values are set by @ref ble_gap_appearance_get_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_appearance_get_req_enc(uint16_t const * const p_appearance, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_appearance_get command. + * + * @sa @ref nrf51_appearance_get_encoding for packet format, + * @ref ble_gap_appearance_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_appearance Appearance (16-bit), see @ref BLE_APPEARANCES. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_appearance_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_appearance, + uint32_t * const p_result_code); + +/** + * @brief Encodes @ref sd_ble_gap_appearance_set command request. + * + * @sa @ref nrf51_appearance_set_encoding for packet format, + * @ref ble_gap_appearance_set_rsp_dec for command response decoder. + * + * @param[in] appearance Appearance (16-bit), see @ref BLE_APPEARANCES. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_appearance_set_req_enc(uint16_t appearance, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_appearance_set command. + * + * @sa @ref nrf51_appearance_set_encoding for packet format, + * @ref ble_gap_appearance_set_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_appearance_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/** + * @brief Encodes @ref sd_ble_gap_device_name_get command request. + * + * @sa @ref nrf51_device_name_get_encoding for packet format, + * @ref ble_gap_device_name_get_rsp_dec for command response decoder. + * + * @param[in] 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] p_dev_name_len Length of the buffer pointed by p_dev_name. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_dev_name and \p p_len will not be updated by the command + * request encoder. Updated values are set by @ref ble_gap_device_name_get_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_device_name_get_req_enc(uint8_t const * const p_dev_name, + uint16_t const * const p_dev_name_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_device_name_get command. + * + * @sa @ref nrf51_device_name_get_encoding for packet format, + * @ref ble_gap_device_name_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_dev_name Pointer to an empty buffer where the UTF-8 + * non NULL-terminated string will be placed. + * @param[in,out] p_dev_name_len Length of the buffer pointed by p_dev_name, complete device name + * length on output. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_device_name_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * const p_dev_name, + uint16_t * const p_dev_name_len, + uint32_t * const p_result_code); + +/** + * @brief Encodes @ref sd_ble_gap_device_name_set command request. + * + * @sa @ref nrf51_device_name_set_encoding for packet format, + * @ref ble_gap_device_name_set_rsp_dec for command response decoder. + * + * @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). + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_device_name_set_req_enc(ble_gap_conn_sec_mode_t const * const p_write_perm, + uint8_t const * const p_dev_name, + uint16_t len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_device_name_set command. + * + * @sa @ref nrf51_device_name_set_encoding for packet format, + * @ref ble_gap_device_name_set_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_device_name_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/** + * @brief Encodes @ref sd_ble_gap_ppcp_set command request. + * + * @sa @ref nrf51_ppcp_set_encoding for packet format, + * @ref ble_gap_ppcp_set_rsp_dec for command response decoder. + * + * @param[in] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure with the + * desired parameters. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_ppcp_set_req_enc(ble_gap_conn_params_t const * const p_conn_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_gap_ppcp_set command. + * + * @sa @ref nrf51_ppcp_set_encoding for packet format, + * @ref ble_gap_ppcp_set_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gap_ppcp_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_conn_param_update command request. + * + * @sa @ref nrf51_gap_conn_param_update_encoding for packet format, + * @ref ble_gap_conn_param_update_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_conn_params Pointer to desired connection parameters.. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_conn_param_update_req_enc(uint16_t conn_handle, + ble_gap_conn_params_t const * const p_conn_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_conn_param_update command. + * + * @sa @ref nrf51_gap_conn_param_update_encoding for packet format, + * @ref ble_gap_conn_param_update_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_conn_param_update_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_disconnect command request. + * + * @sa @ref nrf51_disconnect_encoding for packet format, + * @ref ble_gap_disconnect_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] hci_status_code HCI status code, see @ref BLE_HCI_STATUS_CODES. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_disconnect_req_enc(uint16_t conn_handle, + uint8_t hci_status_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_disconnect command. + * + * @sa @ref nrf51_disconnect_encoding for packet format, + * @ref ble_gap_disconnect_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_disconnect_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + + +/**@brief Encodes @ref sd_ble_gap_rssi_stop command request. + * + * @sa @ref nrf51_rssi_stop_encoding for packet format, + * @ref ble_gap_rssi_stop_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_rssi_stop_req_enc(uint16_t conn_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_rssi_stop command. + * + * @sa @ref nrf51_rssi_stop_encoding for packet format, + * @ref ble_gap_rssi_stop_rsp_dec for command response decoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_rssi_stop_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + + + + +/**@brief Encodes @ref sd_ble_gap_ppcp_get command request. + * + * @sa @ref nrf51_gap_ppcp_get_encoding for packet format, + * @ref ble_gap_ppcp_get_rsp_dec for command response decoder. + * + * @param[in] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure where the + * parameters will be stored. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_conn_params will not be updated by the command request encoder. Updated values are + * set by @ref ble_gap_ppcp_get_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_ppcp_get_req_enc(ble_gap_conn_params_t const * const p_conn_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_ppcp_get command. + * + * @sa @ref nrf51_gap_ppcp_get_encoding for packet format, + * @ref ble_gap_ppcp_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure where the parameters + * will be stored. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_ppcp_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_conn_params_t * const p_conn_params, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_auth_key_reply command request. + * + * @sa @ref nrf51_auth_key_reply_encoding for packet format, + * @ref ble_gap_auth_key_reply_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] key_type Key type which defines length of key data as defined for + * @ref sd_ble_gap_auth_key_reply . + * @param[in] p_key Pointer to a buffer which contains key + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Encoding failure. Incorrect param provided (key_type). + */ +uint32_t ble_gap_auth_key_reply_req_enc(uint16_t conn_handle, + uint8_t key_type, + uint8_t const * const p_key, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_auth_key_reply command. + * + * @sa @ref nrf51_auth_key_reply_encoding for packet format, + * @ref ble_gap_auth_key_reply_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_auth_key_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_sec_info_reply command request. + * + * @sa @ref nrf51_gap_sec_info_reply_encoding for packet format, + * @ref ble_gap_sec_info_reply_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_enc_info Pointer to a @ref ble_gap_enc_info_t encryption information + * structure. + * @param[in] p_id_info Pointer to a @ref ble_gap_irk_t id information + * structure. + * @param[in] p_sign_info Pointer to a @ref ble_gap_sign_info_t signing information + * structure. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_sec_info_reply_req_enc(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, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_sec_info_reply command. + * + * @sa @ref nrf51_gap_sec_info_reply_encoding for packet format, + * @ref ble_gap_sec_info_reply_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_sec_info_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_sec_params_reply command request. + * + * @sa @ref nrf51_sec_params_reply_encoding for packet format, + * @ref ble_gap_sec_params_reply_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] sec_status Security status, see @ref BLE_GAP_SEC_STATUS. + * @param[in] p_sec_params Pointer to @ref ble_gap_sec_params_t security parameters + * structure. + * @param[in] p_sec_keyset Pointer to @ref ble_gap_sec_keyset_t security keys + * structure. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_sec_params_reply_req_enc(uint16_t conn_handle, + uint8_t sec_status, + ble_gap_sec_params_t const * const p_sec_params, + ble_gap_sec_keyset_t const * const p_sec_keyset, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_sec_params_reply command. + * + * @sa @ref nrf51_sec_params_reply_encoding for packet format, + * @ref ble_gap_sec_params_reply_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[in] p_sec_keyset Pointer to @ref ble_gap_sec_keyset_t security keys + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_sec_params_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_sec_keyset_t const * const p_sec_keyset, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_authenticate command request. + * + * @sa @ref nrf51_ble_gap_authenticate_encoding for packet format, + * @ref ble_gap_authenticate_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_sec_params Pointer to a @ref ble_gap_sec_params_t security parameters + * structure. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_authenticate_req_enc(uint16_t conn_handle, + ble_gap_sec_params_t const * const p_sec_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_authenticate command. + * + * @sa @ref nrf51_ble_gap_authenticate_encoding for packet format, + * @ref ble_gap_authenticate_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_authenticate_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_adv_stop command request. + * + * @sa @ref nrf51_sd_ble_gap_adv_stop for packet format, + * @ref ble_gap_adv_stop_rsp_dec for command response decoder. + * + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_adv_stop_req_enc(uint8_t * const p_buf, uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_adv_stop command. + * + * @sa @ref nrf51_sd_ble_gap_adv_stop for packet format, + * @ref ble_gap_adv_stop_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_adv_stop_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_conn_sec_get command request. + * + * @sa @ref nrf51_gap_conn_sec_get_encoding for packet format, + * @ref ble_gap_conn_sec_get_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_conn_sec Pointer to \ref ble_gap_conn_sec_t which will be filled in + * response. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_conn_sec_get_req_enc(uint16_t conn_handle, + ble_gap_conn_sec_t const * const p_conn_sec, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_conn_sec_get command. + * + * @sa @ref nrf51_gap_conn_sec_get_encoding for packet format, + * @ref ble_gap_conn_sec_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_conn_sec Pointer to pointer to \ref ble_gap_conn_sec_t which will be filled by + * the decoded data (if present). + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_conn_sec_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_conn_sec_t * * const pp_conn_sec, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_rssi_start command request. + * + * @sa @ref nrf51_rssi_start_encoding for packet format, + * @ref ble_gap_rssi_start_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] threshold_dbm Threshold in dBm. + * @param[in] skip_count Sample skip count. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_rssi_start_req_enc(uint16_t conn_handle, + uint8_t threshold_dbm, + uint8_t skip_count, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_rssi_start command. + * + * @sa @ref nrf51_rssi_start_encoding for packet format, + * @ref ble_gap_rssi_start_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_rssi_start_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_scan_stop command request. + * + * @sa @ref nrf51_scan_stop_encoding for packet format, + * @ref ble_gap_scan_stop_rsp_dec for command response decoder. + * + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_scan_stop_req_enc(uint8_t * const p_buf, uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_scan_stop command. + * + * @sa @ref nrf51_scan_stop_encoding for packet format, + * @ref ble_gap_scan_stop_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_scan_stop_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_scan_start command request. + * + * @sa @ref nrf51_scan_start_encoding for packet format, + * @ref ble_gap_scan_start_rsp_dec for command response decoder. + * + * @param[in] p_scan_params Pointer to scan params structure. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_scan_start_req_enc(ble_gap_scan_params_t const * p_scan_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_scan_start command. + * + * @sa @ref nrf51_scan_start_encoding for packet format, + * @ref ble_gap_scan_start_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_scan_start_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_connect command request. + * + * @sa @ref nrf51_connect_encoding for packet format, + * @ref ble_gap_connect_rsp_dec for command response decoder. + * + * @param[in] p_peer_addr Pointer to peer address. + * @param[in] p_scan_params Pointer to scan params structure. + * @param[in] p_conn_params Pointer to desired connection parameters. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_connect_req_enc(ble_gap_addr_t const * const p_peer_addr, + ble_gap_scan_params_t const * const p_scan_params, + ble_gap_conn_params_t const * const p_conn_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_connect command. + * + * @sa @ref nrf51_connect_encoding for packet format, + * @ref ble_gap_connect_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_connect_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_connect_cancel command request. + * + * @sa @ref nrf51_connect_cancel_encoding for packet format, + * @ref ble_gap_connect_cancel_rsp_dec for command response decoder. + * + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_connect_cancel_req_enc(uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_connect_cancel command. + * + * @sa @ref nrf51_connect_cancel_encoding for packet format, + * @ref ble_gap_connect_cancel_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_connect_cancel_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + + +/**@brief Encodes @ref sd_ble_gap_encrypt command request. + * + * @sa @ref nrf51_gap_encrypt_encoding for packet format, + * @ref ble_gap_encrypt_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle. + * @param[in] p_master_id Pointer to a master identification structure. + * @param[in] p_enc_info Pointer to desired connection parameters. + * @param[in] p_buf Pointer to a ble_gap_enc_info_t encryption information structure. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ + +uint32_t ble_gap_encrypt_req_enc( uint16_t conn_handle, + ble_gap_master_id_t const * const p_master_id, + ble_gap_enc_info_t const * const p_enc_info, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + + +/**@brief Decodes response to @ref sd_ble_gap_encrypt command. + * + * @sa @ref nrf51_gap_encrypt_encoding for packet format, + * @ref ble_gap_encrypt_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_encrypt_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gap_rssi_get command request. + * + * @sa @ref nrf51_rssi_get_encoding for packet format, + * @ref ble_gap_rssi_get_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle. + * @param[in] p_rssi Pointer to the rssi value. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_rssi_get_req_enc(uint16_t conn_handle, + int8_t const * const p_rssi, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gap_rssi_get command. + * + * @sa @ref nrf51_rssi_get_encoding for packet format, + * @ref ble_gap_rssi_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_rssi Pointer to rssi value. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gap_rssi_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + int8_t * const p_rssi, + uint32_t * const p_result_code); + +/** @} */ +#endif diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_appearance_get.c b/components/serialization/application/codecs/s130/serializers/ble_gap_appearance_get.c new file mode 100644 index 0000000..cc55dd6 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_appearance_get.c @@ -0,0 +1,70 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_appearance_get_req_enc(uint16_t const * const p_appearance, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_APPEARANCE_GET; + p_buf[index++] = (p_appearance == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_appearance_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_appearance, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t index = 0; + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_GAP_APPEARANCE_GET, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; + } + + SER_ASSERT_LENGTH_LEQ(index + sizeof (uint16_t), packet_len); + + uint16_dec(p_buf, packet_len, &index, p_appearance); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_appearance_set.c b/components/serialization/application/codecs/s130/serializers/ble_gap_appearance_set.c new file mode 100644 index 0000000..8038b76 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_appearance_set.c @@ -0,0 +1,44 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "ble_gap.h" +#include "app_util.h" + + +uint32_t ble_gap_appearance_set_req_enc(uint16_t appearance, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 2, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_APPEARANCE_SET; + index += uint16_encode(appearance, &p_buf[index]); + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_appearance_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_APPEARANCE_SET, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_auth_key_reply.c b/components/serialization/application/codecs/s130/serializers/ble_gap_auth_key_reply.c new file mode 100644 index 0000000..58861e0 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_auth_key_reply.c @@ -0,0 +1,76 @@ +/* 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 "ble_gap_app.h" +#include +#include "ble_serialization.h" +#include "ble_gap.h" +#include "app_util.h" + + +uint32_t ble_gap_auth_key_reply_req_enc(uint16_t conn_handle, + uint8_t key_type, + uint8_t const * const p_key, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t buf_len = *p_buf_len; + uint8_t opcode = SD_BLE_GAP_AUTH_KEY_REPLY; + uint32_t err_code = NRF_SUCCESS; + uint8_t key_len; + + err_code = uint8_t_enc(&opcode, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&key_type, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + switch (key_type) + { + case BLE_GAP_AUTH_KEY_TYPE_NONE: + key_len = 0; + break; + + case BLE_GAP_AUTH_KEY_TYPE_PASSKEY: + key_len = 6; + break; + + case BLE_GAP_AUTH_KEY_TYPE_OOB: + key_len = 16; + break; + + default: + return NRF_ERROR_INVALID_PARAM; + } + + err_code = buf_enc(p_key, key_len, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gap_auth_key_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_AUTH_KEY_REPLY, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_authenticate.c b/components/serialization/application/codecs/s130/serializers/ble_gap_authenticate.c new file mode 100644 index 0000000..1f93c74 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_authenticate.c @@ -0,0 +1,52 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_authenticate_req_enc(uint16_t conn_handle, + ble_gap_sec_params_t const * const p_sec_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(1, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_AUTHENTICATE; + + err_code = uint16_t_enc(&conn_handle, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_sec_params, p_buf, *p_buf_len, &index, ble_gap_sec_params_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gap_authenticate_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_AUTHENTICATE, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_conn_param_update.c b/components/serialization/application/codecs/s130/serializers/ble_gap_conn_param_update.c new file mode 100644 index 0000000..3d81edf --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_conn_param_update.c @@ -0,0 +1,55 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_conn_param_update_req_enc(uint16_t conn_handle, + ble_gap_conn_params_t const * const p_conn_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 2 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_CONN_PARAM_UPDATE; + index += uint16_encode(conn_handle, &p_buf[index]); + + p_buf[index++] = (p_conn_params != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_conn_params != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 1 + 2 * 4, *p_buf_len); + index += uint16_encode(p_conn_params->min_conn_interval, &p_buf[index]); + index += uint16_encode(p_conn_params->max_conn_interval, &p_buf[index]); + index += uint16_encode(p_conn_params->slave_latency, &p_buf[index]); + index += uint16_encode(p_conn_params->conn_sup_timeout, &p_buf[index]); + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_conn_param_update_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_CONN_PARAM_UPDATE, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_conn_sec_get.c b/components/serialization/application/codecs/s130/serializers/ble_gap_conn_sec_get.c new file mode 100644 index 0000000..b3850b1 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_conn_sec_get.c @@ -0,0 +1,74 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "app_util.h" +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" + +uint32_t ble_gap_conn_sec_get_req_enc(uint16_t conn_handle, + ble_gap_conn_sec_t const * const p_conn_sec, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + uint8_t opcode = SD_BLE_GAP_CONN_SEC_GET; + + + err_code = uint8_t_enc(&opcode, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_conn_sec, p_buf, total_len, &index, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gap_conn_sec_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_conn_sec_t * * const pp_conn_sec, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + uint32_t index = 0; + uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_GAP_CONN_SEC_GET, + p_result_code); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_conn_sec, + ble_gap_conn_sec_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_connect.c b/components/serialization/application/codecs/s130/serializers/ble_gap_connect.c new file mode 100644 index 0000000..5f13670 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_connect.c @@ -0,0 +1,54 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" + +uint32_t ble_gap_connect_req_enc(ble_gap_addr_t const * const p_peer_addr, + ble_gap_scan_params_t const * const p_scan_params, + ble_gap_conn_params_t const * const p_conn_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GAP_CONNECT; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_peer_addr, p_buf, buf_len, &index, ble_gap_addr_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_scan_params, p_buf, buf_len, &index, ble_gap_scan_params_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_conn_params, p_buf, buf_len, &index, ble_gap_conn_params_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gap_connect_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_CONNECT, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_connect_cancel.c b/components/serialization/application/codecs/s130/serializers/ble_gap_connect_cancel.c new file mode 100644 index 0000000..0730ade --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_connect_cancel.c @@ -0,0 +1,42 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" + +uint32_t ble_gap_connect_cancel_req_enc(uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GAP_CONNECT_CANCEL; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gap_connect_cancel_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_CONNECT_CANCEL, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_device_name_get.c b/components/serialization/application/codecs/s130/serializers/ble_gap_device_name_get.c new file mode 100644 index 0000000..0d12b4a --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_device_name_get.c @@ -0,0 +1,84 @@ +/* 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 "ble_gap_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_device_name_get_req_enc(uint8_t const * const p_dev_name, + uint16_t const * const p_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 2, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_DEVICE_NAME_GET; + p_buf[index++] = (p_len != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_len != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 2, *p_buf_len); + index += uint16_encode(*p_len, &p_buf[index]); + } + + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + p_buf[index++] = (p_dev_name != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_device_name_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * const p_dev_name, + uint16_t * const p_dev_name_len, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + uint32_t index = 0; + uint32_t status_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_GAP_DEVICE_NAME_GET, + p_result_code); + + if (status_code != NRF_SUCCESS) + { + return status_code; + } + + if (*p_result_code != NRF_SUCCESS) + { + + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_dev_name_len); + status_code = len16data_dec(p_buf, packet_len, &index, (uint8_t * *)&p_dev_name, p_dev_name_len); + + if (status_code != NRF_SUCCESS) + { + return status_code; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return status_code; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_device_name_set.c b/components/serialization/application/codecs/s130/serializers/ble_gap_device_name_set.c new file mode 100644 index 0000000..c265c4f --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_device_name_set.c @@ -0,0 +1,66 @@ +/* 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 "ble_gap_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_device_name_set_req_enc(ble_gap_conn_sec_mode_t const * const p_write_perm, + uint8_t const * const p_dev_name, + uint16_t len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(2, *p_buf_len); + p_buf[index++] = SD_BLE_GAP_DEVICE_NAME_SET; + + p_buf[index++] = (p_write_perm != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_write_perm != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + p_buf[index++] = (uint8_t) ((p_write_perm->sm) | (p_write_perm->lv << 4)); + } + + SER_ERROR_CHECK(len <= BLE_GAP_DEVNAME_MAX_LEN, NRF_ERROR_INVALID_PARAM); + + SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len); + index += uint16_encode(len, &p_buf[index]); + + p_buf[index++] = (p_dev_name != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_dev_name != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + len, *p_buf_len); + memcpy(&p_buf[index], p_dev_name, len); + index += len; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_device_name_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_DEVICE_NAME_SET, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_disconnect.c b/components/serialization/application/codecs/s130/serializers/ble_gap_disconnect.c new file mode 100644 index 0000000..d3064d6 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_disconnect.c @@ -0,0 +1,45 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_disconnect_req_enc(uint16_t conn_handle, + uint8_t hci_status_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 4, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_DISCONNECT; + index += uint16_encode(conn_handle, &p_buf[index]); + p_buf[index++] = hci_status_code; + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_disconnect_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_DISCONNECT, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_encrypt.c b/components/serialization/application/codecs/s130/serializers/ble_gap_encrypt.c new file mode 100644 index 0000000..0abf029 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_encrypt.c @@ -0,0 +1,68 @@ +/* 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 "ble_gap_app.h" +#include +#include "ble_serialization.h" +#include "ble_gap.h" +#include "app_util.h" + + +uint32_t ble_gap_encrypt_req_enc( uint16_t conn_handle, + ble_gap_master_id_t const * const p_master_id, + ble_gap_enc_info_t const * const p_enc_info, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 2 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_ENCRYPT; + index += uint16_encode(conn_handle, &p_buf[index]); + + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + p_buf[index++] = (p_master_id != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_master_id != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + BLE_GAP_SEC_RAND_LEN + 2, *p_buf_len); + index += uint16_encode(p_master_id->ediv, &p_buf[index]); + memcpy(&p_buf[index], p_master_id->rand, BLE_GAP_SEC_RAND_LEN); + index += BLE_GAP_SEC_RAND_LEN; + } + + p_buf[index++] = (p_enc_info != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_enc_info != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + BLE_GAP_SEC_KEY_LEN + 1, *p_buf_len); + memcpy(&p_buf[index], p_enc_info->ltk, BLE_GAP_SEC_KEY_LEN); + index += BLE_GAP_SEC_KEY_LEN; + p_buf[index++] = (p_enc_info->auth | (p_enc_info->ltk_len << 1)); + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_encrypt_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_ENCRYPT, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_evt_adv_report.c b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_adv_report.c new file mode 100644 index 0000000..256919b --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_adv_report.c @@ -0,0 +1,72 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_adv_report_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE+7+1+1, packet_len); // assumed size(data) = 0 + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.adv_report)) + + sizeof (ble_gap_evt_adv_report_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_ADV_REPORT; + p_event->header.evt_len = event_len; + + err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.conn_handle)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_addr_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.adv_report.peer_addr)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.adv_report.rssi)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, packet_len, &index, &byte); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + p_event->evt.gap_evt.params.adv_report.scan_rsp = byte & 0x01; + p_event->evt.gap_evt.params.adv_report.type = (byte >> 1) & 0x03; + p_event->evt.gap_evt.params.adv_report.dlen = (byte >> 3) & 0x1F; + + err_code = uint8_vector_dec(p_buf, packet_len, &index, + p_event->evt.gap_evt.params.adv_report.data, (uint16_t)(p_event->evt.gap_evt.params.adv_report.dlen)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return err_code; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_evt_app.h b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_app.h new file mode 100644 index 0000000..1e97446 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_app.h @@ -0,0 +1,409 @@ +/* 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 BLE_GAP_EVT_APP_H__ +#define BLE_GAP_EVT_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s130_codecs Application s130 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gap_evt_app GAP Application event decoders + * @{ + * @ingroup ser_app_s130_codecs + * + * @brief GAP Application event decoders. + */ +#include "ble.h" + +/** + * @brief Decodes ble_gap_evt_auth_key_request event. + * + * @sa @ref nrf51_evt_auth_key_request_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_auth_key_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_auth_status event. + * + * @sa @ref nrf51_evt_auth_status_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_auth_status_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_conn_param_update event. + * + * @sa @ref nrf51_evt_conn_param_update_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_conn_param_update_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_conn_sec_update event. + * + * @sa @ref nrf51_evt_conn_sec_update_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_conn_sec_update_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_connected event. + * + * @sa @ref nrf51_evt_connected_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_connected_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_disconnected event. + * + * @sa @ref nrf51_evt_disconnected_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_disconnected_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_passkey_display event. + * + * @sa @ref nrf51_evt_passkey_display for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_passkey_display_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_rssi_changed event. + * + * @sa @ref nrf51_evt_rssi_changed_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_rssi_changed_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_sec_info_request event. + * + * @sa @ref nrf51_evt_sec_info_request_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_sec_info_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_sec_params_request event. + * + * @sa @ref nrf51_evt_sec_param_request_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_sec_params_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_timeout event. + * + * @sa @ref nrf51_evt_timeout_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_timeout_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_sec_request event. + * + * @sa @ref nrf51_evt_sec_request_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_sec_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_conn_param_update_request event. + * + * @sa @ref nrf51_evt_conn_param_update_request_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_conn_param_update_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); +/** + * @brief Decodes ble_gap_evt_adv_report event. + * + * @sa @ref nrf51_evt_adv_report_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_adv_report_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gap_evt_scan_req_report event. + * + * @sa @ref nrf51_evt_scan_req_report_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gap_evt_scan_req_report_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); +/** @} */ +#endif diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_evt_auth_key_request.c b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_auth_key_request.c new file mode 100644 index 0000000..090b431 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_auth_key_request.c @@ -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. + * + */ + +#include "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_auth_key_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t event_len; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(3, packet_len); + + event_len = SER_EVT_CONN_HANDLE_SIZE + 1; + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_AUTH_KEY_REQUEST; + p_event->header.evt_len = event_len; + + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + + uint8_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.params.auth_key_request.key_type); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_evt_auth_status.c b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_auth_status.c new file mode 100644 index 0000000..6f54d6a --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_auth_status.c @@ -0,0 +1,69 @@ +/* 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 "ble_gap_evt_app.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" +#include "app_ble_gap_sec_keys.h" + +extern ser_ble_gap_app_keyset_t m_app_keys_table[]; + +uint32_t ble_gap_evt_auth_status_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + uint32_t conn_index; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 6, packet_len); + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.auth_status)) + + sizeof (ble_gap_evt_adv_report_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + p_event->header.evt_id = BLE_GAP_EVT_AUTH_STATUS; + p_event->header.evt_len = event_len; + + err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.conn_handle)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_auth_status_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.auth_status)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + // keyset is an extension of standard event data - used to synchronize keys at application + err_code = app_ble_gap_sec_context_find(p_event->evt.gap_evt.conn_handle, &conn_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_keyset_t_dec(p_buf, packet_len, &index, &(m_app_keys_table[conn_index].keyset)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = app_ble_gap_sec_context_destroy(p_event->evt.gap_evt.conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return err_code; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_param_update.c b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_param_update.c new file mode 100644 index 0000000..33cacdc --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_param_update.c @@ -0,0 +1,59 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_conn_param_update_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 2, packet_len); + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.conn_param_update)) + + sizeof (ble_gap_evt_conn_param_update_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_CONN_PARAM_UPDATE; + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gap_evt.params.conn_param_update.conn_params.min_conn_interval); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gap_evt.params.conn_param_update.conn_params.max_conn_interval); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gap_evt.params.conn_param_update.conn_params.slave_latency); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gap_evt.params.conn_param_update.conn_params.conn_sup_timeout); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_param_update_request.c b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_param_update_request.c new file mode 100644 index 0000000..7bede0f --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_param_update_request.c @@ -0,0 +1,59 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_conn_param_update_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 2, packet_len); + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.conn_param_update_request)) + + sizeof (ble_gap_evt_conn_param_update_request_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST; + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gap_evt.params.conn_param_update_request.conn_params.min_conn_interval); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gap_evt.params.conn_param_update_request.conn_params.max_conn_interval); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gap_evt.params.conn_param_update_request.conn_params.slave_latency); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gap_evt.params.conn_param_update_request.conn_params.conn_sup_timeout); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_sec_update.c b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_sec_update.c new file mode 100644 index 0000000..6802173 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_sec_update.c @@ -0,0 +1,57 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_conn_sec_update_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 2, packet_len); + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.conn_sec_update)) + + sizeof (ble_gap_evt_conn_sec_update_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_CONN_SEC_UPDATE; + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + + p_event->evt.gap_evt.params.conn_sec_update.conn_sec.sec_mode.sm = p_buf[index] & 0x0F; + p_event->evt.gap_evt.params.conn_sec_update.conn_sec.sec_mode.lv = (p_buf[index] >> 4) & 0x0F; + index++; + + uint8_dec(p_buf, packet_len, + &index, &p_event->evt.gap_evt.params.conn_sec_update.conn_sec.encr_key_size); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_evt_connected.c b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_connected.c new file mode 100644 index 0000000..0dfcd5a --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_connected.c @@ -0,0 +1,53 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_connected_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + uint32_t event_len = sizeof (ble_gap_evt_connected_t) + + sizeof (p_event->evt.gap_evt.conn_handle); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_len = event_len; + + err_code = uint16_t_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_connected_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.connected)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return err_code; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_evt_disconnected.c b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_disconnected.c new file mode 100644 index 0000000..fa29107 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_disconnected.c @@ -0,0 +1,48 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_disconnected_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(3, packet_len); + + uint32_t event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gap_evt_disconnected_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_DISCONNECTED; + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + uint8_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.params.disconnected.reason); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_evt_passkey_display.c b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_passkey_display.c new file mode 100644 index 0000000..7a2f155 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_passkey_display.c @@ -0,0 +1,57 @@ +/* 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 "ble_gap_evt_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + +#define PASSKEY_LEN sizeof (p_event->evt.gap_evt.params.passkey_display.passkey) + + +uint32_t ble_gap_evt_passkey_display_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t event_len; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + PASSKEY_LEN, packet_len); + + event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gap_evt_passkey_display_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_PASSKEY_DISPLAY; + p_event->header.evt_len = event_len; + + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + memcpy(p_event->evt.gap_evt.params.passkey_display.passkey, &p_buf[index], PASSKEY_LEN); + index += PASSKEY_LEN; + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + *p_event_len = event_len; + + return NRF_SUCCESS; +} + diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_evt_rssi_changed.c b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_rssi_changed.c new file mode 100644 index 0000000..b7de4cc --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_rssi_changed.c @@ -0,0 +1,53 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_rssi_changed_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t event_len; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 1, packet_len); + + event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gap_evt_rssi_changed_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_RSSI_CHANGED; + p_event->header.evt_len = event_len; + + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + int8_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.params.rssi_changed.rssi); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + *p_event_len = event_len; + + return NRF_SUCCESS; +} + diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_evt_scan_req_report.c b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_scan_req_report.c new file mode 100644 index 0000000..118fcf2 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_scan_req_report.c @@ -0,0 +1,58 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_scan_req_report_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.scan_req_report)) + + sizeof (ble_gap_evt_scan_req_report_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_SCAN_REQ_REPORT; + p_event->header.evt_len = event_len; + + err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.conn_handle)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_addr_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.scan_req_report.peer_addr)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.scan_req_report.rssi)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return err_code; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_info_request.c b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_info_request.c new file mode 100644 index 0000000..ff3d0af --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_info_request.c @@ -0,0 +1,55 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_sec_info_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 2, packet_len); + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.sec_info_request)) + + sizeof (ble_gap_evt_sec_info_request_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_SEC_INFO_REQUEST; + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + + err_code = ble_gap_evt_sec_info_request_t_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.params.sec_info_request); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_params_request.c b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_params_request.c new file mode 100644 index 0000000..0386291 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_params_request.c @@ -0,0 +1,55 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_evt_sec_params_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t event_len; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(7, packet_len); + + event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gap_evt_sec_params_request_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + p_event->header.evt_id = BLE_GAP_EVT_SEC_PARAMS_REQUEST; + p_event->header.evt_len = event_len; + + err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.conn_handle)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_sec_params_request_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.sec_params_request)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + *p_event_len = event_len; + + return err_code; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_request.c b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_request.c new file mode 100644 index 0000000..f080405 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_request.c @@ -0,0 +1,59 @@ +/* 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 + +#include "ble_gap_evt_app.h" +#include "ble_gap_struct_serialization.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_sec_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(3, packet_len); + + uint32_t event_len = sizeof (ble_gap_evt_sec_request_t) + + sizeof (p_event->evt.gap_evt.conn_handle); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + + ble_gap_evt_sec_request_t * p_decoded_evt = &(p_event->evt.gap_evt.params.sec_request); + + uint32_t err_code = ble_gap_evt_sec_request_t_dec(p_buf, packet_len, &index, p_decoded_evt); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_evt_timeout.c b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_timeout.c new file mode 100644 index 0000000..8fdb83b --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_evt_timeout.c @@ -0,0 +1,52 @@ +/* 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 "ble_gap_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_timeout_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t event_len; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_EQ(SER_EVT_CONN_HANDLE_SIZE + 1, packet_len); + + event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gap_evt_timeout_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GAP_EVT_TIMEOUT; + p_event->header.evt_len = event_len; + + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + uint8_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.params.timeout.src); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_ppcp_get.c b/components/serialization/application/codecs/s130/serializers/ble_gap_ppcp_get.c new file mode 100644 index 0000000..e3c8b07 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_ppcp_get.c @@ -0,0 +1,68 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" + + +uint32_t ble_gap_ppcp_get_req_enc(ble_gap_conn_params_t const * const p_conn_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_PPCP_GET; + p_buf[index++] = (p_conn_params != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_ppcp_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_conn_params_t * const p_conn_params, + uint32_t * const p_result_code) +{ + uint32_t index = 0; + + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_GAP_PPCP_GET, p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_conn_params); + + SER_ASSERT_LENGTH_LEQ(index + 8, packet_len); + uint16_dec(p_buf, packet_len, &index, &p_conn_params->min_conn_interval); + uint16_dec(p_buf, packet_len, &index, &p_conn_params->max_conn_interval); + uint16_dec(p_buf, packet_len, &index, &p_conn_params->slave_latency); + uint16_dec(p_buf, packet_len, &index, &p_conn_params->conn_sup_timeout); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return decode_result; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_ppcp_set.c b/components/serialization/application/codecs/s130/serializers/ble_gap_ppcp_set.c new file mode 100644 index 0000000..15e5528 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_ppcp_set.c @@ -0,0 +1,54 @@ +/* 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 "ble_gap_app.h" +#include +#include "nrf_error.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_ppcp_set_req_enc(ble_gap_conn_params_t const * const p_conn_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(1 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GAP_PPCP_SET; + p_buf[index++] = (p_conn_params != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_conn_params != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 8, *p_buf_len); + index += uint16_encode(p_conn_params->min_conn_interval, &p_buf[index]); + index += uint16_encode(p_conn_params->max_conn_interval, &p_buf[index]); + index += uint16_encode(p_conn_params->slave_latency, &p_buf[index]); + index += uint16_encode(p_conn_params->conn_sup_timeout, &p_buf[index]); + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_ppcp_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_PPCP_SET, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_rssi_get.c b/components/serialization/application/codecs/s130/serializers/ble_gap_rssi_get.c new file mode 100644 index 0000000..24b4b2c --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_rssi_get.c @@ -0,0 +1,80 @@ +/* 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 "ble_gap_app.h" +#include +#include +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_rssi_get_req_enc(uint16_t conn_handle, + int8_t const * const p_rssi, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + SER_ASSERT_LENGTH_LEQ(index + 1, total_len); + + p_buf[index++] = SD_BLE_GAP_RSSI_GET; + + err_code = uint16_t_enc(&conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_rssi, p_buf, total_len, &index, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gap_rssi_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + int8_t * const p_rssi, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t index = 0; + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, + &index, + packet_len, + SD_BLE_GAP_RSSI_GET, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + decode_result = uint8_t_dec(p_buf, packet_len, &index, (uint8_t *) p_rssi); + SER_ASSERT(decode_result == NRF_SUCCESS, decode_result); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return decode_result; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_rssi_start.c b/components/serialization/application/codecs/s130/serializers/ble_gap_rssi_start.c new file mode 100644 index 0000000..539b8b6 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_rssi_start.c @@ -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. + * + */ + +#include "ble_gap_app.h" +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_rssi_start_req_enc(uint16_t conn_handle, + uint8_t threshold_dbm, + uint8_t skip_count, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GAP_RSSI_START; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&threshold_dbm, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&skip_count, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gap_rssi_start_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_RSSI_START, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_rssi_stop.c b/components/serialization/application/codecs/s130/serializers/ble_gap_rssi_stop.c new file mode 100644 index 0000000..49ef65e --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_rssi_stop.c @@ -0,0 +1,45 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_rssi_stop_req_enc(uint16_t conn_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + uint8_t op_code = SD_BLE_GAP_RSSI_STOP; + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gap_rssi_stop_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_RSSI_STOP, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_scan_start.c b/components/serialization/application/codecs/s130/serializers/ble_gap_scan_start.c new file mode 100644 index 0000000..a92ab3b --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_scan_start.c @@ -0,0 +1,45 @@ +/* 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 "ble_gap_app.h" +#include "cond_field_serialization.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" + +uint32_t ble_gap_scan_start_req_enc(ble_gap_scan_params_t const * p_scan_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GAP_SCAN_START; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + err_code = cond_field_enc(p_scan_params, p_buf, buf_len, &index, ble_gap_scan_params_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gap_scan_start_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_SCAN_START, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_scan_stop.c b/components/serialization/application/codecs/s130/serializers/ble_gap_scan_stop.c new file mode 100644 index 0000000..72e7c4a --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_scan_stop.c @@ -0,0 +1,40 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" + +uint32_t ble_gap_scan_stop_req_enc(uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GAP_SCAN_STOP; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gap_scan_stop_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_SCAN_STOP, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_sec_info_reply.c b/components/serialization/application/codecs/s130/serializers/ble_gap_sec_info_reply.c new file mode 100644 index 0000000..0739b31 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_sec_info_reply.c @@ -0,0 +1,78 @@ +/* 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 "ble_gap_app.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "ble_gap.h" +#include "cond_field_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_sec_info_reply_req_enc(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, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GAP_SEC_INFO_REPLY; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(index + 1, buf_len); + p_buf[index++] = (p_enc_info != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_enc_info != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + BLE_GAP_SEC_KEY_LEN + 1, buf_len); + memcpy(&p_buf[index], p_enc_info->ltk, BLE_GAP_SEC_KEY_LEN); + index += BLE_GAP_SEC_KEY_LEN; + p_buf[index++] = (p_enc_info->auth | (p_enc_info->ltk_len << 1)); + } + + err_code = cond_field_enc(p_id_info, p_buf, buf_len, &index, ble_gap_irk_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(index + 1, buf_len); + p_buf[index++] = (p_sign_info != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_sign_info != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + BLE_GAP_SEC_KEY_LEN, buf_len); + memcpy(&p_buf[index], p_sign_info->csrk, BLE_GAP_SEC_KEY_LEN); + index += BLE_GAP_SEC_KEY_LEN; + } + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gap_sec_info_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_SEC_INFO_REPLY, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_sec_params_reply.c b/components/serialization/application/codecs/s130/serializers/ble_gap_sec_params_reply.c new file mode 100644 index 0000000..d04189d --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_sec_params_reply.c @@ -0,0 +1,87 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_sec_params_reply_req_enc(uint16_t conn_handle, + uint8_t sec_status, + ble_gap_sec_params_t const * const p_sec_params, + ble_gap_sec_keyset_t const * const p_sec_keyset, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GAP_SEC_PARAMS_REPLY; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&sec_status, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_sec_params, p_buf, buf_len, &index, ble_gap_sec_params_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_sec_keyset, p_buf, buf_len, &index, ble_gap_sec_keyset_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gap_sec_params_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_sec_keyset_t const * const p_sec_keyset, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = 0; + + err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, SD_BLE_GAP_SEC_PARAMS_REPLY, p_result_code); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_sec_keyset); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void **)&p_sec_keyset, ble_gap_sec_keyset_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gap_tx_power_set.c b/components/serialization/application/codecs/s130/serializers/ble_gap_tx_power_set.c new file mode 100644 index 0000000..807eb78 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gap_tx_power_set.c @@ -0,0 +1,45 @@ +/* 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 "ble_gap_app.h" +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_tx_power_set_req_enc(int8_t tx_power, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GAP_TX_POWER_SET; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&tx_power, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gap_tx_power_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_TX_POWER_SET, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gattc_app.h b/components/serialization/application/codecs/s130/serializers/ble_gattc_app.h new file mode 100644 index 0000000..d6e1bba --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gattc_app.h @@ -0,0 +1,406 @@ +/* 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. + * + */ +#ifndef BLE_GATTC_APP_H__ +#define BLE_GATTC_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s130_codecs Application s130 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gattc_app GATTC Application command request encoders and command response decoders + * @{ + * @ingroup ser_app_s130_codecs + * + * @brief GATTC Application command request encoders and command response decoders. + */ +#include "ble_gattc.h" +#include "ble.h" + +/**@brief Encodes @ref sd_ble_gattc_primary_services_discover command request. + * + * @sa @ref nrf51_sd_ble_gattc_primary_services_discover_encoding for packet format, + * @ref ble_gattc_primary_services_discover_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] start_handle Handle to start searching from. + * @param[in] p_srvc_uuid Pointer to a @ref ble_uuid_t which indicates the service UUID to + * be found. If it is NULL, all primary services will be returned. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_primary_services_discover_req_enc(uint16_t conn_handle, + uint16_t start_handle, + ble_uuid_t const * const p_srvc_uuid, + uint8_t * const p_buf, + uint32_t * p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gattc_primary_services_discover command. + * + * @sa @ref nrf51_sd_ble_gattc_primary_services_discover_encoding for packet format, + * @ref ble_gattc_primary_services_discover_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gattc_primary_services_discover_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gattc_descriptors_discover command request. + * + * @sa @ref nrf51_sd_ble_gattc_descriptors_discover_encoding for packet format, + * @ref ble_gattc_descriptors_discover_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_handle_range A pointer to the range of handles of the Service to perform + * this procedure on. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_descriptors_discover_req_enc( + uint16_t conn_handle, + ble_gattc_handle_range_t const * const p_handle_range, + uint8_t * const p_buf, + uint32_t * p_buf_len); + + +/**@brief Decodes response to @ref sd_ble_gattc_descriptors_discover command. + * + * @sa @ref nrf51_sd_ble_gattc_descriptors_discover_encoding for packet format, + * @ref ble_gattc_primary_services_discover_rsp_dec for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gattc_descriptors_discover_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gattc_relationships_discover command request. + * + * @sa @ref nrf51_sd_ble_gattc_relationships_discover_encoding for packet format, + * @ref ble_gattc_relationships_discover_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_handle_range A pointer to the range of handles of the Service to perform + * this procedure on. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_relationships_discover_req_enc( + uint16_t conn_handle, + ble_gattc_handle_range_t const * const p_handle_range, + uint8_t * const p_buf, + uint32_t * p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gattc_relationships_discover command. + * + * @sa @ref nrf51_sd_ble_gattc_relationships_discover_encoding for packet format, + * @ref ble_gattc_relationships_discover_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gattc_relationships_discover_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gattc_characteristics_discover command request. + * + * @sa @ref nrf51_sd_ble_gattc_characteristics_discover_encoding for packet format, + * @ref ble_gattc_characteristics_discover_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_handle_range A pointer to the range of handles of the Service to perform + * this procedure on. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_characteristics_discover_req_enc + (uint16_t conn_handle, + ble_gattc_handle_range_t const * const p_handle_range, + uint8_t * const p_buf, + uint32_t * p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gattc_characteristics_discover command. + * + * @sa @ref nrf51_sd_ble_gattc_characteristics_discover_encoding for packet format, + * @ref ble_gattc_primary_services_discover_rsp_dec for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gattc_characteristics_discover_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gattc_read command request. + * + * @sa @ref nrf51_sd_ble_gattc_read_encoding for packet format, + * @ref ble_gattc_read_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] handle The handle of the attribute to be read. + * @param[in] offset Offset into the attribute value to be read. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_read_req_enc(uint16_t conn_handle, + uint16_t handle, + uint16_t offset, + uint8_t * const p_buf, + uint32_t * p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gattc_read command. + * + * @sa @ref nrf51_sd_ble_gattc_read_encoding for packet format, + * @ref ble_gattc_read_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gattc_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gattc_char_values_read command request. + * + * @sa @ref nrf51_sd_ble_gattc_char_values_read for packet format, + * @ref ble_gattc_char_values_read_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @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. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_char_values_read_req_enc(uint16_t conn_handle, + uint16_t const * const p_handles, + uint16_t handle_count, + uint8_t * const p_buf, + uint32_t * p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gattc_char_values_read command. + * + * @sa @ref nrf51_sd_ble_gattc_char_values_read for packet format, + * @ref ble_gattc_char_values_read_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gattc_char_values_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gattc_write command request. + * + * @sa @ref nrf51_sd_ble_gattc_write_encoding for packet format, + * @ref ble_gattc_write_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_write_params Pointer to \ref sd_ble_gattc_write params. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_write_req_enc(uint16_t conn_handle, + ble_gattc_write_params_t const * const p_write_params, + uint8_t * const p_buf, + uint32_t * p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gattc_write command. + * + * @sa @ref nrf51_sd_ble_gattc_write_encoding for packet format, + * @ref ble_gattc_write_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gattc_write_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gattc_hv_confirm command request. + * + * @sa @ref nrf51_sd_ble_gattc_hv_confirm for packet format, + * @ref ble_gattc_hv_confirm_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] handle Handle of the attribute in the indication. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_hv_confirm_req_enc(uint16_t conn_handle, + uint16_t handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gattc_hv_confirm command. + * + * @sa @ref nrf51_sd_ble_gattc_hv_confirm for packet format, + * @ref ble_gattc_hv_confirm_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Pointer to command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gattc_hv_confirm_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gattc_char_value_by_uuid_read command request. + * + * @sa @ref nrf51_sd_ble_gattc_char_value_by_uuid_read_encoding for packet format, + * @ref ble_gattc_char_value_by_uuid_read_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_uuid Pointer to a characteristic value UUID to read. + * @param[in] p_handle_range Pointer to the range of handles to perform this procedure on. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_char_value_by_uuid_read_req_enc + (uint16_t conn_handle, + ble_uuid_t const * const p_uuid, + ble_gattc_handle_range_t const * const p_handle_range, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gattc_char_value_by_uuid_read command. + * + * @sa @ref nrf51_sd_ble_gattc_char_value_by_uuid_read_encoding for packet format, + * @ref ble_gattc_char_value_by_uuid_read_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Pointer to command response result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected + * operation code. + */ +uint32_t ble_gattc_char_value_by_uuid_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); +/** @} */ +#endif + + diff --git a/components/serialization/application/codecs/s130/serializers/ble_gattc_char_value_by_uuid_read.c b/components/serialization/application/codecs/s130/serializers/ble_gattc_char_value_by_uuid_read.c new file mode 100644 index 0000000..7b75815 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gattc_char_value_by_uuid_read.c @@ -0,0 +1,61 @@ +/* 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 "ble_gattc_app.h" +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "ble_gattc_struct_serialization.h" +#include "cond_field_serialization.h" +#include "ble_types.h" +#include + +uint32_t ble_gattc_char_value_by_uuid_read_req_enc + (uint16_t conn_handle, + ble_uuid_t const * const p_uuid, + ble_gattc_handle_range_t const * const p_handle_range, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t err_code; + uint32_t index = 0; + uint32_t buf_len = *p_buf_len; + uint8_t opcode = SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ; + + err_code = uint8_t_enc(&opcode, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_uuid, p_buf, buf_len, &index, ble_uuid_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_handle_range, p_buf, buf_len, &index, ble_gattc_handle_range_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gattc_char_value_by_uuid_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, + packet_len, + SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, + p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gattc_char_values_read.c b/components/serialization/application/codecs/s130/serializers/ble_gattc_char_values_read.c new file mode 100644 index 0000000..6dc1e17 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gattc_char_values_read.c @@ -0,0 +1,48 @@ +/* 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 "ble_gattc_app.h" +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gattc_char_values_read_req_enc(uint16_t conn_handle, + uint16_t const * const p_handles, + uint16_t handle_count, + uint8_t * const p_buf, + uint32_t * p_buf_len) +{ + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t buf_len = *p_buf_len; + uint32_t err_code; + uint8_t opCode = SD_BLE_GATTC_CHAR_VALUES_READ; + + err_code = uint8_t_enc(&opCode, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + err_code = count16_cond_data16_enc(p_handles, handle_count, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + *p_buf_len = index; + return err_code; +} + + +uint32_t ble_gattc_char_values_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_CHAR_VALUES_READ, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gattc_characteristics_discover.c b/components/serialization/application/codecs/s130/serializers/ble_gattc_characteristics_discover.c new file mode 100644 index 0000000..b98d142 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gattc_characteristics_discover.c @@ -0,0 +1,57 @@ +/* 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 "ble_gattc_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_characteristics_discover_req_enc( + uint16_t conn_handle, + ble_gattc_handle_range_t const * const p_handle_range, + uint8_t * const p_buf, + uint32_t * p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 2, *p_buf_len); + + p_buf[index++] = SD_BLE_GATTC_CHARACTERISTICS_DISCOVER; + index += uint16_encode(conn_handle, &p_buf[index]); + + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + p_buf[index++] = (p_handle_range != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_handle_range != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 2 + 2, *p_buf_len); + + index += uint16_encode(p_handle_range->start_handle, &p_buf[index]); + index += uint16_encode(p_handle_range->end_handle, &p_buf[index]); + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_characteristics_discover_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_CHARACTERISTICS_DISCOVER, + p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gattc_descriptors_discover.c b/components/serialization/application/codecs/s130/serializers/ble_gattc_descriptors_discover.c new file mode 100644 index 0000000..28e1a21 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gattc_descriptors_discover.c @@ -0,0 +1,53 @@ +/* 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 "ble_gattc_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_descriptors_discover_req_enc( + uint16_t conn_handle, + ble_gattc_handle_range_t const * const p_handle_range, + uint8_t * const p_buf, + uint32_t * p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 2 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GATTC_DESCRIPTORS_DISCOVER; + index += uint16_encode(conn_handle, &p_buf[index]); + p_buf[index++] = (p_handle_range == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + if (p_handle_range != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 2 + 2, *p_buf_len); + index += uint16_encode(p_handle_range->start_handle, &p_buf[index]); + index += uint16_encode(p_handle_range->end_handle, &p_buf[index]); + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_descriptors_discover_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_DESCRIPTORS_DISCOVER, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_app.h b/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_app.h new file mode 100644 index 0000000..fba9e82 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_app.h @@ -0,0 +1,286 @@ +/* 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 BLE_GATTC_EVT_APP_H__ +#define BLE_GATTC_EVT_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s130_codecs Application s130 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gattc_evt_app GATTC Application event decoders + * @{ + * @ingroup ser_app_s130_codecs + * + * @brief GATTC Application event decoders. + */ +#include "ble.h" + +/** + * @brief Decodes ble_gattc_evt_char_disc_rsp event. + * + * @sa @ref nrf51_gattc_evt_char_disc_rsp_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_char_disc_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gattc_evt_char_val_by_uuid_read_rsp event. + * + * @sa @ref nrf51_gattc_evt_char_val_by_uuid_read_rsp_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gattc_evt_char_vals_read_rsp event. + * + * @sa @ref nrf51_gattc_evt_char_vals_read_rsp_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_char_vals_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gattc_evt_desc_disc_rsp event. + * + * @sa @ref nrf51_gattc_evt_desc_disc_rsp_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_desc_disc_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gattc_evt_hvx event. + * + * @sa @ref nrf51_gattc_evt_hvx_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_hvx_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gattc_evt_prim_srvc_disc_rsp event. + * + * @sa @ref nrf51_gattc_evt_prim_srvc_disc_rsp_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_prim_srvc_disc_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gattc_evt_read_rsp event. + * + * @sa @ref nrf51_gattc_evt_read_rsp_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gattc_evt_rel_disc_rsp_dec event. + * + * @sa @ref nrf51_gattc_evt_rel_disc_rsp_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_rel_disc_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gattc_evt_timeout event. + * + * @sa @ref nrf51_gattc_evt_timeout_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_timeout_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gattc_evt_write_rsp event. + * + * @sa @ref nrf51_gattc_evt_write_rsp_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gattc_evt_write_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** @} */ +#endif diff --git a/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_disc_rsp.c b/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_disc_rsp.c new file mode 100644 index 0000000..cdc6532 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_disc_rsp.c @@ -0,0 +1,103 @@ +/* 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 "ble_gattc_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" +#include "nordic_common.h" + + +uint32_t ble_gattc_evt_char_disc_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(2 + 2 + 2 + 2, packet_len); + + uint16_t tmp_conn_handle; + uint16_t tmp_gatt_status; + uint16_t tmp_error_handle; + uint16_t tmp_service_count; + uint16_dec(p_buf, packet_len, &index, &tmp_conn_handle); + uint16_dec(p_buf, packet_len, &index, &tmp_gatt_status); + uint16_dec(p_buf, packet_len, &index, &tmp_error_handle); + uint16_dec(p_buf, packet_len, &index, &tmp_service_count); + + + uint32_t event_len = offsetof(ble_evt_t, evt.gattc_evt.params.char_disc_rsp) + + sizeof (uint16_t) + tmp_service_count * sizeof (ble_gattc_char_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTC_EVT_CHAR_DISC_RSP; + p_event->header.evt_len = event_len; + p_event->evt.gattc_evt.conn_handle = tmp_conn_handle; + p_event->evt.gattc_evt.gatt_status = tmp_gatt_status; + p_event->evt.gattc_evt.error_handle = tmp_error_handle; + p_event->evt.gattc_evt.params.char_disc_rsp.count = tmp_service_count; + + SER_ASSERT_LENGTH_LEQ(index + (tmp_service_count * 9), packet_len); + + for (uint16_t i = 0; i < tmp_service_count; i++) + { + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].uuid.uuid); + uint8_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].uuid.type); + + uint8_t characteristic_props; + uint8_dec(p_buf, packet_len, &index, &characteristic_props); + + p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.broadcast = + !!(characteristic_props & BIT_0); + p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.read = + !!(characteristic_props & BIT_1); + p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.write_wo_resp = + !!(characteristic_props & BIT_2); + p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.write = + !!(characteristic_props & BIT_3); + p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.notify = + !!(characteristic_props & BIT_4); + p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.indicate = + !!(characteristic_props & BIT_5); + p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.auth_signed_wr = + !!(characteristic_props & BIT_6); + + uint8_t characteristic_ext_props; + uint8_dec(p_buf, packet_len, &index, &characteristic_ext_props); + + p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_ext_props = + characteristic_ext_props & BIT_0; + + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].handle_decl); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].handle_value); + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c b/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c new file mode 100644 index 0000000..93d89dc --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c @@ -0,0 +1,78 @@ +/* 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_util.h" +#include "ble.h" +#include "ble_serialization.h" +#include "ble_gattc_struct_serialization.h" +#include "ble_gattc_evt_app.h" + + +uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + uint32_t index = 0; + uint32_t err_code; + uint16_t conn_handle; + uint16_t gatt_status; + uint16_t error_handle; + + SER_ASSERT_LENGTH_LEQ(6, packet_len - index); + + uint32_t in_event_len = *p_event_len; + + *p_event_len = (offsetof(ble_evt_t, evt.gattc_evt.params)) - sizeof (ble_evt_hdr_t); + + uint16_dec(p_buf, packet_len, &index, &conn_handle); + uint16_dec(p_buf, packet_len, &index, &gatt_status); + uint16_dec(p_buf, packet_len, &index, &error_handle); + + void * p_data = NULL; + + if (p_event) + { + SER_ASSERT_LENGTH_LEQ(*p_event_len, in_event_len); + + p_event->header.evt_id = BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP; + p_event->evt.gattc_evt.conn_handle = conn_handle; + p_event->evt.gattc_evt.gatt_status = gatt_status; + p_event->evt.gattc_evt.error_handle = error_handle; + + p_data = &p_event->evt.gattc_evt.params.char_val_by_uuid_read_rsp; + } + else + { + p_data = NULL; + } + + //call struct decoder with remaining size of event struct + uint32_t temp_event_len = in_event_len - *p_event_len; + err_code = ble_gattc_evt_char_val_by_uuid_read_rsp_t_dec(p_buf, packet_len, &index, + &temp_event_len, p_data); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + //update event length with the amount processed by struct decoder + *p_event_len += temp_event_len; + + if (p_event) + { + p_event->header.evt_len = *p_event_len; + } + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_vals_read_rsp.c b/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_vals_read_rsp.c new file mode 100644 index 0000000..4e99a17 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_vals_read_rsp.c @@ -0,0 +1,66 @@ +/* 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 "ble_gattc_evt_app.h" +#include "ble_gattc_struct_serialization.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + +#define BLE_GATTC_EVT_CHAR_VALS_READ_RSP_LEN_POSITION 6 + + +uint32_t ble_gattc_evt_char_vals_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t event_len = 0; + + uint32_t error_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(10, packet_len); + + event_len = (uint16_t) (offsetof(ble_evt_t, evt.gattc_evt.params.char_vals_read_rsp.values)) - + sizeof (ble_evt_hdr_t) + + uint16_decode(&p_buf[BLE_GATTC_EVT_CHAR_VALS_READ_RSP_LEN_POSITION]); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + else + { + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + *p_event_len = event_len; + } + + p_event->header.evt_id = BLE_GATTC_EVT_CHAR_VALS_READ_RSP; + + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.conn_handle)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.gatt_status)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.error_handle)); + + //Event structure for BLE_GATTC_EVT_CHAR_VALS_READ_RSP + error_code = + ble_gattc_evt_char_vals_read_rsp_t_dec(p_buf, packet_len, &index, + &(p_event->evt.gattc_evt.params.char_vals_read_rsp)); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return error_code; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_desc_disc_rsp.c b/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_desc_disc_rsp.c new file mode 100644 index 0000000..6e44502 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_desc_disc_rsp.c @@ -0,0 +1,95 @@ +/* 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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_gattc_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_desc_disc_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 6, packet_len); + + uint16_t tmp_conn_handle; + uint16_t tmp_gatt_status; + uint16_t tmp_error_handle; + uint16_t tmp_service_count; + uint16_dec(p_buf, packet_len, &index, &tmp_conn_handle); + uint16_dec(p_buf, packet_len, &index, &tmp_gatt_status); + uint16_dec(p_buf, packet_len, &index, &tmp_error_handle); + uint16_dec(p_buf, packet_len, &index, &tmp_service_count); + + uint32_t event_len = offsetof(ble_evt_t, evt.gattc_evt.params.desc_disc_rsp) + + sizeof (uint16_t) + tmp_service_count * sizeof (ble_gattc_desc_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTC_EVT_DESC_DISC_RSP; + p_event->header.evt_len = event_len; + p_event->evt.gattc_evt.conn_handle = tmp_conn_handle; + p_event->evt.gattc_evt.gatt_status = tmp_gatt_status; + p_event->evt.gattc_evt.error_handle = tmp_error_handle; + p_event->evt.gattc_evt.params.desc_disc_rsp.count = tmp_service_count; + + SER_ASSERT_LENGTH_LEQ(index + (tmp_service_count * 5), packet_len); + + for (uint16_t i = 0; i < tmp_service_count; i++) + { + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.desc_disc_rsp.descs[i].handle); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.desc_disc_rsp.descs[i].uuid.uuid); + uint8_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.desc_disc_rsp.descs[i].uuid.type); + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_hvx.c b/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_hvx.c new file mode 100644 index 0000000..f20f499 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_hvx.c @@ -0,0 +1,66 @@ +/* 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 "ble_gattc_evt_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_hvx_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint16_t tmp_attr_len; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(11, packet_len); + + tmp_attr_len = uint16_decode(&(p_buf[9])); + + uint32_t event_len = offsetof(ble_evt_t, evt.gattc_evt.params.hvx) + + sizeof (ble_gattc_evt_hvx_t) - 1 + tmp_attr_len; + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTC_EVT_HVX; + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.conn_handle)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.gatt_status)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.error_handle)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.hvx.handle)); + uint8_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.hvx.type)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.hvx.len)); + + SER_ASSERT_LENGTH_LEQ(index + tmp_attr_len, packet_len); + + if (tmp_attr_len > 0) + { + memcpy(&(p_event->evt.gattc_evt.params.hvx.data[0]), &(p_buf[index]), tmp_attr_len); + index += tmp_attr_len; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c b/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c new file mode 100644 index 0000000..85d43c0 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c @@ -0,0 +1,78 @@ +/* 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 "ble_gattc_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_prim_srvc_disc_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 6, packet_len); + + uint16_t tmp_conn_handle; + uint16_t tmp_gatt_status; + uint16_t tmp_error_handle; + uint16_t tmp_service_count; + uint16_dec(p_buf, packet_len, &index, &tmp_conn_handle); + uint16_dec(p_buf, packet_len, &index, &tmp_gatt_status); + uint16_dec(p_buf, packet_len, &index, &tmp_error_handle); + uint16_dec(p_buf, packet_len, &index, &tmp_service_count); + + uint32_t event_len = offsetof(ble_evt_t, evt.gattc_evt.params.prim_srvc_disc_rsp) + + sizeof (uint16_t) + tmp_service_count * sizeof (ble_gattc_service_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP; + p_event->header.evt_len = event_len; + p_event->evt.gattc_evt.conn_handle = tmp_conn_handle; + p_event->evt.gattc_evt.gatt_status = tmp_gatt_status; + p_event->evt.gattc_evt.error_handle = tmp_error_handle; + p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.count = tmp_service_count; + + SER_ASSERT_LENGTH_LEQ(index + (tmp_service_count * 7), packet_len); + + for (uint16_t i = 0; i < tmp_service_count; i++) + { + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].uuid.uuid); + uint8_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].uuid.type); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].handle_range. + start_handle); + uint16_dec(p_buf, packet_len, &index, + &p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].handle_range. + end_handle); + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_read_rsp.c b/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_read_rsp.c new file mode 100644 index 0000000..a851447 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_read_rsp.c @@ -0,0 +1,66 @@ +/* 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 "ble_gattc_evt_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint16_t tmp_attr_len; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(12, packet_len); + + tmp_attr_len = uint16_decode(&(p_buf[10])); + + uint32_t event_len = offsetof(ble_evt_t, evt.gattc_evt.params.read_rsp) + + sizeof (ble_gattc_evt_read_rsp_t) - 1 + tmp_attr_len; + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTC_EVT_READ_RSP; + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.conn_handle)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.gatt_status)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.error_handle)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.read_rsp.handle)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.read_rsp.offset)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.read_rsp.len)); + + SER_ASSERT_LENGTH_LEQ(index + tmp_attr_len, packet_len); + + if (tmp_attr_len > 0) + { + memcpy(&(p_event->evt.gattc_evt.params.read_rsp.data[0]), &(p_buf[index]), tmp_attr_len); + index += tmp_attr_len; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_rel_disc_rsp.c b/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_rel_disc_rsp.c new file mode 100644 index 0000000..7f0bd9f --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_rel_disc_rsp.c @@ -0,0 +1,65 @@ +/* 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 "ble_gattc_evt_app.h" +#include "ble_gattc_struct_serialization.h" +#include "ble_serialization.h" +#include "app_util.h" + +#define BLE_GATTC_EVT_REL_DISC_RSP_COUNT_POSITION 6 + + +uint32_t ble_gattc_evt_rel_disc_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t event_len = 0; + uint16_t include_count = 0; + + uint32_t error_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(8, packet_len); + + include_count = uint16_decode(&p_buf[BLE_GATTC_EVT_REL_DISC_RSP_COUNT_POSITION]); + event_len = (uint16_t) (offsetof(ble_evt_t, evt.gattc_evt.params.rel_disc_rsp.includes)) - + sizeof (ble_evt_hdr_t) + (include_count * sizeof (ble_gattc_include_t)); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTC_EVT_REL_DISC_RSP; + error_code = + uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.conn_handle)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.gatt_status)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.error_handle)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = + ble_gattc_evt_rel_disc_rsp_t_dec(p_buf, packet_len, &index, + &(p_event->evt.gattc_evt.params.rel_disc_rsp)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return error_code; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_timeout.c b/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_timeout.c new file mode 100644 index 0000000..8f831d3 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_timeout.c @@ -0,0 +1,75 @@ +/* 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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_gattc_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_timeout_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + uint32_t event_len; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 1, packet_len); + + event_len = offsetof(ble_evt_t, evt.gattc_evt.params.timeout) + + sizeof (ble_gattc_evt_timeout_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTC_EVT_TIMEOUT; + p_event->header.evt_len = event_len; + + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gattc_evt.conn_handle); + uint8_dec(p_buf, packet_len, &index, &p_event->evt.gattc_evt.params.timeout.src); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_write_rsp.c b/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_write_rsp.c new file mode 100644 index 0000000..bfed5e2 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_write_rsp.c @@ -0,0 +1,66 @@ +/* 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 "ble_gattc_evt_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_write_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(13, packet_len); + + uint16_t tmp_attr_len = uint16_decode(&(p_buf[11])); + + uint32_t event_len = offsetof(ble_evt_t, evt.gattc_evt.params.write_rsp) + + sizeof (ble_gattc_evt_write_rsp_t) - 1 + tmp_attr_len; + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTC_EVT_WRITE_RSP; + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.conn_handle)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.gatt_status)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.error_handle)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.write_rsp.handle)); + uint8_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.write_rsp.write_op)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.write_rsp.offset)); + uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.write_rsp.len)); + + SER_ASSERT_LENGTH_LEQ(index + tmp_attr_len, packet_len); + + if (tmp_attr_len > 0) + { + memcpy(&(p_event->evt.gattc_evt.params.write_rsp.data[0]), &(p_buf[index]), tmp_attr_len); + index += tmp_attr_len; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gattc_hv_confirm.c b/components/serialization/application/codecs/s130/serializers/ble_gattc_hv_confirm.c new file mode 100644 index 0000000..f745640 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gattc_hv_confirm.c @@ -0,0 +1,49 @@ +/* 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 "ble_gattc_app.h" +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gattc_hv_confirm_req_enc(uint16_t conn_handle, + uint16_t handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint8_t op_code = SD_BLE_GATTC_HV_CONFIRM; + uint32_t err_code = NRF_SUCCESS; + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + + err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return NRF_SUCCESS; +} + +uint32_t ble_gattc_hv_confirm_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_HV_CONFIRM, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gattc_primary_services_discover.c b/components/serialization/application/codecs/s130/serializers/ble_gattc_primary_services_discover.c new file mode 100644 index 0000000..762508b --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gattc_primary_services_discover.c @@ -0,0 +1,59 @@ +/* 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 "ble_gattc_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_primary_services_discover_req_enc(uint16_t conn_handle, + uint16_t start_handle, + ble_uuid_t const * const p_srvc_uuid, + uint8_t * const p_buf, + uint32_t * p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 5, *p_buf_len); + + p_buf[index++] = SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER; + index += uint16_encode(conn_handle, &p_buf[index]); + index += uint16_encode(start_handle, &p_buf[index]); + + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + + p_buf[index++] = (p_srvc_uuid != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_srvc_uuid != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len); + + index += uint16_encode(p_srvc_uuid->uuid, &p_buf[index]); + p_buf[index++] = p_srvc_uuid->type; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_primary_services_discover_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER, + p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gattc_read.c b/components/serialization/application/codecs/s130/serializers/ble_gattc_read.c new file mode 100644 index 0000000..1d4b5ec --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gattc_read.c @@ -0,0 +1,47 @@ +/* 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 "ble_gattc_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_read_req_enc(uint16_t conn_handle, + uint16_t handle, + uint16_t offset, + uint8_t * const p_buf, + uint32_t * p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 7, *p_buf_len); + + p_buf[index++] = SD_BLE_GATTC_READ; + index += uint16_encode(conn_handle, &p_buf[index]); + index += uint16_encode(handle, &p_buf[index]); + index += uint16_encode(offset, &p_buf[index]); + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_read_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_READ, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gattc_relationships_discover.c b/components/serialization/application/codecs/s130/serializers/ble_gattc_relationships_discover.c new file mode 100644 index 0000000..943457e --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gattc_relationships_discover.c @@ -0,0 +1,57 @@ +/* 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 "ble_gattc_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_relationships_discover_req_enc( + uint16_t conn_handle, + ble_gattc_handle_range_t const * const p_handle_range, + uint8_t * const p_buf, + uint32_t * p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len); + + p_buf[index++] = SD_BLE_GATTC_RELATIONSHIPS_DISCOVER; + index += uint16_encode(conn_handle, &p_buf[index]); + + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + p_buf[index++] = (p_handle_range != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_handle_range != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 4, *p_buf_len); + + index += uint16_encode(p_handle_range->start_handle, &p_buf[index]); + index += uint16_encode(p_handle_range->end_handle, &p_buf[index]); + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_relationships_discover_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, + p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gattc_write.c b/components/serialization/application/codecs/s130/serializers/ble_gattc_write.c new file mode 100644 index 0000000..edfe93a --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gattc_write.c @@ -0,0 +1,68 @@ +/* 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 "ble_gattc_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gattc_write_req_enc(uint16_t conn_handle, + ble_gattc_write_params_t const * const p_write_params, + uint8_t * const p_buf, + uint32_t * p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 4, *p_buf_len); + + p_buf[index++] = SD_BLE_GATTC_WRITE; + index += uint16_encode(conn_handle, &p_buf[index]); + p_buf[index++] = (p_write_params == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + if (p_write_params != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 9, *p_buf_len); + p_buf[index++] = p_write_params->write_op; + p_buf[index++] = p_write_params->flags; + index += uint16_encode(p_write_params->handle, &p_buf[index]); + index += uint16_encode(p_write_params->offset, &p_buf[index]); + index += uint16_encode(p_write_params->len, &p_buf[index]); + + SER_ERROR_CHECK(p_write_params->len <= BLE_GATTC_WRITE_P_VALUE_LEN_MAX, + NRF_ERROR_INVALID_PARAM); + + p_buf[index++] = (p_write_params->p_value == NULL) ? + SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + if (p_write_params->p_value != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + p_write_params->len, *p_buf_len); + memcpy(&p_buf[index], p_write_params->p_value, p_write_params->len); + index += p_write_params->len; + } + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_write_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_WRITE, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gatts_app.h b/components/serialization/application/codecs/s130/serializers/ble_gatts_app.h new file mode 100644 index 0000000..54b41a0 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gatts_app.h @@ -0,0 +1,554 @@ +/* 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. + * + */ +#ifndef BLE_GATTS_APP_H__ +#define BLE_GATTS_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s130_codecs Application s130 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gatts_app GATTS Application command request encoders and command response decoders + * @{ + * @ingroup ser_app_s130_codecs + * + * @brief GATTS Application command request encoders and command response decoders. + */ +#include "ble_gatts.h" +#include "ble.h" + +/**@brief Encodes @ref sd_ble_gatts_value_get command request. + * + * @sa @ref nrf51_gatts_value_get_encoding for packet format, + * @ref ble_gatts_value_get_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle. + * @param[in] handle Attribute handle. + * @param[in] p_value Pointer to attribute value information. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_data_len and \p p_data will not be updated by the command + * request encoder. Updated values are set by @ref ble_gatts_value_get_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_value_get_req_enc(uint16_t conn_handle, + uint16_t handle, + ble_gatts_value_t const * const p_value, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_value_get command. + * + * @sa @ref nrf51_gatts_value_get_encoding for packet format, + * @ref ble_gatts_value_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_value Pointer to structure where the attribute value will be stored. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Length of \p p_value is too small to hold decoded + * value from response. + */ +uint32_t ble_gatts_value_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gatts_value_t * const p_value, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gatts_hvx command request. + * + * @sa @ref nrf51_gatts_hvx_encoding for packet format, + * @ref ble_gatts_hvx_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle. + * @param[in] p_hvx_params Pointer to an HVx parameters structure to be encoded. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_hvx_params will not be updated by the command + * request encoder. Updated values are set by @ref ble_gatts_hvx_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_hvx_req_enc(uint16_t conn_handle, + ble_gatts_hvx_params_t const * const p_hvx_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_hvx command. + * + * @sa @ref nrf51_gatts_hvx_encoding for packet format, + * @ref ble_gatts_hvx_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * @param[out] pp_bytes_written Pointer to pointer to location where number of bytes is written. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_hvx_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code, + uint16_t * * const pp_bytes_written); + +/**@brief Encodes @ref sd_ble_gatts_characteristic_add command request. + * + * @sa @ref nrf51_characteristics_add_encoding for packet format, + * @ref ble_gatts_characteristic_add_rsp_dec for command response decoder. + * + * @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 Pointer to a @ref ble_gatts_char_md_t structure, characteristic + * metadata. + * @param[in] p_attr_char_value Pointer to a @ref ble_gatts_attr_t structure, corresponding to + * the characteristic value. + * @param[in] p_handles Pointer to a @ref ble_gatts_char_handles_t structure, where the + * assigned handles will be stored. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_handles will not be updated by the command + * request encoder. Updated values are set by @ref ble_gatts_characteristic_add_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_characteristic_add_req_enc + (uint16_t service_handle, + ble_gatts_char_md_t const * const p_char_md, + ble_gatts_attr_t const * const p_attr_char_value, + ble_gatts_char_handles_t const * const p_handles, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_characteristic_add command. + * + * @sa @ref nrf51_characteristics_add_encoding for packet format, + * @ref ble_gatts_characteristic_add_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_handles Pointer to pointer to location where handles should be decoded. + * @param[out] p_result_code Pointer to command result code decode location. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_characteristic_add_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * * const pp_handles, + uint32_t * const p_result_code); + + +/**@brief Encodes @ref sd_ble_gatts_service_add command request. + * + * @sa @ref nrf51_gatts_service_add_encoding for packet format, + * @ref ble_gatts_service_add_rsp_dec for command response decoder. + * + * @param[in] type Toggles between primary and secondary services, + * see @ref BLE_GATTS_SRVC_TYPES. + * @param[in] p_uuid Pointer to service UUID. + * @param[in] p_conn_handle Pointer to a 16-bit word where the assigned handle will be stored. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_conn_handle will not be updated by the command + * request encoder. Updated values are set by @ref ble_gatts_service_add_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_service_add_req_enc(uint8_t type, + ble_uuid_t const * const p_uuid, + uint16_t const * const p_conn_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_service_add command. + * + * @sa @ref nrf51_gatts_service_add_encoding for packet format, + * @ref ble_gatts_service_add_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Connection handle. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_service_add_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gatts_sys_attr_set command request. + * + * @sa @ref nrf51_gatts_sys_attr_set_encoding for packet format, + * @ref ble_gatts_sys_attr_set_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle. + * @param[in] p_sys_attr_data Pointer to a buffer (at least \p sys_attr_data_len bytes long) + * containing the attribute value to write. + * @param[in] sys_attr_data_len Length (in bytes) of \p p_sys_attr_data. + * @param[in] flags Optional additional flags. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_sys_attr_set_req_enc(uint16_t conn_handle, + uint8_t const * const p_sys_attr_data, + uint16_t sys_attr_data_len, + uint32_t flags, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_sys_attr_set command. + * + * @sa @ref nrf51_gatts_sys_attr_set_encoding for packet format, + * @ref ble_gatts_sys_attr_set_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_sys_attr_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gatts_value_set command request. + * + * @sa @ref nrf51_gatts_value_set_encoding for packet format, + * @ref ble_gatts_value_set_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle. + * @param[in] handle Attribute handle. + * @param[in] p_value Pointer to attribute value information. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_value_set_req_enc(uint16_t conn_handle, + uint16_t handle, + ble_gatts_value_t * p_value, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_value_set command. + * + * @sa @ref nrf51_gatts_value_set_encoding for packet format, + * @ref ble_gatts_value_set_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_value Pointer to attribute value information.. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_value_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gatts_value_t * const p_value, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gatts_sys_attr_get command request. + * + * @sa @ref nrf51_gatts_sys_attr_get_encoding for packet format, + * @ref ble_gatts_sys_attr_get_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle of the connection. + * @param[in] p_sys_attr_data Pointer to buffer where updated information about system + * attributes will be stored. Can be NULL to calculate required + * size. + * @param[in] p_sys_attr_data_len Size of p_sys_attr_data buffer if \p p_sys_attr_data is + * not NULL. + * @param[in] flags Additional optional flags. + * @param[in,out] p_buf Pointer to buffer where encoded data command will + * be returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @note \p p_sys_attr_data and \p p_sys_attr_data_len will not be updated by the command + * request encoder. Updated values are set by @ref ble_gatts_sys_attr_get_rsp_dec. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_sys_attr_get_req_enc(uint16_t conn_handle, + uint8_t const * const p_sys_attr_data, + uint16_t const * const p_sys_attr_data_len, + uint32_t flags, + uint8_t * const p_buf, + uint32_t * p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_sys_attr_get command. + * + * @sa @ref nrf51_gatts_sys_attr_get_encoding for packet format, + * @ref ble_gatts_sys_attr_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_sys_attr_data Pointer to a buffer where updated information about system + * attributes will be stored. + * @param[in,out] p_sys_attr_data_len \c in: Size (in bytes) of \p p_sys_attr_data buffer. + * \c out: Length of decoded contents of \p p_sys_attr_data. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Length of \p p_sys_attr_data is too small to hold decoded + * value from response. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_sys_attr_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * const p_sys_attr_data, + uint16_t * const p_sys_attr_data_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gatts_descriptor_add command request. + * + * @sa @ref nrf51_descriptor_add_encoding for packet format, + * @ref ble_gatts_descriptor_add_rsp_dec for command response decoder. + * + * @param[in] char_handle Handle of the characteristic where the description is to be placed. + * If @ref BLE_GATT_HANDLE_INVALID is used, it will be placed + * sequentially. + * @param[in] p_attr Pointer to a @ref ble_gatts_attr_t structure, characteristic + * metadata. + * @param[in] p_handle Pointer to a @ref ble_gatts_char_handles_t structure, where the + * assigned handles will be stored. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_descriptor_add_req_enc(uint16_t char_handle, + ble_gatts_attr_t const * const p_attr, + uint16_t * const p_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_descriptor_add command. + * + * @sa @ref nrf51_descriptor_add_encoding for packet format, + * @ref ble_gatts_descriptor_add_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_handle Pointer to bufer where descriptor handle will be + returned. + * @param[out] p_result_code Pointer to command result code decode location. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_descriptor_add_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_handle, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gatts_include_add command request. + * + * @sa @ref nrf51_gatts_include_add_encoding for packet format, + * @ref ble_gatts_include_add_rsp_dec for command response decoder. + * + * @param[in] service_handle Handle of the service where the included service is to be placed. + * @param[in] inc_srvc_handle Handle of the included service + * @param[in] p_include_handle Pointer to Pointer to a 16-bit word where the assigned handle will be stored. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_include_add_req_enc(uint16_t service_handle, + uint16_t inc_srvc_handle, + uint16_t * const p_include_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_include_add command. + * + * @sa @ref nrf51_gatts_include_add_encoding for packet format, + * @ref ble_gatts_include_add_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_include_handle Pointer to a 16-bit word where the assigned handle will be stored. + * @param[out] p_result_code Pointer to command result code decode location. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_include_add_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_include_handle, + uint32_t * const p_result_code); + + +/**@brief Encodes @ref sd_ble_gatts_rw_authorize_reply command request. + * + * @sa @ref nrf51_gatts_rw_authorize_reply_encoding for packet format, + * @ref ble_gatts_rw_authorize_reply_rsp_dec for command response decoder. + * + * @param[in] conn_handle Connection handle. + * @param[in] p_reply_params Pointer to \ref ble_gatts_rw_authorize_reply_params_t + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Encoding failure. Invalid param provided in p_reply_params. + */ +uint32_t ble_gatts_rw_authorize_reply_req_enc( + uint16_t conn_handle, + ble_gatts_rw_authorize_reply_params_t const * const + p_reply_params, + uint8_t * const + p_buf, + uint32_t * const + p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_rw_authorize_reply command. + * + * @sa @ref nrf51_gatts_rw_authorize_reply_encoding for packet format, + * @ref ble_gatts_rw_authorize_reply_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_rw_authorize_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Encodes @ref sd_ble_gatts_service_changed command request. + * + * @sa @ref nrf51_service_changed_encoding for packet format, + * @ref ble_gatts_service_changed_rsp_dec for command response decoder. + * + * @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. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Encoding failure. Invalid param provided in p_reply_params. + */ +uint32_t ble_gatts_service_changed_req_enc(uint16_t conn_handle, + uint16_t start_handle, + uint16_t end_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_ble_gatts_service_changed command. + * + * @sa @ref nrf51_service_changed_encoding for packet format, + * @ref ble_gatts_service_changed_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_gatts_service_changed_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/** @} */ +#endif //BLE_GATTS_APP_H__ + + diff --git a/components/serialization/application/codecs/s130/serializers/ble_gatts_characteristic_add.c b/components/serialization/application/codecs/s130/serializers/ble_gatts_characteristic_add.c new file mode 100644 index 0000000..75e164d --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gatts_characteristic_add.c @@ -0,0 +1,89 @@ +/* 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 "ble_gatts_app.h" +#include +#include "ble_serialization.h" +#include "ble_gatts.h" +#include "app_util.h" +#include "cond_field_serialization.h" +#include "ble_gatts_struct_serialization.h" + +uint32_t ble_gatts_characteristic_add_req_enc( + uint16_t service_handle, + ble_gatts_char_md_t const * const p_char_md, + ble_gatts_attr_t const * const p_attr_char_value, + ble_gatts_char_handles_t const * const p_handles, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + uint8_t opcode = SD_BLE_GATTS_CHARACTERISTIC_ADD; + uint32_t buf_len = *p_buf_len; + + err_code = uint8_t_enc(&opcode, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&service_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_char_md, p_buf, buf_len, &index, ble_gatts_char_md_enc); + SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_attr_char_value, p_buf, buf_len, &index, ble_gatts_attr_enc); + SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_handles, p_buf, buf_len, &index, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gatts_characteristic_add_rsp_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * * const pp_handles, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t index = 0; + + uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, buf_len, + SD_BLE_GATTS_CHARACTERISTIC_ADD, + p_result_code); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, buf_len); + return NRF_SUCCESS; + } + + err_code = cond_field_dec(p_buf, + buf_len, + &index, + (void * *)pp_handles, + ble_gatts_char_handles_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gatts_descriptor_add.c b/components/serialization/application/codecs/s130/serializers/ble_gatts_descriptor_add.c new file mode 100644 index 0000000..ea895bb --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gatts_descriptor_add.c @@ -0,0 +1,91 @@ +/* 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 "ble_gatts_app.h" +#include +#include +#include "ble_serialization.h" +#include "ble_gap.h" +#include "app_util.h" +#include "cond_field_serialization.h" +#include "ble_gatts_struct_serialization.h" + + +uint32_t ble_gatts_descriptor_add_req_enc(uint16_t char_handle, + ble_gatts_attr_t const * const p_attr, + uint16_t * const p_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(1, *p_buf_len); + p_buf[index++] = SD_BLE_GATTS_DESCRIPTOR_ADD; + + uint32_t err_code = uint16_t_enc(&char_handle, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_attr, + p_buf, + *p_buf_len, + &index, + ble_gatts_attr_enc); + SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + p_buf[index++] = (p_handle != NULL) ? SER_FIELD_PRESENT : + SER_FIELD_NOT_PRESENT; + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_gatts_descriptor_add_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_handle, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t index = 0; + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, + &index, + packet_len, + SD_BLE_GATTS_DESCRIPTOR_ADD, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + SER_ASSERT_LENGTH_LEQ(index + 2, packet_len); + SER_ASSERT_NOT_NULL(p_handle); + + uint16_dec(p_buf, packet_len, &index, p_handle); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_app.h b/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_app.h new file mode 100644 index 0000000..d7c3fff --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_app.h @@ -0,0 +1,186 @@ +/* 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 BLE_GATTS_EVT_APP_H__ +#define BLE_GATTS_EVT_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s130_codecs Application s130 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gatts_evt_app GATTS Application event decoders + * @{ + * @ingroup ser_app_s130_codecs + * + * @brief GATTS Application event decoders. + */ +#include "ble.h" + +/** + * @brief Decodes ble_gatts_evt_hvc event. + * + * @sa @ref nrf51_gatts_evt_hvc_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gatts_evt_hvc_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gatts_evt_rw_authorize_request event. + * + * @sa @ref nrf51_evt_rw_authorize_request for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gatts_evt_rw_authorize_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gatts_evt_sc_confirm event. + * + * @sa @ref nrf51_gatts_evt_sc_confirm_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gatts_evt_sc_confirm_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gatts_evt_sys_attr_missing event. + * + * @sa @ref nrf51_evt_sys_attr_missing_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gatts_evt_sys_attr_missing_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gatts_evt_timeout event. + * + * @sa @ref nrf51_gatts_evt_timeout_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gatts_evt_timeout_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** + * @brief Decodes ble_gatts_evt_write event. + * + * @sa @ref nrf51_evt_write_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_gatts_evt_write_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** @} */ +#endif diff --git a/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_hvc.c b/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_hvc.c new file mode 100644 index 0000000..2c1c5aa --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_hvc.c @@ -0,0 +1,51 @@ +/* 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 "ble_gatts_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_evt_hvc_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 1, packet_len); + + uint32_t event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gatts_evt_hvc_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTS_EVT_HVC; + p_event->header.evt_len = event_len; + + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gatts_evt.conn_handle); + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gatts_evt.params.hvc.handle); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_rw_authorize_request.c b/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_rw_authorize_request.c new file mode 100644 index 0000000..86f1b35 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_rw_authorize_request.c @@ -0,0 +1,78 @@ +/* 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 "ble_gatts_evt_app.h" +#include "ble_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "app_ble_user_mem.h" +#include "app_util.h" + +extern ser_ble_user_mem_t m_app_user_mem_table[]; + +uint32_t ble_gatts_evt_rw_authorize_request_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + uint32_t in_event_len = *p_event_len; + + *p_event_len = offsetof(ble_evt_t, evt.gatts_evt.params) - sizeof (ble_evt_hdr_t); + + uint16_t conn_handle; + err_code = uint16_t_dec(p_buf, packet_len, &index, &conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + void * p_void_authorize_request = NULL; + + if (p_event != NULL) + { + SER_ASSERT_LENGTH_LEQ(*p_event_len, in_event_len); + + p_event->header.evt_id = BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST; + p_event->evt.gatts_evt.conn_handle = conn_handle; + + p_void_authorize_request = &(p_event->evt.gatts_evt.params.authorize_request); + } + uint32_t tmp_event_len = in_event_len - *p_event_len; + err_code = ble_gatts_evt_rw_authorize_request_t_dec(p_buf, + packet_len, + &index, + &tmp_event_len, + p_void_authorize_request); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_event_len += tmp_event_len; + + if(p_event != NULL) + { + if((p_event->evt.gatts_evt.params.authorize_request.type == BLE_GATTS_AUTHORIZE_TYPE_WRITE) && (p_event->evt.gatts_evt.params.authorize_request.request.write.op == BLE_GATTS_OP_EXEC_WRITE_REQ_NOW)) + { + uint32_t conn_index; + + if(app_ble_user_mem_context_find(p_event->evt.gatts_evt.conn_handle, &conn_index) != NRF_ERROR_NOT_FOUND) + { + err_code = len16data_dec(p_buf, packet_len, &index, &m_app_user_mem_table[conn_index].mem_block.p_mem, &m_app_user_mem_table[conn_index].mem_block.len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + } + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_sc_confirm.c b/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_sc_confirm.c new file mode 100644 index 0000000..d8d440f --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_sc_confirm.c @@ -0,0 +1,49 @@ +/* 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 "ble_gatts_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_evt_sc_confirm_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE, packet_len); + + uint32_t event_len = SER_EVT_CONN_HANDLE_SIZE; + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTS_EVT_SC_CONFIRM; + p_event->header.evt_len = event_len; + + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gatts_evt.conn_handle); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_sys_attr_missing.c b/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_sys_attr_missing.c new file mode 100644 index 0000000..8b17268 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_sys_attr_missing.c @@ -0,0 +1,51 @@ +/* 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 "ble_gatts_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_evt_sys_attr_missing_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(3, packet_len); + + uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gatts_evt.params.sys_attr_missing)) + + sizeof (ble_gatts_evt_sys_attr_missing_t) - + sizeof (ble_evt_hdr_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTS_EVT_SYS_ATTR_MISSING; + p_event->header.evt_len = event_len; + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); + uint8_dec(p_buf, packet_len, &index, &p_event->evt.gatts_evt.params.sys_attr_missing.hint); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_timeout.c b/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_timeout.c new file mode 100644 index 0000000..fba0b11 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_timeout.c @@ -0,0 +1,50 @@ +/* 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 "ble_gatts_evt_app.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_evt_timeout_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 1, packet_len); + + uint32_t event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gatts_evt_timeout_t); + + if (p_event == NULL) + { + *p_event_len = event_len; + return NRF_SUCCESS; + } + + SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); + + p_event->header.evt_id = BLE_GATTS_EVT_TIMEOUT; + p_event->header.evt_len = event_len; + + uint16_dec(p_buf, packet_len, &index, &p_event->evt.gatts_evt.conn_handle); + uint8_dec(p_buf, packet_len, &index, &p_event->evt.gatts_evt.params.timeout.src); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + *p_event_len = event_len; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_write.c b/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_write.c new file mode 100644 index 0000000..d6e7918 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_write.c @@ -0,0 +1,78 @@ +/* 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 "ble_gatts_evt_app.h" +#include +#include "ble_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "app_ble_user_mem.h" +#include "app_util.h" + +extern ser_ble_user_mem_t m_app_user_mem_table[]; + +uint32_t ble_gatts_evt_write_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = 0; + + uint32_t in_event_len = *p_event_len; + + *p_event_len = offsetof(ble_evt_t, evt.gatts_evt.params) - sizeof (ble_evt_hdr_t); + + uint16_t conn_handle; + err_code = uint16_t_dec(p_buf, packet_len, &index, &conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + void * p_void_write = NULL; + + if (p_event != NULL) + { + SER_ASSERT_LENGTH_LEQ(*p_event_len, in_event_len); + p_event->evt.gatts_evt.conn_handle = conn_handle; + + p_void_write = &(p_event->evt.gatts_evt.params.write); + } + + uint32_t tmp_struct_len = in_event_len - *p_event_len; + err_code = ble_gatts_evt_write_t_dec(p_buf, + packet_len, + &index, + &tmp_struct_len, + p_void_write); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_event_len += tmp_struct_len; + + if(p_event != NULL) + { + if(p_event->evt.gatts_evt.params.write.op == BLE_GATTS_OP_EXEC_WRITE_REQ_NOW) + { + uint32_t conn_index; + + if(app_ble_user_mem_context_find(p_event->evt.gatts_evt.conn_handle, &conn_index) != NRF_ERROR_NOT_FOUND) + { + err_code = len16data_dec(p_buf, packet_len, &index, &m_app_user_mem_table[conn_index].mem_block.p_mem, &m_app_user_mem_table[conn_index].mem_block.len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + } + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gatts_hvx.c b/components/serialization/application/codecs/s130/serializers/ble_gatts_hvx.c new file mode 100644 index 0000000..4682af8 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gatts_hvx.c @@ -0,0 +1,115 @@ +/* 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 "ble_gatts_app.h" +#include +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gap.h" +#include "app_util.h" + + +uint32_t ble_gatts_hvx_req_enc(uint16_t conn_handle, + ble_gatts_hvx_params_t const * const p_hvx_params, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT(p_hvx_params == NULL || + !(p_hvx_params->p_len == NULL && p_hvx_params->p_data != NULL), NRF_ERROR_NULL); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 2 + 1 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GATTS_HVX; + index += uint16_encode(conn_handle, &p_buf[index]); + + p_buf[index++] = (p_hvx_params != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_hvx_params != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 2 + 1 + 2 + 2, *p_buf_len); + index += uint16_encode(p_hvx_params->handle, &p_buf[index]); + p_buf[index++] = p_hvx_params->type; + index += uint16_encode(p_hvx_params->offset, &p_buf[index]); + + if (p_hvx_params->p_len != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 1 + 2 + 1, *p_buf_len); + + SER_ERROR_CHECK(*p_hvx_params->p_len <= BLE_GATTS_VAR_ATTR_LEN_MAX, + NRF_ERROR_INVALID_PARAM); + p_buf[index++] = SER_FIELD_PRESENT; + index += uint16_encode(*(p_hvx_params->p_len), &p_buf[index]); + + if (p_hvx_params->p_data != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 1 + *(p_hvx_params->p_len), *p_buf_len); + p_buf[index++] = SER_FIELD_PRESENT; + memcpy(&(p_buf[index]), p_hvx_params->p_data, *(p_hvx_params->p_len)); + index += *(p_hvx_params->p_len); + } + else + { + p_buf[index++] = SER_FIELD_NOT_PRESENT; + } + } + else + { + p_buf[index++] = SER_FIELD_NOT_PRESENT; + p_buf[index++] = SER_FIELD_NOT_PRESENT; + } + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gatts_hvx_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code, + uint16_t * * const pp_bytes_written) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t err_code; + uint32_t index = 0; + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, + &index, + packet_len, + SD_BLE_GATTS_HVX, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_bytes_written, uint16_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gatts_include_add.c b/components/serialization/application/codecs/s130/serializers/ble_gatts_include_add.c new file mode 100644 index 0000000..cb991a8 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gatts_include_add.c @@ -0,0 +1,74 @@ +/* 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 "ble_gatts_app.h" +#include "ble_serialization.h" +#include "ble_gatts.h" +#include "app_util.h" + + +uint32_t ble_gatts_include_add_req_enc(uint16_t service_handle, + uint16_t inc_srvc_handle, + uint16_t * const p_include_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + SER_ASSERT_LENGTH_LEQ(6, *p_buf_len); + + uint32_t index = 0; + uint32_t buf_len = *p_buf_len; + uint32_t err_code; + uint8_t opCode = SD_BLE_GATTS_INCLUDE_ADD; + uint8_t presenceFlag; + + err_code = uint8_t_enc(&opCode, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + err_code = uint16_t_enc(&service_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + err_code = uint16_t_enc(&inc_srvc_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + presenceFlag = (p_include_handle != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + err_code = uint8_t_enc(&presenceFlag, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + *p_buf_len = index; + return err_code; + +} + + +uint32_t ble_gatts_include_add_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_include_handle, + uint32_t * const p_result_code) +{ + uint32_t index = 0; + uint32_t err_code; + + err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_GATTS_INCLUDE_ADD, + p_result_code); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + SER_ASSERT_NOT_NULL(p_include_handle); + SER_ASSERT_LENGTH_LEQ(index + 2, packet_len); + err_code = uint16_t_dec(p_buf, packet_len, &index, p_include_handle); + SER_ASSERT_LENGTH_EQ(index, packet_len); + return err_code; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gatts_rw_authorize_reply.c b/components/serialization/application/codecs/s130/serializers/ble_gatts_rw_authorize_reply.c new file mode 100644 index 0000000..f792b7e --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gatts_rw_authorize_reply.c @@ -0,0 +1,57 @@ +/* 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 "ble_gatts_app.h" +#include "ble_serialization.h" +#include "app_util.h" +#include "cond_field_serialization.h" +#include "ble_gatts_struct_serialization.h" + +uint32_t ble_gatts_rw_authorize_reply_req_enc( + uint16_t conn_handle, + ble_gatts_rw_authorize_reply_params_t const * const + p_reply_params, + uint8_t * const + p_buf, + uint32_t * const + p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t buf_len = *p_buf_len; + uint8_t opcode = SD_BLE_GATTS_RW_AUTHORIZE_REPLY; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint8_t_enc(&opcode, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_reply_params, p_buf, buf_len, &index, + ble_gatts_rw_authorize_reply_params_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gatts_rw_authorize_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTS_RW_AUTHORIZE_REPLY, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gatts_service_add.c b/components/serialization/application/codecs/s130/serializers/ble_gatts_service_add.c new file mode 100644 index 0000000..443c660 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gatts_service_add.c @@ -0,0 +1,83 @@ +/* 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 "ble_gatts_app.h" +#include "ble_serialization.h" +#include "ble_gatts.h" +#include "app_util.h" + + +uint32_t ble_gatts_service_add_req_enc(uint8_t type, + ble_uuid_t const * const p_uuid, + uint16_t const * const p_conn_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 1 + 1 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_GATTS_SERVICE_ADD; + p_buf[index++] = type; + + p_buf[index++] = (p_uuid != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_uuid != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len); + index += uint16_encode(p_uuid->uuid, &p_buf[index]); + p_buf[index++] = p_uuid->type; + } + + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + p_buf[index++] = (p_conn_handle != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gatts_service_add_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint32_t * const p_result_code) +{ + uint32_t index = 0; + + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_GATTS_SERVICE_ADD, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_conn_handle); + + SER_ASSERT_LENGTH_LEQ(index + 2, packet_len); + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return decode_result; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gatts_service_changed.c b/components/serialization/application/codecs/s130/serializers/ble_gatts_service_changed.c new file mode 100644 index 0000000..aba707e --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gatts_service_changed.c @@ -0,0 +1,55 @@ +/* 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 "ble_gatts_app.h" +#include "ble_serialization.h" +#include "ble_gatts.h" +#include "app_util.h" + + +uint32_t ble_gatts_service_changed_req_enc(uint16_t conn_handle, + uint16_t start_handle, + uint16_t end_handle, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code; + uint8_t opcode = SD_BLE_GATTS_SERVICE_CHANGED; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + err_code = uint8_t_enc(&opcode, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&conn_handle, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&start_handle, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&end_handle, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_gatts_service_changed_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTS_SERVICE_CHANGED, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gatts_sys_attr_get.c b/components/serialization/application/codecs/s130/serializers/ble_gatts_sys_attr_get.c new file mode 100644 index 0000000..6f36b20 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gatts_sys_attr_get.c @@ -0,0 +1,113 @@ +/* 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 "ble_gatts_app.h" +#include +#include +#include "ble_serialization.h" +#include "ble_gap.h" +#include "app_util.h" + + +uint32_t ble_gatts_sys_attr_get_req_enc(uint16_t conn_handle, + uint8_t const * const p_sys_attr_data, + uint16_t const * const p_sys_attr_data_len, + uint32_t flags, + uint8_t * const p_buf, + uint32_t * p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 1 + 2 + 1 + 4, *p_buf_len); + p_buf[index++] = SD_BLE_GATTS_SYS_ATTR_GET; + index += uint16_encode(conn_handle, &p_buf[index]); + + p_buf[index++] = (p_sys_attr_data_len != NULL) ? SER_FIELD_PRESENT : + SER_FIELD_NOT_PRESENT; + + if (p_sys_attr_data_len != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 2, *p_buf_len); + index += uint16_encode(*p_sys_attr_data_len, &p_buf[index]); + } + + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + p_buf[index++] = (p_sys_attr_data != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + err_code = uint32_t_enc(&flags, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gatts_sys_attr_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * const p_sys_attr_data, + uint16_t * const p_sys_attr_data_len, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t index = 0; + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, + &index, + packet_len, + SD_BLE_GATTS_SYS_ATTR_GET, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + SER_ASSERT_LENGTH_LEQ(index + 2 + 1, packet_len); + + uint16_t sys_attr_len; + uint16_dec(p_buf, packet_len, &index, &sys_attr_len); + + if (p_buf[index++] == SER_FIELD_PRESENT) + { + SER_ASSERT_NOT_NULL(p_sys_attr_data); + SER_ASSERT_NOT_NULL(p_sys_attr_data_len); + SER_ASSERT(sys_attr_len <= *p_sys_attr_data_len, NRF_ERROR_DATA_SIZE); + + SER_ASSERT_LENGTH_LEQ(index + sys_attr_len, packet_len); + memcpy(p_sys_attr_data, &p_buf[index], sys_attr_len); + *p_sys_attr_data_len = sys_attr_len; + index += sys_attr_len; + } + else + { + if (p_sys_attr_data_len != NULL) + { + *p_sys_attr_data_len = sys_attr_len; + } + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gatts_sys_attr_set.c b/components/serialization/application/codecs/s130/serializers/ble_gatts_sys_attr_set.c new file mode 100644 index 0000000..b8830a6 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gatts_sys_attr_set.c @@ -0,0 +1,65 @@ +/* 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 "ble_gatts_app.h" +#include +#include "ble_serialization.h" +#include "ble_gatts.h" +#include "app_util.h" + + +uint32_t ble_gatts_sys_attr_set_req_enc(uint16_t conn_handle, + uint8_t const * const p_sys_attr_data, + uint16_t sys_attr_data_len, + uint32_t flags, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 8, *p_buf_len); + + p_buf[index++] = SD_BLE_GATTS_SYS_ATTR_SET; + index += uint16_encode(conn_handle, &p_buf[index]); + + p_buf[index++] = (p_sys_attr_data != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_sys_attr_data != NULL) + { + //lint -save -esym(670,memcpy) + SER_ERROR_CHECK(sys_attr_data_len <= BLE_GATTS_VAR_ATTR_LEN_MAX, NRF_ERROR_INVALID_PARAM); + SER_ASSERT_LENGTH_LEQ(index + 2 + sys_attr_data_len + 4, *p_buf_len); + index += uint16_encode(sys_attr_data_len, &p_buf[index]); + memcpy(&(p_buf[index]), p_sys_attr_data, sys_attr_data_len); + //lint -restore + index += sys_attr_data_len; + } + + err_code = uint32_t_enc(&flags, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gatts_sys_attr_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTS_SYS_ATTR_SET, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gatts_value_get.c b/components/serialization/application/codecs/s130/serializers/ble_gatts_value_get.c new file mode 100644 index 0000000..54d5844 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gatts_value_get.c @@ -0,0 +1,126 @@ +/* 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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_gatts_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" +#include "cond_field_serialization.h" +#include "ble_gatts_struct_serialization.h" + +uint32_t ble_gatts_value_get_req_enc(uint16_t conn_handle, + uint16_t handle, + ble_gatts_value_t const * const p_value, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + uint32_t total_len = *p_buf_len; + + SER_ASSERT_LENGTH_LEQ(1 + 2 + 2 + 1, total_len); + p_buf[index++] = SD_BLE_GATTS_VALUE_GET; + + err_code = uint16_t_enc(&conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (p_value != NULL) + { + p_buf[index++] = SER_FIELD_PRESENT; + err_code = uint16_t_enc(&(p_value->len), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_value->offset), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(1, total_len - index); + if (p_value->p_value != NULL) + { + p_buf[index++] = SER_FIELD_PRESENT; + } + else + { + p_buf[index++] = SER_FIELD_NOT_PRESENT; + } + } + else + { + p_buf[index++] = SER_FIELD_NOT_PRESENT; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gatts_value_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gatts_value_t * const p_value, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + SER_ASSERT_NOT_NULL(p_value); + + uint32_t err_code; + uint32_t index = 0; + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, + packet_len, SD_BLE_GATTS_VALUE_GET, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + err_code = ble_gatts_value_t_dec(p_buf, packet_len, &index, p_value); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_gatts_value_set.c b/components/serialization/application/codecs/s130/serializers/ble_gatts_value_set.c new file mode 100644 index 0000000..e11cffc --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_gatts_value_set.c @@ -0,0 +1,84 @@ +/* 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 "ble_gatts_app.h" +#include +#include "nrf_error.h" +#include "cond_field_serialization.h" +#include "ble_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_gatts_value_set_req_enc(uint16_t conn_handle, + uint16_t handle, + ble_gatts_value_t * p_value, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(1 + 2 + 2, *p_buf_len); + p_buf[index++] = SD_BLE_GATTS_VALUE_SET; + index += uint16_encode(conn_handle, &p_buf[index]); + index += uint16_encode(handle, &p_buf[index]); + + if(p_value != NULL) + { + SER_ERROR_CHECK(p_value->len <= BLE_GATTS_VAR_ATTR_LEN_MAX, NRF_ERROR_INVALID_PARAM); + } + err_code = cond_field_enc(p_value, p_buf, *p_buf_len, &index, ble_gatts_value_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_gatts_value_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gatts_value_t * const p_value, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, + &index, + packet_len, + SD_BLE_GATTS_VALUE_SET, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + err_code = ble_gatts_value_t_dec(p_buf, packet_len, &index, p_value); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_l2cap_app.h b/components/serialization/application/codecs/s130/serializers/ble_l2cap_app.h new file mode 100644 index 0000000..626ccc4 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_l2cap_app.h @@ -0,0 +1,163 @@ +/* Copyright (c) 2014 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. + * + */ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s130_codecs Application s130 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_l2cap_app L2CAP Application command request encoders and command response decoders + * @{ + * @ingroup ser_app_s130_codecs + * + * @brief L2CAP Application command request encoders and command response decoders. + */ + +#ifndef BLE_L2CAP_APP_H__ +#define BLE_L2CAP_APP_H__ + +#include "ble.h" +#include "ble_types.h" +#include "ble_ranges.h" +#include "ble_err.h" +#include "ble_l2cap.h" + +/**@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. + * + * @param[in] cid L2CAP CID. + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_l2cap_cid_register_req_enc(uint16_t cid, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_l2cap_cid_register command. + * + * @sa @ref nrf51_adv_start_encoding for packet format, + * @ref ble_l2cap_cid_register_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_l2cap_cid_register_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Unregister a CID with L2CAP. + * + * @details This unregisters a previously registered higher protocol layer with the L2CAP multiplexer. + * + * @param[in] cid L2CAP CID. + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_l2cap_cid_unregister_req_enc(uint16_t cid, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_l2cap_cid_unregister command. + * + * @sa @ref nrf51_adv_start_encoding for packet format, + * @ref ble_l2cap_cid_unregister_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_l2cap_cid_unregister_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + +/**@brief Transmit an L2CAP packet. + * + * @note It is important to note that a call to this function will consume an application buffer, 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_buffer_count_get for more details. + * + * @param[in] conn_handle Connection Handle. + * @param[in] p_l2cap_header Pointer to a packet header containing length and CID. + * @param[in] p_data Pointer to the data to be transmitted. + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer. + * \c out: Length of encoded command packet. + * + * @return @ref NRF_SUCCESS Successfully queued an L2CAP packet for transmission. + * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + * @return @ref NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, CIDs must be registered beforehand with @ref sd_ble_l2cap_cid_register. + * @return @ref NRF_ERROR_NOT_FOUND CID not found. + * @return @ref NRF_ERROR_NO_MEM Not enough memory to complete operation. + * @return @ref BLE_ERROR_NO_TX_BUFFERS Not enough application buffers available. + * @return @ref NRF_ERROR_DATA_SIZE Invalid data size(s) supplied, see @ref BLE_L2CAP_MTU_DEF. + */ +uint32_t ble_l2cap_tx_req_enc(uint16_t conn_handle, + ble_l2cap_header_t const * const p_l2cap_header, + uint8_t const * const p_data, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Decodes response to @ref sd_ble_l2cap_tx command. + * + * @sa @ref nrf51_adv_start_encoding for packet format, + * @ref ble_l2cap_tx_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match + * expected operation code. + */ +uint32_t ble_l2cap_tx_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code); + + +#endif //BLE_L2CAP_APP_H__ + +/** + @} + */ diff --git a/components/serialization/application/codecs/s130/serializers/ble_l2cap_cid_register.c b/components/serialization/application/codecs/s130/serializers/ble_l2cap_cid_register.c new file mode 100644 index 0000000..de597fe --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_l2cap_cid_register.c @@ -0,0 +1,45 @@ +/* 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 "ble_gap_app.h" +#include +#include "ble_serialization.h" +#include "ble_gap.h" +#include "app_util.h" + +uint32_t ble_l2cap_cid_register_req_enc(uint16_t cid, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len); + + p_buf[index++] = SD_BLE_L2CAP_CID_REGISTER; + err_code = uint16_t_enc(&cid, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_l2cap_cid_register_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_L2CAP_CID_REGISTER, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_l2cap_cid_unregister.c b/components/serialization/application/codecs/s130/serializers/ble_l2cap_cid_unregister.c new file mode 100644 index 0000000..cd6e65a --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_l2cap_cid_unregister.c @@ -0,0 +1,45 @@ +/* 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 "ble_gap_app.h" +#include +#include "ble_serialization.h" +#include "ble_gap.h" +#include "app_util.h" + +uint32_t ble_l2cap_cid_unregister_req_enc(uint16_t cid, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len); + + p_buf[index++] = SD_BLE_L2CAP_CID_UNREGISTER; + err_code = uint16_t_enc(&cid, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_l2cap_cid_unregister_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_L2CAP_CID_UNREGISTER, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_l2cap_evt_app.h b/components/serialization/application/codecs/s130/serializers/ble_l2cap_evt_app.h new file mode 100644 index 0000000..cb7b22c --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_l2cap_evt_app.h @@ -0,0 +1,61 @@ +/* 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 BLE_L2CAP_EVT_APP_H__ +#define BLE_L2CAP_EVT_APP_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s130_codecs Application s130 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_l2cap_evt_app L2CAP Application event decoders + * @{ + * @ingroup ser_app_s130_codecs + * + * @brief L2CAP Application event decoders. + */ +#include "ble.h" + +/** + * @brief Decodes ble_l2cap_evt_rx event. + * + * @sa @ref nrf51_l2cap_evt_rx_encoding for packet format. + * + * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. + * + * @param[in] p_buf Pointer to the beginning of an event packet. + * @param[in] packet_len Length (in bytes) of the event packet. + * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be + * stored. If NULL, required length will be returned in \p p_event_len. + * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. + * \c out: Length of decoded contents of \p p_event. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t ble_l2cap_evt_rx_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len); + +/** @} */ +#endif diff --git a/components/serialization/application/codecs/s130/serializers/ble_l2cap_evt_rx.c b/components/serialization/application/codecs/s130/serializers/ble_l2cap_evt_rx.c new file mode 100644 index 0000000..d54682a --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_l2cap_evt_rx.c @@ -0,0 +1,56 @@ +/* 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 "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" +#include "ble_l2cap_evt_app.h" + +uint32_t ble_l2cap_evt_rx_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_evt_t * const p_event, + uint32_t * const p_event_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_event_len); + + uint32_t index = 0; + uint32_t in_event_len = *p_event_len; + + *p_event_len = offsetof(ble_l2cap_evt_t, params); + + uint16_t evt_id; + + uint32_t err_code = uint16_t_dec(p_buf, packet_len, &index, &evt_id); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + void * p_rx = NULL; + + if (p_event) + { + err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.l2cap_evt.conn_handle)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + p_rx = &(p_event->evt.l2cap_evt.params.rx); + } + + uint32_t struct_len = in_event_len - *p_event_len; + err_code = ble_l2cap_evt_rx_t_dec(p_buf, packet_len, &index, &struct_len, p_rx); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_event_len += struct_len; + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_l2cap_tx.c b/components/serialization/application/codecs/s130/serializers/ble_l2cap_tx.c new file mode 100644 index 0000000..83baa90 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_l2cap_tx.c @@ -0,0 +1,61 @@ +/* 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 +#include "ble_l2cap_app.h" +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "ble_gap.h" +#include "app_util.h" +#include "cond_field_serialization.h" + +uint32_t ble_l2cap_tx_req_enc(uint16_t conn_handle, + ble_l2cap_header_t const * const p_l2cap_header, + uint8_t const * const p_data, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(1, *p_buf_len); + p_buf[index++] = SD_BLE_L2CAP_TX; + + err_code = uint16_t_enc(&conn_handle, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_l2cap_header, p_buf, *p_buf_len, &index, ble_l2cap_header_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (p_l2cap_header != NULL) + { + err_code = buf_enc(p_data, p_l2cap_header->len, p_buf, *p_buf_len, &index); + } + else + { + err_code = buf_enc(NULL, 0, p_buf, *p_buf_len, &index); + } + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_l2cap_tx_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_L2CAP_TX, p_result_code); +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_opt_get.c b/components/serialization/application/codecs/s130/serializers/ble_opt_get.c new file mode 100644 index 0000000..7728d66 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_opt_get.c @@ -0,0 +1,126 @@ +/* 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 "ble_app.h" +#include +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_opt_get_req_enc(uint32_t opt_id, + ble_opt_t const * const p_opt, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + SER_ASSERT_LENGTH_LEQ(1+4+1, *p_buf_len); // [OPCODE][OP_ID][PRESENT] + SER_ASSERT(((opt_id == BLE_COMMON_OPT_RADIO_CPU_MUTEX) || + (opt_id == BLE_GAP_OPT_CH_MAP) || + (opt_id == BLE_GAP_OPT_LOCAL_CONN_LATENCY) || + (opt_id == BLE_GAP_OPT_PASSKEY) || + (opt_id == BLE_GAP_OPT_PRIVACY) || + (opt_id == BLE_GAP_OPT_SCAN_REQ_REPORT) || + (opt_id == BLE_GAP_OPT_COMPAT_MODE)) , NRF_ERROR_INVALID_PARAM); + + p_buf[index++] = SD_BLE_OPT_GET; + + err_code = uint32_t_enc(&opt_id, p_buf, *p_buf_len, &index); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + p_buf[index++] = (p_opt == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + *p_buf_len = index; + + return NRF_SUCCESS; +} + +uint32_t ble_opt_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_opt_id, + ble_opt_t * const p_opt, + uint32_t * const p_result_code) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_opt_id); + SER_ASSERT_NOT_NULL(p_opt); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_OPT_GET, + p_result_code); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + (void) uint32_t_dec(p_buf, packet_len, &index, p_opt_id); + SER_ASSERT(((*p_opt_id == BLE_COMMON_OPT_RADIO_CPU_MUTEX) || + (*p_opt_id == BLE_GAP_OPT_CH_MAP) || + (*p_opt_id == BLE_GAP_OPT_LOCAL_CONN_LATENCY) || + (*p_opt_id == BLE_GAP_OPT_PASSKEY) || + (*p_opt_id == BLE_GAP_OPT_PRIVACY) || + (*p_opt_id == BLE_GAP_OPT_SCAN_REQ_REPORT) || + (*p_opt_id == BLE_GAP_OPT_COMPAT_MODE)), NRF_ERROR_INVALID_PARAM); + + switch (*p_opt_id) + { + case BLE_COMMON_OPT_RADIO_CPU_MUTEX: + err_code = ble_common_opt_radio_cpu_mutex_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->common_opt.radio_cpu_mutex)); + break; + case BLE_GAP_OPT_CH_MAP: + err_code = ble_gap_opt_ch_map_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.ch_map)); + break; + case BLE_GAP_OPT_LOCAL_CONN_LATENCY: + err_code = ble_gap_opt_local_conn_latency_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.local_conn_latency)); + break; + case BLE_GAP_OPT_PASSKEY: + err_code = ble_gap_opt_passkey_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.passkey)); + break; + case BLE_GAP_OPT_PRIVACY: + err_code = ble_gap_opt_privacy_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.privacy)); + break; + case BLE_GAP_OPT_SCAN_REQ_REPORT: + err_code = ble_gap_opt_scan_req_report_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.scan_req_report)); + break; + case BLE_GAP_OPT_COMPAT_MODE: + err_code = ble_gap_opt_compat_mode_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.compat_mode)); + break; + } + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + diff --git a/components/serialization/application/codecs/s130/serializers/ble_opt_set.c b/components/serialization/application/codecs/s130/serializers/ble_opt_set.c new file mode 100644 index 0000000..d6772b0 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_opt_set.c @@ -0,0 +1,117 @@ +/* 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 "ble_app.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_opt_set_req_enc(uint32_t const opt_id, + ble_opt_t const * const p_opt, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t initial_buf_len = *p_buf_len; + + SER_ASSERT_LENGTH_LEQ(1 + 4 + 1, initial_buf_len); + + SER_ASSERT(((opt_id == BLE_COMMON_OPT_RADIO_CPU_MUTEX) || + (opt_id == BLE_GAP_OPT_CH_MAP) || + (opt_id == BLE_GAP_OPT_LOCAL_CONN_LATENCY) || + (opt_id == BLE_GAP_OPT_PASSKEY) || + (opt_id == BLE_GAP_OPT_PRIVACY) || + (opt_id == BLE_GAP_OPT_SCAN_REQ_REPORT) || + (opt_id == BLE_GAP_OPT_COMPAT_MODE)), NRF_ERROR_INVALID_PARAM); + + p_buf[index++] = SD_BLE_OPT_SET; + + err_code = uint32_t_enc(&opt_id, p_buf, initial_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (p_opt != NULL) + { + p_buf[index++] = SER_FIELD_PRESENT; + + switch(opt_id) + { + case BLE_COMMON_OPT_RADIO_CPU_MUTEX: + err_code = ble_common_opt_radio_cpu_mutex_t_enc(&(p_opt->common_opt.radio_cpu_mutex),p_buf, initial_buf_len, &index); + break; + case BLE_GAP_OPT_CH_MAP: + err_code = ble_gap_opt_ch_map_t_enc(&(p_opt->gap_opt.ch_map),p_buf, initial_buf_len, &index); + break; + case BLE_GAP_OPT_LOCAL_CONN_LATENCY: + err_code = ble_gap_opt_local_conn_latency_t_enc(&(p_opt->gap_opt.local_conn_latency),p_buf, initial_buf_len, &index); + break; + case BLE_GAP_OPT_PASSKEY: + err_code = ble_gap_opt_passkey_t_enc(&(p_opt->gap_opt.passkey),p_buf, initial_buf_len, &index); + break; + case BLE_GAP_OPT_PRIVACY: + err_code = ble_gap_opt_privacy_t_enc(&(p_opt->gap_opt.privacy),p_buf, initial_buf_len, &index); + break; + case BLE_GAP_OPT_SCAN_REQ_REPORT: + err_code = ble_gap_opt_scan_req_report_t_enc(&(p_opt->gap_opt.scan_req_report),p_buf, initial_buf_len, &index); + break; + case BLE_GAP_OPT_COMPAT_MODE: + err_code = ble_gap_opt_compat_mode_t_enc(&(p_opt->gap_opt.compat_mode),p_buf, initial_buf_len, &index); + break; + } + } + else + { + p_buf[index++] = SER_FIELD_NOT_PRESENT; + } + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_opt_set_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + uint32_t index = 0; + uint32_t error_code; + + error_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_OPT_SET, p_result_code); + + if (error_code != NRF_SUCCESS) + { + return error_code; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_tx_buffer_count_get.c b/components/serialization/application/codecs/s130/serializers/ble_tx_buffer_count_get.c new file mode 100644 index 0000000..944fe63 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_tx_buffer_count_get.c @@ -0,0 +1,68 @@ +/* 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 "ble_app.h" +#include "ble_serialization.h" +#include "app_util.h" +#include "cond_field_serialization.h" + +uint32_t ble_tx_buffer_count_get_req_enc(uint8_t const * const p_count, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint8_t opcode = SD_BLE_TX_BUFFER_COUNT_GET; + uint32_t err_code; + uint32_t total_len = *p_buf_len; + + err_code = uint8_t_enc(&opcode, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_count, p_buf, total_len, &index, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_tx_buffer_count_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * * const pp_count, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t index = 0; + uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_TX_BUFFER_COUNT_GET, p_result_code); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; + } + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_count, uint8_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_user_mem_reply.c b/components/serialization/application/codecs/s130/serializers/ble_user_mem_reply.c new file mode 100644 index 0000000..7a39b6b --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_user_mem_reply.c @@ -0,0 +1,65 @@ +/* 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 "ble_app.h" +#include +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + +uint32_t ble_user_mem_reply_req_enc(uint16_t conn_handle, + ble_user_mem_block_t const * p_block, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + p_buf[index++] = SD_BLE_USER_MEM_REPLY; + + err_code = uint16_t_enc(&conn_handle, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if(p_block != NULL) + { + p_buf[index++] = SER_FIELD_PRESENT; + + // Encoding order is different than structure elements order because + // mem block length should be sent first + err_code = uint16_t_enc(&(p_block->len), p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_block->p_mem, p_buf, *p_buf_len, &index, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + else + { + p_buf[index++] = SER_FIELD_NOT_PRESENT; + } + + *p_buf_len = index; + + return err_code; +} + +uint32_t ble_user_mem_reply_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code) +{ + return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_USER_MEM_REPLY, p_result_code); +} + + diff --git a/components/serialization/application/codecs/s130/serializers/ble_uuid_decode.c b/components/serialization/application/codecs/s130/serializers/ble_uuid_decode.c new file mode 100644 index 0000000..5c3e006 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_uuid_decode.c @@ -0,0 +1,84 @@ +/* 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 "ble_app.h" +#include +#include +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_uuid_decode_req_enc(uint8_t uuid_le_len, + uint8_t const * const p_uuid_le, + ble_uuid_t * const p_uuid, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t err_code; + uint32_t index = 0; + uint32_t buf_len = *p_buf_len; + uint8_t opcode = SD_BLE_UUID_DECODE; + + err_code = uint8_t_enc((void *)&opcode, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = len8data_enc(p_uuid_le, uuid_le_len, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc((void *)p_uuid, p_buf, buf_len, &index, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_uuid_decode_rsp_dec(uint8_t const * const p_buf, + uint32_t buf_len, + ble_uuid_t * * const pp_uuid, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t err_code; + uint32_t index = 0; + + uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, + &index, + buf_len, + SD_BLE_UUID_DECODE, + p_result_code); + + if (decode_result != NRF_SUCCESS) + { + return decode_result; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, buf_len); + return NRF_SUCCESS; + } + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_uuid, ble_uuid_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_uuid_encode.c b/components/serialization/application/codecs/s130/serializers/ble_uuid_encode.c new file mode 100644 index 0000000..5eb8099 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_uuid_encode.c @@ -0,0 +1,93 @@ +/* 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 "ble_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_uuid_encode_req_enc(ble_uuid_t const * const p_uuid, + uint8_t const * const p_uuid_le_len, + uint8_t const * const p_uuid_le, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(1 + 1, *p_buf_len); + + p_buf[index++] = SD_BLE_UUID_ENCODE; + + p_buf[index++] = (p_uuid != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + if (p_uuid != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len); + index += uint16_encode(p_uuid->uuid, &p_buf[index]); + p_buf[index++] = p_uuid->type; + } + + SER_ASSERT_LENGTH_LEQ(index + 2, *p_buf_len); + p_buf[index++] = (p_uuid_le_len == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + p_buf[index++] = (p_uuid_le == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ble_uuid_encode_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * const p_uuid_le_len, + uint8_t * const p_uuid_le, + uint32_t * const p_result_code) +{ + uint32_t index = 0; + uint32_t error_code; + + error_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_UUID_ENCODE, p_result_code); + + if (error_code != NRF_SUCCESS) + { + return error_code; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + + SER_ASSERT_LENGTH_LEQ(index + 1, packet_len); + uint8_t uuid_le_len = p_buf[index++]; + + if (p_uuid_le_len != NULL) + { + if (p_uuid_le != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + uuid_le_len, packet_len); + memcpy(p_uuid_le, &(p_buf[index]), uuid_le_len); + index += uuid_le_len; + } + *p_uuid_le_len = uuid_le_len; + } + + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_uuid_vs_add.c b/components/serialization/application/codecs/s130/serializers/ble_uuid_vs_add.c new file mode 100644 index 0000000..0f686f1 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_uuid_vs_add.c @@ -0,0 +1,83 @@ +/* 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 "ble_app.h" +#include +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_uuid_vs_add_req_enc(ble_uuid128_t const * const p_vs_uuid, + uint8_t * const p_uuid_type, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t err_code; + uint32_t index = 0; + uint32_t buf_len = *p_buf_len; + uint8_t opcode = SD_BLE_UUID_VS_ADD; + + err_code = uint8_t_enc(&opcode, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc((void *)p_vs_uuid, p_buf, buf_len, &index, ble_uuid128_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc((void *)p_uuid_type, p_buf, buf_len, &index, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + + +uint32_t ble_uuid_vs_add_rsp_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint8_t * * const pp_uuid_type, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + SER_ASSERT_NOT_NULL(pp_uuid_type); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = 0; + + err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, + &index, + buf_len, + SD_BLE_UUID_VS_ADD, + p_result_code); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, buf_len); + return NRF_SUCCESS; + } + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_uuid_type, uint8_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} diff --git a/components/serialization/application/codecs/s130/serializers/ble_version_get.c b/components/serialization/application/codecs/s130/serializers/ble_version_get.c new file mode 100644 index 0000000..0485b4f --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/ble_version_get.c @@ -0,0 +1,73 @@ +/* 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 "ble_app.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_version_get_req_enc(ble_version_t const * const p_version, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + 2, *p_buf_len); + + p_buf[index++] = SD_BLE_VERSION_GET; + + SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); + + p_buf[index++] = (p_version == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + *p_buf_len = index; + + return NRF_SUCCESS; +} + +uint32_t ble_version_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_version_t * p_version, + uint32_t * const p_result_code) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + + uint32_t status_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, + SD_BLE_VERSION_GET, + p_result_code); + + if (status_code != NRF_SUCCESS) + { + return status_code; + } + + if (*p_result_code != NRF_SUCCESS) + { + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; + } + uint8_dec(p_buf, packet_len, &index, &(p_version->version_number)); + uint16_dec(p_buf, packet_len, &index, &(p_version->company_id)); + uint16_dec(p_buf, packet_len, &index, &p_version->subversion_number); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return status_code; +} + + diff --git a/components/serialization/application/codecs/s130/serializers/nrf_soc_app.h b/components/serialization/application/codecs/s130/serializers/nrf_soc_app.h new file mode 100644 index 0000000..0131837 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/nrf_soc_app.h @@ -0,0 +1,90 @@ +/* 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. + * + */ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_app_s130_codecs Application s130 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup soc_app SOC Application command request encoders and command response decoders + * @{ + * @ingroup ser_app_s130_codecs + * + * @brief SOC Application command request encoders and command response decoders. + */ + +#ifndef NRF_SOC_APP_H__ +#define NRF_SOC_APP_H__ + +#include + +/**@brief Encodes @ref sd_power_system_off command request. + * + * @sa @ref nrf51_sd_power_off for packet format. + * + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: size of p_buf buffer. \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t power_system_off_req_enc(uint8_t * const p_buf, uint32_t * const p_buf_len); + + +/**@brief Encodes @ref sd_temp_get command request. + * + * @sa @ref nrf51_sd_temp_get for packet format. + @ref temp_get_rsp_dec for command response decoder. + * + * @param[in] p_temp Pointer to result of temperature measurement. + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in,out] p_buf_len \c in: size of p_buf buffer. \c out: Length of encoded command packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t temp_get_req_enc(int32_t const * const p_temp, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes response to @ref sd_temp_get command. + * + * @sa @ref nrf51_sd_temp_get for packet format, + * @ref temp_get_req_enc for command request encoder. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_result_code Command result code. + * @param[out] p_temp Pointer to result of temperature measurement. + * + * @return NRF_SUCCESS Version information stored successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to + * hold decoded event. + */ +uint32_t temp_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code, + int32_t * const p_temp); + +/** @} */ + +#endif // NRF_SOC_APP_H__ diff --git a/components/serialization/application/codecs/s130/serializers/power_system_off.c b/components/serialization/application/codecs/s130/serializers/power_system_off.c new file mode 100644 index 0000000..c81b1ca --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/power_system_off.c @@ -0,0 +1,32 @@ +/* + * 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 "nrf_soc_app.h" +#include "ble_serialization.h" +#include "nrf_soc.h" + + +uint32_t power_system_off_req_enc(uint8_t * const p_buf, uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(1, *p_buf_len); + + p_buf[index++] = SD_POWER_SYSTEM_OFF; + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/application/codecs/s130/serializers/temp_get.c b/components/serialization/application/codecs/s130/serializers/temp_get.c new file mode 100644 index 0000000..e50a799 --- /dev/null +++ b/components/serialization/application/codecs/s130/serializers/temp_get.c @@ -0,0 +1,71 @@ +/* + * 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 "nrf_soc.h" +#include "nrf_error.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" + +uint32_t temp_get_req_enc(int32_t const * const p_temp, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + uint32_t total_len = *p_buf_len; + + SER_ASSERT_LENGTH_LEQ(1, total_len); + p_buf[index++] = SD_TEMP_GET; + + err_code = cond_field_enc(p_temp, p_buf, total_len, &index, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} + +uint32_t temp_get_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const p_result_code, + int32_t * const p_temp) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_result_code); + SER_ASSERT_NOT_NULL(p_temp); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, + &index, + packet_len, + SD_TEMP_GET, + p_result_code); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (*p_result_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + err_code = uint32_t_dec(p_buf, packet_len, &index, p_temp); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} diff --git a/components/serialization/application/hal/arm_startup_nrf51.s b/components/serialization/application/hal/arm_startup_nrf51.s new file mode 100644 index 0000000..ccab7fc --- /dev/null +++ b/components/serialization/application/hal/arm_startup_nrf51.s @@ -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: +; +; * 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. + +; NOTE: Template files (including this one) are application specific and therefore +; expected to be copied into the application project folder prior to its use! + +; Description message + +Stack_Size EQU 2048 + AREA STACK, NOINIT, READWRITE, ALIGN=3 +Stack_Mem SPACE Stack_Size +__initial_sp + +Heap_Size EQU 2048 + + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +Heap_Mem SPACE Heap_Size +__heap_limit + + 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 ; Reset Handler + DCD NMI_Handler ; NMI Handler + DCD HardFault_Handler ; Hard Fault Handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD SVC_Handler ; SVCall Handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD PendSV_Handler ; PendSV Handler + DCD SysTick_Handler ; SysTick Handler + + ; External Interrupts + DCD POWER_CLOCK_IRQHandler ;POWER_CLOCK + DCD RADIO_IRQHandler ;RADIO + DCD UART0_IRQHandler ;UART0 + DCD SPI0_TWI0_IRQHandler ;SPI0_TWI0 + DCD SPI1_TWI1_IRQHandler ;SPI1_TWI1 + DCD 0 ;Reserved + DCD GPIOTE_IRQHandler ;GPIOTE + DCD ADC_IRQHandler ;ADC + DCD TIMER0_IRQHandler ;TIMER0 + DCD TIMER1_IRQHandler ;TIMER1 + DCD TIMER2_IRQHandler ;TIMER2 + DCD RTC0_IRQHandler ;RTC0 + DCD TEMP_IRQHandler ;TEMP + DCD RNG_IRQHandler ;RNG + DCD ECB_IRQHandler ;ECB + DCD CCM_AAR_IRQHandler ;CCM_AAR + DCD WDT_IRQHandler ;WDT + DCD RTC1_IRQHandler ;RTC1 + DCD QDEC_IRQHandler ;QDEC + DCD LPCOMP_IRQHandler ;LPCOMP + DCD SWI0_IRQHandler ;SWI0 + DCD SWI1_IRQHandler ;SWI1 + DCD SWI2_IRQHandler ;SWI2 + DCD SWI3_IRQHandler ;SWI3 + DCD SWI4_IRQHandler ;SWI4 + DCD SWI5_IRQHandler ;SWI5 + DCD 0 ;Reserved + DCD 0 ;Reserved + DCD 0 ;Reserved + DCD 0 ;Reserved + DCD 0 ;Reserved + DCD 0 ;Reserved + + +__Vectors_End + +__Vectors_Size EQU __Vectors_End - __Vectors + + AREA |.text|, CODE, READONLY + +; Reset Handler + +NRF_POWER_RAMON_ADDRESS EQU 0x40000524 ; NRF_POWER->RAMON address +NRF_POWER_RAMON_RAMxON_ONMODE_Msk EQU 0x3 ; All RAM blocks on in onmode bit mask + +Reset_Handler PROC + EXPORT Reset_Handler [WEAK] + IMPORT SystemInit + IMPORT __main + LDR R0, =NRF_POWER_RAMON_ADDRESS + LDR R2, [R0] + MOVS R1, #NRF_POWER_RAMON_RAMxON_ONMODE_Msk + ORRS R2, R2, R1 + STR R2, [R0] + LDR R0, =SystemInit + 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 +SVC_Handler PROC + EXPORT SVC_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 UART0_IRQHandler [WEAK] + EXPORT SPI0_TWI0_IRQHandler [WEAK] + EXPORT SPI1_TWI1_IRQHandler [WEAK] + EXPORT GPIOTE_IRQHandler [WEAK] + EXPORT ADC_IRQHandler [WEAK] + EXPORT TIMER0_IRQHandler [WEAK] + EXPORT TIMER1_IRQHandler [WEAK] + EXPORT TIMER2_IRQHandler [WEAK] + EXPORT RTC0_IRQHandler [WEAK] + EXPORT TEMP_IRQHandler [WEAK] + EXPORT RNG_IRQHandler [WEAK] + EXPORT ECB_IRQHandler [WEAK] + EXPORT CCM_AAR_IRQHandler [WEAK] + EXPORT WDT_IRQHandler [WEAK] + EXPORT RTC1_IRQHandler [WEAK] + EXPORT QDEC_IRQHandler [WEAK] + EXPORT LPCOMP_IRQHandler [WEAK] + EXPORT SWI0_IRQHandler [WEAK] + EXPORT SWI1_IRQHandler [WEAK] + EXPORT SWI2_IRQHandler [WEAK] + EXPORT SWI3_IRQHandler [WEAK] + EXPORT SWI4_IRQHandler [WEAK] + EXPORT SWI5_IRQHandler [WEAK] +POWER_CLOCK_IRQHandler +RADIO_IRQHandler +UART0_IRQHandler +SPI0_TWI0_IRQHandler +SPI1_TWI1_IRQHandler +GPIOTE_IRQHandler +ADC_IRQHandler +TIMER0_IRQHandler +TIMER1_IRQHandler +TIMER2_IRQHandler +RTC0_IRQHandler +TEMP_IRQHandler +RNG_IRQHandler +ECB_IRQHandler +CCM_AAR_IRQHandler +WDT_IRQHandler +RTC1_IRQHandler +QDEC_IRQHandler +LPCOMP_IRQHandler +SWI0_IRQHandler +SWI1_IRQHandler +SWI2_IRQHandler +SWI3_IRQHandler +SWI4_IRQHandler +SWI5_IRQHandler + + B . + ENDP + ALIGN + +; User Initial Stack & Heap + + IF :DEF:__MICROLIB + + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + + ELSE + + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + + LDR R0, = Heap_Mem + LDR R1, = (Stack_Mem + Stack_Size) + LDR R2, = (Heap_Mem + Heap_Size) + LDR R3, = Stack_Mem + BX LR + + ALIGN + + ENDIF + + END + diff --git a/components/serialization/application/hal/ser_app_hal.h b/components/serialization/application/hal/ser_app_hal.h new file mode 100644 index 0000000..894a613 --- /dev/null +++ b/components/serialization/application/hal/ser_app_hal.h @@ -0,0 +1,76 @@ +/* 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. + * + */ + +/**@file + * + * @defgroup ser_app_hal Serialization Application Hardware Abstraction Layer + * @{ + * @ingroup ble_sdk_lib_serialization + * + * @brief Functions which set up hardware on Application board and perform the reset of the Connectivity Board. + */ + +#ifndef SER_APP_HAL_H_ +#define SER_APP_HAL_H_ + +#include +/**@brief Function for initializing hw modules. + * + * @details Function can initilize can hardware modules on application processor. It is optional to + * implement. It is called one connectivity chip is initialized. + * + * @return @ref NRF_SUCCESS HAL initialized successfully. + * @return @ref nrf_error "NRF_ERROR_..." HAL initialization failed. + * + */ +uint32_t ser_app_hal_hw_init(void); + +/**@brief Function for waiting for given amount of time. + * + * @param[in] ms Number of milliseconds to wait. + * + */ +void ser_app_hal_delay(uint32_t ms); + +/**@brief Function for clearing connectivity chip reset pin + * + */ +void ser_app_hal_nrf_reset_pin_clear(void); + +/**@brief Function for setting connectivity chip reset pin + * + */ +void ser_app_hal_nrf_reset_pin_set(void); + + +/**@brief Function for setting softdevice event interrupt priority which is serving events incoming + * from connectivity chip. + * + * @note Serialization solution on application side mimics SoC solution where events are handled in + * the interrupt context in two ways: or directly in the interrupt context or message is posted to + * the scheduler. However, it is possible that application processor is not using dedicated interrupt + * for connectivity events. In that case this function can be left empty and + * \ref ser_app_hal_nrf_evt_pending will directly call an interrupt handler function. + */ +void ser_app_hal_nrf_evt_irq_priority_set(void); + +/**@brief Function for setting pending interrupt for serving events incoming from connectivity chip. + * + * @note The interrupt used for event from connectivity chip mimics behavior of SoC and it is not + * intended to be triggered by any hardware event. This function should be the only source of + * interrupt triggering. + */ +void ser_app_hal_nrf_evt_pending(void); + + +#endif /* SER_APP_HAL_H_ */ +/** @} */ diff --git a/components/serialization/application/hal/ser_app_hal_nrf51.c b/components/serialization/application/hal/ser_app_hal_nrf51.c new file mode 100644 index 0000000..ebbba67 --- /dev/null +++ b/components/serialization/application/hal/ser_app_hal_nrf51.c @@ -0,0 +1,91 @@ +/* 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_util_platform.h" +#include "ser_app_hal.h" +#include "nrf.h" +#include "nrf_gpio.h" +#include "nrf_soc.h" +#include "nrf_delay.h" +#include "boards.h" +#include "ser_phy.h" +#include "ser_phy_config_app_nrf51.h" + +#ifdef NRF51 +#define SOFTDEVICE_EVT_IRQ SD_EVT_IRQn /**< SoftDevice Event IRQ number. Used for both protocol events and SoC events. */ +#elif defined NRF52 +#define SOFTDEVICE_EVT_IRQ SWI2_EGU2_IRQn +#endif /* NRF51 */ + +uint32_t ser_app_hal_hw_init() +{ + nrf_gpio_cfg_output(CONN_CHIP_RESET_PIN_NO); + + NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos); + NRF_CLOCK->EVENTS_LFCLKSTARTED = 0; + NRF_CLOCK->TASKS_LFCLKSTART = 1; + + while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0) + { + //No implementation needed. + } + + NRF_CLOCK->EVENTS_LFCLKSTARTED = 0; + + return NRF_SUCCESS; +} + +void ser_app_hal_delay(uint32_t ms) +{ + nrf_delay_ms(ms); +} + +void ser_app_hal_nrf_reset_pin_clear() +{ + nrf_gpio_pin_clear(CONN_CHIP_RESET_PIN_NO); +} + +void ser_app_hal_nrf_reset_pin_set() +{ + nrf_gpio_pin_set(CONN_CHIP_RESET_PIN_NO); +} + +void ser_app_hal_nrf_evt_irq_priority_set() +{ + NVIC_SetPriority(SOFTDEVICE_EVT_IRQ, APP_IRQ_PRIORITY_LOW); +} + +void ser_app_hal_nrf_evt_pending() +{ + NVIC_SetPendingIRQ(SOFTDEVICE_EVT_IRQ); +} + +uint32_t sd_ppi_channel_enable_get(uint32_t * p_channel_enable) +{ + *p_channel_enable = NRF_PPI->CHEN; + return NRF_SUCCESS; +} + +uint32_t sd_ppi_channel_enable_set(uint32_t channel_enable_set_msk) +{ + NRF_PPI->CHEN = channel_enable_set_msk; + return NRF_SUCCESS; +} + +uint32_t sd_ppi_channel_assign(uint8_t channel_num, + const volatile void * evt_endpoint, + const volatile void * task_endpoint) +{ + NRF_PPI->CH[channel_num].TEP = (uint32_t)task_endpoint; + NRF_PPI->CH[channel_num].EEP = (uint32_t)evt_endpoint; + return NRF_SUCCESS; +} diff --git a/components/serialization/application/hal/ser_app_power_system_off.c b/components/serialization/application/hal/ser_app_power_system_off.c new file mode 100644 index 0000000..90f1ba8 --- /dev/null +++ b/components/serialization/application/hal/ser_app_power_system_off.c @@ -0,0 +1,35 @@ +/* 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 "nrf.h" +#include "ser_app_power_system_off.h" + +static bool m_power_system_off = false; + + +void ser_app_power_system_off_set(void) +{ + m_power_system_off = true; +} + +bool ser_app_power_system_off_get(void) +{ + return m_power_system_off; +} + +void ser_app_power_system_off_enter(void) +{ + NRF_POWER->SYSTEMOFF = POWER_SYSTEMOFF_SYSTEMOFF_Enter; + + /*Only for debugging purpose, will not be reached without connected debugger*/ + while(1); +} diff --git a/components/serialization/application/hal/ser_app_power_system_off.h b/components/serialization/application/hal/ser_app_power_system_off.h new file mode 100644 index 0000000..08db7f0 --- /dev/null +++ b/components/serialization/application/hal/ser_app_power_system_off.h @@ -0,0 +1,24 @@ +/* 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_POWER_SYSTEM_OFF_H +#define APP_POWER_SYSTEM_OFF_H + +#include + +void ser_app_power_system_off_set(void); + +bool ser_app_power_system_off_get(void); + +void ser_app_power_system_off_enter(void); + +#endif diff --git a/components/serialization/application/transport/ser_sd_transport.c b/components/serialization/application/transport/ser_sd_transport.c new file mode 100644 index 0000000..b06898a --- /dev/null +++ b/components/serialization/application/transport/ser_sd_transport.c @@ -0,0 +1,259 @@ +/* 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 +#include +#include +#include "ser_sd_transport.h" +#include "ser_hal_transport.h" +#include "nrf_error.h" +#include "app_error.h" +#include "ble_serialization.h" + +#include "ser_app_power_system_off.h" + +#include "app_util.h" + +#ifdef ENABLE_DEBUG_LOG_SUPPORT +#include "app_trace.h" +#define APPL_LOG app_trace_log /**< Debug logger macro that will be used in this file to do logging of debug information over UART. */ +#else +#define APPL_LOG(...) +#endif //ENABLE_DEBUG_LOG_SUPPORT + +/** SoftDevice event handler. */ +static ser_sd_transport_evt_handler_t m_evt_handler = NULL; + +/** 'One time' handler called in task context while waiting for response to scheduled command. */ +static ser_sd_transport_rsp_wait_handler_t m_ot_rsp_wait_handler = NULL; + +/** Handler called in task context while waiting for response to scheduled command. */ +static ser_sd_transport_rsp_wait_handler_t m_os_rsp_wait_handler = NULL; + +/** Handler called in serial peripheral interrupt context when response is received. */ +static ser_sd_transport_rsp_set_handler_t m_os_rsp_set_handler = NULL; + +/** Handler called when hal_transport notifies that packet reception has started. */ +static ser_sd_transport_rx_notification_handler_t m_rx_notify_handler = NULL; + +/** User decoder handler for expected response packet. */ +static ser_sd_transport_rsp_handler_t m_rsp_dec_handler = NULL; + +/** Flag indicated whether module is waiting for response packet. */ +static volatile bool m_rsp_wait = false; + +/** SoftDevice call return value decoded by user decoder handler. */ +static uint32_t m_return_value; + +/**@brief Function for handling the rx packets comming from hal_transport. + * + * @details + * This function is called in serial peripheral interrupt context. Response packets are handled in + * this context. Events are passed to the application and it is up to application in which context + * they are handled. + * + * @param[in] p_data Pointer to received data. + * @param[in] length Size of data. + */ +static void ser_sd_transport_rx_packet_handler(uint8_t * p_data, uint16_t length) +{ + if (p_data && (length >= SER_PKT_TYPE_SIZE)) + { + const uint8_t packet_type = p_data[SER_PKT_TYPE_POS]; + p_data += SER_PKT_TYPE_SIZE; + length -= SER_PKT_TYPE_SIZE; + + switch (packet_type) + { + case SER_PKT_TYPE_RESP: + case SER_PKT_TYPE_DTM_RESP: + + if (m_rsp_wait) + { + m_return_value = m_rsp_dec_handler(p_data, length); + (void)ser_sd_transport_rx_free(p_data); + + /* Reset response flag - cmd_write function is pending on it.*/ + m_rsp_wait = false; + + /* If os handler is set, signal os that response has arrived.*/ + if (m_os_rsp_set_handler) + { + m_os_rsp_set_handler(); + } + } + else + { + /* Unexpected packet. */ + (void)ser_sd_transport_rx_free(p_data); + APP_ERROR_HANDLER(packet_type); + } + break; + + case SER_PKT_TYPE_EVT: + /* It is ensured during opening that handler is not NULL. No check needed. */ + APPL_LOG("\r\n[EVT_ID]: 0x%X \r\n", uint16_decode(&p_data[SER_EVT_ID_POS])); // p_data points to EVT_ID + m_evt_handler(p_data, length); + break; + + default: + (void)ser_sd_transport_rx_free(p_data); + APP_ERROR_HANDLER(packet_type); + break; + } + } +} + +/**@brief Function for handling the event from hal_transport. + * + * @param[in] event Event from hal_transport. + */ +static void ser_sd_transport_hal_handler(ser_hal_transport_evt_t event) +{ + switch (event.evt_type) + { + case SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED: + ser_sd_transport_rx_packet_handler(event.evt_params.rx_pkt_received.p_buffer, + event.evt_params.rx_pkt_received.num_of_bytes); + break; + case SER_HAL_TRANSP_EVT_RX_PKT_RECEIVING: + if (m_rx_notify_handler) + { + m_rx_notify_handler(); + } + break; + case SER_HAL_TRANSP_EVT_TX_PKT_SENT: + if(ser_app_power_system_off_get() == true) + { + ser_app_power_system_off_enter(); + } + break; + case SER_HAL_TRANSP_EVT_PHY_ERROR: + + if (m_rsp_wait) + { + m_return_value = NRF_ERROR_INTERNAL; + + /* Reset response flag - cmd_write function is pending on it.*/ + m_rsp_wait = false; + + /* If os handler is set, signal os that response has arrived.*/ + if (m_os_rsp_set_handler) + { + m_os_rsp_set_handler(); + } + } + break; + default: + break; + } +} + +uint32_t ser_sd_transport_open(ser_sd_transport_evt_handler_t evt_handler, + ser_sd_transport_rsp_wait_handler_t os_rsp_wait_handler, + ser_sd_transport_rsp_set_handler_t os_rsp_set_handler, + ser_sd_transport_rx_notification_handler_t rx_notify_handler) +{ + m_os_rsp_wait_handler = os_rsp_wait_handler; + m_os_rsp_set_handler = os_rsp_set_handler; + m_rx_notify_handler = rx_notify_handler; + m_ot_rsp_wait_handler = NULL; + m_evt_handler = evt_handler; + + if (evt_handler == NULL) + { + return NRF_ERROR_INVALID_PARAM; + } + + return ser_hal_transport_open(ser_sd_transport_hal_handler); +} + +uint32_t ser_sd_transport_close(void) +{ + m_evt_handler = NULL; + m_os_rsp_wait_handler = NULL; + m_os_rsp_set_handler = NULL; + m_ot_rsp_wait_handler = NULL; + + ser_hal_transport_close(); + + return NRF_SUCCESS; +} + +uint32_t ser_sd_transport_ot_rsp_wait_handler_set(ser_sd_transport_rsp_wait_handler_t handler) +{ + m_ot_rsp_wait_handler = handler; + + return NRF_SUCCESS; +} + +bool ser_sd_transport_is_busy(void) +{ + return m_rsp_wait; +} + +uint32_t ser_sd_transport_tx_alloc(uint8_t * * pp_data, uint16_t * p_len) +{ + uint32_t err_code; + + if (m_rsp_wait) + { + err_code = NRF_ERROR_BUSY; + } + else + { + err_code = ser_hal_transport_tx_pkt_alloc(pp_data, p_len); + } + return err_code; +} + +uint32_t ser_sd_transport_tx_free(uint8_t * p_data) +{ + return ser_hal_transport_tx_pkt_free(p_data); +} + +uint32_t ser_sd_transport_rx_free(uint8_t * p_data) +{ + p_data -= SER_PKT_TYPE_SIZE; + return ser_hal_transport_rx_pkt_free(p_data); +} + +uint32_t ser_sd_transport_cmd_write(const uint8_t * p_buffer, + uint16_t length, + ser_sd_transport_rsp_handler_t cmd_rsp_decode_callback) +{ + uint32_t err_code = NRF_SUCCESS; + + m_rsp_wait = true; + m_rsp_dec_handler = cmd_rsp_decode_callback; + err_code = ser_hal_transport_tx_pkt_send(p_buffer, length); + APP_ERROR_CHECK(err_code); + + /* Execute callback for response decoding only if one was provided.*/ + if ((err_code == NRF_SUCCESS) && cmd_rsp_decode_callback) + { + if (m_ot_rsp_wait_handler) + { + m_ot_rsp_wait_handler(); + m_ot_rsp_wait_handler = NULL; + } + + m_os_rsp_wait_handler(); + err_code = m_return_value; + } + else + { + m_rsp_wait = false; + } + APPL_LOG("\r\n[SD_CALL_ID]: 0x%X, err_code= 0x%X\r\n", p_buffer[1], err_code); + return err_code; +} diff --git a/components/serialization/application/transport/ser_sd_transport.h b/components/serialization/application/transport/ser_sd_transport.h new file mode 100644 index 0000000..19d4243 --- /dev/null +++ b/components/serialization/application/transport/ser_sd_transport.h @@ -0,0 +1,153 @@ +/* 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. + * + */ + +/** + * @addtogroup ser_app Application side code + * @ingroup ble_sdk_lib_serialization + */ + +/** @file + * + * @defgroup ser_sd_transport Serialization SoftDevice Transport + * @{ + * @ingroup ser_app + * + * @brief Serialization SoftDevice Transport on application side. + * + * @details This file contains declarations of functions and definitions of data structures and + * identifiers (typedef enum) used as API of the serialization of SoftDevice. This layer + * ensures atomic nature of SoftDevice calls (command and waiting for response). Packet + * type field of incoming packets is handled in this layer - responses are handled by + * ser_sd_transport (using response decoder handler provided for each SoftDevice call) but + * events are forwarded to the user so it is user's responsibility to free RX buffer. + * + */ +#ifndef SER_SD_TRANSPORT_H_ +#define SER_SD_TRANSPORT_H_ + +#include +#include + +typedef void (*ser_sd_transport_evt_handler_t)(uint8_t * p_buffer, uint16_t length); +typedef void (*ser_sd_transport_rsp_wait_handler_t)(void); +typedef void (*ser_sd_transport_rsp_set_handler_t)(void); +typedef void (*ser_sd_transport_rx_notification_handler_t)(void); + +typedef uint32_t (*ser_sd_transport_rsp_handler_t)(const uint8_t * p_buffer, uint16_t length); + +/**@brief Function for opening the module. + * + * @note 'Wait for response' and 'Response set' callbacks can be set in RTOS environment. + * It enables rescheduling while waiting for connectivity chip response. In nonOS environment + * usually 'Wait for response' will only be used for handling incoming events or force + * application to low power mode. + * + * @param[in] evt_handler Handler to be called when event packet is received. + * @param[in] os_rsp_wait_handler Handler to be called after request is send. It should. + * implement 'Wait for signal' functionality in OS environment. + * @param[in] os_rsp_set_handler Handler to be called after response reception. It should + * implement 'Signal Set' functionality in OS environment + * @param[in] rx_not_handler Handler to be called after transport layer notifies that + * there is incoming rx packet detected. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_PARAM Operation failure. Parameter propagated from ser_hal_transport + * opening or timer creation. + * @retval NRF_ERROR_INVALID_STATE Operation failure. Parameter propagated from ser_hal_transport + * opening or timer creation. + * @retval NRF_ERROR_INTERNAL Operation failure. Parameter propagated from ser_hal_transport + * opening or timer creation. + * @retval NRF_ERROR_NO_MEM Operation failure. Parameter propagated from timer creation. + */ +uint32_t ser_sd_transport_open(ser_sd_transport_evt_handler_t evt_handler, + ser_sd_transport_rsp_wait_handler_t os_rsp_wait_handler, + ser_sd_transport_rsp_set_handler_t os_rsp_set_handler, + ser_sd_transport_rx_notification_handler_t rx_not_handler); + +/**@brief Function setting 'One Time' handler to be called between sending next request packet and + * receiving response packet. + * @note It is intended to be used in nonOS environment to implement concurrency. + * @note It is 'One Time' handler meaning that it is valid only for next softdevice call processing. + * + * + * @param[in] wait_handler Handler to be called after request packet is sent. + * + * @retval NRF_SUCCESS Operation success. + */ +uint32_t ser_sd_transport_ot_rsp_wait_handler_set(ser_sd_transport_rsp_wait_handler_t wait_handler); + + +/**@brief Function for closing the module. + * + * @retval NRF_SUCCESS Operation success. + */ +uint32_t ser_sd_transport_close(void); + +/**@brief Function for allocating tx packet to be used for request command. + * + * @param[out] pp_data Pointer to data pointer to be set to point to allocated buffer. + * @param[out] p_len Pointer to allocated buffer length. + * + * @retval NRF_SUCCESS Operation success. + */ +uint32_t ser_sd_transport_tx_alloc(uint8_t * * pp_data, uint16_t * p_len); + + +/**@brief Function for freeing tx packet. + * + * @note Function should be called once command is processed. + * + * @param[out] p_data Pointer to allocated tx buffer. + * + * @retval NRF_SUCCESS Operation success. + */ +uint32_t ser_sd_transport_tx_free(uint8_t * p_data); + + +/**@brief Function for freeing RX event packet. + * + * @note Function should be called once SoftDevice event buffer is processed. + * + * @param[out] p_data Pointer to allocated rx buffer. + * + * @retval NRF_SUCCESS Operation success. + */ +uint32_t ser_sd_transport_rx_free(uint8_t * p_data); + + +/**@brief Function for checking if module is busy waiting for response from connectivity side. + * + * @retval true Module busy. Cannot accept next command. + * @retval false Module not busy. Can accept next command. + */ +bool ser_sd_transport_is_busy(void); + +/**@brief Function for handling SoftDevice command. + * + * @note Function blocks task context until response is received and processed. + * @note Non-blocking functionality can be achieved using os handlers or 'One Time' handler + * @warning Function shouldn't be called from interrupt context which would block switching to + * serial port interrupt. + * + * @param[in] p_buffer Pointer to command. + * @param[in] length Pointer to allocated buffer length. + * @param[in] cmd_resp_decode_callback Pointer to function for decoding response packet. + * + * @retval NRF_SUCCESS Operation success. + */ +uint32_t ser_sd_transport_cmd_write(const uint8_t * p_buffer, + uint16_t length, + ser_sd_transport_rsp_handler_t cmd_resp_decode_callback); + +#endif /* SER_SD_TRANSPORT_H_ */ +/** @} */ diff --git a/components/serialization/application/transport/ser_softdevice_handler.c b/components/serialization/application/transport/ser_softdevice_handler.c new file mode 100644 index 0000000..284df3b --- /dev/null +++ b/components/serialization/application/transport/ser_softdevice_handler.c @@ -0,0 +1,176 @@ +/* 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 +#include +#include "ble_app.h" +#include "app_mailbox.h" +#include "app_scheduler.h" +#include "softdevice_handler.h" +#include "ser_sd_transport.h" +#include "ser_app_hal.h" +#include "ser_config.h" +#include "nrf_soc.h" + + +#define SD_BLE_EVT_MAILBOX_QUEUE_SIZE 5 /**< Size of mailbox queue. */ + +/** @brief Structure used to pass packet details through mailbox. + */ +typedef struct +{ + uint32_t evt_data[CEIL_DIV(BLE_STACK_EVT_MSG_BUF_SIZE, sizeof (uint32_t))]; /**< Buffer for decoded event */ +} ser_sd_handler_evt_data_t; + +/** @brief + * Mailbox used for communication between event handler (called from serial stream + * interrupt context) and event processing function (called from scheduler or interrupt context). + */ +APP_MAILBOX_DEF(sd_ble_evt_mailbox, SD_BLE_EVT_MAILBOX_QUEUE_SIZE, sizeof(ser_sd_handler_evt_data_t)); + +/** + * @brief Function to be replaced by user implementation if needed. + * + * Weak function - user can add different implementation of this function if application needs it. + */ +__WEAK void os_rsp_set_handler(void) +{ + +} + +static void connectivity_reset_low(void) +{ + //Signal a reset to the nRF51822 by setting the reset pin on the nRF51822 low. + ser_app_hal_nrf_reset_pin_clear(); + ser_app_hal_delay(CONN_CHIP_RESET_TIME); + +} + +static void connectivity_reset_high(void) +{ + + //Set the reset level to high again. + ser_app_hal_nrf_reset_pin_set(); + + //Wait for nRF51822 to be ready. + ser_app_hal_delay(CONN_CHIP_WAKEUP_TIME); +} + +static void ser_softdevice_evt_handler(uint8_t * p_data, uint16_t length) +{ + ser_sd_handler_evt_data_t item; + uint32_t err_code; + uint32_t len32 = sizeof (item.evt_data); + + err_code = ble_event_dec(p_data, length, (ble_evt_t *)item.evt_data, &len32); + APP_ERROR_CHECK(err_code); + + err_code = ser_sd_transport_rx_free(p_data); + APP_ERROR_CHECK(err_code); + + err_code = app_mailbox_put(&sd_ble_evt_mailbox, &item); + APP_ERROR_CHECK(err_code); + + ser_app_hal_nrf_evt_pending(); +} + +/** + * @brief Function called while waiting for connectivity chip response. It handles incoming events. + */ +static void ser_sd_rsp_wait(void) +{ + do + { + (void)sd_app_evt_wait(); + + //intern_softdevice_events_execute(); + } + while (ser_sd_transport_is_busy()); +} + +uint32_t sd_evt_get(uint32_t * p_evt_id) +{ + (void)p_evt_id; + //current serialization doesn't support any events other than ble events + return NRF_ERROR_NOT_FOUND; +} + +uint32_t sd_ble_evt_get(uint8_t * p_data, uint16_t * p_len) +{ + uint32_t err_code; + + err_code = app_mailbox_get(&sd_ble_evt_mailbox, p_data); + + if (err_code == NRF_SUCCESS) //if anything in the mailbox + { + if (((ble_evt_t *)p_data)->header.evt_len > *p_len) + { + err_code = NRF_ERROR_DATA_SIZE; + } + else + { + *p_len = ((ble_evt_t *)p_data)->header.evt_len; + } + } + else + { + err_code = NRF_ERROR_NOT_FOUND; + } + + return err_code; +} + +uint32_t sd_ble_evt_mailbox_length_get(uint32_t * p_mailbox_length) +{ + uint32_t err_code = NRF_SUCCESS; + + *p_mailbox_length = app_mailbox_length_get(&sd_ble_evt_mailbox); + + return err_code; +} + +uint32_t sd_softdevice_enable(nrf_clock_lfclksrc_t clock_source, + softdevice_assertion_handler_t assertion_handler) +{ + uint32_t err_code; + + err_code = ser_app_hal_hw_init(); + + if (err_code == NRF_SUCCESS) + { + connectivity_reset_low(); + + err_code = app_mailbox_create(&sd_ble_evt_mailbox); + + if (err_code == NRF_SUCCESS) + { + err_code = ser_sd_transport_open(ser_softdevice_evt_handler, + ser_sd_rsp_wait, + os_rsp_set_handler, + NULL); + if (err_code == NRF_SUCCESS) + { + connectivity_reset_high(); + } + } + + ser_app_hal_nrf_evt_irq_priority_set(); + } + + return err_code; +} + + +uint32_t sd_softdevice_disable(void) +{ + return ser_sd_transport_close(); +} + diff --git a/components/serialization/application/transport/ser_softdevice_handler.h b/components/serialization/application/transport/ser_softdevice_handler.h new file mode 100644 index 0000000..93e1e96 --- /dev/null +++ b/components/serialization/application/transport/ser_softdevice_handler.h @@ -0,0 +1,44 @@ +/* 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. + * + */ + +/** + * @addtogroup ser_app Application side code + * @ingroup ble_sdk_lib_serialization + */ + +/** @file + * + * @defgroup ser_softdevice_handler Serialization SoftDevice Handler + * @{ + * @ingroup ser_app + * + * @brief Serialization SoftDevice Handler on application side. + * + */ +#ifndef SER_SOFTDEVICE_HANDLER_H_ +#define SER_SOFTDEVICE_HANDLER_H_ + +#include +#include + + +/**@brief Function for checking if there is any more events in the internal mailbox. + * + * @param[in] p_mailbox_length Pointer to mailbox length. + * + * @retval ::NRF_SUCCESS Length succesfully obtained. + * @retval ::NRF_ERROR_NULL Null pointer provided. + */ +uint32_t sd_ble_evt_mailbox_length_get(uint32_t * p_mailbox_length); + +#endif /* SER_SOFTDEVICE_HANDLER_H_ */ +/** @} */ diff --git a/components/serialization/common/ble_serialization.c b/components/serialization/common/ble_serialization.c new file mode 100644 index 0000000..2701a3b --- /dev/null +++ b/components/serialization/common/ble_serialization.c @@ -0,0 +1,520 @@ +/* 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 "ble_serialization.h" +#include "nrf_error.h" +#include "app_util.h" +#include +#include + +uint32_t ser_ble_cmd_rsp_status_code_enc(uint8_t op_code, + uint32_t command_status, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + uint32_t index = 0; + + SER_ASSERT_LENGTH_LEQ(SER_CMD_RSP_HEADER_SIZE, *p_buf_len); + + //Encode Op Code. + p_buf[index++] = op_code; + + //Encode Status. + index += uint32_encode(command_status, &(p_buf[index])); + *p_buf_len = index; + + return NRF_SUCCESS; +} + + +uint32_t ser_ble_cmd_rsp_result_code_dec(uint8_t const * const p_buf, + uint32_t * const p_pos, + uint32_t packet_len, + uint8_t op_code, + uint32_t * const p_result_code) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_pos); + SER_ASSERT_NOT_NULL(p_result_code); + + if (packet_len < SER_CMD_RSP_HEADER_SIZE) + { + return NRF_ERROR_DATA_SIZE; + } + + if (p_buf[(*p_pos)] != op_code) + { + return NRF_ERROR_INVALID_DATA; + } + + *p_result_code = uint32_decode(&(p_buf[(*p_pos) + SER_CMD_RSP_STATUS_CODE_POS])); + *p_pos += SER_CMD_RSP_HEADER_SIZE; + + return NRF_SUCCESS; +} + + +uint32_t ser_ble_cmd_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t op_code, + uint32_t * const p_result_code) +{ + uint32_t index = 0; + uint32_t result_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, op_code, + p_result_code); + + if (result_code != NRF_SUCCESS) + { + return result_code; + } + + if (index != packet_len) + { + return NRF_ERROR_DATA_SIZE; + } + + return NRF_SUCCESS; +} + +uint32_t uint32_t_enc(void const * const p_field, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_field); + SER_ASSERT_NOT_NULL(p_index); + + uint32_t * p_uint32 = (uint32_t *)p_field; + + SER_ASSERT_LENGTH_LEQ(4, buf_len - *p_index); + + *p_index += uint32_encode(*p_uint32, &p_buf[*p_index]); + + return NRF_SUCCESS; +} + +uint32_t uint32_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * p_field) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_field); + + uint32_t * p_uint32 = (uint32_t *)p_field; + + SER_ASSERT_LENGTH_LEQ(4, ((int32_t)buf_len - *p_index)); + + *p_uint32 = uint32_decode(&p_buf[*p_index]); + *p_index += 4; + + return NRF_SUCCESS; +} + +uint32_t uint16_t_enc(const void * const p_field, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint16_t * p_u16 = (uint16_t *)p_field; + + SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index); + + *p_index += uint16_encode(*p_u16, &p_buf[*p_index]); + + return NRF_SUCCESS; +} + +uint32_t uint16_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * p_field) +{ + uint16_t * p_u16 = (uint16_t *)p_field; + + SER_ASSERT_LENGTH_LEQ(2, ((int32_t)buf_len - *p_index)); + + *p_u16 = uint16_decode(&p_buf[*p_index]); + *p_index += 2; + + return NRF_SUCCESS; +} + +void uint16_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const index, + uint16_t * const value) +{ + SER_ASSERT_VOID_RETURN(*index + 2 <= buf_len); + *value = uint16_decode(&p_buf[*index]); + *index += 2; +} + +uint32_t uint8_t_enc(const void * const p_field, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + + uint8_t * p_u8 = (uint8_t *)p_field; + p_buf[*p_index] = *p_u8; + *p_index += 1; + + return NRF_SUCCESS; +} + +uint32_t uint8_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * p_field) +{ + uint8_t * p_u8 = (uint8_t *)p_field; + + SER_ASSERT_LENGTH_LEQ(1, ((int32_t)buf_len - *p_index)); + *p_u8 = p_buf[*p_index]; + *p_index += 1; + + return NRF_SUCCESS; +} + +void uint8_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const index, + uint8_t * const value) +{ + SER_ASSERT_VOID_RETURN(*index + 1 <= buf_len); + *value = p_buf[*index]; + *index += 1; +} + + +void int8_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const index, + int8_t * const value) +{ + SER_ASSERT_VOID_RETURN(*index + 1 <= buf_len); + *value = p_buf[*index]; + *index += 1; +} + +uint32_t len8data_enc(uint8_t const * const p_data, + uint8_t const dlen, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t err_code = NRF_SUCCESS; + + err_code = uint8_t_enc(&dlen, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = buf_enc(p_data, dlen, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t len8data_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint8_t * * const pp_data, + uint8_t * const p_len) +{ + uint32_t err_code = NRF_SUCCESS; + uint16_t out_buf_len = *p_len; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, p_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = buf_dec(p_buf, buf_len, p_index, pp_data, out_buf_len, *p_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t len16data_enc(uint8_t const * const p_data, + uint16_t const dlen, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&dlen, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = buf_enc(p_data, dlen, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t len16data_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint8_t * * const pp_data, + uint16_t * const p_dlen) +{ + uint32_t err_code = NRF_SUCCESS; + uint16_t out_buf_len = *p_dlen; + + err_code = uint16_t_dec(p_buf, buf_len, p_index, p_dlen); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = buf_dec(p_buf, buf_len, p_index, pp_data, out_buf_len, *p_dlen); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t count16_cond_data16_enc(uint16_t const * const p_data, + uint16_t const count, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t i = 0; + + SER_ASSERT_LENGTH_LEQ(3, ((int32_t)buf_len - *p_index)); + *p_index += uint16_encode(count, &p_buf[*p_index]); + + if (p_data) + { + SER_ASSERT_LENGTH_LEQ((int32_t)(2 * count + 1), ((int32_t)buf_len - (int32_t)*p_index)); + p_buf[*p_index] = SER_FIELD_PRESENT; + *p_index += 1; + + //memcpy may fail in case of Endianness difference between application and connectivity processor + for (i = 0; i < count; i++) + { + *p_index += uint16_encode(p_data[i], &p_buf[*p_index]); + } + } + else + { + SER_ASSERT_LENGTH_LEQ((1), ((int32_t)buf_len - *p_index)); + p_buf[*p_index] = SER_FIELD_NOT_PRESENT; + *p_index += 1; + } + + return NRF_SUCCESS; +} + +uint32_t count16_cond_data16_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint16_t * * const pp_data, + uint16_t * const p_count) + +{ + uint16_t count = 0; + uint8_t is_present = 0; + uint16_t i; + + SER_ASSERT_NOT_NULL(p_count); + SER_ASSERT_NOT_NULL(pp_data); + SER_ASSERT_NOT_NULL(*pp_data); + + SER_ASSERT_LENGTH_LEQ(3, ((int32_t)buf_len - (*p_index))); + + uint16_dec(p_buf, buf_len, p_index, &count); + + if (count > *p_count) + { + return NRF_ERROR_DATA_SIZE; + } + + SER_ASSERT_LENGTH_LEQ(count, *p_count); + + uint8_dec(p_buf, buf_len, p_index, &is_present); + + if (!is_present) + { + *pp_data = NULL; + return NRF_SUCCESS; + } + else + { + for (i = 0; i < count; i++ ) + { + uint16_dec(p_buf, buf_len, p_index, &((&(**pp_data))[i]) ); + } + *p_count = i; + } + return NRF_SUCCESS; +} + + + +uint32_t cond_len16_cond_data_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint8_t * * const pp_data, + uint16_t * * const pp_len) +{ + SER_ASSERT_NOT_NULL(pp_len); + SER_ASSERT_NOT_NULL(*pp_len); + SER_ASSERT_NOT_NULL(pp_data); + SER_ASSERT_NOT_NULL(*pp_data); + + SER_ASSERT_LENGTH_LEQ(2, ((int32_t)buf_len - (*p_index))); + uint8_t is_present = 0; + + uint8_dec(p_buf, buf_len, p_index, &is_present); + + if (!is_present) + { + *pp_len = NULL; //if length field is not present + (*p_index)++; //then data can not be present + *pp_data = NULL; + return NRF_SUCCESS; + } + else + { + return len16data_dec(p_buf, buf_len, p_index, pp_data, *pp_len); + } +} + +uint32_t op_status_enc(uint8_t op_code, + uint32_t return_code, + uint8_t * const p_buff, + uint32_t * const p_buff_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buff); + SER_ASSERT_NOT_NULL(p_buff_len); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_LENGTH_LEQ(SER_CMD_RSP_HEADER_SIZE, *p_buff_len - *p_index); + + //Encode Op Code. + p_buff[(*p_index)++] = op_code; + //Encode Status. + *p_index += uint32_encode(return_code, &(p_buff[*p_index])); + //update size of used buffer + *p_buff_len = *p_index; + + return NRF_SUCCESS; +} + +uint32_t op_status_cond_uint16_enc(uint8_t op_code, + uint32_t return_code, + uint16_t value, + uint8_t * const p_buff, + uint32_t * const p_buff_len, + uint32_t * const p_index) +{ + uint32_t status_code; + uint32_t init_buff_len = *p_buff_len; + + status_code = op_status_enc(op_code, return_code, p_buff, p_buff_len, p_index); + SER_ASSERT(status_code == NRF_SUCCESS, status_code); + + if (return_code == NRF_SUCCESS) //Add 16bit value when return_code is a success + { + *p_buff_len = init_buff_len; //restore original value - it has been modified by op_status_enc + status_code = uint16_t_enc(&value, p_buff, *p_buff_len, p_index); + *p_buff_len = *p_index; + SER_ASSERT(status_code == NRF_SUCCESS, status_code); + } + + return status_code; +} + +uint32_t buf_enc(uint8_t const * const p_data, + uint16_t const dlen, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t err_code = NRF_SUCCESS; + uint8_t is_present = (p_data == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + + err_code = uint8_t_enc(&is_present, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (p_data) + { + SER_ASSERT_LENGTH_LEQ(dlen, ((int32_t)buf_len - *p_index)); + memcpy(&p_buf[*p_index], p_data, dlen); + *p_index += dlen; + } + + return err_code; +} + +uint32_t buf_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint8_t * * const pp_data, + uint16_t data_len, + uint16_t dlen) +{ + uint8_t is_present = 0; + + SER_ASSERT_LENGTH_LEQ(1, ((int32_t)buf_len - *p_index)); + uint8_dec(p_buf, buf_len, p_index, &is_present); + + if (is_present == SER_FIELD_PRESENT) + { + SER_ASSERT_NOT_NULL(pp_data); + SER_ASSERT_NOT_NULL(*pp_data); + SER_ASSERT_LENGTH_LEQ(dlen, data_len); + SER_ASSERT_LENGTH_LEQ(dlen, ((int32_t)buf_len - *p_index)); + memcpy(*pp_data, &p_buf[*p_index], dlen); + *p_index += dlen; + } + else + { + if (pp_data) + { + *pp_data = NULL; + } + } + return NRF_SUCCESS; +} + +uint32_t uint8_vector_enc(uint8_t const * const p_data, + uint16_t const dlen, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + + SER_ASSERT_NOT_NULL(p_data); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_LENGTH_LEQ(dlen, ((int32_t)buf_len - *p_index)); + memcpy(&p_buf[*p_index], p_data, dlen); + *p_index += dlen; + + return NRF_SUCCESS; +} + +uint32_t uint8_vector_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint8_t * const p_data, + uint16_t dlen) +{ + SER_ASSERT_NOT_NULL(p_data); + SER_ASSERT_LENGTH_LEQ(dlen, ((int32_t)buf_len - *p_index)); + memcpy(p_data, &p_buf[*p_index], dlen); + *p_index += dlen; + + return NRF_SUCCESS; +} + diff --git a/components/serialization/common/ble_serialization.h b/components/serialization/common/ble_serialization.h new file mode 100644 index 0000000..4043fb7 --- /dev/null +++ b/components/serialization/common/ble_serialization.h @@ -0,0 +1,582 @@ +/* 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. + * + */ + +#ifndef BLE_SERIALIZATION_H__ +#define BLE_SERIALIZATION_H__ + +#include "nordic_common.h" +#include "nrf_error.h" +#include +#include + +/**@brief The types of serialization packets. */ +typedef enum +{ + SER_PKT_TYPE_CMD = 0, /**< Command packet type. */ + SER_PKT_TYPE_RESP, /**< Command Response packet type. */ + SER_PKT_TYPE_EVT, /**< Event packet type. */ + SER_PKT_TYPE_DTM_CMD, /**< DTM Command packet type. */ + SER_PKT_TYPE_DTM_RESP, /**< DTM Response packet type. */ + SER_PKT_TYPE_RESET_CMD, /**< System Reset Command packet type. */ + SER_PKT_TYPE_MAX /**< Upper bound. */ +} ser_pkt_type_t; + +#define LOW16(a) ((uint16_t)((a & 0x0000FFFF) >> 0)) +#define HIGH16(a) ((uint16_t)((a & 0xFFFF0000) >> 16)) + +//lint -esym(516,__INTADDR__) Symbol '__INTADDR__()' has arg. type conflict +//lint -esym(628,__INTADDR__) no argument information provided for function '__INTADDR__()' + +/** Size in bytes of the Error Code field in a Command Response packet. */ +#define SER_ERR_CODE_SIZE 4 +/** Size in bytes of the Packet Type field (@ref ser_pkt_type_t). */ +#define SER_PKT_TYPE_SIZE 1 +/** Size in bytes of the Operation Code field. */ +#define SER_OP_CODE_SIZE 1 + +/** Position of the Packet Type field in a serialized packet buffer. */ +#define SER_PKT_TYPE_POS 0 +/** Position of the Operation Code field in a serialized packet buffer. */ +#define SER_PKT_OP_CODE_POS (SER_PKT_TYPE_SIZE) +/** Position of the Data in a serialized packet buffer. */ +#define SER_PKT_DATA_POS (SER_PKT_TYPE_SIZE + SER_OP_CODE_SIZE) + +/** Position of the Operation Code field in a command buffer. */ +#define SER_CMD_OP_CODE_POS 0 +/** Position of the Data in a command buffer.*/ +#define SER_CMD_DATA_POS (SER_OP_CODE_SIZE) +/** Size of the Command header. */ +#define SER_CMD_HEADER_SIZE (SER_OP_CODE_SIZE) +/** Size of the Command Response header. */ +#define SER_CMD_RSP_HEADER_SIZE (SER_OP_CODE_SIZE + SER_ERR_CODE_SIZE) +/** Position of the Command Response code. */ +#define SER_CMD_RSP_STATUS_CODE_POS (SER_OP_CODE_SIZE) + +/** Size of event ID field. */ +#define SER_EVT_ID_SIZE 2 +/** Position of event ID field. */ +#define SER_EVT_ID_POS 0 +/** Size of event header. */ +#define SER_EVT_HEADER_SIZE (SER_EVT_ID_SIZE) +/** Size of event connection handler. */ +#define SER_EVT_CONN_HANDLE_SIZE 2 + +/** Position of the Op Code in the DTM command buffer.*/ +#define SER_DTM_CMD_OP_CODE_POS 0 +/** Position of the data in the DTM command buffer.*/ +#define SER_DTM_CMD_DATA_POS 1 + +/** Position of the Op Code in the DTM command response buffer.*/ +#define SER_DTM_RESP_OP_CODE_POS 1 +/** Position of the status field in the DTM command response buffer.*/ +#define SER_DTM_RESP_STATUS_POS 2 + +/** Value to indicate that an optional field is encoded in the serialized packet, e.g. white list.*/ +#define SER_FIELD_PRESENT 0x01 +/** Value to indicate that an optional field is not encoded in the serialized packet. */ +#define SER_FIELD_NOT_PRESENT 0x00 + + +/** Enable SER_ASSERT<*> assserts */ +#define SER_ASSERTS_ENABLED 1 + +/** Returns with error code if expr is not true. It is used for checking error which should be + * checked even when SER_ASSERTS_ENABLED is not set. */ +#define SER_ERROR_CHECK(expr, error_code) do { if (!(expr)) return (error_code); } while (0) + +#ifdef SER_ASSERTS_ENABLED +/** Returns with error code if expr is not true. */ +#define SER_ASSERT(expr, error_code) SER_ERROR_CHECK(expr, error_code) +/** Returns with if expr is not true. */ +#define SER_ASSERT_VOID_RETURN(expr) do { if (!(expr)) return; } while (0) +/** Returns with \ref NRF_ERROR_INVALID_LENGTH if len is not less or equal to maxlen. */ +#define SER_ASSERT_LENGTH_LEQ(len, maxlen) \ + SER_ASSERT((len) <= (maxlen), NRF_ERROR_INVALID_LENGTH) +/** Returns with \ref NRF_ERROR_INVALID_LENGTH if actual_len is not equal to expected_len. */ +#define SER_ASSERT_LENGTH_EQ(actual_len, expected_len) \ + SER_ASSERT((actual_len) == (expected_len), NRF_ERROR_INVALID_LENGTH) +/** Returns with \ref NRF_ERROR_NULL if pointer is null. */ +#define SER_ASSERT_NOT_NULL(ptr) SER_ASSERT((ptr) != NULL, NRF_ERROR_NULL) +#else +#define SER_ASSERT(expr, error_code) +#define SER_ASSERT_VOID_RETURN(expr) +#define SER_ASSERT_LENGTH_LEQ(len, maxlen) UNUSED_VARIABLE(maxlen) +#define SER_ASSERT_LENGTH_EQ(actual_len, expected_len) +#define SER_ASSERT_NOT_NULL(ptr) +#endif + +/** Maximum length of p_value in \ref ble_gattc_write_params_t. See Bluetooth 4.0 spec: 3.4.5.1 and + * 3.4.5.3. */ +#define BLE_GATTC_WRITE_P_VALUE_LEN_MAX (GATT_MTU_SIZE_DEFAULT - 3) + +/** See Bluetooth 4.0 spec: 3.4.4.7. */ +#define BLE_GATTC_HANDLE_COUNT_LEN_MAX ((GATT_MTU_SIZE_DEFAULT - 1) / 2) + +/** Generic command response status code encoder. */ +uint32_t ser_ble_cmd_rsp_status_code_enc(uint8_t op_code, + uint32_t command_status, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** Generic command response result code decoder. */ +uint32_t ser_ble_cmd_rsp_result_code_dec(uint8_t const * const p_buf, + uint32_t * const p_pos, + uint32_t packet_len, + uint8_t op_code, + uint32_t * const p_result_code); + +/** Generic command response decoder. */ +uint32_t ser_ble_cmd_rsp_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t op_code, + uint32_t * const p_result_code); + +/**@brief Function for safe encoding an uint16 value. + * + * Safe decoding of an uint16 value. Range checks will be done if @ref SER_ASSERTS_ENABLED is set. + * + * @param[in] p_field Uint16 value to be encoded. + * @param[out] p_buf Buffer containing the value. + * @param[in] buf_len Size of buffer. + * @param[in,out] p_index \c in: Index to start of uint16 value in buffer. + * \c out: Index in buffer to first byte after the decoded value. + * + * @return NRF_SUCCESS Fields decoded successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t uint16_t_enc(const void * const p_field, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +/**@brief Function for safe decoding an uint16 value. + * + * Safe decoding of an uint16 value. Range checks will be done if @ref SER_ASSERTS_ENABLED is set. + * + * @param[in] p_buf Buffer containing the value. + * @param[in] buf_len Size of buffer. + * @param[in,out] p_index \c in: Index to start of uint16 value in buffer. + * \c out: Index in buffer to first byte after the decoded value. + * @param[out] p_field Pointer to the location where uint16 value will be decoded. + */ +uint32_t uint16_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * p_field); + +/**@brief Function for safe decoding an uint16 value. + * + * Safe decoding of an uint16 value. Range checks will be done if @ref SER_ASSERTS_ENABLED is set. + * + * @param[in] p_buf Buffer containing the value. + * @param[in] buf_len Size of buffer. + * @param[in,out] index \c in: Index to start of uint16 value in buffer. + * \c out: Index in buffer to first byte after the decoded value. + * @param[out] value Decoded uint16 value. + */ +void uint16_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const index, + uint16_t * const value); + +/**@brief Function for safe encoding an uint18 value. + * + * Safe decoding of an uint8 value. Range checks will be done if @ref SER_ASSERTS_ENABLED is set. + * + * @param[in] p_buf Buffer containing the value. + * @param[in] buf_len Size of buffer. + * @param[in,out] p_index \c in: Index to start of uint8 value in buffer. + * \c out: Index in buffer to first byte after the decoded value. + * @param[out] p_field Pointer to uint8 value to be encoded. + * + * @return NRF_SUCCESS Fields decoded successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t uint8_t_enc(const void * const p_field, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +/**@brief Function for safe decoding an uint8 value. + * + * Safe decoding of an uint8 value. Range checks will be done if @ref SER_ASSERTS_ENABLED is set. + * + * @param[in] p_buf Buffer containing the value. + * @param[in] buf_len Size of buffer. + * @param[in,out] p_index \c in: Index to start of uint8 value in buffer. + * \c out: Index in buffer to first byte after the decoded value. + * @param[out] p_field Pointer to the location for decoded uint8 value. + * + * @return NRF_SUCCESS Fields decoded successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t uint8_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * p_field); + +/**@brief Function for safe decoding an uint8 value. + * + * Safe decoding of an uint8 value. Range checks will be done if @ref SER_ASSERTS_ENABLED is set. + * + * @param[in] p_buf Buffer containing the value. + * @param[in] buf_len Size of buffer. + * @param[in,out] index \c in: Index to start of uint8 value in buffer. + * \c out: Index in buffer to first byte after the decoded value. + * @param[out] value Decoded uint8 value. + */ +void uint8_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const index, + uint8_t * const value); + +/**@brief Function for safe decoding an uint18 value. + * + * Safe decoding of an uint8 value. Range checks will be done if @ref SER_ASSERTS_ENABLED is set. + * + * @param[in] p_buf Buffer containing the value. + * @param[in] buf_len Size of buffer. + * @param[in,out] index \c in: Index to start of uint8 value in buffer. + * \c out: Index in buffer to first byte after the decoded value. + * @param[out] value Decoded uint8 value. + */ +void int8_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint32_t * const index, + int8_t * const value); + +/**@brief Function for safe encoding variable length field encoded as length(8bit)+data. + * + * Safe encoding of an variable length field. Range checks will be done if @ref SER_ASSERTS_ENABLED is set. + * + * @param[out] p_data Pointer to data to encode. + * @param[in] dlen Length of data to encode (0-255). + * @param[out] p_buf Buffer containing the value. + * @param[in] buf_len Size of buffer. + * @param[in,out] p_index \c in: Index to start of uint8 value in buffer. + * \c out: Index in buffer to first byte after the decoded value. + * + * @return NRF_SUCCESS Fields decoded successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t len8data_enc(uint8_t const * const p_data, + uint8_t const dlen, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +/**@brief Function for safe decoding variable length field encoded as length(8bit)+data. + * + * Safe decoding of an variable length field. Range checks will be done if @ref SER_ASSERTS_ENABLED is set. + * + * @param[in] p_buf Buffer containing the value. + * @param[in] buf_len Size of buffer. + * @param[in,out] p_index \c in: Index to start of uint8 value in buffer. + * \c out: Index in buffer to first byte after the decoded value. + * @param[out] pp_data Pointer to pointer to decoded data (p_data is set to NULL in + * case data is not present in the buffer). + * @param[out] p_len Decoded length (0-255). + * + * @return NRF_SUCCESS Fields decoded successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t len8data_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint8_t * * const pp_data, + uint8_t * const p_len); + +/**@brief Function for safe encoding variable length field encoded as length(16bit)+data. + * + * Safe encoding of an variable length field. Range checks will be done if @ref SER_ASSERTS_ENABLED is set. + * It is possible that provided p_data is NULL in that case length is encoded and it's followed by + * SER_FIELD_NOT_PRESENT flag. SER_FIELD_PRESENT flag preceeds data otherwise. + * + * @param[in] p_data Data to encode. + * @param[in] dlen Input data length (16bit). + * @param[in] p_buf Pointer to the beginning of the output buffer. + * @param[in] buf_len Size of buffer. + * @param[in,out] p_index \c in: Index to start of uint8 value in buffer. + * \c out: Index in buffer to first byte after the encoded data. + * + * @return NRF_SUCCESS Fields decoded successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t len16data_enc(uint8_t const * const p_data, + uint16_t const dlen, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +/**@brief Function for safe decoding variable length field encoded as length(16bit)+data. + * + * Safe decoding of an variable length field. Range checks will be done if @ref SER_ASSERTS_ENABLED is set. + * Encoded data consist of length field, presence flag and conditional data (present only is presence flag + * is set). p_data pointer is required to be not NULL only is presence flag is set. + * + * @param[in] p_buf Pointer to the beginning of the input buffer. + * @param[in] buf_len Size of buffer. + * @param[in,out] p_index \c in: Index to start of uint8 value in buffer. + * \c out: Index in buffer to first byte after the decoded data. + * @param[in] pp_data Pointer to pointer to decoded data. + * @param[in] p_dlen data length (16bit). + * + * @return NRF_SUCCESS Fields decoded successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t len16data_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint8_t * * const pp_data, + uint16_t * const p_dlen); + + +/**@brief Function for safe encoding of uint16 table with a given element count. + * + * Safe encoding of an variable length field. Range checks will be done if @ref SER_ASSERTS_ENABLED is set. + * It is possible that provided p_data is NULL in that case length is encoded and it's followed by + * SER_FIELD_NOT_PRESENT flag. SER_FIELD_PRESENT flag precedes data otherwise. + * + * @param[in] p_data Data table to encode. + * @param[in] count Table element count. + * @param[in] p_buf Pointer to the beginning of the output buffer. + * @param[in] buf_len Size of buffer. + * @param[in,out] p_index \c in: Index to start of uint8 value in buffer. + * \c out: Index in buffer to first byte after the encoded data. + * + * @return NRF_SUCCESS Fields decoded successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ + +uint32_t count16_cond_data16_enc(uint16_t const * const p_data, + uint16_t const count, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +/**@brief Function for safe decoding of uint16 table with a given element count. + * + * Safe encoding of an variable length field. Range checks will be done if @ref SER_ASSERTS_ENABLED is set. + * It is possible that provided p_data is NULL in that case length is encoded and it's followed by + * SER_FIELD_NOT_PRESENT flag. SER_FIELD_PRESENT flag precedes data otherwise. + * + * @param[in] p_buf Pointer to the beginning of the output buffer. + * @param[in] buf_len Size of buffer. + * @param[in,out] p_index \c in: Index to start of uint8 value in buffer. + * \c out: Index in buffer to first byte after the encoded data. + * @param[in] pp_data Pointer to pointer to the table to encode. + * @param[in,out] p_count Pointer to table element count - initialised with max count + * + * @return NRF_SUCCESS Fields decoded successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_DATA_SIZE Decoding failure. Initial count is smaller than actual. + */ + +uint32_t count16_cond_data16_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint16_t * * const pp_data, + uint16_t * const p_count); + + +/**@brief Function for safe decoding of variable length field encoded as length(16bit)+data. + * + * Safe decoding of an variable length field. Range checks will be done if @ref SER_ASSERTS_ENABLED is set. + * Encoded data consist of presence flag, optional length field, second presence flag and optional data. + * + * + * @param[in] p_buf Pointer to the beginning of the input buffer. + * @param[in] buf_len Size of buffer. + * @param[in,out] p_index \c in: Index to start of uint8 value in buffer. + * \c out: Index in buffer to first byte after the decoded data. + * @param[out] pp_data Pointer to decoded data. + * @param[out] pp_len data length (16bit). + * + * @return NRF_SUCCESS Fields decoded successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ + +uint32_t cond_len16_cond_data_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint8_t * * const pp_data, + uint16_t * * const pp_len); + + +/**@brief Command response encoder - replacement of - ser_ble_cmd_rsp_status_code_enc + * with layout aligned to the rest of encoder functions + * + * @param[in] op_code Operation code - see BLE_GAP_SVCS + * @param[in] return_code nRF Error Code. + * @param[in] p_buff pointer to the start of pointer to decoded data. + * @param[in,out] p_buff_len \c in: size of buffer + * \c out: used bytes in buffer + * @param[in,out] p_buff_len \c in: initial offset in buffer + * \c out: final offset in buffer + * + * @return NRF_SUCCESS Fields decoded successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_NULL Invalid pointer + */ +uint32_t op_status_enc(uint8_t op_code, + uint32_t return_code, + uint8_t * const p_buff, + uint32_t * const p_buff_len, + uint32_t * const p_index); + +/**@brief command response encoder with conditional 16bit field + * + * @param[in] op_code Operation code - see BLE_GAP_SVCS + * @param[in] return_code nRF Error Code. + * @param[in] value optional 16bit field encoded for return code == NRF_SUCCESS + * @param[in] p_buff pointer to the start of pointer to decoded data. + * @param[in,out] p_buff_len \c in: size of buffer + * \c out: used bytes in buffer + * @param[in,out] p_buff_len \c in: initial offset in buffer + * \c out: final offset in buffer + * + * @return NRF_SUCCESS Fields decoded successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_NULL Invalid pointer + */ + +uint32_t op_status_cond_uint16_enc(uint8_t op_code, + uint32_t return_code, + uint16_t value, + uint8_t * const p_buff, + uint32_t * const p_buff_len, + uint32_t * const p_index); + +/**@brief Function for safe encoding a buffer of known size. + * + * Safe encoding of a buffer. Encoder assumes that size is known to the decoder and it is not + * encoded here. Range checks will be done if @ref SER_ASSERTS_ENABLED is set. + * + * @param[in] p_data Data to encode. + * @param[in] dlen Input data length (16bit). + * @param[in] p_buf Pointer to the beginning of the output buffer. + * @param[in] buf_len Size of buffer. + * @param[in,out] p_index \c in: Index to start of uint8 value in buffer. + * \c out: Index in buffer to first byte after the encoded data. + * + * @return NRF_SUCCESS Fields decoded successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t buf_enc(uint8_t const * const p_data, + uint16_t const dlen, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +/**@brief Function for safe decoding a buffer of known size. + * + * Safe decoding of buffer of known size. Range checks will be done if @ref SER_ASSERTS_ENABLED is set. + * Encoded data consist of presence flag and conditional data (present only is presence flag + * is set). p_data pointer is required to be not NULL only is presence flag is set. Length is provided + * as an input to the function. + * + * @param[in] p_buf Pointer to the beginning of the input buffer. + * @param[in] buf_len Size of buffer. + * @param[in,out] p_index \c in: Index to start of uint8 value in buffer. + * \c out: Index in buffer to first byte after the decoded data. + * @param[in] pp_data Pointer to pointer to decoded data. + * @param[in] data_len Length of buffer for decoded data (16bit). + * @param[in] dlen Length of data to decode (16bit). + * + * @return NRF_SUCCESS Fields decoded successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t buf_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint8_t * * const pp_data, + uint16_t data_len, + uint16_t dlen); + +/**@brief Function for safe encoding an uint32 value. + * + * Safe decoding of an uint32 value. Range checks will be done if @ref SER_ASSERTS_ENABLED is set. + * + * @param[in] p_field uint32 value to be encoded. + * @param[out] p_buf Buffer containing the value. + * @param[in] buf_len Size of buffer. + * @param[in,out] p_index \c in: Index to start of uint32 value in buffer. + * \c out: Index in buffer to first byte after the decoded value. + * + * @return NRF_SUCCESS Fields decoded successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t uint32_t_enc(void const * const p_field, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +/**@brief Function for safe decoding an uint32 value. + * + * Safe decoding of an uint32 value. Range checks will be done if @ref SER_ASSERTS_ENABLED is set. + * + * @param[in] p_buf Buffer containing the value. + * @param[in] buf_len Size of buffer. + * @param[in,out] p_index \c in: Index to start of uint32 value in buffer. + * \c out: Index in buffer to first byte after the decoded value. + * @param[out] value Decoded uint32 value. + */ +uint32_t uint32_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * p_field); + +/**@brief Function for safe encoding of an uint8 vector. + * + * Range checks will be done if @ref SER_ASSERTS_ENABLED is set. + * * + * @param[in] p_data Data to encode. + * @param[in] dlen Input data length (16bit). + * @param[in] p_buf Pointer to the beginning of the output buffer. + * @param[in] buf_len Size of buffer. + * @param[in,out] p_index \c in: Index to start of uint8 value in buffer. + * \c out: Index in buffer to first byte after the encoded data. + * + * @return NRF_SUCCESS Fields decoded successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t uint8_vector_enc(uint8_t const * const p_data, + uint16_t const dlen, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +/**@brief Function for safe decoding a an uint8 vector. + * + * Safe decoding of buffer of known size. Range checks will be done if @ref SER_ASSERTS_ENABLED is set. + * Vector length is provided as an input to the function. + * + * @param[in] p_buf Pointer to the beginning of the input buffer. + * @param[in] buf_len Size of buffer. + * @param[in,out] p_index \c in: Index to start of uint8 value in buffer. + * \c out: Index in buffer to first byte after the decoded data. + * @param[in] p_data Pointer to decoded data. + * @param[in] dlen Length of data to decode (16bit). + * + * @return NRF_SUCCESS Fields decoded successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t uint8_vector_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint8_t * const p_data, + uint16_t dlen); + + +#endif + + diff --git a/components/serialization/common/cond_field_serialization.c b/components/serialization/common/cond_field_serialization.c new file mode 100644 index 0000000..4aa38f0 --- /dev/null +++ b/components/serialization/common/cond_field_serialization.c @@ -0,0 +1,62 @@ +#include "nrf_error.h" +#include "cond_field_serialization.h" +#include "ble_serialization.h" +#include + +uint32_t cond_field_enc(void const * const p_field, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + field_encoder_handler_t fp_field_encoder) +{ + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + p_buf[*p_index] = (p_field == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; + *p_index += 1; + + if (p_field && (fp_field_encoder != NULL)) + { + err_code = fp_field_encoder(p_field, p_buf, buf_len, p_index); + } + + return err_code; +} + + +uint32_t cond_field_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * * const pp_field, + field_decoder_handler_t fp_field_parser) +{ + uint32_t err_code = NRF_SUCCESS; + uint8_t is_present; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + uint8_dec(p_buf, buf_len, p_index, &is_present); + + if (is_present == SER_FIELD_PRESENT) + { + SER_ASSERT_NOT_NULL(pp_field); + SER_ASSERT_NOT_NULL(*pp_field); + + if (fp_field_parser != NULL) + { + err_code = fp_field_parser(p_buf, buf_len, p_index, *pp_field); + } + } + else if (is_present == SER_FIELD_NOT_PRESENT) + { + if (pp_field != NULL) + { + *pp_field = NULL; + } + } + else + { + err_code = NRF_ERROR_INVALID_DATA; + } + + return err_code; +} diff --git a/components/serialization/common/cond_field_serialization.h b/components/serialization/common/cond_field_serialization.h new file mode 100644 index 0000000..5eb2132 --- /dev/null +++ b/components/serialization/common/cond_field_serialization.h @@ -0,0 +1,64 @@ +/* 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 "stdint.h" + +typedef uint32_t (*field_encoder_handler_t)(void const * const p_field, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +typedef uint32_t (*field_decoder_handler_t)(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * p_field); + +/**@brief Function for safe encoding conditional field. + * + * Function sets 'presence flag' and checks if conditional field is provided and if it is not NULL + * it calls provided parser function which attempts to encode field content to the buffer stream. + * + * @param[in] p_field Pointer to input struct. + * @param[in] p_buf Pointer to the beginning of the output buffer. + * @param[in] buf_len Size of buffer. + * @param[in,out] p_index \c in: Index to start of uint8 value in buffer. + * \c out: Index in buffer to first byte after the encoded data. + * @param[in] fp_field_encoder Pointer to the function which implements fields encoding. + * + * @return NRF_SUCCESS Fields decoded successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t cond_field_enc(void const * const p_field, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + field_encoder_handler_t field_parser); + +/**@brief Function for safe decoding conditional field. + * + * Function checks if conditional field is present in the input buffer and if it is set it calls + * provided parser function which attempts to parse buffer content to the known field. + * + * @param[in] p_buf Pointer to the beginning of the input buffer. + * @param[in] buf_len Size of buffer. + * @param[in,out] p_index \c in: Index to start of uint8 value in buffer. + * \c out: Index in buffer to first byte after the decoded data. + * @param[in] pp_field Pointer to pointer to output location. + * @param[in] fp_field_decoder Pointer to the function which implements field decoding. + * + * @return NRF_SUCCESS Fields decoded successfully. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t cond_field_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * * const pp_field, + field_decoder_handler_t field_parser); diff --git a/components/serialization/common/ser_config.h b/components/serialization/common/ser_config.h new file mode 100644 index 0000000..6e36361 --- /dev/null +++ b/components/serialization/common/ser_config.h @@ -0,0 +1,122 @@ + /* 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 SER_CONFIG_H__ +#define SER_CONFIG_H__ + +#include + +#include "nrf.h" + +/***********************************************************************************************//** + * General parameters configuration. + **************************************************************************************************/ + +/** Value used as error code on SoftDevice stack dump. Can be used to identify stack location on + * stack unwind.*/ +#define SER_SD_ERROR_CODE (uint32_t)(0xDEADBEEF) + +/** Value used as error code indicating warning - unusual situation but not critical so system + * should NOT be reseted. */ +#define SER_WARNING_CODE (uint32_t)(0xBADDCAFE) + +/***********************************************************************************************//** + * HAL Transport layer configuration. + **************************************************************************************************/ + +/** Max packets size in serialization HAL Transport layer (packets before adding PHY header i.e. + * packet length). */ +#define SER_HAL_TRANSPORT_APP_TO_CONN_MAX_PKT_SIZE (uint32_t)(384) +#define SER_HAL_TRANSPORT_CONN_TO_APP_MAX_PKT_SIZE (uint32_t)(384) + +#define SER_HAL_TRANSPORT_MAX_PKT_SIZE ((SER_HAL_TRANSPORT_APP_TO_CONN_MAX_PKT_SIZE) >= \ + (SER_HAL_TRANSPORT_CONN_TO_APP_MAX_PKT_SIZE) \ + ? \ + (SER_HAL_TRANSPORT_APP_TO_CONN_MAX_PKT_SIZE) : \ + (SER_HAL_TRANSPORT_CONN_TO_APP_MAX_PKT_SIZE)) +#ifdef SER_CONNECTIVITY + #define SER_HAL_TRANSPORT_TX_MAX_PKT_SIZE SER_HAL_TRANSPORT_CONN_TO_APP_MAX_PKT_SIZE + #define SER_HAL_TRANSPORT_RX_MAX_PKT_SIZE SER_HAL_TRANSPORT_APP_TO_CONN_MAX_PKT_SIZE + +#else /* APPLICATION SIDE */ + #define SER_HAL_TRANSPORT_TX_MAX_PKT_SIZE SER_HAL_TRANSPORT_APP_TO_CONN_MAX_PKT_SIZE + #define SER_HAL_TRANSPORT_RX_MAX_PKT_SIZE SER_HAL_TRANSPORT_CONN_TO_APP_MAX_PKT_SIZE +#endif /* SER_CONNECTIVITY */ + + +/***********************************************************************************************//** + * SER_PHY layer configuration. + **************************************************************************************************/ + +#define SER_PHY_HEADER_SIZE 2 + +#define SER_PHY_SPI_FREQUENCY NRF_DRV_SPI_FREQ_1M + +/** Max transfer unit for SPI MASTER and SPI SLAVE. */ +#define SER_PHY_SPI_MTU_SIZE 255 + +/** UART transmission parameters */ +#define SER_PHY_UART_FLOW_CTRL APP_UART_FLOW_CONTROL_ENABLED +#define SER_PHY_UART_PARITY true +#define SER_PHY_UART_BAUDRATE UART_BAUDRATE_BAUDRATE_Baud1M + +/** Find UART baudrate value based on chosen register setting. */ +#if (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud1200) + #define SER_PHY_UART_BAUDRATE_VAL 1200uL +#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud2400) + #define SER_PHY_UART_BAUDRATE_VAL 2400uL +#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud4800) + #define SER_PHY_UART_BAUDRATE_VAL 4800uL +#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud9600) + #define SER_PHY_UART_BAUDRATE_VAL 9600uL +#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud14400) + #define SER_PHY_UART_BAUDRATE_VAL 14400uL +#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud19200) + #define SER_PHY_UART_BAUDRATE_VAL 19200uL +#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud28800) + #define SER_PHY_UART_BAUDRATE_VAL 28800uL +#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud38400) + #define SER_PHY_UART_BAUDRATE_VAL 38400uL +#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud57600) + #define SER_PHY_UART_BAUDRATE_VAL 57600uL +#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud76800) + #define SER_PHY_UART_BAUDRATE_VAL 76800uL +#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud115200) + #define SER_PHY_UART_BAUDRATE_VAL 115200uL +#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud230400) + #define SER_PHY_UART_BAUDRATE_VAL 230400uL +#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud250000) + #define SER_PHY_UART_BAUDRATE_VAL 250000uL +#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud460800) + #define SER_PHY_UART_BAUDRATE_VAL 460800uL +#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud921600) + #define SER_PHY_UART_BAUDRATE_VAL 921600uL +#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud1M) + #define SER_PHY_UART_BAUDRATE_VAL 1000000uL +#endif /* SER_PHY_UART_BAUDRATE */ + +/** Configuration timeouts of connectivity MCU */ +#define CONN_CHIP_RESET_TIME 50 /**< The time to keep the reset line to the nRF51822 low (in milliseconds). */ +#define CONN_CHIP_WAKEUP_TIME 500 /**< The time for nRF51822 to reset and become ready to receive serialized commands (in milliseconds). */ + +#ifdef S110 + #define SER_MAX_CONNECTIONS 1 +#else + #ifdef S120 + #define SER_MAX_CONNECTIONS 8 + #endif + #ifdef S130 + #define SER_MAX_CONNECTIONS 1 + #endif +#endif + +#endif /* SER_CONFIG_H__ */ diff --git a/components/serialization/common/struct_ser/s110/ble_gap_struct_serialization.c b/components/serialization/common/struct_ser/s110/ble_gap_struct_serialization.c new file mode 100644 index 0000000..20beb5f --- /dev/null +++ b/components/serialization/common/struct_ser/s110/ble_gap_struct_serialization.c @@ -0,0 +1,1365 @@ +/* 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 "ble_gap_struct_serialization.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" +#include "string.h" + +uint32_t ble_gap_irk_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_irk_t * p_gap_irk = (ble_gap_irk_t *)p_data; + + SER_ASSERT_LENGTH_LEQ(BLE_GAP_SEC_KEY_LEN, buf_len - *p_index); + + memcpy(&p_buf[*p_index], p_gap_irk->irk, BLE_GAP_SEC_KEY_LEN); + + *p_index += BLE_GAP_SEC_KEY_LEN; + + return NRF_SUCCESS; +} + +uint32_t ble_gap_irk_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + ble_gap_irk_t * p_gap_irk = (ble_gap_irk_t *)p_data; + + SER_ASSERT_LENGTH_LEQ(BLE_GAP_SEC_KEY_LEN, buf_len - *p_index); + + memcpy(p_gap_irk->irk, &p_buf[*p_index], BLE_GAP_SEC_KEY_LEN); + + *p_index += BLE_GAP_SEC_KEY_LEN; + + return NRF_SUCCESS; +} + +uint32_t ble_gap_addr_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_addr_t * p_addr = (ble_gap_addr_t *)p_data; + + SER_ASSERT_LENGTH_LEQ(1 + BLE_GAP_ADDR_LEN, buf_len - *p_index); + + p_buf[*p_index] = p_addr->addr_type; + (*p_index)++; + memcpy(&p_buf[*p_index], p_addr->addr, BLE_GAP_ADDR_LEN); + *p_index += BLE_GAP_ADDR_LEN; + + return NRF_SUCCESS; +} + +uint32_t ble_gap_addr_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_addr) +{ + ble_gap_addr_t * p_address = (ble_gap_addr_t *) p_addr; + + SER_ASSERT_LENGTH_LEQ(sizeof (ble_gap_addr_t), buf_len - *p_index); + memcpy(p_address, &p_buf[*p_index], sizeof (ble_gap_addr_t)); + *p_index += sizeof (ble_gap_addr_t); + + return NRF_SUCCESS; +} + +uint32_t ble_gap_sec_levels_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_sec_levels_t * p_sec_levels = (ble_gap_sec_levels_t *)p_data; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + + p_buf[*p_index] = (p_sec_levels->lv1 << 0) | (p_sec_levels->lv2 << 1) | (p_sec_levels->lv3 << 2); + (*p_index)++; + + return NRF_SUCCESS; +} + +uint32_t ble_gap_sec_levels_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + ble_gap_sec_levels_t * p_sec_levels = (ble_gap_sec_levels_t *)p_data; + uint32_t err_code; + uint32_t uint8_temp; + + SER_ASSERT_LENGTH_LEQ(sizeof (ble_gap_sec_levels_t), buf_len - *p_index); + + err_code = uint8_t_dec(p_buf, buf_len, p_index, (void *) &(uint8_temp)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + p_sec_levels->lv1 = uint8_temp & 0x01; + p_sec_levels->lv2 = (uint8_temp >> 1) & 0x01; + p_sec_levels->lv3 = (uint8_temp >> 2) & 0x01; + + return NRF_SUCCESS; +} + +uint32_t ble_gap_sec_keys_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_sec_keys_t * p_sec_keys = (ble_gap_sec_keys_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = cond_field_enc(p_sec_keys->p_enc_key, p_buf, buf_len, p_index, ble_gap_enc_key_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_sec_keys->p_id_key, p_buf, buf_len, p_index, ble_gap_id_key_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_sec_keys->p_sign_key, p_buf, buf_len, p_index, ble_gap_sign_info_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_sec_keys_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + ble_gap_sec_keys_t * p_sec_keys = (ble_gap_sec_keys_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = cond_field_dec(p_buf, buf_len, p_index, (void * *)&(p_sec_keys->p_enc_key), ble_gap_enc_key_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, buf_len, p_index, (void * *)&(p_sec_keys->p_id_key), ble_gap_id_key_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, buf_len, p_index, (void * *)&(p_sec_keys->p_sign_key), ble_gap_sign_info_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +//uint32_t ble_gap_enc_info_enc(void const * const p_data, +// uint8_t * const p_buf, +// uint32_t buf_len, +// uint32_t * const p_index) +//{ +// uint32_t err_code; +// ble_gap_enc_info_t * p_enc_info = (ble_gap_enc_info_t *)p_data; + +// SER_ASSERT_LENGTH_LEQ(2 + BLE_GAP_SEC_KEY_LEN + 1, buf_len - *p_index); + +// err_code = uint16_t_enc(&p_enc_info->div, p_buf, buf_len, p_index); +// SER_ASSERT(err_code == NRF_SUCCESS, err_code); + +// memcpy(&p_buf[*p_index], p_enc_info->ltk, BLE_GAP_SEC_KEY_LEN); +// *p_index += BLE_GAP_SEC_KEY_LEN; + +// p_buf[*p_index] = p_enc_info->auth & 0x01; +// p_buf[*p_index] |= (p_enc_info->ltk_len & 0x7F) << 1; +// (*p_index)++; + +// return err_code; +//} + +//uint32_t ble_gap_enc_info_dec(uint8_t const * const p_buf, +// uint32_t buf_len, +// uint32_t * const p_index, +// void * const p_enc_info) +//{ +// ble_gap_enc_info_t * p_enc_info2 = (ble_gap_enc_info_t *)p_enc_info; + +// SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index); +// uint16_dec(p_buf, buf_len, p_index, &p_enc_info2->div); + +// SER_ASSERT_LENGTH_LEQ(BLE_GAP_SEC_KEY_LEN, buf_len - *p_index); +// memcpy(p_enc_info2->ltk, &p_buf[*p_index], BLE_GAP_SEC_KEY_LEN); +// *p_index += BLE_GAP_SEC_KEY_LEN; + +// SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); +// p_enc_info2->auth = p_buf[*p_index] & 0x01; +// p_enc_info2->ltk_len = (p_buf[*p_index] >> 1) & 0x7F; +// *p_index += 1; + +// return NRF_SUCCESS; +//} + +uint32_t ble_gap_sign_info_enc(void const * const p_sign_info, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_LENGTH_LEQ(sizeof (ble_gap_sign_info_t), buf_len - *p_index); + memcpy(&p_buf[*p_index], p_sign_info, sizeof (ble_gap_sign_info_t)); + *p_index += sizeof (ble_gap_sign_info_t); + + return NRF_SUCCESS; +} + +uint32_t ble_gap_sign_info_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_sign_info) +{ + SER_ASSERT_LENGTH_LEQ(sizeof (ble_gap_sign_info_t), buf_len - *p_index); + memcpy(p_sign_info, &p_buf[*p_index], sizeof (ble_gap_sign_info_t)); + *p_index += sizeof (ble_gap_sign_info_t); + + return NRF_SUCCESS; +} + +uint32_t ble_gap_evt_auth_status_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + ble_gap_evt_auth_status_t * p_auth_status = (ble_gap_evt_auth_status_t *)p_data; + + SER_ASSERT_LENGTH_LEQ(6, buf_len - *p_index); + + err_code = uint8_t_enc(&(p_auth_status->auth_status), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + byte = (p_auth_status->error_src) | ((p_auth_status->bonded) << 2); + + err_code = uint8_t_enc(&byte, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_levels_enc(&(p_auth_status->sm1_levels), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_levels_enc(&(p_auth_status->sm2_levels), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_kdist_t_enc(&(p_auth_status->kdist_periph), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_kdist_t_enc(&(p_auth_status->kdist_central), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_evt_auth_status_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + + ble_gap_evt_auth_status_t * p_auth_status = (ble_gap_evt_auth_status_t *)p_data; + uint32_t err_code; + uint8_t byte; + + SER_ASSERT_LENGTH_LEQ(6, buf_len - *p_index); + SER_ASSERT_NOT_NULL(p_auth_status); + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &(p_auth_status->auth_status)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &byte); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_auth_status->error_src = byte & 0x03; + p_auth_status->bonded = (byte >> 2) & 0x01 ; + + err_code = ble_gap_sec_levels_dec(p_buf, buf_len, p_index, &(p_auth_status->sm1_levels)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_levels_dec(p_buf, buf_len, p_index, &(p_auth_status->sm2_levels)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_kdist_t_dec(p_buf, buf_len, p_index, &(p_auth_status->kdist_periph)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_kdist_t_dec(p_buf, buf_len, p_index, &(p_auth_status->kdist_central)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_conn_sec_mode_enc(void const * const p_void_sec_mode, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_conn_sec_mode_t * p_sec_mode = (ble_gap_conn_sec_mode_t *)p_void_sec_mode; + uint32_t err_code = NRF_SUCCESS; + uint8_t temp8 = p_sec_mode->sm | (p_sec_mode->lv << 4); + + err_code = uint8_t_enc(&temp8, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_conn_sec_mode_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_sec_mode) +{ + ble_gap_conn_sec_mode_t * p_sec_mode = (ble_gap_conn_sec_mode_t *)p_void_sec_mode; + uint32_t err_code = NRF_SUCCESS; + uint8_t temp8; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + uint8_dec(p_buf, buf_len, p_index, &temp8); + + p_sec_mode->sm = temp8; + p_sec_mode->lv = temp8 >> 4; + + return err_code; +} + +uint32_t ble_gap_evt_conn_sec_update_t_enc(void const * const p_void_conn_sec_update, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + return ble_gap_conn_sec_t_enc(p_void_conn_sec_update, p_buf, buf_len, p_index); +} + +uint32_t ble_gap_evt_conn_sec_update_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_conn_sec_update) +{ + return ble_gap_conn_sec_t_dec(p_buf, buf_len, p_index, p_void_conn_sec_update); +} + +uint32_t ble_gap_conn_sec_t_enc(void const * const p_void_sec, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_conn_sec_t * p_conn_sec = (ble_gap_conn_sec_t *)p_void_sec; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_conn_sec_mode_enc(&p_conn_sec->sec_mode, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&p_conn_sec->encr_key_size, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_conn_sec_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_sec) +{ + ble_gap_conn_sec_t * p_conn_sec = (ble_gap_conn_sec_t *)p_void_sec; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_conn_sec_mode_dec(p_buf, buf_len, p_index, &p_conn_sec->sec_mode); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + uint8_dec(p_buf, buf_len, p_index, &p_conn_sec->encr_key_size); + + return err_code; +} + +uint32_t ble_gap_evt_sec_info_request_t_enc(void const * const p_void_sec_info_request, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_evt_sec_info_request_t * p_conn_sec = + (ble_gap_evt_sec_info_request_t *)p_void_sec_info_request; + + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_addr_enc(&p_conn_sec->peer_addr, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_master_id_t_enc(&p_conn_sec->master_id, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + uint8_t temp8 = p_conn_sec->enc_info | + (p_conn_sec->id_info << 1) | + (p_conn_sec->sign_info << 2); + + err_code = uint8_t_enc(&temp8, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_evt_sec_info_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_sec_info_request) +{ + ble_gap_evt_sec_info_request_t * p_conn_sec = (ble_gap_evt_sec_info_request_t *)p_void_sec_info_request; + uint32_t err_code = NRF_SUCCESS; + uint8_t temp8; + + err_code = ble_gap_addr_dec(p_buf, buf_len, p_index, &(p_conn_sec->peer_addr)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_master_id_t_dec(p_buf, buf_len, p_index, &(p_conn_sec->master_id)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, buf_len, p_index, (void *) &temp8); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + p_conn_sec->enc_info = temp8 & 0x01; + p_conn_sec->id_info = (temp8 >> 1) & 0x01; + p_conn_sec->sign_info = (temp8 >> 2) & 0x01; + + return err_code; +} + +uint32_t ble_gap_evt_connected_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_evt_connected_t * p_evt_conn = (ble_gap_evt_connected_t *)p_void_struct; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte = 0; + + err_code = ble_gap_addr_enc((void *)&p_evt_conn->peer_addr, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_addr_enc((void *)&p_evt_conn->own_addr, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + byte = p_evt_conn->irk_match | (p_evt_conn->irk_match_idx << 1); + err_code = uint8_t_enc(&byte, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_conn_params_t_enc((void *)&p_evt_conn->conn_params, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_evt_connected_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_connected) +{ + ble_gap_evt_connected_t * p_evt_conn = (ble_gap_evt_connected_t *)p_void_connected; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte = 0; + + err_code = ble_gap_addr_dec(p_buf, buf_len, p_index, &(p_evt_conn->peer_addr)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_addr_dec(p_buf, buf_len, p_index, &(p_evt_conn->own_addr)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &byte); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_evt_conn->irk_match = byte & 0x01; + p_evt_conn->irk_match_idx = (byte & 0xFE) >> 1; + + err_code = ble_gap_conn_params_t_dec(p_buf, buf_len, p_index, &(p_evt_conn->conn_params)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_sec_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_sec_params_t * p_sec_params = (ble_gap_sec_params_t *)p_void_struct; + uint32_t err_code = NRF_SUCCESS; + uint8_t temp8; + + temp8 = (p_sec_params->bond & 0x01) | + ((p_sec_params->mitm & 0x01) << 1) | + ((p_sec_params->io_caps & 0x07) << 2) | + ((p_sec_params->oob & 0x01) << 5); + + err_code = uint8_t_enc((void *) &temp8, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc((void *) &(p_sec_params->min_key_size), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc((void *) &(p_sec_params->max_key_size), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_kdist_t_enc((void *) &(p_sec_params->kdist_periph), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_kdist_t_enc((void *) &(p_sec_params->kdist_central), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_sec_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + ble_gap_sec_params_t * p_sec_params = (ble_gap_sec_params_t *)p_void_struct; + uint32_t err_code = NRF_SUCCESS; + uint8_t temp8; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, (void *) &temp8); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_sec_params->bond = temp8 & 0x01; + p_sec_params->mitm = (temp8 >> 1) & 0x01; + p_sec_params->io_caps = (temp8 >> 2) & 0x07; + p_sec_params->oob = (temp8 >> 5) & 0x01; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, (void *) &(p_sec_params->min_key_size)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, buf_len, p_index, (void *) &(p_sec_params->max_key_size)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_kdist_t_dec(p_buf, buf_len, p_index, (void *) &(p_sec_params->kdist_periph)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_kdist_t_dec(p_buf, buf_len, p_index, (void *) &(p_sec_params->kdist_central)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_evt_sec_params_request_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + return ble_gap_sec_params_t_enc(p_void_struct, p_buf, buf_len, p_index); +} + +uint32_t ble_gap_evt_sec_params_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + return ble_gap_sec_params_t_dec(p_buf, buf_len, p_index, p_void_struct); +} + +uint32_t ble_gap_evt_conn_param_update_t_enc(void const * const p_void_evt_conn_param_update, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + return ble_gap_conn_params_t_enc(p_void_evt_conn_param_update, p_buf, buf_len, p_index); +} + +uint32_t ble_gap_evt_conn_param_update_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_evt_conn_param_update) +{ + return ble_gap_conn_params_t_dec(p_buf, buf_len, p_index, p_void_evt_conn_param_update); +} + +uint32_t ble_gap_evt_conn_param_update_request_t_enc(void const * const p_void_evt_conn_param_update_request, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + return ble_gap_conn_params_t_enc(p_void_evt_conn_param_update_request, p_buf, buf_len, p_index); +} + +uint32_t ble_gap_evt_conn_param_update_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_evt_conn_param_update_request) +{ + return ble_gap_conn_params_t_dec(p_buf, buf_len, p_index, p_void_evt_conn_param_update_request); +} + +uint32_t ble_gap_conn_params_t_enc(void const * const p_void_conn_params, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_conn_params_t * p_conn_params = (ble_gap_conn_params_t *)p_void_conn_params; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&p_conn_params->min_conn_interval, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_conn_params->max_conn_interval, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_conn_params->slave_latency, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_conn_params->conn_sup_timeout, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_conn_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_conn_params) +{ + ble_gap_conn_params_t * p_conn_params = (ble_gap_conn_params_t *)p_void_conn_params; + + SER_ASSERT_LENGTH_LEQ(*p_index + 2, buf_len); + uint16_dec(p_buf, buf_len, p_index, &p_conn_params->min_conn_interval); + + SER_ASSERT_LENGTH_LEQ(*p_index + 2, buf_len); + uint16_dec(p_buf, buf_len, p_index, &p_conn_params->max_conn_interval); + + SER_ASSERT_LENGTH_LEQ(*p_index + 2, buf_len); + uint16_dec(p_buf, buf_len, p_index, &p_conn_params->slave_latency); + + SER_ASSERT_LENGTH_LEQ(*p_index + 2, buf_len); + uint16_dec(p_buf, buf_len, p_index, &p_conn_params->conn_sup_timeout); + + return NRF_SUCCESS; +} + +uint32_t ble_gap_evt_disconnected_t_enc(void const * const p_void_disconnected, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_evt_disconnected_t * p_disconnected = (ble_gap_evt_disconnected_t *)p_void_disconnected; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint8_t_enc(&p_disconnected->reason, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_evt_disconnected_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_disconnected) +{ + ble_gap_evt_disconnected_t * p_disconnected = (ble_gap_evt_disconnected_t *)p_void_disconnected; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + uint8_dec(p_buf, buf_len, p_index, &p_disconnected->reason); + + return err_code; +} + +uint32_t ble_gap_opt_ch_map_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_ch_map_t * p_gap_opt_ch_map = (ble_gap_opt_ch_map_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&p_gap_opt_ch_map->conn_handle, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(5, buf_len - *p_index); + memcpy(&p_buf[*p_index], p_gap_opt_ch_map->ch_map, 5); + + *p_index += 5; + + return err_code; +} + +uint32_t ble_gap_opt_ch_map_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_ch_map_t * p_gap_opt_ch_map = (ble_gap_opt_ch_map_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &p_gap_opt_ch_map->conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(5, buf_len - *p_index); + memcpy(p_gap_opt_ch_map->ch_map, &p_buf[*p_index], 5); + + *p_index += 5; + + return err_code; +} + +uint32_t ble_gap_opt_local_conn_latency_t_enc(void const * const p_void_local_conn_latency, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_local_conn_latency_t * p_latency = + (ble_gap_opt_local_conn_latency_t *)p_void_local_conn_latency; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&(p_latency->conn_handle), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_latency->requested_latency), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_latency->p_actual_latency, p_buf, buf_len, p_index, uint16_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_opt_local_conn_latency_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_local_conn_latency) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_local_conn_latency_t * p_latency = + (ble_gap_opt_local_conn_latency_t *)p_void_local_conn_latency; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_latency->conn_handle)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_latency->requested_latency)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_latency->p_actual_latency), + uint16_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_opt_passkey_t_enc(void const * const p_void_passkey, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_passkey_t * p_opt_passkey = (ble_gap_opt_passkey_t *)p_void_passkey; + uint32_t err_code = NRF_SUCCESS; + uint16_t passkey_len = BLE_GAP_PASSKEY_LEN; + + err_code = buf_enc(p_opt_passkey->p_passkey, passkey_len, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_opt_passkey_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_passkey) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_passkey_t * p_opt_passkey = (ble_gap_opt_passkey_t *)p_void_passkey; + uint32_t err_code = NRF_SUCCESS; + uint16_t passkey_len = BLE_GAP_PASSKEY_LEN; + + err_code = buf_dec(p_buf, buf_len, p_index, &p_opt_passkey->p_passkey, passkey_len, + passkey_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_opt_privacy_t_enc(void const * const p_void_privacy, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_privacy_t * p_privacy = (ble_gap_opt_privacy_t *)p_void_privacy; + uint32_t err_code = NRF_SUCCESS; + + err_code = cond_field_enc(p_privacy->p_irk, p_buf, buf_len, p_index, ble_gap_irk_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_privacy->interval_s), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_opt_privacy_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_privacy) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_privacy_t * p_privacy = (ble_gap_opt_privacy_t *)p_void_privacy; + uint32_t err_code = NRF_SUCCESS; + + err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_privacy->p_irk), ble_gap_irk_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_privacy->interval_s)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_opt_scan_req_report_t_enc(void const * const p_void_scan_req_report, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_scan_req_report_t * p_scan_req_report = (ble_gap_opt_scan_req_report_t *)p_void_scan_req_report; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + byte = p_scan_req_report->enable; + err_code = uint8_t_enc(&byte, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_opt_scan_req_report_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_scan_req_report) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_scan_req_report_t * p_scan_req_report = (ble_gap_opt_scan_req_report_t *)p_void_scan_req_report; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &byte); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_scan_req_report->enable = byte & 0x01; + + return err_code; +} + +uint32_t ble_gap_opt_compat_mode_t_enc(void const * const p_void_compat_mode, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_compat_mode_t * p_compat_mode = (ble_gap_opt_compat_mode_t *)p_void_compat_mode; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + byte = p_compat_mode->mode_1_enable; + err_code = uint8_t_enc(&byte, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_opt_compat_mode_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_compat_mode) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_compat_mode_t * p_compat_mode = (ble_gap_opt_compat_mode_t *)p_void_compat_mode; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &byte); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_compat_mode->mode_1_enable = byte & 0x01; + + return err_code; +} + +uint32_t ble_gap_sec_kdist_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_sec_kdist_t * p_sec_kdist = (ble_gap_sec_kdist_t *) p_data; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + + p_buf[*p_index] = p_sec_kdist->enc & 0x01; + p_buf[*p_index] |= (p_sec_kdist->id & 0x01) << 1; + p_buf[*p_index] |= (p_sec_kdist->sign & 0x01) << 2; + (*p_index)++; + + return err_code; +} + +uint32_t ble_gap_sec_kdist_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_sec_kdist_t * p_sec_kdist = (ble_gap_sec_kdist_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + p_sec_kdist->enc = p_buf[*p_index] & 0x01; + p_sec_kdist->id = (p_buf[*p_index] >> 1) & 0x01; + p_sec_kdist->sign = (p_buf[*p_index] >> 2) & 0x01; + (*p_index)++; + + return err_code; +} + +uint32_t ble_gap_master_id_t_enc(void const * const p_master_idx, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_master_id_t * p_master_id = (ble_gap_master_id_t *) p_master_idx; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&(p_master_id->ediv), p_buf, buf_len, p_index); + + SER_ASSERT_LENGTH_LEQ(BLE_GAP_SEC_RAND_LEN, buf_len - *p_index); + memcpy(&p_buf[*p_index], p_master_id->rand, BLE_GAP_SEC_RAND_LEN); + *p_index += BLE_GAP_SEC_RAND_LEN; + + return err_code; +} + +uint32_t ble_gap_master_id_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_master_idx) +{ + ble_gap_master_id_t *p_master_id = (ble_gap_master_id_t *)p_master_idx; + + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_master_id->ediv)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(BLE_GAP_SEC_RAND_LEN, buf_len - *p_index); + memcpy(p_master_id->rand, &p_buf[*p_index], BLE_GAP_SEC_RAND_LEN); + *p_index += BLE_GAP_SEC_RAND_LEN; + + return err_code; +} + +uint32_t ble_gap_enc_info_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t err_code = NRF_SUCCESS; + ble_gap_enc_info_t * p_enc_info = (ble_gap_enc_info_t *)p_data; + + SER_ASSERT_LENGTH_LEQ(BLE_GAP_SEC_KEY_LEN + 1, buf_len - *p_index); + + memcpy(&p_buf[*p_index], p_enc_info->ltk, BLE_GAP_SEC_KEY_LEN); + *p_index += BLE_GAP_SEC_KEY_LEN; + + p_buf[*p_index] = p_enc_info->auth & 0x01; + p_buf[*p_index] |= (p_enc_info->ltk_len & 0x7F) << 1; + (*p_index)++; + + return err_code; +} + +uint32_t ble_gap_enc_info_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_enc_infox) +{ + ble_gap_enc_info_t * p_enc_info = (ble_gap_enc_info_t *)p_enc_infox; + + SER_ASSERT_LENGTH_LEQ(BLE_GAP_SEC_KEY_LEN, buf_len - *p_index); + memcpy(p_enc_info->ltk, &p_buf[*p_index], BLE_GAP_SEC_KEY_LEN); + *p_index += BLE_GAP_SEC_KEY_LEN; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + p_enc_info->auth = p_buf[*p_index] & 0x01; + p_enc_info->ltk_len = (p_buf[*p_index] >> 1) & 0x7F; + *p_index += 1; + + return NRF_SUCCESS; +} + +uint32_t ble_gap_enc_key_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_enc_key_t * p_enc_key = (ble_gap_enc_key_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_enc_info_enc(&(p_enc_key->enc_info), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_master_id_t_enc(&(p_enc_key->master_id), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_enc_key_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_enc_key_t * p_enc_key = (ble_gap_enc_key_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_enc_info_dec(p_buf, buf_len, p_index, &(p_enc_key->enc_info)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_master_id_t_dec(p_buf, buf_len, p_index, &(p_enc_key->master_id)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_id_key_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_id_key_t * p_id_key = (ble_gap_id_key_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_irk_enc(&(p_id_key->id_info), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_addr_enc(&(p_id_key->id_addr_info), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_id_key_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_id_key_t * p_id_key = (ble_gap_id_key_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_irk_dec(p_buf, buf_len, p_index, &(p_id_key->id_info)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_addr_dec(p_buf, buf_len, p_index, &(p_id_key->id_addr_info)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_sec_keyset_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_sec_keyset_t * p_sec_keyset = (ble_gap_sec_keyset_t *) p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_sec_keys_enc(&(p_sec_keyset->keys_periph), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_keys_enc(&(p_sec_keyset->keys_central), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_sec_keyset_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_sec_keyset_t * p_sec_keyset = (ble_gap_sec_keyset_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_sec_keys_dec(p_buf, buf_len, p_index, &(p_sec_keyset->keys_periph)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_keys_dec(p_buf, buf_len, p_index, &(p_sec_keyset->keys_central)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_whitelist_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_whitelist_t *p_whitelist = (ble_gap_whitelist_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + uint32_t i = 0; + + SER_ERROR_CHECK(p_whitelist->addr_count <= BLE_GAP_WHITELIST_ADDR_MAX_COUNT, + NRF_ERROR_INVALID_PARAM); + SER_ERROR_CHECK(p_whitelist->irk_count <= BLE_GAP_WHITELIST_IRK_MAX_COUNT, + NRF_ERROR_INVALID_PARAM); + + err_code = uint8_t_enc(&(p_whitelist->addr_count), p_buf, buf_len, p_index); + + err_code = cond_field_enc(p_whitelist->pp_addrs, p_buf, buf_len, p_index, NULL); + + for (i = 0; i < p_whitelist->addr_count; i++) + { + err_code = cond_field_enc(p_whitelist->pp_addrs[i], p_buf, buf_len, p_index, ble_gap_addr_enc); + } + + err_code = uint8_t_enc(&(p_whitelist->irk_count), p_buf, buf_len, p_index); + + err_code = cond_field_enc(p_whitelist->pp_irks, p_buf, buf_len, p_index, NULL); + + for (i = 0; i < p_whitelist->irk_count; i++) + { + err_code = cond_field_enc(p_whitelist->pp_irks[i], p_buf, buf_len, p_index, ble_gap_irk_enc); + } + + return err_code; +} + +uint32_t ble_gap_whitelist_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * p_data) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_whitelist_t * p_whitelist = (ble_gap_whitelist_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + uint32_t i = 0; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &(p_whitelist->addr_count)); + SER_ERROR_CHECK(p_whitelist->addr_count <= BLE_GAP_WHITELIST_ADDR_MAX_COUNT, + NRF_ERROR_INVALID_LENGTH); + + err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_whitelist->pp_addrs), NULL); + + for (i = 0; i < p_whitelist->addr_count; i++) + { + err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_whitelist->pp_addrs[i]), ble_gap_addr_dec); + } + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &(p_whitelist->irk_count)); + SER_ERROR_CHECK(p_whitelist->irk_count <= BLE_GAP_WHITELIST_IRK_MAX_COUNT, + NRF_ERROR_INVALID_LENGTH); + + err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_whitelist->pp_irks), NULL); + + for (i = 0; i < p_whitelist->irk_count; i++) + { + err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_whitelist->pp_irks[i]), ble_gap_irk_dec); + } + + return err_code; +} + +uint32_t ble_gap_scan_params_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_scan_params_t * p_scan_params = (ble_gap_scan_params_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + p_buf[*p_index] = p_scan_params->active & 0x01; + p_buf[*p_index] |= (p_scan_params->selective & 0x7F) << 1; + (*p_index)++; + + err_code = cond_field_enc(p_scan_params->p_whitelist, p_buf, buf_len, p_index, ble_gap_whitelist_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_scan_params->interval), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_scan_params->window), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_scan_params->timeout), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_scan_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_scan_params_t * p_scan_params = (ble_gap_scan_params_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + p_scan_params->active = p_buf[*p_index] & 0x01; + p_scan_params->selective = (p_buf[*p_index] >> 1) & 0x7F; + (*p_index)++; + + err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_scan_params->p_whitelist), ble_gap_whitelist_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_scan_params->interval)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_scan_params->window)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_scan_params->timeout)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_adv_ch_mask_t_enc(void const * const p_void_ch_mask, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_adv_ch_mask_t * p_ch_mask = (ble_gap_adv_ch_mask_t *)p_void_ch_mask; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + byte = p_ch_mask->ch_37_off | + (p_ch_mask->ch_38_off << 1) | + (p_ch_mask->ch_39_off << 2); + err_code = uint8_t_enc(&byte, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_adv_ch_mask_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_ch_mask) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_adv_ch_mask_t * p_ch_mask = (ble_gap_adv_ch_mask_t *)p_void_ch_mask; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &byte); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_ch_mask->ch_37_off = byte & 0x01; + p_ch_mask->ch_38_off = (byte >> 1) & 0x01; + p_ch_mask->ch_39_off = (byte >> 2) & 0x01; + + return err_code; +} + +uint32_t ble_gap_evt_sec_request_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_evt_sec_request_t * p_evt_sec_request = (ble_gap_evt_sec_request_t *)p_void_struct; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + + p_buf[*p_index] = p_evt_sec_request->bond & 0x01; + p_buf[*p_index] |= (p_evt_sec_request->mitm & 0x01) << 1; + (*p_index)++; + + return err_code; +} + +uint32_t ble_gap_evt_sec_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_evt_sec_request_t * p_sec_request = (ble_gap_evt_sec_request_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + p_sec_request->bond = p_buf[*p_index] & 0x01; + p_sec_request->mitm = (p_buf[*p_index] >> 1) & 0x01; + *p_index += 1; + + return err_code; +} diff --git a/components/serialization/common/struct_ser/s110/ble_gap_struct_serialization.h b/components/serialization/common/struct_ser/s110/ble_gap_struct_serialization.h new file mode 100644 index 0000000..000f355 --- /dev/null +++ b/components/serialization/common/struct_ser/s110/ble_gap_struct_serialization.h @@ -0,0 +1,352 @@ +/* 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 "ble_gap.h" + +uint32_t ble_gap_irk_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_irk_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_addr_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_addr_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_addr); + +uint32_t ble_gap_sec_levels_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_sec_levels_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_sec_keys_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_sec_keys_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_enc_info_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_enc_info_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_enc_info); + +uint32_t ble_gap_sign_info_enc(void const * const p_sign_info, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_sign_info_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_sign_info); + +uint32_t ble_gap_evt_auth_status_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_evt_auth_status_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_conn_sec_mode_enc(void const * const p_void_sec_mode, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_conn_sec_mode_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_sec_mode); + +uint32_t ble_gap_conn_sec_t_enc(void const * const p_void_sec, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_conn_sec_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_sec); + +uint32_t ble_gap_evt_conn_sec_update_t_enc(void const * const p_void_conn_sec_update, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_evt_conn_sec_update_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_conn_sec_update); + +uint32_t ble_gap_evt_sec_info_request_t_enc(void const * const p_void_sec_info_request, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_evt_sec_info_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_sec_info_request); +uint32_t ble_gap_evt_connected_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_evt_connected_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_connected); + +uint32_t ble_gap_sec_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_sec_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gap_evt_sec_params_request_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_evt_sec_params_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gap_conn_params_t_enc(void const * const p_void_conn_params, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_conn_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_conn_params); + +uint32_t ble_gap_evt_conn_param_update_t_enc(void const * const p_void_evt_conn_param_update, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_evt_conn_param_update_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_evt_conn_param_update); + +uint32_t ble_gap_evt_conn_param_update_request_t_enc(void const * const p_void_evt_conn_param_update_request, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_evt_conn_param_update_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_evt_conn_param_update_request); + +uint32_t ble_gap_evt_disconnected_t_enc(void const * const p_void_disconnected, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_evt_disconnected_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_disconnected); + +uint32_t ble_gap_opt_ch_map_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_opt_ch_map_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_opt_local_conn_latency_t_enc(void const * const p_void_local_conn_latency, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_opt_local_conn_latency_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_local_conn_latency); + +uint32_t ble_gap_opt_passkey_t_enc(void const * const p_void_passkey, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_opt_passkey_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_passkey); + +uint32_t ble_gap_opt_privacy_t_enc(void const * const p_void_privacy, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_opt_privacy_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_privacy); + +uint32_t ble_gap_opt_scan_req_report_t_enc(void const * const p_void_scan_req_report, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_opt_scan_req_report_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_scan_req_report); + +uint32_t ble_gap_opt_compat_mode_t_enc(void const * const p_void_compat_mode, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_opt_compat_mode_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_compat_mode); + +uint32_t ble_gap_sec_kdist_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_sec_kdist_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_master_id_t_enc(void const * const p_master_idx, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_master_id_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_master_idx); + +uint32_t ble_gap_enc_info_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_enc_info_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_enc_info); + +uint32_t ble_gap_enc_key_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_enc_key_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_id_key_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_id_key_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_sec_keyset_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_sec_keyset_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_whitelist_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_whitelist_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * p_data); + +uint32_t ble_gap_scan_params_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_scan_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_adv_ch_mask_t_enc(void const * const p_void_ch_mask, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_adv_ch_mask_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_ch_mask); + +uint32_t ble_gap_evt_sec_request_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_evt_sec_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); diff --git a/components/serialization/common/struct_ser/s110/ble_gattc_struct_serialization.c b/components/serialization/common/struct_ser/s110/ble_gattc_struct_serialization.c new file mode 100644 index 0000000..2a03665 --- /dev/null +++ b/components/serialization/common/struct_ser/s110/ble_gattc_struct_serialization.c @@ -0,0 +1,363 @@ +/* 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 "ble_gattc_struct_serialization.h" +#include "ble_struct_serialization.h" +#include "ble_serialization.h" +#include "app_util.h" +#include "ble_gattc.h" +#include "cond_field_serialization.h" +#include + +uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gattc_evt_char_val_by_uuid_read_rsp_t * p_read = + (ble_gattc_evt_char_val_by_uuid_read_rsp_t *) p_void_struct; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&(p_read->count), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_read->value_len), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + uint32_t i; + ble_gattc_handle_value_t * p_handle_value = &p_read->handle_value[0]; + + for (i = 0; i < p_read->count; i++) + { + err_code = uint16_t_enc(&(p_handle_value->handle), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(p_read->value_len, buf_len - *p_index); + memcpy(&p_buf[*p_index], p_handle_value->p_value, p_read->value_len); + *p_index += p_read->value_len; + + p_handle_value++; + } + + return err_code; +} + +uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_struct_size, + void * const p_void_struct) +{ + ble_gattc_evt_char_val_by_uuid_read_rsp_t * p_read = + (ble_gattc_evt_char_val_by_uuid_read_rsp_t *) p_void_struct; + uint32_t err_code = NRF_SUCCESS; + uint16_t value_len; + uint16_t count; + uint32_t i; + + SER_ASSERT_LENGTH_LEQ(4, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &count); + uint16_dec(p_buf, buf_len, p_index, &value_len); + + uint32_t total_struct_size = *p_struct_size; + + //calculate the size of the struct + *p_struct_size = offsetof(ble_gattc_evt_char_val_by_uuid_read_rsp_t, handle_value[0]); + *p_struct_size += sizeof(((ble_gattc_evt_char_val_by_uuid_read_rsp_t *)0)->handle_value) * count; + *p_struct_size += value_len * count; + + if (p_read) + { + p_read->value_len = value_len; + p_read->count = count; + + ble_gattc_handle_value_t * p_handle_value; + uint8_t * p_value; + + SER_ASSERT_LENGTH_LEQ(*p_struct_size, total_struct_size); + + p_value = (uint8_t *)&p_read->handle_value[count]; + + for (i = 0; i < count; i++) + { + p_handle_value = (ble_gattc_handle_value_t *)&p_read->handle_value[i]; + p_handle_value->p_value = p_value; + + SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &(p_handle_value->handle)); + + SER_ASSERT_LENGTH_LEQ(p_read->value_len, buf_len - *p_index); + memcpy(p_handle_value->p_value, &p_buf[*p_index], p_read->value_len); + *p_index += p_read->value_len; + + p_value += value_len; + } + } + else + { + *p_index += count * (value_len + 2); + } + + return err_code; +} + +uint32_t ble_gattc_evt_char_vals_read_rsp_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gattc_evt_char_vals_read_rsp_t * p_read = + (ble_gattc_evt_char_vals_read_rsp_t *) p_void_struct; + uint32_t error_code = NRF_SUCCESS; + + //Encode len + error_code = uint16_t_enc(&(p_read->len), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + //Encode values + SER_ASSERT_LENGTH_LEQ(p_read->len, buf_len - *p_index); + memcpy(&p_buf[*p_index], p_read->values, p_read->len); + *p_index += p_read->len; + + return error_code; +} + +uint32_t ble_gattc_evt_char_vals_read_rsp_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + ble_gattc_evt_char_vals_read_rsp_t * p_read = + (ble_gattc_evt_char_vals_read_rsp_t *) p_void_struct; + uint32_t error_code = NRF_SUCCESS; + + //Decode len + SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &(p_read->len)); + + //Decode values + SER_ASSERT_LENGTH_LEQ(p_read->len, buf_len - *p_index); + memcpy(p_read->values, &p_buf[*p_index], p_read->len); + *p_index += p_read->len; + + return error_code; +} + +uint32_t ble_gattc_handle_range_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gattc_handle_range_t * p_range = (ble_gattc_handle_range_t *) p_void_struct; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&(p_range->start_handle), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_range->end_handle), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gattc_handle_range_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + ble_gattc_handle_range_t * p_range = (ble_gattc_handle_range_t *) p_void_struct; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(4, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &(p_range->start_handle)); + uint16_dec(p_buf, buf_len, p_index, &(p_range->end_handle)); + + return err_code; +} + + +uint32_t ble_gattc_service_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t error_code = NRF_SUCCESS; + ble_gattc_service_t * p_service = (ble_gattc_service_t *) p_void_struct; + + error_code = ble_uuid_t_enc(&(p_service->uuid), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_gattc_handle_range_t_enc(&(p_service->handle_range), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + return error_code; +} + +uint32_t ble_gattc_service_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + uint32_t error_code = NRF_SUCCESS; + ble_gattc_service_t * p_service = (ble_gattc_service_t *) p_void_struct; + + error_code = ble_uuid_t_dec(p_buf, buf_len, p_index, &(p_service->uuid)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_gattc_handle_range_t_dec(p_buf, buf_len, p_index, &(p_service->handle_range)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + return error_code; +} + +uint32_t ble_gattc_include_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t error_code = NRF_SUCCESS; + ble_gattc_include_t * p_include = (ble_gattc_include_t *) p_void_struct; + + error_code = uint16_t_enc(&(p_include->handle), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_gattc_service_t_enc(&(p_include->included_srvc), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + return error_code; +} + +uint32_t ble_gattc_include_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + uint32_t error_code = NRF_SUCCESS; + ble_gattc_include_t * p_include = (ble_gattc_include_t *) p_void_struct; + + error_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_include->handle)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_gattc_service_t_dec(p_buf, buf_len, p_index, &(p_include->included_srvc)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + return error_code; +} + +uint32_t ble_gattc_evt_rel_disc_rsp_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t error_code = NRF_SUCCESS; + uint32_t i; + ble_gattc_evt_rel_disc_rsp_t * p_rsp = (ble_gattc_evt_rel_disc_rsp_t *) p_void_struct; + + error_code = uint16_t_enc(&(p_rsp->count), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + ble_gattc_include_t * p_include = (ble_gattc_include_t *) p_rsp->includes; + + for (i = 0; i < p_rsp->count; i++) + { + error_code = ble_gattc_include_t_enc(p_include, p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + p_include++; + } + + return error_code; +} + +uint32_t ble_gattc_evt_rel_disc_rsp_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + uint32_t error_code = NRF_SUCCESS; + ble_gattc_evt_rel_disc_rsp_t * p_rsp = (ble_gattc_evt_rel_disc_rsp_t *) p_void_struct; + uint16_t include_count; + uint32_t i; + + error_code = uint16_t_dec(p_buf, buf_len, p_index, &include_count); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + p_rsp->count = include_count; + + ble_gattc_include_t * p_include = (ble_gattc_include_t *) p_rsp->includes; + + for (i = 0; i < include_count; i++) + { + error_code = ble_gattc_include_t_dec(p_buf, buf_len, p_index, p_include); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + p_include++; + } + + return error_code; +} + +uint32_t ble_gattc_write_params_t_enc(void const * const p_void_write, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_void_write); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + uint32_t err_code = NRF_SUCCESS; + + ble_gattc_write_params_t * p_write = (ble_gattc_write_params_t *)p_void_write; + + err_code = uint8_t_enc(&(p_write->write_op), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&(p_write->flags), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_write->handle), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_write->offset), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = len16data_enc(p_write->p_value, p_write->len, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gattc_write_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_write) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_write); + + uint32_t err_code = NRF_SUCCESS; + + ble_gattc_write_params_t * p_write = (ble_gattc_write_params_t *)p_void_write; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &(p_write->write_op)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &(p_write->flags)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_write->handle)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_write->offset)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = len16data_dec(p_buf, buf_len, p_index, &(p_write->p_value), &(p_write->len)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} diff --git a/components/serialization/common/struct_ser/s110/ble_gattc_struct_serialization.h b/components/serialization/common/struct_ser/s110/ble_gattc_struct_serialization.h new file mode 100644 index 0000000..cbfae81 --- /dev/null +++ b/components/serialization/common/struct_ser/s110/ble_gattc_struct_serialization.h @@ -0,0 +1,88 @@ +/* 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 BLE_GATTC_STRUCT_SERIALIZATION_H +#define BLE_GATTC_STRUCT_SERIALIZATION_H + +#include "ble_gattc.h" + +uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_struct_size, + void * const p_void_struct); + +uint32_t ble_gattc_evt_char_vals_read_rsp_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gattc_evt_char_vals_read_rsp_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gattc_handle_range_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gattc_handle_range_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gattc_service_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gattc_service_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gattc_include_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gattc_include_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gattc_evt_rel_disc_rsp_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gattc_evt_rel_disc_rsp_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gattc_write_params_t_enc(void const * const p_void_write, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gattc_write_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_write); + +#endif /*BLE_GATTC_STRUCT_SERIALIZATION_H*/ diff --git a/components/serialization/common/struct_ser/s110/ble_gatts_struct_serialization.c b/components/serialization/common/struct_ser/s110/ble_gatts_struct_serialization.c new file mode 100644 index 0000000..cec4062 --- /dev/null +++ b/components/serialization/common/struct_ser/s110/ble_gatts_struct_serialization.c @@ -0,0 +1,926 @@ +/* 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 "ble_gatts_struct_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "ble_struct_serialization.h" +#include "ble_serialization.h" +#include "app_util.h" +#include "ble_gatts.h" +#include "cond_field_serialization.h" +#include + +uint32_t ser_ble_gatts_char_pf_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_char_pf) +{ + ble_gatts_char_pf_t * p_char_pf = (ble_gatts_char_pf_t *)p_void_char_pf; + + SER_ASSERT_LENGTH_LEQ(7, buf_len - *p_index); + + uint8_dec(p_buf, buf_len, p_index, &p_char_pf->format); + uint8_dec(p_buf, buf_len, p_index, (uint8_t *)&p_char_pf->exponent); + uint16_dec(p_buf, buf_len, p_index, &p_char_pf->unit); + uint8_dec(p_buf, buf_len, p_index, &p_char_pf->name_space); + uint16_dec(p_buf, buf_len, p_index, &p_char_pf->desc); + + return NRF_SUCCESS; +} + +uint32_t ser_ble_gatts_char_pf_enc(void const * const p_void_char_pf, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_char_pf_t * p_char_pf = (ble_gatts_char_pf_t *)p_void_char_pf; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint8_t_enc(&p_char_pf->format, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&p_char_pf->exponent, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_char_pf->unit, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&p_char_pf->name_space, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_char_pf->desc, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gatts_attr_md_enc(void const * const p_void_attr_md, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_attr_md_t * p_attr_md = (ble_gatts_attr_md_t *)p_void_attr_md; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_conn_sec_mode_enc(&p_attr_md->read_perm, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_conn_sec_mode_enc(&p_attr_md->write_perm, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + /* serializer does not support attributes on stack */ + if (p_attr_md->vloc != BLE_GATTS_VLOC_STACK) + { + err_code = NRF_ERROR_INVALID_PARAM; + } + + uint8_t temp8; + temp8 = p_attr_md->vlen | + (p_attr_md->vloc << 1) | + (p_attr_md->rd_auth << 3) | + (p_attr_md->wr_auth << 4); + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + p_buf[*p_index] = temp8; + *p_index += 1; + + return err_code; +} + +uint32_t ble_gatts_attr_md_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_attr_md) +{ + ble_gatts_attr_md_t * p_attr_md = (ble_gatts_attr_md_t *)p_void_attr_md; + uint32_t err_code = NRF_SUCCESS; + uint8_t temp8; + + err_code = ble_gap_conn_sec_mode_dec(p_buf, buf_len, p_index, &p_attr_md->read_perm); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_conn_sec_mode_dec(p_buf, buf_len, p_index, &p_attr_md->write_perm); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + uint8_dec(p_buf, buf_len, p_index, &temp8); + + p_attr_md->vlen = temp8; + p_attr_md->vloc = temp8 >> 1; + p_attr_md->rd_auth = temp8 >> 3; + p_attr_md->wr_auth = temp8 >> 4; + + return err_code; +} + +uint32_t ble_gatts_char_md_enc(void const * const p_void_char_md, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t err_code = NRF_SUCCESS; + + ble_gatts_char_md_t * p_char_md = (ble_gatts_char_md_t *)p_void_char_md; + uint8_t temp8; + + temp8 = p_char_md->char_props.broadcast | + (p_char_md->char_props.read << 1) | + (p_char_md->char_props.write_wo_resp << 2) | + (p_char_md->char_props.write << 3) | + (p_char_md->char_props.notify << 4) | + (p_char_md->char_props.indicate << 5) | + (p_char_md->char_props.auth_signed_wr << 6); + + err_code = uint8_t_enc(&temp8, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + temp8 = p_char_md->char_ext_props.reliable_wr | + (p_char_md->char_ext_props.wr_aux << 1); + + err_code = uint8_t_enc(&temp8, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_char_md->char_user_desc_max_size, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ERROR_CHECK(p_char_md->char_user_desc_size <= BLE_GATTS_VAR_ATTR_LEN_MAX, + NRF_ERROR_INVALID_PARAM); + err_code = len16data_enc(p_char_md->p_char_user_desc, p_char_md->char_user_desc_size, p_buf, + buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_char_md->p_char_pf, + p_buf, + buf_len, + p_index, + ser_ble_gatts_char_pf_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_char_md->p_user_desc_md, + p_buf, + buf_len, + p_index, + ble_gatts_attr_md_enc); + SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_char_md->p_cccd_md, p_buf, buf_len, p_index, ble_gatts_attr_md_enc); + SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_char_md->p_sccd_md, p_buf, buf_len, p_index, ble_gatts_attr_md_enc); + SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gatts_char_md_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_char_md) +{ + uint32_t err_code = NRF_SUCCESS; + + ble_gatts_char_md_t * p_char_md = (ble_gatts_char_md_t *)p_void_char_md; + + SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index); + uint8_t temp8 = p_buf[*p_index]; + + p_char_md->char_props.broadcast = temp8 >> 0; + p_char_md->char_props.read = temp8 >> 1; + p_char_md->char_props.write_wo_resp = temp8 >> 2; + p_char_md->char_props.write = temp8 >> 3; + p_char_md->char_props.notify = temp8 >> 4; + p_char_md->char_props.indicate = temp8 >> 5; + p_char_md->char_props.auth_signed_wr = temp8 >> 6; + + temp8 = p_buf[*p_index + 1]; + p_char_md->char_ext_props.reliable_wr = temp8 >> 0; + p_char_md->char_ext_props.wr_aux = temp8 >> 1; + + *p_index += 2; + + SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &p_char_md->char_user_desc_max_size); + + err_code = len16data_dec(p_buf, + buf_len, + p_index, + &p_char_md->p_char_user_desc, + &p_char_md->char_user_desc_size); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + buf_len, + p_index, + (void * *)&p_char_md->p_char_pf, + ser_ble_gatts_char_pf_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + buf_len, + p_index, + (void * *)&p_char_md->p_user_desc_md, + ble_gatts_attr_md_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + buf_len, + p_index, + (void * *)&p_char_md->p_cccd_md, + ble_gatts_attr_md_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + buf_len, + p_index, + (void * *)&p_char_md->p_sccd_md, + ble_gatts_attr_md_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; + +} + +uint32_t ble_gatts_attr_enc(void const * const p_void_gatts_attr, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t err_code = NRF_SUCCESS; + ble_gatts_attr_t * p_gatts_attr = (ble_gatts_attr_t *)p_void_gatts_attr; + + err_code = cond_field_enc((void *)p_gatts_attr->p_uuid, p_buf, buf_len, p_index, ble_uuid_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc((void *)p_gatts_attr->p_attr_md, + p_buf, + buf_len, + p_index, + ble_gatts_attr_md_enc); + SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_gatts_attr->init_offs, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_gatts_attr->max_len, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ERROR_CHECK(p_gatts_attr->init_len <= BLE_GATTS_VAR_ATTR_LEN_MAX, NRF_ERROR_INVALID_PARAM); + //init len move just before p_data to be able to use len16data decoder. + err_code = len16data_enc(p_gatts_attr->p_value, p_gatts_attr->init_len, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gatts_attr_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_gatts_attr) +{ + uint32_t err_code = NRF_SUCCESS; + ble_gatts_attr_t * p_gatts_attr = (ble_gatts_attr_t *)p_void_gatts_attr; + + err_code = cond_field_dec(p_buf, + buf_len, + p_index, + (void * *)&p_gatts_attr->p_uuid, + ble_uuid_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + buf_len, + p_index, + (void * *)&p_gatts_attr->p_attr_md, + ble_gatts_attr_md_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(4, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &p_gatts_attr->init_offs); + uint16_dec(p_buf, buf_len, p_index, &p_gatts_attr->max_len); + + //init len move just before p_data to be able to use len16data decoder. + err_code = len16data_dec(p_buf, + buf_len, + p_index, + &p_gatts_attr->p_value, + &p_gatts_attr->init_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gatts_char_handles_enc(void const * const p_void_char_handles, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_char_handles_t * p_char_handles = (ble_gatts_char_handles_t *)p_void_char_handles; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&p_char_handles->value_handle, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_char_handles->user_desc_handle, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_char_handles->cccd_handle, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_char_handles->sccd_handle, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gatts_char_handles_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_char_handles) +{ + ble_gatts_char_handles_t * p_char_handles = (ble_gatts_char_handles_t *)p_void_char_handles; + + SER_ASSERT_LENGTH_LEQ(8, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &(p_char_handles->value_handle)); + uint16_dec(p_buf, buf_len, p_index, &p_char_handles->user_desc_handle); + uint16_dec(p_buf, buf_len, p_index, &p_char_handles->cccd_handle); + uint16_dec(p_buf, buf_len, p_index, &p_char_handles->sccd_handle); + + return NRF_SUCCESS; +} + +uint32_t ble_gatts_hvx_params_t_enc(void const * const p_void_hvx_params, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_hvx_params_t * p_hvx_params = (ble_gatts_hvx_params_t *)p_void_hvx_params; + + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(2 + 1 + 2, buf_len - *p_index); + + err_code = uint16_t_enc(&p_hvx_params->handle, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&p_hvx_params->type, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_hvx_params->offset, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (p_hvx_params->p_len != NULL) + { + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + p_buf[(*p_index)++] = SER_FIELD_PRESENT; + + err_code = uint16_t_enc(p_hvx_params->p_len, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + + if (p_hvx_params->p_data != NULL) + { + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + p_buf[(*p_index)++] = SER_FIELD_PRESENT; + + SER_ASSERT_LENGTH_LEQ(*p_hvx_params->p_len, buf_len - *p_index); + memcpy(&p_buf[*p_index], p_hvx_params->p_data, *p_hvx_params->p_len); + *p_index += *p_hvx_params->p_len; + } + + return err_code; +} + +uint32_t ble_gatts_hvx_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_hvx_params) +{ + ble_gatts_hvx_params_t * p_hvx_params = (ble_gatts_hvx_params_t *)p_void_hvx_params; + + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(2 + 1 + 2, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &p_hvx_params->handle); + uint8_dec(p_buf, buf_len, p_index, &p_hvx_params->type); + uint16_dec(p_buf, buf_len, p_index, &p_hvx_params->offset); + + SER_ASSERT_NOT_NULL(&p_hvx_params->p_len); + err_code = cond_len16_cond_data_dec(p_buf, + buf_len, + p_index, + &p_hvx_params->p_data, + &p_hvx_params->p_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gatts_attr_context_t_enc(void const * const p_void_attr_context, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t error_code = NRF_SUCCESS; + ble_gatts_attr_context_t * p_context = (ble_gatts_attr_context_t *) p_void_attr_context; + + error_code = ble_uuid_t_enc(&(p_context->srvc_uuid), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_uuid_t_enc(&(p_context->char_uuid), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_uuid_t_enc(&(p_context->desc_uuid), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint16_t_enc(&(p_context->srvc_handle), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint16_t_enc(&(p_context->value_handle), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint8_t_enc(&(p_context->type), p_buf, buf_len, p_index); + + return error_code; +} + +uint32_t ble_gatts_attr_context_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_attr_context) +{ + uint32_t error_code = NRF_SUCCESS; + ble_gatts_attr_context_t * p_context = (ble_gatts_attr_context_t *) p_void_attr_context; + + error_code = ble_uuid_t_dec(p_buf, buf_len, p_index, &(p_context->srvc_uuid)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_uuid_t_dec(p_buf, buf_len, p_index, &(p_context->char_uuid)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_uuid_t_dec(p_buf, buf_len, p_index, &(p_context->desc_uuid)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + SER_ASSERT_LENGTH_LEQ(5, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &(p_context->srvc_handle)); + uint16_dec(p_buf, buf_len, p_index, &(p_context->value_handle)); + uint8_dec(p_buf, buf_len, p_index, &(p_context->type)); + return error_code; +} + +uint32_t ble_gatts_evt_write_t_enc(void const * const p_void_write, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_evt_write_t * p_write = (ble_gatts_evt_write_t *) p_void_write; + uint32_t error_code = NRF_SUCCESS; + + error_code = uint16_t_enc(&(p_write->handle), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint8_t_enc(&(p_write->op), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_gatts_attr_context_t_enc(&(p_write->context), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint16_t_enc(&(p_write->offset), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + uint16_t data_len = p_write->len; + error_code = uint16_t_enc(&data_len, p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + SER_ASSERT_LENGTH_LEQ(data_len, buf_len - *p_index); + memcpy(&p_buf[*p_index], p_write->data, data_len); + *p_index += data_len; + + return error_code; +} + +uint32_t ble_gatts_evt_write_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_struct_len, + void * const p_void_write) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_struct_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t in_struct_len = *p_struct_len; + + *p_struct_len = offsetof(ble_gatts_evt_write_t, data); + + uint16_t handle; + err_code = uint16_t_dec(p_buf, buf_len, p_index, &handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + uint8_t op; + err_code = uint8_t_dec(p_buf, buf_len, p_index, &op); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + ble_gatts_attr_context_t context; + err_code = ble_gatts_attr_context_t_dec(p_buf, buf_len, p_index, &context); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + uint16_t offset; + err_code = uint16_t_dec(p_buf, buf_len, p_index, &offset); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + uint16_t len; + err_code = uint16_t_dec(p_buf, buf_len, p_index, &len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_struct_len += len; + + if (p_void_write != NULL) + { + ble_gatts_evt_write_t * p_write = (ble_gatts_evt_write_t *)p_void_write; + + SER_ASSERT_LENGTH_LEQ(*p_struct_len, in_struct_len); + + p_write->handle = handle; + p_write->op = op; + + memcpy(&(p_write->context), &context, sizeof (ble_gatts_attr_context_t)); + + p_write->offset = offset; + p_write->len = len; + + SER_ASSERT_LENGTH_LEQ(p_write->len, buf_len - *p_index); + memcpy(p_write->data, &p_buf[*p_index], p_write->len); + } + + *p_index += len; + + return err_code; +} + +uint32_t ble_gatts_evt_read_t_enc(void const * const p_void_read, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_read); + + ble_gatts_evt_read_t * p_read = (ble_gatts_evt_read_t *)p_void_read; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&(p_read->handle), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gatts_attr_context_t_enc(&(p_read->context), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_read->offset), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gatts_evt_read_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_struct_len, + void * const p_void_read) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + uint32_t err_code = NRF_SUCCESS; + uint32_t in_struct_len = *p_struct_len; + + *p_struct_len = sizeof (ble_gatts_evt_read_t); + + uint16_t handle; + err_code = uint16_t_dec(p_buf, buf_len, p_index, &handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + ble_gatts_attr_context_t context; + err_code = ble_gatts_attr_context_t_dec(p_buf, buf_len, p_index, &context); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + uint16_t offset; + err_code = uint16_t_dec(p_buf, buf_len, p_index, &offset); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (p_void_read != NULL) + { + ble_gatts_evt_read_t * p_read = (ble_gatts_evt_read_t *)p_void_read; + + SER_ASSERT_LENGTH_LEQ(*p_struct_len, in_struct_len); + + p_read->handle = handle; + memcpy(&(p_read->context), &context, sizeof (context)); + p_read->offset = offset; + } + + return err_code; +} + +uint32_t ble_gatts_evt_rw_authorize_request_t_enc(void const * const p_void_authorize_request, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_authorize_request); + + ble_gatts_evt_rw_authorize_request_t * p_authorize_request = + (ble_gatts_evt_rw_authorize_request_t *)p_void_authorize_request; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint8_t_enc(&(p_authorize_request->type), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + switch (p_authorize_request->type) + { + case BLE_GATTS_AUTHORIZE_TYPE_READ: + err_code = ble_gatts_evt_read_t_enc(&(p_authorize_request->request.read), + p_buf, + buf_len, + p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + + case BLE_GATTS_AUTHORIZE_TYPE_WRITE: + err_code = ble_gatts_evt_write_t_enc(&(p_authorize_request->request.write), + p_buf, + buf_len, + p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + + default: + case BLE_GATTS_AUTHORIZE_TYPE_INVALID: + err_code = NRF_ERROR_INVALID_PARAM; + break; + } + + return err_code; +} + +uint32_t ble_gatts_evt_rw_authorize_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_struct_len, + void * const p_void_authorize_request) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_struct_len); + SER_ASSERT_NOT_NULL(p_index); + + uint32_t err_code = NRF_SUCCESS; + + uint8_t type; + err_code = uint8_t_dec(p_buf, buf_len, p_index, &type); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + uint32_t in_struct_len = *p_struct_len; + + *p_struct_len = offsetof(ble_gatts_evt_rw_authorize_request_t, request); + + ble_gatts_evt_rw_authorize_request_t * p_authorize_request = + (ble_gatts_evt_rw_authorize_request_t *)p_void_authorize_request; + + void * p_void_request = NULL; + + if (p_void_authorize_request != NULL) + { + p_authorize_request->type = type; + + SER_ASSERT_LENGTH_LEQ(*p_struct_len, in_struct_len); + + switch (type) + { + case BLE_GATTS_AUTHORIZE_TYPE_READ: + p_void_request = &(p_authorize_request->request.read); + break; + + case BLE_GATTS_AUTHORIZE_TYPE_WRITE: + p_void_request = &(p_authorize_request->request.write); + break; + + default: + case BLE_GATTS_AUTHORIZE_TYPE_INVALID: + return NRF_ERROR_INVALID_DATA; + } + } + + switch (type) + { + case BLE_GATTS_AUTHORIZE_TYPE_READ: + err_code = ble_gatts_evt_read_t_dec(p_buf, + buf_len, + p_index, + &in_struct_len, + p_void_request); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + + case BLE_GATTS_AUTHORIZE_TYPE_WRITE: + err_code = ble_gatts_evt_write_t_dec(p_buf, + buf_len, + p_index, + &in_struct_len, + p_void_request); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + + default: + case BLE_GATTS_AUTHORIZE_TYPE_INVALID: + return NRF_ERROR_INVALID_DATA; + } + *p_struct_len += in_struct_len; + + return err_code; +} + +uint32_t ble_gatts_read_authorize_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_read_authorize_params_t * p_params = + (ble_gatts_read_authorize_params_t *) p_void_struct; + uint32_t error_code = NRF_SUCCESS; + + error_code = uint16_t_enc(&(p_params->gatt_status), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + uint8_t temp_val = p_params->update; + error_code = uint8_t_enc(&temp_val, p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + error_code = uint16_t_enc(&(p_params->offset), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + error_code = len16data_enc(p_params->p_data, p_params->len, p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + return error_code; +} + +uint32_t ble_gatts_read_authorize_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + ble_gatts_read_authorize_params_t * p_params = + (ble_gatts_read_authorize_params_t *) p_void_struct; + uint32_t error_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &p_params->gatt_status); + + uint8_t temp_val; + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + uint8_dec(p_buf, buf_len, p_index, &temp_val); + p_params->update = temp_val; + + SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &p_params->offset); + + error_code = len16data_dec(p_buf, buf_len, p_index, &p_params->p_data, &p_params->len); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + return error_code; +} + +uint32_t ble_gatts_write_authorize_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_write_authorize_params_t * p_params = + (ble_gatts_write_authorize_params_t *) p_void_struct; + uint32_t error_code = NRF_SUCCESS; + + error_code = uint16_t_enc(&(p_params->gatt_status), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + return error_code; +} + +uint32_t ble_gatts_write_authorize_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + ble_gatts_write_authorize_params_t * p_params = + (ble_gatts_write_authorize_params_t *) p_void_struct; + uint32_t error_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &p_params->gatt_status); + + return error_code; +} + +uint32_t ble_gatts_rw_authorize_reply_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_rw_authorize_reply_params_t const * const p_params = + (ble_gatts_rw_authorize_reply_params_t * ) p_void_struct; + uint32_t error_code = NRF_SUCCESS; + + error_code = uint8_t_enc(&(p_params->type), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + if (p_params->type == BLE_GATTS_AUTHORIZE_TYPE_READ) + { + error_code = ble_gatts_read_authorize_params_t_enc(&p_params->params.read, + p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + } + else if (p_params->type == BLE_GATTS_AUTHORIZE_TYPE_WRITE) + { + error_code = ble_gatts_write_authorize_params_t_enc(&p_params->params.write, + p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + } + else + { + return NRF_ERROR_INVALID_PARAM; + } + + return error_code; +} + +uint32_t ble_gatts_rw_authorize_reply_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + ble_gatts_rw_authorize_reply_params_t * p_params = + (ble_gatts_rw_authorize_reply_params_t *) p_void_struct; + uint32_t error_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + uint8_dec(p_buf, buf_len, p_index, &(p_params->type)); + + if (p_params->type == BLE_GATTS_AUTHORIZE_TYPE_READ) + { + error_code = ble_gatts_read_authorize_params_t_dec(p_buf, buf_len, p_index, + &p_params->params.read); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + } + else if (p_params->type == BLE_GATTS_AUTHORIZE_TYPE_WRITE) + { + error_code = ble_gatts_write_authorize_params_t_dec(p_buf, buf_len, p_index, + &p_params->params.write); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + } + else + { + return NRF_ERROR_INVALID_PARAM; + } + + return error_code; +} + +uint32_t ble_gatts_value_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_value_t * p_value = (ble_gatts_value_t *)p_void_struct; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc((void *) &(p_value->len), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *) &(p_value->offset), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = buf_enc(p_value->p_value, p_value->len, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gatts_value_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + ble_gatts_value_t * p_value = (ble_gatts_value_t *)p_void_struct; + uint32_t err_code = NRF_SUCCESS; + uint16_t total_len = p_value->len; + + err_code = uint16_t_dec(p_buf, buf_len, p_index, (void *) &(p_value->len)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, buf_len, p_index, (void *) &(p_value->offset)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = buf_dec(p_buf, buf_len, p_index, &(p_value->p_value), total_len, p_value->len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} diff --git a/components/serialization/common/struct_ser/s110/ble_gatts_struct_serialization.h b/components/serialization/common/struct_ser/s110/ble_gatts_struct_serialization.h new file mode 100644 index 0000000..f584a96 --- /dev/null +++ b/components/serialization/common/struct_ser/s110/ble_gatts_struct_serialization.h @@ -0,0 +1,160 @@ +/* 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 BLE_GATTS_STRUCT_SERIALIZATION_H +#define BLE_GATTS_STRUCT_SERIALIZATION_H + +#include "ble_gatts.h" + +uint32_t ser_ble_gatts_char_pf_enc(void const * const p_void_char_pf, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ser_ble_gatts_char_pf_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_char_pf); + +uint32_t ble_gatts_attr_md_enc(void const * const p_void_attr_md, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_attr_md_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_attr_md); + +uint32_t ble_gatts_char_md_enc(void const * const p_void_char_md, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_char_md_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_char_md); + +uint32_t ble_gatts_attr_enc(void const * const p_void_gatts_attr, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_attr_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_gatts_attr); + +uint32_t ble_gatts_char_handles_enc(void const * const p_void_char_handles, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_char_handles_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_char_handles); + +uint32_t ble_gatts_attr_context_t_enc(void const * const p_void_attr_context, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_attr_context_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_attr_context); + +uint32_t ble_gatts_evt_write_t_enc(void const * const p_void_write, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_evt_write_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_struct_len, + void * const p_void_write); + +uint32_t ble_gatts_hvx_params_t_enc(void const * const p_void_hvx_params, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_hvx_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_hvx_params); + +uint32_t ble_gatts_evt_read_t_enc(void const * const p_void_read, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_evt_read_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_struct_len, + void * const p_void_read); + +uint32_t ble_gatts_evt_rw_authorize_request_t_enc(void const * const p_void_authorize_request, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_evt_rw_authorize_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_struct_size, + void * const p_void_authorize_request); + +uint32_t ble_gatts_read_authorize_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_read_authorize_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gatts_write_authorize_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_write_authorize_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gatts_rw_authorize_reply_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_rw_authorize_reply_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gatts_value_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_value_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +#endif /* BLE_GATTS_STRUCT_SERIALIZATION_H */ diff --git a/components/serialization/common/struct_ser/s110/ble_struct_serialization.c b/components/serialization/common/struct_ser/s110/ble_struct_serialization.c new file mode 100644 index 0000000..bb019d9 --- /dev/null +++ b/components/serialization/common/struct_ser/s110/ble_struct_serialization.c @@ -0,0 +1,271 @@ +/* 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 "ble_struct_serialization.h" +#include "ble_serialization.h" +#include "app_util.h" +#include "ble_types.h" +#include "ble_l2cap.h" +#include "ble.h" +#include "cond_field_serialization.h" +#include + + +uint32_t ble_uuid_t_enc(void const * const p_void_uuid, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_uuid_t * p_uuid = (ble_uuid_t *)p_void_uuid; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&p_uuid->uuid, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&p_uuid->type, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_uuid_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_uuid) +{ + ble_uuid_t * p_uuid = (ble_uuid_t *)p_void_uuid; + + SER_ASSERT_LENGTH_LEQ(3, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &p_uuid->uuid); + uint8_dec(p_buf, buf_len, p_index, &p_uuid->type); + + return NRF_SUCCESS; +} + +uint32_t ble_uuid128_t_enc(void const * const p_void_uuid, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_uuid128_t * p_uuid = (ble_uuid128_t *)p_void_uuid; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(16, buf_len - *p_index); + + memcpy(&p_buf[*p_index], p_uuid->uuid128, sizeof (p_uuid->uuid128)); + + *p_index += sizeof (p_uuid->uuid128); + + return err_code; +} + +uint32_t ble_uuid128_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_uuid) +{ + ble_uuid128_t * p_uuid = (ble_uuid128_t *)p_void_uuid; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(16, buf_len - *p_index); + + memcpy(p_uuid->uuid128, &p_buf[*p_index], sizeof (p_uuid->uuid128)); + + *p_index += sizeof (p_uuid->uuid128); + + return err_code; +} + +uint32_t ble_l2cap_header_t_enc(void const * const p_void_header, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_header); + + ble_l2cap_header_t * p_header = (ble_l2cap_header_t *)p_void_header; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&(p_header->len), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_header->cid), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_l2cap_header_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_header) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_header); + + ble_l2cap_header_t * p_header = (ble_l2cap_header_t *)p_void_header; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_header->len)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_header->cid)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_l2cap_evt_rx_t_enc(void const * const p_void_evt_rx, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_evt_rx); + + ble_l2cap_evt_rx_t * p_evt_rx = (ble_l2cap_evt_rx_t *)p_void_evt_rx; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_l2cap_header_t_enc(&(p_evt_rx->header), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(p_evt_rx->header.len, buf_len - *p_index); + memcpy(&p_buf[*p_index], p_evt_rx->data, p_evt_rx->header.len); + *p_index += p_evt_rx->header.len; + + return err_code; +} + +uint32_t ble_l2cap_evt_rx_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_struct_len, + void * const p_void_evt_rx) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_struct_len); + + ble_l2cap_evt_rx_t * p_evt_rx = (ble_l2cap_evt_rx_t *)p_void_evt_rx; + uint32_t err_code = NRF_SUCCESS; + + uint32_t total_struct_len = *p_struct_len; + + /* Get data length */ + uint32_t tmp_index = *p_index; + uint16_t len = 0; + + err_code = uint16_t_dec(p_buf, buf_len, &tmp_index, &len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + /* Update struct length */ + *p_struct_len = offsetof(ble_l2cap_evt_rx_t, data[0]); + *p_struct_len += (uint8_t*)&(p_evt_rx->data[len]) - (uint8_t*)&(p_evt_rx->data[0]); + + + /* Decode header and copy data */ + if (p_void_evt_rx != NULL) + { + SER_ASSERT_LENGTH_LEQ(*p_struct_len, total_struct_len); + + err_code = ble_l2cap_header_t_dec(p_buf, buf_len, p_index, &(p_evt_rx->header)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(p_evt_rx->header.len, buf_len - *p_index); + memcpy(p_evt_rx->data, &p_buf[*p_index], p_evt_rx->header.len); + *p_index += p_evt_rx->header.len; + } + + return err_code; +} + +uint32_t ble_enable_params_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t err_code = NRF_SUCCESS; + + ble_enable_params_t * p_enable_params = (ble_enable_params_t *)p_data; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + + p_buf[*p_index] = p_enable_params->gatts_enable_params.service_changed; + (*p_index)++; + err_code = uint32_t_enc(&(p_enable_params->gatts_enable_params.attr_tab_size), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_enable_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + uint32_t err_code = NRF_SUCCESS; + + ble_enable_params_t * p_enable_params = (ble_enable_params_t *) p_data; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + p_enable_params->gatts_enable_params.service_changed = p_buf[(*p_index)++]; + + err_code = uint32_t_dec(p_buf, buf_len, p_index, &(p_enable_params->gatts_enable_params.attr_tab_size)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return NRF_SUCCESS; +} + +uint32_t ble_common_opt_radio_cpu_mutex_t_enc(void const * const p_void_opt_mutex, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_opt_mutex); + + ble_common_opt_radio_cpu_mutex_t * p_radio_cpu_mutex = (ble_common_opt_radio_cpu_mutex_t *)p_void_opt_mutex; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + byte = p_radio_cpu_mutex->enable; + err_code = uint8_t_enc(&byte, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_common_opt_radio_cpu_mutex_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_opt_mutex) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_opt_mutex); + + ble_common_opt_radio_cpu_mutex_t * p_radio_cpu_mutex = (ble_common_opt_radio_cpu_mutex_t *)p_void_opt_mutex; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &byte); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_radio_cpu_mutex->enable = byte & 0x01; + + return err_code; +} + diff --git a/components/serialization/common/struct_ser/s110/ble_struct_serialization.h b/components/serialization/common/struct_ser/s110/ble_struct_serialization.h new file mode 100644 index 0000000..e587300 --- /dev/null +++ b/components/serialization/common/struct_ser/s110/ble_struct_serialization.h @@ -0,0 +1,75 @@ +/* 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 "ble_types.h" + + +uint32_t ble_uuid_t_enc(void const * const p_void_uuid, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_uuid_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_uuid); + +uint32_t ble_uuid128_t_enc(const void * const p_void_uuid, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_uuid128_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_uuid); + +uint32_t ble_l2cap_header_t_enc(void const * const p_void_header, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_l2cap_header_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_header); + +uint32_t ble_l2cap_evt_rx_t_enc(void const * const p_void_evt_rx, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_l2cap_evt_rx_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_event_len, + void * const p_void_evt_rx); + +uint32_t ble_enable_params_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_enable_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_common_opt_radio_cpu_mutex_t_enc(void const * const p_void_opt_mutex, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_common_opt_radio_cpu_mutex_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_opt_mutex); diff --git a/components/serialization/common/struct_ser/s120/ble_gap_struct_serialization.c b/components/serialization/common/struct_ser/s120/ble_gap_struct_serialization.c new file mode 100644 index 0000000..7cad228 --- /dev/null +++ b/components/serialization/common/struct_ser/s120/ble_gap_struct_serialization.c @@ -0,0 +1,1354 @@ +/* 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 "ble_gap_struct_serialization.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" +#include "string.h" + +uint32_t ble_gap_irk_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_irk_t * p_gap_irk = (ble_gap_irk_t *)p_data; + + SER_ASSERT_LENGTH_LEQ(BLE_GAP_SEC_KEY_LEN, buf_len - *p_index); + + memcpy(&p_buf[*p_index], p_gap_irk->irk, BLE_GAP_SEC_KEY_LEN); + + *p_index += BLE_GAP_SEC_KEY_LEN; + + return NRF_SUCCESS; +} + +uint32_t ble_gap_irk_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + ble_gap_irk_t * p_gap_irk = (ble_gap_irk_t *)p_data; + + SER_ASSERT_LENGTH_LEQ(BLE_GAP_SEC_KEY_LEN, buf_len - *p_index); + + memcpy(p_gap_irk->irk, &p_buf[*p_index], BLE_GAP_SEC_KEY_LEN); + + *p_index += BLE_GAP_SEC_KEY_LEN; + + return NRF_SUCCESS; +} + +uint32_t ble_gap_addr_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_addr_t * p_addr = (ble_gap_addr_t *)p_data; + + SER_ASSERT_LENGTH_LEQ(1 + BLE_GAP_ADDR_LEN, buf_len - *p_index); + + p_buf[*p_index] = p_addr->addr_type; + (*p_index)++; + memcpy(&p_buf[*p_index], p_addr->addr, BLE_GAP_ADDR_LEN); + *p_index += BLE_GAP_ADDR_LEN; + + return NRF_SUCCESS; +} + +uint32_t ble_gap_addr_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_addr) +{ + ble_gap_addr_t * p_address = (ble_gap_addr_t *) p_addr; + + SER_ASSERT_LENGTH_LEQ(sizeof (ble_gap_addr_t), buf_len - *p_index); + memcpy(p_address, &p_buf[*p_index], sizeof (ble_gap_addr_t)); + *p_index += sizeof (ble_gap_addr_t); + + return NRF_SUCCESS; +} + +uint32_t ble_gap_sec_levels_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_sec_levels_t * p_sec_levels = (ble_gap_sec_levels_t *)p_data; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + + p_buf[*p_index] = (p_sec_levels->lv1 << 0) | (p_sec_levels->lv2 << 1) | (p_sec_levels->lv3 << 2); + (*p_index)++; + + return NRF_SUCCESS; +} + +uint32_t ble_gap_sec_levels_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + ble_gap_sec_levels_t * p_sec_levels = (ble_gap_sec_levels_t *)p_data; + uint32_t err_code; + uint32_t uint8_temp; + + SER_ASSERT_LENGTH_LEQ(sizeof (ble_gap_sec_levels_t), buf_len - *p_index); + + err_code = uint8_t_dec(p_buf, buf_len, p_index, (void *) &(uint8_temp)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + p_sec_levels->lv1 = uint8_temp & 0x01; + p_sec_levels->lv2 = (uint8_temp >> 1) & 0x01; + p_sec_levels->lv3 = (uint8_temp >> 2) & 0x01; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_sec_keys_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_sec_keys_t * p_sec_keys = (ble_gap_sec_keys_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = cond_field_enc(p_sec_keys->p_enc_key, p_buf, buf_len, p_index, ble_gap_enc_key_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_sec_keys->p_id_key, p_buf, buf_len, p_index, ble_gap_id_key_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_sec_keys->p_sign_key, p_buf, buf_len, p_index, ble_gap_sign_info_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_sec_keys_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + ble_gap_sec_keys_t * p_sec_keys = (ble_gap_sec_keys_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = cond_field_dec(p_buf, buf_len, p_index, (void * *)&(p_sec_keys->p_enc_key), ble_gap_enc_key_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, buf_len, p_index, (void * *)&(p_sec_keys->p_id_key), ble_gap_id_key_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, buf_len, p_index, (void * *)&(p_sec_keys->p_sign_key), ble_gap_sign_info_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_enc_info_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t err_code = NRF_SUCCESS; + ble_gap_enc_info_t * p_enc_info = (ble_gap_enc_info_t *)p_data; + + SER_ASSERT_LENGTH_LEQ(BLE_GAP_SEC_KEY_LEN + 1, buf_len - *p_index); + + memcpy(&p_buf[*p_index], p_enc_info->ltk, BLE_GAP_SEC_KEY_LEN); + *p_index += BLE_GAP_SEC_KEY_LEN; + + p_buf[*p_index] = p_enc_info->auth & 0x01; + p_buf[*p_index] |= (p_enc_info->ltk_len & 0x7F) << 1; + (*p_index)++; + + return err_code; +} + +uint32_t ble_gap_enc_info_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_enc_infox) +{ + ble_gap_enc_info_t * p_enc_info = (ble_gap_enc_info_t *)p_enc_infox; + + SER_ASSERT_LENGTH_LEQ(BLE_GAP_SEC_KEY_LEN, buf_len - *p_index); + memcpy(p_enc_info->ltk, &p_buf[*p_index], BLE_GAP_SEC_KEY_LEN); + *p_index += BLE_GAP_SEC_KEY_LEN; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + p_enc_info->auth = p_buf[*p_index] & 0x01; + p_enc_info->ltk_len = (p_buf[*p_index] >> 1) & 0x7F; + *p_index += 1; + + return NRF_SUCCESS; +} + +uint32_t ble_gap_sign_info_enc(void const * const p_sign_info, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_LENGTH_LEQ(sizeof (ble_gap_sign_info_t), buf_len - *p_index); + memcpy(&p_buf[*p_index], p_sign_info, sizeof (ble_gap_sign_info_t)); + *p_index += sizeof (ble_gap_sign_info_t); + + return NRF_SUCCESS; +} + +uint32_t ble_gap_sign_info_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_sign_info) +{ + SER_ASSERT_LENGTH_LEQ(sizeof (ble_gap_sign_info_t), buf_len - *p_index); + memcpy(p_sign_info, &p_buf[*p_index], sizeof (ble_gap_sign_info_t)); + *p_index += sizeof (ble_gap_sign_info_t); + + return NRF_SUCCESS; +} + +uint32_t ble_gap_evt_auth_status_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + ble_gap_evt_auth_status_t * p_auth_status = (ble_gap_evt_auth_status_t *)p_data; + + SER_ASSERT_LENGTH_LEQ(6, buf_len - *p_index); + + err_code = uint8_t_enc(&(p_auth_status->auth_status), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + byte = (p_auth_status->error_src) | ((p_auth_status->bonded) << 2); + + err_code = uint8_t_enc(&byte, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_levels_enc(&(p_auth_status->sm1_levels), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_levels_enc(&(p_auth_status->sm2_levels), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_kdist_t_enc(&(p_auth_status->kdist_periph), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_kdist_t_enc(&(p_auth_status->kdist_central), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_evt_auth_status_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + + ble_gap_evt_auth_status_t * p_auth_status = (ble_gap_evt_auth_status_t *)p_data; + uint32_t err_code; + uint8_t byte; + + SER_ASSERT_LENGTH_LEQ(6, buf_len - *p_index); + SER_ASSERT_NOT_NULL(p_auth_status); + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &(p_auth_status->auth_status)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &byte); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_auth_status->error_src = byte & 0x03; + p_auth_status->bonded = (byte >> 2) & 0x01 ; + + err_code = ble_gap_sec_levels_dec(p_buf, buf_len, p_index, &(p_auth_status->sm1_levels)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_levels_dec(p_buf, buf_len, p_index, &(p_auth_status->sm2_levels)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_kdist_t_dec(p_buf, buf_len, p_index, &(p_auth_status->kdist_periph)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_kdist_t_dec(p_buf, buf_len, p_index, &(p_auth_status->kdist_central)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + + +uint32_t ble_gap_conn_sec_mode_enc(void const * const p_void_sec_mode, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_conn_sec_mode_t * p_sec_mode = (ble_gap_conn_sec_mode_t *)p_void_sec_mode; + uint32_t err_code = NRF_SUCCESS; + uint8_t temp8 = p_sec_mode->sm | (p_sec_mode->lv << 4); + + err_code = uint8_t_enc(&temp8, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_conn_sec_mode_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_sec_mode) +{ + ble_gap_conn_sec_mode_t * p_sec_mode = (ble_gap_conn_sec_mode_t *)p_void_sec_mode; + uint32_t err_code = NRF_SUCCESS; + uint8_t temp8; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + uint8_dec(p_buf, buf_len, p_index, &temp8); + + p_sec_mode->sm = temp8; + p_sec_mode->lv = temp8 >> 4; + + return err_code; +} + +uint32_t ble_gap_evt_conn_sec_update_t_enc(void const * const p_void_conn_sec_update, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + return ble_gap_conn_sec_t_enc(p_void_conn_sec_update, p_buf, buf_len, p_index); +} + +uint32_t ble_gap_evt_conn_sec_update_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_conn_sec_update) +{ + return ble_gap_conn_sec_t_dec(p_buf, buf_len, p_index, p_void_conn_sec_update); +} + +uint32_t ble_gap_conn_sec_t_enc(void const * const p_void_sec, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_conn_sec_t * p_conn_sec = (ble_gap_conn_sec_t *)p_void_sec; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_conn_sec_mode_enc(&p_conn_sec->sec_mode, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&p_conn_sec->encr_key_size, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_conn_sec_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_sec) +{ + ble_gap_conn_sec_t * p_conn_sec = (ble_gap_conn_sec_t *)p_void_sec; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_conn_sec_mode_dec(p_buf, buf_len, p_index, &p_conn_sec->sec_mode); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + uint8_dec(p_buf, buf_len, p_index, &p_conn_sec->encr_key_size); + + return err_code; +} + +uint32_t ble_gap_evt_sec_info_request_t_enc(void const * const p_void_sec_info_request, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_evt_sec_info_request_t * p_conn_sec = + (ble_gap_evt_sec_info_request_t *)p_void_sec_info_request; + + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_addr_enc(&p_conn_sec->peer_addr, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_master_id_t_enc(&p_conn_sec->master_id, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + uint8_t temp8 = p_conn_sec->enc_info | + (p_conn_sec->id_info << 1) | + (p_conn_sec->sign_info << 2); + + err_code = uint8_t_enc(&temp8, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_evt_sec_info_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_sec_info_request) +{ + ble_gap_evt_sec_info_request_t * p_conn_sec = (ble_gap_evt_sec_info_request_t *)p_void_sec_info_request; + uint32_t err_code = NRF_SUCCESS; + uint8_t temp8; + + err_code = ble_gap_addr_dec(p_buf, buf_len, p_index, &(p_conn_sec->peer_addr)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_master_id_t_dec(p_buf, buf_len, p_index, &(p_conn_sec->master_id)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, buf_len, p_index, (void *) &temp8); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + p_conn_sec->enc_info = temp8 & 0x01; + p_conn_sec->id_info = (temp8 >> 1) & 0x01; + p_conn_sec->sign_info = (temp8 >> 2) & 0x01; + + return err_code; +} + +uint32_t ble_gap_evt_connected_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_evt_connected_t * p_evt_conn = (ble_gap_evt_connected_t *)p_void_struct; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte = 0; + + err_code = ble_gap_addr_enc((void *)&p_evt_conn->peer_addr, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_addr_enc((void *)&p_evt_conn->own_addr, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + byte = p_evt_conn->irk_match | (p_evt_conn->irk_match_idx << 1); + err_code = uint8_t_enc(&byte, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_conn_params_t_enc((void *)&p_evt_conn->conn_params, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_evt_connected_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_connected) +{ + ble_gap_evt_connected_t * p_evt_conn = (ble_gap_evt_connected_t *)p_void_connected; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte = 0; + + err_code = ble_gap_addr_dec(p_buf, buf_len, p_index, &(p_evt_conn->peer_addr)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_addr_dec(p_buf, buf_len, p_index, &(p_evt_conn->own_addr)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &byte); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_evt_conn->irk_match = byte & 0x01; + p_evt_conn->irk_match_idx = (byte & 0xFE) >> 1; + + err_code = ble_gap_conn_params_t_dec(p_buf, buf_len, p_index, &(p_evt_conn->conn_params)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_sec_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_sec_params_t * p_sec_params = (ble_gap_sec_params_t *)p_void_struct; + uint32_t err_code = NRF_SUCCESS; + uint8_t temp8; + + temp8 = (p_sec_params->bond & 0x01) | + ((p_sec_params->mitm & 0x01) << 1) | + ((p_sec_params->io_caps & 0x07) << 2) | + ((p_sec_params->oob & 0x01) << 5); + + err_code = uint8_t_enc((void *) &temp8, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc((void *) &(p_sec_params->min_key_size), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc((void *) &(p_sec_params->max_key_size), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_kdist_t_enc((void *) &(p_sec_params->kdist_periph), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_kdist_t_enc((void *) &(p_sec_params->kdist_central), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_sec_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + ble_gap_sec_params_t * p_sec_params = (ble_gap_sec_params_t *)p_void_struct; + uint32_t err_code = NRF_SUCCESS; + uint8_t temp8; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, (void *) &temp8); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_sec_params->bond = temp8 & 0x01; + p_sec_params->mitm = (temp8 >> 1) & 0x01; + p_sec_params->io_caps = (temp8 >> 2) & 0x07; + p_sec_params->oob = (temp8 >> 5) & 0x01; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, (void *) &(p_sec_params->min_key_size)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, buf_len, p_index, (void *) &(p_sec_params->max_key_size)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_kdist_t_dec(p_buf, buf_len, p_index, (void *) &(p_sec_params->kdist_periph)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_kdist_t_dec(p_buf, buf_len, p_index, (void *) &(p_sec_params->kdist_central)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_enable_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_enable_params_t * p_enable_params = (ble_gap_enable_params_t *)p_void_struct; + uint32_t err_code = NRF_SUCCESS; + uint8_t temp8; + + temp8 = (p_enable_params->role & 0x03); + + err_code = uint8_t_enc((void *) &temp8, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_enable_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + ble_gap_enable_params_t * p_enable_params = (ble_gap_enable_params_t *)p_void_struct; + uint32_t err_code = NRF_SUCCESS; + uint8_t temp8; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, (void *) &temp8); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_enable_params->role = temp8 & 0x03; + + return err_code; +} + +uint32_t ble_gap_evt_sec_params_request_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + return ble_gap_sec_params_t_enc(p_void_struct, p_buf, buf_len, p_index); +} + + uint32_t ble_gap_evt_sec_params_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) + { + return ble_gap_sec_params_t_dec(p_buf, buf_len, p_index, p_void_struct); + } + +uint32_t ble_gap_evt_conn_param_update_t_enc(void const * const p_void_evt_conn_param_update, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + return ble_gap_conn_params_t_enc(p_void_evt_conn_param_update, p_buf, buf_len, p_index); +} + +uint32_t ble_gap_evt_conn_param_update_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_evt_conn_param_update) +{ + return ble_gap_conn_params_t_dec(p_buf, buf_len, p_index, p_void_evt_conn_param_update); +} + +uint32_t ble_gap_evt_conn_param_update_request_t_enc(void const * const p_void_evt_conn_param_update_request, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + return ble_gap_conn_params_t_enc(p_void_evt_conn_param_update_request, p_buf, buf_len, p_index); +} + +uint32_t ble_gap_evt_conn_param_update_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_evt_conn_param_update_request) +{ + return ble_gap_conn_params_t_dec(p_buf, buf_len, p_index, p_void_evt_conn_param_update_request); +} + +uint32_t ble_gap_conn_params_t_enc(void const * const p_void_conn_params, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_conn_params_t * p_conn_params = (ble_gap_conn_params_t *)p_void_conn_params; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&p_conn_params->min_conn_interval, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_conn_params->max_conn_interval, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_conn_params->slave_latency, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_conn_params->conn_sup_timeout, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_conn_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_conn_params) +{ + ble_gap_conn_params_t * p_conn_params = (ble_gap_conn_params_t *)p_void_conn_params; + + SER_ASSERT_LENGTH_LEQ(*p_index + 2, buf_len); + uint16_dec(p_buf, buf_len, p_index, &p_conn_params->min_conn_interval); + + SER_ASSERT_LENGTH_LEQ(*p_index + 2, buf_len); + uint16_dec(p_buf, buf_len, p_index, &p_conn_params->max_conn_interval); + + SER_ASSERT_LENGTH_LEQ(*p_index + 2, buf_len); + uint16_dec(p_buf, buf_len, p_index, &p_conn_params->slave_latency); + + SER_ASSERT_LENGTH_LEQ(*p_index + 2, buf_len); + uint16_dec(p_buf, buf_len, p_index, &p_conn_params->conn_sup_timeout); + + return NRF_SUCCESS; +} + +uint32_t ble_gap_evt_disconnected_t_enc(void const * const p_void_disconnected, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_evt_disconnected_t * p_disconnected = (ble_gap_evt_disconnected_t *)p_void_disconnected; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint8_t_enc(&p_disconnected->reason, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_evt_disconnected_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_disconnected) +{ + ble_gap_evt_disconnected_t * p_disconnected = (ble_gap_evt_disconnected_t *)p_void_disconnected; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + uint8_dec(p_buf, buf_len, p_index, &p_disconnected->reason); + + return err_code; +} + +uint32_t ble_gap_master_id_t_enc(void const * const p_master_idx, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_master_id_t * p_master_id = (ble_gap_master_id_t *) p_master_idx; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&(p_master_id->ediv), p_buf, buf_len, p_index); + + SER_ASSERT_LENGTH_LEQ(BLE_GAP_SEC_RAND_LEN, buf_len - *p_index); + memcpy(&p_buf[*p_index], p_master_id->rand, BLE_GAP_SEC_RAND_LEN); + *p_index += BLE_GAP_SEC_RAND_LEN; + + return err_code; +} + +uint32_t ble_gap_master_id_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_master_idx) +{ + ble_gap_master_id_t *p_master_id = (ble_gap_master_id_t *)p_master_idx; + + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_master_id->ediv)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(BLE_GAP_SEC_RAND_LEN, buf_len - *p_index); + memcpy(p_master_id->rand, &p_buf[*p_index], BLE_GAP_SEC_RAND_LEN); + *p_index += BLE_GAP_SEC_RAND_LEN; + + return err_code; +} + +uint32_t ble_gap_whitelist_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_whitelist_t *p_whitelist = (ble_gap_whitelist_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + uint32_t i = 0; + + SER_ERROR_CHECK(p_whitelist->addr_count <= BLE_GAP_WHITELIST_ADDR_MAX_COUNT, + NRF_ERROR_INVALID_PARAM); + SER_ERROR_CHECK(p_whitelist->irk_count <= BLE_GAP_WHITELIST_IRK_MAX_COUNT, + NRF_ERROR_INVALID_PARAM); + + err_code = uint8_t_enc(&(p_whitelist->addr_count), p_buf, buf_len, p_index); + + err_code = cond_field_enc(p_whitelist->pp_addrs, p_buf, buf_len, p_index, NULL); + + for (i = 0; i < p_whitelist->addr_count; i++) + { + err_code = cond_field_enc(p_whitelist->pp_addrs[i], p_buf, buf_len, p_index, ble_gap_addr_enc); + } + + err_code = uint8_t_enc(&(p_whitelist->irk_count), p_buf, buf_len, p_index); + + err_code = cond_field_enc(p_whitelist->pp_irks, p_buf, buf_len, p_index, NULL); + + for (i = 0; i < p_whitelist->irk_count; i++) + { + err_code = cond_field_enc(p_whitelist->pp_irks[i], p_buf, buf_len, p_index, ble_gap_irk_enc); + } + + return err_code; +} + +uint32_t ble_gap_whitelist_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * p_data) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_whitelist_t * p_whitelist = (ble_gap_whitelist_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + uint32_t i = 0; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &(p_whitelist->addr_count)); + SER_ERROR_CHECK(p_whitelist->addr_count <= BLE_GAP_WHITELIST_ADDR_MAX_COUNT, + NRF_ERROR_INVALID_LENGTH); + + err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_whitelist->pp_addrs), NULL); + + for (i = 0; i < p_whitelist->addr_count; i++) + { + err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_whitelist->pp_addrs[i]), ble_gap_addr_dec); + } + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &(p_whitelist->irk_count)); + SER_ERROR_CHECK(p_whitelist->irk_count <= BLE_GAP_WHITELIST_IRK_MAX_COUNT, + NRF_ERROR_INVALID_LENGTH); + + err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_whitelist->pp_irks), NULL); + + for (i = 0; i < p_whitelist->irk_count; i++) + { + err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_whitelist->pp_irks[i]), ble_gap_irk_dec); + } + + return err_code; +} + +uint32_t ble_gap_scan_params_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_scan_params_t * p_scan_params = (ble_gap_scan_params_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + p_buf[*p_index] = p_scan_params->active & 0x01; + p_buf[*p_index] |= (p_scan_params->selective & 0x7F) << 1; + (*p_index)++; + + err_code = cond_field_enc(p_scan_params->p_whitelist, p_buf, buf_len, p_index, ble_gap_whitelist_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_scan_params->interval), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_scan_params->window), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_scan_params->timeout), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_scan_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_scan_params_t * p_scan_params = (ble_gap_scan_params_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + p_scan_params->active = p_buf[*p_index] & 0x01; + p_scan_params->selective = (p_buf[*p_index] >> 1) & 0x7F; + (*p_index)++; + + err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_scan_params->p_whitelist), ble_gap_whitelist_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_scan_params->interval)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_scan_params->window)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_scan_params->timeout)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_enc_key_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_enc_key_t * p_enc_key = (ble_gap_enc_key_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_enc_info_enc(&(p_enc_key->enc_info), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_master_id_t_enc(&(p_enc_key->master_id), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_enc_key_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_enc_key_t * p_enc_key = (ble_gap_enc_key_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_enc_info_dec(p_buf, buf_len, p_index, &(p_enc_key->enc_info)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_master_id_t_dec(p_buf, buf_len, p_index, &(p_enc_key->master_id)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} +uint32_t ble_gap_id_key_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_id_key_t * p_id_key = (ble_gap_id_key_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_irk_enc(&(p_id_key->id_info), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_addr_enc(&(p_id_key->id_addr_info), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_id_key_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_id_key_t * p_id_key = (ble_gap_id_key_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_irk_dec(p_buf, buf_len, p_index, &(p_id_key->id_info)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_addr_dec(p_buf, buf_len, p_index, &(p_id_key->id_addr_info)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_sec_keyset_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_sec_keyset_t * p_sec_keyset = (ble_gap_sec_keyset_t *) p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_sec_keys_enc(&(p_sec_keyset->keys_periph), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_keys_enc(&(p_sec_keyset->keys_central), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_sec_keyset_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_sec_keyset_t * p_sec_keyset = (ble_gap_sec_keyset_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_sec_keys_dec(p_buf, buf_len, p_index, &(p_sec_keyset->keys_periph)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_keys_dec(p_buf, buf_len, p_index, &(p_sec_keyset->keys_central)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_evt_sec_request_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_evt_sec_request_t * p_evt_sec_request = (ble_gap_evt_sec_request_t *)p_void_struct; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + + p_buf[*p_index] = p_evt_sec_request->bond & 0x01; + p_buf[*p_index] |= (p_evt_sec_request->mitm & 0x01) << 1; + (*p_index)++; + + return err_code; +} + +uint32_t ble_gap_evt_sec_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_evt_sec_request_t * p_sec_request = (ble_gap_evt_sec_request_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + p_sec_request->bond = p_buf[*p_index] & 0x01; + p_sec_request->mitm = (p_buf[*p_index] >> 1) & 0x01; + *p_index += 1; + + return err_code; +} + +uint32_t ble_gap_sec_kdist_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_sec_kdist_t * p_sec_kdist = (ble_gap_sec_kdist_t *) p_data; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + + p_buf[*p_index] = p_sec_kdist->enc & 0x01; + p_buf[*p_index] |= (p_sec_kdist->id & 0x01) << 1; + p_buf[*p_index] |= (p_sec_kdist->sign & 0x01) << 2; + (*p_index)++; + + return err_code; +} + +uint32_t ble_gap_sec_kdist_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_sec_kdist_t * p_sec_kdist = (ble_gap_sec_kdist_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + p_sec_kdist->enc = p_buf[*p_index] & 0x01; + p_sec_kdist->id = (p_buf[*p_index] >> 1) & 0x01; + p_sec_kdist->sign = (p_buf[*p_index] >> 2) & 0x01; + (*p_index)++; + + return err_code; +} + +uint32_t ble_gap_opt_ch_map_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_ch_map_t * p_gap_opt_ch_map = (ble_gap_opt_ch_map_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&p_gap_opt_ch_map->conn_handle, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(5, buf_len - *p_index); + memcpy(&p_buf[*p_index], p_gap_opt_ch_map->ch_map, 5); + + *p_index += 5; + + return err_code; +} + +uint32_t ble_gap_opt_ch_map_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_ch_map_t * p_gap_opt_ch_map = (ble_gap_opt_ch_map_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &p_gap_opt_ch_map->conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(5, buf_len - *p_index); + memcpy(p_gap_opt_ch_map->ch_map, &p_buf[*p_index], 5); + + *p_index += 5; + + return err_code; +} + +uint32_t ble_gap_opt_local_conn_latency_t_enc(void const * const p_void_local_conn_latency, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_local_conn_latency_t * p_latency = + (ble_gap_opt_local_conn_latency_t *)p_void_local_conn_latency; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&(p_latency->conn_handle), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_latency->requested_latency), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_latency->p_actual_latency, p_buf, buf_len, p_index, uint16_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_opt_local_conn_latency_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_local_conn_latency) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_local_conn_latency_t * p_latency = + (ble_gap_opt_local_conn_latency_t *)p_void_local_conn_latency; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_latency->conn_handle)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_latency->requested_latency)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_latency->p_actual_latency), + uint16_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_opt_passkey_t_enc(void const * const p_void_passkey, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_passkey_t * p_opt_passkey = (ble_gap_opt_passkey_t *)p_void_passkey; + uint32_t err_code = NRF_SUCCESS; + uint16_t passkey_len = BLE_GAP_PASSKEY_LEN; + + err_code = buf_enc(p_opt_passkey->p_passkey, passkey_len, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_opt_passkey_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_passkey) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_passkey_t * p_opt_passkey = (ble_gap_opt_passkey_t *)p_void_passkey; + uint32_t err_code = NRF_SUCCESS; + uint16_t passkey_len = BLE_GAP_PASSKEY_LEN; + + err_code = buf_dec(p_buf, buf_len, p_index, &p_opt_passkey->p_passkey, passkey_len, + passkey_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_opt_privacy_t_enc(void const * const p_void_privacy, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_privacy_t * p_privacy = (ble_gap_opt_privacy_t *)p_void_privacy; + uint32_t err_code = NRF_SUCCESS; + + err_code = cond_field_enc(p_privacy->p_irk, p_buf, buf_len, p_index, ble_gap_irk_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_privacy->interval_s), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_opt_privacy_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_privacy) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_privacy_t * p_privacy = (ble_gap_opt_privacy_t *)p_void_privacy; + uint32_t err_code = NRF_SUCCESS; + + err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_privacy->p_irk), ble_gap_irk_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_privacy->interval_s)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_opt_scan_req_report_t_enc(void const * const p_void_scan_req_report, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_scan_req_report_t * p_scan_req_report = (ble_gap_opt_scan_req_report_t *)p_void_scan_req_report; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + byte = p_scan_req_report->enable; + err_code = uint8_t_enc(&byte, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_opt_scan_req_report_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_scan_req_report) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_scan_req_report_t * p_scan_req_report = (ble_gap_opt_scan_req_report_t *)p_void_scan_req_report; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &byte); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_scan_req_report->enable = byte & 0x01; + + return err_code; +} + +uint32_t ble_gap_opt_compat_mode_t_enc(void const * const p_void_compat_mode, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_compat_mode_t * p_compat_mode = (ble_gap_opt_compat_mode_t *)p_void_compat_mode; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + byte = p_compat_mode->mode_1_enable; + err_code = uint8_t_enc(&byte, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_opt_compat_mode_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_compat_mode) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_compat_mode_t * p_compat_mode = (ble_gap_opt_compat_mode_t *)p_void_compat_mode; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &byte); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_compat_mode->mode_1_enable = byte & 0x01; + + return err_code; +} + +uint32_t ble_gap_adv_ch_mask_t_enc(void const * const p_void_ch_mask, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_adv_ch_mask_t * p_ch_mask = (ble_gap_adv_ch_mask_t *)p_void_ch_mask; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + byte = p_ch_mask->ch_37_off | + (p_ch_mask->ch_38_off << 1) | + (p_ch_mask->ch_39_off << 2); + err_code = uint8_t_enc(&byte, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_adv_ch_mask_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_ch_mask) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_adv_ch_mask_t * p_ch_mask = (ble_gap_adv_ch_mask_t *)p_void_ch_mask; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &byte); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_ch_mask->ch_37_off = byte & 0x01; + p_ch_mask->ch_38_off = (byte >> 1) & 0x01; + p_ch_mask->ch_39_off = (byte >> 2) & 0x01; + + return err_code; +} diff --git a/components/serialization/common/struct_ser/s120/ble_gap_struct_serialization.h b/components/serialization/common/struct_ser/s120/ble_gap_struct_serialization.h new file mode 100644 index 0000000..b5f06c2 --- /dev/null +++ b/components/serialization/common/struct_ser/s120/ble_gap_struct_serialization.h @@ -0,0 +1,353 @@ +/* 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 "ble_gap.h" + +uint32_t ble_gap_irk_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_irk_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_addr_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_addr_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_addr); + +uint32_t ble_gap_sec_levels_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_sec_levels_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_sec_keys_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_sec_keys_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_enc_info_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_enc_info_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_enc_info); + +uint32_t ble_gap_sign_info_enc(void const * const p_sign_info, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_sign_info_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_sign_info); + +uint32_t ble_gap_evt_auth_status_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_evt_auth_status_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_conn_sec_mode_enc(void const * const p_void_sec_mode, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_conn_sec_mode_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_sec_mode); + +uint32_t ble_gap_conn_sec_t_enc(void const * const p_void_sec, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_conn_sec_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_sec); + +uint32_t ble_gap_evt_conn_sec_update_t_enc(void const * const p_void_conn_sec_update, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_evt_conn_sec_update_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_conn_sec_update); + +uint32_t ble_gap_evt_sec_info_request_t_enc(void const * const p_void_sec_info_request, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_evt_sec_info_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_sec_info_request); + +uint32_t ble_gap_evt_connected_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_evt_connected_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_connected); + +uint32_t ble_gap_sec_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_sec_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gap_enable_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_enable_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gap_evt_sec_params_request_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_evt_sec_params_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gap_conn_params_t_enc(void const * const p_void_conn_params, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_conn_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_conn_params); + +uint32_t ble_gap_evt_conn_param_update_t_enc(void const * const p_void_evt_conn_param_update, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_evt_conn_param_update_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_evt_conn_param_update); + +uint32_t ble_gap_evt_conn_param_update_request_t_enc(void const * const p_void_evt_conn_param_update_request, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_evt_conn_param_update_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_evt_conn_param_update_request); + +uint32_t ble_gap_evt_disconnected_t_enc(void const * const p_void_disconnected, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_evt_disconnected_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_disconnected); + +uint32_t ble_gap_whitelist_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_whitelist_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * p_data); + +uint32_t ble_gap_scan_params_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_scan_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_master_id_t_enc(void const * const p_master_idx, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_master_id_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_master_idx); + +uint32_t ble_gap_enc_key_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_enc_key_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_id_key_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_id_key_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_sec_keyset_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_sec_keyset_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_evt_sec_request_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_evt_sec_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_sec_kdist_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_sec_kdist_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_opt_ch_map_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_opt_ch_map_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_opt_local_conn_latency_t_enc(void const * const p_void_local_conn_latency, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_opt_local_conn_latency_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_local_conn_latency); + +uint32_t ble_gap_opt_passkey_t_enc(void const * const p_void_passkey, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_opt_passkey_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_passkey); + +uint32_t ble_gap_opt_privacy_t_enc(void const * const p_void_privacy, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_opt_privacy_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_privacy); + +uint32_t ble_gap_opt_scan_req_report_t_enc(void const * const p_void_scan_req_report, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_opt_scan_req_report_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_scan_req_report); + +uint32_t ble_gap_opt_compat_mode_t_enc(void const * const p_void_compat_mode, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_opt_compat_mode_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_compat_mode); + +uint32_t ble_gap_adv_ch_mask_t_enc(void const * const p_void_ch_mask, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_adv_ch_mask_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_ch_mask); diff --git a/components/serialization/common/struct_ser/s120/ble_gattc_struct_serialization.c b/components/serialization/common/struct_ser/s120/ble_gattc_struct_serialization.c new file mode 100644 index 0000000..9c36a55 --- /dev/null +++ b/components/serialization/common/struct_ser/s120/ble_gattc_struct_serialization.c @@ -0,0 +1,363 @@ +/* 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 "ble_gattc_struct_serialization.h" +#include "ble_struct_serialization.h" +#include "ble_serialization.h" +#include "app_util.h" +#include "ble_gattc.h" +#include "cond_field_serialization.h" +#include + +uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gattc_evt_char_val_by_uuid_read_rsp_t * p_read = + (ble_gattc_evt_char_val_by_uuid_read_rsp_t *) p_void_struct; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&(p_read->count), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_read->value_len), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + uint32_t i; + ble_gattc_handle_value_t * p_handle_value = &p_read->handle_value[0]; + + for (i = 0; i < p_read->count; i++) + { + err_code = uint16_t_enc(&(p_handle_value->handle), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(p_read->value_len, buf_len - *p_index); + memcpy(&p_buf[*p_index], p_handle_value->p_value, p_read->value_len); + *p_index += p_read->value_len; + + p_handle_value++; + } + + return err_code; +} + +uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_struct_size, + void * const p_void_struct) +{ + ble_gattc_evt_char_val_by_uuid_read_rsp_t * p_read = + (ble_gattc_evt_char_val_by_uuid_read_rsp_t *) p_void_struct; + uint32_t err_code = NRF_SUCCESS; + uint16_t value_len; + uint16_t count; + uint32_t i; + + SER_ASSERT_LENGTH_LEQ(4, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &count); + uint16_dec(p_buf, buf_len, p_index, &value_len); + + uint32_t total_struct_size = *p_struct_size; + + //calculate the size of the struct + *p_struct_size = offsetof(ble_gattc_evt_char_val_by_uuid_read_rsp_t, handle_value[0]); + *p_struct_size += sizeof(((ble_gattc_evt_char_val_by_uuid_read_rsp_t *)0)->handle_value) * count; + *p_struct_size += value_len * count; + + if (p_read) + { + p_read->value_len = value_len; + p_read->count = count; + + ble_gattc_handle_value_t * p_handle_value; + uint8_t * p_value; + + SER_ASSERT_LENGTH_LEQ(*p_struct_size, total_struct_size); + + p_value = (uint8_t *)&p_read->handle_value[count]; + + for (i = 0; i < count; i++) + { + p_handle_value = (ble_gattc_handle_value_t *)&p_read->handle_value[i]; + p_handle_value->p_value = p_value; + + SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &(p_handle_value->handle)); + + SER_ASSERT_LENGTH_LEQ(p_read->value_len, buf_len - *p_index); + memcpy(p_handle_value->p_value, &p_buf[*p_index], p_read->value_len); + *p_index += p_read->value_len; + + p_value += value_len; + } + } + else + { + *p_index += count * (value_len + 2); + } + + return err_code; +} + +uint32_t ble_gattc_evt_char_vals_read_rsp_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gattc_evt_char_vals_read_rsp_t * p_read = + (ble_gattc_evt_char_vals_read_rsp_t *) p_void_struct; + uint32_t error_code = NRF_SUCCESS; + + //Encode len + error_code = uint16_t_enc(&(p_read->len), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + //Encode values + SER_ASSERT_LENGTH_LEQ(p_read->len, buf_len - *p_index); + memcpy(&p_buf[*p_index], p_read->values, p_read->len); + *p_index += p_read->len; + + return error_code; +} + +uint32_t ble_gattc_evt_char_vals_read_rsp_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + ble_gattc_evt_char_vals_read_rsp_t * p_read = + (ble_gattc_evt_char_vals_read_rsp_t *) p_void_struct; + uint32_t error_code = NRF_SUCCESS; + + //Decode len + SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &(p_read->len)); + + //Decode values + SER_ASSERT_LENGTH_LEQ(p_read->len, buf_len - *p_index); + memcpy(p_read->values, &p_buf[*p_index], p_read->len); + *p_index += p_read->len; + + return error_code; +} + +uint32_t ble_gattc_handle_range_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gattc_handle_range_t * p_range = (ble_gattc_handle_range_t *) p_void_struct; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&(p_range->start_handle), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_range->end_handle), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gattc_handle_range_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + ble_gattc_handle_range_t * p_range = (ble_gattc_handle_range_t *) p_void_struct; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(4, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &(p_range->start_handle)); + uint16_dec(p_buf, buf_len, p_index, &(p_range->end_handle)); + + return err_code; +} + + +uint32_t ble_gattc_service_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t error_code = NRF_SUCCESS; + ble_gattc_service_t * p_service = (ble_gattc_service_t *) p_void_struct; + + error_code = ble_uuid_t_enc(&(p_service->uuid), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_gattc_handle_range_t_enc(&(p_service->handle_range), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + return error_code; +} + +uint32_t ble_gattc_service_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + uint32_t error_code = NRF_SUCCESS; + ble_gattc_service_t * p_service = (ble_gattc_service_t *) p_void_struct; + + error_code = ble_uuid_t_dec(p_buf, buf_len, p_index, &(p_service->uuid)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_gattc_handle_range_t_dec(p_buf, buf_len, p_index, &(p_service->handle_range)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + return error_code; +} + +uint32_t ble_gattc_include_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t error_code = NRF_SUCCESS; + ble_gattc_include_t * p_include = (ble_gattc_include_t *) p_void_struct; + + error_code = uint16_t_enc(&(p_include->handle), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_gattc_service_t_enc(&(p_include->included_srvc), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + return error_code; +} + +uint32_t ble_gattc_include_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + uint32_t error_code = NRF_SUCCESS; + ble_gattc_include_t * p_include = (ble_gattc_include_t *) p_void_struct; + + error_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_include->handle)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_gattc_service_t_dec(p_buf, buf_len, p_index, &(p_include->included_srvc)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + return error_code; +} + +uint32_t ble_gattc_evt_rel_disc_rsp_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t error_code = NRF_SUCCESS; + uint32_t i; + ble_gattc_evt_rel_disc_rsp_t * p_rsp = (ble_gattc_evt_rel_disc_rsp_t *) p_void_struct; + + error_code = uint16_t_enc(&(p_rsp->count), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + ble_gattc_include_t * p_include = (ble_gattc_include_t *) p_rsp->includes; + + for (i = 0; i < p_rsp->count; i++) + { + error_code = ble_gattc_include_t_enc(p_include, p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + p_include++; + } + + return error_code; +} + +uint32_t ble_gattc_evt_rel_disc_rsp_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + uint32_t error_code = NRF_SUCCESS; + ble_gattc_evt_rel_disc_rsp_t * p_rsp = (ble_gattc_evt_rel_disc_rsp_t *) p_void_struct; + uint16_t include_count; + uint32_t i; + + error_code = uint16_t_dec(p_buf, buf_len, p_index, &include_count); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + p_rsp->count = include_count; + + ble_gattc_include_t * p_include = (ble_gattc_include_t *) p_rsp->includes; + + for (i = 0; i < include_count; i++) + { + error_code = ble_gattc_include_t_dec(p_buf, buf_len, p_index, p_include); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + p_include++; + } + + return error_code; +} + +uint32_t ble_gattc_write_params_t_enc(void const * const p_void_write, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_void_write); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + uint32_t err_code = NRF_SUCCESS; + + ble_gattc_write_params_t * p_write = (ble_gattc_write_params_t *)p_void_write; + + err_code = uint8_t_enc(&(p_write->write_op), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&(p_write->flags), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_write->handle), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_write->offset), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = len16data_enc(p_write->p_value, p_write->len, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gattc_write_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_write) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_write); + + uint32_t err_code = NRF_SUCCESS; + + ble_gattc_write_params_t * p_write = (ble_gattc_write_params_t *)p_void_write; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &(p_write->write_op)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &(p_write->flags)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_write->handle)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_write->offset)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = len16data_dec(p_buf, buf_len, p_index, &(p_write->p_value), &(p_write->len)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} diff --git a/components/serialization/common/struct_ser/s120/ble_gattc_struct_serialization.h b/components/serialization/common/struct_ser/s120/ble_gattc_struct_serialization.h new file mode 100644 index 0000000..cbfae81 --- /dev/null +++ b/components/serialization/common/struct_ser/s120/ble_gattc_struct_serialization.h @@ -0,0 +1,88 @@ +/* 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 BLE_GATTC_STRUCT_SERIALIZATION_H +#define BLE_GATTC_STRUCT_SERIALIZATION_H + +#include "ble_gattc.h" + +uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_struct_size, + void * const p_void_struct); + +uint32_t ble_gattc_evt_char_vals_read_rsp_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gattc_evt_char_vals_read_rsp_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gattc_handle_range_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gattc_handle_range_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gattc_service_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gattc_service_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gattc_include_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gattc_include_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gattc_evt_rel_disc_rsp_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gattc_evt_rel_disc_rsp_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gattc_write_params_t_enc(void const * const p_void_write, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gattc_write_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_write); + +#endif /*BLE_GATTC_STRUCT_SERIALIZATION_H*/ diff --git a/components/serialization/common/struct_ser/s120/ble_gatts_struct_serialization.c b/components/serialization/common/struct_ser/s120/ble_gatts_struct_serialization.c new file mode 100644 index 0000000..c03e760 --- /dev/null +++ b/components/serialization/common/struct_ser/s120/ble_gatts_struct_serialization.c @@ -0,0 +1,959 @@ +/* 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 "ble_gatts_struct_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "ble_struct_serialization.h" +#include "ble_serialization.h" +#include "app_util.h" +#include "ble_gatts.h" +#include "cond_field_serialization.h" +#include + +uint32_t ser_ble_gatts_char_pf_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_char_pf) +{ + ble_gatts_char_pf_t * p_char_pf = (ble_gatts_char_pf_t *)p_void_char_pf; + + SER_ASSERT_LENGTH_LEQ(7, buf_len - *p_index); + + uint8_dec(p_buf, buf_len, p_index, &p_char_pf->format); + uint8_dec(p_buf, buf_len, p_index, (uint8_t *)&p_char_pf->exponent); + uint16_dec(p_buf, buf_len, p_index, &p_char_pf->unit); + uint8_dec(p_buf, buf_len, p_index, &p_char_pf->name_space); + uint16_dec(p_buf, buf_len, p_index, &p_char_pf->desc); + + return NRF_SUCCESS; +} + +uint32_t ser_ble_gatts_char_pf_enc(void const * const p_void_char_pf, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_char_pf_t * p_char_pf = (ble_gatts_char_pf_t *)p_void_char_pf; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint8_t_enc(&p_char_pf->format, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&p_char_pf->exponent, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_char_pf->unit, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&p_char_pf->name_space, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_char_pf->desc, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gatts_attr_md_enc(void const * const p_void_attr_md, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_attr_md_t * p_attr_md = (ble_gatts_attr_md_t *)p_void_attr_md; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_conn_sec_mode_enc(&p_attr_md->read_perm, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_conn_sec_mode_enc(&p_attr_md->write_perm, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + /* serializer does not support attributes on stack */ + if (p_attr_md->vloc != BLE_GATTS_VLOC_STACK) + { + err_code = NRF_ERROR_INVALID_PARAM; + } + + uint8_t temp8; + temp8 = p_attr_md->vlen | + (p_attr_md->vloc << 1) | + (p_attr_md->rd_auth << 3) | + (p_attr_md->wr_auth << 4); + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + p_buf[*p_index] = temp8; + *p_index += 1; + + return err_code; +} + +uint32_t ble_gatts_attr_md_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_attr_md) +{ + ble_gatts_attr_md_t * p_attr_md = (ble_gatts_attr_md_t *)p_void_attr_md; + uint32_t err_code = NRF_SUCCESS; + uint8_t temp8; + + err_code = ble_gap_conn_sec_mode_dec(p_buf, buf_len, p_index, &p_attr_md->read_perm); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_conn_sec_mode_dec(p_buf, buf_len, p_index, &p_attr_md->write_perm); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + uint8_dec(p_buf, buf_len, p_index, &temp8); + + p_attr_md->vlen = temp8; + p_attr_md->vloc = temp8 >> 1; + p_attr_md->rd_auth = temp8 >> 3; + p_attr_md->wr_auth = temp8 >> 4; + + return err_code; +} + +uint32_t ble_gatts_char_md_enc(void const * const p_void_char_md, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t err_code = NRF_SUCCESS; + + ble_gatts_char_md_t * p_char_md = (ble_gatts_char_md_t *)p_void_char_md; + uint8_t temp8; + + temp8 = p_char_md->char_props.broadcast | + (p_char_md->char_props.read << 1) | + (p_char_md->char_props.write_wo_resp << 2) | + (p_char_md->char_props.write << 3) | + (p_char_md->char_props.notify << 4) | + (p_char_md->char_props.indicate << 5) | + (p_char_md->char_props.auth_signed_wr << 6); + + err_code = uint8_t_enc(&temp8, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + temp8 = p_char_md->char_ext_props.reliable_wr | + (p_char_md->char_ext_props.wr_aux << 1); + + err_code = uint8_t_enc(&temp8, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_char_md->char_user_desc_max_size, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ERROR_CHECK(p_char_md->char_user_desc_size <= BLE_GATTS_VAR_ATTR_LEN_MAX, + NRF_ERROR_INVALID_PARAM); + err_code = len16data_enc(p_char_md->p_char_user_desc, p_char_md->char_user_desc_size, p_buf, + buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_char_md->p_char_pf, + p_buf, + buf_len, + p_index, + ser_ble_gatts_char_pf_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_char_md->p_user_desc_md, + p_buf, + buf_len, + p_index, + ble_gatts_attr_md_enc); + SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_char_md->p_cccd_md, p_buf, buf_len, p_index, ble_gatts_attr_md_enc); + SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_char_md->p_sccd_md, p_buf, buf_len, p_index, ble_gatts_attr_md_enc); + SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gatts_char_md_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_char_md) +{ + uint32_t err_code = NRF_SUCCESS; + + ble_gatts_char_md_t * p_char_md = (ble_gatts_char_md_t *)p_void_char_md; + + SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index); + uint8_t temp8 = p_buf[*p_index]; + + p_char_md->char_props.broadcast = temp8 >> 0; + p_char_md->char_props.read = temp8 >> 1; + p_char_md->char_props.write_wo_resp = temp8 >> 2; + p_char_md->char_props.write = temp8 >> 3; + p_char_md->char_props.notify = temp8 >> 4; + p_char_md->char_props.indicate = temp8 >> 5; + p_char_md->char_props.auth_signed_wr = temp8 >> 6; + + temp8 = p_buf[*p_index + 1]; + p_char_md->char_ext_props.reliable_wr = temp8 >> 0; + p_char_md->char_ext_props.wr_aux = temp8 >> 1; + + *p_index += 2; + + SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &p_char_md->char_user_desc_max_size); + + err_code = len16data_dec(p_buf, + buf_len, + p_index, + &p_char_md->p_char_user_desc, + &p_char_md->char_user_desc_size); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + buf_len, + p_index, + (void * *)&p_char_md->p_char_pf, + ser_ble_gatts_char_pf_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + buf_len, + p_index, + (void * *)&p_char_md->p_user_desc_md, + ble_gatts_attr_md_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + buf_len, + p_index, + (void * *)&p_char_md->p_cccd_md, + ble_gatts_attr_md_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + buf_len, + p_index, + (void * *)&p_char_md->p_sccd_md, + ble_gatts_attr_md_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; + +} + +uint32_t ble_gatts_attr_enc(void const * const p_void_gatts_attr, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t err_code = NRF_SUCCESS; + ble_gatts_attr_t * p_gatts_attr = (ble_gatts_attr_t *)p_void_gatts_attr; + + err_code = cond_field_enc((void *)p_gatts_attr->p_uuid, p_buf, buf_len, p_index, ble_uuid_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc((void *)p_gatts_attr->p_attr_md, + p_buf, + buf_len, + p_index, + ble_gatts_attr_md_enc); + SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_gatts_attr->init_offs, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_gatts_attr->max_len, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ERROR_CHECK(p_gatts_attr->init_len <= BLE_GATTS_VAR_ATTR_LEN_MAX, NRF_ERROR_INVALID_PARAM); + //init len move just before p_data to be able to use len16data decoder. + err_code = len16data_enc(p_gatts_attr->p_value, p_gatts_attr->init_len, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gatts_attr_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_gatts_attr) +{ + uint32_t err_code = NRF_SUCCESS; + ble_gatts_attr_t * p_gatts_attr = (ble_gatts_attr_t *)p_void_gatts_attr; + + err_code = cond_field_dec(p_buf, + buf_len, + p_index, + (void * *)&p_gatts_attr->p_uuid, + ble_uuid_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + buf_len, + p_index, + (void * *)&p_gatts_attr->p_attr_md, + ble_gatts_attr_md_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(4, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &p_gatts_attr->init_offs); + uint16_dec(p_buf, buf_len, p_index, &p_gatts_attr->max_len); + + //init len move just before p_data to be able to use len16data decoder. + err_code = len16data_dec(p_buf, + buf_len, + p_index, + &p_gatts_attr->p_value, + &p_gatts_attr->init_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gatts_char_handles_enc(void const * const p_void_char_handles, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_char_handles_t * p_char_handles = (ble_gatts_char_handles_t *)p_void_char_handles; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&p_char_handles->value_handle, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_char_handles->user_desc_handle, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_char_handles->cccd_handle, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_char_handles->sccd_handle, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gatts_char_handles_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_char_handles) +{ + ble_gatts_char_handles_t * p_char_handles = (ble_gatts_char_handles_t *)p_void_char_handles; + + SER_ASSERT_LENGTH_LEQ(8, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &(p_char_handles->value_handle)); + uint16_dec(p_buf, buf_len, p_index, &p_char_handles->user_desc_handle); + uint16_dec(p_buf, buf_len, p_index, &p_char_handles->cccd_handle); + uint16_dec(p_buf, buf_len, p_index, &p_char_handles->sccd_handle); + + return NRF_SUCCESS; +} + +uint32_t ble_gatts_hvx_params_t_enc(void const * const p_void_hvx_params, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_hvx_params_t * p_hvx_params = (ble_gatts_hvx_params_t *)p_void_hvx_params; + + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(2 + 1 + 2, buf_len - *p_index); + + err_code = uint16_t_enc(&p_hvx_params->handle, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&p_hvx_params->type, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_hvx_params->offset, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (p_hvx_params->p_len != NULL) + { + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + p_buf[(*p_index)++] = SER_FIELD_PRESENT; + + err_code = uint16_t_enc(p_hvx_params->p_len, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + + if (p_hvx_params->p_data != NULL) + { + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + p_buf[(*p_index)++] = SER_FIELD_PRESENT; + + SER_ASSERT_LENGTH_LEQ(*p_hvx_params->p_len, buf_len - *p_index); + memcpy(&p_buf[*p_index], p_hvx_params->p_data, *p_hvx_params->p_len); + *p_index += *p_hvx_params->p_len; + } + + return err_code; +} + +uint32_t ble_gatts_hvx_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_hvx_params) +{ + ble_gatts_hvx_params_t * p_hvx_params = (ble_gatts_hvx_params_t *)p_void_hvx_params; + + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(2 + 1 + 2, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &p_hvx_params->handle); + uint8_dec(p_buf, buf_len, p_index, &p_hvx_params->type); + uint16_dec(p_buf, buf_len, p_index, &p_hvx_params->offset); + + SER_ASSERT_NOT_NULL(&p_hvx_params->p_len); + err_code = cond_len16_cond_data_dec(p_buf, + buf_len, + p_index, + &p_hvx_params->p_data, + &p_hvx_params->p_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gatts_attr_context_t_enc(void const * const p_void_attr_context, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t error_code = NRF_SUCCESS; + ble_gatts_attr_context_t * p_context = (ble_gatts_attr_context_t *) p_void_attr_context; + + error_code = ble_uuid_t_enc(&(p_context->srvc_uuid), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_uuid_t_enc(&(p_context->char_uuid), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_uuid_t_enc(&(p_context->desc_uuid), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint16_t_enc(&(p_context->srvc_handle), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint16_t_enc(&(p_context->value_handle), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint8_t_enc(&(p_context->type), p_buf, buf_len, p_index); + + return error_code; +} + +uint32_t ble_gatts_attr_context_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_attr_context) +{ + uint32_t error_code = NRF_SUCCESS; + ble_gatts_attr_context_t * p_context = (ble_gatts_attr_context_t *) p_void_attr_context; + + error_code = ble_uuid_t_dec(p_buf, buf_len, p_index, &(p_context->srvc_uuid)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_uuid_t_dec(p_buf, buf_len, p_index, &(p_context->char_uuid)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_uuid_t_dec(p_buf, buf_len, p_index, &(p_context->desc_uuid)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + SER_ASSERT_LENGTH_LEQ(5, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &(p_context->srvc_handle)); + uint16_dec(p_buf, buf_len, p_index, &(p_context->value_handle)); + uint8_dec(p_buf, buf_len, p_index, &(p_context->type)); + return error_code; +} + +uint32_t ble_gatts_evt_write_t_enc(void const * const p_void_write, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_evt_write_t * p_write = (ble_gatts_evt_write_t *) p_void_write; + uint32_t error_code = NRF_SUCCESS; + + error_code = uint16_t_enc(&(p_write->handle), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint8_t_enc(&(p_write->op), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_gatts_attr_context_t_enc(&(p_write->context), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint16_t_enc(&(p_write->offset), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + uint16_t data_len = p_write->len; + error_code = uint16_t_enc(&data_len, p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + SER_ASSERT_LENGTH_LEQ(data_len, buf_len - *p_index); + memcpy(&p_buf[*p_index], p_write->data, data_len); + *p_index += data_len; + + return error_code; +} + +uint32_t ble_gatts_evt_write_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_struct_len, + void * const p_void_write) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_struct_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t in_struct_len = *p_struct_len; + + *p_struct_len = offsetof(ble_gatts_evt_write_t, data); + + uint16_t handle; + err_code = uint16_t_dec(p_buf, buf_len, p_index, &handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + uint8_t op; + err_code = uint8_t_dec(p_buf, buf_len, p_index, &op); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + ble_gatts_attr_context_t context; + err_code = ble_gatts_attr_context_t_dec(p_buf, buf_len, p_index, &context); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + uint16_t offset; + err_code = uint16_t_dec(p_buf, buf_len, p_index, &offset); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + uint16_t len; + err_code = uint16_t_dec(p_buf, buf_len, p_index, &len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_struct_len += len; + + if (p_void_write != NULL) + { + ble_gatts_evt_write_t * p_write = (ble_gatts_evt_write_t *)p_void_write; + + SER_ASSERT_LENGTH_LEQ(*p_struct_len, in_struct_len); + + p_write->handle = handle; + p_write->op = op; + + memcpy(&(p_write->context), &context, sizeof (ble_gatts_attr_context_t)); + + p_write->offset = offset; + p_write->len = len; + + SER_ASSERT_LENGTH_LEQ(p_write->len, buf_len - *p_index); + memcpy(p_write->data, &p_buf[*p_index], p_write->len); + } + + *p_index += len; + + return err_code; +} + +uint32_t ble_gatts_evt_read_t_enc(void const * const p_void_read, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_read); + + ble_gatts_evt_read_t * p_read = (ble_gatts_evt_read_t *)p_void_read; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&(p_read->handle), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gatts_attr_context_t_enc(&(p_read->context), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_read->offset), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gatts_evt_read_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_struct_len, + void * const p_void_read) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + uint32_t err_code = NRF_SUCCESS; + uint32_t in_struct_len = *p_struct_len; + + *p_struct_len = sizeof (ble_gatts_evt_read_t); + + uint16_t handle; + err_code = uint16_t_dec(p_buf, buf_len, p_index, &handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + ble_gatts_attr_context_t context; + err_code = ble_gatts_attr_context_t_dec(p_buf, buf_len, p_index, &context); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + uint16_t offset; + err_code = uint16_t_dec(p_buf, buf_len, p_index, &offset); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (p_void_read != NULL) + { + ble_gatts_evt_read_t * p_read = (ble_gatts_evt_read_t *)p_void_read; + + SER_ASSERT_LENGTH_LEQ(*p_struct_len, in_struct_len); + + p_read->handle = handle; + memcpy(&(p_read->context), &context, sizeof (context)); + p_read->offset = offset; + } + + return err_code; +} + +uint32_t ble_gatts_evt_rw_authorize_request_t_enc(void const * const p_void_authorize_request, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_authorize_request); + + ble_gatts_evt_rw_authorize_request_t * p_authorize_request = + (ble_gatts_evt_rw_authorize_request_t *)p_void_authorize_request; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint8_t_enc(&(p_authorize_request->type), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + switch (p_authorize_request->type) + { + case BLE_GATTS_AUTHORIZE_TYPE_READ: + err_code = ble_gatts_evt_read_t_enc(&(p_authorize_request->request.read), + p_buf, + buf_len, + p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + + case BLE_GATTS_AUTHORIZE_TYPE_WRITE: + err_code = ble_gatts_evt_write_t_enc(&(p_authorize_request->request.write), + p_buf, + buf_len, + p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + + default: + case BLE_GATTS_AUTHORIZE_TYPE_INVALID: + err_code = NRF_ERROR_INVALID_PARAM; + break; + } + + return err_code; +} + +uint32_t ble_gatts_evt_rw_authorize_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_struct_len, + void * const p_void_authorize_request) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_struct_len); + SER_ASSERT_NOT_NULL(p_index); + + uint32_t err_code = NRF_SUCCESS; + + uint8_t type; + err_code = uint8_t_dec(p_buf, buf_len, p_index, &type); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + uint32_t in_struct_len = *p_struct_len; + + *p_struct_len = offsetof(ble_gatts_evt_rw_authorize_request_t, request); + + ble_gatts_evt_rw_authorize_request_t * p_authorize_request = + (ble_gatts_evt_rw_authorize_request_t *)p_void_authorize_request; + + void * p_void_request = NULL; + + if (p_void_authorize_request != NULL) + { + p_authorize_request->type = type; + + SER_ASSERT_LENGTH_LEQ(*p_struct_len, in_struct_len); + + switch (type) + { + case BLE_GATTS_AUTHORIZE_TYPE_READ: + p_void_request = &(p_authorize_request->request.read); + break; + + case BLE_GATTS_AUTHORIZE_TYPE_WRITE: + p_void_request = &(p_authorize_request->request.write); + break; + + default: + case BLE_GATTS_AUTHORIZE_TYPE_INVALID: + return NRF_ERROR_INVALID_DATA; + } + } + + switch (type) + { + case BLE_GATTS_AUTHORIZE_TYPE_READ: + err_code = ble_gatts_evt_read_t_dec(p_buf, + buf_len, + p_index, + &in_struct_len, + p_void_request); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + + case BLE_GATTS_AUTHORIZE_TYPE_WRITE: + err_code = ble_gatts_evt_write_t_dec(p_buf, + buf_len, + p_index, + &in_struct_len, + p_void_request); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + + default: + case BLE_GATTS_AUTHORIZE_TYPE_INVALID: + return NRF_ERROR_INVALID_DATA; + } + *p_struct_len += in_struct_len; + + return err_code; +} + +uint32_t ble_gatts_read_authorize_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_read_authorize_params_t * p_params = + (ble_gatts_read_authorize_params_t *) p_void_struct; + uint32_t error_code = NRF_SUCCESS; + + error_code = uint16_t_enc(&(p_params->gatt_status), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + uint8_t temp_val = p_params->update; + error_code = uint8_t_enc(&temp_val, p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + error_code = uint16_t_enc(&(p_params->offset), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + error_code = len16data_enc(p_params->p_data, p_params->len, p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + return error_code; +} + +uint32_t ble_gatts_read_authorize_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + ble_gatts_read_authorize_params_t * p_params = + (ble_gatts_read_authorize_params_t *) p_void_struct; + uint32_t error_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &p_params->gatt_status); + + uint8_t temp_val; + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + uint8_dec(p_buf, buf_len, p_index, &temp_val); + p_params->update = temp_val; + + SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &p_params->offset); + + error_code = len16data_dec(p_buf, buf_len, p_index, &p_params->p_data, &p_params->len); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + return error_code; +} + +uint32_t ble_gatts_write_authorize_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_write_authorize_params_t * p_params = + (ble_gatts_write_authorize_params_t *) p_void_struct; + uint32_t error_code = NRF_SUCCESS; + + error_code = uint16_t_enc(&(p_params->gatt_status), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + return error_code; +} + +uint32_t ble_gatts_write_authorize_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + ble_gatts_write_authorize_params_t * p_params = + (ble_gatts_write_authorize_params_t *) p_void_struct; + uint32_t error_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &p_params->gatt_status); + + return error_code; +} + +uint32_t ble_gatts_rw_authorize_reply_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_rw_authorize_reply_params_t const * const p_params = + (ble_gatts_rw_authorize_reply_params_t * ) p_void_struct; + uint32_t error_code = NRF_SUCCESS; + + error_code = uint8_t_enc(&(p_params->type), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + if (p_params->type == BLE_GATTS_AUTHORIZE_TYPE_READ) + { + error_code = ble_gatts_read_authorize_params_t_enc(&p_params->params.read, + p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + } + else if (p_params->type == BLE_GATTS_AUTHORIZE_TYPE_WRITE) + { + error_code = ble_gatts_write_authorize_params_t_enc(&p_params->params.write, + p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + } + else + { + return NRF_ERROR_INVALID_PARAM; + } + + return error_code; +} + +uint32_t ble_gatts_rw_authorize_reply_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + ble_gatts_rw_authorize_reply_params_t * p_params = + (ble_gatts_rw_authorize_reply_params_t *) p_void_struct; + uint32_t error_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + uint8_dec(p_buf, buf_len, p_index, &(p_params->type)); + + if (p_params->type == BLE_GATTS_AUTHORIZE_TYPE_READ) + { + error_code = ble_gatts_read_authorize_params_t_dec(p_buf, buf_len, p_index, + &p_params->params.read); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + } + else if (p_params->type == BLE_GATTS_AUTHORIZE_TYPE_WRITE) + { + error_code = ble_gatts_write_authorize_params_t_dec(p_buf, buf_len, p_index, + &p_params->params.write); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + } + else + { + return NRF_ERROR_INVALID_PARAM; + } + + return error_code; +} + +uint32_t ble_gatts_enable_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_enable_params_t * p_enable_params = (ble_gatts_enable_params_t *)p_void_struct; + uint32_t err_code = NRF_SUCCESS; + uint8_t temp8; + + temp8 = (p_enable_params->service_changed & 0x01); + + err_code = uint8_t_enc((void *) &temp8, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gatts_enable_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + ble_gatts_enable_params_t * p_enable_params = (ble_gatts_enable_params_t *)p_void_struct; + uint32_t err_code = NRF_SUCCESS; + uint8_t temp8; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, (void *) &temp8); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_enable_params->service_changed = temp8 & 0x01; + + return err_code; +} + +uint32_t ble_gatts_value_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_value_t * p_value = (ble_gatts_value_t *)p_void_struct; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc((void *) &(p_value->len), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *) &(p_value->offset), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = buf_enc(p_value->p_value, p_value->len, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gatts_value_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + ble_gatts_value_t * p_value = (ble_gatts_value_t *)p_void_struct; + uint32_t err_code = NRF_SUCCESS; + uint16_t total_len = p_value->len; + + err_code = uint16_t_dec(p_buf, buf_len, p_index, (void *) &(p_value->len)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, buf_len, p_index, (void *) &(p_value->offset)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = buf_dec(p_buf, buf_len, p_index, &(p_value->p_value), total_len, p_value->len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} diff --git a/components/serialization/common/struct_ser/s120/ble_gatts_struct_serialization.h b/components/serialization/common/struct_ser/s120/ble_gatts_struct_serialization.h new file mode 100644 index 0000000..6139d9e --- /dev/null +++ b/components/serialization/common/struct_ser/s120/ble_gatts_struct_serialization.h @@ -0,0 +1,170 @@ +/* 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 BLE_GATTS_STRUCT_SERIALIZATION_H +#define BLE_GATTS_STRUCT_SERIALIZATION_H + +#include "ble_gatts.h" + +uint32_t ser_ble_gatts_char_pf_enc(void const * const p_void_char_pf, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ser_ble_gatts_char_pf_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_char_pf); + +uint32_t ble_gatts_attr_md_enc(void const * const p_void_attr_md, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_attr_md_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_attr_md); + +uint32_t ble_gatts_char_md_enc(void const * const p_void_char_md, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_char_md_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_char_md); + +uint32_t ble_gatts_attr_enc(void const * const p_void_gatts_attr, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_attr_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_gatts_attr); + +uint32_t ble_gatts_char_handles_enc(void const * const p_void_char_handles, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_char_handles_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_char_handles); + +uint32_t ble_gatts_attr_context_t_enc(void const * const p_void_attr_context, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_attr_context_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_attr_context); + +uint32_t ble_gatts_evt_write_t_enc(void const * const p_void_write, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_evt_write_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_struct_len, + void * const p_void_write); + +uint32_t ble_gatts_hvx_params_t_enc(void const * const p_void_hvx_params, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_hvx_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_hvx_params); + +uint32_t ble_gatts_evt_read_t_enc(void const * const p_void_read, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_evt_read_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_struct_len, + void * const p_void_read); + +uint32_t ble_gatts_evt_rw_authorize_request_t_enc(void const * const p_void_authorize_request, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_evt_rw_authorize_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_struct_size, + void * const p_void_authorize_request); + +uint32_t ble_gatts_read_authorize_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_read_authorize_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gatts_write_authorize_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_write_authorize_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gatts_rw_authorize_reply_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_rw_authorize_reply_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gatts_enable_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_enable_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gatts_value_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_value_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +#endif /* BLE_GATTS_STRUCT_SERIALIZATION_H */ diff --git a/components/serialization/common/struct_ser/s120/ble_struct_serialization.c b/components/serialization/common/struct_ser/s120/ble_struct_serialization.c new file mode 100644 index 0000000..264571f --- /dev/null +++ b/components/serialization/common/struct_ser/s120/ble_struct_serialization.c @@ -0,0 +1,276 @@ +/* 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 "ble_struct_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "ble_serialization.h" +#include "app_util.h" +#include "ble_types.h" +#include "ble_l2cap.h" +#include "ble.h" +#include "cond_field_serialization.h" +#include + + +uint32_t ble_uuid_t_enc(void const * const p_void_uuid, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_uuid_t * p_uuid = (ble_uuid_t *)p_void_uuid; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&p_uuid->uuid, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&p_uuid->type, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_uuid_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_uuid) +{ + ble_uuid_t * p_uuid = (ble_uuid_t *)p_void_uuid; + + SER_ASSERT_LENGTH_LEQ(3, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &p_uuid->uuid); + uint8_dec(p_buf, buf_len, p_index, &p_uuid->type); + + return NRF_SUCCESS; +} + +uint32_t ble_uuid128_t_enc(void const * const p_void_uuid, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_uuid128_t * p_uuid = (ble_uuid128_t *)p_void_uuid; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(16, buf_len - *p_index); + + memcpy(&p_buf[*p_index], p_uuid->uuid128, sizeof (p_uuid->uuid128)); + + *p_index += sizeof (p_uuid->uuid128); + + return err_code; +} + +uint32_t ble_uuid128_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_uuid) +{ + ble_uuid128_t * p_uuid = (ble_uuid128_t *)p_void_uuid; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(16, buf_len - *p_index); + + memcpy(p_uuid->uuid128, &p_buf[*p_index], sizeof (p_uuid->uuid128)); + + *p_index += sizeof (p_uuid->uuid128); + + return err_code; +} + +uint32_t ble_l2cap_header_t_enc(void const * const p_void_header, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_header); + + ble_l2cap_header_t * p_header = (ble_l2cap_header_t *)p_void_header; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&(p_header->len), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_header->cid), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_l2cap_header_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_header) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_header); + + ble_l2cap_header_t * p_header = (ble_l2cap_header_t *)p_void_header; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_header->len)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_header->cid)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_l2cap_evt_rx_t_enc(void const * const p_void_evt_rx, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_evt_rx); + + ble_l2cap_evt_rx_t * p_evt_rx = (ble_l2cap_evt_rx_t *)p_void_evt_rx; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_l2cap_header_t_enc(&(p_evt_rx->header), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(p_evt_rx->header.len, buf_len - *p_index); + memcpy(&p_buf[*p_index], p_evt_rx->data, p_evt_rx->header.len); + *p_index += p_evt_rx->header.len; + + return err_code; +} + +uint32_t ble_l2cap_evt_rx_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_struct_len, + void * const p_void_evt_rx) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_struct_len); + + ble_l2cap_evt_rx_t * p_evt_rx = (ble_l2cap_evt_rx_t *)p_void_evt_rx; + uint32_t err_code = NRF_SUCCESS; + + uint32_t total_struct_len = *p_struct_len; + + /* Get data length */ + uint32_t tmp_index = *p_index; + uint16_t len = 0; + + err_code = uint16_t_dec(p_buf, buf_len, &tmp_index, &len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + /* Update struct length */ + *p_struct_len = offsetof(ble_l2cap_evt_rx_t, data[0]); + *p_struct_len += (uint8_t*)&p_evt_rx->data[len] - (uint8_t*)&p_evt_rx->data[0]; + + /* Decode header and copy data */ + if (p_void_evt_rx != NULL) + { + SER_ASSERT_LENGTH_LEQ(*p_struct_len, total_struct_len); + + err_code = ble_l2cap_header_t_dec(p_buf, buf_len, p_index, &(p_evt_rx->header)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(p_evt_rx->header.len, buf_len - *p_index); + memcpy(p_evt_rx->data, &p_buf[*p_index], p_evt_rx->header.len); + *p_index += p_evt_rx->header.len; + } + + return err_code; +} + +uint32_t ble_enable_params_t_enc(void const * const p_void_enable_params, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_enable_params); + + ble_enable_params_t * p_enable_params = (ble_enable_params_t *)p_void_enable_params; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_enable_params_t_enc(&p_enable_params->gap_enable_params, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gatts_enable_params_t_enc(&p_enable_params->gatts_enable_params, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_enable_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_enable_params) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_enable_params); + + ble_enable_params_t * p_enable_params = (ble_enable_params_t *)p_void_enable_params; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_enable_params_t_dec(p_buf, buf_len, p_index, &(p_enable_params->gap_enable_params)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gatts_enable_params_t_dec(p_buf, buf_len, p_index, &(p_enable_params->gatts_enable_params)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_common_opt_radio_cpu_mutex_t_enc(void const * const p_void_opt_mutex, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_opt_mutex); + + ble_common_opt_radio_cpu_mutex_t * p_radio_cpu_mutex = (ble_common_opt_radio_cpu_mutex_t *)p_void_opt_mutex; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + byte = p_radio_cpu_mutex->enable; + err_code = uint8_t_enc(&byte, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_common_opt_radio_cpu_mutex_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_opt_mutex) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_opt_mutex); + + ble_common_opt_radio_cpu_mutex_t * p_radio_cpu_mutex = (ble_common_opt_radio_cpu_mutex_t *)p_void_opt_mutex; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &byte); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_radio_cpu_mutex->enable = byte & 0x01; + + return err_code; +} diff --git a/components/serialization/common/struct_ser/s120/ble_struct_serialization.h b/components/serialization/common/struct_ser/s120/ble_struct_serialization.h new file mode 100644 index 0000000..032bdd9 --- /dev/null +++ b/components/serialization/common/struct_ser/s120/ble_struct_serialization.h @@ -0,0 +1,75 @@ +/* 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 "ble_types.h" + + +uint32_t ble_uuid_t_enc(void const * const p_void_uuid, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_uuid_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_uuid); + +uint32_t ble_uuid128_t_enc(const void * const p_void_uuid, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_uuid128_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_uuid); + +uint32_t ble_l2cap_header_t_enc(void const * const p_void_header, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_l2cap_header_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_header); + +uint32_t ble_l2cap_evt_rx_t_enc(void const * const p_void_evt_rx, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_l2cap_evt_rx_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_event_len, + void * const p_void_evt_rx); + +uint32_t ble_enable_params_t_enc(void const * const p_void_enable_params, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_enable_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_enable_params); + +uint32_t ble_common_opt_radio_cpu_mutex_t_enc(void const * const p_void_opt_mutex, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_common_opt_radio_cpu_mutex_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_opt_mutex); diff --git a/components/serialization/common/struct_ser/s130/ble_gap_struct_serialization.c b/components/serialization/common/struct_ser/s130/ble_gap_struct_serialization.c new file mode 100644 index 0000000..7f180c4 --- /dev/null +++ b/components/serialization/common/struct_ser/s130/ble_gap_struct_serialization.c @@ -0,0 +1,1363 @@ +/* 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 "ble_gap_struct_serialization.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" +#include "string.h" + +uint32_t ble_gap_irk_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_irk_t * p_gap_irk = (ble_gap_irk_t *)p_data; + + SER_ASSERT_LENGTH_LEQ(BLE_GAP_SEC_KEY_LEN, buf_len - *p_index); + + memcpy(&p_buf[*p_index], p_gap_irk->irk, BLE_GAP_SEC_KEY_LEN); + + *p_index += BLE_GAP_SEC_KEY_LEN; + + return NRF_SUCCESS; +} + +uint32_t ble_gap_irk_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + ble_gap_irk_t * p_gap_irk = (ble_gap_irk_t *)p_data; + + SER_ASSERT_LENGTH_LEQ(BLE_GAP_SEC_KEY_LEN, buf_len - *p_index); + + memcpy(p_gap_irk->irk, &p_buf[*p_index], BLE_GAP_SEC_KEY_LEN); + + *p_index += BLE_GAP_SEC_KEY_LEN; + + return NRF_SUCCESS; +} + +uint32_t ble_gap_addr_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_addr_t * p_addr = (ble_gap_addr_t *)p_data; + + SER_ASSERT_LENGTH_LEQ(1 + BLE_GAP_ADDR_LEN, buf_len - *p_index); + + p_buf[*p_index] = p_addr->addr_type; + (*p_index)++; + memcpy(&p_buf[*p_index], p_addr->addr, BLE_GAP_ADDR_LEN); + *p_index += BLE_GAP_ADDR_LEN; + + return NRF_SUCCESS; +} + +uint32_t ble_gap_addr_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_addr) +{ + ble_gap_addr_t * p_address = (ble_gap_addr_t *) p_addr; + + SER_ASSERT_LENGTH_LEQ(1 + BLE_GAP_ADDR_LEN, (int32_t)buf_len - *p_index); + + p_address->addr_type = p_buf[*p_index]; + (*p_index)++; + memcpy(p_address->addr, &p_buf[*p_index], BLE_GAP_ADDR_LEN); + *p_index += BLE_GAP_ADDR_LEN; + + return NRF_SUCCESS; +} + +uint32_t ble_gap_sec_levels_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_sec_levels_t * p_sec_levels = (ble_gap_sec_levels_t *)p_data; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + + p_buf[*p_index] = (p_sec_levels->lv1 << 0) | (p_sec_levels->lv2 << 1) | (p_sec_levels->lv3 << 2); + (*p_index)++; + + return NRF_SUCCESS; +} + +uint32_t ble_gap_sec_levels_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + ble_gap_sec_levels_t * p_sec_levels = (ble_gap_sec_levels_t *)p_data; + uint32_t err_code; + uint32_t uint8_temp; + + SER_ASSERT_LENGTH_LEQ(sizeof (ble_gap_sec_levels_t), buf_len - *p_index); + + err_code = uint8_t_dec(p_buf, buf_len, p_index, (void *) &(uint8_temp)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + p_sec_levels->lv1 = uint8_temp & 0x01; + p_sec_levels->lv2 = (uint8_temp >> 1) & 0x01; + p_sec_levels->lv3 = (uint8_temp >> 2) & 0x01; + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_sec_keys_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_sec_keys_t * p_sec_keys = (ble_gap_sec_keys_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = cond_field_enc(p_sec_keys->p_enc_key, p_buf, buf_len, p_index, ble_gap_enc_key_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_sec_keys->p_id_key, p_buf, buf_len, p_index, ble_gap_id_key_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_sec_keys->p_sign_key, p_buf, buf_len, p_index, ble_gap_sign_info_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_sec_keys_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + ble_gap_sec_keys_t * p_sec_keys = (ble_gap_sec_keys_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = cond_field_dec(p_buf, buf_len, p_index, (void * *)&(p_sec_keys->p_enc_key), ble_gap_enc_key_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, buf_len, p_index, (void * *)&(p_sec_keys->p_id_key), ble_gap_id_key_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, buf_len, p_index, (void * *)&(p_sec_keys->p_sign_key), ble_gap_sign_info_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_enc_info_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t err_code = NRF_SUCCESS; + ble_gap_enc_info_t * p_enc_info = (ble_gap_enc_info_t *)p_data; + + SER_ASSERT_LENGTH_LEQ(BLE_GAP_SEC_KEY_LEN + 1, buf_len - *p_index); + + memcpy(&p_buf[*p_index], p_enc_info->ltk, BLE_GAP_SEC_KEY_LEN); + *p_index += BLE_GAP_SEC_KEY_LEN; + + p_buf[*p_index] = p_enc_info->auth & 0x01; + p_buf[*p_index] |= (p_enc_info->ltk_len & 0x7F) << 1; + (*p_index)++; + + return err_code; +} + +uint32_t ble_gap_enc_info_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_enc_infox) +{ + ble_gap_enc_info_t * p_enc_info = (ble_gap_enc_info_t *)p_enc_infox; + + SER_ASSERT_LENGTH_LEQ(BLE_GAP_SEC_KEY_LEN, buf_len - *p_index); + memcpy(p_enc_info->ltk, &p_buf[*p_index], BLE_GAP_SEC_KEY_LEN); + *p_index += BLE_GAP_SEC_KEY_LEN; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + p_enc_info->auth = p_buf[*p_index] & 0x01; + p_enc_info->ltk_len = (p_buf[*p_index] >> 1) & 0x7F; + *p_index += 1; + + return NRF_SUCCESS; +} + +uint32_t ble_gap_sign_info_enc(void const * const p_sign_info, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_LENGTH_LEQ(sizeof (ble_gap_sign_info_t), buf_len - *p_index); + memcpy(&p_buf[*p_index], p_sign_info, sizeof (ble_gap_sign_info_t)); + *p_index += sizeof (ble_gap_sign_info_t); + + return NRF_SUCCESS; +} + +uint32_t ble_gap_sign_info_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_sign_info) +{ + SER_ASSERT_LENGTH_LEQ(sizeof (ble_gap_sign_info_t), buf_len - *p_index); + memcpy(p_sign_info, &p_buf[*p_index], sizeof (ble_gap_sign_info_t)); + *p_index += sizeof (ble_gap_sign_info_t); + + return NRF_SUCCESS; +} + +uint32_t ble_gap_evt_auth_status_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + ble_gap_evt_auth_status_t * p_auth_status = (ble_gap_evt_auth_status_t *)p_data; + + SER_ASSERT_LENGTH_LEQ(6, buf_len - *p_index); + + err_code = uint8_t_enc(&(p_auth_status->auth_status), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + byte = (p_auth_status->error_src) | ((p_auth_status->bonded) << 2); + + err_code = uint8_t_enc(&byte, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_levels_enc(&(p_auth_status->sm1_levels), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_levels_enc(&(p_auth_status->sm2_levels), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_kdist_t_enc(&(p_auth_status->kdist_periph), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_kdist_t_enc(&(p_auth_status->kdist_central), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_evt_auth_status_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + + ble_gap_evt_auth_status_t * p_auth_status = (ble_gap_evt_auth_status_t *)p_data; + uint32_t err_code; + uint8_t byte; + + SER_ASSERT_LENGTH_LEQ(6, buf_len - *p_index); + SER_ASSERT_NOT_NULL(p_auth_status); + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &(p_auth_status->auth_status)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &byte); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_auth_status->error_src = byte & 0x03; + p_auth_status->bonded = (byte >> 2) & 0x01 ; + + err_code = ble_gap_sec_levels_dec(p_buf, buf_len, p_index, &(p_auth_status->sm1_levels)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_levels_dec(p_buf, buf_len, p_index, &(p_auth_status->sm2_levels)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_kdist_t_dec(p_buf, buf_len, p_index, &(p_auth_status->kdist_periph)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_kdist_t_dec(p_buf, buf_len, p_index, &(p_auth_status->kdist_central)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + + +uint32_t ble_gap_conn_sec_mode_enc(void const * const p_void_sec_mode, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_conn_sec_mode_t * p_sec_mode = (ble_gap_conn_sec_mode_t *)p_void_sec_mode; + uint32_t err_code = NRF_SUCCESS; + uint8_t temp8 = p_sec_mode->sm | (p_sec_mode->lv << 4); + + err_code = uint8_t_enc(&temp8, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_conn_sec_mode_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_sec_mode) +{ + ble_gap_conn_sec_mode_t * p_sec_mode = (ble_gap_conn_sec_mode_t *)p_void_sec_mode; + uint32_t err_code = NRF_SUCCESS; + uint8_t temp8; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + uint8_dec(p_buf, buf_len, p_index, &temp8); + + p_sec_mode->sm = temp8; + p_sec_mode->lv = temp8 >> 4; + + return err_code; +} + +uint32_t ble_gap_evt_conn_sec_update_t_enc(void const * const p_void_conn_sec_update, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + return ble_gap_conn_sec_t_enc(p_void_conn_sec_update, p_buf, buf_len, p_index); +} + +uint32_t ble_gap_evt_conn_sec_update_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_conn_sec_update) +{ + return ble_gap_conn_sec_t_dec(p_buf, buf_len, p_index, p_void_conn_sec_update); +} + +uint32_t ble_gap_conn_sec_t_enc(void const * const p_void_sec, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_conn_sec_t * p_conn_sec = (ble_gap_conn_sec_t *)p_void_sec; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_conn_sec_mode_enc(&p_conn_sec->sec_mode, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&p_conn_sec->encr_key_size, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_conn_sec_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_sec) +{ + ble_gap_conn_sec_t * p_conn_sec = (ble_gap_conn_sec_t *)p_void_sec; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_conn_sec_mode_dec(p_buf, buf_len, p_index, &p_conn_sec->sec_mode); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + uint8_dec(p_buf, buf_len, p_index, &p_conn_sec->encr_key_size); + + return err_code; +} + +uint32_t ble_gap_evt_sec_info_request_t_enc(void const * const p_void_sec_info_request, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_evt_sec_info_request_t * p_conn_sec = + (ble_gap_evt_sec_info_request_t *)p_void_sec_info_request; + + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_addr_enc(&p_conn_sec->peer_addr, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_master_id_t_enc(&p_conn_sec->master_id, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + uint8_t temp8 = p_conn_sec->enc_info | + (p_conn_sec->id_info << 1) | + (p_conn_sec->sign_info << 2); + + err_code = uint8_t_enc(&temp8, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_evt_sec_info_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_sec_info_request) +{ + ble_gap_evt_sec_info_request_t * p_conn_sec = (ble_gap_evt_sec_info_request_t *)p_void_sec_info_request; + uint32_t err_code = NRF_SUCCESS; + uint8_t temp8; + + err_code = ble_gap_addr_dec(p_buf, buf_len, p_index, &(p_conn_sec->peer_addr)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_master_id_t_dec(p_buf, buf_len, p_index, &(p_conn_sec->master_id)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, buf_len, p_index, (void *) &temp8); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + p_conn_sec->enc_info = temp8 & 0x01; + p_conn_sec->id_info = (temp8 >> 1) & 0x01; + p_conn_sec->sign_info = (temp8 >> 2) & 0x01; + + return err_code; +} + +uint32_t ble_gap_evt_connected_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_evt_connected_t * p_evt_conn = (ble_gap_evt_connected_t *)p_void_struct; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte = 0; + + err_code = ble_gap_addr_enc((void *)&p_evt_conn->peer_addr, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_addr_enc((void *)&p_evt_conn->own_addr, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&(p_evt_conn->role), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + byte = p_evt_conn->irk_match | (p_evt_conn->irk_match_idx << 1); + err_code = uint8_t_enc(&byte, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_conn_params_t_enc((void *)&p_evt_conn->conn_params, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_evt_connected_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_connected) +{ + ble_gap_evt_connected_t * p_evt_conn = (ble_gap_evt_connected_t *)p_void_connected; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte = 0; + + err_code = ble_gap_addr_dec(p_buf, buf_len, p_index, &(p_evt_conn->peer_addr)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_addr_dec(p_buf, buf_len, p_index, &(p_evt_conn->own_addr)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &(p_evt_conn->role)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &byte); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_evt_conn->irk_match = byte & 0x01; + p_evt_conn->irk_match_idx = (byte & 0xFE) >> 1; + + err_code = ble_gap_conn_params_t_dec(p_buf, buf_len, p_index, &(p_evt_conn->conn_params)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_sec_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_sec_params_t * p_sec_params = (ble_gap_sec_params_t *)p_void_struct; + uint32_t err_code = NRF_SUCCESS; + uint8_t temp8; + + temp8 = (p_sec_params->bond & 0x01) | + ((p_sec_params->mitm & 0x01) << 1) | + ((p_sec_params->io_caps & 0x07) << 2) | + ((p_sec_params->oob & 0x01) << 5); + + err_code = uint8_t_enc((void *) &temp8, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc((void *) &(p_sec_params->min_key_size), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc((void *) &(p_sec_params->max_key_size), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_kdist_t_enc((void *) &(p_sec_params->kdist_periph), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_kdist_t_enc((void *) &(p_sec_params->kdist_central), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_sec_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + ble_gap_sec_params_t * p_sec_params = (ble_gap_sec_params_t *)p_void_struct; + uint32_t err_code = NRF_SUCCESS; + uint8_t temp8; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, (void *) &temp8); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_sec_params->bond = temp8 & 0x01; + p_sec_params->mitm = (temp8 >> 1) & 0x01; + p_sec_params->io_caps = (temp8 >> 2) & 0x07; + p_sec_params->oob = (temp8 >> 5) & 0x01; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, (void *) &(p_sec_params->min_key_size)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, buf_len, p_index, (void *) &(p_sec_params->max_key_size)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_kdist_t_dec(p_buf, buf_len, p_index, (void *) &(p_sec_params->kdist_periph)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_kdist_t_dec(p_buf, buf_len, p_index, (void *) &(p_sec_params->kdist_central)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_enable_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ +// ble_gap_enable_params_t * p_enable_params = (ble_gap_enable_params_t *)p_void_struct; + uint32_t err_code = NRF_SUCCESS; + uint8_t temp8 = 0; + +// temp8 = (p_enable_params->role & 0x03); + + err_code = uint8_t_enc((void *) &temp8, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_enable_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ +// ble_gap_enable_params_t * p_enable_params = (ble_gap_enable_params_t *)p_void_struct; + uint32_t err_code = NRF_SUCCESS; + uint8_t temp8 = 0; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, (void *) &temp8); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); +// p_enable_params->role = temp8 & 0x03; + + return err_code; +} + +uint32_t ble_gap_evt_sec_params_request_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + return ble_gap_sec_params_t_enc(p_void_struct, p_buf, buf_len, p_index); +} + + uint32_t ble_gap_evt_sec_params_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) + { + return ble_gap_sec_params_t_dec(p_buf, buf_len, p_index, p_void_struct); + } + +uint32_t ble_gap_evt_conn_param_update_t_enc(void const * const p_void_evt_conn_param_update, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + return ble_gap_conn_params_t_enc(p_void_evt_conn_param_update, p_buf, buf_len, p_index); +} + +uint32_t ble_gap_evt_conn_param_update_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_evt_conn_param_update) +{ + return ble_gap_conn_params_t_dec(p_buf, buf_len, p_index, p_void_evt_conn_param_update); +} + +uint32_t ble_gap_evt_conn_param_update_request_t_enc(void const * const p_void_evt_conn_param_update_request, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + return ble_gap_conn_params_t_enc(p_void_evt_conn_param_update_request, p_buf, buf_len, p_index); +} + +uint32_t ble_gap_evt_conn_param_update_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_evt_conn_param_update_request) +{ + return ble_gap_conn_params_t_dec(p_buf, buf_len, p_index, p_void_evt_conn_param_update_request); +} + +uint32_t ble_gap_conn_params_t_enc(void const * const p_void_conn_params, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_conn_params_t * p_conn_params = (ble_gap_conn_params_t *)p_void_conn_params; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&p_conn_params->min_conn_interval, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_conn_params->max_conn_interval, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_conn_params->slave_latency, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_conn_params->conn_sup_timeout, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_conn_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_conn_params) +{ + ble_gap_conn_params_t * p_conn_params = (ble_gap_conn_params_t *)p_void_conn_params; + + SER_ASSERT_LENGTH_LEQ(*p_index + 2, buf_len); + uint16_dec(p_buf, buf_len, p_index, &p_conn_params->min_conn_interval); + + SER_ASSERT_LENGTH_LEQ(*p_index + 2, buf_len); + uint16_dec(p_buf, buf_len, p_index, &p_conn_params->max_conn_interval); + + SER_ASSERT_LENGTH_LEQ(*p_index + 2, buf_len); + uint16_dec(p_buf, buf_len, p_index, &p_conn_params->slave_latency); + + SER_ASSERT_LENGTH_LEQ(*p_index + 2, buf_len); + uint16_dec(p_buf, buf_len, p_index, &p_conn_params->conn_sup_timeout); + + return NRF_SUCCESS; +} + +uint32_t ble_gap_evt_disconnected_t_enc(void const * const p_void_disconnected, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_evt_disconnected_t * p_disconnected = (ble_gap_evt_disconnected_t *)p_void_disconnected; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint8_t_enc(&p_disconnected->reason, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_evt_disconnected_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_disconnected) +{ + ble_gap_evt_disconnected_t * p_disconnected = (ble_gap_evt_disconnected_t *)p_void_disconnected; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + uint8_dec(p_buf, buf_len, p_index, &p_disconnected->reason); + + return err_code; +} + +uint32_t ble_gap_master_id_t_enc(void const * const p_master_idx, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gap_master_id_t * p_master_id = (ble_gap_master_id_t *) p_master_idx; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&(p_master_id->ediv), p_buf, buf_len, p_index); + + SER_ASSERT_LENGTH_LEQ(BLE_GAP_SEC_RAND_LEN, buf_len - *p_index); + memcpy(&p_buf[*p_index], p_master_id->rand, BLE_GAP_SEC_RAND_LEN); + *p_index += BLE_GAP_SEC_RAND_LEN; + + return err_code; +} + +uint32_t ble_gap_master_id_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_master_idx) +{ + ble_gap_master_id_t *p_master_id = (ble_gap_master_id_t *)p_master_idx; + + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_master_id->ediv)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(BLE_GAP_SEC_RAND_LEN, buf_len - *p_index); + memcpy(p_master_id->rand, &p_buf[*p_index], BLE_GAP_SEC_RAND_LEN); + *p_index += BLE_GAP_SEC_RAND_LEN; + + return err_code; +} + +uint32_t ble_gap_whitelist_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_whitelist_t *p_whitelist = (ble_gap_whitelist_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + uint32_t i = 0; + + SER_ERROR_CHECK(p_whitelist->addr_count <= BLE_GAP_WHITELIST_ADDR_MAX_COUNT, + NRF_ERROR_INVALID_PARAM); + SER_ERROR_CHECK(p_whitelist->irk_count <= BLE_GAP_WHITELIST_IRK_MAX_COUNT, + NRF_ERROR_INVALID_PARAM); + + err_code = uint8_t_enc(&(p_whitelist->addr_count), p_buf, buf_len, p_index); + + err_code = cond_field_enc(p_whitelist->pp_addrs, p_buf, buf_len, p_index, NULL); + + for (i = 0; i < p_whitelist->addr_count; i++) + { + err_code = cond_field_enc(p_whitelist->pp_addrs[i], p_buf, buf_len, p_index, ble_gap_addr_enc); + } + + err_code = uint8_t_enc(&(p_whitelist->irk_count), p_buf, buf_len, p_index); + + err_code = cond_field_enc(p_whitelist->pp_irks, p_buf, buf_len, p_index, NULL); + + for (i = 0; i < p_whitelist->irk_count; i++) + { + err_code = cond_field_enc(p_whitelist->pp_irks[i], p_buf, buf_len, p_index, ble_gap_irk_enc); + } + + return err_code; +} + +uint32_t ble_gap_whitelist_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * p_data) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_whitelist_t * p_whitelist = (ble_gap_whitelist_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + uint32_t i = 0; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &(p_whitelist->addr_count)); + SER_ERROR_CHECK(p_whitelist->addr_count <= BLE_GAP_WHITELIST_ADDR_MAX_COUNT, + NRF_ERROR_INVALID_LENGTH); + + err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_whitelist->pp_addrs), NULL); + + for (i = 0; i < p_whitelist->addr_count; i++) + { + err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_whitelist->pp_addrs[i]), ble_gap_addr_dec); + } + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &(p_whitelist->irk_count)); + SER_ERROR_CHECK(p_whitelist->irk_count <= BLE_GAP_WHITELIST_IRK_MAX_COUNT, + NRF_ERROR_INVALID_LENGTH); + + err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_whitelist->pp_irks), NULL); + + for (i = 0; i < p_whitelist->irk_count; i++) + { + err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_whitelist->pp_irks[i]), ble_gap_irk_dec); + } + + return err_code; +} + +uint32_t ble_gap_scan_params_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_scan_params_t * p_scan_params = (ble_gap_scan_params_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + p_buf[*p_index] = p_scan_params->active & 0x01; + p_buf[*p_index] |= (p_scan_params->selective & 0x7F) << 1; + (*p_index)++; + + err_code = cond_field_enc(p_scan_params->p_whitelist, p_buf, buf_len, p_index, ble_gap_whitelist_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_scan_params->interval), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_scan_params->window), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_scan_params->timeout), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_scan_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_scan_params_t * p_scan_params = (ble_gap_scan_params_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + p_scan_params->active = p_buf[*p_index] & 0x01; + p_scan_params->selective = (p_buf[*p_index] >> 1) & 0x7F; + (*p_index)++; + + err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_scan_params->p_whitelist), ble_gap_whitelist_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_scan_params->interval)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_scan_params->window)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_scan_params->timeout)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_enc_key_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_enc_key_t * p_enc_key = (ble_gap_enc_key_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_enc_info_enc(&(p_enc_key->enc_info), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_master_id_t_enc(&(p_enc_key->master_id), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_enc_key_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_enc_key_t * p_enc_key = (ble_gap_enc_key_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_enc_info_dec(p_buf, buf_len, p_index, &(p_enc_key->enc_info)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_master_id_t_dec(p_buf, buf_len, p_index, &(p_enc_key->master_id)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} +uint32_t ble_gap_id_key_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_id_key_t * p_id_key = (ble_gap_id_key_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_irk_enc(&(p_id_key->id_info), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_addr_enc(&(p_id_key->id_addr_info), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_id_key_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_id_key_t * p_id_key = (ble_gap_id_key_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_irk_dec(p_buf, buf_len, p_index, &(p_id_key->id_info)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_addr_dec(p_buf, buf_len, p_index, &(p_id_key->id_addr_info)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_sec_keyset_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_sec_keyset_t * p_sec_keyset = (ble_gap_sec_keyset_t *) p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_sec_keys_enc(&(p_sec_keyset->keys_periph), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_keys_enc(&(p_sec_keyset->keys_central), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_sec_keyset_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_sec_keyset_t * p_sec_keyset = (ble_gap_sec_keyset_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_sec_keys_dec(p_buf, buf_len, p_index, &(p_sec_keyset->keys_periph)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_keys_dec(p_buf, buf_len, p_index, &(p_sec_keyset->keys_central)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_evt_sec_request_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_evt_sec_request_t * p_evt_sec_request = (ble_gap_evt_sec_request_t *)p_void_struct; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + + p_buf[*p_index] = p_evt_sec_request->bond & 0x01; + p_buf[*p_index] |= (p_evt_sec_request->mitm & 0x01) << 1; + (*p_index)++; + + return err_code; +} + +uint32_t ble_gap_evt_sec_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_evt_sec_request_t * p_sec_request = (ble_gap_evt_sec_request_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + p_sec_request->bond = p_buf[*p_index] & 0x01; + p_sec_request->mitm = (p_buf[*p_index] >> 1) & 0x01; + *p_index += 1; + + return err_code; +} + +uint32_t ble_gap_sec_kdist_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_sec_kdist_t * p_sec_kdist = (ble_gap_sec_kdist_t *) p_data; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + + p_buf[*p_index] = p_sec_kdist->enc & 0x01; + p_buf[*p_index] |= (p_sec_kdist->id & 0x01) << 1; + p_buf[*p_index] |= (p_sec_kdist->sign & 0x01) << 2; + (*p_index)++; + + return err_code; +} + +uint32_t ble_gap_sec_kdist_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_sec_kdist_t * p_sec_kdist = (ble_gap_sec_kdist_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + p_sec_kdist->enc = p_buf[*p_index] & 0x01; + p_sec_kdist->id = (p_buf[*p_index] >> 1) & 0x01; + p_sec_kdist->sign = (p_buf[*p_index] >> 2) & 0x01; + (*p_index)++; + + return err_code; +} + +uint32_t ble_gap_opt_ch_map_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_ch_map_t * p_gap_opt_ch_map = (ble_gap_opt_ch_map_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&p_gap_opt_ch_map->conn_handle, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(5, buf_len - *p_index); + memcpy(&p_buf[*p_index], p_gap_opt_ch_map->ch_map, 5); + + *p_index += 5; + + return err_code; +} + +uint32_t ble_gap_opt_ch_map_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_ch_map_t * p_gap_opt_ch_map = (ble_gap_opt_ch_map_t *)p_data; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &p_gap_opt_ch_map->conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(5, buf_len - *p_index); + memcpy(p_gap_opt_ch_map->ch_map, &p_buf[*p_index], 5); + + *p_index += 5; + + return err_code; +} + +uint32_t ble_gap_opt_local_conn_latency_t_enc(void const * const p_void_local_conn_latency, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_local_conn_latency_t * p_latency = + (ble_gap_opt_local_conn_latency_t *)p_void_local_conn_latency; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&(p_latency->conn_handle), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_latency->requested_latency), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_latency->p_actual_latency, p_buf, buf_len, p_index, uint16_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_opt_local_conn_latency_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_local_conn_latency) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_local_conn_latency_t * p_latency = + (ble_gap_opt_local_conn_latency_t *)p_void_local_conn_latency; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_latency->conn_handle)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_latency->requested_latency)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_latency->p_actual_latency), + uint16_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_opt_passkey_t_enc(void const * const p_void_passkey, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_passkey_t * p_opt_passkey = (ble_gap_opt_passkey_t *)p_void_passkey; + uint32_t err_code = NRF_SUCCESS; + uint16_t passkey_len = BLE_GAP_PASSKEY_LEN; + + err_code = buf_enc(p_opt_passkey->p_passkey, passkey_len, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_opt_passkey_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_passkey) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_passkey_t * p_opt_passkey = (ble_gap_opt_passkey_t *)p_void_passkey; + uint32_t err_code = NRF_SUCCESS; + uint16_t passkey_len = BLE_GAP_PASSKEY_LEN; + + err_code = buf_dec(p_buf, buf_len, p_index, &p_opt_passkey->p_passkey, passkey_len, + passkey_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_opt_privacy_t_enc(void const * const p_void_privacy, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_privacy_t * p_privacy = (ble_gap_opt_privacy_t *)p_void_privacy; + uint32_t err_code = NRF_SUCCESS; + + err_code = cond_field_enc(p_privacy->p_irk, p_buf, buf_len, p_index, ble_gap_irk_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_privacy->interval_s), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_opt_privacy_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_privacy) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_privacy_t * p_privacy = (ble_gap_opt_privacy_t *)p_void_privacy; + uint32_t err_code = NRF_SUCCESS; + + err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_privacy->p_irk), ble_gap_irk_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_privacy->interval_s)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_opt_scan_req_report_t_enc(void const * const p_void_scan_req_report, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_scan_req_report_t * p_scan_req_report = (ble_gap_opt_scan_req_report_t *)p_void_scan_req_report; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + byte = p_scan_req_report->enable; + err_code = uint8_t_enc(&byte, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_opt_scan_req_report_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_scan_req_report) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_scan_req_report_t * p_scan_req_report = (ble_gap_opt_scan_req_report_t *)p_void_scan_req_report; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &byte); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_scan_req_report->enable = byte & 0x01; + + return err_code; +} + +uint32_t ble_gap_opt_compat_mode_t_enc(void const * const p_void_compat_mode, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_compat_mode_t * p_compat_mode = (ble_gap_opt_compat_mode_t *)p_void_compat_mode; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte = 0; + + byte = p_compat_mode->mode_1_enable; + err_code = uint8_t_enc(&byte, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_opt_compat_mode_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_compat_mode) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_opt_compat_mode_t * p_compat_mode = (ble_gap_opt_compat_mode_t *)p_void_compat_mode; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte = 0; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &byte); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_compat_mode->mode_1_enable = byte & 0x01; + + return err_code; +} + +uint32_t ble_gap_adv_ch_mask_t_enc(void const * const p_void_ch_mask, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_adv_ch_mask_t * p_ch_mask = (ble_gap_adv_ch_mask_t *)p_void_ch_mask; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + byte = p_ch_mask->ch_37_off | + (p_ch_mask->ch_38_off << 1) | + (p_ch_mask->ch_39_off << 2); + err_code = uint8_t_enc(&byte, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_adv_ch_mask_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_ch_mask) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + ble_gap_adv_ch_mask_t * p_ch_mask = (ble_gap_adv_ch_mask_t *)p_void_ch_mask; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &byte); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_ch_mask->ch_37_off = byte & 0x01; + p_ch_mask->ch_38_off = (byte >> 1) & 0x01; + p_ch_mask->ch_39_off = (byte >> 2) & 0x01; + + return err_code; +} diff --git a/components/serialization/common/struct_ser/s130/ble_gap_struct_serialization.h b/components/serialization/common/struct_ser/s130/ble_gap_struct_serialization.h new file mode 100644 index 0000000..b5f06c2 --- /dev/null +++ b/components/serialization/common/struct_ser/s130/ble_gap_struct_serialization.h @@ -0,0 +1,353 @@ +/* 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 "ble_gap.h" + +uint32_t ble_gap_irk_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_irk_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_addr_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_addr_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_addr); + +uint32_t ble_gap_sec_levels_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_sec_levels_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_sec_keys_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_sec_keys_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_enc_info_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_enc_info_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_enc_info); + +uint32_t ble_gap_sign_info_enc(void const * const p_sign_info, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_sign_info_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_sign_info); + +uint32_t ble_gap_evt_auth_status_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_evt_auth_status_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_conn_sec_mode_enc(void const * const p_void_sec_mode, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_conn_sec_mode_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_sec_mode); + +uint32_t ble_gap_conn_sec_t_enc(void const * const p_void_sec, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_conn_sec_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_sec); + +uint32_t ble_gap_evt_conn_sec_update_t_enc(void const * const p_void_conn_sec_update, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_evt_conn_sec_update_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_conn_sec_update); + +uint32_t ble_gap_evt_sec_info_request_t_enc(void const * const p_void_sec_info_request, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_evt_sec_info_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_sec_info_request); + +uint32_t ble_gap_evt_connected_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_evt_connected_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_connected); + +uint32_t ble_gap_sec_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_sec_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gap_enable_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_enable_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gap_evt_sec_params_request_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_evt_sec_params_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gap_conn_params_t_enc(void const * const p_void_conn_params, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_conn_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_conn_params); + +uint32_t ble_gap_evt_conn_param_update_t_enc(void const * const p_void_evt_conn_param_update, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_evt_conn_param_update_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_evt_conn_param_update); + +uint32_t ble_gap_evt_conn_param_update_request_t_enc(void const * const p_void_evt_conn_param_update_request, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_evt_conn_param_update_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_evt_conn_param_update_request); + +uint32_t ble_gap_evt_disconnected_t_enc(void const * const p_void_disconnected, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_evt_disconnected_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_disconnected); + +uint32_t ble_gap_whitelist_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_whitelist_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * p_data); + +uint32_t ble_gap_scan_params_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_scan_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_master_id_t_enc(void const * const p_master_idx, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_master_id_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_master_idx); + +uint32_t ble_gap_enc_key_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_enc_key_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_id_key_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_id_key_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_sec_keyset_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_sec_keyset_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_evt_sec_request_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_evt_sec_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_sec_kdist_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_sec_kdist_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_opt_ch_map_t_enc(void const * const p_data, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_opt_ch_map_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_data); + +uint32_t ble_gap_opt_local_conn_latency_t_enc(void const * const p_void_local_conn_latency, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_opt_local_conn_latency_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_local_conn_latency); + +uint32_t ble_gap_opt_passkey_t_enc(void const * const p_void_passkey, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_opt_passkey_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_passkey); + +uint32_t ble_gap_opt_privacy_t_enc(void const * const p_void_privacy, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_opt_privacy_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_privacy); + +uint32_t ble_gap_opt_scan_req_report_t_enc(void const * const p_void_scan_req_report, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_opt_scan_req_report_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_scan_req_report); + +uint32_t ble_gap_opt_compat_mode_t_enc(void const * const p_void_compat_mode, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_opt_compat_mode_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_compat_mode); + +uint32_t ble_gap_adv_ch_mask_t_enc(void const * const p_void_ch_mask, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gap_adv_ch_mask_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_ch_mask); diff --git a/components/serialization/common/struct_ser/s130/ble_gattc_struct_serialization.c b/components/serialization/common/struct_ser/s130/ble_gattc_struct_serialization.c new file mode 100644 index 0000000..9c36a55 --- /dev/null +++ b/components/serialization/common/struct_ser/s130/ble_gattc_struct_serialization.c @@ -0,0 +1,363 @@ +/* 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 "ble_gattc_struct_serialization.h" +#include "ble_struct_serialization.h" +#include "ble_serialization.h" +#include "app_util.h" +#include "ble_gattc.h" +#include "cond_field_serialization.h" +#include + +uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gattc_evt_char_val_by_uuid_read_rsp_t * p_read = + (ble_gattc_evt_char_val_by_uuid_read_rsp_t *) p_void_struct; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&(p_read->count), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_read->value_len), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + uint32_t i; + ble_gattc_handle_value_t * p_handle_value = &p_read->handle_value[0]; + + for (i = 0; i < p_read->count; i++) + { + err_code = uint16_t_enc(&(p_handle_value->handle), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(p_read->value_len, buf_len - *p_index); + memcpy(&p_buf[*p_index], p_handle_value->p_value, p_read->value_len); + *p_index += p_read->value_len; + + p_handle_value++; + } + + return err_code; +} + +uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_struct_size, + void * const p_void_struct) +{ + ble_gattc_evt_char_val_by_uuid_read_rsp_t * p_read = + (ble_gattc_evt_char_val_by_uuid_read_rsp_t *) p_void_struct; + uint32_t err_code = NRF_SUCCESS; + uint16_t value_len; + uint16_t count; + uint32_t i; + + SER_ASSERT_LENGTH_LEQ(4, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &count); + uint16_dec(p_buf, buf_len, p_index, &value_len); + + uint32_t total_struct_size = *p_struct_size; + + //calculate the size of the struct + *p_struct_size = offsetof(ble_gattc_evt_char_val_by_uuid_read_rsp_t, handle_value[0]); + *p_struct_size += sizeof(((ble_gattc_evt_char_val_by_uuid_read_rsp_t *)0)->handle_value) * count; + *p_struct_size += value_len * count; + + if (p_read) + { + p_read->value_len = value_len; + p_read->count = count; + + ble_gattc_handle_value_t * p_handle_value; + uint8_t * p_value; + + SER_ASSERT_LENGTH_LEQ(*p_struct_size, total_struct_size); + + p_value = (uint8_t *)&p_read->handle_value[count]; + + for (i = 0; i < count; i++) + { + p_handle_value = (ble_gattc_handle_value_t *)&p_read->handle_value[i]; + p_handle_value->p_value = p_value; + + SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &(p_handle_value->handle)); + + SER_ASSERT_LENGTH_LEQ(p_read->value_len, buf_len - *p_index); + memcpy(p_handle_value->p_value, &p_buf[*p_index], p_read->value_len); + *p_index += p_read->value_len; + + p_value += value_len; + } + } + else + { + *p_index += count * (value_len + 2); + } + + return err_code; +} + +uint32_t ble_gattc_evt_char_vals_read_rsp_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gattc_evt_char_vals_read_rsp_t * p_read = + (ble_gattc_evt_char_vals_read_rsp_t *) p_void_struct; + uint32_t error_code = NRF_SUCCESS; + + //Encode len + error_code = uint16_t_enc(&(p_read->len), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + //Encode values + SER_ASSERT_LENGTH_LEQ(p_read->len, buf_len - *p_index); + memcpy(&p_buf[*p_index], p_read->values, p_read->len); + *p_index += p_read->len; + + return error_code; +} + +uint32_t ble_gattc_evt_char_vals_read_rsp_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + ble_gattc_evt_char_vals_read_rsp_t * p_read = + (ble_gattc_evt_char_vals_read_rsp_t *) p_void_struct; + uint32_t error_code = NRF_SUCCESS; + + //Decode len + SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &(p_read->len)); + + //Decode values + SER_ASSERT_LENGTH_LEQ(p_read->len, buf_len - *p_index); + memcpy(p_read->values, &p_buf[*p_index], p_read->len); + *p_index += p_read->len; + + return error_code; +} + +uint32_t ble_gattc_handle_range_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gattc_handle_range_t * p_range = (ble_gattc_handle_range_t *) p_void_struct; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&(p_range->start_handle), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_range->end_handle), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gattc_handle_range_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + ble_gattc_handle_range_t * p_range = (ble_gattc_handle_range_t *) p_void_struct; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(4, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &(p_range->start_handle)); + uint16_dec(p_buf, buf_len, p_index, &(p_range->end_handle)); + + return err_code; +} + + +uint32_t ble_gattc_service_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t error_code = NRF_SUCCESS; + ble_gattc_service_t * p_service = (ble_gattc_service_t *) p_void_struct; + + error_code = ble_uuid_t_enc(&(p_service->uuid), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_gattc_handle_range_t_enc(&(p_service->handle_range), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + return error_code; +} + +uint32_t ble_gattc_service_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + uint32_t error_code = NRF_SUCCESS; + ble_gattc_service_t * p_service = (ble_gattc_service_t *) p_void_struct; + + error_code = ble_uuid_t_dec(p_buf, buf_len, p_index, &(p_service->uuid)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_gattc_handle_range_t_dec(p_buf, buf_len, p_index, &(p_service->handle_range)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + return error_code; +} + +uint32_t ble_gattc_include_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t error_code = NRF_SUCCESS; + ble_gattc_include_t * p_include = (ble_gattc_include_t *) p_void_struct; + + error_code = uint16_t_enc(&(p_include->handle), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_gattc_service_t_enc(&(p_include->included_srvc), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + return error_code; +} + +uint32_t ble_gattc_include_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + uint32_t error_code = NRF_SUCCESS; + ble_gattc_include_t * p_include = (ble_gattc_include_t *) p_void_struct; + + error_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_include->handle)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_gattc_service_t_dec(p_buf, buf_len, p_index, &(p_include->included_srvc)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + return error_code; +} + +uint32_t ble_gattc_evt_rel_disc_rsp_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t error_code = NRF_SUCCESS; + uint32_t i; + ble_gattc_evt_rel_disc_rsp_t * p_rsp = (ble_gattc_evt_rel_disc_rsp_t *) p_void_struct; + + error_code = uint16_t_enc(&(p_rsp->count), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + ble_gattc_include_t * p_include = (ble_gattc_include_t *) p_rsp->includes; + + for (i = 0; i < p_rsp->count; i++) + { + error_code = ble_gattc_include_t_enc(p_include, p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + p_include++; + } + + return error_code; +} + +uint32_t ble_gattc_evt_rel_disc_rsp_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + uint32_t error_code = NRF_SUCCESS; + ble_gattc_evt_rel_disc_rsp_t * p_rsp = (ble_gattc_evt_rel_disc_rsp_t *) p_void_struct; + uint16_t include_count; + uint32_t i; + + error_code = uint16_t_dec(p_buf, buf_len, p_index, &include_count); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + p_rsp->count = include_count; + + ble_gattc_include_t * p_include = (ble_gattc_include_t *) p_rsp->includes; + + for (i = 0; i < include_count; i++) + { + error_code = ble_gattc_include_t_dec(p_buf, buf_len, p_index, p_include); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + p_include++; + } + + return error_code; +} + +uint32_t ble_gattc_write_params_t_enc(void const * const p_void_write, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_void_write); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + uint32_t err_code = NRF_SUCCESS; + + ble_gattc_write_params_t * p_write = (ble_gattc_write_params_t *)p_void_write; + + err_code = uint8_t_enc(&(p_write->write_op), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&(p_write->flags), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_write->handle), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_write->offset), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = len16data_enc(p_write->p_value, p_write->len, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gattc_write_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_write) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_write); + + uint32_t err_code = NRF_SUCCESS; + + ble_gattc_write_params_t * p_write = (ble_gattc_write_params_t *)p_void_write; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &(p_write->write_op)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &(p_write->flags)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_write->handle)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_write->offset)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = len16data_dec(p_buf, buf_len, p_index, &(p_write->p_value), &(p_write->len)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} diff --git a/components/serialization/common/struct_ser/s130/ble_gattc_struct_serialization.h b/components/serialization/common/struct_ser/s130/ble_gattc_struct_serialization.h new file mode 100644 index 0000000..cbfae81 --- /dev/null +++ b/components/serialization/common/struct_ser/s130/ble_gattc_struct_serialization.h @@ -0,0 +1,88 @@ +/* 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 BLE_GATTC_STRUCT_SERIALIZATION_H +#define BLE_GATTC_STRUCT_SERIALIZATION_H + +#include "ble_gattc.h" + +uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_struct_size, + void * const p_void_struct); + +uint32_t ble_gattc_evt_char_vals_read_rsp_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gattc_evt_char_vals_read_rsp_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gattc_handle_range_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gattc_handle_range_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gattc_service_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gattc_service_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gattc_include_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gattc_include_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gattc_evt_rel_disc_rsp_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gattc_evt_rel_disc_rsp_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gattc_write_params_t_enc(void const * const p_void_write, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gattc_write_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_write); + +#endif /*BLE_GATTC_STRUCT_SERIALIZATION_H*/ diff --git a/components/serialization/common/struct_ser/s130/ble_gatts_struct_serialization.c b/components/serialization/common/struct_ser/s130/ble_gatts_struct_serialization.c new file mode 100644 index 0000000..dbcf94b --- /dev/null +++ b/components/serialization/common/struct_ser/s130/ble_gatts_struct_serialization.c @@ -0,0 +1,965 @@ +/* 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 "ble_gatts_struct_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "ble_struct_serialization.h" +#include "ble_serialization.h" +#include "app_util.h" +#include "ble_gatts.h" +#include "cond_field_serialization.h" +#include + +uint32_t ser_ble_gatts_char_pf_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_char_pf) +{ + ble_gatts_char_pf_t * p_char_pf = (ble_gatts_char_pf_t *)p_void_char_pf; + + SER_ASSERT_LENGTH_LEQ(7, buf_len - *p_index); + + uint8_dec(p_buf, buf_len, p_index, &p_char_pf->format); + uint8_dec(p_buf, buf_len, p_index, (uint8_t *)&p_char_pf->exponent); + uint16_dec(p_buf, buf_len, p_index, &p_char_pf->unit); + uint8_dec(p_buf, buf_len, p_index, &p_char_pf->name_space); + uint16_dec(p_buf, buf_len, p_index, &p_char_pf->desc); + + return NRF_SUCCESS; +} + +uint32_t ser_ble_gatts_char_pf_enc(void const * const p_void_char_pf, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_char_pf_t * p_char_pf = (ble_gatts_char_pf_t *)p_void_char_pf; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint8_t_enc(&p_char_pf->format, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&p_char_pf->exponent, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_char_pf->unit, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&p_char_pf->name_space, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_char_pf->desc, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gatts_attr_md_enc(void const * const p_void_attr_md, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_attr_md_t * p_attr_md = (ble_gatts_attr_md_t *)p_void_attr_md; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gap_conn_sec_mode_enc(&p_attr_md->read_perm, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_conn_sec_mode_enc(&p_attr_md->write_perm, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + /* serializer does not support attributes on stack */ + if (p_attr_md->vloc != BLE_GATTS_VLOC_STACK) + { + err_code = NRF_ERROR_INVALID_PARAM; + } + + uint8_t temp8; + temp8 = p_attr_md->vlen | + (p_attr_md->vloc << 1) | + (p_attr_md->rd_auth << 3) | + (p_attr_md->wr_auth << 4); + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + p_buf[*p_index] = temp8; + *p_index += 1; + + return err_code; +} + +uint32_t ble_gatts_attr_md_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_attr_md) +{ + ble_gatts_attr_md_t * p_attr_md = (ble_gatts_attr_md_t *)p_void_attr_md; + uint32_t err_code = NRF_SUCCESS; + uint8_t temp8; + + err_code = ble_gap_conn_sec_mode_dec(p_buf, buf_len, p_index, &p_attr_md->read_perm); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_conn_sec_mode_dec(p_buf, buf_len, p_index, &p_attr_md->write_perm); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + uint8_dec(p_buf, buf_len, p_index, &temp8); + + p_attr_md->vlen = temp8; + p_attr_md->vloc = temp8 >> 1; + p_attr_md->rd_auth = temp8 >> 3; + p_attr_md->wr_auth = temp8 >> 4; + + return err_code; +} + +uint32_t ble_gatts_char_md_enc(void const * const p_void_char_md, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t err_code = NRF_SUCCESS; + + ble_gatts_char_md_t * p_char_md = (ble_gatts_char_md_t *)p_void_char_md; + uint8_t temp8; + + temp8 = p_char_md->char_props.broadcast | + (p_char_md->char_props.read << 1) | + (p_char_md->char_props.write_wo_resp << 2) | + (p_char_md->char_props.write << 3) | + (p_char_md->char_props.notify << 4) | + (p_char_md->char_props.indicate << 5) | + (p_char_md->char_props.auth_signed_wr << 6); + + err_code = uint8_t_enc(&temp8, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + temp8 = p_char_md->char_ext_props.reliable_wr | + (p_char_md->char_ext_props.wr_aux << 1); + + err_code = uint8_t_enc(&temp8, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_char_md->char_user_desc_max_size, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ERROR_CHECK(p_char_md->char_user_desc_size <= BLE_GATTS_VAR_ATTR_LEN_MAX, + NRF_ERROR_INVALID_PARAM); + err_code = len16data_enc(p_char_md->p_char_user_desc, p_char_md->char_user_desc_size, p_buf, + buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_char_md->p_char_pf, + p_buf, + buf_len, + p_index, + ser_ble_gatts_char_pf_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_char_md->p_user_desc_md, + p_buf, + buf_len, + p_index, + ble_gatts_attr_md_enc); + SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_char_md->p_cccd_md, p_buf, buf_len, p_index, ble_gatts_attr_md_enc); + SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc(p_char_md->p_sccd_md, p_buf, buf_len, p_index, ble_gatts_attr_md_enc); + SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gatts_char_md_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_char_md) +{ + uint32_t err_code = NRF_SUCCESS; + + ble_gatts_char_md_t * p_char_md = (ble_gatts_char_md_t *)p_void_char_md; + + SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index); + uint8_t temp8 = p_buf[*p_index]; + + p_char_md->char_props.broadcast = temp8 >> 0; + p_char_md->char_props.read = temp8 >> 1; + p_char_md->char_props.write_wo_resp = temp8 >> 2; + p_char_md->char_props.write = temp8 >> 3; + p_char_md->char_props.notify = temp8 >> 4; + p_char_md->char_props.indicate = temp8 >> 5; + p_char_md->char_props.auth_signed_wr = temp8 >> 6; + + temp8 = p_buf[*p_index + 1]; + p_char_md->char_ext_props.reliable_wr = temp8 >> 0; + p_char_md->char_ext_props.wr_aux = temp8 >> 1; + + *p_index += 2; + + SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &p_char_md->char_user_desc_max_size); + + err_code = len16data_dec(p_buf, + buf_len, + p_index, + &p_char_md->p_char_user_desc, + &p_char_md->char_user_desc_size); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + buf_len, + p_index, + (void * *)&p_char_md->p_char_pf, + ser_ble_gatts_char_pf_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + buf_len, + p_index, + (void * *)&p_char_md->p_user_desc_md, + ble_gatts_attr_md_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + buf_len, + p_index, + (void * *)&p_char_md->p_cccd_md, + ble_gatts_attr_md_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + buf_len, + p_index, + (void * *)&p_char_md->p_sccd_md, + ble_gatts_attr_md_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; + +} + +uint32_t ble_gatts_attr_enc(void const * const p_void_gatts_attr, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t err_code = NRF_SUCCESS; + ble_gatts_attr_t * p_gatts_attr = (ble_gatts_attr_t *)p_void_gatts_attr; + + err_code = cond_field_enc((void *)p_gatts_attr->p_uuid, p_buf, buf_len, p_index, ble_uuid_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_enc((void *)p_gatts_attr->p_attr_md, + p_buf, + buf_len, + p_index, + ble_gatts_attr_md_enc); + SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_gatts_attr->init_offs, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_gatts_attr->max_len, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ERROR_CHECK(p_gatts_attr->init_len <= BLE_GATTS_VAR_ATTR_LEN_MAX, NRF_ERROR_INVALID_PARAM); + //init len move just before p_data to be able to use len16data decoder. + err_code = len16data_enc(p_gatts_attr->p_value, p_gatts_attr->init_len, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gatts_attr_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_gatts_attr) +{ + uint32_t err_code = NRF_SUCCESS; + ble_gatts_attr_t * p_gatts_attr = (ble_gatts_attr_t *)p_void_gatts_attr; + + err_code = cond_field_dec(p_buf, + buf_len, + p_index, + (void * *)&p_gatts_attr->p_uuid, + ble_uuid_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + buf_len, + p_index, + (void * *)&p_gatts_attr->p_attr_md, + ble_gatts_attr_md_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(4, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &p_gatts_attr->init_offs); + uint16_dec(p_buf, buf_len, p_index, &p_gatts_attr->max_len); + + //init len move just before p_data to be able to use len16data decoder. + err_code = len16data_dec(p_buf, + buf_len, + p_index, + &p_gatts_attr->p_value, + &p_gatts_attr->init_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gatts_char_handles_enc(void const * const p_void_char_handles, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_char_handles_t * p_char_handles = (ble_gatts_char_handles_t *)p_void_char_handles; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&p_char_handles->value_handle, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_char_handles->user_desc_handle, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_char_handles->cccd_handle, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_char_handles->sccd_handle, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gatts_char_handles_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_char_handles) +{ + ble_gatts_char_handles_t * p_char_handles = (ble_gatts_char_handles_t *)p_void_char_handles; + + SER_ASSERT_LENGTH_LEQ(8, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &(p_char_handles->value_handle)); + uint16_dec(p_buf, buf_len, p_index, &p_char_handles->user_desc_handle); + uint16_dec(p_buf, buf_len, p_index, &p_char_handles->cccd_handle); + uint16_dec(p_buf, buf_len, p_index, &p_char_handles->sccd_handle); + + return NRF_SUCCESS; +} + +uint32_t ble_gatts_hvx_params_t_enc(void const * const p_void_hvx_params, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_hvx_params_t * p_hvx_params = (ble_gatts_hvx_params_t *)p_void_hvx_params; + + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(2 + 1 + 2, buf_len - *p_index); + + err_code = uint16_t_enc(&p_hvx_params->handle, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&p_hvx_params->type, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_hvx_params->offset, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (p_hvx_params->p_len != NULL) + { + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + p_buf[(*p_index)++] = SER_FIELD_PRESENT; + + err_code = uint16_t_enc(p_hvx_params->p_len, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + + if (p_hvx_params->p_data != NULL) + { + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + p_buf[(*p_index)++] = SER_FIELD_PRESENT; + + SER_ASSERT_LENGTH_LEQ(*p_hvx_params->p_len, buf_len - *p_index); + memcpy(&p_buf[*p_index], p_hvx_params->p_data, *p_hvx_params->p_len); + *p_index += *p_hvx_params->p_len; + } + + return err_code; +} + +uint32_t ble_gatts_hvx_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_hvx_params) +{ + ble_gatts_hvx_params_t * p_hvx_params = (ble_gatts_hvx_params_t *)p_void_hvx_params; + + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(2 + 1 + 2, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &p_hvx_params->handle); + uint8_dec(p_buf, buf_len, p_index, &p_hvx_params->type); + uint16_dec(p_buf, buf_len, p_index, &p_hvx_params->offset); + + SER_ASSERT_NOT_NULL(&p_hvx_params->p_len); + err_code = cond_len16_cond_data_dec(p_buf, + buf_len, + p_index, + &p_hvx_params->p_data, + &p_hvx_params->p_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gatts_attr_context_t_enc(void const * const p_void_attr_context, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + uint32_t error_code = NRF_SUCCESS; + ble_gatts_attr_context_t * p_context = (ble_gatts_attr_context_t *) p_void_attr_context; + + error_code = ble_uuid_t_enc(&(p_context->srvc_uuid), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_uuid_t_enc(&(p_context->char_uuid), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_uuid_t_enc(&(p_context->desc_uuid), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint16_t_enc(&(p_context->srvc_handle), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint16_t_enc(&(p_context->value_handle), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint8_t_enc(&(p_context->type), p_buf, buf_len, p_index); + + return error_code; +} + +uint32_t ble_gatts_attr_context_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_attr_context) +{ + uint32_t error_code = NRF_SUCCESS; + ble_gatts_attr_context_t * p_context = (ble_gatts_attr_context_t *) p_void_attr_context; + + error_code = ble_uuid_t_dec(p_buf, buf_len, p_index, &(p_context->srvc_uuid)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_uuid_t_dec(p_buf, buf_len, p_index, &(p_context->char_uuid)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_uuid_t_dec(p_buf, buf_len, p_index, &(p_context->desc_uuid)); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + SER_ASSERT_LENGTH_LEQ(5, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &(p_context->srvc_handle)); + uint16_dec(p_buf, buf_len, p_index, &(p_context->value_handle)); + uint8_dec(p_buf, buf_len, p_index, &(p_context->type)); + return error_code; +} + +uint32_t ble_gatts_evt_write_t_enc(void const * const p_void_write, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_evt_write_t * p_write = (ble_gatts_evt_write_t *) p_void_write; + uint32_t error_code = NRF_SUCCESS; + + error_code = uint16_t_enc(&(p_write->handle), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint8_t_enc(&(p_write->op), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_gatts_attr_context_t_enc(&(p_write->context), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint16_t_enc(&(p_write->offset), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + uint16_t data_len = p_write->len; + error_code = uint16_t_enc(&data_len, p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + SER_ASSERT_LENGTH_LEQ(data_len, buf_len - *p_index); + memcpy(&p_buf[*p_index], p_write->data, data_len); + *p_index += data_len; + + return error_code; +} + +uint32_t ble_gatts_evt_write_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_struct_len, + void * const p_void_write) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_struct_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t in_struct_len = *p_struct_len; + + *p_struct_len = offsetof(ble_gatts_evt_write_t, data); + + uint16_t handle; + err_code = uint16_t_dec(p_buf, buf_len, p_index, &handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + uint8_t op; + err_code = uint8_t_dec(p_buf, buf_len, p_index, &op); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + ble_gatts_attr_context_t context; + err_code = ble_gatts_attr_context_t_dec(p_buf, buf_len, p_index, &context); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + uint16_t offset; + err_code = uint16_t_dec(p_buf, buf_len, p_index, &offset); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + uint16_t len; + err_code = uint16_t_dec(p_buf, buf_len, p_index, &len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_struct_len += len; + + if (p_void_write != NULL) + { + ble_gatts_evt_write_t * p_write = (ble_gatts_evt_write_t *)p_void_write; + + SER_ASSERT_LENGTH_LEQ(*p_struct_len, in_struct_len); + + p_write->handle = handle; + p_write->op = op; + + memcpy(&(p_write->context), &context, sizeof (ble_gatts_attr_context_t)); + + p_write->offset = offset; + p_write->len = len; + + SER_ASSERT_LENGTH_LEQ(p_write->len, buf_len - *p_index); + memcpy(p_write->data, &p_buf[*p_index], p_write->len); + } + + *p_index += len; + + return err_code; +} + +uint32_t ble_gatts_evt_read_t_enc(void const * const p_void_read, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_read); + + ble_gatts_evt_read_t * p_read = (ble_gatts_evt_read_t *)p_void_read; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&(p_read->handle), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gatts_attr_context_t_enc(&(p_read->context), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_read->offset), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gatts_evt_read_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_struct_len, + void * const p_void_read) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + + uint32_t err_code = NRF_SUCCESS; + uint32_t in_struct_len = *p_struct_len; + + *p_struct_len = sizeof (ble_gatts_evt_read_t); + + uint16_t handle; + err_code = uint16_t_dec(p_buf, buf_len, p_index, &handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + ble_gatts_attr_context_t context; + err_code = ble_gatts_attr_context_t_dec(p_buf, buf_len, p_index, &context); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + uint16_t offset; + err_code = uint16_t_dec(p_buf, buf_len, p_index, &offset); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (p_void_read != NULL) + { + ble_gatts_evt_read_t * p_read = (ble_gatts_evt_read_t *)p_void_read; + + SER_ASSERT_LENGTH_LEQ(*p_struct_len, in_struct_len); + + p_read->handle = handle; + memcpy(&(p_read->context), &context, sizeof (context)); + p_read->offset = offset; + } + + return err_code; +} + +uint32_t ble_gatts_evt_rw_authorize_request_t_enc(void const * const p_void_authorize_request, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_authorize_request); + + ble_gatts_evt_rw_authorize_request_t * p_authorize_request = + (ble_gatts_evt_rw_authorize_request_t *)p_void_authorize_request; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint8_t_enc(&(p_authorize_request->type), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + switch (p_authorize_request->type) + { + case BLE_GATTS_AUTHORIZE_TYPE_READ: + err_code = ble_gatts_evt_read_t_enc(&(p_authorize_request->request.read), + p_buf, + buf_len, + p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + + case BLE_GATTS_AUTHORIZE_TYPE_WRITE: + err_code = ble_gatts_evt_write_t_enc(&(p_authorize_request->request.write), + p_buf, + buf_len, + p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + + default: + case BLE_GATTS_AUTHORIZE_TYPE_INVALID: + err_code = NRF_ERROR_INVALID_PARAM; + break; + } + + return err_code; +} + +uint32_t ble_gatts_evt_rw_authorize_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_struct_len, + void * const p_void_authorize_request) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_struct_len); + SER_ASSERT_NOT_NULL(p_index); + + uint32_t err_code = NRF_SUCCESS; + + uint8_t type; + err_code = uint8_t_dec(p_buf, buf_len, p_index, &type); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + uint32_t in_struct_len = *p_struct_len; + + *p_struct_len = offsetof(ble_gatts_evt_rw_authorize_request_t, request); + + ble_gatts_evt_rw_authorize_request_t * p_authorize_request = + (ble_gatts_evt_rw_authorize_request_t *)p_void_authorize_request; + + void * p_void_request = NULL; + + if (p_void_authorize_request != NULL) + { + p_authorize_request->type = type; + + SER_ASSERT_LENGTH_LEQ(*p_struct_len, in_struct_len); + + switch (type) + { + case BLE_GATTS_AUTHORIZE_TYPE_READ: + p_void_request = &(p_authorize_request->request.read); + break; + + case BLE_GATTS_AUTHORIZE_TYPE_WRITE: + p_void_request = &(p_authorize_request->request.write); + break; + + default: + case BLE_GATTS_AUTHORIZE_TYPE_INVALID: + return NRF_ERROR_INVALID_DATA; + } + } + + switch (type) + { + case BLE_GATTS_AUTHORIZE_TYPE_READ: + err_code = ble_gatts_evt_read_t_dec(p_buf, + buf_len, + p_index, + &in_struct_len, + p_void_request); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + + case BLE_GATTS_AUTHORIZE_TYPE_WRITE: + err_code = ble_gatts_evt_write_t_dec(p_buf, + buf_len, + p_index, + &in_struct_len, + p_void_request); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + + default: + case BLE_GATTS_AUTHORIZE_TYPE_INVALID: + return NRF_ERROR_INVALID_DATA; + } + *p_struct_len += in_struct_len; + + return err_code; +} + +uint32_t ble_gatts_read_authorize_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_read_authorize_params_t * p_params = + (ble_gatts_read_authorize_params_t *) p_void_struct; + uint32_t error_code = NRF_SUCCESS; + + error_code = uint16_t_enc(&(p_params->gatt_status), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + uint8_t temp_val = p_params->update; + error_code = uint8_t_enc(&temp_val, p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + error_code = uint16_t_enc(&(p_params->offset), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + error_code = len16data_enc(p_params->p_data, p_params->len, p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + return error_code; +} + +uint32_t ble_gatts_read_authorize_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + ble_gatts_read_authorize_params_t * p_params = + (ble_gatts_read_authorize_params_t *) p_void_struct; + uint32_t error_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &p_params->gatt_status); + + uint8_t temp_val; + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + uint8_dec(p_buf, buf_len, p_index, &temp_val); + p_params->update = temp_val; + + SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &p_params->offset); + + error_code = len16data_dec(p_buf, buf_len, p_index, &p_params->p_data, &p_params->len); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + return error_code; +} + +uint32_t ble_gatts_write_authorize_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_write_authorize_params_t * p_params = + (ble_gatts_write_authorize_params_t *) p_void_struct; + uint32_t error_code = NRF_SUCCESS; + + error_code = uint16_t_enc(&(p_params->gatt_status), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + return error_code; +} + +uint32_t ble_gatts_write_authorize_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + ble_gatts_write_authorize_params_t * p_params = + (ble_gatts_write_authorize_params_t *) p_void_struct; + uint32_t error_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &p_params->gatt_status); + + return error_code; +} + +uint32_t ble_gatts_rw_authorize_reply_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_rw_authorize_reply_params_t const * const p_params = + (ble_gatts_rw_authorize_reply_params_t * ) p_void_struct; + uint32_t error_code = NRF_SUCCESS; + + error_code = uint8_t_enc(&(p_params->type), p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + if (p_params->type == BLE_GATTS_AUTHORIZE_TYPE_READ) + { + error_code = ble_gatts_read_authorize_params_t_enc(&p_params->params.read, + p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + } + else if (p_params->type == BLE_GATTS_AUTHORIZE_TYPE_WRITE) + { + error_code = ble_gatts_write_authorize_params_t_enc(&p_params->params.write, + p_buf, buf_len, p_index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + } + else + { + return NRF_ERROR_INVALID_PARAM; + } + + return error_code; +} + +uint32_t ble_gatts_rw_authorize_reply_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + ble_gatts_rw_authorize_reply_params_t * p_params = + (ble_gatts_rw_authorize_reply_params_t *) p_void_struct; + uint32_t error_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index); + uint8_dec(p_buf, buf_len, p_index, &(p_params->type)); + + if (p_params->type == BLE_GATTS_AUTHORIZE_TYPE_READ) + { + error_code = ble_gatts_read_authorize_params_t_dec(p_buf, buf_len, p_index, + &p_params->params.read); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + } + else if (p_params->type == BLE_GATTS_AUTHORIZE_TYPE_WRITE) + { + error_code = ble_gatts_write_authorize_params_t_dec(p_buf, buf_len, p_index, + &p_params->params.write); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + } + else + { + return NRF_ERROR_INVALID_PARAM; + } + + return error_code; +} + +uint32_t ble_gatts_enable_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_enable_params_t * p_enable_params = (ble_gatts_enable_params_t *)p_void_struct; + uint32_t err_code = NRF_SUCCESS; + uint8_t temp8 = 0; + + temp8 = (p_enable_params->service_changed & 0x01); + + err_code = uint8_t_enc((void *) &temp8, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint32_t_enc(&(p_enable_params->attr_tab_size), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gatts_enable_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + ble_gatts_enable_params_t * p_enable_params = (ble_gatts_enable_params_t *)p_void_struct; + uint32_t err_code = NRF_SUCCESS; + uint8_t temp8 = 0; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, (void *) &temp8); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_enable_params->service_changed = temp8 & 0x01; + + err_code = uint32_t_dec(p_buf, buf_len, p_index, (void *) &(p_enable_params->attr_tab_size)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gatts_value_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_gatts_value_t * p_value = (ble_gatts_value_t *)p_void_struct; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc((void *) &(p_value->len), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *) &(p_value->offset), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = buf_enc(p_value->p_value, p_value->len, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gatts_value_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct) +{ + ble_gatts_value_t * p_value = (ble_gatts_value_t *)p_void_struct; + uint32_t err_code = NRF_SUCCESS; + uint16_t total_len = p_value->len; + + err_code = uint16_t_dec(p_buf, buf_len, p_index, (void *) &(p_value->len)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, buf_len, p_index, (void *) &(p_value->offset)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = buf_dec(p_buf, buf_len, p_index, &(p_value->p_value), total_len, p_value->len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} diff --git a/components/serialization/common/struct_ser/s130/ble_gatts_struct_serialization.h b/components/serialization/common/struct_ser/s130/ble_gatts_struct_serialization.h new file mode 100644 index 0000000..6139d9e --- /dev/null +++ b/components/serialization/common/struct_ser/s130/ble_gatts_struct_serialization.h @@ -0,0 +1,170 @@ +/* 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 BLE_GATTS_STRUCT_SERIALIZATION_H +#define BLE_GATTS_STRUCT_SERIALIZATION_H + +#include "ble_gatts.h" + +uint32_t ser_ble_gatts_char_pf_enc(void const * const p_void_char_pf, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ser_ble_gatts_char_pf_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_char_pf); + +uint32_t ble_gatts_attr_md_enc(void const * const p_void_attr_md, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_attr_md_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_attr_md); + +uint32_t ble_gatts_char_md_enc(void const * const p_void_char_md, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_char_md_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_char_md); + +uint32_t ble_gatts_attr_enc(void const * const p_void_gatts_attr, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_attr_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_gatts_attr); + +uint32_t ble_gatts_char_handles_enc(void const * const p_void_char_handles, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_char_handles_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_char_handles); + +uint32_t ble_gatts_attr_context_t_enc(void const * const p_void_attr_context, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_attr_context_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_attr_context); + +uint32_t ble_gatts_evt_write_t_enc(void const * const p_void_write, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_evt_write_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_struct_len, + void * const p_void_write); + +uint32_t ble_gatts_hvx_params_t_enc(void const * const p_void_hvx_params, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_hvx_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_hvx_params); + +uint32_t ble_gatts_evt_read_t_enc(void const * const p_void_read, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_evt_read_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_struct_len, + void * const p_void_read); + +uint32_t ble_gatts_evt_rw_authorize_request_t_enc(void const * const p_void_authorize_request, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_evt_rw_authorize_request_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_struct_size, + void * const p_void_authorize_request); + +uint32_t ble_gatts_read_authorize_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_read_authorize_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gatts_write_authorize_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_write_authorize_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gatts_rw_authorize_reply_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_rw_authorize_reply_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gatts_enable_params_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_enable_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +uint32_t ble_gatts_value_t_enc(void const * const p_void_struct, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_gatts_value_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_struct); + +#endif /* BLE_GATTS_STRUCT_SERIALIZATION_H */ diff --git a/components/serialization/common/struct_ser/s130/ble_struct_serialization.c b/components/serialization/common/struct_ser/s130/ble_struct_serialization.c new file mode 100644 index 0000000..553bf73 --- /dev/null +++ b/components/serialization/common/struct_ser/s130/ble_struct_serialization.c @@ -0,0 +1,270 @@ +/* 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 "ble_struct_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "ble_serialization.h" +#include "app_util.h" +#include "ble_types.h" +#include "ble_l2cap.h" +#include "ble.h" +#include "cond_field_serialization.h" +#include + + +uint32_t ble_uuid_t_enc(void const * const p_void_uuid, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_uuid_t * p_uuid = (ble_uuid_t *)p_void_uuid; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&p_uuid->uuid, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&p_uuid->type, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_uuid_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_uuid) +{ + ble_uuid_t * p_uuid = (ble_uuid_t *)p_void_uuid; + + SER_ASSERT_LENGTH_LEQ(3, buf_len - *p_index); + uint16_dec(p_buf, buf_len, p_index, &p_uuid->uuid); + uint8_dec(p_buf, buf_len, p_index, &p_uuid->type); + + return NRF_SUCCESS; +} + +uint32_t ble_uuid128_t_enc(void const * const p_void_uuid, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + ble_uuid128_t * p_uuid = (ble_uuid128_t *)p_void_uuid; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(16, buf_len - *p_index); + + memcpy(&p_buf[*p_index], p_uuid->uuid128, sizeof (p_uuid->uuid128)); + + *p_index += sizeof (p_uuid->uuid128); + + return err_code; +} + +uint32_t ble_uuid128_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_uuid) +{ + ble_uuid128_t * p_uuid = (ble_uuid128_t *)p_void_uuid; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(16, buf_len - *p_index); + + memcpy(p_uuid->uuid128, &p_buf[*p_index], sizeof (p_uuid->uuid128)); + + *p_index += sizeof (p_uuid->uuid128); + + return err_code; +} + +uint32_t ble_l2cap_header_t_enc(void const * const p_void_header, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_header); + + ble_l2cap_header_t * p_header = (ble_l2cap_header_t *)p_void_header; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&(p_header->len), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_header->cid), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_l2cap_header_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_header) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_header); + + ble_l2cap_header_t * p_header = (ble_l2cap_header_t *)p_void_header; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_header->len)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_header->cid)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_l2cap_evt_rx_t_enc(void const * const p_void_evt_rx, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_evt_rx); + + ble_l2cap_evt_rx_t * p_evt_rx = (ble_l2cap_evt_rx_t *)p_void_evt_rx; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_l2cap_header_t_enc(&(p_evt_rx->header), p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(p_evt_rx->header.len, buf_len - *p_index); + memcpy(&p_buf[*p_index], p_evt_rx->data, p_evt_rx->header.len); + *p_index += p_evt_rx->header.len; + + return err_code; +} + +uint32_t ble_l2cap_evt_rx_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_struct_len, + void * const p_void_evt_rx) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_struct_len); + + ble_l2cap_evt_rx_t * p_evt_rx = (ble_l2cap_evt_rx_t *)p_void_evt_rx; + uint32_t err_code = NRF_SUCCESS; + + uint32_t total_struct_len = *p_struct_len; + + /* Get data length */ + uint32_t tmp_index = *p_index; + uint16_t len = 0; + + err_code = uint16_t_dec(p_buf, buf_len, &tmp_index, &len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + /* Update struct length */ + *p_struct_len = offsetof(ble_l2cap_evt_rx_t, data[0]); + *p_struct_len += (uint8_t*)&p_evt_rx->data[len] - (uint8_t*)&p_evt_rx->data[0]; + + /* Decode header and copy data */ + if (p_void_evt_rx != NULL) + { + SER_ASSERT_LENGTH_LEQ(*p_struct_len, total_struct_len); + + err_code = ble_l2cap_header_t_dec(p_buf, buf_len, p_index, &(p_evt_rx->header)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(p_evt_rx->header.len, buf_len - *p_index); + memcpy(p_evt_rx->data, &p_buf[*p_index], p_evt_rx->header.len); + *p_index += p_evt_rx->header.len; + } + + return err_code; +} + +uint32_t ble_enable_params_t_enc(void const * const p_void_enable_params, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_enable_params); + + ble_enable_params_t * p_enable_params = (ble_enable_params_t *)p_void_enable_params; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gatts_enable_params_t_enc(&p_enable_params->gatts_enable_params, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_enable_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_enable_params) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_enable_params); + + ble_enable_params_t * p_enable_params = (ble_enable_params_t *)p_void_enable_params; + uint32_t err_code = NRF_SUCCESS; + + err_code = ble_gatts_enable_params_t_dec(p_buf, buf_len, p_index, &(p_enable_params->gatts_enable_params)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_common_opt_radio_cpu_mutex_t_enc(void const * const p_void_opt_mutex, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_opt_mutex); + + ble_common_opt_radio_cpu_mutex_t * p_radio_cpu_mutex = (ble_common_opt_radio_cpu_mutex_t *)p_void_opt_mutex; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + byte = p_radio_cpu_mutex->enable; + err_code = uint8_t_enc(&byte, p_buf, buf_len, p_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_common_opt_radio_cpu_mutex_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_opt_mutex) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_index); + SER_ASSERT_NOT_NULL(p_void_opt_mutex); + + ble_common_opt_radio_cpu_mutex_t * p_radio_cpu_mutex = (ble_common_opt_radio_cpu_mutex_t *)p_void_opt_mutex; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + + err_code = uint8_t_dec(p_buf, buf_len, p_index, &byte); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_radio_cpu_mutex->enable = byte & 0x01; + + return err_code; +} diff --git a/components/serialization/common/struct_ser/s130/ble_struct_serialization.h b/components/serialization/common/struct_ser/s130/ble_struct_serialization.h new file mode 100644 index 0000000..032bdd9 --- /dev/null +++ b/components/serialization/common/struct_ser/s130/ble_struct_serialization.h @@ -0,0 +1,75 @@ +/* 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 "ble_types.h" + + +uint32_t ble_uuid_t_enc(void const * const p_void_uuid, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_uuid_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_uuid); + +uint32_t ble_uuid128_t_enc(const void * const p_void_uuid, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_uuid128_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_uuid); + +uint32_t ble_l2cap_header_t_enc(void const * const p_void_header, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_l2cap_header_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_header); + +uint32_t ble_l2cap_evt_rx_t_enc(void const * const p_void_evt_rx, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_l2cap_evt_rx_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + uint32_t * const p_event_len, + void * const p_void_evt_rx); + +uint32_t ble_enable_params_t_enc(void const * const p_void_enable_params, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_enable_params_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_enable_params); + +uint32_t ble_common_opt_radio_cpu_mutex_t_enc(void const * const p_void_opt_mutex, + uint8_t * const p_buf, + uint32_t buf_len, + uint32_t * const p_index); + +uint32_t ble_common_opt_radio_cpu_mutex_t_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint32_t * const p_index, + void * const p_void_opt_mutex); diff --git a/components/serialization/common/transport/debug/debug_hci_config_nrf6310.h b/components/serialization/common/transport/debug/debug_hci_config_nrf6310.h new file mode 100644 index 0000000..624b769 --- /dev/null +++ b/components/serialization/common/transport/debug/debug_hci_config_nrf6310.h @@ -0,0 +1,44 @@ +/* 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 DEBUG_HCI_CONFIG_NRF6310_H__ +#define DEBUG_HCI_CONFIG_NRF6310_H__ + +#include "boards.h" + +// define CONN_DGB to prevent CONN chip from being reseted while connected via DBG +#define nCONN_DGB + +#define PIN_EVT_DBG + +#define LED_MEM_CALLBACK LED_3 +#define LED_RX_CALLBACK LED_4 +#define LED_TX_CALLBACK LED_5 +#define LED_DP_CALLBACK LED_6 +#define LED_TX_ERR_CALLBACK LED_7 + +#define PIO_SLIP_EVT_PKT_TX 24 +#define PIO_SLIP_EVT_ACK_TX 25 +#define PIO_SLIP_EVT_PKT_TXED 28 +#define PIO_SLIP_EVT_ACK_TXED 29 +#define PIO_SLIP_EVT_PKT_RXED 0 +#define PIO_SLIP_EVT_ACK_RXED 1 +#define PIO_TIMER_EVT_TIMEOUT 2 +#define PIO_HCI_RETX 3 +#define PIO_MAIN_BUSY 4 +#define PIO_TX_REQ 5 + +#define PIO_SLIP_EVT_ERR_RXED LED_2 // only pulses not change of state + + +#endif //DEBUG_CONFIG_NRF6310_H__ + diff --git a/components/serialization/common/transport/debug/debug_hci_nrf6310.c b/components/serialization/common/transport/debug/debug_hci_nrf6310.c new file mode 100644 index 0000000..64425f6 --- /dev/null +++ b/components/serialization/common/transport/debug/debug_hci_nrf6310.c @@ -0,0 +1,228 @@ +/* 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 +#include +#include "nrf_delay.h" +#include "nrf_gpio.h" + +#ifdef SER_PHY_HCI_DEBUG_ENABLE + +#include "ser_phy_debug_comm.h" +#include "debug_hci_config_nRF6310.h" +#include "app_error.h" + +#define LED_BLINK_us 1 /* 1 us */ + +static hci_dbg_event_handler_t m_hci_dbg_event_handler = NULL; + +static void pio_blink(uint8_t led) +{ + nrf_gpio_pin_set(led); + nrf_delay_us(LED_BLINK_us); + nrf_gpio_pin_clear(led); +} + + +static void Debug_PulseOnMemCallback() +{ + pio_blink(LED_MEM_CALLBACK); +} + + +static void Debug_PulseOnRxCallback() +{ + pio_blink(LED_RX_CALLBACK); +} + + +static void Debug_PulseOnTxCallback() +{ + pio_blink(LED_TX_CALLBACK); +} + + +static void Debug_PulseOnPacketDroppedCallback() +{ + pio_blink(LED_DP_CALLBACK); +} + +static void Debug_PulseOnTxError() +{ + pio_blink(LED_TX_ERR_CALLBACK); +} + +static void Debug_PulseOnPacketTX() +{ + pio_blink(PIO_SLIP_EVT_PKT_TX); +} + +static void Debug_PulseOnAckTX() +{ + pio_blink(PIO_SLIP_EVT_ACK_TX); +} + +static void Debug_PulseOnPacketTXED() +{ + pio_blink(PIO_SLIP_EVT_PKT_TXED); +} + +static void Debug_PulseOnAckTXED() +{ + pio_blink(PIO_SLIP_EVT_ACK_TXED); +} + +static void Debug_PulseOnPacketRXED() +{ + pio_blink(PIO_SLIP_EVT_PKT_RXED); +} + +static void Debug_PulseOnAckRXED() +{ + pio_blink(PIO_SLIP_EVT_ACK_RXED); +} + +static void Debug_PulseOnErrRXED() +{ + pio_blink(PIO_SLIP_EVT_ERR_RXED); + /* throw assert when in debug mode*/ + APP_ERROR_CHECK_BOOL(false); +} + +static void Debug_PulseOnTimer() +{ + pio_blink(PIO_TIMER_EVT_TIMEOUT); +} + +static void Debug_PulseOnRETX() +{ + pio_blink(PIO_HCI_RETX); +} + +static void Debug_LevelOnBusy(uint32_t data) +{ + if (data) + { + nrf_gpio_pin_set(PIO_MAIN_BUSY); + } + else + { + nrf_gpio_pin_clear(PIO_MAIN_BUSY); + } +} + +static void Debug_PulseOnTXReq() +{ + pio_blink(PIO_TX_REQ); +} + +static void default_hci_event_handler(hci_dbg_evt_t event) +{ + switch (event.evt) + { + case HCI_PHY_EVT_TX_PKT_SENT: + Debug_PulseOnTxCallback(); + break; + case HCI_PHY_EVT_BUF_REQUEST: + Debug_PulseOnMemCallback(); + break; + case HCI_PHY_EVT_RX_PKT_RECEIVED: + Debug_PulseOnRxCallback(); + break; + case HCI_PHY_EVT_RX_PKT_DROPPED: + Debug_PulseOnPacketDroppedCallback(); + break; + case HCI_PHY_EVT_TX_ERROR: + Debug_PulseOnTxError(); + break; + case HCI_SLIP_EVT_PACKET_TX: + Debug_PulseOnPacketTX(); + break; + case HCI_SLIP_EVT_ACK_TX: + Debug_PulseOnAckTX(); + break; + case HCI_SLIP_EVT_PACKET_TXED: + Debug_PulseOnPacketTXED(); + break; + case HCI_SLIP_EVT_ACK_TXED: + Debug_PulseOnAckTXED(); + break; + case HCI_SLIP_EVT_PACKET_RXED: + Debug_PulseOnPacketRXED(); + break; + case HCI_SLIP_EVT_ACK_RXED: + Debug_PulseOnAckRXED(); + break; + case HCI_SLIP_EVT_ERR_RXED: + Debug_PulseOnErrRXED(); + break; + case HCI_TIMER_EVT_TIMEOUT: + Debug_PulseOnTimer(); + break; + case HCI_RETX: + Debug_PulseOnRETX(); + break; + case HCI_MAIN_BUSY: + Debug_LevelOnBusy(event.data); + break; + case HCI_TX_REQ: + Debug_PulseOnTXReq(); + break; + + default: + break; + } + return; +} + + +void debug_init(hci_dbg_event_handler_t evt_callback) +{ + //Configure all LED as outputs. + nrf_gpio_range_cfg_output(LED_START, LED_STOP); + + nrf_gpio_cfg_output(PIO_SLIP_EVT_PKT_TX); + nrf_gpio_cfg_output(PIO_SLIP_EVT_ACK_TX); + nrf_gpio_cfg_output(PIO_SLIP_EVT_PKT_TXED); + nrf_gpio_cfg_output(PIO_SLIP_EVT_ACK_TXED); + nrf_gpio_cfg_output(PIO_SLIP_EVT_PKT_RXED); + nrf_gpio_cfg_output(PIO_SLIP_EVT_ACK_RXED); + nrf_gpio_cfg_output(PIO_TIMER_EVT_TIMEOUT); + nrf_gpio_cfg_output(PIO_HCI_RETX); + nrf_gpio_cfg_output(PIO_MAIN_BUSY); + nrf_gpio_cfg_output(PIO_TX_REQ); + m_hci_dbg_event_handler = evt_callback; + if (evt_callback) + { + m_hci_dbg_event_handler = evt_callback; + } + else + { + m_hci_dbg_event_handler = default_hci_event_handler; + } + +} + + +void debug_evt(hci_dbg_evt_type_t evt, uint32_t data) +{ + hci_dbg_evt_t event; + event.evt = evt; + event.data = data; + + if (m_hci_dbg_event_handler) + { + m_hci_dbg_event_handler(event); + } +} + +#endif diff --git a/components/serialization/common/transport/dtm_uart_params.h b/components/serialization/common/transport/dtm_uart_params.h new file mode 100644 index 0000000..e4000c0 --- /dev/null +++ b/components/serialization/common/transport/dtm_uart_params.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef DTM_UART_PARAMS_H__ +#define DTM_UART_PARAMS_H__ + +#include +#include + +/** @ingroup ble_dtm_app + */ + + +/**@brief Enumeration of supported baud rates. */ +typedef enum +{ + UART_BAUD_RATE_1200, /**< Baud rate 1200. */ + UART_BAUD_RATE_2400, /**< Baud rate 2400. */ + UART_BAUD_RATE_4800, /**< Baud rate 4800. */ + UART_BAUD_RATE_9600, /**< Baud rate 9600. */ + UART_BAUD_RATE_14400, /**< Baud rate 14400. */ + UART_BAUD_RATE_19200, /**< Baud rate 19200. */ + UART_BAUD_RATE_28800, /**< Baud rate 28800. */ + UART_BAUD_RATE_38400, /**< Baud rate 38400. */ + UART_BAUD_RATE_57600, /**< Baud rate 57600. */ + UART_BAUD_RATE_76800, /**< Baud rate 76800. */ + UART_BAUD_RATE_115200, /**< Baud rate 115200. */ + UART_BAUD_RATE_230400, /**< Baud rate 230400. */ + UART_BAUD_RATE_250000, /**< Baud rate 250000. */ + UART_BAUD_RATE_460800, /**< Baud rate 460800. */ + UART_BAUD_RATE_921600, /**< Baud rate 921600. */ + UART_BAUD_RATE_1000000, /**< Baud rate 1000000. */ + UART_BAUD_RATE_MAX /**< Enumeration upper bound. */ +} app_uart_stream_baud_rate_t; + +/**@brief UART communication structure holding configuration settings for the peripheral. + */ +typedef struct +{ + uint8_t rx_pin_no; /**< RX pin number. */ + uint8_t tx_pin_no; /**< TX pin number. */ + uint8_t rts_pin_no; /**< RTS pin number, only used if flow control is enabled. */ + uint8_t cts_pin_no; /**< CTS pin number, only used if flow control is enabled. */ + bool use_parity; /**< Even parity if TRUE, no parity if FALSE. */ + app_uart_stream_baud_rate_t baud_rate; /**< Baud rate configuration. */ +} app_uart_stream_comm_params_t; + +#endif // DTM_UART_PARAMS_H__ diff --git a/components/serialization/common/transport/ser_hal_transport.c b/components/serialization/common/transport/ser_hal_transport.c new file mode 100644 index 0000000..b2c32c3 --- /dev/null +++ b/components/serialization/common/transport/ser_hal_transport.c @@ -0,0 +1,460 @@ +/* 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 +#include +#include "app_error.h" +#include "ser_config.h" +#include "ser_phy.h" +#include "ser_hal_transport.h" + +/** + * @brief States of the RX state machine. + */ +typedef enum +{ + HAL_TRANSP_RX_STATE_CLOSED = 0, + HAL_TRANSP_RX_STATE_IDLE, + HAL_TRANSP_RX_STATE_RECEIVING, + HAL_TRANSP_RX_STATE_DROPPING, + HAL_TRANSP_RX_STATE_RECEIVED, + HAL_TRANSP_RX_STATE_RECEIVED_PENDING_BUF_REQ, + HAL_TRANSP_RX_STATE_RECEIVED_DROPPING, + HAL_TRANSP_RX_STATE_MAX +}ser_hal_transp_rx_states_t; + +/** + * @brief States of the TX state machine. + */ +typedef enum +{ + HAL_TRANSP_TX_STATE_CLOSED = 0, + HAL_TRANSP_TX_STATE_IDLE, + HAL_TRANSP_TX_STATE_TX_ALLOCATED, + HAL_TRANSP_TX_STATE_TRANSMITTING, + HAL_TRANSP_TX_STATE_TRANSMITTED, + HAL_TRANSP_TX_STATE_MAX +}ser_hal_transp_tx_states_t; + +/** + * @brief RX state. + */ +static ser_hal_transp_rx_states_t m_rx_state = HAL_TRANSP_RX_STATE_CLOSED; +/** + * @brief TX state. + */ +static ser_hal_transp_tx_states_t m_tx_state = HAL_TRANSP_TX_STATE_CLOSED; + +/** + * @brief Transmission buffer. + */ +static uint8_t m_tx_buffer[SER_HAL_TRANSPORT_TX_MAX_PKT_SIZE]; +/** + * @brief Reception buffer. + */ +static uint8_t m_rx_buffer[SER_HAL_TRANSPORT_RX_MAX_PKT_SIZE]; + +/** + * @brief Callback function handler for Serialization HAL Transport layer events. + */ +static ser_hal_transport_events_handler_t m_events_handler = NULL; + + +/** + * @brief A callback function to be used to handle a PHY module events. This function is called in + * an interrupt context. + */ +static void phy_events_handler(ser_phy_evt_t phy_event) +{ + uint32_t err_code = 0; + ser_hal_transport_evt_t hal_transp_event; + + memset(&hal_transp_event, 0, sizeof (ser_hal_transport_evt_t)); + hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_TYPE_MAX; + + switch (phy_event.evt_type) + { + case SER_PHY_EVT_TX_PKT_SENT: + { + if (HAL_TRANSP_TX_STATE_TRANSMITTING == m_tx_state) + { + m_tx_state = HAL_TRANSP_TX_STATE_TRANSMITTED; + err_code = ser_hal_transport_tx_pkt_free(m_tx_buffer); + APP_ERROR_CHECK(err_code); + /* An event to an upper layer that a packet has been transmitted. */ + hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_TX_PKT_SENT; + m_events_handler(hal_transp_event); + } + else + { + /* Lower layer should not generate this event in current state. */ + APP_ERROR_CHECK_BOOL(false); + } + break; + } + + case SER_PHY_EVT_RX_BUF_REQUEST: + { + /* An event to an upper layer that a packet is being scheduled to receive or to drop. */ + hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_RX_PKT_RECEIVING; + + /* Receive or drop a packet. */ + if (phy_event.evt_params.rx_buf_request.num_of_bytes <= sizeof (m_rx_buffer)) + { + if (HAL_TRANSP_RX_STATE_IDLE == m_rx_state) + { + m_events_handler(hal_transp_event); + err_code = ser_phy_rx_buf_set(m_rx_buffer); + APP_ERROR_CHECK(err_code); + m_rx_state = HAL_TRANSP_RX_STATE_RECEIVING; + } + else if (HAL_TRANSP_RX_STATE_RECEIVED == m_rx_state) + { + /* It is OK to get know higher layer at this point that we are going to receive + * a new packet even though we will start receiving when rx buffer is freed. */ + m_events_handler(hal_transp_event); + m_rx_state = HAL_TRANSP_RX_STATE_RECEIVED_PENDING_BUF_REQ; + } + else + { + /* Lower layer should not generate this event in current state. */ + APP_ERROR_CHECK_BOOL(false); + } + } + else + { + /* There is not enough memory but packet has to be received to dummy location. */ + if (HAL_TRANSP_RX_STATE_IDLE == m_rx_state) + { + m_events_handler(hal_transp_event); + err_code = ser_phy_rx_buf_set(NULL); + APP_ERROR_CHECK(err_code); + m_rx_state = HAL_TRANSP_RX_STATE_DROPPING; + } + else if (HAL_TRANSP_RX_STATE_RECEIVED == m_rx_state) + { + m_events_handler(hal_transp_event); + err_code = ser_phy_rx_buf_set(NULL); + APP_ERROR_CHECK(err_code); + m_rx_state = HAL_TRANSP_RX_STATE_RECEIVED_DROPPING; + } + else + { + /* Lower layer should not generate this event in current state. */ + APP_ERROR_CHECK_BOOL(false); + } + } + break; + } + + case SER_PHY_EVT_RX_PKT_RECEIVED: + { + if (HAL_TRANSP_RX_STATE_RECEIVING == m_rx_state) + { + m_rx_state = HAL_TRANSP_RX_STATE_RECEIVED; + /* Generate the event to an upper layer. */ + hal_transp_event.evt_type = + SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED; + hal_transp_event.evt_params.rx_pkt_received.p_buffer = + phy_event.evt_params.rx_pkt_received.p_buffer; + hal_transp_event.evt_params.rx_pkt_received.num_of_bytes = + phy_event.evt_params.rx_pkt_received.num_of_bytes; + m_events_handler(hal_transp_event); + } + else + { + /* Lower layer should not generate this event in current state. */ + APP_ERROR_CHECK_BOOL(false); + } + break; + } + + case SER_PHY_EVT_RX_PKT_DROPPED: + { + if (HAL_TRANSP_RX_STATE_DROPPING == m_rx_state) + { + /* Generate the event to an upper layer. */ + hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_RX_PKT_DROPPED; + m_events_handler(hal_transp_event); + m_rx_state = HAL_TRANSP_RX_STATE_IDLE; + } + else if (HAL_TRANSP_RX_STATE_RECEIVED_DROPPING == m_rx_state) + { + /* Generate the event to an upper layer. */ + hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_RX_PKT_DROPPED; + m_events_handler(hal_transp_event); + m_rx_state = HAL_TRANSP_RX_STATE_RECEIVED; + } + else + { + /* Lower layer should not generate this event in current state. */ + APP_ERROR_CHECK_BOOL(false); + } + break; + } + + case SER_PHY_EVT_RX_OVERFLOW_ERROR: + { + /* Generate the event to an upper layer. */ + hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_PHY_ERROR; + hal_transp_event.evt_params.phy_error.error_type = + SER_HAL_TRANSP_PHY_ERROR_RX_OVERFLOW; + m_events_handler(hal_transp_event); + break; + } + + case SER_PHY_EVT_TX_OVERREAD_ERROR: + { + /* Generate the event to an upper layer. */ + hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_PHY_ERROR; + hal_transp_event.evt_params.phy_error.error_type = + SER_HAL_TRANSP_PHY_ERROR_TX_OVERREAD; + m_events_handler(hal_transp_event); + break; + } + + case SER_PHY_EVT_HW_ERROR: + { + /* Generate the event to an upper layer. */ + hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_PHY_ERROR; + hal_transp_event.evt_params.phy_error.error_type = + SER_HAL_TRANSP_PHY_ERROR_HW_ERROR; + hal_transp_event.evt_params.phy_error.hw_error_code = + phy_event.evt_params.hw_error.error_code; + if (HAL_TRANSP_TX_STATE_TRANSMITTING == m_tx_state) + { + m_tx_state = HAL_TRANSP_TX_STATE_TRANSMITTED; + err_code = ser_hal_transport_tx_pkt_free(phy_event.evt_params.hw_error.p_buffer); + APP_ERROR_CHECK(err_code); + /* An event to an upper layer that a packet has been transmitted. */ + } + else if (HAL_TRANSP_RX_STATE_RECEIVING == m_rx_state) + { + m_rx_state = HAL_TRANSP_RX_STATE_RECEIVED; + err_code = ser_hal_transport_rx_pkt_free(phy_event.evt_params.hw_error.p_buffer); + APP_ERROR_CHECK(err_code); + } + m_events_handler(hal_transp_event); + + break; + } + + default: + { + APP_ERROR_CHECK_BOOL(false); + break; + } + } +} + +uint32_t ser_hal_transport_open(ser_hal_transport_events_handler_t events_handler) +{ + uint32_t err_code = NRF_SUCCESS; + + if ((HAL_TRANSP_RX_STATE_CLOSED != m_rx_state) || (HAL_TRANSP_TX_STATE_CLOSED != m_tx_state)) + { + err_code = NRF_ERROR_INVALID_STATE; + } + else if (NULL == events_handler) + { + err_code = NRF_ERROR_NULL; + } + else + { + /* We have to change states before calling lower layer because ser_phy_open() function is + * going to enable interrupts. On success an event from PHY layer can be emitted immediately + * after return from ser_phy_open(). */ + m_rx_state = HAL_TRANSP_RX_STATE_IDLE; + m_tx_state = HAL_TRANSP_TX_STATE_IDLE; + + m_events_handler = events_handler; + + /* Initialize a PHY module. */ + err_code = ser_phy_open(phy_events_handler); + + if (NRF_SUCCESS != err_code) + { + m_rx_state = HAL_TRANSP_RX_STATE_CLOSED; + m_tx_state = HAL_TRANSP_TX_STATE_CLOSED; + m_events_handler = NULL; + + if (NRF_ERROR_INVALID_PARAM != err_code) + { + err_code = NRF_ERROR_INTERNAL; + } + } + } + + return err_code; +} + + +void ser_hal_transport_close(void) +{ + /* Reset generic handler for all events, reset internal states and close PHY module. */ + ser_phy_interrupts_disable(); + m_rx_state = HAL_TRANSP_RX_STATE_CLOSED; + m_tx_state = HAL_TRANSP_TX_STATE_CLOSED; + + m_events_handler = NULL; + + ser_phy_close(); +} + + +uint32_t ser_hal_transport_rx_pkt_free(uint8_t * p_buffer) +{ + uint32_t err_code = NRF_SUCCESS; + + ser_phy_interrupts_disable(); + + if (NULL == p_buffer) + { + err_code = NRF_ERROR_NULL; + } + else if (p_buffer != m_rx_buffer) + { + err_code = NRF_ERROR_INVALID_ADDR; + } + else if (HAL_TRANSP_RX_STATE_RECEIVED == m_rx_state) + { + m_rx_state = HAL_TRANSP_RX_STATE_IDLE; + } + else if (HAL_TRANSP_RX_STATE_RECEIVED_DROPPING == m_rx_state) + { + m_rx_state = HAL_TRANSP_RX_STATE_DROPPING; + } + else if (HAL_TRANSP_RX_STATE_RECEIVED_PENDING_BUF_REQ == m_rx_state) + { + err_code = ser_phy_rx_buf_set(m_rx_buffer); + + if (NRF_SUCCESS == err_code) + { + m_rx_state = HAL_TRANSP_RX_STATE_RECEIVING; + } + else + { + err_code = NRF_ERROR_INTERNAL; + } + } + else + { + /* Upper layer should not call this function in current state. */ + err_code = NRF_ERROR_INVALID_STATE; + } + ser_phy_interrupts_enable(); + + return err_code; +} + + +uint32_t ser_hal_transport_tx_pkt_alloc(uint8_t * * pp_memory, uint16_t * p_num_of_bytes) +{ + uint32_t err_code = NRF_SUCCESS; + + if ((NULL == pp_memory) || (NULL == p_num_of_bytes)) + { + err_code = NRF_ERROR_NULL; + } + else if (HAL_TRANSP_TX_STATE_CLOSED == m_tx_state) + { + err_code = NRF_ERROR_INVALID_STATE; + } + else if (HAL_TRANSP_TX_STATE_IDLE == m_tx_state) + { + m_tx_state = HAL_TRANSP_TX_STATE_TX_ALLOCATED; + *pp_memory = &m_tx_buffer[0]; + *p_num_of_bytes = (uint16_t)sizeof (m_tx_buffer); + } + else + { + err_code = NRF_ERROR_NO_MEM; + } + + return err_code; +} + + +uint32_t ser_hal_transport_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes) +{ + uint32_t err_code = NRF_SUCCESS; + + /* The buffer provided to this function must be allocated through ser_hal_transport_tx_alloc() + * function - this assures correct state and that correct memory buffer is used. */ + if (NULL == p_buffer) + { + err_code = NRF_ERROR_NULL; + } + else if (0 == num_of_bytes) + { + err_code = NRF_ERROR_INVALID_PARAM; + } + else if (p_buffer != m_tx_buffer) + { + err_code = NRF_ERROR_INVALID_ADDR; + } + else if (num_of_bytes > sizeof (m_tx_buffer)) + { + err_code = NRF_ERROR_DATA_SIZE; + } + else if (HAL_TRANSP_TX_STATE_TX_ALLOCATED == m_tx_state) + { + ser_phy_interrupts_disable(); + err_code = ser_phy_tx_pkt_send(p_buffer, num_of_bytes); + + if (NRF_SUCCESS == err_code) + { + m_tx_state = HAL_TRANSP_TX_STATE_TRANSMITTING; + } + else + { + if (NRF_ERROR_BUSY != err_code) + { + err_code = NRF_ERROR_INTERNAL; + } + } + ser_phy_interrupts_enable(); + } + else + { + err_code = NRF_ERROR_INVALID_STATE; + } + + return err_code; +} + + +uint32_t ser_hal_transport_tx_pkt_free(uint8_t * p_buffer) +{ + uint32_t err_code = NRF_SUCCESS; + + if (NULL == p_buffer) + { + err_code = NRF_ERROR_NULL; + } + else if (p_buffer != m_tx_buffer) + { + err_code = NRF_ERROR_INVALID_ADDR; + } + else if ((HAL_TRANSP_TX_STATE_TX_ALLOCATED == m_tx_state) || + (HAL_TRANSP_TX_STATE_TRANSMITTED == m_tx_state)) + { + /* Release TX buffer for use. */ + m_tx_state = HAL_TRANSP_TX_STATE_IDLE; + } + else + { + err_code = NRF_ERROR_INVALID_STATE; + } + + return err_code; +} diff --git a/components/serialization/common/transport/ser_hal_transport.h b/components/serialization/common/transport/ser_hal_transport.h new file mode 100644 index 0000000..811dd4c --- /dev/null +++ b/components/serialization/common/transport/ser_hal_transport.h @@ -0,0 +1,231 @@ +/* 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. + * + */ + +/** @file + * + * @defgroup ser_hal_transport Serialization HAL Transport + * @{ + * @ingroup ble_sdk_lib_serialization + * + * @brief HAL Transport layer for serialization. + * + * @details This file contains declarations of functions and typedefs used as API of the HAL + * Transport layer for serialization. This layer is fully hardware independent. + * Currently the HAL Transport layer is responsible for controlling the PHY layer and + * memory management. In the future it is possible to add more feature to it as: crc, + * retransmission etc. + * + * \n \n + * \image html ser_hal_transport_rx_state_machine.png "RX state machine" + * \n \n + * \image html ser_hal_transport_tx_state_machine.png "TX state machine" + * \n + */ + +#ifndef SER_HAL_TRANSPORT_H__ +#define SER_HAL_TRANSPORT_H__ + +#include + + +/**@brief Serialization HAL Transport layer event types. */ +typedef enum +{ + SER_HAL_TRANSP_EVT_TX_PKT_SENT = 0, /**< An event indicating that TX packet has been + transmitted. */ + SER_HAL_TRANSP_EVT_RX_PKT_RECEIVING, /**< An event indicating that RX packet is being + scheduled to receive or to drop. */ + SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED, /**< An event indicating that RX packet is ready for + read. */ + SER_HAL_TRANSP_EVT_RX_PKT_DROPPED, /**< An event indicating that RX packet was dropped + because it was longer than available buffer. */ + SER_HAL_TRANSP_EVT_PHY_ERROR, /**< An event indicating error on PHY layer. */ + SER_HAL_TRANSP_EVT_TYPE_MAX /**< Enumeration upper bound. */ +} ser_hal_transport_evt_type_t; + + +/**@brief Serialization PHY layer error types. */ +typedef enum +{ + SER_HAL_TRANSP_PHY_ERROR_RX_OVERFLOW = 0, /**< An error indicating that more information has + been transmitted than phy module could handle. */ + SER_HAL_TRANSP_PHY_ERROR_TX_OVERREAD, /**< An error indicating that phy module was forced to + transmit more information than possessed. */ + SER_HAL_TRANSP_PHY_ERROR_HW_ERROR, /**< An error indicating a hardware error in a phy + module. */ + SER_HAL_TRANSP_PHY_ERROR_TYPE_MAX /**< Enumeration upper bound. */ +} ser_hal_transport_phy_error_type_t; + + +/**@brief A struct containing parameters of the event of type + * @ref SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED. + */ +typedef struct +{ + uint8_t * p_buffer; /**< Pointer to a buffer containing a packet to read. */ + uint16_t num_of_bytes; /**< Length of a received packet in octets. */ +} ser_hal_transport_evt_rx_pkt_received_params_t; + + +/**@brief A struct containing parameters of the event of type @ref SER_HAL_TRANSP_EVT_PHY_ERROR. */ +typedef struct +{ + ser_hal_transport_phy_error_type_t error_type; /**< Type of PHY error. */ + uint32_t hw_error_code; /**< Hardware error code - specific for any microcontroller. Parameter + is valid only for the phy error of type + @ref SER_HAL_TRANSP_PHY_ERROR_HW_ERROR. */ +} ser_hal_transport_evt_phy_error_params_t; + + +/**@brief A struct containing events from the Serialization HAL Transport layer. + * + * @note Some events do not have parameters, then whole information is contained in the evt_type. + */ +typedef struct +{ + ser_hal_transport_evt_type_t evt_type; /**< Type of event. */ + union /**< Union alternative identified by evt_type in enclosing struct. */ + { + ser_hal_transport_evt_rx_pkt_received_params_t rx_pkt_received; /**< Parameters of the event of type @ref SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED. */ + ser_hal_transport_evt_phy_error_params_t phy_error; /**< Parameters of the event of type @ref SER_HAL_TRANSP_EVT_PHY_ERROR. */ + } evt_params; +} ser_hal_transport_evt_t; + + +/**@brief A generic callback function type to be used by all Serialization HAL Transport layer + * events. + * + * @param[in] event Serialization HAL Transport layer event. + */ +typedef void (*ser_hal_transport_events_handler_t)(ser_hal_transport_evt_t event); + + +/**@brief A function for opening and initializing the Serialization HAL Transport layer. + * + * @note The function opens the transport channel, initializes a PHY layer and registers callback + * function to be used by all Serialization HAL Transport layer events. + * + * @warning If the function has been already called, the function @ref ser_hal_transport_close has + * to be called before ser_hal_transport_open can be called again. + * + * @param[in] events_handler Generic callback function to be used by all Serialization HAL + * Transport layer events. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_PARAM Operation failure. Hardware initialization parameters taken from + * the configuration file are wrong. + * @retval NRF_ERROR_INVALID_STATE Operation failure. The function has been already called. To call + * it again the function @ref ser_hal_transport_close has to be + * called previously. + * @retval NRF_ERROR_INTERNAL Operation failure. Internal error ocurred. + */ +uint32_t ser_hal_transport_open(ser_hal_transport_events_handler_t events_handler); + + +/**@brief A function for closing a transport channel. + * + * @note The function disables hardware, resets internal module states and unregisters events + * callback function. Can be called multiple times, also for not opened channel. + */ +void ser_hal_transport_close(void); + + +/**@brief A function for freeing a memory allocated for RX packet. + * + * @note The function should be called as a response to an event of type + * @ref SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED when received data has beed processed. The function + * frees an RX memory pointed by p_buffer. The memory, immediately or at a later time, is + * reused by the underlying transport layer. + * + * @param[in] p_buffer A pointer to the beginning of a buffer that has been processed (has to be + * the same address as provided in an event of type + * @ref SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED). + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_ADDR Operation failure. Not a valid pointer (provided address is not + * the starting address of a buffer managed by HAL Transport layer). + * @retval NRF_ERROR_INVALID_STATE Operation failure. The function should be called as a response + * to an event of type @ref SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED. + * @retval NRF_ERROR_INTERNAL Operation failure. Internal error ocurred. + */ +uint32_t ser_hal_transport_rx_pkt_free(uint8_t * p_buffer); + + +/**@brief A function for allocating a memory for TX packet. + * + * @param[out] pp_memory A pointer to pointer to which an address of the beginning of the + * allocated buffer is written. + * @param[out] p_num_of_bytes A pointer to a variable to which size in octets of the allocated + * buffer is written. + * + * @retval NRF_SUCCESS Operation success. Memory was allocated. + * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. + * @retval NRF_ERROR_NO_MEM Operation failure. No memory available. + * @retval NRF_ERROR_INVALID_STATE Operation failure. The function was called before calling + * @ref ser_hal_transport_open function. + */ +uint32_t ser_hal_transport_tx_pkt_alloc(uint8_t ** pp_memory, uint16_t * p_num_of_bytes); + +/**@brief A function for transmitting a packet. + * + * @note The function adds a packet pointed by p_buffer parameter to a transmission queue. A buffer + * provided to this function must be allocated by @ref ser_hal_transport_tx_pkt_alloc function. + * + * @warning Completion of this method does not guarantee that actual peripheral transmission would + * have completed. + * + * @param[in] p_buffer A pointer to a buffer to transmit. + * @param[in] num_of_bytes Number of octets to transmit. Must be more than 0. + * + * @retval NRF_SUCCESS Operation success. Packet was added to the transmission queue. + * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_PARAM Operation failure. num_of_bytes is equal to 0. + * @retval NRF_ERROR_INVALID_ADDR Operation failure. Not a valid pointer (provided address is not + * the starting address of a buffer managed by HAL Transport layer). + * @retval NRF_ERROR_DATA_SIZE Operation failure. Packet size exceeds limit. + * @retval NRF_ERROR_BUSY Operation failure. Transmission queue is full so packet was not + * added to the transmission queue. + * @retval NRF_ERROR_INVALID_STATE Operation failure. Transmittion channel was not opened by + * @ref ser_hal_transport_open function or provided buffer was not + * allocated by @ref ser_hal_transport_tx_pkt_alloc function. + * @retval NRF_ERROR_INTERNAL Operation failure. Internal error ocurred. + */ +uint32_t ser_hal_transport_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes); + + +/**@brief A function for freeing a memory allocated for TX packet. + * + * @note The function frees a TX memory pointed by p_buffer. Freeing a TX buffer is possible only if + * the buffer was allocated by @ref ser_hal_transport_tx_pkt_alloc function and transmittion + * is not in progress. When transmittion has finished this function is automatically called by + * the Serialization HAL Transport layer, so the only case when this function should be used + * from outside is when a TX buffer was allocated but a transmittion has not been started + * (@ref ser_hal_transport_tx_pkt_send function has not been called). + * + * @param[in] p_buffer A pointer to the beginning of a buffer that has been allocated by + * @ref ser_hal_transport_tx_pkt_alloc function. + * + * @retval NRF_SUCCESS Operation success. Memory was freed. + * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_ADDR Operation failure. Not a valid pointer (provided address is not + * the starting address of a buffer managed by HAL Transport layer). + * @retval NRF_ERROR_INVALID_STATE Operation failure. Freeing a TX buffer is possible only if the + * buffer was allocated by @ref ser_hal_transport_tx_pkt_alloc + * function and transmittion is not in progress. + */ +uint32_t ser_hal_transport_tx_pkt_free(uint8_t * p_buffer); + + +#endif /* SER_HAL_TRANSPORT_H__ */ +/** @} */ diff --git a/components/serialization/common/transport/ser_phy/config/ser_config_5W_app.h b/components/serialization/common/transport/ser_phy/config/ser_config_5W_app.h new file mode 100644 index 0000000..635502c --- /dev/null +++ b/components/serialization/common/transport/ser_phy/config/ser_config_5W_app.h @@ -0,0 +1,16 @@ +/* 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 SER_CONFIG_5W_APP_H__ +#define SER_CONFIG_5W_APP_H__ + +#endif /* SER_CONFIG_APP_H__ */ diff --git a/components/serialization/common/transport/ser_phy/config/ser_phy_config_app_nrf51.h b/components/serialization/common/transport/ser_phy/config/ser_phy_config_app_nrf51.h new file mode 100644 index 0000000..af0f70d --- /dev/null +++ b/components/serialization/common/transport/ser_phy/config/ser_phy_config_app_nrf51.h @@ -0,0 +1,70 @@ +/* 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 SER_CONFIG_APP_HAL_NRF51_H__ +#define SER_CONFIG_APP_HAL_NRF51_H__ + +#include "boards.h" +#include "ser_config.h" + +#if defined(SPI_MASTER_0_ENABLE) +#define SER_PHY_SPI_MASTER SPI_MASTER_0 +#endif +#if defined(SPI_MASTER_1_ENABLE) +#define SER_PHY_SPI_MASTER SPI_MASTER_1 +#endif +#if defined(SPI_MASTER_2_ENABLE) +#define SER_PHY_SPI_MASTER SPI_MASTER_2 +#endif + +#if (defined(SPI0_ENABLED) && (SPI0_ENABLED == 1)) || defined(SPI_MASTER_0_ENABLE) + +#define SER_PHY_SPI_MASTER_INSTANCE NRF_DRV_SPI_INSTANCE(0) +#define SER_PHY_SPI_MASTER_PIN_SCK SER_APP_SPIM0_SCK_PIN +#define SER_PHY_SPI_MASTER_PIN_MISO SER_APP_SPIM0_MISO_PIN +#define SER_PHY_SPI_MASTER_PIN_MOSI SER_APP_SPIM0_MOSI_PIN +#define SER_PHY_SPI_MASTER_PIN_SLAVE_SELECT SER_APP_SPIM0_SS_PIN +#define SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST SER_APP_SPIM0_REQ_PIN +#define SER_PHY_SPI_MASTER_PIN_SLAVE_READY SER_APP_SPIM0_RDY_PIN + +#elif (defined(SPI1_ENABLED) && (SPI1_ENABLED == 1)) || defined(SPI_MASTER_1_ENABLE) + +#define SER_PHY_SPI_MASTER_INSTANCE NRF_DRV_SPI_INSTANCE(1) +#define SER_PHY_SPI_MASTER_PIN_SCK SER_APP_SPIM1_SCK_PIN +#define SER_PHY_SPI_MASTER_PIN_MISO SER_APP_SPIM1_MISO_PIN +#define SER_PHY_SPI_MASTER_PIN_MOSI SER_APP_SPIM1_MOSI_PIN +#define SER_PHY_SPI_MASTER_PIN_SLAVE_SELECT SER_APP_SPIM1_SS_PIN +#define SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST SER_APP_SPIM1_REQ_PIN +#define SER_PHY_SPI_MASTER_PIN_SLAVE_READY SER_APP_SPIM1_RDY_PIN + +#elif (defined(SPI2_ENABLED) && (SPI2_ENABLED == 1)) || defined(SPI_MASTER_2_ENABLE) + +#define SER_PHY_SPI_MASTER_INSTANCE NRF_DRV_SPI_INSTANCE(2) +#define SER_PHY_SPI_MASTER_PIN_SCK SER_APP_SPIM2_SCK_PIN +#define SER_PHY_SPI_MASTER_PIN_MISO SER_APP_SPIM2_MISO_PIN +#define SER_PHY_SPI_MASTER_PIN_MOSI SER_APP_SPIM2_MOSI_PIN +#define SER_PHY_SPI_MASTER_PIN_SLAVE_SELECT SER_APP_SPIM2_SS_PIN +#define SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST SER_APP_SPIM2_REQ_PIN +#define SER_PHY_SPI_MASTER_PIN_SLAVE_READY SER_APP_SPIM2_RDY_PIN + +#endif + +#define CONN_CHIP_RESET_PIN_NO SER_CONN_CHIP_RESET_PIN /**< Pin used for reseting the nRF51822. */ + +/* UART configuration */ +#define UART_IRQ_PRIORITY APP_IRQ_PRIORITY_MID +#define SER_PHY_UART_RX SER_APP_RX_PIN +#define SER_PHY_UART_TX SER_APP_TX_PIN +#define SER_PHY_UART_CTS SER_APP_CTS_PIN +#define SER_PHY_UART_RTS SER_APP_RTS_PIN + +#endif //SER_CONFIG_APP_HAL_NRF51_H__ diff --git a/components/serialization/common/transport/ser_phy/config/ser_phy_config_conn_nrf51.h b/components/serialization/common/transport/ser_phy/config/ser_phy_config_conn_nrf51.h new file mode 100644 index 0000000..233ab0c --- /dev/null +++ b/components/serialization/common/transport/ser_phy/config/ser_phy_config_conn_nrf51.h @@ -0,0 +1,42 @@ + /* 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 SER_PHY_CONFIG_CONN_NRF51_H__ +#define SER_PHY_CONFIG_CONN_NRF51_H__ + +#include "boards.h" +#include "ser_config.h" + +/***********************************************************************************************//** + * SER_PHY layer configuration. + **************************************************************************************************/ +#define SER_PHY_SPI_PPI_RDY_CH 0 +#define SER_PHY_SPI_GPIOTE_RDY_CH 0 + +#define SER_PHY_SPI_SLAVE_INSTANCE 1 + +#define SER_PHY_SPI_SLAVE_REQ_PIN SER_CON_SPIS_REQ_PIN +#define SER_PHY_SPI_SLAVE_RDY_PIN SER_CON_SPIS_RDY_PIN +#define SER_PHY_SPI_SLAVE_SCK_PIN SER_CON_SPIS_SCK_PIN +#define SER_PHY_SPI_SLAVE_MISO_PIN SER_CON_SPIS_MISO_PIN +#define SER_PHY_SPI_SLAVE_MOSI_PIN SER_CON_SPIS_MOSI_PIN +#define SER_PHY_SPI_SLAVE_SS_PIN SER_CON_SPIS_CSN_PIN + +/* UART configuration */ +#define UART_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW + +#define SER_PHY_UART_RX SER_CON_RX_PIN +#define SER_PHY_UART_TX SER_CON_TX_PIN +#define SER_PHY_UART_CTS SER_CON_CTS_PIN +#define SER_PHY_UART_RTS SER_CON_RTS_PIN + +#endif //SER_PHY_CONFIG_CONN_NRF51_H__ diff --git a/components/serialization/common/transport/ser_phy/config/ser_phy_debug_app.h b/components/serialization/common/transport/ser_phy/config/ser_phy_debug_app.h new file mode 100644 index 0000000..349af24 --- /dev/null +++ b/components/serialization/common/transport/ser_phy/config/ser_phy_debug_app.h @@ -0,0 +1,162 @@ +/* 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 SER_PHY_DEBUG_APP_H__ +#define SER_PHY_DEBUG_APP_H__ + +#ifndef SER_PHY_DEBUG_APP_ENABLE + +#define DEBUG_EVT_SPI_MASTER_RAW_REQUEST(data) +#define DEBUG_EVT_SPI_MASTER_RAW_READY(data) +#define DEBUG_EVT_SPI_MASTER_RAW_XFER_DONE(data) +#define DEBUG_EVT_SPI_MASTER_RAW_API_CALL(data) +#define DEBUG_EVT_SPI_MASTER_RAW_READY_EDGE(data) +#define DEBUG_EVT_SPI_MASTER_RAW_REQUEST_EDGE(data) +#define DEBUG_EVT_SPI_MASTER_PHY_TX_PKT_SENT(data) +#define DEBUG_EVT_SPI_MASTER_PHY_RX_PKT_DROPPED(data) +#define DEBUG_EVT_SPI_MASTER_PHY_RX_PKT_RECEIVED(data) +#define DEBUG_EVT_SPI_MASTER_PHY_BUF_REQUEST(data) + +#define DEBUG_EVT_SPI_MASTER_RAW_XFER_GUARDED(data) +#define DEBUG_EVT_SPI_MASTER_RAW_XFER_PASSED(data) +#define DEBUG_EVT_SPI_MASTER_RAW_XFER_ABORTED(data) +#define DEBUG_EVT_SPI_MASTER_RAW_XFER_RESTARTED(data) + +#else +#include "stdint.h" + +//Low level hardware events +typedef enum +{ + SPI_MASTER_RAW_READY, + SPI_MASTER_RAW_REQUEST, + SPI_MASTER_RAW_XFER_DONE, + SPI_MASTER_RAW_API_CALL, + SPI_MASTER_RAW_READY_EDGE, + SPI_MASTER_RAW_REQUEST_EDGE, + SPI_MASTER_RAW_XFER_STARTED, + SPI_MASTER_RAW_XFER_GUARDED, + SPI_MASTER_RAW_XFER_PASSED, + SPI_MASTER_RAW_XFER_ABORTED, + SPI_MASTER_RAW_XFER_RESTARTED, + SPI_MASTER_PHY_TX_PKT_SENT, + SPI_MASTER_PHY_BUF_REQUEST, + SPI_MASTER_PHY_RX_PKT_RECEIVED, + SPI_MASTER_PHY_RX_PKT_DROPPED, + SPI_MASTER_EVT_MAX +} spi_master_raw_evt_type_t; + + +//Low level hardware event definition +typedef struct +{ + spi_master_raw_evt_type_t evt; + uint32_t data; +} spi_master_raw_evt_t; + +typedef void (*spi_master_raw_callback_t)(spi_master_raw_evt_t event); + +void debug_init(spi_master_raw_callback_t spi_master_raw_evt_callback); + +void debug_evt(spi_master_raw_evt_type_t evt, uint32_t data); + + +#define DEBUG_EVT(evt, data) \ +do { \ + debug_evt(evt, data); \ +} while(0); + + +#define DEBUG_EVT_SPI_MASTER_RAW_REQUEST(data) \ +do { \ + DEBUG_EVT(SPI_MASTER_RAW_REQUEST, data); \ +} while (0); + + +#define DEBUG_EVT_SPI_MASTER_RAW_READY(data) \ +do { \ + DEBUG_EVT(SPI_MASTER_RAW_READY, data); \ +} while (0); + + +#define DEBUG_EVT_SPI_MASTER_RAW_XFER_DONE(data) \ +do { \ + DEBUG_EVT(SPI_MASTER_RAW_XFER_DONE, data); \ +} while (0); + + +#define DEBUG_EVT_SPI_MASTER_RAW_API_CALL(data) \ +do { \ + DEBUG_EVT(SPI_MASTER_RAW_API_CALL, data); \ +} while (0); + + +#define DEBUG_EVT_SPI_MASTER_RAW_READY_EDGE(data) \ +do { \ + DEBUG_EVT(SPI_MASTER_RAW_READY_EDGE, data); \ +} while (0); + + +#define DEBUG_EVT_SPI_MASTER_RAW_REQUEST_EDGE(data) \ +do { \ + DEBUG_EVT(SPI_MASTER_RAW_REQUEST_EDGE, data); \ +} while (0); + + +#define DEBUG_EVT_SPI_MASTER_PHY_TX_PKT_SENT(data) \ +do { \ + DEBUG_EVT(SPI_MASTER_PHY_TX_PKT_SENT, data); \ +} while (0); + + +#define DEBUG_EVT_SPI_MASTER_PHY_RX_PKT_DROPPED(data) \ +do { \ + DEBUG_EVT(SPI_MASTER_PHY_RX_PKT_DROPPED, data); \ +} while (0); + + +#define DEBUG_EVT_SPI_MASTER_PHY_RX_PKT_RECEIVED(data) \ +do { \ + DEBUG_EVT(SPI_MASTER_PHY_RX_PKT_RECEIVED, data); \ +} while (0); + + +#define DEBUG_EVT_SPI_MASTER_PHY_BUF_REQUEST(data) \ +do { \ + DEBUG_EVT(SPI_MASTER_PHY_BUF_REQUEST, data); \ +} while (0); + +#define DEBUG_EVT_SPI_MASTER_RAW_XFER_GUARDED(data) \ +do { \ + DEBUG_EVT(SPI_MASTER_RAW_XFER_GUARDED, data); \ +} while (0); + +#define DEBUG_EVT_SPI_MASTER_RAW_XFER_PASSED(data) \ +do { \ + DEBUG_EVT(SPI_MASTER_RAW_XFER_PASSED, data); \ +} while (0); + +#define DEBUG_EVT_SPI_MASTER_RAW_XFER_ABORTED(data) \ +do { \ + DEBUG_EVT(SPI_MASTER_RAW_XFER_ABORTED, data); \ +} while (0); + +#define DEBUG_EVT_SPI_MASTER_RAW_XFER_RESTARTED(data) \ +do { \ + DEBUG_EVT(SPI_MASTER_RAW_XFER_RESTARTED, data); \ +} while (0); + + + +#endif + +#endif //SER_PHY_DEBUG_APP_H__ diff --git a/components/serialization/common/transport/ser_phy/config/ser_phy_debug_conn.h b/components/serialization/common/transport/ser_phy/config/ser_phy_debug_conn.h new file mode 100644 index 0000000..043d2b9 --- /dev/null +++ b/components/serialization/common/transport/ser_phy/config/ser_phy_debug_conn.h @@ -0,0 +1,130 @@ +/* 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 SER_PHY_DEBUG_CONN_H__ +#define SER_PHY_DEBUG_CONN_H__ + +#ifndef SER_PHY_DEBUG_CONN_ENABLE + +#define DEBUG_EVT_SPI_SLAVE_RAW_RX_XFER_DONE(data); + +#define DEBUG_EVT_SPI_SLAVE_RAW_TX_XFER_DONE(data); + +#define DEBUG_EVT_SPI_SLAVE_RAW_BUFFERS_SET(data); + +#define DEBUG_EVT_SPI_SLAVE_RAW_REQ_SET(data); + +#define DEBUG_EVT_SPI_SLAVE_RAW_REQ_CLEARED(data); + +#define DEBUG_EVT_SPI_SLAVE_PHY_BUF_REQUEST(data); + +#define DEBUG_EVT_SPI_SLAVE_PHY_PKT_RECEIVED(data); + +#define DEBUG_EVT_SPI_SLAVE_PHY_PKT_DROPPED(data); + +#define DEBUG_EVT_SPI_SLAVE_PHY_PKT_SENT(data); + +#else + +#include "stdint.h" + +// low level hardware event types +typedef enum +{ + SPI_SLAVE_RAW_BUFFERS_SET, + SPI_SLAVE_RAW_RX_XFER_DONE, + SPI_SLAVE_RAW_TX_XFER_DONE, + SPI_SLAVE_RAW_REQ_SET, + SPI_SLAVE_RAW_REQ_CLEARED, + SPI_SLAVE_PHY_BUF_REQUEST, + SPI_SLAVE_PHY_PKT_SENT, + SPI_SLAVE_PHY_PKT_RECEIVED, + SPI_SLAVE_PHY_PKT_DROPPED, + SPI_SLAVE_RAW_EVT_TYPE_MAX +} spi_slave_raw_evt_type_t; + +// low level hardware event definition +typedef struct +{ + spi_slave_raw_evt_type_t evt_type; + uint32_t data; +} spi_slave_raw_evt_t; + +typedef void (*spi_slave_raw_callback_t)(spi_slave_raw_evt_t event); + +void debug_init(spi_slave_raw_callback_t spi_slave_raw_evt_callback); + +void debug_evt(spi_slave_raw_evt_type_t evt_type, uint32_t data); + +#define DEBUG_EVT(evt, data) \ +do { \ + debug_evt(evt, data); \ +} while (0); + + +#define DEBUG_EVT_SPI_SLAVE_RAW_RX_XFER_DONE(data) \ +do { \ + DEBUG_EVT(SPI_SLAVE_RAW_RX_XFER_DONE, data); \ +} while (0); + + +#define DEBUG_EVT_SPI_SLAVE_RAW_TX_XFER_DONE(data) \ +do { \ + DEBUG_EVT(SPI_SLAVE_RAW_TX_XFER_DONE, data); \ +} while (0); + + +#define DEBUG_EVT_SPI_SLAVE_RAW_BUFFERS_SET(data) \ +do { \ + DEBUG_EVT(SPI_SLAVE_RAW_BUFFERS_SET, data); \ +} while (0); + + +#define DEBUG_EVT_SPI_SLAVE_RAW_REQ_SET(data) \ +do { \ + DEBUG_EVT(SPI_SLAVE_RAW_REQ_SET, data); \ +} while (0); + + +#define DEBUG_EVT_SPI_SLAVE_RAW_REQ_CLEARED(data) \ +do { \ + DEBUG_EVT(SPI_SLAVE_RAW_REQ_CLEARED, data); \ +} while (0); + + +#define DEBUG_EVT_SPI_SLAVE_PHY_BUF_REQUEST(data) \ +do { \ + DEBUG_EVT(SPI_SLAVE_PHY_BUF_REQUEST, data); \ +} while (0); + + +#define DEBUG_EVT_SPI_SLAVE_PHY_PKT_RECEIVED(data) \ +do { \ + DEBUG_EVT(SPI_SLAVE_PHY_PKT_RECEIVED, data); \ +} while (0); + + +#define DEBUG_EVT_SPI_SLAVE_PHY_PKT_DROPPED(data) \ +do { \ + DEBUG_EVT(SPI_SLAVE_PHY_PKT_DROPPED, data); \ +} while (0); + + +#define DEBUG_EVT_SPI_SLAVE_PHY_PKT_SENT(data) \ +do { \ + DEBUG_EVT(SPI_SLAVE_PHY_PKT_SENT, data); \ +} while (0); + + +#endif + +#endif //SER_PHY_DEBUG_CONN_H__ diff --git a/components/serialization/common/transport/ser_phy/ser_phy.c b/components/serialization/common/transport/ser_phy/ser_phy.c new file mode 100644 index 0000000..e531487 --- /dev/null +++ b/components/serialization/common/transport/ser_phy/ser_phy.c @@ -0,0 +1,61 @@ +/* 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 "ser_phy.h" +#include "app_error.h" + + +__weak uint32_t ser_phy_open(ser_phy_events_handler_t events_handler) +{ + /* A function stub. Function should be implemented according to ser_phy.h API. */ + APP_ERROR_CHECK_BOOL(false); + + return NRF_SUCCESS; +} + +__weak uint32_t ser_phy_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes) +{ + /* A function stub. Function should be implemented according to ser_phy.h API. */ + APP_ERROR_CHECK_BOOL(false); + + return NRF_SUCCESS; +} + +__weak uint32_t ser_phy_rx_buf_set(uint8_t * p_buffer) +{ + /* A function stub. Function should be implemented according to ser_phy.h API. */ + APP_ERROR_CHECK_BOOL(false); + + return NRF_SUCCESS; +} + +__weak void ser_phy_close(void) +{ + /* A function stub. Function should be implemented according to ser_phy.h API. */ + APP_ERROR_CHECK_BOOL(false); +} + + +__weak void ser_phy_interrupts_enable(void) +{ + /* A function stub. Function should be implemented according to ser_phy.h API. */ + APP_ERROR_CHECK_BOOL(false); +} + + +__weak void ser_phy_interrupts_disable(void) +{ + /* A function stub. Function should be implemented according to ser_phy.h API. */ + APP_ERROR_CHECK_BOOL(false); +} + + diff --git a/components/serialization/common/transport/ser_phy/ser_phy.h b/components/serialization/common/transport/ser_phy/ser_phy.h new file mode 100644 index 0000000..c797699 --- /dev/null +++ b/components/serialization/common/transport/ser_phy/ser_phy.h @@ -0,0 +1,256 @@ + /* 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. + * + */ + +/** @file + * + * @defgroup ser_phy Serialization PHY + * @{ + * @ingroup ble_sdk_lib_serialization + * + * @brief PHY layer layer for serialization. + * + * @details This file contains declarations of functions and definitions of data structures and + * identifiers (typedef enum) used as API of the serialization PHY layer. + * + * \par Rationale + * Each specific PHY layer (SPI, I2C, UART, low power UART etc.) should provide the same API. This + * allows the layer above (the HAL Transport layer) which is responsible for controlling the PHY + * layer, memory management, crc, retransmission etc. to be hardware independent. + * + * + * \par Interlayer communication and control + * The PHY layer is controlled by the HAL Transport layer by calling functions declared in this + * file. + * The PHY layer communicates events to the HAL Transport layer by calling a callback function. + * A handler to this function is passed in the @ref ser_phy_open function. This callback function + * should be called with parameter of type @ref ser_phy_evt_t filled accordingly to an event to be + * passed. Types of supported events are defined in @ref ser_phy_evt_type_t. + * For example to pass an event indicating that RX packet has been successfully received first a + * struct of type @ref ser_phy_evt_t has to be filled: + * ser_phy_evt_t phy_evt; + * phy_evt.evt_type = SER_PHY_EVT_RX_PKT_RECEIVED; + * phy_evt.evt_params.rx_pkt_received.p_buffer = (pointer to the RX buffer); + * phy_evt.evt_params.rx_pkt_received.num_of_bytes = (number of received bytes); + * and then the callback function has to be called: + * events_handler(phy_evt); + * All functions declared in this file are obligatory to implement. Some events specified in the + * @ref ser_phy_evt_type_t are optional to implement. + * + * \par Transmitting a packet + * Each PHY layer is responsible for adding the PHY header to a packet to be sent. This header + * shall consists of 16-bit field carrying the packet length (the uint16_encode function defined in + * app_util.h should be used to ensure endianness independence). A pointer to a packet to be sent + * and a length of the packet are parameters of the @ref ser_phy_tx_pkt_send function. When a packet + * has been transmitted an event of type @ref SER_PHY_EVT_TX_PKT_SENT should be emitted. + * + * \image html ser_phy_transport_tx.png "TX - interlayer communication" + * + * + * \par Receiving a packet + * The PHY layer should be able to store only the PHY header (16-bit field carrying the packet + * length). After the PHY header has been received the transmission shall be halted and the PHY + * layer has to sent a request to the HAL Transport layer for a memory to store a packet - an event + * of type @ref SER_PHY_EVT_RX_BUF_REQUEST with event parameters defined in + * @ref ser_phy_evt_rx_buf_request_params_t (the uint16_decode function defined in app_util.h should + * be used for header decoding to ensure endianness independence). The transmission should be + * resumed when @ref ser_phy_rx_buf_set function has been called. + * + * When @ref ser_phy_rx_buf_set function parameter is equal to NULL it means that there is not + * enough memory to store the packet, however the packet shall be received to dummy location to + * ensure continuous communication. After receiving has finished an event of type + * @ref SER_PHY_EVT_RX_PKT_DROPPED shall be generated. + * + * \image html ser_phy_transport_rx_dropped.png "RX dropping - interlayer communication" + * + * When @ref ser_phy_rx_buf_set function parameter is different from NULL the packet should be + * received to a buffer pointed by it. After receiving has finished an event of type + * @ref SER_PHY_EVT_RX_PKT_RECEIVED shall be generated with event parameters defined in + * @ref ser_phy_evt_rx_pkt_received_params_t. + * + * \image html ser_phy_transport_rx_received.png "RX - interlayer communication" + * + * + * \par PHY layer errors + * PHY layer errors can be signaled by an event of type @ref SER_PHY_EVT_RX_OVERFLOW_ERROR or + * @ref SER_PHY_EVT_TX_OVERREAD_ERROR or @ref SER_PHY_EVT_HW_ERROR with event parameters defined in + * @ref ser_phy_evt_hw_error_params_t. + * + */ + +#ifndef SER_PHY_H__ +#define SER_PHY_H__ + +#include + +/**@brief Serialization PHY module events types. */ +typedef enum +{ + SER_PHY_EVT_TX_PKT_SENT = 0, /**< Obligatory to implement. An event indicating that TX packet + * has been transmitted. */ + SER_PHY_EVT_RX_BUF_REQUEST, /**< Obligatory to implement. An event indicating that phy layer + * needs a buffer for RX packet. A PHY flow should be blocked + * until @ref ser_phy_rx_buf_set function is called. */ + SER_PHY_EVT_RX_PKT_RECEIVED, /**< Obligatory to implement. An event indicating that RX packet + * has been successfully received. */ + SER_PHY_EVT_RX_PKT_DROPPED, /**< Obligatory to implement. An event indicating that RX packet + * receiving has been finished but packet was discarded because + * it was longer than available buffer. */ + + SER_PHY_EVT_RX_OVERFLOW_ERROR, /**< Optional to implement. An event indicating that more + * information has been transmitted than phy module could + * handle. */ + SER_PHY_EVT_TX_OVERREAD_ERROR, /**< Optional to implement. An event indicating that phy module + * was forced to transmit more information than possessed. */ + SER_PHY_EVT_HW_ERROR, /**< Optional to implement. An event indicating a hardware error + * in phy module. */ + SER_PHY_EVT_TYPE_MAX /**< Enumeration upper bound. */ +} ser_phy_evt_type_t; + + +/**@brief A struct containing parameters of the event of type @ref SER_PHY_EVT_RX_BUF_REQUEST. */ +typedef struct +{ + uint16_t num_of_bytes; /**< Length of a buffer in octets that layer above PHY module should + * deliver to enable PHY module to receive packet. */ +} ser_phy_evt_rx_buf_request_params_t; + + +/**@brief A struct containing parameters of the event of type @ref SER_PHY_EVT_RX_PKT_RECEIVED. */ +typedef struct +{ + uint8_t * p_buffer; /**< Pointer to a buffer containing received packet. */ + uint16_t num_of_bytes; /**< Length of a received packet in octets. */ +} ser_phy_evt_rx_pkt_received_params_t; + + +/**@brief A struct containing parameters of the event of type @ref SER_PHY_EVT_HW_ERROR. */ +typedef struct +{ + uint32_t error_code; /**< Hardware error code - specific for any microcontroller. */ + uint8_t * p_buffer; /**< Pointer to the buffer that was processed when error occured. */ +} ser_phy_evt_hw_error_params_t; + + +/**@brief A struct containing events from a Serialization PHY module. + * + * @note Some events do not have parameters, then whole information is contained in the evt_type. + */ +typedef struct +{ + ser_phy_evt_type_t evt_type; /**< Type of an event. */ + + union /**< Union alternative identified by evt_type in enclosing struct. */ + { + /** Parameters of the event of type @ref SER_PHY_EVT_RX_BUF_REQUEST. */ + ser_phy_evt_rx_buf_request_params_t rx_buf_request; + /** Parameters of the event of type @ref SER_PHY_EVT_RX_PKT_RECEIVED. */ + ser_phy_evt_rx_pkt_received_params_t rx_pkt_received; + /** Parameters of the event of type @ref SER_PHY_EVT_HW_ERROR. */ + ser_phy_evt_hw_error_params_t hw_error; + } evt_params; +} ser_phy_evt_t; + + +/**@brief A type of generic callback function handler to be used by all PHY module events. + * + * @param[in] event Serialization PHY module event. + */ +typedef void (*ser_phy_events_handler_t)(ser_phy_evt_t event); + + +/**@brief A function for opening and initializing a PHY module. + * + * @note The function initializes hardware and internal module states, and registers callback + * function to be used by all PHY module events. + * + * @warning If the function has been already called, the function @ref ser_phy_close has to be + * called before ser_phy_open can be called again. + * + * @param[in] events_handler Generic callback function handler to be used by all PHY module + * events. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_INVALID_STATE Operation failure. The function has been already called. + * To call it again the function @ref ser_phy_close has to be + * called previously. + * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_PARAM Operation failure. Hardware initialization parameters are not + * supported. + */ +uint32_t ser_phy_open(ser_phy_events_handler_t events_handler); + + +/**@brief A function for transmitting a packet. + * + * @note The function adds a packet pointed by p_buffer parameter to a transmission queue and + * schedules generating an event of type @ref SER_PHY_EVT_TX_PKT_SENT upon transmission + * completion. + * + * @param[in] p_buffer Pointer to a buffer to transmit. + * @param[in] num_of_bytes Number of octets to transmit. Must be more than 0. + * + * @retval NRF_SUCCESS Operation success. Packet was added to the transmission queue + * and event will be send upon transmission completion. + * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_PARAM Operation failure. The num_of_bytes parameter equal to 0. + * @retval NRF_ERROR_BUSY Operation failure. Transmitting of a packet in progress. + */ +uint32_t ser_phy_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes); + + +/**@brief A function for setting an RX buffer and enabling reception of data (the PHY flow). + * + * @note The function has to be called as a response to an event of type + * @ref SER_PHY_EVT_RX_BUF_REQUEST. The function sets an RX buffer and enables reception of + * data (enables the PHY flow). + * Size of a buffer pointed by the p_buffer parameter should be at least equal to the + * num_of_bytes parameter passed within the event (@ref ser_phy_evt_rx_buf_request_params_t) + * or p_buffer should be equal to NULL if there is not enough memory. + * When p_buffer is different from NULL and num_of_bytes octets has been received an event of + * type @ref SER_PHY_EVT_RX_PKT_RECEIVED is generated + * (@ref ser_phy_evt_rx_pkt_received_params_t). + * When p_buffer is equal to NULL data are received to dummy location to ensure continuous + * communication. Then if num_of_bytes octets has been received an event of type + * @ref SER_PHY_EVT_RX_PKT_DROPPED is generated. + * + * @param[in] p_buffer Pointer to an RX buffer where to receive. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_INVALID_STATE Operation failure. A buffer was set without request. + */ +uint32_t ser_phy_rx_buf_set(uint8_t * p_buffer); + + +/**@brief A function for closing a PHY module. + * + * @note The function disables hardware, resets internal module states and unregisters events + * callback function. + */ +void ser_phy_close(void); + + +/**@brief A function for enabling a PHY module interrupts. + * + * @note The function enables all interrupts that are used by a PHY module (and only those). + */ +void ser_phy_interrupts_enable(void); + + +/**@brief A function for disabling a PHY module interrupts. + * + * @note The function disables all interrupts that are used by a PHY module (and only those). + */ +void ser_phy_interrupts_disable(void); + + +#endif /* SER_PHY_H__ */ +/** @} */ diff --git a/components/serialization/common/transport/ser_phy/ser_phy_hci.c b/components/serialization/common/transport/ser_phy/ser_phy_hci.c new file mode 100644 index 0000000..e675e16 --- /dev/null +++ b/components/serialization/common/transport/ser_phy/ser_phy_hci.c @@ -0,0 +1,1667 @@ +/* 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 +#include + +#include "app_error.h" +#include "app_util.h" +#include "app_util_platform.h" +#include "app_timer.h" +#include "app_mailbox.h" +#include "ser_phy.h" +#include "ser_phy_hci.h" +#include "crc16.h" +#include "nrf_soc.h" +#include "ser_config.h" +#include "ser_phy_debug_comm.h" +// hide globals for release version, expose for debug version +#if defined(SER_PHY_HCI_DEBUG_ENABLE) +#define _static +#else +#define _static static +#endif + +#define PKT_HDR_SIZE 4 /**< Packet header size in number of bytes. */ +#define PKT_CRC_SIZE 2 /**< Packet CRC size in number of bytes. */ +#define MAX_PACKET_SIZE_IN_BITS (11uL * \ + (SER_HAL_TRANSPORT_MAX_PKT_SIZE + PKT_HDR_SIZE + PKT_CRC_SIZE)) +#define BAUD_TIME_us (1000000uL / SER_PHY_UART_BAUDRATE_VAL) + +#define TX_EVT_QUEUE_SIZE 16 +#define RX_EVT_QUEUE_SIZE 16 +#define PKT_TYPE_VENDOR_SPECIFIC 14 /**< Packet type vendor specific. */ +#define PKT_TYPE_ACK 0 /**< Packet type acknowledgement. */ +#define PKT_TYPE_LINK_CONTROL 15 /**< Packet type link control. */ +#define DATA_INTEGRITY_MASK (1 << 6) /**< Mask for data integrity bit in the packet header. */ +#define RELIABLE_PKT_MASK (1 << 7) /**< Mask for reliable packet bit in the packet header. */ +#define INITIAL_ACK_NUMBER_EXPECTED 0 /**< Initial acknowledge number expected. */ +#define INITIAL_SEQ_NUMBER INITIAL_ACK_NUMBER_EXPECTED /**< Initial acknowledge number transmitted. */ +#define INVALID_PKT_TYPE 0xFFFFFFFFu /**< Internal invalid packet type value. */ +#define MAX_TRANSMISSION_TIME_ms (MAX_PACKET_SIZE_IN_BITS * BAUD_TIME_us / 1000uL) /**< Max transmission time of a single application packet over UART in units of mseconds. */ +#define RETRANSMISSION_TIMEOUT_IN_ms (10uL * MAX_TRANSMISSION_TIME_ms) /**< Retransmission timeout for application packet in units of mseconds. */ + +#ifdef HCI_LINK_CONTROL +#define HCI_PKT_SYNC 0x7E01u /**< Link Control Packet: type SYNC */ +#define HCI_PKT_SYNC_RSP 0x7D02u /**< Link Control Packet: type SYNC RESPONSE */ +#define HCI_PKT_CONFIG 0xFC03u /**< Link Control Packet: type CONFIG */ +#define HCI_PKT_CONFIG_RSP 0x7B04u /**< Link Control Packet: type CONFIG RESPONSE */ +#define HCI_CONFIG_FIELD 0x11u /**< Configuration field of CONFIG and CONFIG_RSP packet */ +#define HCI_PKT_SYNC_SIZE 6u /**< Size of SYNC and SYNC_RSP packet */ +#define HCI_PKT_CONFIG_SIZE 7u /**< Size of CONFIG and CONFIG_RSP packet */ +#define HCI_LINK_CONTROL_PKT_INVALID 0xFFFFu /**< Size of CONFIG and CONFIG_RSP packet */ +#endif /* HCI_LINK_CONTROL */ + +#ifndef APP_TIMER_PRESCALER +#define APP_TIMER_PRESCALER 0 +#endif + +#define RETRANSMISSION_TIMEOUT_IN_TICKS (APP_TIMER_TICKS(RETRANSMISSION_TIMEOUT_IN_ms, \ + APP_TIMER_PRESCALER)) /**< Retransmission timeout for application packet in units of timer ticks. */ +#define MAX_RETRY_COUNT 5 /**< Max retransmission retry count for application packets. */ + +#if (defined(HCI_TIMER0)) +#define HCI_TIMER NRF_TIMER0 +#define HCI_TIMER_IRQn TIMER0_IRQn +#define HCI_TIMER_IRQHandler TIMER0_IRQHandler +#elif (defined(HCI_TIMER1)) +#define HCI_TIMER NRF_TIMER1 +#define HCI_TIMER_IRQn TIMER1_IRQn +#define HCI_TIMER_IRQHandler TIMER1_IRQHandler +#elif (defined(HCI_TIMER2)) +#define HCI_TIMER NRF_TIMER2 +#define HCI_TIMER_IRQn TIMER2_IRQn +#define HCI_TIMER_IRQHandler TIMER2_IRQHandler +#else +#define HCI_APP_TIMER +#endif + + +/**@brief States of the hci event driven state machine. */ +typedef enum +{ + HCI_TX_STATE_DISABLE, + HCI_TX_STATE_SEND, + HCI_TX_STATE_WAIT_FOR_FIRST_TX_END, + HCI_TX_STATE_WAIT_FOR_ACK_OR_TX_END, + HCI_TX_STATE_WAIT_FOR_ACK, + HCI_TX_STATE_WAIT_FOR_TX_END +} hci_tx_fsm_state_t; + +typedef enum +{ + HCI_RX_STATE_DISABLE, + HCI_RX_STATE_RECEIVE, + HCI_RX_STATE_WAIT_FOR_MEM, + HCI_RX_STATE_WAIT_FOR_SLIP_ACK_END, + HCI_RX_STATE_WAIT_FOR_SLIP_NACK_END, +} hci_rx_fsm_state_t; + +typedef enum +{ + HCI_EVT_TIMEOUT, +} hci_timer_evt_type_t; + +typedef enum +{ + HCI_SER_PHY_TX_REQUEST, + HCI_SER_PHY_RX_BUF_GRANTED, + HCI_SER_PHY_EVT_GEN_ENABLE, + HCI_SER_PHY_EVT_GEN_DISABLE +} ser_phy_int_evt_type_t; + +typedef enum +{ + HCI_SER_PHY_EVT, + HCI_SLIP_EVT, + HCI_TIMER_EVT, +} hci_evt_source_t; + +#ifdef HCI_LINK_CONTROL +typedef enum +{ + HCI_MODE_DISABLE, + HCI_MODE_UNINITIALIZED, + HCI_MODE_INITIALIZED, + HCI_MODE_ACTIVE, +} hci_mode_t; +#endif /*HCI_LINK_CONTROL */ + +typedef struct +{ + hci_timer_evt_type_t evt_type; /**< Type of an event. */ +} hci_timer_evt_t; + +typedef struct +{ + ser_phy_int_evt_type_t evt_type; /**< Type of an event. */ +} ser_phy_int_evt_t; + +typedef struct +{ + hci_evt_source_t evt_source; /**< source of an event. */ + union + { + ser_phy_int_evt_t ser_phy_evt; /**< ser_phy event. */ + ser_phy_hci_slip_evt_t ser_phy_slip_evt; /**< ser_phy_hci event. */ + hci_timer_evt_t timer_evt; /**< timer event. */ + } evt; +} hci_evt_t; + +_static uint8_t m_tx_packet_header[PKT_HDR_SIZE]; +_static uint8_t m_tx_packet_crc[PKT_CRC_SIZE]; +_static uint8_t m_tx_ack_packet[PKT_HDR_SIZE]; +#ifdef HCI_LINK_CONTROL +_static uint8_t m_tx_link_control_header[PKT_HDR_SIZE]; +_static uint8_t m_tx_link_control_payload[HCI_PKT_CONFIG_SIZE - PKT_HDR_SIZE]; +#endif /* HCI_LINK_CONTROL */ + +_static uint32_t m_packet_ack_number; // Sequence number counter of the packet expected to be received +_static uint32_t m_packet_seq_number; // Sequence number counter of the transmitted packet for which acknowledgement packet is waited for + + +_static uint32_t m_tx_retry_count; + + +// _static uint32_t m_tx_retx_counter = 0; +// _static uint32_t m_rx_drop_counter = 0; + + +APP_MAILBOX_DEF(tx_evt_queue, TX_EVT_QUEUE_SIZE, sizeof(hci_evt_t)); +APP_MAILBOX_DEF(rx_evt_queue, RX_EVT_QUEUE_SIZE, sizeof(hci_evt_t)); + +_static hci_tx_fsm_state_t m_hci_tx_fsm_state = HCI_TX_STATE_DISABLE; +_static hci_rx_fsm_state_t m_hci_rx_fsm_state = HCI_RX_STATE_DISABLE; + +#ifdef HCI_LINK_CONTROL +_static hci_mode_t m_hci_mode = HCI_MODE_DISABLE; +_static uint16_t m_hci_link_control_next_pkt = HCI_PKT_SYNC; +_static bool m_hci_other_side_active = false; +#endif /* HCI_LINK_CONTROL */ + +#ifdef HCI_APP_TIMER +APP_TIMER_DEF(m_app_timer_id); +#endif + +_static bool m_tx_fsm_idle_flag = true; +_static bool m_rx_fsm_idle_flag = true; + +_static bool m_buffer_reqested_flag = false; + +_static uint8_t * m_p_rx_buffer = NULL; +_static uint16_t m_rx_packet_length; +_static uint8_t * m_p_rx_packet; +_static uint8_t * m_p_tx_payload = NULL; +_static uint16_t m_tx_payload_length; + +_static ser_phy_events_handler_t m_ser_phy_callback = NULL; + +static void hci_tx_event_handler(hci_evt_t * p_event); +static void hci_rx_event_handler(hci_evt_t * p_event); +#ifdef HCI_LINK_CONTROL +static void hci_link_control_event_handler(hci_evt_t * p_event); +#endif /* HCI_LINK_CONTROL */ + +_static bool m_hci_timer_enabled_flag = true; +_static bool m_hci_timout_pending_flag = false; +_static bool m_hci_global_enable_flag = true; + +#define ser_phy_hci_assert(cond) APP_ERROR_CHECK_BOOL(cond) + +static void hci_signal_timeout_event(void) +{ + hci_evt_t event; + + event.evt_source = HCI_TIMER_EVT; + event.evt.timer_evt.evt_type = HCI_EVT_TIMEOUT; + DEBUG_EVT_TIMEOUT(0); + +#ifndef HCI_LINK_CONTROL + hci_tx_event_handler(&event); +#else + hci_link_control_event_handler(&event); + if((m_hci_mode == HCI_MODE_ACTIVE) && m_hci_other_side_active) + { + hci_tx_event_handler(&event); + } +#endif /* HCI_LINK_CONTROL */ +} + + +#ifndef HCI_APP_TIMER + +void HCI_TIMER_IRQHandler(void) +{ + + if ((HCI_TIMER->EVENTS_COMPARE[1] == 1) && (HCI_TIMER->INTENSET & TIMER_INTENSET_COMPARE1_Msk)) + { + HCI_TIMER->EVENTS_COMPARE[1] = 0; + HCI_TIMER->TASKS_CLEAR = 1; + + if (m_hci_timer_enabled_flag) + { + hci_signal_timeout_event(); + } + else + { + m_hci_timout_pending_flag = true; + } + } +} + + +static void hci_timeout_setup(uint32_t count) +{ + + uint32_t time_msec; + + if (count) + { + HCI_TIMER->INTENCLR = TIMER_INTENCLR_COMPARE1_Msk; + time_msec = count * RETRANSMISSION_TIMEOUT_IN_ms; + HCI_TIMER->CC[1] = time_msec * 31; + HCI_TIMER->CC[1] += time_msec / 4; + HCI_TIMER->TASKS_CLEAR = 1; // < Clear TIMER + HCI_TIMER->EVENTS_COMPARE[1] = 0; + HCI_TIMER->TASKS_START = 1; // < Start TIMER + HCI_TIMER->INTENSET = TIMER_INTENSET_COMPARE1_Msk; + } + else + { + HCI_TIMER->INTENCLR = TIMER_INTENCLR_COMPARE1_Msk; + HCI_TIMER->TASKS_STOP = 1; // < Start TIMER + } +} + + +#else + +_static bool m_hci_timer_setup_flag = false; +_static uint32_t m_hci_timer_counter = 0; +_static uint32_t m_hci_timer_setup; + +static void hci_timeout_setup(uint32_t count) +{ + m_hci_timer_setup = count; + m_hci_timer_setup_flag = true; +} + + +static void hci_timeout_handler(void * p_context) +{ + + if (m_hci_timer_setup_flag) + { + m_hci_timer_setup_flag = false; + m_hci_timer_counter = m_hci_timer_setup; /* for 1 it will be always more than 1 tick - jitter is up to 1 tick */ + } + else if ( m_hci_timer_counter ) + { + m_hci_timer_counter--; + + if (m_hci_timer_counter == 0) + { + if (m_hci_timer_enabled_flag) + { + hci_signal_timeout_event(); + } + else + { + m_hci_timout_pending_flag = true; + } + } + } + return; +} + + +#endif + + +/**@brief Function for validating a received packet. + * + * @param[in] p_buffer Pointer to the packet data. + * @param[in] length Length of packet data in bytes. + * + * @return true if received packet is valid, false in other case. + */ +static bool is_rx_pkt_valid(const uint8_t * p_buffer, uint32_t length) +{ + // Executed packet filtering algorithm order: + // - verify packet overall length + // - verify data integrity bit set + // - verify reliable packet bit set + // - verify supported packet type + // - verify header checksum + // - verify payload length field + // - verify CRC + if (length <= PKT_HDR_SIZE) + { + return false; + } + + if (!(p_buffer[0] & DATA_INTEGRITY_MASK)) + { + return false; + } + + if (!(p_buffer[0] & RELIABLE_PKT_MASK)) + { + return false; + } + + if ((p_buffer[1] & 0x0Fu) != PKT_TYPE_VENDOR_SPECIFIC) + { + return false; + } + + const uint32_t expected_checksum = + ((p_buffer[0] + p_buffer[1] + p_buffer[2] + p_buffer[3])) & 0xFFu; + + if (expected_checksum != 0) + { + return false; + } + + const uint16_t crc_calculated = crc16_compute(p_buffer, (length - PKT_CRC_SIZE), NULL); + const uint16_t crc_received = uint16_decode(&p_buffer[length - PKT_CRC_SIZE]); + + if (crc_calculated != crc_received) + { + return false; + } + + return true; +} + + +/**@brief Function for getting the sequence number of the next reliable packet expected. + * + * @return sequence number of the next reliable packet expected. + */ +static __INLINE uint8_t packet_ack_get(void) +{ + return (uint8_t) m_packet_ack_number; +} + + +/**@brief Function for getting the sequence number of a reliable TX packet for which peer protocol + * entity acknowledgment is pending. + * + * @return sequence number of a reliable TX packet for which peer protocol entity acknowledgement + * is pending. + */ +static __INLINE uint8_t packet_seq_get(void) +{ + return m_packet_seq_number; +} + + +static __INLINE uint8_t packet_seq_nmbr_extract(const uint8_t * p_buffer) +{ + return (p_buffer[0] & 0x07u); +} + + +/**@brief Function for constructing 1st byte of the packet header of the packet to be transmitted. + * + * @return 1st byte of the packet header of the packet to be transmitted + */ +static __INLINE uint8_t tx_packet_byte_zero_construct(void) +{ + const uint32_t value = DATA_INTEGRITY_MASK | RELIABLE_PKT_MASK | + (packet_ack_get() << 3u) | packet_seq_get(); + + return (uint8_t) value; +} + + +/**@brief Function for calculating a packet header checksum. + * + * @param[in] p_hdr Pointer to the packet header. + * + * @return Calculated checksum. + */ +static __INLINE uint8_t header_checksum_calculate(const uint8_t * p_hdr) +{ + // @note: no pointer validation check needed as already checked by calling function. + uint32_t checksum; + + checksum = p_hdr[0]; + checksum += p_hdr[1]; + checksum += p_hdr[2]; + checksum &= 0xFFu; + checksum = (~checksum + 1u); + + return (uint8_t)checksum; +} + + +/**@brief Function for getting the expected ACK number. + * + * @return expected ACK number. + */ +static __INLINE uint8_t expected_ack_number_get(void) +{ + uint8_t seq_nmbr = packet_seq_get(); + + ++seq_nmbr; + seq_nmbr &= 0x07u; + + return seq_nmbr; +} + + +/**@brief Function for getting the expected ACK number. + * + * @return next expected ACK number. + */ + +static __INLINE uint8_t next_expected_ack_number_get(void) +{ + uint8_t seq_nmbr = expected_ack_number_get(); + + ++seq_nmbr; + seq_nmbr &= 0x07u; + + return seq_nmbr; +} + + +/**@brief Function for processing a received acknowledgement packet. + * + * Verifies does the received acknowledgement packet has the expected acknowledgement number and + * that the header checksum is correct. + * + * @param[in] p_buffer Pointer to the packet data. + * + * @return true if valid acknowledgement packet received. + */ + +static bool rx_ack_pkt_valid(const uint8_t * p_buffer) +{ + // @note: no pointer validation check needed as allready checked by calling function. + + // Verify header checksum. + const uint32_t expected_checksum = + ((p_buffer[0] + p_buffer[1] + p_buffer[2] + p_buffer[3])) & 0xFFu; + + if (expected_checksum != 0) + { + return false; + } + + const uint8_t ack_number = (p_buffer[0] >> 3u) & 0x07u; + + // Verify expected acknowledgment number. + return ( (ack_number == expected_ack_number_get()) || + (ack_number == next_expected_ack_number_get()) ); +} + + +/**@brief Function for decoding a packet type field. + * + * @param[in] p_buffer Pointer to the packet data. + * @param[in] length Length of packet data in bytes. + * + * @return Packet type field or INVALID_PKT_TYPE in case of decode error. + */ + +static uint32_t packet_type_decode(const uint8_t * p_buffer, uint32_t length) +{ + // @note: no pointer validation check needed as allready checked by calling function. + uint32_t return_value; + + if (length >= PKT_HDR_SIZE) + { + return_value = (p_buffer[1] & 0x0Fu); + } + else + { + return_value = INVALID_PKT_TYPE; + } + + return return_value; +} + +#ifdef HCI_LINK_CONTROL +/**@brief Function for decoding a link control packet. + * + * @param[in] p_buffer Pointer to the packet data. + * @param[in] length Length of packet data in bytes. + * + * @return Link Control Packet Type if decoding successful, HCI_LINK_CONTROL_PKT_INVALID otherwise. + */ +static uint16_t link_control_packet_decode(const uint8_t * p_buffer, uint32_t length) +{ + // @note: no pointer validation check needed as allready checked by calling function. + uint16_t packet_type = HCI_LINK_CONTROL_PKT_INVALID; + + // Executed link control packet filtering algorithm order: + // - verify packet overall length + // - verify data integrity bit cleared + // - verify reliable packet bit cleared + // - verify header checksum + // - verify payload: length and value + + if (length < HCI_PKT_SYNC_SIZE) + { + packet_type = HCI_LINK_CONTROL_PKT_INVALID; + } + + packet_type = p_buffer[PKT_HDR_SIZE] | (p_buffer[PKT_HDR_SIZE + 1] << 8u); + + if ((p_buffer[0] & DATA_INTEGRITY_MASK) || (p_buffer[0] & RELIABLE_PKT_MASK)) + { + packet_type = HCI_LINK_CONTROL_PKT_INVALID; + } + + const uint32_t expected_checksum = + ((p_buffer[0] + p_buffer[1] + p_buffer[2] + p_buffer[3])) & 0xFFu; + + if (expected_checksum != 0) + { + packet_type = HCI_LINK_CONTROL_PKT_INVALID; + } + + // This is a CONFIG or CONFIG_RSP packet + if ((packet_type == HCI_PKT_CONFIG) || (packet_type == HCI_PKT_CONFIG_RSP)) + { + if (length != HCI_PKT_CONFIG_SIZE) + { + packet_type = HCI_LINK_CONTROL_PKT_INVALID; + } + // Verify configuration field (0x11): + // - Sliding Window Size == 1, + // - OOF Flow Control == 0, + // - Data Integrity Check Type == 1, + // - Version Number == 0 + if (p_buffer[HCI_PKT_CONFIG_SIZE - 1] != HCI_CONFIG_FIELD) + { + packet_type = HCI_LINK_CONTROL_PKT_INVALID; + } + } + // This is a SYNC or SYNC_RSP packet + else if ((packet_type == HCI_PKT_SYNC) || (packet_type == HCI_PKT_SYNC_RSP)) + { + if (length != HCI_PKT_SYNC_SIZE) + { + packet_type = HCI_LINK_CONTROL_PKT_INVALID; + } + } + else + { + packet_type = HCI_LINK_CONTROL_PKT_INVALID; + } + + return packet_type; +} +#endif /* HCI_LINK_CONTROL */ + +/**@brief Function for writing an acknowledgment packet for transmission. + */ + +static void ack_transmit(void) +{ + uint32_t err_code; + // TX ACK packet format: + // - Unreliable Packet type + // - Payload Length set to 0 + // - Sequence Number set to 0 + // - Header checksum calculated + // - Acknowledge Number set correctly + m_tx_ack_packet[0] = (packet_ack_get() << 3u); + m_tx_ack_packet[1] = 0; + m_tx_ack_packet[2] = 0; + m_tx_ack_packet[3] = header_checksum_calculate(m_tx_ack_packet); + + ser_phy_hci_pkt_params_t pkt_header; + + pkt_header.p_buffer = m_tx_ack_packet; + pkt_header.num_of_bytes = PKT_HDR_SIZE; + DEBUG_EVT_SLIP_ACK_TX(0); + err_code = ser_phy_hci_slip_tx_pkt_send(&pkt_header, NULL, NULL); + ser_phy_hci_assert(err_code == NRF_SUCCESS); + + return; +} + + +static void ser_phy_event_callback(ser_phy_evt_t event) +{ + if (m_ser_phy_callback) + { + m_ser_phy_callback(event); + } + + return; +} + + +static void memory_request_callback(uint16_t size) +{ + ser_phy_evt_t event; + + DEBUG_EVT_HCI_PHY_EVT_BUF_REQUEST(0); + + event.evt_type = SER_PHY_EVT_RX_BUF_REQUEST; + event.evt_params.rx_buf_request.num_of_bytes = size; + ser_phy_event_callback(event); +} + + +static void packet_received_callback(uint8_t * pBuffer, uint16_t size) +{ + ser_phy_evt_t event; + + DEBUG_EVT_HCI_PHY_EVT_RX_PKT_RECEIVED(0); + + event.evt_type = SER_PHY_EVT_RX_PKT_RECEIVED; + event.evt_params.rx_pkt_received.num_of_bytes = size; + event.evt_params.rx_pkt_received.p_buffer = pBuffer; + ser_phy_event_callback(event); +} + + +static void packet_dropped_callback(void) +{ + ser_phy_evt_t event; + + DEBUG_EVT_HCI_PHY_EVT_RX_PKT_DROPPED(0); + + event.evt_type = SER_PHY_EVT_RX_PKT_DROPPED; + ser_phy_event_callback(event); +} + + +static void packet_transmitted_callback(void) +{ + ser_phy_evt_t event; + + DEBUG_EVT_HCI_PHY_EVT_TX_PKT_SENT(0); + + event.evt_type = SER_PHY_EVT_TX_PKT_SENT; + ser_phy_event_callback(event); +} + + +static void error_callback(void) +{ + ser_phy_evt_t event; + + DEBUG_EVT_HCI_PHY_EVT_TX_ERROR(0); + + event.evt_type = SER_PHY_EVT_HW_ERROR; + event.evt_params.hw_error.p_buffer = m_p_tx_payload; + ser_phy_event_callback(event); +} + + +static void hci_slip_event_handler(ser_phy_hci_slip_evt_t * p_event) +{ + hci_evt_t event; + uint32_t packet_type; + uint32_t err_code; + + if ( p_event->evt_type == SER_PHY_HCI_SLIP_EVT_PKT_SENT ) + { + DEBUG_EVT_SLIP_PACKET_TXED(0); + event.evt_source = HCI_SLIP_EVT; + event.evt.ser_phy_slip_evt.evt_type = p_event->evt_type; +#ifndef HCI_LINK_CONTROL + hci_tx_event_handler(&event); +#else + if ((m_hci_mode == HCI_MODE_ACTIVE) && m_hci_other_side_active) + { + hci_tx_event_handler(&event); + } +#endif /*HCI_LINK_CONTROL*/ + } + else if ( p_event->evt_type == SER_PHY_HCI_SLIP_EVT_ACK_SENT ) + { + DEBUG_EVT_SLIP_ACK_TXED(0); + event.evt_source = HCI_SLIP_EVT; + event.evt.ser_phy_slip_evt.evt_type = p_event->evt_type; +#ifndef HCI_LINK_CONTROL + hci_rx_event_handler(&event); +#else + if ((m_hci_mode == HCI_MODE_ACTIVE) && m_hci_other_side_active) + { + hci_rx_event_handler(&event); + } +#endif /* HCI_LINK_CONTROL */ + } + + else if ( p_event->evt_type == SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED ) + { + event.evt_source = HCI_SLIP_EVT; + event.evt.ser_phy_slip_evt.evt_type = p_event->evt_type; + event.evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer = + p_event->evt_params.received_pkt.p_buffer; + event.evt.ser_phy_slip_evt.evt_params.received_pkt.num_of_bytes = + p_event->evt_params.received_pkt.num_of_bytes; + ser_phy_hci_assert(event.evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer != NULL); + ser_phy_hci_assert(event.evt.ser_phy_slip_evt.evt_params.received_pkt.num_of_bytes != 0); + packet_type = packet_type_decode( + event.evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer, + event.evt.ser_phy_slip_evt.evt_params.received_pkt.num_of_bytes); + + if (packet_type == PKT_TYPE_ACK ) + { + DEBUG_EVT_SLIP_ACK_RXED(0); +#ifndef HCI_LINK_CONTROL + hci_tx_event_handler(&event); +#else + if ((m_hci_mode == HCI_MODE_ACTIVE) && m_hci_other_side_active) + { + hci_tx_event_handler(&event); + } + else + { + err_code = ser_phy_hci_slip_rx_buf_free( + event.evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer); + } +#endif /* HCI_LINK_CONTROL */ + } + else if ( packet_type == PKT_TYPE_VENDOR_SPECIFIC ) + { + if (is_rx_pkt_valid(event.evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer, + event.evt.ser_phy_slip_evt.evt_params.received_pkt.num_of_bytes)) + { + DEBUG_EVT_SLIP_PACKET_RXED(0); +#ifndef HCI_LINK_CONTROL + hci_rx_event_handler(&event); +#else + if ((m_hci_mode == HCI_MODE_ACTIVE) && m_hci_other_side_active) + { + hci_rx_event_handler(&event); + } + else + { + err_code = ser_phy_hci_slip_rx_buf_free( + event.evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer); + } +#endif /* HCI_LINK_CONTROL */ + } + else + { + err_code = ser_phy_hci_slip_rx_buf_free( + event.evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer); + ser_phy_hci_assert(err_code == NRF_SUCCESS); + /* throw assert when in debug mode*/ + DEBUG_EVT_SLIP_ERR_RXED(0); + } + } +#ifdef HCI_LINK_CONTROL + else if (packet_type == PKT_TYPE_LINK_CONTROL) + { + hci_link_control_event_handler(&event); + } +#endif /* HCI_LINK_CONTROL */ + else + { + err_code = ser_phy_hci_slip_rx_buf_free( + event.evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer); + ser_phy_hci_assert(err_code == NRF_SUCCESS); + /* throw assert when in debug mode*/ + DEBUG_EVT_SLIP_ERR_RXED(0); + } + } + +} + + +static void hci_pkt_send(void) +{ + uint32_t err_code; + + m_tx_packet_header[0] = tx_packet_byte_zero_construct(); + uint16_t type_and_length_fields = ((m_tx_payload_length << 4u) | PKT_TYPE_VENDOR_SPECIFIC); + (void)uint16_encode(type_and_length_fields, &(m_tx_packet_header[1])); + m_tx_packet_header[3] = header_checksum_calculate(m_tx_packet_header); + uint16_t crc = crc16_compute(m_tx_packet_header, PKT_HDR_SIZE, NULL); + crc = crc16_compute(m_p_tx_payload, m_tx_payload_length, &crc); + (void)uint16_encode(crc, m_tx_packet_crc); + + ser_phy_hci_pkt_params_t pkt_header; + ser_phy_hci_pkt_params_t pkt_payload; + ser_phy_hci_pkt_params_t pkt_crc; + + pkt_header.p_buffer = m_tx_packet_header; + pkt_header.num_of_bytes = PKT_HDR_SIZE; + pkt_payload.p_buffer = m_p_tx_payload; + pkt_payload.num_of_bytes = m_tx_payload_length; + pkt_crc.p_buffer = m_tx_packet_crc; + pkt_crc.num_of_bytes = PKT_CRC_SIZE; + DEBUG_EVT_SLIP_PACKET_TX(0); + err_code = ser_phy_hci_slip_tx_pkt_send(&pkt_header, &pkt_payload, &pkt_crc); + ser_phy_hci_assert(err_code == NRF_SUCCESS); + + return; +} + +#ifdef HCI_LINK_CONTROL +static void hci_link_control_pkt_send(void) +{ + uint32_t err_code; + uint16_t link_control_payload_len = 0; + + m_tx_link_control_header[0] = 0x00u; // SEQ, ACK, DI and RP are set to 0 for link control + if (m_hci_link_control_next_pkt == HCI_PKT_SYNC) + { + link_control_payload_len = HCI_PKT_SYNC_SIZE - PKT_HDR_SIZE; + (void)uint16_encode(HCI_PKT_SYNC, m_tx_link_control_payload); + } + else if (m_hci_link_control_next_pkt == HCI_PKT_SYNC_RSP) + { + link_control_payload_len = HCI_PKT_SYNC_SIZE - PKT_HDR_SIZE; + (void)uint16_encode(HCI_PKT_SYNC_RSP, m_tx_link_control_payload); + } + else if (m_hci_link_control_next_pkt == HCI_PKT_CONFIG) + { + link_control_payload_len = HCI_PKT_CONFIG_SIZE - PKT_HDR_SIZE; + (void)uint16_encode(HCI_PKT_CONFIG, m_tx_link_control_payload); + m_tx_link_control_payload[2] = HCI_CONFIG_FIELD; + } + else if (m_hci_link_control_next_pkt == HCI_PKT_CONFIG_RSP) + { + link_control_payload_len = HCI_PKT_CONFIG_SIZE - PKT_HDR_SIZE; + (void)uint16_encode(HCI_PKT_CONFIG_RSP, m_tx_link_control_payload); + m_tx_link_control_payload[2] = HCI_CONFIG_FIELD; + } + uint16_t type_and_length_fields = ((link_control_payload_len << 4u) | PKT_TYPE_LINK_CONTROL); + (void)uint16_encode(type_and_length_fields, &(m_tx_link_control_header[1])); + m_tx_link_control_header[3] = header_checksum_calculate(m_tx_link_control_header); + + ser_phy_hci_pkt_params_t pkt_header; + ser_phy_hci_pkt_params_t pkt_payload; + ser_phy_hci_pkt_params_t pkt_crc; + + pkt_header.p_buffer = m_tx_link_control_header; + pkt_header.num_of_bytes = PKT_HDR_SIZE; + pkt_payload.p_buffer = m_tx_link_control_payload; + pkt_payload.num_of_bytes = link_control_payload_len; + pkt_crc.p_buffer = NULL; + pkt_crc.num_of_bytes = 0; + DEBUG_EVT_SLIP_PACKET_TX(0); + err_code = ser_phy_hci_slip_tx_pkt_send(&pkt_header, &pkt_payload, &pkt_crc); + ser_phy_hci_assert(err_code == NRF_SUCCESS); + + return; +} +#endif /* HCI_LINK_CONTROL */ + +static void hci_pkt_sent_upcall(void) +{ + m_packet_seq_number++; // incoming ACK is valid, increment SEQ + m_packet_seq_number &= 0x07u; + m_p_tx_payload = NULL; + packet_transmitted_callback(); + + return; +} + + +static void hci_release_ack_buffer(hci_evt_t * p_event) +{ + uint32_t err_code; + + err_code = ser_phy_hci_slip_rx_buf_free( + p_event->evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer); + ser_phy_hci_assert(err_code == NRF_SUCCESS); + + return; +} + + +static void hci_process_orphaned_ack(hci_evt_t * p_event) +{ + hci_release_ack_buffer(p_event); + return; +} + +/* main tx fsm */ +static void hci_tx_fsm_event_process(hci_evt_t * p_event) +{ + + switch (m_hci_tx_fsm_state) + { + case HCI_TX_STATE_SEND: + + if ((p_event->evt_source == HCI_SER_PHY_EVT) && + (p_event->evt.ser_phy_evt.evt_type == HCI_SER_PHY_TX_REQUEST)) + { + hci_pkt_send(); + hci_timeout_setup(0); + m_tx_retry_count = MAX_RETRY_COUNT; + m_hci_tx_fsm_state = HCI_TX_STATE_WAIT_FOR_FIRST_TX_END; + } + else if ((p_event->evt_source == HCI_SLIP_EVT) && + (p_event->evt.ser_phy_slip_evt.evt_type == SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED)) + { + hci_process_orphaned_ack(p_event); + } + + break; + + case HCI_TX_STATE_WAIT_FOR_FIRST_TX_END: + + if ((p_event->evt_source == HCI_SLIP_EVT) && + (p_event->evt.ser_phy_slip_evt.evt_type == SER_PHY_HCI_SLIP_EVT_PKT_SENT)) + { + hci_timeout_setup(1); + m_hci_tx_fsm_state = HCI_TX_STATE_WAIT_FOR_ACK; + } + else if ((p_event->evt_source == HCI_SLIP_EVT) && + (p_event->evt.ser_phy_slip_evt.evt_type == SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED)) + { + hci_process_orphaned_ack(p_event); + } + break; + + case HCI_TX_STATE_WAIT_FOR_ACK_OR_TX_END: + + if ((p_event->evt_source == HCI_SLIP_EVT) && + (p_event->evt.ser_phy_slip_evt.evt_type == SER_PHY_HCI_SLIP_EVT_PKT_SENT)) + { + hci_timeout_setup(1); + m_hci_tx_fsm_state = HCI_TX_STATE_WAIT_FOR_ACK; + } + else if ((p_event->evt_source == HCI_SLIP_EVT) && + (p_event->evt.ser_phy_slip_evt.evt_type == SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED)) + { + if (rx_ack_pkt_valid(p_event->evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer)) + { + hci_timeout_setup(0); + m_hci_tx_fsm_state = HCI_TX_STATE_WAIT_FOR_TX_END; + } + hci_release_ack_buffer(p_event); + } + break; + + case HCI_TX_STATE_WAIT_FOR_ACK: + + if ((p_event->evt_source == HCI_SLIP_EVT) && + (p_event->evt.ser_phy_slip_evt.evt_type == SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED)) + { + if (rx_ack_pkt_valid(p_event->evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer)) + { + hci_timeout_setup(0); + hci_pkt_sent_upcall(); + m_hci_tx_fsm_state = HCI_TX_STATE_SEND; + } + hci_release_ack_buffer(p_event); + } + else if (p_event->evt_source == HCI_TIMER_EVT) + { + m_tx_retry_count--; + // m_tx_retx_counter++; // global retransmissions counter + if (m_tx_retry_count) + { + hci_pkt_send(); + DEBUG_HCI_RETX(0); + m_hci_tx_fsm_state = HCI_TX_STATE_WAIT_FOR_ACK_OR_TX_END; + } + else + { + error_callback(); + m_hci_tx_fsm_state = HCI_TX_STATE_SEND; + } + } + break; + + case HCI_TX_STATE_WAIT_FOR_TX_END: + + if ((p_event->evt_source == HCI_SLIP_EVT) && + (p_event->evt.ser_phy_slip_evt.evt_type == SER_PHY_HCI_SLIP_EVT_PKT_SENT)) + { + hci_pkt_sent_upcall(); + m_hci_tx_fsm_state = HCI_TX_STATE_SEND; + } + else if ((p_event->evt_source == HCI_SLIP_EVT) && + (p_event->evt.ser_phy_slip_evt.evt_type == SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED)) + { + hci_process_orphaned_ack(p_event); + } + + break; + +#ifdef HCI_LINK_CONTROL + case HCI_TX_STATE_DISABLE: + /* This case should not happen if HCI is in ACTIVE mode */ + if (m_hci_mode == HCI_MODE_ACTIVE) + { + ser_phy_hci_assert(false); + } + break; +#endif /* HCI_LINK_CONTROL */ + + default: + ser_phy_hci_assert(false); + break; + } +} + + +static void hci_mem_request(hci_evt_t * p_event) +{ + m_buffer_reqested_flag = true; + m_p_rx_packet = p_event->evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer; + m_rx_packet_length = p_event->evt.ser_phy_slip_evt.evt_params.received_pkt.num_of_bytes; + ser_phy_hci_assert(m_rx_packet_length > PKT_HDR_SIZE + PKT_CRC_SIZE); + memory_request_callback(m_rx_packet_length - PKT_HDR_SIZE - PKT_CRC_SIZE); + return; +} + + +static void hci_inc_ack() +{ + m_packet_ack_number++; + m_packet_ack_number &= 0x07u; +} + + +static void hci_rx_fsm_event_process(hci_evt_t * p_event) +{ + switch (m_hci_rx_fsm_state) + { + case HCI_RX_STATE_RECEIVE: + + if ((p_event->evt_source == HCI_SLIP_EVT) && + (p_event->evt.ser_phy_slip_evt.evt_type == SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED)) + { + /* type and crc and check sum are validated by slip handler */ + uint8_t rx_seq_number = packet_seq_nmbr_extract( + p_event->evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer); + + if (packet_ack_get() == rx_seq_number) + { + hci_mem_request(p_event); + m_hci_rx_fsm_state = HCI_RX_STATE_WAIT_FOR_MEM; + } + else + { + // m_rx_drop_counter++; + m_hci_rx_fsm_state = HCI_RX_STATE_WAIT_FOR_SLIP_NACK_END; + (void) ser_phy_hci_slip_rx_buf_free(m_p_rx_packet); // and drop a packet + ack_transmit(); // send NACK with valid ACK + } + } + break; + + case HCI_RX_STATE_WAIT_FOR_MEM: + + if ((p_event->evt_source == HCI_SER_PHY_EVT) && + (p_event->evt.ser_phy_evt.evt_type == HCI_SER_PHY_RX_BUF_GRANTED)) + { + if (m_p_rx_buffer) + { + memcpy(m_p_rx_buffer, + m_p_rx_packet + PKT_HDR_SIZE, + m_rx_packet_length - PKT_HDR_SIZE - PKT_CRC_SIZE); + (void) ser_phy_hci_slip_rx_buf_free(m_p_rx_packet); + } + m_hci_rx_fsm_state = HCI_RX_STATE_WAIT_FOR_SLIP_ACK_END; + hci_inc_ack(); // SEQ was valid for good packet, we will send incremented SEQ as ACK + ack_transmit(); + } + + break; + + case HCI_RX_STATE_WAIT_FOR_SLIP_ACK_END: + + if ((p_event->evt_source == HCI_SLIP_EVT) && + (p_event->evt.ser_phy_slip_evt.evt_type == SER_PHY_HCI_SLIP_EVT_ACK_SENT)) + { + + if (m_p_rx_buffer) + { + packet_received_callback(m_p_rx_buffer, + m_rx_packet_length - PKT_HDR_SIZE - PKT_CRC_SIZE); + } + else + { + packet_dropped_callback(); + } + m_hci_rx_fsm_state = HCI_RX_STATE_RECEIVE; + } + else if ((p_event->evt_source == HCI_SLIP_EVT) && + (p_event->evt.ser_phy_slip_evt.evt_type == SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED)) + { + (void) ser_phy_hci_slip_rx_buf_free(p_event->evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer); + } + break; + + case HCI_RX_STATE_WAIT_FOR_SLIP_NACK_END: + if ((p_event->evt_source == HCI_SLIP_EVT) && + (p_event->evt.ser_phy_slip_evt.evt_type == SER_PHY_HCI_SLIP_EVT_ACK_SENT)) + { + m_hci_rx_fsm_state = HCI_RX_STATE_RECEIVE; + } + else + { + (void) ser_phy_hci_slip_rx_buf_free(p_event->evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer); + } + break; + + +#ifdef HCI_LINK_CONTROL + case HCI_RX_STATE_DISABLE: + if (m_hci_mode == HCI_MODE_ACTIVE) + { + ser_phy_hci_assert(false); + } + break; +#endif /* HCI_LINK_CONTROL */ + + default: + ser_phy_hci_assert(false); + break; + } +} + + +/* this function might be entered only via hci_tx_event_handler */ +static void hci_tx_fsm(void) +{ + hci_evt_t event; + uint32_t err_code = NRF_SUCCESS; + + while (err_code == NRF_SUCCESS) + { + + CRITICAL_REGION_ENTER(); + err_code = app_mailbox_get(&tx_evt_queue, &event); + + if (err_code != NRF_SUCCESS) + { + m_tx_fsm_idle_flag = true; + } + CRITICAL_REGION_EXIT(); + + if (err_code == NRF_SUCCESS) + { + hci_tx_fsm_event_process(&event); /* this is the only entry to the TX_FSM */ + } + } + return; +} + + +/* this function might be entered only via hci_rx_event_handler */ +static void hci_rx_fsm(void) +{ + hci_evt_t event; + uint32_t err_code = NRF_SUCCESS; + + while (err_code == NRF_SUCCESS) + { + CRITICAL_REGION_ENTER(); + err_code = app_mailbox_get(&rx_evt_queue, &event); + + if (err_code != NRF_SUCCESS) + { + m_rx_fsm_idle_flag = true; + } + CRITICAL_REGION_EXIT(); + + if (err_code == NRF_SUCCESS) + { + hci_rx_fsm_event_process(&event); /* this is the only entry to the RX_FSM */ + } + } + return; +} + + +/* something might have been queued by API with disabled 'PHY-interrupts' */ +static void hci_tx_reschedule() +{ + bool tx_exec_flag = false; + uint32_t tx_queue_length; + + CRITICAL_REGION_ENTER(); + tx_queue_length = app_mailbox_length_get(&tx_evt_queue); + +#ifndef HCI_LINK_CONTROL + if (m_tx_fsm_idle_flag && m_hci_global_enable_flag && tx_queue_length) +#else + if (m_tx_fsm_idle_flag && m_hci_global_enable_flag && tx_queue_length && (m_hci_mode == HCI_MODE_ACTIVE)) +#endif /* HCI_LINK_CONTROL */ + { + tx_exec_flag = true; // FSM should be activated + m_tx_fsm_idle_flag = false; // FSM will be busy from now on till the queue is exhausted + } + CRITICAL_REGION_EXIT(); + + if (tx_exec_flag) + { + hci_tx_fsm(); + } + return; +} + + +/* entry to TX state machine, might be called asynchronously from different contexts */ +/* Puts event into the TX event queue and execute if FSM was idle */ +static void hci_tx_event_handler(hci_evt_t * p_event) +{ + bool tx_exec_flag = false; + uint32_t err_code; + + CRITICAL_REGION_ENTER(); + err_code = app_mailbox_put(&tx_evt_queue, p_event); + ser_phy_hci_assert(err_code == NRF_SUCCESS); + + // CRITICAL_REGION_ENTER(); + /* only one process can acquire tx_exec_flag */ + if (m_tx_fsm_idle_flag && m_hci_global_enable_flag) + { + tx_exec_flag = true; // FSM should be activated + m_tx_fsm_idle_flag = false; // FSM will be busy from now on till the queue is exhausted + } + CRITICAL_REGION_EXIT(); + + if (tx_exec_flag) + { + hci_tx_fsm(); + } + return; +} + + +/* Something might have been queued by API with disabled 'PHY-interrupts' */ +static void hci_rx_reschedule() +{ + bool rx_exec_flag = false; + uint32_t rx_queue_length; + + CRITICAL_REGION_ENTER(); + rx_queue_length = app_mailbox_length_get(&rx_evt_queue); + +#ifndef HCI_LINK_CONTROL + if (m_rx_fsm_idle_flag && m_hci_global_enable_flag && rx_queue_length) +#else + if (m_rx_fsm_idle_flag && m_hci_global_enable_flag && rx_queue_length && (m_hci_mode == HCI_MODE_ACTIVE)) +#endif /* HCI_LINK_CONTROL */ + { + rx_exec_flag = true; // FSM should be activated + m_rx_fsm_idle_flag = false; // FSM will be busy from now on till the queue is exhausted + } + CRITICAL_REGION_EXIT(); + + if (rx_exec_flag) + { + hci_rx_fsm(); + } + +} + + +/* Entry to RX state machine, might be called asynchronously from different contexts */ +/* Puts event into the RX event queue and execute if FSM was idle */ +static void hci_rx_event_handler(hci_evt_t * p_event) +{ + bool rx_exec_flag = false; + uint32_t err_code; + + CRITICAL_REGION_ENTER(); + err_code = app_mailbox_put(&rx_evt_queue, p_event); + ser_phy_hci_assert(err_code == NRF_SUCCESS); + + /* only one process can acquire rx_exec_flag */ + // CRITICAL_REGION_ENTER(); + if (m_rx_fsm_idle_flag && m_hci_global_enable_flag) + { + rx_exec_flag = true; // FSM should be activated + m_rx_fsm_idle_flag = false; // FSM will be busy from now on till the queue is exhausted + } + CRITICAL_REGION_EXIT(); + + if (rx_exec_flag) + { + hci_rx_fsm(); + } + + return; +} + +#ifdef HCI_LINK_CONTROL +/* Link control event handler - used only for Link Control packets */ +/* This handler will be called only in 2 cases: + - when SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED event is received + - when HCI_TIMER_EVT event is reveived */ +static void hci_link_control_event_handler(hci_evt_t * p_event) +{ + uint16_t pkt_type = HCI_LINK_CONTROL_PKT_INVALID; + + switch(p_event->evt_source) + { + case HCI_SLIP_EVT: + pkt_type = link_control_packet_decode( + p_event->evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer, + p_event->evt.ser_phy_slip_evt.evt_params.received_pkt.num_of_bytes); + /* Perform HCI mode transition if needed */ + CRITICAL_REGION_ENTER(); + switch (pkt_type) + { + case HCI_PKT_SYNC: + m_hci_link_control_next_pkt = HCI_PKT_SYNC_RSP; + /* Restart HCI communication if it was in ACTIVE mode */ + if (m_hci_mode == HCI_MODE_ACTIVE) + { + m_hci_mode = HCI_MODE_UNINITIALIZED; + m_packet_ack_number = INITIAL_ACK_NUMBER_EXPECTED; + m_packet_seq_number = INITIAL_SEQ_NUMBER; + m_hci_tx_fsm_state = HCI_TX_STATE_DISABLE; + m_hci_rx_fsm_state = HCI_RX_STATE_DISABLE; + m_hci_other_side_active = false; + } + hci_link_control_pkt_send(); + hci_timeout_setup(7u); // Need to trigger transmitting SYNC messages + break; + case HCI_PKT_SYNC_RSP: + if (m_hci_mode == HCI_MODE_UNINITIALIZED) + { + m_hci_mode = HCI_MODE_INITIALIZED; + m_hci_link_control_next_pkt = HCI_PKT_CONFIG; + } + break; + case HCI_PKT_CONFIG: + if (m_hci_mode != HCI_MODE_UNINITIALIZED) + { + m_hci_link_control_next_pkt = HCI_PKT_CONFIG_RSP; + hci_link_control_pkt_send(); + m_hci_other_side_active = true; + } + break; + case HCI_PKT_CONFIG_RSP: + if (m_hci_mode == HCI_MODE_INITIALIZED) + { + m_hci_mode = HCI_MODE_ACTIVE; + m_hci_tx_fsm_state = HCI_TX_STATE_SEND; + m_hci_rx_fsm_state = HCI_RX_STATE_RECEIVE; + } + break; + } + CRITICAL_REGION_EXIT(); + (void) ser_phy_hci_slip_rx_buf_free( + p_event->evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer); + /* Kick the state machine so it can start process BLE packets */ + if ((m_hci_mode == HCI_MODE_ACTIVE) && m_hci_other_side_active) + { + hci_tx_reschedule(); + hci_rx_reschedule(); + } + break; + + case HCI_TIMER_EVT: + /* Send one of the Link Control packets if in Unintialized or Initialized state */ + CRITICAL_REGION_ENTER(); + switch (m_hci_mode) + { + case HCI_MODE_UNINITIALIZED: + //send packet + m_hci_link_control_next_pkt = HCI_PKT_SYNC; + hci_link_control_pkt_send(); + hci_timeout_setup(7u); + break; + case HCI_MODE_INITIALIZED: + m_hci_link_control_next_pkt = HCI_PKT_CONFIG; + hci_link_control_pkt_send(); + hci_timeout_setup(7u); + break; + case HCI_MODE_ACTIVE: + case HCI_MODE_DISABLE: + default: + // No implementation needed + break; + } + CRITICAL_REGION_EXIT(); + break; + case HCI_SER_PHY_EVT: + default: + // No implementation needed + break; + } +} +#endif /* HCI_LINK_CONTROL */ + +/* ser_phy API function */ +void ser_phy_interrupts_enable(void) +{ + bool pending_timer_callback_flag = false; + + CRITICAL_REGION_ENTER(); + m_hci_timer_enabled_flag = true; + + if (m_hci_timout_pending_flag) + { + m_hci_timout_pending_flag = false; + pending_timer_callback_flag = true; + } + CRITICAL_REGION_EXIT(); + // this is a workaround - scheduled SER_PHY EVENTS + m_hci_global_enable_flag = true; + hci_tx_reschedule(); + hci_rx_reschedule(); + + if (pending_timer_callback_flag) + { + hci_signal_timeout_event(); + } + + return; +} + + +/* ser_phy API function */ +void ser_phy_interrupts_disable(void) +{ + CRITICAL_REGION_ENTER(); + m_hci_timer_enabled_flag = false; + // transport calls PHY API with ser_phy_interrupts_disabled + m_hci_global_enable_flag = false; + CRITICAL_REGION_EXIT(); +} + + +/* ser_phy API function */ +uint32_t ser_phy_rx_buf_set(uint8_t * p_buffer) +{ + uint32_t status = NRF_SUCCESS; + hci_evt_t event; + + if (m_buffer_reqested_flag) + { + m_buffer_reqested_flag = false; + m_p_rx_buffer = p_buffer; + event.evt_source = HCI_SER_PHY_EVT; + event.evt.ser_phy_evt.evt_type = HCI_SER_PHY_RX_BUF_GRANTED; + hci_rx_event_handler(&event); + } + else + { + status = NRF_ERROR_BUSY; + } + return status; +} + + +/* ser_phy API function */ +uint32_t ser_phy_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes) +{ + uint32_t status = NRF_SUCCESS; + hci_evt_t event; + + if ( p_buffer == NULL || num_of_bytes == 0) + { + return NRF_ERROR_NULL; + } + + if ( m_p_tx_payload == NULL) + { + m_tx_payload_length = num_of_bytes; + m_p_tx_payload = (uint8_t *)p_buffer; + DEBUG_EVT_TX_REQ(0); + event.evt_source = HCI_SER_PHY_EVT; + event.evt.ser_phy_evt.evt_type = HCI_SER_PHY_TX_REQUEST; + hci_tx_event_handler(&event); + } + else + { + status = NRF_ERROR_BUSY; + } + + return status; +} + + +static uint32_t hci_timer_init(void) +{ + uint32_t err_code = NRF_SUCCESS; + +#ifdef HCI_APP_TIMER + + err_code = app_timer_create(&m_app_timer_id, APP_TIMER_MODE_REPEATED, hci_timeout_handler); + + if (err_code != NRF_SUCCESS) + { + return NRF_ERROR_INTERNAL; + } + + err_code = app_timer_start(m_app_timer_id, RETRANSMISSION_TIMEOUT_IN_TICKS, NULL); + + if (err_code != NRF_SUCCESS) + { + return NRF_ERROR_INTERNAL; + } + +#else + + // Configure TIMER for compare[1] event + HCI_TIMER->PRESCALER = 9; + HCI_TIMER->MODE = TIMER_MODE_MODE_Timer; + HCI_TIMER->BITMODE = TIMER_BITMODE_BITMODE_32Bit; + + // Clear TIMER + HCI_TIMER->TASKS_CLEAR = 1; + + // Enable interrupt + HCI_TIMER->INTENCLR = 0xFFFFFFFF; + HCI_TIMER->INTENSET = TIMER_INTENSET_COMPARE1_Enabled << TIMER_INTENSET_COMPARE1_Pos; + + NVIC_ClearPendingIRQ(HCI_TIMER_IRQn); + NVIC_SetPriority(HCI_TIMER_IRQn, APP_IRQ_PRIORITY_HIGH); + NVIC_EnableIRQ(HCI_TIMER_IRQn); + +#endif + + return err_code; + +} + + +/* ser_phy API function */ +uint32_t ser_phy_open(ser_phy_events_handler_t events_handler) +{ + uint32_t err_code; + + if ((m_hci_tx_fsm_state != HCI_TX_STATE_DISABLE) || (m_hci_rx_fsm_state != HCI_RX_STATE_DISABLE)) + { + return NRF_ERROR_INVALID_STATE; + } + + if (events_handler == NULL) + { + return NRF_ERROR_NULL; + } + + err_code = hci_timer_init(); + + if (err_code != NRF_SUCCESS) + { + return NRF_ERROR_INTERNAL; + } + + err_code = app_mailbox_create(&tx_evt_queue); + + if (err_code != NRF_SUCCESS) + { + return NRF_ERROR_INTERNAL; + } + + err_code = app_mailbox_create(&rx_evt_queue); + + if (err_code != NRF_SUCCESS) + { + return NRF_ERROR_INTERNAL; + } + + err_code = ser_phy_hci_slip_open(hci_slip_event_handler); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (err_code == NRF_SUCCESS) + { + m_packet_ack_number = INITIAL_ACK_NUMBER_EXPECTED; + m_packet_seq_number = INITIAL_SEQ_NUMBER; + m_ser_phy_callback = events_handler; + +#ifndef HCI_LINK_CONTROL + m_hci_tx_fsm_state = HCI_TX_STATE_SEND; + m_hci_rx_fsm_state = HCI_RX_STATE_RECEIVE; +#else + hci_timeout_setup(7u);// Trigger sending SYNC messages + m_hci_mode = HCI_MODE_UNINITIALIZED; + m_hci_other_side_active = false; +#endif /*HCI_LINK_CONTROL*/ + } + return err_code; +} + +static uint32_t hci_timer_close(void) +{ + uint32_t err_code = NRF_SUCCESS; + +#ifdef HCI_APP_TIMER + err_code = app_timer_stop(m_app_timer_id); + + if (err_code != NRF_SUCCESS) + { + return NRF_ERROR_INTERNAL; + } +#endif + + return err_code; +} + +/* ser_phy API function */ +void ser_phy_close(void) +{ + m_ser_phy_callback = NULL; + ser_phy_hci_slip_close(); + m_hci_tx_fsm_state = HCI_TX_STATE_DISABLE; + m_hci_rx_fsm_state = HCI_RX_STATE_DISABLE; + +#ifdef HCI_LINK_CONTROL + m_hci_mode = HCI_MODE_DISABLE; +#endif /* HCI_LINK_CONTROL */ + + uint32_t err_code = hci_timer_close(); + ser_phy_hci_assert(err_code == NRF_SUCCESS); +} + + diff --git a/components/serialization/common/transport/ser_phy/ser_phy_hci.h b/components/serialization/common/transport/ser_phy/ser_phy_hci.h new file mode 100644 index 0000000..fda7d8a --- /dev/null +++ b/components/serialization/common/transport/ser_phy/ser_phy_hci.h @@ -0,0 +1,147 @@ + /* 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. + * + */ + +/** @file + * + * @defgroup ser_phy_hci HCI Serialization PHY + * @{ + * @ingroup ble_sdk_lib_serialization + * + * @brief HCI PHY layer for serialization. + * + * @details This file contains declarations of functions and definitions of data structures and + * identifiers (typedef enum) used as API of the serialization HCI PHY layer. + * + * + */ + +#ifndef SER_PHY_HCI_H__ +#define SER_PHY_HCI_H__ + +#include + +/**@brief Serialization PHY HCI module events types. */ +typedef enum +{ + SER_PHY_HCI_SLIP_EVT_PKT_SENT = 0, /**< An event indicating that packet has been transmitted. */ + SER_PHY_HCI_SLIP_EVT_ACK_SENT, /**< An event indicating that ack packet has been transmitted. */ + SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED, /**< An event indicating that packet has been received. */ + SER_PHY_HCI_SLIP_EVT_HW_ERROR, /**< An event indicating a hardware error in PHY HCI module. */ + SER_PHY_HCI_SLIP_EVT_TYPE_MAX /**< Enumeration upper bound. */ +} ser_phy_hci_slip_evt_type_t; + +/**@brief A struct representing a PHY HCI packet. */ +typedef struct +{ + uint8_t * p_buffer; /**< Pointer to a buffer containing a packet. */ + uint16_t num_of_bytes; /**< Length of a packet in octets. */ +} ser_phy_hci_pkt_params_t; + + +/**@brief A struct containing parameters of the event of type @ref SER_PHY_HCI_SLIP_EVT_HW_ERROR. */ +typedef struct +{ + uint32_t error_code; /**< Hardware error code - specific for any microcontroller. */ +} ser_phy_hci_evt_hw_error_params_t; + + +/**@brief A struct containing events from a Serialization PHY module. + * + * @note Some events do not have parameters, then whole information is contained in the evt_type. + */ +typedef struct +{ + ser_phy_hci_slip_evt_type_t evt_type; /**< Type of an event. */ + union /**< Union alternative identified by evt_type in enclosing struct. */ + { + /** Parameters of the event of type @ref SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED. */ + ser_phy_hci_pkt_params_t received_pkt; + /** Parameters of the event of type @ref SER_PHY_HCI_SLIP_EVT_HW_ERROR. */ + ser_phy_hci_evt_hw_error_params_t hw_error; + } evt_params; +} ser_phy_hci_slip_evt_t; + + +/**@brief A type of generic callback function handler to be used by all PHY HCI events. + * + * @param[in] event Serialization PHY HCI module event. + */ +typedef void (*ser_phy_hci_slip_event_handler_t)(ser_phy_hci_slip_evt_t *p_event); + +/**@brief A function for opening and initializing a HCI SLIP PHY module. + * + * @note The function initializes hardware and internal module states, and registers callback + * function to be used by all PHY HCI module events. + * + * @warning If the function has been already called, the function @ref ser_phy_hci_slip_close has to be + * called before ser_phy_hci_slip_open can be called again. + * + * @param[in] events_handler Generic callback function handler to be used by all PHY HCI module + * events. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_INVALID_STATE Operation failure. The function has been already called. + * To call it again the function @ref ser_phy_hci_slip_close has to + * be called previously. + * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_PARAM Operation failure. Hardware initialization parameters are not + * supported. + */ +uint32_t ser_phy_hci_slip_open(ser_phy_hci_slip_event_handler_t events_handler); + + +/**@brief A function for transmitting a HCI SLIP packet. + * + * @note The function adds a packet pointed by p_buffer parameter to a transmission queue and + * schedules generating an event of type @ref SER_PHY_HCI_SLIP_EVT_PKT_SENT upon transmission + * completion. + * + * @param[in] p_header Pointer to ser_phy_hci_pkt_params_t structure representing packet header. + * @param[in] p_payload Pointer to ser_phy_hci_pkt_params_t structure representing packet payload. + * @param[in] p_crc Pointer to ser_phy_hci_pkt_params_t structure representing packet crc. + * + * @retval NRF_SUCCESS Operation success. Packet was added to the transmission queue + * and event will be send upon transmission completion. + * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied in p_header parameter. + * NULL pointer is allowed for p_payload and p_crc parameters. + * @retval NRF_ERROR_INVALID_PARAM Operation failure. Number of bytes to be send equal to 0. + * @retval NRF_ERROR_BUSY Operation failure. Transmitting of a packet in progress. + */ +uint32_t ser_phy_hci_slip_tx_pkt_send(const ser_phy_hci_pkt_params_t * p_header, + const ser_phy_hci_pkt_params_t * p_payload, + const ser_phy_hci_pkt_params_t * p_crc); + + +/**@brief A function for freeing an RX buffer. + * + * @note The function has to be called as a response for event @ref SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED + * when RX packet has been processed. The function frees the RX buffer and therefore enables + * reception of next incoming data. + + * @param[in] p_buffer Pointer to an RX buffer which must be freed. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_STATE Operation failure. A buffer was already free. + */ +uint32_t ser_phy_hci_slip_rx_buf_free(uint8_t * p_buffer); + + +/**@brief A function for closing a PHY HCI module. + * + * @note The function disables hardware, resets internal module states and unregisters events + * callback function. + */ +void ser_phy_hci_slip_close(void); + +#endif /* SER_PHY_HCI_H__ */ +/** @} */ diff --git a/components/serialization/common/transport/ser_phy/ser_phy_hci_slip.c b/components/serialization/common/transport/ser_phy/ser_phy_hci_slip.c new file mode 100644 index 0000000..7e8431a --- /dev/null +++ b/components/serialization/common/transport/ser_phy/ser_phy_hci_slip.c @@ -0,0 +1,634 @@ + +/* 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 "nrf_error.h" +#include "nrf_gpio.h" +#include "app_uart.h" +#include "ser_phy_hci.h" +#include "app_error.h" +#include "app_util_platform.h" +#include "nrf_soc.h" + +#ifdef SER_CONNECTIVITY +#include "ser_phy_config_conn_nrf51.h" +#else +#include "ser_phy_config_app_nrf51.h" +#endif /* SER_CONNECTIVITY */ + +#include "ser_config.h" +#define APP_SLIP_END 0xC0 /**< SLIP code for identifying the beginning and end of a packet frame.. */ +#define APP_SLIP_ESC 0xDB /**< SLIP escape code. This code is used to specify that the following character is specially encoded. */ +#define APP_SLIP_ESC_END 0xDC /**< SLIP special code. When this code follows 0xDB, this character is interpreted as payload data 0xC0.. */ +#define APP_SLIP_ESC_ESC 0xDD /**< SLIP special code. When this code follows 0xDB, this character is interpreted as payload data 0xDB. */ + +#define HDR_SIZE 4 +#define CRC_SIZE 2 +#define PKT_SIZE (SER_HAL_TRANSPORT_MAX_PKT_SIZE + HDR_SIZE + CRC_SIZE) + +static const app_uart_comm_params_t comm_params = +{ + .rx_pin_no = SER_PHY_UART_RX, + .tx_pin_no = SER_PHY_UART_TX, + .rts_pin_no = SER_PHY_UART_RTS, + .cts_pin_no = SER_PHY_UART_CTS, + // Below values are defined in ser_config.h common for application and connectivity + .flow_control = SER_PHY_UART_FLOW_CTRL, + .use_parity = SER_PHY_UART_PARITY, + .baud_rate = SER_PHY_UART_BAUDRATE +}; + +static uint8_t m_small_buffer[HDR_SIZE]; +static uint8_t m_big_buffer[PKT_SIZE]; + +static uint8_t * mp_small_buffer = NULL; +static uint8_t * mp_big_buffer = NULL; +static uint8_t * mp_buffer = NULL; + +static ser_phy_hci_pkt_params_t m_header; +static ser_phy_hci_pkt_params_t m_payload; +static ser_phy_hci_pkt_params_t m_crc; +static ser_phy_hci_pkt_params_t m_header_pending; +static ser_phy_hci_pkt_params_t m_payload_pending; +static ser_phy_hci_pkt_params_t m_crc_pending; + +static ser_phy_hci_slip_evt_t m_ser_phy_hci_slip_event; +static ser_phy_hci_slip_event_handler_t m_ser_phy_hci_slip_event_handler; /**< Event handler for upper layer */ + +static bool m_other_side_active = false; /**< Flag indicating that the other side is running */ +static uint8_t m_rx_byte; /**< Rx byte passed from low-level driver */ + +static bool m_rx_escape = false; +static bool m_tx_escape = false; + +static bool m_tx_busy = false; /**< Flag indicating that currently some transmission is ongoing */ + +static uint32_t m_tx_index; +static uint32_t m_rx_index; +static ser_phy_hci_pkt_params_t * mp_data = NULL; + +/* Function declarations */ +static uint32_t ser_phy_hci_tx_byte(void); +static bool slip_decode(uint8_t * p_received_byte); +static void ser_phi_hci_rx_byte(uint8_t rx_byte); +// /////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +__STATIC_INLINE void callback_hw_error(uint32_t error_src) +{ + m_ser_phy_hci_slip_event.evt_type = SER_PHY_HCI_SLIP_EVT_HW_ERROR; + + // Pass error source to upper layer + m_ser_phy_hci_slip_event.evt_params.hw_error.error_code = error_src; + m_ser_phy_hci_slip_event_handler(&m_ser_phy_hci_slip_event); +} + + +__STATIC_INLINE void slip_encode(void) +{ + switch (mp_data->p_buffer[m_tx_index]) + { + case APP_SLIP_END: + m_tx_escape = true; + (void)app_uart_put(APP_SLIP_ESC); + break; + + case APP_SLIP_ESC: + m_tx_escape = true; + (void)app_uart_put(APP_SLIP_ESC); + break; + + default: + (void)app_uart_put(mp_data->p_buffer[m_tx_index]); + m_tx_index++; + break; + } +} + + +__STATIC_INLINE bool check_pending_tx() +{ + bool tx_continue = false; + + if (m_header_pending.p_buffer != NULL) + { + m_header = m_header_pending; + m_payload = m_payload_pending; + m_crc = m_crc_pending; + + m_header_pending.p_buffer = NULL; + m_header_pending.num_of_bytes = 0; + m_payload_pending.p_buffer = NULL; + m_payload_pending.num_of_bytes = 0; + m_crc_pending.p_buffer = NULL; + m_crc_pending.num_of_bytes = 0; + + m_tx_index = 0; // may be also done in ser_phy_hci_tx_byte??? + tx_continue = true; + + /* Start sending pending packet */ + (void)ser_phy_hci_tx_byte(); + } + + return tx_continue; +} + + +static uint32_t ser_phy_hci_tx_byte() +{ + /* Flags informing about actually transmited part of packet*/ + static bool header = false; + static bool payload = false; + static bool crc = false; + + static bool ack_end = false; + static bool packet_end = false; + + if (ack_end == true) + { + ack_end = false; + m_tx_busy = check_pending_tx(); + /* Report end of ACK transmission*/ + m_ser_phy_hci_slip_event.evt_type = SER_PHY_HCI_SLIP_EVT_ACK_SENT; + m_ser_phy_hci_slip_event_handler(&m_ser_phy_hci_slip_event); + + } + else if (packet_end == true) + { + packet_end = false; + m_tx_busy = check_pending_tx(); + /* Report end of packet transmission*/ + m_ser_phy_hci_slip_event.evt_type = SER_PHY_HCI_SLIP_EVT_PKT_SENT; + m_ser_phy_hci_slip_event_handler(&m_ser_phy_hci_slip_event); + + } + else if ((m_tx_index == 0) && !header && !payload && !crc) + { + /* Beginning of packet - sent 0xC0*/ + header = true; + mp_data = &m_header; + (void)app_uart_put(APP_SLIP_END); + } + else if ((m_tx_index == mp_data->num_of_bytes) && crc == true) + { + /* End of packet - sent 0xC0*/ + (void)app_uart_put(APP_SLIP_END); + + m_crc.p_buffer = NULL; + crc = false; + m_tx_index = 0; + packet_end = true; + } + else if ((m_tx_index == mp_data->num_of_bytes) && header == true) + { + /* End of header transmission*/ + m_tx_index = 0; + + if (m_payload.p_buffer != NULL) + { + header = false; + payload = true; + mp_data = &m_payload; + + /* Handle every character in buffer accordingly to SLIP protocol*/ + slip_encode(); + } + else + { + /* End of ACK - sent 0xC0*/ + (void)app_uart_put(APP_SLIP_END); + + header = false; + ack_end = true; + } + } + else if ((m_tx_index == mp_data->num_of_bytes) && payload == true) + { + /* End of payload transmission*/ + m_tx_index = 0; + + if (m_crc.p_buffer != NULL) + { + m_payload.p_buffer = NULL; + payload = false; + crc = true; + mp_data = &m_crc; + + /* Handle every character in buffer accordingly to SLIP protocol*/ + slip_encode(); + } + /* CRC is not used for this packet -> finish packet transmission */ + else + { + /* End of packet - send 0xC0*/ + (void)app_uart_put(APP_SLIP_END); + + m_payload.p_buffer = NULL; + payload = false; + packet_end = true; + } + } + else if (m_tx_escape == false) + { + /* Handle every character in buffer accordingly to SLIP protocol*/ + slip_encode(); + } + else if (m_tx_escape == true) + { + /* Send SLIP special code*/ + m_tx_escape = false; + + if (mp_data->p_buffer[m_tx_index] == APP_SLIP_END) + { + (void)app_uart_put(APP_SLIP_ESC_END); + m_tx_index++; + } + else + { + (void)app_uart_put(APP_SLIP_ESC_ESC); + m_tx_index++; + } + } + + return NRF_SUCCESS; +} + + +uint32_t ser_phy_hci_slip_tx_pkt_send(const ser_phy_hci_pkt_params_t * p_header, + const ser_phy_hci_pkt_params_t * p_payload, + const ser_phy_hci_pkt_params_t * p_crc) +{ + /* Block TXRDY interrupts at this point*/ + // NRF_UART0->INTENCLR = (UART_INTENCLR_TXDRDY_Clear << UART_INTENCLR_TXDRDY_Pos); + CRITICAL_REGION_ENTER(); + + if (p_header == NULL) + { + return NRF_ERROR_NULL; + } + + /* Check if no tx is ongoing */ + if (!m_tx_busy) + { + m_header = *p_header; + + if (p_payload != NULL) + { + m_payload = *p_payload; + } + + if (p_crc != NULL) + { + m_crc = *p_crc; + } + } + /* Tx is ongoing, schedule transmission as pending */ + else + { + if (p_crc != NULL) + { + m_crc_pending = *p_crc; + } + + if (p_payload != NULL) + { + m_payload_pending = *p_payload; + } + + m_header_pending = *p_header; + } + + /* Start packet transmission only if no other tx is ongoing */ + if (!m_tx_busy) + { + m_tx_busy = true; + (void)ser_phy_hci_tx_byte(); + } + + /* Enable TXRDY interrupts at this point*/ + // NRF_UART0->INTENSET = (UART_INTENSET_TXDRDY_Set << UART_INTENSET_TXDRDY_Pos); + CRITICAL_REGION_EXIT(); + return NRF_SUCCESS; +} + + +/* Function returns false when last byte in packet is detected.*/ +static bool slip_decode(uint8_t * p_received_byte) +{ + switch (*p_received_byte) + { + case APP_SLIP_END: + return false; + + case APP_SLIP_ESC: + m_rx_escape = true; + break; + + case APP_SLIP_ESC_END: + + if (m_rx_escape == true) + { + m_rx_escape = false; + *p_received_byte = APP_SLIP_END; + } + break; + + case APP_SLIP_ESC_ESC: + + if (m_rx_escape == true) + { + m_rx_escape = false; + *p_received_byte = APP_SLIP_ESC; + } + break; + + /* Normal character - decoding not needed*/ + default: + break; + } + + return true; +} + + +static void ser_phi_hci_rx_byte(uint8_t rx_byte) +{ + static bool rx_sync = false; + uint8_t received_byte = rx_byte; + static bool big_buff_in_use = false; + + /* Test received byte for SLIP packet start: 0xC0*/ + if (!rx_sync) + { + if (received_byte == APP_SLIP_END) + { + m_rx_index = 0; + rx_sync = true; + } + return; + } + + /* Additional check needed in case rx_sync flag was set by end of previous packet*/ + if ((m_rx_index) == 0 && (received_byte == APP_SLIP_END)) + { + return; + } + + /* Check if small (ACK) buffer is available*/ + if ((mp_small_buffer != NULL) && (big_buff_in_use == false)) + { + if (m_rx_index == 0) + { + mp_buffer = mp_small_buffer; + } + + /* Check if switch between small and big buffer is needed*/ + if (m_rx_index == sizeof (m_small_buffer) /*NEW!!!*/ && received_byte != APP_SLIP_END) + { + /* Check if big (PKT) buffer is available*/ + if (mp_big_buffer != NULL) + { + /* Switch to big buffer*/ + memcpy(m_big_buffer, m_small_buffer, sizeof (m_small_buffer)); + mp_buffer = m_big_buffer; + } + else + { + /* Small buffer is too small and big buffer not available - cannot continue reception*/ + rx_sync = false; + return; + } + } + + /* Check if big buffer is full */ + if ((m_rx_index >= PKT_SIZE) && (received_byte != APP_SLIP_END)) + { + /* Do not notify upper layer - the packet is too big and cannot be handled by slip */ + rx_sync = false; + return; + } + + /* Decode byte. Will return false when it is 0xC0 - end of packet*/ + if (slip_decode(&received_byte)) + { + /* Write Rx byte only if it is not escape char */ + if (!m_rx_escape) + { + mp_buffer[m_rx_index++] = received_byte; + } + } + else + { + /* Reset pointers to signalise buffers are locked waiting for upper layer */ + if (mp_buffer == mp_small_buffer) + { + mp_small_buffer = NULL; + } + else + { + mp_big_buffer = NULL; + } + /* Report packet reception end*/ + m_ser_phy_hci_slip_event.evt_type = + SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED; + m_ser_phy_hci_slip_event.evt_params.received_pkt.p_buffer = mp_buffer; + m_ser_phy_hci_slip_event.evt_params.received_pkt.num_of_bytes = m_rx_index; + m_ser_phy_hci_slip_event_handler(&m_ser_phy_hci_slip_event); + + rx_sync = false; + } + } + else if (mp_big_buffer != NULL) + { + big_buff_in_use = true; + mp_buffer = mp_big_buffer; + + /* Check if big buffer is full */ + if ((m_rx_index >= PKT_SIZE) && (received_byte != APP_SLIP_END)) + { + /* Do not notify upper layer - the packet is too big and cannot be handled by slip */ + rx_sync = false; + return; + } + + /* Decode byte*/ + if (slip_decode(&received_byte)) + { + /* Write Rx byte only if it is not escape char */ + if (!m_rx_escape) + { + mp_buffer[m_rx_index++] = received_byte; + } + } + else + { + /* Report packet reception end*/ + m_ser_phy_hci_slip_event.evt_type = + SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED; + m_ser_phy_hci_slip_event.evt_params.received_pkt.p_buffer = mp_buffer; + m_ser_phy_hci_slip_event.evt_params.received_pkt.num_of_bytes = m_rx_index; + m_ser_phy_hci_slip_event_handler(&m_ser_phy_hci_slip_event); + + rx_sync = false; + mp_big_buffer = NULL; + big_buff_in_use = false; + } + } + else + { + /* Both buffers are not available - cannot continue reception*/ + rx_sync = false; + return; + } +} + + +uint32_t ser_phy_hci_slip_rx_buf_free(uint8_t * p_buffer) +{ + uint32_t err_code = NRF_SUCCESS; + + if (p_buffer == NULL) + { + return NRF_ERROR_NULL; + } + else if (p_buffer == m_small_buffer) + { + /* Free small buffer*/ + if (mp_small_buffer == NULL) + { + mp_small_buffer = m_small_buffer; + } + else + { + err_code = NRF_ERROR_INVALID_STATE; + } + } + else if (p_buffer == m_big_buffer) + { + /* Free big buffer*/ + if (mp_big_buffer == NULL) + { + mp_big_buffer = m_big_buffer; + } + else + { + err_code = NRF_ERROR_INVALID_STATE; + } + } + + return err_code; +} + + +static void ser_phy_uart_evt_callback(app_uart_evt_t * uart_evt) +{ + if (uart_evt == NULL) + { + return; + } + + switch (uart_evt->evt_type) + { + case APP_UART_COMMUNICATION_ERROR: + + // Process error only if this is parity or overrun error. + // Break and framing error is always present when app side is not active + if (uart_evt->data.error_communication & + (UART_ERRORSRC_PARITY_Msk | UART_ERRORSRC_OVERRUN_Msk)) + { + callback_hw_error(uart_evt->data.error_communication); + } + break; + + case APP_UART_TX_EMPTY: + (void)ser_phy_hci_tx_byte(); + break; + + case APP_UART_DATA: + + // After first reception disable pulldown - it was only needed before start + // of the other side + if (!m_other_side_active) + { + m_other_side_active = true; + } + + m_rx_byte = uart_evt->data.value; + ser_phi_hci_rx_byte(m_rx_byte); + break; + + default: + APP_ERROR_CHECK(NRF_ERROR_INTERNAL); + break; + } +} + + +uint32_t ser_phy_hci_slip_open(ser_phy_hci_slip_event_handler_t events_handler) +{ + uint32_t err_code; + + if (events_handler == NULL) + { + return NRF_ERROR_NULL; + } + + // Check if function was not called before + if (m_ser_phy_hci_slip_event_handler != NULL) + { + return NRF_ERROR_INVALID_STATE; + } + + // Configure UART and register handler + // uart_evt_handler is used to handle events produced by low-level uart driver + APP_UART_INIT(&comm_params, ser_phy_uart_evt_callback, UART_IRQ_PRIORITY, err_code); + + mp_small_buffer = m_small_buffer; + mp_big_buffer = m_big_buffer; + + m_ser_phy_hci_slip_event_handler = events_handler; + + return err_code; +} + + +void ser_phy_hci_slip_close(void) +{ + m_ser_phy_hci_slip_event_handler = NULL; + (void)app_uart_close(); +} + diff --git a/components/serialization/common/transport/ser_phy/ser_phy_nohci.c b/components/serialization/common/transport/ser_phy/ser_phy_nohci.c new file mode 100644 index 0000000..2aac44c --- /dev/null +++ b/components/serialization/common/transport/ser_phy/ser_phy_nohci.c @@ -0,0 +1,356 @@ +/* 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. + * + */ + +/**@file + * + * @defgroup ser_phy_spi_phy_driver_slave ser_phy_nrf51_spi_slave.c + * @{ + * @ingroup ser_phy_spi_phy_driver_slave + * + * @brief SPI_RAW PHY slave driver. + */ + +#include +#include + +#include "app_error.h" +#include "app_util.h" +#include "app_util_platform.h" +#include "app_timer.h" +#include "app_mailbox.h" +#include "ser_phy.h" +#include "ser_phy_hci.h" +#include "crc16.h" +#include "nrf_soc.h" + +#include "ser_phy_debug_comm.h" + +static bool m_flag_nohci_init = false; +static bool m_flag_expect_ack; +static bool m_flag_buffer_reqested = false; + +static uint16_t m_rx_packet_length; +static uint8_t * m_p_rx_packet; + +static uint16_t m_rx_pending_packet_length; +static uint8_t * m_p_rx_pending_packet; + +static uint16_t m_rx_allocated_packet_length; +static uint8_t * m_p_rx_allocated_packet; + +static uint8_t * m_p_tx_packet = NULL; +static uint16_t m_tx_packet_length; + +static ser_phy_events_handler_t m_ser_phy_callback = NULL; + +#define PKT_HDR_SIZE 4 /**< Packet header size in number of bytes. */ +#define PKT_CRC_SIZE 2 /**< Packet CRC size in number of bytes. */ + +static void ser_phy_nohci_assert(bool cond) +{ + APP_ERROR_CHECK_BOOL(cond); +} + + +static void ser_phy_event_callback(ser_phy_evt_t event) +{ + if (m_ser_phy_callback) + { + m_ser_phy_callback(event); + } +} + + +static void memory_request_callback(uint16_t size) +{ + ser_phy_evt_t event; + + DEBUG_EVT_HCI_PHY_EVT_BUF_REQUEST(0); + + event.evt_type = SER_PHY_EVT_RX_BUF_REQUEST; + event.evt_params.rx_buf_request.num_of_bytes = size; + ser_phy_event_callback(event); +} + + +static void packet_received_callback(uint8_t * pBuffer, uint16_t size) +{ + ser_phy_evt_t event; + + DEBUG_EVT_HCI_PHY_EVT_RX_PKT_RECEIVED(0); + + event.evt_type = SER_PHY_EVT_RX_PKT_RECEIVED; + event.evt_params.rx_pkt_received.num_of_bytes = size; + event.evt_params.rx_pkt_received.p_buffer = pBuffer; + ser_phy_event_callback(event); +} + + +static void packet_dropped_callback(void) +{ + ser_phy_evt_t event; + + DEBUG_EVT_HCI_PHY_EVT_RX_PKT_DROPPED(0); + + event.evt_type = SER_PHY_EVT_RX_PKT_DROPPED; + ser_phy_event_callback(event); +} + + +static void packet_transmitted_callback(void) +{ + ser_phy_evt_t event; + + DEBUG_EVT_HCI_PHY_EVT_TX_PKT_SENT(0); + + event.evt_type = SER_PHY_EVT_TX_PKT_SENT; + ser_phy_event_callback(event); +} + + +static void hci_slip_event_handler(ser_phy_hci_slip_evt_t * p_event) +{ + if ( p_event->evt_type == SER_PHY_HCI_SLIP_EVT_PKT_SENT ) + { + DEBUG_EVT_SLIP_PACKET_TXED(0); + + if (!m_flag_expect_ack) + { + m_p_tx_packet = NULL; + packet_transmitted_callback(); + } + else + { + ser_phy_nohci_assert(false); // packet was send as a ACK packet, callback should be with ACK_SENT + } + + } + else if ( p_event->evt_type == SER_PHY_HCI_SLIP_EVT_ACK_SENT ) + { + DEBUG_EVT_SLIP_ACK_TXED(0); + + if (m_flag_expect_ack) + { + m_p_tx_packet = NULL; + packet_transmitted_callback(); + } + else + { + ser_phy_nohci_assert(false); // packet was send as a normal packet, callback should be with PKT_SENT + } + + } + else if ( p_event->evt_type == SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED ) + { + CRITICAL_REGION_ENTER(); + + if (m_p_rx_packet == NULL) + { + m_p_rx_packet = p_event->evt_params.received_pkt.p_buffer; + m_rx_packet_length = p_event->evt_params.received_pkt.num_of_bytes; + m_p_rx_allocated_packet = m_p_rx_packet; + m_rx_allocated_packet_length = m_rx_packet_length; + m_flag_buffer_reqested = true; + memory_request_callback(m_rx_allocated_packet_length); + } + else if (m_p_rx_pending_packet == NULL) + { + m_p_rx_pending_packet = p_event->evt_params.received_pkt.p_buffer; + m_rx_pending_packet_length = p_event->evt_params.received_pkt.num_of_bytes; + } + else + { + // both buffers are not released; this is fault + ser_phy_nohci_assert(false); + } + CRITICAL_REGION_EXIT(); + } + else + { + // no other callbacks are expected + ser_phy_nohci_assert(false); + } +} + + +/* ser_phy API function */ +void ser_phy_interrupts_enable(void) +{ + + NVIC_EnableIRQ(UART0_IRQn); + return; +} + + +/* ser_phy API function */ +void ser_phy_interrupts_disable(void) +{ + NVIC_DisableIRQ(UART0_IRQn); + return; +} + + +/* ser_phy API function */ +uint32_t ser_phy_rx_buf_set(uint8_t * p_buffer) +{ + uint32_t status = NRF_SUCCESS; + + if (m_flag_buffer_reqested) + { + m_flag_buffer_reqested = false; + + if (p_buffer) + { + memcpy(p_buffer, m_p_rx_allocated_packet, m_rx_allocated_packet_length); + packet_received_callback(p_buffer, m_rx_allocated_packet_length); + } + else + { + packet_dropped_callback(); + } + + CRITICAL_REGION_ENTER(); + + if (m_p_rx_allocated_packet == m_p_rx_packet && (m_p_rx_pending_packet == NULL)) + { + // packet is copied and there is no pending packet + (void) ser_phy_hci_slip_rx_buf_free(m_p_rx_packet); + m_p_rx_packet = NULL; + m_p_rx_allocated_packet = NULL; + } + else if (m_p_rx_allocated_packet == m_p_rx_packet && (m_p_rx_pending_packet != NULL)) + { + // there is a pending packet - request memory for it + m_p_rx_allocated_packet = m_p_rx_pending_packet; + m_rx_allocated_packet_length = m_rx_pending_packet_length; + m_flag_buffer_reqested = true; + } + else if (m_p_rx_allocated_packet == m_p_rx_pending_packet ) + { + // the pending packet was serviced - release both + m_p_rx_allocated_packet = NULL; + (void) ser_phy_hci_slip_rx_buf_free(m_p_rx_packet); + m_p_rx_packet = NULL; + (void) ser_phy_hci_slip_rx_buf_free(m_p_rx_pending_packet); + m_p_rx_pending_packet = NULL; + } + else + { + // no other calls are expected + ser_phy_nohci_assert(false); + } + CRITICAL_REGION_EXIT(); + + // request memory for a pending + if (m_p_rx_allocated_packet) + { + memory_request_callback(m_rx_allocated_packet_length); + } + } + else + { + status = NRF_ERROR_BUSY; + } + return status; +} + + +/* ser_phy API function */ +uint32_t ser_phy_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes) +{ + uint32_t status = NRF_SUCCESS; + uint32_t err_code; + + if ( p_buffer == NULL || num_of_bytes == 0) + { + return NRF_ERROR_NULL; + } + + if ( m_p_tx_packet == NULL) + { + m_tx_packet_length = num_of_bytes; + m_p_tx_packet = (uint8_t *)p_buffer; + + if (m_tx_packet_length <= PKT_HDR_SIZE + PKT_CRC_SIZE) + { + ser_phy_hci_pkt_params_t pkt; // all packets smaller than 6 goes as ACK + + m_flag_expect_ack = true; + pkt.p_buffer = (uint8_t *)m_p_tx_packet; + pkt.num_of_bytes = m_tx_packet_length; + DEBUG_EVT_SLIP_ACK_TX(0); + err_code = ser_phy_hci_slip_tx_pkt_send(&pkt, NULL, NULL); // this will look like ACK for slip + ser_phy_nohci_assert(err_code == NRF_SUCCESS); + } + else + { + ser_phy_hci_pkt_params_t header; // this is fake header - just first 4 bytes + ser_phy_hci_pkt_params_t crc; // this is fake header - just last 2 bytes + ser_phy_hci_pkt_params_t payload; // this is fake payload - all except for header and crc + + m_flag_expect_ack = false; + header.p_buffer = (uint8_t *)m_p_tx_packet; + header.num_of_bytes = PKT_HDR_SIZE; + crc.p_buffer = (uint8_t *)m_p_tx_packet + m_tx_packet_length - PKT_CRC_SIZE; + crc.num_of_bytes = PKT_CRC_SIZE; + payload.p_buffer = (uint8_t *)m_p_tx_packet + PKT_HDR_SIZE; + payload.num_of_bytes = m_tx_packet_length - PKT_HDR_SIZE - PKT_CRC_SIZE; + DEBUG_EVT_SLIP_PACKET_TX(0); + err_code = ser_phy_hci_slip_tx_pkt_send(&header, &payload, &crc); // this will look like normal packet for slip + ser_phy_nohci_assert(err_code == NRF_SUCCESS); + } + } + else + { + status = NRF_ERROR_BUSY; + } + + return status; +} + + +/* ser_phy API function */ +uint32_t ser_phy_open(ser_phy_events_handler_t events_handler) +{ + uint32_t err_code; + + if (m_flag_nohci_init) + { + return NRF_ERROR_INVALID_STATE; + } + + if (events_handler == NULL) + { + return NRF_ERROR_NULL; + } + err_code = ser_phy_hci_slip_open(hci_slip_event_handler); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + m_ser_phy_callback = events_handler; + m_flag_nohci_init = true; + return NRF_SUCCESS; +} + + +/* ser_phy API function */ +void ser_phy_close(void) +{ + m_ser_phy_callback = NULL; + ser_phy_hci_slip_close(); + m_flag_nohci_init = false; +} + + diff --git a/components/serialization/common/transport/ser_phy/ser_phy_nrf51_nrf_drv_spi.c b/components/serialization/common/transport/ser_phy/ser_phy_nrf51_nrf_drv_spi.c new file mode 100644 index 0000000..54900b6 --- /dev/null +++ b/components/serialization/common/transport/ser_phy/ser_phy_nrf51_nrf_drv_spi.c @@ -0,0 +1,774 @@ +/* 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. + * + */ + +/**@file + * + * @defgroup ser_phy_spi_phy_driver_master ser_phy_nrf51_spi_master.c + * @{ + * @ingroup ser_phy_spi_phy_driver_master + * + * @brief SPI_RAW PHY master driver. + */ + +#include +#include "nrf_drv_gpiote.h" +#include "nrf_drv_spi.h" +#include "ser_phy.h" +#include "ser_config.h" +#include "app_util.h" +#include "app_util_platform.h" +#include "app_error.h" +#include "nrf_error.h" +#include "nrf_gpio.h" +#include "nrf_gpiote.h" +#include "boards.h" +#include "app_error.h" +#include "ser_phy_config_app_nrf51.h" +#include "ser_phy_debug_app.h" + +#define notUSE_PendSV + +#ifdef USE_PendSV + +#define SW_IRQn PendSV_IRQn +#define SW_IRQ_Handler() PendSV_Handler() +#define SET_Pend_SW_IRQ() SCB->ICSR = SCB->ICSR | SCB_ICSR_PENDSVSET_Msk //NVIC_SetPendingIRQ(PendSV_IRQn) - PendSV_IRQn is a negative - does not work with CMSIS + +#else + +#ifdef NRF51 +#define SW_IRQn SWI3_IRQn +#define SW_IRQ_Handler() SWI3_IRQHandler() +#define SET_Pend_SW_IRQ() NVIC_SetPendingIRQ(SWI3_IRQn) +#elif defined NRF52 +#define SW_IRQn SWI3_EGU3_IRQn +#define SW_IRQ_Handler() SWI3_EGU3_IRQHandler() +#define SET_Pend_SW_IRQ() NVIC_SetPendingIRQ(SWI3_EGU3_IRQn) +#endif /* NRF51 */ + +#endif /* USE_PendSV */ + +typedef enum +{ + SER_PHY_STATE_IDLE = 0, + SER_PHY_STATE_TX_HEADER, + SER_PHY_STATE_TX_WAIT_FOR_RDY, + SER_PHY_STATE_TX_PAYLOAD, + SER_PHY_STATE_RX_WAIT_FOR_RDY, + SER_PHY_STATE_TX_ZERO_HEADER, + SER_PHY_STATE_RX_HEADER, + SER_PHY_STATE_MEMORY_REQUEST, + SER_PHY_STATE_RX_PAYLOAD, + SER_PHY_STATE_DISABLED +} ser_phy_spi_master_state_t; + +typedef enum +{ + SER_PHY_EVT_GPIO_RDY = 0, + SER_PHY_EVT_GPIO_REQ, + SER_PHY_EVT_SPI_TRANSFER_DONE, + SER_PHY_EVT_TX_API_CALL, + SER_PHY_EVT_RX_API_CALL +} ser_phy_event_source_t; + +#define _static static + +_static uint8_t * mp_tx_buffer = NULL; +_static uint16_t m_tx_buf_len = 0; + +_static uint8_t * mp_rx_buffer = NULL; +_static uint16_t m_rx_buf_len = 0; +_static uint8_t m_frame_buffer[SER_PHY_SPI_MTU_SIZE]; +_static uint8_t m_header_buffer[SER_PHY_HEADER_SIZE] = { 0 }; + +_static uint16_t m_tx_packet_length = 0; +_static uint16_t m_accumulated_tx_packet_length = 0; +_static uint16_t m_current_tx_packet_length = 0; + +_static uint16_t m_rx_packet_length = 0; +_static uint16_t m_accumulated_rx_packet_length = 0; +_static uint16_t m_current_rx_packet_length = 0; + +_static volatile bool m_pend_req_flag = 0; +_static volatile bool m_pend_rdy_flag = 0; +_static volatile bool m_pend_xfer_flag = 0; +_static volatile bool m_pend_rx_api_flag = 0; +_static volatile bool m_pend_tx_api_flag = 0; + +_static volatile bool m_slave_ready_flag = false; +_static volatile bool m_slave_request_flag = false; + +_static ser_phy_events_handler_t m_callback_events_handler = NULL; +_static ser_phy_spi_master_state_t m_spi_master_state = SER_PHY_STATE_DISABLED; + +_static const nrf_drv_spi_t m_spi_master = SER_PHY_SPI_MASTER_INSTANCE; + +static void ser_phy_switch_state(ser_phy_event_source_t evt_src); + +static void spi_master_raw_assert(bool cond) +{ + APP_ERROR_CHECK_BOOL(cond); +} + +void SW_IRQ_Handler() +{ + if (m_pend_req_flag) + { + m_pend_req_flag = false; + DEBUG_EVT_SPI_MASTER_RAW_REQUEST(0); + ser_phy_switch_state(SER_PHY_EVT_GPIO_REQ); + } + + if (m_pend_rdy_flag) + { + m_pend_rdy_flag = false; + DEBUG_EVT_SPI_MASTER_RAW_READY(0); + ser_phy_switch_state(SER_PHY_EVT_GPIO_RDY); + } + + if (m_pend_xfer_flag) + { + m_pend_xfer_flag = false; + DEBUG_EVT_SPI_MASTER_RAW_XFER_DONE(0); + ser_phy_switch_state(SER_PHY_EVT_SPI_TRANSFER_DONE); + } + + if (m_pend_rx_api_flag) + { + m_pend_rx_api_flag = false; + DEBUG_EVT_SPI_MASTER_RAW_API_CALL(0); + ser_phy_switch_state(SER_PHY_EVT_RX_API_CALL); + } + + if (m_pend_tx_api_flag) + { + m_pend_tx_api_flag = false; + DEBUG_EVT_SPI_MASTER_RAW_API_CALL(0); + ser_phy_switch_state(SER_PHY_EVT_TX_API_CALL); + } +} + +void ser_phy_spi_master_ready(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action) +{ + if (nrf_gpio_pin_read(pin) == 0) + { + m_slave_ready_flag = true; + m_pend_rdy_flag = true; + } + else + { + m_slave_ready_flag = false; + } + + DEBUG_EVT_SPI_MASTER_RAW_READY_EDGE((uint32_t) !m_slave_ready_flag); + SET_Pend_SW_IRQ(); +} + +void ser_phy_spi_master_request(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action) +{ + if (nrf_gpio_pin_read(pin) == 0) + { + m_slave_request_flag = true; + m_pend_req_flag = true; + } + else + { + m_slave_request_flag = false; + } + + DEBUG_EVT_SPI_MASTER_RAW_REQUEST_EDGE((uint32_t) !m_slave_request_flag); + SET_Pend_SW_IRQ(); +} + +/* Send event SER_PHY_EVT_TX_PKT_SENT */ +static __INLINE void callback_packet_sent() +{ + ser_phy_evt_t event; + + DEBUG_EVT_SPI_MASTER_PHY_TX_PKT_SENT(0); + + event.evt_type = SER_PHY_EVT_TX_PKT_SENT; + m_callback_events_handler(event); +} + +/* Send event SER_PHY_EVT_RX_PKT_DROPPED */ +static __INLINE void callback_packet_dropped() +{ + ser_phy_evt_t event; + + DEBUG_EVT_SPI_MASTER_PHY_RX_PKT_DROPPED(0); + + event.evt_type = SER_PHY_EVT_RX_PKT_DROPPED; + m_callback_events_handler(event); +} + +/* Send event SER_PHY_EVT_RX_PKT_RECEIVED */ +static __INLINE void callback_packet_received() +{ + ser_phy_evt_t event; + + DEBUG_EVT_SPI_MASTER_PHY_RX_PKT_RECEIVED(0); + + event.evt_type = SER_PHY_EVT_RX_PKT_RECEIVED; + event.evt_params.rx_pkt_received.p_buffer = mp_rx_buffer; + event.evt_params.rx_pkt_received.num_of_bytes = m_rx_buf_len; + m_callback_events_handler(event); +} + +/* Send event SER_PHY_EVT_RX_BUF_REQUEST */ +static __INLINE void callback_mem_request() +{ + ser_phy_evt_t event; + + DEBUG_EVT_SPI_MASTER_PHY_BUF_REQUEST(0); + + event.evt_type = SER_PHY_EVT_RX_BUF_REQUEST; + event.evt_params.rx_buf_request.num_of_bytes = m_rx_buf_len; + m_callback_events_handler(event); +} + +/* Release buffer */ +static __INLINE void buffer_release(uint8_t * * const pp_buffer, + uint16_t * const p_buf_len) +{ + *pp_buffer = NULL; + *p_buf_len = 0; +} + +/* Function computes current packet length */ +static uint16_t compute_current_packet_length(const uint16_t packet_length, + const uint16_t accumulated_packet_length) +{ + uint16_t current_packet_length = packet_length - accumulated_packet_length; + + if (current_packet_length > SER_PHY_SPI_MTU_SIZE) + { + current_packet_length = SER_PHY_SPI_MTU_SIZE; + } + + return current_packet_length; +} + +static __INLINE uint32_t header_send(const uint16_t length) +{ + uint8_t buf_len_size = uint16_encode(length, m_header_buffer); + + return nrf_drv_spi_transfer(&m_spi_master, m_header_buffer, buf_len_size, NULL, 0); +} + + +static __INLINE uint32_t frame_send() +{ + uint32_t err_code; + + m_current_tx_packet_length = compute_current_packet_length(m_tx_packet_length, + m_accumulated_tx_packet_length); + err_code = + nrf_drv_spi_transfer(&m_spi_master, + &mp_tx_buffer[m_accumulated_tx_packet_length], + m_current_tx_packet_length, + NULL, + 0); + m_accumulated_tx_packet_length += m_current_tx_packet_length; + return err_code; +} + +static __INLINE uint32_t header_get() +{ + return nrf_drv_spi_transfer(&m_spi_master, NULL, 0, m_header_buffer, SER_PHY_HEADER_SIZE); +} + +static __INLINE uint32_t frame_get() +{ + uint32_t err_code; + + m_current_rx_packet_length = compute_current_packet_length(m_rx_packet_length, + m_accumulated_rx_packet_length); + + if (mp_rx_buffer) + { + err_code = nrf_drv_spi_transfer(&m_spi_master, + NULL, + 0, + &(mp_rx_buffer[m_accumulated_rx_packet_length]), + m_current_rx_packet_length); + } + else + { + err_code = nrf_drv_spi_transfer(&m_spi_master, + NULL, + 0, + m_frame_buffer, + m_current_rx_packet_length); + } + return err_code; +} + + +/** + * \brief Master driver main state machine + * Executed only in the context of PendSV_Handler() + * For UML graph, please refer to SDK documentation +*/ +static void ser_phy_switch_state(ser_phy_event_source_t evt_src) +{ + uint32_t err_code = NRF_SUCCESS; + static bool m_wait_for_ready_flag = false; //local scheduling flag to defer RDY events + + switch (m_spi_master_state) + { + + case SER_PHY_STATE_IDLE: + + if (evt_src == SER_PHY_EVT_GPIO_REQ) + { + m_wait_for_ready_flag = false; + + if (m_slave_ready_flag) + { + m_spi_master_state = SER_PHY_STATE_TX_ZERO_HEADER; + err_code = header_send(0); + } + else + { + m_spi_master_state = SER_PHY_STATE_RX_WAIT_FOR_RDY; + } + } + else if (evt_src == SER_PHY_EVT_TX_API_CALL) + { + spi_master_raw_assert(mp_tx_buffer != NULL); //api event with tx_buffer == NULL has no sense + m_wait_for_ready_flag = false; + + if (m_slave_ready_flag) + { + m_spi_master_state = SER_PHY_STATE_TX_HEADER; + err_code = header_send(m_tx_buf_len); + } + else + { + m_spi_master_state = SER_PHY_STATE_TX_WAIT_FOR_RDY; + } + } + break; + + case SER_PHY_STATE_TX_WAIT_FOR_RDY: + + if (evt_src == SER_PHY_EVT_GPIO_RDY) + { + m_spi_master_state = SER_PHY_STATE_TX_HEADER; + err_code = header_send(m_tx_buf_len); + } + break; + + case SER_PHY_STATE_RX_WAIT_FOR_RDY: + + if (evt_src == SER_PHY_EVT_GPIO_RDY) + { + m_spi_master_state = SER_PHY_STATE_TX_ZERO_HEADER; + err_code = header_send(0); + + } + break; + + case SER_PHY_STATE_TX_HEADER: + + if (evt_src == SER_PHY_EVT_SPI_TRANSFER_DONE) + { + m_tx_packet_length = m_tx_buf_len; + m_accumulated_tx_packet_length = 0; + + if (m_slave_ready_flag) + { + m_spi_master_state = SER_PHY_STATE_TX_PAYLOAD; + err_code = frame_send(); + + } + else + { + m_wait_for_ready_flag = true; + } + } + else if ((evt_src == SER_PHY_EVT_GPIO_RDY) && m_wait_for_ready_flag) + { + m_wait_for_ready_flag = false; + m_spi_master_state = SER_PHY_STATE_TX_PAYLOAD; + err_code = frame_send(); + } + + break; + + case SER_PHY_STATE_TX_PAYLOAD: + + if (evt_src == SER_PHY_EVT_SPI_TRANSFER_DONE) + { + if (m_accumulated_tx_packet_length < m_tx_packet_length) + { + if (m_slave_ready_flag) + { + err_code = frame_send(); + } + else + { + m_wait_for_ready_flag = true; + } + } + else + { + spi_master_raw_assert(m_accumulated_tx_packet_length == m_tx_packet_length); + buffer_release(&mp_tx_buffer, &m_tx_buf_len); + callback_packet_sent(); + if ( m_slave_request_flag) + { + if (m_slave_ready_flag) + { + m_spi_master_state = SER_PHY_STATE_TX_ZERO_HEADER; + err_code = header_send(0); + } + else + { + m_spi_master_state = SER_PHY_STATE_RX_WAIT_FOR_RDY; + } + } + else + { + m_spi_master_state = SER_PHY_STATE_IDLE; //m_Tx_buffer is NULL - have to wait for API event + } + } + } + else if ((evt_src == SER_PHY_EVT_GPIO_RDY) && m_wait_for_ready_flag ) + { + m_wait_for_ready_flag = false; + err_code = frame_send(); + } + + break; + + case SER_PHY_STATE_TX_ZERO_HEADER: + + if (evt_src == SER_PHY_EVT_SPI_TRANSFER_DONE) + { + if (m_slave_ready_flag) + { + m_spi_master_state = SER_PHY_STATE_RX_HEADER; + err_code = header_get(); + } + else + { + m_wait_for_ready_flag = true; + } + } + else if ( (evt_src == SER_PHY_EVT_GPIO_RDY) && m_wait_for_ready_flag) + { + m_wait_for_ready_flag = false; + m_spi_master_state = SER_PHY_STATE_RX_HEADER; + err_code = header_get(); + } + break; + + case SER_PHY_STATE_RX_HEADER: + + if (evt_src == SER_PHY_EVT_SPI_TRANSFER_DONE) + { + m_spi_master_state = SER_PHY_STATE_MEMORY_REQUEST; + m_rx_buf_len = uint16_decode(m_header_buffer); + m_rx_packet_length = m_rx_buf_len; + callback_mem_request(); + + } + break; + + case SER_PHY_STATE_MEMORY_REQUEST: + + if (evt_src == SER_PHY_EVT_RX_API_CALL) + { + m_accumulated_rx_packet_length = 0; + + if (m_slave_ready_flag) + { + m_spi_master_state = SER_PHY_STATE_RX_PAYLOAD; + err_code = frame_get(); + } + else + { + m_wait_for_ready_flag = true; + } + } + else if ((evt_src == SER_PHY_EVT_GPIO_RDY) && m_wait_for_ready_flag) + { + m_wait_for_ready_flag = false; + m_spi_master_state = SER_PHY_STATE_RX_PAYLOAD; + err_code = frame_get(); + } + break; + + case SER_PHY_STATE_RX_PAYLOAD: + + if (evt_src == SER_PHY_EVT_SPI_TRANSFER_DONE) + { + m_accumulated_rx_packet_length += m_current_rx_packet_length; + + if (m_accumulated_rx_packet_length < m_rx_packet_length) + { + if (m_slave_ready_flag) + { + err_code = frame_get(); + } + else + { + m_wait_for_ready_flag = true; + } + } + else + { + spi_master_raw_assert(m_accumulated_rx_packet_length == m_rx_packet_length); + + if (mp_rx_buffer == NULL) + { + callback_packet_dropped(); + } + else + { + callback_packet_received(); + } + buffer_release(&mp_rx_buffer, &m_rx_buf_len); + if (mp_tx_buffer != NULL) //mp_tx_buffer !=NULL, this means that API_EVT was scheduled + { + if (m_slave_ready_flag ) + { + err_code = header_send(m_tx_buf_len); + m_spi_master_state = SER_PHY_STATE_TX_HEADER; + } + else + { + m_spi_master_state = SER_PHY_STATE_TX_WAIT_FOR_RDY; + } + } + else if (m_slave_request_flag) + { + if (m_slave_ready_flag) + { + m_spi_master_state = SER_PHY_STATE_TX_ZERO_HEADER; + err_code = header_send(0); + } + else + { + m_spi_master_state = SER_PHY_STATE_RX_WAIT_FOR_RDY; + } + } + else + { + m_spi_master_state = SER_PHY_STATE_IDLE; + + } + } + + } + else if ( evt_src == SER_PHY_EVT_GPIO_RDY && m_wait_for_ready_flag) + { + m_wait_for_ready_flag = false; + err_code = frame_get(); + } + break; + + default: + break; + } + + if (err_code != NRF_SUCCESS) + { + (void)err_code; + } +} + +static void ser_phy_spi_master_event_handler(nrf_drv_spi_event_t event) +{ + switch (event) + { + case NRF_DRV_SPI_EVENT_DONE: + + /* Switch state */ + m_pend_xfer_flag = true; + SET_Pend_SW_IRQ(); + + break; + + default: + break; + } +} + +static __INLINE void ser_phy_init_PendSV() +{ + NVIC_SetPriority(SW_IRQn, APP_IRQ_PRIORITY_MID); + NVIC_EnableIRQ(SW_IRQn); +} + +static __INLINE void ser_phy_init_gpio() +{ + nrf_gpio_cfg_input(SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST, NRF_GPIO_PIN_PULLUP); + nrf_gpio_cfg_input(SER_PHY_SPI_MASTER_PIN_SLAVE_READY, NRF_GPIO_PIN_PULLUP); +} + +static __INLINE void ser_phy_init_gpiote() +{ + if (!nrf_drv_gpiote_is_init()) + { + (void)nrf_drv_gpiote_init(); + } + m_slave_request_flag = !(nrf_gpio_pin_read(SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST)); + m_slave_ready_flag = !(nrf_gpio_pin_read(SER_PHY_SPI_MASTER_PIN_SLAVE_READY)); + + nrf_drv_gpiote_in_config_t config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(true); + /* Enable pullup to ensure high state while connectivity device is reset */ + config.pull = NRF_GPIO_PIN_PULLUP; + (void)nrf_drv_gpiote_in_init(SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST, &config, ser_phy_spi_master_request); + nrf_drv_gpiote_in_event_enable(SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST,true); + + (void)nrf_drv_gpiote_in_init(SER_PHY_SPI_MASTER_PIN_SLAVE_READY, &config, ser_phy_spi_master_ready); + nrf_drv_gpiote_in_event_enable(SER_PHY_SPI_MASTER_PIN_SLAVE_READY,true); + + NVIC_ClearPendingIRQ(SW_IRQn); +} + +static __INLINE void ser_phy_deinit_gpiote() +{ + nrf_drv_gpiote_in_uninit(SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST); + nrf_drv_gpiote_in_uninit(SER_PHY_SPI_MASTER_PIN_SLAVE_READY); + +// (void)app_gpiote_end_irq_event_handler_unregister(); +} + +/* ser_phy API function */ +uint32_t ser_phy_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes) +{ + if (p_buffer == NULL) + { + return NRF_ERROR_NULL; + } + + if (num_of_bytes == 0) + { + return NRF_ERROR_INVALID_PARAM; + } + + if (mp_tx_buffer != NULL) + { + return NRF_ERROR_BUSY; + } + + //ser_phy_interrupts_disable(); + CRITICAL_REGION_ENTER(); + mp_tx_buffer = (uint8_t *)p_buffer; + m_tx_buf_len = num_of_bytes; + m_pend_tx_api_flag = true; + SET_Pend_SW_IRQ(); + //ser_phy_interrupts_enable(); + CRITICAL_REGION_EXIT(); + + return NRF_SUCCESS; +} +/* ser_phy API function */ +uint32_t ser_phy_rx_buf_set(uint8_t * p_buffer) +{ + if (m_spi_master_state != SER_PHY_STATE_MEMORY_REQUEST) + { + return NRF_ERROR_INVALID_STATE; + } + + //ser_phy_interrupts_disable(); + CRITICAL_REGION_ENTER(); + mp_rx_buffer = p_buffer; + m_pend_rx_api_flag = true; + SET_Pend_SW_IRQ(); + //ser_phy_interrupts_enable(); + CRITICAL_REGION_EXIT(); + + return NRF_SUCCESS; +} + +/* ser_phy API function */ +uint32_t ser_phy_open(ser_phy_events_handler_t events_handler) +{ + if (m_spi_master_state != SER_PHY_STATE_DISABLED) + { + return NRF_ERROR_INVALID_STATE; + } + + if (events_handler == NULL) + { + return NRF_ERROR_NULL; + } + + uint32_t err_code = NRF_SUCCESS; + + m_spi_master_state = SER_PHY_STATE_IDLE; + m_callback_events_handler = events_handler; + nrf_drv_spi_config_t spi_master_config = { + .sck_pin = SER_PHY_SPI_MASTER_PIN_SCK, + .mosi_pin = SER_PHY_SPI_MASTER_PIN_MOSI, + .miso_pin = SER_PHY_SPI_MASTER_PIN_MISO, + .ss_pin = SER_PHY_SPI_MASTER_PIN_SLAVE_SELECT, + .irq_priority = APP_IRQ_PRIORITY_MID, + .orc = 0, + .frequency = SER_PHY_SPI_FREQUENCY, + .mode = NRF_DRV_SPI_MODE_0, + .bit_order = NRF_DRV_SPI_BIT_ORDER_LSB_FIRST, + }; + err_code = nrf_drv_spi_init(&m_spi_master, &spi_master_config, + ser_phy_spi_master_event_handler); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + ser_phy_init_gpio(); + ser_phy_init_gpiote(); + ser_phy_init_PendSV(); + return err_code; +} + +/* ser_phy API function */ +void ser_phy_close(void) +{ + m_spi_master_state = SER_PHY_STATE_DISABLED; + + m_callback_events_handler = NULL; + + buffer_release(&mp_tx_buffer, &m_tx_buf_len); + buffer_release(&mp_rx_buffer, &m_rx_buf_len); + + m_tx_packet_length = 0; + m_accumulated_tx_packet_length = 0; + m_current_tx_packet_length = 0; + + m_rx_packet_length = 0; + m_accumulated_rx_packet_length = 0; + m_current_rx_packet_length = 0; + + ser_phy_deinit_gpiote(); + nrf_drv_spi_uninit(&m_spi_master); +} + +/* ser_phy API function */ +/* only PendSV may interact with ser_phy layer, other interrupts are internal */ +void ser_phy_interrupts_enable(void) +{ + NVIC_EnableIRQ(SW_IRQn); +} + +/* ser_phy API function */ +void ser_phy_interrupts_disable(void) +{ + NVIC_DisableIRQ(SW_IRQn); +} + +/** @} */ diff --git a/components/serialization/common/transport/ser_phy/ser_phy_nrf51_spi_5W_master.c b/components/serialization/common/transport/ser_phy/ser_phy_nrf51_spi_5W_master.c new file mode 100644 index 0000000..e1e931d --- /dev/null +++ b/components/serialization/common/transport/ser_phy/ser_phy_nrf51_spi_5W_master.c @@ -0,0 +1,803 @@ +/* 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. + * + */ + +/**@file + * + * @defgroup ser_phy_spi_5W_phy_driver_master ser_phy_nrf51_spi_5W_master.c + * @{ + * @ingroup ser_phy_spi_5W_phy_driver_master + * + * @brief SPI_5W_RAW PHY master driver. + */ + +#include +#include "app_util.h" +#include "app_util_platform.h" +#include "boards.h" +#include "nrf_error.h" +#include "nrf_gpio.h" +#include "nrf_drv_gpiote.h" +#include "ser_config.h" +#include "ser_config_5W_app.h" +#include "ser_phy.h" +#include "ser_phy_config_app_nrf51.h" +#include "spi_5W_master.h" +#include "ser_phy_debug_app.h" +#include "app_error.h" +#define notUSE_PendSV + +#ifdef USE_PendSV +#define SW_IRQn PendSV_IRQn +#define SW_IRQ_Handler() PendSV_Handler() +#define SET_Pend_SW_IRQ() SCB->ICSR = SCB->ICSR | SCB_ICSR_PENDSVSET_Msk //NVIC_SetPendingIRQ(PendSV_IRQn) - PendSV_IRQn is a negative - does not work with CMSIS +#else +#define SW_IRQn SWI3_IRQn +#define SW_IRQ_Handler() SWI3_IRQHandler() +#define SET_Pend_SW_IRQ() NVIC_SetPendingIRQ(SWI3_IRQn) +#endif + +#define SER_PHY_SPI_5W_MTU_SIZE SER_PHY_SPI_MTU_SIZE + +typedef enum +{ + SER_PHY_STATE_IDLE = 0, + SER_PHY_STATE_TX_HEADER, + SER_PHY_STATE_TX_WAIT_FOR_RDY, + SER_PHY_STATE_TX_PAYLOAD, + SER_PHY_STATE_RX_WAIT_FOR_RDY, + SER_PHY_STATE_TX_ZERO_HEADER, + SER_PHY_STATE_RX_HEADER, + SER_PHY_STATE_MEMORY_REQUEST, + SER_PHY_STATE_RX_PAYLOAD, + SER_PHY_STATE_DISABLED +} ser_phy_spi_master_state_t; + +typedef enum +{ + SER_PHY_EVT_GPIO_RDY = 0, + SER_PHY_EVT_GPIO_REQ, + SER_PHY_EVT_SPI_TRANSFER_DONE, + SER_PHY_EVT_TX_API_CALL, + SER_PHY_EVT_RX_API_CALL +} ser_phy_event_source_t; + +#define _static static + +_static uint8_t * mp_tx_buffer = NULL; +_static uint16_t m_tx_buf_len = 0; + +_static uint8_t * mp_rx_buffer = NULL; +_static uint16_t m_rx_buf_len = 0; +_static uint8_t m_recv_buffer[SER_PHY_SPI_5W_MTU_SIZE]; +_static uint8_t m_len_buffer[SER_PHY_HEADER_SIZE + 1] = { 0 }; //len is asymmetric for 5W, there is a 1 byte guard when receiving + +_static uint16_t m_tx_packet_length = 0; +_static uint16_t m_accumulated_tx_packet_length = 0; +_static uint16_t m_current_tx_packet_length = 0; + +_static uint16_t m_rx_packet_length = 0; +_static uint16_t m_accumulated_rx_packet_length = 0; +_static uint16_t m_current_rx_packet_length = 0; + +_static volatile bool m_pend_req_flag = 0; +_static volatile bool m_pend_rdy_flag = 0; +_static volatile bool m_pend_xfer_flag = 0; +_static volatile bool m_pend_rx_api_flag = 0; +_static volatile bool m_pend_tx_api_flag = 0; + +_static volatile bool m_slave_ready_flag = false; +_static volatile bool m_slave_request_flag = false; + + +_static ser_phy_events_handler_t m_callback_events_handler = NULL; +_static ser_phy_spi_master_state_t m_spi_master_state = SER_PHY_STATE_DISABLED; + +static void ser_phy_switch_state(ser_phy_event_source_t evt_src); + +static void spi_master_raw_assert(bool cond) +{ + APP_ERROR_CHECK_BOOL(cond); +} + +void SW_IRQ_Handler() +{ + if (m_pend_req_flag) + { + m_pend_req_flag = false; + DEBUG_EVT_SPI_MASTER_RAW_REQUEST(0); + ser_phy_switch_state(SER_PHY_EVT_GPIO_REQ); + } + + if (m_pend_rdy_flag) + { + m_pend_rdy_flag = false; + DEBUG_EVT_SPI_MASTER_RAW_READY(0); + ser_phy_switch_state(SER_PHY_EVT_GPIO_RDY); + } + + if (m_pend_xfer_flag) + { + m_pend_xfer_flag = false; + DEBUG_EVT_SPI_MASTER_RAW_XFER_DONE(0); + ser_phy_switch_state(SER_PHY_EVT_SPI_TRANSFER_DONE); + } + + if (m_pend_rx_api_flag) + { + m_pend_rx_api_flag = false; + DEBUG_EVT_SPI_MASTER_RAW_API_CALL(0); + ser_phy_switch_state(SER_PHY_EVT_RX_API_CALL); + } + + if (m_pend_tx_api_flag) + { + m_pend_tx_api_flag = false; + DEBUG_EVT_SPI_MASTER_RAW_API_CALL(0); + ser_phy_switch_state(SER_PHY_EVT_TX_API_CALL); + } + +} + +void ser_phy_spi_master_ready(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action) +{ + +#ifdef _SPI_5W_ + //For 5W slave is considered to be always READY + m_slave_ready_flag = true; + m_pend_rdy_flag = false; + #else + if (nrf_gpio_pin_read(SER_PHY_SPI_MASTER_PIN_SLAVE_READY) == 0) + { + m_slave_ready_flag = true; + m_pend_rdy_flag = true; + } + else + { + m_slave_ready_flag = false; + } + + DEBUG_EVT_SPI_MASTER_RAW_READY_EDGE((uint32_t) !m_slave_ready_flag); +#endif + +} + +void ser_phy_spi_master_request(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action) +{ + if (nrf_gpio_pin_read(SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST) == 0) + { + m_slave_request_flag = true; + m_pend_req_flag = true; + } + else + { + m_slave_request_flag = false; + } + + DEBUG_EVT_SPI_MASTER_RAW_REQUEST_EDGE((uint32_t) !m_slave_request_flag); + SET_Pend_SW_IRQ(); +} + +/* Send event SER_PHY_EVT_TX_PKT_SENT */ +static __INLINE void callback_packet_sent() +{ + ser_phy_evt_t event; + + event.evt_type = SER_PHY_EVT_TX_PKT_SENT; + m_callback_events_handler(event); +} + +/* Send event SER_PHY_EVT_RX_PKT_DROPPED */ +static __INLINE void callback_packet_dropped() +{ + ser_phy_evt_t event; + + event.evt_type = SER_PHY_EVT_RX_PKT_DROPPED; + m_callback_events_handler(event); +} + +/* Send event SER_PHY_EVT_RX_PKT_RECEIVED */ +static __INLINE void callback_packet_received() +{ + ser_phy_evt_t event; + + event.evt_type = SER_PHY_EVT_RX_PKT_RECEIVED; + event.evt_params.rx_pkt_received.p_buffer = mp_rx_buffer; + event.evt_params.rx_pkt_received.num_of_bytes = m_rx_buf_len; + m_callback_events_handler(event); +} + +/* Send event SER_PHY_EVT_RX_BUF_REQUEST */ +static __INLINE void callback_mem_request() +{ + ser_phy_evt_t event; + + event.evt_type = SER_PHY_EVT_RX_BUF_REQUEST; + event.evt_params.rx_buf_request.num_of_bytes = m_rx_buf_len; + m_callback_events_handler(event); +} + +static __INLINE void copy_buff(uint8_t * const p_dest, uint8_t const * const p_src, uint16_t len) +{ + uint16_t index; + + for (index = 0; index < len; index++) + { + p_dest[index] = p_src[index]; + } + return; +} + +static __INLINE void buffer_release(uint8_t * * const pp_buffer, uint16_t * const p_buf_len) +{ + *pp_buffer = NULL; + *p_buf_len = 0; +} + +static uint16_t compute_current_packet_length(const uint16_t packet_length, + const uint16_t accumulated_packet_length) +{ + uint16_t current_packet_length = packet_length - accumulated_packet_length; + + if (current_packet_length > SER_PHY_SPI_5W_MTU_SIZE) + { + current_packet_length = SER_PHY_SPI_5W_MTU_SIZE; + } + + return current_packet_length; +} + +static __INLINE uint32_t header_send(const uint16_t length) +{ + uint16_t buf_len_size = uint16_encode(length, m_len_buffer); + + return spi_master_send_recv(SER_PHY_SPI_MASTER, m_len_buffer, buf_len_size, NULL, 0); +} + +static __INLINE uint32_t frame_send() +{ + uint32_t err_code; + + m_current_tx_packet_length = compute_current_packet_length(m_tx_packet_length, + m_accumulated_tx_packet_length); + err_code = + spi_master_send_recv(SER_PHY_SPI_MASTER, + &mp_tx_buffer[m_accumulated_tx_packet_length], + m_current_tx_packet_length, + NULL, + 0); + m_accumulated_tx_packet_length += m_current_tx_packet_length; + return err_code; +} + +static __INLINE uint32_t header_get() +{ + return spi_master_send_recv(SER_PHY_SPI_MASTER, NULL, 0, m_len_buffer, SER_PHY_HEADER_SIZE + 1); //add 0 byte guard when receiving +} + +static __INLINE uint32_t frame_get() +{ + uint32_t err_code; + + m_current_rx_packet_length = compute_current_packet_length(m_rx_packet_length, + m_accumulated_rx_packet_length); + + if (m_current_rx_packet_length < SER_PHY_SPI_5W_MTU_SIZE) + { + m_current_rx_packet_length++; //take into account guard byte when receiving + } + err_code = spi_master_send_recv(SER_PHY_SPI_MASTER, + NULL, + 0, + m_recv_buffer, + m_current_rx_packet_length); + return err_code; +} + +/** + * \brief Master driver main state machine + * Executed only in the context of PendSV_Handler() + * For UML graph, please refer to SDK documentation +*/ + +static void ser_phy_switch_state(ser_phy_event_source_t evt_src) +{ + uint32_t err_code = NRF_SUCCESS; + static bool m_waitForReadyFlag = false; //local scheduling flag to defer RDY events + + switch (m_spi_master_state) + { + + case SER_PHY_STATE_IDLE: + + if (evt_src == SER_PHY_EVT_GPIO_REQ) + { + m_waitForReadyFlag = false; + + if (m_slave_ready_flag) + { + m_spi_master_state = SER_PHY_STATE_TX_ZERO_HEADER; + err_code = header_send(0); + } + else + { + m_spi_master_state = SER_PHY_STATE_RX_WAIT_FOR_RDY; + } + } + else if (evt_src == SER_PHY_EVT_TX_API_CALL) + { + spi_master_raw_assert(mp_tx_buffer != NULL); //api event with tx_buffer == NULL has no sense + m_waitForReadyFlag = false; + + if (m_slave_ready_flag) + { + m_spi_master_state = SER_PHY_STATE_TX_HEADER; + err_code = header_send(m_tx_buf_len); + } + else + { + m_spi_master_state = SER_PHY_STATE_TX_WAIT_FOR_RDY; + } + } + break; + + case SER_PHY_STATE_TX_WAIT_FOR_RDY: + + if (evt_src == SER_PHY_EVT_GPIO_RDY) + { + m_spi_master_state = SER_PHY_STATE_TX_HEADER; + err_code = header_send(m_tx_buf_len); + } + break; + + case SER_PHY_STATE_RX_WAIT_FOR_RDY: + + if (evt_src == SER_PHY_EVT_GPIO_RDY) + { + m_spi_master_state = SER_PHY_STATE_TX_ZERO_HEADER; + err_code = header_send(0); + + } + break; + + case SER_PHY_STATE_TX_HEADER: + + if (evt_src == SER_PHY_EVT_SPI_TRANSFER_DONE) + { + m_tx_packet_length = m_tx_buf_len; + m_accumulated_tx_packet_length = 0; + + if (m_slave_ready_flag) + { + m_spi_master_state = SER_PHY_STATE_TX_PAYLOAD; + err_code = frame_send(); + + } + else + { + m_waitForReadyFlag = true; + } + } + else if ((evt_src == SER_PHY_EVT_GPIO_RDY) && m_waitForReadyFlag) + { + m_waitForReadyFlag = false; + m_spi_master_state = SER_PHY_STATE_TX_PAYLOAD; + err_code = frame_send(); + } + + break; + + case SER_PHY_STATE_TX_PAYLOAD: + + if (evt_src == SER_PHY_EVT_SPI_TRANSFER_DONE) + { + if (m_accumulated_tx_packet_length < m_tx_packet_length) + { + if (m_slave_ready_flag) + { + err_code = frame_send(); + } + else + { + m_waitForReadyFlag = true; + } + } + else + { + spi_master_raw_assert(m_accumulated_tx_packet_length == m_tx_packet_length); + //Release TX buffer + buffer_release(&mp_tx_buffer, &m_tx_buf_len); + callback_packet_sent(); + + if ( m_slave_request_flag) + { + if (m_slave_ready_flag) + { + m_spi_master_state = SER_PHY_STATE_TX_ZERO_HEADER; + err_code = header_send(0); + } + else + { + m_spi_master_state = SER_PHY_STATE_RX_WAIT_FOR_RDY; + } + } + else + { + m_spi_master_state = SER_PHY_STATE_IDLE; //m_Tx_buffer is NULL - have to wait for API event + } + } + } + else if ((evt_src == SER_PHY_EVT_GPIO_RDY) && m_waitForReadyFlag ) + { + m_waitForReadyFlag = false; + err_code = frame_send(); + } + + break; + + case SER_PHY_STATE_TX_ZERO_HEADER: + + if (evt_src == SER_PHY_EVT_SPI_TRANSFER_DONE) + { + if (m_slave_ready_flag) + { + m_spi_master_state = SER_PHY_STATE_RX_HEADER; + err_code = header_get(); + } + else + { + m_waitForReadyFlag = true; + } + } + else if ( (evt_src == SER_PHY_EVT_GPIO_RDY) && m_waitForReadyFlag) + { + m_waitForReadyFlag = false; + m_spi_master_state = SER_PHY_STATE_RX_HEADER; + err_code = header_get(); + } + break; + + case SER_PHY_STATE_RX_HEADER: + + if (evt_src == SER_PHY_EVT_SPI_TRANSFER_DONE) + { + m_spi_master_state = SER_PHY_STATE_MEMORY_REQUEST; + m_rx_buf_len = uint16_decode(&(m_len_buffer[1])); //skip guard when receiving + m_rx_packet_length = m_rx_buf_len; + callback_mem_request(); + } + break; + + case SER_PHY_STATE_MEMORY_REQUEST: + + if (evt_src == SER_PHY_EVT_RX_API_CALL) + { + m_accumulated_rx_packet_length = 0; + + if (m_slave_ready_flag) + { + m_spi_master_state = SER_PHY_STATE_RX_PAYLOAD; + err_code = frame_get(); + } + else + { + m_waitForReadyFlag = true; + } + } + else if ((evt_src == SER_PHY_EVT_GPIO_RDY) && m_waitForReadyFlag) + { + m_waitForReadyFlag = false; + m_spi_master_state = SER_PHY_STATE_RX_PAYLOAD; + err_code = frame_get(); + } + break; + + case SER_PHY_STATE_RX_PAYLOAD: + + if (evt_src == SER_PHY_EVT_SPI_TRANSFER_DONE) + { + if (mp_rx_buffer) + { + copy_buff(&(mp_rx_buffer[m_accumulated_rx_packet_length]), + &(m_recv_buffer[1]), + m_current_rx_packet_length - 1); //skip guard byte when receiving + } + m_accumulated_rx_packet_length += (m_current_rx_packet_length - 1); + + if (m_accumulated_rx_packet_length < m_rx_packet_length) + { + if (m_slave_ready_flag) + { + err_code = frame_get(); + } + else + { + m_waitForReadyFlag = true; + } + } + else + { + spi_master_raw_assert(m_accumulated_rx_packet_length == m_rx_packet_length); + + if (mp_rx_buffer == NULL) + { + callback_packet_dropped(); + } + else + { + callback_packet_received(); + } + //Release RX buffer + buffer_release(&mp_rx_buffer, &m_rx_buf_len); + + if ((mp_tx_buffer != NULL)) //mp_tx_buffer !=NULL, this means that API_EVT was scheduled + { + if (m_slave_ready_flag ) + { + err_code = header_send(m_tx_buf_len); + m_spi_master_state = SER_PHY_STATE_TX_HEADER; + } + else + { + m_spi_master_state = SER_PHY_STATE_TX_WAIT_FOR_RDY; + } + } + else if (m_slave_request_flag) + { + if (m_slave_ready_flag) + { + m_spi_master_state = SER_PHY_STATE_TX_ZERO_HEADER; + err_code = header_send(0); + } + else + { + m_spi_master_state = SER_PHY_STATE_RX_WAIT_FOR_RDY; + } + } + else + { + m_spi_master_state = SER_PHY_STATE_IDLE; + } + } + } + else if ( evt_src == SER_PHY_EVT_GPIO_RDY && m_waitForReadyFlag) + { + m_waitForReadyFlag = false; + err_code = frame_get(); + } + + + break; + + default: + break; + } + + + if (err_code != NRF_SUCCESS) + { + (void)err_code; + } +} + +/* SPI master event handler */ +static void ser_phy_spi_master_event_handler(spi_master_evt_t spi_master_evt) +{ + switch (spi_master_evt.type) + { + case SPI_MASTER_EVT_TRANSFER_COMPLETED: + + /* Switch state */ + m_pend_xfer_flag = true; + SET_Pend_SW_IRQ(); + + break; + + default: + break; + } +} + +/* Initialize GPIO */ +static __INLINE void ser_phy_init_gpio() +{ + nrf_gpio_cfg_input(SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST, NRF_GPIO_PIN_PULLUP); + nrf_gpio_cfg_input(SER_PHY_SPI_MASTER_PIN_SLAVE_READY, NRF_GPIO_PIN_PULLUP); +} + +/* Initialize GPIO */ +static __INLINE void ser_phy_init_pendSV() +{ + NVIC_SetPriority(SW_IRQn, APP_IRQ_PRIORITY_MID); + NVIC_EnableIRQ(SW_IRQn); +} + +/* Initialize GPIOTE */ +static __INLINE void ser_phy_init_gpiote() +{ + if (!nrf_drv_gpiote_is_init()) + { + (void)nrf_drv_gpiote_init(); + } + m_slave_request_flag = !(nrf_gpio_pin_read(SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST)); + + nrf_drv_gpiote_in_config_t config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(true); + (void)nrf_drv_gpiote_in_init(SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST, &config, ser_phy_spi_master_request); + nrf_drv_gpiote_in_event_enable(SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST,true); + m_slave_request_flag = !(nrf_gpio_pin_read(SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST)); + + +#ifdef _SPI_5W_ + m_slave_ready_flag = true; + +#else + m_slave_ready_flag = !(nrf_gpio_pin_read(SER_PHY_SPI_MASTER_PIN_SLAVE_READY)); + (void)nrf_drv_gpiote_in_init(SER_PHY_SPI_MASTER_PIN_SLAVE_READY, &config, ser_phy_spi_master_ready); + + nrf_drv_gpiote_in_event_enable(SER_PHY_SPI_MASTER_PIN_SLAVE_READY,true); +#endif + + NVIC_ClearPendingIRQ(SW_IRQn); +} + +static __INLINE void ser_phy_deinit_gpiote() +{ + nrf_drv_gpiote_in_uninit(SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST); +#ifndef _SPI_5W_ + nrf_drv_gpiote_in_uninit(SER_PHY_SPI_MASTER_PIN_SLAVE_READY); +#endif + + +} + +/* ser_phy API function */ +uint32_t ser_phy_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes) +{ + if (p_buffer == NULL) + { + return NRF_ERROR_NULL; + } + + if (num_of_bytes == 0) + { + return NRF_ERROR_INVALID_PARAM; + } + + if (mp_tx_buffer != NULL) + { + return NRF_ERROR_BUSY; + } + + ser_phy_interrupts_disable(); + mp_tx_buffer = (uint8_t *)p_buffer; + m_tx_buf_len = num_of_bytes; + m_pend_tx_api_flag = true; + SET_Pend_SW_IRQ(); + ser_phy_interrupts_enable(); + return NRF_SUCCESS; +} + +/* ser_phy API function */ +uint32_t ser_phy_rx_buf_set(uint8_t * p_buffer) +{ + if (m_spi_master_state != SER_PHY_STATE_MEMORY_REQUEST) + { + return NRF_ERROR_INVALID_STATE; + } + ser_phy_interrupts_disable(); + mp_rx_buffer = p_buffer; + m_pend_rx_api_flag = true; + SET_Pend_SW_IRQ(); + ser_phy_interrupts_enable(); + return NRF_SUCCESS; +} + +/* ser_phy API function */ +uint32_t ser_phy_open(ser_phy_events_handler_t events_handler) +{ + + if (m_spi_master_state != SER_PHY_STATE_DISABLED) + { + return NRF_ERROR_INVALID_STATE; + } + + if (events_handler == NULL) + { + return NRF_ERROR_NULL; + } + + uint32_t err_code = NRF_SUCCESS; + ser_phy_init_gpio(); + m_spi_master_state = SER_PHY_STATE_IDLE; + m_callback_events_handler = events_handler; + ser_phy_init_gpiote(); + + /* Configure SPI Master driver */ + spi_master_config_t spi_master_config; + spi_master_config.SPI_Freq = SPI_FREQUENCY_FREQUENCY_M1; + spi_master_config.SPI_Pin_SCK = SER_PHY_SPI_MASTER_PIN_SCK; + spi_master_config.SPI_Pin_MISO = SER_PHY_SPI_MASTER_PIN_MISO; + spi_master_config.SPI_Pin_MOSI = SER_PHY_SPI_MASTER_PIN_MOSI; + spi_master_config.SPI_Pin_SS = SER_PHY_SPI_MASTER_PIN_SLAVE_SELECT; + spi_master_config.SPI_ORDER = SPI_CONFIG_ORDER_LsbFirst; + spi_master_config.SPI_CPOL = SPI_CONFIG_CPOL_ActiveHigh; + spi_master_config.SPI_CPHA = SPI_CONFIG_CPHA_Leading; + + err_code = spi_master_open(SER_PHY_SPI_MASTER, &spi_master_config); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } +#ifdef _SPI_5W_ + spi_5W_master_evt_handler_reg(SER_PHY_SPI_MASTER, ser_phy_spi_master_event_handler); +#else + spi_master_evt_handler_reg(SER_PHY_SPI_MASTER, ser_phy_spi_master_event_handler); +#endif + ser_phy_init_pendSV(); + + return err_code; +} + +/* ser_phy API function */ +void ser_phy_close(void) +{ + m_spi_master_state = SER_PHY_STATE_DISABLED; + + m_callback_events_handler = NULL; + + buffer_release(&mp_tx_buffer, &m_tx_buf_len); + buffer_release(&mp_rx_buffer, &m_rx_buf_len); + m_tx_packet_length = 0; + m_accumulated_tx_packet_length = 0; + m_current_tx_packet_length = 0; + m_rx_packet_length = 0; + m_accumulated_rx_packet_length = 0; + m_current_rx_packet_length = 0; + ser_phy_deinit_gpiote(); + spi_master_close(SER_PHY_SPI_MASTER); +} + +/* ser_phy API function */ +void ser_phy_interrupts_enable(void) +{ + NVIC_EnableIRQ(SW_IRQn); +} + +/* ser_phy API function */ +void ser_phy_interrupts_disable(void) +{ + NVIC_DisableIRQ(SW_IRQn); +} + + +#ifdef SER_PHY_DEBUG_APP_ENABLE + +static spi_master_raw_callback_t m_spi_master_raw_evt_callback; + +void debug_evt(spi_master_raw_evt_type_t evt, uint32_t data) +{ + if (m_spi_master_raw_evt_callback) + { + spi_master_raw_evt_t e; + e.evt = evt; + e.data = data; + m_spi_master_raw_evt_callback(e); + } +} + +void debug_init(spi_master_raw_callback_t spi_master_raw_evt_callback) +{ + m_spi_master_raw_evt_callback = spi_master_raw_evt_callback; +} + +#endif +/** @} */ diff --git a/components/serialization/common/transport/ser_phy/ser_phy_nrf51_spi_5W_slave.c b/components/serialization/common/transport/ser_phy/ser_phy_nrf51_spi_5W_slave.c new file mode 100644 index 0000000..5bfdd33 --- /dev/null +++ b/components/serialization/common/transport/ser_phy/ser_phy_nrf51_spi_5W_slave.c @@ -0,0 +1,618 @@ +/* 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. + * + */ + +/**@file + * + * @defgroup ser_phy_spi_5W_phy_driver_slave ser_phy_nrf51_spi_5W_slave.c + * @{ + * @ingroup ser_phy_spi_5W_phy_driver_slave + * + * @brief SPI_5W_RAW PHY slave driver. + */ + + +#include +#include + + +#include "boards.h" +#include "nrf_drv_spis.h" +#include "ser_phy.h" +#include "ser_config.h" +#include "nrf_gpio.h" +#include "nrf_delay.h" +#include "nrf_gpiote.h" +#include "nrf_soc.h" +#include "app_error.h" +#include "app_util.h" +#include "ser_phy_config_conn_nrf51.h" +#include "ser_phy_debug_conn.h" +#include "app_error.h" + +#define _static static + +#define SER_PHY_SPI_5W_MTU_SIZE SER_PHY_SPI_MTU_SIZE + +#define SER_PHY_SPI_DEF_CHARACTER 0xFF //SPI default character. Character clocked out in case of an ignored transaction +#define SER_PHY_SPI_ORC_CHARACTER 0xFF //SPI over-read character. Character clocked out after an over-read of the transmit buffer + +static nrf_drv_spis_t m_spis = NRF_DRV_SPIS_INSTANCE(SER_PHY_SPI_SLAVE_INSTANCE); + +#define _SPI_5W_ + +//SPI raw peripheral device configuration data +typedef struct +{ + int32_t pin_req; //SPI /REQ pin. -1 for not using + int32_t pin_rdy; //SPI /RDY pin. -1 for not using + int32_t ppi_rdy_ch; //SPI /RDY ppi ready channel + int32_t gpiote_rdy_ch; //SPI /RDY pin ready channel +} spi_slave_raw_trasp_cfg_t; + +/**@brief States of the SPI transaction state machine. */ +typedef enum +{ + SPI_RAW_STATE_UNKNOWN, + SPI_RAW_STATE_SETUP_HEADER, + SPI_RAW_STATE_RX_HEADER, + SPI_RAW_STATE_MEM_REQUESTED, + SPI_RAW_STATE_RX_PAYLOAD, + SPI_RAW_STATE_TX_HEADER, + SPI_RAW_STATE_TX_PAYLOAD, +} trans_state_t; + +_static spi_slave_raw_trasp_cfg_t m_spi_slave_raw_config; + +_static uint16_t m_accumulated_rx_packet_length; +_static uint16_t m_rx_packet_length; +_static uint16_t m_current_rx_frame_length; + +_static uint16_t m_accumulated_tx_packet_length; +_static uint16_t m_tx_packet_length; +_static uint16_t m_current_tx_frame_length; + +_static uint8_t m_header_rx_buffer[SER_PHY_HEADER_SIZE + 1]; //+1 for '0' guard in SPI_5W +_static uint8_t m_header_tx_buffer[SER_PHY_HEADER_SIZE + 1]; //+1 for '0' guard in SPI_5W + +_static uint8_t m_tx_frame_buffer[SER_PHY_SPI_5W_MTU_SIZE]; +_static uint8_t m_rx_frame_buffer[SER_PHY_SPI_5W_MTU_SIZE]; +_static uint8_t m_zero_buff[SER_PHY_SPI_5W_MTU_SIZE] = { 0 }; //ROM'able declaration - all guard bytes + +_static uint8_t * volatile m_p_rx_buffer = NULL; +_static const uint8_t * volatile m_p_tx_buffer = NULL; + +_static bool m_trash_payload_flag; +_static bool m_buffer_reqested_flag; + +_static trans_state_t m_trans_state = SPI_RAW_STATE_UNKNOWN; +_static ser_phy_events_handler_t m_ser_phy_callback = NULL; + +static void spi_slave_raw_assert(bool cond) +{ + APP_ERROR_CHECK_BOOL(cond); +} + +static void callback_ser_phy_event(ser_phy_evt_t event) +{ + if (m_ser_phy_callback) + { + m_ser_phy_callback(event); + } + return; +} + +static void callback_memory_request(uint16_t size) +{ + ser_phy_evt_t event; + + event.evt_type = SER_PHY_EVT_RX_BUF_REQUEST; + event.evt_params.rx_buf_request.num_of_bytes = size; + callback_ser_phy_event(event); + return; + +} + +static void callback_packet_received(uint8_t * pBuffer, uint16_t size) +{ + ser_phy_evt_t event; + + event.evt_type = SER_PHY_EVT_RX_PKT_RECEIVED; + event.evt_params.rx_pkt_received.num_of_bytes = size; + event.evt_params.rx_pkt_received.p_buffer = pBuffer; + callback_ser_phy_event(event); + return; +} + +static void callback_packet_dropped() +{ + ser_phy_evt_t event; + + event.evt_type = SER_PHY_EVT_RX_PKT_DROPPED; + callback_ser_phy_event(event); + return; +} + +static void callback_packet_transmitted(void) +{ + ser_phy_evt_t event; + + event.evt_type = SER_PHY_EVT_TX_PKT_SENT; + callback_ser_phy_event(event); + return; +} + +static void copy_buff(uint8_t * const p_dest, uint8_t const * const p_src, uint16_t len) +{ + uint16_t index; + + for (index = 0; index < len; index++) + { + p_dest[index] = p_src[index]; + } + return; +} + +/* Function computes current packet length */ +static uint16_t compute_current_frame_length(const uint16_t packet_length, + const uint16_t accumulated_packet_length) +{ + uint16_t current_packet_length = packet_length - accumulated_packet_length; + + if (current_packet_length > SER_PHY_SPI_5W_MTU_SIZE) + { + current_packet_length = SER_PHY_SPI_5W_MTU_SIZE; + } + + return current_packet_length; +} + +static uint32_t header_get() +{ + uint32_t err_code; + + err_code = nrf_drv_spis_buffers_set(&m_spis, + (uint8_t *) m_zero_buff, + SER_PHY_HEADER_SIZE, + m_header_rx_buffer, + SER_PHY_HEADER_SIZE); + return err_code; +} + +static uint32_t frame_get() +{ + uint32_t err_code; + + m_current_rx_frame_length = compute_current_frame_length(m_rx_packet_length, + m_accumulated_rx_packet_length); + + if (!m_trash_payload_flag) + { + err_code = + nrf_drv_spis_buffers_set(&m_spis, + (uint8_t *) m_zero_buff, + m_current_rx_frame_length, + &(m_p_rx_buffer[m_accumulated_rx_packet_length]), + m_current_rx_frame_length); + } + else + { + err_code = nrf_drv_spis_buffers_set(&m_spis, + (uint8_t *) m_zero_buff, + m_current_rx_frame_length, + m_rx_frame_buffer, + m_current_rx_frame_length); + } + return err_code; +} + +static uint32_t header_send(uint16_t len) +{ + uint32_t err_code; + + m_header_tx_buffer[0] = (uint8_t) 0; //this is guard byte + (void)uint16_encode(len, &(m_header_tx_buffer[1])); + err_code = nrf_drv_spis_buffers_set(&m_spis, + m_header_tx_buffer, + SER_PHY_HEADER_SIZE + 1, + m_header_rx_buffer, + SER_PHY_HEADER_SIZE + 1); + return err_code; +} + +static uint32_t frame_send() +{ + uint32_t err_code; + + m_current_tx_frame_length = compute_current_frame_length(m_tx_packet_length, + m_accumulated_tx_packet_length); + + if (m_current_tx_frame_length == SER_PHY_SPI_5W_MTU_SIZE) + { + m_current_tx_frame_length -= 1; //extra space for guard byte must be taken into account for MTU + } + m_tx_frame_buffer[0] = 0; //guard byte + copy_buff(&(m_tx_frame_buffer[1]), + &(m_p_tx_buffer[m_accumulated_tx_packet_length]), + m_current_tx_frame_length); + err_code = nrf_drv_spis_buffers_set(&m_spis, + m_tx_frame_buffer, + m_current_tx_frame_length + 1, + m_rx_frame_buffer, + m_current_tx_frame_length + 1); + + return err_code; +} + +static void set_ready_line(void) +{ +#ifndef _SPI_5W_ + //toggle - this should go high - but toggle is unsafe + uint32_t rdy_task = nrf_drv_gpiote_out_task_addr_get(m_spi_slave_raw_config.gpiote_rdy_ch); + *(uint32_t *)rdy_task = 1; +#endif + return; +} + +static void set_request_line(void) +{ + //active low logic - set is 0 + nrf_gpio_pin_clear(m_spi_slave_raw_config.pin_req); + DEBUG_EVT_SPI_SLAVE_RAW_REQ_SET(0); + return; +} + +static void clear_request_line(void) +{ + //active low logic - clear is 1 + nrf_gpio_pin_set(m_spi_slave_raw_config.pin_req); + DEBUG_EVT_SPI_SLAVE_RAW_REQ_CLEARED(0); + return; +} + +/** + * \brief Slave driver main state machine + * For UML graph, please refer to SDK documentation +*/ +static void spi_slave_event_handle(nrf_drv_spis_event_t event) +{ + static uint32_t err_code = NRF_SUCCESS; + static uint16_t packetLength; + + switch (m_trans_state) + { + case SPI_RAW_STATE_SETUP_HEADER: + m_trans_state = SPI_RAW_STATE_RX_HEADER; + err_code = header_get(); + break; + + case SPI_RAW_STATE_RX_HEADER: + + if (event.evt_type == NRF_DRV_SPIS_BUFFERS_SET_DONE) + { + DEBUG_EVT_SPI_SLAVE_RAW_BUFFERS_SET(0); + set_ready_line(); + } + + if (event.evt_type == NRF_DRV_SPIS_XFER_DONE) + { + DEBUG_EVT_SPI_SLAVE_RAW_RX_XFER_DONE(event.rx_amount); + spi_slave_raw_assert(event.rx_amount == SER_PHY_HEADER_SIZE); + packetLength = uint16_decode(m_header_rx_buffer); + + if (packetLength != 0 ) + { + m_trans_state = SPI_RAW_STATE_MEM_REQUESTED; + m_buffer_reqested_flag = true; + m_rx_packet_length = packetLength; + callback_memory_request(packetLength); + } + else + { + if (m_p_tx_buffer) + { + clear_request_line(); + m_trans_state = SPI_RAW_STATE_TX_HEADER; + err_code = header_send(m_tx_packet_length); + } + else + { + //there is nothing to send - zero response facilitates pooling - but perhaps, it should be assert + err_code = header_send(0); + } + } + } + + break; + + case SPI_RAW_STATE_MEM_REQUESTED: + + if (event.evt_type == NRF_DRV_SPIS_EVT_TYPE_MAX) //This is API dummy event + { + m_buffer_reqested_flag = false; + m_trans_state = SPI_RAW_STATE_RX_PAYLOAD; + m_accumulated_rx_packet_length = 0; + err_code = frame_get(); + } + break; + + + case SPI_RAW_STATE_RX_PAYLOAD: + + if (event.evt_type == NRF_DRV_SPIS_BUFFERS_SET_DONE) + { + DEBUG_EVT_SPI_SLAVE_RAW_BUFFERS_SET(0); + set_ready_line(); + } + + if (event.evt_type == NRF_DRV_SPIS_XFER_DONE) + { + DEBUG_EVT_SPI_SLAVE_RAW_RX_XFER_DONE(event.rx_amount); + spi_slave_raw_assert(event.rx_amount == m_current_rx_frame_length); + m_accumulated_rx_packet_length += m_current_rx_frame_length; + + if (m_accumulated_rx_packet_length < m_rx_packet_length ) + { + err_code = frame_get(); + } + else + { + spi_slave_raw_assert(m_accumulated_rx_packet_length == m_rx_packet_length); + m_trans_state = SPI_RAW_STATE_RX_HEADER; + err_code = header_get(); + + if (!m_trash_payload_flag) + { + callback_packet_received(m_p_rx_buffer, m_accumulated_rx_packet_length); + } + else + { + callback_packet_dropped(); + } + } + } + break; + + case SPI_RAW_STATE_TX_HEADER: + + if (event.evt_type == NRF_DRV_SPIS_BUFFERS_SET_DONE) + { + DEBUG_EVT_SPI_SLAVE_RAW_BUFFERS_SET(0); + set_ready_line(); + } + + if (event.evt_type == NRF_DRV_SPIS_XFER_DONE) + { + DEBUG_EVT_SPI_SLAVE_RAW_TX_XFER_DONE(event.tx_amount); + spi_slave_raw_assert(event.tx_amount == SER_PHY_HEADER_SIZE + 1); + m_trans_state = SPI_RAW_STATE_TX_PAYLOAD; + m_accumulated_tx_packet_length = 0; + err_code = frame_send(); + } + + break; + + case SPI_RAW_STATE_TX_PAYLOAD: + + if (event.evt_type == NRF_DRV_SPIS_BUFFERS_SET_DONE) + { + DEBUG_EVT_SPI_SLAVE_RAW_BUFFERS_SET(0); + set_ready_line(); + } + + if (event.evt_type == NRF_DRV_SPIS_XFER_DONE) + { + DEBUG_EVT_SPI_SLAVE_RAW_TX_XFER_DONE(event.tx_amount); + spi_slave_raw_assert(event.tx_amount == m_current_tx_frame_length + 1); + m_accumulated_tx_packet_length += m_current_tx_frame_length; + + if ( m_accumulated_tx_packet_length < m_tx_packet_length ) + { + err_code = frame_send(); + } + else + { + spi_slave_raw_assert(m_accumulated_tx_packet_length == m_tx_packet_length); + //clear pointer before callback + m_p_tx_buffer = NULL; + callback_packet_transmitted(); + //spi slave TX transfer is possible only when RX is ready, so return to waiting for a header + m_trans_state = SPI_RAW_STATE_RX_HEADER; + err_code = header_get(); + } + } + break; + + default: + err_code = NRF_ERROR_INVALID_STATE; + break; + } + APP_ERROR_CHECK(err_code); +} + +#ifndef _SPI_5W_ +static void spi_slave_gpiote_init(void) +{ + if (!nrf_drv_gpiote_is_init()) + { + (void)nrf_drv_gpiote_init(); + } + nrf_drv_gpiote_out_config_t config = GPIOTE_CONFIG_OUT_TASK_TOGGLE(true); + (void)nrf_drv_gpiote_out_init(m_spi_slave_raw_config.gpiote_rdy_ch, &config); + return; +} + +static void spi_slave_ppi_init(void) +{ + uint32_t rdy_task = nrf_drv_gpiote_out_task_addr_get(m_spi_slave_raw_config.gpiote_rdy_ch); + //Configure PPI channel to clear /RDY line + NRF_PPI->CH[m_spi_slave_raw_config.ppi_rdy_ch].EEP = (uint32_t)(&NRF_SPIS1->EVENTS_END); + NRF_PPI->CH[m_spi_slave_raw_config.ppi_rdy_ch].TEP = rdy_task; + + //this works only for channels 0..15 - but soft device is using 8-15 anyway + NRF_PPI->CHEN |= (1 << m_spi_slave_raw_config.ppi_rdy_ch); + return; +} +#endif + +static void spi_slave_gpio_init(void) +{ + nrf_gpio_cfg_output(m_spi_slave_raw_config.pin_req); + nrf_gpio_pin_set(m_spi_slave_raw_config.pin_req); +#ifndef _SPI_5W_ + nrf_gpio_cfg_output(m_spi_slave_raw_config.pin_rdy); + nrf_gpio_pin_set(m_spi_slave_raw_config.pin_rdy); +#endif + return; +} + +/* ser_phy API function */ +void ser_phy_interrupts_enable(void) +{ + NVIC_EnableIRQ(m_spis.irq); +} + +/* ser_phy API function */ +void ser_phy_interrupts_disable(void) +{ + NVIC_DisableIRQ(m_spis.irq); +} + +/* ser_phy API function */ +uint32_t ser_phy_rx_buf_set(uint8_t * p_buffer) +{ + uint32_t status = NRF_SUCCESS; + nrf_drv_spis_event_t event; + + ser_phy_interrupts_disable(); + + if (m_buffer_reqested_flag && (m_trans_state == SPI_RAW_STATE_MEM_REQUESTED)) + { + m_p_rx_buffer = p_buffer; + + if (m_p_rx_buffer) + { + m_trash_payload_flag = false; + } + else + { + m_trash_payload_flag = true; + } + + event.evt_type = NRF_DRV_SPIS_EVT_TYPE_MAX; //force transition with dummy event + event.rx_amount = 0; + event.tx_amount = 0; + spi_slave_event_handle(event); + } + else + { + status = NRF_ERROR_BUSY; + } + ser_phy_interrupts_enable(); + + return status; +} + +/* ser_phy API function */ +uint32_t ser_phy_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes) +{ + uint32_t status = NRF_SUCCESS; + + if ( p_buffer == NULL || num_of_bytes == 0) + { + return NRF_ERROR_NULL; + } + + ser_phy_interrupts_disable(); + + if ( m_p_tx_buffer == NULL) + { + m_tx_packet_length = num_of_bytes; + m_p_tx_buffer = p_buffer; + set_request_line(); + } + else + { + status = NRF_ERROR_BUSY; + } + ser_phy_interrupts_enable(); + + return status; +} + +/* ser_phy API function */ +uint32_t ser_phy_open(ser_phy_events_handler_t events_handler) +{ + uint32_t err_code; + nrf_drv_spis_config_t spi_slave_config; + nrf_drv_spis_event_t event; + + if (m_trans_state != SPI_RAW_STATE_UNKNOWN) + { + return NRF_ERROR_INVALID_STATE; + } + + if (events_handler == NULL) + { + return NRF_ERROR_NULL; + } + + //one ppi channel and one gpiote channel are used to drive RDY line + m_spi_slave_raw_config.pin_req = SER_PHY_SPI_SLAVE_REQ_PIN; + m_spi_slave_raw_config.pin_rdy = SER_PHY_SPI_SLAVE_RDY_PIN; + m_spi_slave_raw_config.ppi_rdy_ch = SER_PHY_SPI_PPI_RDY_CH; + m_spi_slave_raw_config.gpiote_rdy_ch = SER_PHY_SPI_GPIOTE_RDY_CH; + + spi_slave_gpio_init(); +#ifndef _SPI_5W_ + spi_slave_gpiote_init(); + spi_slave_ppi_init(); +#endif + + spi_slave_config.miso_pin = SPIS_MISO_PIN; + spi_slave_config.mosi_pin = SPIS_MOSI_PIN; + spi_slave_config.sck_pin = SPIS_SCK_PIN; + spi_slave_config.csn_pin = SPIS_CSN_PIN; + spi_slave_config.mode = NRF_DRV_SPIS_MODE_0; + spi_slave_config.bit_order = NRF_DRV_SPIS_BIT_ORDER_LSB_FIRST; + spi_slave_config.def = SER_PHY_SPI_DEF_CHARACTER; + spi_slave_config.orc = SER_PHY_SPI_ORC_CHARACTER; + spi_slave_config.csn_pullup = NRF_GPIO_PIN_PULLUP; + spi_slave_config.irq_priority = NRF_APP_PRIORITY_LOW; + + //keep /CS high when init + nrf_gpio_cfg_input(spi_slave_config.csn_pin, NRF_GPIO_PIN_PULLUP); + + err_code = nrf_drv_spis_init(&m_spis, &spi_slave_config, spi_slave_event_handle); + APP_ERROR_CHECK(err_code); + + if (err_code == NRF_SUCCESS) + { + m_ser_phy_callback = events_handler; + + m_trans_state = SPI_RAW_STATE_SETUP_HEADER; + event.evt_type = NRF_DRV_SPIS_EVT_TYPE_MAX; //force transition for dummy event + event.rx_amount = 0; + event.tx_amount = 0; + spi_slave_event_handle(event); + + } + + return err_code; +} + +/* ser_phy API function */ +void ser_phy_close(void) +{ + nrf_drv_spis_uninit(&m_spis); + m_ser_phy_callback = NULL; + m_trans_state = SPI_RAW_STATE_UNKNOWN; +} diff --git a/components/serialization/common/transport/ser_phy/ser_phy_nrf51_spi_slave.c b/components/serialization/common/transport/ser_phy/ser_phy_nrf51_spi_slave.c new file mode 100644 index 0000000..e9fdfdd --- /dev/null +++ b/components/serialization/common/transport/ser_phy/ser_phy_nrf51_spi_slave.c @@ -0,0 +1,580 @@ +/* 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. + * + */ + +/**@file + * + * @defgroup ser_phy_spi_phy_driver_slave ser_phy_nrf51_spi_slave.c + * @{ + * @ingroup ser_phy_spi_phy_driver_slave + * + * @brief SPI_RAW PHY slave driver. + */ + +#include +#include + +#include "app_error.h" +#include "app_util.h" +#include "boards.h" +#include "nrf_gpio.h" +#include "nrf_drv_gpiote.h" +#include "nrf_soc.h" +#include "nrf_drv_spis.h" +#include "ser_config.h" +#include "ser_phy.h" +#include "ser_phy_config_conn_nrf51.h" +#include "ser_phy_debug_conn.h" + +#define SER_PHY_SPI_DEF_CHARACTER 0xFF //SPI default character. Character clocked out in case of an ignored transaction +#define SER_PHY_SPI_ORC_CHARACTER 0xFF //SPI over-read character. Character clocked out after an over-read of the transmit buffer + +static nrf_drv_spis_t m_spis = NRF_DRV_SPIS_INSTANCE(SER_PHY_SPI_SLAVE_INSTANCE); + +//SPI raw peripheral device configuration data +typedef struct +{ + int32_t pin_req; //SPI /REQ pin. -1 for not using + int32_t pin_rdy; //SPI /RDY pin. -1 for not using + int32_t ppi_rdy_ch; //SPI /RDY ppi ready channel + int32_t gpiote_rdy_ch; //SPI /RDY pin ready channel +} spi_slave_raw_trasp_cfg_t; + +/**@brief States of the SPI transaction state machine. */ +typedef enum +{ + SPI_RAW_STATE_UNKNOWN, + SPI_RAW_STATE_SETUP_HEADER, + SPI_RAW_STATE_RX_HEADER, + SPI_RAW_STATE_MEM_REQUESTED, + SPI_RAW_STATE_RX_PAYLOAD, + SPI_RAW_STATE_TX_HEADER, + SPI_RAW_STATE_TX_PAYLOAD, +} trans_state_t; + +#define _static static + +static spi_slave_raw_trasp_cfg_t m_spi_slave_raw_config; + +_static uint16_t m_accumulated_rx_packet_length; +_static uint16_t m_rx_packet_length; +_static uint16_t m_current_rx_frame_length; + +_static uint16_t m_accumulated_tx_packet_length; +_static uint16_t m_tx_packet_length; +_static uint16_t m_current_tx_frame_length; + +_static uint8_t m_header_rx_buffer[SER_PHY_HEADER_SIZE]; +_static uint8_t m_header_tx_buffer[SER_PHY_HEADER_SIZE]; + +_static uint8_t m_frame_buffer[SER_PHY_SPI_MTU_SIZE]; //trash storage +_static uint8_t m_zero_buffer[SER_PHY_SPI_MTU_SIZE] = { 0 }; //ROM'able declaration + +_static uint8_t * volatile m_p_rx_buffer = NULL; +_static const uint8_t * volatile m_p_tx_buffer = NULL; + +_static bool m_trash_payload_flag; +_static bool m_buffer_reqested_flag; + +_static trans_state_t m_trans_state = SPI_RAW_STATE_UNKNOWN; +_static ser_phy_events_handler_t m_ser_phy_callback = NULL; + +static void spi_slave_raw_assert(bool cond) +{ + APP_ERROR_CHECK_BOOL(cond); +} + +static void callback_ser_phy_event(ser_phy_evt_t event) +{ + if (m_ser_phy_callback) + { + m_ser_phy_callback(event); + } +} + +static void callback_memory_request(uint16_t size) +{ + ser_phy_evt_t event; + + DEBUG_EVT_SPI_SLAVE_PHY_BUF_REQUEST(0); + + event.evt_type = SER_PHY_EVT_RX_BUF_REQUEST; + event.evt_params.rx_buf_request.num_of_bytes = size; + callback_ser_phy_event(event); +} + +static void callback_packet_received(uint8_t * pBuffer, uint16_t size) +{ + ser_phy_evt_t event; + + DEBUG_EVT_SPI_SLAVE_PHY_PKT_RECEIVED(0); + + event.evt_type = SER_PHY_EVT_RX_PKT_RECEIVED; + event.evt_params.rx_pkt_received.num_of_bytes = size; + event.evt_params.rx_pkt_received.p_buffer = pBuffer; + callback_ser_phy_event(event); +} + +static void callback_packet_dropped() +{ + ser_phy_evt_t event; + + DEBUG_EVT_SPI_SLAVE_PHY_PKT_DROPPED(0); + + event.evt_type = SER_PHY_EVT_RX_PKT_DROPPED; + callback_ser_phy_event(event); +} + +static void callback_packet_transmitted(void) +{ + ser_phy_evt_t event; + + DEBUG_EVT_SPI_SLAVE_PHY_PKT_SENT(0); + + event.evt_type = SER_PHY_EVT_TX_PKT_SENT; + callback_ser_phy_event(event); +} + +/* Function computes current packet length */ +static uint16_t compute_current_frame_length(const uint16_t packet_length, + const uint16_t accumulated_packet_length) +{ + uint16_t current_packet_length = packet_length - accumulated_packet_length; + + if (current_packet_length > SER_PHY_SPI_MTU_SIZE) + { + current_packet_length = SER_PHY_SPI_MTU_SIZE; + } + + return current_packet_length; +} + +static uint32_t header_get() +{ + uint32_t err_code; + + err_code = nrf_drv_spis_buffers_set(&m_spis, + (uint8_t *) m_zero_buffer, + SER_PHY_HEADER_SIZE, + m_header_rx_buffer, + SER_PHY_HEADER_SIZE); + return err_code; +} + +static uint32_t frame_get() +{ + uint32_t err_code; + + m_current_rx_frame_length = compute_current_frame_length(m_rx_packet_length, + m_accumulated_rx_packet_length); + + if (!m_trash_payload_flag) + { + err_code = + nrf_drv_spis_buffers_set(&m_spis, + (uint8_t *) m_zero_buffer, + m_current_rx_frame_length, + &(m_p_rx_buffer[m_accumulated_rx_packet_length]), + m_current_rx_frame_length); + } + else + { + err_code = nrf_drv_spis_buffers_set(&m_spis, + (uint8_t *) m_zero_buffer, + m_current_rx_frame_length, + m_frame_buffer, + m_current_rx_frame_length); + } + return err_code; +} + +static uint32_t header_send(uint16_t len) +{ + uint32_t err_code; + + (void) uint16_encode(len, m_header_tx_buffer); + err_code = + nrf_drv_spis_buffers_set(&m_spis, + m_header_tx_buffer, + sizeof (m_header_tx_buffer), + m_header_rx_buffer, + sizeof (m_header_tx_buffer)); + return err_code; +} + +static uint32_t frame_send() +{ + uint32_t err_code; + + m_current_tx_frame_length = compute_current_frame_length(m_tx_packet_length, + m_accumulated_tx_packet_length); + err_code = + nrf_drv_spis_buffers_set(&m_spis, + (uint8_t *) &(m_p_tx_buffer[m_accumulated_tx_packet_length]), + m_current_tx_frame_length, + m_frame_buffer, + m_current_tx_frame_length); + return err_code; +} + +static void set_ready_line(void) +{ + //toggle - this should go high - but toggle is unsafe + uint32_t rdy_task = nrf_drv_gpiote_out_task_addr_get(m_spi_slave_raw_config.pin_rdy); + *(uint32_t *)rdy_task = 1; + return; +} + +static void set_request_line(void) +{ + //active low logic - set is 0 + nrf_gpio_pin_clear(m_spi_slave_raw_config.pin_req); + DEBUG_EVT_SPI_SLAVE_RAW_REQ_SET(0); +} + +static void clear_request_line(void) +{ + //active low logic - clear is 1 + nrf_gpio_pin_set(m_spi_slave_raw_config.pin_req); + DEBUG_EVT_SPI_SLAVE_RAW_REQ_SET(0); +} + +/** + * \brief Slave driver main state machine + * For UML graph, please refer to SDK documentation +*/ +static void spi_slave_event_handle(nrf_drv_spis_event_t event) +{ + uint32_t err_code = NRF_SUCCESS; + static uint16_t packetLength; + + switch (m_trans_state) + { + case SPI_RAW_STATE_SETUP_HEADER: + m_trans_state = SPI_RAW_STATE_RX_HEADER; + err_code = header_get(); + break; + + case SPI_RAW_STATE_RX_HEADER: + + if (event.evt_type == NRF_DRV_SPIS_BUFFERS_SET_DONE) + { + DEBUG_EVT_SPI_SLAVE_RAW_BUFFERS_SET(0); + set_ready_line(); + } + + if (event.evt_type == NRF_DRV_SPIS_XFER_DONE) + { + DEBUG_EVT_SPI_SLAVE_RAW_RX_XFER_DONE(event.rx_amount); + spi_slave_raw_assert(event.rx_amount == SER_PHY_HEADER_SIZE); + packetLength = uint16_decode(m_header_rx_buffer); + + if (packetLength != 0 ) + { + m_trans_state = SPI_RAW_STATE_MEM_REQUESTED; + m_buffer_reqested_flag = true; + m_rx_packet_length = packetLength; + callback_memory_request(packetLength); + } + else + { + if (m_p_tx_buffer) + { + clear_request_line(); + m_trans_state = SPI_RAW_STATE_TX_HEADER; + err_code = header_send(m_tx_packet_length); + } + else + { + //there is nothing to send - zero response facilitates pooling - but perhaps, it should be assert + err_code = header_send(0); + } + } + } + + break; + + case SPI_RAW_STATE_MEM_REQUESTED: + + if (event.evt_type == NRF_DRV_SPIS_EVT_TYPE_MAX) //This is API dummy event + { + m_buffer_reqested_flag = false; + m_trans_state = SPI_RAW_STATE_RX_PAYLOAD; + m_accumulated_rx_packet_length = 0; + err_code = frame_get(); + } + break; + + case SPI_RAW_STATE_RX_PAYLOAD: + + if (event.evt_type == NRF_DRV_SPIS_BUFFERS_SET_DONE) + { + DEBUG_EVT_SPI_SLAVE_RAW_BUFFERS_SET(0); + set_ready_line(); + } + + if (event.evt_type == NRF_DRV_SPIS_XFER_DONE) + { + DEBUG_EVT_SPI_SLAVE_RAW_RX_XFER_DONE(event.rx_amount); + spi_slave_raw_assert(event.rx_amount == m_current_rx_frame_length); + m_accumulated_rx_packet_length += m_current_rx_frame_length; + + if (m_accumulated_rx_packet_length < m_rx_packet_length ) + { + err_code = frame_get(); + } + else + { + spi_slave_raw_assert(m_accumulated_rx_packet_length == m_rx_packet_length); + m_trans_state = SPI_RAW_STATE_RX_HEADER; + err_code = header_get(); + + if (!m_trash_payload_flag) + { + callback_packet_received(m_p_rx_buffer, m_accumulated_rx_packet_length); + } + else + { + callback_packet_dropped(); + } + } + } + break; + + case SPI_RAW_STATE_TX_HEADER: + + if (event.evt_type == NRF_DRV_SPIS_BUFFERS_SET_DONE) + { + DEBUG_EVT_SPI_SLAVE_RAW_BUFFERS_SET(0); + set_ready_line(); + } + + if (event.evt_type == NRF_DRV_SPIS_XFER_DONE) + { + DEBUG_EVT_SPI_SLAVE_RAW_TX_XFER_DONE(event.tx_amount); + spi_slave_raw_assert(event.tx_amount == SER_PHY_HEADER_SIZE); + m_trans_state = SPI_RAW_STATE_TX_PAYLOAD; + m_accumulated_tx_packet_length = 0; + err_code = frame_send(); + } + + break; + + case SPI_RAW_STATE_TX_PAYLOAD: + + if (event.evt_type == NRF_DRV_SPIS_BUFFERS_SET_DONE) + { + DEBUG_EVT_SPI_SLAVE_RAW_BUFFERS_SET(0); + set_ready_line(); + } + + if (event.evt_type == NRF_DRV_SPIS_XFER_DONE) + { + DEBUG_EVT_SPI_SLAVE_RAW_TX_XFER_DONE(event.tx_amount); + spi_slave_raw_assert(event.tx_amount == m_current_tx_frame_length); + m_accumulated_tx_packet_length += m_current_tx_frame_length; + + if ( m_accumulated_tx_packet_length < m_tx_packet_length ) + { + err_code = frame_send(); + } + else + { + spi_slave_raw_assert(m_accumulated_tx_packet_length == m_tx_packet_length); + //clear pointer before callback + m_p_tx_buffer = NULL; + callback_packet_transmitted(); + //spi slave TX transfer is possible only when RX is ready, so return to waiting for a header + m_trans_state = SPI_RAW_STATE_RX_HEADER; + err_code = header_get(); + } + } + break; + + default: + err_code = NRF_ERROR_INVALID_STATE; + break; + } + APP_ERROR_CHECK(err_code); +} + +static void spi_slave_gpiote_init(void) +{ + if (!nrf_drv_gpiote_is_init()) + { + (void)nrf_drv_gpiote_init(); + } + nrf_drv_gpiote_out_config_t config = GPIOTE_CONFIG_OUT_TASK_TOGGLE(true); + (void) nrf_drv_gpiote_out_init(m_spi_slave_raw_config.pin_rdy, &config); + (void) nrf_drv_gpiote_out_task_enable(m_spi_slave_raw_config.pin_rdy); + return; +} + +static void spi_slave_ppi_init(void) +{ + uint32_t rdy_task = nrf_drv_gpiote_out_task_addr_get(m_spi_slave_raw_config.pin_rdy); + //Configure PPI channel to clear /RDY line + NRF_PPI->CH[m_spi_slave_raw_config.ppi_rdy_ch].EEP = (uint32_t)(&NRF_SPIS1->EVENTS_END); + NRF_PPI->CH[m_spi_slave_raw_config.ppi_rdy_ch].TEP = rdy_task; + + //this works only for channels 0..15 - but soft device is using 8-15 anyway + NRF_PPI->CHEN |= (1 << m_spi_slave_raw_config.ppi_rdy_ch); + return; +} + +static void spi_slave_gpio_init(void) +{ + nrf_gpio_cfg_output(m_spi_slave_raw_config.pin_req); + nrf_gpio_pin_set(m_spi_slave_raw_config.pin_req); + nrf_gpio_cfg_output(m_spi_slave_raw_config.pin_rdy); + nrf_gpio_pin_set(m_spi_slave_raw_config.pin_rdy); +} + +/* ser_phy API function */ +void ser_phy_interrupts_enable(void) +{ + (void)sd_nvic_EnableIRQ(m_spis.irq); +} + +/* ser_phy API function */ +void ser_phy_interrupts_disable(void) +{ + (void)sd_nvic_DisableIRQ(m_spis.irq); +} + +/* ser_phy API function */ +uint32_t ser_phy_rx_buf_set(uint8_t * p_buffer) +{ + uint32_t status = NRF_SUCCESS; + nrf_drv_spis_event_t event; + + ser_phy_interrupts_disable(); + + if (m_buffer_reqested_flag && (m_trans_state == SPI_RAW_STATE_MEM_REQUESTED)) + { + m_p_rx_buffer = p_buffer; + + if (m_p_rx_buffer) + { + m_trash_payload_flag = false; + } + else + { + m_trash_payload_flag = true; + } + event.evt_type = NRF_DRV_SPIS_EVT_TYPE_MAX; //force transition with dummy event + event.rx_amount = 0; + event.tx_amount = 0; + spi_slave_event_handle(event); + } + else + { + status = NRF_ERROR_BUSY; + } + ser_phy_interrupts_enable(); + + return status; +} + +/* ser_phy API function */ +uint32_t ser_phy_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes) +{ + uint32_t status = NRF_SUCCESS; + + if ( p_buffer == NULL || num_of_bytes == 0) + { + return NRF_ERROR_NULL; + } + + ser_phy_interrupts_disable(); + + if ( m_p_tx_buffer == NULL) + { + m_tx_packet_length = num_of_bytes; + m_p_tx_buffer = p_buffer; + set_request_line(); + } + else + { + status = NRF_ERROR_BUSY; + } + ser_phy_interrupts_enable(); + + return status; +} + +/* ser_phy API function */ +uint32_t ser_phy_open(ser_phy_events_handler_t events_handler) +{ + uint32_t err_code; + nrf_drv_spis_config_t spi_slave_config; + nrf_drv_spis_event_t event; + + if (m_trans_state != SPI_RAW_STATE_UNKNOWN) + { + return NRF_ERROR_INVALID_STATE; + } + + if (events_handler == NULL) + { + return NRF_ERROR_NULL; + } + + //one ppi channel and one gpiote channel are used to drive RDY line + m_spi_slave_raw_config.pin_req = SER_PHY_SPI_SLAVE_REQ_PIN; + m_spi_slave_raw_config.pin_rdy = SER_PHY_SPI_SLAVE_RDY_PIN; + m_spi_slave_raw_config.ppi_rdy_ch = SER_PHY_SPI_PPI_RDY_CH; + m_spi_slave_raw_config.gpiote_rdy_ch = SER_PHY_SPI_GPIOTE_RDY_CH; + + spi_slave_gpio_init(); + spi_slave_gpiote_init(); + spi_slave_ppi_init(); + + spi_slave_config.miso_pin = SER_PHY_SPI_SLAVE_MISO_PIN; + spi_slave_config.mosi_pin = SER_PHY_SPI_SLAVE_MOSI_PIN; + spi_slave_config.sck_pin = SER_PHY_SPI_SLAVE_SCK_PIN; + spi_slave_config.csn_pin = SER_PHY_SPI_SLAVE_SS_PIN; + spi_slave_config.mode = NRF_DRV_SPIS_MODE_0; + spi_slave_config.bit_order = NRF_DRV_SPIS_BIT_ORDER_LSB_FIRST; + spi_slave_config.def = SER_PHY_SPI_DEF_CHARACTER; + spi_slave_config.orc = SER_PHY_SPI_ORC_CHARACTER; + spi_slave_config.irq_priority = NRF_APP_PRIORITY_LOW; + spi_slave_config.miso_drive = NRF_DRV_SPIS_DEFAULT_MISO_DRIVE; + //use /CS pullup because state of the line might be undefined when master redefines PIO lines + spi_slave_config.csn_pullup = NRF_GPIO_PIN_PULLUP; + + //keep /CS high when init + nrf_gpio_cfg_input(spi_slave_config.csn_pin, NRF_GPIO_PIN_PULLUP); + + err_code = nrf_drv_spis_init(&m_spis, &spi_slave_config, spi_slave_event_handle); + APP_ERROR_CHECK(err_code); + + if (err_code == NRF_SUCCESS) + { + m_ser_phy_callback = events_handler; + + m_trans_state = SPI_RAW_STATE_SETUP_HEADER; + event.evt_type = NRF_DRV_SPIS_EVT_TYPE_MAX; //force transition for dummy event + event.rx_amount = 0; + event.tx_amount = 0; + spi_slave_event_handle(event); + + } + return err_code; +} + +/* ser_phy API function */ +void ser_phy_close(void) +{ + nrf_drv_spis_uninit(&m_spis); + m_ser_phy_callback = NULL; + m_trans_state = SPI_RAW_STATE_UNKNOWN; +} diff --git a/components/serialization/common/transport/ser_phy/ser_phy_nrf51_uart.c b/components/serialization/common/transport/ser_phy/ser_phy_nrf51_uart.c new file mode 100644 index 0000000..d162921 --- /dev/null +++ b/components/serialization/common/transport/ser_phy/ser_phy_nrf51_uart.c @@ -0,0 +1,440 @@ + +/* 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 "ser_phy.h" +#include +#include +#include + +#include "nordic_common.h" +#include "nrf.h" +#include "nrf_error.h" +#include "nrf_gpio.h" +#include "app_util.h" +#include "app_uart.h" +#include "app_error.h" + +#ifdef SER_CONNECTIVITY +#include "ser_phy_config_conn_nrf51.h" +#else +#include "ser_phy_config_app_nrf51.h" +#endif /* SER_CONNECTIVITY */ + +#include "boards.h" + +#ifdef NRF51 +#define SER_UART_IRQ UART0_IRQn +#elif defined NRF52 +#define SER_UART_IRQ UARTE0_UART0_IRQn +#endif /* NRF51 */ + +static uint8_t * mp_tx_stream; /**< Pointer to Tx data */ +static uint16_t m_tx_stream_length; /**< Length of Tx data including SER_PHY + * header */ +static uint16_t m_tx_stream_index; /**< Byte index in Tx data */ +static uint8_t m_tx_length_buf[SER_PHY_HEADER_SIZE]; /**< Buffer for header of Tx packet */ + +static uint8_t * mp_rx_stream; /**< Pointer to Rx buffer */ +static uint16_t m_rx_stream_length; /**< Length of Rx data including SER_PHY + * header*/ +static uint16_t m_rx_stream_index; /**< Byte index in Rx data */ +static uint8_t m_rx_length_buf[SER_PHY_HEADER_SIZE]; /**< Buffer for header of Rx packet */ +static uint8_t m_rx_drop_buf[1]; /**< 1-byte buffer used to trash incoming + * data */ +static uint8_t m_rx_byte; /**< Rx byte passed from low-level driver */ + +static ser_phy_events_handler_t m_ser_phy_event_handler; /**< Event handler for upper layer */ +static ser_phy_evt_t m_ser_phy_rx_event; /**< Rx event for upper layer + * notification */ +static ser_phy_evt_t m_ser_phy_tx_event; /**< Tx event for upper layer + * notification */ + +static bool m_other_side_active = false; /* Flag indicating that the other side is running */ + +/** + *@breif UART configuration structure, values are defined in SER_PHY config files: + * ser_phy_config_conn_nrf51.h for connectivity and ser_phy_config_app_nrf51.h for application. + */ +static const app_uart_comm_params_t comm_params = +{ + .rx_pin_no = SER_PHY_UART_RX, + .tx_pin_no = SER_PHY_UART_TX, + .rts_pin_no = SER_PHY_UART_RTS, + .cts_pin_no = SER_PHY_UART_CTS, + //Below values are defined in ser_config.h common for application and connectivity + .flow_control = SER_PHY_UART_FLOW_CTRL, + .use_parity = SER_PHY_UART_PARITY, + .baud_rate = SER_PHY_UART_BAUDRATE +}; + +/** FUNCTION DECLARATIONS */ + +static __INLINE void callback_ser_phy_event(ser_phy_evt_t event); +static __INLINE void callback_packet_received(void); +static __INLINE void callback_packet_sent(void); +static __INLINE void callback_mem_request(void); +static __INLINE void callback_hw_error(uint32_t error_src); + +static void ser_phy_uart_tx(void); +static void ser_phy_uart_rx(uint8_t rx_byte); +static void ser_phy_uart_evt_callback(app_uart_evt_t * uart_evt); + + +/** STATIC FUNCTION DEFINITIONS */ + +/** + *@brief Callback for calling ser phy event handler to notify higher layer with appropriate event. + * Handler is called only wen it was previously registered. + */ +static __INLINE void callback_ser_phy_event(ser_phy_evt_t event) +{ + if (m_ser_phy_event_handler) + { + m_ser_phy_event_handler(event); + } + return; +} + +/** + *@brief Callback for notifying upper layer that either a packet was succesfully received or it was + * dropped. + */ +static __INLINE void callback_packet_received(void) +{ + if (mp_rx_stream == m_rx_drop_buf) + { + m_ser_phy_rx_event.evt_type = SER_PHY_EVT_RX_PKT_DROPPED; + } + else + { + m_ser_phy_rx_event.evt_type = SER_PHY_EVT_RX_PKT_RECEIVED; + m_ser_phy_rx_event.evt_params.rx_pkt_received.num_of_bytes = + m_rx_stream_index - SER_PHY_HEADER_SIZE; + m_ser_phy_rx_event.evt_params.rx_pkt_received.p_buffer = + mp_rx_stream; + } + + mp_rx_stream = NULL; + m_rx_stream_length = 0; + m_rx_stream_index = 0; + + callback_ser_phy_event(m_ser_phy_rx_event); +} + +/** + *@brief Callback for notifying upper layer that a packet was succesfully transmitted + */ +static __INLINE void callback_packet_sent(void) +{ + mp_tx_stream = NULL; + m_tx_stream_length = 0; + m_tx_stream_index = 0; + + m_ser_phy_tx_event.evt_type = SER_PHY_EVT_TX_PKT_SENT; + + callback_ser_phy_event(m_ser_phy_tx_event); +} + +/** + *@brief Callback for requesting from upper layer memory for an incomming packet. + */ +static __INLINE void callback_mem_request(void) +{ + m_rx_stream_length = uint16_decode(m_rx_length_buf) + SER_PHY_HEADER_SIZE; + m_ser_phy_rx_event.evt_type = SER_PHY_EVT_RX_BUF_REQUEST; + m_ser_phy_rx_event.evt_params.rx_buf_request.num_of_bytes = + m_rx_stream_length - SER_PHY_HEADER_SIZE; + + callback_ser_phy_event(m_ser_phy_rx_event); +} + +/** + *@brief Callback for notifying upper layer of a HW error that occured. + */ +static __INLINE void callback_hw_error(uint32_t error_src) +{ + mp_rx_stream = NULL; + m_rx_stream_length = 0; + m_rx_stream_index = 0; + m_ser_phy_rx_event.evt_type = SER_PHY_EVT_HW_ERROR; + + //Pass error source to upper layer + m_ser_phy_rx_event.evt_params.hw_error.error_code = error_src; + callback_ser_phy_event(m_ser_phy_rx_event); +} + +/** + *@brief Function for handling Tx procedure. + */ +static void ser_phy_uart_tx(void) +{ + if (mp_tx_stream != NULL) + { + bool tx_done_flag = false; /**< Local flag for indicating that TX is completed */ + uint32_t err_code = NRF_SUCCESS; /**< Error code for storing result of app_uart_put */ + + //Blocking TXRDY interrupt is done to avoid interrupting when this procedure is + //triggered from main context + NRF_UART0->INTENCLR = (UART_INTENSET_TXDRDY_Set << UART_INTENSET_TXDRDY_Pos); + + //Notify upper layer if whole packet has been transmitted + if (m_tx_stream_index == m_tx_stream_length) + { + callback_packet_sent(); + tx_done_flag = true; + } + //First transmit 2 bytes of packet length + else if (m_tx_stream_index < SER_PHY_HEADER_SIZE) + { + err_code = app_uart_put(m_tx_length_buf[m_tx_stream_index]); + } + //Then transmit payload + else if (m_tx_stream_index < m_tx_stream_length) + { + err_code = app_uart_put(mp_tx_stream[m_tx_stream_index - SER_PHY_HEADER_SIZE]); + } + + //Increment index only if byte was sent without errors + if ((err_code == NRF_SUCCESS) && !tx_done_flag) + { + m_tx_stream_index++; + } + + //Unblock TXRDY interrupts + NRF_UART0->INTENSET = (UART_INTENSET_TXDRDY_Set << UART_INTENSET_TXDRDY_Pos); + } + +} + +/** + *@brief Function for handling Rx procedure. + */ +static void ser_phy_uart_rx(uint8_t rx_byte) +{ + + if (mp_rx_stream == NULL ) + { + //Receive length value and request rx buffer from higher layer + if (m_rx_stream_index < SER_PHY_HEADER_SIZE) + { + m_rx_length_buf[m_rx_stream_index++] = rx_byte; + + if (m_rx_stream_index == SER_PHY_HEADER_SIZE) + { + //Block RXRDY interrupts at this point to not handle incoming bytes until upper + //layer provides memory for payload + NRF_UART0->INTENCLR = (UART_INTENCLR_RXDRDY_Clear << UART_INTENCLR_RXDRDY_Pos); + + //Request rx buffer from upper layer + callback_mem_request(); + } + } + } + else if (m_rx_stream_index < m_rx_stream_length) + { + //Receive or drop payload + if (mp_rx_stream == m_rx_drop_buf) + { + //Drop incoming data to the one-element drop buffer + *mp_rx_stream = rx_byte; + m_rx_stream_index++; + } + else + { + mp_rx_stream[m_rx_stream_index - SER_PHY_HEADER_SIZE] = rx_byte; + m_rx_stream_index++; + } + } + + //Process RX packet, notify higher layer + if (m_rx_stream_index == m_rx_stream_length) + { + callback_packet_received(); + } +} + +/** + *@brief Callback for processing events from low-level UART driver. + */ +static void ser_phy_uart_evt_callback(app_uart_evt_t * uart_evt) +{ + if (uart_evt == NULL) + { + return; + } + + switch (uart_evt->evt_type) + { + case APP_UART_COMMUNICATION_ERROR: + + //Process error only if this is parity or overrun error. + //Break and framing error is always present when app side is not active + if (uart_evt->data.error_communication & + (UART_ERRORSRC_PARITY_Msk | UART_ERRORSRC_OVERRUN_Msk)) + { + callback_hw_error(uart_evt->data.error_communication); + } + break; + + case APP_UART_TX_EMPTY: + ser_phy_uart_tx(); + break; + + case APP_UART_DATA: + + //After first reception disable pulldown - it was only needed before start + //of the other side + if (!m_other_side_active) + { + nrf_gpio_cfg_input(comm_params.rx_pin_no, NRF_GPIO_PIN_NOPULL); + m_other_side_active = true; + } + + m_rx_byte = uart_evt->data.value; + ser_phy_uart_rx(m_rx_byte); + break; + + default: + APP_ERROR_CHECK(NRF_ERROR_INTERNAL); + break; + } +} + +/** API FUNCTIONS */ + +uint32_t ser_phy_open(ser_phy_events_handler_t events_handler) +{ + uint32_t err_code = NRF_SUCCESS; + + if (events_handler == NULL) + { + return NRF_ERROR_NULL; + } + + //Check if function was not called before + if (m_ser_phy_event_handler != NULL) + { + return NRF_ERROR_INVALID_STATE; + } + + //Configure UART and register handler + //uart_evt_handler is used to handle events produced by low-level uart driver + APP_UART_INIT(&comm_params, ser_phy_uart_evt_callback, UART_IRQ_PRIORITY, err_code); + +// //Pull down Rx pin until another side gets up to avoid receiving false bytes due to glitches +// //on Rx line +// nrf_gpio_cfg_input(comm_params.rx_pin_no, NRF_GPIO_PIN_PULLDOWN); + + m_ser_phy_event_handler = events_handler; + + //If intialization did not go alright return error + if (err_code != NRF_SUCCESS) + { + return NRF_ERROR_INVALID_PARAM; + } + + return err_code; +} + + + +uint32_t ser_phy_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes) +{ + if (p_buffer == NULL) + { + return NRF_ERROR_NULL; + } + else if (num_of_bytes == 0) + { + return NRF_ERROR_INVALID_PARAM; + } + + //Check if there is no ongoing transmission at the moment + if ((mp_tx_stream == NULL) && (m_tx_stream_length == 0) && (m_tx_stream_index == 0)) + { + (void) uint16_encode(num_of_bytes, m_tx_length_buf); + mp_tx_stream = (uint8_t *)p_buffer; + m_tx_stream_length = num_of_bytes + SER_PHY_HEADER_SIZE; + + //Call tx procedure to start transmission of a packet + ser_phy_uart_tx(); + } + else + { + return NRF_ERROR_BUSY; + } + + return NRF_SUCCESS; +} + +uint32_t ser_phy_rx_buf_set(uint8_t * p_buffer) +{ + + if (m_ser_phy_rx_event.evt_type != SER_PHY_EVT_RX_BUF_REQUEST) + { + return NRF_ERROR_INVALID_STATE; + } + + if (p_buffer != NULL) + { + mp_rx_stream = p_buffer; + } + else + { + mp_rx_stream = m_rx_drop_buf; + } + + //Unblock RXRDY interrupts as higher layer has responded (with a valid or NULL pointer) + NRF_UART0->INTENSET = (UART_INTENSET_RXDRDY_Set << UART_INTENSET_RXDRDY_Pos); + + return NRF_SUCCESS; +} + +void ser_phy_close(void) +{ + m_ser_phy_event_handler = NULL; + (void)app_uart_close(); +} + +void ser_phy_interrupts_enable(void) +{ + NVIC_EnableIRQ(SER_UART_IRQ); +} + +void ser_phy_interrupts_disable(void) +{ + NVIC_DisableIRQ(SER_UART_IRQ); +} + diff --git a/components/serialization/common/transport/ser_phy/ser_phy_nrf51_uart_stm_app.c b/components/serialization/common/transport/ser_phy/ser_phy_nrf51_uart_stm_app.c new file mode 100644 index 0000000..55cbbfe --- /dev/null +++ b/components/serialization/common/transport/ser_phy/ser_phy_nrf51_uart_stm_app.c @@ -0,0 +1,754 @@ +/* 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by STMicroelectronics that + * is used in combination with a processor manufactured by Nordic Semiconductor + * or in a processor manufactured by STMicroelectronics. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 "nordic_common.h" +#include "boards.h" +#include "nrf.h" +#include "nrf_error.h" +#include "nrf_gpio.h" +#include "nrf_delay.h" +#include "nrf_gpiote.h" +#include "app_gpiote.h" +#include "app_util.h" +#include "app_util_platform.h" + +#include "ser_phy.h" +#include "ser_phy_config_app_nrf51.h" + +#define UART_PIN_DISCONNECTED 0xFFFFFFFF /**< Value indicating that no pin is connected to this UART register. */ + +/** @brief States for the app_uart state machine. */ +typedef enum +{ + UART_IDLE, /**< Indicating that the current status for either RX or TX is idle. When both RX and TX is idle the UART will be disabled in order to save power. */ + UART_RX, /**< Used to indicate that a packet is currently being received on RX. */ + UART_RX_PENDING, /**< Used to indicate that byte is ready at RXD register but no buffer was available when the byte was received. The byte will be pulled when a buffer is set. */ + UART_TX_COMPLETE, /**< Used on TX to indicate that final byte has been put on TXD register. Next TXDRDY interrupt will indicate that last byte has been transmitted. */ + UART_TX_SEND, /**< Used to indicate that a packet is currently being transmitted on TX. */ + UART_TX_LAST_BYTE_WAIT, /**< Used to indicate that the last byte on a TX packet is currently waiting to be transmitted when CTS goes low. Note that flow control is off when tranmitting final byte. */ + UART_STALL, /**< Indicates that TX is stalled because final byte is being received on the UART. */ +} uart_states_t; + +static volatile uint32_t m_pin_cts_mask; /**< CTS pin mask for UART module. */ + +static volatile uint8_t * mp_tx_stream; /**< Pointer to array of data packet to be transmitted. */ +static volatile uint16_t m_tx_stream_length; /**< Total length of data packet to be transmitted. */ +static volatile uint16_t m_tx_stream_index; /**< Index in data packet for next byte to be transmitted. */ +static uint8_t m_tx_length_buf[SER_PHY_HEADER_SIZE]; /**< Buffer needed in transmission of packet length */ + +static uint8_t * mp_rx_stream; /**< Pointer to current receive buffer. */ +static volatile uint16_t m_rx_stream_length; /**< Length of receive buffer. */ +static volatile uint16_t m_rx_stream_index; /**< Index in receive buffer where the next byte will be placed. */ +static volatile bool m_rx_stream_header; /**< Indication of whether header data (true) or payload data (false) is currently being received. */ +static uint8_t m_rx_length_buf[SER_PHY_HEADER_SIZE]; /**< Buffer needed in reception of packet length */ +static uint8_t m_rx_drop_buf[1]; /**< Additional buffer, needed by packet dropping functionality. */ + +static volatile uart_states_t m_rx_state = UART_IDLE; /**< State of the RX state machine. */ +static volatile uart_states_t m_tx_state = UART_IDLE; /**< State of the TX state machine. */ +static volatile bool m_tx_pending = false; /**< If TX state is UART_STALL and a byte is ready for tranmission the pending flag is set to true. */ +static volatile bool m_cts_high_disconnect = false; /**< If CTS was sampled low when last byte was transmitted this flag is set to true to indicate that a switch from low->high on CTS should be interpreted as transmission has completed and UART is to be disabled to save power. */ + +static volatile ser_phy_events_handler_t m_ser_phy_event_handler; +static volatile ser_phy_evt_t m_ser_phy_event_rx; +static volatile ser_phy_evt_t m_ser_phy_event_tx; + + +static void uart_peripheral_disconnect_flow(void) +{ + NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS; + nrf_gpio_cfg_output(SER_PHY_UART_RTS); + + NRF_UART0->PSELCTS = UART_PIN_DISCONNECTED; + NRF_UART0->PSELRTS = UART_PIN_DISCONNECTED; + NRF_UART0->CONFIG &= ~(UART_CONFIG_HWFC_Enabled << UART_CONFIG_HWFC_Pos); +} + + +static void uart_peripheral_connect_flow(void) +{ + NRF_UART0->PSELCTS = SER_PHY_UART_CTS; + NRF_UART0->PSELRTS = SER_PHY_UART_RTS; + NRF_UART0->CONFIG |= (UART_CONFIG_HWFC_Enabled << UART_CONFIG_HWFC_Pos); +} + + +static void uart_peripheral_enable(void) +{ + if (!(NRF_UART0->ENABLE & (UART_ENABLE_ENABLE_Enabled << UART_ENABLE_ENABLE_Pos))) + { + NRF_UART0->PSELCTS = SER_PHY_UART_CTS; + NRF_UART0->PSELRTS = SER_PHY_UART_RTS; + NRF_UART0->CONFIG |= (UART_CONFIG_HWFC_Enabled << UART_CONFIG_HWFC_Pos); + NRF_UART0->TASKS_STARTRX = 1; + NRF_UART0->TASKS_STARTTX = 1; + NRF_UART0->ENABLE = (UART_ENABLE_ENABLE_Enabled << UART_ENABLE_ENABLE_Pos); + } +} + + +static void uart_peripheral_disable(void) +{ + if ((m_tx_state == UART_IDLE || m_tx_state == UART_STALL) && + (m_rx_state == UART_IDLE)) + { + NRF_UART0->TASKS_STOPTX = 1; + NRF_UART0->TASKS_STOPRX = 1; + NRF_UART0->PSELCTS = UART_PIN_DISCONNECTED; + NRF_UART0->PSELRTS = UART_PIN_DISCONNECTED; + NRF_UART0->ENABLE = (UART_ENABLE_ENABLE_Disabled << UART_ENABLE_ENABLE_Pos); + + nrf_gpio_cfg_input(SER_PHY_UART_RTS, NRF_GPIO_PIN_NOPULL); + + nrf_gpiote_event_configure(0, SER_PHY_UART_CTS, NRF_GPIOTE_POLARITY_TOGGLE); + + if (!nrf_gpio_pin_read(SER_PHY_UART_CTS)) + { + NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS; + nrf_gpio_cfg_output(SER_PHY_UART_RTS); + uart_peripheral_enable(); + } + } +} + + +static void uart_tx_start(void) +{ + if (mp_tx_stream != NULL) + { + //If RX is already ongoing then no wakeup signal is required. + if (m_rx_state == UART_IDLE) + { + nrf_gpiote_event_disable(0); + NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS; + nrf_gpio_cfg_output(SER_PHY_UART_RTS); + uart_peripheral_connect_flow(); + uart_peripheral_enable(); + } + } +} + + +static void uart_tx_send(void) +{ + //First send 2 bytes of header then payload + if (m_tx_stream_index < SER_PHY_HEADER_SIZE) + { + NRF_UART0->TXD = m_tx_length_buf[m_tx_stream_index++]; + } + else if (m_tx_stream_index < m_tx_stream_length) + { + NRF_UART0->TXD = mp_tx_stream[m_tx_stream_index++ - SER_PHY_HEADER_SIZE]; + } +} + + +static void uart_tx_last_byte(void) +{ + uart_peripheral_disconnect_flow(); + m_tx_state = UART_TX_LAST_BYTE_WAIT; + + //Configure event in case CTS is going low during this function execution + nrf_gpiote_event_configure(0, SER_PHY_UART_CTS, NRF_GPIOTE_POLARITY_TOGGLE); + + if (!nrf_gpio_pin_read(SER_PHY_UART_CTS)) //All pins are low --> last byte can be transmitted. + { + //Re-check state as it might have changed due to preemption of current interrupt. + nrf_gpiote_event_disable(0); + + if (m_tx_state == UART_TX_LAST_BYTE_WAIT) + { + m_tx_state = UART_TX_COMPLETE; + uart_tx_send(); + } + } +} + + +static void tx_complete_event_send(void) +{ + mp_tx_stream = NULL; + m_tx_stream_length = 0; + m_tx_stream_index = 0; + + m_ser_phy_event_tx.evt_type = SER_PHY_EVT_TX_PKT_SENT; + m_ser_phy_event_handler(m_ser_phy_event_tx); +} + + +static void uart_txdrdy_handle(void) +{ + NRF_UART0->EVENTS_TXDRDY = 0; + + if (m_tx_state == UART_TX_SEND || m_tx_state == UART_IDLE) + { + if (m_tx_stream_index < (m_tx_stream_length - 1)) + { + m_tx_state = UART_TX_SEND; + uart_tx_send(); + //Keep same state. + } + else if (m_tx_stream_index == m_tx_stream_length) + { + m_tx_state = UART_IDLE; + tx_complete_event_send(); + } + else + { + uart_tx_last_byte(); + } + } + else if (m_tx_state == UART_TX_COMPLETE) + { + m_tx_state = UART_IDLE; + + if (m_rx_state == UART_IDLE) + { + nrf_delay_us(15); + nrf_gpiote_event_configure(0, SER_PHY_UART_CTS, NRF_GPIOTE_POLARITY_TOGGLE); + + if (nrf_gpio_pin_read(SER_PHY_UART_CTS)) + { + uart_peripheral_disable(); + } + else + { + uart_peripheral_connect_flow(); + m_cts_high_disconnect = true; + nrf_gpiote_event_configure(0, SER_PHY_UART_CTS, NRF_GPIOTE_POLARITY_TOGGLE); + + if (nrf_gpio_pin_read(SER_PHY_UART_CTS)) + { + //If second sample show CTS high it either + //1) happened BEFORE gpiote enable and uart should be disabled. + //(m_cts_high_disconnect == true). + //2) happened AFTER gpiote enable and an interrupt low->high has occured then + //uart should NOT be disabled as the ISR has disabled the UART. + //(m_cts_high_disconnect == false). + if (m_cts_high_disconnect == true) + { + m_cts_high_disconnect = false; + uart_peripheral_disable(); + } + } + } + } + else + { + uart_peripheral_connect_flow(); + } + + tx_complete_event_send(); + } + else if (m_tx_state == UART_STALL) + { + if (m_tx_stream_index == m_tx_stream_length) + { + tx_complete_event_send(); + } + else + { + m_tx_pending = true; + } + } + else + { + //Do nothing. + } +} + + +static __INLINE void on_cts_high(void) +{ + if (m_cts_high_disconnect == true) + { + m_cts_high_disconnect = false; + + if (m_rx_state == UART_IDLE && m_tx_state == UART_IDLE) + { + if (m_tx_stream_index == m_tx_stream_length) + { + uart_peripheral_disable(); + } + } + } +} + + +static __INLINE void on_cts_low(void) +{ + m_cts_high_disconnect = false; + nrf_gpiote_event_disable(0); + + if (m_tx_state == UART_STALL) + { + m_tx_pending = true; + } + else if (m_tx_state == UART_TX_LAST_BYTE_WAIT) + { + m_tx_state = UART_TX_COMPLETE; + uart_tx_send(); + } + else if (m_rx_state == UART_IDLE && m_tx_state == UART_IDLE) + { + NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS; + nrf_gpio_cfg_output(SER_PHY_UART_RTS); + uart_peripheral_enable(); + } +} + + +static void uart_rxdrdy_handle(void) +{ + if (m_rx_state == UART_IDLE) + { + m_rx_state = UART_RX; + } + + //Set proper size and buff at the beginning of receiving header + if ((m_rx_stream_header == true) && !m_rx_stream_index) + { + m_rx_stream_length = SER_PHY_HEADER_SIZE; + mp_rx_stream = m_rx_length_buf; + } + + if (mp_rx_stream != NULL) + { + bool tx_dual_end = false; + + NRF_UART0->EVENTS_RXDRDY = 0; + + //Second last byte received. + //Disconnect CTS before pulling the byte and receiving the final byte. + if ((m_rx_stream_header == false) && ((m_rx_stream_index) == (m_rx_stream_length - 2))) + { + nrf_gpio_cfg_output(SER_PHY_UART_RTS); + + //Last byte is waiting for tansmission. Thus dual end TX case. + // + if (m_tx_state == UART_TX_LAST_BYTE_WAIT) + { + m_tx_state = UART_STALL; + nrf_gpiote_event_disable(0); + + //Checking pending state. + //- If pending is true then CTS have become low after we stalled the UART and final byte should be transmitted here. + //- If pending is false we should check if final byte was tranmitted and if not, the do the transmission her. + if ((m_tx_pending == true) || (m_tx_stream_index == (m_tx_stream_length - 1))) + { + //tx_dual_end = true; + NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS; + uart_tx_send(); + } + } + + if (!tx_dual_end) + { + NRF_GPIO->OUTCLR = 1 << SER_PHY_UART_RTS; + } + m_tx_state = UART_STALL; + + NRF_UART0->PSELCTS = UART_PIN_DISCONNECTED; + NRF_UART0->PSELRTS = UART_PIN_DISCONNECTED; + NRF_UART0->CONFIG &= ~(UART_CONFIG_HWFC_Enabled << UART_CONFIG_HWFC_Pos); + } + + if (m_rx_stream_index < (m_rx_stream_length - 1)) + { + if (mp_rx_stream != m_rx_drop_buf) + { + mp_rx_stream[m_rx_stream_index++] = NRF_UART0->RXD; + } + else + { + mp_rx_stream[0] = NRF_UART0->RXD; + m_rx_stream_index++; + } + + if (m_tx_stream_index == (m_tx_stream_length - 1)) + { + //Toggle CTS line to indicate ack. + //If CTS is connected to UART this code will have no effect. + //But on edge case on bi-directional last byte transfer this avoids lock-up. + NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS; + nrf_delay_us(8); + NRF_GPIO->OUTCLR = 1 << SER_PHY_UART_RTS; + } + } + else + { + if (m_rx_stream_header == false) + { + NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS; + + if (mp_rx_stream != m_rx_drop_buf) + { + mp_rx_stream[m_rx_stream_index++] = NRF_UART0->RXD; + } + else + { + mp_rx_stream[0] = NRF_UART0->RXD; + m_rx_stream_index++; + } + m_rx_state = UART_IDLE; + + //Last byte of payload received - notify that next transmission will be header + m_rx_stream_header = true; + + //Prepare event + if (mp_rx_stream != m_rx_drop_buf) + { + m_ser_phy_event_rx.evt_type = SER_PHY_EVT_RX_PKT_RECEIVED; + m_ser_phy_event_rx.evt_params.rx_pkt_received.num_of_bytes = m_rx_stream_index; + m_ser_phy_event_rx.evt_params.rx_pkt_received.p_buffer = mp_rx_stream; + } + else + { + m_ser_phy_event_rx.evt_type = SER_PHY_EVT_RX_PKT_DROPPED; + } + + m_rx_stream_length = 0; + m_rx_stream_index = 0; + } + else + { + mp_rx_stream[m_rx_stream_index++] = NRF_UART0->RXD; + + //Last byte of header received - notify that next transmission will be payload + m_rx_stream_header = false; + + mp_rx_stream = NULL; + + //Clear index before receiving payload + m_rx_stream_index = 0; + + //Prepare event + m_rx_stream_length = uint16_decode(m_rx_length_buf); + m_ser_phy_event_rx.evt_type = SER_PHY_EVT_RX_BUF_REQUEST; + m_ser_phy_event_rx.evt_params.rx_buf_request.num_of_bytes = m_rx_stream_length; + } + + //Notify upwards + m_ser_phy_event_handler(m_ser_phy_event_rx); + + //UART TX was stalled while receiving final byte. Restart tx. + if (m_tx_state == UART_STALL) + { + if (m_tx_stream_length == m_tx_stream_index) + { + m_tx_state = UART_IDLE; + } + else if (m_tx_stream_index == (m_tx_stream_length - 1)) + { + m_tx_state = UART_TX_LAST_BYTE_WAIT; + } + else + { + m_tx_state = UART_TX_SEND; + } + + //Critical region for avoiding timing issues in 'simultaneous RX end and TX start' + CRITICAL_REGION_ENTER(); + if (m_tx_pending == true) + { + m_tx_pending = false; + uart_tx_start(); + + if (m_tx_state == UART_TX_SEND) + { + uart_tx_send(); + } + else if (m_tx_state == UART_TX_LAST_BYTE_WAIT) + { + uart_tx_last_byte(); + } + } + CRITICAL_REGION_EXIT(); + + if (m_tx_state == UART_IDLE) + { + uart_peripheral_disable(); + } + } + } + } + else + { + m_rx_state = UART_RX_PENDING; + } +} + + +static __INLINE void uart_error_handle(void) +{ + uint32_t error_source; + + //Clear UART ERROR event flag. + NRF_UART0->EVENTS_ERROR = 0; + + //Clear error source. + error_source = NRF_UART0->ERRORSRC; + NRF_UART0->ERRORSRC = error_source; + + m_ser_phy_event_rx.evt_type = SER_PHY_EVT_HW_ERROR; + m_ser_phy_event_rx.evt_params.hw_error.error_code = error_source; + + m_ser_phy_event_handler(m_ser_phy_event_rx); +} + + +/**@brief app_gpiote_fast_detect event handler. + * + */ +static void gpiote_evt_handler(void) +{ + if ( m_pin_cts_mask) + { + if ( nrf_gpio_pin_read(SER_PHY_UART_CTS) ) + { + on_cts_high(); + } + else + { + on_cts_low(); + } + } +} + +/**@brief Function for handling the UART Interrupt. + * + * @details UART interrupt handler to process TX Ready when TXD is available, RX Ready when a byte + * is received, or in case of error when receiving a byte. + */ +void UART0_IRQHandler(void) +{ + //Handle Reception. + if (NRF_UART0->EVENTS_RXDRDY != 0 && (NRF_UART0->INTENSET & UART_INTENSET_RXDRDY_Msk)) + { + uart_rxdrdy_handle(); + } + + //Handle transmission. + if (NRF_UART0->EVENTS_TXDRDY != 0 && (NRF_UART0->INTENSET & UART_INTENSET_TXDRDY_Msk)) + { + uart_txdrdy_handle(); + } + + //Handle errors. + if (NRF_UART0->EVENTS_ERROR != 0 && (NRF_UART0->INTENSET & UART_INTENSET_ERROR_Msk)) + { + uart_error_handle(); + } +} + + +uint32_t ser_phy_open(ser_phy_events_handler_t events_handler) +{ + if (events_handler == NULL) + { + return NRF_ERROR_NULL; + } + + //Check if function was not called before + if (m_ser_phy_event_handler != NULL) + { + return NRF_ERROR_INVALID_STATE; + } + + //GPIO Setup + nrf_gpio_cfg_input(SER_PHY_UART_RTS, NRF_GPIO_PIN_NOPULL); + + NRF_GPIO->OUTSET = 1 << SER_PHY_UART_TX; + nrf_gpio_cfg_output(SER_PHY_UART_TX); + + //Setup the gpiote to handle pin events on cts-pin. + //For the UART we want to detect both low->high and high->low transitions in order to + //know when to activate/de-activate the TX/RX in the UART. + //Configure pin. + m_pin_cts_mask = (1 << SER_PHY_UART_CTS); + nrf_gpio_cfg_sense_input(SER_PHY_UART_CTS, + NRF_GPIO_PIN_PULLUP, + NRF_GPIO_PIN_SENSE_LOW); + + nrf_gpio_cfg_sense_input(SER_PHY_UART_RX, + NRF_GPIO_PIN_PULLUP, + NRF_GPIO_PIN_NOSENSE); + + (void)app_gpiote_input_event_handler_register(0, + SER_PHY_UART_CTS, + GPIOTE_CONFIG_POLARITY_Toggle, + gpiote_evt_handler); + (void)app_gpiote_enable_interrupts(); + + NVIC_ClearPendingIRQ(PendSV_IRQn); + + m_rx_state = UART_IDLE; + m_tx_state = UART_IDLE; + + //Set header flag + m_rx_stream_header = true; + + //UART setup + NRF_UART0->PSELRXD = SER_PHY_UART_RX; + NRF_UART0->PSELTXD = SER_PHY_UART_TX; + NRF_UART0->PSELCTS = UART_PIN_DISCONNECTED; + NRF_UART0->PSELRTS = UART_PIN_DISCONNECTED; + NRF_UART0->BAUDRATE = SER_PHY_UART_BAUDRATE; + NRF_UART0->CONFIG = (UART_CONFIG_HWFC_Enabled << UART_CONFIG_HWFC_Pos); + NRF_UART0->ENABLE = (UART_ENABLE_ENABLE_Disabled << UART_ENABLE_ENABLE_Pos); + + //Enable UART interrupt + NRF_UART0->INTENCLR = 0xFFFFFFFF; + NRF_UART0->INTENSET = (UART_INTENSET_TXDRDY_Set << UART_INTENSET_TXDRDY_Pos) | + (UART_INTENSET_RXDRDY_Set << UART_INTENSET_RXDRDY_Pos) | + (UART_INTENSET_ERROR_Set << UART_INTENSET_ERROR_Pos); + + NVIC_ClearPendingIRQ(UART0_IRQn); + NVIC_SetPriority(UART0_IRQn, APP_IRQ_PRIORITY_MID); + NVIC_EnableIRQ(UART0_IRQn); + + m_ser_phy_event_handler = events_handler; + + return NRF_SUCCESS; +} + + +void ser_phy_close(void) +{ + //Disable UART interrupt. + NRF_UART0->INTENCLR = 0xFFFFFFFF; + + //Unregister callback. + m_ser_phy_event_handler = NULL; + + //Will not check err_code here as we will still continue with closure of UART despite errors. + //Note that any error will still be reported back in the system. + nrf_gpiote_event_disable(0); + + uart_peripheral_disable(); + + //Clear internal UART states + m_rx_state = UART_IDLE; + m_tx_state = UART_IDLE; + + mp_tx_stream = NULL; + m_tx_stream_length = 0; + m_tx_stream_index = 0; + + mp_rx_stream = NULL; + m_rx_stream_length = 0; + m_rx_stream_index = 0; +} + + +uint32_t ser_phy_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes) +{ + if (p_buffer == NULL) + { + return NRF_ERROR_NULL; + } + + if (num_of_bytes == 0) + { + return NRF_ERROR_INVALID_PARAM; + } + + if (mp_tx_stream != NULL) + { + return NRF_ERROR_BUSY; + } + + m_tx_pending = true; + + (void) uint16_encode(num_of_bytes, m_tx_length_buf); + mp_tx_stream = (uint8_t *)p_buffer; + m_tx_stream_length = num_of_bytes + SER_PHY_HEADER_SIZE; + + //Critical region for avoiding timing issues in 'simultaneous RX end and TX start' + CRITICAL_REGION_ENTER(); + if ((!m_rx_stream_length) || (m_rx_stream_index < (m_rx_stream_length - 2))) + { + if (m_tx_state != UART_STALL) + { + if (m_tx_pending == true) + { + m_tx_pending = false; + uart_tx_start(); + //As no tx can be ongoing, then it is safe to call tx_send here. + uart_tx_send(); + } + } + } + CRITICAL_REGION_EXIT(); + + return NRF_SUCCESS; +} + + +uint32_t ser_phy_rx_buf_set(uint8_t * p_buffer) +{ + if (m_ser_phy_event_rx.evt_type != SER_PHY_EVT_RX_BUF_REQUEST) + { + return NRF_ERROR_INVALID_STATE; + } + + if (p_buffer != NULL) + { + mp_rx_stream = p_buffer; + } + else + { + mp_rx_stream = m_rx_drop_buf; + } + + return NRF_SUCCESS; +} + + +void ser_phy_interrupts_enable(void) +{ + NVIC_EnableIRQ(UART0_IRQn); + NVIC_EnableIRQ(GPIOTE_IRQn); +} + + +void ser_phy_interrupts_disable(void) +{ + NVIC_DisableIRQ(UART0_IRQn); + NVIC_DisableIRQ(GPIOTE_IRQn); +} diff --git a/components/serialization/common/transport/ser_phy/ser_phy_nrf51_uart_stm_conn.c b/components/serialization/common/transport/ser_phy/ser_phy_nrf51_uart_stm_conn.c new file mode 100644 index 0000000..e4782d2 --- /dev/null +++ b/components/serialization/common/transport/ser_phy/ser_phy_nrf51_uart_stm_conn.c @@ -0,0 +1,784 @@ +/* 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by STMicroelectronics that + * is used in combination with a processor manufactured by Nordic Semiconductor + * or in a processor manufactured by STMicroelectronics. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 "nordic_common.h" +#include "boards.h" +#include "nrf.h" +#include "nrf_soc.h" +#include "nrf_error.h" +#include "nrf_gpio.h" +#include "nrf_delay.h" +#include "app_util_platform.h" +#include "app_gpiote.h" +#include "ser_phy.h" +#include "ser_phy_config_conn_nrf51.h" + +#define APP_GPIOTE_MAX_USERS 1 +#define UART_PIN_DISCONNECTED 0xFFFFFFFF /**< Value indicating that no pin is connected to this UART register. */ + +/** @brief States for the app_uart state machine. */ +typedef enum +{ + UART_IDLE, /**< Indicating that the current status for either RX or TX is idle. When both RX and TX is idle the UART will be disabled in order to save power. */ + UART_RX, /**< Used to indicate that a packet is currently being received on RX. */ + UART_RX_PENDING, /**< Used to indicate that byte is ready at RXD register but no buffer was available when the byte was received. The byte will be pulled when a buffer is set. */ + UART_TX_COMPLETE, /**< Used on TX to indicate that final byte has been put on TXD register. Next TXDRDY interrupt will indicate that last byte has been transmitted. */ + UART_TX_SEND, /**< Used to indicate that a packet is currently being transmitted on TX. */ + UART_TX_LAST_BYTE_WAIT, /**< Used to indicate that the last byte on a TX packet is currently waiting to be transmitted when CTS goes low. Note that flow control is off when tranmitting final byte. */ + UART_STALL, /**< Indicates that TX is stalled because final byte is being received on the UART. */ +} uart_states_t; + +static volatile uint32_t m_pin_cts_mask; /**< CTS pin mask for UART module. */ +static app_gpiote_user_id_t m_gpiote_uid; /**< GPIOTE module user id for the UART module. */ + +static volatile uint8_t * mp_tx_stream; /**< Pointer to array of data packet to be transmitted. */ +static volatile uint16_t m_tx_stream_length; /**< Total length of data packet to be transmitted. */ +static volatile uint16_t m_tx_stream_index; /**< Index in data packet for next byte to be transmitted. */ +static uint8_t m_tx_length_buf[SER_PHY_HEADER_SIZE]; /**< Buffer needed in transmission of packet length */ + +static uint8_t * mp_rx_stream; /**< Pointer to current receive buffer. */ +static volatile uint16_t m_rx_stream_length; /**< Length of receive buffer. */ +static volatile uint16_t m_rx_stream_index; /**< Index in receive buffer where the next byte will be placed. */ +static volatile bool m_rx_stream_header; /**< Indication of whether header data (true) or payload data (false) is currently being received. */ +static uint8_t m_rx_length_buf[SER_PHY_HEADER_SIZE]; /**< Buffer needed in reception of packet length */ +static uint8_t m_rx_drop_buf[1]; /**< Additional buffer, needed by packet dropping functionality. */ + +static volatile uart_states_t m_rx_state = UART_IDLE; /**< State of the RX state machine. */ +static volatile uart_states_t m_tx_state = UART_IDLE; /**< State of the TX state machine. */ +static volatile bool m_tx_pending = false; /**< If TX state is UART_STALL and a byte is ready for tranmission the pending flag is set to true. */ +static volatile bool m_cts_high_disconnect = false; /**< If CTS was sampled low when last byte was transmitted this flag is set to true to indicate that a switch from low->high on CTS should be interpreted as transmission has completed and UART is to be disabled to save power. */ + +static volatile ser_phy_events_handler_t m_ser_phy_event_handler; +static volatile ser_phy_evt_t m_ser_phy_event_rx; +static volatile ser_phy_evt_t m_ser_phy_event_tx; + + +static void uart_peripheral_disconnect_flow(void) +{ + NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS; + nrf_gpio_cfg_output(SER_PHY_UART_RTS); + + NRF_UART0->PSELCTS = UART_PIN_DISCONNECTED; + NRF_UART0->PSELRTS = UART_PIN_DISCONNECTED; + NRF_UART0->CONFIG &= ~(UART_CONFIG_HWFC_Enabled << UART_CONFIG_HWFC_Pos); +} + + +static void uart_peripheral_connect_flow(void) +{ + NRF_UART0->PSELCTS = SER_PHY_UART_CTS; + NRF_UART0->PSELRTS = SER_PHY_UART_RTS; + NRF_UART0->CONFIG |= (UART_CONFIG_HWFC_Enabled << UART_CONFIG_HWFC_Pos); +} + + +static void uart_peripheral_enable_wo_flow(void) +{ + if (!(NRF_UART0->ENABLE & (UART_ENABLE_ENABLE_Enabled << UART_ENABLE_ENABLE_Pos))) + { + NRF_UART0->PSELCTS = UART_PIN_DISCONNECTED; + NRF_UART0->PSELRTS = UART_PIN_DISCONNECTED; + NRF_UART0->CONFIG &= ~(UART_CONFIG_HWFC_Enabled << UART_CONFIG_HWFC_Pos); + NRF_UART0->TASKS_STARTRX = 1; + NRF_UART0->TASKS_STARTTX = 1; + NRF_UART0->ENABLE = (UART_ENABLE_ENABLE_Enabled << UART_ENABLE_ENABLE_Pos); + } +} + + +static void uart_peripheral_enable(void) +{ + if (!(NRF_UART0->ENABLE & (UART_ENABLE_ENABLE_Enabled << UART_ENABLE_ENABLE_Pos))) + { + NRF_UART0->PSELCTS = SER_PHY_UART_CTS; + NRF_UART0->PSELRTS = SER_PHY_UART_RTS; + NRF_UART0->CONFIG |= (UART_CONFIG_HWFC_Enabled << UART_CONFIG_HWFC_Pos); + NRF_UART0->TASKS_STARTRX = 1; + NRF_UART0->TASKS_STARTTX = 1; + NRF_UART0->ENABLE = (UART_ENABLE_ENABLE_Enabled << UART_ENABLE_ENABLE_Pos); + } +} + + +static void uart_peripheral_disable(void) +{ + if ((m_tx_state == UART_IDLE || m_tx_state == UART_STALL) && + (m_rx_state == UART_IDLE)) + { + uint32_t pins; + NRF_UART0->TASKS_STOPTX = 1; + NRF_UART0->TASKS_STOPRX = 1; + NRF_UART0->PSELCTS = UART_PIN_DISCONNECTED; + NRF_UART0->PSELRTS = UART_PIN_DISCONNECTED; + NRF_UART0->ENABLE = (UART_ENABLE_ENABLE_Disabled << UART_ENABLE_ENABLE_Pos); + + nrf_gpio_cfg_input(SER_PHY_UART_RTS, NRF_GPIO_PIN_NOPULL); + + (void) app_gpiote_user_enable(m_gpiote_uid); + (void) app_gpiote_pins_state_get(m_gpiote_uid, &pins); + + if (!pins) + { + NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS; + nrf_gpio_cfg_output(SER_PHY_UART_RTS); + uart_peripheral_enable(); + } + } +} + + +static void uart_tx_start(void) +{ + if (mp_tx_stream != NULL) + { + //If RX is already ongoing then no wakeup signal is required. + if (m_rx_state == UART_IDLE) + { + (void) app_gpiote_user_disable(m_gpiote_uid); + uart_peripheral_enable_wo_flow(); + NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS; + nrf_gpio_cfg_output(SER_PHY_UART_RTS); + NRF_GPIO->OUTCLR = 1 << SER_PHY_UART_RTS; + nrf_delay_us(4); + NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS; + uart_peripheral_connect_flow(); + } + } +} + + +static void uart_tx_send(void) +{ + //First send 2 bytes of header then payload + if (m_tx_stream_index < SER_PHY_HEADER_SIZE) + { + NRF_UART0->TXD = m_tx_length_buf[m_tx_stream_index++]; + } + else if (m_tx_stream_index < m_tx_stream_length) + { + NRF_UART0->TXD = mp_tx_stream[m_tx_stream_index++ - SER_PHY_HEADER_SIZE]; + } +} + + +static void uart_tx_last_byte(void) +{ + uint32_t pins; + + uart_peripheral_disconnect_flow(); + m_tx_state = UART_TX_LAST_BYTE_WAIT; + + (void) app_gpiote_user_enable(m_gpiote_uid); + (void) app_gpiote_pins_state_get(m_gpiote_uid, &pins); + + if (!pins) //All pins are low --> last byte can be transmitted. + { + (void) app_gpiote_user_disable(m_gpiote_uid); + + //Re-check state as it might have changed due to preemption of current interrupt. + if (m_tx_state == UART_TX_LAST_BYTE_WAIT) + { + m_tx_state = UART_TX_COMPLETE; + uart_tx_send(); + } + } +} + + +static void tx_complete_event_send(void) +{ + mp_tx_stream = NULL; + m_tx_stream_length = 0; + m_tx_stream_index = 0; + + m_ser_phy_event_tx.evt_type = SER_PHY_EVT_TX_PKT_SENT; + m_ser_phy_event_handler(m_ser_phy_event_tx); +} + + +static void uart_txdrdy_handle(void) +{ + NRF_UART0->EVENTS_TXDRDY = 0; + + if (m_tx_state == UART_TX_SEND || m_tx_state == UART_IDLE) + { + if (m_tx_stream_index < (m_tx_stream_length - 1)) + { + m_tx_state = UART_TX_SEND; + uart_tx_send(); + //Keep same state. + } + else if (m_tx_stream_index == m_tx_stream_length) + { + m_tx_state = UART_IDLE; + tx_complete_event_send(); + } + else + { + uart_tx_last_byte(); + } + } + else if (m_tx_state == UART_TX_COMPLETE) + { + m_tx_state = UART_IDLE; + + if (m_rx_state == UART_IDLE) + { + uint32_t pins; + (void) app_gpiote_pins_state_get(m_gpiote_uid, &pins); + + if (pins) + { + uart_peripheral_disable(); + } + else + { + uart_peripheral_connect_flow(); + m_cts_high_disconnect = true; + (void) app_gpiote_user_enable(m_gpiote_uid); + (void) app_gpiote_pins_state_get(m_gpiote_uid, &pins); + + if (pins) + { + //If second sample show CTS high it either + //1) happened BEFORE gpiote enable and uart should be disabled. + //(m_cts_high_disconnect == true). + //2) happened AFTER gpiote enable and an interrupt low->high has occured then + //uart should NOT be disabled as the ISR has disabled the UART. + //(m_cts_high_disconnect == false). + if (m_cts_high_disconnect == true) + { + m_cts_high_disconnect = false; + uart_peripheral_disable(); + } + } + } + } + else + { + uart_peripheral_connect_flow(); + } + + tx_complete_event_send(); + } + else if (m_tx_state == UART_STALL) + { + if (m_tx_stream_index == m_tx_stream_length) + { + tx_complete_event_send(); + } + else + { + m_tx_pending = true; + } + } + else + { + //Do nothing. + } +} + + +static __INLINE void on_cts_high(void) +{ + if (m_cts_high_disconnect == true) + { + m_cts_high_disconnect = false; + + if (m_rx_state == UART_IDLE && m_tx_state == UART_IDLE) + { + if (m_tx_stream_index == m_tx_stream_length) + { + uart_peripheral_disable(); + } + } + } +} + + +static __INLINE void on_cts_low(void) +{ + m_cts_high_disconnect = false; + (void) app_gpiote_user_disable(m_gpiote_uid); + + if (m_tx_state == UART_STALL) + { + m_tx_pending = true; + } + else if (m_tx_state == UART_TX_LAST_BYTE_WAIT) + { + m_tx_state = UART_TX_COMPLETE; + uart_tx_send(); + } + else if (m_rx_state == UART_IDLE && m_tx_state == UART_IDLE) + { + NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS; + nrf_gpio_cfg_output(SER_PHY_UART_RTS); + uart_peripheral_enable(); + } +} + + +static void uart_rxdrdy_handle(void) +{ + if (m_rx_state == UART_IDLE) + { + m_rx_state = UART_RX; + } + + //Set proper size and buff at the beginning of receiving header + if ((m_rx_stream_header == true) && !m_rx_stream_index) + { + m_rx_stream_length = SER_PHY_HEADER_SIZE; + mp_rx_stream = m_rx_length_buf; + } + + if (mp_rx_stream != NULL) + { + bool tx_dual_end = false; + + NRF_UART0->EVENTS_RXDRDY = 0; + + //Second last byte received. + //Disconnect CTS before pulling the byte and receiving the final byte. + if ((m_rx_stream_header == false) && ((m_rx_stream_index) == (m_rx_stream_length - 2))) + { + nrf_gpio_cfg_output(SER_PHY_UART_RTS); + + //Last byte is waiting for tansmission. Thus dual end TX case. + // + if (m_tx_state == UART_TX_LAST_BYTE_WAIT) + { + m_tx_state = UART_STALL; + (void) app_gpiote_user_disable(m_gpiote_uid); + + //Checking pending state. + //- If pending is true then CTS have become low after we stalled the UART and final byte should be transmitted here. + //- If pending is false we should check if final byte was tranmitted and if not, the do the transmission her. + if ((m_tx_pending == true) || (m_tx_stream_index == (m_tx_stream_length - 1))) + { + tx_dual_end = true; + NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS; + uart_tx_send(); + } + } + + if (!tx_dual_end) + { + NRF_GPIO->OUTCLR = 1 << SER_PHY_UART_RTS; + } + m_tx_state = UART_STALL; + + NRF_UART0->PSELCTS = UART_PIN_DISCONNECTED; + NRF_UART0->PSELRTS = UART_PIN_DISCONNECTED; + NRF_UART0->CONFIG &= ~(UART_CONFIG_HWFC_Enabled << UART_CONFIG_HWFC_Pos); + } + + if (m_rx_stream_index < (m_rx_stream_length - 1)) + { + if (mp_rx_stream != m_rx_drop_buf) + { + mp_rx_stream[m_rx_stream_index++] = NRF_UART0->RXD; + } + else + { + mp_rx_stream[0] = NRF_UART0->RXD; + m_rx_stream_index++; + } + + if (m_tx_stream_index == (m_tx_stream_length - 1)) + { + //Toggle CTS line to indicate ack. + //If CTS is connected to UART this code will have no effect. + //But on edge case on bi-directional last byte transfer this avoids lock-up. + NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS; + nrf_delay_us(4); + NRF_GPIO->OUTCLR = 1 << SER_PHY_UART_RTS; + } + } + else + { + if (m_rx_stream_header == false) + { + NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS; + + if (mp_rx_stream != m_rx_drop_buf) + { + mp_rx_stream[m_rx_stream_index++] = NRF_UART0->RXD; + } + else + { + mp_rx_stream[0] = NRF_UART0->RXD; + m_rx_stream_index++; + } + m_rx_state = UART_IDLE; + + //Last byte of payload received - notify that next transmission will be header + m_rx_stream_header = true; + + //Prepare event + if (mp_rx_stream != m_rx_drop_buf) + { + m_ser_phy_event_rx.evt_type = SER_PHY_EVT_RX_PKT_RECEIVED; + m_ser_phy_event_rx.evt_params.rx_pkt_received.num_of_bytes = m_rx_stream_index; + m_ser_phy_event_rx.evt_params.rx_pkt_received.p_buffer = mp_rx_stream; + } + else + { + m_ser_phy_event_rx.evt_type = SER_PHY_EVT_RX_PKT_DROPPED; + } + + m_rx_stream_length = 0; + m_rx_stream_index = 0; + } + else + { + mp_rx_stream[m_rx_stream_index++] = NRF_UART0->RXD; + + //Last byte of header received - notify that next transmission will be payload + m_rx_stream_header = false; + + mp_rx_stream = NULL; + + //Clear index before receiving payload + m_rx_stream_index = 0; + + //Prepare event + m_rx_stream_length = uint16_decode(m_rx_length_buf); + m_ser_phy_event_rx.evt_type = SER_PHY_EVT_RX_BUF_REQUEST; + m_ser_phy_event_rx.evt_params.rx_buf_request.num_of_bytes = m_rx_stream_length; + } + + //Notify upwards + m_ser_phy_event_handler(m_ser_phy_event_rx); + + //UART TX was stalled while receiving final byte. Restart tx. + if (m_tx_state == UART_STALL) + { + if (m_tx_stream_length == m_tx_stream_index) + { + m_tx_state = UART_IDLE; + } + else if (m_tx_stream_index == (m_tx_stream_length - 1)) + { + m_tx_state = UART_TX_LAST_BYTE_WAIT; + } + else + { + m_tx_state = UART_TX_SEND; + } + + //Critical region for avoiding timing issues in 'simultaneous RX end and TX start' + CRITICAL_REGION_ENTER(); + if (m_tx_pending == true) + { + m_tx_pending = false; + uart_tx_start(); + + if (m_tx_state == UART_TX_SEND) + { + uart_tx_send(); + } + else if (m_tx_state == UART_TX_LAST_BYTE_WAIT) + { + uart_tx_last_byte(); + } + } + CRITICAL_REGION_EXIT(); + + if (m_tx_state == UART_IDLE) + { + uart_peripheral_disable(); + } + } + } + } + else + { + m_rx_state = UART_RX_PENDING; + } +} + + +static __INLINE void uart_error_handle(void) +{ + uint32_t error_source; + + //Clear UART ERROR event flag. + NRF_UART0->EVENTS_ERROR = 0; + + //Clear error source. + error_source = NRF_UART0->ERRORSRC; + NRF_UART0->ERRORSRC = error_source; + + m_ser_phy_event_rx.evt_type = SER_PHY_EVT_HW_ERROR; + m_ser_phy_event_rx.evt_params.hw_error.error_code = error_source; + + m_ser_phy_event_handler(m_ser_phy_event_rx); +} + + +/**@brief Function for handling the GPIOTE event. + * + * @param[in] event_pins_low_to_high Mask telling which pin(s) generated an event from low->high. + * @param[in] event_pins_high_to_low Mask telling which pin(s) generated an event from high->low. + */ +static void gpiote_uart_event_handler(uint32_t event_pins_low_to_high, + uint32_t event_pins_high_to_low) +{ + if ((event_pins_high_to_low & m_pin_cts_mask) != 0) + { + on_cts_low(); + } + + if ((event_pins_low_to_high & m_pin_cts_mask) != 0) + { + on_cts_high(); + } +} + + +/**@brief Function for handling the UART Interrupt. + * + * @details UART interrupt handler to process TX Ready when TXD is available, RX Ready when a byte + * is received, or in case of error when receiving a byte. + */ +void UART0_IRQHandler(void) +{ + //Handle Reception. + if (NRF_UART0->EVENTS_RXDRDY != 0 && (NRF_UART0->INTENSET & UART_INTENSET_RXDRDY_Msk)) + { + uart_rxdrdy_handle(); + } + + //Handle transmission. + if (NRF_UART0->EVENTS_TXDRDY != 0 && (NRF_UART0->INTENSET & UART_INTENSET_TXDRDY_Msk)) + { + uart_txdrdy_handle(); + } + + //Handle errors. + if (NRF_UART0->EVENTS_ERROR != 0 && (NRF_UART0->INTENSET & UART_INTENSET_ERROR_Msk)) + { + uart_error_handle(); + } +} + + +uint32_t ser_phy_open(ser_phy_events_handler_t events_handler) +{ + uint32_t gpiote_pin_low_high_mask = 0; + uint32_t gpiote_pin_high_low_mask = 0; + + if (events_handler == NULL) + { + return NRF_ERROR_NULL; + } + + //Check if function was not called before + if (m_ser_phy_event_handler != NULL) + { + return NRF_ERROR_INVALID_STATE; + } + + //Configure GPIOTE with one user for the UART flow control feature. + APP_GPIOTE_INIT(APP_GPIOTE_MAX_USERS); + + //GPIO Setup + nrf_gpio_cfg_input(SER_PHY_UART_RTS, NRF_GPIO_PIN_NOPULL); + + NRF_GPIO->OUTSET = 1 << SER_PHY_UART_TX; + nrf_gpio_cfg_output(SER_PHY_UART_TX); + + //Setup the gpiote to handle pin events on cts-pin. + //For the UART we want to detect both low->high and high->low transitions in order to + //know when to activate/de-activate the TX/RX in the UART. + //Configure pin. + m_pin_cts_mask = (1 << SER_PHY_UART_CTS); + nrf_gpio_cfg_sense_input(SER_PHY_UART_CTS, + NRF_GPIO_PIN_PULLUP, + NRF_GPIO_PIN_SENSE_LOW); + + nrf_gpio_cfg_sense_input(SER_PHY_UART_RX, + NRF_GPIO_PIN_PULLUP, + NRF_GPIO_PIN_NOSENSE); + + gpiote_pin_low_high_mask = (1 << SER_PHY_UART_CTS); + gpiote_pin_high_low_mask = (1 << SER_PHY_UART_CTS); + + (void)app_gpiote_user_register(&m_gpiote_uid, + gpiote_pin_low_high_mask, + gpiote_pin_high_low_mask, + gpiote_uart_event_handler); + + (void)app_gpiote_user_enable(m_gpiote_uid); + + m_rx_state = UART_IDLE; + m_tx_state = UART_IDLE; + + //Set header flag + m_rx_stream_header = true; + + //UART setup + NRF_UART0->PSELRXD = SER_PHY_UART_RX; + NRF_UART0->PSELTXD = SER_PHY_UART_TX; + NRF_UART0->PSELCTS = UART_PIN_DISCONNECTED; + NRF_UART0->PSELRTS = UART_PIN_DISCONNECTED; + NRF_UART0->BAUDRATE = SER_PHY_UART_BAUDRATE; + NRF_UART0->CONFIG = (UART_CONFIG_HWFC_Enabled << UART_CONFIG_HWFC_Pos); + NRF_UART0->ENABLE = (UART_ENABLE_ENABLE_Disabled << UART_ENABLE_ENABLE_Pos); + + //Enable UART interrupt + NRF_UART0->INTENCLR = 0xFFFFFFFF; + NRF_UART0->INTENSET = (UART_INTENSET_TXDRDY_Set << UART_INTENSET_TXDRDY_Pos) | + (UART_INTENSET_RXDRDY_Set << UART_INTENSET_RXDRDY_Pos) | + (UART_INTENSET_ERROR_Set << UART_INTENSET_ERROR_Pos); + + NVIC_ClearPendingIRQ(UART0_IRQn); + NVIC_SetPriority(UART0_IRQn, APP_IRQ_PRIORITY_LOW); + NVIC_EnableIRQ(UART0_IRQn); + + m_ser_phy_event_handler = events_handler; + + return NRF_SUCCESS; +} + + +void ser_phy_close(void) +{ + //Disable UART interrupt. + NRF_UART0->INTENCLR = 0xFFFFFFFF; + + //Unregister callback. + m_ser_phy_event_handler = NULL; + + //Will not check err_code here as we will still continue with closure of UART despite errors. + //Note that any error will still be reported back in the system. + (void)app_gpiote_user_disable(m_gpiote_uid); + + uart_peripheral_disable(); + + //Clear internal UART states + m_rx_state = UART_IDLE; + m_tx_state = UART_IDLE; + + mp_tx_stream = NULL; + m_tx_stream_length = 0; + m_tx_stream_index = 0; + + mp_rx_stream = NULL; + m_rx_stream_length = 0; + m_rx_stream_index = 0; +} + + +uint32_t ser_phy_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes) +{ + if (p_buffer == NULL) + { + return NRF_ERROR_NULL; + } + + if (num_of_bytes == 0) + { + return NRF_ERROR_INVALID_PARAM; + } + + if (mp_tx_stream != NULL) + { + return NRF_ERROR_BUSY; + } + + m_tx_pending = true; + + (void) uint16_encode(num_of_bytes, m_tx_length_buf); + mp_tx_stream = (uint8_t *)p_buffer; + m_tx_stream_length = num_of_bytes + SER_PHY_HEADER_SIZE; + + //Critical region for avoiding timing issues in 'simultaneous RX end and TX start' + CRITICAL_REGION_ENTER(); + if ((!m_rx_stream_length) || (m_rx_stream_index < (m_rx_stream_length - 2))) + { + if (m_tx_state != UART_STALL) + { + if (m_tx_pending == true) + { + m_tx_pending = false; + uart_tx_start(); + //As no tx can be ongoing, then it is safe to call tx_send here. + uart_tx_send(); + } + } + } + CRITICAL_REGION_EXIT(); + + return NRF_SUCCESS; +} + + +uint32_t ser_phy_rx_buf_set(uint8_t * p_buffer) +{ + if (m_ser_phy_event_rx.evt_type != SER_PHY_EVT_RX_BUF_REQUEST) + { + return NRF_ERROR_INVALID_STATE; + } + + if (p_buffer != NULL) + { + mp_rx_stream = p_buffer; + } + else + { + mp_rx_stream = m_rx_drop_buf; + } + + return NRF_SUCCESS; +} + + +void ser_phy_interrupts_enable(void) +{ + NVIC_EnableIRQ(UART0_IRQn); +} + + +void ser_phy_interrupts_disable(void) +{ + NVIC_DisableIRQ(UART0_IRQn); +} diff --git a/components/serialization/common/transport/ser_phy/spi_5W_master.c b/components/serialization/common/transport/ser_phy/spi_5W_master.c new file mode 100644 index 0000000..5d48382 --- /dev/null +++ b/components/serialization/common/transport/ser_phy/spi_5W_master.c @@ -0,0 +1,603 @@ +/* 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. + * + */ + +/**@file + * + * @defgroup ser_phy_spi_5W_hw_driver_master spi_5W_master.c + * @{ + * @ingroup ser_phy_spi_5W_hw_driver_master + * + * @brief SPI_5W_RAW hardware driver. + */ + +#include "app_error.h" +#include "app_util_platform.h" +#include "nrf_gpio.h" +#include "nrf.h" +#include "spi_5W_master.h" +#include "ser_config_5W_app.h" +#include "ser_phy_debug_app.h" + + +#define _static + +#define DOUBLE_BUFFERED /**< A flag for enabling double buffering. */ + +#define SPI_PIN_DISCONNECTED 0xFFFFFFFF /**< A value used to the PIN deinitialization. */ +#define SPI_DEFAULT_TX_BYTE 0x00 /**< Default byte (used to clock transmission + from slave to the master) */ + +typedef struct +{ + NRF_SPI_Type * p_nrf_spi; /**< A pointer to the NRF SPI master */ + IRQn_Type irq_type; /**< A type of NVIC IRQn */ + + uint8_t * p_tx_buffer; /**< A pointer to TX buffer. */ + uint16_t tx_length; /**< A length of TX buffer. */ + uint16_t tx_index; /**< A index of the current element in the TX buffer. */ + + uint8_t * p_rx_buffer; /**< A pointer to RX buffer. */ + uint16_t rx_length; /**< A length RX buffer. */ + uint16_t rx_index; /**< A index of the current element in the RX buffer. */ + + uint16_t max_length; /**< Max length (Max of the TX and RX length). */ + uint16_t bytes_count; + uint8_t pin_slave_select; /**< A pin for Slave Select. */ + + spi_master_event_handler_t callback_event_handler; /**< A handler for event callback function. */ + spi_master_state_t state; /**< A state of an instance of SPI master. */ + bool start_flag; + bool abort_flag; + +} spi_master_instance_t; + +#ifdef _SPI_5W_ +typedef enum +{ + HOOK_STATE_DISABLED, + HOOK_STATE_IDLE, + HOOK_STATE_GUARDED, + HOOK_STATE_ABORTED, + HOOK_STATE_RESTARTED, + HOOK_STATE_PASSING +} spi_hook_state_t; + + +_static spi_master_event_handler_t m_ser_phy_event_handler; +_static spi_master_hw_instance_t m_spi_master_hw_instance; +_static spi_hook_state_t m_hook_state = HOOK_STATE_DISABLED; +#endif + +#ifdef SER_PHY_DEBUG_APP_ENABLE +_static spi_master_raw_callback_t m_debug_callback; +#endif + +_static spi_master_instance_t m_spi_master_instances[SPI_MASTER_HW_ENABLED_COUNT]; + +static __INLINE spi_master_instance_t * spi_master_get_instance( + const spi_master_hw_instance_t spi_master_hw_instance); +static __INLINE void spi_master_send_recv_irq(spi_master_instance_t * const p_spi_instance); +static __INLINE void spi_master_signal_evt(spi_master_instance_t * const p_spi_instance, + spi_master_evt_type_t event_type, + const uint16_t data); + +#ifdef SPI_MASTER_0_ENABLE +/** + * @brief SPI0 interrupt handler. + */ +void SPI0_TWI0_IRQHandler(void) +{ + if (NRF_SPI0->EVENTS_READY != 0) + { + NRF_SPI0->EVENTS_READY = 0; + + spi_master_instance_t * p_spi_instance = spi_master_get_instance(SPI_MASTER_0); + + spi_master_send_recv_irq(p_spi_instance); + } +} +#endif //SPI_MASTER_0_ENABLE + +#ifdef SPI_MASTER_1_ENABLE +/** + * @brief SPI0 interrupt handler. + */ +void SPI1_TWI1_IRQHandler(void) +{ + if (NRF_SPI1->EVENTS_READY != 0) + { + NRF_SPI1->EVENTS_READY = 0; + + spi_master_instance_t * p_spi_instance = spi_master_get_instance(SPI_MASTER_1); + + spi_master_send_recv_irq(p_spi_instance); + } +} +#endif //SPI_MASTER_1_ENABLE + +#if defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE) + +/**@brief Function for getting an instance of SPI master. */ +static __INLINE spi_master_instance_t * spi_master_get_instance( + const spi_master_hw_instance_t spi_master_hw_instance) +{ + return &(m_spi_master_instances[(uint8_t)spi_master_hw_instance]); +} + +/** @brief Function for initializing instance of SPI master by default values. */ +static __INLINE void spi_master_init_hw_instance(NRF_SPI_Type * p_nrf_spi, + IRQn_Type irq_type, + spi_master_instance_t * p_spi_instance) +{ + APP_ERROR_CHECK_BOOL(p_spi_instance != NULL); + + p_spi_instance->p_nrf_spi = p_nrf_spi; + p_spi_instance->irq_type = irq_type; + + p_spi_instance->p_tx_buffer = NULL; + p_spi_instance->tx_length = 0; + p_spi_instance->tx_index = 0; + + p_spi_instance->p_rx_buffer = NULL; + p_spi_instance->rx_length = 0; + p_spi_instance->rx_index = 0; + + p_spi_instance->bytes_count = 0; + p_spi_instance->max_length = 0; + p_spi_instance->pin_slave_select = 0; + + p_spi_instance->callback_event_handler = NULL; + + p_spi_instance->state = SPI_MASTER_STATE_DISABLED; + p_spi_instance->abort_flag = false; + p_spi_instance->start_flag = false; +} + +/**@brief Function for initializing TX or RX buffer. */ +static __INLINE void spi_master_buffer_init(uint8_t * const p_buf, + const uint16_t buf_len, + uint8_t * * pp_buf, + uint16_t * const p_buf_len, + uint16_t * const p_index) +{ + APP_ERROR_CHECK_BOOL(pp_buf != NULL); + APP_ERROR_CHECK_BOOL(p_buf_len != NULL); + APP_ERROR_CHECK_BOOL(p_index != NULL); + + *pp_buf = p_buf; + *p_buf_len = (p_buf != NULL) ? buf_len : 0; + *p_index = 0; +} + +/**@brief Function for releasing TX or RX buffer. */ +static __INLINE void spi_master_buffer_release(uint8_t * * const pp_buf, uint16_t * const p_buf_len) +{ + APP_ERROR_CHECK_BOOL(pp_buf != NULL); + APP_ERROR_CHECK_BOOL(p_buf_len != NULL); + + *pp_buf = NULL; + *p_buf_len = 0; +} + +/**@brief Function for sending events by callback. */ +static __INLINE void spi_master_signal_evt(spi_master_instance_t * const p_spi_instance, + spi_master_evt_type_t event_type, + const uint16_t data) +{ + APP_ERROR_CHECK_BOOL(p_spi_instance != NULL); + + if (p_spi_instance->callback_event_handler != NULL) + { + spi_master_evt_t event = {SPI_MASTER_EVT_TYPE_MAX, 0}; + event.type = event_type; + event.data = data; + p_spi_instance->callback_event_handler(event); + } +} + +/**@brief Function insert to a TX buffer another byte or two bytes (depends on flag @ref DOUBLE_BUFFERED). */ +static __INLINE void spi_master_send_initial_bytes(spi_master_instance_t * const p_spi_instance) +{ + APP_ERROR_CHECK_BOOL(p_spi_instance != NULL); + + p_spi_instance->p_nrf_spi->TXD = ((p_spi_instance->p_tx_buffer != NULL) && + (p_spi_instance->tx_index < p_spi_instance->tx_length)) ? + p_spi_instance->p_tx_buffer[p_spi_instance->tx_index] : + SPI_DEFAULT_TX_BYTE; + (p_spi_instance->tx_index)++; + + #ifdef DOUBLE_BUFFERED + + if (p_spi_instance->tx_index < p_spi_instance->max_length) + { + p_spi_instance->p_nrf_spi->TXD = ((p_spi_instance->p_tx_buffer != NULL) && + (p_spi_instance->tx_index < p_spi_instance->tx_length)) ? + p_spi_instance->p_tx_buffer[p_spi_instance->tx_index] : + SPI_DEFAULT_TX_BYTE; + (p_spi_instance->tx_index)++; + } + #endif +} + +/**@brief Function for receiving and sending data from IRQ. (The same for both IRQs). */ +static __INLINE void spi_master_send_recv_irq(spi_master_instance_t * const p_spi_instance) +{ + + uint8_t rx_byte; + + APP_ERROR_CHECK_BOOL(p_spi_instance != NULL); + APP_ERROR_CHECK_BOOL(p_spi_instance->state == SPI_MASTER_STATE_BUSY); + + p_spi_instance->bytes_count++; + rx_byte = p_spi_instance->p_nrf_spi->RXD; + + if (p_spi_instance->start_flag) + { + p_spi_instance->start_flag = false; + spi_master_signal_evt(p_spi_instance, SPI_MASTER_EVT_FIRST_BYTE_RECEIVED, (uint16_t)rx_byte); + } + else if (p_spi_instance->abort_flag ) //this is tricky, but callback for SPI_MASTER_EVT_FIRST_BYTE_RECEIVED will set this flag for a first byte, which is bad because there is still byte in a buffer + { //and for a single byte transaction you will get XFERDONE event to restart + p_spi_instance->abort_flag = false; + p_spi_instance->state = SPI_MASTER_STATE_ABORTED; + nrf_gpio_pin_set(p_spi_instance->pin_slave_select); + spi_master_signal_evt(p_spi_instance, SPI_MASTER_EVT_TRANSFER_ABORTED, 0); + return; + } + + if ((p_spi_instance->p_rx_buffer != NULL) && + (p_spi_instance->rx_index < p_spi_instance->rx_length)) + { + p_spi_instance->p_rx_buffer[p_spi_instance->rx_index++] = rx_byte; + } + + if ((p_spi_instance->tx_index < p_spi_instance->max_length) && (!(p_spi_instance->abort_flag))) //do not TX if you know that there is an abort to be done - this should work for a DOUBLE BUFFERING ??? + { + p_spi_instance->p_nrf_spi->TXD = ((p_spi_instance->p_tx_buffer != NULL) && + (p_spi_instance->tx_index < p_spi_instance->tx_length)) ? + p_spi_instance->p_tx_buffer[p_spi_instance->tx_index] : + SPI_DEFAULT_TX_BYTE; + (p_spi_instance->tx_index)++; + } + + if (p_spi_instance->bytes_count >= p_spi_instance->max_length) + { + APP_ERROR_CHECK_BOOL(p_spi_instance->bytes_count == p_spi_instance->max_length); + nrf_gpio_pin_set(p_spi_instance->pin_slave_select); + p_spi_instance->state = SPI_MASTER_STATE_IDLE; + spi_master_signal_evt(p_spi_instance, + SPI_MASTER_EVT_TRANSFER_COMPLETED, + p_spi_instance->tx_index); + } + return; +} +#endif //defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE) + + +/** + * @brief Function for opening and initializing a SPI master driver. */ +uint32_t spi_master_open(const spi_master_hw_instance_t spi_master_hw_instance, + spi_master_config_t const * const p_spi_master_config) +{ + #if defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE) + + + if (p_spi_master_config == NULL) + { + return NRF_ERROR_NULL; + } + + spi_master_instance_t * p_spi_instance = spi_master_get_instance(spi_master_hw_instance); + + switch (spi_master_hw_instance) + { + #ifdef SPI_MASTER_0_ENABLE + case SPI_MASTER_0: + spi_master_init_hw_instance(NRF_SPI0, SPI0_TWI0_IRQn, p_spi_instance); + break; + #endif //SPI_MASTER_0_ENABLE + + #ifdef SPI_MASTER_1_ENABLE + case SPI_MASTER_1: + spi_master_init_hw_instance(NRF_SPI1, SPI1_TWI1_IRQn, p_spi_instance); + break; + #endif //SPI_MASTER_1_ENABLE + + default: + break; + } + + //A Slave select must be set as high before setting it as output, + //because during connect it to the pin it causes glitches. + nrf_gpio_pin_set(p_spi_master_config->SPI_Pin_SS); + nrf_gpio_cfg_output(p_spi_master_config->SPI_Pin_SS); + nrf_gpio_pin_set(p_spi_master_config->SPI_Pin_SS); + + //Configure GPIO + nrf_gpio_cfg_output(p_spi_master_config->SPI_Pin_SCK); + nrf_gpio_cfg_output(p_spi_master_config->SPI_Pin_MOSI); + nrf_gpio_cfg_input(p_spi_master_config->SPI_Pin_MISO, NRF_GPIO_PIN_NOPULL); + p_spi_instance->pin_slave_select = p_spi_master_config->SPI_Pin_SS; + + /* Configure SPI hardware */ + p_spi_instance->p_nrf_spi->PSELSCK = p_spi_master_config->SPI_Pin_SCK; + p_spi_instance->p_nrf_spi->PSELMOSI = p_spi_master_config->SPI_Pin_MOSI; + p_spi_instance->p_nrf_spi->PSELMISO = p_spi_master_config->SPI_Pin_MISO; + + p_spi_instance->p_nrf_spi->FREQUENCY = p_spi_master_config->SPI_Freq; + + p_spi_instance->p_nrf_spi->CONFIG = + (uint32_t)(p_spi_master_config->SPI_CPHA << SPI_CONFIG_CPHA_Pos) | + (p_spi_master_config->SPI_CPOL << SPI_CONFIG_CPOL_Pos) | + (p_spi_master_config->SPI_ORDER << SPI_CONFIG_ORDER_Pos); + + + /* Clear waiting interrupts and events */ + p_spi_instance->p_nrf_spi->EVENTS_READY = 0; + + NVIC_ClearPendingIRQ(p_spi_instance->irq_type); + NVIC_SetPriority(p_spi_instance->irq_type, APP_IRQ_PRIORITY_MID); + + /* Clear event handler */ + p_spi_instance->callback_event_handler = NULL; + + /* Enable interrupt */ + p_spi_instance->p_nrf_spi->INTENSET = (SPI_INTENSET_READY_Set << SPI_INTENCLR_READY_Pos); + NVIC_EnableIRQ(p_spi_instance->irq_type); + + /* Enable SPI hardware */ + p_spi_instance->p_nrf_spi->ENABLE = (SPI_ENABLE_ENABLE_Enabled << SPI_ENABLE_ENABLE_Pos); + + /* Change state to IDLE */ + p_spi_instance->state = SPI_MASTER_STATE_IDLE; + + return NRF_SUCCESS; + #else + return NRF_ERROR_NOT_SUPPORTED; + #endif +} + +/** + * @brief Function for closing a SPI master driver. + */ +void spi_master_close(const spi_master_hw_instance_t spi_master_hw_instance) +{ + #if defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE) + spi_master_instance_t * p_spi_instance = spi_master_get_instance(spi_master_hw_instance); + + /* Disable interrupt */ + NVIC_ClearPendingIRQ(p_spi_instance->irq_type); + NVIC_DisableIRQ(p_spi_instance->irq_type); + + p_spi_instance->p_nrf_spi->ENABLE = (SPI_ENABLE_ENABLE_Disabled << SPI_ENABLE_ENABLE_Pos); + + /* Disconnect pin slave select */ + nrf_gpio_pin_clear(p_spi_instance->pin_slave_select); + p_spi_instance->pin_slave_select = (uint8_t)0xFF; + + /* Disconnect pins from SPI hardware */ + p_spi_instance->p_nrf_spi->PSELSCK = (uint32_t)SPI_PIN_DISCONNECTED; + p_spi_instance->p_nrf_spi->PSELMOSI = (uint32_t)SPI_PIN_DISCONNECTED; + p_spi_instance->p_nrf_spi->PSELMISO = (uint32_t)SPI_PIN_DISCONNECTED; + + /* Reset to default values */ + spi_master_init_hw_instance(NULL, (IRQn_Type)0, p_spi_instance); + #else + return; + #endif +} + +/** + * @brief Function for getting current state of the SPI master driver. + */ +__INLINE spi_master_state_t spi_master_get_state( + const spi_master_hw_instance_t spi_master_hw_instance) +{ + #if defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE) + spi_master_instance_t * spi_instance = spi_master_get_instance(spi_master_hw_instance); + return spi_instance->state; + #else + return SPI_MASTER_STATE_DISABLED; + #endif +} + +/** + * @brief Function for event handler registration. + */ +__INLINE void spi_master_evt_handler_reg(const spi_master_hw_instance_t spi_master_hw_instance, + spi_master_event_handler_t event_handler) +{ + #if defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE) + spi_master_instance_t * spi_instance = spi_master_get_instance(spi_master_hw_instance); + spi_instance->callback_event_handler = event_handler; + #else + return; + #endif +} + +/** + * @brief Function for transmitting data between SPI master and SPI slave. + */ +uint32_t spi_master_send_recv(const spi_master_hw_instance_t spi_master_hw_instance, + uint8_t * const p_tx_buf, const uint16_t tx_buf_len, + uint8_t * const p_rx_buf, const uint16_t rx_buf_len) +{ + #if defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE) + spi_master_instance_t * p_spi_instance = spi_master_get_instance(spi_master_hw_instance); + + uint32_t err_code = NRF_SUCCESS; + uint16_t max_length = 0; + + if (p_spi_instance->state == SPI_MASTER_STATE_IDLE) + { + NVIC_DisableIRQ(p_spi_instance->irq_type); + + max_length = (rx_buf_len > tx_buf_len) ? rx_buf_len : tx_buf_len; + + if (max_length > 0) + { + p_spi_instance->state = SPI_MASTER_STATE_BUSY; + p_spi_instance->start_flag = true; //abort_flag should set by abort and cleared only by restart + p_spi_instance->bytes_count = 0; + p_spi_instance->max_length = max_length; + spi_master_buffer_release(&(p_spi_instance->p_tx_buffer), &(p_spi_instance->tx_length)); + spi_master_buffer_release(&(p_spi_instance->p_rx_buffer), &(p_spi_instance->rx_length)); + /* Initialize buffers */ + spi_master_buffer_init(p_tx_buf, tx_buf_len, &(p_spi_instance->p_tx_buffer), + &(p_spi_instance->tx_length), &(p_spi_instance->tx_index)); + spi_master_buffer_init(p_rx_buf, rx_buf_len, &(p_spi_instance->p_rx_buffer), + &(p_spi_instance->rx_length), &(p_spi_instance->rx_index)); + nrf_gpio_pin_clear(p_spi_instance->pin_slave_select); + spi_master_send_initial_bytes(p_spi_instance); + spi_master_signal_evt(p_spi_instance, SPI_MASTER_EVT_TRANSFER_STARTED, max_length); + } + else + { + err_code = NRF_ERROR_INVALID_PARAM; + } + + NVIC_EnableIRQ(p_spi_instance->irq_type); + } + else + { + err_code = NRF_ERROR_BUSY; + } + + return err_code; + #else + return NRF_ERROR_NOT_SUPPORTED; + #endif +} + +#ifdef _SPI_5W_ + +/** + * @brief Function for aborting transfer + */ +uint32_t spi_master_abort(const spi_master_hw_instance_t spi_master_hw_instance) +{ + spi_master_instance_t * p_spi_instance = spi_master_get_instance(spi_master_hw_instance); + + NVIC_DisableIRQ(p_spi_instance->irq_type); + + if (p_spi_instance->state == SPI_MASTER_STATE_BUSY) + { + //set_flag - but only when there are events pending + //ignore when in IDLE - must be able to restart a completed transfer + p_spi_instance->abort_flag = true; + } + NVIC_EnableIRQ(p_spi_instance->irq_type); + return NRF_SUCCESS; +} + +/** + * @brief Function for restarting transfer + */ +uint32_t spi_master_restart(const spi_master_hw_instance_t spi_master_hw_instance) +{ + spi_master_instance_t * p_spi_instance = spi_master_get_instance(spi_master_hw_instance); + + NVIC_DisableIRQ(p_spi_instance->irq_type); + spi_master_signal_evt(p_spi_instance, SPI_MASTER_EVT_TRANSFER_RESTARTED, 0); + p_spi_instance->state = SPI_MASTER_STATE_BUSY; + p_spi_instance->bytes_count = 0; + p_spi_instance->tx_index = 0; + p_spi_instance->rx_index = 0; + p_spi_instance->start_flag = true; + p_spi_instance->abort_flag = false; //you should force clearing abort flag - no other way for 1 byte transfer + nrf_gpio_pin_clear(p_spi_instance->pin_slave_select); + spi_master_send_initial_bytes(p_spi_instance); + NVIC_EnableIRQ(p_spi_instance->irq_type); + + return NRF_SUCCESS; +} + +static void spi_5W_master_event_handler(spi_master_evt_t evt) +{ + + switch (m_hook_state) + { + case HOOK_STATE_IDLE: + + if (evt.type == SPI_MASTER_EVT_TRANSFER_STARTED) + { + DEBUG_EVT_SPI_MASTER_RAW_XFER_GUARDED(0); + m_hook_state = HOOK_STATE_GUARDED; + m_ser_phy_event_handler(evt); + } + break; + + case HOOK_STATE_GUARDED: + + if (evt.type == SPI_MASTER_EVT_FIRST_BYTE_RECEIVED) + { + if (evt.data == 0) + { + DEBUG_EVT_SPI_MASTER_RAW_XFER_PASSED(0); + m_hook_state = HOOK_STATE_PASSING; + } + else + { + DEBUG_EVT_SPI_MASTER_RAW_XFER_ABORTED(0); + m_hook_state = HOOK_STATE_ABORTED; + (void)spi_master_abort(m_spi_master_hw_instance); + } + } + break; + + case HOOK_STATE_ABORTED: + + if ((evt.type == SPI_MASTER_EVT_TRANSFER_ABORTED) || + (evt.type == SPI_MASTER_EVT_TRANSFER_COMPLETED)) + { + DEBUG_EVT_SPI_MASTER_RAW_XFER_RESTARTED(0); + m_hook_state = HOOK_STATE_RESTARTED; + (void)spi_master_restart(m_spi_master_hw_instance); + } + break; + + case HOOK_STATE_RESTARTED: + + if (evt.type == SPI_MASTER_EVT_TRANSFER_RESTARTED) + { + DEBUG_EVT_SPI_MASTER_RAW_XFER_GUARDED(0); + m_hook_state = HOOK_STATE_GUARDED; + } + break; + + case HOOK_STATE_PASSING: + + if (evt.type == SPI_MASTER_EVT_TRANSFER_COMPLETED) + { + m_hook_state = HOOK_STATE_IDLE; + m_ser_phy_event_handler(evt); //this is the only way to get a signal from complete transaction + } + break; + + default: + break; + } +} + +void spi_5W_master_evt_handler_reg(const spi_master_hw_instance_t spi_master_hw_instance, + spi_master_event_handler_t event_handler) +{ + m_ser_phy_event_handler = event_handler; + m_spi_master_hw_instance = spi_master_hw_instance; + m_hook_state = HOOK_STATE_IDLE; + spi_master_evt_handler_reg(spi_master_hw_instance, spi_5W_master_event_handler); + return; +} + +#endif + +/** @} */ diff --git a/components/serialization/common/transport/ser_phy/spi_5W_master.h b/components/serialization/common/transport/ser_phy/spi_5W_master.h new file mode 100644 index 0000000..940db8b --- /dev/null +++ b/components/serialization/common/transport/ser_phy/spi_5W_master.h @@ -0,0 +1,170 @@ +/* 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_SPI_MASTER_H +#define APP_SPI_MASTER_H + +#include +#include +#include "boards.h" + +#define _SPI_5W_ + +/**@brief Struct containing configuration parameters of the SPI master. */ +typedef struct +{ + uint32_t SPI_Freq; /**< SPI frequency. */ + uint32_t SPI_Pin_SCK; /**< SCK pin number. */ + uint32_t SPI_Pin_MISO; /**< MISO pin number. */ + uint32_t SPI_Pin_MOSI; /**< MOSI pin number .*/ + uint32_t SPI_Pin_SS; /**< Slave select pin number. */ + uint8_t SPI_ORDER; /**< Bytes order MSBFIRST or LSBFIRST. */ + uint8_t SPI_CPOL; /**< Serial clock polarity ACTIVEHIGH or ACTIVELOW. */ + uint8_t SPI_CPHA; /**< Serial clock phase LEADING or TRAILING. */ + } spi_master_config_t; + +/**@brief SPI master driver events types. */ +typedef enum +{ + SPI_MASTER_EVT_TRANSFER_STARTED = 0, /**< An event indicating that transfer has been started */ + SPI_MASTER_EVT_TRANSFER_COMPLETED, /**< An event indicating that transfer has been completed */ + SPI_MASTER_EVT_TRANSFER_ABORTED, /**< An event indicating that transfer has been aborted */ + SPI_MASTER_EVT_TRANSFER_RESTARTED, /**< An event indicating that transfer has been resumed */ + SPI_MASTER_EVT_FIRST_BYTE_RECEIVED, /**< An event indicating end of one byte transfer */ + SPI_MASTER_EVT_TYPE_MAX /**< Enumeration upper bound. */ +} spi_master_evt_type_t; + +/**@brief Struct containing parameters of the SPI MASTER event */ + typedef struct + { + spi_master_evt_type_t type; /**< Type of an event */ + uint16_t data; /**< event data - context dependent */ + } spi_master_evt_t; + + /**@brief SPI MASTER internal states types. */ + typedef enum + { + SPI_MASTER_STATE_DISABLED, /**< A state indicating that SPI master is disabled. */ + SPI_MASTER_STATE_BUSY, /**< A state indicating that SPI master is sending now. */ + SPI_MASTER_STATE_ABORTED, + SPI_MASTER_STATE_IDLE /**< A state indicating that SPI master is idle now. */ + } spi_master_state_t; + + /**@brief Instances of SPI master module. */ + typedef enum + { + #ifdef SPI_MASTER_0_ENABLE + SPI_MASTER_0, /**< A instance of SPI master 0. */ + #endif + + #ifdef SPI_MASTER_1_ENABLE + SPI_MASTER_1, /**< A instance of SPI master 1. */ + #endif + + SPI_MASTER_HW_ENABLED_COUNT /**< A number of enabled instances of SPI master. */ + } spi_master_hw_instance_t; + +/**@brief Type of generic callback function handler to be used by all SPI MASTER driver events. + * + * @param[in] spi_master_evt SPI MASTER driver event. + */ +typedef void (*spi_master_event_handler_t) (spi_master_evt_t spi_master_evt); + + +/**@brief Function for opening and initializing a SPI master driver. + * + * @note Function initializes SPI master hardware and internal module states, unregister events callback. + * + * @warning If the function has been already called, the function @ref spi_master_close has to be + * called before spi_master_open can be called again. + * + * @param[in] spi_master_hw_instance Instance of SPI master module. + * @param[in] p_spi_master_config Pointer to configuration structure which will be used + * to initialize SPI MASTER hardware. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_INVALID_STATE Operation failure. The function has been already called. + * To call it again the function @ref spi_master_close + * has to be called previously. + * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. + */ +uint32_t spi_master_open(const spi_master_hw_instance_t spi_master_hw_instance, + spi_master_config_t const * const p_spi_master_config); + + +/**@brief Function for closing a SPI MASTER driver. + * + * @note Function disable hardware, reset internal module states and unregister events callback + * function. + * + * @param[in] spi_master_hw_instance A instance of SPI master. + */ +void spi_master_close(const spi_master_hw_instance_t spi_master_hw_instance); + + +/**@brief Function for transferring data between SPI master and SPI slave + * + * @note Function registers buffers pointed by p_tx_buf and p_rx_buf parameters, after that starts transmission. + * Function generates an event of type @ref SPI_MASTER_EVT_TRANSFER_STARTED when transfer has been started + * and @ref SPI_MASTER_EVT_TRANSFER_COMPLETED when transfer has been completed. + * + * @param[in] spi_master_hw_instance Instance of SPI master module. + * @param[in] p_tx_buf Pointer to a transmit buffer. + * @param[in] tx_buf_len Number of octets to the transfer. + * @param[out] p_rx_buf Pointer to a receive buffer. + * @param[in] rx_buf_len Number of octets to be received. + * + * @retval NRF_SUCCESS Operation success. Packet was registered to the transmission + * and event will be send upon transmission completion. + * @retval NRF_ERROR_BUSY Operation failure. Transmitting of a data is in progress. + */ + uint32_t spi_master_send_recv(const spi_master_hw_instance_t spi_master_hw_instance, + uint8_t * const p_tx_buf, const uint16_t tx_buf_len, + uint8_t * const p_rx_buf, const uint16_t rx_buf_len); + + +/**@brief Function for registration event handler. +* +* @note Function registers a event handler to be used by SPI MASTER driver for sending events. +* @ref SPI_MASTER_EVT_TRANSFER_STARTED and @ref SPI_MASTER_EVT_TRANSFER_COMPLETED. +* +* @param[in] spi_master_hw_instance Instance of SPI master module. +* @param[in] event_handler Generic callback function handler to be used +* by all SPI master driver events. +*/ +void spi_master_evt_handler_reg(const spi_master_hw_instance_t spi_master_hw_instance, + spi_master_event_handler_t event_handler); + + +/**@brief Function for getting current state of the SPI master driver. + * + * @note Function gets current state of the SPI master driver. + * + * @param[in] spi_master_hw_instance Instance of SPI master module. + * + * @retval SPI_MASTER_STATE_DISABLED SPI MASTER is disabled. + * @retval SPI_MASTER_STATE_BUSY SPI_MASTER is sending now. + * @retval SPI_MASTER_STATE_IDLE SPI_MASTER is idle now. + */ +spi_master_state_t spi_master_get_state(const spi_master_hw_instance_t spi_master_hw_instance); + +#ifdef _SPI_5W_ + +uint32_t spi_master_abort(const spi_master_hw_instance_t spi_master_hw_instance); + +uint32_t spi_master_restart(const spi_master_hw_instance_t spi_master_hw_instance); + +void spi_5W_master_evt_handler_reg(const spi_master_hw_instance_t spi_master_hw_instance, + spi_master_event_handler_t event_handler); +#endif + +#endif diff --git a/components/serialization/common/transport/ser_phy_debug_comm.h b/components/serialization/common/transport/ser_phy_debug_comm.h new file mode 100644 index 0000000..a694ec3 --- /dev/null +++ b/components/serialization/common/transport/ser_phy_debug_comm.h @@ -0,0 +1,167 @@ +/* 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 SER_PHY_DEBUG_COMM_H__ +#define SER_PHY_DEBUG_COMM_H__ + +#ifndef SER_PHY_HCI_DEBUG_ENABLE + +// empty definitions here +#define DEBUG_EVT_HCI_PHY_EVT_TX_PKT_SENT(data) +#define DEBUG_EVT_HCI_PHY_EVT_BUF_REQUEST(data) +#define DEBUG_EVT_HCI_PHY_EVT_RX_PKT_RECEIVED(data) +#define DEBUG_EVT_HCI_PHY_EVT_RX_PKT_DROPPED(data) +#define DEBUG_EVT_HCI_PHY_EVT_TX_ERROR(data) +#define DEBUG_EVT_SLIP_PACKET_TX(data) +#define DEBUG_EVT_SLIP_ACK_TX(data) +#define DEBUG_EVT_SLIP_PACKET_TXED(data) +#define DEBUG_EVT_SLIP_ACK_TXED(data) +#define DEBUG_EVT_SLIP_PACKET_RXED(data) +#define DEBUG_EVT_SLIP_ACK_RXED(data) +#define DEBUG_EVT_SLIP_ERR_RXED(data) +#define DEBUG_EVT_TIMEOUT(data) +#define DEBUG_HCI_RETX(data) +#define DEBUG_EVT_MAIN_BUSY(data) +#define DEBUG_EVT_TX_REQ(data) + +#else +#include "stdint.h" + +//Low level hardware events +typedef enum +{ + HCI_PHY_EVT_TX_PKT_SENT, + HCI_PHY_EVT_BUF_REQUEST, + HCI_PHY_EVT_RX_PKT_RECEIVED, + HCI_PHY_EVT_RX_PKT_DROPPED, + HCI_PHY_EVT_TX_ERROR, + HCI_SLIP_EVT_PACKET_TX, + HCI_SLIP_EVT_ACK_TX, + HCI_SLIP_EVT_PACKET_TXED, + HCI_SLIP_EVT_ACK_TXED, + HCI_SLIP_EVT_PACKET_RXED, + HCI_SLIP_EVT_ACK_RXED, + HCI_SLIP_EVT_ERR_RXED, + HCI_TIMER_EVT_TIMEOUT, + HCI_RETX, + HCI_MAIN_BUSY, + HCI_TX_REQ, + HCI_PHY_EVT_MAX +} hci_dbg_evt_type_t; + + +//Low level hardware event definition +typedef struct +{ + hci_dbg_evt_type_t evt; + uint32_t data; +} hci_dbg_evt_t; + +typedef void (*hci_dbg_event_handler_t)(hci_dbg_evt_t event); + +void debug_init(hci_dbg_event_handler_t evt_callback); + +void debug_evt(hci_dbg_evt_type_t evt, uint32_t data); + + +#define DEBUG_EVT(event_type, data) \ +do { \ + debug_evt(event_type, data); \ +} while(0); + + +#define DEBUG_EVT_HCI_PHY_EVT_TX_PKT_SENT(data) \ +do { \ + DEBUG_EVT(HCI_PHY_EVT_TX_PKT_SENT, data); \ +} while (0); + + +#define DEBUG_EVT_HCI_PHY_EVT_BUF_REQUEST(data) \ +do { \ + DEBUG_EVT(HCI_PHY_EVT_BUF_REQUEST, data); \ +} while (0); + + +#define DEBUG_EVT_HCI_PHY_EVT_RX_PKT_RECEIVED(data) \ +do { \ + DEBUG_EVT(HCI_PHY_EVT_RX_PKT_RECEIVED, data); \ +} while (0); + + +#define DEBUG_EVT_HCI_PHY_EVT_RX_PKT_DROPPED(data) \ +do { \ + DEBUG_EVT(HCI_PHY_EVT_RX_PKT_DROPPED, data); \ +} while (0); + +#define DEBUG_EVT_HCI_PHY_EVT_TX_ERROR(data) \ +do { \ + DEBUG_EVT(HCI_PHY_EVT_TX_ERROR, data); \ +} while (0); + +#define DEBUG_EVT_SLIP_PACKET_TX(data) \ +do { \ + DEBUG_EVT(HCI_SLIP_EVT_PACKET_TX, data); \ +} while (0); + +#define DEBUG_EVT_SLIP_ACK_TX(data) \ +do { \ + DEBUG_EVT(HCI_SLIP_EVT_ACK_TX, data); \ +} while (0); + +#define DEBUG_EVT_SLIP_PACKET_TXED(data) \ +do { \ + DEBUG_EVT(HCI_SLIP_EVT_PACKET_TXED, data); \ +} while (0); + +#define DEBUG_EVT_SLIP_ACK_TXED(data) \ +do { \ + DEBUG_EVT(HCI_SLIP_EVT_ACK_TXED, data); \ +} while (0); + +#define DEBUG_EVT_SLIP_PACKET_RXED(data) \ +do { \ + DEBUG_EVT(HCI_SLIP_EVT_PACKET_RXED, data); \ +} while (0); + +#define DEBUG_EVT_SLIP_ACK_RXED(data) \ +do { \ + DEBUG_EVT(HCI_SLIP_EVT_ACK_RXED, data); \ +} while (0); + +#define DEBUG_EVT_SLIP_ERR_RXED(data) \ +do { \ + DEBUG_EVT(HCI_SLIP_EVT_ERR_RXED, data); \ +} while (0); + +#define DEBUG_EVT_TIMEOUT(data) \ +do { \ + DEBUG_EVT(HCI_TIMER_EVT_TIMEOUT, data); \ +} while (0); + +#define DEBUG_HCI_RETX(data) \ +do { \ + DEBUG_EVT(HCI_RETX, data); \ +} while (0); + +#define DEBUG_EVT_MAIN_BUSY(data) \ +do { \ + DEBUG_EVT(HCI_MAIN_BUSY, data); \ +} while (0); + +#define DEBUG_EVT_TX_REQ(data) \ +do { \ + DEBUG_EVT(HCI_TX_REQ, data); \ +} while (0); + +#endif // SER_PHY_HCI_DEBUG_ENABLE + +#endif // SER_PHY_DEBUG_COMM_H__ diff --git a/components/serialization/connectivity/codecs/common/ble_dtm_conn.h b/components/serialization/connectivity/codecs/common/ble_dtm_conn.h new file mode 100644 index 0000000..a1b47b5 --- /dev/null +++ b/components/serialization/connectivity/codecs/common/ble_dtm_conn.h @@ -0,0 +1,77 @@ +/* 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 BLE_DTM_CONN_H__ +#define BLE_DTM_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_common_codecs Connectivity common codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_dtm_conn DTM Connectivity command request decoder and command response encoder + * @{ + * @ingroup ser_conn_common_codecs + * + * @brief DTM Connectivity command request decoder and command response encoder + */ + +#include "dtm_uart.h" + +/**@brief Decodes @ref ble_dtm_init command request. + * + * @sa @ref nrf51_dtm_init_encoding_sec for packet format, + * @ref ble_dtm_init_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of request packet. + * @param[in] p_comm_params Pointer to the structure with DTM Uart configuration. + + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_dtm_init_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + app_uart_stream_comm_params_t * p_comm_params); + + +/**@brief Encodes @ref ble_dtm_init command response. + * + * @sa @ref nrf51_dtm_init_encoding_sec for packet format. + * @ref ble_dtm_init_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_dtm_init_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** @} */ +#endif // BLE_DTM_CONN_H__ + diff --git a/components/serialization/connectivity/codecs/common/ble_dtm_init.c b/components/serialization/connectivity/codecs/common/ble_dtm_init.c new file mode 100644 index 0000000..0af4f99 --- /dev/null +++ b/components/serialization/connectivity/codecs/common/ble_dtm_init.c @@ -0,0 +1,56 @@ +/* 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 "ble_dtm_conn.h" +#include "dtm_uart.h" +#include "nrf_error.h" +#include "ble_serialization.h" + +uint32_t ble_dtm_init_req_dec(uint8_t const * const p_buf, uint16_t packet_len, + app_uart_stream_comm_params_t * p_comm_params) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_comm_params); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint8_t_dec(p_buf, packet_len, &index, &p_comm_params->tx_pin_no); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, packet_len, &index, &p_comm_params->rx_pin_no); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, packet_len, &index, &p_comm_params->baud_rate); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT(index == packet_len, NRF_ERROR_INVALID_LENGTH); + + return err_code; +} + +uint32_t ble_dtm_init_rsp_enc(uint32_t return_code, uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint32_t_enc(&return_code, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/common/conn_mw.c b/components/serialization/connectivity/codecs/common/conn_mw.c new file mode 100644 index 0000000..9fcd291 --- /dev/null +++ b/components/serialization/connectivity/codecs/common/conn_mw.c @@ -0,0 +1,84 @@ +/* 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 + +#include "ble_serialization.h" +#include "nrf_soc.h" +#include "ble.h" +#include "ble_l2cap.h" +#include "ble_gap.h" +#include "ble_gattc.h" +#include "ble_gatts.h" + +/**@brief Connectivity middleware handler type. */ +typedef uint32_t (*conn_mw_handler_t)(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Connectivity middleware item. */ +typedef struct +{ + uint8_t opcode; /**< Opcode by which specific codec is identified */ + conn_mw_handler_t fp_handler; /**< Function pointer to handler associated with given opcode */ +} conn_mw_item_t; + +/* Include handlers for given softdevice */ +#include "conn_mw_items.c" + +/**@brief Number of registered connectivity middleware handlers. */ +static const uint32_t conn_mw_item_len = sizeof (conn_mw_item) / sizeof (conn_mw_item[0]); + +/**@brief Local function for finding connectivity middleware handler in the table.. */ +static conn_mw_handler_t conn_mw_handler_get(uint8_t opcode) +{ + conn_mw_handler_t fp_handler = NULL; + uint32_t i; + + for (i = 0; i < conn_mw_item_len; i++) + { + if (opcode == conn_mw_item[i].opcode) + { + fp_handler = conn_mw_item[i].fp_handler; + break; + } + } + + return fp_handler; +} + +uint32_t conn_mw_handler(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + conn_mw_handler_t fp_handler; + uint32_t err_code = NRF_SUCCESS; + uint8_t opcode = p_rx_buf[SER_CMD_OP_CODE_POS]; + + fp_handler = conn_mw_handler_get(opcode); + + if (fp_handler) + { + err_code = fp_handler(p_rx_buf, rx_buf_len, p_tx_buf, p_tx_buf_len); + } + else + { + err_code = NRF_ERROR_NOT_SUPPORTED; + } + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/common/conn_mw.h b/components/serialization/connectivity/codecs/common/conn_mw.h new file mode 100644 index 0000000..378a96f --- /dev/null +++ b/components/serialization/connectivity/codecs/common/conn_mw.h @@ -0,0 +1,38 @@ +/* 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 _CONN_MW_H +#define _CONN_MW_H + +#include + +/**@brief Connectivity Middleware dispatcher function + * + * @details It will handle decode the opcode from RX buffer and based on the opcode it will search + * for registered handler. Handler is called once it is found. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + * @retval NRF_ERROR_NOT_SUPPORTED Handler failure. Opcode not supported. + */ +uint32_t conn_mw_handler (uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); +#endif //_CONN_MW_H diff --git a/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble.c b/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble.c new file mode 100644 index 0000000..5a9de37 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble.c @@ -0,0 +1,287 @@ +/* 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 "ble_conn.h" +#include "conn_mw_ble.h" +#include "ble_serialization.h" +#include "conn_ble_user_mem.h" + +extern ser_ble_user_mem_t m_conn_user_mem_table[]; + +uint32_t conn_mw_ble_tx_buffer_count_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint8_t count; + uint8_t * p_count = &count; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_tx_buffer_count_get_req_dec(p_rx_buf, rx_buf_len, &p_count); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_tx_buffer_count_get(p_count); + + err_code = ble_tx_buffer_count_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_count); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_uuid_vs_add(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + ble_uuid128_t uuid; + ble_uuid128_t * p_uuid = &uuid; + uint8_t uuid_type; + uint8_t * p_uuid_type = &uuid_type; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_uuid_vs_add_req_dec(p_rx_buf, rx_buf_len, &p_uuid, &p_uuid_type); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_uuid_vs_add(p_uuid, p_uuid_type); + + err_code = ble_uuid_vs_add_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_uuid_type); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + return err_code; +} + +uint32_t conn_mw_ble_uuid_decode(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint8_t raw_uuid[16]; + uint8_t uuid_len = sizeof (raw_uuid); + uint8_t * p_raw_uuid = raw_uuid; + ble_uuid_t uuid; + ble_uuid_t * p_uuid = &uuid; + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_uuid_decode_req_dec(p_rx_buf, rx_buf_len, &uuid_len, &p_raw_uuid, &p_uuid); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_uuid_decode(uuid_len, p_raw_uuid, p_uuid); + + err_code = ble_uuid_decode_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_uuid); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_uuid_encode(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint8_t raw_uuid[16]; + uint8_t uuid_len = sizeof (raw_uuid); + uint8_t * p_uuid_len = &uuid_len; + uint8_t * p_raw_uuid = raw_uuid; + ble_uuid_t uuid; + ble_uuid_t * p_uuid = &uuid; + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_uuid_encode_req_dec(p_rx_buf, rx_buf_len, &p_uuid, &p_uuid_len, &p_raw_uuid); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_uuid_encode(p_uuid, p_uuid_len, p_raw_uuid); + + err_code = ble_uuid_encode_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, uuid_len, p_raw_uuid); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_version_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + ble_version_t version; + ble_version_t * p_version = &version; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_version_get_req_dec(p_rx_buf, rx_buf_len, &p_version); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_version_get(p_version); + + err_code = ble_version_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_version); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_enable(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + ble_enable_params_t params; + ble_enable_params_t * p_params = ¶ms; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_enable_req_dec(p_rx_buf, rx_buf_len, &p_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_enable(p_params); + + err_code = ble_enable_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_opt_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t opt_id; + ble_opt_t opt; + ble_opt_t *p_opt = &opt; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_opt_get_req_dec(p_rx_buf, rx_buf_len, &opt_id, &p_opt); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_opt_get(opt_id, p_opt); + + err_code = ble_opt_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, opt_id, p_opt); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_opt_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t opt_id = 0xFFFFFFFF; + uint16_t act_latency; + uint8_t passkey[BLE_GAP_PASSKEY_LEN]; + ble_gap_irk_t irk = {{0}}; + uint32_t err_code = NRF_SUCCESS; + + /* Pre-decode type of ble_opt_t union */ + err_code = ble_opt_id_pre_dec(p_rx_buf, rx_buf_len, &opt_id); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + ble_opt_t opt; + ble_opt_t *p_opt = &opt; + /* Initialaize appropriate pointers inside opt union based on opt_id */ + switch(opt_id) + { + case BLE_GAP_OPT_LOCAL_CONN_LATENCY: + opt.gap_opt.local_conn_latency.p_actual_latency = &act_latency; + break; + case BLE_GAP_OPT_PASSKEY: + opt.gap_opt.passkey.p_passkey = passkey; + break; + case BLE_GAP_OPT_PRIVACY: + opt.gap_opt.privacy.p_irk = &irk; + break; + } + + uint32_t sd_err_code; + + err_code = ble_opt_set_req_dec(p_rx_buf, rx_buf_len, &opt_id, &p_opt); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_opt_set(opt_id, p_opt); + + err_code = ble_opt_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_user_mem_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t * p_conn_handle; + ble_user_mem_block_t * p_mem_block; + uint32_t err_code = NRF_SUCCESS; + uint32_t user_mem_tab_index; + + /* Allocate user memory context for SoftDevice */ + err_code = conn_ble_user_mem_context_create(&user_mem_tab_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_conn_handle = &(m_conn_user_mem_table[user_mem_tab_index].conn_handle); + p_mem_block = &(m_conn_user_mem_table[user_mem_tab_index].mem_block); + + uint32_t sd_err_code; + + err_code = ble_user_mem_reply_req_dec(p_rx_buf, rx_buf_len, p_conn_handle, &p_mem_block); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_user_mem_reply(*p_conn_handle, p_mem_block); + + err_code = ble_user_mem_reply_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble.h b/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble.h new file mode 100644 index 0000000..d4eba18 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble.h @@ -0,0 +1,178 @@ +/* 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 _CONN_MW_BLE_H +#define _CONN_MW_BLE_H + +#include + +/**@brief Handles @ref sd_ble_tx_buffer_count_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_tx_buffer_count_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_uuid_vs_add command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_uuid_vs_add(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_uuid_decode command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_uuid_decode(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_uuid_encode command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_uuid_encode(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_version_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_version_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_enable command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_enable(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_opt_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_opt_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_opt_set command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_opt_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_user_mem_reply command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_user_mem_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); +#endif //_CONN_MW_BLE_H diff --git a/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_gap.c b/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_gap.c new file mode 100644 index 0000000..06ce2ad --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_gap.c @@ -0,0 +1,831 @@ +/* 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 "ble_gap_conn.h" +#include "conn_mw_ble_gap.h" +#include "ble_serialization.h" +#include "ser_config.h" +#include "conn_ble_gap_sec_keys.h" + +extern ser_ble_gap_conn_keyset_t m_conn_keys_table[SER_MAX_CONNECTIONS]; + +uint32_t conn_mw_ble_gap_address_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint8_t addr_cycle_mode; + + ble_gap_addr_t addr; + ble_gap_addr_t * p_addr = &addr; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_address_set_req_dec(p_rx_buf, rx_buf_len, &addr_cycle_mode, &p_addr); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_address_set(addr_cycle_mode, p_addr); + + err_code = ble_gap_address_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_connect(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + ble_gap_addr_t addr; + ble_gap_addr_t * p_addr = &addr; + + ble_gap_addr_t * pp_addr_tab[BLE_GAP_WHITELIST_ADDR_MAX_COUNT]; + ble_gap_irk_t * pp_irk_tab[BLE_GAP_WHITELIST_IRK_MAX_COUNT]; + + ble_gap_whitelist_t whitelist; + whitelist.addr_count = BLE_GAP_WHITELIST_ADDR_MAX_COUNT; + whitelist.pp_addrs = pp_addr_tab; + whitelist.irk_count = BLE_GAP_WHITELIST_IRK_MAX_COUNT; + whitelist.pp_irks = pp_irk_tab; + + ble_gap_scan_params_t scan_params; + scan_params.p_whitelist = &whitelist; + ble_gap_scan_params_t * p_scan_params = &scan_params; + + ble_gap_conn_params_t conn_params; + ble_gap_conn_params_t * p_conn_params = &conn_params; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_connect_req_dec(p_rx_buf, rx_buf_len, &p_addr, &p_scan_params, &p_conn_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_connect(p_addr, p_scan_params, p_conn_params); + + err_code = ble_gap_connect_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_connect_cancel(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + sd_err_code = sd_ble_gap_connect_cancel(); + + err_code = ble_gap_connect_cancel_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_address_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + ble_gap_addr_t addr; + ble_gap_addr_t * p_addr = &addr; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_address_get_req_dec(p_rx_buf, rx_buf_len, &p_addr); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_address_get(p_addr); + + err_code = ble_gap_address_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_addr); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_adv_data_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint8_t data[BLE_GAP_ADV_MAX_SIZE]; + uint8_t * p_data = data; + uint8_t dlen = sizeof (data); + + uint8_t sr_data[BLE_GAP_ADV_MAX_SIZE]; + uint8_t * p_sr_data = sr_data; + uint8_t srdlen = sizeof (sr_data); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_adv_data_set_req_dec(p_rx_buf, + rx_buf_len, + &p_data, + &dlen, + &p_sr_data, + &srdlen); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_adv_data_set(p_data, dlen, p_sr_data, srdlen); + + err_code = ble_gap_adv_data_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_adv_start(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + ble_gap_addr_t * p_addresses[BLE_GAP_WHITELIST_ADDR_MAX_COUNT]; + ble_gap_addr_t addresses[BLE_GAP_WHITELIST_ADDR_MAX_COUNT]; + ble_gap_irk_t * p_irks[BLE_GAP_WHITELIST_IRK_MAX_COUNT]; + ble_gap_irk_t irks[BLE_GAP_WHITELIST_IRK_MAX_COUNT]; + ble_gap_addr_t peer_addr; + ble_gap_whitelist_t whitelist; + ble_gap_adv_params_t adv_params; + ble_gap_adv_params_t * p_adv_params; + + uint32_t i = 0; + + for (i = 0; i < BLE_GAP_WHITELIST_ADDR_MAX_COUNT; i++) + { + p_addresses[i] = &(addresses[i]); + } + + for (i = 0; i < BLE_GAP_WHITELIST_IRK_MAX_COUNT; i++) + { + p_irks[i] = &(irks[i]); + } + + whitelist.pp_addrs = &p_addresses[0]; + whitelist.pp_irks = &p_irks[0]; + + adv_params.p_peer_addr = &peer_addr; + adv_params.p_whitelist = &whitelist; + + p_adv_params = &adv_params; + + err_code = ble_gap_adv_start_req_dec(p_rx_buf, rx_buf_len, &p_adv_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_adv_start(p_adv_params); + + err_code = ble_gap_adv_start_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_adv_stop(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + sd_err_code = sd_ble_gap_adv_stop(); + + err_code = ble_gap_adv_stop_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_conn_param_update(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + ble_gap_conn_params_t conn_params; + ble_gap_conn_params_t * p_conn_params = &conn_params; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_conn_param_update_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_conn_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_conn_param_update(conn_handle, p_conn_params); + + err_code = ble_gap_conn_param_update_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_disconnect(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + uint8_t hci_status_code; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_disconnect_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &hci_status_code); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_disconnect(conn_handle, hci_status_code); + + err_code = ble_gap_disconnect_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_tx_power_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + int8_t tx_power; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_tx_power_set_req_dec(p_rx_buf, rx_buf_len, &tx_power); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_tx_power_set(tx_power); + + err_code = ble_gap_tx_power_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_appearance_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t appearance; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_appearance_set_req_dec(p_rx_buf, rx_buf_len, &appearance); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_appearance_set(appearance); + + err_code = ble_gap_appearance_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_appearance_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t appearance; + uint16_t * p_appearance = &appearance; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_appearance_get_req_dec(p_rx_buf, rx_buf_len, &p_appearance); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_appearance_get(p_appearance); + + err_code = ble_gap_appearance_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_appearance); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + + +uint32_t conn_mw_ble_gap_ppcp_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + ble_gap_conn_params_t conn_params; + ble_gap_conn_params_t * p_conn_params = &conn_params; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_ppcp_set_req_dec(p_rx_buf, rx_buf_len, &p_conn_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_ppcp_set(p_conn_params); + + err_code = ble_gap_ppcp_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_ppcp_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + ble_gap_conn_params_t conn_params; + ble_gap_conn_params_t * p_conn_params = &conn_params; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_ppcp_get_req_dec(p_rx_buf, rx_buf_len, &p_conn_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_ppcp_get(p_conn_params); + + err_code = ble_gap_ppcp_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_conn_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + + +uint32_t conn_mw_ble_gap_device_name_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint8_t dev_name[BLE_GAP_DEVNAME_MAX_LEN]; + uint8_t * p_dev_name = dev_name; + + uint16_t len; + uint16_t * p_len = &len; + + err_code = ble_gap_device_name_get_req_dec(p_rx_buf, rx_buf_len, &p_dev_name, &p_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_device_name_get(p_dev_name, p_len); + + err_code = ble_gap_device_name_get_rsp_enc(sd_err_code, p_dev_name, len, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_device_name_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + ble_gap_conn_sec_mode_t write_perm; + ble_gap_conn_sec_mode_t * p_write_perm = &write_perm; + + uint8_t dev_name[BLE_GAP_DEVNAME_MAX_LEN]; + uint8_t * p_dev_name = dev_name; + + uint16_t len = BLE_GAP_DEVNAME_MAX_LEN; + + err_code = ble_gap_device_name_set_req_dec(p_rx_buf, + rx_buf_len, + &p_write_perm, + &p_dev_name, + &len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_device_name_set(p_write_perm, p_dev_name, len); + + err_code = ble_gap_device_name_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_authenticate(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint16_t conn_handle; + + ble_gap_sec_params_t sec_params; + ble_gap_sec_params_t * p_sec_params = &sec_params; + + err_code = ble_gap_authenticate_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_sec_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_authenticate(conn_handle, p_sec_params); + + err_code = ble_gap_authenticate_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_sec_params_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + uint32_t sec_tab_index = 0; + + uint16_t * p_conn_handle; + uint8_t sec_status; + + ble_gap_sec_params_t sec_params; + ble_gap_sec_params_t * p_sec_params = &sec_params; + + // Allocate global security context for soft device + err_code = conn_ble_gap_sec_context_create(&sec_tab_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_conn_handle = &(m_conn_keys_table[sec_tab_index].conn_handle); + + // Set up global structure for command decoder + ble_gap_sec_keyset_t * p_sec_keyset = &(m_conn_keys_table[sec_tab_index].keyset); + + p_sec_keyset->keys_periph.p_enc_key = &(m_conn_keys_table[sec_tab_index].enc_key_periph); + p_sec_keyset->keys_periph.p_id_key = &(m_conn_keys_table[sec_tab_index].id_key_periph); + p_sec_keyset->keys_periph.p_sign_key = &(m_conn_keys_table[sec_tab_index].sign_key_periph); + p_sec_keyset->keys_central.p_enc_key = &(m_conn_keys_table[sec_tab_index].enc_key_central); + p_sec_keyset->keys_central.p_id_key = &(m_conn_keys_table[sec_tab_index].id_key_central); + p_sec_keyset->keys_central.p_sign_key = &(m_conn_keys_table[sec_tab_index].sign_key_central); + + err_code = ble_gap_sec_params_reply_req_dec(p_rx_buf, + rx_buf_len, + p_conn_handle, + &sec_status, + &p_sec_params, + &p_sec_keyset); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_sec_params_reply(*p_conn_handle, sec_status, p_sec_params, p_sec_keyset); + + err_code = ble_gap_sec_params_reply_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_sec_keyset); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_auth_key_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint16_t conn_handle; + uint8_t key_type; + + uint8_t key[BLE_GAP_SEC_KEY_LEN]; + uint8_t * p_key = key; + + err_code = ble_gap_auth_key_reply_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &key_type, &p_key); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_auth_key_reply(conn_handle, key_type, p_key); + + err_code = ble_gap_auth_key_reply_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_sec_info_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint16_t conn_handle; + + ble_gap_enc_info_t enc_info; + ble_gap_enc_info_t * p_enc_info = &enc_info; + + ble_gap_irk_t id_info; + ble_gap_irk_t * p_id_info = &id_info; + + ble_gap_sign_info_t sign_info; + ble_gap_sign_info_t * p_sign_info = &sign_info; + + err_code = ble_gap_sec_info_reply_req_dec(p_rx_buf, + rx_buf_len, + &conn_handle, + &p_enc_info, + &p_id_info, + &p_sign_info); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_sec_info_reply(conn_handle, p_enc_info, p_id_info, p_sign_info); + + err_code = ble_gap_sec_info_reply_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_conn_sec_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint16_t conn_handle; + + ble_gap_conn_sec_t conn_sec; + ble_gap_conn_sec_t * p_conn_sec = &conn_sec; + + err_code = ble_gap_conn_sec_get_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_conn_sec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_conn_sec_get(conn_handle, p_conn_sec); + + err_code = ble_gap_conn_sec_get_rsp_enc(sd_err_code, p_conn_sec, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_rssi_start(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint16_t conn_handle; + uint8_t threshold_dbm; + uint8_t skip_count; + + err_code = ble_gap_rssi_start_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &threshold_dbm, &skip_count); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_rssi_start(conn_handle, threshold_dbm, skip_count); + + err_code = ble_gap_rssi_start_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_rssi_stop(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint16_t conn_handle; + + err_code = ble_gap_rssi_stop_req_dec(p_rx_buf, rx_buf_len, &conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_rssi_stop(conn_handle); + + err_code = ble_gap_rssi_stop_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_encrypt(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint16_t conn_handle; + + ble_gap_master_id_t master_id; + ble_gap_master_id_t *p_master_id = &master_id; + + ble_gap_enc_info_t enc_info; + ble_gap_enc_info_t *p_enc_info = &enc_info; + + err_code = ble_gap_encrypt_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_master_id, &p_enc_info); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_encrypt(conn_handle, p_master_id, p_enc_info); + + err_code = ble_gap_encrypt_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_rssi_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint16_t conn_handle; + int8_t rssi; + int8_t * p_rssi = &rssi; + + err_code = ble_gap_rssi_get_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_rssi); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_rssi_get(conn_handle, p_rssi); + + err_code = ble_gap_rssi_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, rssi); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_scan_start(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + ble_gap_addr_t * pp_addr_tab[BLE_GAP_WHITELIST_ADDR_MAX_COUNT]; + ble_gap_irk_t * pp_irk_tab[BLE_GAP_WHITELIST_IRK_MAX_COUNT]; + + ble_gap_whitelist_t whitelist; + whitelist.addr_count = BLE_GAP_WHITELIST_ADDR_MAX_COUNT; + whitelist.pp_addrs = pp_addr_tab; + whitelist.irk_count = BLE_GAP_WHITELIST_IRK_MAX_COUNT; + whitelist.pp_irks = pp_irk_tab; + + ble_gap_scan_params_t scan_params; + scan_params.p_whitelist = &whitelist; + ble_gap_scan_params_t * p_scan_params = &scan_params; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_scan_start_req_dec(p_rx_buf, rx_buf_len, &p_scan_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_scan_start(p_scan_params); + + err_code = ble_gap_scan_start_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_scan_stop(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + sd_err_code = sd_ble_gap_scan_stop(); + + err_code = ble_gap_scan_stop_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + diff --git a/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_gap.h b/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_gap.h new file mode 100644 index 0000000..2aad67a --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_gap.h @@ -0,0 +1,504 @@ +/* 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 _CONN_MW_BLE_GAP_H +#define _CONN_MW_BLE_GAP_H + +#include + +/**@brief Handles @ref sd_ble_gap_address_set command request and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_address_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_address_get command request and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_address_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_adv_data_set command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_adv_data_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_adv_start command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_adv_start(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_adv_stop command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_adv_stop(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_conn_param_update command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_conn_param_update(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_disconnect command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_disconnect(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_tx_power_set command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_tx_power_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_appearance_set command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_appearance_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_appearance_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_appearance_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_ppcp_set command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_ppcp_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_ppcp_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_ppcp_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_device_name_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_device_name_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_device_name_set command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_device_name_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_authenticate command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_authenticate(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_sec_params_reply command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_sec_params_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_auth_key_reply command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_auth_key_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_sec_info_reply command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_sec_info_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_conn_sec_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_conn_sec_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_rssi_start command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_rssi_start(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_rssi_stop command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_rssi_stop(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_rssi_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_rssi_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_connect command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_connect(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_connect_cancel command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_connect_cancel(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_encrypt command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ + +uint32_t conn_mw_ble_gap_encrypt(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_scan_start command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_scan_start(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_scan_stop command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_scan_stop(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +#endif //_CONN_MW_BLE_GAP_H diff --git a/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_gattc.c b/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_gattc.c new file mode 100644 index 0000000..d41ac4d --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_gattc.c @@ -0,0 +1,293 @@ +/* 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 "ble_gattc_conn.h" +#include "conn_mw_ble_gattc.h" +#include "ble_serialization.h" + +uint32_t conn_mw_ble_gattc_primary_services_discover(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + uint16_t start_handle; + ble_uuid_t srvc_uuid; + ble_uuid_t * p_srvc_uuid = &srvc_uuid; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gattc_primary_services_discover_req_dec(p_rx_buf, + rx_buf_len, + &conn_handle, + &start_handle, + &p_srvc_uuid); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gattc_primary_services_discover(conn_handle, start_handle, p_srvc_uuid); + + err_code = ble_gattc_primary_services_discover_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gattc_relationships_discover(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + ble_gattc_handle_range_t handle_range; + ble_gattc_handle_range_t * p_handle_range = &handle_range; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gattc_relationships_discover_req_dec(p_rx_buf, rx_buf_len, + &conn_handle, &p_handle_range); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gattc_relationships_discover(conn_handle, p_handle_range); + + err_code = ble_gattc_relationships_discover_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gattc_characteristics_discover(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + ble_gattc_handle_range_t handle_range; + ble_gattc_handle_range_t * p_handle_range = &handle_range; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gattc_characteristics_discover_req_dec(p_rx_buf, rx_buf_len, + &conn_handle, &p_handle_range); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gattc_characteristics_discover(conn_handle, p_handle_range); + + err_code = ble_gattc_characteristics_discover_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gattc_descriptors_discover(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + ble_gattc_handle_range_t handle_range; + ble_gattc_handle_range_t * p_handle_range = &handle_range; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gattc_descriptors_discover_req_dec(p_rx_buf, rx_buf_len, + &conn_handle, &p_handle_range); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gattc_descriptors_discover(conn_handle, p_handle_range); + + err_code = ble_gattc_descriptors_discover_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gattc_char_value_by_uuid_read(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + + ble_uuid_t uuid = {0}; + ble_uuid_t * p_uuid = &uuid; + + ble_gattc_handle_range_t handle_range; + ble_gattc_handle_range_t * p_handle_range = &handle_range; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gattc_char_value_by_uuid_read_req_dec(p_rx_buf, rx_buf_len, + &conn_handle, &p_uuid, &p_handle_range); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gattc_char_value_by_uuid_read(conn_handle, p_uuid, p_handle_range); + + err_code = ble_gattc_char_value_by_uuid_read_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gattc_read(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + uint16_t * p_conn_handle = &conn_handle; + + uint16_t handle; + uint16_t * p_handle = &handle; + + uint16_t offset; + uint16_t * p_offset = &offset; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gattc_read_req_dec(p_rx_buf, rx_buf_len, p_conn_handle, p_handle, p_offset); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gattc_read(conn_handle, handle, offset); + + err_code = ble_gattc_read_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gattc_char_values_read(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + uint16_t * p_conn_handle = &conn_handle; + + uint16_t handles[BLE_GATTC_HANDLE_COUNT_LEN_MAX]; + uint16_t * p_handles = handles; + + uint16_t handle_count = BLE_GATTC_HANDLE_COUNT_LEN_MAX; + uint16_t * p_handle_count = &handle_count; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gattc_char_values_read_req_dec(p_rx_buf, + rx_buf_len, + p_conn_handle, + &p_handles, + p_handle_count); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gattc_char_values_read(conn_handle, p_handles, handle_count); + + err_code = ble_gattc_char_values_read_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gattc_write(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + uint16_t * p_conn_handle = &conn_handle; + + uint8_t value[BLE_GATTC_WRITE_P_VALUE_LEN_MAX]; + + ble_gattc_write_params_t write_params = {0}; + ble_gattc_write_params_t * p_write_params = &write_params; + + p_write_params->len = BLE_GATTC_WRITE_P_VALUE_LEN_MAX; + p_write_params->p_value = value; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gattc_write_req_dec(p_rx_buf, rx_buf_len, p_conn_handle, &p_write_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gattc_write(conn_handle, p_write_params); + + err_code = ble_gattc_write_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gattc_hv_confirm(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint16_t conn_handle; + uint16_t * p_conn_handle = &conn_handle; + + uint16_t handle; + uint16_t * p_handle = &handle; + + err_code = ble_gattc_hv_confirm_req_dec(p_rx_buf, rx_buf_len, p_conn_handle, p_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gattc_hv_confirm(conn_handle, handle); + + err_code = ble_gattc_hv_confirm_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_gattc.h b/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_gattc.h new file mode 100644 index 0000000..403ae11 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_gattc.h @@ -0,0 +1,180 @@ +/* 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 _CONN_MW_BLE_GATTC_H + #define _CONN_MW_BLE_GATTC_H + +#include + +/**@brief Handles @ref sd_ble_gattc_primary_services_discover command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gattc_primary_services_discover (uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gattc_relationships_discover command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gattc_relationships_discover(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gattc_characteristics_discover command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gattc_characteristics_discover(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gattc_descriptors_discover command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gattc_descriptors_discover(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gattc_char_value_by_uuid_read command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gattc_char_value_by_uuid_read(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gattc_read command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gattc_read (uint8_t const *const rx_buf, + uint32_t rx_buf_len, + uint8_t *const tx_buf, + uint32_t *const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gattc_char_values_read command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gattc_char_values_read (uint8_t const *const rx_buf, + uint32_t rx_buf_len, + uint8_t *const tx_buf, + uint32_t *const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gattc_write command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gattc_write (uint8_t const *const rx_buf, + uint32_t rx_buf_len, + uint8_t *const tx_buf, + uint32_t *const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gattc_hv_confirm command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gattc_hv_confirm (uint8_t const *const rx_buf, + uint32_t rx_buf_len, + uint8_t *const tx_buf, + uint32_t *const p_tx_buf_len); + + +#endif //_CONN_MW_BLE_GATTC_H diff --git a/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_gatts.c b/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_gatts.c new file mode 100644 index 0000000..018c5ce --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_gatts.c @@ -0,0 +1,407 @@ +/* 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 "ble_gatts_conn.h" +#include "conn_mw_ble_gatts.h" +#include "ble_serialization.h" + +uint32_t conn_mw_ble_gatts_service_add(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint8_t type; + ble_uuid_t uuid = {0}; + ble_uuid_t * p_uuid = &uuid; + uint16_t handle; + uint16_t * p_handle = &handle; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_service_add_req_dec(p_rx_buf, rx_buf_len, &type, &p_uuid, &p_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_service_add(type, p_uuid, p_handle); + + err_code = ble_gatts_service_add_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gatts_characteristic_add(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t service_handle; + + //Preparing char_md + ble_gatts_char_md_t char_md; + + uint8_t char_user_desc[BLE_GATTS_VAR_ATTR_LEN_MAX]; + ble_gatts_char_pf_t char_pf; + ble_gatts_attr_md_t user_desc_md; + ble_gatts_attr_md_t cccd_md; + ble_gatts_attr_md_t sccd_md; + + char_md.char_user_desc_size = sizeof (char_user_desc); + char_md.p_char_user_desc = char_user_desc; + char_md.p_char_pf = &char_pf; + char_md.p_user_desc_md = &user_desc_md; + char_md.p_cccd_md = &cccd_md; + char_md.p_sccd_md = &sccd_md; + + ble_gatts_char_md_t * p_char_md = &char_md; + + //Preparing attr_char_value + ble_gatts_attr_t attr_char_value; + ble_uuid_t uuid; + ble_gatts_attr_md_t attr_md; + uint8_t value[BLE_GATTS_VAR_ATTR_LEN_MAX]; + + attr_char_value.p_uuid = &uuid; + attr_char_value.p_attr_md = &attr_md; + attr_char_value.init_len = sizeof (value); + attr_char_value.p_value = value; + + ble_gatts_attr_t * p_attr_char_value = &attr_char_value; + + //Preparing handles + ble_gatts_char_handles_t handles; + ble_gatts_char_handles_t * p_handles = &handles; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_characteristic_add_req_dec(p_rx_buf, rx_buf_len, &service_handle, + &p_char_md, &p_attr_char_value, &p_handles); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_characteristic_add(service_handle, p_char_md, + p_attr_char_value, p_handles); + + err_code = ble_gatts_characteristic_add_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, + p_handles); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; + +} + +uint32_t conn_mw_ble_gatts_include_add(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t service_handle; + uint16_t inc_srvc_handle; + uint16_t handle; + uint16_t * p_handle = &handle; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_include_add_req_dec(p_rx_buf, rx_buf_len, &service_handle, + &inc_srvc_handle, &p_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_include_add(service_handle, inc_srvc_handle, p_handle); + + err_code = ble_gatts_include_add_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gatts_descriptor_add(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t char_handle; + uint8_t attr_value[BLE_GATTS_VAR_ATTR_LEN_MAX]; + ble_uuid_t char_uuid; + ble_gatts_attr_md_t metadata; + ble_gatts_attr_t attr; + ble_gatts_attr_t * p_attr = &attr; + + attr.p_uuid = &char_uuid; + attr.p_attr_md = &metadata; + attr.p_value = attr_value; + attr.init_len = sizeof (attr_value); + + uint16_t handle; + uint16_t * p_handle = &handle; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_descriptor_add_req_dec(p_rx_buf, rx_buf_len, &char_handle, &p_attr, + &p_handle); + + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_descriptor_add(char_handle, p_attr, p_handle); + + err_code = ble_gatts_descriptor_add_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gatts_value_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + uint16_t handle; + uint8_t attr_val_table[BLE_GATTS_VAR_ATTR_LEN_MAX]; + ble_gatts_value_t attr_val = + { + .len = sizeof (attr_val_table), + .offset = 0, + .p_value = attr_val_table + }; + ble_gatts_value_t * p_attr_val = &attr_val; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_value_set_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &handle, &p_attr_val); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_value_set(conn_handle, handle, p_attr_val); + + err_code = ble_gatts_value_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_attr_val); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gatts_value_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + uint16_t handle; + uint8_t val[BLE_GATTS_VAR_ATTR_LEN_MAX]; + ble_gatts_value_t attr_value; + ble_gatts_value_t * p_attr_value = &attr_value; + + attr_value.p_value = val; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_value_get_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &handle, &p_attr_value); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_value_get(conn_handle, handle, p_attr_value); + + err_code = ble_gatts_value_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_attr_value); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gatts_hvx(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + uint8_t data[BLE_GATTS_VAR_ATTR_LEN_MAX]; + uint8_t * p_data = data; + uint16_t len = sizeof data; + uint16_t * p_len = &len; + + ble_gatts_hvx_params_t hvx_params; + ble_gatts_hvx_params_t * p_hvx_params = &hvx_params; + + hvx_params.p_len = p_len; + hvx_params.p_data = p_data; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_hvx_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_hvx_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + sd_err_code = sd_ble_gatts_hvx(conn_handle, p_hvx_params); + + p_len = (p_hvx_params) ? p_hvx_params->p_len : NULL; + err_code = ble_gatts_hvx_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gatts_service_changed(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + uint16_t start_handle; + uint16_t end_handle; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_service_changed_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &start_handle, + &end_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_service_changed(conn_handle, start_handle, end_handle); + + err_code = ble_gatts_service_changed_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gatts_rw_authorize_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + + uint8_t data[BLE_GATTS_VAR_ATTR_LEN_MAX]; + ble_gatts_rw_authorize_reply_params_t auth_params; + ble_gatts_rw_authorize_reply_params_t * p_auth_params = &auth_params; + + auth_params.params.read.p_data = data; + auth_params.params.read.len = sizeof (data); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_rw_authorize_reply_req_dec(p_rx_buf, rx_buf_len, &conn_handle, + &p_auth_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_rw_authorize_reply(conn_handle, p_auth_params); + + err_code = ble_gatts_rw_authorize_reply_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gatts_sys_attr_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + + uint8_t sys_attr[BLE_GATTS_VAR_ATTR_LEN_MAX]; + + uint8_t * p_sys_attr = sys_attr; + uint16_t sys_attr_len = sizeof (sys_attr); + + uint32_t flags; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_sys_attr_set_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_sys_attr, + &sys_attr_len, &flags); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_sys_attr_set(conn_handle, p_sys_attr, sys_attr_len, flags); + + err_code = ble_gatts_sys_attr_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gatts_sys_attr_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + + uint8_t sys_attr[BLE_GATTS_VAR_ATTR_LEN_MAX]; + + uint8_t * p_sys_attr = sys_attr; + uint16_t sys_attr_len = sizeof (sys_attr); + uint16_t * p_sys_attr_len = &sys_attr_len; + + uint32_t flags; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_sys_attr_get_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_sys_attr, + &p_sys_attr_len, &flags); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_sys_attr_get(conn_handle, p_sys_attr, p_sys_attr_len, flags); + + err_code = ble_gatts_sys_attr_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_sys_attr, + p_sys_attr_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_gatts.h b/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_gatts.h new file mode 100644 index 0000000..d61865a --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_gatts.h @@ -0,0 +1,216 @@ +/* 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 _CONN_MW_BLE_GATTS_H +#define _CONN_MW_BLE_GATTS_H + +#include + +/**@brief Handles @ref sd_ble_gatts_service_add command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_service_add (uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gatts_characteristic_add command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_characteristic_add(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref conn_mw_ble_gatts_include_add command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_include_add (uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref conn_mw_ble_gatts_descriptor_add command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_descriptor_add(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref conn_mw_ble_gatts_value_set command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_value_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref conn_mw_ble_gatts_value_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_value_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref conn_mw_ble_gatts_hvx command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_hvx(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref conn_mw_ble_gatts_service_changed command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_service_changed(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref conn_mw_ble_gatts_rw_authorize_reply command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_rw_authorize_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref conn_mw_ble_gatts_sys_attr_set command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_sys_attr_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref conn_mw_ble_gatts_sys_attr_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_sys_attr_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); +#endif //_CONN_MW_BLE_GATTS_H + diff --git a/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_l2cap.c b/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_l2cap.c new file mode 100644 index 0000000..a3134b0 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_l2cap.c @@ -0,0 +1,91 @@ +/* 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 "ble_l2cap_conn.h" +#include "conn_mw_ble_l2cap.h" +#include "ble_serialization.h" + +uint32_t conn_mw_ble_l2cap_cid_register(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t cid; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_l2cap_cid_register_req_dec(p_rx_buf, rx_buf_len, &cid); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_l2cap_cid_register(cid); + + err_code = ble_l2cap_cid_register_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_l2cap_cid_unregister(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t cid; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_l2cap_cid_unregister_req_dec(p_rx_buf, rx_buf_len, &cid); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_l2cap_cid_unregister(cid); + + err_code = ble_l2cap_cid_unregister_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_l2cap_tx(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + ble_l2cap_header_t l2cap_header; + ble_l2cap_header_t * p_l2cap_header = &l2cap_header; + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + uint8_t const * p_data = NULL; + + err_code = ble_l2cap_tx_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_l2cap_header, &p_data); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_l2cap_tx(conn_handle, p_l2cap_header, p_data); + + err_code = ble_l2cap_tx_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_l2cap.h b/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_l2cap.h new file mode 100644 index 0000000..dd6ac2e --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/middleware/conn_mw_ble_l2cap.h @@ -0,0 +1,72 @@ +/* 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 _CONN_MW_BLE_L2CAP_H_ +#define _CONN_MW_BLE_L2CAP_H_ + +#include + +/**@brief Handles @ref sd_ble_l2cap_cid_register command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_l2cap_cid_register(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_l2cap_cid_unregister command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_l2cap_cid_unregister(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_l2cap_tx command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_l2cap_tx(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +#endif diff --git a/components/serialization/connectivity/codecs/s110/middleware/conn_mw_items.c b/components/serialization/connectivity/codecs/s110/middleware/conn_mw_items.c new file mode 100644 index 0000000..65fef73 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/middleware/conn_mw_items.c @@ -0,0 +1,76 @@ +#include "conn_mw_nrf_soc.h" +#include "conn_mw_ble.h" +#include "conn_mw_ble_l2cap.h" +#include "conn_mw_ble_gap.h" +#include "conn_mw_ble_gatts.h" +#include "conn_mw_ble_gattc.h" + +/**@brief Connectivity middleware handlers table. */ +static const conn_mw_item_t conn_mw_item[] = { + //Functions from nrf_soc.h + {SD_POWER_SYSTEM_OFF, conn_mw_power_system_off}, + {SD_TEMP_GET, conn_mw_temp_get}, + //Functions from ble.h + {SD_BLE_TX_BUFFER_COUNT_GET, conn_mw_ble_tx_buffer_count_get}, + {SD_BLE_UUID_VS_ADD, conn_mw_ble_uuid_vs_add}, + {SD_BLE_UUID_DECODE, conn_mw_ble_uuid_decode}, + {SD_BLE_UUID_ENCODE, conn_mw_ble_uuid_encode}, + {SD_BLE_VERSION_GET, conn_mw_ble_version_get}, + {SD_BLE_ENABLE, conn_mw_ble_enable}, + {SD_BLE_OPT_GET, conn_mw_ble_opt_get}, + {SD_BLE_OPT_SET, conn_mw_ble_opt_set}, + {SD_BLE_USER_MEM_REPLY, conn_mw_ble_user_mem_reply}, + //Functions from ble_l2cap.h + {SD_BLE_L2CAP_CID_REGISTER, conn_mw_ble_l2cap_cid_register}, + {SD_BLE_L2CAP_CID_UNREGISTER, conn_mw_ble_l2cap_cid_unregister}, + {SD_BLE_L2CAP_TX, conn_mw_ble_l2cap_tx}, + //Functions from ble_gap.h + {SD_BLE_GAP_ADDRESS_SET, conn_mw_ble_gap_address_set}, + {SD_BLE_GAP_CONNECT, conn_mw_ble_gap_connect}, + {SD_BLE_GAP_CONNECT_CANCEL, conn_mw_ble_gap_connect_cancel}, + {SD_BLE_GAP_ADDRESS_GET, conn_mw_ble_gap_address_get}, + {SD_BLE_GAP_ADV_DATA_SET, conn_mw_ble_gap_adv_data_set}, + {SD_BLE_GAP_ADV_START, conn_mw_ble_gap_adv_start}, + {SD_BLE_GAP_ADV_STOP, conn_mw_ble_gap_adv_stop}, + {SD_BLE_GAP_CONN_PARAM_UPDATE, conn_mw_ble_gap_conn_param_update}, + {SD_BLE_GAP_DISCONNECT, conn_mw_ble_gap_disconnect}, + {SD_BLE_GAP_TX_POWER_SET, conn_mw_ble_gap_tx_power_set}, + {SD_BLE_GAP_APPEARANCE_SET, conn_mw_ble_gap_appearance_set}, + {SD_BLE_GAP_APPEARANCE_GET, conn_mw_ble_gap_appearance_get}, + {SD_BLE_GAP_PPCP_SET, conn_mw_ble_gap_ppcp_set}, + {SD_BLE_GAP_PPCP_GET, conn_mw_ble_gap_ppcp_get}, + {SD_BLE_GAP_DEVICE_NAME_SET, conn_mw_ble_gap_device_name_set}, + {SD_BLE_GAP_DEVICE_NAME_GET, conn_mw_ble_gap_device_name_get}, + {SD_BLE_GAP_AUTHENTICATE, conn_mw_ble_gap_authenticate}, + {SD_BLE_GAP_SEC_PARAMS_REPLY, conn_mw_ble_gap_sec_params_reply}, + {SD_BLE_GAP_AUTH_KEY_REPLY, conn_mw_ble_gap_auth_key_reply}, + {SD_BLE_GAP_SEC_INFO_REPLY, conn_mw_ble_gap_sec_info_reply}, + {SD_BLE_GAP_CONN_SEC_GET, conn_mw_ble_gap_conn_sec_get}, + {SD_BLE_GAP_RSSI_START, conn_mw_ble_gap_rssi_start}, + {SD_BLE_GAP_RSSI_STOP, conn_mw_ble_gap_rssi_stop}, + {SD_BLE_GAP_RSSI_GET, conn_mw_ble_gap_rssi_get}, + {SD_BLE_GAP_SCAN_START, conn_mw_ble_gap_scan_start}, + {SD_BLE_GAP_SCAN_START, conn_mw_ble_gap_scan_stop}, + //Functions from ble_gattc.h + {SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER, conn_mw_ble_gattc_primary_services_discover}, + {SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, conn_mw_ble_gattc_relationships_discover}, + {SD_BLE_GATTC_CHARACTERISTICS_DISCOVER, conn_mw_ble_gattc_characteristics_discover}, + {SD_BLE_GATTC_DESCRIPTORS_DISCOVER, conn_mw_ble_gattc_descriptors_discover}, + {SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, conn_mw_ble_gattc_char_value_by_uuid_read}, + {SD_BLE_GATTC_READ, conn_mw_ble_gattc_read}, + {SD_BLE_GATTC_CHAR_VALUES_READ, conn_mw_ble_gattc_char_values_read}, + {SD_BLE_GATTC_WRITE, conn_mw_ble_gattc_write}, + {SD_BLE_GATTC_HV_CONFIRM, conn_mw_ble_gattc_hv_confirm}, + //Functions from ble_gatts.h + {SD_BLE_GATTS_SERVICE_ADD, conn_mw_ble_gatts_service_add}, + {SD_BLE_GATTS_INCLUDE_ADD, conn_mw_ble_gatts_include_add}, + {SD_BLE_GATTS_CHARACTERISTIC_ADD, conn_mw_ble_gatts_characteristic_add}, + {SD_BLE_GATTS_DESCRIPTOR_ADD, conn_mw_ble_gatts_descriptor_add}, + {SD_BLE_GATTS_VALUE_SET, conn_mw_ble_gatts_value_set}, + {SD_BLE_GATTS_VALUE_GET, conn_mw_ble_gatts_value_get}, + {SD_BLE_GATTS_HVX, conn_mw_ble_gatts_hvx}, + {SD_BLE_GATTS_SERVICE_CHANGED, conn_mw_ble_gatts_service_changed}, + {SD_BLE_GATTS_RW_AUTHORIZE_REPLY, conn_mw_ble_gatts_rw_authorize_reply}, + {SD_BLE_GATTS_SYS_ATTR_SET, conn_mw_ble_gatts_sys_attr_set}, + {SD_BLE_GATTS_SYS_ATTR_GET, conn_mw_ble_gatts_sys_attr_get}, +}; diff --git a/components/serialization/connectivity/codecs/s110/middleware/conn_mw_nrf_soc.c b/components/serialization/connectivity/codecs/s110/middleware/conn_mw_nrf_soc.c new file mode 100644 index 0000000..c9a7509 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/middleware/conn_mw_nrf_soc.c @@ -0,0 +1,60 @@ +/* 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 "nrf_soc_conn.h" +#include "conn_mw_nrf_soc.h" +#include "ble_serialization.h" + +uint32_t conn_mw_power_system_off(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + + err_code = power_system_off_req_dec(p_rx_buf, rx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = sd_power_system_off(); + /* There should be no return from sd_power_system_off() */ + + return err_code; +} + +uint32_t conn_mw_temp_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + int32_t temperature; + int32_t * p_temperature = &temperature; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = temp_get_req_dec(p_rx_buf, rx_buf_len, &p_temperature); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_temp_get(p_temperature); + + err_code = temp_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_temperature); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/middleware/conn_mw_nrf_soc.h b/components/serialization/connectivity/codecs/s110/middleware/conn_mw_nrf_soc.h new file mode 100644 index 0000000..ba4a973 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/middleware/conn_mw_nrf_soc.h @@ -0,0 +1,55 @@ +/* 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 CONN_MW_NRF_SOC_H__ +#define CONN_MW_NRF_SOC_H__ + +#include + +/**@brief Handles @ref sd_power_system_off command request. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + * @retval NRF_ERROR_NOT_SUPPORTED Handler failure. Opcode not supported. + */ +uint32_t conn_mw_power_system_off(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_temp_get command request and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + * @retval NRF_ERROR_NOT_SUPPORTED Handler failure. Opcode not supported. + */ +uint32_t conn_mw_temp_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +#endif diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_conn.h b/components/serialization/connectivity/codecs/s110/serializers/ble_conn.h new file mode 100644 index 0000000..aa20aa9 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_conn.h @@ -0,0 +1,447 @@ +/* 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. + * + */ +#ifndef BLE_CONN_H__ +#define BLE_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s110_codecs Connectivity s110 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_conn Connectivity command request decoders and command response encoders + * @{ + * @ingroup ser_conn_s110_codecs + * + * @brief Connectivity command request decoders and command response encoders. + */ +#include "ble.h" + +/**@brief Decodes @ref sd_ble_tx_buffer_count_get command request. + * + * @sa @ref nrf51_tx_buffer_count_get_encoding for packet format, + * @ref ble_tx_buffer_count_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_count Pointer to pointer to location for count. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_tx_buffer_count_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint8_t * * const pp_count); + +/**@brief Encodes @ref sd_ble_tx_buffer_count_get command response. + * + * @sa @ref nrf51_tx_buffer_count_get_encoding for packet format. + * @ref ble_tx_buffer_count_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_count Pointer to count value. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_tx_buffer_count_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint8_t const * const p_count); + +/**@brief Event encoding dispatcher. + * + * The event encoding dispatcher will route the event packet to the correct encoder which in turn + * encodes the contents of the event and updates the \p p_buf buffer. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + * @retval NRF_ERROR_NOT_SUPPORTED Event encoder is not implemented. + */ +uint32_t ble_event_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_version_get command request. + * + * @sa @ref nrf51_version_get_encoding for packet format, + * @ref ble_version_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_version Pointer to pointer to @ref ble_version_t address. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_version_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + ble_version_t * * const pp_version); + +/**@brief Encodes @ref sd_ble_version_get command response. + * + * @sa @ref nrf51_version_get_encoding for packet format. + * @ref ble_version_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_version Pointer to @ref ble_version_t address. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_version_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_version_t const * const p_version); + + +/**@brief Decodes @ref sd_ble_opt_get command request. + * + * @sa @ref nrf51_opt_get_encoding for packet format, + * @ref ble_opt_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_opt_id Pointer to pointer to @ref ble_version_t address. + * @param[out] pp_opt Pointer to pointer to @ref ble_opt_t address. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_opt_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint32_t * const p_opt_id, + ble_opt_t **const pp_opt ); + + +/**@brief Encodes @ref sd_ble_opt_get command response. + * + * @sa @ref nrf51_opt_get_encoding for packet format. + * @ref ble_opt_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] opt_id identifies type of ble_opt_t union + * @param[in] p_opt Pointer to @ref ble_opt_t union. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ + +uint32_t ble_opt_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint32_t opt_id, + ble_opt_t const * const p_opt); + + +/**@brief Decodes @ref sd_ble_opt_set command request. + * + * @sa @ref nrf51_opt_set_encoding for packet format, + * @ref ble_opt_set_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_opt_id Pointer to @ref ble_opt_t union type identifier. + * @param[out] pp_opt Pointer to pointer to @ref ble_opt_t union. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_opt_set_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint32_t * const p_opt_id, + ble_opt_t **const pp_opt ); + + +/**@brief Encodes @ref sd_ble_opt_set command response. + * + * @sa @ref nrf51_opt_set_encoding for packet format. + * @ref ble_opt_set_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ + +uint32_t ble_opt_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + + +/**@brief Decodes @ref sd_ble_uuid_encode command request. + * + * @sa @ref nrf51_uuid_encode_encoding for packet format, + * @ref ble_uuid_encode_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_uuid Pointer to pointer to @ref ble_uuid_t structure. + * @param[out] pp_uuid_le_len Pointer to pointer to the length of encoded UUID. + * @param[out] pp_uuid_le Pointer to pointer to buffer where encoded UUID will be stored. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_uuid_encode_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + ble_uuid_t * * const pp_uuid, + uint8_t * * const pp_uuid_le_len, + uint8_t * * const pp_uuid_le); + +/**@brief Encodes @ref sd_ble_uuid_encode command response. + * + * @sa @ref nrf51_uuid_encode_encoding for packet format. + * @ref ble_uuid_encode_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] uuid_le_len Length of the encoded UUID. + * @param[in] p_uuid_le Pointer to the buffer with encoded UUID. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_uuid_encode_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint8_t uuid_le_len, + uint8_t const * const p_uuid_le); + +/**@brief Decodes @ref sd_ble_uuid_decode command request. + * + * @sa @ref nrf51_uuid_decode_encoding for packet format, + * @ref ble_uuid_decode_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of response packet. + * @param[out] p_uuid_le_len Pointer to the length of encoded UUID. + * @param[out] pp_uuid_le Pointer to pointer to buffer where encoded UUID will be stored. + * @param[out] pp_uuid Pointer to pointer to @ref ble_uuid_t structure. + * \c It will be set to NULL if p_uuid is not present in the packet. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_uuid_decode_req_dec(uint8_t const * const p_buf, + uint32_t const buf_len, + uint8_t * p_uuid_le_len, + uint8_t * * const pp_uuid_le, + ble_uuid_t * * const pp_uuid); + +/**@brief Encodes @ref sd_ble_uuid_decode command response. + * + * @sa @ref nrf51_uuid_decode_encoding for packet format. + * @ref ble_uuid_decode_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_uuid Pointer to the buffer with encoded UUID. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_uuid_decode_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_uuid_t const * const p_uuid); + +/**@brief Decodes @ref sd_ble_uuid_vs_add command request. + * + * @sa @ref nrf51_uuid_vs_add_encoding for packet format, + * @ref ble_uuid_vs_add_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of response packet. + * @param[out] pp_uuid Pointer to pointer to UUID. + * \c It will be set to NULL if p_uuid is not present in the packet. + * @param[out] pp_uuid_type Pointer to pointer to UUID type. + * \c It will be set to NULL if p_uuid_type is not present in the packet. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_uuid_vs_add_req_dec(uint8_t const * const p_buf, + uint16_t buf_len, + ble_uuid128_t * * const pp_uuid, + uint8_t * * const pp_uuid_type); + +/**@brief Encodes @ref sd_ble_uuid_vs_add command response. + * + * @sa @ref nrf51_uuid_vs_add_encoding for packet format. + * @ref ble_uuid_vs_add_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_uuid_type Pointer to the UUID type. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_uuid_vs_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint8_t const * const p_uuid_type); + +/**@brief Decodes @ref sd_ble_enable command request. + * + * @sa @ref nrf51_enable_encoding for packet format, + * @ref ble_enable_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_ble_enable_params Pointer to pointer to ble_enable_params_t. + * \c It will be set to NULL if p_ble_enable_params is not present in the packet. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_enable_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_enable_params_t * * const pp_ble_enable_params); + +/**@brief Encodes @ref sd_ble_enable command response. + * + * @sa @ref nrf51_enable_encoding for packet format. + * @ref ble_enable_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_enable_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_user_mem_reply command request. + * + * @sa @ref nrf51_user_mem_reply_encoding for packet format, + * @ref ble_user_mem_reply_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[in] p_conn_handle Pointer to Connection Handle. + * @param[in,out] pp_block Pointer to pointer to ble_user_mem_block_t. + * \c It will be set to NULL if p_block is not present in the packet. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_user_mem_reply_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + ble_user_mem_block_t * * const pp_block); + +/**@brief Encodes @ref sd_ble_user_mem_reply command response. + * + * @sa @ref nrf51_user_mem_reply_encoding for packet format. + * @ref ble_user_mem_reply_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_user_mem_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Pre-decodes opt_id of @ref ble_opt_t for middleware. + * + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] packet_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in,out] p_opt_id Pointer to opt_id which identifies type of @ref ble_opt_t union. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_opt_id_pre_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint32_t * const p_opt_id); + +/** @} */ + +#endif diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_enable.c b/components/serialization/connectivity/codecs/s110/serializers/ble_enable.c new file mode 100644 index 0000000..da81437 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_enable.c @@ -0,0 +1,46 @@ +/* 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 +#include "ble_conn.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_enable_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_enable_params_t * * const pp_ble_enable_params) +{ + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_ble_enable_params); + SER_ASSERT_NOT_NULL(*pp_ble_enable_params); + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_ble_enable_params, ble_enable_params_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + +uint32_t ble_enable_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + return op_status_enc(SD_BLE_ENABLE, return_code, p_buf, p_buf_len, &index); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_event.c b/components/serialization/connectivity/codecs/s110/serializers/ble_event.c new file mode 100644 index 0000000..4eedff6 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_event.c @@ -0,0 +1,186 @@ +/* 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 "ble_conn.h" +#include "ble_evt_conn.h" +#include "ble_gap_evt_conn.h" +#include "ble_gattc_evt_conn.h" +#include "ble_gatts_evt_conn.h" +#include "ble_l2cap_evt_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_event_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t ret_val = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + SER_ASSERT_NOT_NULL(p_event); + + switch (p_event->header.evt_id) + { + case BLE_EVT_TX_COMPLETE: + ret_val = ble_evt_tx_complete_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_EVT_USER_MEM_RELEASE: + ret_val = ble_evt_user_mem_release_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_EVT_USER_MEM_REQUEST: + ret_val = ble_evt_user_mem_request_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_CONN_PARAM_UPDATE: + ret_val = ble_gap_evt_conn_param_update_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST: + ret_val = ble_gap_evt_conn_param_update_request_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_SEC_PARAMS_REQUEST: + ret_val = ble_gap_evt_sec_params_request_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_SEC_INFO_REQUEST: + ret_val = ble_gap_evt_sec_info_request_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_AUTH_STATUS: + ret_val = ble_gap_evt_auth_status_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_PASSKEY_DISPLAY: + ret_val = ble_gap_evt_passkey_display_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_AUTH_KEY_REQUEST: + ret_val = ble_gap_evt_auth_key_request_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_CONN_SEC_UPDATE: + ret_val = ble_gap_evt_conn_sec_update_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_RSSI_CHANGED: + ret_val = ble_gap_evt_rssi_changed_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_TIMEOUT: + ret_val = ble_gap_evt_timeout_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_DISCONNECTED: + ret_val = ble_gap_evt_disconnected_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_CONNECTED: + ret_val = ble_gap_evt_connected_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_SEC_REQUEST: + ret_val = ble_gap_evt_sec_request_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTC_EVT_CHAR_DISC_RSP: + ret_val = ble_gattc_evt_char_disc_rsp_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTC_EVT_DESC_DISC_RSP: + ret_val = ble_gattc_evt_desc_disc_rsp_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP: + ret_val = ble_gattc_evt_char_val_by_uuid_read_rsp_enc(p_event, + event_len, + p_buf, + p_buf_len); + break; + + case BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP: + ret_val = ble_gattc_evt_prim_srvc_disc_rsp_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTC_EVT_HVX: + ret_val = ble_gattc_evt_hvx_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTC_EVT_READ_RSP: + ret_val = ble_gattc_evt_read_rsp_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTC_EVT_TIMEOUT: + ret_val = ble_gattc_evt_timeout_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTC_EVT_WRITE_RSP: + ret_val = ble_gattc_evt_write_rsp_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTC_EVT_REL_DISC_RSP: + ret_val = ble_gattc_evt_rel_disc_rsp_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTC_EVT_CHAR_VALS_READ_RSP: + ret_val = ble_gattc_evt_char_vals_read_rsp_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTS_EVT_HVC: + ret_val = ble_gatts_evt_hvc_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTS_EVT_TIMEOUT: + ret_val = ble_gatts_evt_timeout_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTS_EVT_SC_CONFIRM: + ret_val = ble_gatts_evt_sc_confirm_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTS_EVT_WRITE: + ret_val = ble_gatts_evt_write_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST: + ret_val = ble_gatts_evt_rw_authorize_request_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTS_EVT_SYS_ATTR_MISSING: + ret_val = ble_gatts_evt_sys_attr_missing_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_L2CAP_EVT_RX: + ret_val = ble_l2cap_evt_rx_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_ADV_REPORT: + ret_val = ble_gap_evt_adv_report_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_SCAN_REQ_REPORT: + ret_val = ble_gap_evt_scan_req_report_enc(p_event, event_len, p_buf, p_buf_len); + break; + + default: + ret_val = NRF_ERROR_NOT_SUPPORTED; + *p_buf_len = 0; + break; + } + + return ret_val; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_evt_conn.h b/components/serialization/connectivity/codecs/s110/serializers/ble_evt_conn.h new file mode 100644 index 0000000..3c341da --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_evt_conn.h @@ -0,0 +1,96 @@ +/* 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 BLE_EVT_CONN_H__ +#define BLE_EVT_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s110_codecs Connectivity s110 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_evt_conn Connectivity event encoders + * @{ + * @ingroup ser_conn_s110_codecs + * + * @brief Connectivity event encoders. + */ +#include "ble.h" + +/** + * @brief Encodes ble_evt_tx_complete event. + * + * @sa @ref nrf51_evt_tx_complete_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_evt_tx_complete_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_evt_user_mem_release event. + * + * @sa @ref nrf51_evt_user_mem_release_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_evt_user_mem_release_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_evt_user_mem_request event. + * + * @sa @ref nrf51_evt_user_mem_request_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_evt_user_mem_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** @} */ +#endif diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_evt_tx_complete.c b/components/serialization/connectivity/codecs/s110/serializers/ble_evt_tx_complete.c new file mode 100644 index 0000000..f10dbf9 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_evt_tx_complete.c @@ -0,0 +1,38 @@ +/* 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 "ble.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_evt_tx_complete_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 2 + 1, *p_buf_len); + index += uint16_encode(BLE_EVT_TX_COMPLETE, &(p_buf[index])); + index += uint16_encode(p_event->evt.common_evt.conn_handle, &(p_buf[index])); + p_buf[index++] = p_event->evt.common_evt.params.tx_complete.count; + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_evt_user_mem_release.c b/components/serialization/connectivity/codecs/s110/serializers/ble_evt_user_mem_release.c new file mode 100644 index 0000000..fec44de --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_evt_user_mem_release.c @@ -0,0 +1,56 @@ +/* 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 "ble_evt_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" +#include "conn_ble_user_mem.h" + +uint32_t ble_evt_user_mem_release_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + + const uint16_t evt_header = BLE_EVT_USER_MEM_RELEASE; + + err_code = uint16_t_enc((void *)&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&p_event->evt.common_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc((void *)&(p_event->evt.common_evt.params.user_mem_release.type), p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&(p_event->evt.common_evt.params.user_mem_release.mem_block.len), p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(1, *p_buf_len - index); + p_buf[index++] = p_event->evt.common_evt.params.user_mem_release.mem_block.p_mem ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + // Now user memory context can be released + err_code = conn_ble_user_mem_context_destroy(p_event->evt.common_evt.conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_evt_user_mem_request.c b/components/serialization/connectivity/codecs/s110/serializers/ble_evt_user_mem_request.c new file mode 100644 index 0000000..8faa98b --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_evt_user_mem_request.c @@ -0,0 +1,46 @@ +/* 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 "ble_evt_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_evt_user_mem_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + + const uint16_t evt_header = BLE_EVT_USER_MEM_REQUEST; + + err_code = uint16_t_enc((void *)&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc((void *)&(p_event->evt.common_evt.params.user_mem_request.type), p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_address_get.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_address_get.c new file mode 100644 index 0000000..f0dc9a5 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_address_get.c @@ -0,0 +1,79 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_address_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + ble_gap_addr_t * * const pp_address) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_address); + SER_ASSERT_LENGTH_LEQ(1 + 1, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_GAP_ADDRESS_GET, NRF_ERROR_INVALID_PARAM); + index++; + + if (p_buf[index++] == SER_FIELD_NOT_PRESENT) + { + *pp_address = NULL; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_address_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gap_addr_t const * const p_address) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_ADDRESS_GET, return_code, + p_buf, p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + uint32_t index = *p_buf_len; + + if (return_code != NRF_SUCCESS) + { + *p_buf_len = index; + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_address); + + SER_ASSERT_LENGTH_LEQ(index + sizeof (ble_gap_addr_t), total_len); + p_buf[index++] = p_address->addr_type; + memcpy(&p_buf[index], &p_address->addr[0], BLE_GAP_ADDR_LEN); + index += BLE_GAP_ADDR_LEN; + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_address_set.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_address_set.c new file mode 100644 index 0000000..f5ce35b --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_address_set.c @@ -0,0 +1,49 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_address_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * const p_addr_cycle_mode, + ble_gap_addr_t * * const pp_addr) +{ + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_addr_cycle_mode); + SER_ASSERT_NOT_NULL(pp_addr); + SER_ASSERT_NOT_NULL(*pp_addr); + uint8_dec(p_buf, packet_len, &index, (void *)p_addr_cycle_mode); + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_addr, ble_gap_addr_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + +uint32_t ble_gap_address_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + return op_status_enc(SD_BLE_GAP_ADDRESS_SET, return_code, p_buf, p_buf_len, &index); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_adv_data_set.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_adv_data_set.c new file mode 100644 index 0000000..ab83ce0 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_adv_data_set.c @@ -0,0 +1,49 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_adv_data_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * * const pp_data, + uint8_t * p_dlen, + uint8_t * * const pp_sr_data, + uint8_t * p_srdlen) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_dlen); + SER_ASSERT_NOT_NULL(p_srdlen); + + uint32_t index = SER_CMD_DATA_POS; + + uint32_t error_code = len8data_dec(p_buf, packet_len, &index, pp_data, p_dlen); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + error_code = len8data_dec(p_buf, packet_len, &index, pp_sr_data, p_srdlen); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_adv_data_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_ADV_DATA_SET, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_adv_start.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_adv_start.c new file mode 100644 index 0000000..ad5b071 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_adv_start.c @@ -0,0 +1,88 @@ +/* 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 "ble_gap_conn.h" +#include +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_adv_start_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_adv_params_t * * const pp_adv_params) +{ + uint32_t index = 0, i = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_adv_params); + SER_ASSERT_NOT_NULL(*pp_adv_params); + SER_ASSERT_NOT_NULL((*pp_adv_params)->p_peer_addr); + SER_ASSERT_NOT_NULL((*pp_adv_params)->p_whitelist); + SER_ASSERT_NOT_NULL((*pp_adv_params)->p_whitelist->pp_addrs); + SER_ASSERT_NOT_NULL((*pp_adv_params)->p_whitelist->pp_irks); + + for (i = 0; i < BLE_GAP_WHITELIST_ADDR_MAX_COUNT; i++) + { + SER_ASSERT_NOT_NULL((*pp_adv_params)->p_whitelist->pp_addrs[i]); + } + + for (i = 0; i < BLE_GAP_WHITELIST_IRK_MAX_COUNT; i++) + { + SER_ASSERT_NOT_NULL((*pp_adv_params)->p_whitelist->pp_irks[i]); + } + + /* Packet with variable length. */ + /* For now check: opcode + indicator showing if ble_gap_adv_params_t struct is present. */ + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 1, packet_len); + SER_ASSERT(p_buf[index] == SD_BLE_GAP_ADV_START, NRF_ERROR_INVALID_PARAM); + index++; + + if (p_buf[index++] == SER_FIELD_PRESENT) + { + err_code = uint8_t_dec(p_buf, packet_len, &index, &((*pp_adv_params)->type)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void **) &((*pp_adv_params)->p_peer_addr), ble_gap_addr_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, packet_len, &index, &((*pp_adv_params)->fp)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void **) &((*pp_adv_params)->p_whitelist), ble_gap_whitelist_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, packet_len, &index, &((*pp_adv_params)->interval)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, packet_len, &index, &((*pp_adv_params)->timeout)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_adv_ch_mask_t_dec(p_buf, packet_len, &index, &((*pp_adv_params)->channel_mask)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + else + { + *pp_adv_params = NULL; + } + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + +uint32_t ble_gap_adv_start_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_ADV_START, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_adv_stop.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_adv_stop.c new file mode 100644 index 0000000..b3569a2 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_adv_stop.c @@ -0,0 +1,23 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_adv_stop_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_ADV_STOP, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_appearance_get.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_appearance_get.c new file mode 100644 index 0000000..cc828b5 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_appearance_get.c @@ -0,0 +1,76 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_appearance_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * * const pp_appearance) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_appearance); + SER_ASSERT_NOT_NULL(*pp_appearance); + SER_ASSERT_LENGTH_EQ(2, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_GAP_APPEARANCE_GET, NRF_ERROR_INVALID_PARAM); + index++; + + if (p_buf[index++] == SER_FIELD_NOT_PRESENT) + { + *pp_appearance = NULL; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_appearance_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t const * const p_appearance) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_APPEARANCE_GET, return_code, + p_buf, p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_appearance); + uint32_t index = *p_buf_len; + + SER_ASSERT_LENGTH_LEQ(index + sizeof (uint16_t), total_len); + index += uint16_encode(*p_appearance, &p_buf[index]); + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_appearance_set.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_appearance_set.c new file mode 100644 index 0000000..f393fdb --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_appearance_set.c @@ -0,0 +1,42 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" +#include "nrf_error.h" + + +uint32_t ble_gap_appearance_set_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * const p_appearance) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_appearance); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_LENGTH_EQ(3, buf_len); + SER_ASSERT(p_buf[index++] == SD_BLE_GAP_APPEARANCE_SET, NRF_ERROR_INVALID_PARAM); + + uint32_t err_code = uint16_t_dec(p_buf, buf_len, &index, p_appearance); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_appearance_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_APPEARANCE_SET, return_code, + p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_auth_key_reply.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_auth_key_reply.c new file mode 100644 index 0000000..988c711 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_auth_key_reply.c @@ -0,0 +1,68 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_auth_key_reply_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * p_conn_handle, + uint8_t * p_key_type, + uint8_t * * const pp_key) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_key_type); + + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code = NRF_SUCCESS; + uint8_t key_len; + + SER_ASSERT_LENGTH_LEQ(2, packet_len - index); + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + SER_ASSERT_LENGTH_LEQ(1, packet_len - index); + uint8_dec(p_buf, packet_len, &index, p_key_type); + + switch (*p_key_type) + { + case BLE_GAP_AUTH_KEY_TYPE_NONE: + key_len = 0; + break; + + case BLE_GAP_AUTH_KEY_TYPE_PASSKEY: + key_len = 6; + break; + + case BLE_GAP_AUTH_KEY_TYPE_OOB: + key_len = 16; + break; + + default: + return NRF_ERROR_INVALID_PARAM; + } + + err_code = buf_dec(p_buf, packet_len, &index, pp_key, key_len, key_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + return err_code; +} + +uint32_t ble_gap_auth_key_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_AUTH_KEY_REPLY, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_authenticate.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_authenticate.c new file mode 100644 index 0000000..4d7053e --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_authenticate.c @@ -0,0 +1,57 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "nordic_common.h" +#include "app_util.h" +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" + + +uint32_t ble_gap_authenticate_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + ble_gap_sec_params_t * * const pp_sec_params) +{ + uint32_t index = SER_CMD_DATA_POS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_sec_params); + SER_ASSERT_NOT_NULL(*pp_sec_params); + + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + packet_len, + &index, + (void * *)pp_sec_params, + ble_gap_sec_params_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + +uint32_t ble_gap_authenticate_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_AUTHENTICATE, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_conn.h b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_conn.h new file mode 100644 index 0000000..b07c114 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_conn.h @@ -0,0 +1,1044 @@ +/* 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. + * + */ +#ifndef BLE_GAP_CONN_H__ +#define BLE_GAP_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s110_codecs Connectivity s110 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gap_conn GAP Connectivity command request decoders and command response encoders + * @{ + * @ingroup ser_conn_s110_codecs + * + * @brief GAP Connectivity command request decoders and command response encoders + */ +#include "ble_gap.h" + +/**@brief Decodes @ref sd_ble_gap_address_get command request. + * + * @sa @ref nrf51_address_get_encoding for packet format, + * @ref ble_gap_address_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_address Pointer to pointer to address. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_address_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + ble_gap_addr_t * * const pp_address); + +/**@brief Encodes @ref sd_ble_gap_address_get command response. + * + * @sa @ref nrf51_address_get_encoding for packet format. + * @ref ble_gap_address_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_address Pointer to @ref ble_gap_addr_t address + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_address_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gap_addr_t const * const p_address); + +/**@brief Decodes @ref sd_ble_gap_authenticate command request. + * + * @sa @ref nrf51_ble_gap_authenticate_encoding for packet format, + * @ref ble_gap_authenticate_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle + * @param[out] pp_sec_params Pointer to pointer to security parameters. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_authenticate_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + ble_gap_sec_params_t * * const pp_sec_params); + +/**@brief Encodes @ref sd_ble_gap_authenticate command response. + * + * @sa @ref nrf51_ble_gap_authenticate_encoding for packet format. + * @ref ble_gap_authenticate_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_authenticate_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_address_set command request. + * + * @sa @ref nrf51_gap_address_set_encoding for packet format, + * @ref ble_gap_address_set_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_addr_cycle_mode Pointer to address cycle mode + * @param[out] pp_addr Pointer to pointer to address structure. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_address_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * const p_addr_cycle_mode, + ble_gap_addr_t * * const pp_addr); + +/**@brief Encodes @ref sd_ble_gap_address_set command response. + * + * @sa @ref nrf51_gap_address_set_encoding for packet format. + * @ref ble_gap_address_set_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_address_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_adv_data_set command request. + * + * @sa @ref nrf51_adv_set_encoding for packet format, + * @ref ble_gap_adv_data_set_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of request packet. + * @param[out] pp_data Pointer to the buffer raw data to be placed in advertisement packet. + * @param[out] p_dlen Pointer to data length for p_data. + * @param[out] pp_sr_data Pointer to the buffer raw data to be placed in scan response packet. + * @param[out] p_srdlen Pointer to data length for p_sr_data. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_adv_data_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * * const pp_data, + uint8_t * p_dlen, + uint8_t * * const pp_sr_data, + uint8_t * p_srdlen); + +/**@brief Encodes @ref sd_ble_gap_adv_data_set command response. + * + * @sa @ref nrf51_adv_set_encoding for packet format. + * @ref ble_gap_adv_data_set_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_adv_data_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_adv_start command request. + * + * @sa @ref nrf51_adv_start_encoding for packet format, + * @ref ble_gap_adv_start_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_adv_params Pointer to pointer to advertising parameters. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_adv_start_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_adv_params_t * * const pp_adv_params); + +/**@brief Encodes @ref sd_ble_gap_adv_start command response. + * + * @sa @ref nrf51_adv_start_encoding for packet format. + * @ref ble_gap_adv_start_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_adv_start_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_device_name_get command request. + * + * @sa @ref nrf51_device_name_get_encoding for packet format, + * @ref ble_gap_device_name_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_dev_name Pointer to pointer to device name buffer. + * @param[out] pp_dev_name_len Pointer to pointer to device name length location. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_device_name_get_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * * pp_dev_name, + uint16_t * * pp_dev_name_len); + +/**@brief Encodes @ref sd_ble_gap_device_name_get command response. + * + * @sa @ref nrf51_device_name_get_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_dev_name Pointer to device name buffer. + * @param[in] dev_name_len Length of device name buffer. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buflen \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_device_name_get_rsp_enc(uint32_t return_code, + uint8_t const * const p_dev_name, + uint16_t dev_name_len, + uint8_t * const p_buf, + uint32_t * const p_buflen); + +/**@brief Decodes @ref sd_ble_gap_conn_param_update command request. + * + * @sa @ref nrf51_gap_conn_param_update_encoding for packet format, + * @ref ble_gap_conn_param_update_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] pp_conn_params Pointer to pointer to connection parameters. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for connection + * parameters field present. + */ +uint32_t ble_gap_conn_param_update_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * p_conn_handle, + ble_gap_conn_params_t * * const pp_conn_params); + +/**@brief Encodes @ref sd_ble_gap_conn_param_update command response. + * + * @sa @ref nrf51_gap_conn_param_update_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_conn_param_update_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + + +/**@brief Decodes @ref sd_ble_gap_disconnect command request. + * + * @sa @ref nrf51_disconnect_encoding for packet format, + * @ref ble_gap_disconnect_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[in] p_conn_handle Pointer to Connection Handle. + * @param[in] p_hci_status Pointer to HCI Status Code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_disconnect_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint8_t * const p_hci_status); + +/**@brief Encodes @ref sd_ble_gap_disconnect command response. + * + * @sa @ref nrf51_disconnect_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_disconnect_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_tx_power_set command request. + * + * @sa @ref nrf51_tx_power_set_encoding for packet format, + * @ref ble_gap_tx_power_set_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[in] tx_power Pointer to TX power value. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_tx_power_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + int8_t * tx_power); + +/**@brief Encodes @ref sd_ble_gap_tx_power_set command response. + * + * @sa @ref nrf51_tx_power_set_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_tx_power_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_ppcp_set command request. + * + * @sa @ref nrf51_ppcp_set_encoding for packet format, + * @ref ble_gap_ppcp_set_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_conn_params Pointer to pointer to connection parameters to be set. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for connection + * parameters field present. + */ +uint32_t ble_gap_ppcp_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_conn_params_t * * const pp_conn_params); + +/**@brief Encodes @ref sd_ble_gap_ppcp_set command response. + * + * @sa @ref nrf51_ppcp_set_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_ppcp_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + + +/**@brief Decodes @ref sd_ble_gap_ppcp_get command request. + * + * @sa @ref nrf51_gap_ppcp_get_encoding for packet format, + * @ref ble_gap_ppcp_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_conn_params Pointer to pointer to ble_gap_conn_params_t. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_ppcp_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + ble_gap_conn_params_t * * const pp_conn_params); + +/**@brief Encodes @ref sd_ble_gap_ppcp_get command response. + * + * @sa @ref nrf51_gap_ppcp_get_encoding for packet format. + * @ref ble_gap_ppcp_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_conn_params Pointer to ble_gap_conn_params_t. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_ppcp_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gap_conn_params_t const * const p_conn_params); + + +/**@brief Encodes @ref sd_ble_gap_adv_stop command response. + * + * @sa @ref nrf51_sd_ble_gap_adv_stop for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_adv_stop_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_auth_key_reply command request. + * + * @sa @ref nrf51_auth_key_reply_encoding for packet format, + * @ref ble_gap_auth_key_reply_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] p_key_type Pointer to key type. + * @param[out] pp_key Pointer to pointer to buffer for incoming key. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_auth_key_reply_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * p_conn_handle, + uint8_t * p_key_type, + uint8_t * * const pp_key); + +/**@brief Encodes @ref sd_ble_gap_auth_key_reply command response. + * + * @sa @ref nrf51_auth_key_reply_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_auth_key_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_sec_params_reply command request. + * + * @sa @ref nrf51_sec_params_reply_encoding for packet format, + * @ref ble_gap_sec_params_reply_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] p_sec_status Pointer to security status. + * @param[out] pp_sec_params Pointer to pointer to security parameters structure. + * @param[out] pp_sec_keyset Pointer to pointer to security keyset structure. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for connection + * parameters field present. + */ +uint32_t ble_gap_sec_params_reply_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * p_conn_handle, + uint8_t * p_sec_status, + ble_gap_sec_params_t * * const pp_sec_params, + ble_gap_sec_keyset_t * * const pp_sec_keyset); + +/**@brief Encodes @ref sd_ble_gap_sec_params_reply command response. + * + * @sa @ref nrf51_sec_params_reply_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in] p_sec_keyset Pointer to security keyset structure. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_sec_params_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gap_sec_keyset_t * const p_sec_keyset); + +/**@brief Decodes @ref sd_ble_gap_rssi_start command request. + * + * @sa @ref nrf51_rssi_start_encoding for packet format, + * @ref ble_gap_rssi_start_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] p_threshold_dbm Pointer to threshold in dBm. + * @param[out] p_skip_count Pointer to sample skip count. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_rssi_start_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * p_conn_handle, + uint8_t * p_threshold_dbm, + uint8_t * p_skip_count); + +/**@brief Encodes @ref sd_ble_gap_rssi_start command response. + * + * @sa @ref nrf51_rssi_start_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ + +uint32_t ble_gap_rssi_start_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_rssi_stop command request. + * + * @sa @ref nrf51_rssi_stop_encoding for packet format, + * @ref ble_gap_rssi_stop_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of response packet. + * @param[out] conn_handle Pointer to connection handle. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ + +uint32_t ble_gap_rssi_stop_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * conn_handle); + +/**@brief Encodes @ref sd_ble_gap_rssi_stop command response. + * + * @sa @ref nrf51_rssi_stop_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ + +uint32_t ble_gap_rssi_stop_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_appearance_get command request. + * + * @sa @ref nrf51_appearance_get_encoding for packet format, + * @ref ble_gap_appearance_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_appearance Pointer to pointer to uint16_t appearance. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_appearance_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * * const pp_appearance); + +/**@brief Encodes @ref sd_ble_gap_appearance_get command response. + * + * @sa @ref nrf51_appearance_get_encoding for packet format. + * @ref ble_gap_appearance_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_appearance Pointer to uint16_t appearance. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_appearance_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t const * const p_appearance); + + +/**@brief Decodes @ref sd_ble_gap_appearance_set command request. + * + * @sa @ref nrf51_appearance_set_encoding for packet format, + * @ref ble_gap_tx_power_set_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of the packet. + * @param[out] p_appearance Pointer to the appearance. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_appearance_set_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * const p_appearance); + +/**@brief Encodes @ref sd_ble_gap_appearance_set command response. + * + * @sa @ref nrf51_appearance_set_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_appearance_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + + +/**@brief Decodes @ref sd_ble_gap_sec_info_reply command request. + * + * @sa @ref nrf51_gap_sec_info_reply_encoding for packet format, + * @ref ble_gap_sec_info_reply_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of the packet. + * @param[out] p_conn_handle Pointer to the Connection Handle. + * @param[out] pp_enc_info Pointer to pointer to Encryption Information. + * @param[out] pp_id_info Pointer to pointer to Id Information. + * @param[out] pp_sign_info Pointer to pointer to Signing Information + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_sec_info_reply_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * p_conn_handle, + ble_gap_enc_info_t * * const pp_enc_info, + ble_gap_irk_t * * const pp_id_info, + ble_gap_sign_info_t * * const pp_sign_info); + +/**@brief Encodes @ref sd_ble_gap_sec_info_reply command response. + * + * @sa @ref nrf51_gap_sec_info_reply_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_sec_info_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_device_name_set command request. + * + * @sa @ref nrf51_device_name_set_encoding for packet format, + * @ref ble_gap_device_name_set_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of the packet. + * @param[out] pp_write_perm Pointer to pointer to write permissions filed. + * @param[out] pp_dev_name Pointer to pointer to device name string + * @param[out] p_dev_name_len Pointer to device name string length + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_device_name_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_conn_sec_mode_t * * const pp_write_perm, + uint8_t * * const pp_dev_name, + uint16_t * const p_dev_name_len); + + +/**@brief Encodes @ref sd_ble_gap_device_name_set command response. + * + * @sa @ref nrf51_device_name_set_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_device_name_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_conn_sec_get command request. + * + * @sa @ref nrf51_gap_conn_sec_get_encoding for packet format, + * @ref ble_gap_conn_sec_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to Connection Handle. + * @param[out] pp_conn_sec Pointer to pointer to @ref ble_gap_conn_sec_t to be filled by + * the softdevice. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_conn_sec_get_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * p_conn_handle, + ble_gap_conn_sec_t * * const pp_conn_sec); + +/**@brief Encodes @ref sd_ble_gap_conn_sec_get command response. + * + * @sa @ref nrf51_gap_conn_sec_get_encoding for packet format. + * @ref ble_gap_conn_sec_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_conn_sec Pointer to @ref ble_gap_conn_sec_t to be encoded. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_conn_sec_get_rsp_enc(uint32_t return_code, + ble_gap_conn_sec_t * const p_conn_sec, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_encrypt command request. + * + * @sa @ref nrf51_gap_encrypt_encoding for packet format, + * @ref ble_gap_encrypt_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer connection_handle. + * @param[out] pp_master_id Pointer to pointer to @ref ble_gap_master_id_t. + * @param[out] pp_enc_info Pointer to pointer to @ref ble_gap_enc_info_t. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ + +uint32_t ble_gap_encrypt_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gap_master_id_t ** const pp_master_id, + ble_gap_enc_info_t ** const pp_enc_info); + +/**@brief Encodes @ref sd_ble_gap_encrypt command response. + * + * @sa @ref nrf51_gap_encrypt_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_encrypt_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_rssi_get command request. + * + * @sa @ref nrf51_rssi_get_encoding for packet format, + * @ref ble_gap_rssi_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[in] p_conn_handle Connection handle. + * @param[out] pp_rssi Pointer to pointer to rssi value. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_rssi_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * p_conn_handle, + int8_t * * const pp_rssi); + +/**@brief Encodes @ref sd_ble_gap_rssi_get command response. + * + * @sa @ref nrf51_rssi_get_encoding for packet format. + * @ref ble_gap_rssi_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] rssi RSSI value. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_rssi_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + int8_t rssi); + +/**@brief Decodes @ref sd_ble_gap_connect command request. + * + * @sa @ref nrf51_connect_encoding for packet format, + * @ref ble_gap_connect_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_addr Pointer to pointer to peer address @ref ble_gap_addr_t. + * @param[out] pp_scan_params Pointer to pointer to @ref ble_gap_scan_params_t. + * @param[out] pp_conn_params Pointer to pointer to @ref ble_gap_conn_params_t. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_connect_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_addr_t * * const pp_addr, + ble_gap_scan_params_t * * const pp_scan_params, + ble_gap_conn_params_t * * const pp_conn_params); + +/**@brief Encodes @ref sd_ble_gap_connect command response. + * + * @sa @ref nrf51_connect_encoding for packet format. + * @ref ble_gap_connect_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_connect_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Encodes @ref sd_ble_gap_connect_cancel command response. + * + * @sa @ref nrf51_connect_cancel_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_connect_cancel_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_scan_start command request. + * + * @sa @ref nrf51_scan_start_encoding for packet format, + * @ref ble_gap_scan_start_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_scan_params Pointer to pointer to @ref ble_gap_scan_params_t. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_scan_start_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_scan_params_t * * const pp_scan_params); + +/**@brief Encodes @ref sd_ble_gap_scan_start command response. + * + * @sa @ref nrf51_scan_start_encoding for packet format. + * @ref ble_gap_scan_start_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_scan_start_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Encodes @ref sd_ble_gap_scan_stop command response. + * + * @sa @ref nrf51_scan_stop_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_scan_stop_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); +/** @} */ +#endif diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_conn_param_update.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_conn_param_update.c new file mode 100644 index 0000000..38ac3fd --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_conn_param_update.c @@ -0,0 +1,71 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_conn_param_update_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * p_conn_handle, + ble_gap_conn_params_t * * const pp_conn_params) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_conn_params); + SER_ASSERT_NOT_NULL(*pp_conn_params); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 3, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_GAP_CONN_PARAM_UPDATE, NRF_ERROR_INVALID_PARAM); + + index++; + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + if (p_buf[index] == SER_FIELD_PRESENT) + { + index++; + SER_ASSERT_LENGTH_LEQ(index + 8, packet_len); + uint16_dec(p_buf, packet_len, &index, &((*pp_conn_params)->min_conn_interval)); + uint16_dec(p_buf, packet_len, &index, &((*pp_conn_params)->max_conn_interval)); + uint16_dec(p_buf, packet_len, &index, &((*pp_conn_params)->slave_latency)); + uint16_dec(p_buf, packet_len, &index, &((*pp_conn_params)->conn_sup_timeout)); + } + else if (p_buf[index] == SER_FIELD_NOT_PRESENT) + { + index++; + *pp_conn_params = NULL; + } + else + { + return NRF_ERROR_INVALID_DATA; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_conn_param_update_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_CONN_PARAM_UPDATE, + return_code, + p_buf, + p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_conn_sec_get.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_conn_sec_get.c new file mode 100644 index 0000000..d3631ee --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_conn_sec_get.c @@ -0,0 +1,75 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" + + +uint32_t ble_gap_conn_sec_get_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * p_conn_handle, + ble_gap_conn_sec_t * * const pp_conn_sec) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + + uint32_t index = 0; + uint8_t opcode; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, packet_len - index); + uint8_dec(p_buf, packet_len, &index, &opcode); + + SER_ASSERT(opcode == SD_BLE_GAP_CONN_SEC_GET, NRF_ERROR_INVALID_PARAM); + + SER_ASSERT_LENGTH_LEQ(2, packet_len - index); + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_conn_sec, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + +uint32_t ble_gap_conn_sec_get_rsp_enc(uint32_t return_code, + ble_gap_conn_sec_t * const p_conn_sec, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t buflen = *p_buf_len; + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_CONN_SEC_GET, return_code, + p_buf, p_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + uint32_t index = *p_buf_len; + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + err_code = cond_field_enc(p_conn_sec, p_buf, buflen, &index, ble_gap_conn_sec_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_connect.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_connect.c new file mode 100644 index 0000000..e7b6135 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_connect.c @@ -0,0 +1,55 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_connect_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_addr_t * * const pp_addr, + ble_gap_scan_params_t * * const pp_scan_params, + ble_gap_conn_params_t * * const pp_conn_params) +{ + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_addr); + SER_ASSERT_NOT_NULL(*pp_addr); + SER_ASSERT_NOT_NULL(pp_scan_params); + SER_ASSERT_NOT_NULL(*pp_scan_params); + SER_ASSERT_NOT_NULL(pp_conn_params); + SER_ASSERT_NOT_NULL(*pp_conn_params); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_addr, ble_gap_addr_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_scan_params, ble_gap_scan_params_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_conn_params, ble_gap_conn_params_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + +uint32_t ble_gap_connect_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_CONNECT, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_connect_cancel.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_connect_cancel.c new file mode 100644 index 0000000..4551fcd --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_connect_cancel.c @@ -0,0 +1,25 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_connect_cancel_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_CONNECT_CANCEL, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_device_name_get.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_device_name_get.c new file mode 100644 index 0000000..e169d02 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_device_name_get.c @@ -0,0 +1,92 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" +#include "nrf_error.h" + +uint32_t ble_gap_device_name_get_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint8_t * * pp_name, + uint16_t * * pp_name_len) +{ + uint32_t index = 0; + uint32_t err_code; + + SER_ASSERT_NOT_NULL(pp_name_len); + SER_ASSERT_NOT_NULL(*pp_name_len); + + SER_ASSERT_LENGTH_LEQ(index + 1, buf_len); + + index++; + + if (p_buf[index] != SER_FIELD_PRESENT && p_buf[index] != SER_FIELD_NOT_PRESENT) + { + return NRF_ERROR_INVALID_PARAM; + } + + if (p_buf[index++] == SER_FIELD_PRESENT) + { + err_code = uint16_t_dec(p_buf, buf_len, &index, *pp_name_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + else + { + *pp_name_len = NULL; + } + + SER_ASSERT_LENGTH_LEQ(index + 1, buf_len); + + if (p_buf[index] != SER_FIELD_PRESENT && p_buf[index] != SER_FIELD_NOT_PRESENT) + { + return NRF_ERROR_INVALID_PARAM; + } + + if (p_buf[index] == SER_FIELD_NOT_PRESENT) + { + *pp_name = NULL; + } + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_device_name_get_rsp_enc(uint32_t return_code, + uint8_t const * const p_dev_name, + uint16_t dev_name_len, + uint8_t * const p_buf, + uint32_t * const p_buflen) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buflen); + + uint32_t buflen = *p_buflen; + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_DEVICE_NAME_GET, return_code, + p_buf, p_buflen); + uint32_t index = *p_buflen; + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + err_code = len16data_enc(p_dev_name, dev_name_len, p_buf, buflen, &index); + + *p_buflen = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_device_name_set.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_device_name_set.c new file mode 100644 index 0000000..84c49ff --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_device_name_set.c @@ -0,0 +1,61 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" +#include "ble_gap_struct_serialization.h" +#include "cond_field_serialization.h" + +uint32_t ble_gap_device_name_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_conn_sec_mode_t * * const pp_write_perm, + uint8_t * * const pp_dev_name, + uint16_t * const p_dev_name_len) +{ + SER_ASSERT_NOT_NULL(p_buf); //check if *p_buf is allocated + SER_ASSERT_NOT_NULL(pp_write_perm); //check if *pp_write_perm exist + SER_ASSERT_NOT_NULL(pp_dev_name); //check if *pp_dev_name exist + SER_ASSERT_NOT_NULL(p_dev_name_len); //check if *p_dev_name_len exist + + uint32_t index = SER_CMD_DATA_POS; + uint32_t status_code; + + SER_ASSERT_LENGTH_LEQ(4, packet_len - index); //make sure that payload is at least 4 bytes + + //decode optional write permissions field + status_code = cond_field_dec(p_buf, + packet_len, + &index, + (void * *)pp_write_perm, + ble_gap_conn_sec_mode_dec); + SER_ASSERT(status_code == NRF_SUCCESS, status_code); + + //decode optional device name field + status_code = len16data_dec(p_buf, packet_len, &index, pp_dev_name, p_dev_name_len); + SER_ASSERT(status_code == NRF_SUCCESS, status_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + return status_code; +} + + +uint32_t ble_gap_device_name_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_DEVICE_NAME_SET, + return_code, + p_buf, + p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_disconnect.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_disconnect.c new file mode 100644 index 0000000..e69a0d0 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_disconnect.c @@ -0,0 +1,52 @@ +/* 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 +#include "ble_gap_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_disconnect_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint8_t * const p_hci_status) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_hci_status); + + uint8_t opcode; + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint8_t_dec(p_buf, packet_len, &index, &opcode); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + SER_ASSERT(opcode == SD_BLE_GAP_DISCONNECT, NRF_ERROR_INVALID_PARAM); + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, packet_len, &index, p_hci_status); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + +uint32_t ble_gap_disconnect_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_DISCONNECT, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_encrypt.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_encrypt.c new file mode 100644 index 0000000..3cf0262 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_encrypt.c @@ -0,0 +1,60 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" +#include "ble_gap_struct_serialization.h" +#include "cond_field_serialization.h" + +uint32_t ble_gap_encrypt_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gap_master_id_t ** const pp_master_id, + ble_gap_enc_info_t ** const pp_enc_info) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_enc_info); + SER_ASSERT_NOT_NULL(pp_master_id); + SER_ASSERT_NOT_NULL(*pp_enc_info); + SER_ASSERT_NOT_NULL(*pp_master_id); + + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(2, packet_len - index); + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + err_code = cond_field_dec(p_buf, + packet_len, + &index, + (void **)pp_master_id, + ble_gap_master_id_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + packet_len, + &index, + (void **)pp_enc_info, + ble_gap_enc_info_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_encrypt_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_ENCRYPT, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_adv_report.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_adv_report.c new file mode 100644 index 0000000..fa6cd3f --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_adv_report.c @@ -0,0 +1,61 @@ +/* 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 "ble.h" +#include "ble_gap_evt_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_adv_report_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + const uint16_t evt_header = BLE_GAP_EVT_ADV_REPORT; + + err_code = uint16_t_enc((void *)&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_addr_enc((void *)&(p_event->evt.gap_evt.params.adv_report.peer_addr), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc((void *)&(p_event->evt.gap_evt.params.adv_report.rssi), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + byte = (p_event->evt.gap_evt.params.adv_report.scan_rsp) | + ((p_event->evt.gap_evt.params.adv_report.type) << 0x01) | + ((p_event->evt.gap_evt.params.adv_report.dlen) << 0x03); + + err_code = uint8_t_enc((void *)&(byte), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_vector_enc(p_event->evt.gap_evt.params.adv_report.data, (uint16_t)p_event->evt.gap_evt.params.adv_report.dlen, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_auth_key_request.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_auth_key_request.c new file mode 100644 index 0000000..7805879 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_auth_key_request.c @@ -0,0 +1,49 @@ +/* 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 "ble.h" +#include "ble_gap_evt_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_evt_auth_key_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + uint16_t evt_header = BLE_GAP_EVT_AUTH_KEY_REQUEST; + + err_code = uint16_t_enc(&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&p_event->evt.gap_evt.params.auth_key_request.key_type, + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_auth_status.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_auth_status.c new file mode 100644 index 0000000..59a751a --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_auth_status.c @@ -0,0 +1,62 @@ +/* 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 +#include "ble_serialization.h" +#include "app_util.h" +#include "ble.h" +#include "ble_gap_struct_serialization.h" +#include "ble_gap_evt_conn.h" +#include "conn_ble_gap_sec_keys.h" + +extern ser_ble_gap_conn_keyset_t m_conn_keys_table[]; + +uint32_t ble_gap_evt_auth_status_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint16_t evt_header = BLE_GAP_EVT_AUTH_STATUS; + uint32_t total_len; + uint32_t err_code = NRF_SUCCESS; + uint32_t conn_index; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + total_len = *p_buf_len; + + err_code = uint16_t_enc(&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_auth_status_t_enc(&(p_event->evt.gap_evt.params.auth_status), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + // keyset is an extension of standard event data - used to synchronize keys at application + err_code = conn_ble_gap_sec_context_find(p_event->evt.gap_evt.conn_handle, &conn_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_keyset_t_enc(&(m_conn_keys_table[conn_index].keyset), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = conn_ble_gap_sec_context_destroy(p_event->evt.gap_evt.conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + return err_code; +} + diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_conn.h b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_conn.h new file mode 100644 index 0000000..ce0851e --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_conn.h @@ -0,0 +1,336 @@ +/* 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 BLE_GAP_EVT_CONN_H__ +#define BLE_GAP_EVT_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s110_codecs Connectivity s110 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gap_evt_conn GAP Connectivity event encoders + * @{ + * @ingroup ser_conn_s110_codecs + * + * @brief GAP Connectivity event encoders. + */ +#include "ble.h" + +/** + * @brief Encodes ble_gap_evt_auth_key_request event. + * + * @sa @ref nrf51_evt_auth_key_request_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_auth_key_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_auth_status event. + * + * @sa @ref nrf51_evt_auth_status_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_auth_status_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_conn_param_update event. + * + * @sa @ref nrf51_evt_conn_param_update_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_conn_param_update_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_adv_report event. + * + * @sa @ref nrf51_evt_adv_report_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_adv_report_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_conn_sec_update event. + * + * @sa @ref nrf51_evt_conn_sec_update_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_conn_sec_update_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_connected event. + * + * @sa @ref nrf51_evt_connected_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_connected_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_disconnected event. + * + * @sa @ref nrf51_evt_disconnected_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_disconnected_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_passkey_display event. + * + * @sa @ref nrf51_evt_passkey_display for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_passkey_display_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_rssi_changed event. + * + * @sa @ref nrf51_evt_rssi_changed_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_rssi_changed_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_sec_info_request event. + * + * @sa @ref nrf51_evt_sec_info_request_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_sec_info_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_sec_params_request event. + * + * @sa @ref nrf51_evt_sec_param_request_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_sec_params_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_timeout event. + * + * @sa @ref nrf51_evt_timeout_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_timeout_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_scan_req_report event. + * + * @sa @ref nrf51_evt_scan_req_report_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_scan_req_report_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_conn_param_update_request event. + * + * @sa @ref nrf51_evt_conn_param_update_request_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_conn_param_update_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_sec_request event. + * + * @sa @ref nrf51_evt_sec_request_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_sec_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** @} */ +#endif diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_conn_param_update.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_conn_param_update.c new file mode 100644 index 0000000..a9565dc --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_conn_param_update.c @@ -0,0 +1,49 @@ +/* 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 "ble.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" +#include "ble_gap_evt_conn.h" + + +uint32_t ble_gap_evt_conn_param_update_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + SER_ASSERT(p_event->header.evt_id == BLE_GAP_EVT_CONN_PARAM_UPDATE, NRF_ERROR_INVALID_PARAM); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&p_event->header.evt_id, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_conn_param_update_t_enc(&p_event->evt.gap_evt.params.conn_param_update, + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_conn_param_update_request.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_conn_param_update_request.c new file mode 100644 index 0000000..5843ff3 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_conn_param_update_request.c @@ -0,0 +1,49 @@ +/* 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 "ble.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" +#include "ble_gap_evt_conn.h" + + +uint32_t ble_gap_evt_conn_param_update_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + SER_ASSERT(p_event->header.evt_id == BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST, NRF_ERROR_INVALID_PARAM); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&p_event->header.evt_id, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_conn_param_update_request_t_enc(&p_event->evt.gap_evt.params.conn_param_update_request, + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_conn_sec_update.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_conn_sec_update.c new file mode 100644 index 0000000..8293866 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_conn_sec_update.c @@ -0,0 +1,51 @@ +/* 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 "ble.h" +#include "ble_gap_evt_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_conn_sec_update_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + const uint16_t evt_header = BLE_GAP_EVT_CONN_SEC_UPDATE; + + err_code = uint16_t_enc((void *)&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_conn_sec_update_t_enc( + (void *)&p_event->evt.gap_evt.params.conn_sec_update, + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_connected.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_connected.c new file mode 100644 index 0000000..16cea4f --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_connected.c @@ -0,0 +1,49 @@ +/* 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 "ble.h" +#include "ble_gap_evt_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_evt_connected_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + uint16_t evt_header = BLE_GAP_EVT_CONNECTED; + + err_code = uint16_t_enc((void *)&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_connected_t_enc((void *)&p_event->evt.gap_evt.params.connected, + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_disconnected.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_disconnected.c new file mode 100644 index 0000000..a067462 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_disconnected.c @@ -0,0 +1,49 @@ +/* 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 +#include "ble_serialization.h" +#include "app_util.h" +#include "ble.h" +#include "ble_gap_struct_serialization.h" +#include "ble_gap_evt_conn.h" + +uint32_t ble_gap_evt_disconnected_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code; + uint16_t evt_header = BLE_GAP_EVT_DISCONNECTED; + + err_code = uint16_t_enc(&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&(p_event->evt.gap_evt.conn_handle), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_disconnected_t_enc((void *)&(p_event->evt.gap_evt.params.disconnected), + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_passkey_display.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_passkey_display.c new file mode 100644 index 0000000..1fcaab5 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_passkey_display.c @@ -0,0 +1,43 @@ +/* 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 +#include "ble_serialization.h" +#include "app_util.h" +#include "ble.h" +#include "ble_gap_evt_conn.h" + +#define PASSKEY_LEN sizeof (p_event->evt.gap_evt.params.passkey_display.passkey) + + +uint32_t ble_gap_evt_passkey_display_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 2 + PASSKEY_LEN, *p_buf_len); + index += uint16_encode(BLE_GAP_EVT_PASSKEY_DISPLAY, &(p_buf[index])); + index += uint16_encode(p_event->evt.gap_evt.conn_handle, &(p_buf[index])); + + memcpy(&p_buf[index], p_event->evt.gap_evt.params.passkey_display.passkey, PASSKEY_LEN); + index += PASSKEY_LEN; + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_rssi_changed.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_rssi_changed.c new file mode 100644 index 0000000..6ee6a94 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_rssi_changed.c @@ -0,0 +1,38 @@ +/* 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 "ble.h" +#include "ble_serialization.h" +#include "app_util.h" +#include "ble_gap_evt_conn.h" + + +uint32_t ble_gap_evt_rssi_changed_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 2 + 1, *p_buf_len); + index += uint16_encode(BLE_GAP_EVT_RSSI_CHANGED, &(p_buf[index])); + index += uint16_encode(p_event->evt.gap_evt.conn_handle, &(p_buf[index])); + p_buf[index++] = p_event->evt.gap_evt.params.rssi_changed.rssi; + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_scan_req_report.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_scan_req_report.c new file mode 100644 index 0000000..9707495 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_scan_req_report.c @@ -0,0 +1,49 @@ +/* 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 "ble.h" +#include "ble_gap_evt_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" + + +uint32_t ble_gap_evt_scan_req_report_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + const uint16_t evt_header = BLE_GAP_EVT_SCAN_REQ_REPORT; + + err_code = uint16_t_enc((void *)&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_addr_enc((void *)&(p_event->evt.gap_evt.params.scan_req_report.peer_addr), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc((void *)&(p_event->evt.gap_evt.params.scan_req_report.rssi), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_sec_info_request.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_sec_info_request.c new file mode 100644 index 0000000..e3b7949 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_sec_info_request.c @@ -0,0 +1,51 @@ +/* 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 "ble.h" +#include "ble_gap_evt_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_sec_info_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + const uint16_t evt_header = BLE_GAP_EVT_SEC_INFO_REQUEST; + + err_code = uint16_t_enc((void *)&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_sec_info_request_t_enc( + (void *)&p_event->evt.gap_evt.params.sec_info_request, + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_sec_params_request.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_sec_params_request.c new file mode 100644 index 0000000..f2fdf59 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_sec_params_request.c @@ -0,0 +1,51 @@ +/* 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 "ble.h" +#include "ble_gap_evt_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_sec_params_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + const uint16_t evt_header = BLE_GAP_EVT_SEC_PARAMS_REQUEST; + + err_code = uint16_t_enc((void *)&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_sec_params_request_t_enc( + (void *)&p_event->evt.gap_evt.params.sec_params_request, + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_sec_request.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_sec_request.c new file mode 100644 index 0000000..6a744b0 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_sec_request.c @@ -0,0 +1,49 @@ +/* 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 +#include "ble.h" +#include "ble_gap_evt_conn.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_evt_sec_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + uint16_t evt_header = BLE_GAP_EVT_SEC_REQUEST; + + err_code = uint16_t_enc((void *)&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_sec_request_t_enc((void *)&p_event->evt.gap_evt.params.sec_request, + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_timeout.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_timeout.c new file mode 100644 index 0000000..7894cdc --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_evt_timeout.c @@ -0,0 +1,38 @@ +/* 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 "ble.h" +#include "ble_serialization.h" +#include "app_util.h" +#include "ble_gap_evt_conn.h" + + +uint32_t ble_gap_evt_timeout_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_HEADER_SIZE + 3, *p_buf_len); + index += uint16_encode(BLE_GAP_EVT_TIMEOUT, &(p_buf[index])); + index += uint16_encode(p_event->evt.gap_evt.conn_handle, &(p_buf[index])); + p_buf[index++] = p_event->evt.gap_evt.params.timeout.src; + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_ppcp_get.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_ppcp_get.c new file mode 100644 index 0000000..38663fc --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_ppcp_get.c @@ -0,0 +1,80 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_ppcp_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + ble_gap_conn_params_t * * const pp_conn_params) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_conn_params); + SER_ASSERT_NOT_NULL(*pp_conn_params); + SER_ASSERT_LENGTH_LEQ(2, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_GAP_PPCP_GET, NRF_ERROR_INVALID_PARAM); + index++; + + if (p_buf[index++] == SER_FIELD_NOT_PRESENT) + { + *pp_conn_params = NULL; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_ppcp_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gap_conn_params_t const * const p_conn_params) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_PPCP_GET, return_code, + p_buf, p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_conn_params); + uint32_t index = *p_buf_len; + + SER_ASSERT_LENGTH_LEQ(index + 8, total_len); + + index += uint16_encode(p_conn_params->min_conn_interval, &p_buf[index]); + index += uint16_encode(p_conn_params->max_conn_interval, &p_buf[index]); + index += uint16_encode(p_conn_params->slave_latency, &p_buf[index]); + index += uint16_encode(p_conn_params->conn_sup_timeout, &p_buf[index]); + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_ppcp_set.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_ppcp_set.c new file mode 100644 index 0000000..e09aaf2 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_ppcp_set.c @@ -0,0 +1,64 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "nordic_common.h" +#include "app_util.h" + + +uint32_t ble_gap_ppcp_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_conn_params_t * * const pp_conn_params) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_conn_params); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 1, packet_len); + SER_ASSERT(p_buf[index] == SD_BLE_GAP_PPCP_SET, NRF_ERROR_INVALID_PARAM); + + index++; + + switch (p_buf[index++]) + { + case SER_FIELD_NOT_PRESENT: + *pp_conn_params = NULL; + break; + + case SER_FIELD_PRESENT: + SER_ASSERT_LENGTH_LEQ(index + 8, packet_len); + SER_ASSERT_NOT_NULL(*pp_conn_params); + uint16_dec(p_buf, packet_len, &index, &(*pp_conn_params)->min_conn_interval); + uint16_dec(p_buf, packet_len, &index, &(*pp_conn_params)->max_conn_interval); + uint16_dec(p_buf, packet_len, &index, &(*pp_conn_params)->slave_latency); + uint16_dec(p_buf, packet_len, &index, &(*pp_conn_params)->conn_sup_timeout); + break; + + default: + return NRF_ERROR_INVALID_DATA; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_ppcp_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_PPCP_SET, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_rssi_get.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_rssi_get.c new file mode 100644 index 0000000..306caa2 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_rssi_get.c @@ -0,0 +1,77 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_rssi_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * p_conn_handle, + int8_t * * const pp_rssi) +{ + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_rssi); + SER_ASSERT_NOT_NULL(*pp_rssi); + SER_ASSERT_LENGTH_LEQ(3, packet_len); + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void **) pp_rssi, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + +uint32_t ble_gap_rssi_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + int8_t rssi) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_RSSI_GET, return_code, + p_buf, p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + uint32_t index = *p_buf_len; + + err_code = uint8_t_enc((uint8_t *) &rssi, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_rssi_start.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_rssi_start.c new file mode 100644 index 0000000..cd6f516 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_rssi_start.c @@ -0,0 +1,49 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" + +uint32_t ble_gap_rssi_start_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * p_conn_handle, + uint8_t * p_threshold_dbm, + uint8_t * p_skip_count) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_threshold_dbm); + SER_ASSERT_NOT_NULL(p_skip_count); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = SER_CMD_DATA_POS; + + err_code = uint16_t_dec(p_buf, buf_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, buf_len, &index, p_threshold_dbm); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, buf_len, &index, p_skip_count); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} + +uint32_t ble_gap_rssi_start_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_RSSI_START, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_rssi_stop.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_rssi_stop.c new file mode 100644 index 0000000..d068f3d --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_rssi_stop.c @@ -0,0 +1,39 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" + +uint32_t ble_gap_rssi_stop_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * p_conn_handle) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = SER_CMD_DATA_POS; + + err_code = uint16_t_dec(p_buf, buf_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return NRF_SUCCESS; +} + +uint32_t ble_gap_rssi_stop_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_RSSI_STOP, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_scan_start.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_scan_start.c new file mode 100644 index 0000000..b561d3c --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_scan_start.c @@ -0,0 +1,44 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_scan_start_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_scan_params_t * * const pp_scan_params) +{ + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_scan_params); + SER_ASSERT_NOT_NULL(*pp_scan_params); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_scan_params, ble_gap_scan_params_t_dec); + + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + +uint32_t ble_gap_scan_start_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_SCAN_START, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_scan_stop.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_scan_stop.c new file mode 100644 index 0000000..a390f17 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_scan_stop.c @@ -0,0 +1,23 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_scan_stop_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_SCAN_STOP, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_sec_info_reply.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_sec_info_reply.c new file mode 100644 index 0000000..3e85479 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_sec_info_reply.c @@ -0,0 +1,72 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" +#include "ble_gap_struct_serialization.h" +#include "cond_field_serialization.h" + +uint32_t ble_gap_sec_info_reply_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * p_conn_handle, + ble_gap_enc_info_t * * const pp_enc_info, + ble_gap_irk_t * * const pp_id_info, + ble_gap_sign_info_t * * const pp_sign_info) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_enc_info); + SER_ASSERT_NOT_NULL(pp_id_info); + SER_ASSERT_NOT_NULL(pp_sign_info); + SER_ASSERT_NOT_NULL(*pp_enc_info); + SER_ASSERT_NOT_NULL(*pp_id_info); + SER_ASSERT_NOT_NULL(*pp_sign_info); + + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(2, packet_len - index); + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + err_code = cond_field_dec(p_buf, + packet_len, + &index, + (void * *)pp_enc_info, + ble_gap_enc_info_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + packet_len, + &index, + (void * *)pp_id_info, + ble_gap_irk_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + packet_len, + &index, + (void * *)pp_sign_info, + ble_gap_sign_info_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + return err_code; +} + +uint32_t ble_gap_sec_info_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_SEC_INFO_REPLY, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_sec_params_reply.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_sec_params_reply.c new file mode 100644 index 0000000..0c295be --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_sec_params_reply.c @@ -0,0 +1,90 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_sec_params_reply_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * p_conn_handle, + uint8_t * p_sec_status, + ble_gap_sec_params_t * * const pp_sec_params, + ble_gap_sec_keyset_t * * const pp_sec_keyset) +{ + uint32_t index = SER_CMD_HEADER_SIZE; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_sec_status); + SER_ASSERT_NOT_NULL(pp_sec_params); + SER_ASSERT_NOT_NULL(*pp_sec_params); + SER_ASSERT_NOT_NULL(pp_sec_keyset); + SER_ASSERT_NOT_NULL(*pp_sec_keyset); + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, packet_len, &index, p_sec_status); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *) pp_sec_params, ble_gap_sec_params_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *) pp_sec_keyset, ble_gap_sec_keyset_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + +//opcode: 0x7F +uint32_t ble_gap_sec_params_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gap_sec_keyset_t * const p_sec_keyset) +{ + uint32_t index = 0; + uint32_t buf_len = * p_buf_len; + uint32_t err_code = NRF_SUCCESS; + + err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_SEC_PARAMS_REPLY, + return_code, + p_buf, + p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_sec_keyset); + index = *p_buf_len; + + err_code = cond_field_enc(p_sec_keyset, p_buf, buf_len, &index, ble_gap_sec_keyset_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gap_tx_power_set.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_tx_power_set.c new file mode 100644 index 0000000..6af4f31 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gap_tx_power_set.c @@ -0,0 +1,39 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" + +uint32_t ble_gap_tx_power_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + int8_t * p_tx_power) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_tx_power); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = SER_CMD_DATA_POS; + + err_code = uint8_t_dec(p_buf, packet_len, &index, p_tx_power); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + +uint32_t ble_gap_tx_power_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_TX_POWER_SET, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_char_value_by_uuid_read.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_char_value_by_uuid_read.c new file mode 100644 index 0000000..6fbc19d --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_char_value_by_uuid_read.c @@ -0,0 +1,65 @@ +/* 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 "ble_gattc_conn.h" +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "ble_gattc_struct_serialization.h" +#include "cond_field_serialization.h" +#include "ble_types.h" +#include + +uint32_t ble_gattc_char_value_by_uuid_read_req_dec( + uint8_t const * const p_buf, + uint16_t buf_len, + uint16_t * const p_conn_handle, + ble_uuid_t * * const pp_uuid, + ble_gattc_handle_range_t * * const + pp_handle_range) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_uuid); + SER_ASSERT_NOT_NULL(*pp_uuid); + SER_ASSERT_NOT_NULL(pp_handle_range); + SER_ASSERT_NOT_NULL(*pp_handle_range); + + uint32_t index = 0; + uint32_t err_code; + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 2, buf_len); + SER_ASSERT(p_buf[index] == SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, NRF_ERROR_INVALID_DATA); + index++; + + uint16_dec(p_buf, buf_len, &index, p_conn_handle); + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_uuid, ble_uuid_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_handle_range, + ble_gattc_handle_range_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} + + +uint32_t ble_gattc_char_value_by_uuid_read_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, return_code, + p_buf, p_buf_len); +} + diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_char_values_read.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_char_values_read.c new file mode 100644 index 0000000..39c6808 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_char_values_read.c @@ -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. + * + */ + +#include + +#include "ble_gatts_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gattc_char_values_read_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * * const pp_handles, + uint16_t * const p_handle_count) +{ + SER_ASSERT_NOT_NULL(p_buf); //check if *p_buf is allocated + SER_ASSERT_NOT_NULL(p_conn_handle); //check if *p_conn_handle exist + SER_ASSERT_NOT_NULL(pp_handles); //check if *p_handles exist + SER_ASSERT_NOT_NULL(*pp_handles); //check if p_handles exist + SER_ASSERT_NOT_NULL(p_handle_count); //check if *p_handle_count exist + + uint32_t index = SER_CMD_DATA_POS; + uint32_t status_code; + + SER_ASSERT_LENGTH_LEQ(5, packet_len - index); //make sure that payload length is at least 5 bytes + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + //decode handle table count with optional handle table + status_code = count16_cond_data16_dec(p_buf, packet_len, &index, pp_handles, p_handle_count); + SER_ASSERT(status_code == NRF_SUCCESS, status_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return status_code; +} + + +uint32_t ble_gattc_char_values_read_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + return op_status_enc(SD_BLE_GATTC_CHAR_VALUES_READ, return_code, p_buf, p_buf_len, &index); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_characteristics_discover.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_characteristics_discover.c new file mode 100644 index 0000000..e17edb2 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_characteristics_discover.c @@ -0,0 +1,63 @@ +/* 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 "ble_gattc_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_characteristics_discover_req_dec( + uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gattc_handle_range_t * * const pp_handle_range) +{ + uint32_t index = SER_CMD_DATA_POS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_handle_range); + SER_ASSERT_NOT_NULL(*pp_handle_range); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 2 + 1, packet_len); + + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + switch (p_buf[index++]) + { + case SER_FIELD_NOT_PRESENT: + *pp_handle_range = NULL; + break; + + case SER_FIELD_PRESENT: + SER_ASSERT_LENGTH_LEQ(index + 2 + 2, packet_len); + uint16_dec(p_buf, packet_len, &index, &(*pp_handle_range)->start_handle); + uint16_dec(p_buf, packet_len, &index, &(*pp_handle_range)->end_handle); + break; + + default: + return NRF_ERROR_INVALID_DATA; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_characteristics_discover_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTC_CHARACTERISTICS_DISCOVER, + return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_conn.h b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_conn.h new file mode 100644 index 0000000..f803c91 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_conn.h @@ -0,0 +1,398 @@ +/* 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. + * + */ +#ifndef BLE_GATTC_CONN_H__ +#define BLE_GATTC_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s110_codecs Connectivity s110 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gatc_conn GATTC Connectivity command request decoders and command response encoders + * @{ + * @ingroup ser_conn_s110_codecs + * + * @brief GATTC Connectivity command request decoders and command response encoders + */ +#include "ble_gattc.h" +#include "ble.h" + +/**@brief Decodes @ref sd_ble_gattc_characteristics_discover command request. + * + * @sa @ref nrf51_sd_ble_gattc_characteristics_discover_encoding for packet format, + * @ref ble_gattc_characteristics_discover_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] pp_handle_range Pointer to pointer to handle range. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for handle range field present. + */ +uint32_t ble_gattc_characteristics_discover_req_dec + (uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gattc_handle_range_t * * const pp_handle_range); + +/**@brief Encodes @ref sd_ble_gattc_characteristics_discover command response. + * + * @sa @ref nrf51_sd_ble_gattc_characteristics_discover_encoding for packet format. + * @ref ble_gattc_characteristics_discover_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_characteristics_discover_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gattc_descriptors_discover command request. + * + * @sa @ref nrf51_sd_ble_gattc_descriptors_discover_encoding for packet format, + * @ref ble_gattc_descriptors_discover_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] pp_handle_range Pointer to pointer to handle range. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for handle range field present. + */ +uint32_t ble_gattc_descriptors_discover_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gattc_handle_range_t * * const pp_handle_range); + +/**@brief Encodes @ref sd_ble_gattc_descriptors_discover command response. + * + * @sa @ref nrf51_sd_ble_gattc_descriptors_discover_encoding for packet format. + * @ref ble_gattc_descriptors_discover_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_descriptors_discover_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gattc_relationships_discover command request. + * + * @sa @ref nrf51_sd_ble_gattc_relationships_discover_encoding for packet format, + * @ref ble_gattc_relationships_discover_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] pp_handle_range Pointer to pointer to handle range. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for handle range field present. + */ +uint32_t ble_gattc_relationships_discover_req_dec + (uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gattc_handle_range_t * * const pp_handle_range); + +/**@brief Encodes @ref sd_ble_gattc_relationships_discover command response. + * + * @sa @ref nrf51_sd_ble_gattc_relationships_discover_encoding for packet format. + * @ref ble_gattc_relationships_discover_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_relationships_discover_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gattc_primary_services_discover command request. + * + * @sa @ref nrf51_sd_ble_gattc_primary_services_discover_encoding for packet format, + * @ref ble_gattc_primary_services_discover_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] p_start_handle Pointer to start handle. + * @param[out] pp_srvc_uuid Pointer to pointer to service uuid. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for uuid field present. + */ +uint32_t ble_gattc_primary_services_discover_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * const p_start_handle, + ble_uuid_t * * const pp_srvc_uuid); + +/**@brief Encodes @ref sd_ble_gattc_primary_services_discover command response. + * + * @sa @ref nrf51_sd_ble_gattc_primary_services_discover_encoding for packet format. + * @ref ble_gattc_primary_services_discover_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_primary_services_discover_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gattc_read command request. + * + * @sa @ref nrf51_sd_ble_gattc_read_encoding for packet format, + * @ref ble_gattc_read_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] p_handle Pointer to handle. + * @param[out] p_offset Pointer to offset. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_read_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * const p_handle, + uint16_t * const p_offset); + +/**@brief Encodes @ref sd_ble_gattc_read command response. + * + * @sa @ref nrf51_sd_ble_gattc_read_encoding for packet format. + * @ref ble_gattc_read_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_read_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gattc_char_values_read command request. + * + * @sa @ref nrf51_sd_ble_gattc_char_values_read for packet format, + * @ref ble_gattc_char_values_read_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] pp_handles Pointer to pointer to handle table. + * @param[out] p_handle_count Pointer to handle handle table count. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ + +uint32_t ble_gattc_char_values_read_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * * const pp_handles, + uint16_t * const p_handle_count); + +/**@brief Encodes @ref sd_ble_gattc_char_values_read command response. + * + * @sa @ref nrf51_sd_ble_gattc_char_values_read for packet format. + * @ref ble_gattc_char_values_read_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_char_values_read_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gattc_write command request. + * + * @sa @ref nrf51_sd_ble_gattc_write_encoding for packet format, + * @ref ble_gattc_write_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] pp_write_params Pointer to pointer to write parameters. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_write_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gattc_write_params_t * * const pp_write_params); + +/**@brief Encodes @ref sd_ble_gattc_write command response. + * + * @sa @ref nrf51_sd_ble_gattc_write_encoding for packet format. + * @ref ble_gattc_write_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_write_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gattc_hv_confirm command request. + * + * @sa @ref nrf51_sd_ble_gattc_hv_confirm for packet format, + * @ref ble_gattc_hv_confirm_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] p_handle Pointer to handle of the attribute in the indication. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_hv_confirm_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * const p_handle); + +/**@brief Encodes @ref sd_ble_gattc_hv_confirm command response. + * + * @sa @ref nrf51_sd_ble_gattc_hv_confirm for packet format. + * @ref ble_gattc_hv_confirm_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_hv_confirm_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gattc_char_value_by_uuid_read command request. + * + * @sa @ref nrf51_sd_ble_gattc_char_value_by_uuid_read_encoding for packet format, + * @ref ble_gattc_char_value_by_uuid_read_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of request packet. + * @param[out] p_conn_handle Pointer to connection handle of the connection. + * @param[out] pp_uuid Pointer to pointer to a characteristic value UUID to read. + * @param[out] pp_handle_range Pointer to pointer to the range of handles to perform this + * procedure on. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid operation type. + */ +uint32_t ble_gattc_char_value_by_uuid_read_req_dec + (uint8_t const * const p_buf, + uint16_t buf_len, + uint16_t * const p_conn_handle, + ble_uuid_t * * const pp_uuid, + ble_gattc_handle_range_t * * const pp_handle_range); + +/**@brief Encodes @ref sd_ble_gattc_char_value_by_uuid_read command response. + * + * @sa @ref nrf51_sd_ble_gattc_char_value_by_uuid_read_encoding for packet format. + * @ref ble_gattc_char_value_by_uuid_read_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_char_value_by_uuid_read_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** @} */ +#endif + diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_descriptors_discover.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_descriptors_discover.c new file mode 100644 index 0000000..f78e675 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_descriptors_discover.c @@ -0,0 +1,62 @@ +/* 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 "ble_gattc_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_descriptors_discover_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gattc_handle_range_t * * const pp_handle_range) +{ + uint32_t index = SER_CMD_DATA_POS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_handle_range); + SER_ASSERT_NOT_NULL(*pp_handle_range); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 2 + 1, packet_len); + + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + switch (p_buf[index++]) + { + case SER_FIELD_NOT_PRESENT: + *pp_handle_range = NULL; + break; + + case SER_FIELD_PRESENT: + SER_ASSERT_LENGTH_LEQ(index + 2 + 2, packet_len); + uint16_dec(p_buf, packet_len, &index, &(*pp_handle_range)->start_handle); + uint16_dec(p_buf, packet_len, &index, &(*pp_handle_range)->end_handle); + break; + + default: + return NRF_ERROR_INVALID_DATA; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_descriptors_discover_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTC_DESCRIPTORS_DISCOVER, + return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_char_disc_rsp.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_char_disc_rsp.c new file mode 100644 index 0000000..5799434 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_char_disc_rsp.c @@ -0,0 +1,73 @@ +/* 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 "ble_gattc_evt_conn.h" +#include "ble_serialization.h" +#include "ble_gatts.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_char_disc_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 8, *p_buf_len); + index += uint16_encode(BLE_GATTC_EVT_CHAR_DISC_RSP, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.conn_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.gatt_status, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.error_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.char_disc_rsp.count, &(p_buf[index])); + + uint16_t service_count = p_event->evt.gattc_evt.params.char_disc_rsp.count; + + SER_ASSERT_LENGTH_LEQ(index + (service_count * 9), *p_buf_len); + + for (uint16_t i = 0; i < service_count; i++) + { + index += uint16_encode(p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].uuid.uuid, + &(p_buf[index])); + p_buf[index++] = p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].uuid.type; + p_buf[index++] = (0x00 | + (p_event->evt.gattc_evt.params.char_disc_rsp.chars[i]. + char_props.broadcast << 0) | + (p_event->evt.gattc_evt.params.char_disc_rsp.chars[i]. + char_props.read << 1) | + (p_event->evt.gattc_evt.params.char_disc_rsp.chars[i]. + char_props.write_wo_resp << 2) | + (p_event->evt.gattc_evt.params.char_disc_rsp.chars[i]. + char_props.write << 3) | + (p_event->evt.gattc_evt.params.char_disc_rsp.chars[i]. + char_props.notify << 4) | + (p_event->evt.gattc_evt.params.char_disc_rsp.chars[i]. + char_props.indicate << 5) | + (p_event->evt.gattc_evt.params.char_disc_rsp.chars[i]. + char_props.auth_signed_wr << 6)); + p_buf[index++] = (p_event->evt.gattc_evt.params.char_disc_rsp.chars[i]. + char_ext_props & 0x01); + + index += uint16_encode(p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].handle_decl, + &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].handle_value, + &(p_buf[index])); + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c new file mode 100644 index 0000000..4326380 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c @@ -0,0 +1,52 @@ +/* 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_util.h" +#include "ble.h" +#include "ble_serialization.h" +#include "ble_gattc_struct_serialization.h" +#include "ble_gattc_evt_conn.h" + + +uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code; + + err_code = uint16_t_enc(&p_event->header.evt_id, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_event->evt.gattc_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_event->evt.gattc_evt.gatt_status, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_event->evt.gattc_evt.error_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gattc_evt_char_val_by_uuid_read_rsp_t_enc( + &p_event->evt.gattc_evt.params.char_val_by_uuid_read_rsp, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_char_vals_read_rsp.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_char_vals_read_rsp.c new file mode 100644 index 0000000..fa7fc41 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_char_vals_read_rsp.c @@ -0,0 +1,59 @@ +/* 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 "ble_gattc_evt_conn.h" +#include "ble_gattc_struct_serialization.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_char_vals_read_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint16_t evt_header = BLE_GATTC_EVT_CHAR_VALS_READ_RSP; + + //Event Header + err_code = uint16_t_enc(&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + //GATTC Header + err_code = uint16_t_enc(&(p_event->evt.gattc_evt.conn_handle), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_event->evt.gattc_evt.gatt_status), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_event->evt.gattc_evt.error_handle), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + //Event structure for BLE_GATTC_EVT_CHAR_VALS_READ_RSP + err_code = + ble_gattc_evt_char_vals_read_rsp_t_enc(&(p_event->evt.gattc_evt.params.char_vals_read_rsp), + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_conn.h b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_conn.h new file mode 100644 index 0000000..8e5d9f9 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_conn.h @@ -0,0 +1,236 @@ +/* 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 BLE_GATTC_EVT_CONN_H__ +#define BLE_GATTC_EVT_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s110_codecs Connectivity s110 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gattc_evt_conn GATTC Connectivity event encoders + * @{ + * @ingroup ser_conn_s110_codecs + * + * @brief GATTC Connectivity event encoders. + */ +#include "ble.h" + +/** + * @brief Encodes ble_gattc_evt_char_disc_rsp event. + * + * @sa @ref nrf51_gattc_evt_char_disc_rsp_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_char_disc_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gattc_evt_char_val_by_uuid_read_rsp event. + * + * @sa @ref nrf51_gattc_evt_char_val_by_uuid_read_rsp_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gattc_evt_char_vals_read_rsp event. + * + * @sa @ref nrf51_gattc_evt_char_vals_read_rsp_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_char_vals_read_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gattc_evt_desc_disc_rsp event. + * + * @sa @ref nrf51_gattc_evt_desc_disc_rsp_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_desc_disc_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gattc_evt_hvx event. + * + * @sa @ref nrf51_gattc_evt_hvx_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_hvx_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gattc_evt_prim_srvc_disc_rsp event. + * + * @sa @ref nrf51_gattc_evt_prim_srvc_disc_rsp_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_prim_srvc_disc_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gattc_evt_read_rsp event. + * + * @sa @ref nrf51_gattc_evt_read_rsp_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_read_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gattc_evt_rel_disc_rsp event. + * + * @sa @ref nrf51_gattc_evt_rel_disc_rsp_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_rel_disc_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gattc_evt_timeout event. + * + * @sa @ref nrf51_gattc_evt_timeout_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_timeout_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gattc_evt_write_rsp event. + * + * @sa @ref nrf51_gattc_evt_write_rsp_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_write_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** @} */ +#endif diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_desc_disc_rsp.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_desc_disc_rsp.c new file mode 100644 index 0000000..378e77b --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_desc_disc_rsp.c @@ -0,0 +1,53 @@ +/* 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 "ble_gattc_evt_conn.h" +#include "ble_serialization.h" +#include "ble_gatts.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_desc_disc_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 8, *p_buf_len); + index += uint16_encode(BLE_GATTC_EVT_DESC_DISC_RSP, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.conn_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.gatt_status, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.error_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.desc_disc_rsp.count, &(p_buf[index])); + + uint16_t service_count = p_event->evt.gattc_evt.params.desc_disc_rsp.count; + + SER_ASSERT_LENGTH_LEQ(index + (service_count * 5), *p_buf_len); + + for (uint16_t i = 0; i < service_count; i++) + { + index += uint16_encode(p_event->evt.gattc_evt.params.desc_disc_rsp.descs[i].handle, + &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.desc_disc_rsp.descs[i].uuid.uuid, + &(p_buf[index])); + p_buf[index++] = p_event->evt.gattc_evt.params.desc_disc_rsp.descs[i].uuid.type; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_hvx.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_hvx.c new file mode 100644 index 0000000..8e3a49e --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_hvx.c @@ -0,0 +1,52 @@ +/* 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 "ble_gattc_evt_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_hvx_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 11, *p_buf_len); + index += uint16_encode(BLE_GATTC_EVT_HVX, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.conn_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.gatt_status, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.error_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.hvx.handle, &(p_buf[index])); + p_buf[index++] = p_event->evt.gattc_evt.params.hvx.type; + index += uint16_encode(p_event->evt.gattc_evt.params.hvx.len, &(p_buf[index])); + + SER_ASSERT_LENGTH_LEQ(index + p_event->evt.gattc_evt.params.hvx.len, *p_buf_len); + + if (p_event->evt.gattc_evt.params.hvx.len > 0) + { + memcpy(&(p_buf[index]), + &(p_event->evt.gattc_evt.params.hvx.data[0]), + p_event->evt.gattc_evt.params.hvx.len); + index += p_event->evt.gattc_evt.params.hvx.len; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c new file mode 100644 index 0000000..f70c538 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c @@ -0,0 +1,62 @@ +/* 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 "ble_gattc_evt_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_prim_srvc_disc_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 8, *p_buf_len); + index += uint16_encode(BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.conn_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.gatt_status, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.error_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.count, &(p_buf[index])); + + uint16_t service_count = p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.count; + + SER_ASSERT_LENGTH_LEQ(index + (service_count * 7), *p_buf_len); + + for (uint16_t i = 0; i < service_count; i++) + { + index += uint16_encode( + p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].uuid.uuid, + &(p_buf[index])); + p_buf[index++] = p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].uuid.type; + index += + uint16_encode( + p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].handle_range. + start_handle, + &(p_buf[index])); + index += + uint16_encode( + p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].handle_range. + end_handle, + &(p_buf[index])); + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_read_rsp.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_read_rsp.c new file mode 100644 index 0000000..2d2b0f5 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_read_rsp.c @@ -0,0 +1,52 @@ +/* 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 "ble_gattc_evt_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_read_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 12, *p_buf_len); + index += uint16_encode(BLE_GATTC_EVT_READ_RSP, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.conn_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.gatt_status, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.error_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.read_rsp.handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.read_rsp.offset, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.read_rsp.len, &(p_buf[index])); + + SER_ASSERT_LENGTH_LEQ(index + p_event->evt.gattc_evt.params.read_rsp.len, *p_buf_len); + + if (p_event->evt.gattc_evt.params.read_rsp.len > 0) + { + memcpy(&(p_buf[index]), + &(p_event->evt.gattc_evt.params.read_rsp.data[0]), + p_event->evt.gattc_evt.params.read_rsp.len); + index += p_event->evt.gattc_evt.params.read_rsp.len; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_rel_disc_rsp.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_rel_disc_rsp.c new file mode 100644 index 0000000..fd83b62 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_rel_disc_rsp.c @@ -0,0 +1,51 @@ +/* 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 "ble_gattc_evt_conn.h" +#include "ble_serialization.h" +#include "ble_gattc_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_rel_disc_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t error_code = NRF_SUCCESS; + uint16_t evt_header = BLE_GATTC_EVT_REL_DISC_RSP; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + error_code = uint16_t_enc(&evt_header, p_buf, total_len, &index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint16_t_enc(&p_event->evt.gattc_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint16_t_enc(&p_event->evt.gattc_evt.gatt_status, p_buf, total_len, &index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint16_t_enc(&p_event->evt.gattc_evt.error_handle, p_buf, total_len, &index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_gattc_evt_rel_disc_rsp_t_enc(&p_event->evt.gattc_evt.params.rel_disc_rsp, + p_buf, + total_len, + &index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + *p_buf_len = index; + + return error_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_timeout.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_timeout.c new file mode 100644 index 0000000..ee1e08d --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_timeout.c @@ -0,0 +1,37 @@ +/* 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 "ble_gattc_evt_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_timeout_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 2 + 1, *p_buf_len); + index += uint16_encode(BLE_GATTC_EVT_TIMEOUT, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.conn_handle, &(p_buf[index])); + p_buf[index++] = p_event->evt.gattc_evt.params.timeout.src; + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_write_rsp.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_write_rsp.c new file mode 100644 index 0000000..7692b94 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_evt_write_rsp.c @@ -0,0 +1,53 @@ +/* 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 "ble_gattc_evt_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_write_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 13, *p_buf_len); + index += uint16_encode(BLE_GATTC_EVT_WRITE_RSP, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.conn_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.gatt_status, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.error_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.write_rsp.handle, &(p_buf[index])); + p_buf[index++] = p_event->evt.gattc_evt.params.write_rsp.write_op; + index += uint16_encode(p_event->evt.gattc_evt.params.write_rsp.offset, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.write_rsp.len, &(p_buf[index])); + + SER_ASSERT_LENGTH_LEQ(index + p_event->evt.gattc_evt.params.write_rsp.len, *p_buf_len); + + if (p_event->evt.gattc_evt.params.write_rsp.len > 0) + { + memcpy(&(p_buf[index]), + &(p_event->evt.gattc_evt.params.write_rsp.data[0]), + p_event->evt.gattc_evt.params.write_rsp.len); + index += p_event->evt.gattc_evt.params.write_rsp.len; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_hv_confirm.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_hv_confirm.c new file mode 100644 index 0000000..6a1be3f --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_hv_confirm.c @@ -0,0 +1,45 @@ +/* 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 "ble_gattc_conn.h" +#include "ble_serialization.h" + +uint32_t ble_gattc_hv_confirm_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * const p_handle) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_handle); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = SER_CMD_DATA_POS; + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + +uint32_t ble_gattc_hv_confirm_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTC_HV_CONFIRM, + return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_primary_services_discover.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_primary_services_discover.c new file mode 100644 index 0000000..678e5e8 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_primary_services_discover.c @@ -0,0 +1,67 @@ +/* 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 "ble_gattc_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_primary_services_discover_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * const p_start_handle, + ble_uuid_t * * const pp_srvc_uuid) +{ + uint32_t index = SER_CMD_DATA_POS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_start_handle); + SER_ASSERT_NOT_NULL(pp_srvc_uuid); + SER_ASSERT_NOT_NULL(*pp_srvc_uuid); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 2 + 2 + 1, packet_len); + + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + uint16_dec(p_buf, packet_len, &index, p_start_handle); + + switch (p_buf[index++]) + { + case SER_FIELD_NOT_PRESENT: + *pp_srvc_uuid = NULL; + break; + + case SER_FIELD_PRESENT: + SER_ASSERT_LENGTH_LEQ(index + 2 + 1, packet_len); + uint16_dec(p_buf, packet_len, &index, &(*pp_srvc_uuid)->uuid); + uint8_dec(p_buf, packet_len, &index, &(*pp_srvc_uuid)->type); + break; + + default: + return NRF_ERROR_INVALID_DATA; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_primary_services_discover_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER, + return_code, + p_buf, + p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_read.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_read.c new file mode 100644 index 0000000..ca0af98 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_read.c @@ -0,0 +1,49 @@ +/* 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 "ble_gattc_conn.h" +#include "ble_serialization.h" + +uint32_t ble_gattc_read_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * const p_handle, + uint16_t * const p_offset) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_handle); + SER_ASSERT_NOT_NULL(p_offset); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = SER_CMD_DATA_POS; + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_offset); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + +uint32_t ble_gattc_read_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTC_READ, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_relationships_discover.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_relationships_discover.c new file mode 100644 index 0000000..7a61a3a --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_relationships_discover.c @@ -0,0 +1,64 @@ +/* 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 "ble_gattc_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_relationships_discover_req_dec( + uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gattc_handle_range_t * * const + pp_handle_range) +{ + uint32_t index = SER_CMD_DATA_POS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_handle_range); + SER_ASSERT_NOT_NULL(*pp_handle_range); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 2 + 1, packet_len); + + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + switch (p_buf[index++]) + { + case SER_FIELD_NOT_PRESENT: + *pp_handle_range = NULL; + break; + + case SER_FIELD_PRESENT: + SER_ASSERT_LENGTH_LEQ(index + 2 + 2, packet_len); + uint16_dec(p_buf, packet_len, &index, &(*pp_handle_range)->start_handle); + uint16_dec(p_buf, packet_len, &index, &(*pp_handle_range)->end_handle); + break; + + default: + return NRF_ERROR_INVALID_DATA; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_relationships_discover_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, + return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_write.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_write.c new file mode 100644 index 0000000..e889bce --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gattc_write.c @@ -0,0 +1,59 @@ +/* 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 "ble_gattc_conn.h" +#include "ble_serialization.h" +#include "ble_gattc_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" +#include + + +uint32_t ble_gattc_write_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gattc_write_params_t * * const pp_write_params) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_write_params); + SER_ASSERT_NOT_NULL(*pp_write_params); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = 0; + + uint8_t op_code; + err_code = uint8_t_dec(p_buf, packet_len, &index, &op_code); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + SER_ASSERT(op_code == SD_BLE_GATTC_WRITE, NRF_ERROR_INVALID_PARAM); + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + packet_len, + &index, + (void * *)pp_write_params, + ble_gattc_write_params_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + +uint32_t ble_gattc_write_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTC_WRITE, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_characteristic_add.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_characteristic_add.c new file mode 100644 index 0000000..1e1a9de --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_characteristic_add.c @@ -0,0 +1,88 @@ +/* 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 "ble_gatts_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + +uint32_t ble_gatts_characteristic_add_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * service_handle, + ble_gatts_char_md_t * * const pp_char_md, + ble_gatts_attr_t * * const pp_attr_char_value, + ble_gatts_char_handles_t * * const pp_handles) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(service_handle); + SER_ASSERT_NOT_NULL(pp_char_md); + SER_ASSERT_NOT_NULL(pp_attr_char_value); + SER_ASSERT_NOT_NULL(pp_handles); + SER_ASSERT_NOT_NULL(*pp_char_md); + SER_ASSERT_NOT_NULL(*pp_attr_char_value); + SER_ASSERT_NOT_NULL(*pp_handles); + + uint32_t index = SER_CMD_DATA_POS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len); + uint32_t err_code; + SER_ASSERT_LENGTH_LEQ(2, buf_len - index); + uint16_dec(p_buf, buf_len, &index, service_handle); + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_char_md, ble_gatts_char_md_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + buf_len, + &index, + (void * *)pp_attr_char_value, + ble_gatts_attr_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_handles, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT(index == buf_len, NRF_ERROR_INVALID_LENGTH); + + return err_code; +} + +uint32_t ble_gatts_characteristic_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gatts_char_handles_t const * const p_handles) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + SER_ASSERT_LENGTH_LEQ(1 + 4, total_len); + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTS_CHARACTERISTIC_ADD, + return_code, + p_buf, + p_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (return_code == NRF_SUCCESS) /* Add value and it's length. */ + { + err_code = cond_field_enc((void *)p_handles, + p_buf, + total_len, + p_buf_len, + ble_gatts_char_handles_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_conn.h b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_conn.h new file mode 100644 index 0000000..8f14c21 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_conn.h @@ -0,0 +1,514 @@ +/* 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. + * + */ +#ifndef BLE_GATTS_CONN_H__ +#define BLE_GATTS_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s110_codecs Connectivity s110 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gatts_conn GATTS Connectivity command request decoders and command response encoders + * @{ + * @ingroup ser_conn_s110_codecs + * + * @brief GATTS Connectivity command request decoders and command response encoders + */ + +#include "ble_gatts.h" +#include "ble.h" + +/**@brief Decodes @ref sd_ble_gatts_value_get command request. + * + * @sa @ref nrf51_gatts_value_get_encoding for packet format, + * @ref ble_gatts_value_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of request packet. + * @param[out] p_conn_handle Pointer to the connection_handle. + * @param[out] p_handle Pointer to the attribute_handle. + * @param[out] pp_value Pointer to pointer to the Attribute Value structure. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_value_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * const p_handle, + ble_gatts_value_t * * const pp_value); + +/**@brief Encodes @ref sd_ble_gatts_value_get command response. + * + * @sa @ref nrf51_gatts_value_get_sec_response for packet format. + * @ref ble_gatts_value_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_value Pointer to Attribute Value structure. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_value_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gatts_value_t * const p_value); + +/**@brief Decodes @ref sd_ble_gatts_characteristic_add command request. + * + * @sa @ref nrf51_characteristics_add_encoding for packet format, + * @ref ble_gatts_characteristic_add_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of request packet. + * @param[out] p_service_handle Pointer to the service_handle. + * @param[out] constpp_char_md Pointer to pointer to the location where Characteristic metadata + * will be decoded. + * @param[out] pp_attr_char_value Pointer to pointer to the location where GATT Attribute will be + * decoded. + * @param[out] pp_handles Pointer to pointer to the location where Characteristic definition + * handles will be decoded. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_characteristic_add_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * p_service_handle, + ble_gatts_char_md_t * * constpp_char_md, + ble_gatts_attr_t * * const pp_attr_char_value, + ble_gatts_char_handles_t * * const pp_handles); + +/**@brief Encodes @ref ble_gatts_sys_attr_get_rsp_enc command response. + * + * @sa @ref sd_ble_gatts_sys_attr_get for packet format. + * @ref ble_gatts_sys_attr_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_handles Pointer to handle struct to be encoded. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_characteristic_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gatts_char_handles_t const * const p_handles); + +/**@brief Decodes @ref sd_ble_gatts_include_add command request. + * + * @sa @ref nrf51_gatts_include_add_encoding for packet format, + * @ref ble_gatts_include_add_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of request packet. + * @param[out] p_service_handle Pointer to the service_handle. + * @param[out] p_inc_srvc_handle Pointer to the handle of the included service. + * @param[out] pp_include_handle Pointer to Pointer to 16-bit word where the assigned handle will be stored. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ + +uint32_t ble_gatts_include_add_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_service_handle, + uint16_t * const p_inc_srvc_handle, + uint16_t * * const pp_include_handle); + +/**@brief Encodes @ref ble_gatts_include_add_rsp_enc command response. + * + * @sa @ref nrf51_gatts_include_add_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_include_handle Pointer to a 16-bit word where the assigned handle was stored. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ + +uint32_t ble_gatts_include_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t const * const p_include_handle); + +/**@brief Decodes @ref sd_ble_gatts_service_add command request. + * + * @sa @ref nrf51_gatts_service_add_encoding for packet format, + * @ref ble_gatts_service_add_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of request packet. + * @param[out] p_type Pointer to the service type. + * @param[out] pp_uuid Pointer to pointer to service UUID. + * @param[out] pp_handle Pointer to Pointer to a 16-bit word where the assigned handle will be stored. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ + +uint32_t ble_gatts_service_add_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint8_t * const p_type, + ble_uuid_t * * const pp_uuid, + uint16_t * * const pp_handle); + +/**@brief Encodes @ref ble_gatts_service_add_rsp_enc command response. + * + * @sa @ref nrf51_gatts_service_add_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_handle Pointer to a 16-bit word where the assigned handle was stored. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ + +uint32_t ble_gatts_service_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t const * const p_handle); + +/**@brief Decodes @ref ble_gatts_sys_attr_get_req_dec command request. + * + * @sa @ref sd_ble_gatts_sys_attr_get for packet format, + * @ref ble_gatts_sys_attr_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connectiton handle. + * @param[out] pp_sys_attr_data Pointer to pointer to buffer where system attributes data will be filled in. + * @param[out] pp_sys_attr_data_len Pointer to pointer to variable which contains size of buffer for system attributes. + * @param[out] p_flags Pointer to additional optional flags. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gatts_sys_attr_get_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint8_t * * const pp_sys_attr_data, + uint16_t * * const pp_sys_attr_data_len, + uint32_t * const p_flags); + +/**@brief Encodes @ref ble_gatts_sys_attr_get_rsp_enc command response. + * + * @sa @ref sd_ble_gatts_sys_attr_get for packet format. + * @ref ble_gatts_sys_attr_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_sys_attr_data Pointer to buffer where system attributes data are storred. + * @param[in] p_sys_attr_data_len Pointer to variable which contains size of buffer for system attributes. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_sys_attr_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint8_t const * const p_sys_attr_data, + uint16_t const * const p_sys_attr_data_len); + +/**@brief Decodes @ref sd_ble_gatts_value_set command request. + * + * @sa @ref nrf51_gatts_value_set_encoding for packet format, + * @ref ble_gatts_value_set_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle + * @param[out] p_handle Pointer to attribute handle + * @param[out] pp_value Pointer to pointer to attribute value structure + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ + +uint32_t ble_gatts_value_set_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * p_conn_handle, + uint16_t * p_handle, + ble_gatts_value_t * * const pp_value); + +/**@brief Encodes @ref sd_ble_gatts_value_set command response. + * + * @sa @ref nrf51_gatts_value_set_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buff Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buff_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_value \c in: size of value returned when value was written with success + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_value_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buff, + uint32_t * const p_buff_len, + ble_gatts_value_t * p_value); + +/**@brief Decodes @ref sd_ble_gatts_sys_attr_set command request. + * + * @sa @ref nrf51_gatts_sys_attr_set_encoding for packet format, + * @ref ble_gatts_sys_attr_set_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of request packet. + * @param[out] p_conn_handle Pointer to the buffer raw data to be placed in advertisement packet. + * @param[out] pp_sys_attr_data Pointer to pointer to system attribute data. + * @param[out] p_sys_attr_data_len Pointer to data length for system attribute data. + * @param[out] p_flags Pointer to additional optional flags. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_sys_attr_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint8_t * * const pp_sys_attr_data, + uint16_t * const p_sys_attr_data_len, + uint32_t * const p_flags); + +/**@brief Encodes @ref sd_ble_gatts_sys_attr_set command response. + * + * @sa @ref nrf51_gatts_sys_attr_set_encoding for packet format. + * @ref ble_gatts_sys_attr_set_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_sys_attr_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref ble_gatts_hvx_req_dec command request. + * + * @sa @ref sd_ble_gatts_hvx for packet format, + * @ref ble_gatts_hvx_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of request packet. + * @param[out] p_conn_handle Pointer to the buffer raw data to be placed in advertisement packet. + * @param[out] pp_hvx_params Pointer to an HVx parameters structure. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_hvx_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + ble_gatts_hvx_params_t * * const pp_hvx_params); + +/**@brief Encodes @ref ble_gatts_hvx_rsp_enc command response. + * + * @sa @ref sd_ble_gatts_sys_attr_set for packet format. + * @ref ble_gatts_hvx_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_bytes_written Pointer to number of bytes written. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_hvx_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t const * const p_bytes_written); + +/**@brief Decodes @ref sd_ble_gatts_descriptor_add command request. + * + * @sa @ref sd_ble_gatts_descriptor_add for packet format, + * @ref ble_gatts_descriptor_add_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of request packet. + * @param[out] p_char_handle Pointer to buffer where characteristic handle will be. + returned. + * @param[out] pp_attr Pointer to pointer to an attribute structure. + * @param[out] pp_handle Pointer to pointer to descriptor handle. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_descriptor_add_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_char_handle, + ble_gatts_attr_t * * const pp_attr, + uint16_t * * const pp_handle); + +/**@brief Encodes @ref sd_ble_gatts_descriptor_add command response. + * + * @sa @ref sd_ble_gatts_sys_attr_set for packet format. + * @ref ble_gatts_descriptor_add_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] handle Descriptor handle value. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_descriptor_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t handle); + +/**@brief Decodes @ref sd_ble_gatts_rw_authorize_reply command request. + * + * @sa @ref nrf51_gatts_rw_authorize_reply_encoding for packet format, + * @ref ble_gatts_rw_authorize_reply_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] pp_reply_params Pointer to pointer to \ref ble_gatts_rw_authorize_reply_params_t + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ + +uint32_t ble_gatts_rw_authorize_reply_req_dec( + uint8_t const * const p_buf, + uint32_t + packet_len, + uint16_t * + p_conn_handle, + ble_gatts_rw_authorize_reply_params_t * * const + pp_reply_params); + +/**@brief Encodes @ref sd_ble_gatts_rw_authorize_reply command response. + * + * @sa @ref nrf51_gatts_rw_authorize_reply_encoding for packet format. + * @ref ble_gatts_rw_authorize_reply_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_rw_authorize_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gatts_service_changed command request. + * + * @sa @ref nrf51_service_changed_encoding for packet format, + * @ref ble_gatts_service_changed_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] p_start_handle Pointer to start handle. + * @param[out] p_end_handle Pointer to end handle. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gatts_service_changed_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * p_conn_handle, + uint16_t * p_start_handle, + uint16_t * p_end_handle); + +/**@brief Encodes @ref sd_ble_gatts_service_changed command response. + * + * @sa @ref nrf51_service_changed_encoding for packet format. + * @ref ble_gatts_service_changed_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_service_changed_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** @} */ +#endif //BLE_GATTS_CONN_H__ + diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_descriptor_add.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_descriptor_add.c new file mode 100644 index 0000000..1929309 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_descriptor_add.c @@ -0,0 +1,94 @@ +/* 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 "ble_gatts_conn.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_gatts_descriptor_add_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_char_handle, + ble_gatts_attr_t * * const pp_attr, + uint16_t * * const pp_handle) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_char_handle); + SER_ASSERT_NOT_NULL(pp_attr); + SER_ASSERT_NOT_NULL(*pp_attr); + SER_ASSERT_NOT_NULL(pp_handle); + SER_ASSERT_NOT_NULL(*pp_handle); + + uint32_t index = 0; + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 2 + 1, packet_len); + SER_ASSERT(p_buf[index] == SD_BLE_GATTS_DESCRIPTOR_ADD, NRF_ERROR_INVALID_PARAM); + index++; + + uint16_dec(p_buf, packet_len, &index, p_char_handle); + + uint32_t err_code = cond_field_dec(p_buf, + packet_len, + &index, + (void * *)pp_attr, + ble_gatts_attr_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + packet_len, + &index, + (void * *)pp_handle, + NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + +uint32_t ble_gatts_descriptor_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t handle) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 4, total_len); + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTS_DESCRIPTOR_ADD, + return_code, + p_buf, + p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + uint32_t index = *p_buf_len; + + SER_ASSERT_LENGTH_LEQ(index + 2, total_len); + + err_code = uint16_t_enc(&handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_conn.h b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_conn.h new file mode 100644 index 0000000..c4ace61 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_conn.h @@ -0,0 +1,156 @@ +/* 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 BLE_GATTS_EVT_CONN_H__ +#define BLE_GATTS_EVT_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s110_codecs Connectivity s110 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gatts_evt_conn GATTS Connectivity event encoders + * @{ + * @ingroup ser_conn_s110_codecs + * + * @brief GATTS Connectivity event encoders. + */ +#include "ble.h" + +/** + * @brief Encodes @ref BLE_GATTS_EVT_HVC event. + * + * @sa @ref nrf51_gatts_evt_hvc_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_evt_hvc_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes @ref BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST event. + * + * @sa @ref nrf51_evt_rw_authorize_request for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_evt_rw_authorize_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes @ref BLE_GATTS_EVT_SC_CONFIRM event. + * + * @sa @ref nrf51_gatts_evt_sc_confirm_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_evt_sc_confirm_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes @ref BLE_GATTS_EVT_SYS_ATTR_MISSING event. + * + * @sa @ref nrf51_evt_sys_attr_missing_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_evt_sys_attr_missing_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes @ref BLE_GATTS_EVT_TIMEOUT event. + * + * @sa @ref nrf51_gatts_evt_timeout_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_evt_timeout_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes @ref BLE_GATTS_EVT_WRITE event. + * + * @sa @ref nrf51_evt_write_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_evt_write_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** @} */ +#endif diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_hvc.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_hvc.c new file mode 100644 index 0000000..872e9a5 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_hvc.c @@ -0,0 +1,38 @@ +/* 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 "ble_gatts_evt_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_evt_hvc_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 2 + 2, *p_buf_len); + + index += uint16_encode(BLE_GATTS_EVT_HVC, &(p_buf[index])); + index += uint16_encode(p_event->evt.gatts_evt.conn_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gatts_evt.params.hvc.handle, &(p_buf[index])); + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_rw_authorize_request.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_rw_authorize_request.c new file mode 100644 index 0000000..770df04 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_rw_authorize_request.c @@ -0,0 +1,59 @@ +/* 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 "ble_gatts_evt_conn.h" +#include "ble_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "conn_ble_user_mem.h" +#include "app_util.h" + +extern ser_ble_user_mem_t m_conn_user_mem_table[]; + +uint32_t ble_gatts_evt_rw_authorize_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + SER_ASSERT_NOT_NULL(p_event); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&p_event->header.evt_id, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_event->evt.gatts_evt.conn_handle), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gatts_evt_rw_authorize_request_t_enc( + &(p_event->evt.gatts_evt.params.authorize_request), + p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if((p_event->evt.gatts_evt.params.authorize_request.type == BLE_GATTS_AUTHORIZE_TYPE_WRITE) && (p_event->evt.gatts_evt.params.authorize_request.request.write.op == BLE_GATTS_OP_EXEC_WRITE_REQ_NOW)) + { + uint32_t conn_index; + + if(conn_ble_user_mem_context_find(p_event->evt.gatts_evt.conn_handle, &conn_index) != NRF_ERROR_NOT_FOUND) + { + err_code = len16data_enc(m_conn_user_mem_table[conn_index].mem_block.p_mem, m_conn_user_mem_table[conn_index].mem_block.len, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + } + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_sc_confirm.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_sc_confirm.c new file mode 100644 index 0000000..1bf1e0f --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_sc_confirm.c @@ -0,0 +1,37 @@ +/* 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 "ble_gatts_evt_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_evt_sc_confirm_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_HEADER_SIZE + 2, *p_buf_len); + + uint32_t index = 0; + index += uint16_encode(BLE_GATTS_EVT_SC_CONFIRM, &(p_buf[index])); + index += uint16_encode(p_event->evt.gatts_evt.conn_handle, &(p_buf[index])); + + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_sys_attr_missing.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_sys_attr_missing.c new file mode 100644 index 0000000..cb7c3e4 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_sys_attr_missing.c @@ -0,0 +1,37 @@ +/* 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 "ble_gatts_evt_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_evt_sys_attr_missing_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 2 + 1, *p_buf_len); + index += uint16_encode(BLE_GATTS_EVT_SYS_ATTR_MISSING, &(p_buf[index])); + index += uint16_encode(p_event->evt.gatts_evt.conn_handle, &(p_buf[index])); + p_buf[index++] = p_event->evt.gatts_evt.params.sys_attr_missing.hint; + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_timeout.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_timeout.c new file mode 100644 index 0000000..096ec5c --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_timeout.c @@ -0,0 +1,37 @@ +/* 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 "ble_gatts_evt_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_evt_timeout_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 2 + 1, *p_buf_len); + index += uint16_encode(BLE_GATTS_EVT_TIMEOUT, &(p_buf[index])); + index += uint16_encode(p_event->evt.gatts_evt.conn_handle, &(p_buf[index])); + p_buf[index++] = p_event->evt.gatts_evt.params.timeout.src; + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_write.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_write.c new file mode 100644 index 0000000..d37ce9f --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_evt_write.c @@ -0,0 +1,63 @@ +/* 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 "ble_gatts_evt_conn.h" +#include "ble_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "conn_ble_user_mem.h" +#include "app_util.h" + +extern ser_ble_user_mem_t m_conn_user_mem_table[]; + +uint32_t ble_gatts_evt_write_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint16_t evt_header = BLE_GATTS_EVT_WRITE; + + err_code = uint16_t_enc(&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_event->evt.gatts_evt.conn_handle), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gatts_evt_write_t_enc(&(p_event->evt.gatts_evt.params.write), + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if(p_event->evt.gatts_evt.params.write.op == BLE_GATTS_OP_EXEC_WRITE_REQ_NOW) + { + uint32_t conn_index; + + if(conn_ble_user_mem_context_find(p_event->evt.gatts_evt.conn_handle, &conn_index) != NRF_ERROR_NOT_FOUND) + { + err_code = len16data_enc(m_conn_user_mem_table[conn_index].mem_block.p_mem, m_conn_user_mem_table[conn_index].mem_block.len, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + } + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_hvx.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_hvx.c new file mode 100644 index 0000000..67bd566 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_hvx.c @@ -0,0 +1,81 @@ +/* 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 "ble_gatts_conn.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_gatts_hvx_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + ble_gatts_hvx_params_t * * const pp_hvx_params) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_hvx_params); + SER_ASSERT_NOT_NULL(*pp_hvx_params); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 2 + 1, packet_len); + SER_ASSERT(p_buf[index] == SD_BLE_GATTS_HVX, NRF_ERROR_INVALID_PARAM); + index++; + + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + uint32_t err_code = cond_field_dec(p_buf, packet_len, + &index, + (void * *)pp_hvx_params, + ble_gatts_hvx_params_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + +uint32_t ble_gatts_hvx_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t const * const p_bytes_written) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTS_HVX, + return_code, + p_buf, + p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + uint32_t index = *p_buf_len; + + err_code = cond_field_enc(p_bytes_written, p_buf, total_len, &index, uint16_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_include_add.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_include_add.c new file mode 100644 index 0000000..766313f --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_include_add.c @@ -0,0 +1,74 @@ +/* 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 + +#include "ble_gatts_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gatts_include_add_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_service_handle, + uint16_t * const p_inc_srvc_handle, + uint16_t * * const pp_include_handle) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_service_handle); + SER_ASSERT_NOT_NULL(p_inc_srvc_handle); + SER_ASSERT_NOT_NULL(pp_include_handle); + SER_ASSERT_LENGTH_EQ(6, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_GATTS_INCLUDE_ADD, NRF_ERROR_INVALID_PARAM); + index++; + + uint16_dec(p_buf, packet_len, &index, p_service_handle); + uint16_dec(p_buf, packet_len, &index, p_inc_srvc_handle); + + if (p_buf[index++] == SER_FIELD_NOT_PRESENT) + { + *pp_include_handle = NULL; + } + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gatts_include_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t const * const p_include_handle) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + uint32_t err_code; + + err_code = op_status_enc(SD_BLE_GATTS_INCLUDE_ADD, return_code, p_buf, p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + SER_ASSERT_NOT_NULL(p_include_handle); + err_code = uint16_t_enc(p_include_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; //update change made by op_status_enc + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_rw_authorize_reply.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_rw_authorize_reply.c new file mode 100644 index 0000000..94390bb --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_rw_authorize_reply.c @@ -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. + * + */ + +#include "ble_gatts_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" +#include "ble_gatts_struct_serialization.h" +#include "cond_field_serialization.h" + +uint32_t ble_gatts_rw_authorize_reply_req_dec( + uint8_t const * const p_buf, + uint32_t + packet_len, + uint16_t * + p_conn_handle, + ble_gatts_rw_authorize_reply_params_t * * const + pp_reply_params) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + + uint32_t index = SER_CMD_HEADER_SIZE; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(2, packet_len - index); + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + err_code = cond_field_dec(p_buf, packet_len, &index, + (void * *)pp_reply_params, ble_gatts_rw_authorize_reply_params_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + +uint32_t ble_gatts_rw_authorize_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTS_RW_AUTHORIZE_REPLY, return_code, + p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_service_add.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_service_add.c new file mode 100644 index 0000000..e1d7c68 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_service_add.c @@ -0,0 +1,76 @@ +/* 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 + +#include "ble_gatts_conn.h" +#include "ble_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "ble_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + +uint32_t ble_gatts_service_add_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint8_t * const p_type, + ble_uuid_t * * const pp_uuid, + uint16_t * * const pp_handle) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_type); + SER_ASSERT_NOT_NULL(pp_uuid); + SER_ASSERT_NOT_NULL(*pp_uuid); + SER_ASSERT_NOT_NULL(pp_handle); + SER_ASSERT_NOT_NULL(*pp_handle); + + uint32_t index = SER_CMD_DATA_POS; + + uint32_t err_code; + SER_ASSERT_LENGTH_LEQ(3, buf_len - index); + err_code = uint8_t_dec(p_buf, buf_len, &index, p_type); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_uuid, ble_uuid_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_handle, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT(index == buf_len, NRF_ERROR_INVALID_LENGTH); + + return err_code; +} + +uint32_t ble_gatts_service_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t const * const p_handle) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + uint32_t err_code; + + err_code = op_status_enc(SD_BLE_GATTS_SERVICE_ADD, return_code, p_buf, p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; //this seems silly but it is not + } + SER_ASSERT_NOT_NULL(p_handle); + err_code = uint16_t_enc(p_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; //update change made by op_status_enc + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_service_changed.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_service_changed.c new file mode 100644 index 0000000..37e9e34 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_service_changed.c @@ -0,0 +1,55 @@ +/* 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 +#include "ble_gatts_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_service_changed_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * p_conn_handle, + uint16_t * p_start_handle, + uint16_t * p_end_handle) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_start_handle); + SER_ASSERT_NOT_NULL(p_end_handle); + + SER_ASSERT_LENGTH_EQ(SER_CMD_HEADER_SIZE + 6, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_GATTS_SERVICE_CHANGED, NRF_ERROR_INVALID_PARAM); + index++; + + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + uint16_dec(p_buf, packet_len, &index, p_start_handle); + uint16_dec(p_buf, packet_len, &index, p_end_handle); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gatts_service_changed_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTS_SERVICE_CHANGED, + return_code, + p_buf, + p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_sys_attr_get.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_sys_attr_get.c new file mode 100644 index 0000000..affbe8e --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_sys_attr_get.c @@ -0,0 +1,125 @@ +/* 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 "ble_gatts_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_sys_attr_get_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint8_t * * const pp_sys_attr_data, + uint16_t * * const pp_sys_attr_data_len, + uint32_t * const p_flags) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_sys_attr_data); + SER_ASSERT_NOT_NULL(pp_sys_attr_data_len); + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 2 + 1, packet_len); + SER_ASSERT(p_buf[index] == SD_BLE_GATTS_SYS_ATTR_GET, NRF_ERROR_INVALID_PARAM); + index++; + + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_flags); + *p_conn_handle = uint16_decode(&p_buf[index]); + index += sizeof (uint16_t); + + if (p_buf[index++] == SER_FIELD_PRESENT) + { + SER_ASSERT_LENGTH_LEQ(index + 2, packet_len); + + SER_ASSERT_NOT_NULL(*pp_sys_attr_data_len); + **pp_sys_attr_data_len = uint16_decode(&p_buf[index]); + index += sizeof (uint16_t); + } + else + { + *pp_sys_attr_data_len = NULL; + } + + SER_ASSERT_LENGTH_LEQ(index + 1, packet_len); + + if (p_buf[index++] == SER_FIELD_NOT_PRESENT) + { + *pp_sys_attr_data = NULL; + } + + err_code = uint32_t_dec(p_buf, packet_len, &index, p_flags); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + +uint32_t ble_gatts_sys_attr_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint8_t const * const p_sys_attr_data, + uint16_t const * const p_sys_attr_data_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + SER_ASSERT_LENGTH_LEQ(1 + 4, total_len); + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTS_SYS_ATTR_GET, + return_code, + p_buf, + p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_sys_attr_data); + SER_ASSERT_NOT_NULL(p_sys_attr_data_len); + uint32_t index = *p_buf_len; + uint16_t sys_attr_len = 0; + + SER_ASSERT_LENGTH_LEQ(index + 2, total_len); + + if (p_sys_attr_data_len != NULL) + { + index += uint16_encode(*p_sys_attr_data_len, &p_buf[index]); + sys_attr_len = *p_sys_attr_data_len; + } + + SER_ASSERT_LENGTH_LEQ(index + 1, total_len); + p_buf[index++] = p_sys_attr_data ? SER_FIELD_PRESENT : + SER_FIELD_NOT_PRESENT; + + SER_ASSERT_LENGTH_LEQ(index + sys_attr_len, total_len); + + if (p_sys_attr_data != NULL) + { + memcpy(&p_buf[index], p_sys_attr_data, sys_attr_len); + index += sys_attr_len; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_sys_attr_set.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_sys_attr_set.c new file mode 100644 index 0000000..b25d9d9 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_sys_attr_set.c @@ -0,0 +1,76 @@ +/* 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 "ble_gatts_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_sys_attr_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint8_t * * const pp_sys_attr_data, + uint16_t * const p_sys_attr_data_len, + uint32_t * const p_flags) +{ + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code = NRF_SUCCESS; + + uint16_t sys_attr_data_len_temp; + uint16_t * p_sys_attr_data_len_temp = &sys_attr_data_len_temp; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_sys_attr_data); + SER_ASSERT_NOT_NULL(*pp_sys_attr_data); + SER_ASSERT_NOT_NULL(p_sys_attr_data_len); + SER_ASSERT_NOT_NULL(p_flags); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 7, packet_len); + + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + switch (p_buf[index++]) + { + case SER_FIELD_NOT_PRESENT: + *pp_sys_attr_data = NULL; + SER_ASSERT_LENGTH_EQ(index + 4, packet_len); + *p_sys_attr_data_len = 0; + break; + + case SER_FIELD_PRESENT: + uint16_dec(p_buf, packet_len, &index, p_sys_attr_data_len_temp); + SER_ASSERT_LENGTH_LEQ(*p_sys_attr_data_len_temp, *p_sys_attr_data_len); + *p_sys_attr_data_len = *p_sys_attr_data_len_temp; + SER_ASSERT_LENGTH_EQ(index + *p_sys_attr_data_len + 4, packet_len); + memcpy(*pp_sys_attr_data, &p_buf[index], *p_sys_attr_data_len); + index += *p_sys_attr_data_len; + break; + + default: + return NRF_ERROR_INVALID_DATA; + } + + err_code = uint32_t_dec(p_buf, packet_len, &index, p_flags); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + + +uint32_t ble_gatts_sys_attr_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTS_SYS_ATTR_SET, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_value_get.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_value_get.c new file mode 100644 index 0000000..eebd031 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_value_get.c @@ -0,0 +1,105 @@ +/* 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 "ble_gatts_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_value_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * const p_handle, + ble_gatts_value_t * * const pp_value) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_handle); + SER_ASSERT_NOT_NULL(pp_value); + SER_ASSERT_NOT_NULL(*pp_value); + SER_ASSERT_NOT_NULL((*pp_value)->p_value); + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 5, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_GATTS_VALUE_GET, NRF_ERROR_INVALID_PARAM); + index++; + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (p_buf[index++] == SER_FIELD_PRESENT) + { + err_code = uint16_t_dec(p_buf, packet_len, &index, &((*pp_value)->len)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, packet_len, &index, &((*pp_value)->offset)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(1, packet_len - index); + if (p_buf[index++] == SER_FIELD_NOT_PRESENT) + { + (*pp_value)->p_value = NULL; + } + } + else + { + *pp_value = NULL; + } + + return err_code; +} + + +uint32_t ble_gatts_value_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gatts_value_t * const p_value) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_RSP_HEADER_SIZE, *p_buf_len); + + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTS_VALUE_GET, + return_code, + p_buf, + p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + uint32_t index = *p_buf_len; + + if (return_code == NRF_SUCCESS) + { + SER_ASSERT_NOT_NULL(p_value); + + err_code = ble_gatts_value_t_enc(p_value, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_value_set.c b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_value_set.c new file mode 100644 index 0000000..4a7eb2b --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_gatts_value_set.c @@ -0,0 +1,74 @@ +/* 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 "ble_gatts_conn.h" +#include +#include "cond_field_serialization.h" +#include "ble_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_value_set_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * p_conn_handle, + uint16_t * p_handle, + ble_gatts_value_t * * const pp_value) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_handle); + SER_ASSERT_NOT_NULL(pp_value); + + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(4, packet_len - index); //make sure that payload length is at least 4 bytes + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + uint16_dec(p_buf, packet_len, &index, p_handle); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_value, ble_gatts_value_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + +uint32_t ble_gatts_value_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buff, + uint32_t * const p_buff_len, + ble_gatts_value_t * p_value) +{ + SER_ASSERT_NOT_NULL(p_buff); + SER_ASSERT_NOT_NULL(p_buff_len); + + uint32_t buf_len = *p_buff_len; + uint32_t index = 0; + uint32_t err_code; + + err_code = op_status_enc(SD_BLE_GATTS_VALUE_SET, return_code, p_buff, p_buff_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + SER_ASSERT_NOT_NULL(p_value); + err_code = ble_gatts_value_t_enc(p_value, p_buff, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buff_len = index; //update change made by op_status_enc + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_l2cap_cid_register.c b/components/serialization/connectivity/codecs/s110/serializers/ble_l2cap_cid_register.c new file mode 100644 index 0000000..9e2a775 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_l2cap_cid_register.c @@ -0,0 +1,46 @@ +/* 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 "ble_l2cap_conn.h" +#include "ble_serialization.h" +#include "nrf_error.h" + + +uint32_t ble_l2cap_cid_register_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * p_cid) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_cid); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_LENGTH_EQ(3, buf_len); + SER_ASSERT(p_buf[index] == SD_BLE_L2CAP_CID_REGISTER, NRF_ERROR_INVALID_PARAM); + + index++; + err_code = uint16_t_dec(p_buf, buf_len, &index, p_cid); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} + + +uint32_t ble_l2cap_cid_register_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_L2CAP_CID_REGISTER, return_code, + p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_l2cap_cid_unregister.c b/components/serialization/connectivity/codecs/s110/serializers/ble_l2cap_cid_unregister.c new file mode 100644 index 0000000..74d4619 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_l2cap_cid_unregister.c @@ -0,0 +1,46 @@ +/* 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 "ble_l2cap_conn.h" +#include "ble_serialization.h" +#include "nrf_error.h" + + +uint32_t ble_l2cap_cid_unregister_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * p_cid) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_cid); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_LENGTH_EQ(3, buf_len); + SER_ASSERT(p_buf[index] == SD_BLE_L2CAP_CID_UNREGISTER, NRF_ERROR_INVALID_PARAM); + + index++; + err_code = uint16_t_dec(p_buf, buf_len, &index, p_cid); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} + + +uint32_t ble_l2cap_cid_unregister_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_L2CAP_CID_UNREGISTER, return_code, + p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_l2cap_conn.h b/components/serialization/connectivity/codecs/s110/serializers/ble_l2cap_conn.h new file mode 100644 index 0000000..773bac4 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_l2cap_conn.h @@ -0,0 +1,156 @@ +/* Copyright (c) 2011 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. + * + */ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s110_codecs Connectivity s110 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_l2cap_conn L2CAP Connectivity command request decoders and command response encoders + * @{ + * @ingroup ser_conn_s110_codecs + * + * @brief L2CAP Connectivity command request decoders and command response encoders. + */ + +#ifndef BLE_L2CAP_CONN_H__ +#define BLE_L2CAP_CONN_H__ + +#include "ble.h" +#include "ble_types.h" +#include "ble_ranges.h" +#include "ble_err.h" +#include "ble_l2cap.h" + +/**@brief Decodes @ref sd_ble_l2cap_cid_register command request. + * + * @sa @ref nrf51_ble_l2cap_cid_register for packet format, + * @ref ble_l2cap_cid_register_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of response packet. + * @param[in] p_cid Pointer to L2CAP CID. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_l2cap_cid_register_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * p_cid); + +/**@brief Encodes @ref sd_ble_l2cap_cid_register command response. + * + * @sa @ref nrf51_ble_l2cap_cid_register for packet format. + * @ref ble_l2cap_cid_register_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_l2cap_cid_register_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_l2cap_cid_unregister command request. + * + * @sa @ref nrf51_ble_l2cap_cid_unregister for packet format, + * @ref ble_l2cap_cid_unregister_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of response packet. + * @param[in] p_cid Pointer to L2CAP CID. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_l2cap_cid_unregister_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * p_cid); + +/**@brief Encodes @ref sd_ble_l2cap_cid_unregister command response. + * + * @sa @ref nrf51_ble_l2cap_cid_unregister for packet format. + * @ref ble_l2cap_cid_unregister_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_l2cap_cid_unregister_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_l2cap_tx command request. + * + * @sa @ref nrf51_ble_l2cap_tx for packet format, + * @ref ble_l2cap_tx_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of response packet. + * @param[in] p_conn_handle Pointer to connection handle. + * @param[in] pp_l2cap_header Pointer to pointer to L2CAP header. + * @param[in] pp_data Pointer to pointer L2CAP data. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_l2cap_tx_req_dec(uint8_t const * const p_buf, + uint32_t const buf_len, + uint16_t * p_conn_handle, + ble_l2cap_header_t * * const pp_l2cap_header, + uint8_t const * * pp_data); + +/**@brief Encodes @ref sd_ble_l2cap_tx command response. + * + * @sa @ref nrf51_ble_l2cap_tx for packet format. + * @ref ble_l2cap_tx_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_l2cap_tx_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +#endif //BLE_L2CAP_CONN_H__ + +/** + @} + */ diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_l2cap_evt_conn.h b/components/serialization/connectivity/codecs/s110/serializers/ble_l2cap_evt_conn.h new file mode 100644 index 0000000..805814e --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_l2cap_evt_conn.h @@ -0,0 +1,56 @@ +/* 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 BLE_L2CAP_EVT_CONN_H__ +#define BLE_L2CAP_EVT_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s110_codecs Connectivity s110 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_l2cap_evt_conn L2CAP Connectivity event encoders + * @{ + * @ingroup ser_conn_s110_codecs + * + * @brief L2CAP Connectivity event encoders. + */ +#include "ble.h" + +/** + * @brief Encodes ble_l2cap_evt_rx event. + * + * @sa @ref nrf51_l2cap_evt_rx_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_l2cap_evt_rx_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** @} */ +#endif diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_l2cap_evt_rx.c b/components/serialization/connectivity/codecs/s110/serializers/ble_l2cap_evt_rx.c new file mode 100644 index 0000000..15793ed --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_l2cap_evt_rx.c @@ -0,0 +1,50 @@ +/* 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 "ble_l2cap_evt_conn.h" +#include +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_l2cap_evt_rx_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t err_code; + uint32_t total_len = *p_buf_len; + + uint16_t evt_id = BLE_L2CAP_EVT_RX; + + err_code = uint16_t_enc(&evt_id, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_event->evt.l2cap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_l2cap_evt_rx_t_enc(&(p_event->evt.l2cap_evt.params.rx), + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_l2cap_tx.c b/components/serialization/connectivity/codecs/s110/serializers/ble_l2cap_tx.c new file mode 100644 index 0000000..c574b40 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_l2cap_tx.c @@ -0,0 +1,67 @@ +/* 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 +#include +#include "ble_l2cap_conn.h" +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + +uint32_t ble_l2cap_tx_req_dec(uint8_t const * const p_buf, + uint32_t const buf_len, + uint16_t * p_conn_handle, + ble_l2cap_header_t * * const pp_l2cap_header, + uint8_t const * * pp_data) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_l2cap_header); + SER_ASSERT_NOT_NULL(*pp_l2cap_header); + SER_ASSERT_NOT_NULL(pp_data); + //SER_ASSERT_NOT_NULL(*pp_data); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = SER_CMD_DATA_POS; + + err_code = uint16_t_dec(p_buf, buf_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_l2cap_header, + ble_l2cap_header_t_dec); + + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (*pp_l2cap_header != NULL) + { + *pp_data = p_buf + index + 1; + index += 1 + (*pp_l2cap_header)->len; + } + else + { + *pp_data = NULL; + index++; + } + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} + +uint32_t ble_l2cap_tx_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_L2CAP_TX, return_code, + p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_opt_get.c b/components/serialization/connectivity/codecs/s110/serializers/ble_opt_get.c new file mode 100644 index 0000000..7f2da63 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_opt_get.c @@ -0,0 +1,130 @@ +/* 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 "ble_conn.h" +#include +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_opt_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint32_t * const p_opt_id, + ble_opt_t **const pp_opt ) +{ + uint32_t index = 0; + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_opt_id); + SER_ASSERT_NOT_NULL(pp_opt); + SER_ASSERT_NOT_NULL(*pp_opt); + SER_ASSERT_LENGTH_EQ(SER_CMD_HEADER_SIZE + 4 + 1, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_OPT_GET, NRF_ERROR_INVALID_PARAM); + index++; + + err_code = uint32_t_dec(p_buf, packet_len, &index, p_opt_id); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT(((*p_opt_id == BLE_COMMON_OPT_RADIO_CPU_MUTEX) || + (*p_opt_id == BLE_GAP_OPT_CH_MAP) || + (*p_opt_id == BLE_GAP_OPT_LOCAL_CONN_LATENCY) || + (*p_opt_id == BLE_GAP_OPT_PASSKEY) || + (*p_opt_id == BLE_GAP_OPT_PRIVACY) || + (*p_opt_id == BLE_GAP_OPT_SCAN_REQ_REPORT) || + (*p_opt_id == BLE_GAP_OPT_COMPAT_MODE)), NRF_ERROR_INVALID_PARAM); + + if (p_buf[index++] == SER_FIELD_NOT_PRESENT) + { + *pp_opt = NULL; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_opt_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint32_t opt_id, + ble_opt_t const * const p_opt) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_OPT_GET, return_code, + p_buf, p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_opt); + SER_ASSERT(((opt_id == BLE_COMMON_OPT_RADIO_CPU_MUTEX) || + (opt_id == BLE_GAP_OPT_CH_MAP) || + (opt_id == BLE_GAP_OPT_LOCAL_CONN_LATENCY) || + (opt_id == BLE_GAP_OPT_PASSKEY) || + (opt_id == BLE_GAP_OPT_PRIVACY) || + (opt_id == BLE_GAP_OPT_SCAN_REQ_REPORT) || + (opt_id == BLE_GAP_OPT_COMPAT_MODE)), NRF_ERROR_INVALID_PARAM); + + uint32_t index = *p_buf_len; + err_code = uint32_t_enc(&opt_id, p_buf, total_len, &index); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + switch (opt_id) + { + case BLE_COMMON_OPT_RADIO_CPU_MUTEX: + err_code = ble_common_opt_radio_cpu_mutex_t_enc((void *)&(p_opt->common_opt.radio_cpu_mutex), p_buf, total_len, &index); + break; + case BLE_GAP_OPT_CH_MAP: + err_code = ble_gap_opt_ch_map_t_enc((void *)&(p_opt->gap_opt.ch_map), p_buf, total_len, &index); + break; + case BLE_GAP_OPT_LOCAL_CONN_LATENCY: + err_code = ble_gap_opt_local_conn_latency_t_enc((void *)&(p_opt->gap_opt.local_conn_latency), p_buf, total_len, &index); + break; + case BLE_GAP_OPT_PASSKEY: + err_code = ble_gap_opt_passkey_t_enc((void *)&(p_opt->gap_opt.passkey), p_buf, total_len, &index); + break; + case BLE_GAP_OPT_PRIVACY: + err_code = ble_gap_opt_privacy_t_enc((void *)&(p_opt->gap_opt.privacy), p_buf, total_len, &index); + break; + case BLE_GAP_OPT_SCAN_REQ_REPORT: + err_code = ble_gap_opt_scan_req_report_t_enc((void *)&(p_opt->gap_opt.scan_req_report), p_buf, total_len, &index); + break; + case BLE_GAP_OPT_COMPAT_MODE: + err_code = ble_gap_opt_compat_mode_t_enc((void *)&(p_opt->gap_opt.compat_mode), p_buf, total_len, &index); + break; + } + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_opt_id_pre_decoder.c b/components/serialization/connectivity/codecs/s110/serializers/ble_opt_id_pre_decoder.c new file mode 100644 index 0000000..7b0e749 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_opt_id_pre_decoder.c @@ -0,0 +1,36 @@ +/* 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 "ble_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_opt_id_pre_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint32_t * const p_opt_id) +{ + uint32_t index = 0; + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_opt_id); + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 4, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_OPT_SET, NRF_ERROR_INVALID_PARAM); + index++; + + err_code = uint32_t_dec(p_buf, packet_len, &index, p_opt_id); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_opt_set.c b/components/serialization/connectivity/codecs/s110/serializers/ble_opt_set.c new file mode 100644 index 0000000..8a0b6e5 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_opt_set.c @@ -0,0 +1,114 @@ +/* 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 "ble_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_opt_set_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint32_t * const p_opt_id, + ble_opt_t **const pp_opt ) +{ + uint32_t index = 0; + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_opt_id); + SER_ASSERT_NOT_NULL(pp_opt); + SER_ASSERT_NOT_NULL(*pp_opt); + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 4 + 1, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_OPT_SET, NRF_ERROR_INVALID_PARAM); + index++; + + err_code = uint32_t_dec(p_buf, packet_len, &index, p_opt_id); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT(((*p_opt_id == BLE_COMMON_OPT_RADIO_CPU_MUTEX) || + (*p_opt_id == BLE_GAP_OPT_CH_MAP) || + (*p_opt_id == BLE_GAP_OPT_LOCAL_CONN_LATENCY) || + (*p_opt_id == BLE_GAP_OPT_PASSKEY) || + (*p_opt_id == BLE_GAP_OPT_PRIVACY) || + (*p_opt_id == BLE_GAP_OPT_SCAN_REQ_REPORT) || + (*p_opt_id == BLE_GAP_OPT_COMPAT_MODE)), NRF_ERROR_INVALID_PARAM); + + if (p_buf[index++] == SER_FIELD_NOT_PRESENT) + { + *pp_opt = NULL; + } + else + { + switch(*p_opt_id) + { + case BLE_COMMON_OPT_RADIO_CPU_MUTEX: + err_code = ble_common_opt_radio_cpu_mutex_t_dec(p_buf, packet_len, &index, &((*pp_opt)->common_opt.radio_cpu_mutex)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + case BLE_GAP_OPT_CH_MAP: + err_code = ble_gap_opt_ch_map_t_dec(p_buf, packet_len, &index, &((*pp_opt)->gap_opt.ch_map)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + case BLE_GAP_OPT_LOCAL_CONN_LATENCY: + err_code = ble_gap_opt_local_conn_latency_t_dec(p_buf, packet_len, &index, &((*pp_opt)->gap_opt.local_conn_latency)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + case BLE_GAP_OPT_PASSKEY: + err_code = ble_gap_opt_passkey_t_dec(p_buf, packet_len, &index, &((*pp_opt)->gap_opt.passkey)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + case BLE_GAP_OPT_PRIVACY: + err_code = ble_gap_opt_privacy_t_dec(p_buf, packet_len, &index, &((*pp_opt)->gap_opt.privacy)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + case BLE_GAP_OPT_SCAN_REQ_REPORT: + err_code = ble_gap_opt_scan_req_report_t_dec(p_buf, packet_len, &index, &((*pp_opt)->gap_opt.scan_req_report)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + case BLE_GAP_OPT_COMPAT_MODE: + err_code = ble_gap_opt_compat_mode_t_dec(p_buf, packet_len, &index, &((*pp_opt)->gap_opt.compat_mode)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + } + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + +uint32_t ble_opt_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_OPT_SET, return_code, + p_buf, p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_tx_buffer_count_get.c b/components/serialization/connectivity/codecs/s110/serializers/ble_tx_buffer_count_get.c new file mode 100644 index 0000000..eec8bb9 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_tx_buffer_count_get.c @@ -0,0 +1,65 @@ +/* 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 "ble_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" +#include "cond_field_serialization.h" + +uint32_t ble_tx_buffer_count_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint8_t * * const pp_count) +{ + SER_ASSERT_NOT_NULL(p_buf); + + uint32_t index = 0; + uint8_t opcode; + uint32_t err_code; + + err_code = uint8_t_dec(p_buf, packet_len, &index, &opcode); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + SER_ASSERT(opcode == SD_BLE_TX_BUFFER_COUNT_GET, NRF_ERROR_INVALID_PARAM); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_count, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + +uint32_t ble_tx_buffer_count_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint8_t const * const p_count) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_TX_BUFFER_COUNT_GET, return_code, + p_buf, p_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + err_code = cond_field_enc(p_count, p_buf, total_len, p_buf_len, uint8_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_user_mem_reply.c b/components/serialization/connectivity/codecs/s110/serializers/ble_user_mem_reply.c new file mode 100644 index 0000000..d3f0108 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_user_mem_reply.c @@ -0,0 +1,66 @@ +/* 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 "ble_conn.h" +#include +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_user_mem_reply_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + ble_user_mem_block_t * * const pp_mem_block) +{ + uint32_t index = 0; + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_mem_block); + SER_ASSERT_NOT_NULL(*pp_mem_block); + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 2 + 1, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_USER_MEM_REPLY, NRF_ERROR_INVALID_PARAM); + index++; + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (p_buf[index++] == SER_FIELD_PRESENT) + { + // Decoding order is different than structure elements order because + // mem block length is received first + err_code = uint16_t_dec(p_buf, packet_len, &index, &((*pp_mem_block)->len)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void **)&((*pp_mem_block)->p_mem), NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + else + { + *pp_mem_block = NULL; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + +uint32_t ble_user_mem_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_USER_MEM_REPLY, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_uuid_decode.c b/components/serialization/connectivity/codecs/s110/serializers/ble_uuid_decode.c new file mode 100644 index 0000000..000e4d8 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_uuid_decode.c @@ -0,0 +1,77 @@ +/* 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 "ble_conn.h" +#include +#include +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_uuid_decode_req_dec(uint8_t const * const p_buf, + uint32_t const buf_len, + uint8_t * p_uuid_le_len, + uint8_t * * const pp_uuid_le, + ble_uuid_t * * const pp_uuid) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_uuid_le_len); + uint32_t err_code; + uint32_t index = 0; + uint8_t opcode = SD_BLE_UUID_DECODE; + + SER_ASSERT_LENGTH_LEQ(1, ((int32_t)buf_len - index)); + uint8_dec(p_buf, buf_len, &index, &opcode); + SER_ASSERT(opcode == SD_BLE_UUID_DECODE, NRF_ERROR_INVALID_DATA); + + err_code = len8data_dec(p_buf, buf_len, &index, pp_uuid_le, p_uuid_le_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_uuid, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} + +uint32_t ble_uuid_decode_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_uuid_t const * const p_uuid) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_UUID_DECODE, return_code, + p_buf, p_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + + uint32_t index = *p_buf_len; + + if (return_code != NRF_SUCCESS) + { + *p_buf_len = index; + return NRF_SUCCESS; + } + + err_code = cond_field_enc((void *)p_uuid, p_buf, total_len, &index, ble_uuid_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_uuid_encode.c b/components/serialization/connectivity/codecs/s110/serializers/ble_uuid_encode.c new file mode 100644 index 0000000..0843668 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_uuid_encode.c @@ -0,0 +1,117 @@ +/* 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 "ble_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_uuid_encode_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + ble_uuid_t * * const pp_uuid, + uint8_t * * const pp_uuid_le_len, + uint8_t * * const pp_uuid_le) +{ + uint32_t index = SER_CMD_HEADER_SIZE; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_uuid); + SER_ASSERT_NOT_NULL(pp_uuid_le_len); + SER_ASSERT_NOT_NULL(pp_uuid_le); + SER_ASSERT_NOT_NULL(*pp_uuid); + SER_ASSERT_NOT_NULL(*pp_uuid_le_len); + SER_ASSERT_NOT_NULL(*pp_uuid_le); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 3, packet_len); + + if (p_buf[index] == SER_FIELD_NOT_PRESENT) + { + index++; + *pp_uuid = NULL; + } + else if (p_buf[index] == SER_FIELD_PRESENT) + { + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 6, packet_len); + index++; + uint16_dec(p_buf, packet_len, &index, &((*pp_uuid)->uuid)); + (*pp_uuid)->type = p_buf[index++]; + } + else + { + return NRF_ERROR_INVALID_DATA; + } + + if (p_buf[index] == SER_FIELD_NOT_PRESENT) + { + *pp_uuid_le_len = NULL; + } + else if (p_buf[index] != SER_FIELD_PRESENT) + { + return NRF_ERROR_INVALID_DATA; + } + + index++; + + if (p_buf[index] == SER_FIELD_NOT_PRESENT) + { + *pp_uuid_le = NULL; + } + else if (p_buf[index] != SER_FIELD_PRESENT) + { + return NRF_ERROR_INVALID_DATA; + } + + SER_ASSERT_LENGTH_EQ(index + 1, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_uuid_encode_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint8_t uuid_le_len, + uint8_t const * const p_uuid_le) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_UUID_ENCODE, return_code, + p_buf, p_buf_len); + uint32_t index = *p_buf_len; + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + SER_ASSERT_LENGTH_LEQ(index + 1, total_len); + p_buf[index++] = uuid_le_len; + + if (p_uuid_le != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + uuid_le_len, total_len); + memcpy(p_buf + index, p_uuid_le, uuid_le_len); + index += uuid_le_len; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_uuid_vs_add.c b/components/serialization/connectivity/codecs/s110/serializers/ble_uuid_vs_add.c new file mode 100644 index 0000000..5deeac7 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_uuid_vs_add.c @@ -0,0 +1,73 @@ +/* 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 "ble_conn.h" +#include +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_uuid_vs_add_req_dec(uint8_t const * const p_buf, + uint16_t buf_len, + ble_uuid128_t * * const pp_uuid, + uint8_t * * const pp_uuid_type) +{ + uint32_t index = SER_CMD_HEADER_SIZE; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_uuid); + SER_ASSERT_NOT_NULL(pp_uuid_type); + SER_ASSERT_NOT_NULL(*pp_uuid); + SER_ASSERT_NOT_NULL(*pp_uuid_type); + + uint32_t err_code; + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_uuid, ble_uuid128_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_uuid_type, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} + + +uint32_t ble_uuid_vs_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint8_t const * const p_uuid_type) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_UUID_VS_ADD, return_code, + p_buf, p_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + uint32_t index = *p_buf_len; + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + err_code = cond_field_enc((void *)p_uuid_type, p_buf, total_len, &index, uint8_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/ble_version_get.c b/components/serialization/connectivity/codecs/s110/serializers/ble_version_get.c new file mode 100644 index 0000000..28dbe54 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/ble_version_get.c @@ -0,0 +1,77 @@ +/* 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 "ble_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_version_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + ble_version_t * * const pp_version) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_version); + SER_ASSERT_NOT_NULL(*pp_version); + SER_ASSERT_LENGTH_EQ(SER_CMD_HEADER_SIZE + 1, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_VERSION_GET, NRF_ERROR_INVALID_PARAM); + index++; + + if (p_buf[index++] == SER_FIELD_NOT_PRESENT) + { + *pp_version = NULL; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_version_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_version_t const * const p_version) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_VERSION_GET, return_code, + p_buf, p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_version); + uint32_t index = *p_buf_len; + + SER_ASSERT_LENGTH_LEQ(index + 5, total_len); + p_buf[index++] = p_version->version_number; + index += uint16_encode(p_version->company_id, &p_buf[index]); + index += uint16_encode(p_version->subversion_number, &p_buf[index]); + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/conn_ble_gap_sec_keys.c b/components/serialization/connectivity/codecs/s110/serializers/conn_ble_gap_sec_keys.c new file mode 100644 index 0000000..f0bf74d --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/conn_ble_gap_sec_keys.c @@ -0,0 +1,74 @@ +/* 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 "conn_ble_gap_sec_keys.h" +#include "ser_config.h" +#include "nrf_error.h" +#include + +ser_ble_gap_conn_keyset_t m_conn_keys_table[SER_MAX_CONNECTIONS]; + +uint32_t conn_ble_gap_sec_context_create(uint32_t *p_index) +{ + uint32_t err_code = NRF_ERROR_NO_MEM; + uint32_t i; + + for (i=0; i + +/**@brief GAP connection - keyset mapping structure. + * + * @note This structure is used to map keysets to connection instances, and will be stored in a static table. + */ +typedef struct +{ + uint16_t conn_handle; /**< Connection handle.*/ + uint8_t conn_active; /**< Indication that keys for this connection are used by soft device. 0: keys used; 1: keys not used*/ + ble_gap_sec_keyset_t keyset; /**< Keyset structure see @ref ble_gap_sec_keyset_t.*/ + ble_gap_enc_key_t enc_key_periph; /**< Peripheral Encryption Key, see @ref ble_gap_enc_key_t.*/ + ble_gap_id_key_t id_key_periph; /**< Peripheral Identity Key, see @ref ble_gap_id_key_t.*/ + ble_gap_sign_info_t sign_key_periph; /**< Peripheral Signing Information, see @ref ble_gap_sign_info_t.*/ + ble_gap_enc_key_t enc_key_central; /**< Central Encryption Key, see @ref ble_gap_enc_key_t.*/ + ble_gap_id_key_t id_key_central; /**< Central Identity Key, see @ref ble_gap_id_key_t.*/ + ble_gap_sign_info_t sign_key_central; /**< Central Signing Information, see @ref ble_gap_sign_info_t.*/ +} ser_ble_gap_conn_keyset_t; + +/**@brief allocates instance in m_conn_keys_table[] for storage of encryption keys. + * + * @param[out] p_index pointer to the index of allocated instance + * + * @retval NRF_SUCCESS great success. + * @retval NRF_ERROR_NO_MEM no free instance available. + */ +uint32_t conn_ble_gap_sec_context_create(uint32_t *p_index); + +/**@brief release instance identified by a connection handle. + * + * @param[in] conn_handle conn_handle + * + * @retval NRF_SUCCESS Context released. + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t conn_ble_gap_sec_context_destroy(uint16_t conn_handle); + +/**@brief finds index of instance identified by a connection handle in m_conn_keys_table[]. + * + * @param[in] conn_handle conn_handle + * + * @param[out] p_index Pointer to the index of entry in the context table corresponding to the given conn_handle + * + * @retval NRF_SUCCESS Context table entry found + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t conn_ble_gap_sec_context_find(uint16_t conn_handle, uint32_t *p_index); +/** @} */ + +#endif //_CONN_BLE_GAP_SEC_KEYS_H diff --git a/components/serialization/connectivity/codecs/s110/serializers/conn_ble_user_mem.c b/components/serialization/connectivity/codecs/s110/serializers/conn_ble_user_mem.c new file mode 100644 index 0000000..7ee0563 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/conn_ble_user_mem.c @@ -0,0 +1,78 @@ +/* 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 "conn_ble_user_mem.h" +#include "ser_config.h" +#include "nrf_error.h" +#include + + + +ser_ble_user_mem_t m_conn_user_mem_table[SER_MAX_CONNECTIONS]; + +uint32_t conn_ble_user_mem_context_create(uint32_t *p_index) +{ + uint32_t err_code = NRF_ERROR_NO_MEM; + uint32_t i; + + for (i=0; i + +/**@brief Connection - user memory mapping structure. + * + * @note This structure is used to map keysets to connection instances, and will be stored in a static table. + */ +//lint -esym(452,ser_ble_user_mem_t) +typedef struct +{ + uint16_t conn_handle; /**< Connection handle.*/ + uint8_t conn_active; /**< Indication that user memory for this connection is used by soft device. 0: memory used; 1: memory not used*/ + ble_user_mem_block_t mem_block; /**< User memory block structure, see @ref ble_user_mem_block_t.*/ + uint8_t mem_table[64]; /**< Memory table.*/ +} ser_ble_user_mem_t; + +/**@brief allocates instance in m_user_mem_table[] for storage. + * + * @param[out] p_index pointer to the index of allocated instance + * + * @retval NRF_SUCCESS great success. + * @retval NRF_ERROR_NO_MEM no free instance available. + */ +uint32_t conn_ble_user_mem_context_create(uint32_t *p_index); + +/**@brief release instance identified by a connection handle. + * + * @param[in] conn_handle conn_handle + * + * @retval NRF_SUCCESS Context released. + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t conn_ble_user_mem_context_destroy(uint16_t conn_handle); + +/**@brief finds index of instance identified by a connection handle in m_user_mem_table[]. + * + * @param[in] conn_handle conn_handle + * + * @param[out] p_index Pointer to the index of entry in the context table corresponding to the given conn_handle + * + * @retval NRF_SUCCESS Context table entry found + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t conn_ble_user_mem_context_find(uint16_t conn_handle, uint32_t *p_index); +/** @} */ + +#endif //_CONN_BLE_USER_MEM_H diff --git a/components/serialization/connectivity/codecs/s110/serializers/nrf_soc_conn.h b/components/serialization/connectivity/codecs/s110/serializers/nrf_soc_conn.h new file mode 100644 index 0000000..ea2b746 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/nrf_soc_conn.h @@ -0,0 +1,89 @@ +/* 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 NRF_SOC_CONN_H__ +#define NRF_SOC_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s110_codecs Connectivity s110 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup soc_conn SOC Connectivity command request decoders and command response encoders + * @{ + * @ingroup ser_conn_s110_codecs + * + * @brief SOC Connectivity command request decoders and command response encoderss. + */ +#include "nrf_soc.h" + +/**@brief Decodes @ref sd_power_system_off command request. + * + * @sa @ref nrf51_sd_power_off for packet format. + * + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in] packet_len Length (in bytes) of request packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_PARAM Encoding failure. Incorrect parameter. + */ +uint32_t power_system_off_req_dec(uint8_t const * const p_buf, uint16_t packet_len); + + +/**@brief Decodes @ref sd_temp_get command request. + * + * @sa @ref nrf51_sd_temp_get for packet format. + * @ref temp_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in] buf_len Length (in bytes) of request packet. + * @param[out] pp_temp Pointer to pointer to result of temperature measurement. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_PARAM Encoding failure. Incorrect parameter. + */ +uint32_t temp_get_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + int32_t * * const pp_temp); + +/**@brief Encodes @ref sd_temp_get command response. + * + * @sa @ref nrf51_sd_temp_get for packet format. + * @ref temp_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_temp Pointer to result of temperature measurement. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t temp_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + int32_t * const p_temp); + +/** @} */ +#endif + diff --git a/components/serialization/connectivity/codecs/s110/serializers/power_system_off.c b/components/serialization/connectivity/codecs/s110/serializers/power_system_off.c new file mode 100644 index 0000000..00e66b2 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/power_system_off.c @@ -0,0 +1,28 @@ +/* + * 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 "nrf_soc_conn.h" +#include "ble_serialization.h" + +uint32_t power_system_off_req_dec(uint8_t const * const p_buf, + uint16_t packet_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + + uint32_t index = 0; + SER_ASSERT_LENGTH_LEQ(1, packet_len); + SER_ASSERT(p_buf[index] == SD_POWER_SYSTEM_OFF, NRF_ERROR_INVALID_PARAM); + index++; + + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s110/serializers/temp_get.c b/components/serialization/connectivity/codecs/s110/serializers/temp_get.c new file mode 100644 index 0000000..8cd2081 --- /dev/null +++ b/components/serialization/connectivity/codecs/s110/serializers/temp_get.c @@ -0,0 +1,71 @@ +/* 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 "nrf_soc.h" +#include "nrf_error.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" + +uint32_t temp_get_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + int32_t * * const pp_temp) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_temp); + SER_ASSERT_NOT_NULL(*pp_temp); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len); + SER_ASSERT(p_buf[index] == SD_TEMP_GET, NRF_ERROR_INVALID_PARAM); + index++; + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_temp, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} + +uint32_t temp_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + int32_t * const p_temp) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_temp); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + uint32_t total_len = *p_buf_len; + + err_code = ser_ble_cmd_rsp_status_code_enc(SD_TEMP_GET, + return_code, + p_buf, + p_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + index += *p_buf_len; + + if (return_code == NRF_SUCCESS) + { + err_code = uint32_t_enc(p_temp, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/middleware/conn_mw.h b/components/serialization/connectivity/codecs/s120/middleware/conn_mw.h new file mode 100644 index 0000000..378a96f --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/middleware/conn_mw.h @@ -0,0 +1,38 @@ +/* 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 _CONN_MW_H +#define _CONN_MW_H + +#include + +/**@brief Connectivity Middleware dispatcher function + * + * @details It will handle decode the opcode from RX buffer and based on the opcode it will search + * for registered handler. Handler is called once it is found. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + * @retval NRF_ERROR_NOT_SUPPORTED Handler failure. Opcode not supported. + */ +uint32_t conn_mw_handler (uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); +#endif //_CONN_MW_H diff --git a/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble.c b/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble.c new file mode 100644 index 0000000..78a55ea --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble.c @@ -0,0 +1,287 @@ +/* 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 "ble_conn.h" +#include "conn_mw_ble.h" +#include "ble_serialization.h" +#include "conn_ble_user_mem.h" + +extern ser_ble_user_mem_t m_conn_user_mem_table[]; + +uint32_t conn_mw_ble_tx_buffer_count_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint8_t count; + uint8_t * p_count = &count; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_tx_buffer_count_get_req_dec(p_rx_buf, rx_buf_len, &p_count); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_tx_buffer_count_get(p_count); + + err_code = ble_tx_buffer_count_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_count); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_uuid_vs_add(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + ble_uuid128_t uuid; + ble_uuid128_t * p_uuid = &uuid; + uint8_t uuid_type; + uint8_t * p_uuid_type = &uuid_type; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_uuid_vs_add_req_dec(p_rx_buf, rx_buf_len, &p_uuid, &p_uuid_type); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_uuid_vs_add(p_uuid, p_uuid_type); + + err_code = ble_uuid_vs_add_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_uuid_type); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + return err_code; +} + +uint32_t conn_mw_ble_uuid_decode(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint8_t raw_uuid[16]; + uint8_t uuid_len = sizeof (raw_uuid); + uint8_t * p_raw_uuid = raw_uuid; + ble_uuid_t uuid; + ble_uuid_t * p_uuid = &uuid; + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_uuid_decode_req_dec(p_rx_buf, rx_buf_len, &uuid_len, &p_raw_uuid, &p_uuid); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_uuid_decode(uuid_len, p_raw_uuid, p_uuid); + + err_code = ble_uuid_decode_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_uuid); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_uuid_encode(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint8_t raw_uuid[16]; + uint8_t uuid_len = sizeof (raw_uuid); + uint8_t * p_uuid_len = &uuid_len; + uint8_t * p_raw_uuid = raw_uuid; + ble_uuid_t uuid; + ble_uuid_t * p_uuid = &uuid; + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_uuid_encode_req_dec(p_rx_buf, rx_buf_len, &p_uuid, &p_uuid_len, &p_raw_uuid); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_uuid_encode(p_uuid, p_uuid_len, p_raw_uuid); + + err_code = ble_uuid_encode_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, uuid_len, p_raw_uuid); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_version_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + ble_version_t version; + ble_version_t * p_version = &version; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_version_get_req_dec(p_rx_buf, rx_buf_len, &p_version); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_version_get(p_version); + + err_code = ble_version_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_version); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_opt_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t opt_id; + ble_opt_t opt; + ble_opt_t *p_opt = &opt; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_opt_get_req_dec(p_rx_buf, rx_buf_len, &opt_id, &p_opt); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_opt_get(opt_id, p_opt); + + err_code = ble_opt_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, opt_id, p_opt); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_opt_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t opt_id = 0xFFFFFFFF; + uint16_t act_latency; + uint8_t passkey[BLE_GAP_PASSKEY_LEN]; + ble_gap_irk_t irk = {{0}}; + uint32_t err_code = NRF_SUCCESS; + + /* Pre-decode type of ble_opt_t union */ + err_code = ble_opt_id_pre_dec(p_rx_buf, rx_buf_len, &opt_id); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + ble_opt_t opt; + ble_opt_t *p_opt = &opt; + /* Initialaize appropriate pointers inside opt union based on opt_id */ + switch(opt_id) + { + case BLE_GAP_OPT_LOCAL_CONN_LATENCY: + opt.gap_opt.local_conn_latency.p_actual_latency = &act_latency; + break; + case BLE_GAP_OPT_PASSKEY: + opt.gap_opt.passkey.p_passkey = passkey; + break; + case BLE_GAP_OPT_PRIVACY: + opt.gap_opt.privacy.p_irk = &irk; + break; + } + + uint32_t sd_err_code; + + err_code = ble_opt_set_req_dec(p_rx_buf, rx_buf_len, &opt_id, &p_opt); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_opt_set(opt_id, p_opt); + + err_code = ble_opt_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_enable(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + ble_enable_params_t params; + ble_enable_params_t * p_params = ¶ms; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_enable_req_dec(p_rx_buf, rx_buf_len, &p_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_enable(p_params); + + err_code = ble_enable_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_user_mem_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t * p_conn_handle; + ble_user_mem_block_t * p_mem_block; + uint32_t err_code = NRF_SUCCESS; + uint32_t user_mem_tab_index; + + /* Allocate user memory context for SoftDevice */ + err_code = conn_ble_user_mem_context_create(&user_mem_tab_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_conn_handle = &(m_conn_user_mem_table[user_mem_tab_index].conn_handle); + p_mem_block = &(m_conn_user_mem_table[user_mem_tab_index].mem_block); + + uint32_t sd_err_code; + + err_code = ble_user_mem_reply_req_dec(p_rx_buf, rx_buf_len, p_conn_handle, &p_mem_block); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_user_mem_reply(*p_conn_handle, p_mem_block); + + err_code = ble_user_mem_reply_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble.h b/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble.h new file mode 100644 index 0000000..8698fcc --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble.h @@ -0,0 +1,179 @@ +/* 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 _CONN_MW_BLE_H +#define _CONN_MW_BLE_H + +#include + +/**@brief Handles @ref sd_ble_tx_buffer_count_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_tx_buffer_count_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_uuid_vs_add command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_uuid_vs_add(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_uuid_decode command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_uuid_decode(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_uuid_encode command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_uuid_encode(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_version_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_version_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_opt_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_opt_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_opt_set command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_opt_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_enable command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_enable(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_user_mem_reply command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_user_mem_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +#endif //_CONN_MW_BLE_H diff --git a/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_gap.c b/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_gap.c new file mode 100644 index 0000000..4628349 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_gap.c @@ -0,0 +1,830 @@ +/* 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 "ble_gap_conn.h" +#include "conn_mw_ble_gap.h" +#include "ble_serialization.h" +#include "conn_ble_gap_sec_keys.h" +#include + +extern ser_ble_gap_conn_keyset_t m_conn_keys_table[SER_MAX_CONNECTIONS]; + +uint32_t conn_mw_ble_gap_address_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint8_t addr_cycle_mode; + + ble_gap_addr_t addr; + ble_gap_addr_t * p_addr = &addr; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_address_set_req_dec(p_rx_buf, rx_buf_len, &addr_cycle_mode, &p_addr); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_address_set(addr_cycle_mode, p_addr); + + err_code = ble_gap_address_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_connect(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + ble_gap_addr_t addr; + ble_gap_addr_t * p_addr = &addr; + + ble_gap_addr_t * pp_addr_tab[BLE_GAP_WHITELIST_ADDR_MAX_COUNT]; + ble_gap_irk_t * pp_irk_tab[BLE_GAP_WHITELIST_IRK_MAX_COUNT]; + + ble_gap_whitelist_t whitelist; + whitelist.addr_count = BLE_GAP_WHITELIST_ADDR_MAX_COUNT; + whitelist.pp_addrs = pp_addr_tab; + whitelist.irk_count = BLE_GAP_WHITELIST_IRK_MAX_COUNT; + whitelist.pp_irks = pp_irk_tab; + + ble_gap_scan_params_t scan_params; + scan_params.p_whitelist = &whitelist; + ble_gap_scan_params_t * p_scan_params = &scan_params; + + ble_gap_conn_params_t conn_params; + ble_gap_conn_params_t * p_conn_params = &conn_params; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_connect_req_dec(p_rx_buf, rx_buf_len, &p_addr, &p_scan_params, &p_conn_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_connect(p_addr, p_scan_params, p_conn_params); + + err_code = ble_gap_connect_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_connect_cancel(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + sd_err_code = sd_ble_gap_connect_cancel(); + + err_code = ble_gap_connect_cancel_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_scan_start(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + ble_gap_addr_t * pp_addr_tab[BLE_GAP_WHITELIST_ADDR_MAX_COUNT]; + ble_gap_irk_t * pp_irk_tab[BLE_GAP_WHITELIST_IRK_MAX_COUNT]; + + ble_gap_whitelist_t whitelist; + whitelist.addr_count = BLE_GAP_WHITELIST_ADDR_MAX_COUNT; + whitelist.pp_addrs = pp_addr_tab; + whitelist.irk_count = BLE_GAP_WHITELIST_IRK_MAX_COUNT; + whitelist.pp_irks = pp_irk_tab; + + ble_gap_scan_params_t scan_params; + scan_params.p_whitelist = &whitelist; + ble_gap_scan_params_t * p_scan_params = &scan_params; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_scan_start_req_dec(p_rx_buf, rx_buf_len, &p_scan_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_scan_start(p_scan_params); + + err_code = ble_gap_scan_start_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_address_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + ble_gap_addr_t addr; + ble_gap_addr_t * p_addr = &addr; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_address_get_req_dec(p_rx_buf, rx_buf_len, &p_addr); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_address_get(p_addr); + + err_code = ble_gap_address_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_addr); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_adv_data_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint8_t data[BLE_GAP_ADV_MAX_SIZE]; + uint8_t * p_data = data; + uint8_t dlen = sizeof (data); + + uint8_t sr_data[BLE_GAP_ADV_MAX_SIZE]; + uint8_t * p_sr_data = sr_data; + uint8_t srdlen = sizeof (sr_data); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_adv_data_set_req_dec(p_rx_buf, + rx_buf_len, + &p_data, + &dlen, + &p_sr_data, + &srdlen); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_adv_data_set(p_data, dlen, p_sr_data, srdlen); + + err_code = ble_gap_adv_data_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_adv_start(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + ble_gap_addr_t * p_addresses[BLE_GAP_WHITELIST_ADDR_MAX_COUNT]; + ble_gap_addr_t addresses[BLE_GAP_WHITELIST_ADDR_MAX_COUNT]; + ble_gap_irk_t * p_irks[BLE_GAP_WHITELIST_IRK_MAX_COUNT]; + ble_gap_irk_t irks[BLE_GAP_WHITELIST_IRK_MAX_COUNT]; + ble_gap_addr_t peer_addr; + ble_gap_whitelist_t whitelist; + ble_gap_adv_params_t adv_params; + ble_gap_adv_params_t * p_adv_params; + + uint32_t i = 0; + + for (i = 0; i < BLE_GAP_WHITELIST_ADDR_MAX_COUNT; i++) + { + p_addresses[i] = &(addresses[i]); + } + + for (i = 0; i < BLE_GAP_WHITELIST_IRK_MAX_COUNT; i++) + { + p_irks[i] = &(irks[i]); + } + + whitelist.pp_addrs = &p_addresses[0]; + whitelist.pp_irks = &p_irks[0]; + + adv_params.p_peer_addr = &peer_addr; + adv_params.p_whitelist = &whitelist; + + p_adv_params = &adv_params; + + err_code = ble_gap_adv_start_req_dec(p_rx_buf, rx_buf_len, &p_adv_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_adv_start(p_adv_params); + + err_code = ble_gap_adv_start_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_adv_stop(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + sd_err_code = sd_ble_gap_adv_stop(); + + err_code = ble_gap_adv_stop_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_conn_param_update(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + ble_gap_conn_params_t conn_params; + ble_gap_conn_params_t * p_conn_params = &conn_params; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_conn_param_update_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_conn_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_conn_param_update(conn_handle, p_conn_params); + + err_code = ble_gap_conn_param_update_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_disconnect(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + uint8_t hci_status_code; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_disconnect_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &hci_status_code); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_disconnect(conn_handle, hci_status_code); + + err_code = ble_gap_disconnect_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_tx_power_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + int8_t tx_power; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_tx_power_set_req_dec(p_rx_buf, rx_buf_len, &tx_power); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_tx_power_set(tx_power); + + err_code = ble_gap_tx_power_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_appearance_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t appearance; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_appearance_set_req_dec(p_rx_buf, rx_buf_len, &appearance); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_appearance_set(appearance); + + err_code = ble_gap_appearance_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_appearance_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t appearance; + uint16_t * p_appearance = &appearance; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_appearance_get_req_dec(p_rx_buf, rx_buf_len, &p_appearance); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_appearance_get(p_appearance); + + err_code = ble_gap_appearance_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_appearance); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + + +uint32_t conn_mw_ble_gap_ppcp_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + ble_gap_conn_params_t conn_params; + ble_gap_conn_params_t * p_conn_params = &conn_params; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_ppcp_set_req_dec(p_rx_buf, rx_buf_len, &p_conn_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_ppcp_set(p_conn_params); + + err_code = ble_gap_ppcp_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_ppcp_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + ble_gap_conn_params_t conn_params; + ble_gap_conn_params_t * p_conn_params = &conn_params; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_ppcp_get_req_dec(p_rx_buf, rx_buf_len, &p_conn_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_ppcp_get(p_conn_params); + + err_code = ble_gap_ppcp_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_conn_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + + +uint32_t conn_mw_ble_gap_device_name_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint8_t dev_name[BLE_GAP_DEVNAME_MAX_LEN]; + uint8_t * p_dev_name = dev_name; + + uint16_t len; + uint16_t * p_len = &len; + + err_code = ble_gap_device_name_get_req_dec(p_rx_buf, rx_buf_len, &p_dev_name, &p_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_device_name_get(p_dev_name, p_len); + + err_code = ble_gap_device_name_get_rsp_enc(sd_err_code, p_dev_name, len, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_device_name_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + ble_gap_conn_sec_mode_t write_perm; + ble_gap_conn_sec_mode_t * p_write_perm = &write_perm; + + uint8_t dev_name[BLE_GAP_DEVNAME_MAX_LEN]; + uint8_t * p_dev_name = dev_name; + + uint16_t len = BLE_GAP_DEVNAME_MAX_LEN; + + err_code = ble_gap_device_name_set_req_dec(p_rx_buf, + rx_buf_len, + &p_write_perm, + &p_dev_name, + &len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_device_name_set(p_write_perm, p_dev_name, len); + + err_code = ble_gap_device_name_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_authenticate(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint16_t conn_handle; + + ble_gap_sec_params_t sec_params; + ble_gap_sec_params_t * p_sec_params = &sec_params; + + err_code = ble_gap_authenticate_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_sec_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_authenticate(conn_handle, p_sec_params); + + err_code = ble_gap_authenticate_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_sec_params_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + uint32_t sec_tab_index = 0; + + uint16_t * p_conn_handle; + uint8_t sec_status; + + ble_gap_sec_params_t sec_params; + ble_gap_sec_params_t * p_sec_params = &sec_params; + + // Allocate global security context for soft device + err_code = conn_ble_gap_sec_context_create(&sec_tab_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_conn_handle = &(m_conn_keys_table[sec_tab_index].conn_handle); + + // Set up global structure for command decoder + ble_gap_sec_keyset_t * p_sec_keyset = &(m_conn_keys_table[sec_tab_index].keyset); + + p_sec_keyset->keys_periph.p_enc_key = &(m_conn_keys_table[sec_tab_index].enc_key_periph); + p_sec_keyset->keys_periph.p_id_key = &(m_conn_keys_table[sec_tab_index].id_key_periph); + p_sec_keyset->keys_periph.p_sign_key = &(m_conn_keys_table[sec_tab_index].sign_key_periph); + p_sec_keyset->keys_central.p_enc_key = &(m_conn_keys_table[sec_tab_index].enc_key_central); + p_sec_keyset->keys_central.p_id_key = &(m_conn_keys_table[sec_tab_index].id_key_central); + p_sec_keyset->keys_central.p_sign_key = &(m_conn_keys_table[sec_tab_index].sign_key_central); + + err_code = ble_gap_sec_params_reply_req_dec(p_rx_buf, + rx_buf_len, + p_conn_handle, + &sec_status, + &p_sec_params, + &p_sec_keyset); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_sec_params_reply(*p_conn_handle, sec_status, p_sec_params, p_sec_keyset); + + err_code = ble_gap_sec_params_reply_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_sec_keyset); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_auth_key_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint16_t conn_handle; + uint8_t key_type; + + uint8_t key[BLE_GAP_SEC_KEY_LEN]; + uint8_t * p_key = key; + + err_code = ble_gap_auth_key_reply_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &key_type, &p_key); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_auth_key_reply(conn_handle, key_type, p_key); + + err_code = ble_gap_auth_key_reply_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_sec_info_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint16_t conn_handle; + + ble_gap_enc_info_t enc_info; + ble_gap_enc_info_t * p_enc_info = &enc_info; + + ble_gap_irk_t id_info; + ble_gap_irk_t * p_id_info = &id_info; + + ble_gap_sign_info_t sign_info; + ble_gap_sign_info_t * p_sign_info = &sign_info; + + err_code = ble_gap_sec_info_reply_req_dec(p_rx_buf, + rx_buf_len, + &conn_handle, + &p_enc_info, + &p_id_info, + &p_sign_info); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_sec_info_reply(conn_handle, p_enc_info, p_id_info, p_sign_info); + + err_code = ble_gap_sec_info_reply_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_conn_sec_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint16_t conn_handle; + + ble_gap_conn_sec_t conn_sec; + ble_gap_conn_sec_t * p_conn_sec = &conn_sec; + + err_code = ble_gap_conn_sec_get_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_conn_sec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_conn_sec_get(conn_handle, p_conn_sec); + + err_code = ble_gap_conn_sec_get_rsp_enc(sd_err_code, p_conn_sec, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_rssi_start(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint16_t conn_handle; + uint8_t threshold_dbm; + uint8_t skip_count; + + err_code = ble_gap_rssi_start_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &threshold_dbm, &skip_count); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_rssi_start(conn_handle, threshold_dbm, skip_count); + + err_code = ble_gap_rssi_start_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_rssi_stop(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint16_t conn_handle; + + err_code = ble_gap_rssi_stop_req_dec(p_rx_buf, rx_buf_len, &conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_rssi_stop(conn_handle); + + err_code = ble_gap_rssi_stop_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_scan_stop(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + sd_err_code = sd_ble_gap_scan_stop(); + + err_code = ble_gap_scan_stop_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_encrypt(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint16_t conn_handle; + + ble_gap_master_id_t master_id; + ble_gap_master_id_t *p_master_id = &master_id; + + ble_gap_enc_info_t enc_info; + ble_gap_enc_info_t *p_enc_info = &enc_info; + + err_code = ble_gap_encrypt_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_master_id, &p_enc_info); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_encrypt(conn_handle, p_master_id, p_enc_info); + + err_code = ble_gap_encrypt_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_rssi_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint16_t conn_handle; + int8_t rssi; + int8_t * p_rssi = &rssi; + + err_code = ble_gap_rssi_get_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_rssi); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_rssi_get(conn_handle, p_rssi); + + err_code = ble_gap_rssi_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, rssi); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_gap.h b/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_gap.h new file mode 100644 index 0000000..c1fff5a --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_gap.h @@ -0,0 +1,532 @@ +/* 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 _CONN_MW_BLE_GAP_H +#define _CONN_MW_BLE_GAP_H + +#include + +/**@brief Handles @ref sd_ble_gap_address_set command request and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_address_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_address_get command request and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_address_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_adv_data_set command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_adv_data_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_adv_start command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_adv_start(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_adv_stop command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_adv_stop(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_conn_param_update command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_conn_param_update(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_disconnect command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_disconnect(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_tx_power_set command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_tx_power_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_appearance_set command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_appearance_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_appearance_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_appearance_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_ppcp_set command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_ppcp_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_ppcp_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_ppcp_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_device_name_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_device_name_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_device_name_set command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_device_name_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_authenticate command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_authenticate(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_sec_params_reply command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_sec_params_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_auth_key_reply command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_auth_key_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_sec_info_reply command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_sec_info_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_conn_sec_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_conn_sec_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_rssi_start command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_rssi_start(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_rssi_stop command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_rssi_stop(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_rssi_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_rssi_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_connect command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_connect(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_connect_cancel command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_connect_cancel(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_scan_start command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_scan_start(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_scan_stop command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_scan_stop(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_encrypt command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ + +uint32_t conn_mw_ble_gap_encrypt(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief allocates instance in m_conn_keys_table[] for storage of encryption keys. + * + * @param[in] conn_handle conn_handle + * @param[out] p_index pointer to the index of allocated instance + * + * @retval NRF_SUCCESS great success. + * @retval NRF_ERROR_NO_MEM no free instance available. + */ +uint32_t conn_mw_ble_gap_sec_context_create(uint16_t conn_handle, uint32_t *p_index); + +/**@brief release instance identified by a connection handle. + * + * @param[in] conn_handle conn_handle + * + * @retval NRF_SUCCESS great success + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t conn_mw_ble_gap_sec_context_destroy(uint16_t conn_handle); + +/**@brief finds index of instance identified by a connection handle in m_conn_keys_table[]. + * + * @param[in] conn_handle conn_handle + * + * @retval NRF_SUCCESS great success + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t conn_mw_ble_gap_sec_context_find(uint16_t conn_handle, uint32_t *p_index); + +#endif //_CONN_MW_BLE_GAP_H diff --git a/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_gattc.c b/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_gattc.c new file mode 100644 index 0000000..d41ac4d --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_gattc.c @@ -0,0 +1,293 @@ +/* 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 "ble_gattc_conn.h" +#include "conn_mw_ble_gattc.h" +#include "ble_serialization.h" + +uint32_t conn_mw_ble_gattc_primary_services_discover(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + uint16_t start_handle; + ble_uuid_t srvc_uuid; + ble_uuid_t * p_srvc_uuid = &srvc_uuid; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gattc_primary_services_discover_req_dec(p_rx_buf, + rx_buf_len, + &conn_handle, + &start_handle, + &p_srvc_uuid); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gattc_primary_services_discover(conn_handle, start_handle, p_srvc_uuid); + + err_code = ble_gattc_primary_services_discover_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gattc_relationships_discover(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + ble_gattc_handle_range_t handle_range; + ble_gattc_handle_range_t * p_handle_range = &handle_range; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gattc_relationships_discover_req_dec(p_rx_buf, rx_buf_len, + &conn_handle, &p_handle_range); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gattc_relationships_discover(conn_handle, p_handle_range); + + err_code = ble_gattc_relationships_discover_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gattc_characteristics_discover(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + ble_gattc_handle_range_t handle_range; + ble_gattc_handle_range_t * p_handle_range = &handle_range; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gattc_characteristics_discover_req_dec(p_rx_buf, rx_buf_len, + &conn_handle, &p_handle_range); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gattc_characteristics_discover(conn_handle, p_handle_range); + + err_code = ble_gattc_characteristics_discover_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gattc_descriptors_discover(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + ble_gattc_handle_range_t handle_range; + ble_gattc_handle_range_t * p_handle_range = &handle_range; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gattc_descriptors_discover_req_dec(p_rx_buf, rx_buf_len, + &conn_handle, &p_handle_range); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gattc_descriptors_discover(conn_handle, p_handle_range); + + err_code = ble_gattc_descriptors_discover_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gattc_char_value_by_uuid_read(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + + ble_uuid_t uuid = {0}; + ble_uuid_t * p_uuid = &uuid; + + ble_gattc_handle_range_t handle_range; + ble_gattc_handle_range_t * p_handle_range = &handle_range; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gattc_char_value_by_uuid_read_req_dec(p_rx_buf, rx_buf_len, + &conn_handle, &p_uuid, &p_handle_range); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gattc_char_value_by_uuid_read(conn_handle, p_uuid, p_handle_range); + + err_code = ble_gattc_char_value_by_uuid_read_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gattc_read(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + uint16_t * p_conn_handle = &conn_handle; + + uint16_t handle; + uint16_t * p_handle = &handle; + + uint16_t offset; + uint16_t * p_offset = &offset; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gattc_read_req_dec(p_rx_buf, rx_buf_len, p_conn_handle, p_handle, p_offset); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gattc_read(conn_handle, handle, offset); + + err_code = ble_gattc_read_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gattc_char_values_read(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + uint16_t * p_conn_handle = &conn_handle; + + uint16_t handles[BLE_GATTC_HANDLE_COUNT_LEN_MAX]; + uint16_t * p_handles = handles; + + uint16_t handle_count = BLE_GATTC_HANDLE_COUNT_LEN_MAX; + uint16_t * p_handle_count = &handle_count; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gattc_char_values_read_req_dec(p_rx_buf, + rx_buf_len, + p_conn_handle, + &p_handles, + p_handle_count); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gattc_char_values_read(conn_handle, p_handles, handle_count); + + err_code = ble_gattc_char_values_read_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gattc_write(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + uint16_t * p_conn_handle = &conn_handle; + + uint8_t value[BLE_GATTC_WRITE_P_VALUE_LEN_MAX]; + + ble_gattc_write_params_t write_params = {0}; + ble_gattc_write_params_t * p_write_params = &write_params; + + p_write_params->len = BLE_GATTC_WRITE_P_VALUE_LEN_MAX; + p_write_params->p_value = value; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gattc_write_req_dec(p_rx_buf, rx_buf_len, p_conn_handle, &p_write_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gattc_write(conn_handle, p_write_params); + + err_code = ble_gattc_write_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gattc_hv_confirm(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint16_t conn_handle; + uint16_t * p_conn_handle = &conn_handle; + + uint16_t handle; + uint16_t * p_handle = &handle; + + err_code = ble_gattc_hv_confirm_req_dec(p_rx_buf, rx_buf_len, p_conn_handle, p_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gattc_hv_confirm(conn_handle, handle); + + err_code = ble_gattc_hv_confirm_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_gattc.h b/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_gattc.h new file mode 100644 index 0000000..403ae11 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_gattc.h @@ -0,0 +1,180 @@ +/* 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 _CONN_MW_BLE_GATTC_H + #define _CONN_MW_BLE_GATTC_H + +#include + +/**@brief Handles @ref sd_ble_gattc_primary_services_discover command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gattc_primary_services_discover (uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gattc_relationships_discover command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gattc_relationships_discover(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gattc_characteristics_discover command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gattc_characteristics_discover(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gattc_descriptors_discover command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gattc_descriptors_discover(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gattc_char_value_by_uuid_read command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gattc_char_value_by_uuid_read(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gattc_read command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gattc_read (uint8_t const *const rx_buf, + uint32_t rx_buf_len, + uint8_t *const tx_buf, + uint32_t *const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gattc_char_values_read command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gattc_char_values_read (uint8_t const *const rx_buf, + uint32_t rx_buf_len, + uint8_t *const tx_buf, + uint32_t *const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gattc_write command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gattc_write (uint8_t const *const rx_buf, + uint32_t rx_buf_len, + uint8_t *const tx_buf, + uint32_t *const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gattc_hv_confirm command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gattc_hv_confirm (uint8_t const *const rx_buf, + uint32_t rx_buf_len, + uint8_t *const tx_buf, + uint32_t *const p_tx_buf_len); + + +#endif //_CONN_MW_BLE_GATTC_H diff --git a/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_gatts.c b/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_gatts.c new file mode 100644 index 0000000..018c5ce --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_gatts.c @@ -0,0 +1,407 @@ +/* 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 "ble_gatts_conn.h" +#include "conn_mw_ble_gatts.h" +#include "ble_serialization.h" + +uint32_t conn_mw_ble_gatts_service_add(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint8_t type; + ble_uuid_t uuid = {0}; + ble_uuid_t * p_uuid = &uuid; + uint16_t handle; + uint16_t * p_handle = &handle; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_service_add_req_dec(p_rx_buf, rx_buf_len, &type, &p_uuid, &p_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_service_add(type, p_uuid, p_handle); + + err_code = ble_gatts_service_add_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gatts_characteristic_add(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t service_handle; + + //Preparing char_md + ble_gatts_char_md_t char_md; + + uint8_t char_user_desc[BLE_GATTS_VAR_ATTR_LEN_MAX]; + ble_gatts_char_pf_t char_pf; + ble_gatts_attr_md_t user_desc_md; + ble_gatts_attr_md_t cccd_md; + ble_gatts_attr_md_t sccd_md; + + char_md.char_user_desc_size = sizeof (char_user_desc); + char_md.p_char_user_desc = char_user_desc; + char_md.p_char_pf = &char_pf; + char_md.p_user_desc_md = &user_desc_md; + char_md.p_cccd_md = &cccd_md; + char_md.p_sccd_md = &sccd_md; + + ble_gatts_char_md_t * p_char_md = &char_md; + + //Preparing attr_char_value + ble_gatts_attr_t attr_char_value; + ble_uuid_t uuid; + ble_gatts_attr_md_t attr_md; + uint8_t value[BLE_GATTS_VAR_ATTR_LEN_MAX]; + + attr_char_value.p_uuid = &uuid; + attr_char_value.p_attr_md = &attr_md; + attr_char_value.init_len = sizeof (value); + attr_char_value.p_value = value; + + ble_gatts_attr_t * p_attr_char_value = &attr_char_value; + + //Preparing handles + ble_gatts_char_handles_t handles; + ble_gatts_char_handles_t * p_handles = &handles; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_characteristic_add_req_dec(p_rx_buf, rx_buf_len, &service_handle, + &p_char_md, &p_attr_char_value, &p_handles); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_characteristic_add(service_handle, p_char_md, + p_attr_char_value, p_handles); + + err_code = ble_gatts_characteristic_add_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, + p_handles); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; + +} + +uint32_t conn_mw_ble_gatts_include_add(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t service_handle; + uint16_t inc_srvc_handle; + uint16_t handle; + uint16_t * p_handle = &handle; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_include_add_req_dec(p_rx_buf, rx_buf_len, &service_handle, + &inc_srvc_handle, &p_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_include_add(service_handle, inc_srvc_handle, p_handle); + + err_code = ble_gatts_include_add_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gatts_descriptor_add(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t char_handle; + uint8_t attr_value[BLE_GATTS_VAR_ATTR_LEN_MAX]; + ble_uuid_t char_uuid; + ble_gatts_attr_md_t metadata; + ble_gatts_attr_t attr; + ble_gatts_attr_t * p_attr = &attr; + + attr.p_uuid = &char_uuid; + attr.p_attr_md = &metadata; + attr.p_value = attr_value; + attr.init_len = sizeof (attr_value); + + uint16_t handle; + uint16_t * p_handle = &handle; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_descriptor_add_req_dec(p_rx_buf, rx_buf_len, &char_handle, &p_attr, + &p_handle); + + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_descriptor_add(char_handle, p_attr, p_handle); + + err_code = ble_gatts_descriptor_add_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gatts_value_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + uint16_t handle; + uint8_t attr_val_table[BLE_GATTS_VAR_ATTR_LEN_MAX]; + ble_gatts_value_t attr_val = + { + .len = sizeof (attr_val_table), + .offset = 0, + .p_value = attr_val_table + }; + ble_gatts_value_t * p_attr_val = &attr_val; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_value_set_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &handle, &p_attr_val); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_value_set(conn_handle, handle, p_attr_val); + + err_code = ble_gatts_value_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_attr_val); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gatts_value_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + uint16_t handle; + uint8_t val[BLE_GATTS_VAR_ATTR_LEN_MAX]; + ble_gatts_value_t attr_value; + ble_gatts_value_t * p_attr_value = &attr_value; + + attr_value.p_value = val; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_value_get_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &handle, &p_attr_value); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_value_get(conn_handle, handle, p_attr_value); + + err_code = ble_gatts_value_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_attr_value); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gatts_hvx(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + uint8_t data[BLE_GATTS_VAR_ATTR_LEN_MAX]; + uint8_t * p_data = data; + uint16_t len = sizeof data; + uint16_t * p_len = &len; + + ble_gatts_hvx_params_t hvx_params; + ble_gatts_hvx_params_t * p_hvx_params = &hvx_params; + + hvx_params.p_len = p_len; + hvx_params.p_data = p_data; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_hvx_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_hvx_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + sd_err_code = sd_ble_gatts_hvx(conn_handle, p_hvx_params); + + p_len = (p_hvx_params) ? p_hvx_params->p_len : NULL; + err_code = ble_gatts_hvx_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gatts_service_changed(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + uint16_t start_handle; + uint16_t end_handle; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_service_changed_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &start_handle, + &end_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_service_changed(conn_handle, start_handle, end_handle); + + err_code = ble_gatts_service_changed_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gatts_rw_authorize_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + + uint8_t data[BLE_GATTS_VAR_ATTR_LEN_MAX]; + ble_gatts_rw_authorize_reply_params_t auth_params; + ble_gatts_rw_authorize_reply_params_t * p_auth_params = &auth_params; + + auth_params.params.read.p_data = data; + auth_params.params.read.len = sizeof (data); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_rw_authorize_reply_req_dec(p_rx_buf, rx_buf_len, &conn_handle, + &p_auth_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_rw_authorize_reply(conn_handle, p_auth_params); + + err_code = ble_gatts_rw_authorize_reply_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gatts_sys_attr_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + + uint8_t sys_attr[BLE_GATTS_VAR_ATTR_LEN_MAX]; + + uint8_t * p_sys_attr = sys_attr; + uint16_t sys_attr_len = sizeof (sys_attr); + + uint32_t flags; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_sys_attr_set_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_sys_attr, + &sys_attr_len, &flags); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_sys_attr_set(conn_handle, p_sys_attr, sys_attr_len, flags); + + err_code = ble_gatts_sys_attr_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gatts_sys_attr_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + + uint8_t sys_attr[BLE_GATTS_VAR_ATTR_LEN_MAX]; + + uint8_t * p_sys_attr = sys_attr; + uint16_t sys_attr_len = sizeof (sys_attr); + uint16_t * p_sys_attr_len = &sys_attr_len; + + uint32_t flags; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_sys_attr_get_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_sys_attr, + &p_sys_attr_len, &flags); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_sys_attr_get(conn_handle, p_sys_attr, p_sys_attr_len, flags); + + err_code = ble_gatts_sys_attr_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_sys_attr, + p_sys_attr_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_gatts.h b/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_gatts.h new file mode 100644 index 0000000..d61865a --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_gatts.h @@ -0,0 +1,216 @@ +/* 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 _CONN_MW_BLE_GATTS_H +#define _CONN_MW_BLE_GATTS_H + +#include + +/**@brief Handles @ref sd_ble_gatts_service_add command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_service_add (uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gatts_characteristic_add command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_characteristic_add(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref conn_mw_ble_gatts_include_add command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_include_add (uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref conn_mw_ble_gatts_descriptor_add command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_descriptor_add(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref conn_mw_ble_gatts_value_set command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_value_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref conn_mw_ble_gatts_value_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_value_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref conn_mw_ble_gatts_hvx command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_hvx(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref conn_mw_ble_gatts_service_changed command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_service_changed(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref conn_mw_ble_gatts_rw_authorize_reply command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_rw_authorize_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref conn_mw_ble_gatts_sys_attr_set command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_sys_attr_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref conn_mw_ble_gatts_sys_attr_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_sys_attr_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); +#endif //_CONN_MW_BLE_GATTS_H + diff --git a/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_l2cap.c b/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_l2cap.c new file mode 100644 index 0000000..a3134b0 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_l2cap.c @@ -0,0 +1,91 @@ +/* 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 "ble_l2cap_conn.h" +#include "conn_mw_ble_l2cap.h" +#include "ble_serialization.h" + +uint32_t conn_mw_ble_l2cap_cid_register(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t cid; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_l2cap_cid_register_req_dec(p_rx_buf, rx_buf_len, &cid); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_l2cap_cid_register(cid); + + err_code = ble_l2cap_cid_register_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_l2cap_cid_unregister(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t cid; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_l2cap_cid_unregister_req_dec(p_rx_buf, rx_buf_len, &cid); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_l2cap_cid_unregister(cid); + + err_code = ble_l2cap_cid_unregister_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_l2cap_tx(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + ble_l2cap_header_t l2cap_header; + ble_l2cap_header_t * p_l2cap_header = &l2cap_header; + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + uint8_t const * p_data = NULL; + + err_code = ble_l2cap_tx_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_l2cap_header, &p_data); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_l2cap_tx(conn_handle, p_l2cap_header, p_data); + + err_code = ble_l2cap_tx_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_l2cap.h b/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_l2cap.h new file mode 100644 index 0000000..dd6ac2e --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/middleware/conn_mw_ble_l2cap.h @@ -0,0 +1,72 @@ +/* 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 _CONN_MW_BLE_L2CAP_H_ +#define _CONN_MW_BLE_L2CAP_H_ + +#include + +/**@brief Handles @ref sd_ble_l2cap_cid_register command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_l2cap_cid_register(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_l2cap_cid_unregister command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_l2cap_cid_unregister(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_l2cap_tx command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_l2cap_tx(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +#endif diff --git a/components/serialization/connectivity/codecs/s120/middleware/conn_mw_items.c b/components/serialization/connectivity/codecs/s120/middleware/conn_mw_items.c new file mode 100644 index 0000000..6db81a1 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/middleware/conn_mw_items.c @@ -0,0 +1,77 @@ +#include "conn_mw_nrf_soc.h" +#include "conn_mw_ble.h" +#include "conn_mw_ble_l2cap.h" +#include "conn_mw_ble_gap.h" +#include "conn_mw_ble_gatts.h" +#include "conn_mw_ble_gattc.h" + +/**@brief Connectivity middleware handlers table. */ +static const conn_mw_item_t conn_mw_item[] = { + //Functions from nrf_soc.h + {SD_POWER_SYSTEM_OFF, conn_mw_power_system_off}, + {SD_TEMP_GET, conn_mw_temp_get}, + //Functions from ble.h + {SD_BLE_TX_BUFFER_COUNT_GET, conn_mw_ble_tx_buffer_count_get}, + {SD_BLE_UUID_VS_ADD, conn_mw_ble_uuid_vs_add}, + {SD_BLE_UUID_DECODE, conn_mw_ble_uuid_decode}, + {SD_BLE_UUID_ENCODE, conn_mw_ble_uuid_encode}, + {SD_BLE_VERSION_GET, conn_mw_ble_version_get}, + {SD_BLE_OPT_GET, conn_mw_ble_opt_get}, + {SD_BLE_OPT_SET, conn_mw_ble_opt_set}, + {SD_BLE_ENABLE, conn_mw_ble_enable}, + //Functions from ble_l2cap.h + {SD_BLE_L2CAP_CID_REGISTER, conn_mw_ble_l2cap_cid_register}, + {SD_BLE_L2CAP_CID_UNREGISTER, conn_mw_ble_l2cap_cid_unregister}, + {SD_BLE_L2CAP_TX, conn_mw_ble_l2cap_tx}, + //Functions from ble_gap.h + {SD_BLE_GAP_SCAN_STOP, conn_mw_ble_gap_scan_stop}, + {SD_BLE_GAP_ADDRESS_SET, conn_mw_ble_gap_address_set}, + {SD_BLE_GAP_CONNECT, conn_mw_ble_gap_connect}, + {SD_BLE_GAP_CONNECT_CANCEL, conn_mw_ble_gap_connect_cancel}, + {SD_BLE_GAP_SCAN_START, conn_mw_ble_gap_scan_start}, + {SD_BLE_GAP_SEC_INFO_REPLY, conn_mw_ble_gap_sec_info_reply}, + {SD_BLE_GAP_ENCRYPT, conn_mw_ble_gap_encrypt}, + {SD_BLE_GAP_ADDRESS_GET, conn_mw_ble_gap_address_get}, + {SD_BLE_GAP_ADV_DATA_SET, conn_mw_ble_gap_adv_data_set}, + {SD_BLE_GAP_ADV_START, conn_mw_ble_gap_adv_start}, + {SD_BLE_GAP_ADV_STOP, conn_mw_ble_gap_adv_stop}, + {SD_BLE_GAP_CONN_PARAM_UPDATE, conn_mw_ble_gap_conn_param_update}, + {SD_BLE_GAP_DISCONNECT, conn_mw_ble_gap_disconnect}, + {SD_BLE_GAP_TX_POWER_SET, conn_mw_ble_gap_tx_power_set}, + {SD_BLE_GAP_APPEARANCE_SET, conn_mw_ble_gap_appearance_set}, + {SD_BLE_GAP_APPEARANCE_GET, conn_mw_ble_gap_appearance_get}, + {SD_BLE_GAP_PPCP_SET, conn_mw_ble_gap_ppcp_set}, + {SD_BLE_GAP_PPCP_GET, conn_mw_ble_gap_ppcp_get}, + {SD_BLE_GAP_DEVICE_NAME_SET, conn_mw_ble_gap_device_name_set}, + {SD_BLE_GAP_DEVICE_NAME_GET, conn_mw_ble_gap_device_name_get}, + {SD_BLE_GAP_AUTHENTICATE, conn_mw_ble_gap_authenticate}, + {SD_BLE_GAP_SEC_PARAMS_REPLY, conn_mw_ble_gap_sec_params_reply}, + {SD_BLE_GAP_AUTH_KEY_REPLY, conn_mw_ble_gap_auth_key_reply}, + {SD_BLE_GAP_SEC_INFO_REPLY, conn_mw_ble_gap_sec_info_reply}, + {SD_BLE_GAP_CONN_SEC_GET, conn_mw_ble_gap_conn_sec_get}, + {SD_BLE_GAP_RSSI_START, conn_mw_ble_gap_rssi_start}, + {SD_BLE_GAP_RSSI_STOP, conn_mw_ble_gap_rssi_stop}, + {SD_BLE_GAP_RSSI_GET, conn_mw_ble_gap_rssi_get}, + //Functions from ble_gattc.h + {SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER, conn_mw_ble_gattc_primary_services_discover}, + {SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, conn_mw_ble_gattc_relationships_discover}, + {SD_BLE_GATTC_CHARACTERISTICS_DISCOVER, conn_mw_ble_gattc_characteristics_discover}, + {SD_BLE_GATTC_DESCRIPTORS_DISCOVER, conn_mw_ble_gattc_descriptors_discover}, + {SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, conn_mw_ble_gattc_char_value_by_uuid_read}, + {SD_BLE_GATTC_READ, conn_mw_ble_gattc_read}, + {SD_BLE_GATTC_CHAR_VALUES_READ, conn_mw_ble_gattc_char_values_read}, + {SD_BLE_GATTC_WRITE, conn_mw_ble_gattc_write}, + {SD_BLE_GATTC_HV_CONFIRM, conn_mw_ble_gattc_hv_confirm}, + //Functions from ble_gatts.h + {SD_BLE_GATTS_SERVICE_ADD, conn_mw_ble_gatts_service_add}, + {SD_BLE_GATTS_INCLUDE_ADD, conn_mw_ble_gatts_include_add}, + {SD_BLE_GATTS_CHARACTERISTIC_ADD, conn_mw_ble_gatts_characteristic_add}, + {SD_BLE_GATTS_DESCRIPTOR_ADD, conn_mw_ble_gatts_descriptor_add}, + {SD_BLE_GATTS_VALUE_SET, conn_mw_ble_gatts_value_set}, + {SD_BLE_GATTS_VALUE_GET, conn_mw_ble_gatts_value_get}, + {SD_BLE_GATTS_HVX, conn_mw_ble_gatts_hvx}, + {SD_BLE_GATTS_SERVICE_CHANGED, conn_mw_ble_gatts_service_changed}, + {SD_BLE_GATTS_RW_AUTHORIZE_REPLY, conn_mw_ble_gatts_rw_authorize_reply}, + {SD_BLE_GATTS_SYS_ATTR_SET, conn_mw_ble_gatts_sys_attr_set}, + {SD_BLE_GATTS_SYS_ATTR_GET, conn_mw_ble_gatts_sys_attr_get}, +}; diff --git a/components/serialization/connectivity/codecs/s120/middleware/conn_mw_nrf_soc.c b/components/serialization/connectivity/codecs/s120/middleware/conn_mw_nrf_soc.c new file mode 100644 index 0000000..c9a7509 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/middleware/conn_mw_nrf_soc.c @@ -0,0 +1,60 @@ +/* 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 "nrf_soc_conn.h" +#include "conn_mw_nrf_soc.h" +#include "ble_serialization.h" + +uint32_t conn_mw_power_system_off(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + + err_code = power_system_off_req_dec(p_rx_buf, rx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = sd_power_system_off(); + /* There should be no return from sd_power_system_off() */ + + return err_code; +} + +uint32_t conn_mw_temp_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + int32_t temperature; + int32_t * p_temperature = &temperature; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = temp_get_req_dec(p_rx_buf, rx_buf_len, &p_temperature); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_temp_get(p_temperature); + + err_code = temp_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_temperature); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/middleware/conn_mw_nrf_soc.h b/components/serialization/connectivity/codecs/s120/middleware/conn_mw_nrf_soc.h new file mode 100644 index 0000000..ba4a973 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/middleware/conn_mw_nrf_soc.h @@ -0,0 +1,55 @@ +/* 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 CONN_MW_NRF_SOC_H__ +#define CONN_MW_NRF_SOC_H__ + +#include + +/**@brief Handles @ref sd_power_system_off command request. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + * @retval NRF_ERROR_NOT_SUPPORTED Handler failure. Opcode not supported. + */ +uint32_t conn_mw_power_system_off(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_temp_get command request and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + * @retval NRF_ERROR_NOT_SUPPORTED Handler failure. Opcode not supported. + */ +uint32_t conn_mw_temp_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +#endif diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_conn.h b/components/serialization/connectivity/codecs/s120/serializers/ble_conn.h new file mode 100644 index 0000000..9259445 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_conn.h @@ -0,0 +1,447 @@ +/* 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. + * + */ +#ifndef BLE_CONN_H__ +#define BLE_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s120_codecs Connectivity s120 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_conn Connectivity command request decoders and command response encoders + * @{ + * @ingroup ser_conn_s120_codecs + * + * @brief Connectivity command request decoders and command response encoders. + */ +#include "ble.h" + +/**@brief Decodes @ref sd_ble_tx_buffer_count_get command request. + * + * @sa @ref nrf51_tx_buffer_count_get_encoding for packet format, + * @ref ble_tx_buffer_count_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_count Pointer to pointer to location for count. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_tx_buffer_count_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint8_t * * const pp_count); + +/**@brief Encodes @ref sd_ble_tx_buffer_count_get command response. + * + * @sa @ref nrf51_tx_buffer_count_get_encoding for packet format. + * @ref ble_tx_buffer_count_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_count Pointer to count value. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_tx_buffer_count_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint8_t const * const p_count); + +/**@brief Event encoding dispatcher. + * + * The event encoding dispatcher will route the event packet to the correct encoder which in turn + * encodes the contents of the event and updates the \p p_buf buffer. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + * @retval NRF_ERROR_NOT_SUPPORTED Event encoder is not implemented. + */ +uint32_t ble_event_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_version_get command request. + * + * @sa @ref nrf51_version_get_encoding for packet format, + * @ref ble_version_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_version Pointer to pointer to @ref ble_version_t address. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_version_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + ble_version_t * * const pp_version); + +/**@brief Encodes @ref sd_ble_version_get command response. + * + * @sa @ref nrf51_version_get_encoding for packet format. + * @ref ble_version_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_version Pointer to @ref ble_version_t address. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_version_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_version_t const * const p_version); + + +/**@brief Decodes @ref sd_ble_opt_get command request. + * + * @sa @ref nrf51_opt_get_encoding for packet format, + * @ref ble_opt_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_opt_id Pointer to pointer to @ref ble_version_t address. + * @param[out] pp_opt Pointer to pointer to @ref ble_opt_t address. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_opt_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint32_t * const p_opt_id, + ble_opt_t **const pp_opt ); + + +/**@brief Encodes @ref sd_ble_opt_get command response. + * + * @sa @ref nrf51_opt_get_encoding for packet format. + * @ref ble_opt_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] opt_id identifies type of ble_opt_t union + * @param[in] p_opt Pointer to @ref ble_opt_t union. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ + +uint32_t ble_opt_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint32_t opt_id, + ble_opt_t const * const p_opt); + + +/**@brief Decodes @ref sd_ble_opt_set command request. + * + * @sa @ref nrf51_opt_set_encoding for packet format, + * @ref ble_opt_set_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_opt_id Pointer to @ref ble_opt_t union type identifier. + * @param[out] pp_opt Pointer to pointer to @ref ble_opt_t union. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_opt_set_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint32_t * const p_opt_id, + ble_opt_t **const pp_opt ); + + +/**@brief Encodes @ref sd_ble_opt_set command response. + * + * @sa @ref nrf51_opt_set_encoding for packet format. + * @ref ble_opt_set_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ + +uint32_t ble_opt_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + + +/**@brief Decodes @ref sd_ble_uuid_encode command request. + * + * @sa @ref nrf51_uuid_encode_encoding for packet format, + * @ref ble_uuid_encode_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_uuid Pointer to pointer to @ref ble_uuid_t structure. + * @param[out] pp_uuid_le_len Pointer to pointer to the length of encoded UUID. + * @param[out] pp_uuid_le Pointer to pointer to buffer where encoded UUID will be stored. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_uuid_encode_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + ble_uuid_t * * const pp_uuid, + uint8_t * * const pp_uuid_le_len, + uint8_t * * const pp_uuid_le); + +/**@brief Encodes @ref sd_ble_uuid_encode command response. + * + * @sa @ref nrf51_uuid_encode_encoding for packet format. + * @ref ble_uuid_encode_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] uuid_le_len Length of the encoded UUID. + * @param[in] p_uuid_le Pointer to the buffer with encoded UUID. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_uuid_encode_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint8_t uuid_le_len, + uint8_t const * const p_uuid_le); + +/**@brief Decodes @ref sd_ble_uuid_decode command request. + * + * @sa @ref nrf51_uuid_decode_encoding for packet format, + * @ref ble_uuid_decode_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of response packet. + * @param[out] p_uuid_le_len Pointer to the length of encoded UUID. + * @param[out] pp_uuid_le Pointer to pointer to buffer where encoded UUID will be stored. + * @param[out] pp_uuid Pointer to pointer to @ref ble_uuid_t structure. + * \c It will be set to NULL if p_uuid is not present in the packet. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_uuid_decode_req_dec(uint8_t const * const p_buf, + uint32_t const buf_len, + uint8_t * p_uuid_le_len, + uint8_t * * const pp_uuid_le, + ble_uuid_t * * const pp_uuid); + +/**@brief Encodes @ref sd_ble_uuid_decode command response. + * + * @sa @ref nrf51_uuid_decode_encoding for packet format. + * @ref ble_uuid_decode_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_uuid Pointer to the buffer with encoded UUID. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_uuid_decode_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_uuid_t const * const p_uuid); + +/**@brief Decodes @ref sd_ble_uuid_vs_add command request. + * + * @sa @ref nrf51_uuid_vs_add_encoding for packet format, + * @ref ble_uuid_vs_add_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of response packet. + * @param[out] pp_uuid Pointer to pointer to UUID. + * \c It will be set to NULL if p_uuid is not present in the packet. + * @param[out] pp_uuid_type Pointer to pointer to UUID type. + * \c It will be set to NULL if p_uuid_type is not present in the packet. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_uuid_vs_add_req_dec(uint8_t const * const p_buf, + uint16_t buf_len, + ble_uuid128_t * * const pp_uuid, + uint8_t * * const pp_uuid_type); + +/**@brief Encodes @ref sd_ble_uuid_vs_add command response. + * + * @sa @ref nrf51_uuid_vs_add_encoding for packet format. + * @ref ble_uuid_vs_add_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_uuid_type Pointer to the UUID type. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_uuid_vs_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint8_t const * const p_uuid_type); + +/**@brief Decodes @ref sd_ble_enable command request. + * + * @sa @ref nrf51_enable_encoding for packet format, + * @ref ble_enable_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_ble_enable_params Pointer to pointer to ble_enable_params_t. + * \c It will be set to NULL if p_ble_enable_params is not present in the packet. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_enable_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_enable_params_t * * const pp_ble_enable_params); + +/**@brief Encodes @ref sd_ble_enable command response. + * + * @sa @ref nrf51_enable_encoding for packet format. + * @ref ble_enable_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_enable_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Pre-decodes opt_id of @ref ble_opt_t for middleware. + * + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] packet_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in,out] p_opt_id Pointer to opt_id which identifies type of @ref ble_opt_t union. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_opt_id_pre_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint32_t * const p_opt_id); + +/**@brief Decodes @ref sd_ble_user_mem_reply command request. + * + * @sa @ref nrf51_user_mem_reply_encoding for packet format, + * @ref ble_user_mem_reply_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[in] p_conn_handle Pointer to Connection Handle. + * @param[in,out] pp_block Pointer to pointer to ble_user_mem_block_t. + * \c It will be set to NULL if p_block is not present in the packet. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_user_mem_reply_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + ble_user_mem_block_t * * const pp_block); + +/**@brief Encodes @ref sd_ble_user_mem_reply command response. + * + * @sa @ref nrf51_user_mem_reply_encoding for packet format. + * @ref ble_user_mem_reply_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_user_mem_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** @} */ + +#endif diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_enable.c b/components/serialization/connectivity/codecs/s120/serializers/ble_enable.c new file mode 100644 index 0000000..da81437 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_enable.c @@ -0,0 +1,46 @@ +/* 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 +#include "ble_conn.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_enable_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_enable_params_t * * const pp_ble_enable_params) +{ + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_ble_enable_params); + SER_ASSERT_NOT_NULL(*pp_ble_enable_params); + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_ble_enable_params, ble_enable_params_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + +uint32_t ble_enable_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + return op_status_enc(SD_BLE_ENABLE, return_code, p_buf, p_buf_len, &index); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_event.c b/components/serialization/connectivity/codecs/s120/serializers/ble_event.c new file mode 100644 index 0000000..058cfa4 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_event.c @@ -0,0 +1,184 @@ +/* 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 "ble_conn.h" +#include "ble_evt_conn.h" +#include "ble_gap_evt_conn.h" +#include "ble_gattc_evt_conn.h" +#include "ble_gatts_evt_conn.h" +#include "ble_l2cap_evt_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_event_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t ret_val = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + SER_ASSERT_NOT_NULL(p_event); + + switch (p_event->header.evt_id) + { + case BLE_EVT_TX_COMPLETE: + ret_val = ble_evt_tx_complete_enc(p_event, event_len, p_buf, p_buf_len); + break; + case BLE_EVT_USER_MEM_RELEASE: + ret_val = ble_evt_user_mem_release_enc(p_event, event_len, p_buf, p_buf_len); + break; + case BLE_EVT_USER_MEM_REQUEST: + ret_val = ble_evt_user_mem_request_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_CONN_PARAM_UPDATE: + ret_val = ble_gap_evt_conn_param_update_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST: + ret_val = ble_gap_evt_conn_param_update_request_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_SEC_PARAMS_REQUEST: + ret_val = ble_gap_evt_sec_params_request_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_SEC_INFO_REQUEST: + ret_val = ble_gap_evt_sec_info_request_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_AUTH_STATUS: + ret_val = ble_gap_evt_auth_status_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_PASSKEY_DISPLAY: + ret_val = ble_gap_evt_passkey_display_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_AUTH_KEY_REQUEST: + ret_val = ble_gap_evt_auth_key_request_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_CONN_SEC_UPDATE: + ret_val = ble_gap_evt_conn_sec_update_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_RSSI_CHANGED: + ret_val = ble_gap_evt_rssi_changed_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_TIMEOUT: + ret_val = ble_gap_evt_timeout_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_DISCONNECTED: + ret_val = ble_gap_evt_disconnected_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_CONNECTED: + ret_val = ble_gap_evt_connected_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_SEC_REQUEST: + ret_val = ble_gap_evt_sec_request_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTC_EVT_CHAR_DISC_RSP: + ret_val = ble_gattc_evt_char_disc_rsp_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTC_EVT_DESC_DISC_RSP: + ret_val = ble_gattc_evt_desc_disc_rsp_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP: + ret_val = ble_gattc_evt_char_val_by_uuid_read_rsp_enc(p_event, + event_len, + p_buf, + p_buf_len); + break; + + case BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP: + ret_val = ble_gattc_evt_prim_srvc_disc_rsp_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTC_EVT_HVX: + ret_val = ble_gattc_evt_hvx_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTC_EVT_READ_RSP: + ret_val = ble_gattc_evt_read_rsp_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTC_EVT_TIMEOUT: + ret_val = ble_gattc_evt_timeout_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTC_EVT_WRITE_RSP: + ret_val = ble_gattc_evt_write_rsp_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTC_EVT_REL_DISC_RSP: + ret_val = ble_gattc_evt_rel_disc_rsp_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTC_EVT_CHAR_VALS_READ_RSP: + ret_val = ble_gattc_evt_char_vals_read_rsp_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTS_EVT_HVC: + ret_val = ble_gatts_evt_hvc_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTS_EVT_TIMEOUT: + ret_val = ble_gatts_evt_timeout_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTS_EVT_SC_CONFIRM: + ret_val = ble_gatts_evt_sc_confirm_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTS_EVT_WRITE: + ret_val = ble_gatts_evt_write_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST: + ret_val = ble_gatts_evt_rw_authorize_request_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTS_EVT_SYS_ATTR_MISSING: + ret_val = ble_gatts_evt_sys_attr_missing_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_L2CAP_EVT_RX: + ret_val = ble_l2cap_evt_rx_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_ADV_REPORT: + ret_val = ble_gap_evt_adv_report_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_SCAN_REQ_REPORT: + ret_val = ble_gap_evt_scan_req_report_enc(p_event, event_len, p_buf, p_buf_len); + break; + + default: + ret_val = NRF_ERROR_NOT_SUPPORTED; + *p_buf_len = 0; + break; + } + + return ret_val; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_evt_conn.h b/components/serialization/connectivity/codecs/s120/serializers/ble_evt_conn.h new file mode 100644 index 0000000..2c8059a --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_evt_conn.h @@ -0,0 +1,95 @@ +/* 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 BLE_EVT_CONN_H__ +#define BLE_EVT_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s120_codecs Connectivity s120 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_evt_conn Connectivity event encoders + * @{ + * @ingroup ser_conn_s120_codecs + * + * @brief Connectivity event encoders. + */ +#include "ble.h" + +/** + * @brief Encodes ble_evt_tx_complete event. + * + * @sa @ref nrf51_evt_tx_complete_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_evt_tx_complete_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_evt_user_mem_release event. + * + * @sa @ref nrf51_evt_user_mem_release_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_evt_user_mem_release_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_evt_user_mem_request event. + * + * @sa @ref nrf51_evt_user_mem_request_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_evt_user_mem_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); +/** @} */ +#endif diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_evt_tx_complete.c b/components/serialization/connectivity/codecs/s120/serializers/ble_evt_tx_complete.c new file mode 100644 index 0000000..f10dbf9 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_evt_tx_complete.c @@ -0,0 +1,38 @@ +/* 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 "ble.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_evt_tx_complete_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 2 + 1, *p_buf_len); + index += uint16_encode(BLE_EVT_TX_COMPLETE, &(p_buf[index])); + index += uint16_encode(p_event->evt.common_evt.conn_handle, &(p_buf[index])); + p_buf[index++] = p_event->evt.common_evt.params.tx_complete.count; + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_evt_user_mem_release.c b/components/serialization/connectivity/codecs/s120/serializers/ble_evt_user_mem_release.c new file mode 100644 index 0000000..5f4f3df --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_evt_user_mem_release.c @@ -0,0 +1,55 @@ +/* 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 "ble_evt_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" +#include "conn_ble_user_mem.h" + +uint32_t ble_evt_user_mem_release_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + + const uint16_t evt_header = BLE_EVT_USER_MEM_RELEASE; + + err_code = uint16_t_enc((void *)&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&p_event->evt.common_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc((void *)&(p_event->evt.common_evt.params.user_mem_release.type), p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&(p_event->evt.common_evt.params.user_mem_release.mem_block.len), p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + p_buf[index++] = p_event->evt.common_evt.params.user_mem_release.mem_block.p_mem ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + // Now user memory context can be released + err_code = conn_ble_user_mem_context_destroy(p_event->evt.common_evt.conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_evt_user_mem_request.c b/components/serialization/connectivity/codecs/s120/serializers/ble_evt_user_mem_request.c new file mode 100644 index 0000000..8faa98b --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_evt_user_mem_request.c @@ -0,0 +1,46 @@ +/* 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 "ble_evt_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_evt_user_mem_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + + const uint16_t evt_header = BLE_EVT_USER_MEM_REQUEST; + + err_code = uint16_t_enc((void *)&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc((void *)&(p_event->evt.common_evt.params.user_mem_request.type), p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_address_get.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_address_get.c new file mode 100644 index 0000000..f0dc9a5 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_address_get.c @@ -0,0 +1,79 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_address_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + ble_gap_addr_t * * const pp_address) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_address); + SER_ASSERT_LENGTH_LEQ(1 + 1, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_GAP_ADDRESS_GET, NRF_ERROR_INVALID_PARAM); + index++; + + if (p_buf[index++] == SER_FIELD_NOT_PRESENT) + { + *pp_address = NULL; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_address_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gap_addr_t const * const p_address) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_ADDRESS_GET, return_code, + p_buf, p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + uint32_t index = *p_buf_len; + + if (return_code != NRF_SUCCESS) + { + *p_buf_len = index; + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_address); + + SER_ASSERT_LENGTH_LEQ(index + sizeof (ble_gap_addr_t), total_len); + p_buf[index++] = p_address->addr_type; + memcpy(&p_buf[index], &p_address->addr[0], BLE_GAP_ADDR_LEN); + index += BLE_GAP_ADDR_LEN; + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_address_set.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_address_set.c new file mode 100644 index 0000000..8727a01 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_address_set.c @@ -0,0 +1,52 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_address_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * p_addr_cycle_mode, + ble_gap_addr_t * * const pp_addr) +{ + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_addr_cycle_mode); + SER_ASSERT_NOT_NULL(pp_addr); + SER_ASSERT_NOT_NULL(*pp_addr); + + err_code = uint8_t_dec(p_buf, packet_len, &index, p_addr_cycle_mode); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_addr, ble_gap_addr_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + +uint32_t ble_gap_address_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + return op_status_enc(SD_BLE_GAP_ADDRESS_SET, return_code, p_buf, p_buf_len, &index); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_adv_data_set.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_adv_data_set.c new file mode 100644 index 0000000..ab83ce0 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_adv_data_set.c @@ -0,0 +1,49 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_adv_data_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * * const pp_data, + uint8_t * p_dlen, + uint8_t * * const pp_sr_data, + uint8_t * p_srdlen) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_dlen); + SER_ASSERT_NOT_NULL(p_srdlen); + + uint32_t index = SER_CMD_DATA_POS; + + uint32_t error_code = len8data_dec(p_buf, packet_len, &index, pp_data, p_dlen); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + error_code = len8data_dec(p_buf, packet_len, &index, pp_sr_data, p_srdlen); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_adv_data_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_ADV_DATA_SET, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_adv_start.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_adv_start.c new file mode 100644 index 0000000..ad5b071 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_adv_start.c @@ -0,0 +1,88 @@ +/* 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 "ble_gap_conn.h" +#include +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_adv_start_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_adv_params_t * * const pp_adv_params) +{ + uint32_t index = 0, i = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_adv_params); + SER_ASSERT_NOT_NULL(*pp_adv_params); + SER_ASSERT_NOT_NULL((*pp_adv_params)->p_peer_addr); + SER_ASSERT_NOT_NULL((*pp_adv_params)->p_whitelist); + SER_ASSERT_NOT_NULL((*pp_adv_params)->p_whitelist->pp_addrs); + SER_ASSERT_NOT_NULL((*pp_adv_params)->p_whitelist->pp_irks); + + for (i = 0; i < BLE_GAP_WHITELIST_ADDR_MAX_COUNT; i++) + { + SER_ASSERT_NOT_NULL((*pp_adv_params)->p_whitelist->pp_addrs[i]); + } + + for (i = 0; i < BLE_GAP_WHITELIST_IRK_MAX_COUNT; i++) + { + SER_ASSERT_NOT_NULL((*pp_adv_params)->p_whitelist->pp_irks[i]); + } + + /* Packet with variable length. */ + /* For now check: opcode + indicator showing if ble_gap_adv_params_t struct is present. */ + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 1, packet_len); + SER_ASSERT(p_buf[index] == SD_BLE_GAP_ADV_START, NRF_ERROR_INVALID_PARAM); + index++; + + if (p_buf[index++] == SER_FIELD_PRESENT) + { + err_code = uint8_t_dec(p_buf, packet_len, &index, &((*pp_adv_params)->type)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void **) &((*pp_adv_params)->p_peer_addr), ble_gap_addr_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, packet_len, &index, &((*pp_adv_params)->fp)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void **) &((*pp_adv_params)->p_whitelist), ble_gap_whitelist_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, packet_len, &index, &((*pp_adv_params)->interval)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, packet_len, &index, &((*pp_adv_params)->timeout)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_adv_ch_mask_t_dec(p_buf, packet_len, &index, &((*pp_adv_params)->channel_mask)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + else + { + *pp_adv_params = NULL; + } + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + +uint32_t ble_gap_adv_start_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_ADV_START, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_adv_stop.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_adv_stop.c new file mode 100644 index 0000000..b3569a2 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_adv_stop.c @@ -0,0 +1,23 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_adv_stop_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_ADV_STOP, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_appearance_get.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_appearance_get.c new file mode 100644 index 0000000..cc828b5 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_appearance_get.c @@ -0,0 +1,76 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_appearance_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * * const pp_appearance) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_appearance); + SER_ASSERT_NOT_NULL(*pp_appearance); + SER_ASSERT_LENGTH_EQ(2, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_GAP_APPEARANCE_GET, NRF_ERROR_INVALID_PARAM); + index++; + + if (p_buf[index++] == SER_FIELD_NOT_PRESENT) + { + *pp_appearance = NULL; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_appearance_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t const * const p_appearance) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_APPEARANCE_GET, return_code, + p_buf, p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_appearance); + uint32_t index = *p_buf_len; + + SER_ASSERT_LENGTH_LEQ(index + sizeof (uint16_t), total_len); + index += uint16_encode(*p_appearance, &p_buf[index]); + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_appearance_set.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_appearance_set.c new file mode 100644 index 0000000..f393fdb --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_appearance_set.c @@ -0,0 +1,42 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" +#include "nrf_error.h" + + +uint32_t ble_gap_appearance_set_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * const p_appearance) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_appearance); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_LENGTH_EQ(3, buf_len); + SER_ASSERT(p_buf[index++] == SD_BLE_GAP_APPEARANCE_SET, NRF_ERROR_INVALID_PARAM); + + uint32_t err_code = uint16_t_dec(p_buf, buf_len, &index, p_appearance); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_appearance_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_APPEARANCE_SET, return_code, + p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_auth_key_reply.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_auth_key_reply.c new file mode 100644 index 0000000..988c711 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_auth_key_reply.c @@ -0,0 +1,68 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_auth_key_reply_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * p_conn_handle, + uint8_t * p_key_type, + uint8_t * * const pp_key) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_key_type); + + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code = NRF_SUCCESS; + uint8_t key_len; + + SER_ASSERT_LENGTH_LEQ(2, packet_len - index); + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + SER_ASSERT_LENGTH_LEQ(1, packet_len - index); + uint8_dec(p_buf, packet_len, &index, p_key_type); + + switch (*p_key_type) + { + case BLE_GAP_AUTH_KEY_TYPE_NONE: + key_len = 0; + break; + + case BLE_GAP_AUTH_KEY_TYPE_PASSKEY: + key_len = 6; + break; + + case BLE_GAP_AUTH_KEY_TYPE_OOB: + key_len = 16; + break; + + default: + return NRF_ERROR_INVALID_PARAM; + } + + err_code = buf_dec(p_buf, packet_len, &index, pp_key, key_len, key_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + return err_code; +} + +uint32_t ble_gap_auth_key_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_AUTH_KEY_REPLY, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_authenticate.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_authenticate.c new file mode 100644 index 0000000..4d7053e --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_authenticate.c @@ -0,0 +1,57 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "nordic_common.h" +#include "app_util.h" +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" + + +uint32_t ble_gap_authenticate_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + ble_gap_sec_params_t * * const pp_sec_params) +{ + uint32_t index = SER_CMD_DATA_POS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_sec_params); + SER_ASSERT_NOT_NULL(*pp_sec_params); + + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + packet_len, + &index, + (void * *)pp_sec_params, + ble_gap_sec_params_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + +uint32_t ble_gap_authenticate_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_AUTHENTICATE, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_conn.h b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_conn.h new file mode 100644 index 0000000..9f6e520 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_conn.h @@ -0,0 +1,1043 @@ +/* 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. + * + */ +#ifndef BLE_GAP_CONN_H__ +#define BLE_GAP_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s120_codecs Connectivity s120 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gap_conn GAP Connectivity command request decoders and command response encoders + * @{ + * @ingroup ser_conn_s120_codecs + * + * @brief GAP Connectivity command request decoders and command response encoders + */ +#include "ble_gap.h" + +/**@brief Decodes @ref sd_ble_gap_address_get command request. + * + * @sa @ref nrf51_address_get_encoding for packet format, + * @ref ble_gap_address_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_address Pointer to pointer to address. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_address_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + ble_gap_addr_t * * const pp_address); + +/**@brief Encodes @ref sd_ble_gap_address_get command response. + * + * @sa @ref nrf51_address_get_encoding for packet format. + * @ref ble_gap_address_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_address Pointer to @ref ble_gap_addr_t address + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_address_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gap_addr_t const * const p_address); + +/**@brief Decodes @ref sd_ble_gap_authenticate command request. + * + * @sa @ref nrf51_ble_gap_authenticate_encoding for packet format, + * @ref ble_gap_authenticate_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle + * @param[out] pp_sec_params Pointer to pointer to security parameters. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_authenticate_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + ble_gap_sec_params_t * * const pp_sec_params); + +/**@brief Encodes @ref sd_ble_gap_authenticate command response. + * + * @sa @ref nrf51_ble_gap_authenticate_encoding for packet format. + * @ref ble_gap_authenticate_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_authenticate_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** @brief Decodes @ref sd_ble_gap_address_set command request. + * + * @sa @ref nrf51_gap_address_set_encoding for packet format, + * @ref ble_gap_address_set_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of request packet. + * @param[in] p_addr_cycle_mode Pointer to address cycle mode. + * @param[out] pp_addr Pointer to pointer to the address structure. + + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_address_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * p_addr_cycle_mode, + ble_gap_addr_t * * const pp_addr); + +/**@brief Encodes @ref sd_ble_gap_address_set command response. + * + * @sa @ref nrf51_gap_address_set_encoding for packet format. + * @ref ble_gap_address_set_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_address_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_adv_data_set command request. + * + * @sa @ref nrf51_adv_set_encoding for packet format, + * @ref ble_gap_adv_data_set_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of request packet. + * @param[out] pp_data Pointer to the buffer raw data to be placed in advertisement packet. + * @param[out] p_dlen Pointer to data length for p_data. + * @param[out] pp_sr_data Pointer to the buffer raw data to be placed in scan response packet. + * @param[out] p_srdlen Pointer to data length for p_sr_data. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_adv_data_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * * const pp_data, + uint8_t * p_dlen, + uint8_t * * const pp_sr_data, + uint8_t * p_srdlen); + +/**@brief Encodes @ref sd_ble_gap_adv_data_set command response. + * + * @sa @ref nrf51_adv_set_encoding for packet format. + * @ref ble_gap_adv_data_set_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_adv_data_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_adv_start command request. + * + * @sa @ref nrf51_adv_start_encoding for packet format, + * @ref ble_gap_adv_start_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_adv_params Pointer to pointer to advertising parameters. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_adv_start_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_adv_params_t * * const pp_adv_params); + +/**@brief Encodes @ref sd_ble_gap_adv_start command response. + * + * @sa @ref nrf51_adv_start_encoding for packet format. + * @ref ble_gap_adv_start_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_adv_start_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_device_name_get command request. + * + * @sa @ref nrf51_device_name_get_encoding for packet format, + * @ref ble_gap_device_name_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_dev_name Pointer to pointer to device name buffer. + * @param[out] pp_dev_name_len Pointer to pointer to device name length location. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_device_name_get_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * * pp_dev_name, + uint16_t * * pp_dev_name_len); + +/**@brief Encodes @ref sd_ble_gap_device_name_get command response. + * + * @sa @ref nrf51_device_name_get_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_dev_name Pointer to device name buffer. + * @param[in] dev_name_len Length of device name buffer. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buflen \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_device_name_get_rsp_enc(uint32_t return_code, + uint8_t const * const p_dev_name, + uint16_t dev_name_len, + uint8_t * const p_buf, + uint32_t * const p_buflen); + +/**@brief Decodes @ref sd_ble_gap_conn_param_update command request. + * + * @sa @ref nrf51_gap_conn_param_update_encoding for packet format, + * @ref ble_gap_conn_param_update_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] pp_conn_params Pointer to pointer to connection parameters. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for connection + * parameters field present. + */ +uint32_t ble_gap_conn_param_update_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * p_conn_handle, + ble_gap_conn_params_t * * const pp_conn_params); + +/**@brief Encodes @ref sd_ble_gap_conn_param_update command response. + * + * @sa @ref nrf51_gap_conn_param_update_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_conn_param_update_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + + +/**@brief Decodes @ref sd_ble_gap_disconnect command request. + * + * @sa @ref nrf51_disconnect_encoding for packet format, + * @ref ble_gap_disconnect_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[in] p_conn_handle Pointer to Connection Handle. + * @param[in] p_hci_status Pointer to HCI Status Code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_disconnect_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint8_t * const p_hci_status); + +/**@brief Encodes @ref sd_ble_gap_disconnect command response. + * + * @sa @ref nrf51_disconnect_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_disconnect_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_tx_power_set command request. + * + * @sa @ref nrf51_tx_power_set_encoding for packet format, + * @ref ble_gap_tx_power_set_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[in] tx_power Pointer to TX power value. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_tx_power_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + int8_t * tx_power); + +/**@brief Encodes @ref sd_ble_gap_tx_power_set command response. + * + * @sa @ref nrf51_tx_power_set_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_tx_power_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_ppcp_set command request. + * + * @sa @ref nrf51_ppcp_set_encoding for packet format, + * @ref ble_gap_ppcp_set_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_conn_params Pointer to pointer to connection parameters to be set. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for connection + * parameters field present. + */ +uint32_t ble_gap_ppcp_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_conn_params_t * * const pp_conn_params); + +/**@brief Encodes @ref sd_ble_gap_ppcp_set command response. + * + * @sa @ref nrf51_ppcp_set_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_ppcp_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + + +/**@brief Decodes @ref sd_ble_gap_ppcp_get command request. + * + * @sa @ref nrf51_gap_ppcp_get_encoding for packet format, + * @ref ble_gap_ppcp_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_conn_params Pointer to pointer to ble_gap_conn_params_t. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_ppcp_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + ble_gap_conn_params_t * * const pp_conn_params); + +/**@brief Encodes @ref sd_ble_gap_ppcp_get command response. + * + * @sa @ref nrf51_gap_ppcp_get_encoding for packet format. + * @ref ble_gap_ppcp_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_conn_params Pointer to ble_gap_conn_params_t. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_ppcp_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gap_conn_params_t const * const p_conn_params); + +/**@brief Encodes @ref sd_ble_gap_adv_stop command response. + * + * @sa @ref nrf51_sd_ble_gap_adv_stop for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_adv_stop_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_auth_key_reply command request. + * + * @sa @ref nrf51_auth_key_reply_encoding for packet format, + * @ref ble_gap_auth_key_reply_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] p_key_type Pointer to key type. + * @param[out] pp_key Pointer to pointer to buffer for incoming key. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_auth_key_reply_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * p_conn_handle, + uint8_t * p_key_type, + uint8_t * * const pp_key); + +/**@brief Encodes @ref sd_ble_gap_auth_key_reply command response. + * + * @sa @ref nrf51_auth_key_reply_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_auth_key_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_sec_params_reply command request. + * + * @sa @ref nrf51_sec_params_reply_encoding for packet format, + * @ref ble_gap_sec_params_reply_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] p_sec_status Pointer to security status. + * @param[out] pp_sec_params Pointer to pointer to security parameters structure. + * @param[out] pp_sec_keyset Pointer to pointer to security keyset structure. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for connection + * parameters field present. + */ +uint32_t ble_gap_sec_params_reply_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * p_conn_handle, + uint8_t * p_sec_status, + ble_gap_sec_params_t * * const pp_sec_params, + ble_gap_sec_keyset_t * * const pp_sec_keyset); + +/**@brief Encodes @ref sd_ble_gap_sec_params_reply command response. + * + * @sa @ref nrf51_sec_params_reply_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in] p_sec_keyset Pointer to security keyset structure. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_sec_params_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gap_sec_keyset_t * const p_sec_keyset); + +/**@brief Decodes @ref sd_ble_gap_rssi_start command request. + * + * @sa @ref nrf51_rssi_start_encoding for packet format, + * @ref ble_gap_rssi_start_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] p_threshold_dbm Pointer to threshold in dBm. + * @param[out] p_skip_count Pointer to sample skip count. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_rssi_start_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * p_conn_handle, + uint8_t * p_threshold_dbm, + uint8_t * p_skip_count); + +/**@brief Encodes @ref sd_ble_gap_rssi_start command response. + * + * @sa @ref nrf51_rssi_start_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ + +uint32_t ble_gap_rssi_start_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_rssi_stop command request. + * + * @sa @ref nrf51_rssi_stop_encoding for packet format, + * @ref ble_gap_rssi_stop_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of response packet. + * @param[out] conn_handle Pointer to connection handle. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ + +uint32_t ble_gap_rssi_stop_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * conn_handle); + +/**@brief Encodes @ref sd_ble_gap_rssi_stop command response. + * + * @sa @ref nrf51_rssi_stop_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ + +uint32_t ble_gap_rssi_stop_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_appearance_get command request. + * + * @sa @ref nrf51_appearance_get_encoding for packet format, + * @ref ble_gap_appearance_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_appearance Pointer to pointer to uint16_t appearance. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_appearance_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * * const pp_appearance); + +/**@brief Encodes @ref sd_ble_gap_appearance_get command response. + * + * @sa @ref nrf51_appearance_get_encoding for packet format. + * @ref ble_gap_appearance_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_appearance Pointer to uint16_t appearance. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_appearance_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t const * const p_appearance); + + +/**@brief Decodes @ref sd_ble_gap_appearance_set command request. + * + * @sa @ref nrf51_appearance_set_encoding for packet format, + * @ref ble_gap_tx_power_set_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of the packet. + * @param[out] p_appearance Pointer to the appearance. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_appearance_set_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * const p_appearance); + +/**@brief Encodes @ref sd_ble_gap_appearance_set command response. + * + * @sa @ref nrf51_appearance_set_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_appearance_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + + +/**@brief Decodes @ref sd_ble_gap_sec_info_reply command request. + * + * @sa @ref nrf51_gap_sec_info_reply_encoding for packet format, + * @ref ble_gap_sec_info_reply_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of the packet. + * @param[out] p_conn_handle Pointer to the Connection Handle. + * @param[out] pp_enc_info Pointer to pointer to Encryption Information. + * @param[out] pp_id_info Pointer to pointer to Id Information. + * @param[out] pp_sign_info Pointer to pointer to Signing Information + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_sec_info_reply_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * p_conn_handle, + ble_gap_enc_info_t * * const pp_enc_info, + ble_gap_irk_t * * const pp_id_info, + ble_gap_sign_info_t * * const pp_sign_info); + +/**@brief Encodes @ref sd_ble_gap_sec_info_reply command response. + * + * @sa @ref nrf51_gap_sec_info_reply_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_sec_info_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_device_name_set command request. + * + * @sa @ref nrf51_device_name_set_encoding for packet format, + * @ref ble_gap_device_name_set_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of the packet. + * @param[out] pp_write_perm Pointer to pointer to write permissions filed. + * @param[out] pp_dev_name Pointer to pointer to device name string + * @param[out] p_dev_name_len Pointer to device name string length + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_device_name_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_conn_sec_mode_t * * const pp_write_perm, + uint8_t * * const pp_dev_name, + uint16_t * const p_dev_name_len); + + +/**@brief Encodes @ref sd_ble_gap_device_name_set command response. + * + * @sa @ref nrf51_device_name_set_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_device_name_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_conn_sec_get command request. + * + * @sa @ref nrf51_gap_conn_sec_get_encoding for packet format, + * @ref ble_gap_conn_sec_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to Connection Handle. + * @param[out] pp_conn_sec Pointer to pointer to @ref ble_gap_conn_sec_t to be filled by + * the softdevice. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_conn_sec_get_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * p_conn_handle, + ble_gap_conn_sec_t * * const pp_conn_sec); + +/**@brief Encodes @ref sd_ble_gap_conn_sec_get command response. + * + * @sa @ref nrf51_gap_conn_sec_get_encoding for packet format. + * @ref ble_gap_conn_sec_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_conn_sec Pointer to @ref ble_gap_conn_sec_t to be encoded. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_conn_sec_get_rsp_enc(uint32_t return_code, + ble_gap_conn_sec_t * const p_conn_sec, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Encodes @ref sd_ble_gap_scan_stop command response. + * + * @sa @ref nrf51_scan_stop_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_scan_stop_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_connect command request. + * + * @sa @ref nrf51_connect_encoding for packet format, + * @ref ble_gap_connect_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_addr Pointer to pointer to peer address @ref ble_gap_addr_t. + * @param[out] pp_scan_params Pointer to pointer to @ref ble_gap_scan_params_t. + * @param[out] pp_conn_params Pointer to pointer to @ref ble_gap_conn_params_t. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_connect_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_addr_t * * const pp_addr, + ble_gap_scan_params_t * * const pp_scan_params, + ble_gap_conn_params_t * * const pp_conn_params); + +/**@brief Encodes @ref sd_ble_gap_connect command response. + * + * @sa @ref nrf51_connect_encoding for packet format. + * @ref ble_gap_connect_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_connect_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_scan_start command request. + * + * @sa @ref nrf51_scan_start_encoding for packet format, + * @ref ble_gap_scan_start_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_scan_params Pointer to pointer to @ref ble_gap_scan_params_t. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_scan_start_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_scan_params_t * * const pp_scan_params); + +/**@brief Encodes @ref sd_ble_gap_scan_start command response. + * + * @sa @ref nrf51_scan_start_encoding for packet format. + * @ref ble_gap_scan_start_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_scan_start_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Encodes @ref sd_ble_gap_connect_cancel command response. + * + * @sa @ref nrf51_connect_cancel_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_connect_cancel_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_encrypt command request. + * + * @sa @ref nrf51_gap_encrypt_encoding for packet format, + * @ref ble_gap_encrypt_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer connection_handle. + * @param[out] pp_master_id Pointer to pointer to @ref ble_gap_master_id_t. + * @param[out] pp_enc_info Pointer to pointer to @ref ble_gap_enc_info_t. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ + +uint32_t ble_gap_encrypt_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gap_master_id_t ** const pp_master_id, + ble_gap_enc_info_t ** const pp_enc_info); + +/**@brief Encodes @ref sd_ble_gap_encrypt command response. + * + * @sa @ref nrf51_gap_encrypt_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_encrypt_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_rssi_get command request. + * + * @sa @ref nrf51_rssi_get_encoding for packet format, + * @ref ble_gap_rssi_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[in] p_conn_handle Connection handle. + * @param[out] pp_rssi Pointer to pointer to rssi value. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_rssi_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * p_conn_handle, + int8_t * * const pp_rssi); + +/**@brief Encodes @ref sd_ble_gap_rssi_get command response. + * + * @sa @ref nrf51_rssi_get_encoding for packet format. + * @ref ble_gap_rssi_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] rssi RSSI value. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_rssi_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + int8_t rssi); + +/** @} */ +#endif diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_conn_param_update.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_conn_param_update.c new file mode 100644 index 0000000..38ac3fd --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_conn_param_update.c @@ -0,0 +1,71 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_conn_param_update_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * p_conn_handle, + ble_gap_conn_params_t * * const pp_conn_params) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_conn_params); + SER_ASSERT_NOT_NULL(*pp_conn_params); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 3, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_GAP_CONN_PARAM_UPDATE, NRF_ERROR_INVALID_PARAM); + + index++; + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + if (p_buf[index] == SER_FIELD_PRESENT) + { + index++; + SER_ASSERT_LENGTH_LEQ(index + 8, packet_len); + uint16_dec(p_buf, packet_len, &index, &((*pp_conn_params)->min_conn_interval)); + uint16_dec(p_buf, packet_len, &index, &((*pp_conn_params)->max_conn_interval)); + uint16_dec(p_buf, packet_len, &index, &((*pp_conn_params)->slave_latency)); + uint16_dec(p_buf, packet_len, &index, &((*pp_conn_params)->conn_sup_timeout)); + } + else if (p_buf[index] == SER_FIELD_NOT_PRESENT) + { + index++; + *pp_conn_params = NULL; + } + else + { + return NRF_ERROR_INVALID_DATA; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_conn_param_update_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_CONN_PARAM_UPDATE, + return_code, + p_buf, + p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_conn_sec_get.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_conn_sec_get.c new file mode 100644 index 0000000..d3631ee --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_conn_sec_get.c @@ -0,0 +1,75 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" + + +uint32_t ble_gap_conn_sec_get_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * p_conn_handle, + ble_gap_conn_sec_t * * const pp_conn_sec) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + + uint32_t index = 0; + uint8_t opcode; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, packet_len - index); + uint8_dec(p_buf, packet_len, &index, &opcode); + + SER_ASSERT(opcode == SD_BLE_GAP_CONN_SEC_GET, NRF_ERROR_INVALID_PARAM); + + SER_ASSERT_LENGTH_LEQ(2, packet_len - index); + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_conn_sec, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + +uint32_t ble_gap_conn_sec_get_rsp_enc(uint32_t return_code, + ble_gap_conn_sec_t * const p_conn_sec, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t buflen = *p_buf_len; + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_CONN_SEC_GET, return_code, + p_buf, p_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + uint32_t index = *p_buf_len; + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + err_code = cond_field_enc(p_conn_sec, p_buf, buflen, &index, ble_gap_conn_sec_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_connect.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_connect.c new file mode 100644 index 0000000..e7b6135 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_connect.c @@ -0,0 +1,55 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_connect_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_addr_t * * const pp_addr, + ble_gap_scan_params_t * * const pp_scan_params, + ble_gap_conn_params_t * * const pp_conn_params) +{ + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_addr); + SER_ASSERT_NOT_NULL(*pp_addr); + SER_ASSERT_NOT_NULL(pp_scan_params); + SER_ASSERT_NOT_NULL(*pp_scan_params); + SER_ASSERT_NOT_NULL(pp_conn_params); + SER_ASSERT_NOT_NULL(*pp_conn_params); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_addr, ble_gap_addr_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_scan_params, ble_gap_scan_params_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_conn_params, ble_gap_conn_params_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + +uint32_t ble_gap_connect_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_CONNECT, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_connect_cancel.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_connect_cancel.c new file mode 100644 index 0000000..4551fcd --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_connect_cancel.c @@ -0,0 +1,25 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_connect_cancel_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_CONNECT_CANCEL, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_device_name_get.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_device_name_get.c new file mode 100644 index 0000000..e169d02 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_device_name_get.c @@ -0,0 +1,92 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" +#include "nrf_error.h" + +uint32_t ble_gap_device_name_get_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint8_t * * pp_name, + uint16_t * * pp_name_len) +{ + uint32_t index = 0; + uint32_t err_code; + + SER_ASSERT_NOT_NULL(pp_name_len); + SER_ASSERT_NOT_NULL(*pp_name_len); + + SER_ASSERT_LENGTH_LEQ(index + 1, buf_len); + + index++; + + if (p_buf[index] != SER_FIELD_PRESENT && p_buf[index] != SER_FIELD_NOT_PRESENT) + { + return NRF_ERROR_INVALID_PARAM; + } + + if (p_buf[index++] == SER_FIELD_PRESENT) + { + err_code = uint16_t_dec(p_buf, buf_len, &index, *pp_name_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + else + { + *pp_name_len = NULL; + } + + SER_ASSERT_LENGTH_LEQ(index + 1, buf_len); + + if (p_buf[index] != SER_FIELD_PRESENT && p_buf[index] != SER_FIELD_NOT_PRESENT) + { + return NRF_ERROR_INVALID_PARAM; + } + + if (p_buf[index] == SER_FIELD_NOT_PRESENT) + { + *pp_name = NULL; + } + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_device_name_get_rsp_enc(uint32_t return_code, + uint8_t const * const p_dev_name, + uint16_t dev_name_len, + uint8_t * const p_buf, + uint32_t * const p_buflen) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buflen); + + uint32_t buflen = *p_buflen; + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_DEVICE_NAME_GET, return_code, + p_buf, p_buflen); + uint32_t index = *p_buflen; + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + err_code = len16data_enc(p_dev_name, dev_name_len, p_buf, buflen, &index); + + *p_buflen = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_device_name_set.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_device_name_set.c new file mode 100644 index 0000000..84c49ff --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_device_name_set.c @@ -0,0 +1,61 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" +#include "ble_gap_struct_serialization.h" +#include "cond_field_serialization.h" + +uint32_t ble_gap_device_name_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_conn_sec_mode_t * * const pp_write_perm, + uint8_t * * const pp_dev_name, + uint16_t * const p_dev_name_len) +{ + SER_ASSERT_NOT_NULL(p_buf); //check if *p_buf is allocated + SER_ASSERT_NOT_NULL(pp_write_perm); //check if *pp_write_perm exist + SER_ASSERT_NOT_NULL(pp_dev_name); //check if *pp_dev_name exist + SER_ASSERT_NOT_NULL(p_dev_name_len); //check if *p_dev_name_len exist + + uint32_t index = SER_CMD_DATA_POS; + uint32_t status_code; + + SER_ASSERT_LENGTH_LEQ(4, packet_len - index); //make sure that payload is at least 4 bytes + + //decode optional write permissions field + status_code = cond_field_dec(p_buf, + packet_len, + &index, + (void * *)pp_write_perm, + ble_gap_conn_sec_mode_dec); + SER_ASSERT(status_code == NRF_SUCCESS, status_code); + + //decode optional device name field + status_code = len16data_dec(p_buf, packet_len, &index, pp_dev_name, p_dev_name_len); + SER_ASSERT(status_code == NRF_SUCCESS, status_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + return status_code; +} + + +uint32_t ble_gap_device_name_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_DEVICE_NAME_SET, + return_code, + p_buf, + p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_disconnect.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_disconnect.c new file mode 100644 index 0000000..e69a0d0 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_disconnect.c @@ -0,0 +1,52 @@ +/* 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 +#include "ble_gap_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_disconnect_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint8_t * const p_hci_status) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_hci_status); + + uint8_t opcode; + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint8_t_dec(p_buf, packet_len, &index, &opcode); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + SER_ASSERT(opcode == SD_BLE_GAP_DISCONNECT, NRF_ERROR_INVALID_PARAM); + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, packet_len, &index, p_hci_status); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + +uint32_t ble_gap_disconnect_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_DISCONNECT, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_encrypt.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_encrypt.c new file mode 100644 index 0000000..3cf0262 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_encrypt.c @@ -0,0 +1,60 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" +#include "ble_gap_struct_serialization.h" +#include "cond_field_serialization.h" + +uint32_t ble_gap_encrypt_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gap_master_id_t ** const pp_master_id, + ble_gap_enc_info_t ** const pp_enc_info) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_enc_info); + SER_ASSERT_NOT_NULL(pp_master_id); + SER_ASSERT_NOT_NULL(*pp_enc_info); + SER_ASSERT_NOT_NULL(*pp_master_id); + + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(2, packet_len - index); + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + err_code = cond_field_dec(p_buf, + packet_len, + &index, + (void **)pp_master_id, + ble_gap_master_id_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + packet_len, + &index, + (void **)pp_enc_info, + ble_gap_enc_info_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_encrypt_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_ENCRYPT, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_adv_report.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_adv_report.c new file mode 100644 index 0000000..fa6cd3f --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_adv_report.c @@ -0,0 +1,61 @@ +/* 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 "ble.h" +#include "ble_gap_evt_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_adv_report_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + const uint16_t evt_header = BLE_GAP_EVT_ADV_REPORT; + + err_code = uint16_t_enc((void *)&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_addr_enc((void *)&(p_event->evt.gap_evt.params.adv_report.peer_addr), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc((void *)&(p_event->evt.gap_evt.params.adv_report.rssi), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + byte = (p_event->evt.gap_evt.params.adv_report.scan_rsp) | + ((p_event->evt.gap_evt.params.adv_report.type) << 0x01) | + ((p_event->evt.gap_evt.params.adv_report.dlen) << 0x03); + + err_code = uint8_t_enc((void *)&(byte), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_vector_enc(p_event->evt.gap_evt.params.adv_report.data, (uint16_t)p_event->evt.gap_evt.params.adv_report.dlen, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_auth_key_request.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_auth_key_request.c new file mode 100644 index 0000000..7805879 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_auth_key_request.c @@ -0,0 +1,49 @@ +/* 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 "ble.h" +#include "ble_gap_evt_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_evt_auth_key_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + uint16_t evt_header = BLE_GAP_EVT_AUTH_KEY_REQUEST; + + err_code = uint16_t_enc(&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&p_event->evt.gap_evt.params.auth_key_request.key_type, + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_auth_status.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_auth_status.c new file mode 100644 index 0000000..59a751a --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_auth_status.c @@ -0,0 +1,62 @@ +/* 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 +#include "ble_serialization.h" +#include "app_util.h" +#include "ble.h" +#include "ble_gap_struct_serialization.h" +#include "ble_gap_evt_conn.h" +#include "conn_ble_gap_sec_keys.h" + +extern ser_ble_gap_conn_keyset_t m_conn_keys_table[]; + +uint32_t ble_gap_evt_auth_status_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint16_t evt_header = BLE_GAP_EVT_AUTH_STATUS; + uint32_t total_len; + uint32_t err_code = NRF_SUCCESS; + uint32_t conn_index; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + total_len = *p_buf_len; + + err_code = uint16_t_enc(&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_auth_status_t_enc(&(p_event->evt.gap_evt.params.auth_status), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + // keyset is an extension of standard event data - used to synchronize keys at application + err_code = conn_ble_gap_sec_context_find(p_event->evt.gap_evt.conn_handle, &conn_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_keyset_t_enc(&(m_conn_keys_table[conn_index].keyset), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = conn_ble_gap_sec_context_destroy(p_event->evt.gap_evt.conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + return err_code; +} + diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_conn.h b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_conn.h new file mode 100644 index 0000000..8fbe6e0 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_conn.h @@ -0,0 +1,336 @@ +/* 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 BLE_GAP_EVT_CONN_H__ +#define BLE_GAP_EVT_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s120_codecs Connectivity s120 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gap_evt_conn GAP Connectivity event encoders + * @{ + * @ingroup ser_conn_s120_codecs + * + * @brief GAP Connectivity event encoders. + */ +#include "ble.h" + +/** + * @brief Encodes ble_gap_evt_auth_key_request event. + * + * @sa @ref nrf51_evt_auth_key_request_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_auth_key_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_auth_status event. + * + * @sa @ref nrf51_evt_auth_status_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_auth_status_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_conn_param_update event. + * + * @sa @ref nrf51_evt_conn_param_update_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_conn_param_update_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_conn_sec_update event. + * + * @sa @ref nrf51_evt_conn_sec_update_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_conn_sec_update_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_connected event. + * + * @sa @ref nrf51_evt_connected_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_connected_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_disconnected event. + * + * @sa @ref nrf51_evt_disconnected_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_disconnected_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_passkey_display event. + * + * @sa @ref nrf51_evt_passkey_display for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_passkey_display_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_rssi_changed event. + * + * @sa @ref nrf51_evt_rssi_changed_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_rssi_changed_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_sec_info_request event. + * + * @sa @ref nrf51_evt_sec_info_request_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_sec_info_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_sec_params_request event. + * + * @sa @ref nrf51_evt_sec_param_request_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_sec_params_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_timeout event. + * + * @sa @ref nrf51_evt_timeout_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_timeout_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_sec_request event. + * + * @sa @ref nrf51_evt_sec_request_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_sec_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_conn_param_update_request event. + * + * @sa @ref nrf51_evt_conn_param_update_request_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_conn_param_update_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_adv_report event. + * + * @sa @ref nrf51_evt_adv_report_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_adv_report_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_scan_req_report event. + * + * @sa @ref nrf51_evt_scan_req_report_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_scan_req_report_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** @} */ +#endif diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_conn_param_update.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_conn_param_update.c new file mode 100644 index 0000000..a9565dc --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_conn_param_update.c @@ -0,0 +1,49 @@ +/* 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 "ble.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" +#include "ble_gap_evt_conn.h" + + +uint32_t ble_gap_evt_conn_param_update_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + SER_ASSERT(p_event->header.evt_id == BLE_GAP_EVT_CONN_PARAM_UPDATE, NRF_ERROR_INVALID_PARAM); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&p_event->header.evt_id, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_conn_param_update_t_enc(&p_event->evt.gap_evt.params.conn_param_update, + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_conn_param_update_request.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_conn_param_update_request.c new file mode 100644 index 0000000..5843ff3 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_conn_param_update_request.c @@ -0,0 +1,49 @@ +/* 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 "ble.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" +#include "ble_gap_evt_conn.h" + + +uint32_t ble_gap_evt_conn_param_update_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + SER_ASSERT(p_event->header.evt_id == BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST, NRF_ERROR_INVALID_PARAM); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&p_event->header.evt_id, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_conn_param_update_request_t_enc(&p_event->evt.gap_evt.params.conn_param_update_request, + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_conn_sec_update.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_conn_sec_update.c new file mode 100644 index 0000000..8293866 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_conn_sec_update.c @@ -0,0 +1,51 @@ +/* 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 "ble.h" +#include "ble_gap_evt_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_conn_sec_update_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + const uint16_t evt_header = BLE_GAP_EVT_CONN_SEC_UPDATE; + + err_code = uint16_t_enc((void *)&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_conn_sec_update_t_enc( + (void *)&p_event->evt.gap_evt.params.conn_sec_update, + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_connected.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_connected.c new file mode 100644 index 0000000..16cea4f --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_connected.c @@ -0,0 +1,49 @@ +/* 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 "ble.h" +#include "ble_gap_evt_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_evt_connected_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + uint16_t evt_header = BLE_GAP_EVT_CONNECTED; + + err_code = uint16_t_enc((void *)&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_connected_t_enc((void *)&p_event->evt.gap_evt.params.connected, + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_disconnected.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_disconnected.c new file mode 100644 index 0000000..a067462 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_disconnected.c @@ -0,0 +1,49 @@ +/* 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 +#include "ble_serialization.h" +#include "app_util.h" +#include "ble.h" +#include "ble_gap_struct_serialization.h" +#include "ble_gap_evt_conn.h" + +uint32_t ble_gap_evt_disconnected_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code; + uint16_t evt_header = BLE_GAP_EVT_DISCONNECTED; + + err_code = uint16_t_enc(&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&(p_event->evt.gap_evt.conn_handle), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_disconnected_t_enc((void *)&(p_event->evt.gap_evt.params.disconnected), + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_passkey_display.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_passkey_display.c new file mode 100644 index 0000000..1fcaab5 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_passkey_display.c @@ -0,0 +1,43 @@ +/* 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 +#include "ble_serialization.h" +#include "app_util.h" +#include "ble.h" +#include "ble_gap_evt_conn.h" + +#define PASSKEY_LEN sizeof (p_event->evt.gap_evt.params.passkey_display.passkey) + + +uint32_t ble_gap_evt_passkey_display_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 2 + PASSKEY_LEN, *p_buf_len); + index += uint16_encode(BLE_GAP_EVT_PASSKEY_DISPLAY, &(p_buf[index])); + index += uint16_encode(p_event->evt.gap_evt.conn_handle, &(p_buf[index])); + + memcpy(&p_buf[index], p_event->evt.gap_evt.params.passkey_display.passkey, PASSKEY_LEN); + index += PASSKEY_LEN; + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_rssi_changed.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_rssi_changed.c new file mode 100644 index 0000000..6ee6a94 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_rssi_changed.c @@ -0,0 +1,38 @@ +/* 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 "ble.h" +#include "ble_serialization.h" +#include "app_util.h" +#include "ble_gap_evt_conn.h" + + +uint32_t ble_gap_evt_rssi_changed_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 2 + 1, *p_buf_len); + index += uint16_encode(BLE_GAP_EVT_RSSI_CHANGED, &(p_buf[index])); + index += uint16_encode(p_event->evt.gap_evt.conn_handle, &(p_buf[index])); + p_buf[index++] = p_event->evt.gap_evt.params.rssi_changed.rssi; + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_scan_req_report.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_scan_req_report.c new file mode 100644 index 0000000..9707495 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_scan_req_report.c @@ -0,0 +1,49 @@ +/* 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 "ble.h" +#include "ble_gap_evt_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" + + +uint32_t ble_gap_evt_scan_req_report_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + const uint16_t evt_header = BLE_GAP_EVT_SCAN_REQ_REPORT; + + err_code = uint16_t_enc((void *)&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_addr_enc((void *)&(p_event->evt.gap_evt.params.scan_req_report.peer_addr), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc((void *)&(p_event->evt.gap_evt.params.scan_req_report.rssi), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_sec_info_request.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_sec_info_request.c new file mode 100644 index 0000000..e3b7949 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_sec_info_request.c @@ -0,0 +1,51 @@ +/* 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 "ble.h" +#include "ble_gap_evt_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_sec_info_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + const uint16_t evt_header = BLE_GAP_EVT_SEC_INFO_REQUEST; + + err_code = uint16_t_enc((void *)&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_sec_info_request_t_enc( + (void *)&p_event->evt.gap_evt.params.sec_info_request, + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_sec_params_request.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_sec_params_request.c new file mode 100644 index 0000000..f2fdf59 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_sec_params_request.c @@ -0,0 +1,51 @@ +/* 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 "ble.h" +#include "ble_gap_evt_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_sec_params_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + const uint16_t evt_header = BLE_GAP_EVT_SEC_PARAMS_REQUEST; + + err_code = uint16_t_enc((void *)&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_sec_params_request_t_enc( + (void *)&p_event->evt.gap_evt.params.sec_params_request, + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_sec_request.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_sec_request.c new file mode 100644 index 0000000..6a744b0 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_sec_request.c @@ -0,0 +1,49 @@ +/* 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 +#include "ble.h" +#include "ble_gap_evt_conn.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_evt_sec_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + uint16_t evt_header = BLE_GAP_EVT_SEC_REQUEST; + + err_code = uint16_t_enc((void *)&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_sec_request_t_enc((void *)&p_event->evt.gap_evt.params.sec_request, + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_timeout.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_timeout.c new file mode 100644 index 0000000..7894cdc --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_evt_timeout.c @@ -0,0 +1,38 @@ +/* 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 "ble.h" +#include "ble_serialization.h" +#include "app_util.h" +#include "ble_gap_evt_conn.h" + + +uint32_t ble_gap_evt_timeout_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_HEADER_SIZE + 3, *p_buf_len); + index += uint16_encode(BLE_GAP_EVT_TIMEOUT, &(p_buf[index])); + index += uint16_encode(p_event->evt.gap_evt.conn_handle, &(p_buf[index])); + p_buf[index++] = p_event->evt.gap_evt.params.timeout.src; + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_ppcp_get.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_ppcp_get.c new file mode 100644 index 0000000..38663fc --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_ppcp_get.c @@ -0,0 +1,80 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_ppcp_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + ble_gap_conn_params_t * * const pp_conn_params) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_conn_params); + SER_ASSERT_NOT_NULL(*pp_conn_params); + SER_ASSERT_LENGTH_LEQ(2, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_GAP_PPCP_GET, NRF_ERROR_INVALID_PARAM); + index++; + + if (p_buf[index++] == SER_FIELD_NOT_PRESENT) + { + *pp_conn_params = NULL; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_ppcp_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gap_conn_params_t const * const p_conn_params) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_PPCP_GET, return_code, + p_buf, p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_conn_params); + uint32_t index = *p_buf_len; + + SER_ASSERT_LENGTH_LEQ(index + 8, total_len); + + index += uint16_encode(p_conn_params->min_conn_interval, &p_buf[index]); + index += uint16_encode(p_conn_params->max_conn_interval, &p_buf[index]); + index += uint16_encode(p_conn_params->slave_latency, &p_buf[index]); + index += uint16_encode(p_conn_params->conn_sup_timeout, &p_buf[index]); + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_ppcp_set.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_ppcp_set.c new file mode 100644 index 0000000..e09aaf2 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_ppcp_set.c @@ -0,0 +1,64 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "nordic_common.h" +#include "app_util.h" + + +uint32_t ble_gap_ppcp_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_conn_params_t * * const pp_conn_params) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_conn_params); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 1, packet_len); + SER_ASSERT(p_buf[index] == SD_BLE_GAP_PPCP_SET, NRF_ERROR_INVALID_PARAM); + + index++; + + switch (p_buf[index++]) + { + case SER_FIELD_NOT_PRESENT: + *pp_conn_params = NULL; + break; + + case SER_FIELD_PRESENT: + SER_ASSERT_LENGTH_LEQ(index + 8, packet_len); + SER_ASSERT_NOT_NULL(*pp_conn_params); + uint16_dec(p_buf, packet_len, &index, &(*pp_conn_params)->min_conn_interval); + uint16_dec(p_buf, packet_len, &index, &(*pp_conn_params)->max_conn_interval); + uint16_dec(p_buf, packet_len, &index, &(*pp_conn_params)->slave_latency); + uint16_dec(p_buf, packet_len, &index, &(*pp_conn_params)->conn_sup_timeout); + break; + + default: + return NRF_ERROR_INVALID_DATA; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_ppcp_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_PPCP_SET, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_rssi_get.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_rssi_get.c new file mode 100644 index 0000000..306caa2 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_rssi_get.c @@ -0,0 +1,77 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_rssi_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * p_conn_handle, + int8_t * * const pp_rssi) +{ + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_rssi); + SER_ASSERT_NOT_NULL(*pp_rssi); + SER_ASSERT_LENGTH_LEQ(3, packet_len); + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void **) pp_rssi, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + +uint32_t ble_gap_rssi_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + int8_t rssi) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_RSSI_GET, return_code, + p_buf, p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + uint32_t index = *p_buf_len; + + err_code = uint8_t_enc((uint8_t *) &rssi, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_rssi_start.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_rssi_start.c new file mode 100644 index 0000000..cd6f516 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_rssi_start.c @@ -0,0 +1,49 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" + +uint32_t ble_gap_rssi_start_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * p_conn_handle, + uint8_t * p_threshold_dbm, + uint8_t * p_skip_count) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_threshold_dbm); + SER_ASSERT_NOT_NULL(p_skip_count); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = SER_CMD_DATA_POS; + + err_code = uint16_t_dec(p_buf, buf_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, buf_len, &index, p_threshold_dbm); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, buf_len, &index, p_skip_count); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} + +uint32_t ble_gap_rssi_start_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_RSSI_START, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_rssi_stop.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_rssi_stop.c new file mode 100644 index 0000000..d068f3d --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_rssi_stop.c @@ -0,0 +1,39 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" + +uint32_t ble_gap_rssi_stop_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * p_conn_handle) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = SER_CMD_DATA_POS; + + err_code = uint16_t_dec(p_buf, buf_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return NRF_SUCCESS; +} + +uint32_t ble_gap_rssi_stop_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_RSSI_STOP, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_scan_start.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_scan_start.c new file mode 100644 index 0000000..b561d3c --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_scan_start.c @@ -0,0 +1,44 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_scan_start_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_scan_params_t * * const pp_scan_params) +{ + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_scan_params); + SER_ASSERT_NOT_NULL(*pp_scan_params); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_scan_params, ble_gap_scan_params_t_dec); + + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + +uint32_t ble_gap_scan_start_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_SCAN_START, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_scan_stop.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_scan_stop.c new file mode 100644 index 0000000..a390f17 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_scan_stop.c @@ -0,0 +1,23 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_scan_stop_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_SCAN_STOP, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_sec_info_reply.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_sec_info_reply.c new file mode 100644 index 0000000..3e85479 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_sec_info_reply.c @@ -0,0 +1,72 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" +#include "ble_gap_struct_serialization.h" +#include "cond_field_serialization.h" + +uint32_t ble_gap_sec_info_reply_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * p_conn_handle, + ble_gap_enc_info_t * * const pp_enc_info, + ble_gap_irk_t * * const pp_id_info, + ble_gap_sign_info_t * * const pp_sign_info) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_enc_info); + SER_ASSERT_NOT_NULL(pp_id_info); + SER_ASSERT_NOT_NULL(pp_sign_info); + SER_ASSERT_NOT_NULL(*pp_enc_info); + SER_ASSERT_NOT_NULL(*pp_id_info); + SER_ASSERT_NOT_NULL(*pp_sign_info); + + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(2, packet_len - index); + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + err_code = cond_field_dec(p_buf, + packet_len, + &index, + (void * *)pp_enc_info, + ble_gap_enc_info_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + packet_len, + &index, + (void * *)pp_id_info, + ble_gap_irk_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + packet_len, + &index, + (void * *)pp_sign_info, + ble_gap_sign_info_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + return err_code; +} + +uint32_t ble_gap_sec_info_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_SEC_INFO_REPLY, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_sec_params_reply.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_sec_params_reply.c new file mode 100644 index 0000000..0c295be --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_sec_params_reply.c @@ -0,0 +1,90 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_sec_params_reply_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * p_conn_handle, + uint8_t * p_sec_status, + ble_gap_sec_params_t * * const pp_sec_params, + ble_gap_sec_keyset_t * * const pp_sec_keyset) +{ + uint32_t index = SER_CMD_HEADER_SIZE; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_sec_status); + SER_ASSERT_NOT_NULL(pp_sec_params); + SER_ASSERT_NOT_NULL(*pp_sec_params); + SER_ASSERT_NOT_NULL(pp_sec_keyset); + SER_ASSERT_NOT_NULL(*pp_sec_keyset); + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, packet_len, &index, p_sec_status); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *) pp_sec_params, ble_gap_sec_params_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *) pp_sec_keyset, ble_gap_sec_keyset_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + +//opcode: 0x7F +uint32_t ble_gap_sec_params_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gap_sec_keyset_t * const p_sec_keyset) +{ + uint32_t index = 0; + uint32_t buf_len = * p_buf_len; + uint32_t err_code = NRF_SUCCESS; + + err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_SEC_PARAMS_REPLY, + return_code, + p_buf, + p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_sec_keyset); + index = *p_buf_len; + + err_code = cond_field_enc(p_sec_keyset, p_buf, buf_len, &index, ble_gap_sec_keyset_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gap_tx_power_set.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_tx_power_set.c new file mode 100644 index 0000000..6af4f31 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gap_tx_power_set.c @@ -0,0 +1,39 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" + +uint32_t ble_gap_tx_power_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + int8_t * p_tx_power) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_tx_power); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = SER_CMD_DATA_POS; + + err_code = uint8_t_dec(p_buf, packet_len, &index, p_tx_power); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + +uint32_t ble_gap_tx_power_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_TX_POWER_SET, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_char_value_by_uuid_read.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_char_value_by_uuid_read.c new file mode 100644 index 0000000..6fbc19d --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_char_value_by_uuid_read.c @@ -0,0 +1,65 @@ +/* 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 "ble_gattc_conn.h" +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "ble_gattc_struct_serialization.h" +#include "cond_field_serialization.h" +#include "ble_types.h" +#include + +uint32_t ble_gattc_char_value_by_uuid_read_req_dec( + uint8_t const * const p_buf, + uint16_t buf_len, + uint16_t * const p_conn_handle, + ble_uuid_t * * const pp_uuid, + ble_gattc_handle_range_t * * const + pp_handle_range) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_uuid); + SER_ASSERT_NOT_NULL(*pp_uuid); + SER_ASSERT_NOT_NULL(pp_handle_range); + SER_ASSERT_NOT_NULL(*pp_handle_range); + + uint32_t index = 0; + uint32_t err_code; + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 2, buf_len); + SER_ASSERT(p_buf[index] == SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, NRF_ERROR_INVALID_DATA); + index++; + + uint16_dec(p_buf, buf_len, &index, p_conn_handle); + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_uuid, ble_uuid_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_handle_range, + ble_gattc_handle_range_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} + + +uint32_t ble_gattc_char_value_by_uuid_read_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, return_code, + p_buf, p_buf_len); +} + diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_char_values_read.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_char_values_read.c new file mode 100644 index 0000000..39c6808 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_char_values_read.c @@ -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. + * + */ + +#include + +#include "ble_gatts_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gattc_char_values_read_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * * const pp_handles, + uint16_t * const p_handle_count) +{ + SER_ASSERT_NOT_NULL(p_buf); //check if *p_buf is allocated + SER_ASSERT_NOT_NULL(p_conn_handle); //check if *p_conn_handle exist + SER_ASSERT_NOT_NULL(pp_handles); //check if *p_handles exist + SER_ASSERT_NOT_NULL(*pp_handles); //check if p_handles exist + SER_ASSERT_NOT_NULL(p_handle_count); //check if *p_handle_count exist + + uint32_t index = SER_CMD_DATA_POS; + uint32_t status_code; + + SER_ASSERT_LENGTH_LEQ(5, packet_len - index); //make sure that payload length is at least 5 bytes + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + //decode handle table count with optional handle table + status_code = count16_cond_data16_dec(p_buf, packet_len, &index, pp_handles, p_handle_count); + SER_ASSERT(status_code == NRF_SUCCESS, status_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return status_code; +} + + +uint32_t ble_gattc_char_values_read_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + return op_status_enc(SD_BLE_GATTC_CHAR_VALUES_READ, return_code, p_buf, p_buf_len, &index); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_characteristics_discover.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_characteristics_discover.c new file mode 100644 index 0000000..e17edb2 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_characteristics_discover.c @@ -0,0 +1,63 @@ +/* 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 "ble_gattc_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_characteristics_discover_req_dec( + uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gattc_handle_range_t * * const pp_handle_range) +{ + uint32_t index = SER_CMD_DATA_POS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_handle_range); + SER_ASSERT_NOT_NULL(*pp_handle_range); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 2 + 1, packet_len); + + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + switch (p_buf[index++]) + { + case SER_FIELD_NOT_PRESENT: + *pp_handle_range = NULL; + break; + + case SER_FIELD_PRESENT: + SER_ASSERT_LENGTH_LEQ(index + 2 + 2, packet_len); + uint16_dec(p_buf, packet_len, &index, &(*pp_handle_range)->start_handle); + uint16_dec(p_buf, packet_len, &index, &(*pp_handle_range)->end_handle); + break; + + default: + return NRF_ERROR_INVALID_DATA; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_characteristics_discover_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTC_CHARACTERISTICS_DISCOVER, + return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_conn.h b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_conn.h new file mode 100644 index 0000000..1a3794f --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_conn.h @@ -0,0 +1,398 @@ +/* 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. + * + */ +#ifndef BLE_GATTC_CONN_H__ +#define BLE_GATTC_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s120_codecs Connectivity s120 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gatc_conn GATTC Connectivity command request decoders and command response encoders + * @{ + * @ingroup ser_conn_s120_codecs + * + * @brief GATTC Connectivity command request decoders and command response encoders + */ +#include "ble_gattc.h" +#include "ble.h" + +/**@brief Decodes @ref sd_ble_gattc_characteristics_discover command request. + * + * @sa @ref nrf51_sd_ble_gattc_characteristics_discover_encoding for packet format, + * @ref ble_gattc_characteristics_discover_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] pp_handle_range Pointer to pointer to handle range. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for handle range field present. + */ +uint32_t ble_gattc_characteristics_discover_req_dec + (uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gattc_handle_range_t * * const pp_handle_range); + +/**@brief Encodes @ref sd_ble_gattc_characteristics_discover command response. + * + * @sa @ref nrf51_sd_ble_gattc_characteristics_discover_encoding for packet format. + * @ref ble_gattc_characteristics_discover_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_characteristics_discover_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gattc_descriptors_discover command request. + * + * @sa @ref nrf51_sd_ble_gattc_descriptors_discover_encoding for packet format, + * @ref ble_gattc_descriptors_discover_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] pp_handle_range Pointer to pointer to handle range. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for handle range field present. + */ +uint32_t ble_gattc_descriptors_discover_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gattc_handle_range_t * * const pp_handle_range); + +/**@brief Encodes @ref sd_ble_gattc_descriptors_discover command response. + * + * @sa @ref nrf51_sd_ble_gattc_descriptors_discover_encoding for packet format. + * @ref ble_gattc_descriptors_discover_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_descriptors_discover_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gattc_relationships_discover command request. + * + * @sa @ref nrf51_sd_ble_gattc_relationships_discover_encoding for packet format, + * @ref ble_gattc_relationships_discover_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] pp_handle_range Pointer to pointer to handle range. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for handle range field present. + */ +uint32_t ble_gattc_relationships_discover_req_dec + (uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gattc_handle_range_t * * const pp_handle_range); + +/**@brief Encodes @ref sd_ble_gattc_relationships_discover command response. + * + * @sa @ref nrf51_sd_ble_gattc_relationships_discover_encoding for packet format. + * @ref ble_gattc_relationships_discover_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_relationships_discover_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gattc_primary_services_discover command request. + * + * @sa @ref nrf51_sd_ble_gattc_primary_services_discover_encoding for packet format, + * @ref ble_gattc_primary_services_discover_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] p_start_handle Pointer to start handle. + * @param[out] pp_srvc_uuid Pointer to pointer to service uuid. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for uuid field present. + */ +uint32_t ble_gattc_primary_services_discover_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * const p_start_handle, + ble_uuid_t * * const pp_srvc_uuid); + +/**@brief Encodes @ref sd_ble_gattc_primary_services_discover command response. + * + * @sa @ref nrf51_sd_ble_gattc_primary_services_discover_encoding for packet format. + * @ref ble_gattc_primary_services_discover_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_primary_services_discover_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gattc_read command request. + * + * @sa @ref nrf51_sd_ble_gattc_read_encoding for packet format, + * @ref ble_gattc_read_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] p_handle Pointer to handle. + * @param[out] p_offset Pointer to offset. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_read_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * const p_handle, + uint16_t * const p_offset); + +/**@brief Encodes @ref sd_ble_gattc_read command response. + * + * @sa @ref nrf51_sd_ble_gattc_read_encoding for packet format. + * @ref ble_gattc_read_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_read_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gattc_char_values_read command request. + * + * @sa @ref nrf51_sd_ble_gattc_char_values_read for packet format, + * @ref ble_gattc_char_values_read_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] pp_handles Pointer to pointer to handle table. + * @param[out] p_handle_count Pointer to handle handle table count. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ + +uint32_t ble_gattc_char_values_read_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * * const pp_handles, + uint16_t * const p_handle_count); + +/**@brief Encodes @ref sd_ble_gattc_char_values_read command response. + * + * @sa @ref nrf51_sd_ble_gattc_char_values_read for packet format. + * @ref ble_gattc_char_values_read_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_char_values_read_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gattc_write command request. + * + * @sa @ref nrf51_sd_ble_gattc_write_encoding for packet format, + * @ref ble_gattc_write_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] pp_write_params Pointer to pointer to write parameters. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_write_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gattc_write_params_t * * const pp_write_params); + +/**@brief Encodes @ref sd_ble_gattc_write command response. + * + * @sa @ref nrf51_sd_ble_gattc_write_encoding for packet format. + * @ref ble_gattc_write_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_write_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gattc_hv_confirm command request. + * + * @sa @ref nrf51_sd_ble_gattc_hv_confirm for packet format, + * @ref ble_gattc_hv_confirm_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] p_handle Pointer to handle of the attribute in the indication. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_hv_confirm_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * const p_handle); + +/**@brief Encodes @ref sd_ble_gattc_hv_confirm command response. + * + * @sa @ref nrf51_sd_ble_gattc_hv_confirm for packet format. + * @ref ble_gattc_hv_confirm_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_hv_confirm_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gattc_char_value_by_uuid_read command request. + * + * @sa @ref nrf51_sd_ble_gattc_char_value_by_uuid_read_encoding for packet format, + * @ref ble_gattc_char_value_by_uuid_read_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of request packet. + * @param[out] p_conn_handle Pointer to connection handle of the connection. + * @param[out] pp_uuid Pointer to pointer to a characteristic value UUID to read. + * @param[out] pp_handle_range Pointer to pointer to the range of handles to perform this + * procedure on. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid operation type. + */ +uint32_t ble_gattc_char_value_by_uuid_read_req_dec + (uint8_t const * const p_buf, + uint16_t buf_len, + uint16_t * const p_conn_handle, + ble_uuid_t * * const pp_uuid, + ble_gattc_handle_range_t * * const pp_handle_range); + +/**@brief Encodes @ref sd_ble_gattc_char_value_by_uuid_read command response. + * + * @sa @ref nrf51_sd_ble_gattc_char_value_by_uuid_read_encoding for packet format. + * @ref ble_gattc_char_value_by_uuid_read_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_char_value_by_uuid_read_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** @} */ +#endif + diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_descriptors_discover.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_descriptors_discover.c new file mode 100644 index 0000000..f78e675 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_descriptors_discover.c @@ -0,0 +1,62 @@ +/* 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 "ble_gattc_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_descriptors_discover_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gattc_handle_range_t * * const pp_handle_range) +{ + uint32_t index = SER_CMD_DATA_POS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_handle_range); + SER_ASSERT_NOT_NULL(*pp_handle_range); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 2 + 1, packet_len); + + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + switch (p_buf[index++]) + { + case SER_FIELD_NOT_PRESENT: + *pp_handle_range = NULL; + break; + + case SER_FIELD_PRESENT: + SER_ASSERT_LENGTH_LEQ(index + 2 + 2, packet_len); + uint16_dec(p_buf, packet_len, &index, &(*pp_handle_range)->start_handle); + uint16_dec(p_buf, packet_len, &index, &(*pp_handle_range)->end_handle); + break; + + default: + return NRF_ERROR_INVALID_DATA; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_descriptors_discover_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTC_DESCRIPTORS_DISCOVER, + return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_char_disc_rsp.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_char_disc_rsp.c new file mode 100644 index 0000000..5799434 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_char_disc_rsp.c @@ -0,0 +1,73 @@ +/* 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 "ble_gattc_evt_conn.h" +#include "ble_serialization.h" +#include "ble_gatts.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_char_disc_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 8, *p_buf_len); + index += uint16_encode(BLE_GATTC_EVT_CHAR_DISC_RSP, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.conn_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.gatt_status, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.error_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.char_disc_rsp.count, &(p_buf[index])); + + uint16_t service_count = p_event->evt.gattc_evt.params.char_disc_rsp.count; + + SER_ASSERT_LENGTH_LEQ(index + (service_count * 9), *p_buf_len); + + for (uint16_t i = 0; i < service_count; i++) + { + index += uint16_encode(p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].uuid.uuid, + &(p_buf[index])); + p_buf[index++] = p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].uuid.type; + p_buf[index++] = (0x00 | + (p_event->evt.gattc_evt.params.char_disc_rsp.chars[i]. + char_props.broadcast << 0) | + (p_event->evt.gattc_evt.params.char_disc_rsp.chars[i]. + char_props.read << 1) | + (p_event->evt.gattc_evt.params.char_disc_rsp.chars[i]. + char_props.write_wo_resp << 2) | + (p_event->evt.gattc_evt.params.char_disc_rsp.chars[i]. + char_props.write << 3) | + (p_event->evt.gattc_evt.params.char_disc_rsp.chars[i]. + char_props.notify << 4) | + (p_event->evt.gattc_evt.params.char_disc_rsp.chars[i]. + char_props.indicate << 5) | + (p_event->evt.gattc_evt.params.char_disc_rsp.chars[i]. + char_props.auth_signed_wr << 6)); + p_buf[index++] = (p_event->evt.gattc_evt.params.char_disc_rsp.chars[i]. + char_ext_props & 0x01); + + index += uint16_encode(p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].handle_decl, + &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].handle_value, + &(p_buf[index])); + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c new file mode 100644 index 0000000..4326380 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c @@ -0,0 +1,52 @@ +/* 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_util.h" +#include "ble.h" +#include "ble_serialization.h" +#include "ble_gattc_struct_serialization.h" +#include "ble_gattc_evt_conn.h" + + +uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code; + + err_code = uint16_t_enc(&p_event->header.evt_id, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_event->evt.gattc_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_event->evt.gattc_evt.gatt_status, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_event->evt.gattc_evt.error_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gattc_evt_char_val_by_uuid_read_rsp_t_enc( + &p_event->evt.gattc_evt.params.char_val_by_uuid_read_rsp, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_char_vals_read_rsp.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_char_vals_read_rsp.c new file mode 100644 index 0000000..fa7fc41 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_char_vals_read_rsp.c @@ -0,0 +1,59 @@ +/* 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 "ble_gattc_evt_conn.h" +#include "ble_gattc_struct_serialization.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_char_vals_read_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint16_t evt_header = BLE_GATTC_EVT_CHAR_VALS_READ_RSP; + + //Event Header + err_code = uint16_t_enc(&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + //GATTC Header + err_code = uint16_t_enc(&(p_event->evt.gattc_evt.conn_handle), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_event->evt.gattc_evt.gatt_status), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_event->evt.gattc_evt.error_handle), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + //Event structure for BLE_GATTC_EVT_CHAR_VALS_READ_RSP + err_code = + ble_gattc_evt_char_vals_read_rsp_t_enc(&(p_event->evt.gattc_evt.params.char_vals_read_rsp), + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_conn.h b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_conn.h new file mode 100644 index 0000000..12805cd --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_conn.h @@ -0,0 +1,236 @@ +/* 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 BLE_GATTC_EVT_CONN_H__ +#define BLE_GATTC_EVT_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s120_codecs Connectivity s120 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gattc_evt_conn GATTC Connectivity event encoders + * @{ + * @ingroup ser_conn_s120_codecs + * + * @brief GATTC Connectivity event encoders. + */ +#include "ble.h" + +/** + * @brief Encodes ble_gattc_evt_char_disc_rsp event. + * + * @sa @ref nrf51_gattc_evt_char_disc_rsp_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_char_disc_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gattc_evt_char_val_by_uuid_read_rsp event. + * + * @sa @ref nrf51_gattc_evt_char_val_by_uuid_read_rsp_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gattc_evt_char_vals_read_rsp event. + * + * @sa @ref nrf51_gattc_evt_char_vals_read_rsp_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_char_vals_read_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gattc_evt_desc_disc_rsp event. + * + * @sa @ref nrf51_gattc_evt_desc_disc_rsp_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_desc_disc_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gattc_evt_hvx event. + * + * @sa @ref nrf51_gattc_evt_hvx_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_hvx_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gattc_evt_prim_srvc_disc_rsp event. + * + * @sa @ref nrf51_gattc_evt_prim_srvc_disc_rsp_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_prim_srvc_disc_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gattc_evt_read_rsp event. + * + * @sa @ref nrf51_gattc_evt_read_rsp_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_read_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gattc_evt_rel_disc_rsp event. + * + * @sa @ref nrf51_gattc_evt_rel_disc_rsp_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_rel_disc_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gattc_evt_timeout event. + * + * @sa @ref nrf51_gattc_evt_timeout_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_timeout_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gattc_evt_write_rsp event. + * + * @sa @ref nrf51_gattc_evt_write_rsp_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_write_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** @} */ +#endif diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_desc_disc_rsp.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_desc_disc_rsp.c new file mode 100644 index 0000000..378e77b --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_desc_disc_rsp.c @@ -0,0 +1,53 @@ +/* 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 "ble_gattc_evt_conn.h" +#include "ble_serialization.h" +#include "ble_gatts.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_desc_disc_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 8, *p_buf_len); + index += uint16_encode(BLE_GATTC_EVT_DESC_DISC_RSP, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.conn_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.gatt_status, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.error_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.desc_disc_rsp.count, &(p_buf[index])); + + uint16_t service_count = p_event->evt.gattc_evt.params.desc_disc_rsp.count; + + SER_ASSERT_LENGTH_LEQ(index + (service_count * 5), *p_buf_len); + + for (uint16_t i = 0; i < service_count; i++) + { + index += uint16_encode(p_event->evt.gattc_evt.params.desc_disc_rsp.descs[i].handle, + &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.desc_disc_rsp.descs[i].uuid.uuid, + &(p_buf[index])); + p_buf[index++] = p_event->evt.gattc_evt.params.desc_disc_rsp.descs[i].uuid.type; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_hvx.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_hvx.c new file mode 100644 index 0000000..8e3a49e --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_hvx.c @@ -0,0 +1,52 @@ +/* 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 "ble_gattc_evt_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_hvx_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 11, *p_buf_len); + index += uint16_encode(BLE_GATTC_EVT_HVX, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.conn_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.gatt_status, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.error_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.hvx.handle, &(p_buf[index])); + p_buf[index++] = p_event->evt.gattc_evt.params.hvx.type; + index += uint16_encode(p_event->evt.gattc_evt.params.hvx.len, &(p_buf[index])); + + SER_ASSERT_LENGTH_LEQ(index + p_event->evt.gattc_evt.params.hvx.len, *p_buf_len); + + if (p_event->evt.gattc_evt.params.hvx.len > 0) + { + memcpy(&(p_buf[index]), + &(p_event->evt.gattc_evt.params.hvx.data[0]), + p_event->evt.gattc_evt.params.hvx.len); + index += p_event->evt.gattc_evt.params.hvx.len; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c new file mode 100644 index 0000000..f70c538 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c @@ -0,0 +1,62 @@ +/* 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 "ble_gattc_evt_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_prim_srvc_disc_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 8, *p_buf_len); + index += uint16_encode(BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.conn_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.gatt_status, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.error_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.count, &(p_buf[index])); + + uint16_t service_count = p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.count; + + SER_ASSERT_LENGTH_LEQ(index + (service_count * 7), *p_buf_len); + + for (uint16_t i = 0; i < service_count; i++) + { + index += uint16_encode( + p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].uuid.uuid, + &(p_buf[index])); + p_buf[index++] = p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].uuid.type; + index += + uint16_encode( + p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].handle_range. + start_handle, + &(p_buf[index])); + index += + uint16_encode( + p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].handle_range. + end_handle, + &(p_buf[index])); + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_read_rsp.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_read_rsp.c new file mode 100644 index 0000000..2d2b0f5 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_read_rsp.c @@ -0,0 +1,52 @@ +/* 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 "ble_gattc_evt_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_read_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 12, *p_buf_len); + index += uint16_encode(BLE_GATTC_EVT_READ_RSP, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.conn_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.gatt_status, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.error_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.read_rsp.handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.read_rsp.offset, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.read_rsp.len, &(p_buf[index])); + + SER_ASSERT_LENGTH_LEQ(index + p_event->evt.gattc_evt.params.read_rsp.len, *p_buf_len); + + if (p_event->evt.gattc_evt.params.read_rsp.len > 0) + { + memcpy(&(p_buf[index]), + &(p_event->evt.gattc_evt.params.read_rsp.data[0]), + p_event->evt.gattc_evt.params.read_rsp.len); + index += p_event->evt.gattc_evt.params.read_rsp.len; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_rel_disc_rsp.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_rel_disc_rsp.c new file mode 100644 index 0000000..fd83b62 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_rel_disc_rsp.c @@ -0,0 +1,51 @@ +/* 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 "ble_gattc_evt_conn.h" +#include "ble_serialization.h" +#include "ble_gattc_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_rel_disc_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t error_code = NRF_SUCCESS; + uint16_t evt_header = BLE_GATTC_EVT_REL_DISC_RSP; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + error_code = uint16_t_enc(&evt_header, p_buf, total_len, &index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint16_t_enc(&p_event->evt.gattc_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint16_t_enc(&p_event->evt.gattc_evt.gatt_status, p_buf, total_len, &index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint16_t_enc(&p_event->evt.gattc_evt.error_handle, p_buf, total_len, &index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_gattc_evt_rel_disc_rsp_t_enc(&p_event->evt.gattc_evt.params.rel_disc_rsp, + p_buf, + total_len, + &index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + *p_buf_len = index; + + return error_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_timeout.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_timeout.c new file mode 100644 index 0000000..ee1e08d --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_timeout.c @@ -0,0 +1,37 @@ +/* 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 "ble_gattc_evt_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_timeout_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 2 + 1, *p_buf_len); + index += uint16_encode(BLE_GATTC_EVT_TIMEOUT, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.conn_handle, &(p_buf[index])); + p_buf[index++] = p_event->evt.gattc_evt.params.timeout.src; + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_write_rsp.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_write_rsp.c new file mode 100644 index 0000000..7692b94 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_evt_write_rsp.c @@ -0,0 +1,53 @@ +/* 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 "ble_gattc_evt_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_write_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 13, *p_buf_len); + index += uint16_encode(BLE_GATTC_EVT_WRITE_RSP, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.conn_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.gatt_status, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.error_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.write_rsp.handle, &(p_buf[index])); + p_buf[index++] = p_event->evt.gattc_evt.params.write_rsp.write_op; + index += uint16_encode(p_event->evt.gattc_evt.params.write_rsp.offset, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.write_rsp.len, &(p_buf[index])); + + SER_ASSERT_LENGTH_LEQ(index + p_event->evt.gattc_evt.params.write_rsp.len, *p_buf_len); + + if (p_event->evt.gattc_evt.params.write_rsp.len > 0) + { + memcpy(&(p_buf[index]), + &(p_event->evt.gattc_evt.params.write_rsp.data[0]), + p_event->evt.gattc_evt.params.write_rsp.len); + index += p_event->evt.gattc_evt.params.write_rsp.len; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_hv_confirm.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_hv_confirm.c new file mode 100644 index 0000000..6a1be3f --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_hv_confirm.c @@ -0,0 +1,45 @@ +/* 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 "ble_gattc_conn.h" +#include "ble_serialization.h" + +uint32_t ble_gattc_hv_confirm_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * const p_handle) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_handle); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = SER_CMD_DATA_POS; + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + +uint32_t ble_gattc_hv_confirm_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTC_HV_CONFIRM, + return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_primary_services_discover.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_primary_services_discover.c new file mode 100644 index 0000000..678e5e8 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_primary_services_discover.c @@ -0,0 +1,67 @@ +/* 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 "ble_gattc_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_primary_services_discover_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * const p_start_handle, + ble_uuid_t * * const pp_srvc_uuid) +{ + uint32_t index = SER_CMD_DATA_POS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_start_handle); + SER_ASSERT_NOT_NULL(pp_srvc_uuid); + SER_ASSERT_NOT_NULL(*pp_srvc_uuid); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 2 + 2 + 1, packet_len); + + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + uint16_dec(p_buf, packet_len, &index, p_start_handle); + + switch (p_buf[index++]) + { + case SER_FIELD_NOT_PRESENT: + *pp_srvc_uuid = NULL; + break; + + case SER_FIELD_PRESENT: + SER_ASSERT_LENGTH_LEQ(index + 2 + 1, packet_len); + uint16_dec(p_buf, packet_len, &index, &(*pp_srvc_uuid)->uuid); + uint8_dec(p_buf, packet_len, &index, &(*pp_srvc_uuid)->type); + break; + + default: + return NRF_ERROR_INVALID_DATA; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_primary_services_discover_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER, + return_code, + p_buf, + p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_read.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_read.c new file mode 100644 index 0000000..ca0af98 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_read.c @@ -0,0 +1,49 @@ +/* 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 "ble_gattc_conn.h" +#include "ble_serialization.h" + +uint32_t ble_gattc_read_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * const p_handle, + uint16_t * const p_offset) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_handle); + SER_ASSERT_NOT_NULL(p_offset); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = SER_CMD_DATA_POS; + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_offset); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + +uint32_t ble_gattc_read_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTC_READ, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_relationships_discover.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_relationships_discover.c new file mode 100644 index 0000000..7a61a3a --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_relationships_discover.c @@ -0,0 +1,64 @@ +/* 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 "ble_gattc_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_relationships_discover_req_dec( + uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gattc_handle_range_t * * const + pp_handle_range) +{ + uint32_t index = SER_CMD_DATA_POS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_handle_range); + SER_ASSERT_NOT_NULL(*pp_handle_range); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 2 + 1, packet_len); + + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + switch (p_buf[index++]) + { + case SER_FIELD_NOT_PRESENT: + *pp_handle_range = NULL; + break; + + case SER_FIELD_PRESENT: + SER_ASSERT_LENGTH_LEQ(index + 2 + 2, packet_len); + uint16_dec(p_buf, packet_len, &index, &(*pp_handle_range)->start_handle); + uint16_dec(p_buf, packet_len, &index, &(*pp_handle_range)->end_handle); + break; + + default: + return NRF_ERROR_INVALID_DATA; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_relationships_discover_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, + return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_write.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_write.c new file mode 100644 index 0000000..e889bce --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gattc_write.c @@ -0,0 +1,59 @@ +/* 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 "ble_gattc_conn.h" +#include "ble_serialization.h" +#include "ble_gattc_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" +#include + + +uint32_t ble_gattc_write_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gattc_write_params_t * * const pp_write_params) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_write_params); + SER_ASSERT_NOT_NULL(*pp_write_params); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = 0; + + uint8_t op_code; + err_code = uint8_t_dec(p_buf, packet_len, &index, &op_code); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + SER_ASSERT(op_code == SD_BLE_GATTC_WRITE, NRF_ERROR_INVALID_PARAM); + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + packet_len, + &index, + (void * *)pp_write_params, + ble_gattc_write_params_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + +uint32_t ble_gattc_write_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTC_WRITE, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_characteristic_add.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_characteristic_add.c new file mode 100644 index 0000000..1e1a9de --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_characteristic_add.c @@ -0,0 +1,88 @@ +/* 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 "ble_gatts_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + +uint32_t ble_gatts_characteristic_add_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * service_handle, + ble_gatts_char_md_t * * const pp_char_md, + ble_gatts_attr_t * * const pp_attr_char_value, + ble_gatts_char_handles_t * * const pp_handles) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(service_handle); + SER_ASSERT_NOT_NULL(pp_char_md); + SER_ASSERT_NOT_NULL(pp_attr_char_value); + SER_ASSERT_NOT_NULL(pp_handles); + SER_ASSERT_NOT_NULL(*pp_char_md); + SER_ASSERT_NOT_NULL(*pp_attr_char_value); + SER_ASSERT_NOT_NULL(*pp_handles); + + uint32_t index = SER_CMD_DATA_POS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len); + uint32_t err_code; + SER_ASSERT_LENGTH_LEQ(2, buf_len - index); + uint16_dec(p_buf, buf_len, &index, service_handle); + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_char_md, ble_gatts_char_md_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + buf_len, + &index, + (void * *)pp_attr_char_value, + ble_gatts_attr_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_handles, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT(index == buf_len, NRF_ERROR_INVALID_LENGTH); + + return err_code; +} + +uint32_t ble_gatts_characteristic_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gatts_char_handles_t const * const p_handles) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + SER_ASSERT_LENGTH_LEQ(1 + 4, total_len); + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTS_CHARACTERISTIC_ADD, + return_code, + p_buf, + p_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (return_code == NRF_SUCCESS) /* Add value and it's length. */ + { + err_code = cond_field_enc((void *)p_handles, + p_buf, + total_len, + p_buf_len, + ble_gatts_char_handles_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_conn.h b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_conn.h new file mode 100644 index 0000000..d2144a1 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_conn.h @@ -0,0 +1,514 @@ +/* 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. + * + */ +#ifndef BLE_GATTS_CONN_H__ +#define BLE_GATTS_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s120_codecs Connectivity s120 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gatts_conn GATTS Connectivity command request decoders and command response encoders + * @{ + * @ingroup ser_conn_s120_codecs + * + * @brief GATTS Connectivity command request decoders and command response encoders + */ + +#include "ble_gatts.h" +#include "ble.h" + +/**@brief Decodes @ref sd_ble_gatts_value_get command request. + * + * @sa @ref nrf51_gatts_value_get_encoding for packet format, + * @ref ble_gatts_value_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of request packet. + * @param[out] p_conn_handle Pointer to the connection_handle. + * @param[out] p_handle Pointer to the attribute_handle. + * @param[out] pp_value Pointer to pointer to the Attribute Value structure. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_value_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * const p_handle, + ble_gatts_value_t * * const pp_value); + +/**@brief Encodes @ref sd_ble_gatts_value_get command response. + * + * @sa @ref nrf51_gatts_value_get_sec_response for packet format. + * @ref ble_gatts_value_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_value Pointer to Attribute Value structure. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_value_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gatts_value_t * const p_value); + +/**@brief Decodes @ref sd_ble_gatts_characteristic_add command request. + * + * @sa @ref nrf51_characteristics_add_encoding for packet format, + * @ref ble_gatts_characteristic_add_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of request packet. + * @param[out] p_service_handle Pointer to the service_handle. + * @param[out] constpp_char_md Pointer to pointer to the location where Characteristic metadata + * will be decoded. + * @param[out] pp_attr_char_value Pointer to pointer to the location where GATT Attribute will be + * decoded. + * @param[out] pp_handles Pointer to pointer to the location where Characteristic definition + * handles will be decoded. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_characteristic_add_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * p_service_handle, + ble_gatts_char_md_t * * constpp_char_md, + ble_gatts_attr_t * * const pp_attr_char_value, + ble_gatts_char_handles_t * * const pp_handles); + +/**@brief Encodes @ref ble_gatts_sys_attr_get_rsp_enc command response. + * + * @sa @ref sd_ble_gatts_sys_attr_get for packet format. + * @ref ble_gatts_sys_attr_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_handles Pointer to handle struct to be encoded. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_characteristic_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gatts_char_handles_t const * const p_handles); + +/**@brief Decodes @ref sd_ble_gatts_include_add command request. + * + * @sa @ref nrf51_gatts_include_add_encoding for packet format, + * @ref ble_gatts_include_add_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of request packet. + * @param[out] p_service_handle Pointer to the service_handle. + * @param[out] p_inc_srvc_handle Pointer to the handle of the included service. + * @param[out] pp_include_handle Pointer to Pointer to 16-bit word where the assigned handle will be stored. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ + +uint32_t ble_gatts_include_add_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_service_handle, + uint16_t * const p_inc_srvc_handle, + uint16_t * * const pp_include_handle); + +/**@brief Encodes @ref ble_gatts_include_add_rsp_enc command response. + * + * @sa @ref nrf51_gatts_include_add_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_include_handle Pointer to a 16-bit word where the assigned handle was stored. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ + +uint32_t ble_gatts_include_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t const * const p_include_handle); + +/**@brief Decodes @ref sd_ble_gatts_service_add command request. + * + * @sa @ref nrf51_gatts_service_add_encoding for packet format, + * @ref ble_gatts_service_add_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of request packet. + * @param[out] p_type Pointer to the service type. + * @param[out] pp_uuid Pointer to pointer to service UUID. + * @param[out] pp_handle Pointer to Pointer to a 16-bit word where the assigned handle will be stored. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ + +uint32_t ble_gatts_service_add_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint8_t * const p_type, + ble_uuid_t * * const pp_uuid, + uint16_t * * const pp_handle); + +/**@brief Encodes @ref ble_gatts_service_add_rsp_enc command response. + * + * @sa @ref nrf51_gatts_service_add_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_handle Pointer to a 16-bit word where the assigned handle was stored. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ + +uint32_t ble_gatts_service_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t const * const p_handle); + +/**@brief Decodes @ref ble_gatts_sys_attr_get_req_dec command request. + * + * @sa @ref sd_ble_gatts_sys_attr_get for packet format, + * @ref ble_gatts_sys_attr_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connectiton handle. + * @param[out] pp_sys_attr_data Pointer to pointer to buffer where system attributes data will be filled in. + * @param[out] pp_sys_attr_data_len Pointer to pointer to variable which contains size of buffer for system attributes. + * @param[out] p_flags Pointer to additional optional flags. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gatts_sys_attr_get_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint8_t * * const pp_sys_attr_data, + uint16_t * * const pp_sys_attr_data_len, + uint32_t * const p_flags); + +/**@brief Encodes @ref ble_gatts_sys_attr_get_rsp_enc command response. + * + * @sa @ref sd_ble_gatts_sys_attr_get for packet format. + * @ref ble_gatts_sys_attr_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_sys_attr_data Pointer to buffer where system attributes data are storred. + * @param[in] p_sys_attr_data_len Pointer to variable which contains size of buffer for system attributes. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_sys_attr_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint8_t const * const p_sys_attr_data, + uint16_t const * const p_sys_attr_data_len); + +/**@brief Decodes @ref sd_ble_gatts_value_set command request. + * + * @sa @ref nrf51_gatts_value_set_encoding for packet format, + * @ref ble_gatts_value_set_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle + * @param[out] p_handle Pointer to attribute handle + * @param[out] pp_value Pointer to pointer to attribute value structure + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ + +uint32_t ble_gatts_value_set_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * p_conn_handle, + uint16_t * p_handle, + ble_gatts_value_t * * const pp_value); + +/**@brief Encodes @ref sd_ble_gatts_value_set command response. + * + * @sa @ref nrf51_gatts_value_set_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buff Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buff_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_value \c in: size of value returned when value was written with success + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_value_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buff, + uint32_t * const p_buff_len, + ble_gatts_value_t * p_value); + +/**@brief Decodes @ref sd_ble_gatts_sys_attr_set command request. + * + * @sa @ref nrf51_gatts_sys_attr_set_encoding for packet format, + * @ref ble_gatts_sys_attr_set_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of request packet. + * @param[out] p_conn_handle Pointer to the buffer raw data to be placed in advertisement packet. + * @param[out] pp_sys_attr_data Pointer to pointer to system attribute data. + * @param[out] p_sys_attr_data_len Pointer to data length for system attribute data. + * @param[out] p_flags Pointer to additional optional flags. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_sys_attr_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint8_t * * const pp_sys_attr_data, + uint16_t * const p_sys_attr_data_len, + uint32_t * const p_flags); + +/**@brief Encodes @ref sd_ble_gatts_sys_attr_set command response. + * + * @sa @ref nrf51_gatts_sys_attr_set_encoding for packet format. + * @ref ble_gatts_sys_attr_set_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_sys_attr_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref ble_gatts_hvx_req_dec command request. + * + * @sa @ref sd_ble_gatts_hvx for packet format, + * @ref ble_gatts_hvx_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of request packet. + * @param[out] p_conn_handle Pointer to the buffer raw data to be placed in advertisement packet. + * @param[out] pp_hvx_params Pointer to an HVx parameters structure. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_hvx_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + ble_gatts_hvx_params_t * * const pp_hvx_params); + +/**@brief Encodes @ref ble_gatts_hvx_rsp_enc command response. + * + * @sa @ref sd_ble_gatts_sys_attr_set for packet format. + * @ref ble_gatts_hvx_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_bytes_written Pointer to number of bytes written. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_hvx_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t const * const p_bytes_written); + +/**@brief Decodes @ref sd_ble_gatts_descriptor_add command request. + * + * @sa @ref sd_ble_gatts_descriptor_add for packet format, + * @ref ble_gatts_descriptor_add_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of request packet. + * @param[out] p_char_handle Pointer to buffer where characteristic handle will be. + returned. + * @param[out] pp_attr Pointer to pointer to an attribute structure. + * @param[out] pp_handle Pointer to pointer to descriptor handle. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_descriptor_add_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_char_handle, + ble_gatts_attr_t * * const pp_attr, + uint16_t * * const pp_handle); + +/**@brief Encodes @ref sd_ble_gatts_descriptor_add command response. + * + * @sa @ref sd_ble_gatts_sys_attr_set for packet format. + * @ref ble_gatts_descriptor_add_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] handle Descriptor handle value. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_descriptor_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t handle); + +/**@brief Decodes @ref sd_ble_gatts_rw_authorize_reply command request. + * + * @sa @ref nrf51_gatts_rw_authorize_reply_encoding for packet format, + * @ref ble_gatts_rw_authorize_reply_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] pp_reply_params Pointer to pointer to \ref ble_gatts_rw_authorize_reply_params_t + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ + +uint32_t ble_gatts_rw_authorize_reply_req_dec( + uint8_t const * const p_buf, + uint32_t + packet_len, + uint16_t * + p_conn_handle, + ble_gatts_rw_authorize_reply_params_t * * const + pp_reply_params); + +/**@brief Encodes @ref sd_ble_gatts_rw_authorize_reply command response. + * + * @sa @ref nrf51_gatts_rw_authorize_reply_encoding for packet format. + * @ref ble_gatts_rw_authorize_reply_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_rw_authorize_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gatts_service_changed command request. + * + * @sa @ref nrf51_service_changed_encoding for packet format, + * @ref ble_gatts_service_changed_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] p_start_handle Pointer to start handle. + * @param[out] p_end_handle Pointer to end handle. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gatts_service_changed_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * p_conn_handle, + uint16_t * p_start_handle, + uint16_t * p_end_handle); + +/**@brief Encodes @ref sd_ble_gatts_service_changed command response. + * + * @sa @ref nrf51_service_changed_encoding for packet format. + * @ref ble_gatts_service_changed_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_service_changed_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** @} */ +#endif //BLE_GATTS_CONN_H__ + diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_descriptor_add.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_descriptor_add.c new file mode 100644 index 0000000..1929309 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_descriptor_add.c @@ -0,0 +1,94 @@ +/* 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 "ble_gatts_conn.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_gatts_descriptor_add_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_char_handle, + ble_gatts_attr_t * * const pp_attr, + uint16_t * * const pp_handle) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_char_handle); + SER_ASSERT_NOT_NULL(pp_attr); + SER_ASSERT_NOT_NULL(*pp_attr); + SER_ASSERT_NOT_NULL(pp_handle); + SER_ASSERT_NOT_NULL(*pp_handle); + + uint32_t index = 0; + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 2 + 1, packet_len); + SER_ASSERT(p_buf[index] == SD_BLE_GATTS_DESCRIPTOR_ADD, NRF_ERROR_INVALID_PARAM); + index++; + + uint16_dec(p_buf, packet_len, &index, p_char_handle); + + uint32_t err_code = cond_field_dec(p_buf, + packet_len, + &index, + (void * *)pp_attr, + ble_gatts_attr_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + packet_len, + &index, + (void * *)pp_handle, + NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + +uint32_t ble_gatts_descriptor_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t handle) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 4, total_len); + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTS_DESCRIPTOR_ADD, + return_code, + p_buf, + p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + uint32_t index = *p_buf_len; + + SER_ASSERT_LENGTH_LEQ(index + 2, total_len); + + err_code = uint16_t_enc(&handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_conn.h b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_conn.h new file mode 100644 index 0000000..42d0d3f --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_conn.h @@ -0,0 +1,156 @@ +/* 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 BLE_GATTS_EVT_CONN_H__ +#define BLE_GATTS_EVT_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s120_codecs Connectivity s120 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gatts_evt_conn GATTS Connectivity event encoders + * @{ + * @ingroup ser_conn_s120_codecs + * + * @brief GATTS Connectivity event encoders. + */ +#include "ble.h" + +/** + * @brief Encodes @ref BLE_GATTS_EVT_HVC event. + * + * @sa @ref nrf51_gatts_evt_hvc_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_evt_hvc_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes @ref BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST event. + * + * @sa @ref nrf51_evt_rw_authorize_request for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_evt_rw_authorize_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes @ref BLE_GATTS_EVT_SC_CONFIRM event. + * + * @sa @ref nrf51_gatts_evt_sc_confirm_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_evt_sc_confirm_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes @ref BLE_GATTS_EVT_SYS_ATTR_MISSING event. + * + * @sa @ref nrf51_evt_sys_attr_missing_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_evt_sys_attr_missing_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes @ref BLE_GATTS_EVT_TIMEOUT event. + * + * @sa @ref nrf51_gatts_evt_timeout_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_evt_timeout_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes @ref BLE_GATTS_EVT_WRITE event. + * + * @sa @ref nrf51_evt_write_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_evt_write_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** @} */ +#endif diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_hvc.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_hvc.c new file mode 100644 index 0000000..872e9a5 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_hvc.c @@ -0,0 +1,38 @@ +/* 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 "ble_gatts_evt_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_evt_hvc_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 2 + 2, *p_buf_len); + + index += uint16_encode(BLE_GATTS_EVT_HVC, &(p_buf[index])); + index += uint16_encode(p_event->evt.gatts_evt.conn_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gatts_evt.params.hvc.handle, &(p_buf[index])); + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_rw_authorize_request.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_rw_authorize_request.c new file mode 100644 index 0000000..4674938 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_rw_authorize_request.c @@ -0,0 +1,59 @@ +/* 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 "ble_gatts_evt_conn.h" +#include "ble_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "conn_ble_user_mem.h" +#include "app_util.h" + +extern ser_ble_user_mem_t m_conn_user_mem_table[]; + +uint32_t ble_gatts_evt_rw_authorize_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + SER_ASSERT_NOT_NULL(p_event); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&p_event->header.evt_id, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_event->evt.gatts_evt.conn_handle), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gatts_evt_rw_authorize_request_t_enc( + &(p_event->evt.gatts_evt.params.authorize_request), + p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if(p_event->evt.gatts_evt.params.authorize_request.type == BLE_GATTS_AUTHORIZE_TYPE_WRITE) + { + uint32_t conn_index; + + if(conn_ble_user_mem_context_find(p_event->evt.gatts_evt.conn_handle, &conn_index) != NRF_ERROR_NOT_FOUND) + { + err_code = len16data_enc(m_conn_user_mem_table[conn_index].mem_block.p_mem, m_conn_user_mem_table[conn_index].mem_block.len, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + } + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_sc_confirm.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_sc_confirm.c new file mode 100644 index 0000000..1bf1e0f --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_sc_confirm.c @@ -0,0 +1,37 @@ +/* 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 "ble_gatts_evt_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_evt_sc_confirm_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_HEADER_SIZE + 2, *p_buf_len); + + uint32_t index = 0; + index += uint16_encode(BLE_GATTS_EVT_SC_CONFIRM, &(p_buf[index])); + index += uint16_encode(p_event->evt.gatts_evt.conn_handle, &(p_buf[index])); + + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_sys_attr_missing.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_sys_attr_missing.c new file mode 100644 index 0000000..cb7c3e4 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_sys_attr_missing.c @@ -0,0 +1,37 @@ +/* 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 "ble_gatts_evt_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_evt_sys_attr_missing_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 2 + 1, *p_buf_len); + index += uint16_encode(BLE_GATTS_EVT_SYS_ATTR_MISSING, &(p_buf[index])); + index += uint16_encode(p_event->evt.gatts_evt.conn_handle, &(p_buf[index])); + p_buf[index++] = p_event->evt.gatts_evt.params.sys_attr_missing.hint; + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_timeout.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_timeout.c new file mode 100644 index 0000000..096ec5c --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_timeout.c @@ -0,0 +1,37 @@ +/* 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 "ble_gatts_evt_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_evt_timeout_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 2 + 1, *p_buf_len); + index += uint16_encode(BLE_GATTS_EVT_TIMEOUT, &(p_buf[index])); + index += uint16_encode(p_event->evt.gatts_evt.conn_handle, &(p_buf[index])); + p_buf[index++] = p_event->evt.gatts_evt.params.timeout.src; + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_write.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_write.c new file mode 100644 index 0000000..acc2a43 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_evt_write.c @@ -0,0 +1,63 @@ +/* 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 "ble_gatts_evt_conn.h" +#include "ble_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "conn_ble_user_mem.h" +#include "app_util.h" + +extern ser_ble_user_mem_t m_conn_user_mem_table[]; + +uint32_t ble_gatts_evt_write_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint16_t evt_header = BLE_GATTS_EVT_WRITE; + + err_code = uint16_t_enc(&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_event->evt.gatts_evt.conn_handle), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gatts_evt_write_t_enc(&(p_event->evt.gatts_evt.params.write), + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if((p_event->evt.gatts_evt.params.write.op == BLE_GATTS_OP_WRITE_REQ) || (p_event->evt.gatts_evt.params.write.op == BLE_GATTS_OP_EXEC_WRITE_REQ_NOW)) + { + uint32_t conn_index; + + if(conn_ble_user_mem_context_find(p_event->evt.gatts_evt.conn_handle, &conn_index) != NRF_ERROR_NOT_FOUND) + { + err_code = len16data_enc(m_conn_user_mem_table[conn_index].mem_block.p_mem, m_conn_user_mem_table[conn_index].mem_block.len, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + } + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_hvx.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_hvx.c new file mode 100644 index 0000000..67bd566 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_hvx.c @@ -0,0 +1,81 @@ +/* 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 "ble_gatts_conn.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_gatts_hvx_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + ble_gatts_hvx_params_t * * const pp_hvx_params) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_hvx_params); + SER_ASSERT_NOT_NULL(*pp_hvx_params); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 2 + 1, packet_len); + SER_ASSERT(p_buf[index] == SD_BLE_GATTS_HVX, NRF_ERROR_INVALID_PARAM); + index++; + + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + uint32_t err_code = cond_field_dec(p_buf, packet_len, + &index, + (void * *)pp_hvx_params, + ble_gatts_hvx_params_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + +uint32_t ble_gatts_hvx_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t const * const p_bytes_written) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTS_HVX, + return_code, + p_buf, + p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + uint32_t index = *p_buf_len; + + err_code = cond_field_enc(p_bytes_written, p_buf, total_len, &index, uint16_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_include_add.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_include_add.c new file mode 100644 index 0000000..766313f --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_include_add.c @@ -0,0 +1,74 @@ +/* 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 + +#include "ble_gatts_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gatts_include_add_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_service_handle, + uint16_t * const p_inc_srvc_handle, + uint16_t * * const pp_include_handle) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_service_handle); + SER_ASSERT_NOT_NULL(p_inc_srvc_handle); + SER_ASSERT_NOT_NULL(pp_include_handle); + SER_ASSERT_LENGTH_EQ(6, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_GATTS_INCLUDE_ADD, NRF_ERROR_INVALID_PARAM); + index++; + + uint16_dec(p_buf, packet_len, &index, p_service_handle); + uint16_dec(p_buf, packet_len, &index, p_inc_srvc_handle); + + if (p_buf[index++] == SER_FIELD_NOT_PRESENT) + { + *pp_include_handle = NULL; + } + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gatts_include_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t const * const p_include_handle) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + uint32_t err_code; + + err_code = op_status_enc(SD_BLE_GATTS_INCLUDE_ADD, return_code, p_buf, p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + SER_ASSERT_NOT_NULL(p_include_handle); + err_code = uint16_t_enc(p_include_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; //update change made by op_status_enc + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_rw_authorize_reply.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_rw_authorize_reply.c new file mode 100644 index 0000000..94390bb --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_rw_authorize_reply.c @@ -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. + * + */ + +#include "ble_gatts_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" +#include "ble_gatts_struct_serialization.h" +#include "cond_field_serialization.h" + +uint32_t ble_gatts_rw_authorize_reply_req_dec( + uint8_t const * const p_buf, + uint32_t + packet_len, + uint16_t * + p_conn_handle, + ble_gatts_rw_authorize_reply_params_t * * const + pp_reply_params) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + + uint32_t index = SER_CMD_HEADER_SIZE; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(2, packet_len - index); + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + err_code = cond_field_dec(p_buf, packet_len, &index, + (void * *)pp_reply_params, ble_gatts_rw_authorize_reply_params_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + +uint32_t ble_gatts_rw_authorize_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTS_RW_AUTHORIZE_REPLY, return_code, + p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_service_add.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_service_add.c new file mode 100644 index 0000000..e1d7c68 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_service_add.c @@ -0,0 +1,76 @@ +/* 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 + +#include "ble_gatts_conn.h" +#include "ble_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "ble_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + +uint32_t ble_gatts_service_add_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint8_t * const p_type, + ble_uuid_t * * const pp_uuid, + uint16_t * * const pp_handle) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_type); + SER_ASSERT_NOT_NULL(pp_uuid); + SER_ASSERT_NOT_NULL(*pp_uuid); + SER_ASSERT_NOT_NULL(pp_handle); + SER_ASSERT_NOT_NULL(*pp_handle); + + uint32_t index = SER_CMD_DATA_POS; + + uint32_t err_code; + SER_ASSERT_LENGTH_LEQ(3, buf_len - index); + err_code = uint8_t_dec(p_buf, buf_len, &index, p_type); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_uuid, ble_uuid_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_handle, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT(index == buf_len, NRF_ERROR_INVALID_LENGTH); + + return err_code; +} + +uint32_t ble_gatts_service_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t const * const p_handle) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + uint32_t err_code; + + err_code = op_status_enc(SD_BLE_GATTS_SERVICE_ADD, return_code, p_buf, p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; //this seems silly but it is not + } + SER_ASSERT_NOT_NULL(p_handle); + err_code = uint16_t_enc(p_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; //update change made by op_status_enc + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_service_changed.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_service_changed.c new file mode 100644 index 0000000..37e9e34 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_service_changed.c @@ -0,0 +1,55 @@ +/* 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 +#include "ble_gatts_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_service_changed_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * p_conn_handle, + uint16_t * p_start_handle, + uint16_t * p_end_handle) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_start_handle); + SER_ASSERT_NOT_NULL(p_end_handle); + + SER_ASSERT_LENGTH_EQ(SER_CMD_HEADER_SIZE + 6, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_GATTS_SERVICE_CHANGED, NRF_ERROR_INVALID_PARAM); + index++; + + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + uint16_dec(p_buf, packet_len, &index, p_start_handle); + uint16_dec(p_buf, packet_len, &index, p_end_handle); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gatts_service_changed_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTS_SERVICE_CHANGED, + return_code, + p_buf, + p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_sys_attr_get.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_sys_attr_get.c new file mode 100644 index 0000000..affbe8e --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_sys_attr_get.c @@ -0,0 +1,125 @@ +/* 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 "ble_gatts_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_sys_attr_get_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint8_t * * const pp_sys_attr_data, + uint16_t * * const pp_sys_attr_data_len, + uint32_t * const p_flags) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_sys_attr_data); + SER_ASSERT_NOT_NULL(pp_sys_attr_data_len); + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 2 + 1, packet_len); + SER_ASSERT(p_buf[index] == SD_BLE_GATTS_SYS_ATTR_GET, NRF_ERROR_INVALID_PARAM); + index++; + + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_flags); + *p_conn_handle = uint16_decode(&p_buf[index]); + index += sizeof (uint16_t); + + if (p_buf[index++] == SER_FIELD_PRESENT) + { + SER_ASSERT_LENGTH_LEQ(index + 2, packet_len); + + SER_ASSERT_NOT_NULL(*pp_sys_attr_data_len); + **pp_sys_attr_data_len = uint16_decode(&p_buf[index]); + index += sizeof (uint16_t); + } + else + { + *pp_sys_attr_data_len = NULL; + } + + SER_ASSERT_LENGTH_LEQ(index + 1, packet_len); + + if (p_buf[index++] == SER_FIELD_NOT_PRESENT) + { + *pp_sys_attr_data = NULL; + } + + err_code = uint32_t_dec(p_buf, packet_len, &index, p_flags); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + +uint32_t ble_gatts_sys_attr_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint8_t const * const p_sys_attr_data, + uint16_t const * const p_sys_attr_data_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + SER_ASSERT_LENGTH_LEQ(1 + 4, total_len); + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTS_SYS_ATTR_GET, + return_code, + p_buf, + p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_sys_attr_data); + SER_ASSERT_NOT_NULL(p_sys_attr_data_len); + uint32_t index = *p_buf_len; + uint16_t sys_attr_len = 0; + + SER_ASSERT_LENGTH_LEQ(index + 2, total_len); + + if (p_sys_attr_data_len != NULL) + { + index += uint16_encode(*p_sys_attr_data_len, &p_buf[index]); + sys_attr_len = *p_sys_attr_data_len; + } + + SER_ASSERT_LENGTH_LEQ(index + 1, total_len); + p_buf[index++] = p_sys_attr_data ? SER_FIELD_PRESENT : + SER_FIELD_NOT_PRESENT; + + SER_ASSERT_LENGTH_LEQ(index + sys_attr_len, total_len); + + if (p_sys_attr_data != NULL) + { + memcpy(&p_buf[index], p_sys_attr_data, sys_attr_len); + index += sys_attr_len; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_sys_attr_set.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_sys_attr_set.c new file mode 100644 index 0000000..1b26b77 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_sys_attr_set.c @@ -0,0 +1,76 @@ +/* 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 "ble_gatts_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_sys_attr_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint8_t * * const pp_sys_attr_data, + uint16_t * const p_sys_attr_data_len, + uint32_t * const p_flags) +{ + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code = NRF_SUCCESS; + + uint16_t sys_attr_data_len_temp; + uint16_t * p_sys_attr_data_len_temp = &sys_attr_data_len_temp; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_sys_attr_data); + SER_ASSERT_NOT_NULL(*pp_sys_attr_data); + SER_ASSERT_NOT_NULL(p_sys_attr_data_len); + SER_ASSERT_NOT_NULL(p_flags); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 7, packet_len); + + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + switch (p_buf[index++]) + { + case SER_FIELD_NOT_PRESENT: + *pp_sys_attr_data = NULL; + SER_ASSERT_LENGTH_EQ(index + 4, packet_len); + *p_sys_attr_data_len = 0; + break; + + case SER_FIELD_PRESENT: + uint16_dec(p_buf, packet_len, &index, p_sys_attr_data_len_temp); + SER_ASSERT_LENGTH_LEQ(*p_sys_attr_data_len_temp, *p_sys_attr_data_len); + *p_sys_attr_data_len = *p_sys_attr_data_len_temp; + SER_ASSERT_LENGTH_EQ(index + *p_sys_attr_data_len + 4, packet_len); + memcpy(*pp_sys_attr_data, &p_buf[index], *p_sys_attr_data_len); + index += *p_sys_attr_data_len; + break; + + default: + return NRF_ERROR_INVALID_DATA; + } + + err_code = uint32_t_dec(p_buf, packet_len, &index, p_flags); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return NRF_SUCCESS; +} + + +uint32_t ble_gatts_sys_attr_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTS_SYS_ATTR_SET, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_value_get.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_value_get.c new file mode 100644 index 0000000..eebd031 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_value_get.c @@ -0,0 +1,105 @@ +/* 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 "ble_gatts_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_value_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * const p_handle, + ble_gatts_value_t * * const pp_value) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_handle); + SER_ASSERT_NOT_NULL(pp_value); + SER_ASSERT_NOT_NULL(*pp_value); + SER_ASSERT_NOT_NULL((*pp_value)->p_value); + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 5, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_GATTS_VALUE_GET, NRF_ERROR_INVALID_PARAM); + index++; + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (p_buf[index++] == SER_FIELD_PRESENT) + { + err_code = uint16_t_dec(p_buf, packet_len, &index, &((*pp_value)->len)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, packet_len, &index, &((*pp_value)->offset)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(1, packet_len - index); + if (p_buf[index++] == SER_FIELD_NOT_PRESENT) + { + (*pp_value)->p_value = NULL; + } + } + else + { + *pp_value = NULL; + } + + return err_code; +} + + +uint32_t ble_gatts_value_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gatts_value_t * const p_value) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_RSP_HEADER_SIZE, *p_buf_len); + + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTS_VALUE_GET, + return_code, + p_buf, + p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + uint32_t index = *p_buf_len; + + if (return_code == NRF_SUCCESS) + { + SER_ASSERT_NOT_NULL(p_value); + + err_code = ble_gatts_value_t_enc(p_value, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_value_set.c b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_value_set.c new file mode 100644 index 0000000..4a7eb2b --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_gatts_value_set.c @@ -0,0 +1,74 @@ +/* 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 "ble_gatts_conn.h" +#include +#include "cond_field_serialization.h" +#include "ble_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_value_set_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * p_conn_handle, + uint16_t * p_handle, + ble_gatts_value_t * * const pp_value) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_handle); + SER_ASSERT_NOT_NULL(pp_value); + + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(4, packet_len - index); //make sure that payload length is at least 4 bytes + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + uint16_dec(p_buf, packet_len, &index, p_handle); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_value, ble_gatts_value_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + +uint32_t ble_gatts_value_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buff, + uint32_t * const p_buff_len, + ble_gatts_value_t * p_value) +{ + SER_ASSERT_NOT_NULL(p_buff); + SER_ASSERT_NOT_NULL(p_buff_len); + + uint32_t buf_len = *p_buff_len; + uint32_t index = 0; + uint32_t err_code; + + err_code = op_status_enc(SD_BLE_GATTS_VALUE_SET, return_code, p_buff, p_buff_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + SER_ASSERT_NOT_NULL(p_value); + err_code = ble_gatts_value_t_enc(p_value, p_buff, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buff_len = index; //update change made by op_status_enc + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_l2cap_cid_register.c b/components/serialization/connectivity/codecs/s120/serializers/ble_l2cap_cid_register.c new file mode 100644 index 0000000..9e2a775 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_l2cap_cid_register.c @@ -0,0 +1,46 @@ +/* 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 "ble_l2cap_conn.h" +#include "ble_serialization.h" +#include "nrf_error.h" + + +uint32_t ble_l2cap_cid_register_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * p_cid) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_cid); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_LENGTH_EQ(3, buf_len); + SER_ASSERT(p_buf[index] == SD_BLE_L2CAP_CID_REGISTER, NRF_ERROR_INVALID_PARAM); + + index++; + err_code = uint16_t_dec(p_buf, buf_len, &index, p_cid); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} + + +uint32_t ble_l2cap_cid_register_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_L2CAP_CID_REGISTER, return_code, + p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_l2cap_cid_unregister.c b/components/serialization/connectivity/codecs/s120/serializers/ble_l2cap_cid_unregister.c new file mode 100644 index 0000000..74d4619 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_l2cap_cid_unregister.c @@ -0,0 +1,46 @@ +/* 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 "ble_l2cap_conn.h" +#include "ble_serialization.h" +#include "nrf_error.h" + + +uint32_t ble_l2cap_cid_unregister_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * p_cid) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_cid); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_LENGTH_EQ(3, buf_len); + SER_ASSERT(p_buf[index] == SD_BLE_L2CAP_CID_UNREGISTER, NRF_ERROR_INVALID_PARAM); + + index++; + err_code = uint16_t_dec(p_buf, buf_len, &index, p_cid); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} + + +uint32_t ble_l2cap_cid_unregister_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_L2CAP_CID_UNREGISTER, return_code, + p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_l2cap_conn.h b/components/serialization/connectivity/codecs/s120/serializers/ble_l2cap_conn.h new file mode 100644 index 0000000..9cbf645 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_l2cap_conn.h @@ -0,0 +1,156 @@ +/* Copyright (c) 2011 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. + * + */ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s120_codecs Connectivity s120 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_l2cap_conn L2CAP Connectivity command request decoders and command response encoders + * @{ + * @ingroup ser_conn_s120_codecs + * + * @brief L2CAP Connectivity command request decoders and command response encoders. + */ + +#ifndef BLE_L2CAP_CONN_H__ +#define BLE_L2CAP_CON__H__ + +#include "ble.h" +#include "ble_types.h" +#include "ble_ranges.h" +#include "ble_err.h" +#include "ble_l2cap.h" + +/**@brief Decodes @ref sd_ble_l2cap_cid_register command request. + * + * @sa @ref nrf51_ble_l2cap_cid_register for packet format, + * @ref ble_l2cap_cid_register_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of response packet. + * @param[in] p_cid Pointer to L2CAP CID. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_l2cap_cid_register_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * p_cid); + +/**@brief Encodes @ref sd_ble_l2cap_cid_register command response. + * + * @sa @ref nrf51_ble_l2cap_cid_register for packet format. + * @ref ble_l2cap_cid_register_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_l2cap_cid_register_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_l2cap_cid_unregister command request. + * + * @sa @ref nrf51_ble_l2cap_cid_unregister for packet format, + * @ref ble_l2cap_cid_unregister_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of response packet. + * @param[in] p_cid Pointer to L2CAP CID. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_l2cap_cid_unregister_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * p_cid); + +/**@brief Encodes @ref sd_ble_l2cap_cid_unregister command response. + * + * @sa @ref nrf51_ble_l2cap_cid_unregister for packet format. + * @ref ble_l2cap_cid_unregister_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_l2cap_cid_unregister_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_l2cap_tx command request. + * + * @sa @ref nrf51_ble_l2cap_tx for packet format, + * @ref ble_l2cap_tx_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of response packet. + * @param[in] p_conn_handle Pointer to connection handle. + * @param[in] pp_l2cap_header Pointer to pointer to L2CAP header. + * @param[in] pp_data Pointer to pointer L2CAP data. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_l2cap_tx_req_dec(uint8_t const * const p_buf, + uint32_t const buf_len, + uint16_t * p_conn_handle, + ble_l2cap_header_t * * const pp_l2cap_header, + uint8_t const * * pp_data); + +/**@brief Encodes @ref sd_ble_l2cap_tx command response. + * + * @sa @ref nrf51_ble_l2cap_tx for packet format. + * @ref ble_l2cap_tx_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_l2cap_tx_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +#endif //BLE_L2CAP_CONN_H__ + +/** + @} + */ diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_l2cap_evt_conn.h b/components/serialization/connectivity/codecs/s120/serializers/ble_l2cap_evt_conn.h new file mode 100644 index 0000000..ee85aa1 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_l2cap_evt_conn.h @@ -0,0 +1,56 @@ +/* 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 BLE_L2CAP_EVT_CONN_H__ +#define BLE_L2CAP_EVT_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s120_codecs Connectivity s120 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_l2cap_evt_conn L2CAP Connectivity event encoders + * @{ + * @ingroup ser_conn_s120_codecs + * + * @brief L2CAP Connectivity event encoders. + */ +#include "ble.h" + +/** + * @brief Encodes ble_l2cap_evt_rx event. + * + * @sa @ref nrf51_l2cap_evt_rx_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_l2cap_evt_rx_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** @} */ +#endif diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_l2cap_evt_rx.c b/components/serialization/connectivity/codecs/s120/serializers/ble_l2cap_evt_rx.c new file mode 100644 index 0000000..15793ed --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_l2cap_evt_rx.c @@ -0,0 +1,50 @@ +/* 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 "ble_l2cap_evt_conn.h" +#include +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_l2cap_evt_rx_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t err_code; + uint32_t total_len = *p_buf_len; + + uint16_t evt_id = BLE_L2CAP_EVT_RX; + + err_code = uint16_t_enc(&evt_id, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_event->evt.l2cap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_l2cap_evt_rx_t_enc(&(p_event->evt.l2cap_evt.params.rx), + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_l2cap_tx.c b/components/serialization/connectivity/codecs/s120/serializers/ble_l2cap_tx.c new file mode 100644 index 0000000..c574b40 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_l2cap_tx.c @@ -0,0 +1,67 @@ +/* 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 +#include +#include "ble_l2cap_conn.h" +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + +uint32_t ble_l2cap_tx_req_dec(uint8_t const * const p_buf, + uint32_t const buf_len, + uint16_t * p_conn_handle, + ble_l2cap_header_t * * const pp_l2cap_header, + uint8_t const * * pp_data) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_l2cap_header); + SER_ASSERT_NOT_NULL(*pp_l2cap_header); + SER_ASSERT_NOT_NULL(pp_data); + //SER_ASSERT_NOT_NULL(*pp_data); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = SER_CMD_DATA_POS; + + err_code = uint16_t_dec(p_buf, buf_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_l2cap_header, + ble_l2cap_header_t_dec); + + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (*pp_l2cap_header != NULL) + { + *pp_data = p_buf + index + 1; + index += 1 + (*pp_l2cap_header)->len; + } + else + { + *pp_data = NULL; + index++; + } + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} + +uint32_t ble_l2cap_tx_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_L2CAP_TX, return_code, + p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_opt_get.c b/components/serialization/connectivity/codecs/s120/serializers/ble_opt_get.c new file mode 100644 index 0000000..7f2da63 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_opt_get.c @@ -0,0 +1,130 @@ +/* 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 "ble_conn.h" +#include +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_opt_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint32_t * const p_opt_id, + ble_opt_t **const pp_opt ) +{ + uint32_t index = 0; + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_opt_id); + SER_ASSERT_NOT_NULL(pp_opt); + SER_ASSERT_NOT_NULL(*pp_opt); + SER_ASSERT_LENGTH_EQ(SER_CMD_HEADER_SIZE + 4 + 1, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_OPT_GET, NRF_ERROR_INVALID_PARAM); + index++; + + err_code = uint32_t_dec(p_buf, packet_len, &index, p_opt_id); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT(((*p_opt_id == BLE_COMMON_OPT_RADIO_CPU_MUTEX) || + (*p_opt_id == BLE_GAP_OPT_CH_MAP) || + (*p_opt_id == BLE_GAP_OPT_LOCAL_CONN_LATENCY) || + (*p_opt_id == BLE_GAP_OPT_PASSKEY) || + (*p_opt_id == BLE_GAP_OPT_PRIVACY) || + (*p_opt_id == BLE_GAP_OPT_SCAN_REQ_REPORT) || + (*p_opt_id == BLE_GAP_OPT_COMPAT_MODE)), NRF_ERROR_INVALID_PARAM); + + if (p_buf[index++] == SER_FIELD_NOT_PRESENT) + { + *pp_opt = NULL; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_opt_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint32_t opt_id, + ble_opt_t const * const p_opt) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_OPT_GET, return_code, + p_buf, p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_opt); + SER_ASSERT(((opt_id == BLE_COMMON_OPT_RADIO_CPU_MUTEX) || + (opt_id == BLE_GAP_OPT_CH_MAP) || + (opt_id == BLE_GAP_OPT_LOCAL_CONN_LATENCY) || + (opt_id == BLE_GAP_OPT_PASSKEY) || + (opt_id == BLE_GAP_OPT_PRIVACY) || + (opt_id == BLE_GAP_OPT_SCAN_REQ_REPORT) || + (opt_id == BLE_GAP_OPT_COMPAT_MODE)), NRF_ERROR_INVALID_PARAM); + + uint32_t index = *p_buf_len; + err_code = uint32_t_enc(&opt_id, p_buf, total_len, &index); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + switch (opt_id) + { + case BLE_COMMON_OPT_RADIO_CPU_MUTEX: + err_code = ble_common_opt_radio_cpu_mutex_t_enc((void *)&(p_opt->common_opt.radio_cpu_mutex), p_buf, total_len, &index); + break; + case BLE_GAP_OPT_CH_MAP: + err_code = ble_gap_opt_ch_map_t_enc((void *)&(p_opt->gap_opt.ch_map), p_buf, total_len, &index); + break; + case BLE_GAP_OPT_LOCAL_CONN_LATENCY: + err_code = ble_gap_opt_local_conn_latency_t_enc((void *)&(p_opt->gap_opt.local_conn_latency), p_buf, total_len, &index); + break; + case BLE_GAP_OPT_PASSKEY: + err_code = ble_gap_opt_passkey_t_enc((void *)&(p_opt->gap_opt.passkey), p_buf, total_len, &index); + break; + case BLE_GAP_OPT_PRIVACY: + err_code = ble_gap_opt_privacy_t_enc((void *)&(p_opt->gap_opt.privacy), p_buf, total_len, &index); + break; + case BLE_GAP_OPT_SCAN_REQ_REPORT: + err_code = ble_gap_opt_scan_req_report_t_enc((void *)&(p_opt->gap_opt.scan_req_report), p_buf, total_len, &index); + break; + case BLE_GAP_OPT_COMPAT_MODE: + err_code = ble_gap_opt_compat_mode_t_enc((void *)&(p_opt->gap_opt.compat_mode), p_buf, total_len, &index); + break; + } + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_opt_id_pre_decoder.c b/components/serialization/connectivity/codecs/s120/serializers/ble_opt_id_pre_decoder.c new file mode 100644 index 0000000..7b0e749 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_opt_id_pre_decoder.c @@ -0,0 +1,36 @@ +/* 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 "ble_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_opt_id_pre_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint32_t * const p_opt_id) +{ + uint32_t index = 0; + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_opt_id); + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 4, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_OPT_SET, NRF_ERROR_INVALID_PARAM); + index++; + + err_code = uint32_t_dec(p_buf, packet_len, &index, p_opt_id); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_opt_set.c b/components/serialization/connectivity/codecs/s120/serializers/ble_opt_set.c new file mode 100644 index 0000000..8a0b6e5 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_opt_set.c @@ -0,0 +1,114 @@ +/* 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 "ble_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_opt_set_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint32_t * const p_opt_id, + ble_opt_t **const pp_opt ) +{ + uint32_t index = 0; + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_opt_id); + SER_ASSERT_NOT_NULL(pp_opt); + SER_ASSERT_NOT_NULL(*pp_opt); + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 4 + 1, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_OPT_SET, NRF_ERROR_INVALID_PARAM); + index++; + + err_code = uint32_t_dec(p_buf, packet_len, &index, p_opt_id); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT(((*p_opt_id == BLE_COMMON_OPT_RADIO_CPU_MUTEX) || + (*p_opt_id == BLE_GAP_OPT_CH_MAP) || + (*p_opt_id == BLE_GAP_OPT_LOCAL_CONN_LATENCY) || + (*p_opt_id == BLE_GAP_OPT_PASSKEY) || + (*p_opt_id == BLE_GAP_OPT_PRIVACY) || + (*p_opt_id == BLE_GAP_OPT_SCAN_REQ_REPORT) || + (*p_opt_id == BLE_GAP_OPT_COMPAT_MODE)), NRF_ERROR_INVALID_PARAM); + + if (p_buf[index++] == SER_FIELD_NOT_PRESENT) + { + *pp_opt = NULL; + } + else + { + switch(*p_opt_id) + { + case BLE_COMMON_OPT_RADIO_CPU_MUTEX: + err_code = ble_common_opt_radio_cpu_mutex_t_dec(p_buf, packet_len, &index, &((*pp_opt)->common_opt.radio_cpu_mutex)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + case BLE_GAP_OPT_CH_MAP: + err_code = ble_gap_opt_ch_map_t_dec(p_buf, packet_len, &index, &((*pp_opt)->gap_opt.ch_map)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + case BLE_GAP_OPT_LOCAL_CONN_LATENCY: + err_code = ble_gap_opt_local_conn_latency_t_dec(p_buf, packet_len, &index, &((*pp_opt)->gap_opt.local_conn_latency)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + case BLE_GAP_OPT_PASSKEY: + err_code = ble_gap_opt_passkey_t_dec(p_buf, packet_len, &index, &((*pp_opt)->gap_opt.passkey)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + case BLE_GAP_OPT_PRIVACY: + err_code = ble_gap_opt_privacy_t_dec(p_buf, packet_len, &index, &((*pp_opt)->gap_opt.privacy)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + case BLE_GAP_OPT_SCAN_REQ_REPORT: + err_code = ble_gap_opt_scan_req_report_t_dec(p_buf, packet_len, &index, &((*pp_opt)->gap_opt.scan_req_report)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + case BLE_GAP_OPT_COMPAT_MODE: + err_code = ble_gap_opt_compat_mode_t_dec(p_buf, packet_len, &index, &((*pp_opt)->gap_opt.compat_mode)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + } + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + +uint32_t ble_opt_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_OPT_SET, return_code, + p_buf, p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_tx_buffer_count_get.c b/components/serialization/connectivity/codecs/s120/serializers/ble_tx_buffer_count_get.c new file mode 100644 index 0000000..eec8bb9 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_tx_buffer_count_get.c @@ -0,0 +1,65 @@ +/* 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 "ble_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" +#include "cond_field_serialization.h" + +uint32_t ble_tx_buffer_count_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint8_t * * const pp_count) +{ + SER_ASSERT_NOT_NULL(p_buf); + + uint32_t index = 0; + uint8_t opcode; + uint32_t err_code; + + err_code = uint8_t_dec(p_buf, packet_len, &index, &opcode); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + SER_ASSERT(opcode == SD_BLE_TX_BUFFER_COUNT_GET, NRF_ERROR_INVALID_PARAM); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_count, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + +uint32_t ble_tx_buffer_count_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint8_t const * const p_count) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_TX_BUFFER_COUNT_GET, return_code, + p_buf, p_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + err_code = cond_field_enc(p_count, p_buf, total_len, p_buf_len, uint8_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_user_mem_reply.c b/components/serialization/connectivity/codecs/s120/serializers/ble_user_mem_reply.c new file mode 100644 index 0000000..61062b6 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_user_mem_reply.c @@ -0,0 +1,66 @@ +/* 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 "ble_conn.h" +#include +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_user_mem_reply_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + ble_user_mem_block_t * * const pp_mem_block) +{ + uint32_t index = 0; + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_mem_block); + SER_ASSERT_NOT_NULL(*pp_mem_block); + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 2 + 4, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_USER_MEM_REPLY, NRF_ERROR_INVALID_PARAM); + index++; + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (p_buf[index++] == SER_FIELD_PRESENT) + { + // Decoding order is different than structure elements order because + // mem block length is received first + err_code = uint16_t_dec(p_buf, packet_len, &index, &((*pp_mem_block)->len)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void **)&((*pp_mem_block)->p_mem), NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + else + { + *pp_mem_block = NULL; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + +uint32_t ble_user_mem_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_dec(p_buf, *p_buf_len, SD_BLE_USER_MEM_REPLY, &return_code); +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_uuid_decode.c b/components/serialization/connectivity/codecs/s120/serializers/ble_uuid_decode.c new file mode 100644 index 0000000..000e4d8 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_uuid_decode.c @@ -0,0 +1,77 @@ +/* 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 "ble_conn.h" +#include +#include +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_uuid_decode_req_dec(uint8_t const * const p_buf, + uint32_t const buf_len, + uint8_t * p_uuid_le_len, + uint8_t * * const pp_uuid_le, + ble_uuid_t * * const pp_uuid) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_uuid_le_len); + uint32_t err_code; + uint32_t index = 0; + uint8_t opcode = SD_BLE_UUID_DECODE; + + SER_ASSERT_LENGTH_LEQ(1, ((int32_t)buf_len - index)); + uint8_dec(p_buf, buf_len, &index, &opcode); + SER_ASSERT(opcode == SD_BLE_UUID_DECODE, NRF_ERROR_INVALID_DATA); + + err_code = len8data_dec(p_buf, buf_len, &index, pp_uuid_le, p_uuid_le_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_uuid, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} + +uint32_t ble_uuid_decode_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_uuid_t const * const p_uuid) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_UUID_DECODE, return_code, + p_buf, p_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + + uint32_t index = *p_buf_len; + + if (return_code != NRF_SUCCESS) + { + *p_buf_len = index; + return NRF_SUCCESS; + } + + err_code = cond_field_enc((void *)p_uuid, p_buf, total_len, &index, ble_uuid_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_uuid_encode.c b/components/serialization/connectivity/codecs/s120/serializers/ble_uuid_encode.c new file mode 100644 index 0000000..0843668 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_uuid_encode.c @@ -0,0 +1,117 @@ +/* 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 "ble_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_uuid_encode_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + ble_uuid_t * * const pp_uuid, + uint8_t * * const pp_uuid_le_len, + uint8_t * * const pp_uuid_le) +{ + uint32_t index = SER_CMD_HEADER_SIZE; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_uuid); + SER_ASSERT_NOT_NULL(pp_uuid_le_len); + SER_ASSERT_NOT_NULL(pp_uuid_le); + SER_ASSERT_NOT_NULL(*pp_uuid); + SER_ASSERT_NOT_NULL(*pp_uuid_le_len); + SER_ASSERT_NOT_NULL(*pp_uuid_le); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 3, packet_len); + + if (p_buf[index] == SER_FIELD_NOT_PRESENT) + { + index++; + *pp_uuid = NULL; + } + else if (p_buf[index] == SER_FIELD_PRESENT) + { + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 6, packet_len); + index++; + uint16_dec(p_buf, packet_len, &index, &((*pp_uuid)->uuid)); + (*pp_uuid)->type = p_buf[index++]; + } + else + { + return NRF_ERROR_INVALID_DATA; + } + + if (p_buf[index] == SER_FIELD_NOT_PRESENT) + { + *pp_uuid_le_len = NULL; + } + else if (p_buf[index] != SER_FIELD_PRESENT) + { + return NRF_ERROR_INVALID_DATA; + } + + index++; + + if (p_buf[index] == SER_FIELD_NOT_PRESENT) + { + *pp_uuid_le = NULL; + } + else if (p_buf[index] != SER_FIELD_PRESENT) + { + return NRF_ERROR_INVALID_DATA; + } + + SER_ASSERT_LENGTH_EQ(index + 1, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_uuid_encode_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint8_t uuid_le_len, + uint8_t const * const p_uuid_le) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_UUID_ENCODE, return_code, + p_buf, p_buf_len); + uint32_t index = *p_buf_len; + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + SER_ASSERT_LENGTH_LEQ(index + 1, total_len); + p_buf[index++] = uuid_le_len; + + if (p_uuid_le != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + uuid_le_len, total_len); + memcpy(p_buf + index, p_uuid_le, uuid_le_len); + index += uuid_le_len; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_uuid_vs_add.c b/components/serialization/connectivity/codecs/s120/serializers/ble_uuid_vs_add.c new file mode 100644 index 0000000..5deeac7 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_uuid_vs_add.c @@ -0,0 +1,73 @@ +/* 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 "ble_conn.h" +#include +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_uuid_vs_add_req_dec(uint8_t const * const p_buf, + uint16_t buf_len, + ble_uuid128_t * * const pp_uuid, + uint8_t * * const pp_uuid_type) +{ + uint32_t index = SER_CMD_HEADER_SIZE; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_uuid); + SER_ASSERT_NOT_NULL(pp_uuid_type); + SER_ASSERT_NOT_NULL(*pp_uuid); + SER_ASSERT_NOT_NULL(*pp_uuid_type); + + uint32_t err_code; + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_uuid, ble_uuid128_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_uuid_type, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} + + +uint32_t ble_uuid_vs_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint8_t const * const p_uuid_type) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_UUID_VS_ADD, return_code, + p_buf, p_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + uint32_t index = *p_buf_len; + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + err_code = cond_field_enc((void *)p_uuid_type, p_buf, total_len, &index, uint8_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/ble_version_get.c b/components/serialization/connectivity/codecs/s120/serializers/ble_version_get.c new file mode 100644 index 0000000..28dbe54 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/ble_version_get.c @@ -0,0 +1,77 @@ +/* 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 "ble_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_version_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + ble_version_t * * const pp_version) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_version); + SER_ASSERT_NOT_NULL(*pp_version); + SER_ASSERT_LENGTH_EQ(SER_CMD_HEADER_SIZE + 1, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_VERSION_GET, NRF_ERROR_INVALID_PARAM); + index++; + + if (p_buf[index++] == SER_FIELD_NOT_PRESENT) + { + *pp_version = NULL; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_version_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_version_t const * const p_version) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_VERSION_GET, return_code, + p_buf, p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_version); + uint32_t index = *p_buf_len; + + SER_ASSERT_LENGTH_LEQ(index + 5, total_len); + p_buf[index++] = p_version->version_number; + index += uint16_encode(p_version->company_id, &p_buf[index]); + index += uint16_encode(p_version->subversion_number, &p_buf[index]); + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/conn_ble_gap_sec_keys.c b/components/serialization/connectivity/codecs/s120/serializers/conn_ble_gap_sec_keys.c new file mode 100644 index 0000000..a7db7e3 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/conn_ble_gap_sec_keys.c @@ -0,0 +1,73 @@ +/* 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 "conn_ble_gap_sec_keys.h" +#include "nrf_error.h" +#include + +ser_ble_gap_conn_keyset_t m_conn_keys_table[SER_MAX_CONNECTIONS]; + +uint32_t conn_ble_gap_sec_context_create(uint32_t *p_index) +{ + uint32_t err_code = NRF_ERROR_NO_MEM; + uint32_t i; + + for (i=0; i + +#define SER_MAX_CONNECTIONS 2 + +/**@brief GAP connection - keyset mapping structure. + * + * @note This structure is used to map keysets to connection instances, and will be stored in a static table. + */ +typedef struct +{ + uint16_t conn_handle; /**< Connection handle.*/ + uint8_t conn_active; /**< Indication that keys for this connection are used by soft device. 0: keys used; 1: keys not used*/ + ble_gap_sec_keyset_t keyset; /**< Keyset structure see @ref ble_gap_sec_keyset_t.*/ + ble_gap_enc_key_t enc_key_periph; /**< Peripheral Encryption Key, see @ref ble_gap_enc_key_t.*/ + ble_gap_id_key_t id_key_periph; /**< Peripheral Identity Key, see @ref ble_gap_id_key_t.*/ + ble_gap_sign_info_t sign_key_periph; /**< Peripheral Signing Information, see @ref ble_gap_sign_info_t.*/ + ble_gap_enc_key_t enc_key_central; /**< Central Encryption Key, see @ref ble_gap_enc_key_t.*/ + ble_gap_id_key_t id_key_central; /**< Central Identity Key, see @ref ble_gap_id_key_t.*/ + ble_gap_sign_info_t sign_key_central; /**< Central Signing Information, see @ref ble_gap_sign_info_t.*/ +} ser_ble_gap_conn_keyset_t; + +/**@brief allocates instance in m_conn_keys_table[] for storage of encryption keys. + * + * @param[out] p_index pointer to the index of allocated instance + * + * @retval NRF_SUCCESS great success. + * @retval NRF_ERROR_NO_MEM no free instance available. + */ +uint32_t conn_ble_gap_sec_context_create(uint32_t *p_index); + +/**@brief release instance identified by a connection handle. + * + * @param[in] conn_handle conn_handle + * + * @retval NRF_SUCCESS Context released. + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t conn_ble_gap_sec_context_destroy(uint16_t conn_handle); + +/**@brief finds index of instance identified by a connection handle in m_conn_keys_table[]. + * + * @param[in] conn_handle conn_handle + * + * @param[out] p_index Pointer to the index of entry in the context table corresponding to the given conn_handle + * + * @retval NRF_SUCCESS Context table entry found + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t conn_ble_gap_sec_context_find(uint16_t conn_handle, uint32_t *p_index); +/** @} */ + +#endif //_CONN_BLE_GAP_SEC_KEYS_H diff --git a/components/serialization/connectivity/codecs/s120/serializers/conn_ble_user_mem.c b/components/serialization/connectivity/codecs/s120/serializers/conn_ble_user_mem.c new file mode 100644 index 0000000..7ee0563 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/conn_ble_user_mem.c @@ -0,0 +1,78 @@ +/* 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 "conn_ble_user_mem.h" +#include "ser_config.h" +#include "nrf_error.h" +#include + + + +ser_ble_user_mem_t m_conn_user_mem_table[SER_MAX_CONNECTIONS]; + +uint32_t conn_ble_user_mem_context_create(uint32_t *p_index) +{ + uint32_t err_code = NRF_ERROR_NO_MEM; + uint32_t i; + + for (i=0; i + +/**@brief Connection - user memory mapping structure. + * + * @note This structure is used to map keysets to connection instances, and will be stored in a static table. + */ +//lint -esym(452,ser_ble_user_mem_t) +typedef struct +{ + uint16_t conn_handle; /**< Connection handle.*/ + uint8_t conn_active; /**< Indication that user memory for this connection is used by soft device. 0: memory used; 1: memory not used*/ + ble_user_mem_block_t mem_block; /**< User memory block structure, see @ref ble_user_mem_block_t.*/ + uint8_t mem_table[64]; /**< Memory table.*/ +} ser_ble_user_mem_t; + +/**@brief allocates instance in m_user_mem_table[] for storage. + * + * @param[out] p_index pointer to the index of allocated instance + * + * @retval NRF_SUCCESS great success. + * @retval NRF_ERROR_NO_MEM no free instance available. + */ +uint32_t conn_ble_user_mem_context_create(uint32_t *p_index); + +/**@brief release instance identified by a connection handle. + * + * @param[in] conn_handle conn_handle + * + * @retval NRF_SUCCESS Context released. + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t conn_ble_user_mem_context_destroy(uint16_t conn_handle); + +/**@brief finds index of instance identified by a connection handle in m_user_mem_table[]. + * + * @param[in] conn_handle conn_handle + * + * @param[out] p_index Pointer to the index of entry in the context table corresponding to the given conn_handle + * + * @retval NRF_SUCCESS Context table entry found + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t conn_ble_user_mem_context_find(uint16_t conn_handle, uint32_t *p_index); +/** @} */ + +#endif //_CONN_BLE_USER_MEM_H diff --git a/components/serialization/connectivity/codecs/s120/serializers/nrf_soc_conn.h b/components/serialization/connectivity/codecs/s120/serializers/nrf_soc_conn.h new file mode 100644 index 0000000..7448e81 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/nrf_soc_conn.h @@ -0,0 +1,89 @@ +/* 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 NRF_SOC_CONN_H__ +#define NRF_SOC_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s120_codecs Connectivity s120 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup soc_conn SOC Connectivity command request decoders and command response encoders + * @{ + * @ingroup ser_conn_s120_codecs + * + * @brief SOC Connectivity command request decoders and command response encoderss. + */ +#include "nrf_soc.h" + +/**@brief Decodes @ref sd_power_system_off command request. + * + * @sa @ref nrf51_sd_power_off for packet format. + * + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in] packet_len Length (in bytes) of request packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_PARAM Encoding failure. Incorrect parameter. + */ +uint32_t power_system_off_req_dec(uint8_t const * const p_buf, uint16_t packet_len); + + +/**@brief Decodes @ref sd_temp_get command request. + * + * @sa @ref nrf51_sd_temp_get for packet format. + * @ref temp_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in] buf_len Length (in bytes) of request packet. + * @param[out] pp_temp Pointer to pointer to result of temperature measurement. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_PARAM Encoding failure. Incorrect parameter. + */ +uint32_t temp_get_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + int32_t * * const pp_temp); + +/**@brief Encodes @ref sd_temp_get command response. + * + * @sa @ref nrf51_sd_temp_get for packet format. + * @ref temp_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_temp Pointer to result of temperature measurement. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t temp_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + int32_t * const p_temp); + +/** @} */ +#endif + diff --git a/components/serialization/connectivity/codecs/s120/serializers/power_system_off.c b/components/serialization/connectivity/codecs/s120/serializers/power_system_off.c new file mode 100644 index 0000000..00e66b2 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/power_system_off.c @@ -0,0 +1,28 @@ +/* + * 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 "nrf_soc_conn.h" +#include "ble_serialization.h" + +uint32_t power_system_off_req_dec(uint8_t const * const p_buf, + uint16_t packet_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + + uint32_t index = 0; + SER_ASSERT_LENGTH_LEQ(1, packet_len); + SER_ASSERT(p_buf[index] == SD_POWER_SYSTEM_OFF, NRF_ERROR_INVALID_PARAM); + index++; + + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s120/serializers/temp_get.c b/components/serialization/connectivity/codecs/s120/serializers/temp_get.c new file mode 100644 index 0000000..8cd2081 --- /dev/null +++ b/components/serialization/connectivity/codecs/s120/serializers/temp_get.c @@ -0,0 +1,71 @@ +/* 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 "nrf_soc.h" +#include "nrf_error.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" + +uint32_t temp_get_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + int32_t * * const pp_temp) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_temp); + SER_ASSERT_NOT_NULL(*pp_temp); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len); + SER_ASSERT(p_buf[index] == SD_TEMP_GET, NRF_ERROR_INVALID_PARAM); + index++; + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_temp, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} + +uint32_t temp_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + int32_t * const p_temp) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_temp); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + uint32_t total_len = *p_buf_len; + + err_code = ser_ble_cmd_rsp_status_code_enc(SD_TEMP_GET, + return_code, + p_buf, + p_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + index += *p_buf_len; + + if (return_code == NRF_SUCCESS) + { + err_code = uint32_t_enc(p_temp, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/middleware/conn_mw.h b/components/serialization/connectivity/codecs/s130/middleware/conn_mw.h new file mode 100644 index 0000000..378a96f --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/middleware/conn_mw.h @@ -0,0 +1,38 @@ +/* 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 _CONN_MW_H +#define _CONN_MW_H + +#include + +/**@brief Connectivity Middleware dispatcher function + * + * @details It will handle decode the opcode from RX buffer and based on the opcode it will search + * for registered handler. Handler is called once it is found. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + * @retval NRF_ERROR_NOT_SUPPORTED Handler failure. Opcode not supported. + */ +uint32_t conn_mw_handler (uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); +#endif //_CONN_MW_H diff --git a/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble.c b/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble.c new file mode 100644 index 0000000..78a55ea --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble.c @@ -0,0 +1,287 @@ +/* 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 "ble_conn.h" +#include "conn_mw_ble.h" +#include "ble_serialization.h" +#include "conn_ble_user_mem.h" + +extern ser_ble_user_mem_t m_conn_user_mem_table[]; + +uint32_t conn_mw_ble_tx_buffer_count_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint8_t count; + uint8_t * p_count = &count; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_tx_buffer_count_get_req_dec(p_rx_buf, rx_buf_len, &p_count); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_tx_buffer_count_get(p_count); + + err_code = ble_tx_buffer_count_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_count); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_uuid_vs_add(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + ble_uuid128_t uuid; + ble_uuid128_t * p_uuid = &uuid; + uint8_t uuid_type; + uint8_t * p_uuid_type = &uuid_type; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_uuid_vs_add_req_dec(p_rx_buf, rx_buf_len, &p_uuid, &p_uuid_type); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_uuid_vs_add(p_uuid, p_uuid_type); + + err_code = ble_uuid_vs_add_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_uuid_type); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + return err_code; +} + +uint32_t conn_mw_ble_uuid_decode(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint8_t raw_uuid[16]; + uint8_t uuid_len = sizeof (raw_uuid); + uint8_t * p_raw_uuid = raw_uuid; + ble_uuid_t uuid; + ble_uuid_t * p_uuid = &uuid; + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_uuid_decode_req_dec(p_rx_buf, rx_buf_len, &uuid_len, &p_raw_uuid, &p_uuid); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_uuid_decode(uuid_len, p_raw_uuid, p_uuid); + + err_code = ble_uuid_decode_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_uuid); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_uuid_encode(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint8_t raw_uuid[16]; + uint8_t uuid_len = sizeof (raw_uuid); + uint8_t * p_uuid_len = &uuid_len; + uint8_t * p_raw_uuid = raw_uuid; + ble_uuid_t uuid; + ble_uuid_t * p_uuid = &uuid; + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_uuid_encode_req_dec(p_rx_buf, rx_buf_len, &p_uuid, &p_uuid_len, &p_raw_uuid); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_uuid_encode(p_uuid, p_uuid_len, p_raw_uuid); + + err_code = ble_uuid_encode_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, uuid_len, p_raw_uuid); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_version_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + ble_version_t version; + ble_version_t * p_version = &version; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_version_get_req_dec(p_rx_buf, rx_buf_len, &p_version); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_version_get(p_version); + + err_code = ble_version_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_version); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_opt_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t opt_id; + ble_opt_t opt; + ble_opt_t *p_opt = &opt; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_opt_get_req_dec(p_rx_buf, rx_buf_len, &opt_id, &p_opt); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_opt_get(opt_id, p_opt); + + err_code = ble_opt_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, opt_id, p_opt); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_opt_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t opt_id = 0xFFFFFFFF; + uint16_t act_latency; + uint8_t passkey[BLE_GAP_PASSKEY_LEN]; + ble_gap_irk_t irk = {{0}}; + uint32_t err_code = NRF_SUCCESS; + + /* Pre-decode type of ble_opt_t union */ + err_code = ble_opt_id_pre_dec(p_rx_buf, rx_buf_len, &opt_id); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + ble_opt_t opt; + ble_opt_t *p_opt = &opt; + /* Initialaize appropriate pointers inside opt union based on opt_id */ + switch(opt_id) + { + case BLE_GAP_OPT_LOCAL_CONN_LATENCY: + opt.gap_opt.local_conn_latency.p_actual_latency = &act_latency; + break; + case BLE_GAP_OPT_PASSKEY: + opt.gap_opt.passkey.p_passkey = passkey; + break; + case BLE_GAP_OPT_PRIVACY: + opt.gap_opt.privacy.p_irk = &irk; + break; + } + + uint32_t sd_err_code; + + err_code = ble_opt_set_req_dec(p_rx_buf, rx_buf_len, &opt_id, &p_opt); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_opt_set(opt_id, p_opt); + + err_code = ble_opt_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_enable(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + ble_enable_params_t params; + ble_enable_params_t * p_params = ¶ms; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_enable_req_dec(p_rx_buf, rx_buf_len, &p_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_enable(p_params); + + err_code = ble_enable_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_user_mem_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t * p_conn_handle; + ble_user_mem_block_t * p_mem_block; + uint32_t err_code = NRF_SUCCESS; + uint32_t user_mem_tab_index; + + /* Allocate user memory context for SoftDevice */ + err_code = conn_ble_user_mem_context_create(&user_mem_tab_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_conn_handle = &(m_conn_user_mem_table[user_mem_tab_index].conn_handle); + p_mem_block = &(m_conn_user_mem_table[user_mem_tab_index].mem_block); + + uint32_t sd_err_code; + + err_code = ble_user_mem_reply_req_dec(p_rx_buf, rx_buf_len, p_conn_handle, &p_mem_block); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_user_mem_reply(*p_conn_handle, p_mem_block); + + err_code = ble_user_mem_reply_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble.h b/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble.h new file mode 100644 index 0000000..8698fcc --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble.h @@ -0,0 +1,179 @@ +/* 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 _CONN_MW_BLE_H +#define _CONN_MW_BLE_H + +#include + +/**@brief Handles @ref sd_ble_tx_buffer_count_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_tx_buffer_count_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_uuid_vs_add command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_uuid_vs_add(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_uuid_decode command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_uuid_decode(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_uuid_encode command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_uuid_encode(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_version_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_version_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_opt_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_opt_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_opt_set command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_opt_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_enable command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_enable(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_user_mem_reply command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_user_mem_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +#endif //_CONN_MW_BLE_H diff --git a/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gap.c b/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gap.c new file mode 100644 index 0000000..79e974b --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gap.c @@ -0,0 +1,854 @@ +/* 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 "ble_gap_conn.h" +#include "conn_mw_ble_gap.h" +#include "ble_serialization.h" +#include "conn_ble_gap_sec_keys.h" +#include + +extern ser_ble_gap_conn_keyset_t m_conn_keys_table[SER_MAX_CONNECTIONS]; + +uint32_t conn_mw_ble_gap_address_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint8_t addr_cycle_mode; + + ble_gap_addr_t addr; + ble_gap_addr_t * p_addr = &addr; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_address_set_req_dec(p_rx_buf, rx_buf_len, &addr_cycle_mode, &p_addr); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_address_set(addr_cycle_mode, p_addr); + + err_code = ble_gap_address_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_connect(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + ble_gap_addr_t addr; + ble_gap_addr_t * p_addr = &addr; + + ble_gap_addr_t * pp_addr_tab[BLE_GAP_WHITELIST_ADDR_MAX_COUNT]; + ble_gap_irk_t * pp_irk_tab[BLE_GAP_WHITELIST_IRK_MAX_COUNT]; + + ble_gap_addr_t addr_tab[BLE_GAP_WHITELIST_ADDR_MAX_COUNT]; + ble_gap_irk_t irk_tab[BLE_GAP_WHITELIST_IRK_MAX_COUNT]; + + for (uint8_t i = 0; i < BLE_GAP_WHITELIST_ADDR_MAX_COUNT; ++i) + { + pp_addr_tab[i] = &addr_tab[i]; + } + for (uint8_t i = 0; i < BLE_GAP_WHITELIST_IRK_MAX_COUNT; ++i) + { + pp_irk_tab[i] = &irk_tab[i]; + } + + ble_gap_whitelist_t whitelist; + whitelist.addr_count = BLE_GAP_WHITELIST_ADDR_MAX_COUNT; + whitelist.pp_addrs = pp_addr_tab; + whitelist.irk_count = BLE_GAP_WHITELIST_IRK_MAX_COUNT; + whitelist.pp_irks = pp_irk_tab; + + ble_gap_scan_params_t scan_params; + scan_params.p_whitelist = &whitelist; + ble_gap_scan_params_t * p_scan_params = &scan_params; + + ble_gap_conn_params_t conn_params; + ble_gap_conn_params_t * p_conn_params = &conn_params; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_connect_req_dec(p_rx_buf, rx_buf_len, &p_addr, &p_scan_params, &p_conn_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_connect(p_addr, p_scan_params, p_conn_params); + + err_code = ble_gap_connect_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_connect_cancel(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + sd_err_code = sd_ble_gap_connect_cancel(); + + err_code = ble_gap_connect_cancel_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_scan_start(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + ble_gap_addr_t * pp_addr_tab[BLE_GAP_WHITELIST_ADDR_MAX_COUNT]; + ble_gap_irk_t * pp_irk_tab[BLE_GAP_WHITELIST_IRK_MAX_COUNT]; + + ble_gap_addr_t addr_tab[BLE_GAP_WHITELIST_ADDR_MAX_COUNT]; + ble_gap_irk_t irk_tab[BLE_GAP_WHITELIST_IRK_MAX_COUNT]; + + for (uint8_t i = 0; i < BLE_GAP_WHITELIST_ADDR_MAX_COUNT; ++i) + { + pp_addr_tab[i] = &addr_tab[i]; + } + for (uint8_t i = 0; i < BLE_GAP_WHITELIST_IRK_MAX_COUNT; ++i) + { + pp_irk_tab[i] = &irk_tab[i]; + } + + ble_gap_whitelist_t whitelist; + whitelist.addr_count = BLE_GAP_WHITELIST_ADDR_MAX_COUNT; + whitelist.pp_addrs = pp_addr_tab; + whitelist.irk_count = BLE_GAP_WHITELIST_IRK_MAX_COUNT; + whitelist.pp_irks = pp_irk_tab; + + ble_gap_scan_params_t scan_params; + scan_params.p_whitelist = &whitelist; + ble_gap_scan_params_t * p_scan_params = &scan_params; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_scan_start_req_dec(p_rx_buf, rx_buf_len, &p_scan_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_scan_start(p_scan_params); + + err_code = ble_gap_scan_start_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_address_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + ble_gap_addr_t addr; + ble_gap_addr_t * p_addr = &addr; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_address_get_req_dec(p_rx_buf, rx_buf_len, &p_addr); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_address_get(p_addr); + + err_code = ble_gap_address_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_addr); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_adv_data_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint8_t data[BLE_GAP_ADV_MAX_SIZE]; + uint8_t * p_data = data; + uint8_t dlen = sizeof (data); + + uint8_t sr_data[BLE_GAP_ADV_MAX_SIZE]; + uint8_t * p_sr_data = sr_data; + uint8_t srdlen = sizeof (sr_data); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_adv_data_set_req_dec(p_rx_buf, + rx_buf_len, + &p_data, + &dlen, + &p_sr_data, + &srdlen); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_adv_data_set(p_data, dlen, p_sr_data, srdlen); + + err_code = ble_gap_adv_data_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_adv_start(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + ble_gap_addr_t * p_addresses[BLE_GAP_WHITELIST_ADDR_MAX_COUNT]; + ble_gap_addr_t addresses[BLE_GAP_WHITELIST_ADDR_MAX_COUNT]; + ble_gap_irk_t * p_irks[BLE_GAP_WHITELIST_IRK_MAX_COUNT]; + ble_gap_irk_t irks[BLE_GAP_WHITELIST_IRK_MAX_COUNT]; + ble_gap_addr_t peer_addr; + ble_gap_whitelist_t whitelist; + ble_gap_adv_params_t adv_params; + ble_gap_adv_params_t * p_adv_params; + + uint32_t i = 0; + + for (i = 0; i < BLE_GAP_WHITELIST_ADDR_MAX_COUNT; i++) + { + p_addresses[i] = &(addresses[i]); + } + + for (i = 0; i < BLE_GAP_WHITELIST_IRK_MAX_COUNT; i++) + { + p_irks[i] = &(irks[i]); + } + + whitelist.pp_addrs = &p_addresses[0]; + whitelist.pp_irks = &p_irks[0]; + + adv_params.p_peer_addr = &peer_addr; + adv_params.p_whitelist = &whitelist; + + p_adv_params = &adv_params; + + err_code = ble_gap_adv_start_req_dec(p_rx_buf, rx_buf_len, &p_adv_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_adv_start(p_adv_params); + + err_code = ble_gap_adv_start_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_adv_stop(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + sd_err_code = sd_ble_gap_adv_stop(); + + err_code = ble_gap_adv_stop_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_conn_param_update(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + ble_gap_conn_params_t conn_params; + ble_gap_conn_params_t * p_conn_params = &conn_params; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_conn_param_update_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_conn_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_conn_param_update(conn_handle, p_conn_params); + + err_code = ble_gap_conn_param_update_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_disconnect(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + uint8_t hci_status_code; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_disconnect_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &hci_status_code); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_disconnect(conn_handle, hci_status_code); + + err_code = ble_gap_disconnect_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_tx_power_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + int8_t tx_power; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_tx_power_set_req_dec(p_rx_buf, rx_buf_len, &tx_power); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_tx_power_set(tx_power); + + err_code = ble_gap_tx_power_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_appearance_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t appearance; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_appearance_set_req_dec(p_rx_buf, rx_buf_len, &appearance); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_appearance_set(appearance); + + err_code = ble_gap_appearance_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_appearance_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t appearance; + uint16_t * p_appearance = &appearance; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_appearance_get_req_dec(p_rx_buf, rx_buf_len, &p_appearance); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_appearance_get(p_appearance); + + err_code = ble_gap_appearance_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_appearance); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + + +uint32_t conn_mw_ble_gap_ppcp_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + ble_gap_conn_params_t conn_params; + ble_gap_conn_params_t * p_conn_params = &conn_params; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_ppcp_set_req_dec(p_rx_buf, rx_buf_len, &p_conn_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_ppcp_set(p_conn_params); + + err_code = ble_gap_ppcp_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_ppcp_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + ble_gap_conn_params_t conn_params; + ble_gap_conn_params_t * p_conn_params = &conn_params; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gap_ppcp_get_req_dec(p_rx_buf, rx_buf_len, &p_conn_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_ppcp_get(p_conn_params); + + err_code = ble_gap_ppcp_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_conn_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + + +uint32_t conn_mw_ble_gap_device_name_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint8_t dev_name[BLE_GAP_DEVNAME_MAX_LEN]; + uint8_t * p_dev_name = dev_name; + + uint16_t len; + uint16_t * p_len = &len; + + err_code = ble_gap_device_name_get_req_dec(p_rx_buf, rx_buf_len, &p_dev_name, &p_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_device_name_get(p_dev_name, p_len); + + err_code = ble_gap_device_name_get_rsp_enc(sd_err_code, p_dev_name, len, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_device_name_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + ble_gap_conn_sec_mode_t write_perm; + ble_gap_conn_sec_mode_t * p_write_perm = &write_perm; + + uint8_t dev_name[BLE_GAP_DEVNAME_MAX_LEN]; + uint8_t * p_dev_name = dev_name; + + uint16_t len = BLE_GAP_DEVNAME_MAX_LEN; + + err_code = ble_gap_device_name_set_req_dec(p_rx_buf, + rx_buf_len, + &p_write_perm, + &p_dev_name, + &len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_device_name_set(p_write_perm, p_dev_name, len); + + err_code = ble_gap_device_name_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_authenticate(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint16_t conn_handle; + + ble_gap_sec_params_t sec_params; + ble_gap_sec_params_t * p_sec_params = &sec_params; + + err_code = ble_gap_authenticate_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_sec_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_authenticate(conn_handle, p_sec_params); + + err_code = ble_gap_authenticate_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_sec_params_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + uint32_t sec_tab_index = 0; + + uint16_t * p_conn_handle; + uint8_t sec_status; + + ble_gap_sec_params_t sec_params; + ble_gap_sec_params_t * p_sec_params = &sec_params; + + // Allocate global security context for soft device + err_code = conn_ble_gap_sec_context_create(&sec_tab_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + p_conn_handle = &(m_conn_keys_table[sec_tab_index].conn_handle); + + // Set up global structure for command decoder + ble_gap_sec_keyset_t * p_sec_keyset = &(m_conn_keys_table[sec_tab_index].keyset); + + p_sec_keyset->keys_periph.p_enc_key = &(m_conn_keys_table[sec_tab_index].enc_key_periph); + p_sec_keyset->keys_periph.p_id_key = &(m_conn_keys_table[sec_tab_index].id_key_periph); + p_sec_keyset->keys_periph.p_sign_key = &(m_conn_keys_table[sec_tab_index].sign_key_periph); + p_sec_keyset->keys_central.p_enc_key = &(m_conn_keys_table[sec_tab_index].enc_key_central); + p_sec_keyset->keys_central.p_id_key = &(m_conn_keys_table[sec_tab_index].id_key_central); + p_sec_keyset->keys_central.p_sign_key = &(m_conn_keys_table[sec_tab_index].sign_key_central); + + err_code = ble_gap_sec_params_reply_req_dec(p_rx_buf, + rx_buf_len, + p_conn_handle, + &sec_status, + &p_sec_params, + &p_sec_keyset); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_sec_params_reply(*p_conn_handle, sec_status, p_sec_params, p_sec_keyset); + + err_code = ble_gap_sec_params_reply_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_sec_keyset); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_auth_key_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint16_t conn_handle; + uint8_t key_type; + + uint8_t key[BLE_GAP_SEC_KEY_LEN]; + uint8_t * p_key = key; + + err_code = ble_gap_auth_key_reply_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &key_type, &p_key); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_auth_key_reply(conn_handle, key_type, p_key); + + err_code = ble_gap_auth_key_reply_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_sec_info_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint16_t conn_handle; + + ble_gap_enc_info_t enc_info; + ble_gap_enc_info_t * p_enc_info = &enc_info; + + ble_gap_irk_t id_info; + ble_gap_irk_t * p_id_info = &id_info; + + ble_gap_sign_info_t sign_info; + ble_gap_sign_info_t * p_sign_info = &sign_info; + + err_code = ble_gap_sec_info_reply_req_dec(p_rx_buf, + rx_buf_len, + &conn_handle, + &p_enc_info, + &p_id_info, + &p_sign_info); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_sec_info_reply(conn_handle, p_enc_info, p_id_info, p_sign_info); + + err_code = ble_gap_sec_info_reply_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_conn_sec_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint16_t conn_handle; + + ble_gap_conn_sec_t conn_sec; + ble_gap_conn_sec_t * p_conn_sec = &conn_sec; + + err_code = ble_gap_conn_sec_get_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_conn_sec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_conn_sec_get(conn_handle, p_conn_sec); + + err_code = ble_gap_conn_sec_get_rsp_enc(sd_err_code, p_conn_sec, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_rssi_start(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint16_t conn_handle; + uint8_t threshold_dbm; + uint8_t skip_count; + + err_code = ble_gap_rssi_start_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &threshold_dbm, &skip_count); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_rssi_start(conn_handle, threshold_dbm, skip_count); + + err_code = ble_gap_rssi_start_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_rssi_stop(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint16_t conn_handle; + + err_code = ble_gap_rssi_stop_req_dec(p_rx_buf, rx_buf_len, &conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_rssi_stop(conn_handle); + + err_code = ble_gap_rssi_stop_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_scan_stop(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + sd_err_code = sd_ble_gap_scan_stop(); + + err_code = ble_gap_scan_stop_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_encrypt(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint16_t conn_handle; + + ble_gap_master_id_t master_id; + ble_gap_master_id_t *p_master_id = &master_id; + + ble_gap_enc_info_t enc_info; + ble_gap_enc_info_t *p_enc_info = &enc_info; + + err_code = ble_gap_encrypt_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_master_id, &p_enc_info); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_encrypt(conn_handle, p_master_id, p_enc_info); + + err_code = ble_gap_encrypt_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gap_rssi_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint16_t conn_handle; + int8_t rssi; + int8_t * p_rssi = &rssi; + + err_code = ble_gap_rssi_get_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_rssi); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gap_rssi_get(conn_handle, p_rssi); + + err_code = ble_gap_rssi_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, rssi); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gap.h b/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gap.h new file mode 100644 index 0000000..aa43b0b --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gap.h @@ -0,0 +1,532 @@ +/* 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 _CONN_MW_BLE_GAP_H +#define _CONN_MW_BLE_GAP_H + +#include + +/**@brief Handles @ref sd_ble_gap_address_set command request and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_address_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_address_get command request and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_address_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_adv_data_set command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_adv_data_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_adv_start command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_adv_start(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_adv_stop command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_adv_stop(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_conn_param_update command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_conn_param_update(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_disconnect command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_disconnect(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_tx_power_set command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_tx_power_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_appearance_set command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_appearance_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_appearance_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_appearance_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_ppcp_set command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_ppcp_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_ppcp_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_ppcp_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_device_name_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_device_name_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_device_name_set command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_device_name_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_authenticate command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_authenticate(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_sec_params_reply command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_sec_params_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_auth_key_reply command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_auth_key_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_sec_info_reply command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_sec_info_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_conn_sec_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_conn_sec_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_rssi_start command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_rssi_start(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_rssi_stop command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_rssi_stop(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +///**@brief Handles @ref sd_ble_gap_rssi_get command and prepares response. +// * +// * @param[in] p_rx_buf Pointer to input buffer. +// * @param[in] rx_buf_len Size of p_rx_buf. +// * @param[out] p_tx_buf Pointer to output buffer. +// * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. +// * \c out: Length of valid data in \p p_tx_buf. +// * +// * @retval NRF_SUCCESS Handler success. +// * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. +// * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. +// * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. +// */ +//uint32_t conn_mw_ble_gap_rssi_get(uint8_t const * const p_rx_buf, +// uint32_t rx_buf_len, +// uint8_t * const p_tx_buf, +// uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_connect command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_connect(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_connect_cancel command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_connect_cancel(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_scan_start command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_scan_start(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_scan_stop command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gap_scan_stop(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gap_encrypt command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ + +uint32_t conn_mw_ble_gap_encrypt(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief allocates instance in m_conn_keys_table[] for storage of encryption keys. + * + * @param[in] conn_handle conn_handle + * @param[out] p_index pointer to the index of allocated instance + * + * @retval NRF_SUCCESS great success. + * @retval NRF_ERROR_NO_MEM no free instance available. + */ +uint32_t conn_mw_ble_gap_sec_context_create(uint16_t conn_handle, uint32_t *p_index); + +/**@brief release instance identified by a connection handle. + * + * @param[in] conn_handle conn_handle + * + * @retval NRF_SUCCESS great success + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t conn_mw_ble_gap_sec_context_destroy(uint16_t conn_handle); + +/**@brief finds index of instance identified by a connection handle in m_conn_keys_table[]. + * + * @param[in] conn_handle conn_handle + * + * @retval NRF_SUCCESS great success + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t conn_mw_ble_gap_sec_context_find(uint16_t conn_handle, uint32_t *p_index); + +#endif //_CONN_MW_BLE_GAP_H diff --git a/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gattc.c b/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gattc.c new file mode 100644 index 0000000..d41ac4d --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gattc.c @@ -0,0 +1,293 @@ +/* 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 "ble_gattc_conn.h" +#include "conn_mw_ble_gattc.h" +#include "ble_serialization.h" + +uint32_t conn_mw_ble_gattc_primary_services_discover(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + uint16_t start_handle; + ble_uuid_t srvc_uuid; + ble_uuid_t * p_srvc_uuid = &srvc_uuid; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gattc_primary_services_discover_req_dec(p_rx_buf, + rx_buf_len, + &conn_handle, + &start_handle, + &p_srvc_uuid); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gattc_primary_services_discover(conn_handle, start_handle, p_srvc_uuid); + + err_code = ble_gattc_primary_services_discover_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gattc_relationships_discover(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + ble_gattc_handle_range_t handle_range; + ble_gattc_handle_range_t * p_handle_range = &handle_range; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gattc_relationships_discover_req_dec(p_rx_buf, rx_buf_len, + &conn_handle, &p_handle_range); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gattc_relationships_discover(conn_handle, p_handle_range); + + err_code = ble_gattc_relationships_discover_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gattc_characteristics_discover(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + ble_gattc_handle_range_t handle_range; + ble_gattc_handle_range_t * p_handle_range = &handle_range; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gattc_characteristics_discover_req_dec(p_rx_buf, rx_buf_len, + &conn_handle, &p_handle_range); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gattc_characteristics_discover(conn_handle, p_handle_range); + + err_code = ble_gattc_characteristics_discover_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gattc_descriptors_discover(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + ble_gattc_handle_range_t handle_range; + ble_gattc_handle_range_t * p_handle_range = &handle_range; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gattc_descriptors_discover_req_dec(p_rx_buf, rx_buf_len, + &conn_handle, &p_handle_range); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gattc_descriptors_discover(conn_handle, p_handle_range); + + err_code = ble_gattc_descriptors_discover_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gattc_char_value_by_uuid_read(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + + ble_uuid_t uuid = {0}; + ble_uuid_t * p_uuid = &uuid; + + ble_gattc_handle_range_t handle_range; + ble_gattc_handle_range_t * p_handle_range = &handle_range; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gattc_char_value_by_uuid_read_req_dec(p_rx_buf, rx_buf_len, + &conn_handle, &p_uuid, &p_handle_range); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gattc_char_value_by_uuid_read(conn_handle, p_uuid, p_handle_range); + + err_code = ble_gattc_char_value_by_uuid_read_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gattc_read(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + uint16_t * p_conn_handle = &conn_handle; + + uint16_t handle; + uint16_t * p_handle = &handle; + + uint16_t offset; + uint16_t * p_offset = &offset; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gattc_read_req_dec(p_rx_buf, rx_buf_len, p_conn_handle, p_handle, p_offset); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gattc_read(conn_handle, handle, offset); + + err_code = ble_gattc_read_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gattc_char_values_read(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + uint16_t * p_conn_handle = &conn_handle; + + uint16_t handles[BLE_GATTC_HANDLE_COUNT_LEN_MAX]; + uint16_t * p_handles = handles; + + uint16_t handle_count = BLE_GATTC_HANDLE_COUNT_LEN_MAX; + uint16_t * p_handle_count = &handle_count; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gattc_char_values_read_req_dec(p_rx_buf, + rx_buf_len, + p_conn_handle, + &p_handles, + p_handle_count); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gattc_char_values_read(conn_handle, p_handles, handle_count); + + err_code = ble_gattc_char_values_read_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gattc_write(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + uint16_t * p_conn_handle = &conn_handle; + + uint8_t value[BLE_GATTC_WRITE_P_VALUE_LEN_MAX]; + + ble_gattc_write_params_t write_params = {0}; + ble_gattc_write_params_t * p_write_params = &write_params; + + p_write_params->len = BLE_GATTC_WRITE_P_VALUE_LEN_MAX; + p_write_params->p_value = value; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gattc_write_req_dec(p_rx_buf, rx_buf_len, p_conn_handle, &p_write_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gattc_write(conn_handle, p_write_params); + + err_code = ble_gattc_write_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gattc_hv_confirm(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + uint16_t conn_handle; + uint16_t * p_conn_handle = &conn_handle; + + uint16_t handle; + uint16_t * p_handle = &handle; + + err_code = ble_gattc_hv_confirm_req_dec(p_rx_buf, rx_buf_len, p_conn_handle, p_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gattc_hv_confirm(conn_handle, handle); + + err_code = ble_gattc_hv_confirm_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gattc.h b/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gattc.h new file mode 100644 index 0000000..403ae11 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gattc.h @@ -0,0 +1,180 @@ +/* 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 _CONN_MW_BLE_GATTC_H + #define _CONN_MW_BLE_GATTC_H + +#include + +/**@brief Handles @ref sd_ble_gattc_primary_services_discover command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gattc_primary_services_discover (uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gattc_relationships_discover command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gattc_relationships_discover(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gattc_characteristics_discover command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gattc_characteristics_discover(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gattc_descriptors_discover command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gattc_descriptors_discover(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gattc_char_value_by_uuid_read command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gattc_char_value_by_uuid_read(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gattc_read command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gattc_read (uint8_t const *const rx_buf, + uint32_t rx_buf_len, + uint8_t *const tx_buf, + uint32_t *const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gattc_char_values_read command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gattc_char_values_read (uint8_t const *const rx_buf, + uint32_t rx_buf_len, + uint8_t *const tx_buf, + uint32_t *const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gattc_write command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gattc_write (uint8_t const *const rx_buf, + uint32_t rx_buf_len, + uint8_t *const tx_buf, + uint32_t *const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gattc_hv_confirm command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gattc_hv_confirm (uint8_t const *const rx_buf, + uint32_t rx_buf_len, + uint8_t *const tx_buf, + uint32_t *const p_tx_buf_len); + + +#endif //_CONN_MW_BLE_GATTC_H diff --git a/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gatts.c b/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gatts.c new file mode 100644 index 0000000..018c5ce --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gatts.c @@ -0,0 +1,407 @@ +/* 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 "ble_gatts_conn.h" +#include "conn_mw_ble_gatts.h" +#include "ble_serialization.h" + +uint32_t conn_mw_ble_gatts_service_add(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint8_t type; + ble_uuid_t uuid = {0}; + ble_uuid_t * p_uuid = &uuid; + uint16_t handle; + uint16_t * p_handle = &handle; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_service_add_req_dec(p_rx_buf, rx_buf_len, &type, &p_uuid, &p_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_service_add(type, p_uuid, p_handle); + + err_code = ble_gatts_service_add_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gatts_characteristic_add(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t service_handle; + + //Preparing char_md + ble_gatts_char_md_t char_md; + + uint8_t char_user_desc[BLE_GATTS_VAR_ATTR_LEN_MAX]; + ble_gatts_char_pf_t char_pf; + ble_gatts_attr_md_t user_desc_md; + ble_gatts_attr_md_t cccd_md; + ble_gatts_attr_md_t sccd_md; + + char_md.char_user_desc_size = sizeof (char_user_desc); + char_md.p_char_user_desc = char_user_desc; + char_md.p_char_pf = &char_pf; + char_md.p_user_desc_md = &user_desc_md; + char_md.p_cccd_md = &cccd_md; + char_md.p_sccd_md = &sccd_md; + + ble_gatts_char_md_t * p_char_md = &char_md; + + //Preparing attr_char_value + ble_gatts_attr_t attr_char_value; + ble_uuid_t uuid; + ble_gatts_attr_md_t attr_md; + uint8_t value[BLE_GATTS_VAR_ATTR_LEN_MAX]; + + attr_char_value.p_uuid = &uuid; + attr_char_value.p_attr_md = &attr_md; + attr_char_value.init_len = sizeof (value); + attr_char_value.p_value = value; + + ble_gatts_attr_t * p_attr_char_value = &attr_char_value; + + //Preparing handles + ble_gatts_char_handles_t handles; + ble_gatts_char_handles_t * p_handles = &handles; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_characteristic_add_req_dec(p_rx_buf, rx_buf_len, &service_handle, + &p_char_md, &p_attr_char_value, &p_handles); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_characteristic_add(service_handle, p_char_md, + p_attr_char_value, p_handles); + + err_code = ble_gatts_characteristic_add_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, + p_handles); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; + +} + +uint32_t conn_mw_ble_gatts_include_add(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t service_handle; + uint16_t inc_srvc_handle; + uint16_t handle; + uint16_t * p_handle = &handle; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_include_add_req_dec(p_rx_buf, rx_buf_len, &service_handle, + &inc_srvc_handle, &p_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_include_add(service_handle, inc_srvc_handle, p_handle); + + err_code = ble_gatts_include_add_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gatts_descriptor_add(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t char_handle; + uint8_t attr_value[BLE_GATTS_VAR_ATTR_LEN_MAX]; + ble_uuid_t char_uuid; + ble_gatts_attr_md_t metadata; + ble_gatts_attr_t attr; + ble_gatts_attr_t * p_attr = &attr; + + attr.p_uuid = &char_uuid; + attr.p_attr_md = &metadata; + attr.p_value = attr_value; + attr.init_len = sizeof (attr_value); + + uint16_t handle; + uint16_t * p_handle = &handle; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_descriptor_add_req_dec(p_rx_buf, rx_buf_len, &char_handle, &p_attr, + &p_handle); + + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_descriptor_add(char_handle, p_attr, p_handle); + + err_code = ble_gatts_descriptor_add_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gatts_value_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + uint16_t handle; + uint8_t attr_val_table[BLE_GATTS_VAR_ATTR_LEN_MAX]; + ble_gatts_value_t attr_val = + { + .len = sizeof (attr_val_table), + .offset = 0, + .p_value = attr_val_table + }; + ble_gatts_value_t * p_attr_val = &attr_val; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_value_set_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &handle, &p_attr_val); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_value_set(conn_handle, handle, p_attr_val); + + err_code = ble_gatts_value_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_attr_val); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gatts_value_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + uint16_t handle; + uint8_t val[BLE_GATTS_VAR_ATTR_LEN_MAX]; + ble_gatts_value_t attr_value; + ble_gatts_value_t * p_attr_value = &attr_value; + + attr_value.p_value = val; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_value_get_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &handle, &p_attr_value); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_value_get(conn_handle, handle, p_attr_value); + + err_code = ble_gatts_value_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_attr_value); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gatts_hvx(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + uint8_t data[BLE_GATTS_VAR_ATTR_LEN_MAX]; + uint8_t * p_data = data; + uint16_t len = sizeof data; + uint16_t * p_len = &len; + + ble_gatts_hvx_params_t hvx_params; + ble_gatts_hvx_params_t * p_hvx_params = &hvx_params; + + hvx_params.p_len = p_len; + hvx_params.p_data = p_data; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_hvx_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_hvx_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + sd_err_code = sd_ble_gatts_hvx(conn_handle, p_hvx_params); + + p_len = (p_hvx_params) ? p_hvx_params->p_len : NULL; + err_code = ble_gatts_hvx_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gatts_service_changed(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + uint16_t start_handle; + uint16_t end_handle; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_service_changed_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &start_handle, + &end_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_service_changed(conn_handle, start_handle, end_handle); + + err_code = ble_gatts_service_changed_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gatts_rw_authorize_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + + uint8_t data[BLE_GATTS_VAR_ATTR_LEN_MAX]; + ble_gatts_rw_authorize_reply_params_t auth_params; + ble_gatts_rw_authorize_reply_params_t * p_auth_params = &auth_params; + + auth_params.params.read.p_data = data; + auth_params.params.read.len = sizeof (data); + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_rw_authorize_reply_req_dec(p_rx_buf, rx_buf_len, &conn_handle, + &p_auth_params); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_rw_authorize_reply(conn_handle, p_auth_params); + + err_code = ble_gatts_rw_authorize_reply_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gatts_sys_attr_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + + uint8_t sys_attr[BLE_GATTS_VAR_ATTR_LEN_MAX]; + + uint8_t * p_sys_attr = sys_attr; + uint16_t sys_attr_len = sizeof (sys_attr); + + uint32_t flags; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_sys_attr_set_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_sys_attr, + &sys_attr_len, &flags); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_sys_attr_set(conn_handle, p_sys_attr, sys_attr_len, flags); + + err_code = ble_gatts_sys_attr_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_gatts_sys_attr_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + + uint8_t sys_attr[BLE_GATTS_VAR_ATTR_LEN_MAX]; + + uint8_t * p_sys_attr = sys_attr; + uint16_t sys_attr_len = sizeof (sys_attr); + uint16_t * p_sys_attr_len = &sys_attr_len; + + uint32_t flags; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_gatts_sys_attr_get_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_sys_attr, + &p_sys_attr_len, &flags); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_gatts_sys_attr_get(conn_handle, p_sys_attr, p_sys_attr_len, flags); + + err_code = ble_gatts_sys_attr_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_sys_attr, + p_sys_attr_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gatts.h b/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gatts.h new file mode 100644 index 0000000..d61865a --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gatts.h @@ -0,0 +1,216 @@ +/* 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 _CONN_MW_BLE_GATTS_H +#define _CONN_MW_BLE_GATTS_H + +#include + +/**@brief Handles @ref sd_ble_gatts_service_add command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_service_add (uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_gatts_characteristic_add command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_characteristic_add(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref conn_mw_ble_gatts_include_add command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_include_add (uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref conn_mw_ble_gatts_descriptor_add command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_descriptor_add(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref conn_mw_ble_gatts_value_set command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_value_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref conn_mw_ble_gatts_value_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_value_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref conn_mw_ble_gatts_hvx command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_hvx(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref conn_mw_ble_gatts_service_changed command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_service_changed(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref conn_mw_ble_gatts_rw_authorize_reply command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_rw_authorize_reply(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref conn_mw_ble_gatts_sys_attr_set command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_sys_attr_set(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref conn_mw_ble_gatts_sys_attr_get command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_gatts_sys_attr_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); +#endif //_CONN_MW_BLE_GATTS_H + diff --git a/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_l2cap.c b/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_l2cap.c new file mode 100644 index 0000000..a3134b0 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_l2cap.c @@ -0,0 +1,91 @@ +/* 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 "ble_l2cap_conn.h" +#include "conn_mw_ble_l2cap.h" +#include "ble_serialization.h" + +uint32_t conn_mw_ble_l2cap_cid_register(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t cid; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_l2cap_cid_register_req_dec(p_rx_buf, rx_buf_len, &cid); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_l2cap_cid_register(cid); + + err_code = ble_l2cap_cid_register_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_l2cap_cid_unregister(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t cid; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = ble_l2cap_cid_unregister_req_dec(p_rx_buf, rx_buf_len, &cid); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_l2cap_cid_unregister(cid); + + err_code = ble_l2cap_cid_unregister_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t conn_mw_ble_l2cap_tx(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint16_t conn_handle; + ble_l2cap_header_t l2cap_header; + ble_l2cap_header_t * p_l2cap_header = &l2cap_header; + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + uint8_t const * p_data = NULL; + + err_code = ble_l2cap_tx_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_l2cap_header, &p_data); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_ble_l2cap_tx(conn_handle, p_l2cap_header, p_data); + + err_code = ble_l2cap_tx_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_l2cap.h b/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_l2cap.h new file mode 100644 index 0000000..dd6ac2e --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_l2cap.h @@ -0,0 +1,72 @@ +/* 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 _CONN_MW_BLE_L2CAP_H_ +#define _CONN_MW_BLE_L2CAP_H_ + +#include + +/**@brief Handles @ref sd_ble_l2cap_cid_register command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_l2cap_cid_register(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_l2cap_cid_unregister command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_l2cap_cid_unregister(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_ble_l2cap_tx command and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + */ +uint32_t conn_mw_ble_l2cap_tx(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +#endif diff --git a/components/serialization/connectivity/codecs/s130/middleware/conn_mw_items.c b/components/serialization/connectivity/codecs/s130/middleware/conn_mw_items.c new file mode 100644 index 0000000..989afba --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/middleware/conn_mw_items.c @@ -0,0 +1,76 @@ +#include "conn_mw_nrf_soc.h" +#include "conn_mw_ble.h" +#include "conn_mw_ble_l2cap.h" +#include "conn_mw_ble_gap.h" +#include "conn_mw_ble_gatts.h" +#include "conn_mw_ble_gattc.h" + +/**@brief Connectivity middleware handlers table. */ +static const conn_mw_item_t conn_mw_item[] = { + //Functions from nrf_soc.h + {SD_POWER_SYSTEM_OFF, conn_mw_power_system_off}, + {SD_TEMP_GET, conn_mw_temp_get}, + //Functions from ble.h + {SD_BLE_TX_BUFFER_COUNT_GET, conn_mw_ble_tx_buffer_count_get}, + {SD_BLE_UUID_VS_ADD, conn_mw_ble_uuid_vs_add}, + {SD_BLE_UUID_DECODE, conn_mw_ble_uuid_decode}, + {SD_BLE_UUID_ENCODE, conn_mw_ble_uuid_encode}, + {SD_BLE_VERSION_GET, conn_mw_ble_version_get}, + {SD_BLE_OPT_GET, conn_mw_ble_opt_get}, + {SD_BLE_OPT_SET, conn_mw_ble_opt_set}, + {SD_BLE_ENABLE, conn_mw_ble_enable}, + //Functions from ble_l2cap.h + {SD_BLE_L2CAP_CID_REGISTER, conn_mw_ble_l2cap_cid_register}, + {SD_BLE_L2CAP_CID_UNREGISTER, conn_mw_ble_l2cap_cid_unregister}, + {SD_BLE_L2CAP_TX, conn_mw_ble_l2cap_tx}, + //Functions from ble_gap.h + {SD_BLE_GAP_SCAN_STOP, conn_mw_ble_gap_scan_stop}, + {SD_BLE_GAP_ADDRESS_SET, conn_mw_ble_gap_address_set}, + {SD_BLE_GAP_CONNECT, conn_mw_ble_gap_connect}, + {SD_BLE_GAP_CONNECT_CANCEL, conn_mw_ble_gap_connect_cancel}, + {SD_BLE_GAP_SCAN_START, conn_mw_ble_gap_scan_start}, + {SD_BLE_GAP_SEC_INFO_REPLY, conn_mw_ble_gap_sec_info_reply}, + {SD_BLE_GAP_ENCRYPT, conn_mw_ble_gap_encrypt}, + {SD_BLE_GAP_ADDRESS_GET, conn_mw_ble_gap_address_get}, + {SD_BLE_GAP_ADV_DATA_SET, conn_mw_ble_gap_adv_data_set}, + {SD_BLE_GAP_ADV_START, conn_mw_ble_gap_adv_start}, + {SD_BLE_GAP_ADV_STOP, conn_mw_ble_gap_adv_stop}, + {SD_BLE_GAP_CONN_PARAM_UPDATE, conn_mw_ble_gap_conn_param_update}, + {SD_BLE_GAP_DISCONNECT, conn_mw_ble_gap_disconnect}, + {SD_BLE_GAP_TX_POWER_SET, conn_mw_ble_gap_tx_power_set}, + {SD_BLE_GAP_APPEARANCE_SET, conn_mw_ble_gap_appearance_set}, + {SD_BLE_GAP_APPEARANCE_GET, conn_mw_ble_gap_appearance_get}, + {SD_BLE_GAP_PPCP_SET, conn_mw_ble_gap_ppcp_set}, + {SD_BLE_GAP_PPCP_GET, conn_mw_ble_gap_ppcp_get}, + {SD_BLE_GAP_DEVICE_NAME_SET, conn_mw_ble_gap_device_name_set}, + {SD_BLE_GAP_DEVICE_NAME_GET, conn_mw_ble_gap_device_name_get}, + {SD_BLE_GAP_AUTHENTICATE, conn_mw_ble_gap_authenticate}, + {SD_BLE_GAP_SEC_PARAMS_REPLY, conn_mw_ble_gap_sec_params_reply}, + {SD_BLE_GAP_AUTH_KEY_REPLY, conn_mw_ble_gap_auth_key_reply}, + {SD_BLE_GAP_SEC_INFO_REPLY, conn_mw_ble_gap_sec_info_reply}, + {SD_BLE_GAP_CONN_SEC_GET, conn_mw_ble_gap_conn_sec_get}, + {SD_BLE_GAP_RSSI_START, conn_mw_ble_gap_rssi_start}, + {SD_BLE_GAP_RSSI_STOP, conn_mw_ble_gap_rssi_stop}, + //Functions from ble_gattc.h + {SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER, conn_mw_ble_gattc_primary_services_discover}, + {SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, conn_mw_ble_gattc_relationships_discover}, + {SD_BLE_GATTC_CHARACTERISTICS_DISCOVER, conn_mw_ble_gattc_characteristics_discover}, + {SD_BLE_GATTC_DESCRIPTORS_DISCOVER, conn_mw_ble_gattc_descriptors_discover}, + {SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, conn_mw_ble_gattc_char_value_by_uuid_read}, + {SD_BLE_GATTC_READ, conn_mw_ble_gattc_read}, + {SD_BLE_GATTC_CHAR_VALUES_READ, conn_mw_ble_gattc_char_values_read}, + {SD_BLE_GATTC_WRITE, conn_mw_ble_gattc_write}, + {SD_BLE_GATTC_HV_CONFIRM, conn_mw_ble_gattc_hv_confirm}, + //Functions from ble_gatts.h + {SD_BLE_GATTS_SERVICE_ADD, conn_mw_ble_gatts_service_add}, + {SD_BLE_GATTS_INCLUDE_ADD, conn_mw_ble_gatts_include_add}, + {SD_BLE_GATTS_CHARACTERISTIC_ADD, conn_mw_ble_gatts_characteristic_add}, + {SD_BLE_GATTS_DESCRIPTOR_ADD, conn_mw_ble_gatts_descriptor_add}, + {SD_BLE_GATTS_VALUE_SET, conn_mw_ble_gatts_value_set}, + {SD_BLE_GATTS_VALUE_GET, conn_mw_ble_gatts_value_get}, + {SD_BLE_GATTS_HVX, conn_mw_ble_gatts_hvx}, + {SD_BLE_GATTS_SERVICE_CHANGED, conn_mw_ble_gatts_service_changed}, + {SD_BLE_GATTS_RW_AUTHORIZE_REPLY, conn_mw_ble_gatts_rw_authorize_reply}, + {SD_BLE_GATTS_SYS_ATTR_SET, conn_mw_ble_gatts_sys_attr_set}, + {SD_BLE_GATTS_SYS_ATTR_GET, conn_mw_ble_gatts_sys_attr_get}, +}; diff --git a/components/serialization/connectivity/codecs/s130/middleware/conn_mw_nrf_soc.c b/components/serialization/connectivity/codecs/s130/middleware/conn_mw_nrf_soc.c new file mode 100644 index 0000000..c9a7509 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/middleware/conn_mw_nrf_soc.c @@ -0,0 +1,60 @@ +/* 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 "nrf_soc_conn.h" +#include "conn_mw_nrf_soc.h" +#include "ble_serialization.h" + +uint32_t conn_mw_power_system_off(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + uint32_t err_code = NRF_SUCCESS; + + err_code = power_system_off_req_dec(p_rx_buf, rx_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = sd_power_system_off(); + /* There should be no return from sd_power_system_off() */ + + return err_code; +} + +uint32_t conn_mw_temp_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len) +{ + SER_ASSERT_NOT_NULL(p_rx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf); + SER_ASSERT_NOT_NULL(p_tx_buf_len); + + int32_t temperature; + int32_t * p_temperature = &temperature; + + uint32_t err_code = NRF_SUCCESS; + uint32_t sd_err_code; + + err_code = temp_get_req_dec(p_rx_buf, rx_buf_len, &p_temperature); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + sd_err_code = sd_temp_get(p_temperature); + + err_code = temp_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_temperature); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/middleware/conn_mw_nrf_soc.h b/components/serialization/connectivity/codecs/s130/middleware/conn_mw_nrf_soc.h new file mode 100644 index 0000000..ba4a973 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/middleware/conn_mw_nrf_soc.h @@ -0,0 +1,55 @@ +/* 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 CONN_MW_NRF_SOC_H__ +#define CONN_MW_NRF_SOC_H__ + +#include + +/**@brief Handles @ref sd_power_system_off command request. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + * @retval NRF_ERROR_NOT_SUPPORTED Handler failure. Opcode not supported. + */ +uint32_t conn_mw_power_system_off(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +/**@brief Handles @ref sd_temp_get command request and prepares response. + * + * @param[in] p_rx_buf Pointer to input buffer. + * @param[in] rx_buf_len Size of p_rx_buf. + * @param[out] p_tx_buf Pointer to output buffer. + * @param[in,out] p_tx_buf_len \c in: size of \p p_tx_buf buffer. + * \c out: Length of valid data in \p p_tx_buf. + * + * @retval NRF_SUCCESS Handler success. + * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type. + * @retval NRF_ERROR_NOT_SUPPORTED Handler failure. Opcode not supported. + */ +uint32_t conn_mw_temp_get(uint8_t const * const p_rx_buf, + uint32_t rx_buf_len, + uint8_t * const p_tx_buf, + uint32_t * const p_tx_buf_len); + +#endif diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_conn.h b/components/serialization/connectivity/codecs/s130/serializers/ble_conn.h new file mode 100644 index 0000000..7a13b1d --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_conn.h @@ -0,0 +1,447 @@ +/* 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. + * + */ +#ifndef BLE_CONN_H__ +#define BLE_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s130_codecs Connectivity s130 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_conn Connectivity command request decoders and command response encoders + * @{ + * @ingroup ser_conn_s130_codecs + * + * @brief Connectivity command request decoders and command response encoders. + */ +#include "ble.h" + +/**@brief Decodes @ref sd_ble_tx_buffer_count_get command request. + * + * @sa @ref nrf51_tx_buffer_count_get_encoding for packet format, + * @ref ble_tx_buffer_count_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_count Pointer to pointer to location for count. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_tx_buffer_count_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint8_t * * const pp_count); + +/**@brief Encodes @ref sd_ble_tx_buffer_count_get command response. + * + * @sa @ref nrf51_tx_buffer_count_get_encoding for packet format. + * @ref ble_tx_buffer_count_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_count Pointer to count value. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_tx_buffer_count_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint8_t const * const p_count); + +/**@brief Event encoding dispatcher. + * + * The event encoding dispatcher will route the event packet to the correct encoder which in turn + * encodes the contents of the event and updates the \p p_buf buffer. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + * @retval NRF_ERROR_NOT_SUPPORTED Event encoder is not implemented. + */ +uint32_t ble_event_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_version_get command request. + * + * @sa @ref nrf51_version_get_encoding for packet format, + * @ref ble_version_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_version Pointer to pointer to @ref ble_version_t address. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_version_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + ble_version_t * * const pp_version); + +/**@brief Encodes @ref sd_ble_version_get command response. + * + * @sa @ref nrf51_version_get_encoding for packet format. + * @ref ble_version_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_version Pointer to @ref ble_version_t address. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_version_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_version_t const * const p_version); + + +/**@brief Decodes @ref sd_ble_opt_get command request. + * + * @sa @ref nrf51_opt_get_encoding for packet format, + * @ref ble_opt_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_opt_id Pointer to pointer to @ref ble_version_t address. + * @param[out] pp_opt Pointer to pointer to @ref ble_opt_t address. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_opt_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint32_t * const p_opt_id, + ble_opt_t **const pp_opt ); + + +/**@brief Encodes @ref sd_ble_opt_get command response. + * + * @sa @ref nrf51_opt_get_encoding for packet format. + * @ref ble_opt_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] opt_id identifies type of ble_opt_t union + * @param[in] p_opt Pointer to @ref ble_opt_t union. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ + +uint32_t ble_opt_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint32_t opt_id, + ble_opt_t const * const p_opt); + + +/**@brief Decodes @ref sd_ble_opt_set command request. + * + * @sa @ref nrf51_opt_set_encoding for packet format, + * @ref ble_opt_set_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_opt_id Pointer to @ref ble_opt_t union type identifier. + * @param[out] pp_opt Pointer to pointer to @ref ble_opt_t union. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_opt_set_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint32_t * const p_opt_id, + ble_opt_t **const pp_opt ); + + +/**@brief Encodes @ref sd_ble_opt_set command response. + * + * @sa @ref nrf51_opt_set_encoding for packet format. + * @ref ble_opt_set_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ + +uint32_t ble_opt_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + + +/**@brief Decodes @ref sd_ble_uuid_encode command request. + * + * @sa @ref nrf51_uuid_encode_encoding for packet format, + * @ref ble_uuid_encode_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_uuid Pointer to pointer to @ref ble_uuid_t structure. + * @param[out] pp_uuid_le_len Pointer to pointer to the length of encoded UUID. + * @param[out] pp_uuid_le Pointer to pointer to buffer where encoded UUID will be stored. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_uuid_encode_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + ble_uuid_t * * const pp_uuid, + uint8_t * * const pp_uuid_le_len, + uint8_t * * const pp_uuid_le); + +/**@brief Encodes @ref sd_ble_uuid_encode command response. + * + * @sa @ref nrf51_uuid_encode_encoding for packet format. + * @ref ble_uuid_encode_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] uuid_le_len Length of the encoded UUID. + * @param[in] p_uuid_le Pointer to the buffer with encoded UUID. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_uuid_encode_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint8_t uuid_le_len, + uint8_t const * const p_uuid_le); + +/**@brief Decodes @ref sd_ble_uuid_decode command request. + * + * @sa @ref nrf51_uuid_decode_encoding for packet format, + * @ref ble_uuid_decode_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of response packet. + * @param[out] p_uuid_le_len Pointer to the length of encoded UUID. + * @param[out] pp_uuid_le Pointer to pointer to buffer where encoded UUID will be stored. + * @param[out] pp_uuid Pointer to pointer to @ref ble_uuid_t structure. + * \c It will be set to NULL if p_uuid is not present in the packet. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_uuid_decode_req_dec(uint8_t const * const p_buf, + uint32_t const buf_len, + uint8_t * p_uuid_le_len, + uint8_t * * const pp_uuid_le, + ble_uuid_t * * const pp_uuid); + +/**@brief Encodes @ref sd_ble_uuid_decode command response. + * + * @sa @ref nrf51_uuid_decode_encoding for packet format. + * @ref ble_uuid_decode_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_uuid Pointer to the buffer with encoded UUID. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_uuid_decode_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_uuid_t const * const p_uuid); + +/**@brief Decodes @ref sd_ble_uuid_vs_add command request. + * + * @sa @ref nrf51_uuid_vs_add_encoding for packet format, + * @ref ble_uuid_vs_add_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of response packet. + * @param[out] pp_uuid Pointer to pointer to UUID. + * \c It will be set to NULL if p_uuid is not present in the packet. + * @param[out] pp_uuid_type Pointer to pointer to UUID type. + * \c It will be set to NULL if p_uuid_type is not present in the packet. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_uuid_vs_add_req_dec(uint8_t const * const p_buf, + uint16_t buf_len, + ble_uuid128_t * * const pp_uuid, + uint8_t * * const pp_uuid_type); + +/**@brief Encodes @ref sd_ble_uuid_vs_add command response. + * + * @sa @ref nrf51_uuid_vs_add_encoding for packet format. + * @ref ble_uuid_vs_add_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_uuid_type Pointer to the UUID type. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_uuid_vs_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint8_t const * const p_uuid_type); + +/**@brief Decodes @ref sd_ble_enable command request. + * + * @sa @ref nrf51_enable_encoding for packet format, + * @ref ble_enable_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_ble_enable_params Pointer to pointer to ble_enable_params_t. + * \c It will be set to NULL if p_ble_enable_params is not present in the packet. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_enable_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_enable_params_t * * const pp_ble_enable_params); + +/**@brief Encodes @ref sd_ble_enable command response. + * + * @sa @ref nrf51_enable_encoding for packet format. + * @ref ble_enable_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_enable_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Pre-decodes opt_id of @ref ble_opt_t for middleware. + * + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] packet_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in,out] p_opt_id Pointer to opt_id which identifies type of @ref ble_opt_t union. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_opt_id_pre_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint32_t * const p_opt_id); + +/**@brief Decodes @ref sd_ble_user_mem_reply command request. + * + * @sa @ref nrf51_user_mem_reply_encoding for packet format, + * @ref ble_user_mem_reply_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[in] p_conn_handle Pointer to Connection Handle. + * @param[in,out] pp_block Pointer to pointer to ble_user_mem_block_t. + * \c It will be set to NULL if p_block is not present in the packet. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_user_mem_reply_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + ble_user_mem_block_t * * const pp_block); + +/**@brief Encodes @ref sd_ble_user_mem_reply command response. + * + * @sa @ref nrf51_user_mem_reply_encoding for packet format. + * @ref ble_user_mem_reply_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_user_mem_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** @} */ + +#endif diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_enable.c b/components/serialization/connectivity/codecs/s130/serializers/ble_enable.c new file mode 100644 index 0000000..da81437 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_enable.c @@ -0,0 +1,46 @@ +/* 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 +#include "ble_conn.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_enable_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_enable_params_t * * const pp_ble_enable_params) +{ + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_ble_enable_params); + SER_ASSERT_NOT_NULL(*pp_ble_enable_params); + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_ble_enable_params, ble_enable_params_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + +uint32_t ble_enable_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + return op_status_enc(SD_BLE_ENABLE, return_code, p_buf, p_buf_len, &index); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_event.c b/components/serialization/connectivity/codecs/s130/serializers/ble_event.c new file mode 100644 index 0000000..058cfa4 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_event.c @@ -0,0 +1,184 @@ +/* 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 "ble_conn.h" +#include "ble_evt_conn.h" +#include "ble_gap_evt_conn.h" +#include "ble_gattc_evt_conn.h" +#include "ble_gatts_evt_conn.h" +#include "ble_l2cap_evt_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_event_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t ret_val = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + SER_ASSERT_NOT_NULL(p_event); + + switch (p_event->header.evt_id) + { + case BLE_EVT_TX_COMPLETE: + ret_val = ble_evt_tx_complete_enc(p_event, event_len, p_buf, p_buf_len); + break; + case BLE_EVT_USER_MEM_RELEASE: + ret_val = ble_evt_user_mem_release_enc(p_event, event_len, p_buf, p_buf_len); + break; + case BLE_EVT_USER_MEM_REQUEST: + ret_val = ble_evt_user_mem_request_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_CONN_PARAM_UPDATE: + ret_val = ble_gap_evt_conn_param_update_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST: + ret_val = ble_gap_evt_conn_param_update_request_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_SEC_PARAMS_REQUEST: + ret_val = ble_gap_evt_sec_params_request_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_SEC_INFO_REQUEST: + ret_val = ble_gap_evt_sec_info_request_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_AUTH_STATUS: + ret_val = ble_gap_evt_auth_status_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_PASSKEY_DISPLAY: + ret_val = ble_gap_evt_passkey_display_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_AUTH_KEY_REQUEST: + ret_val = ble_gap_evt_auth_key_request_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_CONN_SEC_UPDATE: + ret_val = ble_gap_evt_conn_sec_update_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_RSSI_CHANGED: + ret_val = ble_gap_evt_rssi_changed_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_TIMEOUT: + ret_val = ble_gap_evt_timeout_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_DISCONNECTED: + ret_val = ble_gap_evt_disconnected_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_CONNECTED: + ret_val = ble_gap_evt_connected_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_SEC_REQUEST: + ret_val = ble_gap_evt_sec_request_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTC_EVT_CHAR_DISC_RSP: + ret_val = ble_gattc_evt_char_disc_rsp_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTC_EVT_DESC_DISC_RSP: + ret_val = ble_gattc_evt_desc_disc_rsp_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP: + ret_val = ble_gattc_evt_char_val_by_uuid_read_rsp_enc(p_event, + event_len, + p_buf, + p_buf_len); + break; + + case BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP: + ret_val = ble_gattc_evt_prim_srvc_disc_rsp_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTC_EVT_HVX: + ret_val = ble_gattc_evt_hvx_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTC_EVT_READ_RSP: + ret_val = ble_gattc_evt_read_rsp_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTC_EVT_TIMEOUT: + ret_val = ble_gattc_evt_timeout_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTC_EVT_WRITE_RSP: + ret_val = ble_gattc_evt_write_rsp_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTC_EVT_REL_DISC_RSP: + ret_val = ble_gattc_evt_rel_disc_rsp_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTC_EVT_CHAR_VALS_READ_RSP: + ret_val = ble_gattc_evt_char_vals_read_rsp_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTS_EVT_HVC: + ret_val = ble_gatts_evt_hvc_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTS_EVT_TIMEOUT: + ret_val = ble_gatts_evt_timeout_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTS_EVT_SC_CONFIRM: + ret_val = ble_gatts_evt_sc_confirm_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTS_EVT_WRITE: + ret_val = ble_gatts_evt_write_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST: + ret_val = ble_gatts_evt_rw_authorize_request_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GATTS_EVT_SYS_ATTR_MISSING: + ret_val = ble_gatts_evt_sys_attr_missing_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_L2CAP_EVT_RX: + ret_val = ble_l2cap_evt_rx_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_ADV_REPORT: + ret_val = ble_gap_evt_adv_report_enc(p_event, event_len, p_buf, p_buf_len); + break; + + case BLE_GAP_EVT_SCAN_REQ_REPORT: + ret_val = ble_gap_evt_scan_req_report_enc(p_event, event_len, p_buf, p_buf_len); + break; + + default: + ret_val = NRF_ERROR_NOT_SUPPORTED; + *p_buf_len = 0; + break; + } + + return ret_val; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_evt_conn.h b/components/serialization/connectivity/codecs/s130/serializers/ble_evt_conn.h new file mode 100644 index 0000000..b187b94 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_evt_conn.h @@ -0,0 +1,95 @@ +/* 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 BLE_EVT_CONN_H__ +#define BLE_EVT_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s130_codecs Connectivity s130 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_evt_conn Connectivity event encoders + * @{ + * @ingroup ser_conn_s130_codecs + * + * @brief Connectivity event encoders. + */ +#include "ble.h" + +/** + * @brief Encodes ble_evt_tx_complete event. + * + * @sa @ref nrf51_evt_tx_complete_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_evt_tx_complete_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_evt_user_mem_release event. + * + * @sa @ref nrf51_evt_user_mem_release_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_evt_user_mem_release_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_evt_user_mem_request event. + * + * @sa @ref nrf51_evt_user_mem_request_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_evt_user_mem_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); +/** @} */ +#endif diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_evt_tx_complete.c b/components/serialization/connectivity/codecs/s130/serializers/ble_evt_tx_complete.c new file mode 100644 index 0000000..f10dbf9 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_evt_tx_complete.c @@ -0,0 +1,38 @@ +/* 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 "ble.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_evt_tx_complete_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 2 + 1, *p_buf_len); + index += uint16_encode(BLE_EVT_TX_COMPLETE, &(p_buf[index])); + index += uint16_encode(p_event->evt.common_evt.conn_handle, &(p_buf[index])); + p_buf[index++] = p_event->evt.common_evt.params.tx_complete.count; + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_evt_user_mem_release.c b/components/serialization/connectivity/codecs/s130/serializers/ble_evt_user_mem_release.c new file mode 100644 index 0000000..5f4f3df --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_evt_user_mem_release.c @@ -0,0 +1,55 @@ +/* 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 "ble_evt_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" +#include "conn_ble_user_mem.h" + +uint32_t ble_evt_user_mem_release_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + + const uint16_t evt_header = BLE_EVT_USER_MEM_RELEASE; + + err_code = uint16_t_enc((void *)&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&p_event->evt.common_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc((void *)&(p_event->evt.common_evt.params.user_mem_release.type), p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&(p_event->evt.common_evt.params.user_mem_release.mem_block.len), p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + p_buf[index++] = p_event->evt.common_evt.params.user_mem_release.mem_block.p_mem ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; + + // Now user memory context can be released + err_code = conn_ble_user_mem_context_destroy(p_event->evt.common_evt.conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_evt_user_mem_request.c b/components/serialization/connectivity/codecs/s130/serializers/ble_evt_user_mem_request.c new file mode 100644 index 0000000..8faa98b --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_evt_user_mem_request.c @@ -0,0 +1,46 @@ +/* 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 "ble_evt_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_evt_user_mem_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + + const uint16_t evt_header = BLE_EVT_USER_MEM_REQUEST; + + err_code = uint16_t_enc((void *)&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc((void *)&(p_event->evt.common_evt.params.user_mem_request.type), p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_address_get.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_address_get.c new file mode 100644 index 0000000..f0dc9a5 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_address_get.c @@ -0,0 +1,79 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_address_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + ble_gap_addr_t * * const pp_address) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_address); + SER_ASSERT_LENGTH_LEQ(1 + 1, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_GAP_ADDRESS_GET, NRF_ERROR_INVALID_PARAM); + index++; + + if (p_buf[index++] == SER_FIELD_NOT_PRESENT) + { + *pp_address = NULL; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_address_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gap_addr_t const * const p_address) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_ADDRESS_GET, return_code, + p_buf, p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + uint32_t index = *p_buf_len; + + if (return_code != NRF_SUCCESS) + { + *p_buf_len = index; + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_address); + + SER_ASSERT_LENGTH_LEQ(index + sizeof (ble_gap_addr_t), total_len); + p_buf[index++] = p_address->addr_type; + memcpy(&p_buf[index], &p_address->addr[0], BLE_GAP_ADDR_LEN); + index += BLE_GAP_ADDR_LEN; + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_address_set.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_address_set.c new file mode 100644 index 0000000..8727a01 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_address_set.c @@ -0,0 +1,52 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_address_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * p_addr_cycle_mode, + ble_gap_addr_t * * const pp_addr) +{ + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_addr_cycle_mode); + SER_ASSERT_NOT_NULL(pp_addr); + SER_ASSERT_NOT_NULL(*pp_addr); + + err_code = uint8_t_dec(p_buf, packet_len, &index, p_addr_cycle_mode); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_addr, ble_gap_addr_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + +uint32_t ble_gap_address_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + return op_status_enc(SD_BLE_GAP_ADDRESS_SET, return_code, p_buf, p_buf_len, &index); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_adv_data_set.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_adv_data_set.c new file mode 100644 index 0000000..ab83ce0 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_adv_data_set.c @@ -0,0 +1,49 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_adv_data_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * * const pp_data, + uint8_t * p_dlen, + uint8_t * * const pp_sr_data, + uint8_t * p_srdlen) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_dlen); + SER_ASSERT_NOT_NULL(p_srdlen); + + uint32_t index = SER_CMD_DATA_POS; + + uint32_t error_code = len8data_dec(p_buf, packet_len, &index, pp_data, p_dlen); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + error_code = len8data_dec(p_buf, packet_len, &index, pp_sr_data, p_srdlen); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_adv_data_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_ADV_DATA_SET, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_adv_start.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_adv_start.c new file mode 100644 index 0000000..ad5b071 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_adv_start.c @@ -0,0 +1,88 @@ +/* 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 "ble_gap_conn.h" +#include +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_adv_start_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_adv_params_t * * const pp_adv_params) +{ + uint32_t index = 0, i = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_adv_params); + SER_ASSERT_NOT_NULL(*pp_adv_params); + SER_ASSERT_NOT_NULL((*pp_adv_params)->p_peer_addr); + SER_ASSERT_NOT_NULL((*pp_adv_params)->p_whitelist); + SER_ASSERT_NOT_NULL((*pp_adv_params)->p_whitelist->pp_addrs); + SER_ASSERT_NOT_NULL((*pp_adv_params)->p_whitelist->pp_irks); + + for (i = 0; i < BLE_GAP_WHITELIST_ADDR_MAX_COUNT; i++) + { + SER_ASSERT_NOT_NULL((*pp_adv_params)->p_whitelist->pp_addrs[i]); + } + + for (i = 0; i < BLE_GAP_WHITELIST_IRK_MAX_COUNT; i++) + { + SER_ASSERT_NOT_NULL((*pp_adv_params)->p_whitelist->pp_irks[i]); + } + + /* Packet with variable length. */ + /* For now check: opcode + indicator showing if ble_gap_adv_params_t struct is present. */ + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 1, packet_len); + SER_ASSERT(p_buf[index] == SD_BLE_GAP_ADV_START, NRF_ERROR_INVALID_PARAM); + index++; + + if (p_buf[index++] == SER_FIELD_PRESENT) + { + err_code = uint8_t_dec(p_buf, packet_len, &index, &((*pp_adv_params)->type)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void **) &((*pp_adv_params)->p_peer_addr), ble_gap_addr_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, packet_len, &index, &((*pp_adv_params)->fp)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void **) &((*pp_adv_params)->p_whitelist), ble_gap_whitelist_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, packet_len, &index, &((*pp_adv_params)->interval)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, packet_len, &index, &((*pp_adv_params)->timeout)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_adv_ch_mask_t_dec(p_buf, packet_len, &index, &((*pp_adv_params)->channel_mask)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + else + { + *pp_adv_params = NULL; + } + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + +uint32_t ble_gap_adv_start_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_ADV_START, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_adv_stop.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_adv_stop.c new file mode 100644 index 0000000..b3569a2 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_adv_stop.c @@ -0,0 +1,23 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_adv_stop_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_ADV_STOP, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_appearance_get.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_appearance_get.c new file mode 100644 index 0000000..cc828b5 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_appearance_get.c @@ -0,0 +1,76 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_appearance_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * * const pp_appearance) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_appearance); + SER_ASSERT_NOT_NULL(*pp_appearance); + SER_ASSERT_LENGTH_EQ(2, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_GAP_APPEARANCE_GET, NRF_ERROR_INVALID_PARAM); + index++; + + if (p_buf[index++] == SER_FIELD_NOT_PRESENT) + { + *pp_appearance = NULL; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_appearance_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t const * const p_appearance) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_APPEARANCE_GET, return_code, + p_buf, p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_appearance); + uint32_t index = *p_buf_len; + + SER_ASSERT_LENGTH_LEQ(index + sizeof (uint16_t), total_len); + index += uint16_encode(*p_appearance, &p_buf[index]); + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_appearance_set.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_appearance_set.c new file mode 100644 index 0000000..f393fdb --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_appearance_set.c @@ -0,0 +1,42 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" +#include "nrf_error.h" + + +uint32_t ble_gap_appearance_set_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * const p_appearance) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_appearance); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_LENGTH_EQ(3, buf_len); + SER_ASSERT(p_buf[index++] == SD_BLE_GAP_APPEARANCE_SET, NRF_ERROR_INVALID_PARAM); + + uint32_t err_code = uint16_t_dec(p_buf, buf_len, &index, p_appearance); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_appearance_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_APPEARANCE_SET, return_code, + p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_auth_key_reply.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_auth_key_reply.c new file mode 100644 index 0000000..988c711 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_auth_key_reply.c @@ -0,0 +1,68 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_auth_key_reply_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * p_conn_handle, + uint8_t * p_key_type, + uint8_t * * const pp_key) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_key_type); + + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code = NRF_SUCCESS; + uint8_t key_len; + + SER_ASSERT_LENGTH_LEQ(2, packet_len - index); + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + SER_ASSERT_LENGTH_LEQ(1, packet_len - index); + uint8_dec(p_buf, packet_len, &index, p_key_type); + + switch (*p_key_type) + { + case BLE_GAP_AUTH_KEY_TYPE_NONE: + key_len = 0; + break; + + case BLE_GAP_AUTH_KEY_TYPE_PASSKEY: + key_len = 6; + break; + + case BLE_GAP_AUTH_KEY_TYPE_OOB: + key_len = 16; + break; + + default: + return NRF_ERROR_INVALID_PARAM; + } + + err_code = buf_dec(p_buf, packet_len, &index, pp_key, key_len, key_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + return err_code; +} + +uint32_t ble_gap_auth_key_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_AUTH_KEY_REPLY, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_authenticate.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_authenticate.c new file mode 100644 index 0000000..4d7053e --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_authenticate.c @@ -0,0 +1,57 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "nordic_common.h" +#include "app_util.h" +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" + + +uint32_t ble_gap_authenticate_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + ble_gap_sec_params_t * * const pp_sec_params) +{ + uint32_t index = SER_CMD_DATA_POS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_sec_params); + SER_ASSERT_NOT_NULL(*pp_sec_params); + + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + packet_len, + &index, + (void * *)pp_sec_params, + ble_gap_sec_params_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + +uint32_t ble_gap_authenticate_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_AUTHENTICATE, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_conn.h b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_conn.h new file mode 100644 index 0000000..8c5ac79 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_conn.h @@ -0,0 +1,1043 @@ +/* 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. + * + */ +#ifndef BLE_GAP_CONN_H__ +#define BLE_GAP_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s130_codecs Connectivity s130 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gap_conn GAP Connectivity command request decoders and command response encoders + * @{ + * @ingroup ser_conn_s130_codecs + * + * @brief GAP Connectivity command request decoders and command response encoders + */ +#include "ble_gap.h" + +/**@brief Decodes @ref sd_ble_gap_address_get command request. + * + * @sa @ref nrf51_address_get_encoding for packet format, + * @ref ble_gap_address_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_address Pointer to pointer to address. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_address_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + ble_gap_addr_t * * const pp_address); + +/**@brief Encodes @ref sd_ble_gap_address_get command response. + * + * @sa @ref nrf51_address_get_encoding for packet format. + * @ref ble_gap_address_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_address Pointer to @ref ble_gap_addr_t address + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_address_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gap_addr_t const * const p_address); + +/**@brief Decodes @ref sd_ble_gap_authenticate command request. + * + * @sa @ref nrf51_ble_gap_authenticate_encoding for packet format, + * @ref ble_gap_authenticate_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle + * @param[out] pp_sec_params Pointer to pointer to security parameters. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_authenticate_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + ble_gap_sec_params_t * * const pp_sec_params); + +/**@brief Encodes @ref sd_ble_gap_authenticate command response. + * + * @sa @ref nrf51_ble_gap_authenticate_encoding for packet format. + * @ref ble_gap_authenticate_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_authenticate_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** @brief Decodes @ref sd_ble_gap_address_set command request. + * + * @sa @ref nrf51_gap_address_set_encoding for packet format, + * @ref ble_gap_address_set_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of request packet. + * @param[in] p_addr_cycle_mode Pointer to address cycle mode. + * @param[out] pp_addr Pointer to pointer to the address structure. + + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_address_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * p_addr_cycle_mode, + ble_gap_addr_t * * const pp_addr); + +/**@brief Encodes @ref sd_ble_gap_address_set command response. + * + * @sa @ref nrf51_gap_address_set_encoding for packet format. + * @ref ble_gap_address_set_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_address_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_adv_data_set command request. + * + * @sa @ref nrf51_adv_set_encoding for packet format, + * @ref ble_gap_adv_data_set_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of request packet. + * @param[out] pp_data Pointer to the buffer raw data to be placed in advertisement packet. + * @param[out] p_dlen Pointer to data length for p_data. + * @param[out] pp_sr_data Pointer to the buffer raw data to be placed in scan response packet. + * @param[out] p_srdlen Pointer to data length for p_sr_data. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_adv_data_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * * const pp_data, + uint8_t * p_dlen, + uint8_t * * const pp_sr_data, + uint8_t * p_srdlen); + +/**@brief Encodes @ref sd_ble_gap_adv_data_set command response. + * + * @sa @ref nrf51_adv_set_encoding for packet format. + * @ref ble_gap_adv_data_set_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_adv_data_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_adv_start command request. + * + * @sa @ref nrf51_adv_start_encoding for packet format, + * @ref ble_gap_adv_start_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_adv_params Pointer to pointer to advertising parameters. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_adv_start_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_adv_params_t * * const pp_adv_params); + +/**@brief Encodes @ref sd_ble_gap_adv_start command response. + * + * @sa @ref nrf51_adv_start_encoding for packet format. + * @ref ble_gap_adv_start_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_adv_start_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_device_name_get command request. + * + * @sa @ref nrf51_device_name_get_encoding for packet format, + * @ref ble_gap_device_name_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_dev_name Pointer to pointer to device name buffer. + * @param[out] pp_dev_name_len Pointer to pointer to device name length location. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_device_name_get_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint8_t * * pp_dev_name, + uint16_t * * pp_dev_name_len); + +/**@brief Encodes @ref sd_ble_gap_device_name_get command response. + * + * @sa @ref nrf51_device_name_get_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_dev_name Pointer to device name buffer. + * @param[in] dev_name_len Length of device name buffer. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buflen \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_device_name_get_rsp_enc(uint32_t return_code, + uint8_t const * const p_dev_name, + uint16_t dev_name_len, + uint8_t * const p_buf, + uint32_t * const p_buflen); + +/**@brief Decodes @ref sd_ble_gap_conn_param_update command request. + * + * @sa @ref nrf51_gap_conn_param_update_encoding for packet format, + * @ref ble_gap_conn_param_update_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] pp_conn_params Pointer to pointer to connection parameters. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for connection + * parameters field present. + */ +uint32_t ble_gap_conn_param_update_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * p_conn_handle, + ble_gap_conn_params_t * * const pp_conn_params); + +/**@brief Encodes @ref sd_ble_gap_conn_param_update command response. + * + * @sa @ref nrf51_gap_conn_param_update_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_conn_param_update_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + + +/**@brief Decodes @ref sd_ble_gap_disconnect command request. + * + * @sa @ref nrf51_disconnect_encoding for packet format, + * @ref ble_gap_disconnect_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[in] p_conn_handle Pointer to Connection Handle. + * @param[in] p_hci_status Pointer to HCI Status Code. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_disconnect_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint8_t * const p_hci_status); + +/**@brief Encodes @ref sd_ble_gap_disconnect command response. + * + * @sa @ref nrf51_disconnect_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_disconnect_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_tx_power_set command request. + * + * @sa @ref nrf51_tx_power_set_encoding for packet format, + * @ref ble_gap_tx_power_set_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[in] tx_power Pointer to TX power value. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_tx_power_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + int8_t * tx_power); + +/**@brief Encodes @ref sd_ble_gap_tx_power_set command response. + * + * @sa @ref nrf51_tx_power_set_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_tx_power_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_ppcp_set command request. + * + * @sa @ref nrf51_ppcp_set_encoding for packet format, + * @ref ble_gap_ppcp_set_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_conn_params Pointer to pointer to connection parameters to be set. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for connection + * parameters field present. + */ +uint32_t ble_gap_ppcp_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_conn_params_t * * const pp_conn_params); + +/**@brief Encodes @ref sd_ble_gap_ppcp_set command response. + * + * @sa @ref nrf51_ppcp_set_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_ppcp_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + + +/**@brief Decodes @ref sd_ble_gap_ppcp_get command request. + * + * @sa @ref nrf51_gap_ppcp_get_encoding for packet format, + * @ref ble_gap_ppcp_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_conn_params Pointer to pointer to ble_gap_conn_params_t. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_ppcp_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + ble_gap_conn_params_t * * const pp_conn_params); + +/**@brief Encodes @ref sd_ble_gap_ppcp_get command response. + * + * @sa @ref nrf51_gap_ppcp_get_encoding for packet format. + * @ref ble_gap_ppcp_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_conn_params Pointer to ble_gap_conn_params_t. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_ppcp_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gap_conn_params_t const * const p_conn_params); + +/**@brief Encodes @ref sd_ble_gap_adv_stop command response. + * + * @sa @ref nrf51_sd_ble_gap_adv_stop for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_adv_stop_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_auth_key_reply command request. + * + * @sa @ref nrf51_auth_key_reply_encoding for packet format, + * @ref ble_gap_auth_key_reply_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] p_key_type Pointer to key type. + * @param[out] pp_key Pointer to pointer to buffer for incoming key. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_auth_key_reply_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * p_conn_handle, + uint8_t * p_key_type, + uint8_t * * const pp_key); + +/**@brief Encodes @ref sd_ble_gap_auth_key_reply command response. + * + * @sa @ref nrf51_auth_key_reply_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_auth_key_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_sec_params_reply command request. + * + * @sa @ref nrf51_sec_params_reply_encoding for packet format, + * @ref ble_gap_sec_params_reply_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] p_sec_status Pointer to security status. + * @param[out] pp_sec_params Pointer to pointer to security parameters structure. + * @param[out] pp_sec_keyset Pointer to pointer to security keyset structure. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for connection + * parameters field present. + */ +uint32_t ble_gap_sec_params_reply_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * p_conn_handle, + uint8_t * p_sec_status, + ble_gap_sec_params_t * * const pp_sec_params, + ble_gap_sec_keyset_t * * const pp_sec_keyset); + +/**@brief Encodes @ref sd_ble_gap_sec_params_reply command response. + * + * @sa @ref nrf51_sec_params_reply_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in] p_sec_keyset Pointer to security keyset structure. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_sec_params_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gap_sec_keyset_t * const p_sec_keyset); + +/**@brief Decodes @ref sd_ble_gap_rssi_start command request. + * + * @sa @ref nrf51_rssi_start_encoding for packet format, + * @ref ble_gap_rssi_start_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] p_threshold_dbm Pointer to threshold in dBm. + * @param[out] p_skip_count Pointer to sample skip count. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_rssi_start_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * p_conn_handle, + uint8_t * p_threshold_dbm, + uint8_t * p_skip_count); + +/**@brief Encodes @ref sd_ble_gap_rssi_start command response. + * + * @sa @ref nrf51_rssi_start_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ + +uint32_t ble_gap_rssi_start_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_rssi_stop command request. + * + * @sa @ref nrf51_rssi_stop_encoding for packet format, + * @ref ble_gap_rssi_stop_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of response packet. + * @param[out] conn_handle Pointer to connection handle. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ + +uint32_t ble_gap_rssi_stop_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * conn_handle); + +/**@brief Encodes @ref sd_ble_gap_rssi_stop command response. + * + * @sa @ref nrf51_rssi_stop_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ + +uint32_t ble_gap_rssi_stop_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_appearance_get command request. + * + * @sa @ref nrf51_appearance_get_encoding for packet format, + * @ref ble_gap_appearance_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_appearance Pointer to pointer to uint16_t appearance. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_appearance_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * * const pp_appearance); + +/**@brief Encodes @ref sd_ble_gap_appearance_get command response. + * + * @sa @ref nrf51_appearance_get_encoding for packet format. + * @ref ble_gap_appearance_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_appearance Pointer to uint16_t appearance. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_appearance_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t const * const p_appearance); + + +/**@brief Decodes @ref sd_ble_gap_appearance_set command request. + * + * @sa @ref nrf51_appearance_set_encoding for packet format, + * @ref ble_gap_tx_power_set_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of the packet. + * @param[out] p_appearance Pointer to the appearance. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_appearance_set_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * const p_appearance); + +/**@brief Encodes @ref sd_ble_gap_appearance_set command response. + * + * @sa @ref nrf51_appearance_set_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_appearance_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + + +/**@brief Decodes @ref sd_ble_gap_sec_info_reply command request. + * + * @sa @ref nrf51_gap_sec_info_reply_encoding for packet format, + * @ref ble_gap_sec_info_reply_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of the packet. + * @param[out] p_conn_handle Pointer to the Connection Handle. + * @param[out] pp_enc_info Pointer to pointer to Encryption Information. + * @param[out] pp_id_info Pointer to pointer to Id Information. + * @param[out] pp_sign_info Pointer to pointer to Signing Information + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_sec_info_reply_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * p_conn_handle, + ble_gap_enc_info_t * * const pp_enc_info, + ble_gap_irk_t * * const pp_id_info, + ble_gap_sign_info_t * * const pp_sign_info); + +/**@brief Encodes @ref sd_ble_gap_sec_info_reply command response. + * + * @sa @ref nrf51_gap_sec_info_reply_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_sec_info_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_device_name_set command request. + * + * @sa @ref nrf51_device_name_set_encoding for packet format, + * @ref ble_gap_device_name_set_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of the packet. + * @param[out] pp_write_perm Pointer to pointer to write permissions filed. + * @param[out] pp_dev_name Pointer to pointer to device name string + * @param[out] p_dev_name_len Pointer to device name string length + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_device_name_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_conn_sec_mode_t * * const pp_write_perm, + uint8_t * * const pp_dev_name, + uint16_t * const p_dev_name_len); + + +/**@brief Encodes @ref sd_ble_gap_device_name_set command response. + * + * @sa @ref nrf51_device_name_set_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_device_name_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_conn_sec_get command request. + * + * @sa @ref nrf51_gap_conn_sec_get_encoding for packet format, + * @ref ble_gap_conn_sec_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to Connection Handle. + * @param[out] pp_conn_sec Pointer to pointer to @ref ble_gap_conn_sec_t to be filled by + * the softdevice. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_conn_sec_get_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * p_conn_handle, + ble_gap_conn_sec_t * * const pp_conn_sec); + +/**@brief Encodes @ref sd_ble_gap_conn_sec_get command response. + * + * @sa @ref nrf51_gap_conn_sec_get_encoding for packet format. + * @ref ble_gap_conn_sec_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_conn_sec Pointer to @ref ble_gap_conn_sec_t to be encoded. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_conn_sec_get_rsp_enc(uint32_t return_code, + ble_gap_conn_sec_t * const p_conn_sec, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Encodes @ref sd_ble_gap_scan_stop command response. + * + * @sa @ref nrf51_scan_stop_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_scan_stop_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_connect command request. + * + * @sa @ref nrf51_connect_encoding for packet format, + * @ref ble_gap_connect_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_addr Pointer to pointer to peer address @ref ble_gap_addr_t. + * @param[out] pp_scan_params Pointer to pointer to @ref ble_gap_scan_params_t. + * @param[out] pp_conn_params Pointer to pointer to @ref ble_gap_conn_params_t. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_connect_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_addr_t * * const pp_addr, + ble_gap_scan_params_t * * const pp_scan_params, + ble_gap_conn_params_t * * const pp_conn_params); + +/**@brief Encodes @ref sd_ble_gap_connect command response. + * + * @sa @ref nrf51_connect_encoding for packet format. + * @ref ble_gap_connect_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_connect_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_scan_start command request. + * + * @sa @ref nrf51_scan_start_encoding for packet format, + * @ref ble_gap_scan_start_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] pp_scan_params Pointer to pointer to @ref ble_gap_scan_params_t. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_scan_start_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_scan_params_t * * const pp_scan_params); + +/**@brief Encodes @ref sd_ble_gap_scan_start command response. + * + * @sa @ref nrf51_scan_start_encoding for packet format. + * @ref ble_gap_scan_start_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_scan_start_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Encodes @ref sd_ble_gap_connect_cancel command response. + * + * @sa @ref nrf51_connect_cancel_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_connect_cancel_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_encrypt command request. + * + * @sa @ref nrf51_gap_encrypt_encoding for packet format, + * @ref ble_gap_encrypt_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer connection_handle. + * @param[out] pp_master_id Pointer to pointer to @ref ble_gap_master_id_t. + * @param[out] pp_enc_info Pointer to pointer to @ref ble_gap_enc_info_t. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ + +uint32_t ble_gap_encrypt_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gap_master_id_t ** const pp_master_id, + ble_gap_enc_info_t ** const pp_enc_info); + +/**@brief Encodes @ref sd_ble_gap_encrypt command response. + * + * @sa @ref nrf51_gap_encrypt_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_encrypt_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gap_rssi_get command request. + * + * @sa @ref nrf51_rssi_get_encoding for packet format, + * @ref ble_gap_rssi_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[in] p_conn_handle Connection handle. + * @param[out] pp_rssi Pointer to pointer to rssi value. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gap_rssi_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * p_conn_handle, + int8_t * * const pp_rssi); + +/**@brief Encodes @ref sd_ble_gap_rssi_get command response. + * + * @sa @ref nrf51_rssi_get_encoding for packet format. + * @ref ble_gap_rssi_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] rssi RSSI value. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_rssi_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + int8_t rssi); + +/** @} */ +#endif diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_conn_param_update.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_conn_param_update.c new file mode 100644 index 0000000..38ac3fd --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_conn_param_update.c @@ -0,0 +1,71 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_conn_param_update_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * p_conn_handle, + ble_gap_conn_params_t * * const pp_conn_params) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_conn_params); + SER_ASSERT_NOT_NULL(*pp_conn_params); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 3, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_GAP_CONN_PARAM_UPDATE, NRF_ERROR_INVALID_PARAM); + + index++; + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + if (p_buf[index] == SER_FIELD_PRESENT) + { + index++; + SER_ASSERT_LENGTH_LEQ(index + 8, packet_len); + uint16_dec(p_buf, packet_len, &index, &((*pp_conn_params)->min_conn_interval)); + uint16_dec(p_buf, packet_len, &index, &((*pp_conn_params)->max_conn_interval)); + uint16_dec(p_buf, packet_len, &index, &((*pp_conn_params)->slave_latency)); + uint16_dec(p_buf, packet_len, &index, &((*pp_conn_params)->conn_sup_timeout)); + } + else if (p_buf[index] == SER_FIELD_NOT_PRESENT) + { + index++; + *pp_conn_params = NULL; + } + else + { + return NRF_ERROR_INVALID_DATA; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_conn_param_update_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_CONN_PARAM_UPDATE, + return_code, + p_buf, + p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_conn_sec_get.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_conn_sec_get.c new file mode 100644 index 0000000..d3631ee --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_conn_sec_get.c @@ -0,0 +1,75 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" + + +uint32_t ble_gap_conn_sec_get_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * p_conn_handle, + ble_gap_conn_sec_t * * const pp_conn_sec) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + + uint32_t index = 0; + uint8_t opcode; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, packet_len - index); + uint8_dec(p_buf, packet_len, &index, &opcode); + + SER_ASSERT(opcode == SD_BLE_GAP_CONN_SEC_GET, NRF_ERROR_INVALID_PARAM); + + SER_ASSERT_LENGTH_LEQ(2, packet_len - index); + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_conn_sec, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + +uint32_t ble_gap_conn_sec_get_rsp_enc(uint32_t return_code, + ble_gap_conn_sec_t * const p_conn_sec, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t buflen = *p_buf_len; + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_CONN_SEC_GET, return_code, + p_buf, p_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + uint32_t index = *p_buf_len; + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + err_code = cond_field_enc(p_conn_sec, p_buf, buflen, &index, ble_gap_conn_sec_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_connect.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_connect.c new file mode 100644 index 0000000..e7b6135 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_connect.c @@ -0,0 +1,55 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_connect_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_addr_t * * const pp_addr, + ble_gap_scan_params_t * * const pp_scan_params, + ble_gap_conn_params_t * * const pp_conn_params) +{ + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_addr); + SER_ASSERT_NOT_NULL(*pp_addr); + SER_ASSERT_NOT_NULL(pp_scan_params); + SER_ASSERT_NOT_NULL(*pp_scan_params); + SER_ASSERT_NOT_NULL(pp_conn_params); + SER_ASSERT_NOT_NULL(*pp_conn_params); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_addr, ble_gap_addr_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_scan_params, ble_gap_scan_params_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_conn_params, ble_gap_conn_params_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + +uint32_t ble_gap_connect_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_CONNECT, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_connect_cancel.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_connect_cancel.c new file mode 100644 index 0000000..4551fcd --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_connect_cancel.c @@ -0,0 +1,25 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_connect_cancel_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_CONNECT_CANCEL, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_device_name_get.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_device_name_get.c new file mode 100644 index 0000000..e169d02 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_device_name_get.c @@ -0,0 +1,92 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" +#include "nrf_error.h" + +uint32_t ble_gap_device_name_get_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint8_t * * pp_name, + uint16_t * * pp_name_len) +{ + uint32_t index = 0; + uint32_t err_code; + + SER_ASSERT_NOT_NULL(pp_name_len); + SER_ASSERT_NOT_NULL(*pp_name_len); + + SER_ASSERT_LENGTH_LEQ(index + 1, buf_len); + + index++; + + if (p_buf[index] != SER_FIELD_PRESENT && p_buf[index] != SER_FIELD_NOT_PRESENT) + { + return NRF_ERROR_INVALID_PARAM; + } + + if (p_buf[index++] == SER_FIELD_PRESENT) + { + err_code = uint16_t_dec(p_buf, buf_len, &index, *pp_name_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + else + { + *pp_name_len = NULL; + } + + SER_ASSERT_LENGTH_LEQ(index + 1, buf_len); + + if (p_buf[index] != SER_FIELD_PRESENT && p_buf[index] != SER_FIELD_NOT_PRESENT) + { + return NRF_ERROR_INVALID_PARAM; + } + + if (p_buf[index] == SER_FIELD_NOT_PRESENT) + { + *pp_name = NULL; + } + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_device_name_get_rsp_enc(uint32_t return_code, + uint8_t const * const p_dev_name, + uint16_t dev_name_len, + uint8_t * const p_buf, + uint32_t * const p_buflen) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buflen); + + uint32_t buflen = *p_buflen; + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_DEVICE_NAME_GET, return_code, + p_buf, p_buflen); + uint32_t index = *p_buflen; + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + err_code = len16data_enc(p_dev_name, dev_name_len, p_buf, buflen, &index); + + *p_buflen = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_device_name_set.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_device_name_set.c new file mode 100644 index 0000000..84c49ff --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_device_name_set.c @@ -0,0 +1,61 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" +#include "ble_gap_struct_serialization.h" +#include "cond_field_serialization.h" + +uint32_t ble_gap_device_name_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_conn_sec_mode_t * * const pp_write_perm, + uint8_t * * const pp_dev_name, + uint16_t * const p_dev_name_len) +{ + SER_ASSERT_NOT_NULL(p_buf); //check if *p_buf is allocated + SER_ASSERT_NOT_NULL(pp_write_perm); //check if *pp_write_perm exist + SER_ASSERT_NOT_NULL(pp_dev_name); //check if *pp_dev_name exist + SER_ASSERT_NOT_NULL(p_dev_name_len); //check if *p_dev_name_len exist + + uint32_t index = SER_CMD_DATA_POS; + uint32_t status_code; + + SER_ASSERT_LENGTH_LEQ(4, packet_len - index); //make sure that payload is at least 4 bytes + + //decode optional write permissions field + status_code = cond_field_dec(p_buf, + packet_len, + &index, + (void * *)pp_write_perm, + ble_gap_conn_sec_mode_dec); + SER_ASSERT(status_code == NRF_SUCCESS, status_code); + + //decode optional device name field + status_code = len16data_dec(p_buf, packet_len, &index, pp_dev_name, p_dev_name_len); + SER_ASSERT(status_code == NRF_SUCCESS, status_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + return status_code; +} + + +uint32_t ble_gap_device_name_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_DEVICE_NAME_SET, + return_code, + p_buf, + p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_disconnect.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_disconnect.c new file mode 100644 index 0000000..e69a0d0 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_disconnect.c @@ -0,0 +1,52 @@ +/* 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 +#include "ble_gap_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_disconnect_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint8_t * const p_hci_status) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_hci_status); + + uint8_t opcode; + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint8_t_dec(p_buf, packet_len, &index, &opcode); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + SER_ASSERT(opcode == SD_BLE_GAP_DISCONNECT, NRF_ERROR_INVALID_PARAM); + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, packet_len, &index, p_hci_status); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + +uint32_t ble_gap_disconnect_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_DISCONNECT, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_encrypt.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_encrypt.c new file mode 100644 index 0000000..3cf0262 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_encrypt.c @@ -0,0 +1,60 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" +#include "ble_gap_struct_serialization.h" +#include "cond_field_serialization.h" + +uint32_t ble_gap_encrypt_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gap_master_id_t ** const pp_master_id, + ble_gap_enc_info_t ** const pp_enc_info) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_enc_info); + SER_ASSERT_NOT_NULL(pp_master_id); + SER_ASSERT_NOT_NULL(*pp_enc_info); + SER_ASSERT_NOT_NULL(*pp_master_id); + + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(2, packet_len - index); + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + err_code = cond_field_dec(p_buf, + packet_len, + &index, + (void **)pp_master_id, + ble_gap_master_id_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + packet_len, + &index, + (void **)pp_enc_info, + ble_gap_enc_info_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + +uint32_t ble_gap_encrypt_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_ENCRYPT, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_adv_report.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_adv_report.c new file mode 100644 index 0000000..fa6cd3f --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_adv_report.c @@ -0,0 +1,61 @@ +/* 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 "ble.h" +#include "ble_gap_evt_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_adv_report_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + uint8_t byte; + const uint16_t evt_header = BLE_GAP_EVT_ADV_REPORT; + + err_code = uint16_t_enc((void *)&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_addr_enc((void *)&(p_event->evt.gap_evt.params.adv_report.peer_addr), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc((void *)&(p_event->evt.gap_evt.params.adv_report.rssi), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + byte = (p_event->evt.gap_evt.params.adv_report.scan_rsp) | + ((p_event->evt.gap_evt.params.adv_report.type) << 0x01) | + ((p_event->evt.gap_evt.params.adv_report.dlen) << 0x03); + + err_code = uint8_t_enc((void *)&(byte), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_vector_enc(p_event->evt.gap_evt.params.adv_report.data, (uint16_t)p_event->evt.gap_evt.params.adv_report.dlen, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_auth_key_request.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_auth_key_request.c new file mode 100644 index 0000000..7805879 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_auth_key_request.c @@ -0,0 +1,49 @@ +/* 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 "ble.h" +#include "ble_gap_evt_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_evt_auth_key_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + uint16_t evt_header = BLE_GAP_EVT_AUTH_KEY_REQUEST; + + err_code = uint16_t_enc(&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc(&p_event->evt.gap_evt.params.auth_key_request.key_type, + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_auth_status.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_auth_status.c new file mode 100644 index 0000000..59a751a --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_auth_status.c @@ -0,0 +1,62 @@ +/* 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 +#include "ble_serialization.h" +#include "app_util.h" +#include "ble.h" +#include "ble_gap_struct_serialization.h" +#include "ble_gap_evt_conn.h" +#include "conn_ble_gap_sec_keys.h" + +extern ser_ble_gap_conn_keyset_t m_conn_keys_table[]; + +uint32_t ble_gap_evt_auth_status_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint16_t evt_header = BLE_GAP_EVT_AUTH_STATUS; + uint32_t total_len; + uint32_t err_code = NRF_SUCCESS; + uint32_t conn_index; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + total_len = *p_buf_len; + + err_code = uint16_t_enc(&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_auth_status_t_enc(&(p_event->evt.gap_evt.params.auth_status), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + // keyset is an extension of standard event data - used to synchronize keys at application + err_code = conn_ble_gap_sec_context_find(p_event->evt.gap_evt.conn_handle, &conn_index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_sec_keyset_t_enc(&(m_conn_keys_table[conn_index].keyset), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = conn_ble_gap_sec_context_destroy(p_event->evt.gap_evt.conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + return err_code; +} + diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_conn.h b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_conn.h new file mode 100644 index 0000000..b4233f6 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_conn.h @@ -0,0 +1,336 @@ +/* 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 BLE_GAP_EVT_CONN_H__ +#define BLE_GAP_EVT_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s130_codecs Connectivity s130 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gap_evt_conn GAP Connectivity event encoders + * @{ + * @ingroup ser_conn_s130_codecs + * + * @brief GAP Connectivity event encoders. + */ +#include "ble.h" + +/** + * @brief Encodes ble_gap_evt_auth_key_request event. + * + * @sa @ref nrf51_evt_auth_key_request_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_auth_key_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_auth_status event. + * + * @sa @ref nrf51_evt_auth_status_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_auth_status_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_conn_param_update event. + * + * @sa @ref nrf51_evt_conn_param_update_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_conn_param_update_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_conn_sec_update event. + * + * @sa @ref nrf51_evt_conn_sec_update_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_conn_sec_update_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_connected event. + * + * @sa @ref nrf51_evt_connected_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_connected_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_disconnected event. + * + * @sa @ref nrf51_evt_disconnected_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_disconnected_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_passkey_display event. + * + * @sa @ref nrf51_evt_passkey_display for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_passkey_display_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_rssi_changed event. + * + * @sa @ref nrf51_evt_rssi_changed_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_rssi_changed_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_sec_info_request event. + * + * @sa @ref nrf51_evt_sec_info_request_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_sec_info_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_sec_params_request event. + * + * @sa @ref nrf51_evt_sec_param_request_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_sec_params_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_timeout event. + * + * @sa @ref nrf51_evt_timeout_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_timeout_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_sec_request event. + * + * @sa @ref nrf51_evt_sec_request_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_sec_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_conn_param_update_request event. + * + * @sa @ref nrf51_evt_conn_param_update_request_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_conn_param_update_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_adv_report event. + * + * @sa @ref nrf51_evt_adv_report_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_adv_report_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gap_evt_scan_req_report event. + * + * @sa @ref nrf51_evt_scan_req_report_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gap_evt_scan_req_report_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** @} */ +#endif diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_conn_param_update.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_conn_param_update.c new file mode 100644 index 0000000..a9565dc --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_conn_param_update.c @@ -0,0 +1,49 @@ +/* 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 "ble.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" +#include "ble_gap_evt_conn.h" + + +uint32_t ble_gap_evt_conn_param_update_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + SER_ASSERT(p_event->header.evt_id == BLE_GAP_EVT_CONN_PARAM_UPDATE, NRF_ERROR_INVALID_PARAM); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&p_event->header.evt_id, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_conn_param_update_t_enc(&p_event->evt.gap_evt.params.conn_param_update, + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_conn_param_update_request.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_conn_param_update_request.c new file mode 100644 index 0000000..5843ff3 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_conn_param_update_request.c @@ -0,0 +1,49 @@ +/* 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 "ble.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" +#include "ble_gap_evt_conn.h" + + +uint32_t ble_gap_evt_conn_param_update_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + SER_ASSERT(p_event->header.evt_id == BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST, NRF_ERROR_INVALID_PARAM); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&p_event->header.evt_id, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_conn_param_update_request_t_enc(&p_event->evt.gap_evt.params.conn_param_update_request, + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_conn_sec_update.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_conn_sec_update.c new file mode 100644 index 0000000..8293866 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_conn_sec_update.c @@ -0,0 +1,51 @@ +/* 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 "ble.h" +#include "ble_gap_evt_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_conn_sec_update_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + const uint16_t evt_header = BLE_GAP_EVT_CONN_SEC_UPDATE; + + err_code = uint16_t_enc((void *)&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_conn_sec_update_t_enc( + (void *)&p_event->evt.gap_evt.params.conn_sec_update, + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_connected.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_connected.c new file mode 100644 index 0000000..16cea4f --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_connected.c @@ -0,0 +1,49 @@ +/* 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 "ble.h" +#include "ble_gap_evt_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_evt_connected_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + uint16_t evt_header = BLE_GAP_EVT_CONNECTED; + + err_code = uint16_t_enc((void *)&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_connected_t_enc((void *)&p_event->evt.gap_evt.params.connected, + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_disconnected.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_disconnected.c new file mode 100644 index 0000000..a067462 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_disconnected.c @@ -0,0 +1,49 @@ +/* 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 +#include "ble_serialization.h" +#include "app_util.h" +#include "ble.h" +#include "ble_gap_struct_serialization.h" +#include "ble_gap_evt_conn.h" + +uint32_t ble_gap_evt_disconnected_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code; + uint16_t evt_header = BLE_GAP_EVT_DISCONNECTED; + + err_code = uint16_t_enc(&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&(p_event->evt.gap_evt.conn_handle), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_disconnected_t_enc((void *)&(p_event->evt.gap_evt.params.disconnected), + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_passkey_display.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_passkey_display.c new file mode 100644 index 0000000..1fcaab5 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_passkey_display.c @@ -0,0 +1,43 @@ +/* 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 +#include "ble_serialization.h" +#include "app_util.h" +#include "ble.h" +#include "ble_gap_evt_conn.h" + +#define PASSKEY_LEN sizeof (p_event->evt.gap_evt.params.passkey_display.passkey) + + +uint32_t ble_gap_evt_passkey_display_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 2 + PASSKEY_LEN, *p_buf_len); + index += uint16_encode(BLE_GAP_EVT_PASSKEY_DISPLAY, &(p_buf[index])); + index += uint16_encode(p_event->evt.gap_evt.conn_handle, &(p_buf[index])); + + memcpy(&p_buf[index], p_event->evt.gap_evt.params.passkey_display.passkey, PASSKEY_LEN); + index += PASSKEY_LEN; + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_rssi_changed.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_rssi_changed.c new file mode 100644 index 0000000..6ee6a94 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_rssi_changed.c @@ -0,0 +1,38 @@ +/* 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 "ble.h" +#include "ble_serialization.h" +#include "app_util.h" +#include "ble_gap_evt_conn.h" + + +uint32_t ble_gap_evt_rssi_changed_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 2 + 1, *p_buf_len); + index += uint16_encode(BLE_GAP_EVT_RSSI_CHANGED, &(p_buf[index])); + index += uint16_encode(p_event->evt.gap_evt.conn_handle, &(p_buf[index])); + p_buf[index++] = p_event->evt.gap_evt.params.rssi_changed.rssi; + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_scan_req_report.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_scan_req_report.c new file mode 100644 index 0000000..9707495 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_scan_req_report.c @@ -0,0 +1,49 @@ +/* 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 "ble.h" +#include "ble_gap_evt_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" + + +uint32_t ble_gap_evt_scan_req_report_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + const uint16_t evt_header = BLE_GAP_EVT_SCAN_REQ_REPORT; + + err_code = uint16_t_enc((void *)&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_addr_enc((void *)&(p_event->evt.gap_evt.params.scan_req_report.peer_addr), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_enc((void *)&(p_event->evt.gap_evt.params.scan_req_report.rssi), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_sec_info_request.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_sec_info_request.c new file mode 100644 index 0000000..e3b7949 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_sec_info_request.c @@ -0,0 +1,51 @@ +/* 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 "ble.h" +#include "ble_gap_evt_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_sec_info_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + const uint16_t evt_header = BLE_GAP_EVT_SEC_INFO_REQUEST; + + err_code = uint16_t_enc((void *)&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_sec_info_request_t_enc( + (void *)&p_event->evt.gap_evt.params.sec_info_request, + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_sec_params_request.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_sec_params_request.c new file mode 100644 index 0000000..f2fdf59 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_sec_params_request.c @@ -0,0 +1,51 @@ +/* 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 "ble.h" +#include "ble_gap_evt_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_evt_sec_params_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + const uint16_t evt_header = BLE_GAP_EVT_SEC_PARAMS_REQUEST; + + err_code = uint16_t_enc((void *)&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_sec_params_request_t_enc( + (void *)&p_event->evt.gap_evt.params.sec_params_request, + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_sec_request.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_sec_request.c new file mode 100644 index 0000000..6a744b0 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_sec_request.c @@ -0,0 +1,49 @@ +/* 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 +#include "ble.h" +#include "ble_gap_evt_conn.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_gap_evt_sec_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + uint16_t evt_header = BLE_GAP_EVT_SEC_REQUEST; + + err_code = uint16_t_enc((void *)&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc((void *)&p_event->evt.gap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gap_evt_sec_request_t_enc((void *)&p_event->evt.gap_evt.params.sec_request, + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_timeout.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_timeout.c new file mode 100644 index 0000000..7894cdc --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_evt_timeout.c @@ -0,0 +1,38 @@ +/* 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 "ble.h" +#include "ble_serialization.h" +#include "app_util.h" +#include "ble_gap_evt_conn.h" + + +uint32_t ble_gap_evt_timeout_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_HEADER_SIZE + 3, *p_buf_len); + index += uint16_encode(BLE_GAP_EVT_TIMEOUT, &(p_buf[index])); + index += uint16_encode(p_event->evt.gap_evt.conn_handle, &(p_buf[index])); + p_buf[index++] = p_event->evt.gap_evt.params.timeout.src; + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_ppcp_get.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_ppcp_get.c new file mode 100644 index 0000000..38663fc --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_ppcp_get.c @@ -0,0 +1,80 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_ppcp_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + ble_gap_conn_params_t * * const pp_conn_params) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_conn_params); + SER_ASSERT_NOT_NULL(*pp_conn_params); + SER_ASSERT_LENGTH_LEQ(2, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_GAP_PPCP_GET, NRF_ERROR_INVALID_PARAM); + index++; + + if (p_buf[index++] == SER_FIELD_NOT_PRESENT) + { + *pp_conn_params = NULL; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_ppcp_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gap_conn_params_t const * const p_conn_params) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_PPCP_GET, return_code, + p_buf, p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_conn_params); + uint32_t index = *p_buf_len; + + SER_ASSERT_LENGTH_LEQ(index + 8, total_len); + + index += uint16_encode(p_conn_params->min_conn_interval, &p_buf[index]); + index += uint16_encode(p_conn_params->max_conn_interval, &p_buf[index]); + index += uint16_encode(p_conn_params->slave_latency, &p_buf[index]); + index += uint16_encode(p_conn_params->conn_sup_timeout, &p_buf[index]); + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_ppcp_set.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_ppcp_set.c new file mode 100644 index 0000000..e09aaf2 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_ppcp_set.c @@ -0,0 +1,64 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "nordic_common.h" +#include "app_util.h" + + +uint32_t ble_gap_ppcp_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_conn_params_t * * const pp_conn_params) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_conn_params); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 1, packet_len); + SER_ASSERT(p_buf[index] == SD_BLE_GAP_PPCP_SET, NRF_ERROR_INVALID_PARAM); + + index++; + + switch (p_buf[index++]) + { + case SER_FIELD_NOT_PRESENT: + *pp_conn_params = NULL; + break; + + case SER_FIELD_PRESENT: + SER_ASSERT_LENGTH_LEQ(index + 8, packet_len); + SER_ASSERT_NOT_NULL(*pp_conn_params); + uint16_dec(p_buf, packet_len, &index, &(*pp_conn_params)->min_conn_interval); + uint16_dec(p_buf, packet_len, &index, &(*pp_conn_params)->max_conn_interval); + uint16_dec(p_buf, packet_len, &index, &(*pp_conn_params)->slave_latency); + uint16_dec(p_buf, packet_len, &index, &(*pp_conn_params)->conn_sup_timeout); + break; + + default: + return NRF_ERROR_INVALID_DATA; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gap_ppcp_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_PPCP_SET, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_rssi_get.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_rssi_get.c new file mode 100644 index 0000000..306caa2 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_rssi_get.c @@ -0,0 +1,77 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_rssi_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * p_conn_handle, + int8_t * * const pp_rssi) +{ + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_rssi); + SER_ASSERT_NOT_NULL(*pp_rssi); + SER_ASSERT_LENGTH_LEQ(3, packet_len); + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void **) pp_rssi, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + +uint32_t ble_gap_rssi_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + int8_t rssi) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_RSSI_GET, return_code, + p_buf, p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + uint32_t index = *p_buf_len; + + err_code = uint8_t_enc((uint8_t *) &rssi, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_rssi_start.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_rssi_start.c new file mode 100644 index 0000000..cd6f516 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_rssi_start.c @@ -0,0 +1,49 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" + +uint32_t ble_gap_rssi_start_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * p_conn_handle, + uint8_t * p_threshold_dbm, + uint8_t * p_skip_count) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_threshold_dbm); + SER_ASSERT_NOT_NULL(p_skip_count); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = SER_CMD_DATA_POS; + + err_code = uint16_t_dec(p_buf, buf_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, buf_len, &index, p_threshold_dbm); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, buf_len, &index, p_skip_count); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} + +uint32_t ble_gap_rssi_start_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_RSSI_START, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_rssi_stop.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_rssi_stop.c new file mode 100644 index 0000000..d068f3d --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_rssi_stop.c @@ -0,0 +1,39 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" + +uint32_t ble_gap_rssi_stop_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * p_conn_handle) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = SER_CMD_DATA_POS; + + err_code = uint16_t_dec(p_buf, buf_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return NRF_SUCCESS; +} + +uint32_t ble_gap_rssi_stop_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_RSSI_STOP, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_scan_start.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_scan_start.c new file mode 100644 index 0000000..b561d3c --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_scan_start.c @@ -0,0 +1,44 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_scan_start_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + ble_gap_scan_params_t * * const pp_scan_params) +{ + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_scan_params); + SER_ASSERT_NOT_NULL(*pp_scan_params); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_scan_params, ble_gap_scan_params_t_dec); + + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + +uint32_t ble_gap_scan_start_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_SCAN_START, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_scan_stop.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_scan_stop.c new file mode 100644 index 0000000..a390f17 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_scan_stop.c @@ -0,0 +1,23 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_scan_stop_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_SCAN_STOP, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_sec_info_reply.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_sec_info_reply.c new file mode 100644 index 0000000..3e85479 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_sec_info_reply.c @@ -0,0 +1,72 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" +#include "ble_gap_struct_serialization.h" +#include "cond_field_serialization.h" + +uint32_t ble_gap_sec_info_reply_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * p_conn_handle, + ble_gap_enc_info_t * * const pp_enc_info, + ble_gap_irk_t * * const pp_id_info, + ble_gap_sign_info_t * * const pp_sign_info) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_enc_info); + SER_ASSERT_NOT_NULL(pp_id_info); + SER_ASSERT_NOT_NULL(pp_sign_info); + SER_ASSERT_NOT_NULL(*pp_enc_info); + SER_ASSERT_NOT_NULL(*pp_id_info); + SER_ASSERT_NOT_NULL(*pp_sign_info); + + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(2, packet_len - index); + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + err_code = cond_field_dec(p_buf, + packet_len, + &index, + (void * *)pp_enc_info, + ble_gap_enc_info_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + packet_len, + &index, + (void * *)pp_id_info, + ble_gap_irk_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + packet_len, + &index, + (void * *)pp_sign_info, + ble_gap_sign_info_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + return err_code; +} + +uint32_t ble_gap_sec_info_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_SEC_INFO_REPLY, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_sec_params_reply.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_sec_params_reply.c new file mode 100644 index 0000000..0c295be --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_sec_params_reply.c @@ -0,0 +1,90 @@ +/* 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 "ble_gap_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + + +uint32_t ble_gap_sec_params_reply_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * p_conn_handle, + uint8_t * p_sec_status, + ble_gap_sec_params_t * * const pp_sec_params, + ble_gap_sec_keyset_t * * const pp_sec_keyset) +{ + uint32_t index = SER_CMD_HEADER_SIZE; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_sec_status); + SER_ASSERT_NOT_NULL(pp_sec_params); + SER_ASSERT_NOT_NULL(*pp_sec_params); + SER_ASSERT_NOT_NULL(pp_sec_keyset); + SER_ASSERT_NOT_NULL(*pp_sec_keyset); + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint8_t_dec(p_buf, packet_len, &index, p_sec_status); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *) pp_sec_params, ble_gap_sec_params_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *) pp_sec_keyset, ble_gap_sec_keyset_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + +//opcode: 0x7F +uint32_t ble_gap_sec_params_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gap_sec_keyset_t * const p_sec_keyset) +{ + uint32_t index = 0; + uint32_t buf_len = * p_buf_len; + uint32_t err_code = NRF_SUCCESS; + + err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_SEC_PARAMS_REPLY, + return_code, + p_buf, + p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_sec_keyset); + index = *p_buf_len; + + err_code = cond_field_enc(p_sec_keyset, p_buf, buf_len, &index, ble_gap_sec_keyset_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gap_tx_power_set.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_tx_power_set.c new file mode 100644 index 0000000..6af4f31 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gap_tx_power_set.c @@ -0,0 +1,39 @@ +/* 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 "ble_gap_conn.h" +#include "ble_serialization.h" + +uint32_t ble_gap_tx_power_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + int8_t * p_tx_power) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_tx_power); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = SER_CMD_DATA_POS; + + err_code = uint8_t_dec(p_buf, packet_len, &index, p_tx_power); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + +uint32_t ble_gap_tx_power_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GAP_TX_POWER_SET, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_char_value_by_uuid_read.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_char_value_by_uuid_read.c new file mode 100644 index 0000000..6fbc19d --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_char_value_by_uuid_read.c @@ -0,0 +1,65 @@ +/* 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 "ble_gattc_conn.h" +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "ble_gattc_struct_serialization.h" +#include "cond_field_serialization.h" +#include "ble_types.h" +#include + +uint32_t ble_gattc_char_value_by_uuid_read_req_dec( + uint8_t const * const p_buf, + uint16_t buf_len, + uint16_t * const p_conn_handle, + ble_uuid_t * * const pp_uuid, + ble_gattc_handle_range_t * * const + pp_handle_range) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_uuid); + SER_ASSERT_NOT_NULL(*pp_uuid); + SER_ASSERT_NOT_NULL(pp_handle_range); + SER_ASSERT_NOT_NULL(*pp_handle_range); + + uint32_t index = 0; + uint32_t err_code; + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 2, buf_len); + SER_ASSERT(p_buf[index] == SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, NRF_ERROR_INVALID_DATA); + index++; + + uint16_dec(p_buf, buf_len, &index, p_conn_handle); + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_uuid, ble_uuid_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_handle_range, + ble_gattc_handle_range_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} + + +uint32_t ble_gattc_char_value_by_uuid_read_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, return_code, + p_buf, p_buf_len); +} + diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_char_values_read.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_char_values_read.c new file mode 100644 index 0000000..39c6808 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_char_values_read.c @@ -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. + * + */ + +#include + +#include "ble_gatts_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gattc_char_values_read_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * * const pp_handles, + uint16_t * const p_handle_count) +{ + SER_ASSERT_NOT_NULL(p_buf); //check if *p_buf is allocated + SER_ASSERT_NOT_NULL(p_conn_handle); //check if *p_conn_handle exist + SER_ASSERT_NOT_NULL(pp_handles); //check if *p_handles exist + SER_ASSERT_NOT_NULL(*pp_handles); //check if p_handles exist + SER_ASSERT_NOT_NULL(p_handle_count); //check if *p_handle_count exist + + uint32_t index = SER_CMD_DATA_POS; + uint32_t status_code; + + SER_ASSERT_LENGTH_LEQ(5, packet_len - index); //make sure that payload length is at least 5 bytes + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + //decode handle table count with optional handle table + status_code = count16_cond_data16_dec(p_buf, packet_len, &index, pp_handles, p_handle_count); + SER_ASSERT(status_code == NRF_SUCCESS, status_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return status_code; +} + + +uint32_t ble_gattc_char_values_read_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + return op_status_enc(SD_BLE_GATTC_CHAR_VALUES_READ, return_code, p_buf, p_buf_len, &index); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_characteristics_discover.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_characteristics_discover.c new file mode 100644 index 0000000..e17edb2 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_characteristics_discover.c @@ -0,0 +1,63 @@ +/* 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 "ble_gattc_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_characteristics_discover_req_dec( + uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gattc_handle_range_t * * const pp_handle_range) +{ + uint32_t index = SER_CMD_DATA_POS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_handle_range); + SER_ASSERT_NOT_NULL(*pp_handle_range); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 2 + 1, packet_len); + + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + switch (p_buf[index++]) + { + case SER_FIELD_NOT_PRESENT: + *pp_handle_range = NULL; + break; + + case SER_FIELD_PRESENT: + SER_ASSERT_LENGTH_LEQ(index + 2 + 2, packet_len); + uint16_dec(p_buf, packet_len, &index, &(*pp_handle_range)->start_handle); + uint16_dec(p_buf, packet_len, &index, &(*pp_handle_range)->end_handle); + break; + + default: + return NRF_ERROR_INVALID_DATA; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_characteristics_discover_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTC_CHARACTERISTICS_DISCOVER, + return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_conn.h b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_conn.h new file mode 100644 index 0000000..3191729 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_conn.h @@ -0,0 +1,398 @@ +/* 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. + * + */ +#ifndef BLE_GATTC_CONN_H__ +#define BLE_GATTC_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s130_codecs Connectivity s130 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gatc_conn GATTC Connectivity command request decoders and command response encoders + * @{ + * @ingroup ser_conn_s130_codecs + * + * @brief GATTC Connectivity command request decoders and command response encoders + */ +#include "ble_gattc.h" +#include "ble.h" + +/**@brief Decodes @ref sd_ble_gattc_characteristics_discover command request. + * + * @sa @ref nrf51_sd_ble_gattc_characteristics_discover_encoding for packet format, + * @ref ble_gattc_characteristics_discover_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] pp_handle_range Pointer to pointer to handle range. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for handle range field present. + */ +uint32_t ble_gattc_characteristics_discover_req_dec + (uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gattc_handle_range_t * * const pp_handle_range); + +/**@brief Encodes @ref sd_ble_gattc_characteristics_discover command response. + * + * @sa @ref nrf51_sd_ble_gattc_characteristics_discover_encoding for packet format. + * @ref ble_gattc_characteristics_discover_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_characteristics_discover_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gattc_descriptors_discover command request. + * + * @sa @ref nrf51_sd_ble_gattc_descriptors_discover_encoding for packet format, + * @ref ble_gattc_descriptors_discover_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] pp_handle_range Pointer to pointer to handle range. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for handle range field present. + */ +uint32_t ble_gattc_descriptors_discover_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gattc_handle_range_t * * const pp_handle_range); + +/**@brief Encodes @ref sd_ble_gattc_descriptors_discover command response. + * + * @sa @ref nrf51_sd_ble_gattc_descriptors_discover_encoding for packet format. + * @ref ble_gattc_descriptors_discover_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_descriptors_discover_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gattc_relationships_discover command request. + * + * @sa @ref nrf51_sd_ble_gattc_relationships_discover_encoding for packet format, + * @ref ble_gattc_relationships_discover_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] pp_handle_range Pointer to pointer to handle range. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for handle range field present. + */ +uint32_t ble_gattc_relationships_discover_req_dec + (uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gattc_handle_range_t * * const pp_handle_range); + +/**@brief Encodes @ref sd_ble_gattc_relationships_discover command response. + * + * @sa @ref nrf51_sd_ble_gattc_relationships_discover_encoding for packet format. + * @ref ble_gattc_relationships_discover_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_relationships_discover_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gattc_primary_services_discover command request. + * + * @sa @ref nrf51_sd_ble_gattc_primary_services_discover_encoding for packet format, + * @ref ble_gattc_primary_services_discover_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] p_start_handle Pointer to start handle. + * @param[out] pp_srvc_uuid Pointer to pointer to service uuid. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for uuid field present. + */ +uint32_t ble_gattc_primary_services_discover_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * const p_start_handle, + ble_uuid_t * * const pp_srvc_uuid); + +/**@brief Encodes @ref sd_ble_gattc_primary_services_discover command response. + * + * @sa @ref nrf51_sd_ble_gattc_primary_services_discover_encoding for packet format. + * @ref ble_gattc_primary_services_discover_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_primary_services_discover_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gattc_read command request. + * + * @sa @ref nrf51_sd_ble_gattc_read_encoding for packet format, + * @ref ble_gattc_read_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] p_handle Pointer to handle. + * @param[out] p_offset Pointer to offset. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_read_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * const p_handle, + uint16_t * const p_offset); + +/**@brief Encodes @ref sd_ble_gattc_read command response. + * + * @sa @ref nrf51_sd_ble_gattc_read_encoding for packet format. + * @ref ble_gattc_read_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_read_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gattc_char_values_read command request. + * + * @sa @ref nrf51_sd_ble_gattc_char_values_read for packet format, + * @ref ble_gattc_char_values_read_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] pp_handles Pointer to pointer to handle table. + * @param[out] p_handle_count Pointer to handle handle table count. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ + +uint32_t ble_gattc_char_values_read_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * * const pp_handles, + uint16_t * const p_handle_count); + +/**@brief Encodes @ref sd_ble_gattc_char_values_read command response. + * + * @sa @ref nrf51_sd_ble_gattc_char_values_read for packet format. + * @ref ble_gattc_char_values_read_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_char_values_read_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gattc_write command request. + * + * @sa @ref nrf51_sd_ble_gattc_write_encoding for packet format, + * @ref ble_gattc_write_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] pp_write_params Pointer to pointer to write parameters. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_write_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gattc_write_params_t * * const pp_write_params); + +/**@brief Encodes @ref sd_ble_gattc_write command response. + * + * @sa @ref nrf51_sd_ble_gattc_write_encoding for packet format. + * @ref ble_gattc_write_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_write_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gattc_hv_confirm command request. + * + * @sa @ref nrf51_sd_ble_gattc_hv_confirm for packet format, + * @ref ble_gattc_hv_confirm_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command response packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] p_handle Pointer to handle of the attribute in the indication. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_hv_confirm_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * const p_handle); + +/**@brief Encodes @ref sd_ble_gattc_hv_confirm command response. + * + * @sa @ref nrf51_sd_ble_gattc_hv_confirm for packet format. + * @ref ble_gattc_hv_confirm_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_hv_confirm_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gattc_char_value_by_uuid_read command request. + * + * @sa @ref nrf51_sd_ble_gattc_char_value_by_uuid_read_encoding for packet format, + * @ref ble_gattc_char_value_by_uuid_read_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of request packet. + * @param[out] p_conn_handle Pointer to connection handle of the connection. + * @param[out] pp_uuid Pointer to pointer to a characteristic value UUID to read. + * @param[out] pp_handle_range Pointer to pointer to the range of handles to perform this + * procedure on. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid operation type. + */ +uint32_t ble_gattc_char_value_by_uuid_read_req_dec + (uint8_t const * const p_buf, + uint16_t buf_len, + uint16_t * const p_conn_handle, + ble_uuid_t * * const pp_uuid, + ble_gattc_handle_range_t * * const pp_handle_range); + +/**@brief Encodes @ref sd_ble_gattc_char_value_by_uuid_read command response. + * + * @sa @ref nrf51_sd_ble_gattc_char_value_by_uuid_read_encoding for packet format. + * @ref ble_gattc_char_value_by_uuid_read_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_char_value_by_uuid_read_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** @} */ +#endif + diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_descriptors_discover.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_descriptors_discover.c new file mode 100644 index 0000000..f78e675 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_descriptors_discover.c @@ -0,0 +1,62 @@ +/* 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 "ble_gattc_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_descriptors_discover_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gattc_handle_range_t * * const pp_handle_range) +{ + uint32_t index = SER_CMD_DATA_POS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_handle_range); + SER_ASSERT_NOT_NULL(*pp_handle_range); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 2 + 1, packet_len); + + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + switch (p_buf[index++]) + { + case SER_FIELD_NOT_PRESENT: + *pp_handle_range = NULL; + break; + + case SER_FIELD_PRESENT: + SER_ASSERT_LENGTH_LEQ(index + 2 + 2, packet_len); + uint16_dec(p_buf, packet_len, &index, &(*pp_handle_range)->start_handle); + uint16_dec(p_buf, packet_len, &index, &(*pp_handle_range)->end_handle); + break; + + default: + return NRF_ERROR_INVALID_DATA; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_descriptors_discover_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTC_DESCRIPTORS_DISCOVER, + return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_char_disc_rsp.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_char_disc_rsp.c new file mode 100644 index 0000000..5799434 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_char_disc_rsp.c @@ -0,0 +1,73 @@ +/* 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 "ble_gattc_evt_conn.h" +#include "ble_serialization.h" +#include "ble_gatts.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_char_disc_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 8, *p_buf_len); + index += uint16_encode(BLE_GATTC_EVT_CHAR_DISC_RSP, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.conn_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.gatt_status, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.error_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.char_disc_rsp.count, &(p_buf[index])); + + uint16_t service_count = p_event->evt.gattc_evt.params.char_disc_rsp.count; + + SER_ASSERT_LENGTH_LEQ(index + (service_count * 9), *p_buf_len); + + for (uint16_t i = 0; i < service_count; i++) + { + index += uint16_encode(p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].uuid.uuid, + &(p_buf[index])); + p_buf[index++] = p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].uuid.type; + p_buf[index++] = (0x00 | + (p_event->evt.gattc_evt.params.char_disc_rsp.chars[i]. + char_props.broadcast << 0) | + (p_event->evt.gattc_evt.params.char_disc_rsp.chars[i]. + char_props.read << 1) | + (p_event->evt.gattc_evt.params.char_disc_rsp.chars[i]. + char_props.write_wo_resp << 2) | + (p_event->evt.gattc_evt.params.char_disc_rsp.chars[i]. + char_props.write << 3) | + (p_event->evt.gattc_evt.params.char_disc_rsp.chars[i]. + char_props.notify << 4) | + (p_event->evt.gattc_evt.params.char_disc_rsp.chars[i]. + char_props.indicate << 5) | + (p_event->evt.gattc_evt.params.char_disc_rsp.chars[i]. + char_props.auth_signed_wr << 6)); + p_buf[index++] = (p_event->evt.gattc_evt.params.char_disc_rsp.chars[i]. + char_ext_props & 0x01); + + index += uint16_encode(p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].handle_decl, + &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].handle_value, + &(p_buf[index])); + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c new file mode 100644 index 0000000..4326380 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c @@ -0,0 +1,52 @@ +/* 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_util.h" +#include "ble.h" +#include "ble_serialization.h" +#include "ble_gattc_struct_serialization.h" +#include "ble_gattc_evt_conn.h" + + +uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code; + + err_code = uint16_t_enc(&p_event->header.evt_id, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_event->evt.gattc_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_event->evt.gattc_evt.gatt_status, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_event->evt.gattc_evt.error_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gattc_evt_char_val_by_uuid_read_rsp_t_enc( + &p_event->evt.gattc_evt.params.char_val_by_uuid_read_rsp, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_char_vals_read_rsp.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_char_vals_read_rsp.c new file mode 100644 index 0000000..fa7fc41 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_char_vals_read_rsp.c @@ -0,0 +1,59 @@ +/* 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 "ble_gattc_evt_conn.h" +#include "ble_gattc_struct_serialization.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_char_vals_read_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint16_t evt_header = BLE_GATTC_EVT_CHAR_VALS_READ_RSP; + + //Event Header + err_code = uint16_t_enc(&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + //GATTC Header + err_code = uint16_t_enc(&(p_event->evt.gattc_evt.conn_handle), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_event->evt.gattc_evt.gatt_status), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_event->evt.gattc_evt.error_handle), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + //Event structure for BLE_GATTC_EVT_CHAR_VALS_READ_RSP + err_code = + ble_gattc_evt_char_vals_read_rsp_t_enc(&(p_event->evt.gattc_evt.params.char_vals_read_rsp), + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_conn.h b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_conn.h new file mode 100644 index 0000000..5791655 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_conn.h @@ -0,0 +1,236 @@ +/* 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 BLE_GATTC_EVT_CONN_H__ +#define BLE_GATTC_EVT_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s130_codecs Connectivity s130 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gattc_evt_conn GATTC Connectivity event encoders + * @{ + * @ingroup ser_conn_s130_codecs + * + * @brief GATTC Connectivity event encoders. + */ +#include "ble.h" + +/** + * @brief Encodes ble_gattc_evt_char_disc_rsp event. + * + * @sa @ref nrf51_gattc_evt_char_disc_rsp_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_char_disc_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gattc_evt_char_val_by_uuid_read_rsp event. + * + * @sa @ref nrf51_gattc_evt_char_val_by_uuid_read_rsp_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gattc_evt_char_vals_read_rsp event. + * + * @sa @ref nrf51_gattc_evt_char_vals_read_rsp_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_char_vals_read_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gattc_evt_desc_disc_rsp event. + * + * @sa @ref nrf51_gattc_evt_desc_disc_rsp_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_desc_disc_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gattc_evt_hvx event. + * + * @sa @ref nrf51_gattc_evt_hvx_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_hvx_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gattc_evt_prim_srvc_disc_rsp event. + * + * @sa @ref nrf51_gattc_evt_prim_srvc_disc_rsp_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_prim_srvc_disc_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gattc_evt_read_rsp event. + * + * @sa @ref nrf51_gattc_evt_read_rsp_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_read_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gattc_evt_rel_disc_rsp event. + * + * @sa @ref nrf51_gattc_evt_rel_disc_rsp_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_rel_disc_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gattc_evt_timeout event. + * + * @sa @ref nrf51_gattc_evt_timeout_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_timeout_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes ble_gattc_evt_write_rsp event. + * + * @sa @ref nrf51_gattc_evt_write_rsp_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gattc_evt_write_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** @} */ +#endif diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_desc_disc_rsp.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_desc_disc_rsp.c new file mode 100644 index 0000000..378e77b --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_desc_disc_rsp.c @@ -0,0 +1,53 @@ +/* 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 "ble_gattc_evt_conn.h" +#include "ble_serialization.h" +#include "ble_gatts.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_desc_disc_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 8, *p_buf_len); + index += uint16_encode(BLE_GATTC_EVT_DESC_DISC_RSP, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.conn_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.gatt_status, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.error_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.desc_disc_rsp.count, &(p_buf[index])); + + uint16_t service_count = p_event->evt.gattc_evt.params.desc_disc_rsp.count; + + SER_ASSERT_LENGTH_LEQ(index + (service_count * 5), *p_buf_len); + + for (uint16_t i = 0; i < service_count; i++) + { + index += uint16_encode(p_event->evt.gattc_evt.params.desc_disc_rsp.descs[i].handle, + &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.desc_disc_rsp.descs[i].uuid.uuid, + &(p_buf[index])); + p_buf[index++] = p_event->evt.gattc_evt.params.desc_disc_rsp.descs[i].uuid.type; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_hvx.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_hvx.c new file mode 100644 index 0000000..8e3a49e --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_hvx.c @@ -0,0 +1,52 @@ +/* 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 "ble_gattc_evt_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_hvx_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 11, *p_buf_len); + index += uint16_encode(BLE_GATTC_EVT_HVX, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.conn_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.gatt_status, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.error_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.hvx.handle, &(p_buf[index])); + p_buf[index++] = p_event->evt.gattc_evt.params.hvx.type; + index += uint16_encode(p_event->evt.gattc_evt.params.hvx.len, &(p_buf[index])); + + SER_ASSERT_LENGTH_LEQ(index + p_event->evt.gattc_evt.params.hvx.len, *p_buf_len); + + if (p_event->evt.gattc_evt.params.hvx.len > 0) + { + memcpy(&(p_buf[index]), + &(p_event->evt.gattc_evt.params.hvx.data[0]), + p_event->evt.gattc_evt.params.hvx.len); + index += p_event->evt.gattc_evt.params.hvx.len; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c new file mode 100644 index 0000000..f70c538 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c @@ -0,0 +1,62 @@ +/* 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 "ble_gattc_evt_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_prim_srvc_disc_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 8, *p_buf_len); + index += uint16_encode(BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.conn_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.gatt_status, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.error_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.count, &(p_buf[index])); + + uint16_t service_count = p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.count; + + SER_ASSERT_LENGTH_LEQ(index + (service_count * 7), *p_buf_len); + + for (uint16_t i = 0; i < service_count; i++) + { + index += uint16_encode( + p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].uuid.uuid, + &(p_buf[index])); + p_buf[index++] = p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].uuid.type; + index += + uint16_encode( + p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].handle_range. + start_handle, + &(p_buf[index])); + index += + uint16_encode( + p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].handle_range. + end_handle, + &(p_buf[index])); + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_read_rsp.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_read_rsp.c new file mode 100644 index 0000000..2d2b0f5 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_read_rsp.c @@ -0,0 +1,52 @@ +/* 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 "ble_gattc_evt_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_read_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 12, *p_buf_len); + index += uint16_encode(BLE_GATTC_EVT_READ_RSP, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.conn_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.gatt_status, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.error_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.read_rsp.handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.read_rsp.offset, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.read_rsp.len, &(p_buf[index])); + + SER_ASSERT_LENGTH_LEQ(index + p_event->evt.gattc_evt.params.read_rsp.len, *p_buf_len); + + if (p_event->evt.gattc_evt.params.read_rsp.len > 0) + { + memcpy(&(p_buf[index]), + &(p_event->evt.gattc_evt.params.read_rsp.data[0]), + p_event->evt.gattc_evt.params.read_rsp.len); + index += p_event->evt.gattc_evt.params.read_rsp.len; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_rel_disc_rsp.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_rel_disc_rsp.c new file mode 100644 index 0000000..fd83b62 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_rel_disc_rsp.c @@ -0,0 +1,51 @@ +/* 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 "ble_gattc_evt_conn.h" +#include "ble_serialization.h" +#include "ble_gattc_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_rel_disc_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + uint32_t error_code = NRF_SUCCESS; + uint16_t evt_header = BLE_GATTC_EVT_REL_DISC_RSP; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + error_code = uint16_t_enc(&evt_header, p_buf, total_len, &index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint16_t_enc(&p_event->evt.gattc_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint16_t_enc(&p_event->evt.gattc_evt.gatt_status, p_buf, total_len, &index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = uint16_t_enc(&p_event->evt.gattc_evt.error_handle, p_buf, total_len, &index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + error_code = ble_gattc_evt_rel_disc_rsp_t_enc(&p_event->evt.gattc_evt.params.rel_disc_rsp, + p_buf, + total_len, + &index); + SER_ASSERT(error_code == NRF_SUCCESS, error_code); + + *p_buf_len = index; + + return error_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_timeout.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_timeout.c new file mode 100644 index 0000000..ee1e08d --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_timeout.c @@ -0,0 +1,37 @@ +/* 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 "ble_gattc_evt_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_timeout_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 2 + 1, *p_buf_len); + index += uint16_encode(BLE_GATTC_EVT_TIMEOUT, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.conn_handle, &(p_buf[index])); + p_buf[index++] = p_event->evt.gattc_evt.params.timeout.src; + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_write_rsp.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_write_rsp.c new file mode 100644 index 0000000..7692b94 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_evt_write_rsp.c @@ -0,0 +1,53 @@ +/* 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 "ble_gattc_evt_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_evt_write_rsp_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 13, *p_buf_len); + index += uint16_encode(BLE_GATTC_EVT_WRITE_RSP, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.conn_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.gatt_status, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.error_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.write_rsp.handle, &(p_buf[index])); + p_buf[index++] = p_event->evt.gattc_evt.params.write_rsp.write_op; + index += uint16_encode(p_event->evt.gattc_evt.params.write_rsp.offset, &(p_buf[index])); + index += uint16_encode(p_event->evt.gattc_evt.params.write_rsp.len, &(p_buf[index])); + + SER_ASSERT_LENGTH_LEQ(index + p_event->evt.gattc_evt.params.write_rsp.len, *p_buf_len); + + if (p_event->evt.gattc_evt.params.write_rsp.len > 0) + { + memcpy(&(p_buf[index]), + &(p_event->evt.gattc_evt.params.write_rsp.data[0]), + p_event->evt.gattc_evt.params.write_rsp.len); + index += p_event->evt.gattc_evt.params.write_rsp.len; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_hv_confirm.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_hv_confirm.c new file mode 100644 index 0000000..6a1be3f --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_hv_confirm.c @@ -0,0 +1,45 @@ +/* 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 "ble_gattc_conn.h" +#include "ble_serialization.h" + +uint32_t ble_gattc_hv_confirm_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * const p_handle) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_handle); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = SER_CMD_DATA_POS; + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + +uint32_t ble_gattc_hv_confirm_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTC_HV_CONFIRM, + return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_primary_services_discover.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_primary_services_discover.c new file mode 100644 index 0000000..678e5e8 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_primary_services_discover.c @@ -0,0 +1,67 @@ +/* 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 "ble_gattc_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_primary_services_discover_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * const p_start_handle, + ble_uuid_t * * const pp_srvc_uuid) +{ + uint32_t index = SER_CMD_DATA_POS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_start_handle); + SER_ASSERT_NOT_NULL(pp_srvc_uuid); + SER_ASSERT_NOT_NULL(*pp_srvc_uuid); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 2 + 2 + 1, packet_len); + + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + uint16_dec(p_buf, packet_len, &index, p_start_handle); + + switch (p_buf[index++]) + { + case SER_FIELD_NOT_PRESENT: + *pp_srvc_uuid = NULL; + break; + + case SER_FIELD_PRESENT: + SER_ASSERT_LENGTH_LEQ(index + 2 + 1, packet_len); + uint16_dec(p_buf, packet_len, &index, &(*pp_srvc_uuid)->uuid); + uint8_dec(p_buf, packet_len, &index, &(*pp_srvc_uuid)->type); + break; + + default: + return NRF_ERROR_INVALID_DATA; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_primary_services_discover_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER, + return_code, + p_buf, + p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_read.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_read.c new file mode 100644 index 0000000..ca0af98 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_read.c @@ -0,0 +1,49 @@ +/* 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 "ble_gattc_conn.h" +#include "ble_serialization.h" + +uint32_t ble_gattc_read_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * const p_handle, + uint16_t * const p_offset) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_handle); + SER_ASSERT_NOT_NULL(p_offset); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = SER_CMD_DATA_POS; + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_offset); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + +uint32_t ble_gattc_read_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTC_READ, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_relationships_discover.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_relationships_discover.c new file mode 100644 index 0000000..7a61a3a --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_relationships_discover.c @@ -0,0 +1,64 @@ +/* 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 "ble_gattc_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gattc_relationships_discover_req_dec( + uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gattc_handle_range_t * * const + pp_handle_range) +{ + uint32_t index = SER_CMD_DATA_POS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_handle_range); + SER_ASSERT_NOT_NULL(*pp_handle_range); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 2 + 1, packet_len); + + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + switch (p_buf[index++]) + { + case SER_FIELD_NOT_PRESENT: + *pp_handle_range = NULL; + break; + + case SER_FIELD_PRESENT: + SER_ASSERT_LENGTH_LEQ(index + 2 + 2, packet_len); + uint16_dec(p_buf, packet_len, &index, &(*pp_handle_range)->start_handle); + uint16_dec(p_buf, packet_len, &index, &(*pp_handle_range)->end_handle); + break; + + default: + return NRF_ERROR_INVALID_DATA; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gattc_relationships_discover_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, + return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_write.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_write.c new file mode 100644 index 0000000..e889bce --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gattc_write.c @@ -0,0 +1,59 @@ +/* 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 "ble_gattc_conn.h" +#include "ble_serialization.h" +#include "ble_gattc_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" +#include + + +uint32_t ble_gattc_write_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + ble_gattc_write_params_t * * const pp_write_params) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_write_params); + SER_ASSERT_NOT_NULL(*pp_write_params); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = 0; + + uint8_t op_code; + err_code = uint8_t_dec(p_buf, packet_len, &index, &op_code); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + SER_ASSERT(op_code == SD_BLE_GATTC_WRITE, NRF_ERROR_INVALID_PARAM); + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + packet_len, + &index, + (void * *)pp_write_params, + ble_gattc_write_params_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + +uint32_t ble_gattc_write_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTC_WRITE, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_characteristic_add.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_characteristic_add.c new file mode 100644 index 0000000..1e1a9de --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_characteristic_add.c @@ -0,0 +1,88 @@ +/* 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 "ble_gatts_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + +uint32_t ble_gatts_characteristic_add_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * service_handle, + ble_gatts_char_md_t * * const pp_char_md, + ble_gatts_attr_t * * const pp_attr_char_value, + ble_gatts_char_handles_t * * const pp_handles) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(service_handle); + SER_ASSERT_NOT_NULL(pp_char_md); + SER_ASSERT_NOT_NULL(pp_attr_char_value); + SER_ASSERT_NOT_NULL(pp_handles); + SER_ASSERT_NOT_NULL(*pp_char_md); + SER_ASSERT_NOT_NULL(*pp_attr_char_value); + SER_ASSERT_NOT_NULL(*pp_handles); + + uint32_t index = SER_CMD_DATA_POS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len); + uint32_t err_code; + SER_ASSERT_LENGTH_LEQ(2, buf_len - index); + uint16_dec(p_buf, buf_len, &index, service_handle); + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_char_md, ble_gatts_char_md_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + buf_len, + &index, + (void * *)pp_attr_char_value, + ble_gatts_attr_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_handles, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT(index == buf_len, NRF_ERROR_INVALID_LENGTH); + + return err_code; +} + +uint32_t ble_gatts_characteristic_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gatts_char_handles_t const * const p_handles) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + SER_ASSERT_LENGTH_LEQ(1 + 4, total_len); + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTS_CHARACTERISTIC_ADD, + return_code, + p_buf, + p_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (return_code == NRF_SUCCESS) /* Add value and it's length. */ + { + err_code = cond_field_enc((void *)p_handles, + p_buf, + total_len, + p_buf_len, + ble_gatts_char_handles_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_conn.h b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_conn.h new file mode 100644 index 0000000..18cf3fb --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_conn.h @@ -0,0 +1,514 @@ +/* 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. + * + */ +#ifndef BLE_GATTS_CONN_H__ +#define BLE_GATTS_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s130_codecs Connectivity s130 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gatts_conn GATTS Connectivity command request decoders and command response encoders + * @{ + * @ingroup ser_conn_s130_codecs + * + * @brief GATTS Connectivity command request decoders and command response encoders + */ + +#include "ble_gatts.h" +#include "ble.h" + +/**@brief Decodes @ref sd_ble_gatts_value_get command request. + * + * @sa @ref nrf51_gatts_value_get_encoding for packet format, + * @ref ble_gatts_value_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of request packet. + * @param[out] p_conn_handle Pointer to the connection_handle. + * @param[out] p_handle Pointer to the attribute_handle. + * @param[out] pp_value Pointer to pointer to the Attribute Value structure. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_value_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * const p_handle, + ble_gatts_value_t * * const pp_value); + +/**@brief Encodes @ref sd_ble_gatts_value_get command response. + * + * @sa @ref nrf51_gatts_value_get_sec_response for packet format. + * @ref ble_gatts_value_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_value Pointer to Attribute Value structure. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_value_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gatts_value_t * const p_value); + +/**@brief Decodes @ref sd_ble_gatts_characteristic_add command request. + * + * @sa @ref nrf51_characteristics_add_encoding for packet format, + * @ref ble_gatts_characteristic_add_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of request packet. + * @param[out] p_service_handle Pointer to the service_handle. + * @param[out] constpp_char_md Pointer to pointer to the location where Characteristic metadata + * will be decoded. + * @param[out] pp_attr_char_value Pointer to pointer to the location where GATT Attribute will be + * decoded. + * @param[out] pp_handles Pointer to pointer to the location where Characteristic definition + * handles will be decoded. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_characteristic_add_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * p_service_handle, + ble_gatts_char_md_t * * constpp_char_md, + ble_gatts_attr_t * * const pp_attr_char_value, + ble_gatts_char_handles_t * * const pp_handles); + +/**@brief Encodes @ref ble_gatts_sys_attr_get_rsp_enc command response. + * + * @sa @ref sd_ble_gatts_sys_attr_get for packet format. + * @ref ble_gatts_sys_attr_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_handles Pointer to handle struct to be encoded. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_characteristic_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gatts_char_handles_t const * const p_handles); + +/**@brief Decodes @ref sd_ble_gatts_include_add command request. + * + * @sa @ref nrf51_gatts_include_add_encoding for packet format, + * @ref ble_gatts_include_add_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of request packet. + * @param[out] p_service_handle Pointer to the service_handle. + * @param[out] p_inc_srvc_handle Pointer to the handle of the included service. + * @param[out] pp_include_handle Pointer to Pointer to 16-bit word where the assigned handle will be stored. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ + +uint32_t ble_gatts_include_add_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_service_handle, + uint16_t * const p_inc_srvc_handle, + uint16_t * * const pp_include_handle); + +/**@brief Encodes @ref ble_gatts_include_add_rsp_enc command response. + * + * @sa @ref nrf51_gatts_include_add_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_include_handle Pointer to a 16-bit word where the assigned handle was stored. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ + +uint32_t ble_gatts_include_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t const * const p_include_handle); + +/**@brief Decodes @ref sd_ble_gatts_service_add command request. + * + * @sa @ref nrf51_gatts_service_add_encoding for packet format, + * @ref ble_gatts_service_add_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of request packet. + * @param[out] p_type Pointer to the service type. + * @param[out] pp_uuid Pointer to pointer to service UUID. + * @param[out] pp_handle Pointer to Pointer to a 16-bit word where the assigned handle will be stored. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ + +uint32_t ble_gatts_service_add_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint8_t * const p_type, + ble_uuid_t * * const pp_uuid, + uint16_t * * const pp_handle); + +/**@brief Encodes @ref ble_gatts_service_add_rsp_enc command response. + * + * @sa @ref nrf51_gatts_service_add_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_handle Pointer to a 16-bit word where the assigned handle was stored. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ + +uint32_t ble_gatts_service_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t const * const p_handle); + +/**@brief Decodes @ref ble_gatts_sys_attr_get_req_dec command request. + * + * @sa @ref sd_ble_gatts_sys_attr_get for packet format, + * @ref ble_gatts_sys_attr_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connectiton handle. + * @param[out] pp_sys_attr_data Pointer to pointer to buffer where system attributes data will be filled in. + * @param[out] pp_sys_attr_data_len Pointer to pointer to variable which contains size of buffer for system attributes. + * @param[out] p_flags Pointer to additional optional flags. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gatts_sys_attr_get_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint8_t * * const pp_sys_attr_data, + uint16_t * * const pp_sys_attr_data_len, + uint32_t * const p_flags); + +/**@brief Encodes @ref ble_gatts_sys_attr_get_rsp_enc command response. + * + * @sa @ref sd_ble_gatts_sys_attr_get for packet format. + * @ref ble_gatts_sys_attr_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_sys_attr_data Pointer to buffer where system attributes data are storred. + * @param[in] p_sys_attr_data_len Pointer to variable which contains size of buffer for system attributes. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_sys_attr_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint8_t const * const p_sys_attr_data, + uint16_t const * const p_sys_attr_data_len); + +/**@brief Decodes @ref sd_ble_gatts_value_set command request. + * + * @sa @ref nrf51_gatts_value_set_encoding for packet format, + * @ref ble_gatts_value_set_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle + * @param[out] p_handle Pointer to attribute handle + * @param[out] pp_value Pointer to pointer to attribute value structure + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ + +uint32_t ble_gatts_value_set_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * p_conn_handle, + uint16_t * p_handle, + ble_gatts_value_t * * const pp_value); + +/**@brief Encodes @ref sd_ble_gatts_value_set command response. + * + * @sa @ref nrf51_gatts_value_set_encoding for packet format. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[in] p_buff Pointer to buffer where encoded data command response will be + * returned. + * @param[in, out] p_buff_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_value \c in: size of value returned when value was written with success + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_value_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buff, + uint32_t * const p_buff_len, + ble_gatts_value_t * p_value); + +/**@brief Decodes @ref sd_ble_gatts_sys_attr_set command request. + * + * @sa @ref nrf51_gatts_sys_attr_set_encoding for packet format, + * @ref ble_gatts_sys_attr_set_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of request packet. + * @param[out] p_conn_handle Pointer to the buffer raw data to be placed in advertisement packet. + * @param[out] pp_sys_attr_data Pointer to pointer to system attribute data. + * @param[out] p_sys_attr_data_len Pointer to data length for system attribute data. + * @param[out] p_flags Pointer to additional optional flags. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_sys_attr_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint8_t * * const pp_sys_attr_data, + uint16_t * const p_sys_attr_data_len, + uint32_t * const p_flags); + +/**@brief Encodes @ref sd_ble_gatts_sys_attr_set command response. + * + * @sa @ref nrf51_gatts_sys_attr_set_encoding for packet format. + * @ref ble_gatts_sys_attr_set_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_sys_attr_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref ble_gatts_hvx_req_dec command request. + * + * @sa @ref sd_ble_gatts_hvx for packet format, + * @ref ble_gatts_hvx_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of request packet. + * @param[out] p_conn_handle Pointer to the buffer raw data to be placed in advertisement packet. + * @param[out] pp_hvx_params Pointer to an HVx parameters structure. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_hvx_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + ble_gatts_hvx_params_t * * const pp_hvx_params); + +/**@brief Encodes @ref ble_gatts_hvx_rsp_enc command response. + * + * @sa @ref sd_ble_gatts_sys_attr_set for packet format. + * @ref ble_gatts_hvx_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_bytes_written Pointer to number of bytes written. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_hvx_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t const * const p_bytes_written); + +/**@brief Decodes @ref sd_ble_gatts_descriptor_add command request. + * + * @sa @ref sd_ble_gatts_descriptor_add for packet format, + * @ref ble_gatts_descriptor_add_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of request packet. + * @param[out] p_char_handle Pointer to buffer where characteristic handle will be. + returned. + * @param[out] pp_attr Pointer to pointer to an attribute structure. + * @param[out] pp_handle Pointer to pointer to descriptor handle. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_descriptor_add_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_char_handle, + ble_gatts_attr_t * * const pp_attr, + uint16_t * * const pp_handle); + +/**@brief Encodes @ref sd_ble_gatts_descriptor_add command response. + * + * @sa @ref sd_ble_gatts_sys_attr_set for packet format. + * @ref ble_gatts_descriptor_add_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] handle Descriptor handle value. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_descriptor_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t handle); + +/**@brief Decodes @ref sd_ble_gatts_rw_authorize_reply command request. + * + * @sa @ref nrf51_gatts_rw_authorize_reply_encoding for packet format, + * @ref ble_gatts_rw_authorize_reply_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] pp_reply_params Pointer to pointer to \ref ble_gatts_rw_authorize_reply_params_t + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ + +uint32_t ble_gatts_rw_authorize_reply_req_dec( + uint8_t const * const p_buf, + uint32_t + packet_len, + uint16_t * + p_conn_handle, + ble_gatts_rw_authorize_reply_params_t * * const + pp_reply_params); + +/**@brief Encodes @ref sd_ble_gatts_rw_authorize_reply command response. + * + * @sa @ref nrf51_gatts_rw_authorize_reply_encoding for packet format. + * @ref ble_gatts_rw_authorize_reply_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_rw_authorize_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_gatts_service_changed command request. + * + * @sa @ref nrf51_service_changed_encoding for packet format, + * @ref ble_gatts_service_changed_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] packet_len Length (in bytes) of response packet. + * @param[out] p_conn_handle Pointer to connection handle. + * @param[out] p_start_handle Pointer to start handle. + * @param[out] p_end_handle Pointer to end handle. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_gatts_service_changed_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * p_conn_handle, + uint16_t * p_start_handle, + uint16_t * p_end_handle); + +/**@brief Encodes @ref sd_ble_gatts_service_changed command response. + * + * @sa @ref nrf51_service_changed_encoding for packet format. + * @ref ble_gatts_service_changed_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_service_changed_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** @} */ +#endif //BLE_GATTS_CONN_H__ + diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_descriptor_add.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_descriptor_add.c new file mode 100644 index 0000000..1929309 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_descriptor_add.c @@ -0,0 +1,94 @@ +/* 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 "ble_gatts_conn.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_gatts_descriptor_add_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_char_handle, + ble_gatts_attr_t * * const pp_attr, + uint16_t * * const pp_handle) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_char_handle); + SER_ASSERT_NOT_NULL(pp_attr); + SER_ASSERT_NOT_NULL(*pp_attr); + SER_ASSERT_NOT_NULL(pp_handle); + SER_ASSERT_NOT_NULL(*pp_handle); + + uint32_t index = 0; + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 2 + 1, packet_len); + SER_ASSERT(p_buf[index] == SD_BLE_GATTS_DESCRIPTOR_ADD, NRF_ERROR_INVALID_PARAM); + index++; + + uint16_dec(p_buf, packet_len, &index, p_char_handle); + + uint32_t err_code = cond_field_dec(p_buf, + packet_len, + &index, + (void * *)pp_attr, + ble_gatts_attr_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, + packet_len, + &index, + (void * *)pp_handle, + NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + +uint32_t ble_gatts_descriptor_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t handle) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 4, total_len); + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTS_DESCRIPTOR_ADD, + return_code, + p_buf, + p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + uint32_t index = *p_buf_len; + + SER_ASSERT_LENGTH_LEQ(index + 2, total_len); + + err_code = uint16_t_enc(&handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_conn.h b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_conn.h new file mode 100644 index 0000000..fdbf24e --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_conn.h @@ -0,0 +1,156 @@ +/* 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 BLE_GATTS_EVT_CONN_H__ +#define BLE_GATTS_EVT_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s130_codecs Connectivity s130 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_gatts_evt_conn GATTS Connectivity event encoders + * @{ + * @ingroup ser_conn_s130_codecs + * + * @brief GATTS Connectivity event encoders. + */ +#include "ble.h" + +/** + * @brief Encodes @ref BLE_GATTS_EVT_HVC event. + * + * @sa @ref nrf51_gatts_evt_hvc_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_evt_hvc_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes @ref BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST event. + * + * @sa @ref nrf51_evt_rw_authorize_request for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_evt_rw_authorize_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes @ref BLE_GATTS_EVT_SC_CONFIRM event. + * + * @sa @ref nrf51_gatts_evt_sc_confirm_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_evt_sc_confirm_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes @ref BLE_GATTS_EVT_SYS_ATTR_MISSING event. + * + * @sa @ref nrf51_evt_sys_attr_missing_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_evt_sys_attr_missing_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes @ref BLE_GATTS_EVT_TIMEOUT event. + * + * @sa @ref nrf51_gatts_evt_timeout_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_evt_timeout_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** + * @brief Encodes @ref BLE_GATTS_EVT_WRITE event. + * + * @sa @ref nrf51_evt_write_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_gatts_evt_write_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** @} */ +#endif diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_hvc.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_hvc.c new file mode 100644 index 0000000..872e9a5 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_hvc.c @@ -0,0 +1,38 @@ +/* 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 "ble_gatts_evt_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_evt_hvc_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 2 + 2, *p_buf_len); + + index += uint16_encode(BLE_GATTS_EVT_HVC, &(p_buf[index])); + index += uint16_encode(p_event->evt.gatts_evt.conn_handle, &(p_buf[index])); + index += uint16_encode(p_event->evt.gatts_evt.params.hvc.handle, &(p_buf[index])); + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_rw_authorize_request.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_rw_authorize_request.c new file mode 100644 index 0000000..4674938 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_rw_authorize_request.c @@ -0,0 +1,59 @@ +/* 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 "ble_gatts_evt_conn.h" +#include "ble_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "conn_ble_user_mem.h" +#include "app_util.h" + +extern ser_ble_user_mem_t m_conn_user_mem_table[]; + +uint32_t ble_gatts_evt_rw_authorize_request_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + SER_ASSERT_NOT_NULL(p_event); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint32_t err_code = NRF_SUCCESS; + + err_code = uint16_t_enc(&p_event->header.evt_id, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_event->evt.gatts_evt.conn_handle), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gatts_evt_rw_authorize_request_t_enc( + &(p_event->evt.gatts_evt.params.authorize_request), + p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if(p_event->evt.gatts_evt.params.authorize_request.type == BLE_GATTS_AUTHORIZE_TYPE_WRITE) + { + uint32_t conn_index; + + if(conn_ble_user_mem_context_find(p_event->evt.gatts_evt.conn_handle, &conn_index) != NRF_ERROR_NOT_FOUND) + { + err_code = len16data_enc(m_conn_user_mem_table[conn_index].mem_block.p_mem, m_conn_user_mem_table[conn_index].mem_block.len, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + } + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_sc_confirm.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_sc_confirm.c new file mode 100644 index 0000000..1bf1e0f --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_sc_confirm.c @@ -0,0 +1,37 @@ +/* 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 "ble_gatts_evt_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_evt_sc_confirm_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(SER_EVT_HEADER_SIZE + 2, *p_buf_len); + + uint32_t index = 0; + index += uint16_encode(BLE_GATTS_EVT_SC_CONFIRM, &(p_buf[index])); + index += uint16_encode(p_event->evt.gatts_evt.conn_handle, &(p_buf[index])); + + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_sys_attr_missing.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_sys_attr_missing.c new file mode 100644 index 0000000..cb7c3e4 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_sys_attr_missing.c @@ -0,0 +1,37 @@ +/* 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 "ble_gatts_evt_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_evt_sys_attr_missing_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 2 + 1, *p_buf_len); + index += uint16_encode(BLE_GATTS_EVT_SYS_ATTR_MISSING, &(p_buf[index])); + index += uint16_encode(p_event->evt.gatts_evt.conn_handle, &(p_buf[index])); + p_buf[index++] = p_event->evt.gatts_evt.params.sys_attr_missing.hint; + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_timeout.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_timeout.c new file mode 100644 index 0000000..096ec5c --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_timeout.c @@ -0,0 +1,37 @@ +/* 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 "ble_gatts_evt_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_evt_timeout_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 2 + 1, *p_buf_len); + index += uint16_encode(BLE_GATTS_EVT_TIMEOUT, &(p_buf[index])); + index += uint16_encode(p_event->evt.gatts_evt.conn_handle, &(p_buf[index])); + p_buf[index++] = p_event->evt.gatts_evt.params.timeout.src; + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_write.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_write.c new file mode 100644 index 0000000..acc2a43 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_evt_write.c @@ -0,0 +1,63 @@ +/* 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 "ble_gatts_evt_conn.h" +#include "ble_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "conn_ble_user_mem.h" +#include "app_util.h" + +extern ser_ble_user_mem_t m_conn_user_mem_table[]; + +uint32_t ble_gatts_evt_write_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t total_len = *p_buf_len; + uint16_t evt_header = BLE_GATTS_EVT_WRITE; + + err_code = uint16_t_enc(&evt_header, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&(p_event->evt.gatts_evt.conn_handle), p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_gatts_evt_write_t_enc(&(p_event->evt.gatts_evt.params.write), + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if((p_event->evt.gatts_evt.params.write.op == BLE_GATTS_OP_WRITE_REQ) || (p_event->evt.gatts_evt.params.write.op == BLE_GATTS_OP_EXEC_WRITE_REQ_NOW)) + { + uint32_t conn_index; + + if(conn_ble_user_mem_context_find(p_event->evt.gatts_evt.conn_handle, &conn_index) != NRF_ERROR_NOT_FOUND) + { + err_code = len16data_enc(m_conn_user_mem_table[conn_index].mem_block.p_mem, m_conn_user_mem_table[conn_index].mem_block.len, p_buf, *p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + } + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_hvx.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_hvx.c new file mode 100644 index 0000000..67bd566 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_hvx.c @@ -0,0 +1,81 @@ +/* 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 "ble_gatts_conn.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_gatts_hvx_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + ble_gatts_hvx_params_t * * const pp_hvx_params) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_hvx_params); + SER_ASSERT_NOT_NULL(*pp_hvx_params); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 2 + 1, packet_len); + SER_ASSERT(p_buf[index] == SD_BLE_GATTS_HVX, NRF_ERROR_INVALID_PARAM); + index++; + + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + uint32_t err_code = cond_field_dec(p_buf, packet_len, + &index, + (void * *)pp_hvx_params, + ble_gatts_hvx_params_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + +uint32_t ble_gatts_hvx_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t const * const p_bytes_written) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTS_HVX, + return_code, + p_buf, + p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + uint32_t index = *p_buf_len; + + err_code = cond_field_enc(p_bytes_written, p_buf, total_len, &index, uint16_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_include_add.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_include_add.c new file mode 100644 index 0000000..766313f --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_include_add.c @@ -0,0 +1,74 @@ +/* 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 + +#include "ble_gatts_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_gatts_include_add_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_service_handle, + uint16_t * const p_inc_srvc_handle, + uint16_t * * const pp_include_handle) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_service_handle); + SER_ASSERT_NOT_NULL(p_inc_srvc_handle); + SER_ASSERT_NOT_NULL(pp_include_handle); + SER_ASSERT_LENGTH_EQ(6, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_GATTS_INCLUDE_ADD, NRF_ERROR_INVALID_PARAM); + index++; + + uint16_dec(p_buf, packet_len, &index, p_service_handle); + uint16_dec(p_buf, packet_len, &index, p_inc_srvc_handle); + + if (p_buf[index++] == SER_FIELD_NOT_PRESENT) + { + *pp_include_handle = NULL; + } + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gatts_include_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t const * const p_include_handle) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + uint32_t err_code; + + err_code = op_status_enc(SD_BLE_GATTS_INCLUDE_ADD, return_code, p_buf, p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + SER_ASSERT_NOT_NULL(p_include_handle); + err_code = uint16_t_enc(p_include_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; //update change made by op_status_enc + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_rw_authorize_reply.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_rw_authorize_reply.c new file mode 100644 index 0000000..94390bb --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_rw_authorize_reply.c @@ -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. + * + */ + +#include "ble_gatts_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" +#include "ble_gatts_struct_serialization.h" +#include "cond_field_serialization.h" + +uint32_t ble_gatts_rw_authorize_reply_req_dec( + uint8_t const * const p_buf, + uint32_t + packet_len, + uint16_t * + p_conn_handle, + ble_gatts_rw_authorize_reply_params_t * * const + pp_reply_params) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + + uint32_t index = SER_CMD_HEADER_SIZE; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(2, packet_len - index); + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + err_code = cond_field_dec(p_buf, packet_len, &index, + (void * *)pp_reply_params, ble_gatts_rw_authorize_reply_params_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + +uint32_t ble_gatts_rw_authorize_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTS_RW_AUTHORIZE_REPLY, return_code, + p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_service_add.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_service_add.c new file mode 100644 index 0000000..e1d7c68 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_service_add.c @@ -0,0 +1,76 @@ +/* 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 + +#include "ble_gatts_conn.h" +#include "ble_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "ble_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + +uint32_t ble_gatts_service_add_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint8_t * const p_type, + ble_uuid_t * * const pp_uuid, + uint16_t * * const pp_handle) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_type); + SER_ASSERT_NOT_NULL(pp_uuid); + SER_ASSERT_NOT_NULL(*pp_uuid); + SER_ASSERT_NOT_NULL(pp_handle); + SER_ASSERT_NOT_NULL(*pp_handle); + + uint32_t index = SER_CMD_DATA_POS; + + uint32_t err_code; + SER_ASSERT_LENGTH_LEQ(3, buf_len - index); + err_code = uint8_t_dec(p_buf, buf_len, &index, p_type); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_uuid, ble_uuid_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_handle, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT(index == buf_len, NRF_ERROR_INVALID_LENGTH); + + return err_code; +} + +uint32_t ble_gatts_service_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint16_t const * const p_handle) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t buf_len = *p_buf_len; + uint32_t index = 0; + uint32_t err_code; + + err_code = op_status_enc(SD_BLE_GATTS_SERVICE_ADD, return_code, p_buf, p_buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; //this seems silly but it is not + } + SER_ASSERT_NOT_NULL(p_handle); + err_code = uint16_t_enc(p_handle, p_buf, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; //update change made by op_status_enc + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_service_changed.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_service_changed.c new file mode 100644 index 0000000..37e9e34 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_service_changed.c @@ -0,0 +1,55 @@ +/* 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 +#include "ble_gatts_conn.h" +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_service_changed_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * p_conn_handle, + uint16_t * p_start_handle, + uint16_t * p_end_handle) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_start_handle); + SER_ASSERT_NOT_NULL(p_end_handle); + + SER_ASSERT_LENGTH_EQ(SER_CMD_HEADER_SIZE + 6, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_GATTS_SERVICE_CHANGED, NRF_ERROR_INVALID_PARAM); + index++; + + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + uint16_dec(p_buf, packet_len, &index, p_start_handle); + uint16_dec(p_buf, packet_len, &index, p_end_handle); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_gatts_service_changed_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTS_SERVICE_CHANGED, + return_code, + p_buf, + p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_sys_attr_get.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_sys_attr_get.c new file mode 100644 index 0000000..affbe8e --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_sys_attr_get.c @@ -0,0 +1,125 @@ +/* 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 "ble_gatts_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_sys_attr_get_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint8_t * * const pp_sys_attr_data, + uint16_t * * const pp_sys_attr_data_len, + uint32_t * const p_flags) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_sys_attr_data); + SER_ASSERT_NOT_NULL(pp_sys_attr_data_len); + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 2 + 1, packet_len); + SER_ASSERT(p_buf[index] == SD_BLE_GATTS_SYS_ATTR_GET, NRF_ERROR_INVALID_PARAM); + index++; + + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_flags); + *p_conn_handle = uint16_decode(&p_buf[index]); + index += sizeof (uint16_t); + + if (p_buf[index++] == SER_FIELD_PRESENT) + { + SER_ASSERT_LENGTH_LEQ(index + 2, packet_len); + + SER_ASSERT_NOT_NULL(*pp_sys_attr_data_len); + **pp_sys_attr_data_len = uint16_decode(&p_buf[index]); + index += sizeof (uint16_t); + } + else + { + *pp_sys_attr_data_len = NULL; + } + + SER_ASSERT_LENGTH_LEQ(index + 1, packet_len); + + if (p_buf[index++] == SER_FIELD_NOT_PRESENT) + { + *pp_sys_attr_data = NULL; + } + + err_code = uint32_t_dec(p_buf, packet_len, &index, p_flags); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + +uint32_t ble_gatts_sys_attr_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint8_t const * const p_sys_attr_data, + uint16_t const * const p_sys_attr_data_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + SER_ASSERT_LENGTH_LEQ(1 + 4, total_len); + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTS_SYS_ATTR_GET, + return_code, + p_buf, + p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_sys_attr_data); + SER_ASSERT_NOT_NULL(p_sys_attr_data_len); + uint32_t index = *p_buf_len; + uint16_t sys_attr_len = 0; + + SER_ASSERT_LENGTH_LEQ(index + 2, total_len); + + if (p_sys_attr_data_len != NULL) + { + index += uint16_encode(*p_sys_attr_data_len, &p_buf[index]); + sys_attr_len = *p_sys_attr_data_len; + } + + SER_ASSERT_LENGTH_LEQ(index + 1, total_len); + p_buf[index++] = p_sys_attr_data ? SER_FIELD_PRESENT : + SER_FIELD_NOT_PRESENT; + + SER_ASSERT_LENGTH_LEQ(index + sys_attr_len, total_len); + + if (p_sys_attr_data != NULL) + { + memcpy(&p_buf[index], p_sys_attr_data, sys_attr_len); + index += sys_attr_len; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_sys_attr_set.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_sys_attr_set.c new file mode 100644 index 0000000..b25d9d9 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_sys_attr_set.c @@ -0,0 +1,76 @@ +/* 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 "ble_gatts_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_sys_attr_set_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + uint8_t * * const pp_sys_attr_data, + uint16_t * const p_sys_attr_data_len, + uint32_t * const p_flags) +{ + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code = NRF_SUCCESS; + + uint16_t sys_attr_data_len_temp; + uint16_t * p_sys_attr_data_len_temp = &sys_attr_data_len_temp; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_sys_attr_data); + SER_ASSERT_NOT_NULL(*pp_sys_attr_data); + SER_ASSERT_NOT_NULL(p_sys_attr_data_len); + SER_ASSERT_NOT_NULL(p_flags); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 7, packet_len); + + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + + switch (p_buf[index++]) + { + case SER_FIELD_NOT_PRESENT: + *pp_sys_attr_data = NULL; + SER_ASSERT_LENGTH_EQ(index + 4, packet_len); + *p_sys_attr_data_len = 0; + break; + + case SER_FIELD_PRESENT: + uint16_dec(p_buf, packet_len, &index, p_sys_attr_data_len_temp); + SER_ASSERT_LENGTH_LEQ(*p_sys_attr_data_len_temp, *p_sys_attr_data_len); + *p_sys_attr_data_len = *p_sys_attr_data_len_temp; + SER_ASSERT_LENGTH_EQ(index + *p_sys_attr_data_len + 4, packet_len); + memcpy(*pp_sys_attr_data, &p_buf[index], *p_sys_attr_data_len); + index += *p_sys_attr_data_len; + break; + + default: + return NRF_ERROR_INVALID_DATA; + } + + err_code = uint32_t_dec(p_buf, packet_len, &index, p_flags); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return err_code; +} + + +uint32_t ble_gatts_sys_attr_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTS_SYS_ATTR_SET, return_code, p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_value_get.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_value_get.c new file mode 100644 index 0000000..eebd031 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_value_get.c @@ -0,0 +1,105 @@ +/* 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 "ble_gatts_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_value_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * const p_conn_handle, + uint16_t * const p_handle, + ble_gatts_value_t * * const pp_value) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_handle); + SER_ASSERT_NOT_NULL(pp_value); + SER_ASSERT_NOT_NULL(*pp_value); + SER_ASSERT_NOT_NULL((*pp_value)->p_value); + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 5, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_GATTS_VALUE_GET, NRF_ERROR_INVALID_PARAM); + index++; + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (p_buf[index++] == SER_FIELD_PRESENT) + { + err_code = uint16_t_dec(p_buf, packet_len, &index, &((*pp_value)->len)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_dec(p_buf, packet_len, &index, &((*pp_value)->offset)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_LEQ(1, packet_len - index); + if (p_buf[index++] == SER_FIELD_NOT_PRESENT) + { + (*pp_value)->p_value = NULL; + } + } + else + { + *pp_value = NULL; + } + + return err_code; +} + + +uint32_t ble_gatts_value_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_gatts_value_t * const p_value) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_RSP_HEADER_SIZE, *p_buf_len); + + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_GATTS_VALUE_GET, + return_code, + p_buf, + p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + uint32_t index = *p_buf_len; + + if (return_code == NRF_SUCCESS) + { + SER_ASSERT_NOT_NULL(p_value); + + err_code = ble_gatts_value_t_enc(p_value, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_value_set.c b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_value_set.c new file mode 100644 index 0000000..4a7eb2b --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_gatts_value_set.c @@ -0,0 +1,74 @@ +/* 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 "ble_gatts_conn.h" +#include +#include "cond_field_serialization.h" +#include "ble_serialization.h" +#include "ble_gatts_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_gatts_value_set_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint16_t * p_conn_handle, + uint16_t * p_handle, + ble_gatts_value_t * * const pp_value) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(p_handle); + SER_ASSERT_NOT_NULL(pp_value); + + uint32_t index = SER_CMD_DATA_POS; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(4, packet_len - index); //make sure that payload length is at least 4 bytes + uint16_dec(p_buf, packet_len, &index, p_conn_handle); + uint16_dec(p_buf, packet_len, &index, p_handle); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_value, ble_gatts_value_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + +uint32_t ble_gatts_value_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buff, + uint32_t * const p_buff_len, + ble_gatts_value_t * p_value) +{ + SER_ASSERT_NOT_NULL(p_buff); + SER_ASSERT_NOT_NULL(p_buff_len); + + uint32_t buf_len = *p_buff_len; + uint32_t index = 0; + uint32_t err_code; + + err_code = op_status_enc(SD_BLE_GATTS_VALUE_SET, return_code, p_buff, p_buff_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + SER_ASSERT_NOT_NULL(p_value); + err_code = ble_gatts_value_t_enc(p_value, p_buff, buf_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buff_len = index; //update change made by op_status_enc + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_l2cap_cid_register.c b/components/serialization/connectivity/codecs/s130/serializers/ble_l2cap_cid_register.c new file mode 100644 index 0000000..9e2a775 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_l2cap_cid_register.c @@ -0,0 +1,46 @@ +/* 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 "ble_l2cap_conn.h" +#include "ble_serialization.h" +#include "nrf_error.h" + + +uint32_t ble_l2cap_cid_register_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * p_cid) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_cid); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_LENGTH_EQ(3, buf_len); + SER_ASSERT(p_buf[index] == SD_BLE_L2CAP_CID_REGISTER, NRF_ERROR_INVALID_PARAM); + + index++; + err_code = uint16_t_dec(p_buf, buf_len, &index, p_cid); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} + + +uint32_t ble_l2cap_cid_register_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_L2CAP_CID_REGISTER, return_code, + p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_l2cap_cid_unregister.c b/components/serialization/connectivity/codecs/s130/serializers/ble_l2cap_cid_unregister.c new file mode 100644 index 0000000..74d4619 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_l2cap_cid_unregister.c @@ -0,0 +1,46 @@ +/* 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 "ble_l2cap_conn.h" +#include "ble_serialization.h" +#include "nrf_error.h" + + +uint32_t ble_l2cap_cid_unregister_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * p_cid) +{ + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_NOT_NULL(p_cid); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_LENGTH_EQ(3, buf_len); + SER_ASSERT(p_buf[index] == SD_BLE_L2CAP_CID_UNREGISTER, NRF_ERROR_INVALID_PARAM); + + index++; + err_code = uint16_t_dec(p_buf, buf_len, &index, p_cid); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} + + +uint32_t ble_l2cap_cid_unregister_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_L2CAP_CID_UNREGISTER, return_code, + p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_l2cap_conn.h b/components/serialization/connectivity/codecs/s130/serializers/ble_l2cap_conn.h new file mode 100644 index 0000000..a4b0d4d --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_l2cap_conn.h @@ -0,0 +1,156 @@ +/* Copyright (c) 2011 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. + * + */ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s130_codecs Connectivity s130 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_l2cap_conn L2CAP Connectivity command request decoders and command response encoders + * @{ + * @ingroup ser_conn_s130_codecs + * + * @brief L2CAP Connectivity command request decoders and command response encoders. + */ + +#ifndef BLE_L2CAP_CONN_H__ +#define BLE_L2CAP_CON__H__ + +#include "ble.h" +#include "ble_types.h" +#include "ble_ranges.h" +#include "ble_err.h" +#include "ble_l2cap.h" + +/**@brief Decodes @ref sd_ble_l2cap_cid_register command request. + * + * @sa @ref nrf51_ble_l2cap_cid_register for packet format, + * @ref ble_l2cap_cid_register_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of response packet. + * @param[in] p_cid Pointer to L2CAP CID. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_l2cap_cid_register_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * p_cid); + +/**@brief Encodes @ref sd_ble_l2cap_cid_register command response. + * + * @sa @ref nrf51_ble_l2cap_cid_register for packet format. + * @ref ble_l2cap_cid_register_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_l2cap_cid_register_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_l2cap_cid_unregister command request. + * + * @sa @ref nrf51_ble_l2cap_cid_unregister for packet format, + * @ref ble_l2cap_cid_unregister_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of response packet. + * @param[in] p_cid Pointer to L2CAP CID. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_l2cap_cid_unregister_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + uint16_t * p_cid); + +/**@brief Encodes @ref sd_ble_l2cap_cid_unregister command response. + * + * @sa @ref nrf51_ble_l2cap_cid_unregister for packet format. + * @ref ble_l2cap_cid_unregister_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_l2cap_cid_unregister_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/**@brief Decodes @ref sd_ble_l2cap_tx command request. + * + * @sa @ref nrf51_ble_l2cap_tx for packet format, + * @ref ble_l2cap_tx_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to beginning of command request packet. + * @param[in] buf_len Length (in bytes) of response packet. + * @param[in] p_conn_handle Pointer to connection handle. + * @param[in] pp_l2cap_header Pointer to pointer to L2CAP header. + * @param[in] pp_data Pointer to pointer L2CAP data. + * + * @retval NRF_SUCCESS Decoding success. + * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. + * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type. + */ +uint32_t ble_l2cap_tx_req_dec(uint8_t const * const p_buf, + uint32_t const buf_len, + uint16_t * p_conn_handle, + ble_l2cap_header_t * * const pp_l2cap_header, + uint8_t const * * pp_data); + +/**@brief Encodes @ref sd_ble_l2cap_tx command response. + * + * @sa @ref nrf51_ble_l2cap_tx for packet format. + * @ref ble_l2cap_tx_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_l2cap_tx_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +#endif //BLE_L2CAP_CONN_H__ + +/** + @} + */ diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_l2cap_evt_conn.h b/components/serialization/connectivity/codecs/s130/serializers/ble_l2cap_evt_conn.h new file mode 100644 index 0000000..6026f57 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_l2cap_evt_conn.h @@ -0,0 +1,56 @@ +/* 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 BLE_L2CAP_EVT_CONN_H__ +#define BLE_L2CAP_EVT_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s130_codecs Connectivity s130 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup ble_l2cap_evt_conn L2CAP Connectivity event encoders + * @{ + * @ingroup ser_conn_s130_codecs + * + * @brief L2CAP Connectivity event encoders. + */ +#include "ble.h" + +/** + * @brief Encodes ble_l2cap_evt_rx event. + * + * @sa @ref nrf51_l2cap_evt_rx_encoding for packet format. + * + * @param[in] p_event Pointer to the \ref ble_evt_t buffer that shall be encoded. + * @param[in] event_len Size (in bytes) of \p p_event buffer. + * @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet. + * @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer. + * \c out: Length of encoded contents in \p p_buf. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t ble_l2cap_evt_rx_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len); + +/** @} */ +#endif diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_l2cap_evt_rx.c b/components/serialization/connectivity/codecs/s130/serializers/ble_l2cap_evt_rx.c new file mode 100644 index 0000000..15793ed --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_l2cap_evt_rx.c @@ -0,0 +1,50 @@ +/* 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 "ble_l2cap_evt_conn.h" +#include +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" + + +uint32_t ble_l2cap_evt_rx_enc(ble_evt_t const * const p_event, + uint32_t event_len, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_event); + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t err_code; + uint32_t total_len = *p_buf_len; + + uint16_t evt_id = BLE_L2CAP_EVT_RX; + + err_code = uint16_t_enc(&evt_id, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = uint16_t_enc(&p_event->evt.l2cap_evt.conn_handle, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = ble_l2cap_evt_rx_t_enc(&(p_event->evt.l2cap_evt.params.rx), + p_buf, + total_len, + &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_l2cap_tx.c b/components/serialization/connectivity/codecs/s130/serializers/ble_l2cap_tx.c new file mode 100644 index 0000000..c574b40 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_l2cap_tx.c @@ -0,0 +1,67 @@ +/* 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 +#include +#include "ble_l2cap_conn.h" +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "cond_field_serialization.h" +#include "app_util.h" + +uint32_t ble_l2cap_tx_req_dec(uint8_t const * const p_buf, + uint32_t const buf_len, + uint16_t * p_conn_handle, + ble_l2cap_header_t * * const pp_l2cap_header, + uint8_t const * * pp_data) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_l2cap_header); + SER_ASSERT_NOT_NULL(*pp_l2cap_header); + SER_ASSERT_NOT_NULL(pp_data); + //SER_ASSERT_NOT_NULL(*pp_data); + + uint32_t err_code = NRF_SUCCESS; + uint32_t index = SER_CMD_DATA_POS; + + err_code = uint16_t_dec(p_buf, buf_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_l2cap_header, + ble_l2cap_header_t_dec); + + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (*pp_l2cap_header != NULL) + { + *pp_data = p_buf + index + 1; + index += 1 + (*pp_l2cap_header)->len; + } + else + { + *pp_data = NULL; + index++; + } + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} + +uint32_t ble_l2cap_tx_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_status_code_enc(SD_BLE_L2CAP_TX, return_code, + p_buf, p_buf_len); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_opt_get.c b/components/serialization/connectivity/codecs/s130/serializers/ble_opt_get.c new file mode 100644 index 0000000..7f2da63 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_opt_get.c @@ -0,0 +1,130 @@ +/* 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 "ble_conn.h" +#include +#include "ble_serialization.h" +#include "ble_struct_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_opt_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint32_t * const p_opt_id, + ble_opt_t **const pp_opt ) +{ + uint32_t index = 0; + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_opt_id); + SER_ASSERT_NOT_NULL(pp_opt); + SER_ASSERT_NOT_NULL(*pp_opt); + SER_ASSERT_LENGTH_EQ(SER_CMD_HEADER_SIZE + 4 + 1, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_OPT_GET, NRF_ERROR_INVALID_PARAM); + index++; + + err_code = uint32_t_dec(p_buf, packet_len, &index, p_opt_id); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT(((*p_opt_id == BLE_COMMON_OPT_RADIO_CPU_MUTEX) || + (*p_opt_id == BLE_GAP_OPT_CH_MAP) || + (*p_opt_id == BLE_GAP_OPT_LOCAL_CONN_LATENCY) || + (*p_opt_id == BLE_GAP_OPT_PASSKEY) || + (*p_opt_id == BLE_GAP_OPT_PRIVACY) || + (*p_opt_id == BLE_GAP_OPT_SCAN_REQ_REPORT) || + (*p_opt_id == BLE_GAP_OPT_COMPAT_MODE)), NRF_ERROR_INVALID_PARAM); + + if (p_buf[index++] == SER_FIELD_NOT_PRESENT) + { + *pp_opt = NULL; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_opt_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint32_t opt_id, + ble_opt_t const * const p_opt) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_OPT_GET, return_code, + p_buf, p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_opt); + SER_ASSERT(((opt_id == BLE_COMMON_OPT_RADIO_CPU_MUTEX) || + (opt_id == BLE_GAP_OPT_CH_MAP) || + (opt_id == BLE_GAP_OPT_LOCAL_CONN_LATENCY) || + (opt_id == BLE_GAP_OPT_PASSKEY) || + (opt_id == BLE_GAP_OPT_PRIVACY) || + (opt_id == BLE_GAP_OPT_SCAN_REQ_REPORT) || + (opt_id == BLE_GAP_OPT_COMPAT_MODE)), NRF_ERROR_INVALID_PARAM); + + uint32_t index = *p_buf_len; + err_code = uint32_t_enc(&opt_id, p_buf, total_len, &index); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + switch (opt_id) + { + case BLE_COMMON_OPT_RADIO_CPU_MUTEX: + err_code = ble_common_opt_radio_cpu_mutex_t_enc((void *)&(p_opt->common_opt.radio_cpu_mutex), p_buf, total_len, &index); + break; + case BLE_GAP_OPT_CH_MAP: + err_code = ble_gap_opt_ch_map_t_enc((void *)&(p_opt->gap_opt.ch_map), p_buf, total_len, &index); + break; + case BLE_GAP_OPT_LOCAL_CONN_LATENCY: + err_code = ble_gap_opt_local_conn_latency_t_enc((void *)&(p_opt->gap_opt.local_conn_latency), p_buf, total_len, &index); + break; + case BLE_GAP_OPT_PASSKEY: + err_code = ble_gap_opt_passkey_t_enc((void *)&(p_opt->gap_opt.passkey), p_buf, total_len, &index); + break; + case BLE_GAP_OPT_PRIVACY: + err_code = ble_gap_opt_privacy_t_enc((void *)&(p_opt->gap_opt.privacy), p_buf, total_len, &index); + break; + case BLE_GAP_OPT_SCAN_REQ_REPORT: + err_code = ble_gap_opt_scan_req_report_t_enc((void *)&(p_opt->gap_opt.scan_req_report), p_buf, total_len, &index); + break; + case BLE_GAP_OPT_COMPAT_MODE: + err_code = ble_gap_opt_compat_mode_t_enc((void *)&(p_opt->gap_opt.compat_mode), p_buf, total_len, &index); + break; + } + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_opt_id_pre_decoder.c b/components/serialization/connectivity/codecs/s130/serializers/ble_opt_id_pre_decoder.c new file mode 100644 index 0000000..7b0e749 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_opt_id_pre_decoder.c @@ -0,0 +1,36 @@ +/* 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 "ble_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_opt_id_pre_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint32_t * const p_opt_id) +{ + uint32_t index = 0; + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_opt_id); + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 4, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_OPT_SET, NRF_ERROR_INVALID_PARAM); + index++; + + err_code = uint32_t_dec(p_buf, packet_len, &index, p_opt_id); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_opt_set.c b/components/serialization/connectivity/codecs/s130/serializers/ble_opt_set.c new file mode 100644 index 0000000..8a0b6e5 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_opt_set.c @@ -0,0 +1,114 @@ +/* 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 "ble_conn.h" +#include +#include "ble_serialization.h" +#include "ble_gap_struct_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_opt_set_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint32_t * const p_opt_id, + ble_opt_t **const pp_opt ) +{ + uint32_t index = 0; + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_opt_id); + SER_ASSERT_NOT_NULL(pp_opt); + SER_ASSERT_NOT_NULL(*pp_opt); + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 4 + 1, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_OPT_SET, NRF_ERROR_INVALID_PARAM); + index++; + + err_code = uint32_t_dec(p_buf, packet_len, &index, p_opt_id); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT(((*p_opt_id == BLE_COMMON_OPT_RADIO_CPU_MUTEX) || + (*p_opt_id == BLE_GAP_OPT_CH_MAP) || + (*p_opt_id == BLE_GAP_OPT_LOCAL_CONN_LATENCY) || + (*p_opt_id == BLE_GAP_OPT_PASSKEY) || + (*p_opt_id == BLE_GAP_OPT_PRIVACY) || + (*p_opt_id == BLE_GAP_OPT_SCAN_REQ_REPORT) || + (*p_opt_id == BLE_GAP_OPT_COMPAT_MODE)), NRF_ERROR_INVALID_PARAM); + + if (p_buf[index++] == SER_FIELD_NOT_PRESENT) + { + *pp_opt = NULL; + } + else + { + switch(*p_opt_id) + { + case BLE_COMMON_OPT_RADIO_CPU_MUTEX: + err_code = ble_common_opt_radio_cpu_mutex_t_dec(p_buf, packet_len, &index, &((*pp_opt)->common_opt.radio_cpu_mutex)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + case BLE_GAP_OPT_CH_MAP: + err_code = ble_gap_opt_ch_map_t_dec(p_buf, packet_len, &index, &((*pp_opt)->gap_opt.ch_map)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + case BLE_GAP_OPT_LOCAL_CONN_LATENCY: + err_code = ble_gap_opt_local_conn_latency_t_dec(p_buf, packet_len, &index, &((*pp_opt)->gap_opt.local_conn_latency)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + case BLE_GAP_OPT_PASSKEY: + err_code = ble_gap_opt_passkey_t_dec(p_buf, packet_len, &index, &((*pp_opt)->gap_opt.passkey)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + case BLE_GAP_OPT_PRIVACY: + err_code = ble_gap_opt_privacy_t_dec(p_buf, packet_len, &index, &((*pp_opt)->gap_opt.privacy)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + case BLE_GAP_OPT_SCAN_REQ_REPORT: + err_code = ble_gap_opt_scan_req_report_t_dec(p_buf, packet_len, &index, &((*pp_opt)->gap_opt.scan_req_report)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + case BLE_GAP_OPT_COMPAT_MODE: + err_code = ble_gap_opt_compat_mode_t_dec(p_buf, packet_len, &index, &((*pp_opt)->gap_opt.compat_mode)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + break; + } + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + +uint32_t ble_opt_set_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_OPT_SET, return_code, + p_buf, p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_tx_buffer_count_get.c b/components/serialization/connectivity/codecs/s130/serializers/ble_tx_buffer_count_get.c new file mode 100644 index 0000000..eec8bb9 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_tx_buffer_count_get.c @@ -0,0 +1,65 @@ +/* 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 "ble_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" +#include "cond_field_serialization.h" + +uint32_t ble_tx_buffer_count_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + uint8_t * * const pp_count) +{ + SER_ASSERT_NOT_NULL(p_buf); + + uint32_t index = 0; + uint8_t opcode; + uint32_t err_code; + + err_code = uint8_t_dec(p_buf, packet_len, &index, &opcode); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + SER_ASSERT(opcode == SD_BLE_TX_BUFFER_COUNT_GET, NRF_ERROR_INVALID_PARAM); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_count, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + +uint32_t ble_tx_buffer_count_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint8_t const * const p_count) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_TX_BUFFER_COUNT_GET, return_code, + p_buf, p_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + err_code = cond_field_enc(p_count, p_buf, total_len, p_buf_len, uint8_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_user_mem_reply.c b/components/serialization/connectivity/codecs/s130/serializers/ble_user_mem_reply.c new file mode 100644 index 0000000..61062b6 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_user_mem_reply.c @@ -0,0 +1,66 @@ +/* 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 "ble_conn.h" +#include +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_user_mem_reply_req_dec(uint8_t const * const p_buf, + uint32_t packet_len, + uint16_t * const p_conn_handle, + ble_user_mem_block_t * * const pp_mem_block) +{ + uint32_t index = 0; + uint32_t err_code; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_conn_handle); + SER_ASSERT_NOT_NULL(pp_mem_block); + SER_ASSERT_NOT_NULL(*pp_mem_block); + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 2 + 4, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_USER_MEM_REPLY, NRF_ERROR_INVALID_PARAM); + index++; + + err_code = uint16_t_dec(p_buf, packet_len, &index, p_conn_handle); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + if (p_buf[index++] == SER_FIELD_PRESENT) + { + // Decoding order is different than structure elements order because + // mem block length is received first + err_code = uint16_t_dec(p_buf, packet_len, &index, &((*pp_mem_block)->len)); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, packet_len, &index, (void **)&((*pp_mem_block)->p_mem), NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + else + { + *pp_mem_block = NULL; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return err_code; +} + + +uint32_t ble_user_mem_reply_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len) +{ + return ser_ble_cmd_rsp_dec(p_buf, *p_buf_len, SD_BLE_USER_MEM_REPLY, &return_code); +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_uuid_decode.c b/components/serialization/connectivity/codecs/s130/serializers/ble_uuid_decode.c new file mode 100644 index 0000000..000e4d8 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_uuid_decode.c @@ -0,0 +1,77 @@ +/* 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 "ble_conn.h" +#include +#include +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_uuid_decode_req_dec(uint8_t const * const p_buf, + uint32_t const buf_len, + uint8_t * p_uuid_le_len, + uint8_t * * const pp_uuid_le, + ble_uuid_t * * const pp_uuid) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_uuid_le_len); + uint32_t err_code; + uint32_t index = 0; + uint8_t opcode = SD_BLE_UUID_DECODE; + + SER_ASSERT_LENGTH_LEQ(1, ((int32_t)buf_len - index)); + uint8_dec(p_buf, buf_len, &index, &opcode); + SER_ASSERT(opcode == SD_BLE_UUID_DECODE, NRF_ERROR_INVALID_DATA); + + err_code = len8data_dec(p_buf, buf_len, &index, pp_uuid_le, p_uuid_le_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_uuid, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} + +uint32_t ble_uuid_decode_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_uuid_t const * const p_uuid) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_UUID_DECODE, return_code, + p_buf, p_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + + uint32_t index = *p_buf_len; + + if (return_code != NRF_SUCCESS) + { + *p_buf_len = index; + return NRF_SUCCESS; + } + + err_code = cond_field_enc((void *)p_uuid, p_buf, total_len, &index, ble_uuid_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_uuid_encode.c b/components/serialization/connectivity/codecs/s130/serializers/ble_uuid_encode.c new file mode 100644 index 0000000..0843668 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_uuid_encode.c @@ -0,0 +1,117 @@ +/* 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 "ble_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_uuid_encode_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + ble_uuid_t * * const pp_uuid, + uint8_t * * const pp_uuid_le_len, + uint8_t * * const pp_uuid_le) +{ + uint32_t index = SER_CMD_HEADER_SIZE; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_uuid); + SER_ASSERT_NOT_NULL(pp_uuid_le_len); + SER_ASSERT_NOT_NULL(pp_uuid_le); + SER_ASSERT_NOT_NULL(*pp_uuid); + SER_ASSERT_NOT_NULL(*pp_uuid_le_len); + SER_ASSERT_NOT_NULL(*pp_uuid_le); + + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 3, packet_len); + + if (p_buf[index] == SER_FIELD_NOT_PRESENT) + { + index++; + *pp_uuid = NULL; + } + else if (p_buf[index] == SER_FIELD_PRESENT) + { + SER_ASSERT_LENGTH_LEQ(SER_CMD_HEADER_SIZE + 6, packet_len); + index++; + uint16_dec(p_buf, packet_len, &index, &((*pp_uuid)->uuid)); + (*pp_uuid)->type = p_buf[index++]; + } + else + { + return NRF_ERROR_INVALID_DATA; + } + + if (p_buf[index] == SER_FIELD_NOT_PRESENT) + { + *pp_uuid_le_len = NULL; + } + else if (p_buf[index] != SER_FIELD_PRESENT) + { + return NRF_ERROR_INVALID_DATA; + } + + index++; + + if (p_buf[index] == SER_FIELD_NOT_PRESENT) + { + *pp_uuid_le = NULL; + } + else if (p_buf[index] != SER_FIELD_PRESENT) + { + return NRF_ERROR_INVALID_DATA; + } + + SER_ASSERT_LENGTH_EQ(index + 1, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_uuid_encode_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint8_t uuid_le_len, + uint8_t const * const p_uuid_le) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_UUID_ENCODE, return_code, + p_buf, p_buf_len); + uint32_t index = *p_buf_len; + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + SER_ASSERT_LENGTH_LEQ(index + 1, total_len); + p_buf[index++] = uuid_le_len; + + if (p_uuid_le != NULL) + { + SER_ASSERT_LENGTH_LEQ(index + uuid_le_len, total_len); + memcpy(p_buf + index, p_uuid_le, uuid_le_len); + index += uuid_le_len; + } + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_uuid_vs_add.c b/components/serialization/connectivity/codecs/s130/serializers/ble_uuid_vs_add.c new file mode 100644 index 0000000..5deeac7 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_uuid_vs_add.c @@ -0,0 +1,73 @@ +/* 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 "ble_conn.h" +#include +#include "ble_serialization.h" +#include "cond_field_serialization.h" +#include "ble_struct_serialization.h" +#include "app_util.h" + +uint32_t ble_uuid_vs_add_req_dec(uint8_t const * const p_buf, + uint16_t buf_len, + ble_uuid128_t * * const pp_uuid, + uint8_t * * const pp_uuid_type) +{ + uint32_t index = SER_CMD_HEADER_SIZE; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_uuid); + SER_ASSERT_NOT_NULL(pp_uuid_type); + SER_ASSERT_NOT_NULL(*pp_uuid); + SER_ASSERT_NOT_NULL(*pp_uuid_type); + + uint32_t err_code; + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_uuid, ble_uuid128_t_dec); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_uuid_type, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} + + +uint32_t ble_uuid_vs_add_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + uint8_t const * const p_uuid_type) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_UUID_VS_ADD, return_code, + p_buf, p_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + uint32_t index = *p_buf_len; + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + err_code = cond_field_enc((void *)p_uuid_type, p_buf, total_len, &index, uint8_t_enc); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/ble_version_get.c b/components/serialization/connectivity/codecs/s130/serializers/ble_version_get.c new file mode 100644 index 0000000..28dbe54 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/ble_version_get.c @@ -0,0 +1,77 @@ +/* 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 "ble_conn.h" +#include +#include "ble_serialization.h" +#include "app_util.h" + +uint32_t ble_version_get_req_dec(uint8_t const * const p_buf, + uint16_t packet_len, + ble_version_t * * const pp_version) +{ + uint32_t index = 0; + + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_version); + SER_ASSERT_NOT_NULL(*pp_version); + SER_ASSERT_LENGTH_EQ(SER_CMD_HEADER_SIZE + 1, packet_len); + + SER_ASSERT(p_buf[index] == SD_BLE_VERSION_GET, NRF_ERROR_INVALID_PARAM); + index++; + + if (p_buf[index++] == SER_FIELD_NOT_PRESENT) + { + *pp_version = NULL; + } + + SER_ASSERT_LENGTH_EQ(index, packet_len); + + return NRF_SUCCESS; +} + + +uint32_t ble_version_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + ble_version_t const * const p_version) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t total_len = *p_buf_len; + + uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SD_BLE_VERSION_GET, return_code, + p_buf, p_buf_len); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + if (return_code != NRF_SUCCESS) + { + return NRF_SUCCESS; + } + + SER_ASSERT_NOT_NULL(p_version); + uint32_t index = *p_buf_len; + + SER_ASSERT_LENGTH_LEQ(index + 5, total_len); + p_buf[index++] = p_version->version_number; + index += uint16_encode(p_version->company_id, &p_buf[index]); + index += uint16_encode(p_version->subversion_number, &p_buf[index]); + + *p_buf_len = index; + + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/conn_ble_gap_sec_keys.c b/components/serialization/connectivity/codecs/s130/serializers/conn_ble_gap_sec_keys.c new file mode 100644 index 0000000..a7db7e3 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/conn_ble_gap_sec_keys.c @@ -0,0 +1,73 @@ +/* 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 "conn_ble_gap_sec_keys.h" +#include "nrf_error.h" +#include + +ser_ble_gap_conn_keyset_t m_conn_keys_table[SER_MAX_CONNECTIONS]; + +uint32_t conn_ble_gap_sec_context_create(uint32_t *p_index) +{ + uint32_t err_code = NRF_ERROR_NO_MEM; + uint32_t i; + + for (i=0; i + +#define SER_MAX_CONNECTIONS 2 + +/**@brief GAP connection - keyset mapping structure. + * + * @note This structure is used to map keysets to connection instances, and will be stored in a static table. + */ +typedef struct +{ + uint16_t conn_handle; /**< Connection handle.*/ + uint8_t conn_active; /**< Indication that keys for this connection are used by soft device. 0: keys used; 1: keys not used*/ + ble_gap_sec_keyset_t keyset; /**< Keyset structure see @ref ble_gap_sec_keyset_t.*/ + ble_gap_enc_key_t enc_key_periph; /**< Peripheral Encryption Key, see @ref ble_gap_enc_key_t.*/ + ble_gap_id_key_t id_key_periph; /**< Peripheral Identity Key, see @ref ble_gap_id_key_t.*/ + ble_gap_sign_info_t sign_key_periph; /**< Peripheral Signing Information, see @ref ble_gap_sign_info_t.*/ + ble_gap_enc_key_t enc_key_central; /**< Central Encryption Key, see @ref ble_gap_enc_key_t.*/ + ble_gap_id_key_t id_key_central; /**< Central Identity Key, see @ref ble_gap_id_key_t.*/ + ble_gap_sign_info_t sign_key_central; /**< Central Signing Information, see @ref ble_gap_sign_info_t.*/ +} ser_ble_gap_conn_keyset_t; + +/**@brief allocates instance in m_conn_keys_table[] for storage of encryption keys. + * + * @param[out] p_index pointer to the index of allocated instance + * + * @retval NRF_SUCCESS great success. + * @retval NRF_ERROR_NO_MEM no free instance available. + */ +uint32_t conn_ble_gap_sec_context_create(uint32_t *p_index); + +/**@brief release instance identified by a connection handle. + * + * @param[in] conn_handle conn_handle + * + * @retval NRF_SUCCESS Context released. + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t conn_ble_gap_sec_context_destroy(uint16_t conn_handle); + +/**@brief finds index of instance identified by a connection handle in m_conn_keys_table[]. + * + * @param[in] conn_handle conn_handle + * + * @param[out] p_index Pointer to the index of entry in the context table corresponding to the given conn_handle + * + * @retval NRF_SUCCESS Context table entry found + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t conn_ble_gap_sec_context_find(uint16_t conn_handle, uint32_t *p_index); +/** @} */ + +#endif //_CONN_BLE_GAP_SEC_KEYS_H diff --git a/components/serialization/connectivity/codecs/s130/serializers/conn_ble_user_mem.c b/components/serialization/connectivity/codecs/s130/serializers/conn_ble_user_mem.c new file mode 100644 index 0000000..7ee0563 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/conn_ble_user_mem.c @@ -0,0 +1,78 @@ +/* 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 "conn_ble_user_mem.h" +#include "ser_config.h" +#include "nrf_error.h" +#include + + + +ser_ble_user_mem_t m_conn_user_mem_table[SER_MAX_CONNECTIONS]; + +uint32_t conn_ble_user_mem_context_create(uint32_t *p_index) +{ + uint32_t err_code = NRF_ERROR_NO_MEM; + uint32_t i; + + for (i=0; i + +/**@brief Connection - user memory mapping structure. + * + * @note This structure is used to map keysets to connection instances, and will be stored in a static table. + */ +//lint -esym(452,ser_ble_user_mem_t) +typedef struct +{ + uint16_t conn_handle; /**< Connection handle.*/ + uint8_t conn_active; /**< Indication that user memory for this connection is used by soft device. 0: memory used; 1: memory not used*/ + ble_user_mem_block_t mem_block; /**< User memory block structure, see @ref ble_user_mem_block_t.*/ + uint8_t mem_table[64]; /**< Memory table.*/ +} ser_ble_user_mem_t; + +/**@brief allocates instance in m_user_mem_table[] for storage. + * + * @param[out] p_index pointer to the index of allocated instance + * + * @retval NRF_SUCCESS great success. + * @retval NRF_ERROR_NO_MEM no free instance available. + */ +uint32_t conn_ble_user_mem_context_create(uint32_t *p_index); + +/**@brief release instance identified by a connection handle. + * + * @param[in] conn_handle conn_handle + * + * @retval NRF_SUCCESS Context released. + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t conn_ble_user_mem_context_destroy(uint16_t conn_handle); + +/**@brief finds index of instance identified by a connection handle in m_user_mem_table[]. + * + * @param[in] conn_handle conn_handle + * + * @param[out] p_index Pointer to the index of entry in the context table corresponding to the given conn_handle + * + * @retval NRF_SUCCESS Context table entry found + * @retval NRF_ERROR_NOT_FOUND instance with conn_handle not found + */ +uint32_t conn_ble_user_mem_context_find(uint16_t conn_handle, uint32_t *p_index); +/** @} */ + +#endif //_CONN_BLE_USER_MEM_H diff --git a/components/serialization/connectivity/codecs/s130/serializers/nrf_soc_conn.h b/components/serialization/connectivity/codecs/s130/serializers/nrf_soc_conn.h new file mode 100644 index 0000000..8aae397 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/nrf_soc_conn.h @@ -0,0 +1,89 @@ +/* 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 NRF_SOC_CONN_H__ +#define NRF_SOC_CONN_H__ + +/** + * @addtogroup ser_codecs Serialization codecs + * @ingroup ble_sdk_lib_serialization + */ + +/** + * @addtogroup ser_conn_s130_codecs Connectivity s130 codecs + * @ingroup ser_codecs + */ + +/**@file + * + * @defgroup soc_conn SOC Connectivity command request decoders and command response encoders + * @{ + * @ingroup ser_conn_s130_codecs + * + * @brief SOC Connectivity command request decoders and command response encoderss. + */ +#include "nrf_soc.h" + +/**@brief Decodes @ref sd_power_system_off command request. + * + * @sa @ref nrf51_sd_power_off for packet format. + * + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in] packet_len Length (in bytes) of request packet. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_PARAM Encoding failure. Incorrect parameter. + */ +uint32_t power_system_off_req_dec(uint8_t const * const p_buf, uint16_t packet_len); + + +/**@brief Decodes @ref sd_temp_get command request. + * + * @sa @ref nrf51_sd_temp_get for packet format. + * @ref temp_get_rsp_enc for response encoding. + * + * @param[in] p_buf Pointer to buffer where encoded data command will be returned. + * @param[in] buf_len Length (in bytes) of request packet. + * @param[out] pp_temp Pointer to pointer to result of temperature measurement. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_PARAM Encoding failure. Incorrect parameter. + */ +uint32_t temp_get_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + int32_t * * const pp_temp); + +/**@brief Encodes @ref sd_temp_get command response. + * + * @sa @ref nrf51_sd_temp_get for packet format. + * @ref temp_get_req_dec for request decoding. + * + * @param[in] return_code Return code indicating if command was successful or not. + * @param[out] p_buf Pointer to buffer where encoded data command response will be + * returned. + * @param[in,out] p_buf_len \c in: size of \p p_buf buffer. + * \c out: Length of encoded command response packet. + * @param[in] p_temp Pointer to result of temperature measurement. + * + * @retval NRF_SUCCESS Encoding success. + * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied. + * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length. + */ +uint32_t temp_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + int32_t * const p_temp); + +/** @} */ +#endif + diff --git a/components/serialization/connectivity/codecs/s130/serializers/power_system_off.c b/components/serialization/connectivity/codecs/s130/serializers/power_system_off.c new file mode 100644 index 0000000..00e66b2 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/power_system_off.c @@ -0,0 +1,28 @@ +/* + * 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 "nrf_soc_conn.h" +#include "ble_serialization.h" + +uint32_t power_system_off_req_dec(uint8_t const * const p_buf, + uint16_t packet_len) +{ + SER_ASSERT_NOT_NULL(p_buf); + + uint32_t index = 0; + SER_ASSERT_LENGTH_LEQ(1, packet_len); + SER_ASSERT(p_buf[index] == SD_POWER_SYSTEM_OFF, NRF_ERROR_INVALID_PARAM); + index++; + + SER_ASSERT_LENGTH_EQ(index, packet_len); + return NRF_SUCCESS; +} diff --git a/components/serialization/connectivity/codecs/s130/serializers/temp_get.c b/components/serialization/connectivity/codecs/s130/serializers/temp_get.c new file mode 100644 index 0000000..8cd2081 --- /dev/null +++ b/components/serialization/connectivity/codecs/s130/serializers/temp_get.c @@ -0,0 +1,71 @@ +/* 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 "nrf_soc.h" +#include "nrf_error.h" +#include "ble_serialization.h" +#include "cond_field_serialization.h" + +uint32_t temp_get_req_dec(uint8_t const * const p_buf, + uint32_t buf_len, + int32_t * * const pp_temp) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(pp_temp); + SER_ASSERT_NOT_NULL(*pp_temp); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + SER_ASSERT_LENGTH_LEQ(1, buf_len); + SER_ASSERT(p_buf[index] == SD_TEMP_GET, NRF_ERROR_INVALID_PARAM); + index++; + + err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_temp, NULL); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + + SER_ASSERT_LENGTH_EQ(index, buf_len); + + return err_code; +} + +uint32_t temp_get_rsp_enc(uint32_t return_code, + uint8_t * const p_buf, + uint32_t * const p_buf_len, + int32_t * const p_temp) +{ + SER_ASSERT_NOT_NULL(p_buf); + SER_ASSERT_NOT_NULL(p_temp); + SER_ASSERT_NOT_NULL(p_buf_len); + + uint32_t index = 0; + uint32_t err_code = NRF_SUCCESS; + + uint32_t total_len = *p_buf_len; + + err_code = ser_ble_cmd_rsp_status_code_enc(SD_TEMP_GET, + return_code, + p_buf, + p_buf_len); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + index += *p_buf_len; + + if (return_code == NRF_SUCCESS) + { + err_code = uint32_t_enc(p_temp, p_buf, total_len, &index); + SER_ASSERT(err_code == NRF_SUCCESS, err_code); + } + + *p_buf_len = index; + + return err_code; +} diff --git a/components/serialization/connectivity/hal/dtm_uart.c b/components/serialization/connectivity/hal/dtm_uart.c new file mode 100644 index 0000000..c7e61b8 --- /dev/null +++ b/components/serialization/connectivity/hal/dtm_uart.c @@ -0,0 +1,233 @@ +/* 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. + * + */ + +/** + @defgroup dtm_standalone main.c + @{ + @ingroup ble_sdk_app_dtm_serial + @brief Stand-alone DTM application for UART interface. + + */ + +#include +#include +#include "nrf.h" +#include "ble_dtm.h" +#include "nrf_gpio.h" +#include "dtm_uart.h" +#include "nrf_error.h" +#include "app_util.h" +#include "nrf_drv_uart.h" +#include "app_util_platform.h" + +//Configuration parameters. +#define BITRATE UART_BAUDRATE_BAUDRATE_Baud57600 /**< Serial bitrate on the UART */ + +//@note: The BLE DTM 2-wire UART standard specifies 8 data bits, 1 stop bit, no flow control. +//These parameters are not configurable in the BLE standard. + +/**@details Maximum iterations needed in the main loop between stop bit 1st byte and start bit 2nd + * byte. DTM standard allows 5000us delay between stop bit 1st byte and start bit 2nd byte. + * As the time is only known when a byte is received, then the time between between stop bit 1st + * byte and stop bit 2nd byte becomes: + * 5000us + transmission time of 2nd byte. + * + * Byte transmission time is (Baud rate of 19200): + * 10bits * 1/19200 = approx. 520 us/byte (8 data bits + start & stop bit). + * + * Loop time on polling UART register for received byte is defined in ble_dtm.c as: + * UART_POLL_CYCLE = 260 us + * + * The max time between two bytes thus becomes (loop time: 260us / iteration): + * (5000us + 520us) / 260us / iteration = 21.2 iterations. + * + * This is rounded down to 21. + * + * @note If UART bit rate is changed, this value should be recalculated as well. + */ + +static uint32_t m_baud_rates[] = {[UART_BAUD_RATE_1200] = UART_BAUDRATE_BAUDRATE_Baud1200, + [UART_BAUD_RATE_2400] = UART_BAUDRATE_BAUDRATE_Baud2400, + [UART_BAUD_RATE_4800] = UART_BAUDRATE_BAUDRATE_Baud4800, + [UART_BAUD_RATE_9600] = UART_BAUDRATE_BAUDRATE_Baud9600, + [UART_BAUD_RATE_14400] = UART_BAUDRATE_BAUDRATE_Baud14400, + [UART_BAUD_RATE_19200] = UART_BAUDRATE_BAUDRATE_Baud19200, + [UART_BAUD_RATE_28800] = UART_BAUDRATE_BAUDRATE_Baud28800, + [UART_BAUD_RATE_38400] = UART_BAUDRATE_BAUDRATE_Baud38400, + [UART_BAUD_RATE_57600] = UART_BAUDRATE_BAUDRATE_Baud57600, + [UART_BAUD_RATE_76800] = UART_BAUDRATE_BAUDRATE_Baud76800, + [UART_BAUD_RATE_115200] = UART_BAUDRATE_BAUDRATE_Baud115200, }; + +static uint32_t m_iteration[] = {[UART_BAUD_RATE_1200] = 51, + [UART_BAUD_RATE_2400] = 35, + [UART_BAUD_RATE_4800] = 27, + [UART_BAUD_RATE_9600] = 23, + [UART_BAUD_RATE_14400] = 21, + [UART_BAUD_RATE_19200] = 21, + [UART_BAUD_RATE_28800] = 20, + [UART_BAUD_RATE_38400] = 20, + [UART_BAUD_RATE_57600] = 19, + [UART_BAUD_RATE_76800] = 19, + [UART_BAUD_RATE_115200] = 19, }; + +static uint32_t m_iterations_next_byte_max = 51; + +/**@brief Function for UART initialization. + */ +static uint32_t uart_init(app_uart_stream_comm_params_t * p_comm_params) +{ + if (p_comm_params->baud_rate > UART_BAUD_RATE_115200) + { + return NRF_ERROR_INVALID_PARAM; + } + + nrf_drv_uart_config_t config = NRF_DRV_UART_DEFAULT_CONFIG; + + config.pselrxd = p_comm_params->rx_pin_no; + config.pseltxd = p_comm_params->tx_pin_no; + config.baudrate = (nrf_uart_baudrate_t) m_baud_rates[p_comm_params->baud_rate]; + config.hwfc = NRF_UART_HWFC_DISABLED; + config.parity = NRF_UART_PARITY_EXCLUDED; + + nrf_drv_uart_uninit(); + uint32_t err_code = nrf_drv_uart_init(&config, NULL); + if (err_code != NRF_SUCCESS) + { + return err_code; + } + nrf_drv_uart_rx_enable(); + + m_iterations_next_byte_max = m_iteration[p_comm_params->baud_rate]; + + return NRF_SUCCESS; +} + + +/**@brief Function for splitting UART command bit fields into separate command parameters for the DTM library. + * + * @param[in] command The packed UART command. + * @return result status from dtmlib. + */ +static uint32_t dtm_cmd_put(uint16_t command) +{ + dtm_cmd_t command_code = (command >> 14) & 0x03; + dtm_freq_t freq = (command >> 8) & 0x3F; + uint32_t length = (command >> 2) & 0x3F; + dtm_pkt_type_t payload = command & 0x03; + + //Check for Vendor Specific payload. + if (payload == 0x03) + { + /* Note that in a HCI adaption layer, as well as in the DTM PDU format, + the value 0x03 is a distinct bit pattern (PRBS15). Even though BLE does not + support PRBS15, this implementation re-maps 0x03 to DTM_PKT_VENDORSPECIFIC, + to avoid the risk of confusion, should the code be extended to greater coverage. + */ + payload = DTM_PKT_VENDORSPECIFIC; + } + return dtm_cmd(command_code, freq, length, payload); +} + + +/**@brief Function for application main entry. + * + * @details This function serves as an adaptation layer between a 2-wire UART interface and the + * dtmlib. After initialization, DTM commands submitted through the UART are forwarded to + * dtmlib and events (i.e. results from the command) is reported back through the UART. + */ +uint32_t dtm_start(app_uart_stream_comm_params_t uart_comm_params) +{ + uint32_t current_time; + uint32_t dtm_error_code; + uint32_t msb_time = 0; //Time when MSB of the DTM command was read. Used to catch stray bytes from "misbehaving" testers. + bool is_msb_read = false; //True when MSB of the DTM command has been read and the application is waiting for LSB. + uint16_t dtm_cmd_from_uart = 0; //Packed command containing command_code:freqency:length:payload in 2:6:6:2 bits. + uint8_t rx_byte; //Last byte read from UART. + dtm_event_t result; //Result of a DTM operation. + uint32_t err_code; + + err_code = uart_init(&uart_comm_params); + + if (err_code != NRF_SUCCESS) + { + return err_code; + } + + dtm_error_code = dtm_init(); + + if (dtm_error_code != DTM_SUCCESS) + { + //If DTM cannot be correctly initialized, then we just return. + return NRF_ERROR_INTERNAL; + } + + for (;; ) + { + //Will return every timeout, 625 us. + current_time = dtm_wait(); + + if (NRF_SUCCESS != nrf_drv_uart_rx(&rx_byte,1)) + { + return NRF_ERROR_INTERNAL; + } + + if (!is_msb_read) + { + //This is first byte of two-byte command. + is_msb_read = true; + dtm_cmd_from_uart = ((dtm_cmd_t)rx_byte) << 8; + msb_time = current_time; + + //Go back and wait for 2nd byte of command word. + continue; + } + + //This is the second byte read; combine it with the first and process command + if (current_time > (msb_time + m_iterations_next_byte_max)) + { + //More than ~5mS after msb: Drop old byte, take the new byte as MSB. + //The variable is_msb_read will remains true. + //Go back and wait for 2nd byte of the command word. + dtm_cmd_from_uart = ((dtm_cmd_t)rx_byte) << 8; + msb_time = current_time; + continue; + } + + //2-byte UART command received. + is_msb_read = false; + dtm_cmd_from_uart |= (dtm_cmd_t)rx_byte; + + if (dtm_cmd_put(dtm_cmd_from_uart) != DTM_SUCCESS) + { + //Extended error handling may be put here. + //Default behavior is to return the event on the UART (see below); + //the event report will reflect any lack of success. + } + + //Retrieve result of the operation. This implementation will busy-loop + //for the duration of the byte transmissions on the UART. + if (dtm_event_get(&result)) + { + //Report command status on the UART. + uint8_t tx_byte = (result >> 8) & 0xFF; + + //Transmit MSB of the result. + (void)nrf_drv_uart_tx(&tx_byte, 1); + + //Transmit LSB of the result. + tx_byte = result & 0xFF; + (void)nrf_drv_uart_tx(&tx_byte, 1); + } + } +} + +/// @} diff --git a/components/serialization/connectivity/hal/dtm_uart.h b/components/serialization/connectivity/hal/dtm_uart.h new file mode 100644 index 0000000..cdb5790 --- /dev/null +++ b/components/serialization/connectivity/hal/dtm_uart.h @@ -0,0 +1,23 @@ +/* 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. + * + */ + +#ifndef DTM_UART_H__ +#define DTM_UART_H__ + +#include +#include "dtm_uart_params.h" + +#define UART_PIN_DISCONNECTED 0xFFFFFFFF /**< Value indicating that no pin is connected to this UART register. */ + +uint32_t dtm_start(app_uart_stream_comm_params_t uart_comm_params); + +#endif // DTM_UART_H__ diff --git a/components/serialization/connectivity/pstorage_platform.h b/components/serialization/connectivity/pstorage_platform.h new file mode 100644 index 0000000..0dbda63 --- /dev/null +++ b/components/serialization/connectivity/pstorage_platform.h @@ -0,0 +1,60 @@ +/* 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. + * + */ + + /** @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 + +#define PSTORAGE_FLASH_PAGE_SIZE ((uint16_t)NRF_FICR->CODEPAGESIZE) /**< Size of one flash page. */ +#define PSTORAGE_FLASH_EMPTY_MASK 0xFFFFFFFF /**< Bit mask that defines an empty address in flash. */ + +#define PSTORAGE_FLASH_PAGE_END \ + ((NRF_UICR->BOOTLOADERADDR != PSTORAGE_FLASH_EMPTY_MASK) \ + ? (NRF_UICR->BOOTLOADERADDR / PSTORAGE_FLASH_PAGE_SIZE) \ + : NRF_FICR->CODESIZE) + + +#define PSTORAGE_NUM_OF_PAGES 2 /**< 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) \ + * PSTORAGE_FLASH_PAGE_SIZE) /**< Start address for persistent data, configurable according to system requirements. */ +#define PSTORAGE_DATA_END_ADDR (PSTORAGE_FLASH_PAGE_END * PSTORAGE_FLASH_PAGE_SIZE) /**< End address for persistent data, configurable according to system requirements. */ +#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 30 /**< 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/components/serialization/connectivity/ser_conn_cmd_decoder.c b/components/serialization/connectivity/ser_conn_cmd_decoder.c new file mode 100644 index 0000000..b54afa6 --- /dev/null +++ b/components/serialization/connectivity/ser_conn_cmd_decoder.c @@ -0,0 +1,97 @@ +/* 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 +#include +#include "nordic_common.h" +#include "app_error.h" +#include "ble_serialization.h" +#include "ser_config.h" +#include "conn_mw.h" +#include "ser_hal_transport.h" +#include "ser_conn_cmd_decoder.h" + + +uint32_t ser_conn_command_process(uint8_t * p_command, uint16_t command_len) +{ + SER_ASSERT_NOT_NULL(p_command); + SER_ASSERT_LENGTH_LEQ(SER_OP_CODE_SIZE, command_len); + + uint32_t err_code = NRF_SUCCESS; + uint8_t * p_tx_buf = NULL; + uint32_t tx_buf_len = 0; + uint8_t opcode = p_command[SER_CMD_OP_CODE_POS]; + uint32_t index = 0; + + /* Allocate a memory buffer from HAL Transport layer for transmitting the Command Response. + * Loop until a buffer is available. */ + do + { + err_code = ser_hal_transport_tx_pkt_alloc(&p_tx_buf, (uint16_t *)&tx_buf_len); + } + while (NRF_ERROR_NO_MEM == err_code); + + if (NRF_SUCCESS == err_code) + { + /* Create a new response packet. */ + p_tx_buf[SER_PKT_TYPE_POS] = SER_PKT_TYPE_RESP; + tx_buf_len -= SER_PKT_TYPE_SIZE; + + /* Decode a request, pass a memory for a response command (opcode + data) and encode it. */ + err_code = conn_mw_handler + (p_command, command_len, &p_tx_buf[SER_PKT_OP_CODE_POS], &tx_buf_len); + + /* Command decoder not found. */ + if (NRF_ERROR_NOT_SUPPORTED == err_code) + { + APP_ERROR_CHECK(SER_WARNING_CODE); + err_code = op_status_enc + (opcode, NRF_ERROR_NOT_SUPPORTED, + &p_tx_buf[SER_PKT_OP_CODE_POS], &tx_buf_len, &index); + if (NRF_SUCCESS == err_code) + { + tx_buf_len += SER_PKT_TYPE_SIZE; + err_code = ser_hal_transport_tx_pkt_send(p_tx_buf, (uint16_t)tx_buf_len); + /* TX buffer is going to be freed automatically in the HAL Transport layer. */ + if (NRF_SUCCESS != err_code) + { + err_code = NRF_ERROR_INTERNAL; + } + } + else + { + err_code = NRF_ERROR_INTERNAL; + } + } + else if (NRF_SUCCESS == err_code) /* Send a response. */ + { + tx_buf_len += SER_PKT_TYPE_SIZE; + err_code = ser_hal_transport_tx_pkt_send(p_tx_buf, (uint16_t)tx_buf_len); + + /* TX buffer is going to be freed automatically in the HAL Transport layer. */ + if (NRF_SUCCESS != err_code) + { + err_code = NRF_ERROR_INTERNAL; + } + } + else + { + err_code = NRF_ERROR_INTERNAL; + } + } + else + { + err_code = NRF_ERROR_INTERNAL; + } + + return err_code; +} diff --git a/components/serialization/connectivity/ser_conn_cmd_decoder.h b/components/serialization/connectivity/ser_conn_cmd_decoder.h new file mode 100644 index 0000000..ad51944 --- /dev/null +++ b/components/serialization/connectivity/ser_conn_cmd_decoder.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. + * + */ + +/** + * @addtogroup ser_conn Connectivity application code + * @ingroup ble_sdk_lib_serialization + */ + +/** @file + * + * @defgroup ser_cmd_decoder Command decoder in the connectivity chip + * @{ + * @ingroup ser_conn + * + * @brief Decoder for serialized commands from an Application Chip. + * + * @details This file contains declaration of common function used for commands decoding and sending + * responses back to an Application Chip after a command is processed. + */ + +#ifndef SER_CONN_CMD_DECODER_H__ +#define SER_CONN_CMD_DECODER_H__ + +#include + +/**@brief A function decodes an encoded command and sends a response to an Application Chip. + * + * @details The function decodes an encoded command and calls a SoftDevice API function when a + * command decoder was found or forms a common response with error code + * NRF_ERROR_NOT_SUPPORTED otherwise. Then the function sends a SoftDevice response or + * the response with NRF_ERROR_NOT_SUPPORTED error code to an Application Chip. + * + * @param[in] p_command The encoded command. + * @param[in] command_len Length of the encoded command including opcode. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. + * @retval NRF_ERROR_INTERNAL Operation failure. Internal error ocurred. . + */ +uint32_t ser_conn_command_process(uint8_t * p_command, uint16_t command_len); + +#endif /* SER_CONN_CMD_DECODER_H__ */ + +/** @} */ diff --git a/components/serialization/connectivity/ser_conn_dtm_cmd_decoder.c b/components/serialization/connectivity/ser_conn_dtm_cmd_decoder.c new file mode 100644 index 0000000..075ae81 --- /dev/null +++ b/components/serialization/connectivity/ser_conn_dtm_cmd_decoder.c @@ -0,0 +1,94 @@ +/* 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_util.h" +#include "ble_dtm_conn.h" +#include "ble_serialization.h" +#include "nrf_error.h" +#include "softdevice_handler.h" +#include "ser_conn_dtm_cmd_decoder.h" +#include "ser_hal_transport.h" + +static bool m_is_ready_to_enter_dtm = false; +static app_uart_stream_comm_params_t m_comm_params = { 0 }; + +uint32_t ser_conn_dtm_command_process(uint8_t * p_command, uint16_t command_len) +{ + SER_ASSERT_NOT_NULL(p_command); + + uint32_t err_code = NRF_SUCCESS; + uint8_t * p_tx_buf = NULL; + uint32_t tx_buf_len = 0; + + /* Allocate a memory buffer from HAL Transport layer for transmitting the Command Response. + * Loop until a buffer is available. */ + do + { + err_code = ser_hal_transport_tx_pkt_alloc(&p_tx_buf, (uint16_t *)&tx_buf_len); + } + while (NRF_ERROR_NO_MEM == err_code); + + if (err_code == NRF_SUCCESS) + { + p_tx_buf[SER_PKT_TYPE_POS] = SER_PKT_TYPE_DTM_RESP; + tx_buf_len -= SER_PKT_TYPE_SIZE; + + err_code = ble_dtm_init_req_dec(p_command, command_len, &m_comm_params); + + if (NRF_SUCCESS == err_code) + { + err_code = ble_dtm_init_rsp_enc(NRF_SUCCESS, + &p_tx_buf[SER_PKT_TYPE_SIZE], + &tx_buf_len); + + if (err_code != NRF_SUCCESS) + { + return NRF_ERROR_INTERNAL; + } + + tx_buf_len += SER_PKT_TYPE_SIZE; + + /* Set a flag that device is ready to enter DTM mode. */ + m_is_ready_to_enter_dtm = true; + + err_code = ser_hal_transport_tx_pkt_send(p_tx_buf, (uint16_t)tx_buf_len); + if (err_code != NRF_SUCCESS) + { + err_code = NRF_ERROR_INTERNAL; + } + + /* TX buffer is going to be freed automatically in the HAL Transport layer. */ + } + else + { + err_code = NRF_ERROR_INTERNAL; + } + } + + return err_code; +} + + +void ser_conn_is_ready_to_enter_dtm(void) +{ + if (m_is_ready_to_enter_dtm) + { + /* Disable SoftDevice. */ + (void)sd_softdevice_disable(); + + /* Close HAL Transport Layer. */ + ser_hal_transport_close(); + + /* Start DTM mode. */ + (void)dtm_start(m_comm_params); + } +} diff --git a/components/serialization/connectivity/ser_conn_dtm_cmd_decoder.h b/components/serialization/connectivity/ser_conn_dtm_cmd_decoder.h new file mode 100644 index 0000000..5866845 --- /dev/null +++ b/components/serialization/connectivity/ser_conn_dtm_cmd_decoder.h @@ -0,0 +1,62 @@ +/* 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. + * + */ + +/** + * @addtogroup ser_conn Connectivity application code + * @ingroup ble_sdk_lib_serialization + */ + +/** @file + * + * @defgroup ser_dtm_decoder DTM Command Decoder in the connectivity chip + * @{ + * @ingroup ser_conn + * + * @brief Decoder for serialized DTM commands from an Application Chip. + * + * @details This file contains declaration of common function used for DTM commands decoding and + * sending responses back to an Application Chip after a DTM command is processed. + */ + +#ifndef SER_CONN_DTM_CMD_DECODER_H__ +#define SER_CONN_DTM_CMD_DECODER_H__ + +#include + +/**@brief A function for processing the encoded DTM commands from an Application Chip. + * + * @details The function decodes encoded DTM commands and calls the appropriate DTM API. + * Then creates a DTM Command Response packet with the return value from the + * DTM API encoded in it and sends it to an Application Chip. + * + * @param[in] p_command The encoded command. + * @param[in] command_len Length of the encoded command. + * + * @retval NRF_SUCCESS If the decoding of the command was successful, the DTM API + * was called, and the command response was sent to peer, otherwise an + * error code. + */ +uint32_t ser_conn_dtm_command_process(uint8_t * p_command, uint16_t command_len); + + +/**@brief A function for checking if Connectivity Chip is ready to enter the DTM mode. + * + * @details The function checks if Connectivity Chip is ready to enter into DTM mode. + * If it is ready then it disables SoftDevice, closes HAL Transport Layer + * and starts DTM mode. + */ +void ser_conn_is_ready_to_enter_dtm(void); + +#endif /* SER_CONN_DTM_CMD_DECODER_H__ */ + +/** @} */ + diff --git a/components/serialization/connectivity/ser_conn_error_handling.c b/components/serialization/connectivity/ser_conn_error_handling.c new file mode 100644 index 0000000..ed57952 --- /dev/null +++ b/components/serialization/connectivity/ser_conn_error_handling.c @@ -0,0 +1,104 @@ +/* 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 "nrf_assert.h" +#include "app_error.h" +#include "ser_config.h" + +#include "boards.h" + +/** @file + * + * @defgroup ser_conn_error_handling Errors handling for the Connectivity Chip. + * @{ + * @ingroup sdk_lib_serialization + * + * @brief A module to handle the Connectivity Chip errors and warnings. + * + * @details This file contains definitions of functions used for handling the Connectivity Chip + * errors and warnings. + */ + +/**@brief Function for handling the Connectivity Chip errors and warnings. + * + * @details This function will be called if the ASSERT macro in the connectivity application fails. + * Function declaration can be found in the app_error.h file. + * + * @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. + */ + +#include "app_util_platform.h" +#include "nrf_soc.h" + +// uint32_t m_error_code; +// uint32_t m_error_line_num; +// const uint8_t *m_p_error_file_name; + +void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name) +{ + // disable INTs + CRITICAL_REGION_ENTER(); + + #if LEDS_NUMBER > 0 + + /* Light a LED on error or warning. */ + // nrf_gpio_cfg_output(SER_CONN_ASSERT_LED_PIN); + // nrf_gpio_pin_set(SER_CONN_ASSERT_LED_PIN); + + #endif + + // m_p_error_file_name = p_file_name; + // m_error_code = error_code; + // m_error_line_num = line_num; + + /* Do not reset when warning. */ + if(SER_WARNING_CODE != error_code) + { + /* This call can be used for debug purposes during application development. + * @note CAUTION: Activating code below 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. Un-comment the line below to use. */ + + /* ble_debug_assert_handler(error_code, line_num, p_file_name); */ + +#if 0 + /* Reset the chip. Should be used in the release version. */ + NVIC_SystemReset(); +#else /* Debug version. */ + /* To be able to see function parameters in a debugger. */ + uint32_t temp = 1; + while(temp); +#endif + + } + + CRITICAL_REGION_EXIT(); +} + + +/**@brief Callback function for asserts in the SoftDevice. + * + * @details This function will be called if the ASSERT macro in the SoftDevice fails. Function + * declaration can be found in the nrf_assert.h file. + * + * @param[in] line_num Line number of the failing ASSERT call. + * @param[in] p_file_name File name of the failing ASSERT call. + */ +void assert_nrf_callback(uint16_t line_num, const uint8_t * p_file_name) +{ + app_error_handler(SER_SD_ERROR_CODE, line_num, p_file_name); +} +/** @} */ diff --git a/components/serialization/connectivity/ser_conn_event_encoder.c b/components/serialization/connectivity/ser_conn_event_encoder.c new file mode 100644 index 0000000..60f1ba1 --- /dev/null +++ b/components/serialization/connectivity/ser_conn_event_encoder.c @@ -0,0 +1,75 @@ +/* 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 +#include +#include "app_error.h" +#include "app_scheduler.h" +#include "ble_conn.h" +#include "ble_serialization.h" +#include "ser_config.h" +#include "ser_hal_transport.h" +#include "ser_conn_event_encoder.h" + + +void ser_conn_ble_event_encoder(void * p_event_data, uint16_t event_size) +{ + if (NULL == p_event_data) + { + APP_ERROR_CHECK(NRF_ERROR_NULL); + } + UNUSED_PARAMETER(event_size); + + uint32_t err_code = NRF_SUCCESS; + uint8_t * p_tx_buf = NULL; + uint32_t tx_buf_len = 0; + ble_evt_t * p_ble_evt = (ble_evt_t *)p_event_data; + + /* Allocate a memory buffer from HAL Transport layer for transmitting an event. + * Loop until a buffer is available. */ + do + { + err_code = ser_hal_transport_tx_pkt_alloc(&p_tx_buf, (uint16_t *)&tx_buf_len); + } + while (err_code == NRF_ERROR_NO_MEM); + APP_ERROR_CHECK(err_code); + + /* Create a new packet. */ + p_tx_buf[SER_PKT_TYPE_POS] = SER_PKT_TYPE_EVT; + tx_buf_len -= SER_PKT_TYPE_SIZE; + + /* Pass a memory for an event (opcode + data) and encode it. */ + err_code = ble_event_enc(p_ble_evt, 0, &p_tx_buf[SER_PKT_OP_CODE_POS], &tx_buf_len); + + if (NRF_ERROR_NOT_SUPPORTED != err_code) + { + APP_ERROR_CHECK(err_code); + tx_buf_len += SER_PKT_TYPE_SIZE; + err_code = ser_hal_transport_tx_pkt_send(p_tx_buf, (uint16_t)tx_buf_len); + APP_ERROR_CHECK(err_code); + /* TX buffer is going to be freed automatically in the HAL Transport layer. + * Scheduler must be paused because this function returns before a packet is physically sent + * by transport layer. This can cause start processing of a next event from the application + * scheduler queue. In result the next event reserves the TX buffer before the current + * packet is sent. If in meantime a command arrives a command response cannot be sent in + * result. Pausing the scheduler temporary prevents processing a next event. */ + app_sched_pause(); + } + else + { + /* Event was NOT encoded, therefore the buffer is freed immediately. */ + err_code = ser_hal_transport_tx_pkt_free(p_tx_buf); + APP_ERROR_CHECK(err_code); + APP_ERROR_CHECK(SER_WARNING_CODE); + } +} + diff --git a/components/serialization/connectivity/ser_conn_event_encoder.h b/components/serialization/connectivity/ser_conn_event_encoder.h new file mode 100644 index 0000000..141ede0 --- /dev/null +++ b/components/serialization/connectivity/ser_conn_event_encoder.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +/** + * @addtogroup ser_conn Connectivity application code + * @ingroup ble_sdk_lib_serialization + */ + +/** @file + * + * @defgroup ser_event_encoder Events encoder in the connectivity chip + * @{ + * @ingroup ser_conn + * + * @brief Events encoder for BLE SoftDevice. + * + * @details This file contains declaration of common function used for serializing BLE SoftDevice + * events. + * + */ +#ifndef SER_CONN_EVENT_ENCODER_H__ +#define SER_CONN_EVENT_ENCODER_H__ + +#include + +/**@brief A function for encoding a @ref ble_evt_t. The function passes the serialized byte stream + * to the transport layer after encoding. + * + * @details The function is called by the application scheduler to process an event previously + * pulled from BLE SoftDevice. + * The function creates a new packet, calls an appropriate event encoder and sends the + * packet to an Application Chip. + * + * @param[in] p_event_data Pointer to event data of type @ref ble_evt_t. + * @param[in] event_size Event data size. + */ +void ser_conn_ble_event_encoder(void * p_event_data, uint16_t event_size); + +#endif /* SER_CONN_EVENT_ENCODER_H__ */ + +/** @} */ diff --git a/components/serialization/connectivity/ser_conn_handlers.c b/components/serialization/connectivity/ser_conn_handlers.c new file mode 100644 index 0000000..854fe4f --- /dev/null +++ b/components/serialization/connectivity/ser_conn_handlers.c @@ -0,0 +1,129 @@ +/* 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 +#include "app_error.h" +#include "app_scheduler.h" +#include "ser_config.h" +#include "ser_conn_handlers.h" +#include "ser_conn_event_encoder.h" +#include "ser_conn_pkt_decoder.h" +#include "ser_conn_dtm_cmd_decoder.h" + + +/** @file + * + * @defgroup ser_conn_handlers Events handlers for the Connectivity Chip. + * @{ + * @ingroup sdk_lib_serialization + * + * @brief A module to handle the Connectivity application events. + * + * @details There are two types of events in the Connectivity application: BLE events generated by + * the SoftDevice and events generated by the HAL Transport layer. + */ + +/** Parameters of a received packet. */ +static ser_hal_transport_evt_rx_pkt_received_params_t m_rx_pkt_received_params; + +/** Indicator of received packet that should be process. */ +static bool m_rx_pkt_to_process = false; + + +void ser_conn_hal_transport_event_handle(ser_hal_transport_evt_t event) +{ + switch (event.evt_type) + { + case SER_HAL_TRANSP_EVT_TX_PKT_SENT: + { + /* SoftDevice event or response to received packet was sent, so unblock the application + * scheduler to process a next event. */ + app_sched_resume(); + + /* Check if chip is ready to enter DTM mode. */ + ser_conn_is_ready_to_enter_dtm(); + + break; + } + + case SER_HAL_TRANSP_EVT_RX_PKT_RECEIVING: + { + /* The connectivity side has started receiving a packet. Temporary block processing + * SoftDevice events. It is going to be unblocked when a response for the packet will + * be sent. This prevents communication block. */ + app_sched_pause(); + break; + } + + case SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED: + { + /* We can NOT add received packets as events to the application scheduler queue because + * received packets have to be processed before SoftDevice events but the scheduler + * queue do not have priorities. */ + memcpy(&m_rx_pkt_received_params, &event.evt_params.rx_pkt_received, + sizeof (ser_hal_transport_evt_rx_pkt_received_params_t)); + m_rx_pkt_to_process = true; + break; + } + + case SER_HAL_TRANSP_EVT_RX_PKT_DROPPED: + { + APP_ERROR_CHECK(SER_WARNING_CODE); + break; + } + + case SER_HAL_TRANSP_EVT_PHY_ERROR: + { + APP_ERROR_CHECK(NRF_ERROR_FORBIDDEN); + break; + } + + default: + { + /* do nothing */ + break; + } + } +} + + +uint32_t ser_conn_rx_process(void) +{ + uint32_t err_code = NRF_SUCCESS; + + if (m_rx_pkt_to_process) + { + /* No critical section needed on m_rx_pkt_to_process parameter because it is not possible + * to get next packet before sending a response. */ + m_rx_pkt_to_process = false; + err_code = ser_conn_received_pkt_process(&m_rx_pkt_received_params); + } + + return err_code; +} + + +void ser_conn_ble_event_handle(ble_evt_t * p_ble_evt) +{ + uint32_t err_code = NRF_SUCCESS; + + /* We can NOT encode and send BLE events here. SoftDevice handler implemented in + * softdevice_handler.c pull all available BLE events at once but we need to reschedule between + * encoding and sending every BLE event because sending a response on received packet has higher + * priority than sending a BLE event. Solution for that is to put BLE events into application + * scheduler queue to be processed at a later time. */ + err_code = app_sched_event_put(p_ble_evt, sizeof (ble_evt_hdr_t) + p_ble_evt->header.evt_len, + ser_conn_ble_event_encoder); + APP_ERROR_CHECK(err_code); +} + +/** @} */ diff --git a/components/serialization/connectivity/ser_conn_handlers.h b/components/serialization/connectivity/ser_conn_handlers.h new file mode 100644 index 0000000..acbd027 --- /dev/null +++ b/components/serialization/connectivity/ser_conn_handlers.h @@ -0,0 +1,84 @@ +/* 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. + * + */ + + +/** + * @addtogroup ser_conn Connectivity application code + * @ingroup ble_sdk_lib_serialization + */ + + +/** @file + * + * @defgroup ser_conn_handlers Events handlers in the connectivity chip + * @{ + * @ingroup ser_conn + * + * @brief Events handlers used to process high level events in the connectivity application. + * + * @details This file contains functions: processing the HAL Transport layer events, processing BLE + * SoftDevice events, starting processing received packets. + */ + +#ifndef SER_CONN_HANDLERS_H__ +#define SER_CONN_HANDLERS_H__ + +#include +#include "nordic_common.h" +#include "app_util.h" +#include "ble_stack_handler_types.h" +#include "ant_stack_handler_types.h" +#include "softdevice_handler.h" +#include "ble.h" +#include "ser_hal_transport.h" + +/** Maximum number of events in the application scheduler queue. */ +#define SER_CONN_SCHED_QUEUE_SIZE 16u + +/** Maximum size of events data in the application scheduler queue aligned to 32 bits - this is + * size of the buffer created in the SOFTDEVICE_HANDLER_INIT macro, which stores events pulled + * from the SoftDevice. */ +#define SER_CONN_SCHED_MAX_EVENT_DATA_SIZE ((CEIL_DIV(MAX( \ + MAX(BLE_STACK_EVT_MSG_BUF_SIZE, \ + ANT_STACK_EVT_STRUCT_SIZE), \ + SYS_EVT_MSG_BUF_SIZE \ + ), \ + sizeof(uint32_t))) * \ + sizeof(uint32_t)) + + +/**@brief A function for processing the HAL Transport layer events. + * + * @param[in] event HAL Transport layer event. + */ +void ser_conn_hal_transport_event_handle(ser_hal_transport_evt_t event); + + +/**@brief A function to call the function to process a packet when it is fully received. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. + * @retval NRF_ERROR_INTERNAL Operation failure. Internal error ocurred. + */ +uint32_t ser_conn_rx_process(void); + + +/**@brief A function for processing BLE SoftDevice events. + * + * @details BLE events are put into application scheduler queue to be processed at a later time. + * + * @param[in] p_ble_evt A pointer to a BLE event. + */ +void ser_conn_ble_event_handle(ble_evt_t * p_ble_evt); + +#endif /* SER_CONN_HANDLERS_H__ */ +/** @} */ diff --git a/components/serialization/connectivity/ser_conn_pkt_decoder.c b/components/serialization/connectivity/ser_conn_pkt_decoder.c new file mode 100644 index 0000000..f158799 --- /dev/null +++ b/components/serialization/connectivity/ser_conn_pkt_decoder.c @@ -0,0 +1,86 @@ +/* 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 +#include +#include "nordic_common.h" +#include "app_error.h" +#include "softdevice_handler.h" +#include "ble_serialization.h" +#include "ser_config.h" +#include "ser_hal_transport.h" +#include "ser_conn_pkt_decoder.h" +#include "ser_conn_cmd_decoder.h" +#include "ser_conn_dtm_cmd_decoder.h" +#include "ser_conn_reset_cmd_decoder.h" + + +uint32_t ser_conn_received_pkt_process( + ser_hal_transport_evt_rx_pkt_received_params_t * p_rx_pkt_params) +{ + uint32_t err_code = NRF_SUCCESS; + + if (NULL != p_rx_pkt_params) + { + /* For further processing pass only command (opcode + data). */ + uint8_t * p_command = &p_rx_pkt_params->p_buffer[SER_PKT_OP_CODE_POS]; + uint16_t command_len = p_rx_pkt_params->num_of_bytes - SER_PKT_TYPE_SIZE; + + switch (p_rx_pkt_params->p_buffer[SER_PKT_TYPE_POS]) + { + case SER_PKT_TYPE_CMD: + { + err_code = ser_conn_command_process(p_command, command_len); + break; + } + + case SER_PKT_TYPE_DTM_CMD: + { + err_code = ser_conn_dtm_command_process(p_command, command_len); + break; + } + + case SER_PKT_TYPE_RESET_CMD: + { + ser_conn_reset_command_process(); + break; + } + + default: + { + APP_ERROR_CHECK(SER_WARNING_CODE); + break; + } + } + + if (NRF_SUCCESS == err_code) + { + /* Free a received packet. */ + err_code = ser_hal_transport_rx_pkt_free(p_rx_pkt_params->p_buffer); + + if (NRF_SUCCESS != err_code) + { + err_code = NRF_ERROR_INTERNAL; + } + } + else + { + err_code = NRF_ERROR_INTERNAL; + } + } + else + { + err_code = NRF_ERROR_NULL; + } + + return err_code; +} diff --git a/components/serialization/connectivity/ser_conn_pkt_decoder.h b/components/serialization/connectivity/ser_conn_pkt_decoder.h new file mode 100644 index 0000000..1f39872 --- /dev/null +++ b/components/serialization/connectivity/ser_conn_pkt_decoder.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +/** + * @addtogroup ser_conn Connectivity application code + * @ingroup ble_sdk_lib_serialization + */ + +/** @file + * + * @defgroup ser_pkt_decoder Packets decoder in the connectivity chip + * @{ + * @ingroup ser_conn + * + * @brief Decoder for serialized packets from an Application Chip. + * + * @details This file contains declaration of common function used for processing packets (packets + * dispatcher) received by the transport layer. + */ + +#ifndef SER_CONN_PKT_DECODER_H__ +#define SER_CONN_PKT_DECODER_H__ + +#include +#include "ser_hal_transport.h" + +/**@brief A function for dispatching packets from an Application Chip to an appropriate decoder. + * + * @details The function is called to process received packets from a transport layer. + * The function analyzes packet type and calls appropriate command decoder which among + * other things processes command and sends a response. Then a received packet is freed. + * + * @param[in] p_rx_pkt_params A pointer to a transport layer event of type + * @ref ser_hal_transport_evt_rx_pkt_received_params_t. + * + * @retval NRF_SUCCESS Operation success. + * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied. + * @retval NRF_ERROR_INTERNAL Operation failure. Internal error ocurred. + */ +uint32_t ser_conn_received_pkt_process( + ser_hal_transport_evt_rx_pkt_received_params_t * p_rx_pkt_params); + +#endif /* SER_CONN_PKT_DECODER_H__ */ + +/** @} */ diff --git a/components/serialization/connectivity/ser_conn_reset_cmd_decoder.c b/components/serialization/connectivity/ser_conn_reset_cmd_decoder.c new file mode 100644 index 0000000..9b25fe8 --- /dev/null +++ b/components/serialization/connectivity/ser_conn_reset_cmd_decoder.c @@ -0,0 +1,20 @@ +/* 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 "nrf_soc.h" +#include "ser_conn_reset_cmd_decoder.h" + +void ser_conn_reset_command_process() +{ + (void)sd_nvic_SystemReset(); + while(1); +} diff --git a/components/serialization/connectivity/ser_conn_reset_cmd_decoder.h b/components/serialization/connectivity/ser_conn_reset_cmd_decoder.h new file mode 100644 index 0000000..7492642 --- /dev/null +++ b/components/serialization/connectivity/ser_conn_reset_cmd_decoder.h @@ -0,0 +1,45 @@ +/* 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. + * + */ + +/** + * @addtogroup ser_conn Connectivity application code + * @ingroup ble_sdk_lib_serialization + */ + +/** @file + * + * @defgroup ser_reset_cmd_decoder Reset Command Decoder in the connectivity chip + * @{ + * @ingroup ser_conn + * + * @brief Decoder for serialized reset command from an Application Chip. + * + * @details This file contains declaration of common function used for reset command decoding and + * sending responses back to an Application Chip after a command is processed. + */ + +#ifndef SER_CONN_RESET_CMD_DECODER_H__ +#define SER_CONN_RESET_CMD_DECODER_H__ + +#include + +/**@brief A function for processing the encoded reset commands from an Application Chip. + * + * @details The function decodes encoded system reset command and performs software reset. + * This command does not send back the Command Response packet to an Application Chip. + */ +void ser_conn_reset_command_process(void); + +#endif /* SER_CONN_RESET_CMD_DECODER_H__ */ + +/** @} */ + diff --git a/components/serialization/connectivity/startup/arm/arm_startup_nrf51.s b/components/serialization/connectivity/startup/arm/arm_startup_nrf51.s new file mode 100644 index 0000000..71f5109 --- /dev/null +++ b/components/serialization/connectivity/startup/arm/arm_startup_nrf51.s @@ -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: +; +; * 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. + +; NOTE: Template files (including this one) are application specific and therefore +; expected to be copied into the application project folder prior to its use! + +; Description message + +Stack_Size EQU 4096 + AREA STACK, NOINIT, READWRITE, ALIGN=3 +Stack_Mem SPACE Stack_Size +__initial_sp + +Heap_Size EQU 0 + + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +Heap_Mem SPACE Heap_Size +__heap_limit + + 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 ; Reset Handler + DCD NMI_Handler ; NMI Handler + DCD HardFault_Handler ; Hard Fault Handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD SVC_Handler ; SVCall Handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD PendSV_Handler ; PendSV Handler + DCD SysTick_Handler ; SysTick Handler + + ; External Interrupts + DCD POWER_CLOCK_IRQHandler ;POWER_CLOCK + DCD RADIO_IRQHandler ;RADIO + DCD UART0_IRQHandler ;UART0 + DCD SPI0_TWI0_IRQHandler ;SPI0_TWI0 + DCD SPI1_TWI1_IRQHandler ;SPI1_TWI1 + DCD 0 ;Reserved + DCD GPIOTE_IRQHandler ;GPIOTE + DCD ADC_IRQHandler ;ADC + DCD TIMER0_IRQHandler ;TIMER0 + DCD TIMER1_IRQHandler ;TIMER1 + DCD TIMER2_IRQHandler ;TIMER2 + DCD RTC0_IRQHandler ;RTC0 + DCD TEMP_IRQHandler ;TEMP + DCD RNG_IRQHandler ;RNG + DCD ECB_IRQHandler ;ECB + DCD CCM_AAR_IRQHandler ;CCM_AAR + DCD WDT_IRQHandler ;WDT + DCD RTC1_IRQHandler ;RTC1 + DCD QDEC_IRQHandler ;QDEC + DCD LPCOMP_IRQHandler ;LPCOMP + DCD SWI0_IRQHandler ;SWI0 + DCD SWI1_IRQHandler ;SWI1 + DCD SWI2_IRQHandler ;SWI2 + DCD SWI3_IRQHandler ;SWI3 + DCD SWI4_IRQHandler ;SWI4 + DCD SWI5_IRQHandler ;SWI5 + DCD 0 ;Reserved + DCD 0 ;Reserved + DCD 0 ;Reserved + DCD 0 ;Reserved + DCD 0 ;Reserved + DCD 0 ;Reserved + + +__Vectors_End + +__Vectors_Size EQU __Vectors_End - __Vectors + + AREA |.text|, CODE, READONLY + +; Reset Handler + +NRF_POWER_RAMON_ADDRESS EQU 0x40000524 ; NRF_POWER->RAMON address +NRF_POWER_RAMON_RAMxON_ONMODE_Msk EQU 0x3 ; All RAM blocks on in onmode bit mask + +Reset_Handler PROC + EXPORT Reset_Handler [WEAK] + IMPORT SystemInit + IMPORT __main + LDR R0, =NRF_POWER_RAMON_ADDRESS + LDR R2, [R0] + MOVS R1, #NRF_POWER_RAMON_RAMxON_ONMODE_Msk + ORRS R2, R2, R1 + STR R2, [R0] + LDR R0, =SystemInit + 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 +SVC_Handler PROC + EXPORT SVC_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 UART0_IRQHandler [WEAK] + EXPORT SPI0_TWI0_IRQHandler [WEAK] + EXPORT SPI1_TWI1_IRQHandler [WEAK] + EXPORT GPIOTE_IRQHandler [WEAK] + EXPORT ADC_IRQHandler [WEAK] + EXPORT TIMER0_IRQHandler [WEAK] + EXPORT TIMER1_IRQHandler [WEAK] + EXPORT TIMER2_IRQHandler [WEAK] + EXPORT RTC0_IRQHandler [WEAK] + EXPORT TEMP_IRQHandler [WEAK] + EXPORT RNG_IRQHandler [WEAK] + EXPORT ECB_IRQHandler [WEAK] + EXPORT CCM_AAR_IRQHandler [WEAK] + EXPORT WDT_IRQHandler [WEAK] + EXPORT RTC1_IRQHandler [WEAK] + EXPORT QDEC_IRQHandler [WEAK] + EXPORT LPCOMP_IRQHandler [WEAK] + EXPORT SWI0_IRQHandler [WEAK] + EXPORT SWI1_IRQHandler [WEAK] + EXPORT SWI2_IRQHandler [WEAK] + EXPORT SWI3_IRQHandler [WEAK] + EXPORT SWI4_IRQHandler [WEAK] + EXPORT SWI5_IRQHandler [WEAK] +POWER_CLOCK_IRQHandler +RADIO_IRQHandler +UART0_IRQHandler +SPI0_TWI0_IRQHandler +SPI1_TWI1_IRQHandler +GPIOTE_IRQHandler +ADC_IRQHandler +TIMER0_IRQHandler +TIMER1_IRQHandler +TIMER2_IRQHandler +RTC0_IRQHandler +TEMP_IRQHandler +RNG_IRQHandler +ECB_IRQHandler +CCM_AAR_IRQHandler +WDT_IRQHandler +RTC1_IRQHandler +QDEC_IRQHandler +LPCOMP_IRQHandler +SWI0_IRQHandler +SWI1_IRQHandler +SWI2_IRQHandler +SWI3_IRQHandler +SWI4_IRQHandler +SWI5_IRQHandler + + B . + ENDP + ALIGN + +; User Initial Stack & Heap + + IF :DEF:__MICROLIB + + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + + ELSE + + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + + LDR R0, = Heap_Mem + LDR R1, = (Stack_Mem + Stack_Size) + LDR R2, = (Heap_Mem + Heap_Size) + LDR R3, = Stack_Mem + BX LR + + ALIGN + + ENDIF + + END + diff --git a/components/softdevice/common/softdevice_handler/ant_stack_handler_types.h b/components/softdevice/common/softdevice_handler/ant_stack_handler_types.h new file mode 100644 index 0000000..23fa569 --- /dev/null +++ b/components/softdevice/common/softdevice_handler/ant_stack_handler_types.h @@ -0,0 +1,69 @@ +/* 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. + * + */ + +/**@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 +{ + uint8_t channel; /**< Channel number. */ + uint8_t event; /**< Event code. */ + uint8_t evt_buffer[ANT_STACK_EVT_MSG_BUF_SIZE]; /**< Event message buffer. */ +} 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/components/softdevice/common/softdevice_handler/ble_stack_handler_types.h b/components/softdevice/common/softdevice_handler/ble_stack_handler_types.h new file mode 100644 index 0000000..ff600f2 --- /dev/null +++ b/components/softdevice/common/softdevice_handler/ble_stack_handler_types.h @@ -0,0 +1,64 @@ +/* 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. + * + */ + +/**@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 "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/components/softdevice/common/softdevice_handler/softdevice_handler.c b/components/softdevice/common/softdevice_handler/softdevice_handler.c new file mode 100644 index 0000000..04187cd --- /dev/null +++ b/components/softdevice/common/softdevice_handler/softdevice_handler.c @@ -0,0 +1,326 @@ +/* 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 "softdevice_handler.h" +#include +#include "nordic_common.h" +#include "app_error.h" +#include "app_util.h" +#include "nrf_assert.h" +#include "nrf_soc.h" +#include "nrf.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 "ble.h" +#endif + +#ifdef NRF51 +#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 +#elif defined (NRF52) +#define SOFTDEVICE_EVT_IRQ SWI2_EGU2_IRQn +#define SOFTDEVICE_EVT_IRQHandler SWI2_EGU2_IRQHandler +#endif /* NRF51 */ + +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 if an ASSERT statement in the SoftDevice fails. + * + * @param[in] pc The value of the program counter when the ASSERT call failed. + * @param[in] line_num Line number of the failing ASSERT call. + * @param[in] file_name File name of the failing ASSERT call. + */ +void softdevice_assertion_handler(uint32_t pc, uint16_t line_num, const uint8_t * file_name) +{ + UNUSED_PARAMETER(pc); + assert_nrf_callback(line_num, file_name); +} + + +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; + } + + bool no_more_soc_evts = (m_sys_evt_handler == NULL); +#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. + m_sys_evt_handler(evt_id); + } + } + +#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.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_lfclksrc_t clock_source, + void * p_ble_evt_buffer, + uint16_t ble_evt_buffer_size, + softdevice_evt_schedule_func_t evt_schedule_func) +{ + uint32_t err_code; + + // 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; + +//Enabling FPU for SoftDevice +#ifdef S132 + SCB->CPACR |= (3UL << 20) | (3UL << 22); + __DSB(); + __ISB(); +#endif + // Initialize SoftDevice. + err_code = sd_softdevice_enable(clock_source, softdevice_assertion_handler); + if (err_code != NRF_SUCCESS) + { + return err_code; + } +#ifdef S132 + SCB->CPACR = 0; + __DSB(); + __ISB(); +#endif + + m_softdevice_enabled = true; + + // Enable BLE event interrupt (interrupt priority has already been set by the stack). + return sd_nvic_EnableIRQ(SOFTDEVICE_EVT_IRQ); +} + + +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) +{ + if (ble_evt_handler == NULL) + { + return NRF_ERROR_NULL; + } + + 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) +{ + if (ant_evt_handler == NULL) + { + return NRF_ERROR_NULL; + } + + 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) +{ + if (sys_evt_handler == NULL) + { + return NRF_ERROR_NULL; + } + + 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(); + } +} diff --git a/components/softdevice/common/softdevice_handler/softdevice_handler.h b/components/softdevice/common/softdevice_handler/softdevice_handler.h new file mode 100644 index 0000000..14c44b5 --- /dev/null +++ b/components/softdevice/common/softdevice_handler/softdevice_handler.h @@ -0,0 +1,157 @@ +/* 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. + * + */ + +/** @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" + +#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. */ + +/**@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_lfclksrc_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] clock_source 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_lfclksrc_t clock_source, + 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); + + +// 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/components/softdevice/common/softdevice_handler/softdevice_handler_appsh.c b/components/softdevice/common/softdevice_handler/softdevice_handler_appsh.c new file mode 100644 index 0000000..eacb33d --- /dev/null +++ b/components/softdevice/common/softdevice_handler/softdevice_handler_appsh.c @@ -0,0 +1,26 @@ +/* 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 "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/components/softdevice/common/softdevice_handler/softdevice_handler_appsh.h b/components/softdevice/common/softdevice_handler/softdevice_handler_appsh.h new file mode 100644 index 0000000..ec78973 --- /dev/null +++ b/components/softdevice/common/softdevice_handler/softdevice_handler_appsh.h @@ -0,0 +1,24 @@ +/* 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 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/components/softdevice/s110/doc/s110_nrf51822_8.0.0_migration_document.pdf b/components/softdevice/s110/doc/s110_nrf51822_8.0.0_migration_document.pdf new file mode 100644 index 0000000000000000000000000000000000000000..40a448e637471a7d0a04d75003082fbc99d62ea0 GIT binary patch literal 188439 zcmeFXcT`hbyFQu_2?(JGQUa)vCQ1(_bOH!UZ_;}Sy-4pE1W{3>BUM0((vd1X3P=@D zdIzOR7m!}=ihFvIUjrf6) zTD|GprwJ=tmMk0bdD1L-6lAi}9gg^=l z@E}DI!UFs}eEcR-QY07`Ydive!T$?TgpfSK{~H>90EYkofFH@jFNEM1Me>LW{st%b zH#kE7=WzIu0z9JsnQZuwJVF2%L17*dJT!hDk-vcv{yztU;^W~5miZqQ^`~fr@G=3= zhzRo_g%QF4Hss&Xp#B*eyn_El8vL91{x{kD3yz2Yj{qJHz#m}*9-Q#s;E4P)ICusB z3yz=w9}n_>5zZeh7D5T&S+MA{}PTco}K@h&k+UZ)6tui(gj3xY&ByA&^2yQC zC+0TB%GDYpCFSAijMeN-aUHf_a>0tZRz@iIe9;+N}1lfEJfCJ8e>}CI3En^ryCu>S~~AAHTRyq zTt{Y~^!X-?8P?Fy*(p^@P!n%U@-jlQN`S ze|nT~YISF1wVIiSoDq#yeTmf8(OjiketyeYCi6=k!K~-{n~_|LvfcvS2@zePI+vt2 z99`IVVxe&yWemgAs6HRo>r>nueJ63zy*V*@bN7?3!8+)dOS)%KcbcdW2UhNB&@W<+ zngkzd+pb52lwNGVv_ju^KW66I1o2^TQA-Mphzzl?gg zjFLst7{CHQETb}okJ4-EB7#|-1P|z69uiBqm3Fv}yL=4lkFzj-ML)F!Wz;+-5;@+ zHzeff<6KfqgCd9+|IT55u{F8BQqOpbeazE~1^DA0W5qSfQZhc&hmEtQmUObEUTt-v znl+u{k4;tm4DaTP{w2J&IENkj8>sY0Hit6oesHj-lIGebLym4jfk8q0(k55$*!*`-> zW&e}zB)~Fbhe(Lk|BW`yXP=xnflvYJ#(M_R#ULKWhvrGwFg zF$bTsH4S4`Z>1ch)7cBp@pZBfzI0-K63oJ?9n+S1w<7taqOeD*HMPuc>ZiL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{Y@BvT$*)Jb3@qd*;h5qCpgb&95 zcYAQbzuOb!`-4{i2M|br{@>$;0;Bt@j1TtLc%e`sVAcGiE)4lW{ZR%N{HtH6AoTCL z2;^7&@4EaD$RBk9iuwPf1(;t!#9!lp3-SNOKLHr*kM|f&rtSf)ff`CH*dJhnA1m7Ry1!#f&$y1;V z*!KU?2Li#56#W0{R|xW#jNk)Uid+(Ye~u3U;rkzC1Pt-lbNqsTzgNJ^@%LQ9`Twd5 zhapW-|L#`+j$9)CC=)=gp?{PKLVuehHy0CYI|~=2abL~R(GAduk?S6>yfj!(6l!K_ z35W1oLd-0LAP`f8AOvD5XaYmPOkpqqgbBZxsGtP`0TDEX37A_#OiZ9KK7IkXDW4fs zkRN7ZW^OJdX22`&VCe|HT#D3q)vbLjfJFgVCtTf3T-+{K319*cFhSg_S7mO?;{IR# C;ui=2 literal 0 HcmV?d00001 diff --git a/components/softdevice/s110/doc/s110_nrf51_8.0.0_licence-agreement.pdf b/components/softdevice/s110/doc/s110_nrf51_8.0.0_licence-agreement.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7aab95c8e7ae8c764467d3d81fa9069d2ff9c2ef GIT binary patch literal 5553 zcmc(jXIPZUvVau{imnJEC~=4mpiE+jLk*m+>M^e8(`;moR@SEiSv3zTNagMaQ2j>9;4npZvMD4Uri_x$ncIO8Gkw z%tMWZSvf%~?| z-jJcXWRnHj=U8&nVoF|V2<{6lpH$SLnszpOe0<-v`K#czwI6$X^(`*8hID zoqa@~I{3`-ytKrcad?LX^Q!@-6>4;gHkFVb6P}K3)sb()$D7a~&qSb}Toh3B^-7T8 zb7aA%Sx;hhA2Z9d&BX6}QC0!M%nLSMt3vM~E#^-G%Ln45fzOzdIdhfm zsp_%o&GjD&InTI$89ygxXsB}Hczt|Orv^J#>d=Yp9Y3p-kcWC>gvTU_Ik}PItex*$ z&AqkF0k>BRVKBZT6z2`^MDdWhv5ig@rJ6{W-pVf)ihf;BO9fOxldpz5e8pm=FWzok zU-w@#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z0|7`dHSn(w01kseU;q=qA2bvQK@8*G2VngN4T?Y^iQ)W>Mm*;jNy3K&?p@sPd>_P80zCF@Gn}I+uij)S09JCJzgds?2h`s)DKnD^= zN<*PYXdn=T#AXn9Zw2S?@<7nN9(sTVBfVY_97W29{0AK<_`w(vXZrU>_}_Ja!BArN zIY5Ju;0g$afe*$F2qwi95R3$p!~=|ilC&j)h(s?03?{J;0)Z1plHcuvz({=sfkR38 z5Tw3>pdbe^4uk?pV-5v_NbmxMzz$*(2!)d33JQmi@*(zKzWjb2#5zS1zrct9Jje$F zk@Pnp3<4qLgYMX zlUy4RNjhF3A$y7HH{TOS7ZMymi7-8gE8^G=CTWX6lGq1DLidv7?>dk$QXNP*=ocI~ z*kR1Auy)kMl3O+62K<2igsLW_APu;Ih8da|BTTSxFbo3(Axw;ofhY*p7>)uNgAh_EVT series. */ + uint16_t evt_len; /**< Length in octets excluding 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 Mutual exclusion of radio activity and CPU execution. + * + * This option configures the application's access to the CPU when the radio is active. The + * application can configure itself to be blocked from using the CPU while the radio is + * active. By default, the application will be able to share CPU time with the SoftDevice + * during radio activity. This parameter structure is used together with @ref sd_ble_opt_set + * to configure the @ref BLE_COMMON_OPT_RADIO_CPU_MUTEX option. + * + * @note Note that the application should use this option to configure the SoftDevice to block the + * CPU during radio activity (i.e enable mutual exclusion) when running the SoftDevice on + * hardware affected by PAN #44 "CCM may exceed real time requirements"and PAN #45 "AAR may + * exceed real time requirements". + * + * @note Note that when acting as a scanner, the mutex is only enabled for radio TX activity. + * + * @note @ref sd_ble_opt_get is not supported for this option. + * + */ +typedef struct +{ + uint8_t enable : 1; /**< Enable mutual exclusion of radio activity and the CPU execution. */ +} ble_common_opt_radio_cpu_mutex_t; + +/**@brief Option structure for common options. */ +typedef union +{ + ble_common_opt_radio_cpu_mutex_t radio_cpu_mutex; /**< Parameters for the option for the mutual exclusion of radio activity and CPU execution. */ +} ble_common_opt_t; + +/**@brief Common BLE Option type, wrapping the module specific options. */ +typedef union +{ + ble_common_opt_t common_opt; /**< Common option, opt_id in BLE_COMMON_OPT_* series. */ + ble_gap_opt_t gap_opt; /**< GAP option, opt_id in BLE_GAP_OPT_* series. */ +} ble_opt_t; + +/** + * @brief BLE GATTS init options + */ +typedef struct +{ + ble_gatts_enable_params_t gatts_enable_params; /**< GATTS init options @ref ble_gatts_enable_params_t. */ +} ble_enable_params_t; + +/** @} */ + +/** @addtogroup BLE_COMMON_FUNCTIONS Functions + * @{ */ + +/**@brief Enable the BLE stack + * + * @param[in] p_ble_enable_params Pointer to ble_enable_params_t + * + * @details This call initializes the BLE stack, no other BLE related function can be called before this one. + * + * @return @ref NRF_SUCCESS BLE the BLE stack has been initialized successfully + * @retval @ref NRF_ERROR_INVALID_STATE the BLE stack had already been initialized and cannot be reinitialized. + * @return @ref NRF_ERROR_INVALID_ADDR Invalid or not sufficiently aligned pointer supplied. + * @return @ref 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. + * @return @ref NRF_ERROR_NO_MEM The Attribute Table size is too large. Decrease size in @ref ble_gatts_enable_params_t. + */ +SVCALL(SD_BLE_ENABLE, uint32_t, sd_ble_enable(ble_enable_params_t * p_ble_enable_params)); + +/**@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 signalled 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. + * + * @note The pointer supplied must be aligned to the extend defined by @ref BLE_EVTS_PTR_ALIGNMENT + * + * @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 application transmission buffers per link in the BLE stack. + * + * @details This call allows the application to obtain the total number of + * transmission buffers available per link for application data. Please note that + * this does not give the number of free buffers, but rather the total amount of them. + * The application has two options to handle its own application transmission buffers: + * - Use a simple arithmetic calculation: at boot time the application should use this function + * to find out the total amount of buffers available to it and store it in a variable. + * Every time a packet that consumes an application buffer is sent 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 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 packets. + * This mechanism allows the application to be aware at any time of the number of + * application packets available in the BLE stack's internal buffers, 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. + * - Choose to simply not keep track of available buffers at all, and instead handle the + * @ref BLE_ERROR_NO_TX_BUFFERS 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 buffer 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[out] p_count Pointer to a uint8_t which will contain the number of application transmission buffers upon + * successful return. + * + * @retval ::NRF_SUCCESS Number of application transmission buffers retrieved successfully. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + */ +SVCALL(SD_BLE_TX_BUFFER_COUNT_GET, uint32_t, sd_ble_tx_buffer_count_get(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. + * + * + * @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. + * @retval ::NRF_ERROR_FORBIDDEN If p_vs_uuid has already been added to the VS UUID table. + */ +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. + * + * @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. + * + * @param[in] opt_id Option ID. + * @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. + * @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)); + +/** @} */ + +#endif /* BLE_H__ */ + +/** + @} + @} +*/ diff --git a/components/softdevice/s110/headers/ble_err.h b/components/softdevice/s110/headers/ble_err.h new file mode 100644 index 0000000..1184f24 --- /dev/null +++ b/components/softdevice/s110/headers/ble_err.h @@ -0,0 +1,83 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/* @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_BUFFERS (NRF_ERROR_STK_BASE_NUM+0x004) /**< Buffer capacity exceeded. */ +#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. */ +/** @} */ + +#endif + + +/** + @} + @} +*/ diff --git a/components/softdevice/s110/headers/ble_gap.h b/components/softdevice/s110/headers/ble_gap.h new file mode 100644 index 0000000..eebdf9e --- /dev/null +++ b/components/softdevice/s110/headers/ble_gap.h @@ -0,0 +1,1349 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/**@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_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. @ref ble_gap_evt_connected_t */ + BLE_GAP_EVT_DISCONNECTED, /**< Disconnected from peer. @ref ble_gap_evt_disconnected_t */ + BLE_GAP_EVT_CONN_PARAM_UPDATE, /**< Connection Parameters updated. ble_gap_evt_conn_param_update_t */ + BLE_GAP_EVT_SEC_PARAMS_REQUEST, /**< Request to provide security parameters. @ref ble_gap_evt_sec_params_request_t */ + BLE_GAP_EVT_SEC_INFO_REQUEST, /**< Request to provide security information. @ref ble_gap_evt_sec_info_request_t */ + BLE_GAP_EVT_PASSKEY_DISPLAY, /**< Request to display a passkey to the user. @ref ble_gap_evt_passkey_display_t */ + BLE_GAP_EVT_AUTH_KEY_REQUEST, /**< Request to provide an authentication key. @ref ble_gap_evt_auth_key_request_t */ + BLE_GAP_EVT_AUTH_STATUS, /**< Authentication procedure completed with status. @ref ble_gap_evt_auth_status_t */ + BLE_GAP_EVT_CONN_SEC_UPDATE, /**< Connection security updated. @ref ble_gap_evt_conn_sec_update_t */ + BLE_GAP_EVT_TIMEOUT, /**< Timeout expired. @ref ble_gap_evt_timeout_t */ + BLE_GAP_EVT_RSSI_CHANGED, /**< RSSI report. @ref ble_gap_evt_rssi_changed_t */ + BLE_GAP_EVT_ADV_REPORT, /**< Advertising report. @ref ble_gap_evt_adv_report_t */ + BLE_GAP_EVT_SEC_REQUEST, /**< Security Request. @ref ble_gap_evt_sec_request_t */ + BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST, /**< Connection Parameter Update Request. @ref ble_gap_evt_conn_param_update_request_t */ + BLE_GAP_EVT_SCAN_REQ_REPORT, /**< Scan request report. @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. */ +/**@} */ + + +/**@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_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_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_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. */ +/**@} */ + +/**@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 connction interval specified in connect parameters. */ +#define BLE_GAP_CP_MIN_CONN_INTVL_MIN 0x0006 /**< Lowest mimimum 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 connction 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 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 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 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 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 or 3), 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 and scanning. */ +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 none is given. */ + 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 ble_gap_channel_mask_t for documentation. */ +} 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 none is given. */ + 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. */ +} ble_gap_sec_kdist_t; + + +/**@brief GAP security parameters. */ +typedef struct +{ + uint8_t bond : 1; /**< Perform bonding. */ + uint8_t mitm : 1; /**< Man In The Middle protection required. */ + 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_periph; /**< Key distribution bitmap: keys that the peripheral device will distribute. */ + ble_gap_sec_kdist_t kdist_central; /**< Key distribution bitmap: keys that the central 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 auth : 1; /**< Authenticated Key. */ + uint8_t ltk_len : 7; /**< 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 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 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). */ +} ble_gap_evt_passkey_display_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 Security levels supported. + * @note See Bluetooth Specification Version 4.1 Volume 3, Part C, Chapter 10. +*/ +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. */ +} 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_sec_keys_t; + + +/**@brief Security key set (both Peripheral and Central keys). + * Note that when distributing Bluetooth addresses pertaining to the local device those + * will have to be filled in by the user. */ +typedef struct +{ + ble_gap_sec_keys_t keys_periph; /**< Keys distributed by the device in the Peripheral role. */ + ble_gap_sec_keys_t keys_central; /**< Keys distributed by the device in the Central role. */ +} 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_periph; /**< Bitmap stating which keys were exchanged (distributed) by the peripheral. */ + ble_gap_sec_kdist_t kdist_central; /**< Bitmap stating which keys were exchanged (distributed) by the central. */ +} 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 required. */ +} 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 occured. */ + 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_auth_key_request_t auth_key_request; /**< Authentication Key Request Event Parameters. */ + 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 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. + * + * @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, const ble_gap_addr_t *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. + * + * @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_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. + * + * @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_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. + */ +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). + * + * @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. + * + * @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. + * + * @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 -40 dBm will not actually give -40 dBm, but will instead be remapped to -30 dBm. + * + * @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. + * + * @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. + * + * @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. + * + * @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. + * + * @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 timeout, bond and mitm fields of this structure are used. + * In the central role, this pointer may be NULL to reject a Security Request. + * + * @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. + * + * @note Calling this function may result in the following events depending on the outcome and parameters: @ref BLE_GAP_EVT_SEC_PARAMS_REQUEST, + * @ref BLE_GAP_EVT_SEC_INFO_REQUEST, @ref BLE_GAP_EVT_AUTH_KEY_REQUEST, @ref BLE_GAP_EVT_CONN_SEC_UPDATE, @ref BLE_GAP_EVT_AUTH_STATUS. + * + * + * @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 ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + * @retval ::NRF_ERROR_TIMEOUT A SMP timout has occured, 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. + * + * @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 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. + * The pointer to the ID key data distributed by the local device constitutes however an exception. It can either point to ID key data + * filled in by the user before calling this function, in which case a user-supplied Bluetooth address and IRK will be distributed, + * or the pointer to the ID key data structure can be NULL, in which case the device's configured (or default, if none is configured) + * Bluetooth address and IRK will be distributed. + * + * @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. + * + * @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. + */ +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. + * + * @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). + * If key type is @ref BLE_GAP_AUTH_KEY_TYPE_OOB, then a 16-byte OOB key value in Little Endian format. + * + * @details This function is only used to reply to a @ref BLE_GAP_EVT_AUTH_KEY_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. + * + * @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 Initiate GAP Encryption procedure. + * + * @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. + * + * @details In the central role, this function will initiate the encryption procedure using the encryption information provided. + * + * @note Calling this function may result in the following event depending on the outcome and parameters: @ref BLE_GAP_EVT_CONN_SEC_UPDATE. + * + * @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. + * + * @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. + * + * @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. + * + * @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. + * + * @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. + * + * @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. + * + * @param[in] conn_handle Connection handle. + * @param[out] p_rssi Pointer to the location where the RSSI measurement shall be stored. + * + * @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. + * + * @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). + * + * @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_NOT_SUPPORTED A selected feature is not supported (selective scanning). + */ +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). + * + * @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). + * + * @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_NO_MEM limit of available connections reached. + * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. +*/ +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. + * + * @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)); + +/** @} */ + +#endif // BLE_GAP_H__ + +/** + @} +*/ diff --git a/components/softdevice/s110/headers/ble_gatt.h b/components/softdevice/s110/headers/ble_gatt.h new file mode 100644 index 0000000..cb8a67b --- /dev/null +++ b/components/softdevice/s110/headers/ble_gatt.h @@ -0,0 +1,200 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + + +/** @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 + +/** @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; + +#endif // BLE_GATT_H__ + +/** @} */ + +/** + @} + @} +*/ diff --git a/components/softdevice/s110/headers/ble_gattc.h b/components/softdevice/s110/headers/ble_gattc.h new file mode 100644 index 0000000..57ce312 --- /dev/null +++ b/components/softdevice/s110/headers/ble_gattc.h @@ -0,0 +1,441 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/** @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_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. @ref ble_gattc_evt_prim_srvc_disc_rsp_t */ + BLE_GATTC_EVT_REL_DISC_RSP, /**< Relationship Discovery Response event. @ref ble_gattc_evt_rel_disc_rsp_t */ + BLE_GATTC_EVT_CHAR_DISC_RSP, /**< Characteristic Discovery Response event. @ref ble_gattc_evt_char_disc_rsp_t */ + BLE_GATTC_EVT_DESC_DISC_RSP, /**< Descriptor Discovery Response event. @ref ble_gattc_evt_desc_disc_rsp_t */ + BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP, /**< Read By UUID Response event. @ref ble_gattc_evt_char_val_by_uuid_read_rsp_t */ + BLE_GATTC_EVT_READ_RSP, /**< Read Response event. @ref ble_gattc_evt_read_rsp_t */ + BLE_GATTC_EVT_CHAR_VALS_READ_RSP, /**< Read multiple Response event. @ref ble_gattc_evt_char_vals_read_rsp_t */ + BLE_GATTC_EVT_WRITE_RSP, /**< Write Response event. @ref ble_gattc_evt_write_rsp_t */ + BLE_GATTC_EVT_HVX, /**< Handle Value Notification or Indication event. @ref ble_gattc_evt_hvx_t */ + BLE_GATTC_EVT_TIMEOUT /**< Timeout event. @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. */ +/** @} */ + +/**@brief Last Attribute Handle. */ +#define BLE_GATTC_HANDLE_END 0xFFFF + +/** @} */ + +/** @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 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, variable length. */ +} 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, variable length. */ +} 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, variable length. */ +} 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, variable length. */ +} ble_gattc_evt_desc_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, variable length. */ +} 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, variable length. */ +} 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, variable length. */ +} 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, variable length. */ +} 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, variable length. */ +} 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. */ + } 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. + * + * @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. + * + * @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. + * + * @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. + * + * @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. + * + * @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. + * + * @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_INVALID_ADDR Invalid pointer supplied. + * @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. + * + * @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_buffer_count_get for more details. + * + * @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_BUFFERS There are no available buffers left. + */ +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. + * + * @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)); + +/** @} */ + +#endif /* BLE_GATTC_H__ */ + +/** + @} + @} +*/ diff --git a/components/softdevice/s110/headers/ble_gatts.h b/components/softdevice/s110/headers/ble_gatts.h new file mode 100644 index 0000000..97c5927 --- /dev/null +++ b/components/softdevice/s110/headers/ble_gatts.h @@ -0,0 +1,639 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/** @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. */ +}; + +/** + * @brief GATT Server Event IDs. + */ +enum BLE_GATTS_EVTS +{ + BLE_GATTS_EVT_WRITE = BLE_GATTS_EVT_BASE, /**< Write operation performed. @ref ble_gatts_evt_write_t */ + BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST, /**< Read/Write Authorization request.@ref ble_gatts_evt_rw_authorize_request_t */ + BLE_GATTS_EVT_SYS_ATTR_MISSING, /**< A persistent system attribute access is pending, awaiting a sd_ble_gatts_sys_attr_set(). @ref ble_gatts_evt_sys_attr_missing_t */ + BLE_GATTS_EVT_HVC, /**< Handle Value Confirmation. @ref ble_gatts_evt_hvc_t */ + BLE_GATTS_EVT_SC_CONFIRM, /**< Service Changed Confirmation. No additional event structure applies. */ + BLE_GATTS_EVT_TIMEOUT /**< Timeout. @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 (0x700 bytes for this version of the SoftDevice). */ +/** @} */ + +/** @} */ + +/** @addtogroup BLE_GATTS_STRUCTURES Structures + * @{ */ + +/** + * @brief BLE GATTS init options + */ +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 Attribute Context. */ +typedef struct +{ + ble_uuid_t srvc_uuid; /**< Service UUID. */ + ble_uuid_t char_uuid; /**< Characteristic UUID if applicable (BLE_UUID_TYPE_UNKNOWN otherwise). */ + ble_uuid_t desc_uuid; /**< Descriptor UUID if applicable (BLE_UUID_TYPE_UNKNOWN otherwise). */ + uint16_t srvc_handle; /**< Service Handle. */ + uint16_t value_handle; /**< Characteristic Value Handle if applicable (BLE_GATT_HANDLE_INVALID otherwise). */ + uint8_t type; /**< Attribute Type, see @ref BLE_GATTS_ATTR_TYPES. */ +} ble_gatts_attr_context_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 Read 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 in the ATT response. */ + 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. */ + uint8_t *p_data; /**< Pointer to new value used to update the attribute value. */ +} ble_gatts_read_authorize_params_t; + +/**@brief GATT Write Authorization parameters. */ +typedef struct +{ + uint16_t gatt_status; /**< GATT status code for the operation, see @ref BLE_GATT_STATUS_CODES. */ +} ble_gatts_write_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_read_authorize_params_t read; /**< Read authorization parameters. */ + ble_gatts_write_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. */ + uint8_t op; /**< Type of write operation, see @ref BLE_GATTS_OPS. */ + ble_gatts_attr_context_t context; /**< Attribute Context. */ + uint16_t offset; /**< Offset for the write operation. */ + uint16_t len; /**< Length of the received data. */ + uint8_t data[1]; /**< Received data, variable length. */ +} 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_gatts_attr_context_t context; /**< Attribute Context. */ + 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. + * + * @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. + * + * @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. + * + * @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. + * + * @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. + * + * @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). + * + * @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. + * + * @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. + * + * @note Values other than system attributes can be set at any time, regardless of wheter any active connections exist. + * + * @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. + * + * @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. + * + * @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. + * + * @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 ::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_BUFFERS 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_buffer_count_get for more details. + * + * @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_BUFFERS There are no available buffers to send the data, 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. + * + * @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_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_INVALID_STATE Invalid state to perform operation, notifications or indications must be enabled in the CCCD. + * @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. + * + * @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_STATE Invalid Connection State or no authorization request pending. + * @retval ::NRF_ERROR_INVALID_PARAM Authorization op invalid, + * or for Read Authorization reply: requested handles not replied with, + * or for Write Authorization reply: handle supplied does not match requested handle. + * @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. + * + * @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_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. + * + * @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. 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)); + +/** @} */ + +#endif // BLE_GATTS_H__ + +/** + @} +*/ diff --git a/components/softdevice/s110/headers/ble_hci.h b/components/softdevice/s110/headers/ble_hci.h new file mode 100644 index 0000000..2488985 --- /dev/null +++ b/components/softdevice/s110/headers/ble_hci.h @@ -0,0 +1,125 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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__ + +/** @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. */ + +/** @} */ + + +#endif // BLE_HCI_H__ + +/** @} */ diff --git a/components/softdevice/s110/headers/ble_l2cap.h b/components/softdevice/s110/headers/ble_l2cap.h new file mode 100644 index 0000000..6eab9fb --- /dev/null +++ b/components/softdevice/s110/headers/ble_l2cap.h @@ -0,0 +1,177 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/**@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, variable length. */ +} 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. + * + * @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. + * + * @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 buffer, 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_buffer_count_get for more details. + * + * @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_BUFFERS Not enough application buffers 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)); + +/** @} */ + +#endif // BLE_L2CAP_H__ + +/** + @} +*/ diff --git a/components/softdevice/s110/headers/ble_ranges.h b/components/softdevice/s110/headers/ble_ranges.h new file mode 100644 index 0000000..69100b3 --- /dev/null +++ b/components/softdevice/s110/headers/ble_ranges.h @@ -0,0 +1,119 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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__ + +#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. */ + +#endif /* BLE_RANGES_H__ */ + +/** + @} + @} +*/ diff --git a/components/softdevice/s110/headers/ble_types.h b/components/softdevice/s110/headers/ble_types.h new file mode 100644 index 0000000..d99d774 --- /dev/null +++ b/components/softdevice/s110/headers/ble_types.h @@ -0,0 +1,198 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 + +/** @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 +{ + unsigned char 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; + +/** @} */ + +#endif /* BLE_TYPES_H__ */ + +/** + @} + @} +*/ diff --git a/components/softdevice/s110/headers/nrf_error.h b/components/softdevice/s110/headers/nrf_error.h new file mode 100644 index 0000000..efa1b65 --- /dev/null +++ b/components/softdevice/s110/headers/nrf_error.h @@ -0,0 +1,78 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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__ + +/** @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 + +#endif // NRF_ERROR_H__ + +/** + @} +*/ diff --git a/components/softdevice/s110/headers/nrf_error_sdm.h b/components/softdevice/s110/headers/nrf_error_sdm.h new file mode 100644 index 0000000..25a1437 --- /dev/null +++ b/components/softdevice/s110/headers/nrf_error_sdm.h @@ -0,0 +1,60 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +#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). + +#endif // NRF_ERROR_SDM_H__ + +/** + @} + @} +*/ diff --git a/components/softdevice/s110/headers/nrf_error_soc.h b/components/softdevice/s110/headers/nrf_error_soc.h new file mode 100644 index 0000000..cfddf7e --- /dev/null +++ b/components/softdevice/s110/headers/nrf_error_soc.h @@ -0,0 +1,76 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/* 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 + +#endif // NRF_ERROR_SOC_H__ +/** + @} + @} +*/ diff --git a/components/softdevice/s110/headers/nrf_mbr.h b/components/softdevice/s110/headers/nrf_mbr.h new file mode 100644 index 0000000..3ac6dbf --- /dev/null +++ b/components/softdevice/s110/headers/nrf_mbr.h @@ -0,0 +1,184 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 + + +/** @addtogroup NRF_MBR_DEFINES Defines + * @{ */ + +/**@brief MBR SVC Base number. */ +#define MBR_SVC_BASE (0x18) + +/** @} */ + +/** @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 PROTENSET 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 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. + */ +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 adress in NFR_UICR->BOOTADDR or to the SoftDevice if the BOOTADDR is not set. + * + * @retval ::NRF_SUCCESS + * @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. + */ +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_copy_bl_t copy_bl; /**< Parameters for copy BootLoader.*/ + sd_mbr_command_compare_t compare; /**< Parameters for verify.*/ + sd_mbr_command_vector_table_base_set_t base_set; /**< Parameters for vector table base set.*/ + } params; +} sd_mbr_command_t; + +/** @} */ + +/** @addtogroup NRF_MBR_FUNCTIONS Functions + * @{ */ + +/**@brief Issue Master Boot Record commands + * + * Commands used when updating a SoftDevice and bootloader. + * + * @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 + +*/ +SVCALL(SD_MBR_COMMAND, uint32_t, sd_mbr_command(sd_mbr_command_t* param)); + +/** @} */ +#endif // NRF_MBR_H__ + +/** + @} +*/ diff --git a/components/softdevice/s110/headers/nrf_sd_def.h b/components/softdevice/s110/headers/nrf_sd_def.h new file mode 100644 index 0000000..4740cd8 --- /dev/null +++ b/components/softdevice/s110/headers/nrf_sd_def.h @@ -0,0 +1,23 @@ +/* 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. + * + */ + +#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 th spplication). */ +#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/components/softdevice/s110/headers/nrf_sdm.h b/components/softdevice/s110/headers/nrf_sdm.h new file mode 100644 index 0000000..4d407a9 --- /dev/null +++ b/components/softdevice/s110/headers/nrf_sdm.h @@ -0,0 +1,221 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/** @addtogroup NRF_SDM_DEFINES Defines + * @{ */ + +/** @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 usual size reserverd 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) + +/** @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) + + +/** @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 */ +}; + +/**@brief Possible lfclk oscillator sources. */ +enum NRF_CLOCK_LFCLKSRCS +{ + NRF_CLOCK_LFCLKSRC_SYNTH_250_PPM, /**< LFCLK Synthesized from HFCLK. */ + NRF_CLOCK_LFCLKSRC_XTAL_500_PPM, /**< LFCLK crystal oscillator 500 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_250_PPM, /**< LFCLK crystal oscillator 250 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_150_PPM, /**< LFCLK crystal oscillator 150 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_100_PPM, /**< LFCLK crystal oscillator 100 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_75_PPM, /**< LFCLK crystal oscillator 75 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_50_PPM, /**< LFCLK crystal oscillator 50 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_30_PPM, /**< LFCLK crystal oscillator 30 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, /**< LFCLK crystal oscillator 20 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_250MS_CALIBRATION, /**< LFCLK RC oscillator, 250ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_500MS_CALIBRATION, /**< LFCLK RC oscillator, 500ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_1000MS_CALIBRATION, /**< LFCLK RC oscillator, 1000ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_2000MS_CALIBRATION, /**< LFCLK RC oscillator, 2000ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_4000MS_CALIBRATION, /**< LFCLK RC oscillator, 4000ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_8000MS_CALIBRATION, /**< LFCLK RC oscillator, 8000ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_1000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 1000ms, if changed above a threshold, a calibration is done.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_2000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 2000ms, if changed above a threshold, a calibration is done.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_4000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 4000ms, if changed above a threshold, a calibration is done.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_8000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 8000ms, if changed above a threshold, a calibration is done.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_16000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 16000ms, if changed above a threshold, a calibration is done.*/ +}; + +/** @} */ + +/** @addtogroup NRF_SDM_TYPES Types + * @{ */ + +/**@brief Type representing lfclk oscillator source. */ +typedef uint32_t nrf_clock_lfclksrc_t; + + +/**@brief SoftDevice Assertion Handler type. + * + * When an unexpected error occurs within the SoftDevice it will call the SoftDevice assertion handler callback. + * 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 SoftDevice assert callback. + * + * @param[in] pc The program counter of the failed assert. + * @param[in] line_number Line number where the assert failed. + * @param[in] file_name File name where the assert failed. + */ +typedef void (*softdevice_assertion_handler_t)(uint32_t pc, uint16_t line_number, const uint8_t * p_file_name); + +/** @} */ + +/** @addtogroup NRF_SDM_FUNCTIONS Functions + * @{ */ + +/**@brief Enables the SoftDevice and by extension the protocol stack. + * + * Idempotent function to enable the SoftDevice. + * + * @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 clock_source Low frequency clock source and accuracy. (Note: 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 assertion_handler Callback for SoftDevice assertions. + * + * @retval ::NRF_SUCCESS + * @retval ::NRF_ERROR_INVALID_STATE SoftDevice is already enabled, and the clock source and assertion handler cannot be updated. + * @retval ::NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION SoftDeviceinterrupt 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_lfclksrc_t clock_source, softdevice_assertion_handler_t assertion_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)); + +/** @} */ + +#endif // NRF_SDM_H__ + +/** + @} +*/ diff --git a/components/softdevice/s110/headers/nrf_soc.h b/components/softdevice/s110/headers/nrf_soc.h new file mode 100644 index 0000000..053c6c5 --- /dev/null +++ b/components/softdevice/s110/headers/nrf_soc.h @@ -0,0 +1,993 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/**@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. */ + +#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. */ + +#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_TYPES Types + * @{ */ + +/**@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_NVIC_ENABLEIRQ, + SD_NVIC_DISABLEIRQ, + SD_NVIC_GETPENDINGIRQ, + SD_NVIC_SETPENDINGIRQ, + SD_NVIC_CLEARPENDINGIRQ, + SD_NVIC_SETPRIORITY, + SD_NVIC_GETPRIORITY, + SD_NVIC_SYSTEMRESET, + SD_NVIC_CRITICAL_REGION_ENTER, + SD_NVIC_CRITICAL_REGION_EXIT, + SD_RAND_APPLICATION_POOL_CAPACITY, + SD_RAND_APPLICATION_BYTES_AVAILABLE, + SD_RAND_APPLICATION_GET_VECTOR, + SD_POWER_MODE_SET, + SD_POWER_SYSTEM_OFF, + SD_POWER_RESET_REASON_GET, + SD_POWER_RESET_REASON_CLR, + SD_POWER_POF_ENABLE, + SD_POWER_POF_THRESHOLD_SET, + SD_POWER_RAMON_SET, + SD_POWER_RAMON_CLR, + SD_POWER_RAMON_GET, + SD_POWER_GPREGRET_SET, + SD_POWER_GPREGRET_CLR, + SD_POWER_GPREGRET_GET, + SD_POWER_DCDC_MODE_SET, + SD_APP_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_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 Possible values of ::nrf_app_irq_priority_t. */ +enum NRF_APP_PRIORITIES +{ + NRF_APP_PRIORITY_HIGH = 1, + NRF_APP_PRIORITY_LOW = 3 +}; + +/**@brief Possible values of ::nrf_power_mode_t. */ +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 Possible values of ::nrf_power_failure_threshold_t */ +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 Possible values of ::nrf_power_dcdc_mode_t. */ +enum NRF_POWER_DCDC_MODES +{ + NRF_POWER_DCDC_DISABLE, /**< The DCDC is disabled. */ + NRF_POWER_DCDC_ENABLE /**< The DCDC is enabled. */ +}; + +/**@brief Possible values of ::nrf_radio_notification_distance_t. */ +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 Possible values of ::nrf_radio_notification_type_t. */ +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 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 signal callback handler return was invalid. */ + NRF_EVT_RADIO_SESSION_IDLE, /**< Event indicating that a radio session is idle. */ + NRF_EVT_RADIO_SESSION_CLOSED, /**< Event indicating that a radio session is closed. */ + NRF_EVT_NUMBER_OF_EVTS +}; + +/**@} */ + +/**@addtogroup NRF_SOC_TYPES Types + * @{ */ + +/**@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 The interrupt priorities available to the application while the softdevice is active. */ +typedef uint8_t nrf_app_irq_priority_t; + +/**@brief Represents a power mode, used in power mode functions */ +typedef uint8_t nrf_power_mode_t; + +/**@brief Represents a power failure threshold value. */ +typedef uint8_t nrf_power_failure_threshold_t; + +/**@brief Represents a DCDC mode value. */ +typedef uint32_t nrf_power_dcdc_mode_t; + +/**@brief Radio notification distances. */ +typedef uint8_t nrf_radio_notification_distance_t; + +/**@brief Radio notification types. */ +typedef uint8_t nrf_radio_notification_type_t; + +/**@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_DEFAULT, /**< Use the currently selected oscillator as HF clock source during the timeslot (i.e. the source is not specified). */ + NRF_RADIO_HFCLK_CFG_FORCE_XTAL, /**< Force external crystal to be used as HF clock source during whole the timeslot. */ +}; + +/**@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 timeslot as early as possible. This should always be used for the first request in a session. */ + NRF_RADIO_REQ_TYPE_NORMAL /**< Normal timeslot request. */ +}; + +/**@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 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 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 a request for a timeslot as early as possible. */ + nrf_radio_request_normal_t normal; /**< Parameters for a normal radio request. */ + } 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 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 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 data structure */ +typedef struct +{ + uint8_t key[SOC_ECB_KEY_LENGTH]; /**< Encryption key. */ + uint8_t cleartext[SOC_ECB_CLEARTEXT_LENGTH]; /**< Clear Text data. */ + uint8_t ciphertext[SOC_ECB_CIPHERTEXT_LENGTH]; /**< Cipher Text data. */ +} nrf_ecb_hal_data_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 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. + */ +SVCALL(SD_NVIC_ENABLEIRQ, 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. + */ +SVCALL(SD_NVIC_DISABLEIRQ, 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. + */ +SVCALL(SD_NVIC_GETPENDINGIRQ, 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. + */ +SVCALL(SD_NVIC_SETPENDINGIRQ, 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. + */ +SVCALL(SD_NVIC_CLEARPENDINGIRQ, 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. + */ +SVCALL(SD_NVIC_SETPRIORITY, uint32_t, sd_nvic_SetPriority(IRQn_Type IRQn, nrf_app_irq_priority_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. + */ +SVCALL(SD_NVIC_GETPRIORITY, uint32_t, sd_nvic_GetPriority(IRQn_Type IRQn, nrf_app_irq_priority_t * p_priority)); + +/**@brief System Reset. + * @note Corresponds to NVIC_SystemReset in CMSIS. + * + * @retval ::NRF_ERROR_SOC_NVIC_SHOULD_NOT_RETURN + */ +SVCALL(SD_NVIC_SYSTEMRESET, 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 + */ +SVCALL(SD_NVIC_CRITICAL_REGION_ENTER, 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 + */ +SVCALL(SD_NVIC_CRITICAL_REGION_EXIT, uint32_t, sd_nvic_critical_region_exit(uint8_t is_nested_critical_region)); + +/**@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, 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, 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_GET_VECTOR, 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. @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(nrf_power_mode_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. + * + * @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(nrf_power_failure_threshold_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. + * + * This function is to enable or disable the DCDC periperhal. + * + * @param[in] dcdc_mode The mode of the DCDC. + * + * @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(nrf_power_dcdc_mode_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. + * @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. + * 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(nrf_radio_notification_type_t type, nrf_radio_notification_distance_t distance)); + +/**@brief Encrypts a block according to the specified parameters. + * + * 128-bit AES encryption. + * + * @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 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. + * + * @note Pan #28 in PAN-028 v 1.6 "Negative measured values are not represented correctly" is corrected by this function. + * + * @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 32bit words. +* +* @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 more than 256 words. +* @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 registers PROTENSETx + * + * @note To read the values in PROTENSETx you can read them directly. They are only write-protected. + * + * @param[in] protenset0 Value to be written to PROTENSET0. + * @param[in] protenset1 Value to be written to PROTENSET1. + * + * @retval ::NRF_ERROR_FORBIDDEN Tried to protect the SoftDevice. + * @retval ::NRF_SUCCESS Values successfully written to PROTENSETx. + */ +SVCALL(SD_FLASH_PROTECT, uint32_t, sd_flash_protect(uint32_t protenset0, uint32_t protenset1)); + +/**@brief Opens a session for radio 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 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 )); + +/**@} */ + +#endif // NRF_SOC_H__ + +/**@} */ diff --git a/components/softdevice/s110/headers/nrf_svc.h b/components/softdevice/s110/headers/nrf_svc.h new file mode 100644 index 0000000..8c84a9c --- /dev/null +++ b/components/softdevice/s110/headers/nrf_svc.h @@ -0,0 +1,71 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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__ + +#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__) +#define SVCALL(number, return_type, signature) \ + _Pragma("GCC diagnostic ignored \"-Wunused-function\"") \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \ + __attribute__((naked)) static return_type signature \ + { \ + __asm( \ + "svc %0\n" \ + "bx r14" : : "I" (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 +#endif // NRF_SVC__ diff --git a/components/softdevice/s110/headers/softdevice_assert.h b/components/softdevice/s110/headers/softdevice_assert.h new file mode 100644 index 0000000..a2a8af8 --- /dev/null +++ b/components/softdevice/s110/headers/softdevice_assert.h @@ -0,0 +1,73 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** @brief Utilities for verifying program logic + */ + +#ifndef SOFTDEVICE_ASSERT_H_ +#define SOFTDEVICE_ASSERT_H_ + +#include + +/** @brief This function handles assertions. + * + * + * @note + * This function is called when an assertion has triggered. + * + * + * @param line_num The line number where the assertion is called + * @param file_name Pointer to the file name + */ +void assert_softdevice_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 Check intended for production code + * + * Check passes if "expr" evaluates to true. */ +#define ASSERT(expr) \ +if (expr) \ +{ \ +} \ +else \ +{ \ + assert_softdevice_callback((uint16_t)__LINE__, (uint8_t *)__FILE__); \ + /*lint -unreachable */ \ +} + +#endif /* SOFTDEVICE_ASSERT_H_ */ diff --git a/components/softdevice/s110/hex/s110_nrf51_8.0.0_softdevice.hex b/components/softdevice/s110/hex/s110_nrf51_8.0.0_softdevice.hex new file mode 100644 index 0000000..7551e41 --- /dev/null +++ b/components/softdevice/s110/hex/s110_nrf51_8.0.0_softdevice.hex @@ -0,0 +1,5649 @@ +:020000040000FA +:10000000C0070000D1060000D1000000B1060000CA +:1000100000000000000000000000000000000000E0 +:100020000000000000000000000000005107000078 +:100030000000000000000000DB000000E500000000 +:10004000EF000000F9000000030100000D010000B6 +:1000500017010000210100002B0100003501000004 +:100060003F01000049010000530100005D01000054 +:1000700067010000710100007B01000085010000A4 +:100080008F01000099010000A3010000AD010000F4 +:10009000B7010000C1010000CB010000D501000044 +:1000A000DF010000E9010000F3010000FD01000094 +:1000B00007020000110200001B02000025020000E0 +:1000C0001FB5C046C04600F0EFFA04B00FB41FBD24 +:1000D00008205A49096809580847382057490968CB +:1000E000095808473C2055490968095808474020E5 +:1000F0005249096809580847442050490968095875 +:10010000084748204D490968095808474C204B4981 +:10011000096809580847502048490968095808479C +:100120005420464909680958084758204349096836 +:10013000095808475C204149096809580847602068 +:100140003E4909680958084764203C49096809582C +:100150000847682039490968095808476C20374919 +:100160000968095808477020344909680958084740 +:100170007420324909680958084778202F490968CE +:10018000095808477C202D490968095808478020EC +:100190002A490968095808478420284909680958E4 +:1001A0000847882025490968095808478C202349B1 +:1001B00009680958084790202049096809580847E4 +:1001C00094201E4909680958084798201B49096866 +:1001D000095808479C201949096809580847A02070 +:1001E0001649096809580847A4201449096809589C +:1001F0000847A8201149096809580847AC200F4949 +:10020000096809580847B0200C4909680958084787 +:10021000B4200A49096809580847B82007490968FD +:1002200009580847BC2005490968095808470000D3 +:1002300003480449024A034B7047000000000020B5 +:10024000C0070000C00700000122D84B5A6000BF61 +:10025000D74A1268002AFBD0016000BFD44A126856 +:10026000002AFBD00022D14B5A6000BFD04A12684E +:10027000002AFBD07047F0B505460E46174600240D +:1002800006E0A200B158A2005019FFF7DDFF641C80 +:10029000BC42F6D30020F0BD0120C043C549086030 +:1002A000401048607047014601229204086890425D +:1002B00001D9102070470020FCE7F0B505460C4638 +:1002C0001646002706E028462168FFF7BDFF2D1DD2 +:1002D000241D7F1CB742F6D3F0BD70B505460C4611 +:1002E0002E460BE0304600F075F9FF2C01D80024B3 +:1002F00001E0FF3C013C012080023618002CF1D1C6 +:1003000070BD0146012292044868904201D909203B +:100310007047A9484069401C01D10F20F8E7002030 +:10032000F6E7FEB504462068030000F037FA05043E +:100330002B4249598B00201DFFF7E3FF0546002D96 +:1003400001D02846FEBDFFF7A7FF0120C00200F044 +:1003500041F9042221469948FFF78DFF002801D07A +:100360000320EFE708222146944800F06DF90028A9 +:1003700006D1002192480068FFF766FF00F00CF9F3 +:100380000320DFE7A768E6686068019031463846D9 +:10039000FFF7A3FF324638460199FFF78EFFB20000 +:1003A0003846019900F050F9002800D1CAE703202F +:1003B000C8E700F0E3F9834800688349086041E03A +:1003C00060680190E668A0680090B200009901980A +:1003D00000F03AF90746002F00D1B3E70E20B1E74D +:1003E000201DFFF760FF0546002D01D02846A9E734 +:1003F0006068002807D1FFF74FFF0320800200F05C +:10040000E9F800F0C9F8FFF747FF0120C00200F04B +:10041000E1F8042221466948FFF72DFF002801D0AA +:1004200003208FE708222146644800F00DF90028D8 +:1004300006D1002162480068FFF706FF00F0ACF823 +:1004400003207FE700BF00207CE770B505460C461F +:10045000182D04D12068FFF764FF206002E001201E +:10046000206000BF00BF70BDF0B589B05248406940 +:1004700003905248806881000398081802900398FE +:10048000000B01900121090302984018401E000B47 +:1004900000900124002520462946019A00F0C4F866 +:1004A0000022401E91410791069001260027304608 +:1004B0003946009A00F0B8F80022401E914105919B +:1004C0000490049BDB43059AD2430698184307998E +:1004D00011430791069037490698086007984860CD +:1004E00009B0F0BD70B53448446934488568466841 +:1004F000AA003146204600F0A7F8002801D00020CD +:1005000070BD0120FCE72D484068002801D0012083 +:1005100000E000200546FFF7E5FF002807D0FFF7C1 +:10052000BBFE0320800200F055F800F035F8FFF71D +:100530009BFF002D0ED020484669204884684768FC +:1005400021463046FFF7C9FE224639463046FFF7BE +:10055000B4FE00BF00F020F810B5184844681A48EF +:100560000460204600F0DCF810BD15480068006803 +:10057000401C01D100BFFEE710480068002802D0EF +:10058000042806D101E0FFF7BEFFFFF7E5FF00BF3B +:10059000FEE700BF00BFFEE7BFF34F8F0B480C49DB +:1005A000C860BFF34F8F00BFFEE7000000E50140C9 +:1005B00000E40140000600400010001000080000A8 +:1005C000B8070000BC070000000000200400FA0586 +:1005D00000ED00E010B50146104B1A6808460223F2 +:1005E0000F4C636000BF0F4B1B68002BFBD0531CEC +:1005F00004D0904202D20A4B186101E0084B986087 +:1006000000BF084B1B68002BFBD00023044C636029 +:1006100000BF044B1B68002BFBD010BD0010001066 +:1006200000E5014000E4014010B5202A04DB01464A +:10063000203A9140002010BD914020239C1A03468F +:10064000E3401943904010BD034610B50B439B0790 +:100650000FD1042A0DD308C810C9121FA342F8D025 +:1006600018BA21BA884201D9012010BD0020C04328 +:1006700010BD002A03D0D30703D0521C07E000208E +:1006800010BD03780C78401C491C1B1B07D1037854 +:100690000C78401C491C1B1B01D1921EF1D118463D +:1006A00010BD70477047704710B500F007F810BDD7 +:1006B000014B1B68DB6818470000002019481A49E5 +:1006C0007047FFF7FBFFFFF7FBFC00BD20BFFDE716 +:1006D0001649174C24688C420BD1164B1B68994263 +:1006E0000CD1154B154A1360186810498842EDD09B +:1006F0000AE0134880F30888124B18470F4A13602A +:1007000018680A498842E1D080F308880E49884277 +:1007100004DD0E48026802210A4302605B68184744 +:100720000346DFE7C0070000C0070000FFFFFFFF30 +:10073000000C000014100010001000000000002049 +:10074000000400206B05000000200020240500406C +:100750000D48704502D1EFF3098101E0EFF3088104 +:10076000886902380078182802D1C046074A104725 +:10077000074A12682C3212681047000000B5054B7A +:10078000054A9B58984700BDFDFFFFFF4B04000042 +:1007900000000020001000000400000030B4744687 +:1007A000641E2578641CAB4204D3635D5B00E318D0 +:1007B00030BC18471D46F8E7000C00000010000090 +:1010000000150020CD64010025220000336401009A +:1010100000000000000000000000000000000000D0 +:101020000000000000000000000000003D6501001D +:101030000000000000000000252200002522000022 +:10104000A9650100AF6501002522000025220000EE +:101050002522000025220000252200002522000074 +:10106000B56501002522000025220000BB650100B6 +:1010700025220000C1650100C7650100CD650100A2 +:101080002522000025220000252200002522000044 +:101090002522000025220000252200002522000034 +:1010A000D3650100D965010025220000252200003A +:1010B0002522000025220000252200002522000014 +:1010C00000F002F815F0E3F90CA030C80838241835 +:1010D0002D18A246671EAB4654465D46AC4201D170 +:1010E00015F0D5F97E460F3E0FCCB64601263342A9 +:1010F00000D0FB1AA246AB4633431847B456010052 +:10110000E4560100103A02D378C878C1FAD85207E1 +:1011100001D330C830C101D504680C6070470000AD +:101120000023002400250026103A01D378C1FBD803 +:10113000520700D330C100D50B6070471FB5C046C1 +:10114000C04615F063F904B00FB41FBDF0B44046BB +:10115000494652465B460FB402A0013001B506482D +:10116000004700BF01BC86460FBC804689469246B8 +:101170009B46F0BC70470000C11000008269024924 +:101180008161024810447047911100000100000085 +:1011900001B41EB400B50BF0E6FF01B40198864619 +:1011A00001BC01B01EBD0000401E00BF00BF00BF5B +:1011B00000BF00BF00BF00BF00BF00BF00BF00BF37 +:1011C00000BFF1D17047000070B505460C461646C9 +:1011D00002E00FCC0FC5103E102EFAD2082E02D31B +:1011E00003CC03C5083E042E07D301CC01C5361F2E +:1011F00003E021782970641C6D1C761EF9D270BD45 +:101200008307FF22DB0E9A408907090E99400028C8 +:101210000BDA0007000F0838830828489B001818CD +:10122000C36993430B43C3617047830824489B0001 +:101230001B181868904308431860704710B504469F +:1012400000210120FFF7DCFF00211820FFF7D8FF65 +:1012500000210B20FFF7D4FF02211920FFF7D0FF58 +:1012600002210D20FFF7CCFF02210E20FFF7C8FF5F +:1012700002210F20FFF7C4FF0221C81FFFF7C0FFA4 +:1012800003211620FFF7BCFF03211520FFF7B8FF4D +:10129000204600F019F8002010BD6421018070473D +:1012A00010B500F020F810BD0648704710B500F0EA +:1012B00022F810BD704770477047000000ED00E055 +:1012C00000E400E003F9004370B505462D4C07200B +:1012D0002070A01CFFF7E1FF5920A080294620467E +:1012E00000F099FB70BD10B500F09EFB2549002071 +:1012F000891E087010BDF8B5224E0446B61E30781F +:1013000001270D46002807D0204660380B2808D852 +:10131000204600F03DFF2BE0602CF9D01A48086011 +:10132000F8BD20466C38032803D8204600F071FF32 +:101330001EE0204670381F2803D8204600F045F9EB +:1013400016E0204690380F2803D8204600F0E8F831 +:101350000EE02046A0380F2803D8204600F074F88D +:1013600006E02046B0380F2804D8204600F0CAF91D +:10137000286000E02F60602CD2D128680028CFD1EF +:101380003770F8BD1A000020013000000120244908 +:10139000C003086023490020087007202249C005C7 +:1013A0008860704770B51F4D04462878A04207D06A +:1013B000002C05D0002803D01CA14D2015F033F8D7 +:1013C0002878A0420ED000211D4A17482C70002C0E +:1013D00019D01C4B012C06D0022C0BD013A1682075 +:1013E00015F021F870BD11600221116053610321D5 +:1013F000090605E011600321116053610121C9054F +:101400008160416070BD116011600721C905816074 +:1014100070BD10B505A1712015F005F810BD0000D4 +:1014200080E100E02000002000F501407372635C61 +:1014300068616C5F63636D5F6161722E63000000C1 +:1014400000F500404001002010B5A038030015F061 +:10145000DBF80B070E172028313A414B525C650030 +:101460004B6808788A68194603F0E6F910BD888849 +:101470008A6883B20888194680B203F0ECF910BD7F +:1014800008884C68CB688A6880B2214603F0E7F987 +:1014900010BD08884B688A6880B2194603F0FBF9D2 +:1014A00010BD88888A6883B20888194680B203F024 +:1014B00007FA10BD88888A6883B20888194680B206 +:1014C00003F041FA10BD08884A6880B2114603F063 +:1014D00080FA10BD088982B2888883B208881946CC +:1014E00080B203F081FA10BD08884A6880B21146C4 +:1014F00003F09EFA10BD08894C6882B20888CB6858 +:1015000080B2214603F018FB10BD08884C68CB68F8 +:101510008A6880B2214603F02AFC10BD012010BD6C +:1015200010B59038030015F06FF809060F161D244A +:101530002C363F464E0088888A6883B20888194650 +:1015400080B204F031F910BD08884A6880B21146B3 +:1015500004F065F910BD08884A6880B2114604F0AD +:101560006AF910BD08884A6880B2114604F070F923 +:1015700010BD08884B688A6880B2194604F07BF970 +:1015800010BD088982B2888883B20888194680B263 +:1015900004F07AF910BD08894B6882B208881946B0 +:1015A00080B204F090F910BD08884A6880B21146F4 +:1015B00004F09BF910BD888882B20888114680B279 +:1015C00004F0EFF910BD012010BD10B57038030014 +:1015D00015F01AF81B0F15192125282F363B40440A +:1015E000484C53585F688D707980888D8D8D8D8FB4 +:1015F00096004A680878114608F0FDFD10BD08689D +:1016000008F04AFE10BD0C790B7B8A6808682146F9 +:1016100008F053FE10BD086808F011FF10BD08F077 +:1016200065FB10BD08884A6880B2114609F043F88E +:1016300010BD0A790888114680B209F0D3F810BDB0 +:10164000087840B209F0DCF810BD088880B209F0D3 +:10165000F0F810BD086809F0FEF810BD086801F048 +:10166000D2FB10BD086801F0FCFB10BD088982B2F6 +:1016700009C9194609F007F910BD05C9114609F055 +:1016800051F910BD08884A6880B211460AF0A6F9DF +:1016900010BD0C790888CB688A6880B221460AF0B0 +:1016A000C5FA10BD0B7908888A6880B219460AF01D +:1016B0006DFC10BD08884C68CB688A6880B22146F2 +:1016C0000AF0D5FC10BD08884A6880B211460AF0BD +:1016D00018FD10BD0B7908880A7A80B2194609F006 +:1016E00044F910BD088880B209F044F910BD062005 +:1016F00010BD08884A6880B2114609F042F910BD51 +:10170000012010BD10B5B02805D0B12808D0B228EE +:101710000BD0012010BD088880B20BF0FBF810BD83 +:10172000088880B20BF015F910BD08884B688A68EC +:1017300080B219460BF01EF910BD000010B5030071 +:1017400014F062FF0A0609060C0C0F0F06060612BB +:1017500008F0F4FA10BD0AF0C5FE10BD01F03EFA23 +:1017600010BD06F09FFA10BDFAA1FE4814F05BFE12 +:1017700010BD3EB5FC49054603C900900191FF200C +:10178000C33069460881F94A092310460A212838DE +:101790000BF0BFFD0024F6480BF0D9FD641CE4B249 +:1017A0000A2CF8D3F14801231A4602A990300BF015 +:1017B000A0F9002804D0FF20E6A13D3014F033FE4C +:1017C000686800F024FC00211E22084604F06CF931 +:1017D00008F0C3FC02222421E64801F07DFBE54825 +:1017E00001222C214C3001F077FBE2490B20B0396B +:1017F00001F0FEF9002804D0FF20D6A1513014F0EA +:1018000012FE0AF03EFE02F097F96B460022082114 +:10181000D9A008F07DFB002804D0FF20CDA15730CF +:1018200014F001FE284602F0E7FC002804D0FF2057 +:10183000C8A1593014F0F7FDF3218900D14814F004 +:10184000D3FCD04801214171022181710721C1716E +:101850003EBD10B5CB4CA0780A2804D3FF20BDA113 +:10186000903014F0E0FD20786021484300190021F9 +:101870000173417BF722C908C900C91C1140EF223E +:10188000114041730121E1700C3010BD70B50E465E +:1018900000211C4619801546030014F0B5FE0723ED +:1018A000050B1711231D23002246294630460AF056 +:1018B00037FE70BD22462946304608F095F870BDC7 +:1018C00022462946304601F0E2FF70BD22462946F5 +:1018D000304603F0EAFD70BD22462946304600F04E +:1018E00010FC70BDFF209BA1EF3014F09CFD032085 +:1018F00070BD70B5A34CE078002818D02078602126 +:1019000048430019407B00254007400F0119087922 +:10191000401E08712078401CC0B220700A2800D1F7 +:101920002570A078401CA0700BF097FEE57070BD8C +:101930009448C079002800D08BE7704770B5914D6E +:10194000A86800280CD0FFF7F3FF002862D06022BF +:10195000A968FFF739FCFFF7CCFF0020A860EFE78C +:101960006879002856D0FFF774FF044681484C3050 +:1019700001F0C2FA6060002804D17A4875A14A30AB +:1019800014F051FD606801F01AFB00280DD02046CC +:1019900007F00BFF6078010703D5C008C000401CAA +:1019A0002BE0744861684C302DE0724861684C301F +:1019B00001F0ABFA00F05AFB00282BD1FFF749FFEA +:1019C00004466C4801F098FA6060002804D1332086 +:1019D00060A1000114F027FD606801F0F4FA00280E +:1019E00014D060680088608020460AF0CCFD6078E2 +:1019F000010706D5C008C000801C6070FFF779FFA2 +:101A00009EE75C48616801F080FA99E7594861688F +:101A100001F07BFA70BD10B55B4CE160A0605B48E3 +:101A200000F032FC607010BD57490020087070470C +:101A300070B5574E0546706A94B00C46401C04D1F0 +:101A4000B06AC0430004000C0BD0306AC007C00F5E +:101A50002870706A14F0DBFBB06A2071000A6071B4 +:101A600014E02B206946087009A9684601F07BFA4A +:101A7000002804D03B4837A17E3814F0D4FC012064 +:101A8000287006220AA9204614F04FFB2878002867 +:101A900003D06079C0210843607114B070BDF0B507 +:101AA0003B4C0646206895B00D4637460837401C2B +:101AB00008D16068401C05D1A068401C02D1E068D4 +:101AC000401C11D02068314614F0A1FB6068311D24 +:101AD00014F09DFBA068394614F099FBE06831468C +:101AE0000C3114F094FB25E02B206946087009A9FD +:101AF000684601F038FA002804D01A4815A1553874 +:101B000014F091FC08220AA9304614F00EFB2B2099 +:101B10006946087009A9684601F025FA002804D032 +:101B200010480CA14E3814F07EFC08220AA9384651 +:101B300014F0FBFA20692E460836401C08D1606973 +:101B4000401C05D1A069401C02D1E069401C33D083 +:101B500020691FE07372635C686F73745F636F72F8 +:101B6000652E6300C3020000F866010094010020A6 +:101B70003D170000640800206E524635313832327D +:101B800000000000E8030020240000203D190000B0 +:101B900080000010294614F03AFB6069291D14F0FA +:101BA00036FBA069314614F032FBE06929460C315E +:101BB00014F02DFB15B0F0BD2B246846047009A964 +:101BC00001F0D1F9002803D0F649F74814F02BFCB6 +:101BD000082209AF28460AA914F0A7FA684604703B +:101BE00009A901F0C0F9002804D0EF48ED49C01D53 +:101BF00014F019FC0822391D304614F096FAD9E782 +:101C000070B5EA4C0546A068002804D0E648E549CE +:101C1000563014F008FCA56070BD10B50146E448CC +:101C200001F073F9E1498879401CC0B2887101283C +:101C300003D1E048407800F04BFB10BD70B504467E +:101C4000DD4816460D46814204D1D748D549CB30F0 +:101C500014F0E9FB012E05D0D348D249DA3014F054 +:101C6000E2FB70BD6620207000202072A58101205B +:101C7000A07370BD70B515460C460646FFF758FEBA +:101C800000280CD066210170468001210172216874 +:101C90000161A18881820573FFF72BFE70BD1321BE +:101CA000304608F09FFD70BDC2494968884201D2A4 +:101CB00010207047072101700020704770B5BD4C9F +:101CC00005462078002694B0002801D00820E4E6DC +:101CD000BA4A6260954201D21020DEE668680028A8 +:101CE00009D00921D82804D3C31C9B089B00834238 +:101CF00005D00846D1E60720000268600EE0012109 +:101D000009074B6B896B4B43AD49511A0122591A94 +:101D1000D202891A814201D20421EAE700F050FF81 +:101D20006178A06806F052F8E068401E07280BD8DA +:101D3000302269460A708870684607F007F9002863 +:101D400002D009A806F07CFA2846FFF712FD012010 +:101D500020703046A1E6F8B5044696480F46406824 +:101D6000814208D3002C01D0844204D3E01C8008B7 +:101D70008000A04201D01020F8BD8C488178002955 +:101D800011D0398800914178602251430D18287B89 +:101D90000C350007000F3B4600222946FFF776FD71 +:101DA000060004D015E0002038800520F8BD002C86 +:101DB00013D039880098814201D90C260DE028788B +:101DC0003B460007000F22462946FFF75FFD06004D +:101DD00005D00C2E01D0002038803046F8BD734C61 +:101DE0006078401CC0B260700A2801D10020607089 +:101DF000A078401EA07068784107490F01290ED0D5 +:101E0000022906D003291AD066496E4814F00BFB4C +:101E1000E3E7C006E1D46868FFF7FFFEDDE764484A +:101E200069684C3001F071F86079401CC0B2607193 +:101E30000128D2D15F48407800F04AFACDE7E07936 +:101E4000401CE071C9E7604A10B5904209D3594A75 +:101E50000124A4045268A04201D3904201D39142CC +:101E600001D2102010BD00F0FCFE10BD564B10B585 +:101E7000994209D34F4B0124A4045B68A14201D3CA +:101E8000994201D39A4201D2102010BD022803D0FA +:101E9000102801D0092010BD00F009FF0028FAD059 +:101EA000052010BD484B10B598420DD3414B01247D +:101EB000A4045B68A04201D3984205D3994203D39E +:101EC000002A03D09A4201D2102010BD00F015FF65 +:101ED0000028FAD0072010BD10B50446354894B04C +:101EE0004068844202D2102014B010BD0F2008A90F +:101EF000087369460BA801F036F80028F4D168464B +:101F0000007A207068464089608068468089A08099 +:101F10000020E9E710B500290BD0264A526891420B +:101F200002D30B68934201D2102010BD8A88002A88 +:101F300002D001F05AFE10BD092010BD10B5224A92 +:101F400094B091420ED31B4A01239B0452689942DC +:101F500001D3914206D3441E1E2C41D8994203D38B +:101F6000914201D21020BFE7012837D10878002420 +:101F7000C007C00F002803D003206946887001E025 +:101F80006846847038206946087009A9684600F0E0 +:101F9000EAFF002804D041200CA1C00014F043FA4D +:101FA0002046A1E7541B000093020000E803002034 +:101FB0006408002024000020FFFF0000001900201A +:101FC000000000200A040000008001007372635CBE +:101FD000686F73745F636F72652E6300072083E719 +:101FE0000246203A1F2AF9D807F0F9FF7CE710B51E +:101FF0005F4A5268914201D2102010BD0246203A39 +:102000001F2A02D808F065F810BD072010BD70B572 +:102010000546584C0020207020464619544846601A +:10202000E01C80088000A04204D0FF2052491330F9 +:1020300014F0F9F901200007C06AC0430006000E41 +:1020400003D14E480068401C03D04D484D49301A1A +:10205000C862A8B20122214604F039F9002804D050 +:10206000FF204549233014F0DEF970BDF0B595B07E +:102070003B2008A9087369460BA800F074FF0028EC +:1020800004D0FF203C496B3014F0CDF93E4E0024C3 +:102090006D4630E02F19B87DC10706D0400704D443 +:1020A00060004019C0880AF08DFB3848807900280C +:1020B0001FD0B87D80071CD560004019C088002261 +:1020C00006210AF09CFB002813D03C2108A80173CC +:1020D00060004019C1886846C18569460BA800F0B8 +:1020E00042FF06000BD0FF2023497F3014F09BF9FC +:1020F00005E0641CE4B268460079A042CAD83046C4 +:1021000058E5F7B505460078002700090C463E461D +:10211000062804D0FF201849A83014F084F9287A42 +:1021200000280ED0012814D0FF201349C93014F024 +:102130007AF90298002C068001D027806680002062 +:10214000FEBD02270926002C0ED0A889A080A87BFE +:1021500008E003271426002C06D02869E060A88A2E +:102160002082287B2072E4E702980680E7E70000DF +:102170002400002000190020CC1F000000100010D7 +:10218000000000200005004004300000E8030020AB +:1021900010B56038030014F037FA0A060A0F131856 +:1021A0001F252930353A0868FFF788FD10BD05C99D +:1021B0001146FFF7D0FD10BD0868FFF775FD10BD93 +:1021C00005C91146FFF73FFE10BD4B6808788A68C5 +:1021D0001946FFF74BFE10BD8A6809C91946FFF77B +:1021E00061FE10BD0868FFF777FE10BD08884A68D9 +:1021F00080B21146FFF78EFE10BD05C91146FFF7EC +:102200009DFE10BD05C91146FFF7F1FE10BD01206E +:1022100010BD0120704700000E4A12680C498A4226 +:102220000AD118470B4A1268094B9A4204D101B5EA +:102230000AF090FF03BC8E46074909680958084711 +:1022400006480749054A064B704700000000000099 +:10225000BEBAFECA7800002004000020001500204D +:102260000015002001203F49400608603E490860F3 +:102270003E490A68FF231B029A4383121A430A60ED +:10228000384980390860704710B502460420384943 +:1022900004E0C3005B181B79002B0AD00346401EE4 +:1022A000C0B2002BF5D133A1432014F0BCF8FF20BD +:1022B00010BDC300CA50002259184A718A71012208 +:1022C0000A7110BD2A4A0021C000801801717047B0 +:1022D00010B50446042803D326A1522014F0A3F815 +:1022E0002348E1000C182079012803D021A15320B4 +:1022F00014F099F86079A179401CC0B2814200D0F5 +:1023000060710120174940068031086010BD70B52A +:10231000164804250068164E0004800F1B4C022846 +:102320001AD014A1692014F07EF815E02078C100BD +:1023300088190279012A07D1427983799A4203D018 +:1023400042798271705880472078401CC0B220705A +:10235000042801D30020207028466D1EEDB200280D +:10236000E4D170BD80E100E080E200E018E400E02C +:10237000E00800207372635C736F635F7369676E5C +:10238000616C6C696E672E630000000034000020F1 +:1023900010B5EFF31080C407E40F72B6D24841784D +:1023A000491C41704078012801D10BF07BF9002CC9 +:1023B00000D162B610BD70B5CB4CE07800280AD1D0 +:1023C0000125E570FFF7E4FF0BF074F9002804D055 +:1023D00000200BF047F9002070BDC44865714560CE +:1023E000F9E770B5EFF31080C507ED0F72B6BE4C7C +:1023F0006078002803D1BEA18F2014F014F8607813 +:10240000401E60706078002801D10BF04FF9002D5C +:1024100000D162B670BD10B5B348C178002904D0B0 +:1024200000214171C170FFF7DCFF002010BD10B525 +:1024300004460BF03FF9AC49C978084000D00120B0 +:102440002060002010BDF8B50246A74C0026A671FA +:102450000820042101251027130014F0D5F80D08D9 +:102460000A0C0E101214161E262123252800257191 +:1024700022E0022001E021711EE020711CE02771A2 +:102480001AE02020F9E7012616E0FFF781FF0BF0A4 +:1024900011F90028FBD002260EE02171A5710BE096 +:1024A0002771FBE7202000E040202071F6E7FF20A5 +:1024B0008FA1763013F0B7FF0BF008F9002809D090 +:1024C0000BF00AF9B04205D130460BF008F90028AC +:1024D000FAD02CE001208007C560894900224A60BB +:1024E000884A9661814B02225A608560864802695B +:1024F000D243D206D517026910231A4302610F4650 +:102500006D1C00E020BF78680028FBD030460BF03F +:10251000E6F80028FAD0002D04D17B48026910218A +:102520008A43026171490220886000207860A079A6 +:1025300000280CD00BF0BEF805460BF01BF8734AD0 +:10254000002D02D0A260E06001E0E260A060002EF9 +:1025500001D100F0A5F8F8BD10B504460BF0B0F8B5 +:10256000002805D060490120C8704A78521C4A7082 +:102570002046FFF768FF10BDF8B5614DA86800263A +:10258000012802D1AE600BF06DF86868012800D117 +:102590006E6028680127544C012812D12E606079A2 +:1025A000002803D000200BF05DF866712078002829 +:1025B00007D00BF07FF8002803D0012080070761C7 +:1025C000A770286901282AD12E6100F05FF8012048 +:1025D00080074761A079002815D00BF06BF80090B8 +:1025E0000AF0C8FF0099002901D0E16800E0A16865 +:1025F000411A022901DA8A1C11DC0099002901D054 +:10260000E06000E0A060FFF7C3FE0BF053F8002885 +:1026100004D0012080070761A77000E02770E868F8 +:10262000012812D100F032F800F030F800F02EF856 +:10263000A078002804D1FF202DA1033013F0F3FE71 +:10264000EE60A6702670FFF7CCFEF8BD10B5264CE4 +:10265000E078002801D10BF029F80120810788617A +:1026600000F014F8A07800280BD0254CE068002872 +:1026700003D10BF034F80028F8D10020E06000F01E +:1026800005F800201949C043886010BD08B55020E6 +:10269000694608806A461088411E1180FAD208BD3A +:1026A000F8B5124819278760154900200860C860EE +:1026B0000BF000F8BE0701240B4D002802D0346156 +:1026C000AC7000E02C70FFF763FE084847600D49CE +:1026D00028798863FFF7DAFFB461FFF7D7FF08496D +:1026E000002008617461F8BD38000020000300403C +:1026F0007372635C736F635F636C6F636B2E6300F5 +:10270000000100400005004000ED00E0FFFFFF7FFA +:102710008107C90E002808DA0007000F0838800872 +:102720002E4A80008018C06904E080082C4A80008E +:1027300080180068C8400006800F704710B50D2053 +:10274000FFF7E6FFC4B20420C043FFF7E1FFC0B2C9 +:10275000844203D023A11A2013F065FE26490120EC +:10276000486010BD0121254A48031060244B002217 +:102770001A60244A5160244A1060244A11601F499B +:1027800080390860704701211C4A480310601F4AC5 +:1027900051601B4A002111601B490860704710B549 +:1027A00017490868012804D00EA1572013F03BFEFA +:1027B00010BD114880680022C0B20A600AF020FCF7 +:1027C00010BD10B50E4801680029FCD0FFF7E7FFE7 +:1027D00001200D494003086010BD000000ED00E03D +:1027E00000E400E07372635C736F635F68616C5F49 +:1027F000726E672E6300000000D5004080E100E0AB +:1028000000D1004000D3004080E200E000D0004052 +:1028100030B40121BC48C9020160CD1005604A03F3 +:102820000260BA4803681B021B0A036004680023A5 +:10283000240A24020460B6480468240A24020460BE +:10284000B448012444608460B34C23606360A36097 +:10285000B24B19601D601A60B14B19601A600121FA +:10286000016030BC704710B40121A748CA02026061 +:102870000B0203600C060460A64841608160A94811 +:1028800041680029FCD1A4490020086048608860A4 +:10289000A24802600360046010BC704701219F4899 +:1028A000C9020160C91001607047002805D00128E5 +:1028B00005D0022805D19C4870479C4870479C4829 +:1028C000704710B59BA18B2013F0ADFD002010BD0B +:1028D00070B500219E4C9F4D9F4A8F4B002808D019 +:1028E00001281DD0022822D092A1B32013F09BFD15 +:1028F00070BD01200004A060A86011601960974BB2 +:10290000C2039A60964A90607F4A00121060954810 +:10291000016086480160944801609448017070BD70 +:1029200001204004A060A8605160596070BD012082 +:102930008004A060A8609160996070BDF8B594466D +:10294000834A8B4F834D00240126002808D001289C +:1029500032D0022840D077A1E82013F064FDF8BD02 +:10296000891E0902090A0120000490603C64686025 +:102970006C4A1164012B1DD000217C4A7D4B5170A3 +:102980006146DC63DE637C4B5C6002249C60042453 +:102990001C61744B3D31196073490E605F4B8915A2 +:1029A00019606F4B58605E4801606C49C005486013 +:1029B0001670F8BD0121E0E70120704E4004704F11 +:1029C000012B04D13464506068603964F8BD9060B4 +:1029D000346468603964F8BD01206A4E80046A4F2F +:1029E000012BF4D1EEE74F484068704770B54A4D6F +:1029F00028680026564C012806D1A068C00303D5DC +:102A000001200004A0602E606868012809D1A06838 +:102A1000800306D501204004A0606E6001200BF009 +:102A200041FEA868012809D1A068400306D501200D +:102A30008004A060AE6002200BF034FE70BD10B5C3 +:102A40004A490878002818D00120444AC0079060FD +:102A5000434AC00B90602C4A00121060414A00208B +:102A60001060324A1060404A106008704A78002AAC +:102A700002D048700BF016FE10BD0320FAE70120CB +:102A8000424900060860704701202449000608609A +:102A9000704701203D4940050860704701201F49EB +:102AA00040050860704733490020C86388151B49FA +:102AB00008607047410A364AC005C00D5043801C6B +:102AC0005143400A0818704710B4324C430B63431B +:102AD0001B0C5C020C602E4C6343C31A2E485C0234 +:102AE00058432B4B400D4343E31A0124DB032404DA +:102AF0001B191B1613700A681018086010BC704769 +:102B000010B50BF0A2FE10BD80E100E008E400E08B +:102B100018E400E000B0004040B1004080E200E076 +:102B200000E100E000B5004048B1004040810040B5 +:102B300044B100407372635C72656D5F68616C5F85 +:102B40006576656E745F74696D65722E6300000052 +:102B500000B3004040B3004040B5004000F50140E4 +:102B60000083004040850040008200404800002073 +:102B700000B10040C08F00400085004004B100401B +:102B800004B5004008B1004008B5004000E200E094 +:102B9000093D0000378600006F0C010010B50BF0F6 +:102BA00040FE10BD00200449C8630120012181407E +:102BB000024A116000BF7047C01F004080E200E081 +:102BC00010B50CF097FA0AF059F9FEF7DFFB12F096 +:102BD00063FA0CF0F5FF0CF081FF10BD70B50C46E8 +:102BE000054603F0D5FA214628460EF026F870BDBA +:102BF00070B50D46040012D0002D10D021012846DA +:102C000013F0F0FA10225449284613F08EFA524875 +:102C100001210838018044804560002070BD0120FA +:102C200070BD70B54C4E00240546083E11E0716839 +:102C300020014018817BAA7B914209D1C17BEA7BAC +:102C4000914205D10C22294613F042FA002806D001 +:102C5000641C30888442EADB0020C04370BD2046FB +:102C600070BD70B50D4606000AD0002D08D03A4C54 +:102C7000083C20886188401C884203D9042070BD2C +:102C8000102070BD3046FFF7CCFF002801DB401C50 +:102C90000AE020886168000140181022314613F0D4 +:102CA00044FA2088401C20802870002070BD70B538 +:102CB00014460D001FD0002C1DD00021A170022849 +:102CC00002D0102817D108E068782978000208435C +:102CD00011D00121A17010800BE02846FFF7A1FF61 +:102CE000002808DB401CA070687B297B0002084399 +:102CF0002080002070BD012070BD70B505461446CF +:102D00000E000AD000203070A878012807D004D91E +:102D1000114908390A8890420BD9012070BD002C56 +:102D200004D0287820702888000A5070022008708B +:102D300010E0002C0CD049680001411810222046F8 +:102D4000103913F0F2F9287820732888000A60738C +:102D500010203070002070BD540000205A4910B57A +:102D6000884207D301218904884205D3574909685D +:102D7000884201D2102010BD0146012006F0E4FA7D +:102D800010BD30B5044693B000200D4607901421C5 +:102D90000BA813F029FA1C21684613F025FA6A469D +:102DA000112010770020507710780221084310700E +:102DB00007A80C90012008AA907245486A46108521 +:102DC0000AA80B902088108460885084A088908482 +:102DD000E088D084907FF9210840801C40084000A2 +:102DE000907708209086108708A80F9010AA0BA94A +:102DF000684600F083FF002803D110A800882880CF +:102E0000002013B030BD3EB5044608206946088056 +:102E10002D48844207D301208004844205D32B48E7 +:102E20000068844201D210203EBD2146012006F0F8 +:102E30008BFA0028F8D12088694688806088C8808D +:102E4000A0880881E088488107F05FF801AB6A46F6 +:102E5000002101F0E1FB694609880829E4D003203C +:102E60003EBD1FB504460020029008206946088137 +:102E700015480391844207D301208004844206D37D +:102E800012480068844202D2102004B010BD07F03E +:102E90003CF8014602AA0F4801F055FD0028F4D184 +:102EA00069460989082901D00320EEE769460988A7 +:102EB000218069464988618069468988A180694680 +:102EC000C988E180E1E700000080010028000020BF +:102ED000042A0000FFFF000010B5031D036000205E +:102EE000521E04E05C181C60401C2346C0B2904295 +:102EF000F8DB0020186010BD01460A680020002A97 +:102F000002D0104612680A60704702680A600160C9 +:102F10007047000000B51E2823D00BDC0C281CD005 +:102F20001FDC030013F070FB090F1D111D1D171787 +:102F300013151D00302814DD3A38030013F064FB2C +:102F4000030F11091100002000BD214800BD04201D +:102F500000BD0D2000BD0F2000BD082000BD1120C8 +:102F600000BD032000BD10B50C4605F0EFFF0028A2 +:102F70001ED0204605F064F9002816D022780E2ACB +:102F80000DD00F2A0BD0022A09D0032A07D0102A0D +:102F900009D010A17C2013F046FA002010BDA078C3 +:102FA000FFF7B8FF10BD112010BD0AA18220F2E783 +:102FB00008A18820EFE710B504F083FF10BD10B51D +:102FC00005F03EF910BD10B504F0D9FF10BD0000AA +:102FD000023000007372635C686F73745F686369CA +:102FE0002E63000070477047704770477047704706 +:102FF00070477047704770477047704770470000D0 +:1030000010FFFFFFDBE5B151008001006400FFFF0E +:1030100003B40148019001BD09000020002803D03D +:103020008178012939D101E0102070470188FE4ADA +:10303000881A914233D01BDCFC4A881A91422ED068 +:103040000BDC00292BD00320C002081A27D001284E +:1030500025D001210903401A07E001281FD00228CA +:103060001DD0FF281BD0FF380138002815D116E0ED +:10307000FF220132811A904211D008DC01280ED0C3 +:1030800002280CD0FE280AD0FF2806D107E001292B +:1030900005D0022903D0032901D0002070470F205A +:1030A000704700B50B2826D009DC030013F0ACFAFA +:1030B0000B1D2125251B25292325271F1B00112832 +:1030C0001BD008DC0C2816D00D281CD00F2814D0DB +:1030D000102808D10FE0822809D084280FD0852835 +:1030E0000FD0872811D0032000BD002000BD05208F +:1030F00000BDCF4800BD072000BD0F2000BD04204B +:1031000000BD062000BD0C2000BD0D20800200BDCA +:1031100070B500290BD0CB1FFA3B81241E46CDB2DF +:10312000112B1BD2012805D0022806D009E000206F +:1031300010701DE0FF20043001E0FF2003308142C9 +:1031400018D0330013F060FA111613131613161665 +:103150001316161613131313161316000846FF380A +:1031600081381F2803D9FF39FE39022902D815708A +:10317000002070BD1470072070BD00B5030013F06F +:1031800043FA060406040C080A0C002000BD1120B6 +:1031900000BD072000BD082000BD032000BD007851 +:1031A0000207120F04D0012A05D0022A0AD10EE02C +:1031B000000907D108E00009012805D0022803D042 +:1031C000032801D0072070470870002070470620B0 +:1031D0007047002807D0012807D0022807D003280D +:1031E00007D007207047002004E0112002E02120D2 +:1031F00000E0312008700020704738B50C4605000B +:103200004FD06946FFF7CBFF002822D12088032149 +:1032100089028843694609788907090D0843208097 +:103220006946681CFFF7BBFF002812D121880320E4 +:1032300000038143684600788007800C01432180A9 +:10324000A8784007820F2020012A03D0022A03D049 +:10325000072038BD814300E00143218088B2010589 +:10326000890F08D0012189038843A9780907C90F6C +:1032700089030843208080B28104890F0AD0A9788D +:103280004004C906C90F400CC903084320808004CC +:10329000800F02D12088400403D5208840210843B4 +:1032A0002080002038BD70B50446002008801546F7 +:1032B0006068FFF7A2FF002815D12189A08981420B +:1032C00010D861688978C90708D00121490288426D +:1032D00008D8491C12F0A3FF298009E0FF21FF3123 +:1032E000884201D90C2070BDFF30FF3003302880A8 +:1032F000002070BD10B5137804785B08E4075B000C +:10330000E40F23431370FD2423400478A407E40F43 +:10331000640023431370FB24234004786407E40F04 +:10332000A40023431370F724234004782407E40FF8 +:10333000E40023431370EF2423400478E406E40FF1 +:10334000240123431370DF2423400478A406E40FF0 +:103350006401234313700078BF244006C00F23404C +:10336000800103431370002906D00878C10701D1FA +:10337000800701D5012000E00020C0015906490E58 +:103380000843107010BD30B50A8803239B020488DF +:103390009A4323059D0F02D1A3049C0F01D09B0FDC +:1033A00000E001239B021A4303230A801B039A4374 +:1033B00003889804840F02D11805830F01D0800F71 +:1033C00000E00120000302430A8030BDF3B593B052 +:1033D0000D000FD0139800280FD01221284612F0AC +:1033E00001FF03AAFF21012003F0E7F8002426468D +:1033F00037467AE0102015B0F0BD0720FBE768469D +:10340000807D01280BD16846818A0520C002081AF8 +:1034100010D0012810D0022812D0032812D0042C7A +:1034200014D0052C15D113E002290000012800005A +:1034300003300000012400E002246846468A08E0C8 +:10344000032406E068460424478A02E0052400E0DD +:1034500006246846418A1398814246D12C74002E76 +:1034600041D00DAA0EA905200292019100901023CF +:103470000022FF21304603F041F9002823D168469D +:10348000808E2A46C0B20EA9FFF711FC00281AD17F +:10349000AE81002F27D00DA9052008AE0291009023 +:1034A000132300220196FF21384603F027F9002854 +:1034B00009D16846808EF11CC01EC0B22A1DFFF7DC +:1034C000F6FB002801D0032095E708A88178427810 +:1034D00008021043E881062C05D16846807DA87259 +:1034E0006846808A2881002085E703A803F06EF8EB +:1034F000002884D0FFF7D5FD7DE7002805D0F94AE4 +:10350000012903D0022903D003207047518800E02D +:103510009188814201D1002070470720704770B523 +:103520000C4605461C21204612F05CFE002020803F +:10353000002D08D0012D04D0EBA1F04812F073FF4C +:1035400070BD062000E00520A07070BD70B592B07F +:103550001546064601206A461071107453740846D9 +:1035600008300395029048889082FEF7E1F9040044 +:1035700019D06580172069468883203600940AABED +:103580007178023307AA01A80DF05FF9064660784A +:10359000000701D5FEF7ADF9002E0AD03046FFF73F +:1035A000ECFD12B070BD1321284607F01BF9032073 +:1035B000F7E708A800906846838B0422012128467B +:1035C00008F035FEEDE770B506468AB000200D46DE +:1035D00007900590069003A90490052402460291E5 +:1035E0000190102300942946304603F087F8002804 +:1035F0000DD108A804A9009102900194684683891E +:1036000000222946304602F095FE002801D0FFF73F +:1036100048FD0AB070BD10B50DF01DFB10BDF0B532 +:1036200089B000260546059600780C460827030059 +:1036300012F0EAFF0CFD070C3A0B77779EC2FCD81C +:10364000E8FD68680A38FEF7E8FA0DE1A88800236B +:1036500080B201220321009009F08CFA0290002C24 +:1036600004D0A648A0A16E3012F0DDFE029800281A +:1036700004D1A2489CA16F3012F0D5FE02980099A7 +:1036800008300CF017FDFEF753F9040007D06078FE +:103690003843607000986080FEF72BF9E6E0132154 +:1036A000009807F09FF8EFE0002C04D1BD208EA118 +:1036B000800012F0B8FE608800230122032109F087 +:1036C00059FA0090002804D18C4887A1883012F064 +:1036D000AAFE0099002008802A7994461EE0C300C3 +:1036E0005B199B6807936B469B8B1A0708D5DA0614 +:1036F00006D56046C20050194038C08F088006E0E9 +:103700005B0409D50871C2005019C08848806078F0 +:10371000384360700226A7E0401CC0B28445DED862 +:10372000A2E0E888694608800090002C04D1734824 +:103730006DA1983012F077FE2878062814D10098F1 +:10374000C00B11D0608800230122032109F012FA76 +:10375000060004D1694864A1A23012F064FE002082 +:103760003071A88870803BE06078384360707BE0FF +:10377000002C04D161485CA1B43012F054FE608882 +:1037800000230122032109F0F5F90090002804D15B +:103790005A4855A1B73012F046FE009808300DF097 +:1037A000ACFA0121484002D1E888C00B5CD00098F7 +:1037B00061880226C180D7E7002C04D14F484AA176 +:1037C000D03012F030FE608800230122032109F07E +:1037D000D1F9002804D1494843A1D33012F023FE87 +:1037E0000226C1E7002C04D144483FA1DC3012F08E +:1037F0001AFE0226618801222046FEF71FFA0120E8 +:103800000590B1E7A889002380B20122032100902E +:1038100009F0B0F90746002C04D0384832A1EE3048 +:1038200012F001FE002F07D12FA101E00FE016E0FA +:103830003248EF3012F0F7FD686802902889694637 +:103840008881012202A90098FEF714FA0CE0002CEE +:103850008AD16D2024A1C00012F0E5FD84E727483D +:1038600021A1FE3012F0DFFD002C0DD060780007A2 +:103870000AD50598002807D18420207020465822B8 +:1038800029460830FDF7A0FC304609B0F0BDF7B579 +:103890000C460546007A224688B00A320292921CF3 +:1038A00004920027811E16323E4601920B0012F050 +:1038B000ABFE08F605F548488DD1F4F5688800237D +:1038C0000122032109F056F90190002803D106A135 +:1038D0000B4812F0A8FD01980088002812D052274A +:1038E000072601E1000900207372635C676174744C +:1038F000735F636F72652E63000000006F0200004B +:103900008603000051271E26002C7DD06888A080E9 +:103910000120A071019802990079C0004019C08966 +:10392000FFF754FD002870D101980079C0004019BC +:10393000C089208101980079C0004019408AA08385 +:10394000F2E0698A0091062820D1E889C00B1DD0D9 +:1039500008462230512786B2002CD6D0A889049977 +:10396000FFF734FD002873D16888A0800220A07181 +:10397000A88920810120A072288AE08300982084F1 +:103980006969009A019812F0D0FBCDE0084620301A +:10399000502786B2002CB8D0A8890299FFF716FDEF +:1039A000002855D16888A080A889E080287A062858 +:1039B0000AD002202072288AA0830098E083204643 +:1039C00069692030009ADEE70120F3E76888002368 +:1039D0000122032109F0CEF80690688A009006982B +:1039E000002803D1FD49FE4812F01DFD069808305D +:1039F0000DF083F90121484002D1E889C00B26D09F +:103A00000098223086B201E073E021E05127002CBB +:103A100079D06888A080A8890499FFF7D7FC00288E +:103A200016D10220A071A88920810420A072288AC2 +:103A3000E083009820846969009A019812F075FB70 +:103A40000699002008710698A98941806CE003203E +:103A50000BB0F0BD688805F0D2FB019068880023A8 +:103A60000122032109F086F800900198002804D172 +:103A7000DB48DA492C3012F0D6FC0098002804D13B +:103A8000D748D6492D3012F0CEFC0098D549C088D1 +:103A9000884205D05127222604E01EE03FE035E0B1 +:103AA00050272026002C2ED06888A080502F07D0C9 +:103AB0000220A0712146287B0831FFF730FD33E05A +:103AC000287BA11DFFF72BFD6A8800230099019830 +:103AD000FFF73CFD0028BBD126E0C349A889C9886F +:103AE000814207D154270626002C0CD06888A0807C +:103AF0001AE008E053270826002C04D06888A0802C +:103B0000A889E08010E00A98068013E05527072670 +:103B1000002CF8D0A889A0800020A07104E08D209E +:103B2000AE49C00012F07FFC0A98002C068001D03C +:103B30002780668000208BE7AB4900200870704723 +:103B400030B585B00C4601F0E0F90546FF2804D1F8 +:103B5000A348A249953012F066FC00202080207115 +:103B60006080401EE0802046294608300CF096FA1E +:103B70006A462946012002F020FD102412E0684622 +:103B8000808800070ED56846C0882946FFF71BFDD0 +:103B900068468188FF2321438180C0882946019A95 +:103BA00002F036FE684602F011FD0028E7D005B0AD +:103BB00030BD0A46014610B5104608300CF082FAB6 +:103BC00010BD70B5002305461A46032108F0D2FF48 +:103BD000040004D182488149B73012F024FC204609 +:103BE000294608300CF066FA70BDF0B591B00C466D +:103BF000074605F004FB050005D02878222804D2EA +:103C0000082011B0F0BD7948FBE700231A460321D4 +:103C1000384608F0AFFF0646002C02D0A0880028E6 +:103C20000CD00120694608710220087400204874F5 +:103C3000002C05D0A0880883206802E00920E0E776 +:103C4000088305903046083003970290FDF770FE18 +:103C5000040018D0678017206946888320350094B7 +:103C60000AAB6978023307AA01A80CF0EEFD0546FD +:103C70006078000701D5FDF73CFE002D09D02846ED +:103C8000FFF77BFABDE71321384606F0ABFD0320B2 +:103C9000B7E708A800906846838B042201213846C4 +:103CA00008F0C5FA0021C943F180AAE7FFB585B045 +:103CB0000E9E7788384605F0A2FA054600231A467C +:103CC0000321384608F056FF0446002D03D143492E +:103CD000474812F0A8FB002C04D145483F49401C3E +:103CE00012F0A1FB0834089869460394C1C105A8E5 +:103CF0000DC8203569780CF017FAC6E5F0B5044612 +:103D0000002099B00D4601460D9010A881811646FD +:103D100001818180344A68469180018510A8018024 +:103D200068460187818581841078012808D002289F +:103D300006D0032804D0042802D0082019B0F0BD12 +:103D40002C4A944273D32C4F0121890438688C4249 +:103D500001D3844278D3274A954275D3012189043F +:103D60008D4201D385426FD36168002913D0214A67 +:103D7000914269D301229204914201D3814263D3DB +:103D800060892189884203D801225202914201D9D7 +:103D90000C20D3E70D9016AA0EA92846FFF783FA48 +:103DA0000028CBD1686880784007800F02280AD1AC +:103DB0006846008F8004800F05D02869002802D053 +:103DC0003968884240D30AA92069FFF716FA00280B +:103DD000B4D1206900281CD060780FE0E8380000DA +:103DE000EE030000FFFF0000000900200230000089 +:103DF0000C050000008001002800002080076846B4 +:103E0000008D03D58004800F68D002E08004800F0D +:103E100064D16846008D810618D58004800F6068E3 +:103E200006D0002812D0396888420DD302E00BE09A +:103E300000280BD0FE49884206D30121890488421C +:103E400004D33968884201D2102077E709A9606954 +:103E5000FFF7D3F900289CD16069002808D0684694 +:103E6000808C0105890F012938D18004800F35D05D +:103E70000BA9A069FFF7C1F900288AD16846808C98 +:103E800080062BD46846808D810627D4A16900293D +:103E900006D00105890F012920D18004800F1DD093 +:103EA000E068002804D00078002817D01C2815D21C +:103EB00004AA611C2046FFF71DFA0121890210A8FF +:103EC0000180012768468773DA49818104AA033299 +:103ED00017A92868FEF711FF002801D007202DE759 +:103EE00010A8007F15A9C01CC2B200200C9201903E +:103EF000FF32009003460291FF3203A8033210996B +:103F000002F0B3FA002826D110A9888A0F902A89D6 +:103F10002969C94801910092029010A90A8B6B8906 +:103F200028680E9902F0A1FA01007DD1C24800254F +:103F3000001F818868464174090A8174052104A81C +:103F40006A4623C210A82A46FF21808A0C9B02F0F1 +:103F5000F1F9002802D0FFF7A4F8EFE66846007CEC +:103F60000322C1090020920290430122920280188C +:103F70001490002928D0014610A801806846292104 +:103F8000877309028181058608A8007C0023410807 +:103F900060784900C007C00F014308A80174FD20E4 +:103FA00001406078A54A8007C00F4000014308A87F +:103FB00001740CA9022001910090029503A81099A8 +:103FC00002F053FA01002FD16068002828D0206940 +:103FD00000280DD10AA90EA8FFF7D5F9607880074F +:103FE00006D46946088D032109038843694608857C +:103FF000904968468773FE31818190492089891EE6 +:1040000012F00DF962680D9811AB019200900293C5 +:104010000A46002303A80A9902F027FA010003D1F7 +:104020002078C10603D400E086E080062AD56846E1 +:104030000586606900280DD109A90EA8FFF7A3F92C +:104040006846818C03208002814301208002091888 +:10405000684681846946888CC821084369468884FB +:1040600074488F73FF30888112AA0CA90220029233 +:10407000019100900023714A03A8099902F0F5F913 +:10408000010059D12078C00729D068460586A0696B +:1040900000280DD10BA90EA8FFF775F96846818D90 +:1040A000032080028143012080020918684681852F +:1040B0006846818D40200143684681858773604949 +:1040C000818113AA0CA90220029201910090002381 +:1040D0005A4A03A80B9902F0C8F901002CD1E068F4 +:1040E00000282DD010A8149901805549684687737F +:1040F000491C8181E16808A80A78027449784174F2 +:10410000E0684122418868464186E06800230179E1 +:1041100008A80175E068D200C18808A84175090A9D +:1041200081750CA8072101900091029503A81099B0 +:1041300002F09BF9010003D00F9800F0EAFEFDE5C4 +:104140003D480321001F0170002E0AD08088308076 +:1041500010A88088708010A80089B08010A880897D +:10416000F0800020EAE530B501248BB015460B46FF +:10417000012802D002281CD104E06846052184737E +:10418000C90203E02B4968468473891E8181002B94 +:1041900012D003210020890288430121890240189E +:1041A0006946888405AA04A91846FEF7A6FD0028DA +:1041B00004D007200BB030BD1020FBE76A46127C0C +:1041C0001D480092801E05A9FF3201910290FF3226 +:1041D000002303A80332099902F047F9002802D00E +:1041E000FEF75FFFE6E71448001F002D01D041886D +:1041F000298004700020DDE770B592B004460126E6 +:1042000008A886700F496846018410AA08A930469C +:10421000FFF7A9FF00284DD12078074DC0070024E3 +:104220002D1F002848D01C21684611F0DDFF0BE04F +:1042300000800100032800000409002003020000A0 +:10424000032900000118000068460178202001437E +:104250006846017008A88670F9496846018411947F +:104260000794817FF92001406846891C81770020EE +:1042700001466846017700200146684641770421DF +:104280008185C485018607A80A9011A80D9008A809 +:1042900009900EAA09A96846FFF730FD002809D148 +:1042A0006846008FE8806846808F2881401C6881BE +:1042B0002C70002012B070BDEC802C8110A80088FA +:1042C000F4E7F7B5DF4900260A789EB0012A04D04A +:1042D000022A02D0082021B0F0BD4A88824201D0D3 +:1042E0000620F8E71F98824201D10720F3E7012258 +:1042F00010A98A75D4488882002003239B020146B6 +:1043000099439302CB1810A90B8669468A81CF4A3C +:10431000CA8118A9887110A9888419A904916946CD +:10432000CA820690FF20087503A802F072F90024E3 +:104330002546274608AA052103A802F06DF90028A2 +:1043400010D082286FD1002C6FD0002D6DD010A816 +:104350008480C5800021017418A8807B11AC0128DD +:1043600065D06DE008A88079002F21D0012857D1B1 +:104370006846818CB44881421CD113AA0DA905203E +:104380006B4607C36846408C10230022FF2102F0D1 +:10439000B5F9002868D110A88089042801D0062822 +:1043A0004CD16846818E1F98814239D10F2092E707 +:1043B000012835D16846808C0521C902884202D087 +:1043C000491C88422CD19F4841886846408C8142D4 +:1043D00001D1012700E00027002C01D0002D10D0D2 +:1043E0001F9988421CD113AB0DAA05216E460EC63B +:1043F000044610230022FF2102F080F9002833D167 +:1044000001E035460CE010A88089022801D0102870 +:1044100014D1C0B21BAA0DA9FEF749FC00280DD18A +:104420006846468C86E71FE0FFE7052053E714A99E +:104430001BA8221DFEF761FC002801D003204AE7DB +:1044400010A8007C0023001DC2B210A8027420989E +:1044500002900194009215A81C9902F006F8002819 +:1044600002D1784902220A70FEF71BFE33E710B52D +:104470000B46401E86B084B203AA00211846FEF700 +:1044800039FF04AA052103A802920191009001239B +:104490000022FF21204601F04DFF04466846008AB5 +:1044A000012804D06D206A49000111F0BCFF2046AC +:1044B000FEF7F7FD06B010BDF0B5624F0446387840 +:1044C00087B00E46032804D0042802D0082007B085 +:1044D000F0BD04AA03A92046FEF7E5FE0500F6D1CB +:1044E000606880784007800F02280DD16846808977 +:1044F0008004800F08D02069002805D0554909683C +:10450000884201D21020E2E7208905AA6B46216982 +:1045100007C369460A8A63892068039901F0A5FFE9 +:10452000002802D0FEF7BDFDD1E7002E02D068467C +:10453000808A3080042038702846C8E738B50C00DF +:10454000054609D000236A46FF2102F039F9002808 +:1045500004D0FEF7A6FD38BD102038BD69462046C0 +:10456000FEF74BFE0028F8D1A078FF21C307DB0F30 +:104570002846009A02F04CF9EBE73EB50C0009D052 +:1045800002AB6A46FF2102F01BF9002804D0FEF7B7 +:1045900088FD3EBD10203EBD0321204611F022FEC5 +:1045A0006846008801A90005800FFEF712FE00286A +:1045B0000BD16846007920706846008801A9800404 +:1045C000800FFEF706FE002801D003203EBD68469E +:1045D00000796070A278EF20024068460088C10B25 +:1045E00009010A43F7210A404104C90FC9000A43DF +:1045F000A270F9210A40800601D5022000E00120C6 +:10460000400069460243097A50084000C907C90FB3 +:104610000843A07000203EBD7FB5144605220192DC +:1046200003AD029500930A462388FF2101F082FE24 +:10463000694689892180FEF734FD04B070BD000011 +:10464000052A00000009002002280000FFFF0000EA +:10465000E838000028000020F3B5002799B068462C +:104660000C4607873D4600291ED0E068002806D08A +:10467000A068002818D001886A4611870780199819 +:1046800004F0BDFD002812D0007822287ED31998AE +:1046900000F03BFC002300901A460321199808F013 +:1046A00069FA060009D104E010201BB0F0BDFD48F6 +:1046B000FBE7FD49FD4811F0B6FEA078012803D0C4 +:1046C000022801D00720F0E72088002808D0401EEB +:1046D00080B203AA009901F070FF002859D11DE0B3 +:1046E000F048401CE1E76946498A228891420BD292 +:1046F0006846807D0025012810D16846808AEC49F3 +:1047000088420BD1012509E0914203D1002D2AD026 +:104710006D1C01E0022D0BD0032D04D203A801F083 +:1047200055FF0028DFD082281BD0002831D11DE0A2 +:104730006946897D0129F1D16946DD4B8A8A5B1E74 +:10474000D11A9A420FD005DCDA48101A0BD0012892 +:10475000E4D108E0012906D0FF390129DED1032583 +:10476000E1E7022D15D10D2080029EE7E0680028C8 +:1047700016D00EA9052202910192009069460B8F76 +:10478000A2882088FF2101F0D5FD00E01EE000286E +:1047900002D0FEF786FC88E76846A168008F088093 +:1047A0006846008AC00601D5C3487EE707980028FE +:1047B00003D06846008B022801D0032075E70798D4 +:1047C000A1780078012903D0800710D408206CE775 +:1047D000C007FBD000220721199808F010F8002824 +:1047E00002D00725022004E0AE48801C5DE70225C8 +:1047F000032008A908702188684681851998083621 +:104800000A90099617216846818712AB02330FAAD6 +:10481000052108A800970CF018F8002802D0FEF730 +:10482000ACFC42E710A800906846838F042229461A +:10483000199807F0FCFC38E770B5064615460C469B +:104840000846FEF7EBFB002804D12A4621463046F5 +:10485000FFF789FCF2E610B5FFF733FD10BD70B528 +:104860001E4614460D0014D0002C12D06168002999 +:104870000FD00121FEF741FE002809D12068FEF784 +:10488000CDFB002804D1324621462846FFF736FAF0 +:10489000D4E61020D2E670B515460C000ED00221E9 +:1048A000FEF72BFE002808D12068FEF7B7FB002892 +:1048B00003D129462046FFF7FFFDBFE61020BDE6E5 +:1048C000F8B506467D480D46016814468A4231D344 +:1048D0006068002808D07A4A90422BD301229204C3 +:1048E000904201D3884225D37648864204D0304690 +:1048F00004F085FC00280CD0304600F006FB06468C +:10490000284600F0BFFA002804D16068002802D0D1 +:1049100012E06448F8BD00236A463146284601F09B +:104920004FFF002802D0FEF7BCFBF8BD68460088A8 +:10493000800601D41020F8BD6188224628466368AD +:10494000FFF76AFEF8BDF7B55C4E0746306886B0E3 +:104950001446824202D2102009B0F0BD384600F061 +:10496000D4FA05465748874201D0FF2D08D00023CE +:1049700004AA2946079801F023FF002826D101E068 +:104980004848E9E76846008AC00601D54A48E3E797 +:1049900003A9002002910527019000976288494BE6 +:1049A0002946079801F0AAFE00280FD161683268F5 +:1049B000914208D30191029000972388628829468A +:1049C000079801F09BFE694689892180FEF769FB03 +:1049D000C2E7002907D03C4B0A881B899A4202D8BB +:1049E0003048401C704737E610B586B004236C464B +:1049F000A382354BDC88002C07D01B898B4201D267 +:104A0000914204D92748401C54E5062052E56B46E4 +:104A100019825A820021009101911C800221997013 +:104A200005A9029104A903916946FFF715FE41E526 +:104A3000F3B50C4685B0812069460873002C1BD065 +:104A4000059804F0DCFB070018D03878222869D3D9 +:104A5000059800F05AFA049000220121059807F009 +:104A6000CEFE00280CD000231A460321059808F03A +:104A700081F805000AD105E0102028E5094826E55F +:104A8000112024E50849114811F0CDFC28460830D2 +:104A90000BF032FB06462078012819D0022838D0C6 +:104AA000072014E502300000E8380000E1080000AB +:104AB0000328000000280000013400002800002026 +:104AC00000800100FFFF000000090020840A0000B0 +:104AD000A18803AAFEF71CFB0028CED1B00721D580 +:104AE0006846007B00281FD1A079C0071CD0E06871 +:104AF000002205216B4607C36389228968880499CF +:104B000001F018FC6946087300280DD0FEF7C9FAB9 +:104B1000DDE4A18803AAFEF7FBFA0028ADD134201A +:104B2000064201D10820D2E46846037B2946384674 +:104B3000059AFEF70BFDCAE4FFB597B0002001907F +:104B40001F4615460C460E46179804F058FB0028E1 +:104B500004D00078222803D20820A6E5F448A4E572 +:104B6000B80801D00720A0E5032F00D1002717982F +:104B700000F0CBF90890002C1BD0022D77D3ED4824 +:104B8000006884427CD361190091012902D0491E3A +:104B9000814275D3AD1EAAB22146E74810F036F81F +:104BA00000991E394A7F0B7F11021943884267D151 +:104BB000ADB2E248B90702D50189491C00E00121E4 +:104BC00089B20091F90701D0078900E0DA4F03AA02 +:104BD0000899009801F0F1FC0DE0F078B17800023E +:104BE000084310284CD80199091D401880B2019043 +:104BF000A84245D82618002E60D07078317800027F +:104C0000084300998842E8D358E06946098A0A07B0 +:104C100054D5002C3FD0019AA618121D92B20992C9 +:104C2000F278B37812021A439446102A28D8099AC7 +:104C30006244AA4224D87278337812021A4390420E +:104C40001ED1C8061ED509980AAA052120186B4650 +:104C500007C3707831780002084363460022089940 +:104C600001F068FB002803D0FEF71BFA1DE507E002 +:104C7000F078B178000208436946098D884201D076 +:104C80000B2012E5F078B17800020843099940182A +:104C900080B2019006E0C90604D50899FEF793FC9E +:104CA0000028E3D16946088A1021884369460882B2 +:104CB000488AFF23049A089901F0AAFD03A801F08D +:104CC00085FC002803D16846408AB8429DD900235C +:104CD0001A460321179807F04DFF040003D19849A5 +:104CE000984811F0A0FB20880028BFD0012108A817 +:104CF00001700173002646732188684601862046AC +:104D00000830099017980A90FCF712FE05001BD096 +:104D10001798688017206946888010AB023301AA73 +:104D2000052108A800950BF090FD0746687800075C +:104D300004D584488249223011F075FB002F09D038 +:104D40003846FEF71AFAB0E41321179805F04AFD29 +:104D50000320AAE40EA8009068468388042201215B +:104D6000179807F064FA00288BD126809DE4F0B5EF +:104D700000248DB01F4615460E46002A04D0B908FF +:104D800004D007200DB0F0BD1020FBE7032F00D1A9 +:104D9000002700F0BAF80390FF2804D06749B8074D +:104DA00003D5488902E06248ECE70120FA0702D007 +:104DB0004989491E00E0604906AA8FB2039901F0B3 +:104DC000FCFB38E06946898B090734D504AB052123 +:104DD0000022029300910192574B039901F08EFC3F +:104DE000002821D1002E21D06A46128A2988A218D3 +:104DF0003019121D914234D36946CA8B0270120ACF +:104E000042700A8A8270120AC27004A90522001D2B +:104E10000092029101906946C88B0B8A0022039987 +:104E200001F06CFC002801D00320ABE76846008A43 +:104E30002018001D84B206A801F0C8FB002804D089 +:104E4000822806D0FEF72DF99CE76846C08BB84251 +:104E5000B8D9002C07D0002E10D02988A01C814280 +:104E600003D20C208EE705208CE7224631463248DB +:104E70000FF0CCFE31190870000A4870A41C2C8079 +:104E800000207FE700B585B06946FEF79FFA00284D +:104E90000AD16846007C030011F0B6FB08052F2FED +:104EA0002F2F08080531032005B000BD6846807823 +:104EB000012807D1684600880321C902401A1CD086 +:104EC00001281AD068468079012806D16846808872 +:104ED00015214902401A05280FD96846807A012811 +:104EE00011D16846018929200002081A05D002283C +:104EF00003D0032801D0042805D10F20D4E712A144 +:104F0000164811F090FA0020CEE710B507F028FE01 +:104F100010BD10B50C4601F023FB002803D00AA1F8 +:104F20000F4811F080FA2046FEF7BBF810BD0000D4 +:104F30000230000028000020FFFF000000090020D0 +:104F4000E83800003F0B00007372635C67617474A3 +:104F5000735F636F72652E63000000002202000021 +:104F6000BB060000F8B500780C46164610340E3625 +:104F7000069F022809D0032836D005287ED0FF20BE +:104F8000F6A1E53011F04FFAF8BDCD890A2068434B +:104F90000E30188031203880002AF5D0087B9581AA +:104FA000801FC7B21AE020886168308048780A788C +:104FB00000021043F080C8788A78000210433081E4 +:104FC000B21C3846091DFDF772FE002F01D00028E3 +:104FD00002D000203071708008340A3628466D1ED9 +:104FE000ADB20028DFD1F8BDCD890A2068430E306C +:104FF000188032203880002AF5D0087B9581401F28 +:10500000C7B243E0616822880878F2803279C3072A +:1050100052085200DB0F1A43FD231A408307DB0FAF +:105020005B001A43FB231A404307DB0F9B001A4324 +:10503000F7231A400307DB0FDB001A43EF231A4064 +:10504000C306DB0F1B011A43DF231A408306DB0F65 +:105050005B011A43BF231A404306DB0F9B011A432F +:105060003271C00970718A784B7810021843308110 +:1050700032463846C91CFDF71AFE00E00CE0002855 +:1050800002D00020B070308008340A3628466D1EE9 +:10509000ADB20028B6D1F8BD087BCD89801E86B29E +:1050A0003046083068431030188034203880002A99 +:1050B000F1D0174695811037E800D681C0190090CD +:1050C0000DE020883880009878603246616800984A +:1050D00011F02BF800980834801908370090284602 +:1050E0006D1EADB20028ECD1F8BDFFB581B00A9DB0 +:1050F0001E460C46002A05D0607AFF300130D08071 +:10510000E089108101980E270078030011F07CFAE5 +:105110000B7E0719293541536C7878787E00009210 +:10512000087B082805D0032803D091A1954811F0E9 +:105130007AF9378030200FE000990020888105B08F +:10514000F0BD0092087B042804D08E4888A114305A +:1051500011F069F937803120288000980028EBD1C0 +:10516000EDE70092087B042804D0932080A1800002 +:1051700011F059F937803220EEE70092087B0228BF +:1051800004D080487AA13A3011F04DF937803320AD +:10519000E2E7087B1746042804D07A4874A14C3013 +:1051A00011F041F91020308034202880002FC6D023 +:1051B0000020B88116E0207B1746052806D0062877 +:1051C00004D070486AA1603011F02DF912203080AF +:1051D00035202880002FB2D0E089B88100203882A5 +:1051E00001984088F881AAE70092087B072804D03C +:1051F00064485FA1713011F016F937803620ABE7B3 +:1052000033460095019800F00EFC98E72F2053A13B +:10521000000111F008F992E770B50C46054603F05D +:10522000EEFF002804D00078222803D2082070BDA9 +:10523000554870BD00231A460421284607F09AFC01 +:105240002060002801D0002070BD032070BDFFB594 +:105250008BB00D4607461720694608850E98032631 +:105260001446002805D10EA93846FFF7D5FF0028BF +:1052700034D1002D0BD000220321384607F0BFFAAD +:10528000002834D00E980078002830D108E020782B +:10529000092819D00F2823D030A13C4811F0C3F8B9 +:1052A0000E98A760801D03AA606002320AA92046FA +:1052B00000F00FFC002827D0030011F0A5F9071A11 +:1052C000182323211C1E23000726002231463846BE +:1052D00007F095FA0028E3D12B48801C0FB0F0BDF1 +:1052E00000220321384607F08AFA0028D8D111207D +:1052F000F4E70020F2E70820F0E72348401CEDE740 +:105300000720EBE70320E9E701A800906846038D3A +:1053100004223146384606F08AFF0028DED1002DEF +:10532000DCD00E990D70D9E730B587B01D460C461C +:10533000002A11D0042369460B7013888B81528890 +:10534000CA81A2788A7422880A8200236A46294682 +:10535000FFF77DFF07B030BD1020FBE77372635C81 +:1053600067617474635F636F72652E630000000091 +:105370007372635C67617474635F636F72652E63DD +:105380000000000025020000023000004F03000072 +:10539000F3B581B001980C4600780826030011F09F +:1053A00033F9125F47471B134B0A0A0A0A0A0A0A13 +:1053B0000A0A0A0A0A5F002C02D1F849F84808E0F4 +:1053C0006078304360703CE0002CF9D1F448F34938 +:1053D000083011F028F8F3E70198002380880122B3 +:1053E00087B20421384607F0C5FB0546002C04D0DF +:1053F0007520EA49C00011F016F8002D04D1E848E4 +:10540000E649143011F00FF83946A81D00F058FB9A +:10541000FCF78EFA040006D0607830436070678035 +:10542000FCF767FA0FE01321384605F0DBF915E0C9 +:10543000DB48DA49283002E0D948D8492D3010F04D +:10544000F2FF002C0AD06078000707D59320207067 +:105450002046582208300199FBF7B6FE0020FEBD19 +:10546000CF48CE493130EAE710B500210170801DE8 +:1054700000F023FB10BD0A4610B50146901D00F058 +:1054800027FB10BD70B5002305461A46042107F01E +:1054900071FB040004D1F920C049800010F0C3FF63 +:1054A0002946A01D00F00CFB70BDF7B5054684B081 +:1054B0000C4600206946088188806F8803460122D7 +:1054C0000421384607F056FB060004D1FD20B349FD +:1054D000800010F0A8FF002C03D0A7800020E080FF +:1054E0002081297A20461230C91E142700900B0013 +:1054F00011F08AF80FFEFDFC3809A95E657A2FB21B +:10550000C9E99191FC003078012804D0A3497020AA +:10551000143110F088FFA9896A46C8000E309080C7 +:1055200030201081002C13D0A18100200DE0C1009B +:10553000327909190A747288CA8182005319DA898A +:105540004A821A8A401C8A8280B2A1898142EED89E +:10555000F1E002A8009001AB22462946304600F057 +:105560002BFAE8E03078042804D08C49BD201431AF +:1055700010F059FFA8890622014650436A460E30B2 +:10558000908033201081002CE2D0A18100200BE01C +:10559000062141434F190919FA89CA81BA7C8A74D4 +:1055A0003A8A401C0A8280B2A1898142F0D8C2E0C6 +:1055B000307806280BD079491431D72005E03078AF +:1055C000062804D07549EB20143110F02CFFE8892F +:1055D00069461230888035200881002CB8D0A9890E +:1055E000A1817188E18126E03078072804D06B49D9 +:1055F000FF20143110F017FFA8896A4601460E30CB +:10560000908036201081002CA2D0A1812046AA894A +:105610000E30296954E0E8896946123080B2382298 +:1056200088800A81002C7ED0A989A181287A10283F +:1056300007D00221A173E9892182EA8929690098AA +:105640003EE00121F6E702A8009001AB2246294680 +:105650003046FFF787FC6EE03078082805D04F49C8 +:10566000FF201431EE3010F0DEFE684637218780CF +:105670000181002C5FD0A989A18100206082208255 +:105680000120A07357E03078092805D04349FF2056 +:105690001431FF3010F0C7FE288A69461430888024 +:1056A00037200881002C46D00421A173A989A1814B +:1056B000E9892182298A618220462A8A143069690F +:1056C00010F033FD37E030780A2804D033493548EC +:1056D000143110F0A8FE6846372187800181002C24 +:1056E00029D00521A1730020A08102E01EE003E083 +:1056F0000CE0208260821EE002A8009001AB2246EE +:1057000029463046FFF7F1FC15E00CE00D20694614 +:10571000392288800A81002C05D00120E0800020F9 +:105720002081207307E00699088019E01C481B4976 +:10573000A43010F078FE6846069980880880002C16 +:105740000ED0684600892080684680886080287A6C +:10575000032805D0102803D0112801D00020307074 +:10576000002007B0F0BDF7B5568815460F46002358 +:1057700082B01A460421304607F0FCF9040004D137 +:1057800007480649C43010F04EFEA41D33462A4691 +:1057900039460094029800F022FBD0E45C530000EC +:1057A0009503000013020000F7B58CB00D461446B7 +:1057B00007A90C98FFF730FD002812D1B64E01273B +:1057C000002C0FD00321684601701021818208A8A7 +:1057D00002460690204605A9FDF78FFA00280BD057 +:1057E00007207BE50821684601708581C681052177 +:1057F0008774C90201820BE00798A17801712188A2 +:105800004180684605218774C90201828581C6816D +:1058100002460121079B0C98FFF719FD5EE508B5CC +:1058200001236A4693709D4B13800A460223694602 +:10583000FFF77AFD08BD08B501236A469370974BC0 +:105840005B1C13800A4603236946FFF76DFD08BD04 +:1058500000B587B000290CD002236A4613700B886C +:1058600093814988D18100230421FFF7F0FC07B020 +:1058700000BD1020FBE710B5002903D00523FFF77A +:1058800053FD10BD072010BD70B588B00D461446FD +:10589000064607A9FFF7C0FC00280DD1002C0DD04B +:1058A0000621684601708581C481079B02465C80A1 +:1058B00006213046FFF7CBFC08B070BD05216846D5 +:1058C00001708581F1E710B588B000290BD007245D +:1058D0006B461C709A81049100236A462146FFF7AB +:1058E000B6FC08B010BD1020FBE770B500241722ED +:1058F00088B0002914D00D782B0010F085FE062307 +:10590000050519041B231522D21E93B2CA88002A4A +:1059100002D08E68002E03D09A4203D90C20CBE728 +:105920001020C9E7042D05D08A88002A0AD101E099 +:105930000620C1E7012D11D0022D05D0042D18D06D +:10594000052D23D00720B7E709236A4613704B883B +:105950009381CB88D381896804911DE00C236A462A +:1059600013704B889381CB88D38189680824049174 +:1059700012E00D236A4613704B8893818B88D38184 +:10598000CB88138289680924059105E00E236A46B5 +:105990001370497811730A2400232146FFF757FC3E +:1059A0008AE700B587B00F236A4613709181002300 +:1059B0001946FFF74CFC5AE7FEB50078089D1C46D7 +:1059C00016460F46012803D03549912010F02BFDD3 +:1059D000F889C0000E30208030202880387B001FDE +:1059E000C0B20190002E1DD0F889B081002516E0CC +:1059F000E8008419C0190090224641690E320198CE +:105A0000FDF755F9002802D000202074E0810098AD +:105A10006D1C008A60820098ADB2408AA082B08975 +:105A2000A842E5D8FEBD70B514461425049A1D8021 +:105A300037231380002C0ED0CA89A28100226282F3 +:105A40000078082808D0092810D00A2819D014494D +:105A5000144810F0E8FC70BD087B0C2804D01148F5 +:105A60000F490C3810F0DFFC012008E0087B0D28FE +:105A700004D00C480A49083810F0D5FC0420A07363 +:105A800070BD087B0E2804D006480549001F10F0A1 +:105A9000CAFC0520F3E70000FFFF00000228000019 +:105AA00070530000BB02000010B5FE4B5860197225 +:105AB0001A80C90010F098FB10BD002101807047CA +:105AC00010B50022D2430280032007F0F8FC10BD7D +:105AD0007047F0B50E460446017801208840F2492F +:105AE00099B008400090616815460888EF4A9042D6 +:105AF00006D0009A002A06D0EB4A521E104202D06D +:105B0000012019B0F0BD009A10430880002D12D07A +:105B1000002028702178EA1C0027681C01920B00E5 +:105B200010F072FD10F30E16233A59616F3CB4B0B9 +:105B30008AB8F2F1F0F320780B28EBD00420E0E7EC +:105B400002212970A1890170090A4170032097E0A0 +:105B500004212970A1890170090A41700198E18925 +:105B60000170090A417005208AE006212970A18987 +:105B70000170090A41700199E2890A70120A4A709B +:105B8000218A0171090A4171A28AE81DA16910F0F8 +:105B9000CCFAA08AC01D73E0082129702178082959 +:105BA00001D110212970A1890170090A4170019861 +:105BB000E1890170090A41700520308020466A1D84 +:105BC00002A91030FDF799F800287DD16946308888 +:105BD000097A401854E00A212970A1890170090A44 +:105BE000417003200BE00C212970A1890170090A82 +:105BF00041700198E1890170090A417005203080E7 +:105C00009CE0A08984464000401C81B230888842D4 +:105C10005AD3052958D30E202870002008E02369A4 +:105C200042009B5A521953701B0A401C937080B259 +:105C30006045F4D33180B9E09A48417A002973D0A5 +:105C4000491E4172217B4068C9004518A98828680F +:105C5000082240180838216910F067FA02216846C6 +:105C600001710021417128680390A988684601816B +:105C7000002101A8FFF78CFB0020A880002E00D097 +:105C8000308093E0297880221143297029784022BE +:105C90001143297029788909890112312970A18954 +:105CA0000170090A4170E289E81C216910F03DFA8F +:105CB000E089C01C3080287841063FD5C00975D0E6 +:105CC00001216846017200E02CE000214172318818 +:105CD000091D81810495E189019808180590001D2E +:105CE00006907048017A68460177002102A8FFF704 +:105CF0004FFB074630880C303080022F06D0002F33 +:105D000054D065E03DE033E01CE05EE06548694664 +:105D1000097F4268CB00D218037A994202D2918857 +:105D2000002902D0042753E02FE0417A491C417238 +:105D30001560308890800020308049E06168A0893B +:105D4000888033E029788909890116312970A18971 +:105D50000170090A41700198E1890170090A4170D6 +:105D6000228A681D616910F0E0F9208A401D46E72B +:105D700028788009800118302870207B6870022004 +:105D80007EE760680188090401D4052720E0C08807 +:105D9000A189884201D006271AE01E202870012020 +:105DA0003080606801884904490C0180009800280F +:105DB0000ED03C4800220088A1688300032007F031 +:105DC000D9FA61682078887007E0002030800327C6 +:105DD0006068009902888A430280384691E6FFB5E0 +:105DE0009FB0289D0E46002805D0172803D82A8882 +:105DF0002E4B9A4202D1072023B0F0BD32785306D1 +:105E000001D4D20901D00820F6E700226B461A71AE +:105E10005A7114463278431E1D939BB2189303ABFC +:105E20001A939706CB1CBF0E1B93821E711C3B005E +:105E300010F0EAFB209011EE66EE74EEB0EED4EEB8 +:105E4000EDEEECEEEBEEEAEEE9EEEEEEE8EEE7EE8E +:105E5000E6EEE5EE90EE05287CD10421684601715E +:105E6000A9780172F078B278010211436846418145 +:105E70003179417170788006800E0C282ED009DCB3 +:105E8000801E030010F0C0FB0919661C6621662401 +:105E90006627660012282AD00ADC0E2821D0102896 +:105EA000DAD121E00C090020FF710000FFFF0000A3 +:105EB00016281FD01828CFD11FE02878800701E0CE +:105EC00028784007002845DA45E128780007F9E7F7 +:105ED0002878C006F6E728788006F3E72878400699 +:105EE000F0E728780006EDE72888C005EAE728886B +:105EF000C004E7E728888004E4E728884004E1E755 +:105F00002A78920726D50328A6D105206A46107163 +:105F1000487809780002084310811CE12978490774 +:105F2000F0D5062816D3717890B2012902D0022943 +:105F300092D101E0022100E01021189106216A4669 +:105F400011710021118102AF189AB11C0237921C05 +:105F50001B921AE0B3E04A780B7812021A433A8097 +:105F6000801E891C1790BA1C1A911898FCF79FFE86 +:105F70001A991898189A091817986B46801A1A894E +:105F800080B2521C1A811B9ABF1D8242E3D900289D +:105F900086D1E0E028780007B4D51D98694682B222 +:105FA0000720087100200881701C0A3111E0437835 +:105FB00007781B023B430B80C37887781B023B4367 +:105FC0004B806F463B89121F5B1C001D92B23B81C8 +:105FD000091D042AEBD2002A71D1BCE02978C90638 +:105FE0006DD502286BD308206946087100204881CE +:105FF00070780872844692B2B01C1A9919E089E050 +:1060000090E07EE067E05BE030E025E019E013E03F +:10601000BCE0437807781B023B430B80831C4B603A +:106020006346D21A6F467B8960445B1C92B27B81C7 +:1060300008319445EDD9CEE7287880063FD509226E +:1060400003E0287840063AD50A2268460271AA88F9 +:106050000281189A428107E0287800062FD50B208C +:106060006A46107118981081039174E02988C90557 +:1060700025D5022823D30C206946087100204881C9 +:1060800070780872844692B2B01C1A9914E0437872 +:1060900007781B023B430B80C37887781B023B4386 +:1060A0004B80031D4B606346D21A6F467B89604468 +:1060B0005B1C92B27B8108319445E8D98BE763E0A1 +:1060C0002988C90460D501285ED10D216846017177 +:1060D000A98801813FE02988890455D5052853D333 +:1060E0000E2269460A71AA880A811B99401F4A78C4 +:1060F000097812020A4369464A818881701D04901A +:1061000029E0298849043FD501283DD10F2069465F +:10611000087120E02A88120436D44A780B781202DB +:106120001A43EA8003282FD332789206920E1B2A54 +:1061300026D011226B461A712A880123DB031A43E9 +:106140002A804A78097812020A4369460A81C01EE9 +:1061500048811B98039030788006800E1B2809D058 +:106160001D2807D00320229907F0A9F92888C00B21 +:10617000C003288001A82199FFF70AF920463BE6D1 +:1061800010226B461A71DCE70724F7E70824F5E7CD +:1061900000B597B0032806D16A461070019100211E +:1061A0006846FFF7F5F817B000BD000010B58B7812 +:1061B000002B11D082789A4207D10B88002B0BD08C +:1061C00003E08B79091D002B08D08B789A42F8D117 +:1061D00003880C88A342F4D1002010BD812010BD9B +:1061E000052826D0002A02D0012A0DD102E0098814 +:1061F000090501E009888904890F07D0012918D011 +:10620000022909D003290ED081207047002A01D02D +:10621000032070470220704703280AD0042808D0C2 +:10622000002804D007E0042803D0022803D005206A +:106230007047002070470F20704770B513880546DF +:1062400014460B8018061DD5FE481022807AA842FD +:1062500003D813430B80002070BDA06893430078DF +:10626000E840C007C00E03430B802078A178800768 +:10627000800D0843F4490FF0D2FFA0686943081865 +:10628000401C70BD906870BD37B569468B8813801F +:1062900019061BD5EB4C0125A47A9168844209D8D4 +:1062A000FE280FD1D80602D5A5406D1E00E00025BE +:1062B0000D7007E085400C78DB06DB0FAC438340B4 +:1062C0001C430C7010881021884310803EBDF8B527 +:1062D0000746C81C80080E468000B04201D08620C8 +:1062E000F8BD082A01D90E20F8BDD64D00202E6039 +:1062F000AF802881AA723446E88016E0E988491CFC +:10630000E980810610D48007A178800D0843CE492A +:106310000FF085FF206800F0BAFA2989401880B292 +:106320002881381A8019A0600C3420884107E5D4F0 +:106330000020F8BDFFB589B09F041646139DBF0C21 +:106340000193099800F095FA04000AD0207800061D +:1063500009D5BC48817A0A98814204D887200DB0BB +:10636000F0BD0120FBE7224669460A98FFF765FF6A +:106370000690002069460872052D14D0012221469E +:106380002846FFF72DFF0028E9D1207840060AD5DE +:10639000022168460172099981810188C1810682C2 +:1063A0004782129805900198000404D500273E46C4 +:1063B0000125079709E02078A1788007800D084320 +:1063C000A14907900FF02BFF0D46019840040AD514 +:1063D0000798A84207D12088E1788005800F000245 +:1063E0000843B04201D3AE4201D90720B7E7B8193C +:1063F00080B20190A84201D90D20B0E76846007A2A +:10640000002804D002A8FDF706F90028A7D10798B4 +:10641000A8420BD1208803210902884301998905EC +:10642000890F0902084320800198E0701498002821 +:1064300000D007801298002815D006983A46801997 +:1064400012990FF072FE224669460A98FFF7F5FE90 +:1064500069460888102188436946088022460099C9 +:106460000A98FFF711FF002079E7FFB5754D0C2260 +:10647000E8882968504383B00C180D9F724905982D +:106480000FF0CDFE0091049800F001FA29682A89E6 +:106490008E46611A0C310918944651188AB2A9889F +:1064A000914202D8842007B0F0BD6A46168A3206AF +:1064B00003D5B20601D58520F5E7EA88521C92B2D1 +:1064C000EA800E9B002B00D01A80B20601D5A7608F +:1064D00006E0604480B22881091A70460818A0605E +:1064E0002246FE200499FFF7CFFE0598A070009881 +:1064F000E07020880599800889058000890F08438D +:1065000003210902884300998905890F090208437C +:1065100004210843208003988078A07103980088A4 +:10652000A08000202073310601D5AC7A00E0012460 +:10653000B10600D5002700260EE0052100200191BC +:1065400002900097E88831460C9B069AFFF7F2FE0E +:106550000028A8D1761CF6B2A642EED30020A2E70E +:10656000F1B5009800F085F9060002D00025009CE6 +:1065700014E00120F8BD204600F07BF907460078C2 +:1065800031498007820DB87810430FF048FE386813 +:1065900000F07DF94019641C85B2A4B22948C18875 +:1065A000601E8142E7DC00992648491EC1800189AE +:1065B000491B018100203070F8BD002804D0401E26 +:1065C00010809170002070470120704710B504467C +:1065D00001881C48C288914201D3822010BD006806 +:1065E0000C22514342189079A07290882081108823 +:1065F000D1788005800F00020843A081A078211D7A +:10660000FFF71BFE20612088401C2080E0800020D6 +:1066100010BD012101827047F7B50546002084B006 +:10662000C043108068681746817868468170686842 +:1066300001886846018000218171288A2C88A04247 +:1066400005D303E0180900200102000004462C8253 +:1066500035E0288A401C2882301D6968FFF7A6FDB6 +:1066600000282AD139889248814201D1601E3880A1 +:106670006888A04228D33088F1788005800F000216 +:10668000084302906946301DFFF790FD002814D1A1 +:106690006989874881421BD0002231460598FFF75F +:1066A0009FFD002809D16A890298824205D1E968D4 +:1066B000B0680FF00DFD00280AD0641CA4B220467B +:1066C00000F0D7F80600C4D1641E2C828220EAE6CE +:1066D0007C80B079B871B088B8803078B1788007A4 +:1066E000800D084378810298B8813946287A32466D +:1066F0000831FFF7A2FD38610020D4E6FFB585B070 +:106700001C460F46059800F0B4F8050009D028781B +:10671000000608D56748807AB84204D8872009B0B7 +:10672000F0BD0120FBE707982A468605B60D6946AD +:106730003846FFF782FD07460E98052816D000223E +:106740002946FFF74DFD0028E9D1287840060DD5F0 +:106750000121684601710599018101884181868185 +:10676000C48101A8FCF757FF0028D8D12888AA784F +:106770008107890D11438005800FEA7800021043DC +:10678000079A964207D04C4A914204D3611E814237 +:1067900001DD0B20C3E7864201D90720BFE7801B3C +:1067A00082B2A24200D922461098002800D002806E +:1067B0000F98002802D0B9190FF0B7FC0020AEE7FF +:1067C000F8B51D4617460E4600F053F8040008D0F1 +:1067D0002078000607D53748807AB04203D8872052 +:1067E000F8BD0120F8BD224639463046FFF725FDA9 +:1067F000002D0BD02078A1788007800D08432E490A +:10680000884201D2012000E0002028700020F8BD5D +:10681000F8B51E4617460D4600F02BF8040008D0C8 +:106820002078000607D52348807AA84203D887201D +:10683000F8BD0120F8BD224639462846FFF724FD61 +:10684000FF2E14D02588A178A807800D08431A4987 +:106850000FF0E5FC002E03D1FF31FF31033189B287 +:10686000A170A80880008905890F084320800020B6 +:10687000F8BD1049CA88824207D3002805D00C22EF +:10688000096850430C38081870470020704703B55A +:106890000846694609888A0607D4090604D50549C9 +:1068A000897A4143491C88B20CBD00200CBD000010 +:1068B000FFFF00001809002001020000F8B507786A +:1068C0000D460446012F19D0072F02D00C2F19D1E5 +:1068D00014E0A068216906780B2E0BD0052006F085 +:1068E000EEFD052E0ED0782300220520216906F04A +:1068F00041FD07E0782300220620F8E70520216902 +:1069000006F0DDFD002D0ED000202870294620461F +:1069100004F0AEF9FE482978C05D884201D1032019 +:10692000F8BD0220F8BD0021204604F0A1F90020A6 +:10693000F8BD70B50E460C462036317901208AB07C +:106940001546002909D0012905D12978042902D149 +:106950000520107000200AB070BD6068019005A885 +:1069600002900D21C01C0FF03DFC032205A8A16878 +:106970000FF0DBFB01203071062069460870206AA9 +:10698000049029466846FFF799FFE4E770B50C4686 +:10699000154620310A790120062686B0002A2CD01F +:1069A000012A28D12978042925D169681022A068F4 +:1069B00001F0B4F96868C07B000606D5D44AA06827 +:1069C0001023103A014601F09EF91022A168E068F8 +:1069D00001F0A4F9A068C07B000606D5CC4AE068A7 +:1069E0001023103A014601F08EF92E70A0686860FD +:1069F000E068A860002006B070BD60680190C448DF +:106A0000203802900120087168460670206A0490C0 +:106A100029466846FFF752FFEDE7027B032A06D0BE +:106A2000002224235A540B78092B02D003E00420BF +:106A300070470A76CA61027B9300521C0273C150F0 +:106A400003207047F0B50E4615460C462036024628 +:106A500031790120072393B000290CD0012924D0DB +:106A600002292ED0032904D12978042901D12B70C1 +:106A7000002013B0F0BD01203071606800280DD0F7 +:106A8000A1690B7060684860206988606069C860AF +:106A9000206A08621046FFF7C0FFEAE70620287068 +:106AA000206968606069A86009E029780629E0D15A +:106AB0000220307104202870954820386860032037 +:106AC000D7E729780429D4D1A08910280AD9103809 +:106AD00080B2A081A1681023091805A86A6801F096 +:106AE00012F923E010282FD0C2B21020801AA1681A +:106AF0000DAF1190C0190FF018FB11980006000E91 +:106B000006D0401EC1B28020785438460FF06AFB90 +:106B1000626910230DA909A801F0F5F8102309A94D +:106B200005A86A6801F0EFF80320307160680190F1 +:106B300005A80290062069460870206A049029463C +:106B40006846FFF7BBFE94E710232269A168E2E7DD +:106B5000F0B50E460C4620363179012006278FB05D +:106B6000154600290BD0012932D0022905D12978F8 +:106B7000042902D10820107000200FB0F0BD217D43 +:106B800008A8CA07D20F02718807C10F08A80171AF +:106B90006846027041700722801CE1680FF0C5FA58 +:106BA00002A80722013021690FF0BFFA6068059042 +:106BB0000AA8069010236A46A16801F0A4F80120F3 +:106BC000307168460774206A0890294604A820E0BE +:106BD00029780429D1D1062205A8E1690FF0A5FA88 +:106BE00006A806220230A1690FF09FFA0020089043 +:106BF0006068019009A80290102305AA696801F055 +:106C000082F80220307168460770206A0490294695 +:106C10006846FFF753FEB0E770B50D460C462035C9 +:106C2000297901208CB01646002909D0012905D107 +:106C30003178042902D10920107000200CB070BDF9 +:106C40006068019006A802900822E1680FF06DFAD2 +:106C5000082208A8A1680FF068FA01202871062010 +:106C600069460870206A049031466846FFF726FEA0 +:106C7000E4E770B50D460C462035297901208CB02B +:106C80001646002908D00129D8D131780429D5D158 +:106C90000A2010700020D1E76068019006A80290D9 +:106CA0000822A1680FF041FA002008900990012005 +:106CB0002871062069460870206A049031466846AB +:106CC000FFF7FCFDBAE730B50B4620331C790120F5 +:106CD0008BB0002C09D0012C05D11178042902D1E8 +:106CE0000B20107000200BB030BD4868019005A843 +:106CF00002908C6868462578057564784475CC6880 +:106D0000257885756478C47500200690079001E0A9 +:106D10002867010008900120187106236846037057 +:106D2000086A049011466846FFF7C8FDDBE770B5B6 +:106D30000C462034034625790120002D0AD0012D70 +:106D400014D0022D05D111780A2902D10C2010701F +:106D5000002070BD01202071C868052202704A68B9 +:106D60004260F84A8260921CC2600BE015780B2DDD +:106D7000EFD102202071C868042404705268426078 +:106D80008A688260096A016201461846FFF745FE7B +:106D900070BD30B5011D02463132947803258379E8 +:106DA000ED432C4323408371DB070DD04B7954799D +:106DB00023404B710B79127913400B718278C9789B +:106DC0008A4200D9817030BD00224A710A71F5E70C +:106DD000F7B50C4686B00020694626460870203676 +:106DE000317901271E2015461F2977D24B007B449D +:106DF0009B885B009F441E0017023E0256026902F8 +:106E000088029A02D102F5022E03590371037F030F +:106E1000AE03C303CC03F7031A0464049A04AB045F +:106E2000DF04FE0410052A0565059B05C6058305DC +:106E300087058B056069002802D0007813287DD073 +:106E4000A0680590002849D0012168460170206A99 +:106E500004900321684601710A214171E0690290A2 +:106E600020790028EFD0059909780029E7D00C296E +:106E700064D20B000FF0C8FB0CFD1A4B90B5E8FC78 +:106E8000FBFAF9F807FD022828D16069002802D032 +:106E90000078082852D1022168460170206A0490C7 +:106EA00005984178684601710021B9E20620216AFF +:106EB00006F005FB20790728E6D1606900F050FF55 +:106EC00002280CD0606900F04BFF042807D06069ED +:106ED0000028B8D000780128D6D103E01BE2616910 +:106EE0000120087005980079C11F0A2901D30A20E2 +:106EF00050E06169072288706069059930300FF0B1 +:106F000014F90120307161690320087034E007280A +:106F1000BAD16069002896D001780929B4D10599C1 +:106F2000C978890707D1059949790029DFD10599E1 +:106F300089790029DBD105994A7900E04EE20146C2 +:106F400020314B7D9A43D2D1059A8B7D92799A4319 +:106F5000CDD1059A1279D31F0A2BC8D20979914253 +:106F600036D80722C01C05990FF0DFF801203071D8 +:106F700061690A200870032069460870206A04903D +:106F80006069313001906069001D029060691C30B9 +:106F90000390A1E22076F2E311288DD1606900F020 +:106FA000DFFE042804D0606900F0DAFE0B2893D1DC +:106FB0006069059910223730491C0FF0B6F86069F6 +:106FC000017804297CD12421095C8278914201D97D +:106FD0000620DFE70521017003203071684601704B +:106FE000E2E3112894D1606900F0BAFE062804D0CB +:106FF000606900F0B5FE0C288AD1E068002813D043 +:107000002069002810D060690178062910D00D2170 +:1070100001706069059910225730491C0FF085F8FE +:107020006069573009218CE100206946087072E1DF +:10703000072101706069059910224730491C0FF043 +:1070400074F860694730EDE70228F0D1606900F01C +:1070500087FE0028EBD0606900F082FE0128E6D0B0 +:10706000606900F07DFE05E0B1E08DE06CE02AE0B3 +:107070000AE0D6E00828DAD00521684601710598B3 +:1070800041786846417146E11128D0D160690028F5 +:10709000CDD001780E29CAD1C16A4078022810D01B +:1070A0000020142250431430085805991022491C1E +:1070B0000FF03BF80520216A00F040FE0F205EE053 +:1070C000F1E10120EDE70B28B1D160690028AED0D5 +:1070D00001780F29ABD1C16A4078022826D0002060 +:1070E000142250430C300958059842780A70807871 +:1070F00048706069C16A4078022819D000201422C3 +:1071000050431030085805990822C91C0FF00DF89B +:107110000520216A00F012FE60694178022909D039 +:1071200000220832825C5208520073E00120D7E747 +:107130000120E4E70122F4E7012100E00021083109 +:107140004254BCE30267010011289CD16069002809 +:1071500099D00178102996D1C16A4078022811D0BF +:107160000020142250431830085805991022491C59 +:107170000EF0DBFF0520216A00F0E0FD11206169BF +:107180000870B4E30120ECE7082884D16069002886 +:107190009DD00178112997D10599C06A497801706D +:1071A00060690599C06A0622401C891C0EF0BDFF6B +:1071B0000520216A00F0C2FD60694178022904D0EF +:1071C00000220832825CFD2323E00122F9E7112826 +:1071D000BBD160690028BBD001781229B5D1C16A42 +:1071E0004078022819D00020142250431C3008583F +:1071F00005991022491C0EF098FF0520216A00F025 +:107200009DFD60694178022909D000220832825C24 +:10721000FB231A40022991D18EE70120E4E70122E5 +:10722000F4E70720B6E6287801288ED160696968FE +:1072300014221C30F9F7C8FF6069017F002901D0D2 +:107240002176ACE30178032901D0032037E002273F +:10725000C77081794907490F8171017A4907490F40 +:107260000172417A4907490F41726069FFF791FD48 +:10727000377196E228780F28E3D107206946087015 +:10728000216A049191680291694608716169072237 +:10729000C91C02980EF049FF6169042008700020A3 +:1072A0003071BBE028780328CBD1606901780529CB +:1072B000696807D0082247300EF037FF042030718C +:1072C00005206FE208225730F6E728780328B8D166 +:1072D000606901780529696811D008224F300EF0E5 +:1072E00024FF052030716069006A00280AD002205E +:1072F0002870002028716069006AA860F9E00822FF +:107300005F30ECE704204DE22878022899D12879F3 +:10731000002801D0207642E36069A96801626069B3 +:10732000002901D1F949016206200BE228780F28D3 +:1073300087D1A868E0616069017805292BD04730C2 +:1073400007213171E16802220A706269126A4A609B +:10735000886060693030C8606069C01C086162691B +:10736000087D926A400812784000D207D20F10437D +:1073700008756269926A521C8A61FD221040626936 +:10738000D26A1278D207920F104308756069C06AFA +:10739000401CC86153E25730D2E728780828BAD198 +:1073A0006069017805291AD00B2101700720694610 +:1073B0000870206A0490E069029011200871029818 +:1073C0000321017051681022401C0EF0AEFE002116 +:1073D0006846FFF773FA00203071E06187E206210A +:1073E000E3E728780F2896D1072069460870206ABD +:1073F0000490A8680290112008710298042101707D +:1074000061690A78072A0ED0002232710C220A70B4 +:1074100061691022401C47310EF087FE002168464A +:10742000FFF74CFA63E21022401C57310EF07DFE4C +:1074300000216846FFF742FA0A203071E168032014 +:1074400008706069006A48606069573088606069E8 +:107450004730F3E128780828A1D1606969681022D3 +:1074600037300EF035FE002801D0042092E5606927 +:107470000078072817D00A203071E16803200870CF +:107480006069006A486060695730886060694730A9 +:10749000C860206A08620698FFF7BFFA074660696D +:1074A000FFF777FC6BE208207AE1287809289AD167 +:1074B0000B20307161696868897810224018511A70 +:1074C0000EF090FE082069460870206A04906868F3 +:1074D000019060698078087268E129780D29BBD134 +:1074E00061698979C90703D00C20307109203EE019 +:1074F0003071032770E228780E28ADD1606914221C +:10750000291D1C30F9F760FE6069018DC06A417267 +:10751000090A817260698178C06AC1716169CA6A49 +:10752000081D117AC909C9011172437962691943A9 +:107530008378D26A9B079B0F012B00D00023007930 +:107540009B01C00003431943117260694078012810 +:1075500076D0B4E160694178022901D0012100E0D0 +:1075600000210831405CC00707D00E20EAE06946E0 +:107570000870206A1146049019E11320B8E72878B2 +:107580000F2894D1A868E0610F2030710520EEE744 +:10759000287803288BD16069C16A4078022801D01D +:1075A000012000E000201422504310300858082227 +:1075B00069680EF0BAFD10203071E168062022697A +:1075C00008706069406A48606069C36A4078022850 +:1075D00001D0012000E00020142778431030185813 +:1075E000CA6088602BE128780C2886D16069C26A5D +:1075F0004078022801D0012000E0002014214843F7 +:107600000C30105802230932696800F07CFB11200D +:107610003071E168052008706069006A486060693F +:10762000C06A093088603948001F07E128780B28B4 +:10763000A7D161694878CA6A022802D0012001E016 +:1076400059E1002014235843143010588A7869688F +:107650000EF06BFD60694178C26A022901D00121F8 +:1076600000E00021142359431431525881785018F6 +:107670001022511A0EF0B6FD072069460870206AE4 +:107680000490E069029011200871029806210170AF +:107690006169CA6A4978022901D0012100E000210C +:1076A00014235943143151581022401C0EF03DFD53 +:1076B00000216846FFF702F90020E06112206FE028 +:1076C00028780F2891D1072168460170206A04901C +:1076D000906802900B2268460271029801706169FD +:1076E000CA6A4978022901D0012100E0002114234F +:1076F00059430C3151580A78427049788170616958 +:10770000CA6A4978022903D0012102E00867010012 +:10771000002114235943103151580822C01C0EF087 +:1077200004FD00216846FFF7C9F826E76069417843 +:10773000022901D0012100E000210831405C8007CE +:1077400003D5142030710A2011E71620D0E62878DE +:107750000F287AD1A868E061072069460870206A7E +:107760000490E069029011200871029808210170CC +:107770006169CA6A4978022902D0012101E011E158 +:10778000002114235943183151581022401C0EF087 +:10779000CCFC00216846FFF791F80020E06115203D +:1077A00030710A2069460870206A049029466846AC +:1077B000FFF784F82BE028780F2846D10720694688 +:1077C0000870206A0490906802900820087102985E +:1077D0000921017061690622C969097841706169EE +:1077E000801CC969491C0EF0A0FC00216846FFF707 +:1077F00065F8AAE760694178022901D0012200E01A +:1078000000220832805C400703D51720C8E70746EE +:10781000B5E0012953D070E028780F2815D1A86869 +:10782000E06118203071E168052008706069006A25 +:1078300048606069C06A09308860F848C860206A9A +:1078400008620698FFF7E9F8E1E76FE028780B286F +:107850006CD16069C16A4078022801D0012000E043 +:107860000020142250431C300858102269680EF082 +:107870005CFC072069460870206A0490E069029069 +:107880001120087102980A2101706169CA6A497859 +:10789000022901D0012100E00021142359431C31A9 +:1078A00051581022401C0EF040FC00216846FFF7A2 +:1078B00005F80020E0616069407801281DD1192099 +:1078C00016E660694278022A09D000210831411881 +:1078D000097800290DD0CA0703D00E2106E0012146 +:1078E000F4E7890701D5102100E01221017000277B +:1078F00072E0012A01D00D20FAE51C20F8E51D20D8 +:1079000030710B2033E62978102948D1F0E5606901 +:107910000178012943D0082941D00021317100F0BC +:1079200019FA0C2069460870206A049037E028781C +:107930000F2805D01020107003271B2030714BE05A +:10794000072168460170206A0490A868029002210D +:1079500068460171029805210170217E4170002165 +:107960006846FEF7ABFF0B2168460170206A049061 +:1079700029466846FEF7A2FF07461B203071012FFB +:107980000DD029E0012168460170206A049004218D +:1079900068460171217E41710020207612E0207E30 +:1079A00000280FD06169132008701A2030710A2056 +:1079B00069460870206A049029466846FEF77EFFF3 +:1079C000074609E06069002801D01421017068466B +:1079D0000078002800D021E5384609B0F0BDF7B5A1 +:1079E0000F4620373879012686B00C46002804D08F +:1079F000012828D002281CD197E02079012804D042 +:107A0000022811D0032814D10AE0A0684078012888 +:107A10000ED10620216A05F02CFD00287FD10CE054 +:107A2000A1681320087008E0A0684178022901D0FD +:107A3000052674E00078082871D1012038710A20E9 +:107A40006946087033E0089800780F2867D107214D +:107A500068460170206A049008988568029522792A +:107A60000220012A04D0022A29D0032A57D10FE08C +:107A70000646684606710B202870207B00214007CF +:107A8000400F68706846FEF719FFA068067045E071 +:107A900006466846067105202870207B6870002124 +:107AA0006846FEF70BFF3E710B2168460170206AA5 +:107AB000049068460899FEF701FF06462FE06846E5 +:107AC000017101202870207C6870607CC007C00FA5 +:107AD000A870A07C4007400FE870E17C2971C007C6 +:107AE0001FD0207D4007400F6871607D4007400F28 +:107AF000A87100216846FEF7E1FEA068072229462A +:107B000030300EF012FBE068017AA068203001717D +:107B1000A16828798870A16809200870002630467D +:107B20005BE70020A8716871E3E7A1681420087082 +:107B3000012168460170206A0490042168460171A1 +:107B4000217B41710021FEF7B9FEE7E7F0B585B072 +:107B50000F4605460124287B800040198038C66FF7 +:107B60003078411E0A290AD22C498000323140184F +:107B70008038C36F3A463146284698470446002C61 +:107B800001D0012C11D1287B401E0006000E287365 +:107B900001D00324DFE70D2069460870306A0490A5 +:107BA000002101966846FEF789FE032CD3D02046BB +:107BB00005B0F0BD70B515460A4604462946104684 +:107BC000FFF7C4FF0646002C0FD0207814280CD1F4 +:107BD000207E002806D000202870204629460C3040 +:107BE000FFF7B4FF204600F0B5F8304670BD70478F +:107BF00010B5012903D0022901D0052010BD417024 +:107C000000F0A8F8002010BD002809D0027E002A4C +:107C100006D00A4601460C31CCE700000667010099 +:107C20000120704730B5044687B00D46062005F0A8 +:107C300046FC2946052005F042FC2078142805D092 +:107C40000020694608702046FFF7DEFF07B030BD10 +:107C50007FB50E4600216A4611730178092903D0C9 +:107C60000A2903D0002407E0446900E08468002C5E +:107C700002D0217E002912D0154601462846FEF783 +:107C8000CCFE032809D1324629462046FFF792FF51 +:107C90006946097B002900D0042004B070BD254648 +:107CA0000C35EAE700B50023012285B005280CD089 +:107CB000062808D1684602700491022101714371BF +:107CC0000021FEF7FBFD05B000BD6846027004917F +:107CD0000271F4E710B590B00C4605216A461170A8 +:107CE000019022480290001D03900AA96846FFF700 +:107CF000AFFF002805D1102220460B990EF015FA8F +:107D0000002010B010BD30B505E05B1EDBB2CC5CCE +:107D1000D55C6C40C454002BF7D130BD10B50024A5 +:107D200009E00B78521E5B00234303700B78401C64 +:107D3000DC09D2B2491C002AF3D110BD70B50C4643 +:107D4000054605F0BCFB782300222146284605F0B5 +:107D500011FB70BD4178012900D0082101707047E6 +:107D6000002801D0007870470820704700670100A4 +:107D700038B50446002069460870204609F053FDD6 +:107D8000002803D1FBA1A3200EF04DFB204609F0F3 +:107D900099FC002803D1F7A1A8200EF044FB684607 +:107DA000007838BD70B5F84D002428462C77203077 +:107DB0008471C47101F09AF928464038047020306B +:107DC0008473847484772C75AC7170BD10B50C46C7 +:107DD000EE4982888A8042884A8000780870084686 +:107DE0000E38847009F050FC08F0FDFFFFF7DAFF51 +:107DF00020460BF013F8E449A8310846813809F011 +:107E0000ADFEE2480CF021FBE0480A3808F0FEFF26 +:107E1000002803D0D7A1C5200EF005FB01F066F9BC +:107E200010BD7CB50E461D46144601A909F008F8A0 +:107E3000002807D10AF091FB022803D1D248007D27 +:107E4000002801D001207CBD01988030807C09F0A1 +:107E50004DFC00280CD0684609F052FC0028F2D0F6 +:107E6000002C03D009F011FCA04206D200207CBDFA +:107E7000C0A1C7480EF0D7FAF8E7009809F0D8F883 +:107E80003146009809F0DBF8E2B22946009809F083 +:107E9000F0F909F045FC002804D1BD48B5A11E3019 +:107EA0000EF0C1FAB94C00250E3C6068A030417953 +:107EB000002902D045710BF0D8F860688030458306 +:107EC000C0E730B40179002904D0012907D030BCC3 +:107ED00000207047831D42880488022103E0428805 +:107EE0000488831D0121204630BC9AE7F8B51D4661 +:107EF00014460E4607460AF030FB022803D0A2487B +:107F0000007D002823D0A1480E3841684988398077 +:107F100040688030807C09F069FD002804D153203E +:107F200094A1C0000EF07FFA684609F069FD0028B0 +:107F30000DD0009809F0BAF83070022808D0012856 +:107F400006D093488BA167300EF06DFA0020F8BD83 +:107F50002946009809F0A4F92080002804D1552072 +:107F600084A1C0000EF05FFA09F05DFD002804D185 +:107F7000874880A160300EF056FA0120F8BD38B570 +:107F80000446831D821C6946FFF7B0FF00280DD010 +:107F90000020607168460078012808D0022806D0C9 +:107FA000FF2074A101300EF03EFA012038BD20718F +:107FB000FBE7F8B50AF0D1FA744D734C0E3D022878 +:107FC00002D0207D00287DD0207F0026102818D1E7 +:107FD000A079002803D067A16E480EF024FA6868E3 +:107FE00001464030827F92070BD526724988618115 +:107FF000C17F2173018CE181408C20820120A0711E +:108000002677614F203FB87C00285ED168686946BA +:108010008030807C09F007FC002805D0694668782C +:1080200009784018687004E05A4852A119300EF0DF +:10803000FAF9207D00283AD06868418852484038D3 +:10804000806D4088814204D00F204AA1C0010EF00B +:10805000EAF968688030807C09F0C8FC002804D107 +:108060004C4844A124300EF0DEF909F0EEFC002863 +:108070001DD068688030807CFFF77AFE69784018F0 +:10808000687041484038806D4030417A01290DD1F7 +:108090002670696849886180807A20710120B877EC +:1080A000207F102801D0282800D1267726756978EE +:1080B00000290AD06868428833484038C286018760 +:1080C000012000E001E0B8746E700AF029FA00287F +:1080D00005D1207D002802D0A878FAF7F9F8F8BD7C +:1080E000F8B50446FFF765FF274D0026203DA87E22 +:1080F000002808D0667010202070E87EA070287FCD +:10810000E070AE769AE0204F403F3878002808D0E3 +:108110002C22B91C20460EF008F80E2020703E706C +:108120008CE0A87B184F002815D0387F102808D085 +:10813000282806D0002804D0FF200EA1C2300EF05F +:1081400072F90120E070E87BA070287C60700F203D +:108150002070AE7372E00121204609F099FC0028DE +:108160001AD0387D002857D10021204609F090FC14 +:10817000F8BD00007372635C6C6C5F6374726C2E8C +:1081800073302E630000000094090020720000206C +:108190004F02000062070000A97CF8480090F848F0 +:1081A000002910D0017805290DD2491C0170667094 +:1081B0000D202070012028750622A01C00990DF0CA +:1081C000B4FFAE743AE0EE480670B879002812D0D9 +:1081D000387F002804D00120EA4940020EF023F93C +:1081E00066700120E54920700A221431A01C0DF0B0 +:1081F0009CFFBE7122E020460CF083F800281DD1C0 +:10820000A87C002802D0DE480178CEE7A87F0028AD +:1082100002D0387D002801D00020A9E7387F00284F +:1082200003D0D849D8480EF0FEF866700A202070B6 +:1082300006223946A01C0DF078FFAE77012097E7A3 +:108240004EE710B5CD4C343C2178002904D01321E1 +:108250000E2000F052FF10BDC9490088091D08F02A +:10826000EFFD002801D0022007E0C5484068014624 +:1082700020318A79012A02D00C20207105E00022E9 +:108280002271097E21724088E080012060711321F3 +:10829000E1700E21A170207010BDB84810B53438BF +:1082A0000178002904D024210E2000F026FF10BD03 +:1082B000012101702422C2700C220271417110BD93 +:1082C00070B5AE4C0546343C2078002804D03E21E1 +:1082D0000E2000F012FF70BD0AF03FF9002808D10F +:1082E0000AF03EF9002804D1A4480C30007F002891 +:1082F00001D00C2003E0287809F033FD0020207124 +:10830000012060713E21E170207070BD9B4810B566 +:1083100034380178002904D03C210E2000F0EDFE15 +:1083200010BD00210171012141713C22C270017018 +:1083300010BDF8B5914C343C2078002804D03B2186 +:108340000E2000F0DAFE13E70020A0710AF005F914 +:108350008A4E01250C36022802D0307D002840D0FC +:10836000874F694678688030807C09F073FA00286E +:1083700003D1844985480EF056F8307D002806D098 +:10838000A06D4030407A002801D0012600E0002690 +:1083900078688030807C09F029FB002804D17B4874 +:1083A000784908300EF03FF809F04FFB684031463D +:1083B000014316D07968FD2249882181217E400041 +:1083C000490849003143114001432176684600784D +:1083D000002802D00420014301E0FB200140217667 +:1083E000A5710020207165713B20E0702570BFE60B +:1083F00010B5624C343C2078002804D00E21084689 +:1084000000F07BFE10BD5E4906220831A01D0DF074 +:108410008CFE00202071012060710E21E17020701F +:1084200010BD70B5554C0546343C2078002804D06A +:1084300038210E2000F061FE70BD50480C30007FE6 +:10844000002807D00C202071012060713821E170D4 +:10845000207070BD287809F072FC28780CF05BF968 +:108460000020F0E770B5454D0446343D28780028DB +:1084700004D037210E2000F040FE70BD3F480C3084 +:10848000007F002801D00C200AE03D4E2188706852 +:108490004088884203D10AF060F8022807D0022001 +:1084A0002871012068713721E970287070BD7168EA +:1084B0007F2020310876487600208876A2788A715D +:1084C000E278CA7122790A72EAE710B52B4C343C83 +:1084D0002078002804D039210E2000F00EFE10BDB7 +:1084E0000AF03BF8032808D00AF03AF8032804D031 +:1084F00022480C30007F002801D00C2003E01F49E7 +:1085000000202C31C8712071012060713921E17087 +:10851000207010BD70B5194C0646343C20780028F8 +:1085200004D03A210E2000F0E8FD70BD0AF015F8E5 +:10853000032808D00AF014F8032804D00F480C30A0 +:10854000007F002801D00C2011E00C4D2C35E8797B +:1085500008280BD20001001910223146683000F0C3 +:10856000D6FDE879401CE871002000E0072020716A +:10857000012060713A21E170207070BD88090020EF +:108580006400002074810000210200001708000030 +:10859000F8B5FA4E04463078002804D03D210E206C +:1085A00000F0ABFDE4E5F5484030007F002801D045 +:1085B0000C2034E0F24D218868684088884203D15D +:1085C00009F0CBFF022801D0022028E06F68648800 +:1085D000FD883A896800B988401C844218D3E9486C +:1085E00041431046E84A50430DF019FE401EFF215A +:1085F00080B2F531884200D90846844200D2204634 +:10860000691C401C0DF00BFE6D1C6843401E85B2BA +:10861000E620C05D002800D1BD84F58000203071C7 +:10862000012070713D21F1703070A1E5F8B5D34C97 +:1086300005462078002804D035210E2000F05DFD8D +:1086400096E5CE484030007F002801D00C2016E08F +:10865000A878002801D0012804D1A888FF21F5318D +:10866000884201D912200AE0C54F298878684088DD +:10867000884203D109F071FF022807D0022020713F +:10868000012060713521E170207071E57968002664 +:108690000846C0310E70AA884A800122A0300271BB +:1086A000AA78012A00D000220A704079002801D05F +:1086B0000AF0DBFC2671E3E770B5B04C0546207884 +:1086C000002804D030210E2000F017FD55E709F0F6 +:1086D00044FF002804D1A9484030007F002801D081 +:1086E0000C2003E028780AF0E0FB00202071012034 +:1086F00060713021E17020703FE770B59F4C0546F6 +:108700002078002804D033210E2000F0F6FC34E756 +:1087100009F023FF002804D198484030007F00284A +:1087200001D00C2018E02978002911D00A290FD097 +:1087300014290DD01E290BD0282909D0322907D0A1 +:108740004B2905D0642903D0FF2901D0122003E072 +:1087500028460AF023FC002020710120607133219B +:10876000E170207009E770B5844C06462078251D1D +:10877000002804D032210E2000F0BFFCFDE6314677 +:10878000002009F0AEFA2870002805D17C480622A6 +:10879000314608300DF0C9FC012060713221E170D2 +:1087A0002070EAE670B5754C2178002904D031219B +:1087B0000E2000F0A2FCE0E600214156012504292C +:1087C00012D0002910D0081D0ED0001D0CD0001DA5 +:1087D0000AD0001D08D0001D06D00A3004D00A308F +:1087E00002D01220207103E0084606F079FD657181 +:1087F0003120E0702570C0E6FEB5604C0746207859 +:10880000002804D025210E2000F077FCFEBD38881A +:10881000694608F015FB594D01460020083500292E +:1088200004D002212171286028710FE00098009E79 +:108830000A30019060360020B07105222846019967 +:108840000DF073FCB0790028F5D13888E0800E2057 +:10885000A0702520E070012060712070FEBD10B571 +:10886000464C2078002804D005210E2000F045FC5D +:1088700010BD0020207108F008FFE08008F0D1FF53 +:108880002072012060710521E170207010BDF1B5EA +:108890003A4C2034A07B002804D010210F2000F097 +:1088A0002CFC65E4354D4035A8790C2610270028AE +:1088B00016D1287F002813D109F04FFE022824D1B9 +:1088C0002F4800994068098842888A421DD1014694 +:1088D000C0310A7A002A05D04030807F80070DD44D +:1088E000E6730EE05E22125C920707D406220A723B +:1088F000A0304079002801D00AF0B7FB2F77002084 +:10890000E07327740120A07332E40220F8E710B569 +:108910001A480178002904D00F210E2000F0EDFB49 +:1089200010BD00210171FF2181710021C943018126 +:1089300013490E310A7882728A8882814988C181FE +:10894000012141710E2282700F22C270017010BD90 +:1089500010B50A4C2078002804D02B210E2000F0FE +:10896000CCFB10BD0821A01D04F024FB00202071C9 +:10897000012060712B21E170207010BD540900208E +:1089800064000020C40900001027000070B5FA4DF3 +:1089900004462878002804D02A210E2000F0ADFBE0 +:1089A000EBE5F54810222146303800F0B0FBF248E4 +:1089B0001022A118203800F0AAFBEF4830380CF044 +:1089C000BCFBED49102210392C46A81D00F09FFB7E +:1089D000002020710E20A0702A20E070012060711C +:1089E0002070CAE5F8B50546E348E34C40300090F6 +:1089F000007F0C2628272034002801D0E6733EE0B3 +:108A0000A07B002804D028210F2000F076FB04E48E +:108A1000A87805280DD013280BD0142809D01528C4 +:108A200007D01A2805D0292803D03D2801D03B289B +:108A300003D12888D149884201D912201EE009F0CB +:108A40008CFD0228DAD1CE482A88406841889142BC +:108A500013D10146C0310A79002ACFD1AA784A71D0 +:108A600001220A710099A0300F770021E17340794B +:108A7000002804D00AF0F9FA01E00220E07327741C +:108A80000120A0735FE4F8B5BB4F064638783D1D62 +:108A9000002804D017210E2000F02FFB53E43146AC +:108AA000012009F01EF901242870002807D1B248DE +:108AB00006226030314605460DF037FBAC717C7103 +:108AC0001720F8703C703EE470B5AB4C0646207839 +:108AD000002804D00B210E2000F00FFB4DE509F01B +:108AE0003CFD032808D009F03BFD032804D0A24830 +:108AF0004030007F002801D00C2016E03378002B96 +:108B000003D0012B01D012200FE09B4DE035297AD4 +:108B1000082909D22846721C0C3006F097FB287AE7 +:108B2000401C2872002000E00720207101206071A5 +:108B30000B21E170207020E510B58F4C20780028C3 +:108B400004D00A210E2000F0D8FA16E709F005FD3E +:108B5000032808D009F004FD032804D086484030DB +:108B6000007F002801D00C2002E000F0BFFA0020B6 +:108B70002071012060710A21E1702070FDE610B5BE +:108B80000AF032F9002803D07E497F480DF04BFCF3 +:108B900008F04BFD0BF051FC002804D01720794958 +:108BA00040010DF040FC08F0ACFF002804D0B920D3 +:108BB000744980000DF037FC00F098FAFFF7F2F8E6 +:108BC0006D4800210171012141710222C2700170C2 +:108BD000D3E610B5684C2178002904D020210E205E +:108BE00000F08BFAC9E601781F290ED8411C0CD081 +:108BF000002121710278411C104609F08FF80120F4 +:108C000060712021E1702070B7E612202071F6E734 +:108C1000F8B5594C2178002904D01B210E2000F012 +:108C20006CFABFE401216171534E0C212171403671 +:108C3000317F00296FD10078514F0025012804D0E1 +:108C400000284AD01220207165E009F086FC002837 +:108C500003D109F085FC002804D009F07EFC02282D +:108C600022D058E008F08FFF002854D0307D002833 +:108C700051D1786801224580032108F0B4FB78685F +:108C800009F05AF97868923008F001FD002803D104 +:108C90003C493E480DF0C7FB0AF00BF9002839D0DB +:108CA00085203849C00015E009F05AFC002832D16F +:108CB000707F00282FD001282DD004282BD008F059 +:108CC00062FF002827D00AF0F4F8002822D02F48AD +:108CD0002C4918300DF0A7FB1CE009F03EFC0328DE +:108CE00004D009F03DFC03280FD014E000200AF066 +:108CF00005F800280FD12571307D00280BD1786848 +:108D00008030807CFFF734F805E0002009F0F6FFA2 +:108D1000002800D125711B20E0700120207041E463 +:108D200010B5154C2178002904D01A210E2000F02E +:108D3000E4F922E601781F290ED8411C0CD000214D +:108D400021710278411C104608F0FDFF012060717E +:108D50001A21E170207010E612202071F6E770B53C +:108D6000054E044630780C25002811D018210E201D +:108D700000F0C3F9AAE4000054090020FF0E00002F +:108D80006400002074810000D3020000240400006D +:108D900009F0E3FB03285AD009F0E2FB032856D080 +:108DA000E14A107F002852D16079002801D00128C3 +:108DB0002DD1A079002801D0012828D1A07B00283E +:108DC00005D0012803D0022801D003281FD1607BE1 +:108DD00000281CD0C0081AD161880120800381427C +:108DE00002D82388834203D9207901280FD119E0C2 +:108DF0002079002806D0012814D0022805D00328A5 +:108E000005D102E020290BD30CE0A02B0AD2207957 +:108E1000042805D12088202802D36188884201D9FE +:108E2000122514E0207950776079002802D00128BB +:108E300003D00CE0BD4A002105E0BB4A2032907906 +:108E4000002804D00121204608F0CEFE054601206E +:108E5000357170711821F170307037E470B5B24C13 +:108E60000546403C2078002804D02E210E2000F03A +:108E700044F92BE409F071FB0C22022815D1AA4811 +:108E8000007F002811D1A9482B88083841684888FC +:108E900083421AD10846C030037A002B05D1203115 +:108EA000C97E0F2903D0102901D0227103E00521CA +:108EB0000172002020710E20A0702E20E070288802 +:108EC000E08001206071207016E40220F2E770B5A6 +:108ED000954C0546403C2078002804D02D210E20DA +:108EE00000F00BF908E409F038FB0C21022814D13A +:108EF0008D48007F002810D18C4E2A88083E70686B +:108F000043889A4220D1C822125C002A05D13B2214 +:108F1000125C0F2A03D0102A01D021710AE010221E +:108F2000A91CD6300DF001F970680421C03001721F +:108F3000002020710E20A0702D20E0702888E08095 +:108F40000120607120700DE40220F2E710B5017875 +:108F50000B000DF059FB3F9E9E399E9E599E9E9E92 +:108F60009E3C3F9E9E8752559E9E999E9E9E432963 +:108F70009E2D319E9E9E9E359E9E9E955C9E9E47FA +:108F80009E4B4F9E21259E6C6064689E709E7F83E1 +:108F90007C788A8D74919E00801CFFF798FF76E0A4 +:108FA000801CFFF75BFF72E0801CFFF7D8FE6EE0CD +:108FB000801CFFF7B5FE6AE0801CFFF729FE66E023 +:108FC000801CFFF706FE62E0FFF7D9FD5FE0FFF7C8 +:108FD000B3FD5CE0801CFFF777FD58E0801CFFF7D5 +:108FE00052FD54E0801CFFF7FDFC50E0801CFFF7B1 +:108FF000CDFC4CE0FFF7ACFC49E0FFF788FC46E015 +:10900000801CFFF744FC42E0FFF729FC3FE0801C96 +:10901000FFF7F2FB3BE0801CFFF7C4FB37E0801C4E +:10902000FFF7A1FB33E0801CFFF767FB2FE0801CFC +:10903000FFF742FB2BE0801CFFF7F8FA27E0801CCB +:10904000FFF7A6FA23E0801CFFF764FA1FE0FFF7A2 +:109050003CFA1CE0801CFFF705FA18E0801CFFF7C3 +:10906000E0F914E0FFF7C4F911E0FFF762F90EE050 +:10907000801CFFF74BF90AE0801CFFF721F906E09E +:10908000801CFFF70AF902E0801CFFF7DAF80120E4 +:1090900073E4002071E470B52349244C054640393F +:1090A000083C0A460126403260682B000DF0ACFAFD +:1090B00005171A1A04171A000122002108F093F963 +:1090C000616800220846C0310A724A7209F067FFDF +:1090D000002803D016A11B480DF0A5F960E4167511 +:1090E00088655DE4174812A13330F5E70E4900208A +:1090F000C031C8612039087270470B4A203A937E0C +:10910000002B03D1D076117701209076704730B5CF +:10911000134606E0CC18203CE47FD51A44555B1E6C +:10912000DBB2002BF6D130BD940900206C0000208A +:109130007372635C6C6C5F6374726C2E73302E633D +:10914000000000005108000070B5FD4D040008D07B +:10915000012C10D0022C07D0032C05D0F9A17020CF +:1091600007E0F8A1672004E02878012803D0F5A1E2 +:109170006D200DF058F92C7070BD70B5F04D04469F +:1091800010280AD0112C16D028468178122C07D02E +:10919000132C0AD0EBA19F200BE0EAA1942008E059 +:1091A000112908D0E7A1992003E0112903D0E5A1F6 +:1091B0009C200DF038F9AC7070BD10B5E04894B04B +:1091C000007B002819D0172069460870DC4900A8E8 +:1091D00006220D3102300CF0A8FF09A96846F9F704 +:1091E000C2FE0446112805D0002C03D0D5A1BB2017 +:1091F0000DF019F9204614B010BD3220E4E710B587 +:1092000001220023114603F0B5FC10BDFFB595B057 +:109210001D460E460746FFF7F2FF04000AD02078ED +:10922000222804D3A07F8006C00FA84204D10820C2 +:1092300019B0F0BDC748FBE7372168460170478089 +:10924000002D05D00121017146711799817102E04D +:1092500000206946087109A96846F9F784FEA07FD5 +:10926000DF21084069010843A0770020E0E770B5DE +:109270000446084620380D4603000DF0C5F90A06DD +:109280000A11232C334249505761FF20ADA1083009 +:1092900052E02078202851D1FF20AAA10B304BE0CA +:1092A000A7480178032949D08078132846D0207830 +:1092B000242843D0252841D023283FD0FF20A1A136 +:1092C0000E3039E02078222838D0232836D8FF20E5 +:1092D0009CA1153030E0207822282FD0FF2099A1C2 +:1092E000193029E02078222828D0242826D02628C2 +:1092F00024D0272822D0292820D0FF2091A11C305B +:109300001AE02078252819D0FF208EA1233013E001 +:109310002078252812D0FF208AA126300CE0207862 +:1093200025280BD0FF2087A1293005E020782828A8 +:1093300004D0FF2083A12C300DF075F8257070BD8E +:10934000FF2080A12F30F7E730B5834C0B88834A8C +:10935000022801D0934204D09D1FA54225D20228A5 +:1093600002D04D88954203D04D88AD1FA5421CD236 +:109370004C88A34219D88B88FF25F435AB4214D80A +:10938000022802D0C888904205D0C888724D0A3899 +:109390002D1FA84209D2C888904208D0944206D016 +:1093A0005B1C63438000834201DB072030BD00204B +:1093B00030BDF0B56A49884245D36A4A0125AD04FB +:1093C0001368A84201D398423DD30279002A06D0FF +:1093D000082A02D8067B082E05D90720F0BD047B99 +:1093E000002CFAD0F6E7002A06D004688C422AD373 +:1093F000AC4201D39C4226D3002E06D084688C4216 +:1094000021D3AC4201D39C421DD300240CE005685B +:10941000A700ED598D4216D30127BF04BD4201D3E9 +:109420009D4210D3641CE4B2A242F0D80022012570 +:10943000AD040CE084689700E4598C4203D3AC423D +:1094400003D39C4201D21020F0BD521CD2B29642EE +:10945000F0D80020F0BDFFB50022099B002802D003 +:10946000994205DC58E0002902D1002004B0F0BD8B +:109470000920FBE7845C002C12D087187D78112D21 +:1094800043D010DC2B000DF0BFF80A401726262C25 +:109490002C2E2E363640835C002B30D1521CD2B29B +:1094A0008A42F8DBE1E71C2D2FDA123D2B000DF08C +:1094B000ABF8042C2C121A2C022CD9D1BB78039CAB +:1094C000072B237001D25B0701D40A20CEE7029B51 +:1094D00001241B7816E0E343DB0708E0012C08D0E9 +:1094E00013E00620C2E70F2523072D075B19002B89 +:1094F000F4D03046BAE7029B1B789C0701D50B20BD +:10950000B4E702242343029C2370835C521C9A1804 +:10951000D2B28A4202DDABE7192676028A42A9DB83 +:10952000A3E710B504780B46002C1FD001210E4A8A +:10953000012C1ED0022C22D0032C2AD125E00000C1 +:10954000740A00207372635C6761705F636F726599 +:109550002E630000023000007B0C0000FFFF0000C3 +:109560000080010028000020023200000021197054 +:1095700011E019708179890903290AD10BE019706A +:1095800081798909012904D105E019708179890956 +:1095900001D0104610BD411C0622581C0CF0C5FD20 +:1095A000002010BD08B51346002806D0FEA00068B4 +:1095B000009048796A468009105C18700622581C91 +:1095C0000CF0B3FD08BD30B50C46097895B02229E2 +:1095D00002D2082015B030BD282369460B704880A0 +:1095E000132A03D03B2A01D00720F3E708460A716B +:1095F00009A9F9F7B8FC050003D121212046FFF79E +:1096000036FE2846E6E700B595B0232369460B7081 +:109610004880108888805088C880D0884881908889 +:10962000088100208881C88109A96846F9F79BFC58 +:1096300015B000BD70B50C00064610D0FFF7DFFD79 +:10964000050003D1D949DA480CF0EDFEA68028893F +:10965000E0802889208168896081A889A08170BD07 +:1096600070B50E46050003D00021092003F027FF46 +:109670000120D04C022E207324D0032E04D0CC48DD +:10968000CA491E300CF0CFFECA4806210D3003F047 +:1096900091FCA07C8006800EA074FFF78EFDA08B4D +:1096A00000280ED0002D0CD08300012200210920BB +:1096B00003F060FE092804D0BD48BC4928300CF0F6 +:1096C000B2FE70BDBB480321103003F073FCA07CD8 +:1096D00040218006800E0843A074B6480C3002F08A +:1096E00015F9DAE77FB501A9012003F0C3FA0028D4 +:1096F00004D0AF48AD4967300CF095FEAE4E01A8DE +:1097000003F0C6FA050002D0052D4CD048E0029CBB +:10971000A07F01072CD520462230009068462346C2 +:10972000628E80882146343301F07BFA0546A07FA3 +:10973000F7210840A077002D05D0B5422FD09C48D6 +:109740009A49783029E0E17F480889074000C90F2D +:1097500008432021095D4007400FC9000843E07716 +:10976000207828281CD129212046FFF780FD17E00A +:109770004007C4D568462246808821460E32FFF74E +:1097800042FF0546A07FFB210840A077002D07D0AF +:10979000B54204D08648854992300CF044FE00253D +:1097A000284604B070BD0020FBE7F8B5040004D1E2 +:1097B000ED207E4980000CF036FE7220207060683B +:1097C00008250178091F0B000CF01EFF11F90A3D56 +:1097D0005FF83D0EF8F83E3D3D3D3DF986F93D0010 +:1097E00073487249AA3074E087883846FFF707FD4E +:1097F000060004D16E486D49B2300CF014FE60785A +:109800000421284360706B4CA07F0843A07721217E +:109810003046FFF72CFDB07F8007800F012801D173 +:10982000801EA080384602F057FE3846FBF72AFE1D +:109830003846FAF7C6F93946022003F040FEB07FF9 +:10984000EF210840B077F8BD86883046FFF7D7FC97 +:10985000002804D156485549D0300CF0E4FD60682A +:109860008078012804D052485049D2300CF0DBFDFA +:1098700060688179304602F04EFF0028E3D06178BD +:10988000294361706168C880F8BD87883846FFF752 +:10989000B6FC060004D146484449E3300CF0C3FD51 +:1098A00060783946284360706068C088308160689D +:1098B0000089708160684089B081022003F0FFFD5B +:1098C0000020B075FFF70EFF0028DDD001203749DA +:1098D00080020CF0A8FDF8BD80783C2815D0002748 +:1098E000022815D00026002804D031482F49F8302E +:1098F0000CF099FD0021084603F0E1FD002107204E +:1099000003F0DDFD002E05D046E001270026F1E73B +:109910000126EAE76078284360702648817F294362 +:109920008177002F38D160688688304601F055F87D +:109930000546807F6168800889798000012900D010 +:1099400002210843A87760680622C08A28816068DF +:10995000008B68816068408BA8816068C079E87579 +:1099600061682846183008310CF0DFFB6068062279 +:10997000807B68706168A81C0F310CF0D6FBA87F53 +:109980008107890F304602F090FDA87F8007800F85 +:10999000012801D10748868006480178032913D0A1 +:1099A0008078132814D00BE00302FF0144950000D7 +:1099B00013030000740A0020023000000CE00FE0E6 +:1099C000FF20FCA1453084E70120FFF7BDFBF8BD77 +:1099D0001120FFF7D2FBF8BD204601F02AFCF8BDAC +:1099E000607828436070F8BDF7B505460078002719 +:1099F00000090C463E4601287ED00022F14902288B +:109A00007BD0072804D00A2878D0EAA1EE482DE1BF +:109A1000686803780D2B31D006DC042B6FD0072B40 +:109A200036D00A2B6AD106E0122B38D0132B40D047 +:109A3000142BF7D1B2E011270726002C72D08088B2 +:109A4000A0806968FB238979A171E04905468A7F76 +:109A50001A408A77032103F0C5F80421284603F051 +:109A6000C1F80021284603F0BDF80221284603F082 +:109A7000B9F80121284603F0B5F8F9E001270926D5 +:109A8000002CDBD08088A080686880792072EFE0AD +:109A900012270E2680882146FFF7CCFDE8E01A2722 +:109AA0000726002CCAD04088A08068680079A07181 +:109AB000DEE081783C2936D010271E26002CBDD050 +:109AC0008088A0806868C08A20836868C08AE08235 +:109AD0006868008B60836868408BA0836968207D1C +:109AE000497F4008C9074000C90F084320756968CD +:109AF000C007C00F497F03E05FE08AE0ADE01CE0F3 +:109B000049084900084320756968A21DC8790831D1 +:109B1000FFF748FD69682246887B0D320F31FFF759 +:109B200041FD05E074E019270726002C70D0A271D2 +:109B3000A648F722817F11407DE01B272E26002CAE +:109B400066D0A1806968A21D0879491DFFF72AFD2A +:109B500068682030C07A60736868C0780428A07B89 +:109B600019D040084000A073F921084069681F22FD +:109B7000C9788907490F0843A07369684007C97A03 +:109B8000400FC9000843A073696820460F300C31AC +:109B90000CF0CBFA6CE001210843E4E71E270E2607 +:109BA000002C6DD0A1806868E21D407AA0716968C0 +:109BB0008878C91CFFF7F6FC5AE0287A012805D0FE +:109BC000022815D080487BA132384FE01D270E2691 +:109BD000002C55D06888A080A889E080E889208181 +:109BE000288A6081688AA0817848DF22817FA2E785 +:109BF00012270E266888FFF71DFD002C40D06878DC +:109C00004007400F032833D17048FD22817F92E73F +:109C100036E0287A03000CF0F7FC06041010202030 +:109C2000202619270726002C2AD0A1806748A27178 +:109C3000817F4908490081771AE019270726002CFF +:109C40001ED0A180287A012805D00320A0715F488A +:109C5000EF22817F6FE70220F8E721462846029A2B +:109C600001F04BFCFEBD532052A100010CF0DBFBC8 +:109C70000298002C068001D0278066800020FEBD5F +:109C800002980680FAE710B5504894B080781328FF +:109C900002D0082014B010BD22206946087009A91E +:109CA0006846F9F760F904460021072003F007FC35 +:109CB0002046EFE700B5454895B08078122801D0DE +:109CC0000820B5E41E216846017000218170C17032 +:109CD00009A9F9F748F90028F3D10021072003F07A +:109CE000EEFB1120FFF749FA0020A1E400B5374848 +:109CF00095B00078022801D0032818D11B2108A8AC +:109D000001730021817369460BA8F9F72CF900282B +:109D100004D1684640781B2801D0032088E4002144 +:109D2000084603F0CCFB68468078002801D0082064 +:109D30007EE40120FFF708FA002079E4F8B5234C0F +:109D400003000CF061FC0A068017808080804B3590 +:109D50006E80FFF7CBFF00282AD1F7F7E9FD002836 +:109D600026D02221017000210172F7F7C2FDA07FE9 +:109D7000012152E08EB23046FFF741FA050004D1CE +:109D800011480CA12E300CF04EFB287821280FD062 +:109D9000F7F7CEFD00281BD01221017002270772B1 +:109DA00046800020A875F7F7A4FDA07F3843A07770 +:109DB000F8BD00007372635C6761705F636F72650A +:109DC0002E630000FFFF000036050000740A00202B +:109DD000132229463046FFF7F6FBE9E7A578122D56 +:109DE00006D0132D07D0FA49FA480CF01CFBDFE728 +:109DF000FFF760FF01E0FFF746FF0028D8D1F7F733 +:109E000097FD0028D4D022210170122D07D0022105 +:109E10000172F7F76EFDA07F10210843C7E701210B +:109E2000F6E7A07C810901290BD0800904D0E9481C +:109E3000E74922300CF0F7FA03210020FFF710FC6D +:109E4000B6E70221F9E7E348E1492930CDE7F7B564 +:109E500014460D0004D1DF48DD4931300CF0E3FA3F +:109E600028780827012807D002281FD0D948D849C8 +:109E700062300CF0D8FAFEBD0098FFF7C0F906007A +:109E800004D1D448D24938300CF0CDFA0220B07554 +:109E90001030207060783843607007CD083407C4F4 +:109EA000CD482022817F11438177FEBD0098FFF7C6 +:109EB000A6F9060004D1C748C54946300CF0B3FAEC +:109EC000A988C648814208D1EA88824205D1132276 +:109ED00031460098FFF777FBFEBD814202D1E8884A +:109EE000002809D01220207060783843607007CDB8 +:109EF000083407C4002006E07823002202200099DD +:109F000003F038FA0120B075FEBDB34840897047B0 +:109F1000FFB591B01498F8F721FF00285DD1012416 +:109F2000684603218471C9028180002201A920466C +:109F3000FAF719F9002850D16846152184714902B1 +:109F4000818000261C2102A800960CF04DF901200A +:109F50000146684610310170002001466846417094 +:109F60008178F9273940891C21438170017A0225C3 +:109F70002943017212998186C6861F2101870C90A0 +:109F800011980F9001A80B9009AA0BA902A8F9F744 +:109F9000B5FE002821D168468F4E808CF08068463F +:109FA00084718F498180807809AA3840801C4108DB +:109FB0004900684681708586058713A80F900BA914 +:109FC00002A8F9F79BFE002807D16846808C3081F3 +:109FD00031460A311498F8F7D4FE15B0F0BD30B50B +:109FE0000C46804995B08C4241D37F4901229204AE +:109FF0000968944201D38C4239D3203800220125CC +:10A0000003000CF001FB06042F494D535C64002152 +:10A01000082003F02EFA002802D0112015B030BD20 +:10A0200024206946087000A80522A11C02300CF00B +:10A030007CF809A96846F8F796FF050002D0082DBC +:10A040000ED031E0082300221146184603F092F9A1 +:10A05000082829D05F485E49D6300CF0E4F923E0A7 +:10A060000620DBE76068002803D0884201D2102078 +:10A07000D4E73D2168460170218841806188818054 +:10A0800009A9F8F770FF05000ED1606800280BD011 +:10A090006946098D018007E0206801F079FC02E043 +:10A0A000204600F0D8FC05462846B7E73E2007E0EA +:10A0B000857000E0827009A9F8F755FFF3E73420B6 +:10A0C000694608702078C0076846F3D0F0E707209B +:10A0D000A4E730B50C46444995B009688C4201D2DA +:10A0E00010209BE7203803000CF08EFA0504212194 +:10A0F000232132002088FFF782F8002804D000785E +:10A10000222803D2082089E7384887E725216846B6 +:10A1100001702188418009A9F8F725FF050015D1B4 +:10A120000AA905220231A01C0BF0FFFF0EE0062554 +:10A130000CE02068002805D0884201D2102505E0F7 +:10A1400001F01BFC24480025808BA080284665E791 +:10A15000072063E720481330704710B520211E48C0 +:10A160000CF040F80120FEF7EFFF1120FFF705F893 +:10A1700000211948C943818000218176E1218900AD +:10A18000818301460C300D310446F7F751FC12482B +:10A190000722214613300BF0C8FFFFF70EF8002806 +:10A1A00003D00B4912480CF03EF900F0D5FF10BD6A +:10A1B00010B504463C210CF015F8A07F8008800003 +:10A1C000A077202020700020A0752034607010BD82 +:10A1D000B49D00008C050000740A0020FFFF000001 +:10A1E000012A000000800100280000200230000049 +:10A1F000FB0600007047FEB50546FF480C4681424D +:10A2000007D301208004844205D3FC4800688442BF +:10A2100001D21020FEBD002D02D0012D32D126E04A +:10A22000F74908220F4668460BF07FFF3946204663 +:10A23000FFF777F90028EDD1FEF7BFFF060006D043 +:10A240000722694638460BF070FF3046FEBD207885 +:10A25000002801D0012805D1E94807223946C01D50 +:10A260000BF063FF0021092003F029F90FE00978C2 +:10A27000002907D0012905D0022905D0032903D0E0 +:10A28000E048FEBD0720FEBD0120FFF7E9F9DC48EC +:10A290000C3885760020FEBD10B5D8490968884283 +:10A2A00001D2102093E7D64902460C390B7B0D31C1 +:10A2B0001846FFF777F9002089E7FFB599B0054602 +:10A2C000002069460871087208A9087408751446C8 +:10A2D000CA480122C849920400681E46002D05D0D4 +:10A2E0008D420BD3954201D3854207D3002C08D071 +:10A2F0008C4203D3944204D3844202D210201DB076 +:10A30000F0BD2846204318D01F270CAB01AA0097A8 +:10A3100028461A99FFF79FF80028F0D10DAB02AA42 +:10A32000314620460097FFF796F80028E7D16846A7 +:10A33000007AC10703D00A20E1E70720DFE78007A2 +:10A3400005D568460079800701D50B20D7E703AF14 +:10A35000002D0FD01A20694608731A988873294671 +:10A36000F81C1A9A0BF0E1FE0EA903A8F8F7FBFD02 +:10A370000028C4D1002C0ED02021684601738673BA +:10A3800032462146F81C0BF0D0FE0EA903A8F8F7C0 +:10A39000EAFD0028B3D19A4908A8007C0C3948701E +:10A3A0000020ACE770B504460A2020700D46204618 +:10A3B000F8F7D9FD002805D139202070294620461C +:10A3C000F8F7D1FD70BDF7B500260C4605460B2702 +:10A3D0001AE02968B00009580978002903D001293A +:10A3E00001D00720FEBDA170296806220958E01C93 +:10A3F000491C0BF09AFE277020460299F8F7B3FD2E +:10A400000028EFD1761CF6B22879B042E1D80026B8 +:10A410003A270FE0A868B10041581022A01C0BF0A9 +:10A4200084FE277020460299F8F79DFD0028D9D1B7 +:10A43000761CF6B2287BB042ECD80020FEBDF0B509 +:10A44000044671A003C897B06B4B00271591149078 +:10A450009C4211D369480125AD040268AC4201D386 +:10A46000944209D32078012809D16168994203D325 +:10A47000A94204D3914202D2102017B0F0BD604926 +:10A480000C390A78012A0CD18A88614B9A4203D090 +:10A49000002806D0012804D08A7F13079B0F06D11D +:10A4A00001E00820E9E7D30701D1910701D5112088 +:10A4B000E3E7218A574B0A46203A9A4207D30128FC +:10A4C00075D1002973D1628A002A70D111E0022867 +:10A4D00001D0032801D1A02969D3012809D0484A15 +:10A4E0000C3A5278D20704D0628A002A5FD0B42A8C +:10A4F0005DD8002806D0012808D0022804D00328FF +:10A5000055D117E0002518E0022516E0002902D1F8 +:10A51000608A00280CD004256068007800280CD0E0 +:10A52000012809D0022807D0032805D03548A4E720 +:10A530000125F1E7032500E00127207A002806D055 +:10A54000012806D0022806D003287CD105E0002689 +:10A5500004E0012602E0022600E00326002D01D0DF +:10A56000022D14D1002E12D0E068FEF722FF002841 +:10A5700083D123480C384078800702D02148401E00 +:10A580007BE7022D03D1022E5DD0032E5BD0182174 +:10A5900068460170218A4180218A8180857118482E +:10A5A0000C38007B002803D001286FD104E04AE07A +:10A5B00000216846C17102E001206946C871684601 +:10A5C000077221780930012937D006210BF00AFEE5 +:10A5D00069460E74207D8207C107D20F4007C90F5C +:10A5E0005200C00F11438000014314A8405C69462B +:10A5F000C873002827D00FE0008001002800002049 +:10A60000800A002002320000070605040302010050 +:10A61000FFFF0000E13F000009A96846F8F7A3FC2E +:10A62000002884D109A96846FFF7BCFE0028A7D1FD +:10A63000002D0AD0022D08D010E061680622491CC6 +:10A640000BF073FDC4E7072017E7002E06D009AA18 +:10A650006946E068FFF7B7FE002891D11B206946E4 +:10A6600008700120887009A96846F8F77CFC00286A +:10A6700086D108A840791B2819D12B000BF0C4FF04 +:10A680000504040707040A00032001E00FE002208C +:10A69000FEF75AFD012D0CD0608A002809D0002257 +:10A6A00083001146104602F065FE002801D0032009 +:10A6B000E3E60020E1E6F3B5032687B00D46002966 +:10A6C0000AD0FA4885426FD301208004854203D323 +:10A6D000F7480068854267D30798FEF790FD0400AD +:10A6E00005D02078222804D2082009B0F0BDF14816 +:10A6F000FBE7A07F8707BF0F002D05D0294638460E +:10A70000FEF722FE0600F0D139460027EA4801296B +:10A7100007D0022931D0E949E9480BF084FE3046E0 +:10A72000E3E7A27D2946012A02D0827F920701D564 +:10A730001120DAE700291BD108216A46049711820B +:10A740000592418904AADF48FAF7FDF80028CCD128 +:10A750006846008A082801D00320C6E768460188B9 +:10A7600001814188418181888181C188C18102A99B +:10A77000079801F061FF0646D1E7A17D022916D1B5 +:10A78000807F800613D4002D04D0A07F40070CD416 +:10A79000002100E00121079801F08FFF0600BED1E3 +:10A7A000A775002DBBD004E01AE01126B7E7002DF5 +:10A7B00016D02A4621460798FEF725FF064611289F +:10A7C000ADD1A07F4007AAD42046082229460E30EA +:10A7D0000BF0ABFCA07F04210843A07700269EE786 +:10A7E000102082E770B50C460546FEF708FD010013 +:10A7F00004D022462846FEF7E6FE70BDAD4870BD87 +:10A8000000B50146143195B0192901D2810707D04E +:10A8100001461E3104D00A3102D0072015B000BD18 +:10A82000312269460A70887009A96846F8F79BFBCF +:10A83000F4E701B582B00220694608809E4802AB69 +:10A8400000896A460021F9F7E7FE6946098802296E +:10A8500000D003200EBD1CB50021009102216A46E4 +:10A860001180934901900968884201D210201CBDD3 +:10A87000914801899348FAF766F8694609880229E0 +:10A88000F5D003201CBDF0B50E46884985B01746AB +:10A8900005468E4207D386480122920400689642FC +:10A8A00004D3864202D2102005B0F0BD1F2F01D97B +:10A8B0000C20F9E7804C8D4226D3954201D3854286 +:10A8C00022D3E08803A9F9F758FE0028ECD12878B4 +:10A8D00069464873E08803A9F9F730FE0028E3D100 +:10A8E0006946009008780221084369460870497B50 +:10A8F000090703D00821084369460870E0886946C3 +:10A90000F9F7B5FD0028CFD169468F80E08833463E +:10A9100001AA0021F9F780FE69468988B942C3D0AF +:10A920000320C1E71CB50C4600210091019122884B +:10A9300069460A805E4901900968002801D0884272 +:10A9400001D38C4201D210201CBD002801D0002A66 +:10A9500009D059486A46C1885A48F9F7F4FF694650 +:10A96000098821801CBD0C201CBD10B50123FEF7F9 +:10A970004DFC2CE4002310B51A461946FEF746FCA0 +:10A9800025E430B505464A4895B000680C4681423A +:10A9900002D2102015B030BD2846FEF730FC00284A +:10A9A00007D00178222902D3807F800603D40820B3 +:10A9B000F0E74048EEE7132168460170458009A999 +:10A9C000F8F7D1FA0028E5D108AA0A2151567F29C3 +:10A9D00001D02170DEE70520DCE7F8B5012304464D +:10A9E0001A46194602F0C6F8074601231A46022104 +:10A9F000204602F0BFF8064601231A4604212046ED +:10AA000002F0B8F8054601231A460321204602F059 +:10AA1000B1F80446002F03D128492B480BF003FD61 +:10AA2000002E04D1AD20254980000BF0FCFC002D48 +:10AA300004D125482149801C0BF0F5FC002C04D1E1 +:10AA400021481E49C01C0BF0EEFC22213846FEF7BF +:10AA50000EFC3846F8BD10B50446006800280CD03E +:10AA60001249884207D301218904884205D310493D +:10AA70000968884201D2102014E400F071FFA08818 +:10AA80000D4CA083A07E01280DD10021092002F0E9 +:10AA9000F0FC002800D00120A17C8909012915D0F3 +:10AAA0000321FEF7DDFD002006E400000080010028 +:10AAB0002800002002300000740A0020B49D00002D +:10AAC000C6090000FFFF0000B30200000221E8E712 +:10AAD00030B5F74B9A4207D301239B049A4205D322 +:10AAE000F44B1B689A4201D2102030BD1578EB065A +:10AAF0005B0F042B07D85478072C04D39378102BC2 +:10AB000001D8A34201D2072030BDD3785B0702D41D +:10AB100013795B0701D5062030BDC37FAC075B0806 +:10AB20005B00E40F2343C3770878EF2318401378C2 +:10AB30009B06DB0F1B0118430870F12318401378A4 +:10AB4000DB065B0F5B001843087050780873002029 +:10AB500030BD30B500240C70C378DB07DB0F0B7001 +:10AB6000C578AD07ED0F6D002B430B70C5786D07F1 +:10AB7000ED0FAD002B430B7014700179C907C90F9D +:10AB8000117003799B07DB0F5B001943117000798B +:10AB90004007C00F80000143117030BD70B51446EE +:10ABA0000D460646F6F7C4FE002809D0A221017022 +:10ABB000142221460830F6F707FBF6F79AFE70BD1F +:10ABC000132229463046FEF7FEFC70BD70B51446D0 +:10ABD0000E460546F6F7ACFE002809D0222101708A +:10ABE00045802178017261784172F6F782FE70BD6E +:10ABF000132231462846FEF7E6FC70BD10B5AE4C78 +:10AC0000207C00280CD1204621461038FDF762F840 +:10AC1000002803D0A9A1F2200BF005FC012020742C +:10AC200010BD70B594B015460C462C226946189E8E +:10AC30000A704880002B17D00822194601A80BF093 +:10AC400074FA68468581102231460E300BF06DFA99 +:10AC500009A96846F8F787F9002803D1A17F1022D7 +:10AC60001143A17714B070BD002001900290E8E775 +:10AC7000F0B50646008A97B080B20D460190FEF707 +:10AC8000BEFA04468C48317848380746E8370990C0 +:10AC90000B000BF0B9FC0EFCFB48085F8798B8D995 +:10ACA000FAF9F8F7F6FC002301221946019801F0A1 +:10ACB00061FF050004D1FF2080A130300BF0B3FB11 +:10ACC000002C04D1FF207DA131300BF0ACFB387E8D +:10ACD000C00904D078486030C06DA86112E02B2014 +:10ACE000694608720BA902A8F8F73DF9002804D0BC +:10ACF000FF2072A13C300BF096FB74490C980BF0CE +:10AD00008EFAA9617068A862B068E862A07F8007C7 +:10AD1000800F012820780DD0252804D0FF2067A1BE +:10AD20004D300BF080FB324621460198FFF736FF8D +:10AD300017B0F0BD2528F6D0222806D0242804D04C +:10AD4000FF205EA146300BF06EFB25212046FEF76A +:10AD50008EFAE8E7002301221946019801F00AFF64 +:10AD6000060004D1FF2055A158300BF05CFB002CED +:10AD700004D1FF2051A159300BF055FB2078252834 +:10AD800004D03078012108433070D1E702202870C8 +:10AD9000B068A860B068002802D000202871C7E71A +:10ADA0000120FBE72B2069460870434968464C396F +:10ADB000F8F7D9F8002804D0FF2040A178300BF034 +:10ADC00032FB03201BE02A206946087000A81022ED +:10ADD000023071680BF0A9F904A810220230B168A2 +:10ADE0000BF0A3F9344968464C39F8F7BCF8002851 +:10ADF00004D0FF2031A189300BF015FB042028700E +:10AE00000998686094E7B068002804D1FF202BA15E +:10AE100095300BF008FBE07F400704D5FF2027A109 +:10AE200096300BF000FBB06806220A3800903379A8 +:10AE30000421019801F0FBF90028A6D0FF201FA1F2 +:10AE40009B300BF0F0FA73E7002C04D1FF201BA11C +:10AE5000A3300BF0E8FA2046223010220546716834 +:10AE60000BF063F928212046FEF701FAA07F800746 +:10AE7000800F022814D100231A462146009501981C +:10AE800006E04BE1BAE0B0E095E03FE071E05FE161 +:10AE9000FFF7C7FE11281BD029212046FEF7E7F94E +:10AEA000E07F317A4007400FC9000843E0773FE771 +:10AEB0000080010028000020400B00207372635CBA +:10AEC0006761705F7365632E6300000040420F008E +:10AED000A07F000704D5FF20FD49B0300BF0A3FA96 +:10AEE000A07F08210843A0770020608620463430E8 +:10AEF0000BF078F9E07FFD220146C9071040890F69 +:10AF00000843E077307A2034207011E700230122D3 +:10AF10001946019801F02EFE040004D1FF20EC49EF +:10AF2000CD300BF080FA2B2069460872E94902A85F +:10AF3000F8F719F8002804D0FF20E549D2300BF0CB +:10AF400072FAE4488188204621300176090A417668 +:10AF50000E2129702146FC316960017E2974407EF2 +:10AF60006874DC482C30A860103030346C61E860C4 +:10AF7000DEE6002C04D1FF20D549E6300BF053FA71 +:10AF80002078212893D93079012802D0022808D1CD +:10AF900003E0E07F04210843E077387E0121084385 +:10AFA0003876324621460198FFF7F8FD23212046E6 +:10AFB000FEF75DF9BCE601220421019801F01FFCB7 +:10AFC0000028A2D0002301221946019801F0D2FDE9 +:10AFD000040003D1BE49C0480BF025FA0F202870A9 +:10AFE000172028716E34AC60A2E60421019801F0AC +:10AFF00056FC002889D11020287099E600230122F0 +:10B000001946019801F0B6FD050004D18720B0492A +:10B0100080000BF008FA2E462036307E41064DD5D2 +:10B02000A17F8F07BF0FC00713D029468031486F1B +:10B0300000280ED0027CF37DD207D20F5B001A43AA +:10B040000274486F5108E27F4900D207D20F1143C2 +:10B050000174307E000713D52A468032116F002913 +:10B060000ED0087CF37DC007C00F5B001843087446 +:10B07000116FE27F40084000D207D20F10430874DE +:10B08000307E80070BD5F8204259002A07D0012FC7 +:10B0900005D02946307C31311032FEF783FA307EFC +:10B0A000C0060BD5F8204259002A07D0012F05D140 +:10B0B0002946307C31311032FEF774FA0523684698 +:10B0C0000370357E4570834822216038019A0170F3 +:10B0D0004178C908C900C91C417042800372457299 +:10B0E000F6F78EFD2078252809D021280BD07A4844 +:10B0F00077495B300BF097F92078222803D9222179 +:10B100002046FEF7B4F80021019801F06BFD0028FD +:10B1100000D10DE670486E49633092E674686D4D5B +:10B1200020786035092802D00A28F2D10BE0E168C6 +:10B13000002902D02846F7F7E8FE2169002902D04D +:10B140002846F7F7E2FE21462846F7F7DEFEEFE550 +:10B1500061485F49883074E65E4810B504222821B2 +:10B160006030F7F7B9FE5B480024EC30017E4906F9 +:10B17000490E01764038C465FCF739FD55493C312C +:10B1800008461038F6F78BFC52484C30047410BD5A +:10B1900070B50D46FEF733F8040004D14E484C4913 +:10B1A000A7300BF040F9FF21053128460BF01CF8C1 +:10B1B000A07F8007800F01280CD00221284688300C +:10B1C000FCF716FD002804D043484149AC300BF091 +:10B1D0002AF970BD0121F1E70A46014610B5104673 +:10B1E0008830FCF71FFD10BD70B5054611200C46D8 +:10B1F0000870002161702121495D002908D00329D0 +:10B200000ED0042910D034483149C6300BF00BF968 +:10B2100020780009012802D9E87FC008607070BD5D +:10B220000007000F203002E00007000F30302070D0 +:10B23000EEE7F0B504464068082601789BB008297F +:10B240000DD00B2903D00C294BD1012181716068ED +:10B2500087883846FDF7D3FF05004CD147E0478883 +:10B260003846FDF7CCFF050004D1172018494001EE +:10B270000BF0D9F82878212833D0282833D16068FA +:10B2800002210C3000F050FF00282CD0606808210B +:10B29000001D00F049FF002825D02D2168460170CF +:10B2A000478029461022223101A80AF03EFF0FA94B +:10B2B0006846F7F758FE002804D007480449EF30E5 +:10B2C0000BF0B1F8A87F10210843A877292105E0E9 +:10B2D000BCAE0000F40A0020030200002846FDF77F +:10B2E000C6FF1BB0F0BD607830436070F9E7FE49DF +:10B2F000FE480BF098F8A87FEF210840A87729783E +:10B3000021290FD061688A79002A02D08978002922 +:10B3100012D08007800F022849D0F448F249343017 +:10B320000BF081F8FEF7DEF90028DAD0EF48EE499D +:10B330003F300BF078F8D4E7607830436070E87FF6 +:10B34000C00701D0042100E00321212041552878C5 +:10B3500029280BD03946062002F0B1F82878242895 +:10B36000E0D122212846FDF782FFDBE700230122FE +:10B370001946384601F0FEFB040004D1C920DA4921 +:10B3800080000BF050F825212846FDF770FF0D20B6 +:10B3900008A90871204609A98830FCF735FC022865 +:10B3A000C0D00028BED0D148CF491D30B8E7607862 +:10B3B00030436070B6E7F7B58AB015460646FDF72C +:10B3C0001EFF002841D0017822293ED323293CD0FA +:10B3D000C17F490739D4807F8007800F01280DD0B5 +:10B3E000002301220021304601F0C4FB0746C0487B +:10B3F0000290F7F781FD040007D101E00123F0E797 +:10B40000BA48B94959300BF00EF8002F1FD08837D1 +:10B4100067610298F7F770FD07460298F7F76CFD31 +:10B4200009212170266225710B99E760A1602061D6 +:10B4300003A92046FCF70CFC022806D0002804D003 +:10B44000AA48A94975300AF0EEFF0DB0F0BD002002 +:10B4500007466061E4E730B5002387B00546012266 +:10B46000194601F087FB04462846FDF7C8FE007820 +:10B4700022281BD9002C04D19C489B4981300AF01A +:10B48000D2FF0F21684601701721017120466E30EE +:10B49000029069461A30FCF7B7FB022806D0002854 +:10B4A00004D0E520904980000AF0BDFF07B030BD10 +:10B4B00030B5002387B005460122194601F05AFB3A +:10B4C00004462846FDF79BFE00782228EED9002C82 +:10B4D00004D18648844993300AF0A5FF10206946BC +:10B4E000087020468830FCF78FFB0028DED0E9206A +:10B4F0007D4980000AF097FFD8E7F7B50546007848 +:10B500000027000982B00C463E4602287ED007285C +:10B5100002D00A284AD14AE068680178082907D091 +:10B520000B2930D00C292ED070486F49D33060E100 +:10B5300014271A26002C6AD04088A080FDF75FFEF1 +:10B540000090002804D169486749AF300AF06BFFCA +:10B5500000980099C07DA21D1831FEF723F8686895 +:10B5600008228089E081696820461030091D0AF0B0 +:10B57000DCFD207E01210843F92108402076009857 +:10B580004021807F47E018270826002CD3D08088F0 +:10B59000A080FDF734FE050004D1F7205249800059 +:10B5A0000AF041FFA11D2846FFF71EFE23E1002CF3 +:10B5B00001D0288BA080287A01287DD0022804D0D1 +:10B5C00003282FD048494B4813E11C270726002C9D +:10B5D000B1D0A088FDF713FE0090002804D1FD2013 +:10B5E000414980000AF01FFF287B8007800F012857 +:10B5F000A07914D040084000A071FD210840297BAB +:10B600004907C90F49000843A07101E0E3E0DFE00A +:10B6100000988021807F084300998877EBE0012122 +:10B620000843E9E713270B26002C84D0A088FDF7F8 +:10B63000E6FD00900023A0880122194601F09AFA45 +:10B6400005460098002804D12A48274960380AF0A6 +:10B65000EAFE002D04D181202349C0000AF0E3FE58 +:10B660000098807F8007800F012859D0E86A817890 +:10B670008907890F0129A17954D049084900A1718E +:10B680008278FD255207D20F294052001143A17143 +:10B69000E322114002785207D20E1143A171DF223A +:10B6A00011404278D207920E1143A1710021E1713D +:10B6B000C1782172427900E037E00179607AD307DE +:10B6C00040084000DB0F18439307DB0F28405B0066 +:10B6D00018435207FB23D20F1840920010436072A8 +:10B6E000A07A4008400007E0BCAE00000E03000056 +:10B6F000540B002067040000CA07D20F10438A07CA +:10B70000D20F2840520049071043C90F1840890042 +:10B710000843A0720098007823286CD92621AFE056 +:10B72000A86AA4E701221143A9E7297BFE48022960 +:10B7300010D017270C26002C4AD0012911D003293C +:10B740001ED004291FD005291DD0F849F8480AF059 +:10B750006AFE23E019270726002C4CD00121A17195 +:10B7600005E00121A171E17989088900E171017E7B +:10B77000CA094906D201890E49000A4302760DE042 +:10B780000220A07106E0687B0007000F8030A071E6 +:10B79000052918D0E07980088000E071A088FDF7C5 +:10B7A0002EFD05460078212825D0232804D0E04826 +:10B7B000DE490C300AF037FEA088002101F012FAB1 +:10B7C000222128465DE0E07980088000401CE4E703 +:10B7D0000498068015E0002C01D06888A080287AA3 +:10B7E000032828D004280FD005284DD0D048CF49B1 +:10B7F00064300AF018FE0498002C068001D02780DF +:10B800006680002005B0F0BD15270C26002CDFD087 +:10B810000023A0880122194601F0ACF9050004D1EB +:10B82000C348C2492A300AF0FEFD0622A11DA869BC +:10B8300009F0DCF9DFE716270726002CC8D0A0881E +:10B84000FDF7DDFC00900023A0880122194601F0DD +:10B8500091F905460098002801D0002D04D1B44884 +:10B86000B24938300AF0DFFD2878C00601D5022041 +:10B8700000E00120A071009800782328BBD927217F +:10B880000098FDF7F4FCB6E717270C26002C9FD094 +:10B89000A088FDF7B4FC00906D7A002804D1A4487C +:10B8A000A2494B300AF0BFFD0621A01D0AF09AFC08 +:10B8B0000020A071207A032108432072FB21084058 +:10B8C0000099C97FC907490F08432072680692D5BD +:10B8D000E07904210843E071A07AE90740084000BC +:10B8E000C90F0843E17A2A0749084900D20F1143DA +:10B8F000FD22AB07DB0F10405B001843A072E80687 +:10B90000C00F114040000143E17274E710B50446D6 +:10B91000807990B08009012804D04D20834900012E +:10B920000AF081FDFFF76AF90120694608707E4838 +:10B930000AA9A0380190201D0290601C0B90684657 +:10B94000FCF786F9002804D07948784987300AF056 +:10B950006AFD0322601C0B990AF0E7FB10B010BDD2 +:10B9600010B5714CA03C002805D00146102220469D +:10B970000AF0DBFB0120207410BD10B50446FFF770 +:10B980003DF969491022A03920460AF0CEFB10BDCE +:10B9900070B50025644C00281CD06649884207D346 +:10B9A00001218904884205D363490968884201D28C +:10B9B00010250DE0062109F003F9411C07D05A4972 +:10B9C0004039C865207E80210843207600E00725A5 +:10B9D000284670BD207E4006400EF6E7F3B50020F5 +:10B9E00089B00D46029000290AD0524885421CD3E6 +:10B9F00001208004854203D34F480068854214D358 +:10BA00000998FDF7FCFB060003D03078222815D1F9 +:10BA100002E04A480BB0F0BD002D08D1B07FC1094B +:10BA200003D08007800F022801D01020F2E7B07FFA +:10BA3000C10601D4000703D5002D01D00820E9E795 +:10BA40003948007EC00712D1F07F400701D50D2094 +:10BA5000E0E7002201231146099801F08BF8070066 +:10BA600005D0B07F8007800F022802D00BE01120A4 +:10BA7000D0E7002D07D02A4639463046FFF728F890 +:10BA800002900028C6D128488C38F7F735FA040010 +:10BA900003D126492A480AF0C6FC0A2020700998DA +:10BAA000206238468830A060B07FFB218007800F7D +:10BAB000012829D0002D4CD002202071381DE060D3 +:10BAC00038780007400F20743878C006C00F6074C3 +:10BAD000A07C2A788008D2078000D20F1043A0747F +:10BAE0000840F17F01AAC907490F0843A074A8784C +:10BAF000E07469462846FFF72CF8684600792075FF +:10BB000068460078607528E001202071207B2A7843 +:10BB10008008D2078000D20F104320730840297894 +:10BB20008907C90F89000DE0E00B0020BCAE0000C2 +:10BB300053040000008001002800002002300000B3 +:10BB4000630500000843207324213046FDF78FFB76 +:10BB50000BE0032020710520207325213046FDF7DE +:10BB600086FBB07F4006400EB07703A92046FCF765 +:10BB70006FF8022805D0002803D0FD49FD480AF0DF +:10BB800052FC029846E7FFB581B00A9D06461C4666 +:10BB90001746142128460AF027FB0B980021016064 +:10BBA000F8070ED0F44920680968884239D312306A +:10BBB00028602068143068602068A8600B982168AD +:10BBC0000160B80726D56068002803D0EA490968F3 +:10BBD000884226D3029900290AD0FC3600280ED0CC +:10BBE00031461030FDF79DFC00281BD1606810E045 +:10BBF000002816D0E86080366068B0670AE0FEF77B +:10BC0000A9FA0146072230460AF08FFAFEF7F6FF3E +:10BC1000DA48E860780707D5D749A06809688842FC +:10BC200001D21020EEE528610020EBE5FFB5D44AF3 +:10BC30000E4607CA97B002AB07C3002700970197CB +:10BC40001798FDF7DCFA050005D02878262804D0DF +:10BC500008201BB0F0BDCB48FBE700231A4619466D +:10BC6000179800F087FF040004D1C248C049803013 +:10BC70000AF0D9FBA87F8007800F1690012814D006 +:10BC8000022824D0BB48BA4999300AF0CCFB0121E4 +:10BC90000022852E31D01EDC002E26D0812E26D00B +:10BCA000822E26D0832E1ED125E0002EEFD12146F4 +:10BCB0002846199AFEF70CFF0028CAD119988078F7 +:10BCC000009019980078C007C00F0190DFE719981D +:10BCD000002808D1DBE7862E11D0882E11D0892EBE +:10BCE00011D08A2E11D00720B3E710460EE0084687 +:10BCF0000CE002200AE0032008E0052006E0062010 +:10BD000004E0082002E0092000E00A20002222715D +:10BD100001216A461176211D0791002801D020716A +:10BD2000FAE0169801280CD0A66AE06A02220121E6 +:10BD300010900020A0602846173002291AD0012157 +:10BD400019E0E66AA06A1090032030702078FB2387 +:10BD5000C006C00F7070B07801221840009BF370CD +:10BD60008008019B800018430221B0700020707190 +:10BD70003071DEE70021890009190861681C022A78 +:10BD800001D0012100E00021890009190861B07883 +:10BD90008007800F01285ED1109880788007800F7F +:10BDA000012858D110980079844610984079009065 +:10BDB000169801281DD0317908A801747179017590 +:10BDC00008A8027C6046024008A8007D009908404F +:10BDD000139010433FD06C491A98884207D3012131 +:10BDE0008904884215D364490968884211D2102019 +:10BDF0002FE70CAA0DA91998FEF7ABFE08A8007C46 +:10BE000061460840307108A8007D009908407071B3 +:10BE1000D6E720463C3021460090F031169801913B +:10BE2000022834D000211A9B20460C33FFF7ABFECA +:10BE30000028DDD12046503021460090F43116987C +:10BE40000191012825D0002120461A9B139AFFF763 +:10BE50009AFE0028CCD110988078400702D4E87F61 +:10BE6000C0072BD0169902A8012914D0109909787F +:10BE70004900405A21780907490F4900C8408707FF +:10BE8000BF0F2AD0012F14D0022F0FD113E00121B0 +:10BE9000C9E70121D8E721780907490F4900405A2D +:10BEA000109909784900C8408707BF0F032F04D0B5 +:10BEB00004E0022711E001270FE00227169801286D +:10BEC0000BD1B078FB210840E97FC907490F08432F +:10BED000B07020780007400F3070207810224008A2 +:10BEE000400020701099D2434978C907C90E114308 +:10BEF00008402070C00623D4022F21D0012F21D06A +:10BF00000020A061E0612062606220461830A060DD +:10BF1000E87F40084000E877204606A98830FBF714 +:10BF200073FE002806D0022804D06F2010490001BB +:10BF30000AF079FA25212846FDF799F9002088E6CC +:10BF4000032008E020460D211B300AF04BF9204663 +:10BF50001830A060042069460875E87F0121084375 +:10BF6000E87705AA29461798FEF730FED4E70000C7 +:10BF7000BCAE00008E05000028000020400B002011 +:10BF8000606701000230000000800100F0B587B05A +:10BF900015460E0004460DD06A48854207D301209D +:10BFA0008004854206D368480068854202D210208A +:10BFB00007B0F0BD2046FDF722F9070004D038781D +:10BFC000272803D00820F3E76048F1E700231A464A +:10BFD0001946204600F0CEFD040003D15C495D48BF +:10BFE0000AF021FA0020002E05D0022E08D0012EE2 +:10BFF00011D00720DCE701216A461171A06018E02A +:10C00000234618336946A360087110222946184652 +:10C010000AF08BF80DE021461831A16069460871DD +:10C02000A061E061206260620621284608F0C8FD38 +:10C03000A0612078C10714D0400840002070022081 +:10C04000694608702046183002907030FBF7DCFD1E +:10C05000022806D0002804D03E483D4923300AF08B +:10C06000E2F925213846FDF702F90020A0E770B576 +:10C0700094B00D460646002B02D0072014B070BDC8 +:10C08000FDF7BDF8040007D02078222802D3A07F56 +:10C09000400603D40820F1E72C48EFE7002D19D023 +:10C0A0002D216846017046801022294601A80AF019 +:10C0B0003CF8E07F297C4008C9074000C90F0843CD +:10C0C000E077297C40078906400FC90EC900084364 +:10C0D000E07703E02E2168460170468009A9684692 +:10C0E000F6F741FF694609782D2905D1002803D1CB +:10C0F000A17F10221143A177A17FBF221140A17718 +:10C10000BCE710B50C46FDF77AF8002805D00E49BB +:10C1100009688C4203D2102010BD0C4810BD214686 +:10C12000FFF762F8002010BD05E00278401C002AED +:10C1300001D0002070470A46491E89B2002AF4D176 +:10C14000012070470080010028000020023000001C +:10C15000BCAE00000F07000030B50346072903D02E +:10C160000820DA781C7916E00720FAE707290BD0B7 +:10C170005500ED186D79072D01D0401EC0B2521C3C +:10C18000D2B20F2A07D105E05500ED186D79072DC1 +:10C19000F3D0F4E700222546641EE4B2002DE5D179 +:10C1A00030BDFFB581B00C461646114620460A9FA9 +:10C1B0000B9DFFF7D1FF00280AD020790F2803D369 +:10C1C000FEA1A0200AF02FF9A078C00907D019E03D +:10C1D000072E02D0112005B0F0BDFD48FBE7019805 +:10C1E0002880381D6880002068712871EF800498CD +:10C1F00028812846F6F7DFFE002803D1EFA1AD2005 +:10C200000AF011F9E07821794018491CC0B2217177 +:10C210000F2801D30F38C0B2400000194671817950 +:10C22000F12249084900114081710020D3E7FFB590 +:10C2300083B01C4616460F4600231A4602210C9D69 +:10C24000039800F097FC010008D033463A46019568 +:10C2500000940398FFF7A5FF07B0F0BDDC48801EEF +:10C26000FAE7F0B5054616460F4650888DB0002314 +:10C270000122022100F07EFC040003D1CFA1DF20C7 +:10C280000AF0D1F8002069460871A078400603D171 +:10C29000CAA1E3200AF0C7F8042F5ED32A78D0079A +:10C2A000C017401C06D161786B78994255D121782E +:10C2B000090752D00121142A46DA012A42D0122A53 +:10C2C00002D0132A40D128E00C2F3DD1A27852068B +:10C2D000520E012A38D0207800090001401C20703D +:10C2E000687860706846017168792A7901021143A3 +:10C2F00068460181E879AA790102114368464181C3 +:10C30000687A2A7A0102114368468181E87AAA7A1A +:10C31000010211436846C1811AE0062F14D120782A +:10C320000009000120707188012001F0C8F8022185 +:10C3300068460171C91E018168792A790102114399 +:10C3400068461FE0062F0AD06A461279002A1BD0E1 +:10C350007088324601A9FDF77AFD0DB0F0BD207856 +:10C360000009000120707188012001F0A8F8022165 +:10C370006846017168792A79010211436846018192 +:10C380000021C9434181E3E70028E6D0748868466C +:10C3900081766978C176022181830021C18304A856 +:10C3A00005220090062311462046FFF740FF002893 +:10C3B000D3D088A1D6200AF036F8CEE7F7B58CB0F6 +:10C3C00015460C990D98F9F7CEF9C0B2082851D14D +:10C3D000002069468885688800230122022100F038 +:10C3E000C9FB040004D1FF2074A163300AF01BF8DC +:10C3F00001230021E07822790BE046003619767996 +:10C400009E4201D1491CC9B2401CC0B20F2800D1C4 +:10C4100000201646521ED2B2002EEED1002902D1C3 +:10C4200017206946888504AB02330BAA00950C9946 +:10C430000D98F7F73BFC0006000E07D002281BD032 +:10C44000032817D0FF205DA1893011E06846808D58 +:10C4500000280FD002A901910090688804230122CE +:10C460002146FFF79EFE002804D0FF2053A176301E +:10C4700009F0D9FF0FB0F0BD68781021084368704B +:10C48000F8E70020584902464300401CCA520828D9 +:10C49000FAD3704700218170017809090901017000 +:10C4A00000214170C1700171704770B50D460023C5 +:10C4B0000122022100F05EFB040004D1FF203FA115 +:10C4C000CF3009F0B0FFA0786906C009C001490E5D +:10C4D0000843A07070BD704710B50146012000F000 +:10C4E000EEFF10BD3EB58DB2002301220221284689 +:10C4F00000F040FB040004D1FF2030A1E43009F03B +:10C5000092FF20786946000900012070022008701F +:10C5100036488880C88000222846FDF798FC3EBD3A +:10C52000F7B505460078002700090C463E4601286D +:10C5300004D0FF2021A1F33009F075FF287A0328E9 +:10C540000CD041201DA1C00009F06DFF0298002C05 +:10C55000068001D0278066800020FEBDEA89702712 +:10C5600010460A3086B2002C0AD06888A080A889BC +:10C570002081E28020460A30296909F0D6FDE5E7EE +:10C5800002980680E8E7F8B543680246D9799C79B5 +:10C59000090221435C7A1E7A25025C88981D354386 +:10C5A000241FA14238D11B79022B35D1042D34D060 +:10C5B000052D3DD0062D34D0402D19E07372635CFB +:10C5C0006C326361705F636F72652E630000000000 +:10C5D000043000007372635C6C326361705F636F80 +:10C5E00072652E6300000000000C0020FFFF0000B9 +:10C5F00012D3061D0F461446284600F0E9F9082814 +:10C600000AD01120207003202072A581E7812661C5 +:10C610006078082108436070F8BD001DFFF7CEFE6A +:10C62000F8BD031D50880A461946FEF7C4FEF8BD42 +:10C63000001DFFF716FEF8BD70B50D4600238CB047 +:10C6400006461A46022100F095FA040031D02078FF +:10C650000007000F01282ED01220694688746078E8 +:10C660000523801CC874082088822888C8826888AE +:10C670000883A8884883E888888302A90C20019150 +:10C6800000901A4621463046FFF78BFD00280ED158 +:10C69000F02300223146012000F06CFE20780009D2 +:10C6A0000001401C20706078801C607000200CB07D +:10C6B00070BDCD48FBE71120F9E770B50D460023AA +:10C6C0008CB006461A46022100F054FA040006D047 +:10C6D00020780007000F012803D00820E7E7C248B0 +:10C6E000E5E71321684681746178C1740221818273 +:10C6F000C58202A906200523019100901A46214611 +:10C700003046FFF74EFD0028D1D120780009000106 +:10C7100020700020CBE7F3B581B00D460023012245 +:10C720000221019800F026FA00260446002803D1D1 +:10C73000AE49AF4809F077FE2079A8423BD2AC4819 +:10C74000AA49401C09F06FFE35E0E07841000F195E +:10C75000401C7979C0B20091E0700F2801D100200F +:10C76000E0702079401E2071B879C00708D0009889 +:10C770000199042815D09D498220183109F053FEF3 +:10C78000B8790007410F08D0400F019904280CD058 +:10C7900096498F20183109F046FE009807280AD1E3 +:10C7A00007E00846FEF784FEEAE70846FEF753FE78 +:10C7B000F3E7761CF6B228466D1EEDB20028C4D110 +:10C7C0003046FEBD10B500230122022100F0D2F94F +:10C7D000040004D1B5208549800009F024FEE078EA +:10C7E00021794018C0B2E0700F2801D30F38E070F3 +:10C7F00000202071A07880210843A07010BDF8B5FA +:10C8000017460D4600231A46022100F0B3F9040032 +:10C8100005D0002D0CD0002F07D0062006E0072DF4 +:10C8200001D00820F8BD0720F8BD0820A84204D890 +:10C830006F486E49423009F0F6FD29462046FFF761 +:10C840008BFC0646002F28D0002E26D1E0782179D7 +:10C850001CE0420012195379072B03D093791B0770 +:10C860005B0F04D0401CC0B20F280CD00CE040007D +:10C8700000198079F12318406B071B0F1843907142 +:10C8800000290AD104E00020491EC9B20029E0D1E4 +:10C89000574856495A3009F0C6FD3046F8BDF8B53C +:10C8A0000D4600231A46022100F064F9040004D169 +:10C8B0004F484E49683009F0B6FD681E052804D37C +:10C8C0004B484A49693009F0AEFD0F21E2782079E2 +:10C8D000002310E0560036197779AF4206D1B179BE +:10C8E00049084900B1715B1CDBB21146521CD2B23F +:10C8F0000F2A00D100220646401EC0B2002EE9D108 +:10C900000F2905D248000019817901221143817154 +:10C910001846F8BD10B50446402801D2072010BDC6 +:10C9200000F056F8082802D03120000210BD002186 +:10C93000304802E0491C082903D24A00825A002AE2 +:10C94000F8D1082903D049004452002010BD04202A +:10C9500010BD10B5402801D2072010BD00F038F8F6 +:10C96000082805D00021234A40001152084610BD76 +:10C97000052010BDF0B58BB016460C00074607D059 +:10C98000002E05D06188402904D207200BB0F0BDED +:10C990001020FBE72088002801D0172801D90C209F +:10C9A000F4E7084600F014F808280FD0258803A8FB +:10C9B0002A463146023009F0B8FB01A8009062888F +:10C9C0002B4607213846FFF732FCDFE70520DDE77D +:10C9D00001460020074A02E0401C082803D2430019 +:10C9E000D35A8B42F8D1704702300000BCC500001A +:10C9F000AD020000000C0020F8B50546E54C079E8E +:10CA0000069821706270A370E6702071681C42085D +:10CA10005200E14B0021880000198446C261605C2D +:10CA200040008218002D0AD0002005E0664647002D +:10CA3000F669401CF353C0B2665C8642F6D8491CC6 +:10CA4000C9B20529E7D30026D21C9708B000BF0061 +:10CA500000198760304600F042F9A15D761C48431A +:10CA6000C219F6B2052EEFD3501B80B2F8BDF0B557 +:10CA70000546C84F8C460020FF247E5DA9009646DF +:10CA80000346CF190CE0F9695A008A5AC2498A4212 +:10CA900004D1401CC0B2FF2C00D11C465B1CDBB291 +:10CAA0009E42F0D86146002909D100280BD0002D04 +:10CAB00007D0B84949788E4203D2401EC0B2002840 +:10CAC00001D071460C70F0BD70B5B24C8D000023E2 +:10CAD0002D19615C09E0EC695E00A45B844202D11F +:10CAE0001370012070BD5B1CDBB29942F3D80020AB +:10CAF00070BDFEB51C4617460D46060008D0002D39 +:10CB000006D0F01C80088000B04203D01020FEBD8B +:10CB10000E20FEBD002F03D0002C01D0A74201D96A +:10CB20000720FEBD0094234622463946002001948A +:10CB3000FFF762FF2988814207D0814201D2042198 +:10CB400000E0092128800846FEBD009423462246C5 +:10CB5000394630460194FFF74FFF28800020FEBD84 +:10CB600010B5044600F0C5F8002801D0E0B210BDB1 +:10CB7000FF2010BDFFB50546874881B01E460C4614 +:10CB8000854204D0052C02D20398022802D300204B +:10CB900005B0F0BD002769460F7028466A46214659 +:10CBA000FFF792FF00280ED068460178204600F07B +:10CBB000A8F8002EECD00028EAD1284600F099F819 +:10CBC000002809D103E03846002EF6D1E0E7FF2027 +:10CBD00072A15C3009F027FC21462846039A00F038 +:10CBE0009CF8D5E7F8B505460C4600206A4E694624 +:10CBF0006E4F0870B5423BD0052C01D30720F8BD1D +:10CC00000A4621462846FFF75FFF002830D06846D5 +:10CC10000178204600F075F8230009F0F5FC0504C2 +:10CC2000090C11161B0001462846FEF7D5FA15E03F +:10CC3000FDF7E0FA12E001462846FFF74CFC0DE054 +:10CC400001462846F6F7B5FF08E001462846F8F702 +:10CC500012FC03E056A17B2009F0E5FB4D4A684633 +:10CC6000A10000788918C96940000E520020F8BD63 +:10CC70003846F8BD524A1268914201D210207047DE +:10CC8000052801D3072070470872002048727047BA +:10CC9000F8B504464A480068844201D21020F8BD25 +:10CCA000207A3C4A83009B18617A3B4D125C11E06C +:10CCB000DE694F00F65BAE420AD04A1C6272DA6946 +:10CCC0004B00D25A228000F01CF860600020F8BDB2 +:10CCD000491CC9B28A42EBD861720520F8BD0EB575 +:10CCE000384B40000ECB0091029301926946085ADE +:10CCF0000EBD28494978814201D9012070470020A2 +:10CD0000704770B50C460546FFF7E9FF214AA900B8 +:10CD1000891889686043401870BDF8B50C4606460E +:10CD200000206946134608706A4619462046FFF7F8 +:10CD30009EFE002500282BD0164A6846A1000078E8 +:10CD40008918C96940000E52684601782046FFF7ED +:10CD5000D8FF0546230009F057FC0504090C0F1401 +:10CD6000170029463046FEF713FA11E0FDF720FAC6 +:10CD70000EE0FFF78FFB0BE029463046F6F7E0FEAA +:10CD800006E0F8F771FB03E009A1622009F04BFB14 +:10CD90002846F8BD100C0020FFFF00007372635C92 +:10CDA000686F73745F636D2E6300000002300000D3 +:10CDB0007372635C686F73745F636D2E6300000051 +:10CDC000280000206C67010010B5014620220948A8 +:10CDD00009F0ABF907490020C877084610BD06499D +:10CDE000012048610548064A0168914201D10021AD +:10CDF00001607047400C00200005004078000020D2 +:10CE0000BEBAFECA8107C90E002808DA0007000F63 +:10CE100008388008C24A80008018C06904E0800891 +:10CE2000C04A800080180068C8400006800F704724 +:10CE3000BD4948788978884201D3401A02E021220E +:10CE4000511A0818C0B27047B74923314878897819 +:10CE5000884201D3401A02E02122511A0818C0B2B8 +:10CE60007047B149463148788978884201D3401AE1 +:10CE700002E02122511A0818C0B27047A94910B522 +:10CE80000C310868FF22120290430122D2031043A2 +:10CE90000860A54900202331487088702339487004 +:10CEA0008870463148708870A04808F0C8F89F48DC +:10CEB000401C08F0C4F8F5F741FC00F028F910BD5B +:10CEC00020207047B4E770B50C4605460026FFF7F2 +:10CED000AFFF9549A04214D30A46203A00232046CA +:10CEE000641EE4B200280BD08878105C2870887823 +:10CEF0006D1C401CC0B288702128F0D18B70EEE709 +:10CF0000012600F004F9304670BD202070479BE7F1 +:10CF100070B50C4605460026FFF796FF824923317F +:10CF2000A04214D30A46203A00232046641EE4B2ED +:10CF300000280BD08878105C287088786D1C401C05 +:10CF4000C0B288702128F0D18B70EEE7012600F086 +:10CF5000DEF8304670BD202101700020704710B50A +:10CF60000446FFF77EFF2070002010BD70B50C4610 +:10CF70000546FFF776FF6C494631A04215D30A46B5 +:10CF8000203A00232046641EE4B200280BD08878A3 +:10CF9000105C287088786D1C401CC0B288702128F5 +:10CFA000F0D18B70EEE7002400E0614C00F0AFF8A8 +:10CFB000204670BD70B50C460546212904D9FF20D6 +:10CFC0005CA1473009F02FFA55484068103840B24C +:10CFD000FFF718FFC6B20D20FFF714FFC0B286425C +:10CFE00007D2FF2053A14D3009F01DFA01E0F5F7FB +:10CFF000E8FB21462846FFF766FF0028F7D070BD02 +:10D00000F8B507464948484C401E474E007825462B +:10D0100046362335002806D1A9786878212200F009 +:10D020006BF800280ED0A1786078212200F064F817 +:10D03000002814D0B1787078212200F05DF8002823 +:10D0400028D033E038496878C91C0F546878401CF0 +:10D05000C0B26870212829D10020687026E03249CA +:10D06000607820390F546078401CC0B2607021286D +:10D0700001D1002060702D4F7F1E3878002815D018 +:10D08000A1786078212200F037F800280ED0002027 +:10D0900038700BE02449707826310F547078401CAA +:10D0A000C0B27070212801D100207070A978687812 +:10D0B000212200F021F800281DD0A17860782122DB +:10D0C00000F01AF8002816D0B1787078212200F00C +:10D0D00013F800280FD0F5F756FB144807F0B7FFF8 +:10D0E00001214903884203D016A1C12009F09BF910 +:10D0F0000E4807F0C4FFF8BD401C884205D090429E +:10D1000001D1002901D0002070470120704710B5DF +:10D11000064807F09CFF002801D1F5F723FB10BD5E +:10D1200000ED00E000E400E0800C00207D00002025 +:10D13000072000007372635C736F635F72616E64DB +:10D140002E6300007372635C736F635F72616E6461 +:10D150002E6300000C4908784A78401CC0B2904207 +:10D1600000D008707047094A074820BF40BF20BF61 +:10D170004178037843701368002B02D103788B4207 +:10D18000F3D00020704700007F00002000E200E0A4 +:10D19000FEB5F34C07466068FF213E0181552178BA +:10D1A000FF2913D00901083141583246491E08327F +:10D1B00009020192090A805800F0C8F9002802D03B +:10D1C0002478254615E06168207888552770FEBDD3 +:10D1D000E34842680198115828010090083010581F +:10D1E00000F0B4F9002806D1DD482C4641680098CB +:10D1F0000D5CFF2DECD1DA4821014068855547547C +:10D20000FEBD70B5D64A04460020157A53680AE080 +:10D210000201561C9E5DA64203D10C329A588A42E6 +:10D2200004D0401CC0B28542F2D8FF2070BDF8B5D2 +:10D23000CB4F3E7801F013FE0146FF2E68D034013B +:10D24000254678680835405900F080F9022802D94F +:10D25000786840595AE0C2494868025D0A70A11CCA +:10D26000425C002A0CD0521E425441590122D20580 +:10D2700089180902090A41513046FFF789FF30E059 +:10D28000631CC25C0092221D94468258002A10D072 +:10D2900001239B029A420FD99205920D43595703DD +:10D2A000DB191B021B0A43516346C3589A1A920AA0 +:10D2B00009E0FF21C1540AE0435952039A181202AF +:10D2C000120A4251002242543046FFF761FFA4483F +:10D2D0000C344168C26800980959800012580098BF +:10D2E00090479F4C2078FF2812D001F0B8FD0146EE +:10D2F0002078626800010830105800F027F90128F2 +:10D3000096D92078616800010830085801F09AFD2C +:10D31000F8BDF8B51C4615460E460746FF2B03D34D +:10D3200090A1D32009F07FF88D48FF21C7604560A8 +:10D3300004720674017000224270104604E002017B +:10D34000521C401CA954C0B2A042F8D3F8BD70B51D +:10D35000834C06466578207C854203D381A1E62074 +:10D3600009F061F8E068A90046506078401C6070E0 +:10D37000284670BDFFB581B01D46FF2401F06FFD4A +:10D38000774F064679780198814203D875A1F42039 +:10D3900009F049F872480021037A406810E00A0158 +:10D3A0009446521C825CFF2A24D0019FBA4205D1C8 +:10D3B00062460C328758029A97421DD0491CC9B266 +:10D3C0008B42ECD8FF2C17D021014B1C019AC25480 +:10D3D0000B33029AC250039B614F0022012B0ED0E7 +:10D3E0000B1DC25001239B029D4216D9AA05920D26 +:10D3F00008D008E00C46E1E7FF2005B0F0BD0B1DAA +:10D40000C550EFE71A4653039B190E461B02083618 +:10D410001B0AAA1A8351920A09E0002D00D10125A6 +:10D420006B039B191D022D0A0B460833C550891C3E +:10D4300042543D463E782046FFF7AAFE2878B04287 +:10D4400015D001F00CFD014628786A68000108300B +:10D45000105800F07BF8012807D928786968000186 +:10D460000830085801F0EEFC01E0FFF7E0FE0198FB +:10D47000C3E770B50C46054601F0F1FC06462146AF +:10D480002846FFF7BEFEFF2817D0354D0401204681 +:10D49000696808300858314600F058F8012109033E +:10D4A00040186968A41C095D400B002901D089025D +:10D4B0000818002800D1012070BD002070BDF3B510 +:10D4C00081B00F460198FFF79CFEFF282AD0244D1B +:10D4D0002E7869683246344604E0844205D02646F8 +:10D4E0002301CC5CFF2CF8D11CE0FF2C1AD0A64203 +:10D4F0001FD11001085C2870FF2818D001F0AFFC84 +:10D500002A780146120168680832805800F01EF837 +:10D51000012809D92878696800010830085801F005 +:10D5200091FC06E00020FEBDFFF781FE01E001F066 +:10D5300091FC39460198FFF79CFF22016968FF239F +:10D54000541C0B558A5C3301CA54FEBD401A0002BC +:10D550000121000AC905884200D900207047000057 +:10D56000CC0C00207372635C736F635F74696D65CC +:10D57000722E6300F0B500241C4A01211C4B0803E5 +:10D58000546018601B4B1C601B4C20601B480469D6 +:10D59000E443E406E617046910252C430461184CA3 +:10D5A0006160184D2960761C00E020BF1F68002FC5 +:10D5B000FBD0002E03D107691026B743076190689E +:10D5C0008005906801D5104A10436960A160002170 +:10D5D00019600121084A09031160F0BD10B5044625 +:10D5E000FFF7C8FF2060002010BD000000C500400C +:10D5F00080E100E000C1004080E200E000ED00E0DA +:10D6000000C3004000C0004000FCFFFF70B51F4990 +:10D610000A68002A17D000231D4601244A68521CBC +:10D620004A60092A00D34D600E792246B2400E6846 +:10D6300016420AD072B60B6893430B6062B6496813 +:10D640000160002070BD052070BD5B1C092BE5D377 +:10D650000FA1362008F0E7FEF5E70120104980050C +:10D6600008607047EFF31081CA07D20F72B601212C +:10D6700081400648036819430160002A00D162B660 +:10D68000EBE7024800210160416070478400002000 +:10D690007372635C736F635F6576742E6300000062 +:10D6A00000E200E001208107086070470120810747 +:10D6B000486070471048C068C00700D0012070471C +:10D6C0000D488068C00700D0012070470A484069B3 +:10D6D000C00700D0012070470748C069704706495D +:10D6E0008A69D20306D589698907890F814201D1E8 +:10D6F000012070470020704700040040F8B5F84C46 +:10D70000207BE17A88421CD00126F64D0027E07A82 +:10D71000215C14200A4642435019037C052B11D08A +:10D72000037C062B1CD0037C072B28D0437C012BC9 +:10D7300033D0EDA1EF4808F076FE207BE17A8842F5 +:10D74000E5D1F8BD0674E07A0A2807D0E07A401CDB +:10D75000E072491CC8B2AA5802210CE00020F7E789 +:10D760000674E07A0A2808D0E07A401CE072491C6E +:10D77000C8B2AA5803219047DFE70020F6E70674F5 +:10D78000E07A0A2807D0E07A401CE072491CC8B24F +:10D79000AA580821EFE70020F7E74774E07A0A2843 +:10D7A00007D0E07A401CE072491CC8B2AA58072191 +:10D7B000E1E70020F7E770B50024CF4E0620707235 +:10D7C000CE4825464477047738300473C472CC4879 +:10D7D00007F035FCCB480575F572CB49601E8860B3 +:10D7E0007571B570F57035717570C848643905701C +:10D7F00045701420604340180574641CE4B2052C85 +:10D80000F7D30120F5F764F80020F5F761F801205F +:10D81000B071F4F727FDBE48F4F736FDBD4C20701B +:10D82000BD48F4F731FD6070F4F7F2FF70BD10B53C +:10D83000F5F719F8B74C2078F4F744FD6078F4F761 +:10D8400041FDAD4C207A002803D0F4F7CAFD00203A +:10D85000207210BD70B5A84CA079002804D0A2A1F8 +:10D86000AE4808F0E0FD70BDE07A002803D19EA12B +:10D87000AB4808F0D8FD0126A6710025E572607A54 +:10D88000042114225043974A801801749E488168ED +:10D89000491C04D0691E81600120F5F719F80020A9 +:10D8A000F5F716F8F4F7FAFF07F00AFDF5F7FBF8BD +:10D8B0009C480560056001209B49C0030860F5F79E +:10D8C00071F992480078022804D0032804D1E07846 +:10D8D000002801D0A67000E0A570F5F7D0F870BD63 +:10D8E000034680490520142242435218203A127FF1 +:10D8F000002A04D0401E0006000EF4D17047142206 +:10D90000424351180A46803AD366012220390A77E9 +:10D910007047012805D0032805D1002903D1002034 +:10D9200070470029FBD010B4734C00236370774A12 +:10D93000002890700CD002280AD007291AD20800BB +:10D9400078440079001887441505070D0F1113005E +:10D95000D37003E01B2000E03A20D07001206070FB +:10D9600010BC70475820F8E77720F6E79620F4E7D8 +:10D97000B520F2E710BC0020704710B5634840782E +:10D98000F5F798F880B210BD411E1422504310B52F +:10D99000544A8418203C042902D8207F002803D14F +:10D9A00051A1624808F03FFD207F012804D0B32038 +:10D9B0004DA1800008F037FD0020207710BD70B524 +:10D9C0004E4C607F217F884201D1012500E0002577 +:10D9D000F5F709F8F5F76EF8617F227F914201D1E2 +:10D9E000012100E00021A942EBD170BDF7B5074647 +:10D9F000481E84468EB0C0B2142205905043394A66 +:10DA000085180495287C2D1D07282AD1344C002622 +:10DA1000E07A227B824221D0235C059A934201D195 +:10DA2000012601E0002E04D00A2811D0421CA25C7D +:10DA300022540A280ED0401C227BC0B28242EBD175 +:10DA4000002E0BD0207B002806D0207B401E04E057 +:10DA50000022ECE70020EFE70A202073049A01205F +:10DA600010746046244C042813D8142041431D48E8 +:10DA700008182038007F00280BD00498007C01286B +:10DA80000BD00498007C012803D01098807A0128DC +:10DA900007D015A1264808F0C6FC1098807A012806 +:10DAA0006FD104980F4B007C022845D00C4C207B92 +:10DAB0000A2872D0207BE17A401C884203D10AA157 +:10DAC0001C4808F0B0FC049901204874217B05989B +:10DAD0006054207B0A2864D0207B401C20731CE10A +:10DAE000D80D0020E80D00207372635C72656D2E06 +:10DAF00063000000CF0500006C0E0020A00D002088 +:10DB0000780E0020C00D00204C0E00208E0000205A +:10DB10002FD200008C000020FDD600007D02000006 +:10DB20005E02000000F5004080E200E0CB02000051 +:10DB30001503000022030000607A059A0146904216 +:10DB400006D0014614267043C018807C9042F8D15C +:10DB5000627A824208D1617A14225143C918897CC1 +:10DB600061720121A17207E014224243D2181426E7 +:10DB70007143927CC9188A74142206215043C0183C +:10DB800081741098007A062819D201007944097925 +:10DB900049188F440812100E0C0AE07A00288ED023 +:10DBA00091E700209AE700200FE0B4200DE07320F9 +:10DBB0000BE0322009E00A2007E0062005E0FF2004 +:10DBC000FDA1E03008F02FFC0020029010980168C1 +:10DBD0000298081A28601099097A002912D00221A7 +:10DBE000401A0102090A296010980268406810185A +:10DBF0000002000A68601098807A0228109803D00A +:10DC0000007B74E00421EBE7007A002813D00222A5 +:10DC1000029810188446109842686046083016181A +:10DC2000E848029A4078904202D9E278002A04D06B +:10DC30003046083005E00422EAE7029A801A80198B +:10DC40000830627A062A1CD0627A14235A43DE4BCB +:10DC5000D2185268914214D0DC4B0793617A142297 +:10DC60005143D94A89184A688968D21BC91B1202D4 +:10DC70000902120A090A90423AD89A4238D89942BF +:10DC800036D83818801B0002000A286010996044BA +:10DC9000CF4AC9680002000A9446421A01239B0534 +:10DCA00007929A4201D2104614E00A1A09929A4247 +:10DCB00001D207980EE0079A6346624503D9591AC4 +:10DCC0000818401C06E0099A624506D9181A40183F +:10DCD000401C4042002860DC03E0B7A1BD4808F0CA +:10DCE000A2FB286880190002000A686000202872E0 +:10DCF0006868082608300002000A68601098407AB8 +:10DD0000A8721098007A687203280ED200280CD0EE +:10DD1000FFF7D0FC002803D007E0002011B0F0BDD1 +:10DD200002983A210E1A32200290A6480178012961 +:10DD300001D0032909D141780298814205D9E078C0 +:10DD4000002802D10298081A861928689F4AC01B29 +:10DD5000844601026868090AC01B03021B0A029379 +:10DD60008E421AD81346914217D80299994214D874 +:10DD7000617A062915D0667A6146062203920092DE +:10DD80001422914B7243D2189368DB1B8B4216D836 +:10DD90000396967C062EF3D177E0059801F055F9AD +:10DDA000BBE70499022205980A74627A062A00D019 +:10DDB000627A8A7460720120A07211B0F0BD062EE2 +:10DDC00063D000223146944614227F4B4A43D21836 +:10DDD0005368DB1B834229D2917BAB7A99421FD8CF +:10DDE00004980521059C01747B4D287B0A2811D0DD +:10DDF000287BE97A401C884203D16FA1774808F05C +:10DE000012FB287B2C54287B0A2807D0287B401C37 +:10DE1000287382E7E87A0028EFD0F2E70020F7E7DE +:10DE200001218C46917C0629CED102E06046002873 +:10DE30002AD03546009114202A46424362480621E2 +:10DE4000171839741038007B0A28634816D0017BF4 +:10DE5000C07A491C814203D157A1614808F0E3FA16 +:10DE60005D48017B4554017B0A290BD0017B491C8D +:10DE70000173BD7C0098A842DDD106E0C07A00287D +:10DE8000EAD0EDE70021F3E70096049902204E4D19 +:10DE90000874607AB04207D1049900988874059894 +:10DEA00060720120A07221E00398062E0FD0062890 +:10DEB00003D141A14B4808F0B6FA0398142250430D +:10DEC0004019059981740499009888740EE0062819 +:10DED00003D139A1444808F0A6FA0398142250430C +:10DEE000401905998174049906208874012011B0A5 +:10DEF000F0BD70B50D463D4A441900210B46101A7D +:10DF00008B4103D22CA13A4808F08DFA394885425A +:10DF100003DD29A1384808F086FA3848854203DA3B +:10DF200025A1374808F07FFA3648844205DA002CEC +:10DF300001DB204670BD334800E03348201870BD37 +:10DF4000401E70B5C0B2142148431F494418607B7D +:10DF5000062813D201007944097949188F44020C2C +:10DF60000A080604002068E0B42010E073200EE0E8 +:10DF700032200CE00A200AE0062008E0FF200EA173 +:10DF8000E03008F050FA617B0020002955D00221D2 +:10DF90004018616840180002000AF4F78BFD0C2558 +:10DFA0006557124A441900210B46101A8B412FD293 +:10DFB00001A10F482AE000007372635C72656D2E48 +:10DFC000630000008E000020E80D0020FFFF3F00EE +:10DFD000FFFFFF000E070000D80D00200702000021 +:10DFE000C5030000DD030000E3030000FF7F841E83 +:10DFF000F50300000020A107F603000000E05EF832 +:10E00000F70300000080841E00807BE108F00BFA1B +:10E01000FB48854203DDFB49FB4808F004FAFB4856 +:10E02000854203DAF749FA4808F0FDF9F9488442D5 +:10E0300007DA002C03DB204670BD0421A8E7F54871 +:10E0400000E0F548201870BDF0B5064683B0F348EF +:10E050000190457A029534687068001B0702F04809 +:10E060003F0A001B0090062D2DD014202946414365 +:10E07000EC480122081884464168E9489205864622 +:10E08000081B904210D3631A93420DD30246704688 +:10E09000724503D900984018401C05E073450ED91D +:10E0A000411A0819401C404200280CDA60460295CB +:10E0B000857C0198C0790028D5D003B0F0BDD14946 +:10E0C000D94808F0B0F90298854226D01421484377 +:10E0D000D4490123401802908068D1499B058C46A1 +:10E0E000011B8646994210D3221A9A420DD36346E9 +:10E0F000614503D900997144491C06E019466245FF +:10E100002DD9091A0819401C4142002905DD029841 +:10E11000B17A807B814200D37446062D15D0C14967 +:10E120001420454368184268121B1202120ABA42B0 +:10E130000BD2B37A827B934200D38468857C0198AA +:10E14000C0790028B9D1062DEAD13068A042B4D0F8 +:10E15000E0190002000A3460706003B0F0BDA94904 +:10E16000B14808F060F9D8E7F0B5B049044648680E +:10E1700085B0C005C00D1CD0103840B200280CDAA4 +:10E180000207120F083A920892005118C9698007D5 +:10E19000C00EC1400806800F09E08108A44A89002A +:10E1A000891809688007C00EC1400806800F002842 +:10E1B00008D000272078002806D0012804D00020AD +:10E1C00005B0F0BD0127F5E72079062813D201003C +:10E1D0007944097949188F44020C0A080604002082 +:10E1E00018E0B42010E073200EE032200CE00A208A +:10E1F0000AE0062008E0FF208249E03008F013F929 +:10E2000021790020002905D002214618834D002FD6 +:10E2100002D003E00421F8E70020E871694602AA71 +:10E22000A068F4F751FC694608228A56E06801A903 +:10E2300080180122C01C1F2801DA019209E003AAFC +:10E24000F4F742FC6846007B002802D00198401C8D +:10E25000019000990198401808300002000A0190CE +:10E26000881B0002000A0090607969468872009855 +:10E270000390F4F7B8FB009A019B121A181A6D4923 +:10E2800012020002120A000A8A4216D8884214D8E2 +:10E290006846FFF7D9FE00990398814205D0881996 +:10E2A0000002000AF4F706FCA0600120E9790029C9 +:10E2B00086D0002FB0D005B0F0BD0020F6E7F3B552 +:10E2C0008FB05D480C460B9006F0C1FE5B4A0F997B +:10E2D000524F56185A4D203E00280BD05948007D09 +:10E2E000002803D058A15B4808F09DF82078012849 +:10E2F0007ED060E1687F0A280CD0687F297F401CAF +:10E30000884203D150A1544808F08DF820780128A4 +:10E3100004D00CE0287F0028F4D0F7E7F07F002835 +:10E3200003D049A14D4808F07EF80120F077697FBD +:10E330000F9814224A4E51438919087420780228F4 +:10E3400022D0687F14214843861920793072607981 +:10E35000707232460C323146A068F4F7B5FB0C20DF +:10E3600030560F2804DD1F3830733068401C306091 +:10E370000C217156301DE26801905018C01C1F28F6 +:10E3800070DA01200199FDE028494868C005C00DF8 +:10E3900021D0103840B200280CDA0207120F083AD8 +:10E3A000920892005118C9698007C00EC140080642 +:10E3B000800F09E081081E4A8900891809688007D2 +:10E3C000C00EC1400806800F002804D105201EA100 +:10E3D000000208F028F8687F1421484386190021BC +:10E3E000E0686A460691117006A9F4F76DFB00E03B +:10E3F000D7E06A46002010560F2834DD012033E0B4 +:10E400000020A107B8DF0000F603000000E05EF87E +:10E41000F70300000080841E00807BE16C0E00206A +:10E42000FFFFFF00E80D00200E07000000ED00E0F8 +:10E4300000E400E0FFFF3F00780E00209200002083 +:10E44000A00D0020C00D00207372635C72656D2EFC +:10E450006300000011050000EF040000F404000058 +:10E46000E00C002082E0002006994018079002206E +:10E47000B0722079307260797072A068311DC01C52 +:10E4800006911F2801DA012009E0F4F71DFB684618 +:10E490000078002804D0069806990068401C08609F +:10E4A000307A062813D201007944097949188F443B +:10E4B000020C0A08060400200FE0B4200DE07320CF +:10E4C0000BE0322009E00A2007E0062005E0FF20EB +:10E4D000FD49E03007F0A7FF00202179002943D053 +:10E4E00002214018069071680830081807990890B2 +:10E4F00009180698081A0C900020F871F4F773FABE +:10E5000004463060079820180002000AF060787A0C +:10E51000062825D0797A14204143EC480818406831 +:10E520000899029040180002000A0390707A694628 +:10E53000887402A8FFF788FD0299039A091B121B31 +:10E5400009021202E24B090A120A0C98994207D8F2 +:10E55000824205D80299069808180002000A306025 +:10E56000F8790028C8D110E00421BAE704AA01997B +:10E57000F4F7AAFA6846007C002804D001980199B3 +:10E580000068401C08602078B072687F0A2806D0B6 +:10E59000687F401C68770B9806F071FD47E000200B +:10E5A000F8E7F07F002804D0A320CAA1C00007F03C +:10E5B0003AFF0120F077CA490F98087420780228A2 +:10E5C00003D1C4A1C74807F02EFFC54E2079307291 +:10E5D0006079707232460C323146A068F4F774FAF2 +:10E5E0000C2030560F2804DD1F3830733068401C73 +:10E5F00030600C22B256301DE16801908818C01CB2 +:10E600001F2802DA012001990BE003AA0199F4F70F +:10E610005BFA6846007B002804D0019801990068E5 +:10E62000401C08602078B072AD4901200875687FF1 +:10E63000297F884224D07C7A062C23D0F4F7D3F9A2 +:10E6400014214C43A14961180A7C042A18D00A7C81 +:10E65000032A15D04B6889681B1A081A1B0200028E +:10E660009B4A1B0A000A082B0AD31146934207D87B +:10E67000884205D8687F297F884201D0F4F7FFF9E6 +:10E6800011B0F0BD687F297F8842F7D111B0F0BD8D +:10E6900010B50020F4F709F910BD10B50120F4F70A +:10E6A00004F910BDF1B5009802281ED08E4C607A96 +:10E6B000062803D187A18D4807F0B5FE0026A67174 +:10E6C0000125E572607A03211422804F5043C0195E +:10E6D0000174F4F7D9F9009800280BD0012829D04B +:10E6E000032879D07BA1824844E082480078F3F780 +:10E6F000EFFDF8BD8048007F002803D075A17F485A +:10E7000007F091FE65717C4D00202E60F4F7E0F873 +:10E71000A968481C04D0012300221846F4F70EF91A +:10E72000607A617A401CC0B2142251437A580121A8 +:10E730009047F8BD0120F4F7CBF8607900280DD0A0 +:10E740006D488068401C09D0607A617A401CC0B274 +:10E75000142251437A5806219047F8BD6648007F3D +:10E7600001280AD0022812D0032822D0042834D04D +:10E7700058A1634807F057FEF8BD2079002803D060 +:10E780002671F4F786F9E5705B480677F8BD207AC4 +:10E79000002802D1F3F7FCFD2572607A617A401CF3 +:10E7A000C0B2142251437A5800219047524806774C +:10E7B000F8BD514F0123397B78680022411A184671 +:10E7C000F4F7BCF82079002803D02671F4F761F93A +:10E7D000E57002203877F8BD19E0474E217870685F +:10E7E0000123411A00221846F4F7A8F8207A0028DD +:10E7F00002D1F3F7CDFD2572607A617A401CC0B278 +:10E80000142251437A58002190473577F8BD607A39 +:10E81000617A401CC0B2142251437A5805219047B6 +:10E82000F8BD10B5304C607A062803D129A13548CF +:10E8300007F0F9FD607A617A401CC0B2142251439E +:10E84000224A52580421904710BDF0B583B00620EB +:10E850000290F4F7C8F8244C0090617A2A4801909D +:10E86000062920D0617A1420414318480918097CF0 +:10E87000042918D0617A142251430818007C032817 +:10E880007BD0019900980B6849681B1A081A1B0273 +:10E8900000020F4A1B0A000A082B6ED3114693424E +:10E8A0006BD8884269D814488068401C03D009A1FD +:10E8B000164807F0B8FD00206071607A06282CD158 +:10E8C0006078002829D023E0B8DF0000E80D0020A0 +:10E8D000FFFF3F007372635C72656D2E6300000082 +:10E8E000C00D00201E0500006C0E00204F0500002A +:10E8F000A20500008C0000204C0E00205B050000EB +:10E9000096050000A90500005C0E0020E50500004A +:10E91000FE48C178417081780170607A062815D070 +:10E92000607A1421FA4A48438018007C04280DD1EB +:10E93000607A0290607A0121142358438018017490 +:10E94000607A58438018807C6072A172F14D687FB4 +:10E95000297FF14F884233D0F04E287F142148435D +:10E960008019007CC05D0128287F07D048438019AA +:10E97000007CC05D02282FD044E0FDE11421484313 +:10E980008019807A01280AD0287F0221142250435E +:10E990008019007CC155287F0A2808D009E0287F0B +:10E9A0000021142250438019007CC1552AE0002028 +:10E9B00001E0287F401C2877687F297F8842CCD1DE +:10E9C000D74D287D00284CD0287CC15D012928D056 +:10E9D000C05D022830D03AE0287F142148438019D6 +:10E9E000807A012803D0CFA1D14807F01CFD297FF0 +:10E9F00000201422514389198872297F51438919B3 +:10EA0000097CC855287F142148438219287F484330 +:10EA10008019017C0098FEF7E9FF287F0A28C8D1F9 +:10EA2000C5E7A97A012904D00221C1550020287523 +:10EA30000DE00021C1550AE0A87A012803D0B9A150 +:10EA4000BC4807F0F0FC0020A872297CC855287D3E +:10EA5000002806D0297CB24A0098FEF7C7FF0020A4 +:10EA60002875029806281ED014214843A84940184A +:10EA7000017C012917D107210174AF4D287B0A2899 +:10EA80003CD0287BE97A401C884203D1A5A1AB4841 +:10EA900007F0C9FC297B02986854287B0A2831D0EA +:10EAA000287B401C2873607A06287DD0A07A002835 +:10EAB0007BD00020A072617A1420414394480E1844 +:10EAC0009F49B56873680A46F6687C32CB679660E2 +:10EAD00055609C4D697E002916D00226617A142269 +:10EAE0008B4851430818407B06281BD2010079440B +:10EAF000097949188F440A1412100E0CE87A00287C +:10EB0000C4D0C7E70020CDE70426E7E700210FE0E7 +:10EB1000B4210DE073210BE0322109E00A2107E066 +:10EB2000062105E0FF208849E03007F07CFC002149 +:10EB30002973687E022801D0012810D12869009A23 +:10EB40004018821A1202120A3A2A08D932380321CE +:10EB500000026976000A28613220287308E0322911 +:10EB600006D2207A00280AD1F3F712FC012005E032 +:10EB7000207A002803D0F3F734FC00202072634988 +:10EB80000822487820700978012901D0032906D18C +:10EB900001212171297B884201D9421A0832A378C8 +:10EBA000002B00D0921C01E08DE09BE02179002930 +:10EBB00001D1002B5DD09446644A00990092019ADD +:10EBC000176852687F1A511A3F0209023F0A090A60 +:10EBD000BC451BD85D4A974218D8009A914215D877 +:10EBE000297B884223D92B69421A9A1A1202120AE7 +:10EBF000101880190002000A2A616860002914D0E8 +:10EC0000032028770006000E3ED14CE00020207142 +:10EC1000A070297B002925D028694018801900029E +:10EC2000000A6860022028772EE00120E9E781428F +:10EC30000BD92A69511889190902090A6960002843 +:10EC400001D00420DDE70220DBE7002B03D135A152 +:10EC50003F4807F0E8FB286980190002000A686055 +:10EC6000002004E0296989190902090A69602877E6 +:10EC700019E0287B00280FD02969081880190002A4 +:10EC8000000A686002202877286901238119002280 +:10EC90001846F3F753FE09E0286980190002000ABC +:10ECA0006860002028770120F3F712FE607A1421B3 +:10ECB000484317490C2240188256012300206968F6 +:10ECC000F3F73CFE0EE00120F3F702FE0020F3F71D +:10ECD000FFFDF3F7E3FD207A002803D0F3F781FB73 +:10ECE00000202072A078002804D0F3F7D2FE002084 +:10ECF000E070A0706078002804D00448C1784170AA +:10ED000081780170207900282BD023E08E0000202C +:10ED1000E80D0020A00D002091000020E00C002054 +:10ED2000C00D00207372635C72656D2E630000007D +:10ED30000706000023060000D80D0020350600005D +:10ED4000E00D00204C0E0020B8DF0000FFFF3F0068 +:10ED5000870600000020CF49E0700978002900D123 +:10ED60002071CD48017BC07A814203D0CB484078E6 +:10ED7000F3F7AEFA0120E07103B0F0BDF0B5C84C76 +:10ED80000746607A83B0062803D1C6A1C84807F0B9 +:10ED90004AFB607A1421C74E48438019007C03283F +:10EDA00003D0C0A1C44807F03EFBC44DA868401C76 +:10EDB00003D0BCA1C24807F036FB607A1421484357 +:10EDC00081190C20085600216A4600911171C01962 +:10EDD00001AA6946F3F778FE6A46042010560F2808 +:10EDE00001DD012000E0002000994018696840180A +:10EDF0000102090AA9606079002804D001230022D9 +:10EE00001846F3F79BFD03B0F0BD70B5AE4CAD4AAC +:10EE10000B1AA34214D3451AA54211D3934203D926 +:10EE2000101A43185B1C0BE0954204D9511A0818BC +:10EE3000401C434204E0A549A54807F0F4FA00232A +:10EE4000184670BD10B50146012300220220F3F7D9 +:10EE500075FD10BD10B50220F3F73AFD10BD10B5D9 +:10EE6000F3F7C1FD10BDF0B58D4D0446E87A83B0CF +:10EE7000002803D18BA1974807F0D5FA642C4DD315 +:10EE8000954900200246091B824147D39348417FA0 +:10EE9000007F814242D19248007D00283ED1687AAD +:10EEA0001421844F4843854EC519306801AA0019C2 +:10EEB0006946F3F709FE694604200856002802DD7A +:10EEC0000098401C0090A96800986B680A18D21A34 +:10EED0001202844B120A9A4220D8AA7C062A08D031 +:10EEE00014235A43D2195268511A0902090A81425D +:10EEF00014D3B068401C05D00120F3F7E9FC0020D2 +:10EF0000C043B060306800193060A86800994018AC +:10EF10000002000A7061012003B0F0BD002003B0C0 +:10EF2000F0BDF8B50646401EC5B2142061496843DD +:10EF30004418207C002803D15AA16B4807F073FACB +:10EF40006648017F407F81420CD0684A14234B43BE +:10EF50009B181B7CB3420CD00A290CD0491CC9B2A7 +:10EF60008142F3D15E48017D002964D0007CB0422B +:10EF700061D10020F8BD0021F1E7217C052905D0F1 +:10EF8000217C062902D0217C072928D10121217466 +:10EF9000C17A0023027B8A4221D00246565CAE42EF +:10EFA00001D1012301E0002B04D00A2911D04E1C0D +:10EFB000965D56540A290ED0491C167BC9B28E4262 +:10EFC000ECD1002B0BD0117B002906D0117B491E00 +:10EFD00004E00026ECE70021EFE70A211173617CD1 +:10EFE00000292AD06774C17A0023027B8A4224D088 +:10EFF000425CAA4201D1012301E0002B04D00A297E +:10F0000012D04A1C825C42540A290FD0491C027B50 +:10F01000C9B28A42ECD1002B0FD0027B0146002AF4 +:10F0200006D00A7B521E04E00022EBE70021EEE747 +:10F030000A220A7301E018480027217C01299CD18B +:10F04000617C002999D10120F8BD70B505461420D6 +:10F05000184A05216843801801740F4C207B0A2848 +:10F0600011D0207BE17A401C884203D11749204807 +:10F0700007F0D9F9207B2554207B0A2807D0207B74 +:10F08000401C207370BDE07A0028EFD0F2E700202A +:10F09000F7E700008E000020D80D00208C00002033 +:10F0A0006C0E00207372635C72656D2E630000004D +:10F0B000EA060000E80D0020EB0600004C0E0020E0 +:10F0C000EC060000FF7F841E0020A107B8DF0000CF +:10F0D0000E0700002D070000FF1FA107A00D002054 +:10F0E000C00D0020FFFF3F006A070000E00C002079 +:10F0F0000702000070B5FF4D00246C702C70AC61ED +:10F1000000F0CEFC284620304470C473AC6214304A +:10F110002C6305F094FF002804D0FF20F6A14E30A8 +:10F1200007F081F92C7770BD0B23DB4310B5C21AB1 +:10F13000F54998421FD008DC1C3222D00A2A20D080 +:10F14000142A1CD0182A08D117E0083011D004283E +:10F150000DD0082809D00C2805D0FF20E6A1753075 +:10F1600007F061F910BD04200CE000200AE0FC204B +:10F1700008E0F82006E0F42004E0F02002E0EC20B3 +:10F1800000E0D820C86010BD70B50125DF49022617 +:10F190000E60DF490022CA63CD63DE49C96A0907F0 +:10F1A0000ED4DC494031CB6ADB4A53620B6B93626D +:10F1B0004B6BD3628B6B1363C96BD30519435163DC +:10F1C000D14C002826D0012828D0FF20CAA1A13088 +:10F1D00007F029F9D148A063FF200430606325635C +:10F1E00003202061C849962040314860C1491C2055 +:10F1F0000856FFF799FFCB49C9488860C948CA49F2 +:10F2000080304160C9490160C9480660C949102081 +:10F21000486070BDC8486061C84803E0C848606184 +:10F22000C648801FA061D5E770B50C46B14D0146B8 +:10F230000622A81C06F079FF2C7270BDAD48203064 +:10F2400040787047AB4A517010707047F8B504466B +:10F250000D465079117900020843690009190884A4 +:10F260001F461646501C06F0C1FF317800020843C5 +:10F27000A90060502846083001268640002F0ED095 +:10F28000012F04D0FF209CA1E83007F0CCF8206BC0 +:10F29000304301460120A84001432163F8BD206BA3 +:10F2A000B043F6E770B50D460446082904D9FF209F +:10F2B00091A1F93007F0B7F80022A24809E09100C7 +:10F2C000635809180B6053001B191B8C0B62521CEE +:10F2D000D2B2AA42F3D3206B9A494031086070BD84 +:10F2E00010B50446FFF720FF8248047710BD81481F +:10F2F0002030007B704710B5834CC178616206F006 +:10F3000075FF0002E06110BD252808D0262808D02E +:10F31000272808D041000A2807D8091D06E0022145 +:10F3200005E01A2103E0502101E0891DC9B2764AA7 +:10F33000916075494031486170476E4988617047F6 +:10F3400070B5002818D002226A4C784B0320A272B4 +:10F35000F0331860734D72486860002001262075F4 +:10F3600000290BD0012910D002291BD0952062A1C1 +:10F37000800007F058F870BD0122E5E77248012AC5 +:10F3800001D0466070BD066070BD5A48012A006B0E +:10F3900005D00121490508432063696070BD012142 +:10F3A0000905F8E7A069002803D153A1674807F0D1 +:10F3B0003AF8A169A06A40186549886059486549CA +:10F3C0008030816060491031C1600120216BC00331 +:10F3D00001432163686047482030C67370BD08B59B +:10F3E0000C20694608705148002110380161564AC6 +:10F3F000012111610BE000BF00BF00BF00BF00BFD3 +:10F4000000BF00BF00BF6A461178491E11706946EF +:10F410000978002902D001690029ECD068460078FB +:10F42000002804D1494834A1203006F0FCFF08BD73 +:10F43000F8B53E4CF034206886083E48B600416876 +:10F44000C906CD0F10218160002727603549344857 +:10F450008860FFF7C4FF35481038076100F020FBD3 +:10F460002660002D02D0334910204860F8BD10B549 +:10F4700006F0BCFE00022449000AC86310BD2349FF +:10F48000022008602A49086070472049022080391C +:10F4900008607047304908707047164810B534301E +:10F4A00005F0D5FD002804D0284813A15A3006F0F5 +:10F4B000BAFF10BD0F4810B5343005F0E0FD10BDA7 +:10F4C00011494860704770B50A4D0446A86AA042C9 +:10F4D00004D31E4808A16B3006F0A5FF0120287355 +:10F4E0001C49002008392C6148601948446000F02C +:10F4F000DEFA70BD7C0E00207372635C68616C5F25 +:10F500007263732E630000000015004080E100E08C +:10F51000C01F004080000010001700405B06000084 +:10F520000040000400F50140408000401011004000 +:10F5300080E200E000130040060102002500030203 +:10F5400005010300001600400010004047020000C3 +:10F5500040850040488100409700002010B5FF48DA +:10F5600002210173C6210161FD4A00215160806AB8 +:10F57000FC49C630486000F09AFA10BD0121FA48F3 +:10F5800089058160F548026B8A430021026301739B +:10F590007047F64801214160C160F1490020486090 +:10F5A000F0494860ED4988627047F149402008629F +:10F5B000F0490A6802430A607047EE480168402239 +:10F5C00091430160EA49002008627047E9480168F8 +:10F5D000102291430160E849012088617047E749A2 +:10F5E0000020C861E34801681022114301607047A0 +:10F5F000E249CA69012A01D000207047DC4A9268BA +:10F600005206520E524202700020C861012070471B +:10F6100070B5D248D24D017B002902D0696801291A +:10F6200009D00024D5490A69012A06D00023807A2E +:10F63000012804D006E00124F4E74023F7E7CA6874 +:10F64000012A04D000221A43012802D004E020221B +:10F65000F9E74B68012B05D000231343C84A022861 +:10F6600002D007E01023F8E71668012E02D1CE6819 +:10F67000012E04D000261E43022802D007E00826EF +:10F68000F9E71268002A02D1CA68012A04D00022D0 +:10F690003243022802D005E00422F9E7002C01D011 +:10F6A000022300E000231343022807D14868012801 +:10F6B00004D16868012801D0012600E00026B14885 +:10F6C0001E4302681206120E02D04A69012A00D0B7 +:10F6D0000022A24C2034227300680006000E02D0E3 +:10F6E0008869012800D000206073A148006A0028C2 +:10F6F00003D000F0A8FA012800D00020A07300F089 +:10F70000C7F9002068603046F3E670B50C00054686 +:10F7100003D19D499D4806F086FEE00706D0012CE6 +:10F7200004D06D209849C00006F07DFE002D0ED05B +:10F7300002218A4801294172C4728E4809D00229E7 +:10F740000AD0924890491A3006F06DFED1E60121A8 +:10F75000EFE70168042201E001680822114301601B +:10F76000C7E670B57D4C0022E37A990701D54107C1 +:10F7700014D47A49DD062031002D05DA4D7B002DA9 +:10F7800002D08D7B002D09D01D0702D50D78002DEC +:10F7900004D15B0703D54978002900D10122637A9F +:10F7A0007449002B06D00225284010430CD0FFF7E7 +:10F7B0003FFE9EE66C4A76489060086880088000AC +:10F7C000086000F06DF994E6012B07D0022B0ED0F3 +:10F7D0006E486D496B3006F026FE8AE60868042202 +:10F7E0009043086000F05CF90120A07281E608688F +:10F7F00008229043086000F053F9A57279E6574952 +:10F8000008757047F8B5554F544D2037FA7B564C64 +:10F810000021286B002A31D00122D203A26090433C +:10F820002A46544D10632E685A4A102090600020DA +:10F8300028601014A060FFF7D2FD00F029F92E60B7 +:10F84000281460605349102048604448817A4A482F +:10F8500001290DD002290ED04C484FA1801F06F07F +:10F86000E2FD0020F8733D48007D022874D0F8BD09 +:10F8700001210160F5E701214160F2E73A4A906019 +:10F880000E462963FFF7C4FE044636482E754168CC +:10F8900069620068A862AA7A022A0AD16A78002AF4 +:10F8A00007D0334B403B5B681B7813402A789A4360 +:10F8B00008D03E70E20708D0084603F04AFD012157 +:10F8C000A86A09E001223A70F4E7A10601D50221F5 +:10F8D00002E0A10702D5002103F04BFD2448403887 +:10F8E00041680622A81C093106F0F2FB002809D164 +:10F8F0001F48297A403840680078C009814201D108 +:10F90000012000E0002078702046FFF72AFF2648FB +:10F91000007800280DD001284AD002285BD00328A7 +:10F9200078D01DA1214806F07EFDA87A022870D06B +:10F93000A3E0A00701D502F0EDFB200702D50120CE +:10F9400002F020FC600702D5002002F01BFCA0069C +:10F95000EBD502F07CFBE8E793E000007C0E002092 +:10F96000408100404085004000F50140008000409B +:10F9700040150040001200400010004000110040FF +:10F980000014004040160040F8F40000630300003B +:10F9900000400004001300407372635C68616C5F98 +:10F9A0007263732E6300000097000020E6040000DD +:10F9B000A00701D504F0BBFF200702D5012004F009 +:10F9C00021FF600702D5002004F01CFFA006ACD583 +:10F9D00004F0A4FEA9E7A007BF27002802DA3C40F4 +:10F9E000F3F702FB200703D53C400120F3F7FBFAB5 +:10F9F000600703D53C400020F3F7F5FAA00602D5D6 +:10FA00003C40F3F7EFFA60068FD5F3F7EEFA8CE798 +:10FA100000E012E0A00701D5F3F7EAFA200702D5CB +:10FA20000120F3F7E4FA600702D50020F3F7DFFACC +:10FA3000A00690D5F3F7DAFA77E7287B00281CD0E8 +:10FA40001F494E6002281FD0012803D01D491E48BF +:10FA500006F0E9FCA96A2869884204D81A481949BD +:10FA6000401C06F0E0FC2969184841600120296B20 +:10FA700080050143296316494860287D012800D08C +:10FA8000F5E6F3F7C5FAF8BD2969A86A4118EBE76E +:10FA900010480021C160016141604161816170478E +:10FAA0000D480021417281720121C17270470A48DC +:10FAB0000121026B89050A430263054841607047D2 +:10FAC0004081004098F90000FB04000040850040A0 +:10FAD00000F50140001100407C0E00202E4800215E +:10FAE00001704170704770B5064614460D460120FE +:10FAF000F1F758FC28490120284B08709E60DC6013 +:10FB00001D6170BDF8B504460120F1F74BFC224998 +:10FB10000120087021494C60214900264E600321D4 +:10FB2000204D0906A960204F002C0AD0012C03D0DB +:10FB30001EA1412006F077FC3E60032000066860AD +:10FB4000F8BD386001200006F9E710B512480178C9 +:10FB500000290ED00321134A0906916010494A6812 +:10FB60000021002A03D0154A1268427000E041705B +:10FB700001700020F1F716FC10BD0748017800293C +:10FB800007D007484068002802D00C480068C0B27F +:10FB900070474078704700009800002000F5004052 +:10FBA00000F1004000F5014000F200407372635C18 +:10FBB00068616C5F63636D2E6300000000F40040B9 +:10FBC0003A4800210170417010218170704770B572 +:10FBD000064614460D460220F1F7E4FB01203349A6 +:10FBE000334A0870E41E14619660556070BD10B50C +:10FBF0000220F1F7D7FB2D49012008702D48002184 +:10FC000001604160816001202B49C005486010BD42 +:10FC100010B5264C2078002811D001202649C005B7 +:10FC2000886000F034F80021002804D001206070C2 +:10FC30002248006801E061701020A070217000204F +:10FC4000F1F7B0FB10BD10B51848017800290BD0B2 +:10FC500018480068002805D000F019F8002800D0E6 +:10FC6000012010BD022010BD407810BD10B50F4816 +:10FC70000178002909D000F00AF8002803D00F48C5 +:10FC80000068C0B210BD102010BD807810BD0948BA +:10FC90000168002905D04168002902D08068002849 +:10FCA00001D0002070470120704700009A0000201A +:10FCB00000F5004000F1004000F5014000F4004074 +:10FCC000FFB593B0044600201D9E049015981C9D1E +:10FCD0001027082806D0E06901F014F8002809D0A0 +:10FCE0003770CCE028880921384328801F980227E4 +:10FCF000017016E0E169012088710521E269C902FD +:10FD00009180E1698872E169F9480881E169002020 +:10FD10008873288820210843288011211F980427F0 +:10FD200001701F980225801C0390307810900A20E3 +:10FD30003070204618301190F6F76BFC00206FE011 +:10FD40001598102809D1022D07D06846828A049997 +:10FD50000398401A8270110AC1706846C08A1699C9 +:10FD6000884203D9E349097A149106E0884204D114 +:10FD70001099002901D0317021E003990870000A20 +:10FD800048701E980088401BC01B83B2FF20C01B18 +:10FD9000984200D203460398149AC0190CA9009205 +:10FDA000019002912020015D6846C08A0022F6F78A +:10FDB000A5FC3070002806D0C0B2832862D0684607 +:10FDC000C08A208345E00F98002805D0C948006804 +:10FDD00000790A2830D33CE06846008EC119C9B2C8 +:10FDE0000491022D0FD01F99049A4978914203D1B2 +:10FDF0006A46128C824209D0BE480491006801789C +:10FE0000032909D027E008461F994870B9480068BF +:10FE10000178042906D008E000790A281BD20120C5 +:10FE20000F9009E06946C98A8180039904980818EF +:10FE300003900498281885B205AA14991198F6F72A +:10FE4000EBFB002805D11E980088401BB84200DB60 +:10FE500076E7022D0ED01598102807D1049A039941 +:10FE60006846808A891A8870000AC8701E980580C2 +:10FE7000002030709F4800680078032802D00020DE +:10FE800017B0F0BD0220FBE7F8B50446406B002632 +:10FE9000134600282BD0491F8DB2618F2A460832A5 +:10FEA000278F8A18BA4221D89A7840185F781102B1 +:10FEB00039430170090A41701A79DF781102394318 +:10FEC0008170090AC1700571290A41712A46591DBC +:10FED000801D06F02AF9608FAD1D401980B2608741 +:10FEE000626B002110180170417000E00926304655 +:10FEF000F8BD30B50B88048F9C4212D9446BE018D2 +:10FF00004478057824022C430BD0447905792402E7 +:10FF10002C436404640CA41D1B190B80106000208A +:10FF200030BD822030BDF7B588B000256846058217 +:10FF300005275DE00398417802780E021643417967 +:10FF4000027908021043000452D40A980123068063 +:10FF500005A802905B02002200970195304609999E +:10FF6000F6F7CCFB04004AD16846018A0183039866 +:10FF70004179027909021143437802781C02144343 +:10FF8000B4421ED10A041CD44B0401215B0C89032A +:10FF900000950B4301970295C17880780A020243CD +:10FFA00020460999F6F7C6F9040011D1039948795A +:10FFB0000A79000210430122D20310430871000A9B +:10FFC000487103AA06A90898FFF793FF0400CED052 +:10FFD0000399009501970295487809780002084333 +:10FFE00069468B8A00220999F6F7A4F9822C06D17A +:10FFF00003AA04A90898FFF77CFF04009AD068467A +:020000040001F9 +:10000000058209E003984179027909021143490404 +:10001000490C0171090A417103AA04A90898FFF764 +:1000200068FF0028EED0822C02D020460BB0F0BD35 +:100030000020FBE730B50446406B002597B0002850 +:100040000DD00B2268460270228F0281606B0391F3 +:10005000019000216846F3F7E2FA6846057065638F +:100060006587258717B030BDF8B50F460546696B23 +:100070000020069E144600290FD0012B0DD13246D8 +:1000800039462846FFF74FFF002806D1002C04D040 +:1000900032463946284600F044FEF8BD0022028070 +:1000A000C262831D0263C3614263428702872030BC +:1000B0000170704710B50022D24302800420FDF782 +:1000C000FEF910BD10B596B00446FFF7B3FF208EC1 +:1000D000002808D0012069460870E06A01900021DC +:1000E0006846F3F79CFA0020E062206316B010BD6A +:1000F00001280000B40E00200146098800200A07EC +:1001000000D501200A06120F01D002221043CA05B1 +:1001100001D5042210438A0501D510221043490558 +:1001200001D5202108437047FFB5A9B00600329DD4 +:10013000359C2B981F46229016D0007841060FD48C +:100140008106890E1E2909D021884A05520E0BD13D +:100150003A88172A08D3FE4A914205D0C10906D031 +:100160008006800E122802D003202DB0F0BD20465C +:100170002C302690F7492A980872002018AA03907C +:1001800010726A46107404AA0A60339A4A6020AA60 +:10019000908090812298007801908106681C1C90C4 +:1001A000701F1D902B98890EC21C2492224620326B +:1001B0001B92083A401C02920B0006F025FA1FFD24 +:1001C000FD11FD1FFD8EFDFCFDFBFDFAFDF9FDFCA3 +:1001D000FDF8FDFDFDF7FDF6FDFDFDFDFDF5FD0066 +:1001E000032E76D102E018A9087219E303202870C3 +:1001F0001C9917220A7000224A70CFE2052EF0D116 +:100200004178027808021043208320A98880249A2C +:100210005178127809021143618300287ED0884208 +:100220007CD800202072E080401E60840298F6F79F +:10023000F0F905202870A81C0190022000901BAA4C +:100240002A990298F6F7E8F9002868D118A8807C66 +:10025000012803D002206870102002E0012068709D +:1002600002202490002225A91CA8F2F746FD0028B0 +:100270002BD120A8007D2499814226D13A8800996B +:10028000801C511A814220DB10A8C18D0198017099 +:10029000090A417001991CA8891C01910099019AD1 +:1002A000891C009125A9F2F728FD20A8007D01995D +:1002B0001BAA091801910099081880B200902A9988 +:1002C0000298F6F7A9F90028CCD00098022826D089 +:1002D00064E272E018A9087261E2072E6DD34178DA +:1002E0000346027808021043208320A98880249ABC +:1002F0005178127809021143618300280ED0884298 +:100300000CD8012020725879197900020843E08046 +:1003100000202073E06900F0F5FC01E098E0A9E01E +:1003200000280ED1E169012088710521E269C90226 +:100330009180E1698872E16987480881E16900205C +:100340008873F01F60842298C01D60620298F6F7DF +:1003500060F907202870681C00900120019000209F +:1003600010A9C8852FE00198012814D0E069807990 +:10037000012830D000981E38417F007F09020143D8 +:1003800000980170090A41700098801C0090019843 +:10039000801C80B2019010A8C18D00980170090ADC +:1003A00041700098801C09E00AE296E13BE1DFE041 +:1003B00004E29BE077E036E016E2AFE000900198BF +:1003C000801C80B201901BAA2A990298F6F724F9A2 +:1003D000002803D007E010A8818DD1E73988019863 +:1003E000081A0428BFDA0198012843D0E06980790F +:1003F000012804D010A8818D5548814206D110A84B +:10040000818D00980170090A417009E000981E383A +:10041000417F027F0802009910430870000A48706B +:100420000198801CBAE1072E01D0152E76D14178B3 +:10043000027808021043208320A98880249A5178EA +:100440001278090211436183002801D0884201D942 +:1004500001203FE7012020720020E0802073052E5C +:100460000AD01D982299E269C0B2491DF2F71FFC1B +:10047000002801D00A202DE70020C04360841AA87C +:10048000019023A9229802970395009100780023F8 +:100490008206920E20462A99FFF712FC0390208BC9 +:1004A00020A988807BE1032EC0D1402220A98A8127 +:1004B0004178027808021043208320A988802A9975 +:1004C0001EAB1C9A02930192009139880022491EAA +:1004D0008BB21B990978F6F711F918A90872002850 +:1004E00033D10B20287010A8008F3FE0052E9DD13E +:1004F000802220A98A814178027808021043208353 +:10050000249984464A78097812020A43628420A911 +:1005100088801248824202D30720DBE6AFE03F200A +:100520008002024362842A981FAB1C9902930191B6 +:1005300000903888401E83B21B9801786046F6F719 +:10054000DDF818A9087200280CD08328AAD107E08A +:10055000FFFF0000B40E002001280000010200008F +:100560000220B8E00D20287010A8808F401C15E1F3 +:1005700001990C22C9095143C91CB14204D90198FF +:1005800040067CD5002009E1427803781002184328 +:1005900020AA9080844622980078400609D505203C +:1005A0006A46107422980078C00905D000201074A3 +:1005B0001DE106206A46107424981F902A9A009024 +:1005C0000023701A029383B21E9001921B9800229E +:1005D00001786046F5F7AEFE18A908720022694658 +:1005E0000A74832801D102200390229800784006E3 +:1005F0000DD52088C00506D520A9208B8988884282 +:1006000001D100206062002018A90872C6E0FF2115 +:10061000013120A88181808820831E9860841F98E2 +:1006200060621320B8E0052E29D3417802780802D1 +:10063000104320A98880218F002902D0FE4A9142D0 +:1006400006D10A216A4611740121C943218702E0BB +:1006500007216A46117422992A9A491D0192009134 +:1006600001221D990023D203029311438BB22499D6 +:100670004A78097812020A431B99097800E0C9E018 +:10068000F5F758FE18A90872002269460A7401227B +:10069000520220A98A81832808D0002809D0218FFE +:1006A000E54881427ED10020208778E08888208339 +:1006B0004DE7606B002808D031462046229AFFF7AC +:1006C000E3FB18A90872002869D12B463A46304648 +:1006D000229900F056FB039061E02298022E4078A8 +:1006E00001907DD1002801D0012879D108206946E8 +:1006F00008740198087521A800901B9800220178C1 +:100700002046019BFFF7B0FC6946002248758A75B8 +:10071000002802D10198012809D0208F002806D096 +:10072000002008740120800220A988810EE004A81E +:100730003399F2F774FF0390002069460874012092 +:10074000800220A988810398022807D0BB4800684E +:100750008079002805D018A908722BE00198208321 +:100760001DE00398002803D0812018A9087240E0FA +:1007700021A800901B98012201782046019BFFF7D9 +:1007800073FC18A9087220463499FFF753FC18A986 +:10079000087A002803D11920287001203880684683 +:1007A000007C00E03CE0002804D004A83399F2F774 +:1007B00036FF0390039800282ED01AE0062012E599 +:1007C0002078000713D5012E11D109216846017444 +:1007D000A188818204203499FCF771FE082100E091 +:1007E00005E020A88181CDE60198400612D50320BE +:1007F000039020A9208889890843208020A988891E +:100800004005400E04D026992B98086026988680D3 +:100810000398AAE40420E6E418A8007A00280ED081 +:100820000120287022980078687020A88088A8701D +:10083000000AE87018A8007A28710520388020A9DD +:100840002088898988432080E2E7FFB50746A1B068 +:1008500000201C903A7801209040794A7C68104032 +:1008600010AA1087744B22885B1C9A4203D0002880 +:1008700004D0100702D5012025B0F0BD249E002031 +:10088000307023980025028810A8028518A80575E5 +:100890006A4B68461972057404A8186020462C300B +:1008A0001B902A985860249E94463878721C052123 +:1008B000039201282DD0022808D003287DD130785A +:1008C000800980011D303070B889A08038780228F6 +:1008D00004D13078800980011B303070F01C1FAAD1 +:1008E00001900292009110A8008D0022C01E83B2D8 +:1008F0002020015DB889F5F701FF0028DED10398BB +:10090000B9890170090A417010A9888FC01C088537 +:1009100028E1787B18AA10753A7B012A02D0022AB6 +:10092000CCD1FCE022887F231B011A4010AB1A8730 +:10093000802A4AD006DC102A10D0202A0ED0402A65 +:100940000AD124E0FF3A013A65D0FF3A013A79D062 +:10095000FF3AFF3A022A76D00525A2E02078C006A9 +:1009600001D5082000E010201C9004206A46107475 +:10097000002090821AA81DAA1EAB03960192029035 +:1009800000933B8A20461C9AFFF79AF984E0228B59 +:100990003B8A9646934268D10A221C92002839D19C +:1009A000039801906046401E1FAA83B20292202045 +:1009B0000091015D0022704600E0BAE0F5F79EFE6E +:1009C000014618A801750B201AE0228B3B8A964637 +:1009D00093424AD10C221C92002862D103980190C4 +:1009E00060461FAA401E0292009183B22020015D42 +:1009F000628C7046F5F782FE014618A801750D203D +:100A0000307010A8818F491C01850421684601744B +:100A1000218B818245E0238B3A8A9C469A4224D1DD +:100A200012221C9200283CD1606A002813D00022B8 +:100A30006B4607C3638C07E0FEFF0000B40E002086 +:100A400009F800000DE04BE02020015D6046F5F75D +:100A500071FC18A9087513203070012010A90885B1 +:100A60001FE0398A228B914201D00425B6E016217D +:100A70001C91002815D11B98818802682046FFF739 +:100A800003FA18A9087500280BD11B983346016892 +:100A900080881AAA00F075F9054602281BD0042D9B +:100AA00019D01B988088002811D06846007C002847 +:100AB00004D004A82A99F2F7B2FD05460120694640 +:100AC00008741B981B990068059000208880002DF1 +:100AD00048D0052D2ED06846007C032878D07DE0D4 +:100AE00018211C91002806D0388A20832046B96836 +:100AF000FFF7A0FAD5E72046183000902020015DCE +:100B0000237E01222046FFF7AFFA18A908750028B6 +:100B1000ECD119203070012010A90885E6E7208863 +:100B200001214902084010A90887FF38FF38022830 +:100B300006D0052510A92088098F884320804DE024 +:100B4000208F9849884290D116201C90386900283F +:100B500005D06063B88A20870020608702E000200B +:100B6000C043208710A8008F7F21090102468A43D5 +:100B70000DD0782300220420B968FCF7FBFB3878FD +:100B8000A07010A92088098F0843208002E02188E6 +:100B9000814321806846007C002805D08248416856 +:100BA00004A8F2F73CFD054618A8007D002815D0E2 +:100BB0001C98707001203070208BB070000AF070AB +:100BC00018A8007D3071052110A8018506E0FFE717 +:100BD0007548416804A8F2F722FD05467248017A7B +:100BE00020884005400E22D11B98808800281ED006 +:100BF000239A0026138810AA1385249A2A9B6F46ED +:100C00004CC71B9A039412681AABFFF78DFA05467E +:100C100002280CD00120694608741B982A990068A4 +:100C2000059004A8F2F7FBFC05461B98868010A8E7 +:100C3000018D2398018028461EE600B597B0042850 +:100C400007D102206A461070019100216846F2F730 +:100C5000E6FC17B000BD10B5534C037800222168A4 +:100C6000012B02D0022B42D126E00B78002B01D0C1 +:100C7000042B03D10A712268032111702168838833 +:100C80000A79D200921D8B5221680A79D20008326B +:100C90008918C2880A80216803890A79D2000A3239 +:100CA0008B52428920680179C9000C314252216877 +:100CB0000879401C08711EE00A7482888A802168C5 +:100CC000C288CA80226801891181226841895181C4 +:100CD000C1682068C1606168F2F7A1FC0146022882 +:100CE00007D02068007C002802D1002903D0812091 +:100CF00010BD832010BD002010BD406B002800D027 +:100D0000012070478178012909D100880521C90295 +:100D1000884202D0491C884201D10020704705203A +:100D20007047F7B586B00024684615460F468481A3 +:100D300005261AE0049841780278090211432980B7 +:100D4000811D019602940091417902790B021343AF +:100D5000C178827809020A43417800780902084381 +:100D60003946F5F7E7FA002806D104AA03A9069840 +:100D7000FFF7BFF80028DDD0822800D1002009B09D +:100D8000F0BD10B51488844201D2052010BD17248F +:100D90001C701080421E581C491C05F0C6F900202A +:100DA00010BD0000FEFF0000B40E002010B540484A +:100DB00004F04DF9002801D00C2010BDFF211131A5 +:100DC0003C4805F011FA3B4901200870002048809A +:100DD000E03188718874887520310871344804F0D6 +:100DE0004EF9002010BD10B5314804F028F9002854 +:100DF00003D031A1312005F016FBFFF7D7FF002803 +:100E000003D02DA1382005F00EFB10BD10B504460F +:100E1000274804F01CF9002801D00C2010BD2549FA +:100E20000878002807D0002008702148216004F0CD +:100E300026F9002010BD1E4804F021F91F2010BD26 +:100E400070B505460C461A4804F001F9002801D097 +:100E50000C2070BD174A5088A84202D11078002893 +:100E600004D0134804F00BF9122070BD1048226022 +:100E700004F005F9002070BD10B504460C4804F0DC +:100E8000E6F8002801D00C2010BD0A48017800299E +:100E900007D00020C0432080054804F0F0F812205D +:100EA00010BD40882080024804F0E9F8002010BD01 +:100EB0009D000020C00E00207372635C6C6C5F6448 +:100EC000622E630010B5282105F08CF910BD70B5B5 +:100ED000054600780A0700090001120F1043287028 +:100EE0000B0005F091FB07050705070509050B0039 +:100EF000062408E00C2406E0222404E00024F2A1E9 +:100F0000572005F090FA68788009800120436870C6 +:100F100070BD00780007000F704710B50622C01C96 +:100F200005F003F910BD10B50622093005F0FDF8F3 +:100F300010BD0278BF23C9071A40490E0A43027048 +:100F4000704702785206520EC9010A430270704778 +:100F500070B515460E4604461F2A03D9DAA1A8200B +:100F600005F061FA20462A463146093005F0DDF8E1 +:100F70006078AD1D80098001A906890E0843607064 +:100F800070BD70B515460E4604461F2A03D9CEA182 +:100F9000CC2005F048FA20462A463146093005F0B3 +:100FA000C4F86078AD1D80098001A906890E084348 +:100FB000607070BD70B501780907090F03292ED044 +:100FC000052931D1411C827E0C46437E1102194312 +:100FD000037FC27D1D02037EC67E1B021343827DFA +:100FE000407835438006800E22281DD106291BD368 +:100FF0001920C001814217D8FF26F436B54213D814 +:10100000002A11D0082A0FD88A420DD28B420BD861 +:10101000617F227F09021143814207D904E04078B1 +:101020008006800E0C2801D0002070BD012070BD0C +:1010300000210A464254491C2229FBDB704710B5A7 +:1010400002788B07920892009B0F1A430270427835 +:10105000520952014270012908D0022906D0032901 +:1010600005D0FF2098A1EE3005F0DDF910BD01217B +:101070000A43427010BD10B502788B0792089200A7 +:101080009B0F1A43027042785209520142700129A3 +:1010900007D0022905D0032904D08BA18E4805F082 +:1010A000C2F910BD01210A43427010BD00788007CB +:1010B000800F70470278EF23C9071A40C90E0A4310 +:1010C0000270704770B50546C1700B0005F09CFAC0 +:1010D0000E080A0C0E1012120C14141212160C1810 +:1010E0000C2413E0082411E002240FE017240DE083 +:1010F0000D240BE0012409E0092407E0062405E0A3 +:101100007548002470A1A03005F08DF96878400979 +:1011100040012043687070BDC0787047017AC27981 +:10112000080210437047817A427A080210437047E0 +:10113000017BC27A08021043704781794279080224 +:101140001043704700797047817B427B080210434F +:10115000704770B5017AC37909021943431C857A37 +:101160001C46467A2B023343657926792C02344398 +:10117000C21C5A4E00798D1FB54214D8FF25F43594 +:10118000AB4210D800280ED008280CD888420AD2CA +:101190008C4208D8507A117A00020843B11D884267 +:1011A00001D8012070BD002070BD0B4610B5011D97 +:1011B0000522184604F0B9FF10BD817A427A080270 +:1011C0001043704701717047007970470B4610B5A6 +:1011D000011D0822184604F0A8FF10BD027B0A700A +:1011E000407B487070470B46014610B508220E310F +:1011F000184604F09AFF10BD0B46014610B50422B4 +:101200001631184604F091FF10BD10B50822001DDC +:1012100004F08BFF10BD10B504220C3004F085FFE4 +:1012200010BD017170474171090A81717047C17128 +:10123000090A017270470079704781794279080282 +:1012400010437047017AC279080210437047017158 +:101250007047017170470B4610B5011D08221846F2 +:1012600004F063FF10BD10B50822001D04F05DFFFF +:1012700010BD70B515460E4604461B2A03D912A1AF +:10128000174805F0D0F82A463146E01C04F04DFF1F +:101290006078E90640094001C90E0843607070BDDE +:1012A00070B5054640780E46C406E40E1B2C04D9E2 +:1012B0000B4805A10C3005F0B6F82246E91C304673 +:1012C00004F033FF204670BD7372635C756C5F7011 +:1012D00064752E6300000000070200007A0C000015 +:1012E000F7030000C1074008C207C90FD20F511809 +:1012F0004008C207D20F51184008C207D20F511838 +:101300004008C207D20F51184208D007C00F40183A +:101310005208D107C90F0918500840187047002219 +:1013200002808271C271C2720273427382738270D0 +:10133000C270027142714276828303464284203336 +:101340009A7102859A72C2750276C2730274DA7259 +:101350001A739A7319750284FF21603081709A752F +:10136000704770B504460020A083208C1E46484379 +:101370001546114604F061FF2084F000294604F070 +:101380004EFF401C80B20146192269439202E0835D +:10139000914201DD401EE0837D202946000204F0D9 +:1013A0003EFF401CA08470BD70B50546087B0E460C +:1013B000C006C00E08730020A87504463019007AD4 +:1013C000FFF790FF29194874A97D641C0818E4B23E +:1013D000A875052CF2D3C0B2252803D979A18A209B +:1013E00005F021F870BDF8B5044630302646274692 +:1013F0002546C036A03780350090032909D0002942 +:101400001AD0012924D0022902D1A11CFFF7CCFF58 +:10141000F8BD1146FFF783FF002028836883A88367 +:10142000E883288468847871E88538732621085514 +:10143000A08430703071F8BD0020E885B871A188B3 +:1014400023890A460098FFF78CFFA11C0098DDE76E +:101450000020E885B38A328AA1880098FFF781FFCF +:10146000F8BD70B5867D0D460446002E01D0252EB0 +:1014700001D9122070BD002A18D0287EE17D50438A +:101480000818252104F0CBFE0846E1754207520FEB +:10149000C908504B69189A5C097A8A4368D031466A +:1014A00004F0BDFE491CCAB2002007E0002070BD58 +:1014B000002803D02118097C511ACAB22118497C8E +:1014C00091423AD32918097AC943CB07DB17D21ABC +:1014D000521E1206120E35D08B07DB17D21A521E7F +:1014E0001206120E30D04B07DB17D21A521E12060C +:1014F000120E2CD00B07DB17D21A521E1206120E38 +:1015000028D0CB06DB17D21A521E1206120E24D098 +:101510008B06DB17D21A521E1206120E20D04B0673 +:10152000DB17D21A521E1206120E1CD00906C9175A +:10153000511A491E0A06120E18D0401C0528B7DBA6 +:101540001F2070BDC00013E0C000401C10E0C000B0 +:10155000801C0DE0C000C01C0AE0C000001D07E0B8 +:10156000C000401D04E0C000801D01E0C000C01D9F +:1015700020769BE738B505460C466846FEF738F8F6 +:1015800000281ED0694600200856207209216156A5 +:101590000022411A00D5494220356B798B420FDC7D +:1015A000FF2B0DD0A17A491CC9B2A172AB79994227 +:1015B00002D8617A7F2903D160720020A0720122D3 +:1015C000104638BD7372635C6C6C5F7574696C2E09 +:1015D000630000007667010010B5040004D0FF200E +:1015E000FAA1AB3004F01FFFFB4821464143FB4802 +:1015F000FF230918FF330022581C5A544254C81DB7 +:10160000FF30FA3002704270F448001FC378A342E2 +:1016100002D18270FF23C370EF48EF4BC01E081841 +:101620009B1EC91802700A7010BD70B5EB480026E9 +:10163000001F8670FF24C47035462846FFF7CCFF94 +:101640006D1C2D062D0EF8D00020E4490B229201CE +:10165000E14B43435B189B181E74401C0006000EB0 +:10166000F6D0DF48FFF7E4FC0021DD48FFF722FD5C +:101670000121DB48FFF7E3FCDA4804704470847012 +:10168000C4700471447170BDCFE71B20704730B542 +:101690000021D24A0B239B01CF4C4C43A418E418E1 +:1016A000247C002C05D0491C0906090EF4D000202A +:1016B00030BDC94C01254C43A218D21815740170D5 +:1016C000284630BD10B5044600F0D0F900280CD0F3 +:1016D0002046FFF781FFC0490B224C43BF49002041 +:1016E0006118920189180874012010BD10B50446D4 +:1016F00000F0BCF9002802D0BA484471012010BDA6 +:10170000034610B5B748B44940794843B349421835 +:101710001046FF30E130C17F807F04F0D5FF10BD5F +:1017200010B5B048AC4940790F224843AB49401846 +:10173000A949D239095CFF30FF3004F09FFF10BD8A +:1017400010B5044600F092F9002802D0A5480471B3 +:10175000012010BD034610B5A2489F4900794843B7 +:101760009E4942181046FF30E130C17F807F04F06F +:1017700098FF10BD70B59B4C97492079974D484311 +:101780004019C11DFF31F931FF30E130807F0F2258 +:1017900004F064FF002813D020798F494843401992 +:1017A000FF30FF3002300178491C01700178407829 +:1017B000814204D1884885A1773804F034FE0120A5 +:1017C00070BD884884490079484384494018FF30F7 +:1017D000E130C17F807F814201D10120704700202C +:1017E000704770B57F487C49007948437B49401871 +:1017F000FF30E130867FC57F0F242946304604F054 +:1018000026FF002801D0204670BD70066906400EF4 +:10181000490E884201D3401A01E0081A201AC0B2CA +:1018200070BD0F20704770B50C46054600F01EF9DC +:1018300000280ED0002020706748454367482818CC +:10184000FF30FF300230017842788A1A22704170EE +:10185000012070BD70B50C46054600F007F9002860 +:101860000BD05D4845435D482818FF30FF300230FB +:1018700001784078081A2070012070BD5849016035 +:10188000704710B5044600F0F1F8002802D0554822 +:101890000470012010BD5149091FCA78FF2A02D0E7 +:1018A0000021016007E08A784C492439012A02D0DE +:1018B000016001207047002070474848801E017871 +:1018C000012908D001210170464801784348001FD2 +:1018D000C170012070470020704710B5044600F029 +:1018E000C5F8002802D03F484470012010BD3B4994 +:1018F0003C4B091FCA785B789A4206D18A78203916 +:10190000002A02D001600120704700207047334850 +:10191000344A001FC1785278914209D1FF21C17029 +:10192000801C0178002903D000210170012070473C +:101930000020704729482B4A001FC17852789142F5 +:1019400004D18078002801D0002070470120704722 +:1019500010B5044600F08AF8002802D02148C4706F +:10196000012010BD034610B51E481B49C0784843EE +:101970001A494018C21DFF320B21FC328901401860 +:10198000C17B807B04F0A0FE10BD10B51548124944 +:10199000C0784843114940180B2189014118C97B7F +:1019A0000D4AD21E8018062204F068FE10BD0D48B4 +:1019B0000949C0784843094941180B20800108189B +:1019C000C17B807B81420FD1012070477372635CC1 +:1019D000646D5F712E630000D1020000F40F0020DF +:1019E000C51200209E0000200020EEE710B504463E +:1019F00000F03CF8002802D021488470012010BD7E +:101A0000034610B51E481F49807848431E494018B8 +:101A1000C21DFF320B21FC3289014018C17B807B43 +:101A200004F03FFE10BD10B51548164980780B2212 +:101A300048431549920140181249891E41188018DF +:101A4000807B062204F00AFE10BD0D480D49807807 +:101A500048430D4941180B2080010818C17B807B49 +:101A6000814201D10120B0E70020AEE7002805D176 +:101A70000648007C002801D00120A6E70020A4E74A +:101A80009E000020D1020000F40F0020B4120020BC +:101A9000F8B5FF4E0446B079002500280AD0002989 +:101AA0002DD1657010202070F079A070307AE07030 +:101AB000B57124E0F64F203F387A012804D0707ABF +:101AC000012810D00020F8BD002918D1657013201E +:101AD000EF4920701C221639A01C04F026FB0120BF +:101AE000A0713D720BE0002909D165701420E8490E +:101AF000207008220A31A01C04F017FB7572012027 +:101B0000F8BDF8B5E3480178002902D00C2630462C +:101B1000F8BD0026DE4D3446403D2E756E75EE75DF +:101B20002E76AE75294620396E730F464E734037B8 +:101B30007E717F218170687E002804D0FDF73DFD15 +:101B4000FEF766F86C763C72D14884711430FFF76A +:101B5000B9F9CF483C30FFF7B5F9D8E710B5CD4B10 +:101B600000221A70CA4B203B1A711A46603A11665D +:101B7000D065FFF7C6FF002804D0FF20C6A187303C +:101B800004F051FC10BDC2484038007D7047C04988 +:101B900010B54039C87B897B42078307D20FDB0F22 +:101BA000D218C007C00F101840000B0004F02CFD25 +:101BB000050B060B04080F00BB4906E0BB4810BD2F +:101BC000B949083101E0B8490839085A10BDFF2069 +:101BD000B1A1A73004F027FC002010BDAC48B449E7 +:101BE0004038008A48437047F8B5A94C0646407B08 +:101BF000403CE07337791346A773012F26D0308815 +:101C00002082A348B27B203882710546603D29704E +:101C100006221946681C04F088FAB0796873062217 +:101C2000F11DE81D04F081FA607B0126002800D038 +:101C3000667597486038407B002800D0A6753B0049 +:101C400004F0E2FC0506082549084B000020D7E710 +:101C500000211DE08E4801211430FFF738F98C482F +:101C6000E91D1430FFF75FF9687B002807D00128D1 +:101C700007D0FF2088A1EE3004F0D5FB0CE0002156 +:101C800000E0012182481430FFF75BF904E00621EF +:101C90007F481430FFF71BF90020E07520767C4860 +:101CA000691C1430FFF739F9794829781430FFF7A7 +:101CB00040F9774804213C30FFF709F97448691C62 +:101CC0003C30FFF72AF9724829783C30FFF731F9A8 +:101CD00026750020F8BD0221DAE7FF206EA1F8305A +:101CE000CAE770B56A4C0125403C0346257620467C +:101CF0002030007A002801D03A2070BD64480022CC +:101D0000803806789E4206D1E2750622401C04F017 +:101D10000CFAE57500E02276002070BD70B504462F +:101D20005B4D0020403DA87528462246323804F01D +:101D3000FCF92846203844730120A87570BD544929 +:101D400020390871704710B5514C0022403C627533 +:101D5000607302462046123804F0E7F901206075EE +:101D600010BD4B49203948717047F8B500F0A4FB0D +:101D7000474C0025403C607E002804D0FDF71DFC48 +:101D8000FDF746FF6576434F3D70FDF793FBA07B63 +:101D9000012804D00021084601F0A6FAF8BD002170 +:101DA000022001F0A1FA3A4C203C207A002809D008 +:101DB000374881790029F1D11321C17105720121C0 +:101DC0008171F8BD78780028FBD0314E0622803E24 +:101DD000707BE0733078A0753046F11D703004F0F0 +:101DE000A4F930460622711C773004F09EF93C209D +:101DF000A072012020727D70F8BD10B5244C403CCB +:101E0000E17BA07CCA0701D0C2070BD08A070FD59F +:101E100082070DD42620FDF777FAA07C0221084323 +:101E2000A07410BD2520FDF76FFAA07C0121F6E714 +:101E30004907F6D54007F4D42720FDF765FAA07CC2 +:101E40000421ECE770B5134E3078002872D1104CA5 +:101E5000403C207D00286DD0FDF71FFB0025A574B8 +:101E6000E57475702846FDF715FB0020FDF78CF929 +:101E70000D480D38FDF73FFA0B481038FDF7F7FA1B +:101E8000FDF76CFBFFF7B9FFFDF7FFFA012111E049 +:101E900068130020A40000207372635C6C6C5F61A7 +:101EA00064762E63000000008E6701009A8913009B +:101EB000710200000020FDF743FA0F210520FDF715 +:101EC000C1F92646403E3178701CFDF7ADF9A07B84 +:101ED00001280CD004280AD0607D002807D02146B4 +:101EE00012390846627B6630FFF732F86575A07DCF +:101EF000002807D0FE480146427B12399C30FFF78C +:101F000040F8A575306E0178002903D00178001DD6 +:101F1000FDF7C8F9F06D0178002906D0F44A401C9D +:101F2000C732FDF754FE01206076FDF7C3FA0020AA +:101F300070BDFFE70C20FBE7EE494860704770B5C5 +:101F4000050001D0FFF759FFE94C2034E07C002860 +:101F50000AD0A07B012804D19920E749C00004F0F1 +:101F600062FAFFF702FFE3E7002D0DD00221002007 +:101F7000FDF7E6F9DE4840300079032801D001285A +:101F800002D10220FDF73BFCE07D002600280DD0A9 +:101F9000D74D203D2846691C9430FEF7BEFF2846E9 +:101FA000691CBC30FEF7B9FFE6752676D048743060 +:101FB000FDF786FAA07B030004F026FB0504040469 +:101FC0000D04090001210846FDF79FFB03E0CA4903 +:101FD000CA4804F028FAE17BA07C81430120002953 +:101FE00003D1A17B012903D0E074C24908709FE7A7 +:101FF000A674FAE710B5FDF750FABE48007800283D +:1020000018D1BB482030007D002813D00020FFF7F6 +:1020100096FFB74840300079002809D001280FD03A +:10202000022805D003280BD0B349B54804F0FBF9CA +:10203000002010BD00F040FAFDF73CFA0C2010BD66 +:10204000F0F7E6FFF4E7AB49012048707047F8B5B8 +:10205000002400F0E0FF002824D0FF202D30FDF701 +:102060006CF9A44D2878A24F403701281DD00228D2 +:1020700001D0032834D0A2489F496B3004F0D3F933 +:10208000287800280DD0387900280AD0012808D0F7 +:10209000022838D0032836D099489749803004F078 +:1020A000C2F9F8BDFFF761FEF8BD914E2036B07B56 +:1020B000032815D0707E002803D0FDF798FDFDF7AA +:1020C00074FA8B48C430FDF7FBF9B07B012812D0BD +:1020D000042810D0B879012806D0032804D004E0E1 +:1020E0000120FFF72CFFCBE7102421460E200143EF +:1020F0000020FDF70AFB7879012801D1FDF76FFA7E +:1021000002202870BCE728780228CDD10120FDF7F5 +:1021100076FBF8BD70B5764840304079012801D192 +:1021200000F0D4F9724C2034607E002803D0FDF713 +:1021300044FAFDF76DFD00F06EFF00280CD06D4DE8 +:102140002878022804D06E486B49A33004F06BF95C +:10215000A07B012803D006E0FFF707FEE8E6992000 +:102160008000FDF7EAF80120FFF7E9FE2878002853 +:10217000F4D028780128F1D039205F49000104F01B +:1021800052F9D5E6F0B5074689B000200690FDF774 +:10219000AEF800900020019056480078022804D044 +:1021A00057485549F03004F03EF9514D40356879B3 +:1021B000012801D100F08AF94D48C430FEF7A9FE8C +:1021C0004B4E04462036002F70D03046A430FEF728 +:1021D000F1FE0028F8D0FDF731F80028F4D0707E29 +:1021E00000280AD005277F1EFFB2FDF72CFD02282C +:1021F0000FD0012800D0002001903D492046C43175 +:102200000C46643C030004F0FFF906A4A4A40CA44B +:1022100056A4002FE7D177203AA1C00004F003F9BB +:10222000E9E7B07B012841D004283FD0019A00980B +:10223000104304D1A879002801D0022836D168794A +:1022400001281DD1607A00281AD101206072087817 +:1022500006224006C00FA0722548C91C6B3003F04F +:1022600064FF244C224FA07871377F2804D1A92025 +:1022700024A1C00004F0D7F8A07838707F20A070A7 +:102280001B489C30FDF71CF91A480321017028797E +:10229000002860D001280AD002285CD0032806D08C +:1022A000164818A1E03804F0BEF854E051E00120CF +:1022B000FDF7A5FA4FE00E480F462038C978C079DF +:1022C000814230D10A4839792038027A91422AD1A4 +:1022D0007979427A914226D1B979827A914222D192 +:1022E000F979C27A91421ED1397A027B914211E08A +:1022F00008130020A4000020981E0100F60400002E +:10230000DE0200007372635C6C6C5F6164762E6346 +:102310000000000007D13978407B4906C90F81428F +:1023200001D1012100E00021B07B012801D0042867 +:1023300001D100290AD100280BD101990098084346 +:1023400004D1A879002801D0012802D1307E0028CC +:102350001FD001200690707E002803D0FDF72DF9D4 +:10236000FDF756FC0698002802D00120FFF7E7FD94 +:102370005D48017800290AD00178012907D000784A +:10238000032804D095205949C00004F04CF809B046 +:10239000F0BD55480422406855490F3003F0C5FE92 +:1023A000387806224006C10F4F4840680177F91C73 +:1023B0001D3003F0BAFE4C484D4940680322091D08 +:1023C000133003F0B2FE4848494A4068B97D817530 +:1023D0000F3A117ED37D09021943018311468B7E8A +:1023E0004F7E1B023B438380137FD77E1A023A4302 +:1023F000C2808A7F4B7F1102194301813C4905222B +:1024000010310A3003F091FE3948374A1130017912 +:102410005768C906C90EB97600794009F876287A56 +:10242000002809D0A07900283AD11320E0710020BB +:1024300020720120A07133E00020A8727888B08556 +:10244000387FE8732A48394606221D31833803F065 +:102450006CFE27490622F3390878A87508467730BC +:10246000491C03F062FEB888F087F888208038891C +:102470006080F87E20710198002860790BD00121DE +:1024800008436071FDF7F2FB61794000C907C90F8D +:102490000143617102E04008400060710120287230 +:1024A000114C0020207000F007F8FDF703F8012020 +:1024B000616800F019FF4EE710B5FDF76AF8FDF707 +:1024C0005DF8FCF7B5FFFCF7DAFF10BD064810B564 +:1024D000801CFDF78DF8002802D103497F20887009 +:1024E000FDF774F810BD0000A400002004230100D3 +:1024F000DB1300208107C90E002808DA0007000F4F +:1025000008388008F74A80008018C06904E0800815 +:10251000F54A800080180068C8400006800F7047A8 +:1025200010B500F03BFF10BD70B5F04C0546626879 +:10253000002908D0002A04D0FF20EDA10C3003F0C0 +:1025400072FF656070BD002A04D1FF20E8A112303F +:1025500003F069FF0020606070BDE948C07E7047ED +:10256000E7482830C07E704738B5E04C20680168E5 +:102570004978012925D001216846FAF7C9FC684647 +:102580000078E049000203F04AFE2068426AC06811 +:1025900012685118FBF7ADFC2168C860D84A206862 +:1025A00028320321904218D0028B002A15D0012234 +:1025B0004272017200210171021D017F00F0FBFED9 +:1025C00038BD7D21C068C900FBF793FC2168C86055 +:1025D000FFF7DDFA21680861E0E7028B521C0283F5 +:1025E0004172E6E7FFB5C64E85B0706A346805688B +:1025F00060680190306A0390298E0798401A80B273 +:1026000002900898002804D02746383720464830E2 +:1026100002E0371D2846A830009003203871059845 +:10262000002820D001287DD002285ED003287AD04F +:10263000AFA1B54803F0F7FE0898002807D0387915 +:10264000032804D0B048AAA1093003F0ECFEA16A27 +:102650007069FBF74EFCB860616A206A88427DD9D8 +:10266000009801601FE1306A002804D1A648A0A1AB +:102670007A3803F0D8FEA449288B373948434018EC +:10268000069900F0A6FEA0619F49A8883739484303 +:10269000069900F09EFEE061316A9B48891CA162A8 +:1026A0002A8B37384243A069974B121AE63BD2185F +:1026B0005118A162944BAA7D373B5A4340008018C1 +:1026C000FF30193020626062306A081AED21FF384D +:1026D000C90015388842AFD28C49884204D28A4852 +:1026E00083A15D3803F09FFEB6E0874A288B373A16 +:1026F000E16850430818069900F06BFEA06182491A +:10270000A88837394843069900F063FEE061306AD3 +:10271000002804D17C4876A1553803F084FEAE2011 +:10272000405B01E02CE05AE00028288B784AE16801 +:102730001DD050430818A169401AA0622169A06801 +:10274000734A4843A1694018A97D4000514340188D +:10275000FF3017302062A888504300E0A1E0E16913 +:10276000411A6F20C000081A6062A06A34E050432A +:102770000818A169401A3168D63849684018DCE762 +:10278000284680300190C08D002802D0306A002891 +:1027900004D15F4856A1401F03F045FEA8885C495C +:1027A000E3694843C01AA06201999C46CA8D216919 +:1027B000A368521A4B43A169591863465343C91879 +:1027C000AA7D534B49005A438918FF3117312162C2 +:1027D0006F21C900411A6162316A401A35E00898D8 +:1027E000002803D03420005D002878D1A88848490B +:1027F0004843E169401A02994843A0622846803064 +:102800000490C08D0028019829D0002804D03E48AB +:1028100037A1163803F007FE04983D4AC18D02988F +:102820000818E16948434000FF3017302062A8884B +:102830005043411A6F20C000081A606200F0AEFDDC +:1028400000281CD0A16A0398081AED21FF38C9009E +:102850005538884200D3EFE601203871ECE60028B5 +:1028600002D00398002804D1294821A11A3003F08E +:10287000DAFD0198A16AD6380818A062CCE7FBF708 +:102880009EF8726901461046FCF7BFFAA16A081A61 +:10289000ED21FF38C90050388842DCD2012009B050 +:1028A000F0BD0099086000981A4900688035081842 +:1028B000F860298B0798081A00B2002804DD0598F3 +:1028C000022801D0032000E00120787108983870B8 +:1028D0000898002820D03420005D00281CD0022059 +:1028E000DDE7000000ED00E000E400E0B4000020BF +:1028F0007372635C6C6C5F6C6D2E73302E630000C2 +:10290000F413002010270000190500002902000020 +:10291000E20400004B1700000898012148402034D1 +:102920006075317F3A46304600F045FD0020B6E73D +:1029300010B5FE4900280A68516A096807D0126874 +:102940008988FB4BD2695943891A03F068FC10BD92 +:10295000F8B5F64F38680468416A26460D68203697 +:10296000717D00290AD0618E2A8E914206D1407A6B +:10297000012803D1EF49F04803F055FDFBF71FF89C +:10298000014638684069FCF740FAFFF7D1FF2A8E0C +:10299000618E1318994202DB491C618602E0401CDB +:1029A00010186086B07D002806D19C21608E495B9E +:1029B000884201D1401C6086DC480168088B0328EE +:1029C00002D2401C088302E0618E982041532846C1 +:1029D00040300646C1898089081A298E401E401859 +:1029E00087B218E0D148EB7E00685B00406A00794E +:1029F0004100D248415AC05A401881B2207D00237C +:102A0000FFF7F0FD00280FD001280ED0CA48C949B1 +:102A10003A3003F008FD628EB81A00B20028E1DAFD +:102A20000820B07200F010FEF8BD608E401C608679 +:102A3000F1E770B5BD4D002168680162C27E1300E8 +:102A400003F0E2FD045656034A56426A14680268CF +:102A500011700268516000682030407D002808D164 +:102A6000FAF7ADFF69680968096CFCF7CEF9002830 +:102A700018DC6868228E0168498E914206D1214691 +:102A800080318B8B9A1ACA83238605E0891A9E228D +:102A900011530168498E21860268C1681164C168BA +:102AA000416111E068680168098E228E8B1A224606 +:102AB0008032D3830168098E218601680B6CC36064 +:102AC0000B6C4361886C9062204601F0D8FC0028B2 +:102AD0000DD098499A4808E0C1684161FFF7B2F902 +:102AE000002804D096489349801D03F09CFC70BDDB +:102AF000934890490D30F8E710B58C4A0B001268E6 +:102B000003F082FD0906090F1F0C2E2E082B2E0044 +:102B1000FFF78FFF10BD00F068FC10BDFCF772FEE0 +:102B200010BDD07E022806D0D07E032806D0FF201C +:102B30008049A3300EE0FFF70BFF10BDFFF714FD37 +:102B400010BDD07E0228F6D0D07E0328F6D0FF201C +:102B50007849AE3003F067FCF0E7FAF715FF10BDD7 +:102B6000FF207449BC3003F05EFC10BDF3B581B0AA +:102B70000E4601276D4D734C0B0003F045FD090611 +:102B80002F39392F40403939400001216D48FFF776 +:102B9000CBFC31460198FFF7AFFFE07E022826D13B +:102BA00068680568406A0668FAF7E7FEB188604A17 +:102BB0005143EA69891AD639E962B72802D26248D4 +:102BC000081803E0081A6049B7314018E8625F4806 +:102BD000E96A814200D80846E86205E00198FFF7FB +:102BE0008BFFE07E022802D1206820300775FEBDF1 +:102BF0002C600198FFF780FF00202860FEBDFF20B9 +:102C00004C495C3003F00FFCFEBD70B50C46064627 +:102C10000B0003F0F9FC09060D10100D1A1A101024 +:102C20001A00484801212830FFF77EFC2146304633 +:102C3000FFF762FF70BD43483C4D283028603046A6 +:102C4000FFF75AFF0020286070BDFF20394982300D +:102C500003F0E9FB70BDF0B5344C0020216885B06D +:102C600003258D76CA7E0746032A03D0C97E002934 +:102C700029D029E0087F002803D12E49344803F0E9 +:102C8000D2FB2068067F684605714571FAF797FE0A +:102C90000290FF20F53003900121684601706946DB +:102CA0003046FBF70CFB00E020BF2068007FFCF7FC +:102CB00038F90028F8D02068007FFAF765FE206810 +:102CC000077700F072FB012021688F7605B0F0BD18 +:102CD00016490A68907600E020BF0A68D07E002876 +:102CE00003D0D07E937E9842F6D0D07E002803D0C9 +:102CF00000200021917670470120FAE770B5114954 +:102D00000024CA7E094D032A03D02831CA7E032A33 +:102D10002ED12960002827D0012821D00C48054950 +:102D2000973003F080FB0020296813E0B4000020F6 +:102D3000E2040000F0280100F70500009E67010092 +:102D4000A1030000F4130020C4F8FFFF38120000B4 +:102D500072020000086048622860002C08D070BD34 +:102D60000320FFF7B5FF01E0FFF775FF0446DAE740 +:102D70000C2070BDF8B5F94F04461F25E67E3300E0 +:102D800003F042FC042920031B20F548844204D0B0 +:102D9000FF20F449FC3003F046FB02203C60FFF7C3 +:102DA00097FF002805D03968002008604862386025 +:102DB00011E00C25002038600AE00120FFF79EFF9B +:102DC000054603E0E749E84803F02DFB002D02D05B +:102DD000E07EB042D2D1E07E002804D0E248E14952 +:102DE000801D03F020FBF8BD10B5DD48FFF7C2FFE2 +:102DF000DB482830FFF7BEFFD94900205031087565 +:102E0000D649C91F4870D64948610A4628325061E0 +:102E100088769076D1494860086010BD70B5044648 +:102E20000120FFF767FBC5B20B20FFF763FBC0B2C1 +:102E3000854204D0FF20CB49C63003F0F4FA0120CC +:102E4000FFF758FBC5B21820FFF754FBC0B285420C +:102E500004D0FF20C349C73003F0E5FA0420C04383 +:102E6000FFF748FBC5B21920FFF744FBC0B285420B +:102E700004D0FF20BB49C83003F0D5FAB748B849A1 +:102E8000083804700020C87688760A462832D07642 +:102E90009076B24B012408331C711860486250626E +:102EA00008601060FFF7A0FF70BDAC4908310871E1 +:102EB0007047FEB5AA49CA7E08462830A74C002AAA +:102EC00002D1C27E002A03D0C97E022903D005E0C8 +:102ED000A648216006E0C17E002901D00C20FEBD7D +:102EE0002060A348FAF7FCFC216808779B4920681A +:102EF000C91F0160C91C4162007F002804D1AD20B8 +:102F00009849800003F08FFAFAF737FD9949884213 +:102F100000D20846FF30C83086B220680325C57647 +:102F2000FEF735FE21680861FEF758FE00270028ED +:102F300027D0FEF753FE21684A6A10600968012015 +:102F4000087001466846F9F7E3FF684600788A4949 +:102F5000000203F064F90191FAF731FD019971184B +:102F6000FAF7C7FF2168C8602068057245720771CB +:102F7000021D017F00F01FFA2068078300202760F0 +:102F8000FEBDFAF71CFD3146FAF7B3FF2168C860B1 +:102F900008680770096801204870E5E77047F8B5D0 +:102FA0006F4EF17E002904D131462831C97E0029B7 +:102FB00001D00C20F8BD0221F176694C674F5034E6 +:102FC0000837776234600025386025753979C07E0E +:102FD0004A006A4940008A5A085A2B46101881B2A2 +:102FE0002A462846FFF7FEFA002804D0CF205D4984 +:102FF000800003F018FA25610120A5602075658620 +:1030000025865748703085753968088E401E0886B9 +:1030100035830020F8BD10B5504801244068817EFA +:1030200003290CD001684978002906D0006A544968 +:10303000884202D90024FFF706F8204610BD00247C +:10304000FBE74648406802681178491C1170016A24 +:103050000068C26A914204D8007D012801D0012095 +:1030600070470020704700207047F8B53B4C3C4843 +:103070002060416A00680D68002634210E54A621A4 +:10308000495D00294BD1007D032848D1FAF797FC10 +:10309000014620684069FBF7B8FE00283FDDFFF7D6 +:1030A00047FC298E401C4118206802681186006880 +:1030B000018E9C22525B511A09B200292FDD012199 +:1030C0002030817528464030C1898089081A298EB0 +:1030D000401E401887B21BE0496A09794A00274917 +:1030E0008B5A028E007D9446EA7E5200895AC91896 +:1030F00089B201236246FFF775FA00280FD0012834 +:103100000FD002280BD01B481649193803F08BF951 +:1031100021680868028EBA1A12B2002ADCDA266028 +:10312000F8BD20680068018E491C0186F0E7F8B5FB +:103130000A4D00266A680128516A0C6853D1087943 +:103140000E4940000B5A1068077D032F1AD0027DEC +:10315000022A24D0007D012834D044E0B4000020AD +:10316000F4130020F0280100070200006D2B01007D +:103170000B2C0100F6050000102700009E670100DF +:10318000D98213000661106886609C20025BE07E95 +:103190004000085AC01881B2002303201BE02246D9 +:1031A0008032D78D0761E07E928B4000085AC018AC +:1031B00081B200230220FFF715FA6A680121126824 +:1031C00011750AE09C20025BE07E4000085AC0189E +:1031D00081B200230120FFF705FA002803D09C49A3 +:1031E0009C4803F020F9FAF735FB9B480078EFF78D +:1031F0006FF8686806830268218E51860068203067 +:103200008675F8BD38B5944C0021083460680D46C9 +:1032100000684278002A01D045701FE0007800283D +:1032200009D001216846F9F773FE684600788B499A +:10323000000202F0F4FF6068426AC0681268511828 +:10324000FAF757FE01466068C160057103214172BB +:10325000021D017F00F0AFF860680583FAF7FAFA03 +:103260007D480078EFF734F838BD7B4A10B5014649 +:10327000083250680B0003F0C7F9060D1504081753 +:103280000C31012100F0D1F807E00021106800F0B6 +:10329000CCF810BD0120FFF74AFF00210846FFF7D8 +:1032A00043F910BD032116E0416A02680968D36939 +:1032B00093608A886A4B5A430368DA600A46C032D0 +:1032C000D3890B83137B8B75138A8B80538ACB80B6 +:1032D000928A0A8102210068017510BD5D485C492F +:1032E000913003F0A0F810BD70B500280BD05A4CF7 +:1032F000083401280ED002281ED056485449B43054 +:1033000003F091F870BDFFF77DFF00210846FFF73D +:103310000BF970BD6068002501684D7000F045F83C +:103320000320F5F7B8FEFAF795FA4B486560007888 +:10333000EEF7CEFF656070BDFFF764FF606800F0D8 +:1033400034F800210846FFF7EFF80420F5F7A3FE54 +:1033500070BD414908314968CA7E022A08D10A680D +:103360001378002B04D150600968CA6A1018C8622B +:103370007047394A10B50832526800290CD001292B +:1033800007D0022907D033483149D93003F04BF830 +:1033900010BD801E00E0401F106210BD2E48083096 +:1033A0004068002800D0012070470021C176817656 +:1033B00001604162704710B50B46C17E847EA14218 +:1033C00004D011461846FAF77AFF10BDFFF7EDFF5B +:1033D00010BD024610B50020002905D00846504314 +:1033E000204902F01CFF401C10BD1B4810B50830DE +:1033F0004068C07E030003F007F9041515030B15A0 +:1034000001F05EF900280CD00F2017A1800106E022 +:10341000FEF7F0FD002804D0F12013A1800003F096 +:1034200002F810BD10A11448F9E710B504460029B0 +:1034300003D00020FFF77BFE03E007480078EEF79B +:1034400047FF2046FFF7B1FF0020F5F724FE10BD2F +:10345000F028010092060000AC00002010270000B8 +:10346000E204000040420F007372635C6C6C5F6C9E +:103470006D2E73302E630000CB030000F8B5FEF70D +:10348000B0F90446FEF756FAF84E0546706920304A +:10349000407D002809D0012827D002282AD00328FF +:1034A00032D0FF20F2A19A3037E0F0481830FEF712 +:1034B0001EFA002801D003200FE0EC481830FEF778 +:1034C00049F9002804D070695B21095C002908D003 +:1034D000E6481830FEF7D2F90120716920314875AD +:1034E0001DE002212030417519E0E0481830FEF758 +:1034F000C5F914E0DD481830FEF72CF900280ED18C +:10350000FF20DBA18C3008E0D8481830FEF7EFF937 +:10351000002804D1FF20D6A1943002F084FFB069C6 +:10352000F72201781140017072692032937DDB0728 +:103530001B0F1943FB2319400170D37DDB075B0F81 +:1035400019430170577DEF23022F04D0012F07D0BC +:10355000032F07D00CE0012C06D8002D04D007E083 +:103560006D1E2C43002C03D019401023194300E09A +:1035700019400170D17F002916D0517D012913D047 +:10358000BF48FBF79DFFBE480021283001767269D5 +:10359000916ED26E42610161B949B269FCF7A3FA3A +:1035A0000020FCF7AFFA03E0FBF78AFFFCF7CDFA47 +:1035B000B0690078C00606D4F0690078C00602D46D +:1035C000F079002806D0B079002803D101210846FF +:1035D000FCF79BF8032030703079002803D1FBF70B +:1035E000BDFF01203071F8BD70B5A0481C30FEF75A +:1035F000B9F901259D4C002802D00020607002E03E +:1036000065709F48E061606940300078002802D012 +:103610006078002805D0E069FBF752FFFCF795FAC7 +:1036200070BD9748FBF74CFF9548283005766269D6 +:10363000116F526F42610161914AE169FCF753FADF +:103640000120FCF75FFA70BD10B588490023486976 +:1036500002462030C3768377012049239854A03254 +:103660009279002A03D008700021022001E0002195 +:103670000320FFF7FAFD10BD70B57C4C6079C206DF +:103680002046406901468031002A01DA002202E02A +:10369000CA8DCB8BD218CA850246C0321379002B53 +:1036A00005D0034640331D8AC98B69181982617A97 +:1036B000002903D03D2001F051F94AE003462033B0 +:1036C000D97E042945D0217A002913D0480701D496 +:1036D000C80601D51E2030E0080701D53D202CE0AA +:1036E000C80705D1880703D461A1664802F09BFE94 +:1036F0002A2022E04030817D002905D0418A4D1CDE +:103700004582858AA9420FD2517A062902D0117AC0 +:10371000062905D1018B4A1C0283828A914203D279 +:10372000028AC1898A4201D3222006E09A7F8089D9 +:10373000002A0AD088420FD3082001F00FF96069EF +:103740002030C07E042804D006E0062804D33E20A2 +:10375000F3E7FFF779FF70BD0120207000210846D4 +:10376000FFF783FD70BD10B5404840690146203128 +:103770008A7F002A29D0012A27D0022A06D0032ACC +:1037800004D03BA1404802F04EFE10BDC97E032983 +:103790000FD0082919D001464031CA898989511AA8 +:1037A000891E89B2032900D303218030828B5118EE +:1037B00009E0014640318A89032A06D3028EC9896D +:1037C00080305118491C018310BD8030818BFAE78D +:1037D00000B5030002F018FF0604070B0F121217C2 +:1037E00000290ED00FE0891E02290AD90BE0891F9B +:1037F000012906D907E0082903D004E00B390C2978 +:1038000001D8012000BD002000BDFEB505461748C7 +:103810001830FEF740F8002804D11B4814A1D13815 +:1038200002F001FE114CA069FDF702FC0321A06922 +:10383000FDF721FCA069EF220178114001702946B3 +:10384000FDF740FC002601272B0002F0DDFE0E5C98 +:103850005C085C2C6060255C4C5C603C375C60699B +:103860006521095C002911D0062111E0C400002067 +:103870007372635C6C6C5F736C6176652E630000C1 +:1038800090140020430200005C080000C030417921 +:10389000A069FDF797FC3AE060698030417CA0693F +:1038A000FDF7D7FC33E06169A069B831FDF7ADFCE5 +:1038B0006169A0698C31FDF7AEFC28E00621A069A2 +:1038C000FDF7C5FC23E020690178A069FDF7A9FC9C +:1038D00020698188A069FDF7A6FC20694188A0695C +:1038E000FDF7A5FC13E00096019660696030007951 +:1038F000002803D069460878384308706946A069F3 +:10390000FDF7B1FC03E0F949F94802F08CFDFDF741 +:10391000D4FF002804D1F648F449801D02F083FD4D +:103920000C2D06D0072D03D0606940304682877584 +:10393000FEBD606940300683FEBDF0B5ED4CC82089 +:1039400061698DB0405C04280AD0052835D15C201F +:10395000405C00282AD0012060314871022026E016 +:1039600010226846D63101F030F86169102204A8AF +:10397000B03101F02AF8684601F0DFFB08AE8DCEC9 +:10398000616984250E4678360DC66F5000250D6797 +:103990004D67012540267554D74D88318DC5284681 +:1039A0000822093002F0C1FB052000E00D20FFF7DE +:1039B0002CFF61690020C03108720DB0F0BDF8B570 +:1039C000CC481830FDF767FF002848D0C94C207A52 +:1039D000002844D16069C421095C002500290ED06B +:1039E0002030C17E0120FFF7F3FE002807D1606977 +:1039F0002030C17E0420FFF7EBFE002806D060696E +:103A0000C921095C0126062907D00DE06069502113 +:103A10000D526030457102204EE02030C17E0420FE +:103A2000FFF7D6FE002813D0616908462030C27E19 +:103A3000921E130002F0E8FD166262621D6262626D +:103A400060621F6262622843626262626262466210 +:103A500060695E21095CC90702D0C0304572F8BDBB +:103A60000C20FFF7D2FE60694030817F31438177BF +:103A7000F8BD072020E0FDF79AFF0028F8D0606924 +:103A8000403005700B2017E0F9F741FA0C28EFD30E +:103A900060690821B830F9F73BFA002806D0606960 +:103AA00004218C30F9F734FA002804D1C72093A1FF +:103AB000C00002F0B8FC0420FFF7A7FEF8BDFFF736 +:103AC0003CFFF8BD00228A66CA66C6770A4678318E +:103AD000C8C9894878322838D26842632830C8C0BB +:103AE00008220D30091D02F020FB0620FFF78DFE95 +:103AF000606940308575F8BD0920DDE700F036FFCC +:103B0000F8BD70B57B4C3B216069095C08292FD159 +:103B10000146028EC0314B89521C9A4228D1227A2A +:103B2000002A25D10A8A83889A4207D14B8AC58800 +:103B3000AB4203D18B8A0589AB4209D043884B85C0 +:103B40008A854A8ACA858A8A0A860122E6210A5417 +:103B500001221146FDF747FC00210420FFF785FBF9 +:103B600060690021C92211542030C1760321817778 +:103B700070BD70B55F4C60692030C07E172803D0DF +:103B80005EA1624802F04FFC616900220B4640339F +:103B9000DA7608469A75E030867D0B240125002EE2 +:103BA00006D0837C002B14D1C4740275857410E098 +:103BB0001E7F002E07D01A774C88FA235C520276BB +:103BC0000C23837505E04E88FA235E520276057752 +:103BD00084752031CA7670BD70B5464CA0798007D7 +:103BE00036D5207A002833D160692030C17E01208B +:103BF000FFF7EEFD00282BD1A0690126C078002533 +:103C0000030002F001FD0E8585088537465F0A85B1 +:103C1000168526625285032152E060692030C07EFD +:103C2000052804D0394835A1333802F0FCFB60691F +:103C30000CE060692030C07E092804D033482FA1F1 +:103C40002D3802F0F0FB606956210D542030C57606 +:103C500070BD60692030C07E0B2804D02B4827A19E +:103C6000263802F0E0FB60695B210E540C21203005 +:103C7000C17670BD60692030C07E0F2804D0234813 +:103C80001EA11F3802F0CFFB60695B210E5410218A +:103C9000EDE760692030C07E102804D01B4817A1D2 +:103CA000183802F0C0FB12210AE060692030C07EA3 +:103CB000102804D0154811A1123802F0B4FB1421C9 +:103CC0006069D4E7FFF755FF70BD60690146C030F9 +:103CD000027A062A04D14031897F890700D505720E +:103CE000417A0629F0D1457270BD0000703801009C +:103CF000CD070000C4000020B81400207372635C7C +:103D00006C6C5F736C6176652E6300004C0500007F +:103D1000FD49FE4802F087FBE6E710B5FC4C606900 +:103D20002030C17E0020FFF753FD002803D1207A08 +:103D3000012108432072207A002808D1E069FDF7AC +:103D4000EBF961699122505405202031C87610BDED +:103D500010B5EF4C60690146C0314A7A002A06D09E +:103D6000097A062903D0217A012211432172217A8E +:103D7000002928D14030807F800715D4E069FDF705 +:103D80005AFA61694031C877E069FDF756FA61690E +:103D900040310884E069FDF755FA6169022240313B +:103DA0004884887F10438877606900220146C031CB +:103DB0000B7A062B00D10A724030837FDB0702D1D9 +:103DC00006234B72028310BDF8B5D14C60692030D8 +:103DD000C17E0020FFF7FCFC0125002807D16069A7 +:103DE0004030007F002802D1207A28432072207AB8 +:103DF000002830D160690026014640304682857532 +:103E0000B031E069FDF7EFF96169E0698831FDF7EC +:103E1000F3F960690146E030827D0827002A06D068 +:103E2000817C002913D1C774067585740FE04A8818 +:103E3000F8204252FA31E069FDF7C8F96169E0699A +:103E4000FF310331FDF7CAF96069E03087756069B9 +:103E50000F212030C176F8BD10B5AD4C606920301F +:103E6000C17E0020FFF7B4FC002803D1207A012195 +:103E700008432072207A002812D1E069FDF769F921 +:103E800000280ED0E069FDF75FF96169CA2250523F +:103E9000098E00F0D6FD002806D0282000F05EFD37 +:103EA00010BDFFF73AFF10BDE069FDF74BF96169FE +:103EB000C0310873E069FDF740F96169C031C8811C +:103EC000E069FDF72BF96169C0310882E069FDF70F +:103ED0002AF96169C0314882E069FDF729F9616911 +:103EE000D422505208202031C87610BDF8B5884C35 +:103EF000A079C00776D0207A002873D1606920307D +:103F0000C17E0120FFF764FC002863D1E069002531 +:103F1000C178022701260B0002F076FB0D1613086C +:103F2000415A5A445C575A192F545A00FDF74CF91C +:103F30006169C62250543B20475440314D828E75F2 +:103F400048E000F093FD45E0FFF786FF42E060693E +:103F50002030C17E0020FFF73BFC002802D1207AF0 +:103F600030432072207A002834D160690146403104 +:103F70004D828E750B2120300FE0606901462030A4 +:103F8000C27E0C2A02D0227A3A432272227A002A76 +:103F900020D1C57740310E770D21C1761AE0FFF7A9 +:103FA00013FF17E0606901462030C27E122A02D05A +:103FB000227A3A432272227A002A0BD140318D753F +:103FC0001721EAE7FFF7C4FE04E000F00DFD01E071 +:103FD000FFF7A3FE62690023106F516F401C594127 +:103FE00051671067F8BDF8B5494C05466069203047 +:103FF0008079012801D1FBF7E9FA012D14D160691C +:104000004021095C002903D12030C07F002801D065 +:10401000FBF79BFDFBF7BDFAFBF7B0FAFBF708FADD +:10402000FBF72DFAFBF746FA60790225C107012656 +:10403000002901D180070ED560692030817F0029D9 +:1040400002D0032902D006E0867700E085770021C0 +:104050000120FFF70AF960692030817F012903D12F +:104060006179090700D58577607A002803D100F0CF +:1040700027FDFFF7A4FC207900250028606902D005 +:104080008030058403E08030018C491C0184607914 +:10409000C00705D06069AC210D544030858104E033 +:1040A000616940318889401C8881E079002806D008 +:1040B0006169A031087B022806D8401C087360693A +:1040C000A030007B022806D9606901468030058453 +:1040D0004584A0310D7360692030C17E0020FFF758 +:1040E00077FB002804D160692030C07E072855D1B5 +:1040F00060690146C0310A7A062A4FD0497A0629FA +:104100004CD03E21095C05E0FC3C0100BA050000F2 +:10411000C4000020022941D1A030007B00283DD1FD +:10412000FDF74FFB002839D0FDF704FC002835D0FF +:1041300061690A468032508B01282FD90846A03089 +:10414000844646716038C7898389B81E834201DB83 +:10415000012002E0F81A401E80B2138CA789BB42EE +:1041600001D3012302E0FB1A5B1C9BB2984200D9E9 +:104170001846012801D163465D71C0310B78002BD0 +:1041800010D0528C49888A4201D3012102E0891A59 +:10419000491C89B2884205D9084603E061690120BB +:1041A000A0314D7161690A8E803110188883FFF744 +:1041B000DAFAFFF761FAFEF756FF002809D06069C6 +:1041C0000146FF3001300279002A02D14988C180BE +:1041D00006716069A0308571F8BD70B5F84C6069F2 +:1041E0002030407D00283ED0022810D1FDF7C2FAD1 +:1041F000002804D17120F349000102F014F962692A +:104200000023916ED06E491C58419166D06660695A +:10421000002520304575017D012904D10575A1795E +:1042200010221143A171C17C012915D1C574A07957 +:1042300008210843A071FDF76AFB002804D1E5209E +:10424000E049C00002F0EFF860690023816EC26EA1 +:10425000491C5A41C266816660692030817D01290E +:1042600002D0012181753FE585753DE570B5D44CDF +:104270000026E169012508788207920F0420012AAF +:1042800015D0022A13D0032A03D0217A01432172C8 +:104290002AE560780028FBD1606920308574A17917 +:1042A0002943A17122E0C6751EE5C5751CE5497854 +:1042B000CA0624D06278002AEAD1C906C90E1B2991 +:1042C00018D8617901436171FDF75FFB002804D1C3 +:1042D0003B20BC49400102F0A6F860690023016F51 +:1042E000426F491C5A41426701672030C17D012954 +:1042F000DBD1D8E7207A102108432072F4E460690A +:10430000F3E77CB504460020C0436946888001A8D5 +:10431000FCF7B2FD00287AD169468888FCF790FD49 +:10432000002803D0A749A84802F07DF8009801466C +:10433000E030827C0025002A08D0657010212170B1 +:10434000C17CA170017DE170857472E082799C4E20 +:10435000002A13D065700720207008E07169E620FC +:104360008D8445540A22A01CE83101F0DEFE00983D +:10437000E03080790028F1D1A5705AE0827D002AD2 +:1043800038D0827D130002F03FF90D2F2F2F2F2FF1 +:104390002F2F2F112F2F24082F0065700C21217033 +:1043A000017EA17071694988A18010E065700820C4 +:1043B00020707069082240886080201DFA3101F069 +:1043C000B4FEFF2100980331095AA181E0308575C0 +:1043D0002FE065700B212170017EA1707169498801 +:1043E000A180017FA171F2E7774876495D3002F044 +:1043F0001AF81EE0C81DF9300279002A08D01122EF +:1044000065702270811C89886180057111E012E05D +:10441000027A002A0FD012226570FF312270033118 +:1044200004E005720A8962804A89A280027A002A21 +:10443000F7D101207CBD00207CBD614800780128B7 +:1044400001D00C2070470020704770B55C4C0546C9 +:104450002078002804D05C485A49933001F0E3FFEB +:1044600000202561A07201202070FFF7E6FF0028E0 +:1044700004D0554853499E3001F0D5FF34E4F8B5D7 +:104480004F4F3978012901D00C20F8BD0126A62113 +:1044900078610E548030807CFDF752F900282FD0CF +:1044A00078698030807CFDF753FA002828D078693D +:1044B0008030807CFDF7E5F9002821D078698030D4 +:1044C000807CFDF70AFA00281AD0FAF7E6FF78692F +:1044D00000258030408B002827D039481830FDF760 +:1044E000DAF9002821D07869C421095C00291CD0A0 +:1044F0002030C17E0120FFF76BF9002802D014E0C4 +:104500001220F8BD78692030C17E0420FFF760F9E1 +:1045100000280AD1786950210D526030457102207F +:10452000FFF773F97869A03045717869E621095C75 +:10453000002903D1818CC288914200D8C188B981F9 +:1045400001468031CA8B521E93B20A8CD21892B2A5 +:104550000A8494460246A0321479002C02D04D847D +:10456000157102E04C8CE4184C8404464034A78951 +:10457000FF18A7814C8B012C01D8641C4C83002BA5 +:1045800000D015732030C07E0D4C04281ED0507909 +:1045900000281DD0A1898C451AD2FDF712F90028F8 +:1045A00016D060690146C0310A78002A10D08030E8 +:1045B000408C498888420BD3A570E6700AE0000061 +:1045C000C4000020FC3C010081080000A67001E04E +:1045D000A570E5706069A5210D543B21095C062991 +:1045E00001D0072918D1CA21028E095A511A09B2DD +:1045F000002911DB01460522CC310A3001F095FD7E +:10460000012202216069FCF7EEFE6069C9210D54A8 +:104610003B210D546030867160699E210A5A811CCD +:104620003030FCF71EFFA07800283DD16069C02122 +:10463000095C002901D0803045840120FAF7A4FDEF +:1046400060691330FAF713FF60690F30FAF753FE11 +:104650000120FAF71FFF61694020405C002803D168 +:104660003F20405C00280DD00A467831C8C9F9487F +:104670007832D26842632830C8C008220D30091D44 +:1046800001F053FDFAF701FF01210846FAF758FE41 +:1046900060698030806AFAF716FFFEF7A5FF60694F +:1046A0004030007AFAF730FE6571E571A571257228 +:1046B0006572257102202070FAF7FCFE0020F8BD1B +:1046C00010B5E54C2078022801D00C2010BDA07850 +:1046D000002803D00020FFF786FC17E0FAF7DDFE84 +:1046E00000F033F9606920308079012801D1FAF7B0 +:1046F00076FFA07A002809D0012807D0022807D029 +:10470000032805D0D549D64801F08DFE002010BD04 +:10471000EEF77EFCFAE7D0498872704710B5CE4CB0 +:104720002078032804D0CE48CC49293001F07BFE04 +:10473000606901212030827C002A06D00022827428 +:104740000175A27904231A43A271A2691378DB438D +:104750009B0707D1C37C002B04D1C174A07902212F +:104760000843A0711078C00606D4E0690078C0063E +:1047700002D4E07900280CD06078002809D1A07913 +:10478000002806D1FEF75DFC002802D0207A002820 +:1047900003D00120FFF727FC03E0FEF725FF00F020 +:1047A000D4F8207801280DD0A07A00280AD001285A +:1047B00008D0022807D0032805D0A948A7496830A7 +:1047C00001F031FE10BD0120FBF719F810BD10B546 +:1047D000A14C606920308079012812D1FAF7F6FEE9 +:1047E0006169881C3031FCF7C5FE002809D060697A +:1047F000C21D4388F93253812030007E107301209E +:10480000107210BD70B5944C05462078042804D071 +:1048100093489249803001F006FE617910200143EF +:104820006171002D50D0FBF7A8F96178012508438C +:10483000002811D160694021095C00290CD0E16990 +:104840004A78D20608D0097820300907C07DC90F00 +:10485000814201D165724EE0E078002809D0E0691C +:104860004178C90605D10078C00602D4FFF7AFFF32 +:1048700041E0FFF7ACFFE06900784007C10F6069D5 +:104880002030807D814205D0FFF7A7FC60790821A8 +:1048900008436071E06900780007C10F606920304B +:1048A000C07D814201D1FFF7E1FC6079284360714E +:1048B0000020E071A079000704D560692030C07E37 +:1048C000032818D0207A14E0022001436171E079B6 +:1048D000401CC0B2E07101280DD8606940300078FA +:1048E00000280CD05B484078C106C90E052906D2C5 +:1048F000C006002803D00120FFF775FB01E0FEF79A +:10490000BDFD207801280DD0A07A00280AD001280A +:1049100009D0022806D0032805D051484F49E2307B +:1049200001F081FD9FE40120FAF769FF9BE410B5D7 +:1049300049480078042804D049484849EA3001F041 +:1049400072FD0120FFF74FFB10BD10B501210020C3 +:10495000FAF7DBFE40490420087010BD3E494A22A8 +:104960004969505404202031C876704710B53A4C3C +:10497000C8206169405C00281CD0062806D0203180 +:10498000C97E0020FEF724FF002813D0606901468D +:10499000C0310A7A130001F037FE070D0D0D0D0D21 +:1049A0000D050D004030807FC20704D0C043800752 +:1049B00000D1087210BD0C20FEF727FF60690122AC +:1049C0004030817F1143817710BD10B5002A0AD095 +:1049D000002306E0D41A6418203CE47FC4545B1C16 +:1049E000DBB29342F6D310BD7CB51B4C606920301E +:1049F000C17E0020FEF7ECFE0125002802D1207ABE +:104A000028432072207A00281AD16946E069FCF711 +:104A100022FC684600780022C107C90F6846017071 +:104A20006069002902D06030057101E060300271D8 +:104A30006069014640304282857509202031C87680 +:104A40007CBD401A074900B2884201DC00280BDC1B +:104A50000120704790140020C4000020FC3C01009D +:104A6000F4090000FE7F00000020F2E710B5534C6F +:104A700060692030C17E0020FEF7AAFE0028207A5F +:104A800010D000280DD1E069FCF797FB6169CA22BC +:104A90005052098EFFF7D5FF002807D02820FFF7D6 +:104AA0005DFF10BD01210843207210BD6169E069FE +:104AB000CC31FCF77AFB606906212030C17610BD4D +:104AC00010B500F04EF83D4C607940070BD5606999 +:104AD0002030C17E0520FEF77BFE002803D0207A1F +:104AE000082108432072FFF701FA00F018F8FFF7D9 +:104AF00073F8A079C0060FD5207A00280CD1606920 +:104B00002030C17E0B0001F07FFD07070707070774 +:104B1000070507000721C176FEF7F3FF10BD10B5AA +:104B200026488179490715D5017A002912D14069B3 +:104B30003B21095C891E0B0001F066FD07050C0C8A +:104B40000C0D0C0F0C00002256210A54C030807945 +:104B5000FFF704FF10BD012100E00221C0304172C7 +:104B600010BD10B515488179090720D5017A0029B3 +:104B70001DD1406902462032D47EA41E230001F0DC +:104B800043FD13160B1616161616161616161616BF +:104B90001616161616171600562211546030407954 +:104BA000002801D0062000E01620FFF7D7FE10BD38 +:104BB0004030C1768175D17610BD0000C400002060 +:104BC00030B50346002002460DE09C5C2546303D92 +:104BD0000A2D02D30020C04330BD0A256843303877 +:104BE0002018521CD2B28A42EFD330BD70B50D46A8 +:104BF000144608E00A2101F012FB2A193031203A4C +:104C0000641ED177E4B2002CF4D170BD10B500233E +:104C100010E0040A00020443A0B2CC5C4440200629 +:104C2000000F60400407240C44402006C00C604084 +:104C30005B1C9BB29342ECD310BD000010B572B662 +:104C400000F0DCF800280BD0ECF72AFBF8F7EFFDBA +:104C500000F0A5FD6E490020C86288626D490860B9 +:104C600062B6002010BDF3B5002501200007C06A20 +:104C700081B0C0430006000E04D167480068401CA4 +:104C800000D1012572B600F0B9F8002802D062B652 +:104C90000820FEBDECF75AFAECF706FB5F4B604EBE +:104CA00000211A68CA40D2071FD00246CA40D20764 +:104CB00018D14AB2002A07DA1407240F083CA408C6 +:104CC000A400A419E46904E09408564FA400E41970 +:104CD00024689207D20ED4402206920F012A04D0F3 +:104CE000032A02D062B65048FEBD491C2029D8D301 +:104CF0000198030001F088FC14212323232323239C +:104D000023230B0D0F11131F1517191B1D2E002424 +:104D100016E0012414E0022412E0032410E004242D +:104D20000EE008240CE009240AE00A2408E00B2421 +:104D300006E00C2404E0052402E0072400E0062439 +:104D4000F06901210002000AC9070843F061002D43 +:104D500004D009E062B601200003FEBD2C4D3348AB +:104D6000E862ECF7A1FAA8622A49314808603149A3 +:104D700002980860ECF798FA214600F0F7FCF8F783 +:104D80001AFD00F0FDFE00F073FD0198ECF756FAF5 +:104D9000040062B603D0FFF751FF2046FEBD00209D +:104DA000FEBD10B5044600F029F8002800D001200F +:104DB0002070002010BD204908600020704710B509 +:104DC0000C46102808D011280BD012280CD013281C +:104DD0000ED00120086010BD03CC083CFFF743FF54 +:104DE0000AE0FFF72BFF07E02068FFF7DAFF03E098 +:104DF0001149206808600020206010BD05480C495A +:104E00000068884201D101207047002070470000EF +:104E100000050040780000200010001000E100E0D4 +:104E200000ED00E000E400E00110000000190000C7 +:104E3000BEBAFECAE40000200400002010B52038ED +:104E40000C46030001F0E0FB33A6AAAEB2B8BCC02A +:104E5000C5E0DBE41B1F23272C31373C41474D5075 +:104E600054585C606D71656974787C8084888C901E +:104E700094989C9FA2CACFE9F0F3D3D7F80020689A +:104E800000F0DDF8D6E0206800F0E1F8D2E020681C +:104E900000F0F5F8CEE0207840B200F0D7FAC9E093 +:104EA000207840B200F0F5FAC4E02078616840B2A2 +:104EB00000F008FBBEE0207840B200F018FBB9E03B +:104EC000207840B200F023FBB4E02078217940B292 +:104ED00000F02EFBAEE02078616840B200F058FB95 +:104EE000A8E000F064FBA5E0206800F068FBA1E00A +:104EF000207800F07DFB9DE02068F8F72CF899E021 +:104F00002068F8F72CF895E021792068F8F72EF85A +:104F100090E0206800F0E6F98CE0206800F0E7F906 +:104F200088E0207800F0E7F984E000F0F1F981E012 +:104F3000207800F0F3F97DE0207800F005FA79E0C0 +:104F4000206800F01EFA75E0206800F020FA71E099 +:104F5000206800F022FA6DE0206800F023FA69E092 +:104F6000206800F025FA65E0206800F027FA61E08B +:104F7000206800F028FA5DE00846ECF7FFF859E0F9 +:104F8000EDF719FA56E0EDF746FA53E02068EDF731 +:104F90004EFA4FE0206800F0E1F84BE0206800F0A6 +:104FA000E9F847E0206800F0F0F843E02078A268D4 +:104FB000616800F0F5F83DE0207800F006F939E08E +:104FC000207800F017F935E02078616800F027F9C3 +:104FD00030E02078616800F03AF92BE02179207800 +:104FE00000F016FC26E0206800F06BF822E0206854 +:104FF000F8F70CFB1EE02068F8F7F0FA1AE007CC8F +:105000000C3C00F0FFFC15E0206800F052FD11E0C0 +:1050100003CC083C00F07DFD0CE0206800F06EFF42 +:1050200008E009E003E0FFE700F080FF02E020680D +:1050300000F0B8FF206010BD0120086010BD002105 +:105040000170084670470146002008707047EFF372 +:105050001081C907C90F72B60278012A01D0012256 +:1050600000E0002201230370002900D162B6002A6B +:1050700001D000207047012040037047E7E7EFF3BD +:105080001081C907C90F72B600220270002900D131 +:1050900062B600207047F2E710B52848FFF7CFFF4F +:1050A000002803D026A11D2001F0BDF92348401C93 +:1050B000FFF7C5FF002803D021A1212001F0B3F99B +:1050C00010BDF1B5224D6F6801261C48FFF7BFFFE8 +:1050D0001A4C002803D10026601CFFF7D0FF1D4AA0 +:1050E0001D490120506000BF00BF00BF00BF00BFCE +:1050F00000230B604B60009B6B60106000BF00BF23 +:1051000000BF00BF00BF0868002802D1486800281F +:10511000F9D048680028E4D1002E04D06F60601CEC +:10512000FFF795FF07E0601CFFF791FF0028D3D140 +:105130000248FFF7A4FF0020F8BDC2E7E800002006 +:105140007372635C736F635F6563622E630000005C +:1051500000E5004000E0004000E100405A495B4BA0 +:105160000A685B499A42096801D18904890C016087 +:10517000002070475449554B0A6855499A4201D15D +:105180008004800C4860002070474F494F4B0A68EC +:105190004F499A4201D18004800C886000207047FA +:1051A00030B5494B494D1C684A4BAC4202D01028DF +:1051B00002D203E00E2801D3184630BDC300444894 +:1051C000181801614261002030BD3F493F4B0A6819 +:1051D0004049491C9A4202D0042802D203E0022826 +:1051E00001D3084670473C4A0121C0008018016085 +:1051F000002070473449354B0A683649491C9A42A9 +:1052000002D0042802D203E0022801D308467047E6 +:10521000314A0121C000801841600020704770B5FC +:10522000294A2C4B14682D4E284D82005B1C921984 +:10523000AC4203D0042803D2116006E0022801D357 +:10524000184670BD8804800C1060002070BD70B5D9 +:105250001D4A204B1468214E1C4D82005B1C921984 +:10526000AC4203D0042803D2106806E0022801D320 +:10527000184670BD10688004800C0860002070BD66 +:1052800010B5134A164890600E200021C3009B18E9 +:1052900019615961401C1028F8D300200F4A05E01D +:1052A000022803D383009B18196005E083009B1834 +:1052B0001C68A404A40C1C60401C0428F0D310BD7E +:1052C000034907488860704778000020BEBAFECACC +:1052D00000F501400820000000F0014000F8014006 +:1052E00000C0FFFF47490968016000207047454939 +:1052F0000860002070470121434A002803D001289C +:1053000003D042487047916300E0D16300207047AA +:105310003F49012008603D48801C704704223D4BF6 +:105320003B49002805D05A600869012210430861F2 +:1053300008E008694008400008619A60324900208E +:10534000C03188600020704731490622002808D00B +:10535000012809D002280DD003280FD02B48401C6B +:1053600070470869904302E008699043801C086117 +:105370000020704708699043001DF8E70869104352 +:10538000F5E723494A6A02434A62002070472049F0 +:105390004A6A82434A62002070471D49496A016097 +:1053A000002070471A49CA690243CA610020704749 +:1053B0001749CA698243CA61002070471449C96904 +:1053C0000160002070471249024600204031002A47 +:1053D00003D0012A01D0072070478A6370470D4926 +:1053E0000420886008490020C03188600A480168AC +:1053F0008022090A0902114301600849012008605E +:1054000070470000000400404000004004200000FD +:10541000000500400003004000E400E000E100E07F +:105420008107C90E002808DA0007000F0838800835 +:10543000814A80008018C06904E080087F4A8000AB +:1054400080180068C8400006800F704710B50446F9 +:1054500000F0DBF8002813D02046FFF7E1FFC0B2D0 +:1054600000F0E1F800280DD07549E2060B78D20E65 +:1054700001209040002B08D04A681043486006E0A5 +:10548000704810BD6F48401C10BD6F490860002077 +:1054900010BD10B5044600F0B8F800280BD06849DC +:1054A000E2060B78D20E01209040002B05D04A680E +:1054B00082434A6004E0634810BD6349803108605C +:1054C000002010BD70B50D46044600F09EF800287F +:1054D0000BD05E480068E206D20E012191400840E0 +:1054E00000D001202860002070BD564870BD10B566 +:1054F000044600F08AF8002807D0E106C90E012012 +:10550000884052490860002010BD4E4810BD10B5BB +:10551000044600F07AF8002808D0E106C90E012000 +:1055200088404A4980310860002010BD454810BDC0 +:1055300070B50D46044600F068F8002819D02846DA +:1055400000F071F8002816D0A007C10EFF228A4093 +:10555000A807000E8840002C10DA2107090F08392F +:105560008B0835499B005B18D96991430143D96188 +:105570000CE0344870BD3348401C70BDA3082F496F +:105580009B005B181968914301431960002070BDAE +:1055900070B50C46054600F038F8002805D02846BE +:1055A000FFF73EFF2070002070BD264870BDBFF39E +:1055B0004F8F21492648C860BFF34F8FFEE770B573 +:1055C0001F4C05462178012000290ED1207072B6AB +:1055D00000F0F4F81C4E803631688143616000F0C1 +:1055E000EDF8C043306062B600202870002070BD26 +:1055F00013490A78002A06D0002804D1124A4868C4 +:105600001060002008700020704710B50446202864 +:1056100007DA00F0D3F80121A140084201D10120AE +:1056200010BD002010BD012803D0032801D00020A8 +:10563000704701207047000000ED00E000E400E04A +:10564000EC0000200120000000E100E000E200E0AA +:105650000400FA05F8B50446800700250126002855 +:1056600004DA5848C563C66302208443E00404D5C5 +:105670005548C563C66380148443600003D553480E +:10568000456080058443E00504D55148C563C66381 +:1056900080158443A00404D54E48C563C6634014F6 +:1056A000844360042704C00FF90F884203D04AA145 +:1056B000612000F0B8FEB80F0AD04C49CD634C48C9 +:1056C000C563C563CE63C663C6630320800384439A +:1056D00020050AD5474FFD632F20EBF765FDFE63DC +:1056E0002F20EBF761FDF8148443FFF7C9FD424812 +:1056F000044203D038A18D2000F095FEF8BDF0B52E +:1057000000210A46FF230446CC40E4072AD04CB2CD +:10571000E606F60E0125B540384E3560384E356048 +:10572000002C11DA25072D0F083DAE08354DB600C7 +:105730007719FD69A407E60E1C46B440A54314463C +:10574000B4402543FD610DE0A6082F4DB600761943 +:105750003568A407E70E1C46BC40A5431446BC4070 +:1057600025433560491C2029CDD3F0BD70B5274CA9 +:105770000D462060FFF76EFF2068FFF7C0FF284648 +:10578000ECF7EAFEFFF788FCF7F778FBFFF778FD08 +:10579000FFF725FEECF766FD00F06AF870BD10B566 +:1057A0001A4C2068FFF756FF2068FFF7A8FFFFF7A5 +:1057B00067FDECF74BFF0020206010BD1348006828 +:1057C00070470000C01F0040C0CF004000E501400E +:1057D000C08F0040C0DF00407372635C736F635F13 +:1057E000636F6E6669672E6300000000C0EF0040C3 +:1057F000C0FF0040C0BF0040FEFF0FFC80E100E0A2 +:1058000080E200E000ED00E000E400E0F4000020B1 +:1058100070B5002402460D4620462146002A1ED0BF +:10582000012A04D0022A04D0032A1ED103E0012059 +:1058300002E0022013E003202B0000F0E5FE071633 +:105840000507090B0D0F1600012108E0022106E0F3 +:10585000032104E0042102E0052100E00621F8F71D +:1058600058F8002801D0204670BD0724FBE700004F +:10587000B348002101708170704770B5B14D0123AC +:105880006B60B14B1C68002CFCD0002407E00E6854 +:1058900006601E68002EFCD0001D091D641C944289 +:1058A000F5D30020686018680028FCD070BD70B582 +:1058B000A34C0E466178884203D0A4A16F2000F06B +:1058C000B2FD0325330000F09FFE09520624245246 +:1058D0005252524952002078022803D09BA17320D3 +:1058E00000F0A1FD2570A078022802D0012804D084 +:1058F00008E0A06800F0D2FB04E02046083007C8AA +:10590000FFF7BBFF0020A070F7F7A4FF0420207072 +:1059100070BDF8F754F801466068F9F776FA064664 +:105920002078022803D089A1872000F07CFD8B4AD3 +:105930008B498C48964205D86269032A02D2521CD0 +:10594000626102E0864207D84D71801BC8608449BD +:105950006078F8F7B4FC70BD032003E0A07800285D +:10596000FAD10220F7F77EFE00F0E1F870BD77A1D2 +:10597000B12000F058FD70BD70B50546F8F71FF86E +:105980006F4C60602078012803D070A1B82000F02F +:105990004AFD73490220087000220A718D600422BA +:1059A0004A71704ACA6020706078F8F788FC70BD50 +:1059B00010B5634CA078002802D12078002801D0CF +:1059C000112010BD6848F7F78BFF607060780028E1 +:1059D00004D0012020700020606110BD032010BDA4 +:1059E00010B50124020B64040121604BA04202D2D5 +:1059F0009140186802E0203A58689140084000D071 +:105A0000012010BDF8B50E46910005464F19144609 +:105A10003F1F009100F053FB009980028919091F74 +:105A2000B14201D2012200E00022002C03D0FF216C +:105A300001318C4201D90920F8BD4D498D4219D35D +:105A4000AF4217D3854205D2874203D2284630435E +:105A5000800701D01020F8BD8E420BD3002A09D157 +:105A60002846FFF7BDFF002804D13846FFF7B8FFEE +:105A7000002801D00F20F8BD3E483F490068884209 +:105A800005D0224631462846FFF7F7FE0FE0FFF724 +:105A90008FFF0028EFD12A480121C660856004618C +:105AA00081702046302148431830FFF765FF002001 +:105AB000F8BD10B504462E48800A84420BD300F08E +:105AC000FEFAA04201D8102010BDA0020446FFF744 +:105AD00087FF002801D00F2010BD26482649006806 +:105AE000884203D0204600F0D9FA0AE0FFF760FFB1 +:105AF0000028F1D112480221846081701F48FFF70D +:105B00003BFF002010BD1A48010B01208840401EB9 +:105B1000704700B50B460246FFF7F5FF104201D073 +:105B20000F2000BD114802604360002000BD10B589 +:105B3000034C6078F7F728FF00202070A07010BD9C +:105B4000F800002000E5014000E401407372635C4E +:105B5000736F635F666C6173682E6300307500005D +:105B6000E0140020D0FB0100AF5801000006004007 +:105B70000080010078000020BEBAFECA3A5600003C +:105B8000F74805218170002101704170C17081606A +:105B9000704710B5F3490A78022A07D0CA6810186E +:105BA000C860C8689638F9F7E9F810BD8A68101817 +:105BB00088608868F6E70378EB49EC4A002B02D04E +:105BC000012B10D014E00379002B01D0012B0FD151 +:105BD0004379002B01D0012B0AD18368643B8B42AF +:105BE00006D2C06810E00379002B03D0012B01D04E +:105BF000002070474379002B01D0012BF8D1C368F6 +:105C0000643B8B42F4D280689042F1D80120704707 +:105C1000F8B504460226F8F740FD0068002803D0D6 +:105C2000D3A1BD2000F0FFFB0127CD4D002C08D0F3 +:105C30002078002817D0012805D0022811D0032889 +:105C400013D02F710DE06068C82808D3F9F70BF95D +:105C5000002804D06068FFF79CFF012603E00026BF +:105C600001E000F0F9F93046F8BD28780028F8D1B5 +:105C70006068FFF7A0FF0028E3D060680078002884 +:105C800026D0A878042803D0B9A1F72000F0CBFBD8 +:105C9000B44F0020387060680079012800D00020DF +:105CA000387160684079002837D0042078716068C6 +:105CB0008168E868F8F71DF9B8606068C0689630D8 +:105CC000F8600320A870A749E878F8F7F8FAC8E761 +:105CD000A4480221017061680979012919D00021C5 +:105CE000017161684979002915D004214171616809 +:105CF0008968963181606168C968C160C068984CE4 +:105D000014346060F7F75BFE20606F700220A870AB +:105D1000A7E70321E4E70321E8E70320C6E7F8B596 +:105D20008F4C0D46E178884204D0FF2090A11930B5 +:105D300000F079FB28468A4F00250126143703001E +:105D400000F062FC090612375A7C8D97C4A0C4008B +:105D5000A078032807D0A078022804D0FF2084A1CF +:105D60001D3000F060FBF8BDA078032807D0A078B4 +:105D7000022804D0FF207EA1213000F054FB042033 +:105D8000A07025712078002810D1FFF702FFE0787D +:105D9000F8F7D6F8E0607D49886A7D4A02402261C2 +:105DA0007B4AD24310408862002050E000F054F952 +:105DB000F8BDA078032807D0A078022804D0FF20DF +:105DC0006BA1423000F02FFB2078002802D000F0B9 +:105DD0004FF9F8BDA07803281FD104202AE0091A42 +:105DE0006048C1600146E078F8F769FAF8BD042020 +:105DF000F7F738FCA570F8BDA078032807D0A07885 +:105E0000022804D0FF205AA1633000F00CFB207858 +:105E10000028DCD1A07803280BD0F7F7D0FD01468D +:105E20003868F8F7F2FF0028E1DB79688142DEDBB1 +:105E3000D5E70520F7F716FCA670F8BDA078042872 +:105E400004D0FF204AA1843000F0EDFA0220A168BE +:105E50008847FFF7DDFEFF260546BD3642E0A07805 +:105E6000042804D0FF2042A1893000F0DCFA012090 +:105E7000EDE7A078042899D0FF203DA18E3000F0F6 +:105E8000D2FA93E7A07804280AD06078002802D0DC +:105E9000A078022804D0FF2035A1933000F0C3FA87 +:105EA0002078002893D12079002804D00620F7F725 +:105EB000D9FB2571C0E76078002805D02949E07832 +:105EC000F8F7FDF96570F8BD0720B3E7FF2028A1BA +:105ED000AE3046E7002D0AD0012D06D024A1304671 +:105EE00000F0A1FA022DF5D1F8BD042000E0032056 +:105EF000A1688847FFF78CFE0546F3E770B50500FB +:105F000005D0174CA078052803D0112070BD1020B3 +:105F100070BD2048F7F7E4FCE070E078002803D07B +:105F2000A5600020A07070BD032070BD10B50C48A6 +:105F30000178002901D0112010BD817805292BD0CE +:105F4000817801292AD08178002927D00121017088 +:105F50008178012922D0807800281FD020E000001D +:105F600010010020F01400203D860100FF1FA10752 +:105F70007372635C736F635F726164696F5F74698E +:105F80006D65736C6F742E630000000000050040A7 +:105F9000028100001F5D01000F2010BD00F068F8B5 +:105FA000002010BDF8B5394E0446B078002801D065 +:105FB00001280DD1002C0DD02046FFF7FCFD002854 +:105FC0000AD02078324D002808D0B078012823D09C +:105FD0000F20F8BD1020F8BD0720F8BD02272F7054 +:105FE0002079012814D0002028716079002811D070 +:105FF00004206871A0689630A860E068E860E868EE +:10600000224C14346060F7F7DAFC2060B77019E0B6 +:106010000320E9E70320ECE700202870207901281D +:1060200016D0002028716079002813D004206871F0 +:10603000A168F068F7F75DFFA860E0689630E86057 +:106040000320B0701249F078F8F739F90020F8BD54 +:106050000320E7E70320EAE710B50E48816A0E4AFD +:1060600011400A4A126911438162F7F7F3FB10BD30 +:1060700010B5064CE078F7F787FC0820F7F7F2FA3E +:106080000520A07000202070607010BD100100205D +:10609000F014002000050040FD7EFFFF0A4A0221A7 +:1060A00051600A490B68002BFCD0906008680028FA +:1060B000FCD00020506008680028FCD07047012008 +:1060C000000740697047000000E5014000E401401E +:1060D000034610B50B439B070FD1042A0DD308C804 +:1060E00010C9121FA342F8D018BA21BA884201D9A8 +:1060F000012010BD0020C04310BD002A03D0D307EB +:1061000003D0521C07E0002010BD03780C78401C1F +:10611000491C1B1B07D103780C78401C491C1B1B16 +:1061200001D1921EF1D1184610BDF8B5042A2CD326 +:10613000830712D00B78491C0370401C521E830742 +:106140000BD00B78491C0370401C521E830704D0EF +:106150000B78491C0370401C521E8B079B0F05D007 +:10616000C91ADF002023DE1B08C90AE0EBF72CF870 +:10617000F8BD1D4608C9FD401C46B4402C4310C064 +:10618000121F042AF5D2F308C91A521EF0D40B7854 +:10619000491C0370401C521EEAD40B78491C037042 +:1061A000401C012AE4D409780170F8BD01E004C064 +:1061B000091F0429FBD28B0701D50280801CC90767 +:1061C00000D00270704700290BD0C30702D00270C4 +:1061D000401C491E022904D3830702D50280801C7B +:1061E000891EE3E70022EEE70022DFE70378C278AA +:1061F0001946437812061B0219438378C0781B04A2 +:10620000194311430902090A000608437047020AAC +:1062100008704A70020C8A70020ECA707047002221 +:1062200003098B4273D3030A8B4258D3030B8B426F +:106230003CD3030C8B4221D312E003460B437FD4A3 +:10624000002243088B4274D303098B425FD3030AB5 +:106250008B4244D3030B8B4228D3030C8B420DD3C8 +:10626000FF22090212BA030C8B4202D31212090256 +:1062700065D0030B8B4219D300E0090AC30B8B4294 +:1062800001D3CB03C01A5241830B8B4201D38B0342 +:10629000C01A5241430B8B4201D34B03C01A5241E7 +:1062A000030B8B4201D30B03C01A5241C30A8B422A +:1062B00001D3CB02C01A5241830A8B4201D38B0215 +:1062C000C01A5241430A8B4201D34B02C01A5241B9 +:1062D000030A8B4201D30B02C01A5241CDD2C3092B +:1062E0008B4201D3CB01C01A524183098B4201D3A7 +:1062F0008B01C01A524143098B4201D34B01C01A92 +:10630000524103098B4201D30B01C01A5241C30809 +:106310008B4201D3CB00C01A524183088B4201D378 +:106320008B00C01A524143088B4201D34B00C01A64 +:106330005241411A00D201465241104670475DE079 +:10634000CA0F00D04942031000D3404253400022FC +:106350009C4603098B422DD3030A8B4212D3FC22A5 +:10636000890112BA030A8B420CD3890192118B4224 +:1063700008D3890192118B4204D389013AD092113A +:1063800000E08909C3098B4201D3CB01C01A5241F5 +:1063900083098B4201D38B01C01A524143098B42BE +:1063A00001D34B01C01A524103098B4201D30B01A7 +:1063B000C01A5241C3088B4201D3CB00C01A5241CC +:1063C00083088B4201D38B00C01A5241D9D24308B3 +:1063D0008B4201D34B00C01A5241411A00D20146F0 +:1063E000634652415B10104601D34042002B00D55A +:1063F0004942704763465B1000D3404201B500201C +:10640000C046C04602BD70477047704710B500F0E7 +:106410003BF810BD012308CB134B1860134B1960D8 +:10642000134B1A607047134A134B13607246053AB8 +:10643000F0E7114A0F4B1B689A420ED10D4B00201A +:10644000186001980D4B04B598470CBC9E46024657 +:10645000029800990A4B1B68184706980599094B42 +:106460001B68DB6818470000340100203801002059 +:106470003C0100202C010020EFBEADDEC9CD0000A4 +:10648000E4000020040000201D481E497047FFF76B +:10649000FBFFEAF753FE00BD01200007C06AC0B24F +:1064A000FF2804D1184819490968884202D01848C1 +:1064B00018490160184819490968884203D1184AE7 +:1064C00013605B68184700BD20BFFDE71248134901 +:1064D000096888420ED1134B18680B498842F3D0E3 +:1064E00080F308881049884204DD104802680221C0 +:1064F0000A4302600E4880470E4880470E48004716 +:106500000015002000150020FFFFFFFF0010001005 +:106510002C050040080000000010000000000020D2 +:10652000040000200080010000200020240500401D +:10653000DFCD000099640100156401001348704527 +:1065400002D1EFF3098101E0EFF308818869023895 +:106550000078102814DB202810DB2B280BDB0C4ADA +:1065600012680C4B9A4203D1602804DB0A4A104798 +:10657000022008607047094A10470000084A104787 +:10658000084A12682C32126810470000FDFFFFFF16 +:1065900078000020BEBAFECAAD1200003D4E0100D8 +:1065A000BF4D0100040000200D4B0E4908470E4B63 +:1065B0000C4908470D4B0B4908470D4B0949084743 +:1065C0000C4B084908470C4B064908470B4B05493B +:1065D00008470B4B034908470A4B0249084700008C +:1065E00079250000192200009D2B00003F2A0000A1 +:1065F000ED2900009F270000B912000013140000CD +:10660000012B00000F23000030B47446641E25786F +:10661000641CAB4200D21D46635D5B00E31830BCD6 +:10662000184703B5684600784006400E401C884273 +:1066300005D269460878401CC0B208700CBD684697 +:106640000078000601D500200CBD80200CBD414023 +:10665000802901D0002070470120704737B50878A5 +:106660000C4669460978884206D020781146FFF723 +:10667000D8FF207001203EBD00203EBD37B5044646 +:106680000078154669460979FFF7E1FF002801D037 +:1066900000203EBD20782946FFF7C3FF207001206F +:1066A0003EBD0FB568460179007881420AD0684640 +:1066B000007922214006400E4843801818600120CE +:1066C00004B000BD0020FBE77FB5684601791C4699 +:1066D00015460078FFF7BBFF002802D0002004B069 +:1066E00070BD6846007822214006400E484340199C +:1066F00020600120F3E70000FFFFFFFF0000FFFF25 +:106700000100030000000100000000000000000084 +:1067100000000000000000008700000000000000F2 +:10672000000000000000000000000001020304005F +:106730000D0E0F100000000033690000516B0000C7 +:10674000196C0000736C0000C76C00002F6D000016 +:106750008D690000456A0000D16D0000DF790000FE +:10676000100110013A0200001A02000004013C006E +:10677000230044000E0001020408102040805555FB +:1067800055D6BE898E0000007006120DB4130000AD +:1067900014035A06A00900006004F208840DF401F5 +:1067A000FA00960064004B0032001E001400000046 +:1067B000E067010008000020100000000411000044 +:1067C000F0670100180000202801000004110000FB +:1067D0001869010040010020C013000020110000D2 +:1067E0000249022208681042FCD0704700E200E033 +:1067F0000000000000000000000000000000000099 +:106800000000000000000000000000000000000088 +:106810000000000000000000000000000000000078 +:10682000000000000100010054000020FB349B5FC9 +:106830008000008000100000000000000000000048 +:106840000000000000000000000000000000000048 +:106850000000000001000000000000000000000037 +:106860000000000000000000000000000000000028 +:106870000000000000000000000000000000000018 +:106880000000000000000000000000000000000008 +:1068900000000000000000000000000000000000F8 +:1068A00000000000000000000000000000000000E8 +:1068B00000000000000000000000000000000000D8 +:1068C00000000000000000000000000000000000C8 +:1068D00000000000000000000000000000000000B8 +:1068E00000000000000000000000000000000000A8 +:1068F0000000000000000000000000000000000098 +:106900000000000000000000196401000000000009 +:0869100000000000000000007F +:00000001FF diff --git a/components/softdevice/s110/toolchain/armgcc/armgcc_s110_nrf51422_xxaa.ld b/components/softdevice/s110/toolchain/armgcc/armgcc_s110_nrf51422_xxaa.ld new file mode 100644 index 0000000..64e8506 --- /dev/null +++ b/components/softdevice/s110/toolchain/armgcc/armgcc_s110_nrf51422_xxaa.ld @@ -0,0 +1,22 @@ +/* Linker script to configure memory regions. */ + +SEARCH_DIR(.) +GROUP(-lgcc -lc -lnosys) + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x18000, LENGTH = 0x28000 + RAM (rwx) : ORIGIN = 0x20002000, LENGTH = 0x2000 +} + +SECTIONS +{ + .fs_data_out ALIGN(4): + { + PROVIDE( __start_fs_data = .); + KEEP(*(fs_data)) + PROVIDE( __stop_fs_data = .); + } = 0 +} + +INCLUDE "nrf5x_common.ld" \ No newline at end of file diff --git a/components/softdevice/s110/toolchain/armgcc/armgcc_s110_nrf51422_xxac.ld b/components/softdevice/s110/toolchain/armgcc/armgcc_s110_nrf51422_xxac.ld new file mode 100644 index 0000000..1fcc989 --- /dev/null +++ b/components/softdevice/s110/toolchain/armgcc/armgcc_s110_nrf51422_xxac.ld @@ -0,0 +1,22 @@ +/* Linker script to configure memory regions. */ + +SEARCH_DIR(.) +GROUP(-lgcc -lc -lnosys) + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x18000, LENGTH = 0x28000 + RAM (rwx) : ORIGIN = 0x20002000, LENGTH = 0x6000 +} + +SECTIONS +{ + .fs_data_out ALIGN(4): + { + PROVIDE( __start_fs_data = .); + KEEP(*(fs_data)) + PROVIDE( __stop_fs_data = .); + } = 0 +} + +INCLUDE "nrf5x_common.ld" \ No newline at end of file diff --git a/components/softdevice/s110/toolchain/armgcc/armgcc_s110_nrf51822_xxaa.ld b/components/softdevice/s110/toolchain/armgcc/armgcc_s110_nrf51822_xxaa.ld new file mode 100644 index 0000000..64e8506 --- /dev/null +++ b/components/softdevice/s110/toolchain/armgcc/armgcc_s110_nrf51822_xxaa.ld @@ -0,0 +1,22 @@ +/* Linker script to configure memory regions. */ + +SEARCH_DIR(.) +GROUP(-lgcc -lc -lnosys) + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x18000, LENGTH = 0x28000 + RAM (rwx) : ORIGIN = 0x20002000, LENGTH = 0x2000 +} + +SECTIONS +{ + .fs_data_out ALIGN(4): + { + PROVIDE( __start_fs_data = .); + KEEP(*(fs_data)) + PROVIDE( __stop_fs_data = .); + } = 0 +} + +INCLUDE "nrf5x_common.ld" \ No newline at end of file diff --git a/components/softdevice/s110/toolchain/armgcc/armgcc_s110_nrf51822_xxab.ld b/components/softdevice/s110/toolchain/armgcc/armgcc_s110_nrf51822_xxab.ld new file mode 100644 index 0000000..1bad769 --- /dev/null +++ b/components/softdevice/s110/toolchain/armgcc/armgcc_s110_nrf51822_xxab.ld @@ -0,0 +1,22 @@ +/* Linker script to configure memory regions. */ + +SEARCH_DIR(.) +GROUP(-lgcc -lc -lnosys) + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x18000, LENGTH = 0x8000 + RAM (rwx) : ORIGIN = 0x20002000, LENGTH = 0x2000 +} + +SECTIONS +{ + .fs_data_out ALIGN(4): + { + PROVIDE( __start_fs_data = .); + KEEP(*(fs_data)) + PROVIDE( __stop_fs_data = .); + } = 0 +} + +INCLUDE "nrf5x_common.ld" \ No newline at end of file diff --git a/components/softdevice/s110/toolchain/iar/iar_s110_nrf51422_xxaa.icf b/components/softdevice/s110/toolchain/iar/iar_s110_nrf51422_xxaa.icf new file mode 100644 index 0000000..7b19877 --- /dev/null +++ b/components/softdevice/s110/toolchain/iar/iar_s110_nrf51422_xxaa.icf @@ -0,0 +1,31 @@ +/*###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__ = 0x18000; +/*-Memory Regions-*/ +define symbol __ICFEDIT_region_ROM_start__ = 0x18000; +define symbol __ICFEDIT_region_ROM_end__ = 0x3ffff; +define symbol __ICFEDIT_region_RAM_start__ = 0x20002000; +define symbol __ICFEDIT_region_RAM_end__ = 0x20003fff; +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x800; +define symbol __ICFEDIT_size_heap__ = 0x200; +/**** End of ICF editor section. ###ICF###*/ + +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 CSTACK, + block HEAP }; diff --git a/components/softdevice/s110/toolchain/iar/iar_s110_nrf51422_xxac.icf b/components/softdevice/s110/toolchain/iar/iar_s110_nrf51422_xxac.icf new file mode 100644 index 0000000..028107f --- /dev/null +++ b/components/softdevice/s110/toolchain/iar/iar_s110_nrf51422_xxac.icf @@ -0,0 +1,31 @@ +/*###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__ = 0x18000; +/*-Memory Regions-*/ +define symbol __ICFEDIT_region_ROM_start__ = 0x18000; +define symbol __ICFEDIT_region_ROM_end__ = 0x3ffff; +define symbol __ICFEDIT_region_RAM_start__ = 0x20002000; +define symbol __ICFEDIT_region_RAM_end__ = 0x20007fff; +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x800; +define symbol __ICFEDIT_size_heap__ = 0x200; +/**** End of ICF editor section. ###ICF###*/ + +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 CSTACK, + block HEAP }; diff --git a/components/softdevice/s110/toolchain/iar/iar_s110_nrf51822_xxaa.icf b/components/softdevice/s110/toolchain/iar/iar_s110_nrf51822_xxaa.icf new file mode 100644 index 0000000..7b19877 --- /dev/null +++ b/components/softdevice/s110/toolchain/iar/iar_s110_nrf51822_xxaa.icf @@ -0,0 +1,31 @@ +/*###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__ = 0x18000; +/*-Memory Regions-*/ +define symbol __ICFEDIT_region_ROM_start__ = 0x18000; +define symbol __ICFEDIT_region_ROM_end__ = 0x3ffff; +define symbol __ICFEDIT_region_RAM_start__ = 0x20002000; +define symbol __ICFEDIT_region_RAM_end__ = 0x20003fff; +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x800; +define symbol __ICFEDIT_size_heap__ = 0x200; +/**** End of ICF editor section. ###ICF###*/ + +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 CSTACK, + block HEAP }; diff --git a/components/softdevice/s110/toolchain/iar/iar_s110_nrf51822_xxab.icf b/components/softdevice/s110/toolchain/iar/iar_s110_nrf51822_xxab.icf new file mode 100644 index 0000000..1781997 --- /dev/null +++ b/components/softdevice/s110/toolchain/iar/iar_s110_nrf51822_xxab.icf @@ -0,0 +1,31 @@ +/*###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__ = 0x18000; +/*-Memory Regions-*/ +define symbol __ICFEDIT_region_ROM_start__ = 0x18000; +define symbol __ICFEDIT_region_ROM_end__ = 0x1ffff; +define symbol __ICFEDIT_region_RAM_start__ = 0x20002000; +define symbol __ICFEDIT_region_RAM_end__ = 0x20003fff; +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x800; +define symbol __ICFEDIT_size_heap__ = 0x200; +/**** End of ICF editor section. ###ICF###*/ + +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 CSTACK, + block HEAP }; diff --git a/components/softdevice/s120/doc/s120_nrf51822_2.0.0_licence_agreement.txt b/components/softdevice/s120/doc/s120_nrf51822_2.0.0_licence_agreement.txt new file mode 100644 index 0000000..ef3a1dc --- /dev/null +++ b/components/softdevice/s120/doc/s120_nrf51822_2.0.0_licence_agreement.txt @@ -0,0 +1,91 @@ +S110/S120 license agreement + +NORDIC SEMICONDUCTOR ASA SOFTDEVICE LICENSE AGREEMENT + +License Agreement for the Nordic Semiconductor ASA ("Nordic") S110 and S120 Bluetooth SoftDevice software packages ("SoftDevice"). + +You ("You" "Licensee") must carefully and thoroughly read this License Agreement ("Agreement"), and accept to adhere to this Agreement before +downloading, installing and/or using any software or content in the SoftDevice provided herewith. + +YOU ACCEPT THIS LICENSE AGREEMENT BY (A) CLICKING ACCEPT OR AGREE TO THIS LICENSE AGREEMENT, WHERE THIS +OPTION IS MADE AVAILABLE TO YOU; OR (B) BY ACTUALLY USING THE SOFTDEVICE, IN THIS CASE YOU AGREE THAT THE USE OF +THE SOFTDEVICE CONSTITUTES ACCEPTANCE OF THE LICENSING AGREEMENT FROM THAT POINT ONWARDS. + +IF YOU DO NOT AGREE TO BE BOUND BY THE TERMS OF THIS AGREEMENT, THEN DO NOT DOWNLOAD, INSTALL/COMPLETE +INSTALLATION OF, OR IN ANY OTHER WAY MAKE USE OF THE SOFTDEVICE. + +1. Grant of License +Subject to the terms in this Agreement Nordic grants Licensee a limited, non-exclusive, non-transferable, non-sub licensable, revocable license +("License"): (a) to use the SoftDevice solely in connection with a Nordic integrated circuit, and (b) to distribute the SoftDevice solely as integrated +in Licensee Product. Licensee shall not use the SoftDevice for any purpose other than specifically authorized herein. It is a material breach of this +agreement to use or modify the SoftDevice for use on any wireless connectivity integrated circuit other than a Nordic integrated circuit. + +2. Title +Nordic retains full rights, title, and ownership to the SoftDevice and any and all patents, copyrights, trade secrets, trade names, trademarks, and +other intellectual property rights in and to the SoftDevice. + +3. No Modifications or Reverse Engineering +Licensee shall not, modify, reverse engineer, disassemble, decompile or otherwise attempt to discover the source code of any non-source code +parts of the SoftDevice including, but not limited to pre-compiled hex files, binaries and object code. + +4. Distribution Restrictions +Except as set forward in Section 1 above, the Licensee may not disclose or distribute any or all parts of the SoftDevice to any third party. +Licensee agrees to provide reasonable security precautions to prevent unauthorized access to or use of the SoftDevice as proscribed herein. +Licensee also agrees that use of and access to the SoftDevice will be strictly limited to the employees and subcontractors of the Licensee +necessary for the performance of development, verification and production tasks under this Agreement. The Licensee is responsible for making +such employees and subcontractors comply with the obligations concerning use and non-disclosure of the SoftDevice. + +5. No Other Rights +Licensee shall use the SoftDevice only in compliance with this Agreement and shall refrain from using the SoftDevice in any way that may be +contrary to this Agreement. + +6. Fees +Nordic grants the License to the Licensee free of charge provided that the Licensee undertakes the obligations in the Agreement and warrants to +comply with the Agreement. + +7. DISCLAIMER OF WARRANTY +THE SOFTDEVICE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND EXPRESS OR IMPLIED AND NEITHER NORDIC, ITS +LICENSORS OR AFFILIATES NOR THE COPYRIGHT HOLDERS MAKE ANY REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR +THAT THE SOFTDEVICE WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. THERE +IS NO WARRANTY BY NORDIC OR BY ANY OTHER PARTY THAT THE FUNCTIONS CONTAINED IN THE SOFTDEVICE WILL MEET THE +REQUIREMENTS OF LICENSEE OR THAT THE OPERATION OF THE SOFTDEVICE WILL BE UNINTERRUPTED OR ERROR-FREE. +LICENSEE ASSUMES ALL RESPONSIBILITY AND RISK FOR THE SELECTION OF THE SOFTDEVICE TO ACHIEVE LICENSEES +INTENDED RESULTS AND FOR THE INSTALLATION, USE AND RESULTS OBTAINED FROM IT. + +8. No Support +Nordic is not obligated to furnish or make available to Licensee any further information, software, technical information, know-how, show-how, +bug-fixes or support. Nordic reserves the right to make changes to the SoftDevice without further notice. + +9. Limitation of Liability +In no event shall Nordic, its employees or suppliers, licensors or affiliates be liable for any lost profits, revenue, sales, data or costs of +procurement of substitute goods or services, property damage, personal injury, interruption of business, loss of business information or for any +special, direct, indirect, incidental, economic, punitive, special or consequential damages, however caused and whether arising under contract, +tort, negligence, or other theory of liability arising out of the use of or inability to use the SoftDevice, even if Nordic or its employees or suppliers, +licensors or affiliates are advised of the possibility of such damages. Because some countries/states/jurisdictions do not allow the exclusion or +limitation of liability, but may allow liability to be limited, in such cases, Nordic, its employees or licensors or affiliates liability shall be limited to +USD 50. + +10. Breach of Contract +Upon a breach of contract by the Licensee, Nordic and its licensor are entitled to damages in respect of any direct loss which can be reasonably +attributed to the breach by the Licensee. If the Licensee has acted with gross negligence or willful misconduct, the Licensee shall cover both +direct and indirect costs for Nordic and its licensors. + +11. Indemnity +Licensee undertakes to indemnify, hold harmless and defend Nordic and its directors, officers, affiliates, shareholders, licensors, employees and +agents from and against any claims or lawsuits, including attorney's fees, that arise or result of the Licensees execution of the License and which +is not due to causes for which Nordic is responsible. + +12. Governing Law +This Agreement shall be construed according to the laws of Norway, and hereby submits to the exclusive jurisdiction of the Oslo tingrett. + +13. Assignment +Licensee shall not assign this Agreement or any rights or obligations hereunder without the prior written consent of Nordic. + +14. Termination +Without prejudice to any other rights, Nordic may cancel this Agreement if Licensee does not abide by the terms and conditions of this +Agreement. Upon termination Licensee must promptly cease the use of the License and destroy all copies of the Licensed Technology and any +other material provided by Nordic or its affiliate, or produced by the Licensee in connection with the Agreement or the Licensed Technology. + +15. Third party beneficiaries +Nordics licensors are intended third party beneficiaries under this Agreement. \ No newline at end of file diff --git a/components/softdevice/s120/doc/s120_nrf51_2.1.0_licence_agreement.pdf b/components/softdevice/s120/doc/s120_nrf51_2.1.0_licence_agreement.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7aab95c8e7ae8c764467d3d81fa9069d2ff9c2ef GIT binary patch literal 5553 zcmc(jXIPZUvVau{imnJEC~=4mpiE+jLk*m+>M^e8(`;moR@SEiSv3zTNagMaQ2j>9;4npZvMD4Uri_x$ncIO8Gkw z%tMWZSvf%~?| z-jJcXWRnHj=U8&nVoF|V2<{6lpH$SLnszpOe0<-v`K#czwI6$X^(`*8hID zoqa@~I{3`-ytKr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+Pd&V rgcm31y2F4dcd3%l@h_AMS=c+dcsQAvqag!<>}bfZUyCV-qapt_EVT series. */ + uint16_t evt_len; /**< Length in octets excluding 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 Mutual exclusion of radio activity and CPU execution. + * + * This option configures the application's access to the CPU when the radio is active. The + * application can configure itself to be blocked from using the CPU while the radio is + * active. By default, the application will be able to share CPU time with the SoftDevice + * during radio activity. This parameter structure is used together with @ref sd_ble_opt_set + * to configure the @ref BLE_COMMON_OPT_RADIO_CPU_MUTEX option. + * + * @note Note that the application should use this option to configure the SoftDevice to block the + * CPU during radio activity (i.e enable mutual exclusion) when running the SoftDevice on + * hardware affected by PAN #44 "CCM may exceed real time requirements"and PAN #45 "AAR may + * exceed real time requirements". + * + * @note Note that when acting as a scanner, the mutex is only enabled for radio TX activity. + * + * @note @ref sd_ble_opt_get is not supported for this option. + * + */ +typedef struct +{ + uint8_t enable : 1; /**< Enable mutual exclusion of radio activity and the CPU execution. */ +} ble_common_opt_radio_cpu_mutex_t; + +/**@brief Option structure for common options. */ +typedef union +{ + ble_common_opt_radio_cpu_mutex_t radio_cpu_mutex; /**< Parameters for the option for the mutual exclusion of radio activity and CPU execution. */ +} ble_common_opt_t; + +/**@brief Common BLE Option type, wrapping the module specific options. */ +typedef union +{ + ble_common_opt_t common_opt; /**< Common option, opt_id in BLE_COMMON_OPT_* series. */ + ble_gap_opt_t gap_opt; /**< GAP option, opt_id in BLE_GAP_OPT_* series. */ +} ble_opt_t; + +/** + * @brief BLE GATTS init options + */ +typedef struct +{ + ble_gap_enable_params_t gap_enable_params; /**< GAP init options @ref ble_gap_enable_params_t */ + ble_gatts_enable_params_t gatts_enable_params; /**< GATTS init options @ref ble_gatts_enable_params_t. */ +} ble_enable_params_t; + +/** @} */ + +/** @addtogroup BLE_COMMON_FUNCTIONS Functions + * @{ */ + +/**@brief Enable the bluetooth stack + * + * @param[in] p_ble_enable_params Pointer to ble_enable_params_t + * + * @details This call initializes the bluetooth stack, no other BLE related call can be called before this one has been executed. + * + * @return @ref NRF_SUCCESS BLE stack has been initialized successfully + * @retval @ref NRF_ERROR_INVALID_STATE stack had already been initialized and cannot be reinitialized. + * @return @ref NRF_ERROR_INVALID_ADDR Invalid or not sufficiently aligned pointer supplied. + * @retval @ref NRF_ERROR_INVALID_PARAM Invalid parameter supplied. + */ +SVCALL(SD_BLE_ENABLE, uint32_t, sd_ble_enable(ble_enable_params_t * p_ble_enable_params)); + +/**@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 signalled that an event is + * available from the BLE Stack by the triggering of the SD_EVT_IRQn interrupt (mapped to IRQ 22). + * 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 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. + * + * @note The pointer supplied must be aligned to the extend defined by @ref BLE_EVTS_PTR_ALIGNMENT + * + * @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 application transmission buffers per link in the BLE stack. + * + * @details This call allows the application to obtain the total number of + * transmission buffers available per link for application data. Please note that + * this does not give the number of free buffers, but rather the total amount of them. + * The application has two options to handle its own application transmission buffers: + * - Use a simple arithmetic calculation: at boot time the application should use this function + * to find out the total amount of buffers available to it and store it in a variable. + * Every time a packet that consumes an application buffer is sent 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 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 packets. + * This mechanism allows the application to be aware at any time of the number of + * application packets available in the BLE stack's internal buffers, 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. + * - Choose to simply not keep track of available buffers at all, and instead handle the + * @ref BLE_ERROR_NO_TX_BUFFERS 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 buffer 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[out] p_count Pointer to a uint8_t which will contain the number of application transmission buffers upon + * successful return. + * + * @retval ::NRF_SUCCESS Number of application transmission buffers retrieved successfully. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + */ +SVCALL(SD_BLE_TX_BUFFER_COUNT_GET, uint32_t, sd_ble_tx_buffer_count_get(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. + * + * + * @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. + * @retval ::NRF_ERROR_FORBIDDEN If p_vs_uuid has already been added to the VS UUID table. + */ +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 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. + * + * @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 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. + * + * @param[in] opt_id Option ID. + * @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 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. + * @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 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)); + +/** @} */ + +#endif /* BLE_H__ */ + +/** + @} + @} +*/ diff --git a/components/softdevice/s120/headers/ble_err.h b/components/softdevice/s120/headers/ble_err.h new file mode 100644 index 0000000..1184f24 --- /dev/null +++ b/components/softdevice/s120/headers/ble_err.h @@ -0,0 +1,83 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/* @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_BUFFERS (NRF_ERROR_STK_BASE_NUM+0x004) /**< Buffer capacity exceeded. */ +#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. */ +/** @} */ + +#endif + + +/** + @} + @} +*/ diff --git a/components/softdevice/s120/headers/ble_gap.h b/components/softdevice/s120/headers/ble_gap.h new file mode 100644 index 0000000..de25d37 --- /dev/null +++ b/components/softdevice/s120/headers/ble_gap.h @@ -0,0 +1,1365 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/**@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_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. */ + BLE_GAP_EVT_DISCONNECTED, /**< Disconnected from peer. */ + BLE_GAP_EVT_CONN_PARAM_UPDATE, /**< Connection Parameters updated. */ + BLE_GAP_EVT_SEC_PARAMS_REQUEST, /**< Request to provide security parameters. */ + BLE_GAP_EVT_SEC_INFO_REQUEST, /**< Request to provide security information. */ + BLE_GAP_EVT_PASSKEY_DISPLAY, /**< Request to display a passkey to the user. */ + BLE_GAP_EVT_AUTH_KEY_REQUEST, /**< Request to provide an authentication key. */ + BLE_GAP_EVT_AUTH_STATUS, /**< Authentication procedure completed with status. */ + BLE_GAP_EVT_CONN_SEC_UPDATE, /**< Connection security updated. */ + BLE_GAP_EVT_TIMEOUT, /**< Timeout expired. */ + BLE_GAP_EVT_RSSI_CHANGED, /**< Signal strength measurement report. */ + BLE_GAP_EVT_ADV_REPORT, /**< Advertising report. */ + BLE_GAP_EVT_SEC_REQUEST, /**< Security Request. */ + BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST, /**< Connection Parameter Update Request. */ + BLE_GAP_EVT_SCAN_REQ_REPORT, /**< Scan request report. */ +}; + +/**@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. */ +/**@} */ + + +/**@defgroup BLE_GAP_ROLES GAP Roles + * @{ */ +#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_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 in spec (Addendum 2)). */ +#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_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_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. */ +/**@} */ + +/**@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 connction interval specified in connect parameters. */ +#define BLE_GAP_CP_MIN_CONN_INTVL_MIN 0x0006 /**< Lowest mimimum 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 connction 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 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 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 init options + */ +typedef struct +{ + uint8_t role:2; /**< BLE role to use, see @ref BLE_GAP_ROLES */ +} 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 BT Spec 4.1 Vol 2 Part E, Section 7.8.12 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 link requirements. + * + * See Bluetooth Core specification, Volume 3 Part C 10.2 for details. + * + * 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 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 or 3), 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 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 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 and scanning. */ +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 none is given. */ + 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 ble_gap_channel_mask_t for documentation. */ +} 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 none is given. */ + 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. */ +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. */ +} ble_gap_sec_kdist_t; + + +/**@brief GAP security parameters. */ +typedef struct +{ + uint8_t bond : 1; /**< Perform bonding. */ + uint8_t mitm : 1; /**< Man In The Middle protection required. */ + 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_periph; /**< Key distribution bitmap: keys that the peripheral device will distribute. */ + ble_gap_sec_kdist_t kdist_central; /**< Key distribution bitmap: keys that the central 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 auth : 1; /**< Authenticated Key. */ + uint8_t ltk_len : 7; /**< 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 Event data for connected event. */ +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 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 data for disconnected event. */ +typedef struct +{ + uint8_t reason; /**< HCI error code, see @ref BLE_HCI_STATUS_CODES. */ +} ble_gap_evt_disconnected_t; + + +/**@brief Event data for connection parameter update event. */ +typedef struct +{ + ble_gap_conn_params_t conn_params; /**< GAP Connection Parameters. */ +} ble_gap_evt_conn_param_update_t; + + +/**@brief Event data for security parameters request event. */ +typedef struct +{ + ble_gap_sec_params_t peer_params; /**< Initiator Security Parameters. */ +} ble_gap_evt_sec_params_request_t; + + +/**@brief Event data for security info request event. */ +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 data for passkey display event. */ +typedef struct +{ + uint8_t passkey[BLE_GAP_PASSKEY_LEN]; /**< 6-digit passkey in ASCII ('0'-'9' digits only). */ +} ble_gap_evt_passkey_display_t; + + +/**@brief Event data for authentication key request event. */ +typedef struct +{ + uint8_t key_type; /**< See @ref BLE_GAP_AUTH_KEY_TYPES. */ +} ble_gap_evt_auth_key_request_t; + + +/**@brief Security levels supported. + * @note See Bluetooth Specification Version 4.1 Volume 3, Part C, Chapter 10. +*/ +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. */ +} 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_sec_keys_t; + + +/**@brief Security key set (both Peripheral and Central keys). + * Note that when distributing Bluetooth addresses pertaining to the local device those + * will have to be filled in by the user. */ +typedef struct +{ + ble_gap_sec_keys_t keys_periph; /**< Keys distributed by the device in the Peripheral role. */ + ble_gap_sec_keys_t keys_central; /**< Keys distributed by the device in the Central role. */ +} ble_gap_sec_keyset_t; + + +/**@brief Event data for authentication status event. */ +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_periph; /**< Bitmap stating which keys were exchanged (distributed) by the peripheral. */ + ble_gap_sec_kdist_t kdist_central; /**< Bitmap stating which keys were exchanged (distributed) by the central. */ +} ble_gap_evt_auth_status_t; + + +/**@brief Event data for connection security update event. */ +typedef struct +{ + ble_gap_conn_sec_t conn_sec; /**< Connection security level. */ +} ble_gap_evt_conn_sec_update_t; + + +/**@brief Event data for timeout event. */ +typedef struct +{ + uint8_t src; /**< Source of timeout event, see @ref BLE_GAP_TIMEOUT_SOURCES. */ +} ble_gap_evt_timeout_t; + + +/**@brief Event data for advertisement report event. */ +typedef struct +{ + int8_t rssi; /**< Received Signal Strength Indication in dBm. */ +} ble_gap_evt_rssi_changed_t; + + +/**@brief Event data for advertising report event. */ +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 data for scan request report events. */ +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 Event data for security request event. */ +typedef struct +{ + uint8_t bond : 1; /**< Perform bonding. */ + uint8_t mitm : 1; /**< Man In The Middle protection required. */ +} ble_gap_evt_sec_request_t; + + +/**@brief Event data for connection parameter update request event. */ +typedef struct +{ + ble_gap_conn_params_t conn_params; /**< GAP Connection Parameters. */ +} ble_gap_evt_conn_param_update_request_t; + + +/**@brief GAP event callback event structure. */ +typedef struct +{ + uint16_t conn_handle; /**< Connection Handle on which event occured. */ + 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_auth_key_request_t auth_key_request; /**< Authentication Key Request Event Parameters. */ + 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 default off, and needs to be set 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 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. + * + * @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, const ble_gap_addr_t *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. + * + * @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_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 ::BLE_ERROR_GAP_UUID_LIST_MISMATCH Invalid UUID list supplied. + * @retval ::BLE_ERROR_INVALID_ROLE Operation is not supported in the Central role. + */ +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. + * + * @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_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_INVALID_ROLE Operation is not supported in the Central role. + */ +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). + * + * @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). + * @retval ::BLE_ERROR_INVALID_ROLE Operation is not supported in the Central role. + */ +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 both to reply to a @ref BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST or to start the procedure unrequested. + * + * @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. + * + * @param[in] conn_handle Connection handle. + * @param[in] hci_status_code HCI status code, see @ref BLE_HCI_STATUS_CODES (accepted values are BTLE_REMOTE_USER_TERMINATED_CONNECTION and BTLE_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 -40 dBm will not actually give -40 dBm, but will instead be remapped to -30 dBm. + * + * @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. + * @retval ::BLE_ERROR_INVALID_ROLE Operation is not supported in the Central role. + */ +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. + * @retval ::BLE_ERROR_INVALID_ROLE Operation is not supported in the Central role. + */ +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. + * + * @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. + * + * @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. + * + * @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 GAP Authentication procedure. + * + * @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 procedure. + * In the peripheral role, only the timeout, bond and mitm fields of this structure are used. + * In the central role, this pointer may be NULL to reject a Security Request. + * + * @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. + * + * @note Calling this function may result in the following events depending on the outcome and parameters: @ref BLE_GAP_EVT_SEC_PARAMS_REQUEST, + * @ref BLE_GAP_EVT_SEC_INFO_REQUEST, @ref BLE_GAP_EVT_AUTH_KEY_REQUEST, @ref BLE_GAP_EVT_AUTH_STATUS. + * + * + * @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 ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + * @retval ::NRF_ERROR_TIMEOUT A SMP timout has occured, 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. + * + * @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. As a central 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 distributed as a result of the ongoing security procedure + * will be stored into the memory referenced inside this structure. The keys will be stored and availabel to the applicaiton upon reception + * of a @ref BLE_GAP_EVT_AUTH_STATUS event. A NULL pointer will result in the keys not being stored at all. + * The ID key data distributed by the local device constitute an exception. It will either have to be filled in by the user + * before calling this function, in which case the filled in address and IRK is distributed, or the pointer to the ID key data structure + * can be NULL, in which case the device's configured (or default, if none is configured) Bluetooth address and IRK is distributed. + * + * @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. + * + * @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. + */ +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. + * + * @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). + * If key type is @ref BLE_GAP_AUTH_KEY_TYPE_OOB, then a 16-byte OOB key value in Little Endian format. + * + * @details This function is only used to reply to a @ref BLE_GAP_EVT_AUTH_KEY_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. + * + * @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 Initiate GAP Encryption procedure. + * + * @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. + * + * @details In the central role, this function will initiate the encryption procedure using the encryption information provided. + * + * @note Calling this function may result in the following event depending on the outcome and parameters: @ref BLE_GAP_EVT_CONN_SEC_UPDATE. + * + * @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. + * + * @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. + * + * @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 implemented yet. p_sign_info must therefore be NULL. + * + * @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. + * + * @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. + * + * 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. + * + * @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 RSSI for the last connection event. + * + * @param[in] conn_handle Connection handle. + * @param[out] p_rssi Pointer to the location where the RSSI measurement shall be stored. + * + * @ref sd_ble_gap_rssi_start should be called to start sampling RSSI. @ref NRF_ERROR_NOT_FOUND + * will be returned until RSSI was sampled for the first time after calling sd_ble_gap_rssi_start. + * + * @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 is not started, 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). + * + * @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_NOT_SUPPORTED A selected feature is not supported (selective scanning). + * @retval ::BLE_ERROR_INVALID_ROLE Operation is not supported in the Peripheral role. + */ +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). + * + * @retval ::NRF_SUCCESS Successfully stopped scanning procedure. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation (most probably not in scanning state). + * @retval ::BLE_ERROR_INVALID_ROLE Operation is not supported in the Peripheral role. + */ +SVCALL(SD_BLE_GAP_SCAN_STOP, uint32_t, sd_ble_gap_scan_stop(void)); + + +/**@brief Create a connection (GAP Link Establishment). + * + * @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_NO_MEM limit of available connections reached. + * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. + * @retval ::BLE_ERROR_INVALID_ROLE Operation is not supported in the Peripheral role. +*/ +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. + * + * @retval ::NRF_SUCCESS Successfully cancelled an inprogress connection procedure. + * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. + * @retval ::BLE_ERROR_INVALID_ROLE Operation is not supported in the Peripheral role. + */ +SVCALL(SD_BLE_GAP_CONNECT_CANCEL, uint32_t, sd_ble_gap_connect_cancel(void)); +/**@} */ + +/** @} */ + +#endif // BLE_GAP_H__ + +/** + @} +*/ diff --git a/components/softdevice/s120/headers/ble_gatt.h b/components/softdevice/s120/headers/ble_gatt.h new file mode 100644 index 0000000..7887b9b --- /dev/null +++ b/components/softdevice/s120/headers/ble_gatt.h @@ -0,0 +1,200 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + + +/** @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 + +/** @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 value permitted. */ + uint8_t read :1; /**< Reading value permitted. */ + uint8_t write_wo_resp :1; /**< Writing value with Write Command permitted. */ + uint8_t write :1; /**< Writing value with Write Request permitted. */ + uint8_t notify :1; /**< Notications of value permitted. */ + uint8_t indicate :1; /**< Indications of value permitted. */ + uint8_t auth_signed_wr :1; /**< Writing 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 value with Queued Write Request permitted. */ + uint8_t wr_aux :1; /**< Writing the Characteristic User Description permitted. */ +} ble_gatt_char_ext_props_t; + +#endif // BLE_GATT_H__ + +/** @} */ + +/** + @} + @} +*/ diff --git a/components/softdevice/s120/headers/ble_gattc.h b/components/softdevice/s120/headers/ble_gattc.h new file mode 100644 index 0000000..347025f --- /dev/null +++ b/components/softdevice/s120/headers/ble_gattc.h @@ -0,0 +1,441 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/** @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_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. */ + BLE_GATTC_EVT_REL_DISC_RSP, /**< Relationship Discovery Response event. */ + BLE_GATTC_EVT_CHAR_DISC_RSP, /**< Characteristic Discovery Response event. */ + BLE_GATTC_EVT_DESC_DISC_RSP, /**< Descriptor Discovery Response event. */ + BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP, /**< Read By UUID Response event. */ + BLE_GATTC_EVT_READ_RSP, /**< Read Response event. */ + BLE_GATTC_EVT_CHAR_VALS_READ_RSP, /**< Read multiple Response event. */ + BLE_GATTC_EVT_WRITE_RSP, /**< Write Response event. */ + BLE_GATTC_EVT_HVX, /**< Handle Value Notification or Indication event. */ + BLE_GATTC_EVT_TIMEOUT /**< Timeout event. */ +}; + +/** @} */ + +/** @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. */ +/** @} */ + +/**@brief Last Attribute Handle. */ +#define BLE_GATTC_HANDLE_END 0xFFFF + +/** @} */ + +/** @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 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, variable length. */ +} 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, variable length. */ +} 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, variable length. */ +} 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, variable length. */ +} ble_gattc_evt_desc_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 ble_gattc_evt_read_by_uuid_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, variable length. */ +} 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, variable length. */ +} 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, variable length. */ +} 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, variable length. */ +} 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, variable length. */ +} 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 type. */ +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. */ + } 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 a Primary Service discovery, starting from the supplied handle. + * If the last service has not been reached, this 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. + * + * @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 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. + * + * @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 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. + * + * @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 the 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. + * + * @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 the 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. + * + * @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 a GATT Read (Long) Characteristic or Descriptor procedure. If the Characteristic or Descriptor + * to be read is longer than GATT_MTU - 1, this function must be called multiple times with appropriate offset to read the + * complete value. + * + * @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_INVALID_ADDR Invalid pointer supplied. + * @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. + * + * @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 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_buffer_count_get for more details. + * + * @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_BUFFERS There are no available buffers left. + */ +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. + * + * @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)); + +/** @} */ + +#endif /* BLE_GATTC_H__ */ + +/** + @} + @} +*/ diff --git a/components/softdevice/s120/headers/ble_gatts.h b/components/softdevice/s120/headers/ble_gatts.h new file mode 100644 index 0000000..648ec7f --- /dev/null +++ b/components/softdevice/s120/headers/ble_gatts.h @@ -0,0 +1,615 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/** @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, /**< Get updated persistent system attributes after terminating a connection. */ +}; + +/** + * @brief GATT Server Event IDs. + */ +enum BLE_GATTS_EVTS +{ + BLE_GATTS_EVT_WRITE = BLE_GATTS_EVT_BASE, /**< Write operation performed. */ + BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST, /**< Read/Write Authorization request. */ + BLE_GATTS_EVT_SYS_ATTR_MISSING, /**< A persistent system attribute access is pending, awaiting a sd_ble_gatts_sys_attr_set(). */ + BLE_GATTS_EVT_HVC, /**< Handle Value Confirmation. */ + BLE_GATTS_EVT_SC_CONFIRM, /**< Service Changed Confirmation. */ + BLE_GATTS_EVT_TIMEOUT /**< Timeout. */ +}; +/** @} */ + +/** @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. */ +/** @} */ + + +/** @} */ + +/** @addtogroup BLE_GATTS_STRUCTURES Structures + * @{ */ + +/** + * @brief BLE GATTS init options + */ +typedef struct +{ + uint8_t service_changed:1; /**< Include the Service Changed characteristic in the local attributes. */ +} 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 should 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 Attribute Context. */ +typedef struct +{ + ble_uuid_t srvc_uuid; /**< Service UUID. */ + ble_uuid_t char_uuid; /**< Characteristic UUID if applicable (BLE_UUID_TYPE_UNKNOWN if N/A). */ + ble_uuid_t desc_uuid; /**< Descriptor UUID if applicable (BLE_UUID_TYPE_UNKNOWN if N/A). */ + uint16_t srvc_handle; /**< Service Handle. */ + uint16_t value_handle; /**< Characteristic Handle if applicable (BLE_GATT_HANDLE_INVALID if N/A). */ + uint8_t type; /**< Attribute Type, see @ref BLE_GATTS_ATTR_TYPES. */ +} ble_gatts_attr_context_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; /**< UUID 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, 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 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 Read 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 in the ATT response. */ + 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. */ + uint8_t *p_data; /**< Pointer to new value used to update the attribute value. */ +} ble_gatts_read_authorize_params_t; + +/**@brief GATT Write Authorisation parameters. */ +typedef struct +{ + uint16_t gatt_status; /**< GATT status code for the operation, see @ref BLE_GATT_STATUS_CODES. */ +} ble_gatts_write_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_read_authorize_params_t read; /**< Read authorization parameters. */ + ble_gatts_write_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. */ + uint8_t op; /**< Type of write operation, see @ref BLE_GATTS_OPS. */ + ble_gatts_attr_context_t context; /**< Attribute Context. */ + uint16_t offset; /**< Offset for the write operation. */ + uint16_t len; /**< Length of the incoming data. */ + uint8_t data[1]; /**< Incoming data, variable length. */ +} ble_gatts_evt_write_t; + +/**@brief Event structure for authorize read request. */ +typedef struct +{ + uint16_t handle; /**< Attribute Handle. */ + ble_gatts_attr_context_t context; /**< Attribute Context. */ + 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 (TBD). */ +} 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 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 local server ATT table. + * + * @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. + * + * @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 ATT table. + * + * @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 local server ATT table. + * + * @note It is currently only possible to add an include declaration to the last added service (i.e. only sequential addition is supported at this time). + * + * @note The included service must already be present in the ATT table prior to this call. + * + * @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 local server ATT table. + * + * @note It is currently only possible to add a characteristic to the last added service (i.e. only sequential addition 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. + * + * @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 local server ATT table. + * + * @note It is currently only possible to add a descriptor to the last added characteristic (i.e. only sequential addition is supported at this time). + * + * @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. + * + * @param[in] conn_handle Connection handle. If there is no connection (and value is not a CCCD), 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. + */ +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. + * + * @param[in] conn_handle Connection handle. If there is no connection (and value is not a CCCD), then @ref BLE_CONN_HANDLE_INVALID can be used. + * @param[in] handle Attribute handle. + * @param[in,out] p_value Attribute value information. + * + * @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. + * + * @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. + */ +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 will be sent up 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_BUFFERS the ATT 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_buffer_count_get for more details. + * + * @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_BUFFERS There are no available buffers to send the data, 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. + * + * @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_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_INVALID_STATE Invalid state to perform operation, notifications or indications must be enabled in the CCCD. + * @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. + * + * @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, ATT table updated. + * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. + * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State or no authorization request pending. + * @retval ::NRF_ERROR_INVALID_PARAM Authorization op invalid, + * or for Read Authorization reply: requested handles not replied with, + * or for Write Authorization reply: handle supplied does not match requested handle. + * @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 to the stack information about persistent system attributes. + * This call is legal in the connected state only, and is usually + * made immediately after a connection is established and the bond identified. + * usually 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 struct. + * If the pointer is NULL, the system attribute info is initialized, assuming that + * the application does not have any previously saved data for this bond. + * + * @note The state of persistent system attributes is reset upon connection 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. + * + * @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_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 + * after a connection has been terminated. When a new connection is made to the same bond, the values + * should be restored using @ref sd_ble_gatts_sys_attr_set. + * The data should be read before any new advertising is started, or any new connection established. The connection handle for + * the previous now defunct connection will remain valid until a new one is created to allow this API call to refer to it. + * + * @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. + * + * @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. 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. + */ +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)); + +/** @} */ + +#endif // BLE_GATTS_H__ + +/** + @} +*/ diff --git a/components/softdevice/s120/headers/ble_hci.h b/components/softdevice/s120/headers/ble_hci.h new file mode 100644 index 0000000..2488985 --- /dev/null +++ b/components/softdevice/s120/headers/ble_hci.h @@ -0,0 +1,125 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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__ + +/** @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. */ + +/** @} */ + + +#endif // BLE_HCI_H__ + +/** @} */ diff --git a/components/softdevice/s120/headers/ble_l2cap.h b/components/softdevice/s120/headers/ble_l2cap.h new file mode 100644 index 0000000..6eab9fb --- /dev/null +++ b/components/softdevice/s120/headers/ble_l2cap.h @@ -0,0 +1,177 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/**@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, variable length. */ +} 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. + * + * @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. + * + * @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 buffer, 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_buffer_count_get for more details. + * + * @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_BUFFERS Not enough application buffers 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)); + +/** @} */ + +#endif // BLE_L2CAP_H__ + +/** + @} +*/ diff --git a/components/softdevice/s120/headers/ble_ranges.h b/components/softdevice/s120/headers/ble_ranges.h new file mode 100644 index 0000000..69100b3 --- /dev/null +++ b/components/softdevice/s120/headers/ble_ranges.h @@ -0,0 +1,119 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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__ + +#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. */ + +#endif /* BLE_RANGES_H__ */ + +/** + @} + @} +*/ diff --git a/components/softdevice/s120/headers/ble_types.h b/components/softdevice/s120/headers/ble_types.h new file mode 100644 index 0000000..d99d774 --- /dev/null +++ b/components/softdevice/s120/headers/ble_types.h @@ -0,0 +1,198 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 + +/** @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 +{ + unsigned char 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; + +/** @} */ + +#endif /* BLE_TYPES_H__ */ + +/** + @} + @} +*/ diff --git a/components/softdevice/s120/headers/nrf_error.h b/components/softdevice/s120/headers/nrf_error.h new file mode 100644 index 0000000..efa1b65 --- /dev/null +++ b/components/softdevice/s120/headers/nrf_error.h @@ -0,0 +1,78 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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__ + +/** @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 + +#endif // NRF_ERROR_H__ + +/** + @} +*/ diff --git a/components/softdevice/s120/headers/nrf_error_sdm.h b/components/softdevice/s120/headers/nrf_error_sdm.h new file mode 100644 index 0000000..25a1437 --- /dev/null +++ b/components/softdevice/s120/headers/nrf_error_sdm.h @@ -0,0 +1,60 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +#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). + +#endif // NRF_ERROR_SDM_H__ + +/** + @} + @} +*/ diff --git a/components/softdevice/s120/headers/nrf_error_soc.h b/components/softdevice/s120/headers/nrf_error_soc.h new file mode 100644 index 0000000..cfddf7e --- /dev/null +++ b/components/softdevice/s120/headers/nrf_error_soc.h @@ -0,0 +1,76 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/* 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 + +#endif // NRF_ERROR_SOC_H__ +/** + @} + @} +*/ diff --git a/components/softdevice/s120/headers/nrf_mbr.h b/components/softdevice/s120/headers/nrf_mbr.h new file mode 100644 index 0000000..6ffde6a --- /dev/null +++ b/components/softdevice/s120/headers/nrf_mbr.h @@ -0,0 +1,185 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 + + +/** @addtogroup NRF_MBR_DEFINES Defines + * @{ */ + +/**@brief MBR SVC Base number. */ +#define MBR_SVC_BASE 0x18 + +/**@brief Page size in words. */ +#define PAGE_SIZE_IN_WORDS 256 +/** @} */ + +/** @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 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 PROTENSET 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 256 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_INVALID_STATE indicates that something was wrong. + * @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 is invalid. + */ +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 thiss function should be called with @param address set to 0. + * The MBR will then start forwarding to interrupts to the adress in NFR_UICR->BOOTADDR or to the SoftDevice if the BOOTADDR is not set. + * + * @retval ::NRF_SUCCESS + */ +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.*/ + sd_mbr_command_copy_bl_t copy_bl; /**< Parameters for copy SoftDevice and BootLoader.*/ + sd_mbr_command_compare_t compare; /**< Parameters for verify.*/ + sd_mbr_command_vector_table_base_set_t base_set; /**< Parameters for vector table base set.*/ + } params; +}sd_mbr_command_t; + +/** @} */ + +/** @addtogroup NRF_MBR_FUNCTIONS Functions + * @{ */ + +/**@brief Issue Master Boot Record commands + * + * Commands used when updating a SoftDevice and bootloader. + * + * @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 + +*/ +SVCALL(SD_MBR_COMMAND, uint32_t, sd_mbr_command(sd_mbr_command_t* param)); + +/** @} */ +#endif // NRF_MBR_H__ + +/** + @} +*/ diff --git a/components/softdevice/s120/headers/nrf_sd_def.h b/components/softdevice/s120/headers/nrf_sd_def.h new file mode 100644 index 0000000..4740cd8 --- /dev/null +++ b/components/softdevice/s120/headers/nrf_sd_def.h @@ -0,0 +1,23 @@ +/* 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. + * + */ + +#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 th spplication). */ +#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/components/softdevice/s120/headers/nrf_sdm.h b/components/softdevice/s120/headers/nrf_sdm.h new file mode 100644 index 0000000..703eddf --- /dev/null +++ b/components/softdevice/s120/headers/nrf_sdm.h @@ -0,0 +1,221 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 "nrf51.h" +#include "nrf_soc.h" +#include "nrf_error_sdm.h" + +/** @addtogroup NRF_SDM_DEFINES Defines + * @{ */ + +/** @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 usual size reserverd 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) + +/** @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) + + +/** @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 */ +}; + +/**@brief Possible lfclk oscillator sources. */ +enum NRF_CLOCK_LFCLKSRCS +{ + NRF_CLOCK_LFCLKSRC_SYNTH_250_PPM, /**< LFCLK Synthesized from HFCLK. */ + NRF_CLOCK_LFCLKSRC_XTAL_500_PPM, /**< LFCLK crystal oscillator 500 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_250_PPM, /**< LFCLK crystal oscillator 250 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_150_PPM, /**< LFCLK crystal oscillator 150 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_100_PPM, /**< LFCLK crystal oscillator 100 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_75_PPM, /**< LFCLK crystal oscillator 75 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_50_PPM, /**< LFCLK crystal oscillator 50 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_30_PPM, /**< LFCLK crystal oscillator 30 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, /**< LFCLK crystal oscillator 20 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_250MS_CALIBRATION, /**< LFCLK RC oscillator, 250ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_500MS_CALIBRATION, /**< LFCLK RC oscillator, 500ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_1000MS_CALIBRATION, /**< LFCLK RC oscillator, 1000ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_2000MS_CALIBRATION, /**< LFCLK RC oscillator, 2000ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_4000MS_CALIBRATION, /**< LFCLK RC oscillator, 4000ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_8000MS_CALIBRATION, /**< LFCLK RC oscillator, 8000ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_1000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 1000ms, if changed above a threshold, a calibration is done.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_2000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 2000ms, if changed above a threshold, a calibration is done.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_4000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 4000ms, if changed above a threshold, a calibration is done.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_8000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 8000ms, if changed above a threshold, a calibration is done.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_16000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 16000ms, if changed above a threshold, a calibration is done.*/ +}; + +/** @} */ + +/** @addtogroup NRF_SDM_TYPES Types + * @{ */ + +/**@brief Type representing lfclk oscillator source. */ +typedef uint32_t nrf_clock_lfclksrc_t; + + +/**@brief SoftDevice Assertion Handler type. + * + * When an unexpected error occurs within the SoftDevice it will call the SoftDevice assertion handler callback. + * 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 SoftDevice assert callback. + * + * @param[in] pc The program counter of the failed assert. + * @param[in] line_number Line number where the assert failed. + * @param[in] file_name File name where the assert failed. + */ +typedef void (*softdevice_assertion_handler_t)(uint32_t pc, uint16_t line_number, const uint8_t * p_file_name); + +/** @} */ + +/** @addtogroup NRF_SDM_FUNCTIONS Functions + * @{ */ + +/**@brief Enables the SoftDevice and by extension the protocol stack. + * + * Idempotent function to enable the SoftDevice. + * + * @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 clock_source Low frequency clock source and accuracy. (Note: 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 assertion_handler Callback for SoftDevice assertions. + * + * @retval ::NRF_SUCCESS + * @retval ::NRF_ERROR_INVALID_STATE SoftDevice is already enabled, and the clock source and assertion handler cannot be updated. + * @retval ::NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION SoftDeviceinterrupt 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_lfclksrc_t clock_source, softdevice_assertion_handler_t assertion_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)); + +/** @} */ + +#endif // NRF_SDM_H__ + +/** + @} +*/ diff --git a/components/softdevice/s120/headers/nrf_soc.h b/components/softdevice/s120/headers/nrf_soc.h new file mode 100644 index 0000000..1d2defe --- /dev/null +++ b/components/softdevice/s120/headers/nrf_soc.h @@ -0,0 +1,993 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 "nrf51.h" +#include "nrf51_bitfields.h" +#include "nrf_error_soc.h" + +/**@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. */ + +#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. */ + +#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_TYPES Types + * @{ */ + +/**@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_NVIC_ENABLEIRQ, + SD_NVIC_DISABLEIRQ, + SD_NVIC_GETPENDINGIRQ, + SD_NVIC_SETPENDINGIRQ, + SD_NVIC_CLEARPENDINGIRQ, + SD_NVIC_SETPRIORITY, + SD_NVIC_GETPRIORITY, + SD_NVIC_SYSTEMRESET, + SD_NVIC_CRITICAL_REGION_ENTER, + SD_NVIC_CRITICAL_REGION_EXIT, + SD_RAND_APPLICATION_POOL_CAPACITY, + SD_RAND_APPLICATION_BYTES_AVAILABLE, + SD_RAND_APPLICATION_GET_VECTOR, + SD_POWER_MODE_SET, + SD_POWER_SYSTEM_OFF, + SD_POWER_RESET_REASON_GET, + SD_POWER_RESET_REASON_CLR, + SD_POWER_POF_ENABLE, + SD_POWER_POF_THRESHOLD_SET, + SD_POWER_RAMON_SET, + SD_POWER_RAMON_CLR, + SD_POWER_RAMON_GET, + SD_POWER_GPREGRET_SET, + SD_POWER_GPREGRET_CLR, + SD_POWER_GPREGRET_GET, + SD_POWER_DCDC_MODE_SET, + SD_APP_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_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 Possible values of ::nrf_app_irq_priority_t. */ +enum NRF_APP_PRIORITIES +{ + NRF_APP_PRIORITY_HIGH = 1, + NRF_APP_PRIORITY_LOW = 3 +}; + +/**@brief Possible values of ::nrf_power_mode_t. */ +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 Possible values of ::nrf_power_failure_threshold_t */ +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 Possible values of ::nrf_power_dcdc_mode_t. */ +enum NRF_POWER_DCDC_MODES +{ + NRF_POWER_DCDC_DISABLE, /**< The DCDC is disabled. */ + NRF_POWER_DCDC_ENABLE /**< The DCDC is enabled. */ +}; + +/**@brief Possible values of ::nrf_radio_notification_distance_t. */ +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 Possible values of ::nrf_radio_notification_type_t. */ +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 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 signal callback handler return was invalid. */ + NRF_EVT_RADIO_SESSION_IDLE, /**< Event indicating that a radio session is idle. */ + NRF_EVT_RADIO_SESSION_CLOSED, /**< Event indicating that a radio session is closed. */ + NRF_EVT_NUMBER_OF_EVTS +}; + +/**@} */ + +/**@addtogroup NRF_SOC_TYPES Types + * @{ */ + +/**@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 The interrupt priorities available to the application while the softdevice is active. */ +typedef uint8_t nrf_app_irq_priority_t; + +/**@brief Represents a power mode, used in power mode functions */ +typedef uint8_t nrf_power_mode_t; + +/**@brief Represents a power failure threshold value. */ +typedef uint8_t nrf_power_failure_threshold_t; + +/**@brief Represents a DCDC mode value. */ +typedef uint32_t nrf_power_dcdc_mode_t; + +/**@brief Radio notification distances. */ +typedef uint8_t nrf_radio_notification_distance_t; + +/**@brief Radio notification types. */ +typedef uint8_t nrf_radio_notification_type_t; + +/**@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_DEFAULT, /**< Use the currently selected oscillator as HF clock source during the timeslot (i.e. the source is not specified). */ + NRF_RADIO_HFCLK_CFG_FORCE_XTAL, /**< Force external crystal to be used as HF clock source during whole the timeslot. */ +}; + +/**@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 timeslot as early as possible. This should always be used for the first request in a session. */ + NRF_RADIO_REQ_TYPE_NORMAL /**< Normal timeslot request. */ +}; + +/**@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 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 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 a request for a timeslot as early as possible. */ + nrf_radio_request_normal_t normal; /**< Parameters for a normal radio request. */ + } 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 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 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 data structure */ +typedef struct +{ + uint8_t key[SOC_ECB_KEY_LENGTH]; /**< Encryption key. */ + uint8_t cleartext[SOC_ECB_CLEARTEXT_LENGTH]; /**< Clear Text data. */ + uint8_t ciphertext[SOC_ECB_CIPHERTEXT_LENGTH]; /**< Cipher Text data. */ +} nrf_ecb_hal_data_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 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. + */ +SVCALL(SD_NVIC_ENABLEIRQ, 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. + */ +SVCALL(SD_NVIC_DISABLEIRQ, 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. + */ +SVCALL(SD_NVIC_GETPENDINGIRQ, 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. + */ +SVCALL(SD_NVIC_SETPENDINGIRQ, 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. + */ +SVCALL(SD_NVIC_CLEARPENDINGIRQ, 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. + */ +SVCALL(SD_NVIC_SETPRIORITY, uint32_t, sd_nvic_SetPriority(IRQn_Type IRQn, nrf_app_irq_priority_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. + */ +SVCALL(SD_NVIC_GETPRIORITY, uint32_t, sd_nvic_GetPriority(IRQn_Type IRQn, nrf_app_irq_priority_t * p_priority)); + +/**@brief System Reset. + * @note Corresponds to NVIC_SystemReset in CMSIS. + * + * @retval ::NRF_ERROR_SOC_NVIC_SHOULD_NOT_RETURN + */ +SVCALL(SD_NVIC_SYSTEMRESET, 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 + */ +SVCALL(SD_NVIC_CRITICAL_REGION_ENTER, 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 + */ +SVCALL(SD_NVIC_CRITICAL_REGION_EXIT, uint32_t, sd_nvic_critical_region_exit(uint8_t is_nested_critical_region)); + +/**@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, 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, 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_GET_VECTOR, 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. @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(nrf_power_mode_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. + * + * @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(nrf_power_failure_threshold_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. + * + * This function is to enable or disable the DCDC periperhal. + * + * @param[in] dcdc_mode The mode of the DCDC. + * + * @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(nrf_power_dcdc_mode_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. + * @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. + * 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(nrf_radio_notification_type_t type, nrf_radio_notification_distance_t distance)); + +/**@brief Encrypts a block according to the specified parameters. + * + * 128-bit AES encryption. + * + * @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 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. + * + * @note Pan #28 in PAN-028 v 1.6 "Negative measured values are not represented correctly" is corrected by this function. + * + * @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 32bit words. +* +* @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 more than 256 words. +* @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 registers PROTENSETx + * + * @note To read the values in PROTENSETx you can read them directly. They are only write-protected. + * + * @param[in] protenset0 Value to be written to PROTENSET0. + * @param[in] protenset1 Value to be written to PROTENSET1. + * + * @retval ::NRF_ERROR_FORBIDDEN Tried to protect the SoftDevice. + * @retval ::NRF_SUCCESS Values successfully written to PROTENSETx. + */ +SVCALL(SD_FLASH_PROTECT, uint32_t, sd_flash_protect(uint32_t protenset0, uint32_t protenset1)); + +/**@brief Opens a session for radio 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 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 )); + +/**@} */ + +#endif // NRF_SOC_H__ + +/**@} */ diff --git a/components/softdevice/s120/headers/nrf_svc.h b/components/softdevice/s120/headers/nrf_svc.h new file mode 100644 index 0000000..895f7f2 --- /dev/null +++ b/components/softdevice/s120/headers/nrf_svc.h @@ -0,0 +1,69 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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__ + +#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__) +#define SVCALL(number, return_type, signature) \ + _Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \ + _Pragma("GCC diagnostic ignored \"-Wunused-function\"") \ + __attribute__((naked)) static return_type signature \ + { \ + __asm( \ + "svc %0\n" \ + "bx r14" : : "I" (number) : "r0" \ + ); \ + } +#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 +#endif // NRF_SVC__ diff --git a/components/softdevice/s120/headers/softdevice_assert.h b/components/softdevice/s120/headers/softdevice_assert.h new file mode 100644 index 0000000..a2a8af8 --- /dev/null +++ b/components/softdevice/s120/headers/softdevice_assert.h @@ -0,0 +1,73 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** @brief Utilities for verifying program logic + */ + +#ifndef SOFTDEVICE_ASSERT_H_ +#define SOFTDEVICE_ASSERT_H_ + +#include + +/** @brief This function handles assertions. + * + * + * @note + * This function is called when an assertion has triggered. + * + * + * @param line_num The line number where the assertion is called + * @param file_name Pointer to the file name + */ +void assert_softdevice_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 Check intended for production code + * + * Check passes if "expr" evaluates to true. */ +#define ASSERT(expr) \ +if (expr) \ +{ \ +} \ +else \ +{ \ + assert_softdevice_callback((uint16_t)__LINE__, (uint8_t *)__FILE__); \ + /*lint -unreachable */ \ +} + +#endif /* SOFTDEVICE_ASSERT_H_ */ diff --git a/components/softdevice/s120/hex/s120_nrf51_2.1.0_softdevice.hex b/components/softdevice/s120/hex/s120_nrf51_2.1.0_softdevice.hex new file mode 100644 index 0000000..7cdfb1c --- /dev/null +++ b/components/softdevice/s120/hex/s120_nrf51_2.1.0_softdevice.hex @@ -0,0 +1,7080 @@ +:020000040000FA +:10000000C0070000D1060000D1000000B1060000CA +:1000100000000000000000000000000000000000E0 +:100020000000000000000000000000005107000078 +:100030000000000000000000DB000000E500000000 +:10004000EF000000F9000000030100000D010000B6 +:1000500017010000210100002B0100003501000004 +:100060003F01000049010000530100005D01000054 +:1000700067010000710100007B01000085010000A4 +:100080008F01000099010000A3010000AD010000F4 +:10009000B7010000C1010000CB010000D501000044 +:1000A000DF010000E9010000F3010000FD01000094 +:1000B00007020000110200001B02000025020000E0 +:1000C0001FB5C046C04600F0EFFA04B00FB41FBD24 +:1000D00008205A49096809580847382057490968CB +:1000E000095808473C2055490968095808474020E5 +:1000F0005249096809580847442050490968095875 +:10010000084748204D490968095808474C204B4981 +:10011000096809580847502048490968095808479C +:100120005420464909680958084758204349096836 +:10013000095808475C204149096809580847602068 +:100140003E4909680958084764203C49096809582C +:100150000847682039490968095808476C20374919 +:100160000968095808477020344909680958084740 +:100170007420324909680958084778202F490968CE +:10018000095808477C202D490968095808478020EC +:100190002A490968095808478420284909680958E4 +:1001A0000847882025490968095808478C202349B1 +:1001B00009680958084790202049096809580847E4 +:1001C00094201E4909680958084798201B49096866 +:1001D000095808479C201949096809580847A02070 +:1001E0001649096809580847A4201449096809589C +:1001F0000847A8201149096809580847AC200F4949 +:10020000096809580847B0200C4909680958084787 +:10021000B4200A49096809580847B82007490968FD +:1002200009580847BC2005490968095808470000D3 +:1002300003480449024A034B7047000000000020B5 +:10024000C0070000C00700000122D84B5A6000BF61 +:10025000D74A1268002AFBD0016000BFD44A126856 +:10026000002AFBD00022D14B5A6000BFD04A12684E +:10027000002AFBD07047F0B505460E46174600240D +:1002800006E0A200B158A2005019FFF7DDFF641C80 +:10029000BC42F6D30020F0BD0120C043C549086030 +:1002A000401048607047014601229204086890425D +:1002B00001D9102070470020FCE7F0B505460C4638 +:1002C0001646002706E028462168FFF7BDFF2D1DD2 +:1002D000241D7F1CB742F6D3F0BD70B505460C4611 +:1002E0002E460BE0304600F075F9FF2C01D80024B3 +:1002F00001E0FF3C013C012080023618002CF1D1C6 +:1003000070BD0146012212044868904201D90920BB +:100310007047A9484069401C01D10F20F8E7002030 +:10032000F6E7FEB504462068030000F037FA05043E +:100330002B4249598B00201DFFF7E3FF0546002D96 +:1003400001D02846FEBDFFF7A7FF0120C00200F044 +:1003500041F9042221469948FFF78DFF002801D07A +:100360000320EFE708222146944800F06DF90028A9 +:1003700006D1002192480068FFF766FF00F00CF9F3 +:100380000320DFE7A768E6686068019031463846D9 +:10039000FFF7A3FF324638460199FFF78EFFB20000 +:1003A0003846019900F050F9002800D1CAE703202F +:1003B000C8E700F0E3F9834800688349086041E03A +:1003C00060680190E668A0680090B200009901980A +:1003D00000F03AF90746002F00D1B3E70E20B1E74D +:1003E000201DFFF760FF0546002D01D02846A9E734 +:1003F0006068002807D1FFF74FFF0320800200F05C +:10040000E9F800F0C9F8FFF747FF0120C00200F04B +:10041000E1F8042221466948FFF72DFF002801D0AA +:1004200003208FE708222146644800F00DF90028D8 +:1004300006D1002162480068FFF706FF00F0ACF823 +:1004400003207FE700BF00207CE770B505460C461F +:10045000182D04D12068FFF764FF206002E001201E +:10046000206000BF00BF70BDF0B589B05248406940 +:1004700003905248806881000398081802900398FE +:10048000000B01900121090302984018401E000B47 +:1004900000900124002520462946019A00F0C4F866 +:1004A0000022401E91410791069001260027304608 +:1004B0003946009A00F0B8F80022401E914105919B +:1004C0000490049BDB43059AD2430698184307998E +:1004D00011430791069037490698086007984860CD +:1004E00009B0F0BD70B53448446934488568466841 +:1004F000AA003146204600F0A7F8002801D00020CD +:1005000070BD0120FCE72D484068002801D0012083 +:1005100000E000200546FFF7E5FF002807D0FFF7C1 +:10052000BBFE0320800200F055F800F035F8FFF71D +:100530009BFF002D0ED020484669204884684768FC +:1005400021463046FFF7C9FE224639463046FFF7BE +:10055000B4FE00BF00F020F810B5184844681A48EF +:100560000460204600F0DCF810BD15480068006803 +:10057000401C01D100BFFEE710480068002802D0EF +:10058000042806D101E0FFF7BEFFFFF7E5FF00BF3B +:10059000FEE700BF00BFFEE7BFF34F8F0B480C49DB +:1005A000C860BFF34F8F00BFFEE7000000E50140C9 +:1005B00000E40140000600400010001000080000A8 +:1005C000B8070000BC070000000000200400FA0586 +:1005D00000ED00E010B50146104B1A6808460223F2 +:1005E0000F4C636000BF0F4B1B68002BFBD0531CEC +:1005F00004D0904202D20A4B186101E0084B986087 +:1006000000BF084B1B68002BFBD00023044C636029 +:1006100000BF044B1B68002BFBD010BD0010001066 +:1006200000E5014000E4014010B5202A04DB01464A +:10063000203A9140002010BD914020239C1A03468F +:10064000E3401943904010BD034610B50B439B0790 +:100650000FD1042A0DD308C810C9121FA342F8D025 +:1006600018BA21BA884201D9012010BD0020C04328 +:1006700010BD002A03D0D30703D0521C07E000208E +:1006800010BD03780C78401C491C1B1B07D1037854 +:100690000C78401C491C1B1B01D1921EF1D118463D +:1006A00010BD70477047704710B500F007F810BDD7 +:1006B000014B1B68DB6818470000002019481A49E5 +:1006C0007047FFF7FBFFFFF7FBFC00BD20BFFDE716 +:1006D0001649174C24688C420BD1164B1B68994263 +:1006E0000CD1154B154A1360186810498842EDD09B +:1006F0000AE0134880F30888124B18470F4A13602A +:1007000018680A498842E1D080F308880E49884277 +:1007100004DD0E48026802210A4302605B68184744 +:100720000346DFE7C0070000C0070000FFFFFFFF30 +:10073000000C000014100010001000000000002049 +:10074000000400206B05000000200020240500406C +:100750000D48704502D1EFF3098101E0EFF3088104 +:10076000886902380078182802D1C046074A104725 +:10077000074A12682C3212681047000000B5054B7A +:10078000054A9B58984700BDFDFFFFFF4B04000042 +:1007900000000020001000000400000030B4744687 +:1007A000641E2578641CAB4204D3635D5B00E318D0 +:1007B00030BC18471D46F8E7000C00000010000090 +:10100000801E002095BF0100E5210000FBBE01000D +:1010100000000000000000000000000000000000D0 +:1010200000000000000000000000000005C00100FA +:101030000000000000000000E5210000E5210000A4 +:1010400071C0010077C00100E5210000E52100002A +:10105000E5210000E5210000E5210000E521000078 +:101060007DC00100E5210000E521000083C00100F2 +:10107000E521000089C001008FC0010095C001007A +:10108000E5210000E5210000E5210000E521000048 +:10109000E5210000E5210000E5210000E521000038 +:1010A0009BC00100A1C00100E5210000E521000076 +:1010B000E5210000E5210000E5210000E521000018 +:1010C00000F002F81AF047FF0CA030C808382418C6 +:1010D0002D18A246671EAB4654465D46AC4201D170 +:1010E0001AF039FF7E460F3E0FCCB646012633423A +:1010F00000D0FB1AA246AB463343184728B1010083 +:1011000058B10100103A02D378C878C1FAD8520712 +:1011100001D330C830C101D504680C6070470000AD +:101120000023002400250026103A01D378C1FBD803 +:10113000520700D330C100D50B6070471FB5C046C1 +:10114000C0461AF0AAFE04B00FB41FBDF0B440466A +:10115000494652465B460FB402A0013001B506482D +:10116000004700BF01BC86460FBC804689469246B8 +:101170009B46F0BC70470000C11000008269024924 +:101180008161024810447047911100000100000085 +:1011900001B41EB400B50BF0A4F801B40198864662 +:1011A00001BC01B01EBD0000401E00BF00BF00BF5B +:1011B00000BF00BF00BF00BF00BF00BF00BF00BF37 +:1011C00000BFF1D17047000070B505460C461646C9 +:1011D00002E00FCC0FC5103E102EFAD2082E02D31B +:1011E00003CC03C5083E042E07D301CC01C5361F2E +:1011F00003E021782970641C6D1C761EF9D270BD45 +:101200008307FF22DB0E9A408907090E99400028C8 +:101210000BDA0007000F0838830828489B001818CD +:10122000C36993430B43C3617047830824489B0001 +:101230001B181868904308431860704710B504469F +:1012400000210120FFF7DCFF00211820FFF7D8FF65 +:1012500000210B20FFF7D4FF02211920FFF7D0FF58 +:1012600002210D20FFF7CCFF02210E20FFF7C8FF5F +:1012700002210F20FFF7C4FF0221C81FFFF7C0FFA4 +:1012800003211620FFF7BCFF03211520FFF7B8FF4D +:10129000204600F019F8002010BD6B210180704736 +:1012A00010B500F028F810BD0648704710B500F0E2 +:1012B0002AF810BD704770477047000000ED00E04D +:1012C00000E400E003F9004370B50546314C072007 +:1012D0006070A01CFFF7E1FF5920A0802E492F4825 +:1012E0001AF0D8FC2E492F481AF0D4FC2946204683 +:1012F00000F0C6FB70BD10B500F0CBFB2549002007 +:10130000891E087010BDF8B5224E0446B61E30780E +:1013100001270D46002807D0204660380B2808D842 +:10132000204600F015FF2BE0602CF9D01E48086025 +:10133000F8BD20466C38032803D8204600F049FF4A +:101340001EE0204670381F2803D8204600F04FF9D1 +:1013500016E0204690380F2803D8204600F0F2F817 +:101360000EE02046A0380F2803D8204600F07EF873 +:1013700006E02046B0380F2804D8204600F0EAF9ED +:10138000286000E02F60602CD2D128680028CFD1DF +:101390003770F8BD1A00002060040000801E002095 +:1013A00080090000801E0020013000000120254936 +:1013B000C003086024490020087007202349C005A5 +:1013C0008860704770B5204D04462878A04207D049 +:1013D000002C05D0002803D01DA14D201AF087FD58 +:1013E0002878A0420ED000211E4A18482C70002CEC +:1013F0001BD01D4B012C06D0022C0DD014A168204F +:101400001AF075FD70BD1160022111605361032156 +:1014100009068160416070BD116003211160536154 +:101420000121C9058160416070BD11601160072113 +:10143000C905816070BD10B505A171201AF057FD76 +:1014400010BD000080E100E02000002000F5014018 +:101450007372635C68616C5F63636D5F6161722E60 +:101460006300000000F500409001002010B5A03896 +:1014700003001AF06AFE0B070E172028313A414B81 +:10148000525C65004B6808788A68194603F0BDF91C +:1014900010BD88888A6883B20888194680B203F034 +:1014A000C3F910BD08884C68CB688A6880B22146B1 +:1014B00003F0BEF910BD08884B688A6880B21946EF +:1014C00003F0D2F910BD88888A6883B2088819466B +:1014D00080B203F0DEF910BD88888A6883B208887C +:1014E000194680B203F00CFA10BD08884A6880B231 +:1014F000114603F03FFA10BD088982B2888883B292 +:101500000888194680B203F040FA10BD08884A687E +:1015100080B2114603F05DFA10BD08894C6882B2B2 +:101520000888CB6880B2214603F0D6FA10BD08883F +:101530004C68CB688A6880B2214603F0E7FB10BD97 +:10154000012010BD10B5903803001AF0FEFD090609 +:101550000F161D242C363F464E0088888A6883B2B9 +:101560000888194680B204F0E5F810BD08884A687A +:1015700080B2114604F019F910BD08884A6880B29B +:10158000114604F01EF910BD08884A6880B2114661 +:1015900004F024F910BD08884B688A6880B21946A7 +:1015A00004F02FF910BD088982B2888883B20888B8 +:1015B000194680B204F02EF910BD08894B6882B23A +:1015C0000888194680B204F044F910BD08884A68BA +:1015D00080B2114604F04FF910BD888882B20888A5 +:1015E000114680B204F0A3F910BD012010BD10B562 +:1015F000703803001AF0A9FD1B0F15192125282F9B +:10160000363B4044484C53585F68707881889095C9 +:10161000999CA2A5AC004A680878114607F005FC21 +:1016200010BD086807F051FC10BD0C790B7B8A686F +:101630000868214607F058FC10BD086807F01BFD3C +:1016400010BD07F052F910BD08884A6880B21146F3 +:1016500007F053FE10BD0A790888114680B207F0E2 +:10166000E3FE10BD087840B207F0ECFE10BD08881C +:1016700080B207F000FF10BD086807F00EFF10BD34 +:10168000086801F0A5FB10BD086801F0D5FB10BD8E +:10169000088982B209C9194607F016FF10BD05C9AD +:1016A000114607F05DFF10BD08884A6880B21146F8 +:1016B00009F0FEF810BD0C790888CB688A6880B202 +:1016C000214609F019FA10BD0B7908888A6880B2A2 +:1016D000194609F0C3FB10BD08884B688A6880B2C0 +:1016E000194609F02BFC10BD08884C68CB688A6845 +:1016F00080B2214609F08EFC10BD08884A6880B28D +:10170000114609F0D1FC10BD0B7908880A7A80B225 +:10171000194607F047FF10BD088880B207F047FF61 +:1017200010BD086807F058FF10BD07F0BAF810BDEB +:101730008A6809C9194607F0BEFF10BD07F093F883 +:1017400010BD08884A6880B2114608F071F810BDD3 +:10175000012010BD10B5B02805D0B12808D0B2289E +:101760000BD0012010BD088880B20AF02AF910BD04 +:10177000088880B20AF044F910BD08884B688A686E +:1017800080B219460AF04DF910BD000010B50300F3 +:101790001AF0DBFC0A0609060C0C0F0F06060612EF +:1017A00007F0D2F810BD09F0D6FE10BD01F0FCF92B +:1017B00010BD06F03DFA10BDFAA1FE481AF097FBE5 +:1017C00010BD3EB5FC49054603C9009001912F208C +:1017D000400169460881F94A142310460A21283835 +:1017E0000AF055FE0024F6480AF06FFE641CE4B2CD +:1017F0000A2CF8D30823012202A9F2480AF0CDF9F5 +:10180000002804D0FF20E7A101301AF070FB372038 +:101810000822ED49400104F020FD002804D0FF20FB +:10182000E0A104301AF063FB00211E22084604F0F8 +:1018300001F9284607F0B8FA02222421E34801F012 +:1018400039FBE24801222C214C3001F033FBDF4907 +:101850000B20B03901F0B2F9002804D0FF20D1A14B +:1018600015301AF044FB28788007800F09F007FE36 +:1018700002F05EF96B4600220821D5A007F04FF96F +:10188000002804D0FF20C7A11B301AF030FB681CD1 +:1018900002F0A2FC002804D0FF20C2A11D301AF0E3 +:1018A00026FBDB218900CD481AF0F6F9CB4801214F +:1018B0004171022181710621C1713EBD10B5C74C35 +:1018C000A078092804D3FF20B6A154301AF00FFBEA +:1018D000207860214843001900210173417BF722E1 +:1018E000C908C900C91C1140EF22114041730121F0 +:1018F000E1700C3010BD70B50E4600211C461980F9 +:10190000154603001AF021FC0723050B1711231DB0 +:10191000230022462946304609F03AFE70BD224691 +:101920002946304606F050FE70BD22462946304614 +:1019300001F0A9FF70BD22462946304603F07BFD29 +:1019400070BD22462946304600F0C7FB70BDFF201F +:1019500094A1B3301AF0CBFA032070BD70B59F4C40 +:10196000E078002818D02078602148430019407B97 +:1019700000254007400F01190879401E08712078A2 +:10198000401CC0B22070092800D12570A078401CEE +:10199000A0700AF020FFE57070BD9048C079002863 +:1019A00000D08BE7704770B58C4DA86800280CD02C +:1019B000FFF7F3FF002862D06022A968FFF704FC5C +:1019C000FFF7CCFF0020A860EFE76879002856D029 +:1019D000FFF774FF04467D484C3001F07BFA6060ED +:1019E000002804D173486FA14A301AF080FA606869 +:1019F00001F0D3FA00280DD0204606F0C3FC607831 +:101A0000010703D5C008C000401C2BE06F48616887 +:101A10004C302DE06D4861684C3001F064FA00F004 +:101A2000F5FA00282BD1FFF749FF0446674801F07B +:101A300051FA6060002804D1BD205AA180001AF03C +:101A400056FA606801F0ADFA002814D0606800888A +:101A50006080204609F0CFFD6078010706D5C008F8 +:101A6000C000801C6070FFF779FF9EE757486168EF +:101A700001F039FA99E75548616801F034FA70BD10 +:101A800010B5574CA1606060564800F0DDFB207037 +:101A900010BD534900204870704770B5524E05463E +:101AA000706A94B00C46401C04D1B06AC043000474 +:101AB000000C0BD0306AC007C00F2870706A1AF093 +:101AC000EDF8B06A2071000A607114E02B206946BD +:101AD000087009A9684601F034FA002804D0354896 +:101AE00030A17E381AF003FA0120287006220AA9D4 +:101AF00020461AF072F82878002803D06079C021B7 +:101B00000843607114B070BDF0B5374C06462068CC +:101B100095B00D4637460837401C08D16068401C18 +:101B200005D1A068401C02D1E068401C11D020689B +:101B300031461AF0B3F86068311D1AF0AFF8A068AA +:101B400039461AF0ABF8E06831460C311AF0A6F8C5 +:101B500025E02B206946087009A9684601F0F1F9D3 +:101B6000002804D013480FA155381AF0C0F90822F4 +:101B70000AA930461AF031F82B206946087009A9E5 +:101B8000684601F0DEF9002804D00A4805A14E3865 +:101B90001AF0ADF908220AA938461AF01EF8206991 +:101BA0002E4623E07372635C686F73745F636F72B9 +:101BB000652E63008702000064C10100E40100207B +:101BC0008D170000040A00202403002000140020C8 +:101BD0006E5246353138323200000000E40F0020EA +:101BE00024000020A7190000800000100836401CC7 +:101BF00008D16069401C05D1A069401C02D1E06990 +:101C0000401C12D0206929461AF048F86069291D45 +:101C10001AF044F8A06931461AF040F8E069294604 +:101C20000C311AF03BF815B0F0BD2B246846047057 +:101C300009A901F086F9002803D0FE49FE481AF0F0 +:101C400056F9082209AF28460AA919F0C6FF6846C6 +:101C5000047009A901F075F9002804D0F648F54987 +:101C6000C01D1AF044F90822391D304619F0B5FF9D +:101C7000D9E770B5F14C0546A068002804D0EE48BD +:101C8000EC4956301AF033F9A56070BD10B5014625 +:101C9000EB4801F028F9E9498879401CC0B2887105 +:101CA000012803D1E748007800F0F2FA10BD70B5C2 +:101CB0000446E54816460D46814204D1DE48DD491A +:101CC000CB301AF014F9012E05D0DB48D949DA30AF +:101CD0001AF00DF970BD6620207000202072A581D9 +:101CE0000120A07370BD70B515460C460646FFF77F +:101CF00054FE00280CD0662101704680012101723B +:101D000021680161A18881820573FFF727FE70BDFC +:101D10001321304607F088FB70BD70B5C94C0546ED +:101D2000607894B0002801D00820EBE6C7488542CF +:101D300006D301208004854204D3C548854201D2E0 +:101D40001020DFE6287801268007800F012803D0C5 +:101D5000022805D00720D5E661680020087001E060 +:101D60006068067000F012FF217860680CF066FA77 +:101D7000A068401E07280BD8302269460A70887078 +:101D800068460CF07DFA002802D009A80CF083FA0E +:101D90002846FFF716FD66700020B3E6F8B5044646 +:101DA000AB480F46814208D3002C01D0844204D3B3 +:101DB000E01C80088000A04201D01020F8BD9F48A0 +:101DC0008178002911D039880091417860225143EF +:101DD0000D18287B0C350007000F3B4600222946D2 +:101DE000FFF789FD060004D015E0002038800520AB +:101DF000F8BD002C13D039880098814201D90C26F7 +:101E00000DE028783B460007000F22462946FFF7E1 +:101E100072FD060005D00C2E01D00020388030461F +:101E2000F8BD864C6078401CC0B26070092801D1B2 +:101E300000206070A078401EA07068784107490FAC +:101E400001290ED0022906D003291AD079498148E8 +:101E50001AF04DF8E3E7C006E1D46868FFF716FF13 +:101E6000DDE7774869684C3001F03DF86079401C47 +:101E7000C0B260710128D2D17248007800F008FA2F +:101E8000CDE7E079401CE071C9E7704A10B5904297 +:101E900008D30124A4046E4AA04201D3904201D386 +:101EA000914201D2102010BD00F0C1FE10BD674B61 +:101EB00010B5994208D30124A404654BA14201D373 +:101EC000994201D39A4201D2102010BD022803D0BA +:101ED000102801D0092010BD00F0CFFE0028FAD054 +:101EE000052010BD594B10B598420CD30124A40411 +:101EF000574BA04201D3984205D3994203D3002AFD +:101F000003D09A4201D2102010BD00F0DCFE002860 +:101F1000FAD0072010BD10B504464D4894B0844255 +:101F200002D2102014B010BD0F2008A90873694612 +:101F30000BA801F006F80028F4D16846007A20705A +:101F400068464089608068468089A0800020E9E773 +:101F500010B500290AD03E4A914202D30B68934241 +:101F600001D2102010BD8A88002A02D001F032FE72 +:101F700010BD092010BD10B5344A94B091420DD364 +:101F800001229204324B914201D3994206D3441E5E +:101F90001E2C25D8914203D3994201D21020C1E7CB +:101FA00001281BD108780024C007C00F002803D0E7 +:101FB00003206946887001E06846847038206946CD +:101FC000087009A9684600F0BCFF002804D0FF2073 +:101FD00021A1CD3019F08BFF2046A3E70720A1E710 +:101FE0000246203A1F2AF9D806F011FE9AE7184A4D +:101FF00010B5914201D2102010BD0246203A1F2A8E +:1020000002D806F07CFE10BD072010BDF0B595B0DB +:102010003B2008A9087369460BA800F092FF00282E +:1020200004D0FF200CA12F3019F061FF0E4E0024C8 +:102030006D464CE0A41B000057020000E40F002096 +:102040000014002024000020FFFF000000D0010049 +:1020500000280020C20300007372635C686F737411 +:102060005F636F72652E6300043000002F19B87D26 +:10207000C10706D0400704D460004019C08809F0A9 +:10208000C7FB3148807900281FD0B87D80071CD558 +:1020900060004019C0880022062109F0CDFB00280D +:1020A00013D03C2108A8017360004019C18868461C +:1020B000C18569460BA800F044FF06000BD0FF2045 +:1020C0002249433019F013FF05E0641CE4B268466E +:1020D0000079A042CAD83046A5E5F7B50546007894 +:1020E000002700090C463E46062804D0FF20174969 +:1020F0006C3019F0FCFE287A00280ED0012814D08C +:10210000FF2012498D3019F0F2FE0298002C068053 +:1021100001D0278066800020FEBD02270926002C02 +:102120000ED0A889A080A87B08E003271426002CE5 +:1021300006D02869E060A88A2082287B2072E4E724 +:1021400002980680E7E70000E40F00205820000016 +:1021500010B56038030019F0F8FF0A060A0F1318CB +:102160001F252930353A0868FFF7D7FD10BD05C98E +:102170001146FFF713FE10BD086809F018FC10BDEA +:1021800005C91146FFF781FE10BD4B6808788A68C3 +:102190001946FFF78CFE10BD8A6809C91946FFF77A +:1021A000A1FE10BD0868FFF7B6FE10BD08884A689A +:1021B00080B21146FFF7CCFE10BD05C91146FFF7EE +:1021C000DAFE10BD05C91146FFF711FF10BD012051 +:1021D00010BD0120704700000E4A12680C498A4267 +:1021E0000AD118470B4A1268094B9A4204D101B52B +:1021F0000AF06EF803BC8E4607490968095808477B +:1022000006480749054A064B7047000000000000D9 +:10221000BEBAFECA6000002004000020801E00201C +:10222000801E002001203F49400608603E490860AA +:102230003E490A68FF231B029A4383121A430A602D +:10224000384980390860704710B502460420384983 +:1022500004E0C3005B181B79002B0AD00346401E24 +:10226000C0B2002BF5D133A1432019F040FEFF206E +:1022700010BDC300CA50002259184A718A71012248 +:102280000A7110BD2A4A0021C000801801717047F0 +:1022900010B50446042803D326A1522019F027FEC6 +:1022A0002348E1000C182079012803D021A15320F4 +:1022B00019F01DFE6079A179401CC0B2814200D0A6 +:1022C00060710120174940068031086010BD70B56B +:1022D000164800680004800F022803D015A1692069 +:1022E00019F005FE124E194C03252078C1008819FB +:1022F0000279012A07D1427983799A4203D042793F +:102300008271705880472078401CC0B22070042829 +:1023100001D30020207028466D1EEDB20028E4D1C4 +:1023200070BD000080E100E080E200E018E400E021 +:102330007C1400207372635C736F635F7369676EF4 +:10234000616C6C696E672E63000000003000002035 +:1023500010B5EFF31080C407E40F72B6DA48417885 +:10236000491C41704078012801D10AF059FA002C2B +:1023700000D162B610BD70B5D34CE07800280AD108 +:102380000125E570FFF7E4FF0AF052FA002804D0B7 +:1023900000200AF025FA002070BDCC486571456028 +:1023A000F9E770B5EFF31080C507ED0F72B6C64CB4 +:1023B0006078002803D1C6A18F2019F098FD6078BD +:1023C000401E60706078002801D10AF02DFA002DBF +:1023D00000D162B670BD10B5BB48C178002904D0E9 +:1023E00000214171C170FFF7DCFF002010BD10B566 +:1023F00004460AF01DFAB449C978084000D001200B +:102400002060002010BDF8B50246AF4C0026A67132 +:102410000820042101251027130019F096FE0D084D +:102420000A0C0E101214161E2621232528002571D1 +:1024300022E0022001E021711EE020711CE02771E2 +:102440001AE02020F9E7012616E0FFF781FF0AF0E5 +:10245000EFF90028FBD002260EE02171A5710BE0F8 +:102460002771FBE7202000E040202071F6E7FF20E5 +:1024700097A17E3019F03BFD0AF0E6F9002809D05B +:102480000AF0E8F9B04205D130460AF0E6F9002832 +:10249000FAD02CE001208007C560914900224A60F3 +:1024A000904A9661894B02225A6085608E48026983 +:1024B000D243D206D51702696D1C10231A4302615C +:1024C0000F4600E020BF78680028FBD030460AF0B5 +:1024D000C4F90028FAD0002D04D1834802691021E4 +:1024E0008A43026179490220886000207860A079DF +:1024F00000280CD00AF09CF905460AF0F9F87B4A4E +:10250000002D02D0A260E06001E0E260A060002E39 +:1025100001D100F0B1F8F8BD10B504460AF08EF90B +:10252000002805D068490120C8704A78521C4A70BA +:102530002046FFF768FF10BDF8B5694FB868002561 +:10254000012802D1BD600AF04BF97868012800D15A +:102550007D60386801265C4C012814D13D606079AB +:10256000002803D000200AF03BF96571207800288C +:1025700009D00AF05DF9002805D05948C0388663B3 +:1025800000060661A670386901282CD13D6100F073 +:1025900068F8012080074661A079002815D00AF06C +:1025A00047F900900AF0A4F80099002901D0E168E9 +:1025B00000E0A168411A022901DA8A1C13DC0099A3 +:1025C000002901D0E06000E0A060FFF7C1FE0AF042 +:1025D0002FF9002806D04248C038866300060661FD +:1025E000A67000E02670F868012819D100F039F8CB +:1025F00000F037F800F035F8A078002804D1FF206B +:1026000033A1053019F073FCFD60A5702570FFF74C +:10261000C8FE09F0BCFC002802D03148C038C663AF +:10262000F8BD10B5284CE078002801D10AF0FCF87C +:1026300001208107886100F014F8A07800280BD0F1 +:10264000274CE068002803D10AF007F90028F8D1E8 +:102650000020E06000F005F800201C49C0438860BD +:1026600010BD08B55020694608806A461088411E92 +:1026700011800028F9D108BDF8B5144819278760E2 +:10268000174900200860C8600AF0D2F8BD0701248D +:102690000D4E002805D01248C03884632C61B470F8 +:1026A00000E03470FFF754FE084847600D49307968 +:1026B0008863FFF7D6FFAC61FFF7D3FF084900201E +:1026C00008616C61F8BD0000340000200003004088 +:1026D0007372635C736F635F636C6F636B2E630015 +:1026E000000100400005004000ED00E0FFFFFF7F1B +:1026F0008107C90E002808DA0007000F0838800893 +:102700002C4A80008018C06904E080082A4A8000B2 +:1027100080180068C8400006800F704710B50D2073 +:10272000FFF7E6FFC4B20420C043FFF7E1FFC0B2E9 +:10273000844203D021A11A2019F0D9FB10BD012138 +:10274000234A48031060234B00221A60224A51603A +:10275000224A1060224A11601D4980390860704782 +:1027600001211B4A480310601D4A5160194A00218B +:1027700011601A490860704710B5164908680128A9 +:1027800004D00EA1562019F0B2FB10BD1548806888 +:102790000022C0B20A6009F00BFD10BD10B50D4853 +:1027A00001680029FCD0FFF7E7FF01200B49400337 +:1027B000086010BD00ED00E000E400E07372635CAF +:1027C000736F635F68616C5F726E672E63000000F9 +:1027D00080E100E000D1004000D3004080E200E052 +:1027E00000D0004000D5004030B40121BC48C902EF +:1027F0000160CD1005604A030260BA4803681B02FD +:102800001B0A036004680023240A24020460B648FB +:102810000468240A24020460B448012444608460EB +:10282000B34C23606360A360B24B19601D601A60F3 +:10283000B14B19601A600121016030BC704710B4BF +:102840000121A748CA0202600B0203600C06046063 +:10285000A64841608160A94841680029FCD1A4498B +:102860000020086048608860A2480260036004603D +:1028700010BC704701219F48C9020160C910016066 +:102880007047002805D0012805D0022805D19C48B2 +:1028900070479C4870479C48704710B59BA18B209F +:1028A00019F025FB002010BD70B500219E4C9F4DF6 +:1028B0009F4A8F4B002808D001281DD0022822D023 +:1028C00092A1B32019F013FB70BD01200004A06099 +:1028D000A86011601960974BC2039A60964A906095 +:1028E0007F4A001210609548016086480160944854 +:1028F00001609448017070BD01204004A060A86090 +:102900005160596070BD01208004A060A860916092 +:10291000996070BDF8B59446834A754F834D002485 +:102920000126002808D0012832D0022840D077A103 +:10293000E82019F0DCFAF8BD891E0902090A012015 +:10294000000490603C606860794A1160012B1DD0E2 +:1029500000217C4A7C4B517061463D31DC63DE6373 +:102960007A4B5C6002249C6004241C61734B1960E8 +:1029700073490E605F4B891519606F4B58605E4854 +:1029800001606C49C00548601670F8BD0121E0E7A0 +:1029900001205D4E40046E4F012B04D13460506025 +:1029A00068603960F8BD9060346068603960F8BD77 +:1029B0000120534E8004674F012BF4D1EEE74F48BE +:1029C0004068704770B54A4D28680026564C01286B +:1029D00006D1A068C00303D501200004A0602E60CA +:1029E0006868012809D1A068800306D50120400449 +:1029F000A0606E6001200AF0FEFEA868012809D1DF +:102A0000A068400306D501208004A060AE600220CB +:102A10000AF0F1FE70BD10B54A490878002818D0B8 +:102A20000120444AC0079060434AC00B90602C4A82 +:102A300000121060414A00201060324A1060404A83 +:102A4000106008704A78002A02D048700AF0D3FE5D +:102A500010BD0320FAE701203F49000608607047D7 +:102A60000120244900060860704701203A494005CA +:102A70000860704701201F494005086070473249CF +:102A80000020C86388151B4908607047410A334A13 +:102A9000C005C00D5043801C5143400A08187047C0 +:102AA00010B42F4C430B63431B0C5C020C602B4C8B +:102AB0006343C31A2B485C025843284B400D4343E1 +:102AC000E31A0124DB0324041B191B1613700A6884 +:102AD0001018086010BC704710B50AF05FFF10BDF9 +:102AE00080E100E008E400E018E400E000B000400D +:102AF00040B1004080E200E000E100E000B50040AD +:102B000048B100404081004044B100407372635CB2 +:102B100072656D5F68616C5F6576656E745F746920 +:102B20006D65722E6300000000B3004040B30040AA +:102B300040B5004000F50140008300404085004062 +:102B40000082004044000020C08F0040008500400B +:102B500044B5004048B5004000E200E0093D0000F7 +:102B6000378600006F0C010010B50AF003FF10BD9E +:102B700000200449C863012001218140024A1160FC +:102B800000BF7047C01F004080E200E010B50BF0AE +:102B9000A5FB09F04BFAFEF709FC0DF01FFD0CF048 +:102BA000B5F90CF041F910BD70B50C46054603F0BF +:102BB000B5FA214628460DF0E8F970BD70B50D460E +:102BC000040012D0002D10D02101284619F062F81F +:102BD00010225449284619F000F8524801210838BB +:102BE000018044804560002070BD012070BD70B53B +:102BF0004C4E00240546083E11E071682001401843 +:102C0000817BAA7B914209D1C17BEA7B914205D1AC +:102C10000C22294618F0B4FF002806D0641C308826 +:102C20008442EADB0020C04370BD204670BD70B511 +:102C30000D4606000AD0002D08D03A4C083C2088EA +:102C40006188401C884203D9042070BD102070BDEB +:102C50003046FFF7CCFF002801DB401C0AE020884B +:102C60006168000140181022314618F0B6FF208834 +:102C7000401C20802870002070BD70B514460D00E7 +:102C80001FD0002C1DD00021A170022802D01028D6 +:102C900017D108E0687829780002084311D0012193 +:102CA000A17010800BE02846FFF7A1FF002808DB89 +:102CB000401CA070687B297B000208432080002014 +:102CC00070BD012070BD70B5054614460E000AD0D7 +:102CD00000203070A878012807D004D9114908399C +:102CE0000A8890420BD9012070BD002C04D02878AE +:102CF00020702888000A50700220087010E0002C14 +:102D00000CD049680001411810222046103918F0F3 +:102D100064FF287820732888000A607310203070C0 +:102D2000002070BD500000205D4910B5884206D3D8 +:102D300001218904884204D35A49884201D21020D3 +:102D400010BD0146012005F0D5F810BD30B5044690 +:102D500093B000200D46079014210BA818F09CFF9B +:102D60001C21684618F098FF6A4611201077002051 +:102D70005077107802210843107007A80C900120AA +:102D800008AA907248486A4610850AA80B902088C5 +:102D9000108460885084A0889084E088D084907FDC +:102DA000F9210840801C4008400090770820908658 +:102DB000108708A80F9010AA0BA9684600F094FF8E +:102DC000002803D110A800882880002013B030BD4F +:102DD00030B585B0044608206946088105F09CFEA0 +:102DE00005000CD02E48844206D301208004844282 +:102DF00007D32C48844204D2102005B030BD2B48A4 +:102E0000FBE72146012005F075F80028F5D1208860 +:102E10006946088060884880A0888880E088C880EB +:102E20006B4602AA0021284601F0DDFB69460989AC +:102E30000829E2D00320E0E71FB5044605F06CFE48 +:102E4000010012D00020029008206A461081144828 +:102E50000392844206D301208004844207D31148A0 +:102E6000844204D2102004B010BD1048FBE702AA2F +:102E70000F4801F045FD0028F5D169460989082968 +:102E800001D00320EFE76946098821806946498817 +:102E9000618069468988A1806946C988E180E2E746 +:102EA00000D0010000280020042A000005300000A6 +:102EB000FFFF000010B5031D03600020521E04E058 +:102EC0005C181C60401C2346C0B29042F8DB002016 +:102ED000186010BD01460A680020002A02D0104682 +:102EE00012680A60704702680A600160704700005B +:102EF00000B51E2823D00BDC0C281CD01FDC0300DF +:102F000019F023F9090F1D111D1D171713151D00A9 +:102F1000302814DD3A38030019F017F9030F1109AE +:102F20001100002000BD214800BD042000BD0D207F +:102F300000BD0F2000BD082000BD112000BD0320F2 +:102F400000BD10B50C460BF09BF900281ED02046A2 +:102F50000BF0A1F9002816D022780E2A0DD00F2AE6 +:102F60000BD0022A09D0032A07D0102A09D010A1B9 +:102F70007C2018F0BCFF002010BDA078FFF7B8FF40 +:102F800010BD112010BD0AA18220F2E708A18820FF +:102F9000EFE710B50BF05EF910BD10B50BF07BF943 +:102FA00010BD10B50BF061F910BD0000023000003B +:102FB0007372635C686F73745F6863692E6300008B +:102FC00010B501462022094818F007FE07490020E5 +:102FD000C877084610BD0649012048610548064AE1 +:102FE0000168914201D1002101607047B0160020B4 +:102FF0000005004060000020BEBAFECA704770475E +:1030000010FFFFFFDBE5B15100D001006B00FFFFB7 +:1030100003B40148019001BD09000020002803D03D +:103020008178012939D101E0102070470188FC4ADC +:10303000881A914233D01BDCFA4A881A91422ED06A +:103040000BDC00292BD00320C002081A27D001284E +:1030500025D001210903401A07E001281FD00228CA +:103060001DD0FF281BD0FF380138002815D116E0ED +:10307000FF220132811A904211D008DC01280ED0C3 +:1030800002280CD0FE280AD0FF2806D107E001292B +:1030900005D0022903D0032901D0002070470F205A +:1030A000704700B50A2821D008DC030019F04DF85C +:1030B0000A1C2024241A24282224261A102819D075 +:1030C00008DC0B2816D00C2814D00D281AD00F2895 +:1030D00008D111E011280FD0822807D084280DD004 +:1030E00085280DD0032000BD002000BD052000BDB7 +:1030F000CD4800BD072000BD0F2000BD042000BD4D +:10310000062000BD0C2000BD70B500290BD0CB1FE0 +:10311000FA3B81241E46CDB2112B1BD2012805D0CB +:10312000022806D009E0002010701DE0FF200430C6 +:1031300001E0FF200330814218D0330019F005F878 +:10314000111613131613161613161616131313133C +:10315000161316000846FF3881381F2803D9FF3997 +:10316000FE39022902D81570002070BD14700720A6 +:1031700070BD00B5030018F0E8FF060406040C0853 +:103180000A0C002000BD112000BD072000BD082052 +:1031900000BD032000BD00780207120F04D0012AF1 +:1031A00005D0022A0AD10EE0000907D108E0000983 +:1031B000012805D0022803D0032801D0072070473A +:1031C00008700020704706207047002807D00128AB +:1031D00007D0022807D0032807D007207047002017 +:1031E00004E0112002E0212000E0312008700020DE +:1031F000704738B50C4605004FD06946FFF7CBFF46 +:10320000002822D120880321890288436946097851 +:103210008907090D084320806946681CFFF7BBFF3A +:10322000002812D1218803200003814368460078DA +:103230008007800C01432180A8784007820F20205E +:10324000012A03D0022A03D0072038BD814300E0C1 +:103250000143218088B20105890F08D0012189032B +:103260008843A9780907C90F89030843208080B2E1 +:103270008104890F0AD0A9784004C906C90F400CFF +:10328000C903084320808004800F02D120884004B5 +:1032900003D52088402108432080002038BD70B528 +:1032A00004460020088015466068FFF7A2FF00284A +:1032B00015D12189A089814210D861688978C90710 +:1032C00008D001214902884208D8491C18F0EEFCB8 +:1032D000298009E0FF21FF31884201D90C2070BD0F +:1032E000FF30FF3003302880002070BD10B5137808 +:1032F00004785B08E4075B00E40F23431370FD24AC +:1033000023400478A407E40F640023431370FB24D4 +:10331000234004786407E40FA40023431370F724C8 +:10332000234004782407E40FE40023431370EF24C0 +:1033300023400478E406E40F240123431370DF24C0 +:1033400023400478A406E40F64012343137000783B +:10335000BF244006C00F234080010343137000299F +:1033600006D00878C10701D1800701D5012000E00F +:103370000020C0015906490E0843107010BD30B539 +:103380000A8803239B0204889A4323059D0F02D1D8 +:10339000A3049C0F01D09B0F00E001239B021A4362 +:1033A00003230A801B039A4303889804840F02D1E5 +:1033B0001805830F01D0800F00E0012000030243B5 +:1033C0000A8030BDF3B593B00D000FD013980028DC +:1033D0000FD01221284618F05DFC03AAFF2101201E +:1033E00003F0B1F80024264637467AE0102015B0E5 +:1033F000F0BD0720FBE76846807D01280BD16846B9 +:10340000818A0520C002081A10D0012810D0022895 +:1034100012D0032812D0042C14D0052C15D113E09F +:10342000022900000128000003300000012400E010 +:1034300002246846468A08E0032406E0684604241D +:10344000478A02E0052400E006246846418A139872 +:10345000814246D12C74002E41D00DAA0EA9052020 +:1034600002920191009010230022FF21304603F0C8 +:103470000BF9002823D16846808E2A46C0B20EA9D7 +:10348000FFF7FBFB00281AD1AE81002F27D00DA932 +:10349000052008AE02910090132300220196FF211F +:1034A000384603F0F1F8002809D16846808EF11CF7 +:1034B000C01EC0B22A1DFFF7E0FB002801D0032088 +:1034C00095E708A88178427808021043E881062C25 +:1034D00005D16846807DA8726846808A28810020D0 +:1034E00085E703A803F038F8002884D0FFF7D9FD5A +:1034F0007DE7002805D0FA4A012903D0022903D02C +:1035000003207047518800E09188814201D100205A +:1035100070470720704770B50C4605461C212046B1 +:1035200018F0B8FB00202080002D08D0012D04D019 +:10353000ECA1F14818F0DBFC70BD062000E005208E +:10354000A07070BD70B592B01546064601206A465F +:10355000107110745374084608300395029048881F +:103560009082FEF71AFA040019D065801720694688 +:103570008883203600940AAB7178023307AA01A829 +:103580000CF00BFB06466078000701D5FEF7E6F964 +:10359000002E0AD03046FFF7ECFD12B070BD1321AB +:1035A000284605F041FF0320F7E708A80090684689 +:1035B000838B04220121284607F028FEEDE770B531 +:1035C00006468AB000200D4607900590069003A994 +:1035D000049005240246029101901023009429468C +:1035E000304603F051F800280DD108A804A9009135 +:1035F000029001946846838900222946304602F0F1 +:103600005FFE002801D0FFF74CFD0AB070BD10B579 +:103610000CF0C9FC10BDF0B589B000260546059632 +:1036200000780C460827030018F08FFD0CFD070CEE +:103630003A0B77779EC2FCD8E8FD68680A38FEF737 +:1036400025FB0DE1A888002380B201220321009010 +:1036500008F0E7FA0290002C04D0A748A1A16E3030 +:1036600018F045FC0298002804D15B209DA1C00001 +:1036700018F03DFC0298009908300BF0C3FEFEF7ED +:103680008CF9040007D0607838436070009860803F +:10369000FEF764F9E6E01321009805F0C5FEEFE0BF +:1036A000002C04D194488FA1853018F020FC60884C +:1036B00000230122032108F0B4FA0090002804D16D +:1036C0008D4888A1883018F012FC009900200880ED +:1036D0002A7994461EE0C3005B199B6807936B46EA +:1036E0009B8B1A0708D5DA0606D56046C20050192A +:1036F0004038C08F088006E05B0409D50871C2001D +:103700005019C08848806078384360700226A7E06E +:10371000401CC0B28445DED8A2E0E8886946088033 +:103720000090002C04D174486EA1983018F0DFFB93 +:103730002878062814D10098C00B11D06088002387 +:103740000122032108F06DFA060004D16A4865A140 +:10375000A23018F0CCFB00203071A88870803BE0CC +:103760006078384360707BE0002C04D162485DA132 +:10377000B43018F0BCFB608800230122032108F05C +:1037800050FA0090002804D1192056A1400118F0E9 +:10379000AEFB009808300CF058FC0121484002D1E3 +:1037A000E888C00B5CD0009861880226C180D7E70A +:1037B000002C04D150484BA1D03018F098FB608801 +:1037C00000230122032108F02CFA002804D1CF2085 +:1037D00044A1800018F08BFB0226C1E7002C04D125 +:1037E000454840A1DC3018F082FB022661880122A6 +:1037F0002046FEF75CFA01200590B1E7A889002376 +:1038000080B201220321009008F00BFA0746002C39 +:1038100004D0394833A1EE3018F069FB002F07D1EE +:1038200030A101E00FE016E06B20C00018F05FFB54 +:1038300068680290288969468881012202A9009857 +:10384000FEF751FA0CE0002C8AD12B4825A1F93063 +:1038500018F04DFB84E7284822A1FE3018F047FB02 +:10386000002C0DD0607800070AD50598002807D1F4 +:10387000842020702046582229460830FDF7A4FCF9 +:10388000304609B0F0BDF7B50C460546007A224631 +:1038900088B00A320292921C04920027811E1632CE +:1038A0003E4601920B0018F050FC08F605F548481A +:1038B0008DD2F4F5688800230122032108F0B1F9C4 +:1038C0000190002804D1072006A1C00118F00FFBC9 +:1038D00001980088002811D05227072600E1000037 +:1038E0009C1400207372635C67617474735F636F10 +:1038F00072652E63000000006902000051271E2639 +:10390000002C7DD06888A0800120A07101980299C8 +:103910000079C0004019C089FFF754FD002870D11C +:1039200001980079C0004019C08920810198007970 +:10393000C0004019408AA083F2E0698A00910628FD +:1039400020D1E889C00B1DD008462230512786B20D +:10395000002CD6D0A8890499FFF734FD002874D133 +:103960006888A0800220A071A88920810120A0720F +:10397000288AE083009820846969009A019818F0E9 +:103980002CF9CDE008462030502786B2002CB8D064 +:10399000A8890299FFF716FD002856D16888A080F3 +:1039A000A889E080287A06280AD002202072288A76 +:1039B000A0830098E083204669692030009ADEE702 +:1039C0000120F3E7688800230122032108F029F988 +:1039D0000690688A00900698002804D17D20FD4951 +:1039E000C00018F084FA069808300CF02EFB012174 +:1039F000484002D1E889C00B26D00098223001E06F +:103A000073E022E0512786B2002C78D06888A0802D +:103A1000A8890499FFF7D6FC002816D10220A071CE +:103A2000A88920810420A072288AE083009820843D +:103A30006969009A019818F0D0F806990020087179 +:103A40000698A98941806BE003200BB0F0BD68881F +:103A500004F0AFF90190688800230122032108F0E7 +:103A6000E0F800900198002803D1DA49DA4818F00C +:103A70003EFA0098002804D1D748D649401C18F0D7 +:103A800036FA0098D549C088884205D051272226A9 +:103A900004E01EE03FE035E050272026002C2ED029 +:103AA0006888A080502F07D00220A0712146287B73 +:103AB0000831FFF730FD33E0287BA11DFFF72BFD18 +:103AC0006A88002300990198FFF73CFD0028BCD1CB +:103AD00026E0C349A889C988814207D15427062610 +:103AE000002C0CD06888A0801AE008E05327082634 +:103AF000002C04D06888A080A889E08010E00A9893 +:103B0000068013E055270726002CF8D0A889A0804E +:103B10000020A07104E0B048AE494E3018F0E7F93B +:103B20000A98002C068001D02780668000208CE750 +:103B3000AB4900200870704730B585B00C4601F0E5 +:103B4000ACF905460020208020716080401EE08096 +:103B50002046294608300BF049FC6A4629460120D8 +:103B600002F0F1FC102412E06846808800070ED5B0 +:103B70006846C0882946FFF722FD68468188FF23F2 +:103B800021438180C0882946019A02F007FE6846D9 +:103B900002F0E2FC0028E7D005B030BD0A4601463D +:103BA00010B5104608300BF035FC10BD70B5002381 +:103BB00005461A46032108F034F8040004D186486B +:103BC00084498A3018F093F92046294608300BF0D2 +:103BD00019FC70BDF0B591B00C46074604F0E9F849 +:103BE000050005D02878222804D2082011B0F0BDA5 +:103BF0007C48FBE700231A460321384608F011F8F9 +:103C00000646002C02D0A08800280CD0012069466E +:103C100008710220087400204874002C05D0A08888 +:103C20000883206802E00920E0E708830590304619 +:103C3000083003970290FDF7B0FE040018D06780AB +:103C4000172069468883203500940AAB69780233CF +:103C500007AA01A80BF0A1FF05466078000701D56F +:103C6000FDF77CFE002D09D02846FFF782FABDE75C +:103C70001321384605F0D8FB0320B7E708A80090C9 +:103C80006846838B04220121384607F0BFFA0021E1 +:103C9000C943F180AAE7FFB585B00E9E7788384604 +:103CA00004F087F8054600231A460321384607F03A +:103CB000B8FF0446002D04D147484649F13018F0BA +:103CC00016F9002C04D144484249F23018F00FF99B +:103CD0000834089869460394C1C105A80DC8203569 +:103CE00069780BF0C9FBCCE5F0B50446002099B02B +:103CF0000D4601460D9010A88181164601818180F4 +:103D0000374A68469180018510A80180684601877E +:103D1000818581841078012808D0022806D00328E4 +:103D200004D0042802D0082019B0F0BD2E488442E7 +:103D300079D3012189042D4F8C4201D3BC4272D327 +:103D4000294885426FD301208004854201D3BD42BA +:103D500069D36068002813D02349884263D30121C6 +:103D60008904884201D3B8425DD3608921898842A1 +:103D700003D801225202914201D90C20D4E70D90C0 +:103D800016AA0EA92846FFF78AFA0028CCD168683F +:103D900080784007800F022809D16846008F800490 +:103DA000800F04D02869002801D0B8423BD30AA96B +:103DB0002069FFF71EFA0028B6D1206900281AD022 +:103DC000607880076846008D12D58004800F74D01B +:103DD00011E00000E438000014040000FFFF0000C0 +:103DE0009C1400200230000000D0010000280020B8 +:103DF0008004800F61D16846008D810615D580044E +:103E0000800F606804D000280FD0B8420BD301E0C7 +:103E100000280AD0FE49884205D30121890488423E +:103E200003D3B84201D210207EE709A96069FFF7E9 +:103E3000E0F90028A2D16069002808D06846808C8B +:103E40000105890F012938D18004800F35D00BA9D5 +:103E5000A069FFF7CEF9002890D16846808C8006D3 +:103E60002BD46846808D810627D4A169002906D00D +:103E70000105890F012920D18004800F1DD0E06841 +:103E8000002804D00078002817D01C2815D204AAD6 +:103E9000611C2046FFF72AFA0120800210A9088041 +:103EA000012769468F73DB48888104AA033217A96A +:103EB0002868FEF708FF002801D0072034E710A883 +:103EC000007F15A9C01CC2B200200C920190FF32E5 +:103ED000009003460291FF3203A80332109902F0CA +:103EE0008AFA002828D110A9888A0F902A8929697E +:103EF000C94801910092029010A90A8B6B89286829 +:103F00000E9902F078FA002801D001464DE0C2482F +:103F10000025001F818868464174090A81740521C3 +:103F200004A86A4623C210A82A46FF21808A0C9B57 +:103F300002F0C6F9002802D0FFF7B3F8F4E66846AD +:103F4000007C0322C10900209202904301229202C8 +:103F50008018149000292CD0014610A801806846D2 +:103F60002921877309028181058608A8007C002326 +:103F7000410860784900C007C00F014308A80174D8 +:103F8000FD2001406078A54A8007C00F4000014332 +:103F900008A801740CA9022001910090029503A8C1 +:103FA000109902F028FA010003D00F9800F079FF71 +:103FB000BAE66068002829D0206900280DD10AA936 +:103FC0000EA8FFF7DCF96078800706D46946088DF3 +:103FD000032109038843694608858E49684687732B +:103FE000FE3181818D492089891E17F05FFE62684C +:103FF0000D9811AB0192009002930A46002303A88A +:104000000A9902F0F8F9002800D07EE72078C1066E +:1040100001D480062AD568460586606900280DD13E +:1040200009A90EA8FFF7ABF96846818C032080022E +:104030008143012080020918684681846946888C82 +:10404000C82108436946888472488F73FF3088818D +:1040500012AA0CA9022002920191009000236F4A3B +:1040600003A8099902F0C7F90028CED12078C0072B +:1040700029D068460586A06900280DD10BA90EA895 +:10408000FFF77DF96846808D03218902884301216D +:1040900089024118684681856846818D4020014328 +:1040A0006846818587735E49818113AA0CA9022025 +:1040B0000292019100900023584A03A80B9902F044 +:1040C0009AF90028A1D1E068002829D010A81499F5 +:1040D0000180534968468773491C8181E16808A8BB +:1040E0000A78027449784174E06841224188684640 +:1040F0004186E0680023017908A80175E068D200D4 +:10410000C18808A84175090A81750CA8072101908A +:104110000091029503A8109902F06DF90028A4D12E +:104120003D480321001F0170002E0AD08088308096 +:1041300010A88088708010A80089B08010A880899D +:10414000F0800020F0E530B501248BB015460B4619 +:10415000012802D002281CD104E06846052184739E +:10416000C90203E02B4968468473891E8181002BB4 +:1041700012D00321002089028843012189024018BE +:104180006946888405AA04A91846FEF79CFD002804 +:1041900004D007200BB030BD1020FBE76A46127C2C +:1041A0001D480092801E05A9FF3201910290FF3246 +:1041B000002303A80332099902F01DF9002802D058 +:1041C000FEF76FFFE6E71448001F002D01D041887D +:1041D000298004700020DDE770B592B00446012606 +:1041E00008A886700F4968460184002208A9304655 +:1041F000FFF7A9FF00284BD12078074DC007002406 +:104200002D1F002842D01C21684617F045FD0BE009 +:1042100000D0010003280000A014002003020000C9 +:10422000032900000118000068460178202001439E +:104230006846017008A88670FE496846018411949A +:104240000794817FF92001406846891C817700200E +:1042500001466846017700200146684641770421FF +:104260008185C485018607A80A9011A80D9008A829 +:1042700009900EAA09A96846FFF736FD002807D164 +:104280006846008FE8806846808F28812C70002067 +:1042900012B070BDF7B5E84900260A789EB0012A31 +:1042A00004D0022A02D0082021B0F0BD4A88824200 +:1042B00001D00620F8E71F98824201D10720F3E7DA +:1042C000012210A98A75DD488882002003239B0201 +:1042D000014699439302CB1810A90B8669468A813F +:1042E000D74ACA8118A9887110A9888419A904918C +:1042F0006946CA820690FF20087503A802F04FF9AC +:1043000000242546274608AA052103A802F04AF9F9 +:10431000002810D082286FD1002C6FD0002D6DD0D6 +:1043200010A88480C5800021017418A8807B11AC7E +:10433000012865D06DE008A88079002F21D00128E0 +:1043400057D16846818CBD4881421CD113AA0DA962 +:1043500005206B4607C36846408C10230022FF21CE +:1043600002F092F9002868D110A88089042801D0B1 +:1043700006284CD16846818E1F98814239D10F2082 +:1043800092E7012835D16846808C0521C902884210 +:1043900002D0491C88422CD1A74841886846408CED +:1043A000814201D1012700E00027002C01D0002D1F +:1043B00010D01F9988421CD113AB0DAA05216E465F +:1043C0000EC6044610230022FF2102F05DF90028EA +:1043D00033D101E035460CE010A88089022801D0D5 +:1043E000102814D1C0B21BAA0DA9FEF746FC002864 +:1043F0000DD16846468C86E71FE0FFE7052053E7AE +:1044000014A91BA8221DFEF75EFC002801D0032082 +:104410004AE710A8007C0023001DC2B210A8027455 +:10442000209802900194009215A81C9901F0E3FFD6 +:10443000002802D1804902220A70FEF732FE33E7DB +:1044400010B50B46401E86B084B203AA0021184660 +:10445000FEF74CFF04AA052103A8029201910090E7 +:1044600001230022FF21204601F02AFF044668466E +:10447000008A012803D07349734817F038FD20469D +:10448000FEF70FFE06B010BDF0B56B4F044638784E +:1044900087B00E46032804D0042802D0082007B0B5 +:1044A000F0BD04AA03A92046FEF7F9FE0500F6D1E7 +:1044B000606880784007800F02280CD168468089A8 +:1044C0008004800F07D02069002804D05F4988420B +:1044D00001D21020E3E7208905AA6B46216907C3B2 +:1044E00069460A8A63892068039901F084FF0028DD +:1044F00002D0FEF7D6FDD2E7002E02D06846808AB1 +:104500003080042038702846C9E738B50C000546CD +:1045100009D000236A46FF2102F018F9002804D0D0 +:10452000FEF7BFFD38BD102038BD69462046FEF7B6 +:1045300060FE0028F8D1A078FF21C307DB0F2846D2 +:10454000009A02F02BF9EBE73EB50C0009D002AB64 +:104550006A46FF2102F0FAF8002804D0FEF7A1FD18 +:104560003EBD10203EBD0321204617F093FB684658 +:10457000008801A90005800FFEF727FE00280BD157 +:104580006846007920706846008801A98004800F81 +:10459000FEF71BFE002801D003203EBD68460079CF +:1045A0006070A278EF20024068460088C10B0901C4 +:1045B0000A43F7210A404104C90FC9000A43A27007 +:1045C000F9210A40800601D5022000E001204000C8 +:1045D00069460243097A50084000C907C90F0843D9 +:1045E000A07000203EBD7FB514460522019203ADA8 +:1045F000029500930A462388FF2101F061FE694677 +:1046000089892180FEF74DFD04B070BDF3B5002708 +:1046100099B068460C4607873D4600292DD0E068D2 +:10462000002806D0A068002827D001886A46118794 +:1046300007800DE0052A00009C14002002280000DD +:10464000FFFF0000E4380000BF0600000028002043 +:10465000199803F0AEFB002812D0007822286FD3FF +:10466000199800F01AFC002300901A4603211998AB +:1046700007F0D7FA06000AD104E010201BB0F0BD05 +:10468000FE48FBE78D20FE49000117F030FCA078C2 +:10469000012803D0022801D00720EFE72088002856 +:1046A00008D0401E80B203AA009901F04CFF0028F8 +:1046B00058D11DE0F148401CE0E76946498A22884C +:1046C00091420BD26846807D0025012810D16846B2 +:1046D000808AEC4988420BD1012509E0914203D13F +:1046E000002D2AD06D1C01E0022D0BD0032D04D229 +:1046F00003A801F031FF0028DFD082281BD000285A +:1047000030D11EE06946897D0129F1D16946DD4B32 +:104710008A8A5B1ED11A9A420FD005DCDA48101A39 +:104720000BD00128E4D108E0012906D0FF39012986 +:10473000DED10325E1E7022D14D10D2080029DE793 +:104740002DE0E068002814D00EA905220291019204 +:10475000009069460B8FA2882088FF2101F0B0FDF0 +:10476000002802D0FEF79DFC88E76846A168008F0C +:1047700008806846008AC00601D5C4487EE70798CD +:10478000002803D06846008B022801D0032075E77B +:104790000798A1780078012903D0800710D4082059 +:1047A0006CE7C007FBD000220721199807F044F8F6 +:1047B000002802D00725022004E0B048801C5DE7F5 +:1047C0000225032008A90870218868468185199868 +:1047D00008360A90099617216846818712AB023382 +:1047E0000FAA052108A800970BF0D7F9002802D0DE +:1047F000FEF7BFFC42E710A800906846838F0422B2 +:104800002946199806F002FD38E770B506461546A8 +:104810000C460846FEF702FC002804D12A46214631 +:104820003046FFF790FC70BD10B5FFF733FD10BDAB +:1048300070B51E4614460D0014D0002C12D06168CD +:1048400000290FD00121FEF754FE002809D120686D +:10485000FEF7E4FB002804D1324621462846FFF744 +:1048600043FA70BD102070BD70B515460C000ED017 +:104870000221FEF73EFE002808D12068FEF7CEFB9D +:10488000002803D129462046FFF7FEFD70BD102009 +:1048900070BDF8B50D4614467D4902468C4226D3BC +:1048A0006068002808D07B4B984220D301239B04EA +:1048B000984201D388421AD3104600F0EEFA064619 +:1048C000284600F0A6FA00280CD16068002810D114 +:1048D00000236A463146284601F038FF002802D0FE +:1048E000FEF7DFFBF8BD68460088800601D4102083 +:1048F000F8BD6188224628466368FFF774FEF8BD5C +:10490000F7B5634D86B01446AA4202D2102009B012 +:10491000F0BD00F0C2FA01460390002305AA0798F3 +:1049200001F014FF002822D16846808AC00601D514 +:104930005648ECE704A80026052702900097019648 +:104940006288554B0399079801F09EFE00280ED10E +:104950006168A94208D30296019100972388628872 +:104960000399079801F090FE6946098A2180FEF7B5 +:1049700098FBCCE7002907D0484B0A881B899A424C +:1049800002D83E48401C704740E610B586B004236C +:104990006C46A382414BDC88002C07D01B898B42DC +:1049A00001D2914204D93548401C6BE5062069E5E7 +:1049B0006B4619825A820021009101911C800221CC +:1049C000997005A9029104A903916946FFF71EFE9B +:1049D00058E5F3B50C4685B0812069460873002C74 +:1049E0001BD0059803F0E5F9070018D03878222885 +:1049F00068D3059800F051FA04900022012105982F +:104A000006F01AFF00280CD000231A46032105984F +:104A100007F007F905000AD105E010203FE5174827 +:104A20003DE511203BE516491D4817F060FA284680 +:104A300008300AF009FD06462078012803D0022834 +:104A400037D007202BE5A18803AAFEF75DFB0028DD +:104A5000E4D1B00736D56846007B002834D1A07970 +:104A6000C00731D0E068002205216B4607C3638987 +:104A700022896888049901F023FC13E002300000C9 +:104A8000E438000003280000002800000134000082 +:104A90000028002000D00100FFFF00009C1400202F +:104AA000670A00006946087300280DD0FEF7F9FA7E +:104AB000F5E4A18803AAFEF727FB0028AED1342035 +:104AC000064201D10820EAE46846037B29463846BD +:104AD000059AFEF737FDE2E4FFB597B0002001909C +:104AE0001F4615460C460E46179803F062F900283B +:104AF00004D00078222803D20820BFE5F048BDE5A5 +:104B0000B80801D00720B9E5032F00D10027179876 +:104B100000F0C3F90890002C1AD0022D7FD3E94889 +:104B200084427CD361190091012902D0491E81423F +:104B300075D3AD1EAAB22146E3480BF005FB0099E0 +:104B40001E394B7F0A7F19021143884267D1ADB2EB +:104B5000DE48B90702D50189491C00E0012189B26C +:104B60000091F90701D0078900E0D74F03AA0899FF +:104B7000009801F0E8FC0DE0F078B17800020843FD +:104B800010284CD80199091D401880B20190A84204 +:104B900045D82618002E60D070783178000208437E +:104BA00000998842E8D358E06946098A0A0754D533 +:104BB000002C3FD0019AA618121D92B20992F378E8 +:104BC000B2781B0213439C46102B28D8099A6244E2 +:104BD000AA4224D87278337812021A4390421ED126 +:104BE000C8061ED509980AAA052120186B4607C3D6 +:104BF000707831780002084363460022089901F07A +:104C00005FFB002803D0FEF74CFA37E507E0F078A9 +:104C1000B178000208436946098D884201D00B2013 +:104C20002CE5F078B178000208430999401880B269 +:104C3000019006E0C90604D50899FEF7C0FC0028DB +:104C4000E3D16946088A1021884369460882488A68 +:104C5000FF23049A089901F0A1FD03A801F07CFC50 +:104C6000002803D16846408AB8429DD900231A46DD +:104C70000321179806F0D5FF040003D19449954805 +:104C800017F035F920880028BFD0012108A801704D +:104C90000173002646732188684601862046083045 +:104CA000099017980A90FCF778FE05001BD017981A +:104CB000688017206946888010AB023301AA05215D +:104CC00008A800950AF069FF07466878000704D530 +:104CD00080487F49223017F00AF9002F09D0384662 +:104CE000FEF747FACAE41321179804F09DFB03204E +:104CF000C4E40EA800906846838804220121179816 +:104D000006F084FA00288BD12680B7E4F0B50024A1 +:104D10008DB01F4615460E46002A04D0B90804D0AF +:104D200007200DB0F0BD1020FBE7032F00D10027B6 +:104D300000F0B3F803906549B80702D50889401C14 +:104D400000E0012080B2FA0701D00F8900E05E4F39 +:104D500006AA039901F0F7FB38E06946898B090739 +:104D600034D504AB05210022029300910192564BE9 +:104D7000039901F089FC002821D1002E21D06A4638 +:104D8000128A2988A2183019121D914232D369461D +:104D9000CA8B0270120A42700A8A8270120AC270AA +:104DA00004A90522001D0092029101906946C88B5A +:104DB0000B8A0022039901F067FC002801D0032030 +:104DC000AFE76846008A2018001D84B206A801F0EB +:104DD000C3FB002804D0822806D0FEF762F9A0E7C2 +:104DE0006846C08BB842B8D9002E0ED02988A01CC6 +:104DF000814201D20C2094E72246314632480BF022 +:104E0000A3F931190870000A4870A41C2C800020F6 +:104E100087E700B585B06946FEF7D4FA00280AD1C5 +:104E20006846007C030017F090F908052F2F2F2FFC +:104E300008080531032005B000BD684680780128C8 +:104E400007D1684600880321C902401A1CD00128F6 +:104E50001AD068468079012806D1684680881521D5 +:104E60004902401A05280FD96846807A012812D1D4 +:104E70006846018929200002081A05D0022803D0BB +:104E8000032801D0042806D10F20D4E7872012A1DF +:104E9000800017F02CF80020CDE710B506F0B4FE26 +:104EA00010BD10B50C4601F021FB002803D00AA16B +:104EB0000E4817F01CF82046FEF7F3F810BD00006E +:104EC0000230000000280020FFFF00009C1400209A +:104ED000E4380000220B00007372635C6761747435 +:104EE000735F636F72652E6300000000AA06000006 +:104EF000F8B500780C46164610340E36069F022888 +:104F000009D0032836D005287ED0FF20F6A1E53051 +:104F100016F0EDFFF8BDCD890A2068430E301880E9 +:104F200031203880002AF5D0087B9581801FC7B2D8 +:104F30001AE020886168308048780A7800021043BF +:104F4000F080C8788A78000210433081B21C38465D +:104F5000091DFDF792FE002F01D0002802D000208D +:104F60003071708008340A3628466D1EADB20028B4 +:104F7000DFD1F8BDCD890A2068430E301880322079 +:104F80003880002AF5D0087B9581401FC7B243E0E6 +:104F9000616822880878F2803279C307520852008B +:104FA000DB0F1A43FD231A408307DB0F5B001A4314 +:104FB000FB231A404307DB0F9B001A43F7231A40D9 +:104FC0000307DB0FDB001A43EF231A40C306DB0F96 +:104FD0001B011A43DF231A408306DB0F5B011A43D0 +:104FE000BF231A404306DB0F9B011A433271C009ED +:104FF00070718A784B7810021843308132463846F7 +:10500000C91CFDF73AFE00E00CE0002802D00020A9 +:10501000B070308008340A3628466D1EADB20028C4 +:10502000B6D1F8BD087BCD89801E86B230460830E7 +:1050300068431030188034203880002AF1D0174699 +:1050400095811037E800D681C01900900DE02088C6 +:1050500038800098786032466168009816F0BDFD8F +:105060000098083480190837009028466D1EADB2AC +:105070000028ECD1F8BDFFB581B00A9D1E460C4654 +:10508000002A05D0607AFF300130D080E08910819D +:1050900001980E270078030017F057F80B7E0719C8 +:1050A000293541536C7878787E000092087B082877 +:1050B00005D0032803D091A1954816F018FF37803A +:1050C00030200FE000990020888105B0F0BD0092EB +:1050D000087B042804D08E4888A1143016F007FFFE +:1050E00037803120288000980028EBD1EDE700922E +:1050F000087B042804D0932080A1800016F0F7FEDE +:1051000037803220EEE70092087B022804D08048E6 +:105110007AA13A3016F0EBFE37803320E2E7087BC5 +:105120001746042804D07A4874A14C3016F0DFFEEC +:105130001020308034202880002FC6D00020B88175 +:1051400016E0207B1746052806D0062804D07048B4 +:105150006AA1603016F0CBFE122030803520288006 +:10516000002FB2D0E089B8810020388201984088B1 +:10517000F881AAE70092087B072804D064485FA161 +:10518000713016F0B4FE37803620ABE73346009519 +:10519000019800F00EFC98E72F2053A1000116F0B3 +:1051A000A6FE92E770B50C46054602F002FE002806 +:1051B00004D00078222803D2082070BD554870BD65 +:1051C00000231A460421284606F02BFD2060002803 +:1051D00001D0002070BD032070BDFFB58BB00D461F +:1051E00007461720694608850E98032614460028AE +:1051F00005D10EA93846FFF7D5FF002834D1002D80 +:105200000BD000220321384606F016FB002834D0CC +:105210000E980078002830D108E02078092819D0AD +:105220000F2823D030A13C4816F061FE0E98A760ED +:10523000801D03AA606002320AA9204600F00FFC1C +:10524000002827D0030016F080FF071A1823232117 +:105250001C1E2300072600223146384606F0ECFAD1 +:105260000028E3D12B48801C0FB0F0BD00220321A1 +:10527000384606F0E1FA0028D8D11120F4E70020E2 +:10528000F2E70820F0E72348401CEDE70720EBE7B2 +:105290000320E9E701A800906846038D0422314607 +:1052A000384605F0B3FF0028DED1002DDCD00E9982 +:1052B0000D70D9E730B587B01D460C46002A11D0D5 +:1052C000042369460B7013888B815288CA81A278A7 +:1052D0008A7422880A8200236A462946FFF77DFFE6 +:1052E00007B030BD1020FBE77372635C67617474B4 +:1052F000635F636F72652E63000000007372635C0E +:1053000067617474635F636F72652E6300000000F1 +:1053100025020000023000004F030000F3B581B009 +:1053200001980C4600780826030016F00EFF125F65 +:1053300047471B134B0A0A0A0A0A0A0A0A0A0A0AF8 +:105340000A5F002C02D1F849F84808E06078304341 +:1053500060703CE0002CF9D1F448F349083016F0B5 +:10536000C6FDF3E7019800238088012287B204215B +:10537000384606F056FC0546002C04D07520EA4954 +:10538000C00016F0B4FD002D04D1E848E649143001 +:1053900016F0ADFD3946A81D00F058FBFCF7FDFAEC +:1053A000040006D06078304360706780FCF7D6FA5E +:1053B0000FE01321384604F037F815E0DB48DA49EE +:1053C000283002E0D948D8492D3016F090FD002C45 +:1053D0000AD06078000707D5932020702046582215 +:1053E00008300199FBF7F0FE0020FEBDCF48CE4902 +:1053F0003130EAE710B500210170801D00F023FB79 +:1054000010BD0A4610B50146901D00F027FB10BDE7 +:1054100070B5002305461A46042106F002FC04007C +:1054200004D1F920C049800016F061FD2946A01D75 +:1054300000F00CFB70BDF7B5054684B00C460020AB +:105440006946088188806F88034601220421384616 +:1054500006F0E7FB060004D1FD20B349800016F0FA +:1054600046FD002C03D0A7800020E0802081297A0F +:1054700020461230C91E142700900B0016F065FE5E +:105480000FFEFDFC3809A95E657A2FB2C9E991913A +:10549000FC003078012804D0A3497020143116F0A4 +:1054A00026FDA9896A46C8000E3090803020108100 +:1054B000002C13D0A18100200DE0C1003279091920 +:1054C0000A747288CA8182005319DA894A821A8A58 +:1054D000401C8A8280B2A1898142EED8F1E002A804 +:1054E000009001AB22462946304600F02BFAE8E056 +:1054F0003078042804D08C49BD20143116F0F7FC14 +:10550000A8890622014650436A460E309080332017 +:105510001081002CE2D0A18100200BE00621414344 +:105520004F190919FA89CA81BA7C8A743A8A401CCF +:105530000A8280B2A1898142F0D8C2E03078062880 +:105540000BD079491431D72005E03078062804D0F3 +:105550007549EB20143116F0CAFCE889694612300F +:10556000888035200881002CB8D0A989A181718854 +:10557000E18126E03078072804D06B49FF20143100 +:1055800016F0B5FCA8896A4601460E309080362098 +:105590001081002CA2D0A1812046AA890E30296951 +:1055A00054E0E8896946123080B2382288800A8146 +:1055B000002C7ED0A989A181287A102807D0022149 +:1055C000A173E9892182EA89296900983EE00121D5 +:1055D000F6E702A8009001AB224629463046FFF7C5 +:1055E00087FC6EE03078082805D04F49FF20143141 +:1055F000EE3016F07CFC6846372187800181002C54 +:105600005FD0A989A1810020608220820120A0733F +:1056100057E03078092805D04349FF201431FF3086 +:1056200016F065FC288A6946143088803720088186 +:10563000002C46D00421A173A989A181E989218286 +:10564000298A618220462A8A1430696916F0C5FACF +:1056500037E030780A2804D033493548143116F041 +:1056600046FC6846372187800181002C29D005211E +:10567000A1730020A08102E01EE003E00CE0208284 +:1056800060821EE002A8009001AB22462946304607 +:10569000FFF7F1FC15E00CE00D2069463922888007 +:1056A0000A81002C05D00120E08000202081207399 +:1056B00007E00699088019E01C481B49A43016F041 +:1056C00016FC6846069980880880002C0ED0684633 +:1056D00000892080684680886080287A032805D069 +:1056E000102803D0112801D000203070002007B00E +:1056F000F0BDF7B5568815460F46002382B01A460E +:105700000421304606F08DFA040004D1074806490A +:10571000C43016F0ECFBA41D33462A4639460094EB +:10572000029800F022FBD0E4E8520000950300004C +:1057300013020000F7B58CB00D46144607A90C986B +:10574000FFF730FD002812D1B64E0127002C0FD0F4 +:105750000321684601701021818208A80246069044 +:10576000204605A9FDF7AFFA00280BD007207BE5FE +:105770000821684601708581C68105218774C902A8 +:1057800001820BE00798A178017121884180684669 +:1057900005218774C90201828581C68102460121E3 +:1057A000079B0C98FFF719FD5EE508B501236A46D3 +:1057B00093709D4B13800A4602236946FFF77AFDDA +:1057C00008BD08B501236A469370974B5B1C138094 +:1057D0000A4603236946FFF76DFD08BD00B587B093 +:1057E00000290CD002236A4613700B8893814988E4 +:1057F000D18100230421FFF7F0FC07B000BD102089 +:10580000FBE710B5002903D00523FFF753FD10BDBA +:10581000072010BD70B588B00D461446064607A98E +:10582000FFF7C0FC00280DD1002C0DD006216846E2 +:1058300001708581C481079B02465C800621304649 +:10584000FFF7CBFC08B070BD05216846017085816B +:10585000F1E710B588B000290BD007246B461C7007 +:105860009A81049100236A462146FFF7B6FC08B0EE +:1058700010BD1020FBE770B50024172288B0002966 +:1058800014D00D782B0016F060FC062305051904D2 +:105890001B231522D21E93B2CA88002A02D08E681A +:1058A000002E03D09A4203D90C20CBE71020C9E781 +:1058B000042D05D08A88002A0AD101E00620C1E71C +:1058C000012D11D0022D05D0042D18D0052D23D087 +:1058D0000720B7E709236A4613704B889381CB886A +:1058E000D381896804911DE00C236A4613704B88AC +:1058F0009381CB88D38189680824049112E00D2319 +:105900006A4613704B8893818B88D381CB8813822E +:1059100089680924059105E00E236A4613704978C9 +:1059200011730A2400232146FFF757FC8AE700B5CC +:1059300087B00F236A461370918100231946FFF741 +:105940004CFC5AE7FEB50078089D1C4616460F46EB +:10595000012803D03549912016F0C9FAF889C00012 +:105960000E30208030202880387B001FC0B201908C +:10597000002E1DD0F889B081002516E0E8008419BA +:10598000C0190090224641690E320198FDF775F961 +:10599000002802D000202074E08100986D1C008A4D +:1059A00060820098ADB2408AA082B089A842E5D852 +:1059B000FEBD70B514461425049A1D80372313804C +:1059C000002C0ED0CA89A2810022628200780828A9 +:1059D00008D0092810D00A2819D01449144816F004 +:1059E00086FA70BD087B0C2804D011480F490C388A +:1059F00016F07DFA012008E0087B0D2804D00C4841 +:105A00000A49083816F073FA0420A07370BD087BA9 +:105A10000E2804D006480549001F16F068FA052034 +:105A2000F3E70000FFFF000002280000FC52000026 +:105A3000BB02000010B5FE4B586019721A80C900F5 +:105A400016F02AF910BD00210180704710B5002220 +:105A5000D2430280032006F0F0FD10BD7047F0B580 +:105A60000E460446017801208840F24999B008406A +:105A70000090616815460888EF4A904206D0009A67 +:105A8000002A06D0EB4A521E104202D0012019B063 +:105A9000F0BD009A10430880002D12D0002028701D +:105AA0002178EA1C0027681C01920B0016F04DFBC0 +:105AB00010F30E16233A59616F3CB4B08AB8F2F174 +:105AC000F0F320780B28EBD00420E0E702212970C6 +:105AD000A1890170090A4170032097E0042129700F +:105AE000A1890170090A41700198E1890170090AD0 +:105AF000417005208AE006212970A1890170090AF8 +:105B000041700199E2890A70120A4A70218A017172 +:105B1000090A4171A28AE81DA16916F05EF8A08AFF +:105B2000C01D73E0082129702178082901D11021B6 +:105B30002970A1890170090A41700198E1890170F9 +:105B4000090A41700520308020466A1D02A91030E4 +:105B5000FDF7B9F800287DD169463088097A4018E8 +:105B600054E00A212970A1890170090A41700320BB +:105B70000BE00C212970A1890170090A417001987C +:105B8000E1890170090A4170052030809CE0A089FC +:105B900084464000401C81B2308888425AD305298F +:105BA00058D30E202870002008E0236942009B5A39 +:105BB000521953701B0A401C937080B26045F4D395 +:105BC0003180B9E09A48417A002973D0491E417268 +:105BD000217B4068C9004518A98828680822401818 +:105BE0000838216915F0F9FF02216846017100218A +:105BF000417128680390A98868460181002101A8A5 +:105C0000FFF78CFB0020A880002E00D0308093E0AE +:105C10002978802211432970297840221143297064 +:105C200029788909890112312970A1890170090A2D +:105C30004170E289E81C216915F0CFFFE089C01CA2 +:105C40003080287841063FD5C00975D001216846CB +:105C5000017200E02CE0002141723188091D818130 +:105C60000495E189019808180590001D0690704878 +:105C7000017A68460177002102A8FFF74FFB07462B +:105C800030880C303080022F06D0002F54D065E0D1 +:105C90003DE033E01CE05EE065486946097F42680C +:105CA000CB00D218037A994202D29188002902D0FF +:105CB000042753E02FE0417A491C41721560308877 +:105CC00090800020308049E06168A089888033E0BE +:105CD00029788909890116312970A1890170090A79 +:105CE00041700198E1890170090A4170228A681D9A +:105CF000616915F072FF208A401D46E72878800907 +:105D0000800118302870207B687002207EE7606870 +:105D10000188090401D4052720E0C088A1898842B0 +:105D200001D006271AE01E2028700120308060680C +:105D300001884904490C0180009800280ED03C4895 +:105D400000220088A1688300032006F0D1FB61686F +:105D50002078887007E00020308003276068009971 +:105D600002888A430280384691E6FFB59FB0289D9D +:105D70000E46002805D0172803D82A882E4B9A42B1 +:105D800002D1072023B0F0BD3278530601D4D209E6 +:105D900001D00820F6E700226B461A715A711446AA +:105DA0003278431E1D939BB2189303AB1A93970648 +:105DB000CB1CBF0E1B93821E711C3B0016F0C5F955 +:105DC000209011EE66EE74EEB0EED4EEEDEEECEE59 +:105DD000EBEEEAEEE9EEEEEEE8EEE7EEE6EEE5EE0D +:105DE00090EE05287CD1042168460171A9780172E2 +:105DF000F078B278010211436846418131794171EE +:105E000070788006800E0C282ED009DC801E0300DE +:105E100016F09BF90919661C662166246627660040 +:105E200012282AD00ADC0E2821D01028DAD121E04D +:105E3000A8140020FF710000FFFF000016281FD0EB +:105E40001828CFD11FE02878800701E02878400784 +:105E5000002845DA45E128780007F9E72878C006E8 +:105E6000F6E728788006F3E728784006F0E72878F8 +:105E70000006EDE72888C005EAE72888C004E7E7C0 +:105E800028888004E4E728884004E1E72A7892071C +:105E900026D50328A6D105206A46107148780978CE +:105EA0000002084310811CE129784907F0D5062833 +:105EB00016D3717890B2012902D0022992D101E063 +:105EC000022100E01021189106216A46117100217B +:105ED000118102AF189AB11C0237921C1B921AE072 +:105EE000B3E04A780B7812021A433A80801E891C6C +:105EF0001790BA1C1A911898FCF7BFFE1A991898B7 +:105F0000189A091817986B46801A1A8980B2521C81 +:105F10001A811B9ABF1D8242E3D9002886D1E0E096 +:105F200028780007B4D51D98694682B20720087109 +:105F300000200881701C0A3111E0437807781B02A9 +:105F40003B430B80C37887781B023B434B806F46F3 +:105F50003B89121F5B1C001D92B23B81091D042A64 +:105F6000EBD2002A71D1BCE02978C9066DD5022890 +:105F70006BD3082069460871002048817078087248 +:105F8000844692B2B01C1A9919E089E090E07EE054 +:105F900067E05BE030E025E019E013E0BCE0437827 +:105FA00007781B023B430B80831C4B606346D21A6D +:105FB0006F467B8960445B1C92B27B8108319445BB +:105FC000EDD9CEE7287880063FD5092203E028786E +:105FD00040063AD50A2268460271AA880281189AB8 +:105FE000428107E0287800062FD50B206A46107101 +:105FF00018981081039174E02988C90525D50228D5 +:1060000023D30C20694608710020488170780872FB +:10601000844692B2B01C1A9914E0437807781B02A8 +:106020003B430B80C37887781B023B434B80031DA7 +:106030004B606346D21A6F467B8960445B1C92B208 +:106040007B8108319445E8D98BE763E02988C9044E +:1060500060D501285ED10D2168460171A9880181B2 +:106060003FE02988890455D5052853D30E22694677 +:106070000A71AA880A811B99401F4A78097812027E +:106080000A4369464A818881701D049029E0298865 +:1060900049043FD501283DD10F206946087120E011 +:1060A0002A88120436D44A780B7812021A43EA80FE +:1060B00003282FD332789206920E1B2A26D0112263 +:1060C0006B461A712A880123DB031A432A804A7817 +:1060D000097812020A4369460A81C01E48811B984A +:1060E000039030788006800E1B2809D01D2807D029 +:1060F0000320229906F0A1FA2888C00BC00328804B +:1061000001A82199FFF70AF920463BE610226B46C9 +:106110001A71DCE70724F7E70824F5E700B597B024 +:10612000032806D16A461070019100216846FFF7E6 +:10613000F5F817B000BD000010B58B78002B11D01A +:1061400082789A4207D10B88002B0BD003E08B7921 +:10615000091D002B08D08B789A42F8D103880C884F +:10616000A342F4D1002010BD812010BD052826D007 +:10617000002A02D0012A0DD102E00988090501E0B8 +:1061800009888904890F07D0012918D0022909D06C +:1061900003290ED081207047002A01D003207047C8 +:1061A0000220704703280AD0042808D0002804D011 +:1061B00007E0042803D0022803D005207047002000 +:1061C00070470F20704770B51388054614460B8042 +:1061D00018061DD5FE481022807AA84203D8134322 +:1061E0000B80002070BDA06893430078E840C00792 +:1061F000C00E03430B802078A1788007800D0843F0 +:10620000F44915F053FDA06869430818401C70BD9F +:10621000906870BD37B569468B88138019061BD509 +:10622000EB4C0125A47A9168844209D8FE280FD14D +:10623000D80602D5A5406D1E00E000250D7007E0D0 +:1062400085400C78DB06DB0FAC4383401C430C70AD +:1062500010881021884310803EBDF8B50746C81C41 +:1062600080080E468000B04201D08620F8BD082A82 +:1062700001D90E20F8BDD64D00202E60AF802881B8 +:10628000AA723446E88016E0E988491CE980810654 +:1062900010D48007A178800D0843CE4915F006FD83 +:1062A000206800F0BAFA2989401880B22881381A8B +:1062B0008019A0600C3420884107E5D40020F8BD87 +:1062C000FFB589B09F041646139DBF0C0193099832 +:1062D00000F095FA04000AD02078000609D5BC48E1 +:1062E000817A0A98814204D80E200DB0F0BD0120B9 +:1062F000FBE7224669460A98FFF765FF06900020F3 +:1063000069460872052D14D0012221462846FFF760 +:106310002DFF0028E9D1207840060AD502216846E1 +:106320000172099981810188C18106824782129890 +:1063300005900198000404D500273E4601250797E3 +:1063400009E02078A1788007800D0843A1490790D3 +:1063500015F0ACFC0D46019840040AD50798A842F8 +:1063600007D12088E1788005800F00020843B04201 +:1063700001D3AE4201D90720B7E7B81980B2019026 +:10638000A84201D90D20B0E76846007A002804D061 +:1063900002A8FDF73CF90028A7D10798A8420BD125 +:1063A000208803210902884301998905890F090280 +:1063B000084320800198E0701498002800D00780DE +:1063C0001298002815D006983A468019129915F0AF +:1063D00004FC224669460A98FFF7F5FE69460888DC +:1063E0001021884369460880224600990A98FFF7E1 +:1063F00011FF002079E7FFB5754D0C22E888296868 +:10640000504383B00C180D9F7249059815F04EFC4F +:106410000091049800F001FA29682A898E46611AD1 +:106420000C310918944651188AB2A988914202D8B1 +:10643000842007B0F0BD6A46168A320603D5B2063C +:1064400001D50E20F5E7EA88521C92B2EA800E9B35 +:10645000002B00D01A80B20601D5A76006E0604488 +:1064600080B22881091A70460818A0602246FE20D2 +:106470000499FFF7CFFE0598A0700098E07020887F +:106480000599800889058000890F084303210902C6 +:10649000884300998905890F0902084304210843AC +:1064A000208003988078A07103980088A080002045 +:1064B0002073310601D5AC7A00E00124B10600D585 +:1064C000002700260EE00521002001910290009790 +:1064D000E88831460C9B069AFFF7F2FE0028A8D107 +:1064E000761CF6B2A642EED30020A2E7F1B50098E2 +:1064F00000F085F9060002D00025009C14E0012080 +:10650000F8BD204600F07BF9074600783149800746 +:10651000820DB878104315F0C9FB386800F07DF99A +:106520004019641C85B2A4B22948C188601E81420A +:10653000E7DC00992648491EC1800189491B018179 +:1065400000203070F8BD002804D0401E10809170EB +:10655000002070470120704710B5044601881C4890 +:10656000C288914201D3822010BD00680C225143A1 +:1065700042189079A072908820811088D178800587 +:10658000800F00020843A081A078211DFFF71BFEA9 +:1065900020612088401C2080E080002010BD012167 +:1065A00001827047F7B50546002084B0C0431080D3 +:1065B000686817468178684681706868018868460F +:1065C000018000218171288A2C88A04205D303E034 +:1065D000B41400200102000004462C8235E0288A11 +:1065E000401C2882301D6968FFF7A6FD00282AD1CB +:1065F00039889248814201D1601E38806888A04263 +:1066000028D33088F1788005800F0002084302907B +:106610006946301DFFF790FD002814D1698987482D +:1066200081421BD0002231460598FFF79FFD0028CC +:1066300009D16A890298824205D1E968B06815F0EB +:106640009FFA00280AD0641CA4B2204600F0D7F8B4 +:106650000600C4D1641E2C828220EAE67C80B079D8 +:10666000B871B088B8803078B1788007800D084361 +:1066700078810298B8813946287A32460831FFF786 +:10668000A2FD38610020D4E6FFB585B01C460F4658 +:10669000059800F0B4F8050009D02878000608D560 +:1066A0006748807AB84204D80E2009B0F0BD0120B6 +:1066B000FBE707982A468605B60D69463846FFF778 +:1066C00082FD07460E98052816D000222946FFF7BE +:1066D0004DFD0028E9D1287840060DD501216846F6 +:1066E000017105990181018841818681C48101A8D8 +:1066F000FCF78DFF0028D8D12888AA788107890D5A +:1067000011438005800FEA7800021043079A9642F1 +:1067100007D04C4A914204D3611E814201DD0B2017 +:10672000C3E7864201D90720BFE7801B82B2A2429D +:1067300000D922461098002800D002800F98002827 +:1067400002D0B91915F049FA0020AEE7F8B51D4698 +:1067500017460E4600F053F8040008D020780006D3 +:1067600007D53748807AB04203D80E20F8BD012003 +:10677000F8BD224639463046FFF725FD002D0BD0E7 +:106780002078A1788007800D08432E49884201D2E5 +:10679000012000E0002028700020F8BDF8B51E465A +:1067A00017460D4600F02BF8040008D020780006AC +:1067B00007D52348807AA84203D80E20F8BD0120CF +:1067C000F8BD224639462846FFF724FDFF2E14D097 +:1067D0002588A178A807800D08431A4915F066FAA4 +:1067E000002E03D1FF31FF31033189B2A170A80817 +:1067F00080008905890F084320800020F8BD1049DA +:10680000CA88824207D3002805D00C220968504369 +:106810000C38081870470020704703B508466946D1 +:1068200009888A0607D4090604D50549897A4143AF +:10683000491C88B20CBD00200CBD0000FFFF000009 +:10684000B414002001020000F8B507780D46044694 +:10685000012F19D0072F02D00C2F19D114E0A068F6 +:10686000216906780B2E0BD0052005F0E6FE052EDB +:106870000ED0782300220520216905F039FE07E0BB +:10688000782300220620F8E70520216905F0D5FECF +:10689000002D0ED0002028702946204603F049F92B +:1068A000FE482978C05D884201D10320F8BD02204E +:1068B000F8BD0021204603F03CF90020F8BD70B57A +:1068C0000E460C462036317901208AB01546002943 +:1068D00009D0012905D12978042902D10520107099 +:1068E00000200AB070BD6068019005A802900D21DB +:1068F000C01C15F0CFF9032205A8A16815F06DF9A9 +:1069000001203071062069460870206A04902946EB +:106910006846FFF799FFE4E770B50C46154620314D +:106920000A790120062686B0002A2CD0012A28D117 +:106930002978042925D169681022A06801F0B4F9EA +:106940006868C07B000606D5D44AA0681023103AB8 +:10695000014601F09EF91022A168E06801F0A4F957 +:10696000A068C07B000606D5CC4AE0681023103A28 +:10697000014601F08EF92E70A0686860E068A8609A +:10698000002006B070BD60680190C44820380290B5 +:106990000120087168460670206A049029466846FE +:1069A000FFF752FFEDE7027B032A06D000222423E3 +:1069B0005A540B78092B02D003E0042070470A7662 +:1069C000CA61027B9300521C0273C15003207047BE +:1069D000F0B50E4615460C462036024631790120A8 +:1069E000072393B000290CD0012924D002292ED0EE +:1069F000032904D12978042901D12B70002013B078 +:106A0000F0BD01203071606800280DD0A1690B70C5 +:106A100060684860206988606069C860206A0862B0 +:106A20001046FFF7C0FFEAE706202870206968607B +:106A30006069A86009E029780629E0D10220307158 +:106A4000042028709548203868600320D7E729780B +:106A50000429D4D1A08910280AD9103880B2A08185 +:106A6000A1681023091805A86A6801F012F923E04B +:106A700010282FD0C2B21020801AA1680DAF11903B +:106A8000C01915F0AAF811980006000E06D0401E95 +:106A9000C1B280207854384615F0FCF862691023A2 +:106AA0000DA909A801F0F5F8102309A905A86A683D +:106AB00001F0EFF8032030716068019005A80290A2 +:106AC000062069460870206A049029466846FFF748 +:106AD000BBFE94E710232269A168E2E7F0B50E46F9 +:106AE0000C4620363179012006278FB01546002943 +:106AF0000BD0012932D0022905D12978042902D1ED +:106B00000820107000200FB0F0BD217D08A8CA0732 +:106B1000D20F02718807C10F08A801716846027080 +:106B200041700722801CE16815F057F802A807227F +:106B30000130216915F051F8606805900AA80690A7 +:106B400010236A46A16801F0A4F80120307168465C +:106B50000774206A0890294604A820E029780429AF +:106B6000D1D1062205A8E16915F037F806A806225A +:106B70000230A16915F031F800200890606801909A +:106B800009A80290102305AA696801F082F8022082 +:106B9000307168460770206A049029466846FFF7FE +:106BA00053FEB0E770B50D460C462035297901201B +:106BB0008CB01646002909D0012905D13178042965 +:106BC00002D10920107000200CB070BD60680190E7 +:106BD00006A802900822E16814F0FFFF082208A826 +:106BE000A16814F0FAFF0120287106206946087098 +:106BF000206A049031466846FFF726FEE4E770B548 +:106C00000D460C462035297901208CB01646002906 +:106C100008D00129D8D131780429D5D10A201070A3 +:106C20000020D1E76068019006A802900822A168C0 +:106C300014F0D3FF0020089009900120287106204D +:106C400069460870206A049031466846FFF7FCFDEB +:106C5000BAE730B50B4620331C7901208BB0002CED +:106C600009D0012C05D11178042902D10B20107014 +:106C700000200BB030BD4868019005A802908C68D8 +:106C800068462578057564784475CC6825788575DF +:106C90006478C47500200690079001E094C101005B +:106CA000089001201871062368460370086A049052 +:106CB00011466846FFF7C8FDDBE770B50C46203487 +:106CC000034625790120002D0AD0012D14D0022D74 +:106CD00005D111780A2902D10C201070002070BD56 +:106CE00001202071C868052202704A684260F84A93 +:106CF0008260921CC2600BE015780B2DEFD1022050 +:106D00002071C86804240470526842608A688260F6 +:106D1000096A016201461846FFF745FE70BD30B5AD +:106D2000011D02463132947803258379ED432C43CB +:106D300023408371DB070DD04B79547923404B718D +:106D40000B79127913400B718278C9788A4200D985 +:106D5000817030BD00224A710A71F5E7F7B50C4623 +:106D600086B0002069462646087020363179012712 +:106D70001E2015461F2977D24B007B449B885B0061 +:106D80009F441E0017023E025602690288029A02C0 +:106D9000D102F5022E03590371037F03AE03C3032F +:106DA000CC03F7031A0464049A04AB04DF04FE0462 +:106DB00010052A0565059B05C605830587058B0516 +:106DC0006069002802D0007813287DD0A068059063 +:106DD000002849D0012168460170206A04900321EF +:106DE000684601710A214171E0690290207900280A +:106DF000EFD0059909780029E7D00C2964D20B005F +:106E000015F0A3F90CFD1A4B90B5E8FCFBFAF9F864 +:106E100007FD022828D16069002802D000780828E0 +:106E200052D1022168460170206A04900598417889 +:106E3000684601710021B9E20620216A05F0FDFBD8 +:106E400020790728E6D1606900F050FF02280CD0B5 +:106E5000606900F04BFF042807D060690028B8D0B3 +:106E600000780128D6D103E01BE261690120087097 +:106E700005980079C11F0A2901D30A2050E06169F1 +:106E80000722887060690599303014F0A6FE012051 +:106E9000307161690320087034E00728BAD1606955 +:106EA000002896D001780929B4D10599C9788907B5 +:106EB00007D1059949790029DFD1059989790029F8 +:106EC000DBD105994A7900E04EE2014620314B7D45 +:106ED0009A43D2D1059A8B7D92799A43CDD1059A66 +:106EE0001279D31F0A2BC8D20979914236D80722CA +:106EF000C01C059914F071FE0120307161690A20EF +:106F00000870032069460870206A04906069313077 +:106F100001906069001D029060691C300390A1E23D +:106F20002076F2E311288DD1606900F0DFFE04289D +:106F300004D0606900F0DAFE0B2893D160690599EE +:106F400010223730491C14F048FE6069017804298A +:106F50007CD12421095C8278914201D90620DFE7A7 +:106F6000052101700320307168460170E2E31128A9 +:106F700094D1606900F0BAFE062804D0606900F080 +:106F8000B5FE0C288AD1E068002813D020690028BB +:106F900010D060690178062910D00D210170606958 +:106FA000059910225730491C14F017FE60695730BC +:106FB00009218CE100206946087072E10721017007 +:106FC0006069059910224730491C14F006FE60697B +:106FD0004730EDE70228F0D1606900F087FE002815 +:106FE000EBD0606900F082FE0128E6D0606900F015 +:106FF0007DFE05E0B1E08DE06CE02AE00AE0D6E03D +:107000000828DAD00521684601710598417868465C +:10701000417146E11128D0D160690028CDD00178B6 +:107020000E29CAD1C16A4078022810D0002014224B +:1070300050431430085805991022491C14F0CDFD16 +:107040000520216A00F040FE0F205EE0F1E1012002 +:10705000EDE70B28B1D160690028AED001780F2987 +:10706000ABD1C16A4078022826D0002014225043B8 +:107070000C300958059842780A7080784870606929 +:10708000C16A4078022819D00020142250431030E1 +:10709000085805990822C91C14F09FFD0520216A93 +:1070A00000F012FE60694178022909D000220832FE +:1070B000825C5208520073E00120D7E70120E4E728 +:1070C0000122F4E7012100E0002108314254BCE331 +:1070D0006EC1010011289CD16069002899D0017807 +:1070E000102996D1C16A4078022811D000201422BC +:1070F00050431830085805991022491C14F06DFDB2 +:107100000520216A00F0E0FD112061690870B4E3F8 +:107110000120ECE7082884D1606900289DD001781F +:10712000112997D10599C06A49780170606905995C +:10713000C06A0622401C891C14F04FFD0520216AFC +:1071400000F0C2FD60694178022904D000220832B3 +:10715000825CFD2323E00122F9E71128BBD160699D +:107160000028BBD001781229B5D1C16A4078022825 +:1071700019D00020142250431C30085805991022C1 +:10718000491C14F02AFD0520216A00F09DFD60696C +:107190004178022909D000220832825CFB231A4080 +:1071A000022991D18EE70120E4E70122F4E70720CC +:1071B000B6E6287801288ED16069696814221C30EF +:1071C000FAF702F86069017F002901D02176ACE36B +:1071D0000178032901D0032037E00227C7708179A5 +:1071E0004907490F8171017A4907490F0172417AB4 +:1071F0004907490F41726069FFF791FD377196E2C7 +:1072000028780F28E3D1072069460870216A049185 +:10721000916802916946087161690722C91C029848 +:1072200014F0DBFC61690420087000203071BBE0C1 +:1072300028780328CBD1606901780529696807D0CF +:107240000822473014F0C9FC0420307105206FE299 +:1072500008225730F6E728780328B8D1606901780A +:107260000529696811D008224F3014F0B6FC0520BA +:1072700030716069006A00280AD00220287000205E +:1072800028716069006AA860F9E008225F30ECE7C5 +:1072900004204DE22878022899D12879002801D0CD +:1072A000207642E36069A96801626069002901D122 +:1072B000F949016206200BE228780F2887D1A868D7 +:1072C000E0616069017805292BD0473007213171D1 +:1072D000E16802220A706269126A4A608860606925 +:1072E0003030C8606069C01C08616269087D926ABC +:1072F000400812784000D207D20F10430875626927 +:10730000926A521C8A61FD2210406269D26A127828 +:10731000D207920F104308756069C06A401CC861AB +:1073200053E25730D2E728780828BAD1606901784B +:1073300005291AD00B210170072069460870206AC0 +:107340000490E069029011200871029803210170F5 +:1073500051681022401C14F040FC00216846FFF7E1 +:1073600073FA00203071E06187E20621E3E72878B4 +:107370000F2896D1072069460870206A0490A868F3 +:1073800002901120087102980421017061690A7845 +:10739000072A0ED0002232710C220A706169102275 +:1073A000401C473114F019FC00216846FFF74CFAE5 +:1073B00063E21022401C573114F00FFC0021684694 +:1073C000FFF742FA0A203071E16803200870606913 +:1073D000006A486060695730886060694730F3E14F +:1073E00028780828A1D1606969681022373014F024 +:1073F000C7FB002801D0042092E5606900780728C7 +:1074000017D00A203071E168032008706069006AB3 +:10741000486060695730886060694730C860206A9A +:1074200008620698FFF7BFFA07466069FFF777FC26 +:107430006BE208207AE1287809289AD10B20307174 +:1074400061696868897810224018511A14F022FC8A +:10745000082069460870206A049068680190606995 +:107460008078087268E129780D29BBD16169897932 +:10747000C90703D00C20307109203EE0307103278A +:1074800070E228780E28ADD160691422291D1C30C5 +:10749000F9F79AFE6069018DC06A4172090A81722A +:1074A00060698178C06AC1716169CA6A081D117A10 +:1074B000C909C90111724379626919438378D26A93 +:1074C0009B079B0F012B00D0002300799B01C0007C +:1074D00003431943117260694078012876D0B4E102 +:1074E00060694178022901D0012100E000210831C2 +:1074F000405CC00707D00E20EAE069460870206AA9 +:107500001146049019E11320B8E728780F2894D188 +:10751000A868E0610F2030710520EEE72878032885 +:107520008BD16069C16A4078022801D0012000E057 +:10753000002014225043103008580822696814F0C3 +:107540004CFB10203071E1680620226908706069E8 +:10755000406A48606069C36A4078022801D001200F +:1075600000E000201427784310301858CA60886063 +:107570002BE128780C2886D16069C26A40780228FD +:1075800001D0012000E00020142148430C301058A5 +:1075900002230932696800F07CFB11203071E16838 +:1075A000052008706069006A48606069C06A093037 +:1075B00088603948001F07E128780B28A7D1616946 +:1075C0004878CA6A022802D0012001E059E100206F +:1075D00014235843143010588A78696814F0FDFA5F +:1075E00060694178C26A022901D0012100E00021CE +:1075F0001423594314315258817850181022511ACB +:1076000014F048FB072069460870206A0490E0697E +:107610000290112008710298062101706169CA6AFE +:107620004978022901D0012100E0002114235943A7 +:10763000143151581022401C14F0CFFA0021684632 +:10764000FFF702F90020E06112206FE028780F2890 +:1076500091D1072168460170206A049090680290D9 +:107660000B2268460271029801706169CA6A497802 +:10767000022901D0012100E00021142359430C31DB +:1076800051580A784270497881706169CA6A4978AC +:10769000022903D0012102E074C10100002114235A +:1076A0005943103151580822C01C14F096FA002199 +:1076B0006846FFF7C9F826E760694178022901D0DA +:1076C000012100E000210831405C800703D514202F +:1076D00030710A2011E71620D0E628780F287AD1D9 +:1076E000A868E061072069460870206A0490E06994 +:1076F0000290112008710298082101706169CA6A1C +:107700004978022902D0012101E011E1002114236E +:107710005943183151581022401C14F05EFA0021D0 +:107720006846FFF791F80020E061152030710A20CB +:1077300069460870206A049029466846FFF784F875 +:107740002BE028780F2846D1072069460870206A68 +:107750000490906802900820087102980921017035 +:1077600061690622C969097841706169801CC9692B +:10777000491C14F032FA00216846FFF765F8AAE7C1 +:1077800060694178022901D0012200E0002208321C +:10779000805C400703D51720C8E70746B5E00129FC +:1077A00053D070E028780F2815D1A868E061182020 +:1077B0003071E168052008706069006A486060699E +:1077C000C06A09308860F848C860206A0862069874 +:1077D000FFF7E9F8E1E76FE028780B286CD16069E2 +:1077E000C16A4078022801D0012000E00020142264 +:1077F00050431C3008581022696814F0EEF9072035 +:1078000069460870206A0490E069029011200871AE +:1078100002980A2101706169CA6A4978022901D077 +:10782000012100E00021142359431C31515810223A +:10783000401C14F0D2F900216846FFF705F800203B +:10784000E0616069407801281DD1192016E6606961 +:107850004278022A09D0002108314118097800290C +:107860000DD0CA0703D00E2106E00121F4E78907F5 +:1078700001D5102100E012210170002772E0012AD9 +:1078800001D00D20FAE51C20F8E51D2030710B20F9 +:1078900033E62978102948D1F0E56069017801299B +:1078A00043D0082941D00021317100F019FA0C2091 +:1078B00069460870206A049037E028780F2805D0C0 +:1078C0001020107003271B2030714BE00721684601 +:1078D0000170206A0490A868029002216846017134 +:1078E000029805210170217E417000216846FEF753 +:1078F000ABFF0B2168460170206A04902946684658 +:10790000FEF7A2FF07461B203071012F0DD029E0A2 +:10791000012168460170206A0490042168460171C3 +:10792000217E41710020207612E0207E00280FD0B9 +:107930006169132008701A2030710A2069460870A6 +:10794000206A049029466846FEF77EFF074609E054 +:107950006069002801D01421017068460078002871 +:1079600000D021E5384609B0F0BDF7B50F46203705 +:107970003879012686B00C46002804D0012828D08A +:1079800002281CD197E02079012804D0022811D0C8 +:10799000032814D10AE0A068407801280ED10620FF +:1079A000216A04F024FE00287FD10CE0A168132096 +:1079B000087008E0A0684178022901D0052674E02B +:1079C0000078082871D1012038710A2069460870B2 +:1079D00033E0089800780F2867D1072168460170C6 +:1079E000206A049008988568029522790220012A6D +:1079F00004D0022A29D0032A57D10FE00646684650 +:107A000006710B202870207B00214007400F687012 +:107A10006846FEF719FFA068067045E0064668460E +:107A2000067105202870207B687000216846FEF7EB +:107A30000BFF3E710B2168460170206A0490684676 +:107A40000899FEF701FF06462FE068460171012004 +:107A50002870207C6870607CC007C00FA870A07C74 +:107A60004007400FE870E17C2971C0071FD0207DDE +:107A70004007400F6871607D4007400FA8710021EA +:107A80006846FEF7E1FEA06807222946303014F070 +:107A9000A4F8E068017AA06820300171A168287913 +:107AA0008870A16809200870002630465BE7002036 +:107AB000A8716871E3E7A168142008700121684685 +:107AC0000170206A0490042168460171217B417194 +:107AD0000021FEF7B9FEE7E7F0B585B00F46054691 +:107AE0000124287B800040198038C66F3078411E01 +:107AF0000A290AD22C498000323140188038C36FDD +:107B00003A463146284698470446002C01D0012CBD +:107B100011D1287B401E0006000E287301D00324DB +:107B2000DFE70D2069460870306A04900021019655 +:107B30006846FEF789FE032CD3D0204605B0F0BD81 +:107B400070B515460A46044629461046FFF7C4FF9D +:107B50000646002C0FD0207814280CD1207E002857 +:107B600006D000202870204629460C30FFF7B4FFCD +:107B7000204600F0B5F8304670BD704710B50129B9 +:107B800003D0022901D0052010BD417000F0A8F8F3 +:107B9000002010BD002809D0027E002A06D00A4627 +:107BA00001460C31CCE7000072C101000120704792 +:107BB00030B5044687B00D46062004F03EFD294648 +:107BC000052004F03AFD2078142805D000206946ED +:107BD00008702046FFF7DEFF07B030BD7FB50E46C8 +:107BE00000216A4611730178092903D00A2903D0BC +:107BF000002407E0446900E08468002C02D0217E64 +:107C0000002912D0154601462846FEF7CCFE03286F +:107C100009D1324629462046FFF792FF6946097B83 +:107C2000002900D0042004B070BD25460C35EAE7D9 +:107C300000B50023012285B005280CD0062808D104 +:107C40006846027004910221017143710021FEF720 +:107C5000FBFD05B000BD6846027004910271F4E7B7 +:107C600010B590B00C4605216A461170019022486B +:107C70000290001D03900AA96846FFF7AFFF002895 +:107C800005D1102220460B9913F0A7FF002010B059 +:107C900010BD30B505E05B1EDBB2CC5CD55C6C4042 +:107CA000C454002BF7D130BD10B5002409E00B7887 +:107CB000521E5B00234303700B78401CDC09D2B2D8 +:107CC000491C002AF3D110BD70B50C46054604F0DE +:107CD000B4FC782300222146284604F009FC70BD3C +:107CE0004178012900D0082101707047002801D097 +:107CF00000787047082070476CC1010070B5FD4DD9 +:107D0000040008D0012C10D0022C07D0032C05D081 +:107D1000F9A1702007E0F8A1672004E02878012885 +:107D200003D0F5A16D2014F0E2F82C7070BD70B591 +:107D3000F04D044610280AD0112C16D02846817820 +:107D4000122C07D0132C0AD0EBA19F200BE0EAA144 +:107D5000942008E0112908D0E7A1992003E0112917 +:107D600003D0E5A19C2014F0C2F8AC7070BD10B532 +:107D7000E04894B0007B002819D0172069460870AD +:107D8000DC4900A806220D31023013F026FF09A9B4 +:107D90006846FBF7D6F80446112805D0002C03D01E +:107DA000D5A1BB2014F0A3F8204614B010BD32209A +:107DB000E4E710B501220023114603F032FF10BDA5 +:107DC000FFB595B01D460E460746FFF7F2FF0400CB +:107DD0000AD02078222804D3A07F8006C00FA842B2 +:107DE00004D1082019B0F0BDC748FBE73721684629 +:107DF00001704780002D05D001210171467117994E +:107E0000817102E000206946087109A96846FBF704 +:107E100098F8A07FDF21084069010843A07700207F +:107E2000E0E770B50446084620380D46030014F01C +:107E30008CF90A060A1121282F3E454C535DFF207C +:107E4000ADA108304EE0207820284DD1FF20AAA116 +:107E50000B3047E0A7480178032945D080781328E4 +:107E600042D0207825283FD023283DD0FF20A2A152 +:107E70000E3037E02078232836D8FF209EA114301A +:107E800030E0207822282FD0FF209BA1173029E056 +:107E90002078222828D0242826D0262824D0272835 +:107EA00022D0292820D0FF2093A11A301AE0207870 +:107EB000252819D0FF2090A1213013E02078252813 +:107EC00012D0FF208CA124300CE0207825280BD084 +:107ED000FF2089A1273005E02078282804D0FF2042 +:107EE00085A12A3014F003F8257070BDFF2082A10F +:107EF0002D30F7E730B5854C0B88854A022801D034 +:107F0000934204D09D1FA54225D2022802D04D885D +:107F1000954203D04D88AD1FA5421CD24C88A34288 +:107F200019D88B88FF25F435AB4214D8022802D02B +:107F3000C888904205D0C888744D0A382D1FA842C1 +:107F400009D2C888904208D0944206D05B1C634393 +:107F50008000834201DB072030BD002030BDF0B53A +:107F60006C4A904242D3012189046B4C884201D370 +:107F7000A0423BD30579002D06D0082D02D8067B00 +:107F8000082E05D90720F0BD037B002BFAD0F6E7B9 +:107F9000002D06D00368934228D38B4201D3A3421D +:107FA00024D3002E06D0836893421FD38B4201D383 +:107FB000A3421BD300230BE004689F00E4599442C2 +:107FC00014D38C4202D3544FBC420FD35B1CDBB2A0 +:107FD0009D42F1D80023504D0CE084689F00E45985 +:107FE000944203D38C4203D3AC4201D21020F0BDA3 +:107FF0005B1CDBB29E42F0D80020F0BD10B50289B8 +:10800000464B111F994211D2418904290ED3DB1C22 +:1080100099420BD8914209D80178890704D5406864 +:10802000FFF79DFF002800D1002010BD072010BDE4 +:10803000FFB50022099B002802D0994205DC6FE0C1 +:10804000002902D1002004B0F0BD0920FBE7845CC8 +:10805000002C12D087187D78112D43D010DC2B0016 +:1080600014F073F80A401726262C2C2E2E36364094 +:10807000835C002B30D1521CD2B28A42F8DBE1E79C +:108080001C2D2FDA123D2B0014F05FF8042C2C125B +:108090001A2C022CD9D1BB78039C072B237001D258 +:1080A0005B0701D40A20CEE7029B01241B7816E06F +:1080B000E343DB0708E0012C08D013E00620C2E709 +:1080C0000F2523072D075B19002BF4D03046BAE7A4 +:1080D000029B1B789C0701D50B20B4E702242343A5 +:1080E000029C2370835C521C9A18D2B28A4219DD1A +:1080F000ABE70000C01400207372635C6761705FBF +:10810000636F72652E630000023000007B0C00007C +:10811000FFFF000000D0010000280020FD3F00000C +:10812000192676028A4292DB8CE710B504780B465A +:10813000002C08D00121FE4A012C07D0022C0BD0C4 +:10814000032C13D10EE00021197011E01970817910 +:10815000890903290AD10BE019708179890901295C +:1081600004D105E019708179890901D0104610BD4C +:10817000411C0622581C13F030FD002010BD08B52C +:108180001346002806D0EBA00068009048796A46A4 +:108190008009105C18700622581C13F01EFD08BDE3 +:1081A00030B50C46097895B0222902D2082015B0C6 +:1081B00030BD282369460B704880132A03D03B2A20 +:1081C00001D00720F3E708460A7109A9FAF7B9FEBA +:1081D000050003D121212046FFF723FE2846E6E7CC +:1081E00000B595B0232369460B70488010888880BD +:1081F0005088C880D0884881908808810020888174 +:10820000C88109A96846FAF79CFE15B000BD70B593 +:108210000C00064610D0FFF7CCFD050003D1C6497F +:10822000C64813F064FEA6802889E0802889208152 +:1082300068896081A889A08170BD70B50E4605006F +:1082400003D00021092004F0F8F90120BC4C022ED3 +:10825000207324D0032E04D0B848B7491E3013F041 +:1082600046FEB74806210D3003F07CFFA07C800657 +:10827000800EA074FFF77BFDA08B00280ED0002D90 +:108280000CD0830001220021092004F031F90928D3 +:1082900004D0AA48A849283013F029FE70BDA84888 +:1082A0000321103003F05EFFA07C40218006800E89 +:1082B0000843A074A2480C3002F093FADAE77FB5C5 +:1082C00001A9012003F02BFD002804D06F209A495A +:1082D000C00013F00CFE9B4E01A803F02DFD05001D +:1082E00002D0052D4CD048E0029CA07F01072CD580 +:1082F00020462230009068462346628E80882146C0 +:10830000343301F0EFFB0546A07FF7210840A0774A +:10831000002D05D0B5422FD088488749783029E014 +:10832000E17F480889074000C90F08432021095D03 +:108330004007400FC9000843E077207828281CD167 +:1083400029212046FFF76DFD17E04007C4D5684698 +:108350002246808821460E32FFF742FF0546A07F65 +:10836000FB210840A077002D07D0B54204D0734808 +:108370007149923013F0BBFD0025284604B070BD52 +:108380000020FBE7F8B5040004D16C486A49A1302D +:1083900013F0ADFD72202070606808250178091F78 +:1083A0000B0013F0D2FE11FC0A3D5FFB3D0EFBFB00 +:1083B0003E3D3D3D3DFC86FC3D0060485E49AA30A7 +:1083C00074E087883846FFF7F4FC060004D15B4868 +:1083D0005949B23013F08BFD607804212843607056 +:1083E000574CA07F0843A07721213046FFF719FDA5 +:1083F000B07F8007800F012801D1801EA080384601 +:1084000003F0A3F83846FDF703F83846FBF7CEFB38 +:108410003946022004F011F9B07FEF210840B0770F +:10842000F8BD86883046FFF7C4FC002804D14348D5 +:108430004149D03013F05BFD60688078012804D09A +:108440003E483D49D23013F052FD60688179304694 +:1084500003F07EF90028E3D06178294361706168F8 +:10846000C880F8BD87883846FFF7A3FC060004D112 +:10847000FD203149800013F03AFD607839462843E9 +:1084800060706068C0883081606800897081606851 +:108490004089B081022004F0D0F80020B075FFF7C9 +:1084A0000EFF0028DDD025482349ED3013F01FFDD5 +:1084B000F8BD80783C2815D00027022815D000266A +:1084C000002804D01D481C49F83013F010FD00218D +:1084D000084604F0B2F80021072004F0AEF8002EA0 +:1084E00005D053E001270026F1E70126EFE7607889 +:1084F000284360701248817F29438177002F45D13E +:1085000060688688304601F0BFF90546807F616863 +:10851000800889798000012900D002210843A877CA +:108520006068C08A28816068008B688160680BE0A1 +:10853000023200000302FF01F88000001103000076 +:10854000C014002002300000408BA8816068062221 +:10855000C079E875616828461830083113F03DFB92 +:1085600060680622807B68706168A81C0F3113F078 +:1085700034FBA87F8107890F304602F0CFFFA87F28 +:108580008007800F012801D1FD488680FC480178D2 +:10859000032909D0807813280AD001E00CE00FE00D +:1085A000FF20F8A1433081E70120FFF7A7FBF8BDCA +:1085B0001120FFF7BCFBF8BD204601F09FFDF8BD80 +:1085C000607828436070F8BDF7B50546007800274D +:1085D00000090C463E4601287ED00022ED490228C3 +:1085E0007BD0072804D00A2878D0E6A1EA482DE1FC +:1085F000686803780D2B31D006DC042B6FD0072B75 +:1086000036D00A2B6AD106E0122B38D0132B40D07B +:10861000142BF7D1B2E011270726002C72D08088E6 +:10862000A0806968FB238979A171D54905468A7FB5 +:108630001A408A77032103F02AFB0421284603F01D +:1086400026FB0021284603F022FB0221284603F0E6 +:108650001EFB0121284603F01AFBF9E00127092639 +:10866000002CDBD08088A080686880792072EFE0E1 +:1086700012270E2680882146FFF7C9FDE8E01A2759 +:108680000726002CCAD04088A08068680079A071B5 +:10869000DEE081783C2936D010271E26002CBDD084 +:1086A0008088A0806868C08A20836868C08AE08269 +:1086B0006868008B60836868408BA0836968207D50 +:1086C000497F4008C9074000C90F08432075696801 +:1086D000C007C00F497F03E05FE08AE0ADE01CE027 +:1086E00049084900084320756968A21DC879083106 +:1086F000FFF745FD69682246887B0D320F31FFF791 +:108700003EFD05E074E019270726002C70D0A27109 +:108710009B48F722817F11407DE01B272E26002CED +:1087200066D0A1806968A21D0879491DFFF727FD61 +:1087300068682030C07A60736868C0780428A07BBD +:1087400019D040084000A073F921084069681F2231 +:10875000C9788907490F0843A07369684007C97A37 +:10876000400FC9000843A073696820460F300C31E0 +:1087700013F033FA6CE001210843E4E71E270E26CC +:10878000002C6DD0A1806868E21D407AA0716968F4 +:108790008878C91CFFF7F3FC5AE0287A012805D035 +:1087A000022815D07C4877A132384FE01D270E26CD +:1087B000002C55D06888A080A889E080E8892081B5 +:1087C000288A6081688AA0816D48DF22817FA2E7C4 +:1087D00012270E266888FFF71AFD002C40D0687813 +:1087E0004007400F032833D16548FD22817F92E77F +:1087F00036E0287A030013F0A8FC060410102020AD +:10880000202619270726002C2AD0A1805C48A271B7 +:10881000817F4908490081771AE019270726002C33 +:108820001ED0A180287A012805D00320A0715448C9 +:10883000EF22817F6FE70220F8E721462846029A5F +:1088400001F0B9FDFEBD54484EA1801F13F04FFB4F +:108850000298002C068001D0278066800020FEBD93 +:1088600002980680FAE710B5454894B0817E8907E2 +:10887000890F022902D0494814B010BD807813280E +:1088800001D00820F8E722206946087009A9684647 +:10889000FAF757FB04460021072003F0CEFE2046DE +:1088A000EAE700B5364895B0817E8907890F02292D +:1088B00001D03A48A9E48078122801D00820A4E425 +:1088C0001E206946087000208870C87009A9684693 +:1088D000FAF737FB0028EDD10021072003F0ADFEA9 +:1088E0001120FFF724FA00208FE400B5244895B04A +:1088F000817E8907890F012901D0284885E4007805 +:10890000022801D0032818D11B2108A801730021D7 +:10891000817369460BA8FAF714FB0028EED168466C +:1089200040781B2801D003206FE40021084603F0A3 +:1089300084FE68468078002801D0082065E4012084 +:10894000FFF7DCF9002060E4F8B50D4C030013F0EC +:10895000FCFB0A068127818181814B446F81FFF7EF +:10896000C4FF002839D1F9F718F8002835D02221A2 +:10897000017000210172F8F7F1FFA07F012153E09F +:10898000C01400207372635C6761705F636F72650F +:108990002E630000FFFF00003405000005300000DA +:1089A0008EB23046FFF705FA050003D1F549F648C7 +:1089B00013F09DFA287821280FD0F8F7EEFF002851 +:1089C0000CD0122101700227077246800020A87582 +:1089D000F8F7C4FFA07F3843A077F8BD13222946DB +:1089E0003046FFF7DDFBF8BDA578122D07D0132D1B +:1089F00008D0E548E349283013F079FAF8BDFFF7CD +:108A000050FF01E0FFF72FFF0028F7D1F8F7C5FF6F +:108A10000028F3D022210170122D07D0022101720B +:108A2000F8F79CFFA07F10210843D5E70121F6E766 +:108A3000A07C810901290BD0800904D0D248D149FA +:108A40004A3013F054FA03210020FFF7F6FBF8BD7B +:108A50000221F9E7CC48CB495130CDE7F7B51446B0 +:108A60000D0004D1C848C749593013F040FA28789E +:108A70000827012807D002281FD0C348C1498A30DF +:108A800013F035FAFEBD0098FFF793F9060004D104 +:108A9000BD48BC49603013F02AFA0220B07510308E +:108AA000207060783843607007CD083407C4B74839 +:108AB0002022817F11438177FEBD0098FFF779F96D +:108AC000060004D15D20AF49000113F010FAA98817 +:108AD000AF48814208D1EA88824205D1132231464B +:108AE0000098FFF75DFBFEBD814202D1E8880028B7 +:108AF00009D01220207060783843607007CD0834A8 +:108B000007C4002006E0782300220220009903F029 +:108B1000EFFC0120B075FEBD9C4840897047FFB551 +:108B20009A4C91B0A07E8007800F012804D1149840 +:108B3000FAF7FAF8002860D101256846032185710B +:108B4000C9028180002201A92846FBF7FCFA00280F +:108B500053D16846152185714902818000261C2168 +:108B600002A8009613F098F80120014668461031DB +:108B7000017000200146684641708178F92001406B +:108B8000891C294368468170017A022739430172A2 +:108B900012998186C6861F2101870C9011980F902B +:108BA00001A80B9009AA0BA902A8FBF79DF80028C1 +:108BB00023D16846808CE080684685717549818044 +:108BC0008078F9210840801C41084900684681707E +:108BD0008786078713A80F9009AA0BA902A8FBF79D +:108BE00083F8002809D16846808C2081A07E800708 +:108BF000800F012803D06681002015B0F0BD6349C5 +:108C000014980A31FAF7A2F80028F5D0F5E730B544 +:108C10000C46614995B08C423FD3012189045F4ADB +:108C20008C4201D3944238D320380021012503001F +:108C300013F08BFA06042E484C525B630021082087 +:108C400003F0D5FC002802D0112015B030BD24203F +:108C50006946087000A80522A11C023012F0BDFF71 +:108C600009A96846FAF76DF9050002D0082D0DD064 +:108C700030E0082300221146184603F039FC08288A +:108C800028D04049464813F032F923E00620DCE7BB +:108C90006068002803D0904201D21020D5E73D2122 +:108CA00068460170218841806188818009A9FAF7AE +:108CB00048F905000ED1606800280BD06946098D7F +:108CC000018007E0206801F0CEFD02E0204600F0C0 +:108CD00028FE05462846B8E73E2007E0857000E0FC +:108CE000817009A9FAF72DF9F3E734206A4610706C +:108CF0002078C0076846F3D0F0E70720A5E730B535 +:108D00000C46264995B08C4201D210209DE72038B0 +:108D1000030013F01AFA05042121232132002088D0 +:108D2000FFF747F8002804D00078222803D2082053 +:108D30008BE71C4889E7252168460170218841801E +:108D400009A9FAF7FEF8050015D10AA90522023192 +:108D5000A01C12F042FF0EE006250CE0206800285F +:108D600005D0884201D2102505E001F071FD0748C9 +:108D70000025808BA080284667E7072065E7034829 +:108D8000133070478489000062050000C014002081 +:108D9000FFFF0000012A000000D001000028002091 +:108DA0006B0600000230000010B504462021F84890 +:108DB00012F070FF0120FEF7A1FF1120FEF7B7FFB0 +:108DC0000021F348C943818021788907890F817682 +:108DD0000021C176E1218900818301460C300D31EB +:108DE0000446F8F75AFEEA4807222146133012F0EB +:108DF000F4FEFEF7BCFF002803D0E649E64813F076 +:108E000076F801F00EF910BD10B504463C2112F0C1 +:108E100041FFA07F80088000A077202020700020E4 +:108E2000A0752034607010BD7047FEB50546DB4864 +:108E30000C46814206D301208004844204D3D848E2 +:108E4000844201D21020FEBD002D02D0012D33D16D +:108E500027E0CF4908220C310F46684612F0BDFECC +:108E600039462046FFF761F90028ECD1FEF77FFF75 +:108E7000060006D007226946384612F0AEFE30469C +:108E8000FEBD2078002801D0012805D1C048072266 +:108E90003946133012F0A1FE0021092003F0CDFB6A +:108EA0000FE00978002907D0012905D0022905D053 +:108EB000032903D0BB48FEBD0720FEBD0120FFF7FC +:108EC000BCF9B348C5760020FEBDB54910B588424F +:108ED00001D2102010BDAE4902460B7B0D31184661 +:108EE000FFF74DF9002010BDFFB599B005460020F1 +:108EF00069460871087208A90874A54F0875B87EFC +:108F000014468007800F012802D0A7481DB0F0BD8D +:108F10000120A2498004A24A002D05D08D420BD326 +:108F2000854201D3954207D3002C07D08C4203D34E +:108F3000844203D3944201D21020E7E7284620431D +:108F400018D01F260CAB01AA009628461A99FFF7E5 +:108F50006FF80028DAD10DAB02AA009620461C99C2 +:108F6000FFF766F80028D1D16846007AC10703D020 +:108F70000A20CBE70720C9E7800705D568460079B6 +:108F8000800701D50B20C1E703AE002D0FD01A20BA +:108F9000694608731A9888732946F01C1A9A12F0C9 +:108FA0001CFE0EA903A8F9F7CCFF0028AED1002CB7 +:108FB0000FD02020694608731C9888732146F01C46 +:108FC0001C9A12F00AFE0EA903A8F9F7BAFF0028AE +:108FD0009CD108A8007C7870002097E770B5044603 +:108FE0000A2020700D462046F9F7ABFF002805D176 +:108FF0003920207029462046F9F7A3FF70BDF7B548 +:1090000000260C4605460B271AE02968B0000958CF +:109010000978002903D0012901D00720FEBDA170E5 +:10902000296806220958E01C491C12F0D6FD277059 +:1090300020460299F9F785FF0028EFD1761CF6B299 +:109040002879B042E1D800263A270FE0A868B1009D +:1090500041581022A01C12F0C0FD27702046029932 +:10906000F9F76FFF0028D9D1761CF6B2287BB04201 +:10907000ECD80020FEBDF0B504464CA103C997B062 +:10908000434F15911490B87E00258007800F01286A +:1090900002D0454817B0F0BD404A944210D3012396 +:1090A0009B043F4E9C4201D3B44209D3207801284F +:1090B00008D16168914203D3994203D3B14201D2EE +:1090C0001020E7E7397801290CD1B988394A914253 +:1090D00003D0002806D0012804D0B97F0A07920FD8 +:1090E00006D101E00820D5E7CA0701D1890701D5DB +:1090F0001120CFE7218A304B0A46203A9A4207D303 +:10910000012873D1002971D1628A002A6ED110E042 +:10911000022801D0032801D1A02967D3012808D053 +:109120001B4A5278D20704D0628A002A5ED0B42A41 +:109130005CD8002806D0012808D0022804D00328D3 +:1091400054D117E0002618E0022616E0002902D1CB +:10915000608A00280CD004266068007800280CD0B3 +:10916000012809D0022807D0032805D00D4891E72F +:109170000126F1E7032600E00125207A00281DD012 +:1091800001281DD002281DD003287FD11CE000003B +:10919000C0140020848900000507000000D00100F1 +:1091A00000280020023200000530000007060504F8 +:1091B00003020100FFFF0000E13F0000002704E080 +:1091C000012702E0022700E00327002E01D0022E33 +:1091D00013D1002F11D0E068FEF7C1FE002888D11E +:1091E000F6484078800702D0F54853E74EE0022E5B +:1091F00003D1022F4AD0032F48D0182168460170AE +:10920000218A4180218A81808671EC48007B002878 +:1092100002D001286DD103E000206946C87102E048 +:1092200001216846C171684605722178093001291B +:1092300026D0062112F02EFD69460F74207D82078C +:10924000C107D20F4007C90F5200C00F1143800061 +:10925000014314A8405C6946C873002816D009A9C8 +:109260006846F9F76EFE0028BFD109A96846FFF7E6 +:10927000B5FE0028B9D1002E0AD0022E08D010E089 +:1092800061680622491C12F0A8FCD5E7072001E717 +:10929000002F06D009AA6946E068FFF7B0FE002853 +:1092A000A3D11B20694608700120887009A968466F +:1092B000F9F747FE002898D108A840791B2818D153 +:1092C000330012F042FF05040406060409000320DF +:1092D00000E00220FEF712FD012E0CD0608A00286B +:1092E00009D0002283001146104603F001F900283E +:1092F00001D00320CEE60020CCE6F3B5032687B0EC +:109300000D46002909D0AF4885426FD30120800463 +:10931000854202D3AC48854268D30798FEF749FDE1 +:10932000040005D02078222804D2082009B0F0BD1E +:10933000A648FBE7A07F8707BF0F002D05D0294671 +:109340003846FEF7D7FD0600F0D1394600279B4886 +:10935000012908D0022932D04F209D49400112F046 +:10936000C6FD3046E2E7A27D2946012A02D0827F6F +:10937000920701D51120D9E700291BD108216A469F +:10938000049711820592418904AA9248FBF7B8FA22 +:109390000028CBD16846008A082801D00320C5E701 +:1093A0006846018801814188418181888181C18825 +:1093B000C18102A9079802F05CF90646D1E7A17DB8 +:1093C000022916D1807F800613D4002D04D0A07FFF +:1093D00040070CD4002100E00121079802F08AF92F +:1093E0000600BED1A775002DBBD004E01AE01126FF +:1093F000B7E7002D16D02A4621460798FEF7F0FE63 +:1094000006461128ADD1A07F4007AAD420460822E5 +:1094100029460E3012F0E1FBA07F04210843A0771B +:1094200000269EE7102081E770B50C460546FEF742 +:10943000C0FC010004D022462846FEF7B1FE70BDF4 +:10944000624870BD00B50146143195B0192901D2AA +:10945000810707D001461E3104D00A3102D007200F +:1094600015B000BD312269460A70887009A96846A6 +:10947000F9F767FDF4E701B582B00220694608807C +:109480004E4802AB00896A460021FBF7ACF86946FA +:109490000988022900D003200EBD1CB500210091CF +:1094A00002216A46118048490190884201D2102069 +:1094B0001CBD424801894748FBF722FA69460988E2 +:1094C0000229F5D003201CBDFEB517463D4A0E46C5 +:1094D0000546914206D3012080043B49864203D3CE +:1094E0008E4201D21020FEBD1F2F01D90C20FEBDDF +:1094F000324C954226D3854201D38D4222D3E08857 +:1095000001A9FBF721F80028F1D1287869464871B4 +:10951000E08801A9FAF7F9FF0028E8D16946009030 +:10952000087802210843694608704979090703D081 +:109530000821084369460870E0886946FAF780FF09 +:109540000028D4D169460F81E088334602AA002161 +:10955000FBF749F869460989B942C8D00320FEBD26 +:109560001CB50C46002100910191228869460A80B1 +:1095700015490190002801D0884201D38C4201D2C4 +:1095800010201CBD002801D0002A09D00B486A46D3 +:10959000C1881048FBF7B4F96946098821801CBDD1 +:1095A0000C201CBD10B50123FEF70AFC10BD0023E2 +:1095B00010B51A461946FEF703FC10BDC014002072 +:1095C0000132000000D0010000280020023000001D +:1095D00084890000FFFF000070B5E74D0446A87EB7 +:1095E00094B08007800F022802D0E44814B070BD08 +:1095F000E348844206D301208004844204D3E14836 +:10960000844201D21020F1E72046FEF7F7FC002843 +:10961000ECD1A878112801D00820E7E7A87FC00680 +:1096200001D51120E2E71D2168460170207801264E +:10963000C107C90F68468170218981806189C18015 +:1096400020788007C10F68464172287B00250028DA +:1096500003D0012804D00320C8E76846057201E062 +:109660006846067209A9F9F76CFC0028BED109A961 +:109670006846FFF7B3FC0028B8D12078800706D5EC +:1096800009AA69466068FFF7BAFC0028AED11E211E +:10969000684601708670C57009A9F9F752FC002868 +:1096A000A4D1A08900F02EF904009FD11220FEF76A +:1096B0003EFB20469AE7F0B5AF4F0546B87E95B021 +:1096C0008007800F16460C46022802D0AB4815B022 +:1096D000F0BD0121AA488904AA4A002D05D085427F +:1096E0000FD38D4201D395420BD3844209D38C42D0 +:1096F00001D3944205D3864203D38E4203D39642CC +:1097000001D21020E3E7B87FC106890F01D14007DD +:1097100001D51120DBE72046FEF770FC0028D6D1EA +:1097200020788107C90F294303D0800703D5002D76 +:1097300001D00720CBE731460220FEF7DBFB0028F3 +:10974000C5D18D488078112803D0122801D0082077 +:10975000BDE70121084602F059FA0027002804D08D +:1097600085488078122802D005E00420AFE7FFF793 +:1097700098F80028ABD109A96846FFF72FFC00280C +:10978000A5D12078800706D509AA69466068FFF749 +:1097900036FC00289BD12121684601702189418037 +:1097A0006189818020788007C10F684681712078A7 +:1097B000800715D42878002807D0012808D002286F +:1097C00006D0032804D0704881E76846C77102E0DC +:1097D00001206946C8710622691C02A812F0FDF931 +:1097E0006548007B002803D0012804D003206EE7E1 +:1097F0006846877302E001206946887331886846AD +:10980000018271884182B1888182F188C182078397 +:10981000478309A9F9F795FB00288BD1A08900F0AF +:1098200071F8040086D11320FEF781FA20464EE736 +:1098300030B50546534895B00C46814202D21020FF +:1098400015B030BD2846FEF7B4FA002807D00178DD +:10985000222902D3807F800604D40820F0E74748FD +:10986000C01EEDE7132168460170458009A9F9F78C +:1098700068FB0028E4D108AA0A2151567F2901D0AB +:109880002170DDE70520DBE7F8B5012304461A4621 +:10989000194602F0C6F9074601231A46022120465E +:1098A00002F0BFF9064601231A460421204602F0C1 +:1098B000B8F9054601231A460321204602F0B1F902 +:1098C0000446002F03D13149314812F010FB002E1D +:1098D00004D12F482D49401C12F009FB002D04D162 +:1098E0002B482A49801C12F002FB002C04D1AD2029 +:1098F0002649800012F0FBFA22213846FEF791FA41 +:109900003846F8BD10B5002809D083000022114662 +:10991000072002F0EDFD072801D0032010BD002034 +:1099200010BD10B50446006800280BD014498842C9 +:1099300006D301218904884204D31249884201D206 +:10994000102010BD00F077FFA0880B4CA083E07EB4 +:1099500001280DD10021092002F049FE002800D085 +:109960000120A17C8909012904D00321FEF765FCAF +:10997000002010BD0221F9E7C014002005300000CE +:1099800000D001000028002002320000848900007D +:10999000B102000030B5F74B9A4206D301239B0475 +:1099A0009A4204D3F44B9A4201D2102030BD14786D +:1099B000E3065B0F042B07D85378072B04D3957865 +:1099C000102D01D89D4201D2072030BDD3785B070E +:1099D00002D413795B0701D5062030BDC37FA407ED +:1099E0005B085B00E40F2343C3770878EF2318403C +:1099F00013789B06DB0F1B0118430870F1231840F6 +:109A00001378DB065B0F5B0018430870507808730F +:109A1000002030BD30B500240C70C378DB07DB0FAD +:109A20000B70C578AD07ED0F6D002B430B70C5783B +:109A30006D07ED0FAD002B430B7014700179C90752 +:109A4000C90F117003799B07DB0F5B00194311707D +:109A500000794007C00F80000143117030BD70B520 +:109A600014460D460646F7F798FF002809D0A221B4 +:109A70000170142221460830F7F7A6FBF7F76EFFB6 +:109A800070BD132229463046FEF78AFB70BD70B5C3 +:109A900014460E460546F7F780FF002809D022211C +:109AA000017045802178017261784172F7F756FFA5 +:109AB00070BD132231462846FEF772FB70BD10B50B +:109AC000AE4C207C00280CD1204621461038FEF7F1 +:109AD000C7F8002803D0AAA1F22012F008FA01204A +:109AE000207410BD70B594B015460C462C22694602 +:109AF000189E0A704880002B17D00822194601A82A +:109B000012F06BF868468581102231460E3012F053 +:109B100064F809A96846F9F714FA002803D1A17F6F +:109B200010221143A17714B070BD00200190029063 +:109B3000E8E7F0B50646008A97B080B20D4601907E +:109B4000FEF737F904468D48317848380746E8373C +:109B500009900B0012F0F9FA0EFEFD48085F879895 +:109B6000B8D9FCFBFAF9F8FE002301221946019846 +:109B700002F057F8050004D1FF2081A1303012F027 +:109B8000B6F9002C04D1FF207DA1313012F0AFF9DD +:109B9000387EC00904D079486030C06DA86112E0F9 +:109BA0002B20694608720BA902A8F9F7CAF9002808 +:109BB00004D0FF2072A13C3012F099F974490C983E +:109BC00012F074F8A9617068A862B068E862A07FBA +:109BD0008007800F012820780DD0252804D0FF2091 +:109BE00067A14D3012F083F9324621460198FFF704 +:109BF00036FF17B0F0BD2528F6D0222806D024283D +:109C000004D0FF205EA1463012F071F925212046D4 +:109C1000FEF707F9E8E7002301221946019802F050 +:109C200000F8060004D1FF2055A1583012F05FF96A +:109C3000002C04D1FF2052A1593012F058F920789D +:109C4000252804D03078012108433070D1E7022064 +:109C50002870B068A860B068002802D00020287181 +:109C6000C7E70120FBE72B20694608704349684697 +:109C70004C39F9F766F9002804D0FF2040A178306C +:109C800012F035F903201BE02A206946087000A86D +:109C900010220230716811F0A0FF04A810220230D7 +:109CA000B16811F09AFF354968464C39F9F749F91E +:109CB000002804D0FF2032A1893012F018F90420C6 +:109CC00028700998686094E7B068002804D1FF20E4 +:109CD0002BA1953012F00BF9E07F400704D5FF204F +:109CE00027A1963012F003F9B06806220A380090D6 +:109CF00033790421019801F089FA0028A6D0FF20C9 +:109D00001FA19B3012F0F3F873E7002C04D1FF2061 +:109D10001BA1A33012F0EBF820462230102205469A +:109D2000716811F05AFF28212046FEF77AF8A07FCB +:109D30008007800F022814D100231A46214600957F +:109D40000198FFF7CFFE06E04DE1BCE0B2E097E0FE +:109D50003EE070E061E111281CD029212046FEF789 +:109D600060F8E07F317A4007400FC9000843E07790 +:109D70003FE7000000D00100002800208C150020E3 +:109D80007372635C6761705F7365632E63000000CC +:109D900040420F00A07F000704D5FF20FD49B030EE +:109DA00012F0A5F8A07F08210843A0770020608664 +:109DB0002046343011F06EFFE07FFD220146C907D6 +:109DC0001040890F0843E077307A2034207010E784 +:109DD000002301221946019801F023FF040004D159 +:109DE000FF20EC49CD3012F082F82B206946087232 +:109DF000E94902A8F9F7A5F8002804D0FF20E549B1 +:109E0000D23012F074F8E44881882046213001767F +:109E1000090A41760E2129702146FC316960017ED4 +:109E20002974407E6874DC482C30A86010303034CF +:109E30006C61E860DDE6002C04D1FF20D549E630F6 +:109E400012F055F82078212892D93079012802D0D3 +:109E5000022808D103E0E07F04210843E077387E40 +:109E6000012108433876324621460198FFF7F7FD75 +:109E700020782328ABD923212046FDF7D2FFB8E66E +:109E800001220421019801F0D7FC00289FD0002373 +:109E900001221946019801F0C4FE040003D1BD4916 +:109EA000BE4812F024F80F202870172028716E3455 +:109EB000AC609EE60421019801F01CFD002886D1CB +:109EC0001020287095E6002301221946019801F020 +:109ED000A8FE050004D11120AE49400112F007F898 +:109EE0002E462036307E41064DD5A17F8F07BF0F0D +:109EF000C00713D02A468032516F00290ED0087C4B +:109F0000F37DC007C00F5B0018430874516FE27FF8 +:109F100040084000D207D20F10430874307E00077B +:109F200013D52A468032116F00290ED0087CF37DAC +:109F3000C007C00F5B0018430874116FE27F400830 +:109F40004000D207D20F10430874307E80070BD533 +:109F5000F8204259002A07D0012F05D02946307C2D +:109F600031311032FEF70BF9307EC0060BD5F820E8 +:109F70004259002A07D0012F05D12946307C3131C2 +:109F80001032FEF7FCF8052368460370357E4570F5 +:109F9000814822216038019A01704178C908C900BE +:109FA000C91C4170428003724572F7F762FE207847 +:109FB000252809D021280BD0784876495B3011F04C +:109FC00096FF2078222803D922212046FDF729FF79 +:109FD0000021019801F05BFE002800D109E66F48DE +:109FE0006C4963308EE674686B4D207860350928C3 +:109FF00002D00A28F2D10BE0E168002902D02846FD +:10A00000F8F771FF2169002902D02846F8F76BFFA5 +:10A0100021462846F8F767FFEBE560485D49883040 +:10A0200070E65D4810B5042228216030F8F742FF41 +:10A0300059480024EC30017E4906490E017640382B +:10A04000C465FDF79AFD54493C3108461038F7F7CE +:10A050005BFD51484C30047410BD70B50D46FDF7E2 +:10A06000A8FE040004D14D484A49A73011F03FFF33 +:10A07000FF210531284611F00FFEA07F8007800FD9 +:10A0800001280CD0022128468830FDF777FD0028F2 +:10A0900004D042483F49AC3011F029FF70BD012186 +:10A0A000F1E70A46014610B510468830FDF780FDFD +:10A0B00010BD70B5054611200C4608700021617076 +:10A0C0002121495D002908D003290ED0042910D090 +:10A0D00032483049C63011F00AFF207800090128C3 +:10A0E00002D9E87FC008607070BD0007000F203003 +:10A0F00002E00007000F30302070EEE7F0B50446B4 +:10A100004068082601789BB008290DD00B2903D0A0 +:10A110000C294BD101218171606887883846FDF791 +:10A1200048FE05004CD147E047883846FDF741FE20 +:10A13000050004D1B9201749800011F0D8FE287815 +:10A14000212833D0282833D1606802210C3000F058 +:10A15000BDFF00282CD060680821001D00F0B6FF6C +:10A16000002825D02D2168460170478029461022FD +:10A17000223101A811F031FD0FA96846F8F7E1FE80 +:10A18000002804D005480349EF3011F0B0FEA87F45 +:10A19000102105E0809D000040150020070200000E +:10A1A0000843A87729212846FDF73BFE1BB0F0BDE8 +:10A1B000607830436070F9E7FD49FE4811F097FE82 +:10A1C000A87FEF210840A877297821290FD061685E +:10A1D0008A79002A02D08978002912D08007800F5E +:10A1E000022842D0F348F249303011F080FEFEF7E9 +:10A1F00066F80028DAD0EF48ED493B3011F077FEE1 +:10A20000D4E7607830436070E87FC00701D0042154 +:10A2100000E00321212041552878292804D039461F +:10A22000062002F00AFAE2E7002301221946384626 +:10A2300001F0F7FC040004D16520DD49C00011F0F5 +:10A2400056FE25212846FDF7ECFD0D2008A90871D2 +:10A25000204609A98830FDF79DFC0228C7D00028B8 +:10A26000C5D0D448D2491D30BFE760783043607014 +:10A27000BDE7F7B58AB015460646FDF79AFD0028FA +:10A2800041D0017822293ED323293CD0C17F490700 +:10A2900039D4807F8007800F01280DD00023012250 +:10A2A0000021304601F0BDFC0746C3480290F8F794 +:10A2B00011FE040007D101E00123F0E7BD48BC49CD +:10A2C000553011F014FE002F1FD0883767610298B7 +:10A2D000F8F700FE07460298F8F7FCFD0921217007 +:10A2E000266225710B99E760A160206103A92046D1 +:10A2F000FDF774FC022806D0002804D0AD48AC4914 +:10A30000713011F0F4FD0DB0F0BD00200746606122 +:10A31000E4E730B5002387B005460122194601F075 +:10A3200080FC04462846FDF744FD007822281BD90E +:10A33000002C04D19F489E497D3011F0D8FD0F219B +:10A34000684601701721017120466E3002906946FF +:10A350001A30FDF71FFC022806D0002804D0E520A3 +:10A360009349800011F0C3FD07B030BD30B5002324 +:10A3700087B005460122194601F053FC04462846E1 +:10A38000FDF717FD00782228EED9002C04D189486A +:10A3900087498F3011F0ABFD1020694608702046C8 +:10A3A0008830FDF7F7FB0028DED0E92080498000E7 +:10A3B00011F09DFDD8E7F7B50546007800270009A4 +:10A3C00082B00C463E4602287ED0072802D00A28DA +:10A3D0004AD14AE068680178082907D00B2930D0B3 +:10A3E0000C292ED073487249CF306DE114271A26FC +:10A3F000002C6AD04088A080FDF7DBFC009000288C +:10A4000004D16C486A49AB3011F071FD0098009995 +:10A41000C07DA21D1831FDF7B2FE68680822808950 +:10A42000E081696820461030091D11F0D6FB207EBE +:10A4300001210843F9210840207600984021807FBF +:10A4400048E018270826002CD3D08088A080FDF78C +:10A45000B0FC050004D1F7205549800011F047FDFC +:10A46000A11D2846FFF725FE30E1002C01D0288BE6 +:10A47000A080287A01287DD0022805D0032830D07A +:10A480008D204B49C0001FE11C270726002CB0D0AF +:10A49000A088FDF78EFC0090002804D1FD204449DF +:10A4A000800011F024FD287B8007800F0128A0790F +:10A4B00014D040084000A071FD210840297B4907C5 +:10A4C000C90F4900084301E0F0E0ECE0A0710098FA +:10A4D0008021807F084300998877F7E001210843B5 +:10A4E000E9E713270B26002CAED0A088FDF761FC0E +:10A4F00000900023A0880122194601F092FB054636 +:10A500000098002801D0002D04D12A482849F530B0 +:10A5100011F0EDFC0098807F8007800F012857D054 +:10A52000E86A81788907890F0129A17952D0490801 +:10A530004900A1718278FD255207D20F29405200AF +:10A540001143A171E322114002785207D20E114348 +:10A55000A171DF2211404278D207920E1143A171FE +:10A560000021E171C178217242790179607A400855 +:10A57000400000E031E0D307DB0F18439307DB0F07 +:10A5800028405B0018435207FB23D20F184092006B +:10A5900010436072A07ACA0740084000D20F1043EF +:10A5A0008A07D20F2840520010431840490705E09F +:10A5B000809D000012030000A0150020C90F890033 +:10A5C0000843A0720098007823287FD92621C2E092 +:10A5D000A86AA6E701221143ABE7297BFE480229BE +:10A5E00018D017270C26002C5DD001292AD003296A +:10A5F00037D0042938D0052936D08B20F749C00040 +:10A6000011F075FCA088FDF7D4FB054600782328DF +:10A610003BD05BE019270726002C44D00121A17113 +:10A62000017ECA094906890ED20149000A43027611 +:10A63000A088FDF7BEFB05460078232830D0E74907 +:10A64000E7482BE00121A171E17989088900E171D6 +:10A65000017ECA094906D201890E49000A430276E1 +:10A66000D0E70220A07106E0687B0007000F803071 +:10A67000A071052904D0E07980088000E071C1E76D +:10A68000E07980088000401CF8E7A088002101F0F4 +:10A69000FEFA002804D02320D049400111F027FC05 +:10A6A0002221284658E00498068015E0002C01D0AD +:10A6B0006888A080287A032828D004280FD005288D +:10A6C0004DD09720C549C00011F011FC0498002C12 +:10A6D000068001D027806680002005B0F0BD1527D8 +:10A6E0000C26002CDFD00023A0880122194601F09F +:10A6F00098FA050004D1BA48B849483011F0F7FB80 +:10A700000622A11DA86905F00FFDDFE71627072621 +:10A71000002CC8D0A088FDF74CFB00900023A08837 +:10A720000122194601F07DFA05460098002801D063 +:10A73000002D04D1AA48A949563011F0D8FB287839 +:10A74000C00601D5022000E00120A0710098007829 +:10A750002328BBD927210098FDF763FBB6E717270D +:10A760000C26002C9FD0A088FDF723FB00906D7A6B +:10A77000002804D19A489949693011F0B8FB0621A4 +:10A78000A01D11F087FA0020A071207A0321084350 +:10A790002072FB2108400099C97FC907490F08436F +:10A7A0002072680692D5E07904210843E071A07A0E +:10A7B000E90740084000C90F0843E17A2A07490821 +:10A7C0004900D20F1143FD22AB07DB0F10405B00A5 +:10A7D0001843A072E806C00F114040000143E17227 +:10A7E00074E710B50446807990B08009012804D040 +:10A7F0007B487A499B3011F07AFBFFF760F9012022 +:10A800006946087074480AA9A0380190201D02907A +:10A81000601C0B906846FDF7E1F9002804D07048F1 +:10A820006E49A53011F063FB0322601C0B9911F0F7 +:10A83000D4F910B010BD10B5674CA03C002805D06D +:10A8400001461022204611F0C8F90120207410BDE5 +:10A8500010B50446FFF733F95F491022A0392046AE +:10A8600011F0BBF910BD70B500255B4C00281BD062 +:10A870005C49884206D301218904884204D35A499D +:10A88000884201D210250DE0062105F037FC411C5D +:10A8900007D051494039C865207E80210843207681 +:10A8A00000E00725284670BD207E4006400EF6E7F2 +:10A8B000F3B5002089B00D460290002909D049481F +:10A8C00085421BD301208004854202D3464885423D +:10A8D00014D30998FDF76DFA060003D030782228CA +:10A8E00015D102E041480BB0F0BD002D08D1B07F7A +:10A8F000C10903D08007800F022801D01020F2E7A1 +:10A90000B07FC10601D4000703D5002D01D0082077 +:10A91000E9E73148007EC00712D1F07F400701D53A +:10A920000D20E0E7002201231146099801F079F992 +:10A93000070005D0B07F8007800F022802D00BE00F +:10A940001120D0E7002D07D02A4639463046FFF7C0 +:10A9500021F802900028C6D11F488C38F8F7BAFABF +:10A96000040003D11D49224811F0C1FA0A202070C9 +:10A970000998206238468830A060B07FFB218007AC +:10A98000800F012838D0002D4CD002202071381DB6 +:10A99000E06038780007400F20743878C006C00F98 +:10A9A0006074A07C2A788008D2078000D20F104300 +:10A9B000A0740840F17F01AAC907490F0843A07499 +:10A9C000A878E07469462846FFF724F868460079BD +:10A9D0002075684600780DE02C160020809D000050 +:10A9E0003604000000D001000028002002300000E2 +:10A9F00064050000607519E001202071207B2A7831 +:10AA00008008D2078000D20F1043207308402978B5 +:10AA10008907C90F89000843207324213046FDF7B8 +:10AA200000FA0BE003202071052020732521304619 +:10AA3000FDF7F7F9B07F4006400EB07703A9204636 +:10AA4000FDF7CCF8022805D0002803D0FB49FC48CC +:10AA500011F04DFA029846E7FFB581B00A9D06460F +:10AA60001C4617461421284611F016F90B980021B0 +:10AA70000160F8070DD0F3492068884237D31230BF +:10AA800028602068143068602068A8600B982168EE +:10AA90000160B80725D56068002802D0E9498842DE +:10AAA00025D3029900290AD0FC3600280ED0314661 +:10AAB0001030FDF73AFB00281AD1606810E000283A +:10AAC00015D0E86080366068B0670AE0FEF757F995 +:10AAD00001460722304611F080F8FEF7F0FFDA4811 +:10AAE000E860780706D5D749A068884201D21020CF +:10AAF000F3E528610020F0E5FFB5D44A0E4607CA09 +:10AB000097B002AB07C30027009701971798FDF78E +:10AB100050F9050005D02878262804D008201BB05D +:10AB2000F0BDCB48FBE700231A461946179801F001 +:10AB300078F8040004D1C248C049803011F0D7F938 +:10AB4000A87F8007800F1690012814D0022824D0F7 +:10AB5000C520BA49C00011F0CAF901210022852E92 +:10AB600031D01EDC002E26D0812E26D0822E26D07B +:10AB7000832E1ED125E0002EEFD121462846199ABA +:10AB8000FEF708FF0028CAD119988078009019981C +:10AB90000078C007C00F0190DFE71998002808D19E +:10ABA000DBE7862E11D0882E11D0892E11D08A2E67 +:10ABB00011D00720B3E710460EE008460CE0022053 +:10ABC0000AE0032008E0052006E0062004E0082053 +:10ABD00002E0092000E00A200022227101216A46D9 +:10ABE0001176211D0791002801D02071F9E01698F7 +:10ABF00001280CD0A66AE06A0222012110900020F0 +:10AC0000A0602846173002291AD0012119E0E66A0F +:10AC1000A06A1090032030702078FB23C006C00F7C +:10AC20007070B07801221840009BF3708008019B7F +:10AC3000800018430221B070002070713071DEE78F +:10AC40000021890009190861681C022A01D001212C +:10AC500000E00021890009190861B0788007800FA1 +:10AC600001285DD1109880788007800F012857D186 +:10AC70001098007984461098407900901698012821 +:10AC80001CD0317908A801747179017508A8027C7B +:10AC90006046024008A8007D0099084013901043C8 +:10ACA0003ED06C491A98884206D301218904884213 +:10ACB00014D36449884211D2102030E70CAA0DA9A0 +:10ACC0001998FEF7A7FE08A8007C6146084030717D +:10ACD00008A8007D009908407071D7E720463C30F5 +:10ACE00021460090F03116980191022834D00021BD +:10ACF0001A9B20460C33FFF7AFFE0028DDD120461B +:10AD0000503021460090F43116980191012825D049 +:10AD1000002120461A9B139AFFF79EFE0028CCD1F3 +:10AD200010988078400702D4E87FC0072BD016998E +:10AD300002A8012914D0109909784900405A2178B5 +:10AD40000907490F4900C8408707BF0F2AD0012FC4 +:10AD500014D0022F0FD113E00121C9E70121D8E758 +:10AD600021780907490F4900405A1099097849008C +:10AD7000C8408707BF0F032F04D004E0022711E06B +:10AD800001270FE00227169801280BD1B078FB218C +:10AD90000840E97FC907490F0843B07020780007D1 +:10ADA000400F307020781022400840002070109929 +:10ADB000D2434978C907C90E114308402070C00624 +:10ADC00025D4022F23D0012F23D00020A061E061E1 +:10ADD0002062606220461830A060E87F4008400092 +:10ADE000E877204606A98830FCF7D4FE002805D075 +:10ADF000022803D01149184811F079F82878212841 +:10AE000003D025212846FDF70CF8002087E6032013 +:10AE100008E020460D211B3010F03CFF2046183082 +:10AE2000A060042069460875E87F01210843E8779F +:10AE300005AA29461798FEF72AFED2E7809D000052 +:10AE40008F050000002800208C150020CCC10100D7 +:10AE50000230000000D00100F1060000F0B587B01C +:10AE600015460E0004460CD09F48854206D30120AB +:10AE70008004854205D39D48854202D2102007B048 +:10AE8000F0BD2046FCF795FF070004D0387827284E +:10AE900003D00820F3E79648F1E700231A46194645 +:10AEA000204600F0BEFE040003D19249924811F002 +:10AEB0001EF80020002E05D0022E08D0012E11D041 +:10AEC0000720DCE701216A461171A06018E02346E3 +:10AED00018336946A360087110222946184610F0FD +:10AEE0007CFE0DE021461831A16069460871A06121 +:10AEF000E061206260620621284605F0FFF8A0614B +:10AF00002078C10714D04008400020700220694614 +:10AF100008702046183002907030FCF73BFE022883 +:10AF200006D0002804D074487249233010F0DFFFA7 +:10AF300025213846FCF775FF0020A0E7F8B5154637 +:10AF40000E460746FCF735FF040004D0207822287F +:10AF500003D00820F8BD6648F8BDA07F8007800FA9 +:10AF6000022802D06248C01CF8BD5F4886420CD35C +:10AF7000012189045D4A8E4201D3964205D3854260 +:10AF800003D38D4203D3954201D21020F8BD009522 +:10AF90003288B31C21463846FEF7A4FD112816D08E +:10AFA0000028F3D1E17F2A7C4908D2074900D20F5B +:10AFB0001143E1772A7C49079206490FD20ED2004D +:10AFC0001143E177A17F4906490EA177F8BDA17F22 +:10AFD0000907FBD420460822B11C343010F0FDFDD7 +:10AFE00030886086204610222946223010F0F5FD78 +:10AFF000E07FFD210840297CC907890F0843E077DD +:10B00000287C410820200155A07F08210843A07713 +:10B010000020D7E770B594B00D460646002B02D04D +:10B02000072014B070BDFCF7C4FE040007D02078E0 +:10B03000222802D3A07F400603D40820F1E72C4841 +:10B04000EFE7002D19D02D216846017046801022AF +:10B05000294601A810F0C1FDE07F297C4008C907FE +:10B060004000C90F0843E077297C40078906400F5C +:10B07000C90EC9000843E07703E02E21684601703D +:10B08000468009A96846F7F75CFF694609782D29CB +:10B0900005D1002803D1A17F10221143A177A17F00 +:10B0A000BF221140A177BCE710B50C46FCF781FE2A +:10B0B000002804D00D498C4203D2102010BD0C484A +:10B0C00010BD2146FEF7F5FF002010BD05E0027817 +:10B0D000401C002A01D0002070470A46491E89B250 +:10B0E000002AF4D10120704700D001000028002080 +:10B0F00002300000809D000013070000F7B50F46E6 +:10B10000FA4D0146029A687C072A01D02A7C101A5F +:10B11000C6B2FC78084600F077FD297C401C484305 +:10B12000401EC2B238790FE0029B072B13D0630098 +:10B130005B199B7C072B01D0761EF6B2641CE4B22F +:10B14000944201D9631ADCB20346401EC0B2002B00 +:10B15000EAD13046FEBD63005B199B7C072BEBD028 +:10B16000ECE7FFB581B00D460A9F0B9C019800F0FB +:10B170004BFDDE4E401C317C039A4843401EC0B25A +:10B18000009029460198FFF7B9FF00280BD02879D5 +:10B19000317C884203D3D6A1BB2010F0A8FEA8784A +:10B1A000C00908D01AE00398072802D0112005B082 +:10B1B000F0BDD448FBE701982080381D6080002056 +:10B1C00060712071E780049820812046F7F7E1FE46 +:10B1D000002803D1C6A1C82010F089FEE87829799B +:10B1E0004018491C29710099C0B2884202D9317CAB +:10B1F000401AC0B24000801903998174C17CF122C9 +:10B20000490849001140C1740020D0E7FFB583B060 +:10B210001C4616460F4600231A4602210C9D039831 +:10B2200000F0FFFC010008D033463A460195009437 +:10B230000398FFF796FF07B0F0BDB248801EFAE70B +:10B24000F0B5054616460F4650888DB00023012202 +:10B25000022100F0E6FC040003D1A5A1FA2010F0C1 +:10B2600046FE002069460871A078400603D1A0A1DF +:10B27000FE2010F03CFE042F5ED32A78D007C017C2 +:10B28000401C06D161786B78994255D12178090725 +:10B2900052D00121142A46DA012A42D0122A02D0C1 +:10B2A000132A40D128E00C2F3DD1A2785206520E2D +:10B2B000012A38D0207800090001401C20706878ED +:10B2C00060706846017168792A7901021143684605 +:10B2D0000181E879AA790102114368464181687ABF +:10B2E0002A7A0102114368468181E87AAA7A01022A +:10B2F00011436846C1811AE0062F14D12078000955 +:10B30000000120707188012001F097F90221684640 +:10B310000171C91E018168792A79010211436846C9 +:10B320001FE0062F0AD06A461279002A1BD07088C7 +:10B33000324601A9FDF792FB0DB0F0BD207800095F +:10B34000000120707188012001F077F90221684620 +:10B35000017168792A79010211436846018100214F +:10B36000C9434181E3E70028E6D0748868468176C6 +:10B370006978C176022181830021C18304A8052256 +:10B3800000900C2311462046FFF740FF0028D3D041 +:10B390005DA1F12010F0ABFDCEE7F7B592B01546F8 +:10B3A00012991398FAF7A5F9C0B2082860D10020C5 +:10B3B00069468881688800230122022100F031FC5F +:10B3C000060004D1FF204AA17E3010F090FD68886D +:10B3D00001210E910027F47800F016FC434A401C2E +:10B3E000117C48438C46401EC1B230790FE03F4A81 +:10B3F00063009A18937C0E9A934201D17F1CFFB28E +:10B40000641CE4B28C4202D96246A21AD4B202464B +:10B41000401EC0B2002AEAD1002F02D1172168468F +:10B42000818106AB023303AA009512991398F8F7AD +:10B4300032FC0006000E07D002281BD0032817D0CC +:10B44000FF202BA1A43011E06846808900280FD08E +:10B4500004A9019100906888042301223146FFF776 +:10B4600080FE002804D0FF2021A1913010F03FFD84 +:10B4700015B0F0BD6878102108436870F8E710B582 +:10B4800000221A4913465400521C0B53082AFAD3BF +:10B49000012807D0022809D0FF2015A1E53010F0BF +:10B4A00026FD10BD0F200874072002E0022008745A +:10B4B0000120487410BD70B50C460021A1702178A0 +:10B4C0000025090909012170657000F09DFB0749FD +:10B4D000097C4843C0B2E0704018102804D9FF200E +:10B4E00003A1F13010F003FD257170BD4C16002052 +:10B4F0007372635C6C326361705F636F72652E633D +:10B5000000000000043000007372635C6C32636101 +:10B51000705F636F72652E630000000070B50D46AA +:10B5200000230122022100F07CFB040004D1FF2053 +:10B53000FD49F93010F0DBFCA0786906C009C001B4 +:10B54000490E0843A070D0E7704710B501460120AE +:10B5500001F073F810BD3EB58DB200230122022127 +:10B56000284600F05EFB040003D1EF49EF4810F0DD +:10B57000BEFC207869460009000120700220087096 +:10B58000EB488880C88000222846FDF767FA3EBD58 +:10B59000F7B505460078002700090C463E4601280D +:10B5A00004D08720E049800010F0A1FC287A03280D +:10B5B0000CD0DE48DC49253010F099FC0298002CB4 +:10B5C000068001D0278066800020FEBDEA897027B2 +:10B5D00010460A3086B2002C0AD06888A080A8895C +:10B5E0002081E28020460A30296910F0F6FAE5E76A +:10B5F00002980680E8E7F8B543680246D9799C7955 +:10B60000090221435C7A1E7A25025C88981D354325 +:10B61000241FA1421DD11B79022B1AD1042D19D050 +:10B62000052D22D0062D19D0402D12D3061D0F4610 +:10B630001446284600F023FA08280AD0112020706A +:10B6400003202072A581E7812661607808210843E4 +:10B650006070F8BD001DFFF7A0FEF8BD031D508807 +:10B660000A461946FEF705FEF8BD001DFFF7E8FD86 +:10B67000F8BD70B50D4600238CB006461A4602216F +:10B6800000F0CFFA040031D020780007000F012825 +:10B690002ED012206946887460780523801CC874F7 +:10B6A000082088822888C88268880883A8884883F8 +:10B6B000E888888302A90C20019100901A4621464F +:10B6C0003046FFF74EFD00280ED1F0230022314610 +:10B6D000012000F00DFF207800090001401C2070BF +:10B6E0006078801C607000200CB0FEE69148FBE79B +:10B6F0001120F9E770B50D4600238CB006461A46B6 +:10B70000022100F08EFA040006D020780007000F16 +:10B71000012803D00820E7E78648E5E713216846BB +:10B7200081746178C17402218182C58202A90620D8 +:10B730000523019100901A4621463046FFF711FD7E +:10B740000028D1D120780009000120700020CBE72B +:10B75000F3B581B00D46002301220221019800F0CB +:10B7600060FA00260446002804D170486E49CA30A9 +:10B7700010F0BDFB2079A84243D25B206A49C0008B +:10B7800010F0B5FB3DE0E778019800F03DFA6A491A +:10B790007B000A7C5F18B97C0091E178401C504323 +:10B7A000491C401EC9B2C0B2E170814201D9881A59 +:10B7B000E0702079401E2071F87CC00708D0009905 +:10B7C0000198042915D058499C20183110F08FFB9E +:10B7D000F87C0107480F08D0490F019804290BD0C5 +:10B7E0005149A920183110F082FB0098072808D190 +:10B7F00005E0FEF7BBFDEBE7FEF78BFDF5E7761CFA +:10B80000F6B228466D1EEDB20028BCD13046FEBD12 +:10B8100010B500230122022100F003FA040004D134 +:10B8200042484149F23010F062FB00202071A078BC +:10B8300080210843A07010BDF7B582B015460F46B1 +:10B8400000231A460221029800F0EBF93A4C060058 +:10B8500005D0002F0FD0002D0AD0062009E0072FB9 +:10B8600004D0207C617C401AC0B2A0E4607CFBE77D +:10B870000820B84203D82C49304810F038FB3A462B +:10B8800031460298FFF73AFC0090002D24D00028A2 +:10B8900022D1F578029800F0B7F9217C401C48438A +:10B8A000401EC2B2307910E06B001B199E7C072E3F +:10B8B00003D0DE7C3607760F10D06D1CEDB29542BA +:10B8C00001D96B1ADDB2401EC0B20028ECD1CB20EA +:10B8D0001549800010F00BFB009868E46900091915 +:10B8E000C97CF12211407A07120F1143D974002844 +:10B8F000F2D1ECE7F3B5002381B007461A460221E6 +:10B9000000F08FF9060004D10C480749283010F0E8 +:10B91000EEFA0298401E052804D3CF200249800089 +:10B9200010F0E5FA00250BE0F0B400000D02000075 +:10B93000FFFF0000023000004C160020130300003F +:10B94000F478384600F060F9534F401C397C484386 +:10B95000401EC2B2531C3079D9B218E04E4E670077 +:10B96000BE19B446B77C029EB74208D16146C97C75 +:10B970004E0876006146CE746D1CEDB22146641C03 +:10B98000E4B2944203D9444E367CA41BE4B206468A +:10B99000401EC0B2002EE1D1994206D23E48490075 +:10B9A0000818C17C01221143C1742846FEBD3B49E1 +:10B9B000884201D2102070473749497C017000202D +:10B9C000704710B50446402801D2072010BD00F092 +:10B9D00056F8082802D03120000210BD00212E4860 +:10B9E00002E0491C082903D24A00825A002AF8D1F1 +:10B9F000082903D049004452002010BD042010BD86 +:10BA000010B5402801D2072010BD00F038F80828F2 +:10BA100005D00021204A40001152084610BD0520E3 +:10BA200010BDF0B58BB016460C00074607D0002EAF +:10BA300005D06188402904D207200BB0F0BD10204A +:10BA4000FBE72088002801D0172801D90C20F4E753 +:10BA5000084600F014F808280FD0258803A82A46C5 +:10BA60003146023010F0B9F801A8009062882B46E8 +:10BA700007213846FFF7CAFBDFE70520DDE701466F +:10BA80000020054A02E0401C082803D24300D35A94 +:10BA90008B42F8D1704700004C160020002800208F +:10BAA000F8B50546E24C079E069821706270A370B7 +:10BAB000E6702071681C42085200DE4B00218800AD +:10BAC00000198446C261605C40008218002D0AD0D3 +:10BAD000002005E066464700F669401CF353C0B2FB +:10BAE000665C8642F6D8491CC9B20529E7D3002610 +:10BAF000D21C9708B000BF0000198760304600F0E4 +:10BB000041F9A15D761C4843C219F6B2052EEFD368 +:10BB1000501B80B2F8BDF0B50546C54F8C460020DD +:10BB2000FF247E5DA90096460346CF190CE0F96913 +:10BB30005A008A5ABF498A4204D1401CC0B2FF2C25 +:10BB400000D11C465B1CDBB29E42F0D86146002946 +:10BB500009D100280BD0002D07D0B54949788E4275 +:10BB600003D2401EC0B2002801D071460C70F0BD57 +:10BB700070B5AF4C8D0000232D19615C09E0EC69B4 +:10BB80005E00A45B844202D11370012070BD5B1C77 +:10BB9000DBB29942F3D8002070BDFEB51C461746B3 +:10BBA0000D46060008D0002D06D0F01C800880004D +:10BBB000B04203D01020FEBD0E20FEBD002F03D0EA +:10BBC000002C01D0A74201D90720FEBD00942346D6 +:10BBD0002246394600200194FFF762FF29888142FE +:10BBE00007D0814201D2042100E0092128800846C3 +:10BBF000FEBD009423462246394630460194FFF7A5 +:10BC00004FFF28800020FEBDC0B2704708B5052850 +:10BC100001D2022901D3002008BD6A46FFF77BFF4D +:10BC200008BDFFB50446834881B01E460D468442D8 +:10BC300004D0052D02D20398022802D3002005B0BB +:10BC4000F0BD002769460F7020466A462946FFF777 +:10BC50008FFF002817D068460178284600F09CF82E +:10BC6000002EECD00028EAD171484078A04204D8D8 +:10BC7000FF2071A1553010F03AF929462046039A69 +:10BC800000F096F8DBE73846002EEDD1D7E7F8B59F +:10BC900005460C460020674E69466B4F0870B5425A +:10BCA0003BD0052C01D30720F8BD0A462146284683 +:10BCB000FFF75EFF002830D068460178204600F08C +:10BCC0006BF8230010F041FA0504090C11161B0053 +:10BCD00001462846FEF7E5F915E0FDF7A5F812E064 +:10BCE00001462846FFF730FC0DE001462846F7F7ED +:10BCF00055FF08E001462846F9F783FB03E053A10E +:10BD00007B2010F0F4F84A4A6846A10000788918B0 +:10BD1000C96940000E520020F8BD3846F8BD4F4AB0 +:10BD2000914201D210207047052801D307207047A7 +:10BD30000872002048727047F8B5044647488442AC +:10BD400001D21020F8BD207A394A83009B18617A0D +:10BD5000384D125C11E0DE694F00F65BAE420AD04E +:10BD60004A1C6272DA694B00D25A228000F014F841 +:10BD700060600020F8BD491CC9B28A42EBD86172EC +:10BD80000520F8BD0EB5364B40000ECB0091029356 +:10BD900001926946085A0EBD70B50C460546FFF77C +:10BDA000F1FF234AA900891889686043401870BDD3 +:10BDB000F8B50C46064600206946134608706A46E8 +:10BDC00019462046FFF7A7FE002500282DD0184A67 +:10BDD0006846A10000788918C96940000E5268467B +:10BDE00001782046FFF7D8FF0546230010F0ADF993 +:10BDF0000504090C1116190029463046FEF72DF9E5 +:10BE000013E0FDF701F810E029463046FFF753FB39 +:10BE10000BE029463046F7F78FFE06E0F9F7EAFA1D +:10BE200003E00AA1622010F062F82846F8BD000085 +:10BE300080160020FFFF00007372635C686F7374EC +:10BE40005F636D2E63000000023000007372635C5C +:10BE5000686F73745F636D2E63000000002800201C +:10BE6000D8C101004B490968016000207047494969 +:10BE70000860002070470121474A484B002803D042 +:10BE8000012805D04648704791630020187001E0F2 +:10BE9000D163197000207047424901200860404872 +:10BEA000801C70470422404B3E49002805D05A6050 +:10BEB000086901221043086108E008694008400051 +:10BEC00008619A6034490020C031886000207047C2 +:10BED00034490622002808D0012809D002280DD0B4 +:10BEE00003280FD02E48401C70470869904302E099 +:10BEF00008699043801C08610020704708699043DE +:10BF0000001DF8E708691043F5E726494A6A02432D +:10BF10004A620020704723494A6A82434A620020ED +:10BF200070472049496A0160002070471D49CA696D +:10BF30000243CA61002070471A49CA698243CA6134 +:10BF4000002070471749C9690160002070471549F2 +:10BF5000024600204031002A03D0012A01D00720E8 +:10BF600070478A6370471049042088600A4900209E +:10BF7000C03188600949012008700C490A68802393 +:10BF8000120A12021A430A600949086070470348FE +:10BF9000007870470004004040000040640000202A +:10BFA00004200000000500400003004000E400E021 +:10BFB00000E100E08107C90E002808DA0007000F41 +:10BFC00008388008B94A80008018C06904E08008F9 +:10BFD000B74A800080180068C8400006800F70478C +:10BFE000B44948788978884201D3401A02E0212276 +:10BFF000511A0818C0B27047AE4923314878897881 +:10C00000884201D3401A02E02122511A0818C0B216 +:10C010007047A849463148788978884201D3401A48 +:10C0200002E02122511A0818C0B27047A04810B58A +:10C030000C300168FF22120291430122D203114306 +:10C0400001609C4900202331487088702339487072 +:10C050008870463148708870974804F092FA964884 +:10C06000401C04F08EFAF6F759FB00F015F910BDEC +:10C0700020207047B4E770B50C4605460026FFF750 +:10C08000AFFF8C49A04214D30A46203A0023204631 +:10C09000641EE4B200280BD08878105C2870887881 +:10C0A0006D1C401CC0B288702128F0D18B70EEE767 +:10C0B000012600F0F1F8304670BD202070479BE764 +:10C0C00070B50C4605460026FFF796FF79492331E7 +:10C0D000A04214D30A46203A00232046641EE4B24C +:10C0E00000280BD08878105C287088786D1C401C64 +:10C0F000C0B288702128F0D18B70EEE7012600F0E5 +:10C10000CBF8304670BD202101700020704710B57B +:10C110000446FFF77EFF2070002010BD70B50C466E +:10C120000546FFF776FF63494631A04215D30A461C +:10C13000203A00232046641EE4B200280BD0887801 +:10C14000105C287088786D1C401CC0B28870212853 +:10C15000F0D18B70EEE7002400E0584C00F09CF822 +:10C16000204670BD70B50C460546212904D9FF2034 +:10C1700053A147300FF0BBFE4C484068103840B226 +:10C18000FFF718FFC6B20D20FFF714FFC0B28642BA +:10C1900007D2FF204AA14D300FF0A9FE01E0F6F7CB +:10C1A000FDFA21462846FFF766FF0028F7D070BD4C +:10C1B000F8B5404E07462336B1787078212200F05A +:10C1C00060F8354623353B4C00280ED0A1786078C6 +:10C1D000212200F056F8002814D0A978687821228E +:10C1E00000F04FF800281AD025E032497078C91CB9 +:10C1F0000F547078401CC0B2707021281BD10020F1 +:10C20000707018E02B49607820390F546078401C1A +:10C21000C0B2607021280ED1002060700BE025496B +:10C22000687826310F546878401CC0B268702128A5 +:10C2300001D100206870B1787078212200F021F8D7 +:10C2400000281DD0A1786078212200F01AF800287B +:10C2500016D0A9786878212200F013F800280FD0B2 +:10C26000F6F77EFA144804F094F901214903884254 +:10C2700003D013A1C1200FF03AFE0F4804F0A1F93A +:10C28000F8BD401C884205D0904201D1002901D060 +:10C29000002070470120704710B5074804F079F975 +:10C2A000002801D1F6F74BFA10BD000000ED00E0C8 +:10C2B00000E400E0F01600206500002007200000E8 +:10C2C0007372635C736F635F72616E642E630000F0 +:10C2D0000C4908784A78401CC0B2904200D00870DF +:10C2E0007047094A074820BF40BF20BF4178037804 +:10C2F00043701368002B02D103788B42F3D00020E7 +:10C30000704700006700002000E200E0FEB5F34C3B +:10C3100007466068FF213E0181552178FF2913D02F +:10C320000901083141583246491E0832090201927A +:10C33000090A805800F0C8F9002802D02478254660 +:10C3400015E06168207888552770FEBDE348426893 +:10C3500001981158280100900830105800F0B4F9E5 +:10C36000002806D1DD482C46416800980D5CFF2D61 +:10C37000ECD1DA482101406885554754FEBD70B5BF +:10C38000D64A04460020157A53680AE00201561C7A +:10C390009E5DA64203D10C329A588A4204D0401CBA +:10C3A000C0B28542F2D8FF2070BDF8B5CB4F3E78C1 +:10C3B00001F002FE0146FF2E68D034012546786860 +:10C3C0000835405900F080F9022802D978684059B0 +:10C3D0005AE0C2494868025D0A70A11C425C002A0A +:10C3E0000CD0521E425441590122D205891809022B +:10C3F000090A41513046FFF789FF30E0631CC25CF7 +:10C400000092221D94468258002A10D001239B02DC +:10C410009A420FD99205920D43595703DB191B021B +:10C420001B0A43516346C3589A1A920A09E0FF2136 +:10C43000C1540AE0435952039A181202120A425197 +:10C44000002242543046FFF761FFA4480C34416893 +:10C45000C2680098095980001258009890479F4C74 +:10C460002078FF2812D001F0A7FD014620786268ED +:10C4700000010830105800F027F9012896D92078DB +:10C48000616800010830085801F089FDF8BDF8B571 +:10C490001C4615460E460746FF2B03D390A1D3201A +:10C4A0000FF025FD8D48FF21C760456004720674BA +:10C4B000017000224270104604E00201521C401C30 +:10C4C000A954C0B2A042F8D3F8BD70B5834C06465B +:10C4D0006578207C854203D381A1E6200FF007FD1B +:10C4E000E068A90046506078401C6070284670BD26 +:10C4F000FFB581B01D46FF2401F05EFD774F064673 +:10C5000079780198814203D875A1F4200FF0EFFCEF +:10C5100072480021037A406810E00A019446521CD8 +:10C52000825CFF2A24D0019FBA4205D162460C32B8 +:10C530008758029A97421DD0491CC9B28B42ECD849 +:10C54000FF2C17D021014B1C019AC2540B33029AC5 +:10C55000C250039B614F0022012B0ED00B1DC25015 +:10C5600001239B029D4216D9AA05920D08D008E02E +:10C570000C46E1E7FF2005B0F0BD0B1DC550EFE70D +:10C580001A4653039B190E461B0208361B0AAA1AA9 +:10C590008351920A09E0002D00D101256B039B19FC +:10C5A0001D022D0A0B460833C550891C42543D46D6 +:10C5B0003E782046FFF7AAFE2878B04215D001F059 +:10C5C000FBFC014628786A6800010830105800F02A +:10C5D0007BF8012807D928786968000108300858D5 +:10C5E00001F0DDFC01E0FFF7E0FE0198C3E770B564 +:10C5F0000C46054601F0E0FC064621462846FFF7BA +:10C60000BEFEFF2817D0354D04012046696808306A +:10C610000858314600F058F80121090340186968AC +:10C62000A41C095D400B002901D0890208180028CC +:10C6300000D1012070BD002070BDF3B581B00F4660 +:10C640000198FFF79CFEFF282AD0244D2E786968B8 +:10C650003246344604E0844205D026462301CC5CB1 +:10C66000FF2CF8D11CE0FF2C1AD0A6421FD11001DC +:10C67000085C2870FF2818D001F09EFC2A7801463B +:10C68000120168680832805800F01EF8012809D9A4 +:10C690002878696800010830085801F080FC06E03D +:10C6A0000020FEBDFFF781FE01E001F080FC39466D +:10C6B0000198FFF79CFF22016968FF23541C0B556A +:10C6C0008A5C3301CA54FEBD401A00020121000AEF +:10C6D000C905884200D90020704700003C1700209F +:10C6E0007372635C736F635F74696D65722E630050 +:10C6F000F0B500241C4A01211C4B0803546018604B +:10C700001B4B1C601B4C20601B480469E443E4067F +:10C71000E6170469761C10252C430461174C6160F0 +:10C72000174D296000E020BF1F68002FFBD0002EAE +:10C7300003D107691026B7430761906880059068A8 +:10C7400001D5104A10436960A160002119600121E0 +:10C75000084A09031160F0BD10B50446FFF7C8FF91 +:10C760002060002010BD000000C5004080E100E016 +:10C7700000C1004080E200E000ED00E000C30040A6 +:10C7800000C0004000FCFFFF70B51F490A68002A86 +:10C7900017D000231D4601244A68521C4A60092A0A +:10C7A00000D34D600E792246B2400E6816420AD080 +:10C7B00072B60B6893430B6062B649680160002053 +:10C7C00070BD052070BD5B1C092BE5D30FA1362081 +:10C7D0000FF08DFBF5E701201049800508607047D8 +:10C7E000EFF31081CA07D20F72B6012181400648CB +:10C7F000036819430160002A00D162B6EBE70248E2 +:10C8000000210160416070476C0000207372635C1E +:10C81000736F635F6576742E6300000000E200E0D2 +:10C820000120810708607047012081074860704738 +:10C830001048C068C00700D0012070470D488068CC +:10C84000C00700D0012070470A484069C00700D0E7 +:10C85000012070470748C069704706498A69D203BA +:10C8600006D589698907890F814201D10120704766 +:10C870000020704700040040F8B5FE4C207EE17DAA +:10C8800088421AD00126FC4D0027E07D215C14204F +:10C890000A4642435019037C052B0FD0062B1BD0B0 +:10C8A000072B28D0437C012B33D0F4A1F6480FF09E +:10C8B0001EFB207EE17D8842E7D1F8BD0674E07D55 +:10C8C000162807D0E07D401CE075491CC8B2AA5864 +:10C8D00002210CE00020F7E70674E07D162808D05E +:10C8E000E07D401CE075491CC8B2AA58032190475E +:10C8F000DFE70020F6E70674E07D162807D0E07D2C +:10C90000401CE075491CC8B2AA580821EFE7002076 +:10C91000F7E74774E07D162807D0E07D401CE075FE +:10C92000491CC8B2AA580721E1E70020F7E770B513 +:10C93000D64D0C206872D648002444730473283006 +:10C940000476C475D34803F01CFED3480475EC721A +:10C95000D249601E88606C71AC70EC702C716C7088 +:10C96000CF48052104704470CE4804700475283007 +:10C970000470491EFAD10120F5F796FF0020F5F763 +:10C9800093FF0120A871F5F74DFCC748F5F75CFC53 +:10C99000C64C2070C648F5F757FC6070F5F724FFC9 +:10C9A00070BD10B5F5F74BFFC04C2078F5F76AFC69 +:10C9B0006078F5F767FCB54C207A002803D0F5F7CE +:10C9C000F0FC0020207210BD70B5B04CA07900289A +:10C9D00004D0AAA1B7480FF08AFA70BDE07A002807 +:10C9E00003D1A6A1B4480FF082FA0126A671002552 +:10C9F000E572607A0421142250439F4A8018017422 +:10CA0000A6488168491C04D0691E81600120F5F7A1 +:10CA10004BFF0020F5F748FFF5F72CFF03F0F2FE7F +:10CA2000F6F72DF8A548056005600120A449C0036C +:10CA30000860F6F79DF89A480078022804D0032889 +:10CA400004D1E078002801D0A67000E0A570F6F7C8 +:10CA500002F870BD034688490B2014224243521845 +:10CA6000203A127F002A04D0401E0006000EF4D1A6 +:10CA700070471422424351180A46403AD3620122B9 +:10CA800020390A777047012805D0032805D10029ED +:10CA900003D1002070470029FBD010B47B4C002349 +:10CAA00063707F4A002890700CD002280AD00729B2 +:10CAB0001AD20B007B441B79DB189F441505070D28 +:10CAC0000F111300D37003E01B2000E03A20D07058 +:10CAD0000120607010BC70475820F8E77720F6E717 +:10CAE0009620F4E7B520F2E710BC0020704710B59F +:10CAF0006B484078F5F7CAFF80B210BD411E142282 +:10CB0000504310B55C4A8418203C0A2902D8207F83 +:10CB1000002803D159A16B480FF0E9F9207F0128C3 +:10CB200004D0B32055A180000FF0E1F90020207758 +:10CB300010BD70B5564C607B217B884201D1012528 +:10CB400000E00025F5F73BFFF5F7A0FF617B227BB6 +:10CB5000914201D1012100E00021A942EBD170BD39 +:10CB6000F7B50646481E84468EB0C0B21422049023 +:10CB70005043414A851828460595007C2D1D0728FD +:10CB80002AD13C4C0027E07D227E824221D0235CCA +:10CB9000049A934201D1012701E0002F04D0162806 +:10CBA00011D0421CA25C225416280ED0401C227EBA +:10CBB000C0B28242EBD1002F0BD0207E002806D0DD +:10CBC000207E401E04E00022ECE70020EFE7162064 +:10CBD0002076059A0120107460462C4C0A280FD844 +:10CBE00014204143244808182038007F002807D02B +:10CBF0000598007C012807D01098807A012807D07A +:10CC00001EA131480FF073F91098807A01286FD176 +:10CC10000598194B007C022816D0164C207E162849 +:10CC200072D0207EE17D401C884203D113A12748A9 +:10CC30000FF05DF9059901204874217E0498605435 +:10CC4000207E162864D065E0607A049A01469042FE +:10CC500006D0014614277843C018807C9042F8D152 +:10CC6000627A824237D1617A14225143C918897C91 +:10CC700061722DE038190020541900207372635C32 +:10CC800072656D2E63000000D30500005C1A002061 +:10CC900010190020681A0020201900203C1A0020DA +:10CCA0007600002064190020ABC30000740000204F +:10CCB00079C800007D0200005E02000000F500401F +:10CCC00080E200E0CB020000150300002203000018 +:10CCD0000121A17207E014224243D218142779439C +:10CCE000927CC9188A7414220C215043C018817494 +:10CCF0001098007A06281DD203007B441B79DB18AC +:10CD00009F440C161412100EE07D00288ED091E77F +:10CD1000002001E0207E401C2076B5E000210FE0DD +:10CD2000B4210DE073210BE0322109E00A2107E074 +:10CD3000062105E0FF20FE49E0300FF0D8F8002181 +:10CD4000109802910068401A28601099097A002909 +:10CD500012D00221401A0102090A296010980268C3 +:10CD6000406810180002000A68601098807A022853 +:10CD7000109803D0007B71E00421EBE7007A0028D3 +:10CD800012D00222029812181098436810461030F0 +:10CD900018180A90E748029B4078984202D9E37835 +:10CDA000002B03D00A9805E00422EBE7029BC31A8C +:10CDB0000A981818637A10300C2B1CD0637A142749 +:10CDC0007B43DD4FDB195B68994214D0DB4F617AFE +:10CDD000BC4614235943D84BC9184B6889689B1B20 +:10CDE000891B1B0209021B0A090A984237D86345AE +:10CDF00035D8614533D831180A980123081A000242 +:10CE0000000A286010998018C9680002000A471AB1 +:10CE1000CB4A9B05BC469F4201D2384610E00F1A10 +:10CE20009F4201D260460BE0944503D9511A08187D +:10CE3000401C05E0974206D9101A4018401C404299 +:10CE4000002860DC03E0BA49BE480FF050F82968BA +:10CE50000A9808180002000A6860002028726868B2 +:10CE6000102710300002000A68601098407AA872FB +:10CE70001098007A687203280ED200280CD0FFF7B1 +:10CE8000D7FC002803D007E0002011B0F0BD0298C5 +:10CE900042210F1A32200290A6490878012801D0B9 +:10CEA000032809D148780299884205D9E1780029F8 +:10CEB00002D10299401AC7192868A04A801B8446EB +:10CEC00001026868090A801B03021B0A8F421AD8F4 +:10CED0001746914217D8BB4215D8617A0C2916D053 +:10CEE000677A62460C210391009139461423594315 +:10CEF000914BC9188B689B1B934216D803978F7C64 +:10CF00000C2FF2D173E0049801F049F9BCE70599C0 +:10CF1000022204980A74627A0C2A00D0627A8A7417 +:10CF200060720120A07211B0F0BD0C2F5FD0002202 +:10CF3000394694461422804B4A43D21853689B1BAF +:10CF4000834225D2917BAB7A99421BD80598052163 +:10CF5000049D7D4C0174207E16280FD0207EE17D3B +:10CF6000401C884203D1724978480EF0C0FF207EF1 +:10CF70002554207E162800D0CCE6C9E6E07D0028A6 +:10CF8000F1D0F4E701218C46917C0C29D2D102E04A +:10CF9000604600282AD03D46009114202A4642438C +:10CFA00065480621161831741C38007E162866481C +:10CFB00016D0017EC07D491C814203D164A167481F +:10CFC0000EF095FF6048017E4554017E16290BD076 +:10CFD000017E491C0176B57C0098A842DDD106E0AF +:10CFE000C07D0028EAD0EDE70021F3E7009705991E +:10CFF00002200874504D607AB84207D10599009814 +:10D000008874049860720120A07221E003980C2FAC +:10D010000FD00C2803D14EA151480EF068FF0398A1 +:10D02000142250434019049981740599009888741A +:10D030000EE00C2803D146A14A480EF058FF039891 +:10D040001422504340190499817405990C20887466 +:10D05000012011B0F0BD70B50D46064642490024CE +:10D060002046891BA04103D239A140480EF03FFF62 +:10D070003F490020491BA04104D2FD2034A180007B +:10D080000EF035FF3B4A70190021821A8C4101D302 +:10D090003949401870BDF8B5401EC0B2142148434C +:10D0A00025494518687B062813D203007B441B7969 +:10D0B000DB189F44020C0A080604002065E0B42037 +:10D0C00010E073200EE032200CE00A200AE0062077 +:10D0D00008E0FF201EA1E0300EF009FF697B002070 +:10D0E000002952D0022140186968002440180C2100 +:10D0F00000026956000A002949DBF5F7C7FC1A4A05 +:10D1000006460C27EF570021101AA14103D210A1A7 +:10D1100016480EF0ECFE16490020C91BA04104D2AF +:10D12000FD200BA180000EF0E2FEF019114A25E06F +:10D130007CCC00007600002054190020FFFF3F0047 +:10D14000FFFFFF001207000038190020070200004F +:10D150007372635C72656D2E63000000C50300008E +:10D16000DD030000E3030000FF7F841EF3030000E3 +:10D170000020A1070080841E00807BE10021821A2C +:10D180008C4101D3F7494018F8BD0421ABE7F5F70E +:10D190007DFC0C21695600224018F349091AA2416E +:10D1A000F2D24042F8BDF0B5064683B0EF48019098 +:10D1B000457A029534687068001B0702EC483F0A04 +:10D1C000001B00900C2D2DD0142029464143E94826 +:10D1D0000122081884464168E54892058646081BE6 +:10D1E000904210D3631A93420DD3024670467245A3 +:10D1F00003D900984018401C05E073450ED9411A28 +:10D200000819401C404200280CDA60460295857CD3 +:10D210000198C0790028D5D003B0F0BDD649D748D1 +:10D220000EF065FE0298854226D014214843D1496C +:10D230000123401802908068CD499B058C46011B54 +:10D240008646994210D3221A9A420DD3634661450D +:10D2500003D900997144491C06E0194662452DD94D +:10D26000091A0819401C4142002905DD0298B17ACB +:10D27000807B814200D374460C2D15D0BD4914200B +:10D28000454368184268121B1202120ABA420BD2B6 +:10D29000B27A837B9A4200D38468857C0198C079F6 +:10D2A0000028B9D10C2DEAD13068A042B4D0E019E1 +:10D2B0000002000A3460706003B0F0BDAE49AF48B0 +:10D2C0000EF015FED8E7F0B5AD490446486885B0C4 +:10D2D000C005C00D1CD0103840B200280CDA02077F +:10D2E000120F083A920892005118C9698007C00EBF +:10D2F000C1400806800F09E08108A24A8900891808 +:10D3000009688007C00EC1400806800F002808D0B9 +:10D3100000262078002806D0012804D0002005B07F +:10D32000F0BD0126F5E72079062813D203007B44DF +:10D330001B79DB189F44020C0A080604002018E041 +:10D34000B42010E073200EE032200CE00A200AE046 +:10D35000062008E0FF208849E0300EF0C8FD217962 +:10D360000020002905D002214718804D002E02D050 +:10D3700003E00421F8E70020E87102AA6946A068EA +:10D38000F5F78EFB694608228A56E06801A98018E5 +:10D39000C01C01221F2801DA019209E003AAF5F757 +:10D3A0007FFB6846007B002802D00198401C01905A +:10D3B00000990198401810300002000A0190C81B23 +:10D3C0000002000A00906079694688720098039014 +:10D3D000F5F7F5FA009A019B121A181A6A49120217 +:10D3E0000002120A000A8A4216D8884214D86846F7 +:10D3F000FFF7D9FE00990398814205D0C8190002B1 +:10D40000000AF5F743FBA0600120E979002986D0E6 +:10D41000002EB0D005B0F0BD0020F6E7F3B58FB018 +:10D420005A480C460B9003F0B4F8594A0F994F4EE6 +:10D430005518203D574F00280BD05748007D002835 +:10D4400003D056A158480EF052FD207801287DD017 +:10D450005AE1787B16280CD0787B397B401C8842B7 +:10D4600003D14EA151480EF042FD2078012804D08E +:10D470000DE0387B0028F4D0F7E7E87F002804D0DF +:10D480009F2046A1C0000EF032FD0120E877787B96 +:10D490000F991422464D50434019017420780228F8 +:10D4A00023D0787B1421484345192079287260796C +:10D4B00068722A460C322946A068F5F7F1FA0C206A +:10D4C00028560F2804DD1F3828732868401C286060 +:10D4D0000C22AA56281DE16802908818C01C1F283B +:10D4E0003FDA029901200860F7E025494868C00545 +:10D4F000C00D20D0103840B200280CDA0207120FFD +:10D50000083A920892005118C9698007C00EC140BC +:10D510000806800F09E081081A4A890089180968FD +:10D520008007C00EC1400806800F002803D11BA150 +:10D5300020480EF0DCFC787B14214843451900217B +:10D54000E0686A460591117303AA00E0D3E005A9DB +:10D55000F5F7A6FA6A460C2010560F282CDD01209C +:10D560002BE0ADE000807BE1FF7F841E5C1A002091 +:10D57000FFFFFF005419002050D1000012070000E7 +:10D5800000ED00E000E400E0FFFF3F00681A00202B +:10D59000301A002010190020201900207372635CDB +:10D5A00072656D2E6300000015050000F304000095 +:10D5B000501700200405000000200599401808902D +:10D5C0000220A8722079287260796872A068291DEB +:10D5D000C01C03911F2801DA01200AE006AAF5F712 +:10D5E0005FFA6846007E002804D00398039900681B +:10D5F000401C0860287A062813D203007B441B795C +:10D60000DB189F44020C0A08060400200FE0B42037 +:10D610000DE073200BE0322009E00A2007E006202D +:10D6200005E0FF20FD49E0300EF061FC002021798B +:10D63000002943D002214118069168681031401832 +:10D640000899059008180699401A0C900020F0716E +:10D65000F5F7B5F904462860089820180002000A7A +:10D66000E860707A0C2825D0707A14214843EC4980 +:10D67000401840680090059940180002000A019087 +:10D68000687A694688726846FFF78DFD0098019AAE +:10D69000001B121B00021202E24B000A120A0C9934 +:10D6A000984207D88A4205D80099069808180002BF +:10D6B000000A2860F0790028C8D110E00421BAE7F8 +:10D6C00004AA0299F5F7ECF96846007C002804D01A +:10D6D000029802990068401C08602078A872787B44 +:10D6E000162806D0787B401C78730B9802F069FFEF +:10D6F00047E00020F8E7E87F002803D0CAA1CD4822 +:10D700000EF0F5FB0120E877CB490F9808742078DC +:10D71000022803D1C4A1C9480EF0E9FBC64D207907 +:10D720002872607968722A460C322946A068F5F79B +:10D73000B7F90C2028560F2804DD1F3828732868F5 +:10D74000401C28600C22AA56281DE1680290881807 +:10D75000C01C1F2803DA0299012008600CE003AA0C +:10D760000299F5F79DF96846007B002804D00298DD +:10D7700002990068401C08602078A872AE49012018 +:10D780000875797B387B814223D0747A0C2C22D0A7 +:10D79000F5F715F914214C43A1496218117C0429AD +:10D7A00017D0032915D0536892681B1A101A1B0250 +:10D7B00000029C491B0A000A102B0AD30A468B421E +:10D7C00007D8904205D8787B397B884201D0F5F79D +:10D7D00042F911B0F0BD787B397B8842F7D111B0A6 +:10D7E000F0BD10B50020F5F74CF810BD10B50120C4 +:10D7F000F5F747F810BDF1B5009802281ED0904CFF +:10D80000607A0C2803D188A18E480EF070FB0026A8 +:10D81000A6710125E572607A03211422804F5043DE +:10D82000C0190174F5F71CF9009800280BD00128E5 +:10D8300029D0032879D07CA1834844E0834800782C +:10D84000F4F726FDF8BD8248007F002803D076A1BA +:10D8500080480EF04CFB65717D4D00202E60F5F781 +:10D8600023F8A968481C04D0012300221846F5F7C4 +:10D8700051F8607A617A401CC0B2142251437A5840 +:10D8800001219047F8BD0120F5F70EF860790028D6 +:10D890000DD06F488068401C09D0607A617A401CC6 +:10D8A000C0B2142251437A5806219047F8BD684807 +:10D8B000007F01280AD0022812D0032822D0042891 +:10D8C00034D059A164480EF012FBF8BD207900282D +:10D8D00003D02671F5F7C9F8E5705D480677F8BD05 +:10D8E000207A002802D1F4F733FD2572607A617A3C +:10D8F000401CC0B2142251437A580021904754482A +:10D900000677F8BD524F0123397B78680022411A0F +:10D910001846F4F7FFFF2079002803D02671F5F7A9 +:10D92000A4F8E57002203877F8BD19E0484E217858 +:10D9300070680123411A00221846F4F7EBFF207AA1 +:10D94000002802D1F4F704FD2572607A617A401C48 +:10D95000C0B2142251437A58002190473577F8BD60 +:10D96000607A617A401CC0B2142251437A58052172 +:10D970009047F8BD10B5324C607A0C2803D12AA12B +:10D9800036480EF0B4FA607A617A401CC0B21422B4 +:10D990005143234A52580421904710BDF0B583B03B +:10D9A0000C200290F5F70BF8254C0090617A2C487A +:10D9B00001900C2920D0617A14204143184809189D +:10D9C000097C042918D0617A142251430818007C7C +:10D9D00003287DD00198009A036840689B1A801A3A +:10D9E0001B0200020F491B0A000A102B70D30A46C3 +:10D9F0008B426DD890426BD815488068401C03D08C +:10DA000009A118480EF073FA00206071607A0C28A2 +:10DA100030D1607800282DD0134827E09CD5000035 +:10DA200054190020FFFF3F007372635C72656D2E16 +:10DA3000630000001C0500002019002022050000E2 +:10DA40005C1A002053050000A605000074000020A9 +:10DA50003C1A00205F0500009A050000AD0500009B +:10DA60004C1A0020E905000076000020C1784170C2 +:10DA700081780170607A0C2815D0607A1421FF4AF1 +:10DA800048438018007C04280DD1607A0290617AA6 +:10DA900001201423594389180874617A594389185D +:10DAA000897C6172A072F64D687B297BF54F8842B4 +:10DAB00034D0F54E287B142148438019007CC05D8A +:10DAC0000128287B08D048438019007CC05D00E015 +:10DAD000FEE102282ED043E0142148438019807AC9 +:10DAE00001280AD0287B0221142250438019007C8F +:10DAF000C155287B162808D009E0297B0020142274 +:10DB000051438919097CC8552AE0002001E0287B8F +:10DB1000401C2873687B297B8842CBD1DB4D287D54 +:10DB200000284CD0287CC15D012928D0C05D022886 +:10DB300030D03AE0287B142148438019807A0128AC +:10DB400003D0D3A1D5480EF0D2F9297B00201422AE +:10DB5000514389198872297B51438919097CC85519 +:10DB6000287B142148438219287B48438019017C73 +:10DB70000098FEF7F5FF287B1628C8D1C5E7A97ADB +:10DB8000012904D00221C155002028750DE0002193 +:10DB9000C1550AE0A87A012803D0BDA1C0480EF003 +:10DBA000A6F90020A872297CC855287D002806D037 +:10DBB000297CB64A0098FEF7D3FF0020287502980A +:10DBC0000C281ED014214843AC494018017C01297F +:10DBD00017D10721B34D0174287E16283CD0287E2A +:10DBE000E97D401C884203D1A9A1AF480EF07FF91E +:10DBF000297E02986854287E162831D0287E401C41 +:10DC00002876607A0C287DD0A07A00287BD000206E +:10DC1000A072617A142041439848A44B0A185668B0 +:10DC200091681D46D2687C35DE67AA606960A04DA8 +:10DC3000697E002916D00226617A14228F4851434A +:10DC40000818407B06281BD203007B441B79DB1895 +:10DC50009F440A1412100E0CE87D0028C4D0C7E7B8 +:10DC60000020CDE70426E7E700200FE0B4200DE018 +:10DC700073200BE0322009E00A2007E0062005E0CF +:10DC8000FF2083A1E0300EF032F900202873697E76 +:10DC9000022901D0012910D12969009A09188A1A8C +:10DCA0001202120A422A08D9032068763239080281 +:10DCB000000A28613220287308E0322806D2207A30 +:10DCC00000280AD1F4F744FB012005E0207A00285F +:10DCD00003D0F4F766FB00202072764910224878C2 +:10DCE00020700978012901D0032906D10121217171 +:10DCF000297B884201D9421A1032A378002B00D028 +:10DD0000921C01E08DE09BE02179002901D1002BDC +:10DD10005DD09446684A00990092019A176852684B +:10DD20007F1A511A3F0209023F0A090ABC451BD853 +:10DD3000614A974218D8009A914215D8297B8842A7 +:10DD400023D92B69421A9A1A1202120A1018801942 +:10DD50000002000A2A616860002914D00320287795 +:10DD60000006000E3ED14CE000202071A070297BFF +:10DD7000002925D02869401880190002000A68602F +:10DD8000022028772EE00120E9E781420BD92A6999 +:10DD9000511889190902090A6960002801D0042074 +:10DDA000DDE70220DBE7002B03D139A143480EF069 +:10DDB0009EF8286980190002000A6860002004E0CB +:10DDC000296989190902090A6960287719E0287BFD +:10DDD00000280FD02969081880190002000A68601D +:10DDE0000220287728690123811900221846F4F7B8 +:10DDF00091FD09E0286980190002000A686000208E +:10DE000028770120F4F750FD607A142148431B491C +:10DE10000C2240188256012300206968F4F77AFD2D +:10DE20000EE00120F4F740FD0020F4F73DFDF4F78B +:10DE300021FD207A002803D0F4F7B3FA00202072E5 +:10DE4000A078002804D0F4F710FE0020E070A07045 +:10DE50006078002804D01748C1784170817801703B +:10DE60002079002806D000201249E07009780029A6 +:10DE700000D120710B48017EC07D21E054190020A3 +:10DE8000101900202F1A0020501700202019002000 +:10DE90007372635C72656D2E630000000B060000F8 +:10DEA000270600003819002039060000D01900208C +:10DEB0003C1A002076000020FFFF3F008B06000088 +:10DEC000814203D0C8484078F4F7E2F90120E071BC +:10DED00003B0F0BDF0B5C54C0746607A83B00C289E +:10DEE00003D1C3A1C5480EF002F8607A1421C44ED4 +:10DEF00048438019007C032803D0BDA1C1480DF020 +:10DF0000F6FFC14DA868401C04D06F20B8A10001E5 +:10DF10000DF0EDFF607A1421484381190C2008565A +:10DF200000216A4600911171C01901AA6946F4F7EF +:10DF3000B7FD6A46042010560F2801DD012000E0DD +:10DF4000002000994018696840180102090AA96078 +:10DF50006079002804D0012300221846F4F7DAFC87 +:10DF600003B0F0BD70B5AA4CA84A0B1AA34214D353 +:10DF7000451AA54211D3934203D9101A43185B1CCA +:10DF80000BE0954204D9511A0818401C434204E0A2 +:10DF900097A1A0480DF0ABFF0023184670BD10B547 +:10DFA0000146012300220220F4F7B4FC10BD10B595 +:10DFB0000220F4F779FC10BD10B5F4F700FD10BD98 +:10DFC000F0B58A4D0446E87A83B0002803D188A1D1 +:10DFD00091480DF08CFF642C4DD3904A00210846E7 +:10DFE000121B884147D38E48417B007B814242D13E +:10DFF0008C48007D00283ED1687A1421804F484328 +:10E00000814EC519306801AA00196946F4F748FD28 +:10E01000694604200856002802DD0098401C009044 +:10E02000A96800986B680A18D21A12027E4B120A6D +:10E030009A4220D8AA7C0C2A08D014235A43D21919 +:10E040005268511A0902090A814214D3B068401C6F +:10E0500005D00120F4F728FC0020C043B0603068F0 +:10E0600000193060A868009940180002000A706129 +:10E07000012003B0F0BD002003B0F0BDF8B50646A6 +:10E08000401EC4B214205E4960434518287C002815 +:10E0900003D157A165480DF02AFF6148017B407B01 +:10E0A00081420CD0624A14234B439B181B7CB34221 +:10E0B0000CD016290CD0491CC9B28142F3D1594861 +:10E0C000017D002961D0007CB0425ED10020F8BD06 +:10E0D0000021F1E7052903D0062901D0072928D11D +:10E0E00001212974C17D0023027E8A4221D002468B +:10E0F000565CA64201D1012301E0002B04D0162971 +:10E1000011D04E1C965D565416290ED0491C167E11 +:10E11000C9B28E42ECD1002B0BD0117E002906D063 +:10E12000117E491E04E00026ECE70021EFE71621EE +:10E130001176697C00292AD06F74C17D0023027E8C +:10E140008A4224D0425CA24201D1012301E0002B8B +:10E1500004D0162912D04A1C825C425416290FD0D2 +:10E16000491C027EC9B28A42ECD1002B0FD0027E3C +:10E170000146002A06D00A7E521E04E00022EBE788 +:10E180000021EEE716220A7601E02A480027297CC2 +:10E1900001299FD16A7C002A9CD10120F8BD70B56D +:10E1A00005461420164A052168438018214C017445 +:10E1B000207E162811D0207EE17D401C884203D1AC +:10E1C0000BA11D480DF093FE207E2554207E1628BD +:10E1D00007D0207E401C207670BDE07D0028EFD067 +:10E1E000F2E70020F7E70000740000205C1A00202E +:10E1F0007372635C72656D2E63000000EE060000B2 +:10E2000054190020EF0600003C1A0020FF7F841EF6 +:10E210000020A1071207000031070000FF1FA1071F +:10E220001019002020190020FFFF3F006E0700009A +:10E2300050170020381900200702000010B502789E +:10E24000254B002A1A7002D002F015FB10BD05F014 +:10E250005FFD10BD10B520490978002902D002F0F9 +:10E2600067FB10BD05F0DEFD10BD10B51A49097839 +:10E27000002902D002F0D6FB10BD05F02FFE10BD24 +:10E2800010B515490978002902D003F0C2FB10BD72 +:10E2900006F098FC10BD10B50F490978002902D08E +:10E2A00002F092FD10BD05F0BEFF10BD10B50A4989 +:10E2B0000978002902D004F058FC10BD05F0BBFB22 +:10E2C00010BD10B5044A1278002A02D004F04EFCAA +:10E2D00010BD05F0BFFB10BD7A00002070B5FC4DED +:10E2E00000246C702C70AC616C72AC720120E8720E +:10E2F000F8484470C473AC62F7482C6302F041F9EB +:10E30000002804D0FF20F5A14E300DF0F0FD2C7751 +:10E3100070BDF8B5F54902250D60F5490026CE63BC +:10E320000127CF63F349C96A09070DD4F24AD36ABA +:10E33000F2494B62136B8B62536BCB62936B0B6333 +:10E34000D26BCB051A434A63ED4C002823D0012839 +:10E3500025D0FF20E1A1A1300DF0C9FDE948A0635F +:10E36000FF2004306063276303202061E649962084 +:10E370004860D7491C2008560B22D243811A90428C +:10E3800037D011DC1C313AD00A2938D0142934D0C6 +:10E39000182911D12FE0DD486061DD4802E0DD4839 +:10E3A0006061DD48A061D9E708301FD004281BD088 +:10E3B000082817D00C2812D0FF20D8A175300DF0F6 +:10E3C00096FDDB49D9488860DB48DA494160DB4982 +:10E3D0000160DB480560DB4910204860F8BD04207F +:10E3E000E060EEE7E660ECE7FC2000E0F820E060AB +:10E3F000E7E7F420FBE7F020F9E7EC20F7E7D82087 +:10E40000F5E710B50C460146CF480DF072FEB04856 +:10E41000047210BDAF4840787047AD4A517010701B +:10E420007047F8B504460D4650791179000208434B +:10E43000690009190884501C01460E7801273046EE +:10E440004E78360230438E78C97836043043090658 +:10E450000843117800020843A9006050284608309C +:10E460003E468640002B0CD0012B04D0FF209BA100 +:10E47000E8300DF03CFD206B3043AF403843206363 +:10E48000F8BD206BB043F8E770B50D460446082987 +:10E4900004D9FF2091A1F9300DF029FD0022002DB3 +:10E4A0000CD9AA489100635809180B6053001B1936 +:10E4B0001B8C0B62521CD2B2AA42F3D3206BA4492C +:10E4C000086070BD10B504460B22D2430C308C4955 +:10E4D000944223D008DC1C3026D00A2824D01428EB +:10E4E00020D0182809D11BE02046083014D0042879 +:10E4F00010D008280BD00C2807D0FF2087A175303A +:10E500000DF0F5FC7248047710BD042000E00020F7 +:10E51000C860F7E7FC20FBE7F820F9E7F420F7E70D +:10E52000F020F5E7EC20F3E7D820F1E76948007B1D +:10E5300070477349C2784A62024613781846537886 +:10E540001B0218439378D2781B0418431206104319 +:10E550000002C8617047252808D0262808D027283F +:10E5600008D041000A2807D8091D06E0022105E06D +:10E570001A2103E0502101E0891DC9B2604A91606F +:10E5800061494861704752498861704770B50028F9 +:10E5900017D002224E4C6F4BA27203201860644DBC +:10E5A0006248686000200126207500290BD00129EF +:10E5B00010D002291ED0952048A180000DF097FCB4 +:10E5C00070BD0122E6E76448012A01D0466070BDB3 +:10E5D000066070BD3E48012A006B05D00121490547 +:10E5E00008432063696070BD012109050843206369 +:10E5F000696070BDA069002803D138A157480DF0AB +:10E6000076FCA169A06A4018554988604A48554976 +:10E6100081605549C1600120216BC0030143216322 +:10E6200068602C48C67370BDF8B54A4801688F0809 +:10E630004449BF004A68D206D60F10228A600024DF +:10E6400004603B48394981600C2069460870474D99 +:10E650002C614149012008610BE000BF00BF00BFF1 +:10E6600000BF00BF00BF00BF00BF69460878401E62 +:10E67000087068460078002802D028690028ECD08D +:10E6800068460078002803D124A139480DF02FFCFA +:10E690002C610F48012144728472C1722D480760B9 +:10E6A000002E02D0274910204860F8BD01460A78A4 +:10E6B00010464A78120210438A78C978120410432F +:10E6C0000906084300020E49000AC86370470000AB +:10E6D0006C1A00208C1A0020A01A00207372635C50 +:10E6E00068616C5F7263732E6300000080E100E07C +:10E6F000C01F004080000010C00000100017004044 +:10E70000001500405B0600004015004006010200B5 +:10E7100025000302050103001F0003027372635CFE +:10E7200068616C5F7263732E630000000040000438 +:10E7300000F501404080004080F50140101100408C +:10E7400080E200E0001300406E1A00200016004036 +:10E750004016004000120040001000404702000038 +:10E7600040850040488100401010004000110040EA +:10E7700067020000F94902200860F9490860704703 +:10E78000F849022008607047F7490870704710B5D3 +:10E79000F64801F0FEFE002803D0F549F5480DF0DB +:10E7A000A6FB10BD10B5F14801F00BFF10BDF249FA +:10E7B0004860704770B5F14C0546A06AA84203D383 +:10E7C000EB49EF480DF093FB01202073ED49002049 +:10E7D00025614860EC4845600120216B80050143BC +:10E7E0002163EA49486070BDE44802210173C621F3 +:10E7F0000161E44A00215160816AE34AC6315160F7 +:10E800000121026B89050A430263E04841607047B9 +:10E810000121DE4889058160D848026B8A430021C6 +:10E82000026301737047DA4801214160C160D54934 +:10E8300000204860D4494860D04988627047D54973 +:10E8400040200862D4490A6802430A607047D248EF +:10E850000168402291430160CE4900200862704760 +:10E86000CD480168102291430160CC4901208861A4 +:10E870007047CB490020C861C74801681022114386 +:10E8800001607047C649CA69012A01D0002070475B +:10E89000C04A92685206520E524202700020C8616D +:10E8A0000120704770B50C00054603D1B049BD4842 +:10E8B0000DF01DFBE00706D0012C04D06D20AC4903 +:10E8C000C0000DF014FB002D0DD00221AB48012932 +:10E8D0004172C472B04808D002290BD0A449B24892 +:10E8E0000DF005FB70BD0121F0E701680422114322 +:10E8F000016070BD016808221143016070BDF8B568 +:10E900009E4C0025E27A910701D5410713D4D30626 +:10E91000A649002B05DA4B7B002B02D08B7B002B0A +:10E9200009D0130702D50B78002B04D1520703D569 +:10E930004978002900D10125677A002201239649F0 +:10E94000002F1BD002263040284347D008460168DC +:10E950008E089749B6004D68ED06ED0F10278F60C1 +:10E9600000210160894A934890600C206A4610702B +:10E970008B4F396189490120086114E0834D8D482E +:10E98000A8600868800880000860A272E372F8BD81 +:10E9900000BF00BF00BF00BF00BF00BF00BF00BF7F +:10E9A0001078401E10701078002802D038690028B6 +:10E9B000EED01078002803D17F4980480DF097FAF7 +:10E9C000002038616072A0720120E0727248066017 +:10E9D000002DDCD0764810214160F8BD012F06D013 +:10E9E000022F0CD0624976480DF081FAF8BD086814 +:10E9F0000425A84308606272E372A372F8BD086838 +:10EA00000825A84308606272E372A672F8BD5B49EC +:10EA100008757047F8B5654E5848F37B604C002583 +:10EA2000016B002B55D0594AE3139360994301635E +:10EA3000594807685E4B102199600021016000145D +:10EA400090600C206A4610702161544801250561D0 +:10EA50000AE000BF00BF00BF00BF00BF00BF00BF93 +:10EA600000BF1078401E10701078002802D0206976 +:10EA70000028EED01078002803D14F494F480DF000 +:10EA800036FA0020E060206160606061A061424869 +:10EA900007603E4900144860454910204860374CE3 +:10EAA000A07A01280FD0022810D0434945480DF024 +:10EAB0001EFA0020F073207D022803D1424801682D +:10EAC0008907FCD5F8BD35480560F2E73348456055 +:10EAD000EFE72E4A91600563017B002903D02949A5 +:10EAE0004968012908D000222169012906D00023A4 +:10EAF000817A012904D006E00122F5E74023F7E7F7 +:10EB0000E768012F04D000271F43012902D004E049 +:10EB10002027F9E76368012B05D000233B432B4FE7 +:10EB2000022902D007E01023F8E73868012802D153 +:10EB3000E068012804D000201843022902D007E031 +:10EB40000820F9E73B68002B02D1E368012B3FD096 +:10EB50000023034302293DD040E0000080E100E0B3 +:10EB600080E200E000E100E07B000020A01A00202D +:10EB7000DCE60000A1020000001500406C1A002035 +:10EB8000B2020000408100404085004000F5014095 +:10EB9000008000404015004000120040001000407E +:10EBA00000110040630300007D0300008C1A002068 +:10EBB00000130040004000041CE700006702000052 +:10EBC000CE0300005D03000000E200E000140040FE +:10EBD0000423BEE7002A01D0022200E000221A43EB +:10EBE000022908D16068012805D1824840680128BF +:10EBF00001D0012700E000277F481743016809067C +:10EC0000090E02D06169012900D00021317300682A +:10EC10000006000E02D0A069012800D00020707309 +:10EC20007648006A002803D000F0B9F9012800D026 +:10EC30000020B073E560256165606561A5616D4880 +:10EC400045606F4C6F4825754168616200680B46EE +:10EC5000A062A17A022909D16178002906D06A4A06 +:10EC6000526812780A40217891430AD03570F9072A +:10EC70000AD01846FFF71AFB0121A06AFFF721FB13 +:10EC80000BE001213170F2E7B90601D5022102E063 +:10EC9000B90702D50021FFF714FB5B484168062243 +:10ECA000A01C09310CF06CFF002808D15648217ACD +:10ECB00040680078C009814201D1012000E00020B5 +:10ECC00070703846FFF71BFE5048007800280DD0C2 +:10ECD00001281ED002282FD003284AD04C494D4885 +:10ECE0000DF005F9A07A022856D074E0B80701D5D6 +:10ECF0000BF0D9F8380702D501200BF010F978078E +:10ED000002D500200BF00BF9B806EBD50BF06DF82F +:10ED1000E8E7B80701D50CF09DFB380702D50120C4 +:10ED20000CF03FFA780702D500200CF03AFAB8064A +:10ED3000D8D50CF0B5F9D5E7B807BF26002802DA18 +:10ED4000374009F03BF9380703D53740012008F078 +:10ED50006EFD780703D53740002008F068FDB8063F +:10ED600002D5374009F06EF87806BBD508F05BFD98 +:10ED7000B8E7B80701D509F0D7FF380702D5012059 +:10ED800009F0B6FE780702D5002009F0B1FEB806FA +:10ED9000A8D509F03EFEA5E7217B00291BD0154828 +:10EDA0004560022920D0012903D019491A480DF0E5 +:10EDB0009EF8A16A2069884203D8154917480DF0CA +:10EDC00096F81048216941600120216B80050143BC +:10EDD000216313494860207D012800D072E6114864 +:10EDE00001688907FCD5F8BD2169A06A411805486A +:10EDF0004160E9E740810040401600404015004076 +:10EE00006C1A002040850040001500407B00002067 +:10EE1000DCE60000E6040000FB040000FC04000047 +:10EE200000F5014000E200E02E4800210170417031 +:10EE3000704770B5064614460D460120F2F7C2FA37 +:10EE400028490120284B08709E60DC601D6170BD60 +:10EE5000F8B504460120F2F7B5FA224901200870FE +:10EE600021494C60214900264E600321204D0906AE +:10EE7000A960204F002C0AD0012C03D01EA14120F4 +:10EE80000DF035F83E60032000066860F8BD38607C +:10EE900001200006F9E710B51248017800290ED0CC +:10EEA0000321134A0906916010494A680021002A8B +:10EEB00003D0154A1268427000E0417001700020D2 +:10EEC000F2F780FA10BD07480178002907D00748FB +:10EED0004068002802D00C480068C0B270474078F3 +:10EEE000704700007C00002000F5004000F1004069 +:10EEF00000F5014000F200407372635C68616C5F72 +:10EF000063636D2E6300000000F400403B48002165 +:10EF10000170417010218170704770B5064614462B +:10EF20000D460220F2F74EFA01203449344A0870A7 +:10EF3000E41E14619660556070BD10B50220F2F7B2 +:10EF400041FA2E49012008702E48002101604160DD +:10EF5000816001202C49C005486010BD10B52748CC +:10EF60000178002917D00121274AC9059160254958 +:10EF70000B680022002B05D04B68002B02D089685B +:10EF8000002902D04270102103E0012141701F4985 +:10EF90000968817002700020F2F714FA10BD17485A +:10EFA0000178002912D01748016800290AD00168A9 +:10EFB000002905D04168002902D08068002803D0CC +:10EFC000002070470220704701207047407870474A +:10EFD0000A48017800290FD00A480168002905D0A5 +:10EFE0004168002902D08068002801D010207047B5 +:10EFF00006480068C0B27047807870477E000020E5 +:10F0000000F5004000F1004000F5014000F4004030 +:10F01000FFB593B0044600201D9E049015981C9DDA +:10F020001027082806D0E06901F014F8002809D05C +:10F030003770CCE028880921384328801F980227A0 +:10F04000017016E0E169012088710521E269C902B9 +:10F050009180E1698872E169F9480881E1690020DD +:10F060008873288820210843288011211F980427AD +:10F0700001701F980225801C0390307810900A20A0 +:10F080003070204618301190F7F789FA00206FE0B1 +:10F090001598102809D1022D07D06846828A049954 +:10F0A0000398401A8270110AC1706846C08A169986 +:10F0B000884203D9E349097A149106E0884204D1D1 +:10F0C0001099002901D0317021E003990870000ADD +:10F0D00048701E980088401BC01B83B2FF20C01BD5 +:10F0E000984200D203460398149AC0190CA90092C2 +:10F0F000019002912020015D6846C08A0022F7F746 +:10F10000C3FA3070002806D0C0B2832862D06846A7 +:10F11000C08A208345E00F98002805D0C9480068C0 +:10F1200000790A2830D33CE06846008EC119C9B284 +:10F130000491022D0FD01F99049A4978914203D16E +:10F140006A46128C824209D0BE4804910068017858 +:10F15000032909D027E008461F994870B94800687C +:10F160000178042906D008E000790A281BD2012082 +:10F170000F9009E06946C98A8180039904980818AC +:10F1800003900498281885B205AA14991198F7F7E6 +:10F1900009FA002805D11E980088401BB84200DB00 +:10F1A00076E7022D0ED01598102807D1049A0399FE +:10F1B0006846808A891A8870000AC8701E9805807F +:10F1C000002030709F4800680078032802D000209B +:10F1D00017B0F0BD0220FBE7F8B50446406B0026EF +:10F1E000134600282BD0491F8DB2618F2A46083262 +:10F1F000278F8A18BA4221D89A7840185F7811026E +:10F2000039430170090A41701A79DF7811023943D4 +:10F210008170090AC1700571290A41712A46591D78 +:10F22000801D0CF0DAFC608FAD1D401980B2608744 +:10F23000626B002110180170417000E00926304611 +:10F24000F8BD30B50B88048F9C4212D9446BE0188E +:10F250004478057824022C430BD0447905792402A4 +:10F260002C436404640CA41D1B190B801060002047 +:10F2700030BD822030BDF7B588B0002568460582D4 +:10F2800005275DE00398417802780E021643417924 +:10F29000027908021043000452D40A980123068020 +:10F2A00005A802905B02002200970195304609995B +:10F2B000F7F7EAF904004AD16846018A0183039806 +:10F2C0004179027909021143437802781C02144300 +:10F2D000B4421ED10A041CD44B0401215B0C8903E7 +:10F2E00000950B4301970295C17880780A0202438A +:10F2F00020460999F6F7E4FF040011D103994879F3 +:10F300000A79000210430122D20310430871000A57 +:10F31000487103AA06A90898FFF793FF0400CED00E +:10F3200003990095019702954878097800020843EF +:10F3300069468B8A00220999F6F7C2FF822C06D112 +:10F3400003AA04A90898FFF77CFF04009AD0684636 +:10F35000058209E0039841790279090211434904C1 +:10F36000490C0171090A417103AA04A90898FFF721 +:10F3700068FF0028EED0822C02D020460BB0F0BDF2 +:10F380000020FBE730B50446406B002597B000280D +:10F390000DD00B2268460270228F0281606B0391B0 +:10F3A000019000216846F4F736F9684605706563F8 +:10F3B0006587258717B030BDF8B50F460546696BE0 +:10F3C0000020069E144600290FD0012B0DD1324695 +:10F3D00039462846FFF74FFF002806D1002C04D0FD +:10F3E00032463946284600F044FEF8BD002202802D +:10F3F000C262831D0263C361426342870287203079 +:10F400000170704710B50022D24302800420FDF73E +:10F4100014F910BD10B596B00446FFF7B3FF208E67 +:10F42000002808D0012069460870E06A0190002198 +:10F430006846F4F7F0F80020E062206316B010BDD3 +:10F4400001280000A41A00200146098800200A07AC +:10F4500000D501200A06120F01D002221043CA056E +:10F4600001D5042210438A0501D510221043490515 +:10F4700001D5202108437047FFB5A9B00600329D91 +:10F48000359C2B981F46229016D0007841060FD449 +:10F490008106890E1E2909D021884A05520E0BD1FA +:10F4A0003A88172A08D3FE4A914205D0C10906D0EE +:10F4B0008006800E122802D003202DB0F0BD204619 +:10F4C0002C302690F7492A980872002018AA039039 +:10F4D00010726A46107404AA0A60339A4A6020AA1D +:10F4E000908090812298007801908106681C1C9081 +:10F4F000701F1D902B98890EC21C24922246203228 +:10F500001B92083A401C02920B000CF01EFE1FFDDD +:10F51000FD11FD1FFD8EFDFCFDFBFDFAFDF9FDFC5F +:10F52000FDF8FDFDFDF7FDF6FDFDFDFDFDF5FD0022 +:10F53000032E76D102E018A9087219E3032028707F +:10F540001C9917220A7000224A70CFE2052EF0D1D2 +:10F550004178027808021043208320A98880249AE9 +:10F560005178127809021143618300287ED08842C5 +:10F570007CD800202072E080401E60840298F7F75B +:10F580000EF805202870A81C0190022000901BAAEC +:10F590002A990298F7F706F8002868D118A8807C05 +:10F5A000012803D002206870102002E0012068705A +:10F5B00002202490002225A91CA8F3F784FB002830 +:10F5C0002BD120A8007D2499814226D13A88009928 +:10F5D000801C511A814220DB10A8C18D0198017056 +:10F5E000090A417001991CA8891C01910099019A8E +:10F5F000891C009125A9F3F766FB20A8007D0199DD +:10F600001BAA091801910099081880B200902A9944 +:10F610000298F6F7C7FF0028CCD00098022826D021 +:10F6200064E272E018A9087261E2072E6DD3417896 +:10F630000346027808021043208320A98880249A78 +:10F640005178127809021143618300280ED0884254 +:10F650000CD8012020725879197900020843E08003 +:10F6600000202073E06900F0F5FC01E098E0A9E0DB +:10F6700000280ED1E169012088710521E269C902E3 +:10F680009180E1698872E16987480881E169002019 +:10F690008873F01F60842298C01D60620298F6F79C +:10F6A0007EFF07202870681C009001200190002038 +:10F6B00010A9C8852FE00198012814D0E06980794D +:10F6C000012830D000981E38417F007F0902014395 +:10F6D00000980170090A41700098801C0090019800 +:10F6E000801C80B2019010A8C18D00980170090A99 +:10F6F00041700098801C09E00AE296E13BE1DFE0FE +:10F7000004E29BE077E036E016E2AFE0009001987B +:10F71000801C80B201901BAA2A990298F6F742FF3A +:10F72000002803D007E010A8818DD1E7398801981F +:10F73000081A0428BFDA0198012843D0E0698079CB +:10F74000012804D010A8818D5548814206D110A807 +:10F75000818D00980170090A417009E000981E38F7 +:10F76000417F027F0802009910430870000A487028 +:10F770000198801CBAE1072E01D0152E76D1417870 +:10F78000027808021043208320A98880249A5178A7 +:10F790001278090211436183002801D0884201D9FF +:10F7A00001203FE7012020720020E0802073052E19 +:10F7B0000AD01D982299E269C0B2491DF3F75DFA9B +:10F7C000002801D00A202DE70020C04360841AA839 +:10F7D000019023A9229802970395009100780023B5 +:10F7E0008206920E20462A99FFF712FC0390208B86 +:10F7F00020A988807BE1032EC0D1402220A98A81E4 +:10F800004178027808021043208320A988802A9931 +:10F810001EAB1C9A02930192009139880022491E66 +:10F820008BB21B990978F6F72FFF18A908720028E8 +:10F8300033D10B20287010A8008F3FE0052E9DD1FA +:10F84000802220A98A81417802780802104320830F +:10F85000249984464A78097812020A43628420A9CE +:10F8600088801248824202D30720DBE6AFE03F20C7 +:10F870008002024362842A981FAB1C990293019173 +:10F8800000903888401E83B21B9801786046F6F7D6 +:10F89000FBFE18A9087200280CD08328AAD107E023 +:10F8A000FFFF0000A41A0020012800000102000050 +:10F8B0000220B8E00D20287010A8808F401C15E1B0 +:10F8C00001990C22C9095143C91CB14204D90198BC +:10F8D00040067CD5002009E14278037810021843E5 +:10F8E00020AA9080844622980078400609D50520F9 +:10F8F0006A46107422980078C00905D00020107460 +:10F900001DE106206A46107424981F902A9A0090E0 +:10F910000023701A029383B21E9001921B9800225A +:10F9200001786046F6F7CCFC18A9087200226946F7 +:10F930000A74832801D1022003902298007840069F +:10F940000DD52088C00506D520A9208B898888423E +:10F9500001D100206062002018A90872C6E0FF21D2 +:10F96000013120A88181808820831E9860841F989F +:10F9700060621320B8E0052E29D34178027808028E +:10F98000104320A98880218F002902D0FE4A91428D +:10F9900006D10A216A4611740121C943218702E078 +:10F9A00007216A46117422992A9A491D01920091F1 +:10F9B00001221D990023D203029311438BB2249993 +:10F9C0004A78097812020A431B99097800E0C9E0D5 +:10F9D000F6F776FC18A90872002269460A7401221B +:10F9E000520220A98A81832808D0002809D0218FBB +:10F9F000E54881427ED10020208778E088882083F6 +:10FA00004DE7606B002808D031462046229AFFF768 +:10FA1000E3FB18A90872002869D12B463A46304604 +:10FA2000229900F056FB039061E02298022E407864 +:10FA300001907DD1002801D0012879D108206946A4 +:10FA400008740198087521A800901B98002201787D +:10FA50002046019BFFF7B0FC6946002248758A7575 +:10FA6000002802D10198012809D0208F002806D053 +:10FA7000002008740120800220A988810EE004A8DB +:10FA80003399F3F7C8FD03900020694608740120FC +:10FA9000800220A988810398022807D0BB4800680B +:10FAA0008079002805D018A908722BE001982083DE +:10FAB0001DE00398002803D0812018A9087240E0B7 +:10FAC00021A800901B98012201782046019BFFF796 +:10FAD00073FC18A9087220463499FFF753FC18A943 +:10FAE000087A002803D11920287001203880684640 +:10FAF000007C00E03CE0002804D004A83399F3F730 +:10FB00008AFD0390039800282ED01AE0062012E503 +:10FB10002078000713D5012E11D109216846017400 +:10FB2000A188818204203499FCF787FD082100E038 +:10FB300005E020A88181CDE60198400612D503207A +:10FB4000039020A9208889890843208020A98889DA +:10FB50004005400E04D026992B9808602698868090 +:10FB60000398AAE40420E6E418A8007A00280ED03E +:10FB70000120287022980078687020A88088A870DA +:10FB8000000AE87018A8007A28710520388020A99A +:10FB90002088898988432080E2E7FFB50746A1B025 +:10FBA00000201C903A7801209040794A7C681040EF +:10FBB00010AA1087744B22885B1C9A4203D000283D +:10FBC00004D0100702D5012025B0F0BD249E0020EE +:10FBD000307023980025028810A8028518A80575A2 +:10FBE0006A4B68461972057404A8186020462C30C8 +:10FBF0001B902A985860249E94463878721C0521E0 +:10FC0000039201282DD0022808D003287DD1307816 +:10FC1000800980011D303070B889A08038780228B2 +:10FC200004D13078800980011B303070F01C1FAA8D +:10FC300001900292009110A8008D0022C01E83B294 +:10FC40002020015DB889F6F71FFD0028DED103985A +:10FC5000B9890170090A417010A9888FC01C0885F4 +:10FC600028E1787B18AA10753A7B012A02D0022A73 +:10FC7000CCD1FCE022887F231B011A4010AB1A87ED +:10FC8000802A4AD006DC102A10D0202A0ED0402A22 +:10FC90000AD124E0FF3A013A65D0FF3A013A79D01F +:10FCA000FF3AFF3A022A76D00525A2E02078C00666 +:10FCB00001D5082000E010201C9004206A46107432 +:10FCC000002090821AA81DAA1EAB039601920290F2 +:10FCD00000933B8A20461C9AFFF79AF984E0228B16 +:10FCE0003B8A9646934268D10A221C92002839D159 +:10FCF000039801906046401E1FAA83B20292202002 +:10FD00000091015D0022704600E0BAE0F6F7BCFC0D +:10FD1000014618A801750B201AE0228B3B8A9646F3 +:10FD200093424AD10C221C92002862D10398019080 +:10FD300060461FAA401E0292009183B22020015DFE +:10FD4000628C7046F6F7A0FC014618A801750D20DC +:10FD5000307010A8818F491C018504216846017408 +:10FD6000218B818245E0238B3A8A9C469A4224D19A +:10FD700012221C9200283CD1606A002813D0002275 +:10FD80006B4607C3638C07E0FEFF0000A41A002047 +:10FD900009F800000DE04BE02020015D6046F6F719 +:10FDA0008FFA18A9087513203070012010A9088552 +:10FDB0001FE0398A228B914201D00425B6E016213A +:10FDC0001C91002815D11B98818802682046FFF7F6 +:10FDD00003FA18A9087500280BD11B98334601684F +:10FDE00080881AAA00F075F9054602281BD0042D58 +:10FDF00019D01B988088002811D06846007C002804 +:10FE000004D004A82A99F3F706FC054601206946A8 +:10FE100008741B981B990068059000208880002DAD +:10FE200048D0052D2ED06846007C032878D07DE090 +:10FE300018211C91002806D0388A20832046B968F2 +:10FE4000FFF7A0FAD5E72046183000902020015D8A +:10FE5000237E01222046FFF7AFFA18A90875002873 +:10FE6000ECD119203070012010A90885E6E7208820 +:10FE700001214902084010A90887FF38FF380228ED +:10FE800006D0052510A92088098F884320804DE0E1 +:10FE9000208F9849884290D116201C9038690028FC +:10FEA00005D06063B88A20870020608702E00020C8 +:10FEB000C043208710A8008F7F21090102468A4392 +:10FEC0000DD0782300220420B968FCF711FB3878A4 +:10FED000A07010A92088098F0843208002E02188A3 +:10FEE000814321806846007C002805D08248416813 +:10FEF00004A8F3F790FB054618A8007D002815D04C +:10FF00001C98707001203070208BB070000AF07067 +:10FF100018A8007D3071052110A8018506E0FFE7D3 +:10FF20007548416804A8F3F776FB05467248017AE4 +:10FF300020884005400E22D11B98808800281ED0C2 +:10FF4000239A0026138810AA1385249A2A9B6F46A9 +:10FF50004CC71B9A039412681AABFFF78DFA05463B +:10FF600002280CD00120694608741B982A99006861 +:10FF7000059004A8F3F74FFB05461B98868010A850 +:10FF8000018D2398018028461EE600B597B004280D +:10FF900007D102206A461070019100216846F3F7EC +:10FFA0003AFB17B000BD10B5534C0378002221680E +:10FFB000012B02D0022B42D126E00B78002B01D07E +:10FFC000042B03D10A7122680321117021688388F0 +:10FFD0000A79D200921D8B5221680A79D200083228 +:10FFE0008918C2880A80216803890A79D2000A32F6 +:10FFF0008B52428920680179C9000C314252216834 +:020000040001F9 +:100000000879401C08711EE00A7482888A80216881 +:10001000C288CA8022680189118122684189518180 +:10002000C1682068C1606168F3F7F5FA01460228EB +:1000300007D02068007C002802D1002903D081204D +:1000400010BD832010BD002010BD406B002800D0E3 +:10005000012070478178012909D100880521C90252 +:10006000884202D0491C884201D1002070470520F7 +:100070007047F7B586B00024684615460F46848160 +:1000800005261AE004984178027809021143298074 +:10009000811D019602940091417902790B0213436C +:1000A000C178827809020A4341780078090208433E +:1000B0003946F6F705F9002806D104AA03A90698DF +:1000C000FFF7BFF80028DDD0822800D1002009B05A +:1000D000F0BD10B51488844201D2052010BD17244C +:1000E0001C701080421E581C491C0BF076FD00202D +:1000F00010BD0000FEFF0000A41A002030B503462A +:10010000002002460DE09C5C2546303D0A2D02D3BE +:100110000020C04330BD0A25684330382018521CE7 +:10012000D2B28A42EFD330BD70B50D46144608E016 +:100130000A210BF0BBFD2A193031203A641ED17719 +:10014000E4B2002CF4D170BD10B5002310E0040A15 +:1001500000020443A0B2CC5C44402006000F604083 +:100160000407240C44402006C00C60405B1C9BB27A +:100170009342ECD310BD000010B572B600F0DFF86A +:1001800000280BD0F1F78CF8FCF70BFC05F0FFF919 +:100190006F490020C86288626E49086062B600201C +:1001A00010BDF3B5002501200007C06A81B0C0432F +:1001B0000006000E04D168480068401C00D10125EB +:1001C00072B600F0BCF8002802D062B60820FEBD6E +:1001D000F0F7BCFFF1F768F8604C614A0021236832 +:1001E000CB40DB071FD00346CB40DB0718D14BB217 +:1001F000002B07DA1E07360F083EB608B600B61801 +:10020000F66904E09E08574FB600F61936689B075A +:10021000DB0EDE4033069B0F012B04D0032B02D0F4 +:1002200062B65148FEBD491C2029D8D3019C01204B +:100230004E4923000BF089FF142224242424242473 +:1002400024240B0D1012142016181A1C1E2F002423 +:1002500000E00124C86314E00224FBE70324F9E76B +:100260000424F7E70824F5E70924F3E70A24F1E773 +:100270000B24EFE70C24EDE70524EBE7072400E06F +:100280000624D06901210002000AC9070843D06191 +:10029000002D04D009E062B601200003FEBD2C4D04 +:1002A0003348E862F1F700F8A8622A49314808604B +:1002B000314902980860F0F7F7FF214605F04EF942 +:1002C000FCF735FB05F056FB05F0CAF90198F0F78D +:1002D000B5FF040062B603D0FFF74EFF2046FEBD17 +:1002E0000020FEBD10B5044600F029F8002800D01B +:1002F00001202070002010BD2049086000207047B8 +:1003000010B50C46102808D011280BD012280CD09C +:1003100013280ED00120086010BD61682068FFF727 +:1003200040FF0AE0FFF728FF07E02068FFF7DAFF49 +:1003300003E01249206808600020206010BD0548D5 +:100340000C490068884201D10120704700207047A5 +:1003500000050040600000200010001000E100E0F7 +:1003600000ED00E000E400E001100000400000406B +:1003700000280000BEBAFECA84000020040000204D +:1003800010B520380C4603000BF0DFFE33A6AAAEF2 +:10039000B2B8BCC0C5E0DBE41B1F23272C31373CBF +:1003A00041474D5054585C606D71656974787C802C +:1003B00084888C9094989C9FA2CACFE9F0F3D3D7FD +:1003C000F800206800F0DDF8D6E0206800F0E1F8E1 +:1003D000D2E0206800F0F5F8CEE0207840B204F0DA +:1003E0002DFFC9E0207840B204F04BFFC4E0207834 +:1003F000616840B204F05EFFBEE0207840B204F0D5 +:100400006EFFB9E0207840B204F079FFB4E02078C4 +:10041000217940B204F084FFAEE02078616840B2F8 +:1004200004F0AEFFA8E004F0BAFFA5E0206804F0F5 +:10043000BEFFA1E0207804F0D3FF9DE02068FBF729 +:1004400062FE99E02068FBF762FE95E02179206862 +:10045000FBF764FE90E02068FBF704FD8CE0206869 +:10046000FBF705FD88E02078FBF705FD84E0FBF74E +:1004700013FD81E02078FBF715FD7DE02078FBF788 +:1004800027FD79E02068FBF740FD75E02068FBF769 +:1004900042FD71E02068FBF744FD6DE02068FBF74A +:1004A00045FD69E02068FBF747FD65E02068FBF744 +:1004B00049FD61E02068FBF74AFD5DE00846F0F782 +:1004C0005DFE59E0F1F757FF56E0F1F784FF53E086 +:1004D0002068F1F78CFF4FE0206800F0E1F84BE076 +:1004E000206800F0E9F847E0206800F0F0F843E009 +:1004F0002078A268616800F0F5F83DE0207800F00F +:1005000006F939E0207800F017F935E020786168C5 +:1005100000F027F930E02078616800F03AF92BE02C +:100520002179207805F06CF826E0206800F06BF85F +:1005300022E02068FCF728F91EE02068FCF70CF99F +:100540001AE0204607C805F056F915E0206805F0C6 +:10055000A9F911E06168206805F0D4F90CE0206881 +:1005600005F0C6FB08E009E003E0FFE705F0D8FB73 +:1005700002E0206805F010FC206010BD012008603A +:1005800010BD002101700846704701460020087028 +:100590007047EFF31081C907C90F72B60278012ABC +:1005A00001D0012200E0002201230370002900D1C4 +:1005B00062B6002A01D00020704701204003704736 +:1005C000E7E7EFF31081C907C90F72B60022027086 +:1005D000002900D162B600207047F2E710B5284824 +:1005E000FFF7CFFF002803D026A11D200BF07FFCD2 +:1005F0002348401CFFF7C5FF002803D021A121207C +:100600000BF075FC10BDF1B5224D6F6801261C483A +:10061000FFF7BFFF1A4C002803D10026601CFFF72C +:10062000D0FF1D4A1D490120506000BF00BF00BF20 +:1006300000BF00BF00230B604B60009B6B6010602D +:1006400000BF00BF00BF00BF00BF0868002802D184 +:1006500048680028F9D048680028E4D1002E04D06A +:100660006F60601CFFF795FF07E0601CFFF791FFCC +:100670000028D3D10248FFF7A4FF0020F8BDC2E74D +:10068000880000207372635C736F635F6563622E22 +:100690006300000000E5004000E0004000E1004091 +:1006A0005A495B4B0A685B499A42096801D189043F +:1006B000890C0160002070475449554B0A68554920 +:1006C0009A4201D18004800C4860002070474F4955 +:1006D0004F4B0A684F499A4201D18004800C8860D0 +:1006E0000020704730B5494B494D1C684A4BAC421D +:1006F00002D0102802D203E00E2801D3184630BDE4 +:10070000C3004448181801614261002030BD3F49D0 +:100710003F4B0A684049491C9A4202D0042802D241 +:1007200003E0022801D3084670473C4A0121C0007B +:1007300080180160002070473449354B0A683649FB +:10074000491C9A4202D0042802D203E0022801D3B5 +:1007500008467047314A0121C000801841600020DE +:10076000704770B5294A2C4B14682D4E284D8200D5 +:100770005B1C9219AC4203D0042803D2116006E03E +:10078000022801D3184670BD8804800C1060002038 +:1007900070BD70B51D4A204B1468214E1C4D82005F +:1007A0005B1C9219AC4203D0042803D2106806E007 +:1007B000022801D3184670BD10688004800C0860C0 +:1007C000002070BD10B5134A164890600E2000211D +:1007D000C3009B1819615961401C1028F8D30020F0 +:1007E0000F4A05E0022803D383009B18196005E037 +:1007F00083009B181C68A404A40C1C60401C0428E3 +:10080000F0D310BD0349074888607047600000209E +:10081000BEBAFECA00F501400820000000F0014009 +:1008200000F8014000C0FFFF10B5FFA1086882B0CA +:10083000496801910090FE490020887604228A834D +:100840001022CA83FB4AFC4B0A849A84FB4AFC4C64 +:1008500090762070907390748871907708725877B2 +:10086000F848694604460BF062FC2146F64808F059 +:10087000CCF802B010BD10B5F44C6060A17001203E +:1008800006F036FA05F030FBFFF7CEFFA07801F056 +:100890006CFF06F066FE606807F090FF0024EC48ED +:1008A00021460471EB4806F00BFEEB482146047725 +:1008B000EA4806F00EFE10BD70B582B00E461D4629 +:1008C000144601A905F047FB00282ED1019880307D +:1008D000807C06F05FFA002807D0684606F06AFAC6 +:1008E000002808D0002C0CD107E05120DCA1C0006A +:1008F0000BF0FDFA002002B070BDD9A1DD480BF06D +:10090000F6FA009805F092FD3146009805F093FD47 +:10091000E2B22946009805F04BFF06F074FA002871 +:1009200003D1CFA1D4480BF0E2FA012002B070BD90 +:1009300030B40179002904D0012909D030BC00204D +:1009400070470488831D4288204630BC0221B3E7EB +:100950000488831D4288204630BC0121ACE7FFB5E6 +:10096000B34C83B00E460746208C69460880154676 +:1009700002A905F0F0FA002807D0684605F0F9FA58 +:10098000002802D0002007B0F0BD6846008820840F +:10099000AF4805F0EEFA002802D00020C0432084C2 +:1009A00068460088388002A905F0D5FA002803D0EF +:1009B000ABA1B2480BF09BFA02988030807C06F025 +:1009C0000FFC002803D1A6A1AD480BF090FA01A8B6 +:1009D00006F016FC0028D6D0019805F063FD3070B3 +:1009E000022808D0012806D09DA1A6480BF07FFA66 +:1009F000002007B0F0BD0699019805F0F0FE2880B0 +:100A0000002804D1172096A140010BF070FA06F0DF +:100A100023FC002803D192A19B480BF068FA012027 +:100A200007B0F0BD10B584B00446831D02AA694624 +:100A300001A8FFF794FF002813D068468088208023 +:100A4000684600896080002060716846007801284F +:100A500009D0022807D0FF2081A131300BF047FADE +:100A6000012004B010BD2071FAE7F0B58BB005008D +:100A700004D1FF207AA1D4300BF039FA6F4C002753 +:100A8000A07E00280AD06F7010202870E07EA87029 +:100A9000207FE870A77601200BB0F0BD6848007891 +:100AA000002809D0664C2C22A11C28460BF095F892 +:100AB0000E20287027700BE0A07B00280BD00120AF +:100AC000E870E07BA870207C68700F202870A77306 +:100AD00001200BB0F0BD6D48099005F04AFA0146BF +:100AE000A81C534E019000297ED153480790808C5A +:100AF0000890079804A9808C0390684607750398AE +:100B000005F029FA002803D055A161480BF0EFF950 +:100B100004984921095C002942D08030017E0029D7 +:100B200070D1A17C00297DD1A17F00296DD1807C6D +:100B300006F056FB002803D149A156480BF0D7F91F +:100B400006F0B7FB002826D0049805A98030807CE9 +:100B500006F020FA002803D141A14F480BF0C7F955 +:100B60006846027D002A05D035480399C186028770 +:100B70000120A074377003987080049801464030BB +:100B8000807A30710120A0778031CA6A0398518839 +:100B9000814200D1177004984030407A002831D14A +:100BA000A07C002815D1049805A98030807C06F02F +:100BB000F1F9002803D12AA138480BF098F96846CA +:100BC000017D002905D01E48039AC28601870120B5 +:100BD000A07404984030417F002913D0817F890799 +:100BE00010D5317A002900E05FE00BD1B77203998C +:100BF000B181C17FB173018C3182418C718201213D +:100C000031724777A07C002852D1307A002863D116 +:100C1000A07F002860D1099805F0ABF9002844D1E5 +:100C200007983DE044E00000FFFFFFFF1F000000C9 +:100C3000C01E0020FFFF0000801F0020A01E00201B +:100C4000801E00209E1F00209D1F00208C00002081 +:100C5000E01E0020E81E0020001F00201D1F0020B5 +:100C60007372635C6C6C5F6374726C2E6D302E6398 +:100C70000000000093020000A2020000CA0200006F +:100C8000D1020000ED020000E6020000A41F0020D7 +:100C9000180900002A090000310900005609000067 +:100CA000818C0898814200D023E7A07C002813D0D3 +:100CB000F749487805280FD2401C48706F700D2006 +:100CC0002870012020750198A18A0180E18A418065 +:100CD000218B8180A774FBE6ED484770307A0028AD +:100CE00009D06F70012028700A22EA49A81C0AF076 +:100CF00074FF3772ECE6B07900280AD06F701320C9 +:100D000028701C21A81C0AF0C5FF0220A870B7712A +:100D1000DEE6284606F0E8FA0028DCD1284607F08F +:100D2000B5FC0028D7D1A07C002811D0D848417844 +:100D3000491C41706F700D202870012020750198AA +:100D4000A18A0180E18A4180218B8180A774BFE65E +:100D5000A07F002800D1BCE66F700A20287001989F +:100D60003188018071884180B1888180A77770883F +:100D700006A905F0F0F8002803D0C749C7480BF0D2 +:100D8000B6F8B07805F0E5FF002803D1C249C448A1 +:100D90000BF0ADF8069849210F548030006C0178B3 +:100DA000002907D040887188884203D1BA49BD48DC +:100DB0000BF09DF8069805F00FF900288BD0B64986 +:100DC000B9480BF094F883E64FE6F0B5B74C01272D +:100DD000207885B000280AD0B5480E21837E3B22BA +:100DE000002B02D1C1760277877605B0F0BD0020D6 +:100DF000A071B0486946008C888002A905F0ABF864 +:100E0000002804D001A805F0B4F8002858D168469D +:100E10008188254601801835684602A9008805F0BA +:100E20009AF8002803D09C49A3480BF060F8684664 +:100E3000008803A9C0B206F0C3F8002803D1964980 +:100E40009E480BF054F8029849210E5C8030807C5B +:100E500006F0C6F9002803D18F4999480BF047F8EE +:100E600006F027FA7840314601431FD06A461188C0 +:100E7000A279FD23520012191181A2794000515D1F +:100E80004908490031435155A27919400143515550 +:100E90006A46107B002802D00420014301E0FB20B9 +:100EA0000140A0794155A079401CA071684605F029 +:100EB00060F8002804D16846018880888142ABD15F +:100EC0000020207167713B20E070277005B0F0BDF5 +:100ED00038B5774C0546A17B0120002908D0A37EB8 +:100EE0000F222621002B02D1E2762177A07638BD91 +:100EF0001F21E17326212174A0732888694605F01B +:100F00002AF8002814D100990022087800280FD16F +:100F10004920405C00280BD18031087E002807D092 +:100F2000087E042804D0C86A0378002B06D101E0AB +:100F3000022004E0096C0978002902D03A20E0730D +:100F400038BD07210170009829888030C06A41802F +:100F5000E27338BDF0B5554C07462078012583B0C3 +:100F600000280AD052480E22837E2421002B02D171 +:100F7000C2760177857603B0F0BD65712420E070FC +:100F80002570384605F006FE002801D0002000E05C +:100F9000122020710028EED14A4E394675774A4812 +:100FA0000BF09CF800277777781E69460880684622 +:100FB00004F0DFFF002818D168460688684601A9BA +:100FC000008804F0C8FF002803D033493F480AF0E6 +:100FD0008EFF0198A0300575684604F0CAFF00280E +:100FE00003D1684600888642E8D1277103B0F0BD7E +:100FF000F8B52F4C0546A17B0120002908D0A37E1F +:101000000F212322002B02D1E1762277A076F8BDB2 +:101010001F21E17323212174A0736B882C4A991F2F +:101020003020914278D2A9888E1F964274D28B428A +:1010300072D8EA88FF23F4339A426DD82A89254E64 +:1010400013460A3BB34267D2C9088A4264D9698908 +:10105000AA89914260D800262888694604F07BFF5F +:101060000222002838D100990878002834D149207C +:10107000405C002830D18031087E00282CD0087ECA +:10108000042829D0C86A0378002B2BD126E0000061 +:101090008C000020CA1E0020600C01004F020000DE +:1010A000550200005F02000065020000801E002063 +:1010B000A01E0020C01E0020C1040000C6040000C5 +:1010C000CC040000801F00209E1F0020CD080000DF +:1010D0007B0C0000770C0000E273F8BD0B6C1B78F2 +:1010E000002B01D03A2017E005238371C86A0681DE +:1010F000CB6AA8885881CB6AE8889881CB6A28890E +:10110000D881C86A01894389994204D8817908291C +:1011100001D8994202D31220E073F8BD298841809A +:1011200000988030C06A0270E673F8BD38B5FE4C96 +:1011300001252078002809D0FC480E22837E222138 +:10114000002B02D1C2760177857638BD1F20207131 +:1011500065712220E070257001F01DFD052802D088 +:101160000C20207138BD00202071684601F0A1FBE1 +:101170000028F7D100988030807C05F0EAFD002837 +:1011800003D1EB49EB480AF0B2FE009804F024FFCB +:10119000002803D0E649E8480AF0A9FEE74885712F +:1011A000E7488078F1F774F838BDF0B50446E5A15A +:1011B000086887B04968DD4D06910590A87B012736 +:1011C000002809D0AA7E0F212120002A02D1E97629 +:1011D0002877AF7607B0F0BD1F20E8732120287470 +:1011E000AF732188D94E081F3022B0423AD26088AE +:1011F000031FB34236D2884234D8E189D44E881FC7 +:10120000B0422FD2208A831FB3422BD2814229D8E9 +:10121000618AFF23F433994224D8A18A361F0B46F2 +:101220000A3BB3421ED2C00881421BD9E18A208BFF +:10123000814217D8A01D12220028207905D000284D +:1012400006D0207901280DD107E000280AD0F8E760 +:101250006079002801D0012804D1207B002804D027 +:10126000012802D0EA7307B0F0BD01F094FC052814 +:101270000AD001F090FC042806D002A804F047FE32 +:10128000002805D00920A5E00C20E87307B0F0BDC8 +:1012900001220321029805F072FB029801460F30EB +:1012A00001904E880421FAF75DFF3146019805F060 +:1012B0004FFCA8A0029E00680490032104A81336E6 +:1012C000FAF7D9FE002004A90A5C3254401CC0B2CF +:1012D0000328F9D39A48002601780298C176218A1A +:1012E0008180618AC180A18A0181014620318E7589 +:1012F000CE756179002902D0012903D101E006777A +:1013000000E00777A11D1D300AF0F3FE029805A941 +:101310000A300AF00CFF0298A030077569460E717A +:10132000012101A8FAF7A7FE694608794107C2061C +:10133000490F920F80068918C00F08186946087176 +:10134000401D029B0928987601D208309876012228 +:101350000021184605F013FB0298923005F0DAFCE4 +:10136000002803D172497C480AF0C1FD207B002887 +:1013700006D0012808D06E4978480AF0B8FD3BE055 +:101380000021774A012006E06C48807E00280ED0BC +:101390000121744A084606F0EAF900282CD0029888 +:1013A0008030807C05F0D5FC002816D019E002982A +:1013B0008030807C05F0CDFC002803D15C496A4870 +:1013C0000AF095FD029804F007FE002846D058491F +:1013D000664841E0E87307B0F0BD554964480AF03B +:1013E00086FD029804F0F8FD002803D050496148BA +:1013F0000AF07DFD1F20EDE72079012801D00028AB +:1014000003D106F0D0F900280CD10320029906F090 +:10141000DAF9002806D162882188029801F0D5F90E +:10142000002807D002988030807C05F092FC0028CC +:1014300006D009E00298A0300672EE7307B0F0BD46 +:101440003B494D480AF053FD029804F0C5FD0028C1 +:1014500004D0C3203649C0000AF049FD0C20B9E78A +:1014600070B5314C01212278002A09D02F480E2274 +:10147000847E1E23002C02D1C2760377817670BD54 +:101480001F22227161711E22E270217002781221E6 +:10149000012A01D0002A04D14078002803D0012875 +:1014A00001D0217170BD00260C25012A08D001F061 +:1014B00072FB05280BD001F08FF8002809D006E058 +:1014C0001E48C18B808B01F0C0F9002801D0257126 +:1014D00070BD267170BDF8B5134D06462878012100 +:1014E000002809D011480E23847E1D22002C02D131 +:1014F000C37602778176F8BD1F20287169711D209F +:10150000E870297001F047FB0C2704286FD00528EC +:101510006DD0B0791224012801D0002849D130784B +:1015200000282CD0012829E0801E0020A01E0020C9 +:10153000600C0100460600004A060000C01E0020A4 +:101540008C000020FFFFFFFF1F000000FD3F000098 +:101550007B0C000011223300C9050000E3050000E8 +:1015600094000020D41E0020D6050000DA050000FB +:10157000EA050000EE0500001406000019D1F0791C +:10158000002801D0012814D17188F9480A1F30249D +:1015900082420ED2B288121F82420AD2F54800243B +:1015A0008183B188C183B179012904D000290CD08D +:1015B00017E02C71F8BD807E002835D00121EE4A5D +:1015C000084606F0D4F8044605E0EC4A0021012064 +:1015D00006F0CDF80446002C03D0E949E9480AF0AA +:1015E00086FCF079012803D0002806D009E01BE032 +:1015F000012006F0D8F8044603E0002006F0D3F8F6 +:101600000446002C01D01F2011E03078012802D0C0 +:10161000002803D00AE00021022001E0002101207F +:1016200006F0D1F8002801D02F71F8BD00202871F4 +:10163000F8BDF8B5D44C0546A17B0120002908D09F +:10164000A37E0F222C21002B02D1E2762177A076F7 +:10165000F8BD1F21E1732C212174A07328886946ED +:1016600004F079FC002815D1009A00261178104664 +:1016700000290FD14921895C00290BD18032117ECC +:10168000002907D0117E042904D0D16A0B78002BE1 +:1016900007D102E00220E073F8BD136C1B78002B29 +:1016A00001D03A2022E06030007900281DD06B88FC +:1016B0008B80AB88CB80EB880B812B894B81D16AE7 +:1016C00068898881D06A294610220C310E300AF0D0 +:1016D00084FA009803218030C06A0170009829883C +:1016E0008030C06A4180E673F8BD0C20E073F8BD1D +:1016F000F8B5A64C0546207800280AD0A2480E224C +:10170000837E3A21002B03D1C276017701218176B5 +:10171000F8BD01F040FA04281CD005281AD09C4AD4 +:10172000107F082819D200010319102001469D33AB +:101730006E18203E471A491EF67F0906DE55090E2F +:10174000F6D1107F401CC1B21177924805F0C1FE5E +:10175000002003E00C20207101E00720207101200F +:1017600060713A21E1702070F8BDF8B5864C0646EC +:10177000A07B0125002808D0A27E0F201021002A7E +:1017800002D1E0762177A576F8BD1F20E073102006 +:101790002074A5733088694604F0DDFB002815D15C +:1017A000009900220878002810D108464030437A7A +:1017B000002B0BD180310B7E002B07D00B7E042B2E +:1017C00004D0C96A0B78002B09D101E0022007E0A0 +:1017D000684B1B7A002B02D1437F002B02D03A20AA +:1017E000E073F8BD807F800706D10620087000985E +:1017F00031888030C06A4180E2730098403045777C +:10180000F8BDF0B5614C012721788DB000290AD0D0 +:101810005D480E22837E2A21002B02D1C2760177F9 +:1018200087760DB0F0BD10216B460A464518203D65 +:10183000561A491EED7F09069D55090EF6D1102155 +:1018400010300A4610334518203D561A491EED7FC8 +:1018500009069D55090EF6D16846FEF710FFA11D39 +:101860001020024608AB1D18203D161A401EED7FC1 +:1018700000068D55000EF6D120710E20A0702A2092 +:10188000E070677127700DB0F0BDF8B53E4C0646AC +:10189000A07B0125002808D0A27E0F212820002A45 +:1018A00002D1E1762077A576F8BDB07800271A2816 +:1018B0002DD011DC16283CD2010079440979491851 +:1018C0008F44373737373725373737373737373755 +:1018D00037373737372525252A282AD00DDC1E38FB +:1018E0000C2826D201007944097949188F44212116 +:1018F0002121212121212121210F3A38042818D228 +:1019000001007944097949188F4413011301308883 +:10191000214988420DD81F20E07328202074A57328 +:101920003088694604F017FB002804D00220E073D9 +:10193000F8BD122014E00098017800290FD1492148 +:10194000095C00290BD1014680310A7E002A06D0AD +:10195000097E042903D0A0300179002902D00C208F +:10196000E073F8BDE773B17841710571F8BD00000F +:10197000FD3F0000C01E0020D41E00209400002067 +:10198000600C01000D040000A01E0020801E00203D +:10199000001F00201D1F0020FF0E0000F8B5FB4CAB +:1019A000F94D0646217828790127002909D0F84801 +:1019B0000E22837E0B21002B02D1C276017787761F +:1019C000F8BD3178002903D0012901D0122016E09A +:1019D00008281CD201F0DFF8042816D0052814D0FE +:1019E000EC483378721C29790646FCF71AFD2879F1 +:1019F000401CC1B22971304605F062FD0020207103 +:101A000067710B20E0702770F8BD0C20F7E7072006 +:101A1000F5E7F0B5044683B00120009020783D281A +:101A200050D201007944097949188F44F0F01EF032 +:101A3000F0EFEEF0F0F04C72F0F0EDB7F2F0F0EB0A +:101A4000F0F0F076F0F0F0F0F0EAE9F0F0E8E7E638 +:101A5000E5E4E3F098F09CA0E2F0F0F0E1F6DFF0CE +:101A6000DEF0F0DDDCDBDAD9D80000F006FE00287D +:101A700004D0C320C84980000AF039FA05F0F0F814 +:101A800004F006FA002803D0C349C4480AF02FFA2C +:101A900006F08CFE05F026FD0024BB4821460471AB +:101AA000083005F00DFDBE4821460477BD4805F01D +:101AB00010FDFEF7B9FEB548012104714171022203 +:101AC000C2700170AAE2B14C207800280AD0B04957 +:101AD0000E208B7E0A22002B40D1C8760A77012087 +:101AE00088769BE201F057F804280FD005280DD026 +:101AF0000025A54829460571083005F0E1FC25714F +:101B0000012060710A21E170207087E20C202071B1 +:101B1000F6E7A01CFFF742FF80E2A51C9B4C207853 +:101B2000261D002806D09A480E22837E1721002BFE +:101B30006ED073E22A460121002005F018FE3070B5 +:101B4000002806D1294698480AF0D3FA974801217F +:101B50008176012060711721E17020705EE2A01C87 +:101B6000FFF793FE5AE2A01CFFF74BFE56E2874CAC +:101B70002078002806D086480E21837E2B22002B59 +:101B800078D04BE20821A01DFAF7ECFA0020207172 +:101B9000012060712B21E17020703FE27B480178C9 +:101BA000002906D02030837E0E220F21002B2FD05B +:101BB00034E2002101710E2181700F21C170FF21DB +:101BC00081710021C9430181794949684A7882724B +:101BD0008A8882814988C1810121417182E0B6E110 +:101BE000B2E181E084E01BE1A6E0F4E147E014E02B +:101BF00064E0E1E08AE155E1F5E0F0E0ECE0E7E007 +:101C0000E2E0DDE0B9E104E031E183E1EFE003E2AD +:101C10008CE0A01CFFF7A9FD00E25C4D28780028AD +:101C200006D05B480E22837E3121002B7ED0F5E169 +:101C3000022020560B22D243811A90421BD008DC8E +:101C40001C3118D00A2916D0142914D0182909D10A +:101C500011E0014608310ED004290CD008290AD021 +:101C60000C2908D012202871012068713121E970F7 +:101C70002870D3E137E1FCF725FC0020F3E7A51C31 +:101C8000424C2078261D002806D041480E22837E33 +:101C90003221002B4AD0C1E100212A46084605F036 +:101CA00066FD3070002803D1294642480AF021FA27 +:101CB000012060713221E1702070AFE1334801787A +:101CC000002906D02030837E0E223021002B2DD01B +:101CD000A4E1374AA17811700021017101214171FD +:101CE000302248E1017099E1A01CFFF701FD95E168 +:101CF000264C2078002806D025480E22837E3921E4 +:101D0000002B13D08AE100F046FF042811D00528EB +:101D10000FD000252248294605771D3005F0D9FB54 +:101D20002571012060713921E17000E083E02070AD +:101D300074E10C202071F4E7144D2878002806D0B7 +:101D400013480E22837E3721002B74D066E1608811 +:101D500001A904F000F9002806D002202871012012 +:101D600068713721E97034E101987F2120300176D4 +:101D7000417600218176227982716279C271A279DD +:101D800002722971EBE70000E01E0020801E002097 +:101D9000A01E0020E81E0020600C010016030000B9 +:101DA000001F00201D1F0020D41E0020C01E002088 +:101DB0008C00002094000020A01CFFF73AFC2DE1CD +:101DC000A01CFFF788FB29E1A01CFFF749FB25E1D8 +:101DD000A01CFFF7EAF921E1FFF7A8F91EE1A01C1A +:101DE000FFF706F91AE1A01CFFF7B4F816E1994CC9 +:101DF0002078002806D098480E21837E0522002BEB +:101E000071D00BE104F084FFE08005F0C0F820728F +:101E100000202071012060710521E1702070FDE03B +:101E20008C4D2878002807D08B480E21837E3822DD +:101E3000002B58D0F2E095E01F2028710120687136 +:101E40003821E9702870A078002808D0012806D031 +:101E5000022804D0032802D012202871DEE00026D8 +:101E600005F0BBFCA07806F0CDFD2E71D6E07948D8 +:101E70000178002906D020300E22837E1146002BE7 +:101E800070D0CBE0754A73491389CB8053890B819D +:101E900092894A8100210171012141710E22C27093 +:101EA0000170BBE06B480078002806D06A480E221B +:101EB000837E2521002B55D0B0E0608801A904F075 +:101EC0004AF8002810D00220624900220871084612 +:101ED00082600273CA805F480E2181702521C17023 +:101EE00001214171FEE652E0019E5D4F35466035AD +:101EF0000A360020A871314638460AF018F9A87948 +:101F00000028F6D153486188C180E4E7A01CFEF7A1 +:101F1000DFFF83E04F4C2078002806D04E480E218A +:101F2000837E0622002B32D078E0002020710E2024 +:101F3000A0700620E0704B480AF0CAF8A179012091 +:101F40000143A171607163E0FEF73FFF66E0414825 +:101F50000178002907D02030837E0E213C22002BFF +:101F600015D05BE042E0404962880A84002101719B +:101F7000012141713C22C270B4E6364D2878002818 +:101F80000AD035480E21837E1322002B46D1C1761C +:101F900002770121817641E0608801A903F0DBFF2F +:101FA000002801D0022006E0019801462030827905 +:101FB000012A02D00C20287105E000222A71007E3F +:101FC00028724888E880012068711321E9700E2189 +:101FD000A970287022E0A51C1E4C207800280AD089 +:101FE0001D480E22837E3421002B17D1C276017743 +:101FF0000121817612E000F0CEFD05280AD02846A6 +:1020000000F09CFB00202071012060713421E17000 +:10201000207003E00C20F6E700200090009803B049 +:10202000F0BD10B5062811D201007944097949188C +:102030008F440C0B0B0C0C0200F044FC002804D065 +:102040009B200A49000109F052FF10BD07490848CA +:10205000F9E70000801E0020A01E00208C00002058 +:10206000881E0020861E0020C01E0020600C01007B +:10207000CA090000F7B582B0064603981746818862 +:10208000FE48FE4A41430398039D008B00245043C1 +:10209000009080352A7E002A0CD0F948012A406839 +:1020A0003AD0022A1ED0032A36D0F6A1F94809F008 +:1020B0001EFF4AE0002F03D1F2A1F74809F017FFF5 +:1020C000EF4C6068002803D1EEA1F44809F00FFF3F +:1020D0006068A168001D0A18F1490098401814189A +:1020E000012017E0791E084303D1E6A1ED4809F06D +:1020F000FEFEED48016800980C18002F09D0E0485A +:102100004168EA480818A04203D9DEA1E84809F06E +:10211000EEFE0320287616E00C46002F13D0D84F91 +:10212000002807D17878002804D0FF20D5A18000AE +:1021300009F0DDFEDD4879680818A04203D9D1A175 +:10214000DC4809F0D4FE002C03D1CEA1DA4809F016 +:10215000CEFE2146E869FAF77EFF0027E861377076 +:1021600001243471E869B060039806F0E9FD0028A5 +:1021700001D0777104E0287E012805D0022070711B +:10218000CE48F06005B0F0BD7471F9E7F0B50546D2 +:1021900087B00F46012000F001FDC4B20B2000F013 +:1021A000FDFCC0B2844204D0FF20B6A14A3009F041 +:1021B0009EFE012000F0F2FCC4B2182000F0EEFCFC +:1021C000C0B2844204D0FF20AEA14B3009F08FFE94 +:1021D0003846BB4F6C1E6900CD190026403D0928CA +:1021E0007DD201007944097949188F440441505047 +:1021F0004CEAEAEAA0000B2C04DBFF20B1A11E3060 +:1022000009F075FEE88F694603F0A5FE002804D0AA +:10221000FF209CA1533009F06AFE0B2C04DBFF2049 +:10222000A8A11E3009F063FE0099E88F4988884212 +:1022300004D0FF2093A1553009F059FE009880305A +:10224000007E002804D1FF208EA1563009F04FFEF9 +:102250008B48466046708660009806F0C6FA0028F3 +:1022600004D0FF2087A15D3009F041FE07B0F0BD2A +:1022700006F050FB0028F9D0FF2082A1633009F05E +:1022800036FE07B0F0BDFCF7C5FB07B0F0BD04207B +:10229000C04300F083FCC6B2192000F07FFCC0B23E +:1022A000864204D0FF2077A16F3009F020FE0B2C6E +:1022B00004DBFF2083A11E3009F019FEE88F694678 +:1022C00003F049FE002804D0FF206EA1733009F00E +:1022D0000EFE0B2C06DBFF207AA11E3000E070E022 +:1022E00009F005FE0099E88F4988884204D0FF2054 +:1022F00064A1753009F0FBFD009806F039FB002859 +:1023000004D0FF205FA1783009F0F1FD009C00228D +:10231000214602A8FFF7AEFEA034A07802A9FBF781 +:102320007DF80099088E401C088607B0F0BD0B2C84 +:1023300004DBFF2063A11E3009F0D9FDE88F694658 +:1023400003F009FE002804D0FF204EA1833009F0DD +:10235000CEFD0B2C04DBFF205AA11E3009F0C7FD77 +:102360000099E88F4988884204D0FF2045A1853034 +:1023700009F0BDFD00988030007E042804D0FF20C5 +:1023800040A1863009F0B3FD009C98200655A0348A +:10239000A578504F681E0B2804DBFF2049A124308C +:1023A00009F0A5FD4648690008184038C787A0789D +:1023B000FAF7A4FB4848A6700078EFF769FF07B06A +:1023C000F0BDFF202FA190304EE7F8B5434E0546F3 +:1023D00030780A4600240127002809D03146496890 +:1023E00004280BD0052813D0772026A1C00002E0D6 +:1023F000E72024A1800009F07AFD0FE00220687137 +:10240000002A0AD00820326900F0E1FB044605E00A +:102410006F71002A01D0324C00E00C462146306931 +:10242000FAF719FE0021306129702F71A860B06899 +:10243000FF303130E860F8BDF0B5074685B00E4694 +:10244000012000F0ABFBC4B20B2000F0A7FBC0B230 +:10245000844204D0FF200BA19B3009F048FD0120ED +:1024600000F09CFBC4B2182000F098FBC0B284427C +:102470003AD0FF2003A19C3034E00000E2040000C9 +:10248000A81F00207372635C6C6C5F6C6D2E6D30E6 +:102490002E63000002040000CE030000CF03000002 +:1024A00055040000E9030000A00000205F040000C4 +:1024B000EE030000FD03000005040000F604000028 +:1024C000D41F00207372635C6C6C5F6C6D2E6D307A +:1024D0002E630000FFFF00009C000020B41F0020BE +:1024E000B80B000009F003FD00250120FA4C092E6D +:1024F0006ED231007944097949188F44041A37376C +:1025000033696918510060732073607800280ED118 +:10251000F248456085602573A068C33805F032F83D +:10252000002804D0FF20EE49B03009F0E0FC05B0EF +:10253000F0BD6178002909D0207B002801D105F089 +:1025400056F96573FAF740FA05B0F0BDA07305F0CF +:102550009CF80028F8D0FF20E149C43009F0C7FCFE +:1025600005B0F0BDFCF756FA05B0F0BD0420C0433D +:1025700000F014FBC4B2192000F010FBC0B284427A +:1025800004D0FF20D649D23009F0B1FC00216846C2 +:10259000FFF71BFF69463846FAF740FF05B0F0BD6C +:1025A0002078052804D0FF20CD49DE3009F09FFCBB +:1025B000207F002804D1FF20C949DF3009F097FCB3 +:1025C00025772570207DFAF799FA257505B0F0BDBD +:1025D000FF20C349EA30A8E7F0B5BF4C87B02078A8 +:1025E0000026042805D02078052802D00C2007B04A +:1025F000F0BD01276770607B0025002827D072B6E8 +:10260000607B002808D0A07B002805D005F0EFF8FB +:102610006573A573FAF7D8F962B6207DFBF72EFD36 +:10262000002828D0207F002808D02577207805288A +:1026300003D0AB49AB4809F05AFC0C2665702570F5 +:10264000207DFAF75BFA2575304607B0F0BD207D96 +:10265000009003216846017302214173FAF769FA79 +:1026600004900020C04305906846077202A90098B4 +:10267000FAF7D4FED1E720BFCFE7F0B5964883B094 +:102680000078002801D0FFF7A7FF944F0120387091 +:10269000FF26954D2A36002405E00B2C03D39349E1 +:1026A000304609F024FC204601A903F054FC002820 +:1026B0003AD101988030007E002835D00B2C03D30E +:1026C0008A49304609F013FC2046AC4230D06946B6 +:1026D00003F041FC002804D0C1208449800009F0A7 +:1026E00006FC0098A0308078FBF7C8FC002823D0B7 +:1026F0000098002198221154A03084780C2C04D327 +:10270000FF207A49243009F0F2FB7948610008186B +:102710004038C5870098A0308078FAF7EFF9009923 +:102720000020A0318870B6E7641CE4B2082CB4D352 +:102730000020387003B0F0BD20BFD2E710B500789C +:102740006C4C00280FD001280CD068496A4809F069 +:10275000CEFBA0686949884203D36449684809F000 +:10276000C6FB10BD6748A060F3E710B55B490022C7 +:102770000A70604C207058480270427002770273F1 +:1027800042738273826102752030574B03800521AA +:1027900043808380001D491EFAD1100004D0002A16 +:1027A00004D05848A06005E0A26003E04F495248B9 +:1027B00009F09DFBA0685149884203D34B4950481A +:1027C00009F095FBFFF759FF10BD70B5424D0E465D +:1027D000297884B01446002902D00C2004B070BDC2 +:1027E000A8618030007E002804D051203C49C00000 +:1027F00009F07DFB4448464344434448E41C3018F8 +:102800006E60AC60844200D82046A8603349002046 +:10281000886005212970687028773D48FAF71AF911 +:102820002875002803D12E493A4809F060FBFAF7D1 +:1028300080F9286101216846FFF7C7FD287D6946B8 +:10284000FAF7ECFD002004B070BD10B5224C84B046 +:102850002278002A02D00C2004B010BD2A4A51432D +:102860005043C91C294AA16060608018814200D889 +:102870000846A06000206070042020702448FAF709 +:10288000E9F82075002803D11549234809F02FFBEA +:10289000FAF74FF92149FAF7DEFB2061012168467A +:1028A000FFF793FD207D6946FAF7B8FD002004B0DC +:1028B00010BD10B5084CA1690160FFF78DFE002125 +:1028C000A16110BD70B5044C84B02078052827D0D4 +:1028D0000C2004B070BD0000B41F0020A81F002011 +:1028E0008424010073020000FFFF0000C4240100E3 +:1028F000D41F00209C000020310500006A18000051 +:102900003A050000C409000071020000B3FBFFFF9C +:102910003924010093020000B1020000B80B00004E +:10292000A069002803D1D949D94809F0E0FAA06983 +:102930008030007E002804D0B520D449800009F002 +:10294000D6FAA069A0308078002803D0CF49D148BA +:1029500009F0CDFAD048FAF77DF8A169A2225054C7 +:1029600005464E88401E0B2804DBFF20CB4924304F +:1029700009F0BDFACA49680040184038C687A06906 +:10298000A0308078002803D1C049C64809F0AFFACA +:1029900001226846A169FFF76DFBA0696946A03076 +:1029A0008078FAF73BFD0020A06104B070BD10B53F +:1029B000BD494C68983400280DD001280ED002285B +:1029C00010D0B249B94809F092FAB9488068A042DB +:1029D0000BD9012010BDFF347934F6E7B120800017 +:1029E0002418F2E7FF346134EFE7002010BDAE4851 +:1029F0004178002902D10078002801D000207047DA +:102A00000120704730B502460423AA4D803285B0BC +:102A1000002916D001292FD0022907D003292DD053 +:102A20009A49A54809F063FA05B030BD1376F9F765 +:102A3000CBFF2878EFF72CFC0220FFF7F2FA05B065 +:102A400030BD044698480078002807D01376F9F77F +:102A5000BBFF2878EFF71CFC05B030BD01222146F2 +:102A60006846FFF707FBA220005D6946FAF7D6FC2F +:102A7000208E401C2086EAE7032010E081888F4BDF +:102A800059438F4B1960D16A0B8903838B79837506 +:102A90004B8983808B89C380C9890181022010768C +:102AA00005B030BDF0B5834E014600253078804C2E +:102AB00085B0002908D0012919D0022944D0032962 +:102AC0004FD072497F483BE0EFF7E2FB6078002887 +:102AD00007D100216846FFF778FC207D6946FAF7A8 +:102AE0009DFCF9F771FF6573A57305B0F0BD6E4FDE +:102AF00020697968714B401873494218A069818830 +:102B00004088594300F063F8B1680546884205D211 +:102B1000A1696A4A88884243551903E0674909F068 +:102B2000C5F8A1690883A06905218175008B6349F7 +:102B30004843281A6549B8608842D6D35749644843 +:102B400009F0D5F905B0F0BDEFF7A2FB0120207721 +:102B5000A06921698030C16105760520FFF761FA1F +:102B6000BFE7EFF795FB05B0F0BD704710B54E4AD3 +:102B700000290ED0012906D0022906D04349554824 +:102B800009F0B5F910BD401E03E05178491C5170A1 +:102B9000001F506010BD4648007870478107C90E7D +:102BA00000280BDA0007000F083880084A4A800026 +:102BB0008018C069C8400006800F70478008474AE7 +:102BC000800080180068C8400006800F7047F7B585 +:102BD00082B00D460646424F002406E00B2C04D37B +:102BE000FF202E492A3009F082F9204601A903F07E +:102BF000B2F900280ED101988030007E002809D05B +:102C00000B2C04D3FF2025492A3009F070F9BC426F +:102C100004D006E0641CE4B2082CDFD3002005B029 +:102C2000F0BD6946204603F096F9002804D0D7206D +:102C30001A49800009F05BF9A64203D117492948D7 +:102C400009F055F92848341B444300988030C16985 +:102C50000498FBF787F9041908D5281B6642294612 +:102C6000401E09F031F86843841B05E029462046E0 +:102C700009F02AF86843241AAC4204D9DD20074938 +:102C8000800009F034F9204605B0F0BD842401002D +:102C9000D2020000D60200008D210100C4240100F0 +:102CA000D41F0020D9020000A81F00203B03000011 +:102CB000B41F00209C000020CD040000E2040000AE +:102CC000A0000020F90400004E0600006A18000071 +:102CD000840400001605000000ED00E000E400E0C0 +:102CE000FFFF00005F03000077080000FE48406817 +:102CF000002800D001207047FC48C07E7047FC4887 +:102D0000C07E7047FFB5F94E85B0706A34680568BB +:102D100060680190306A0390298E0798401A80B24B +:102D200002900898002804D02746383720464830BB +:102D300002E0371D2846A83000900320387105981E +:102D400000281FD001287DD0022864D003287AD023 +:102D5000E8A1EC4809F0CBF80898002806D03879AB +:102D6000032803D0E3A1E84809F0C1F8A16A70691B +:102D7000FAF771F9B860216A606A81427ED90099D8 +:102D8000086036E1306A002804D12520D9A140012D +:102D900009F0ADF8288BDD49484342180698002118 +:102DA000002804D05043DA4908F080FF411CA1619B +:102DB0000191AA88D548002142430698002804D0F2 +:102DC0005043D34908F072FF411CE161306ACF4A99 +:102DD000801CA062298BCD4B5143019A891ACD4AA0 +:102DE00089180A18A262A87D019958434900081859 +:102DF000FF30193020626062306AC749101AFF380C +:102E000015388842A8D2C54988427DD2B9A1C448A4 +:102E100009F06DF88CE0288BBC4AE16850430A1831 +:102E200006980021002804D05043B94908F03EFF1D +:102E3000411CA161AA88B548002142430698002898 +:102E400007D001E041E076E05043B14908F02EFFA1 +:102E5000411CE161306A002803D1A6A1B14809F004 +:102E600046F8AE20405BA94A0028288BE16823D0B1 +:102E700050430818A169401AA06200E0B7E0216938 +:102E8000A068A24A4843A1694018A97D4000514367 +:102E90004018FF3017302062A888E1695043411A7A +:102EA000A14808186062A06A316A401A9A49FF383E +:102EB000553888423CD34FE750430818A169401A5F +:102EC0003168D63849684018D6E7284680300190E6 +:102ED000C08D002802D0306A002803D185A1934814 +:102EE00009F005F8A8888949E3694843C01AA06237 +:102EF00001999C46CA8D2169A368521A4B43A16966 +:102F000059186346534300E012E0C918AA7D7F4B6D +:102F100049005A438918FF3117312162824941180B +:102F20006162316A401A7C49FF3855388842C2D202 +:102F30000120387110E70898002803D03420005D84 +:102F4000002872D1A88871494843E169401A029962 +:102F50004843A062284680300490C08D0028019824 +:102F600025D0002803D063A1714808F0C0FF049861 +:102F7000664AC18D02980818E16948434000FF3055 +:102F800017302062A8885043411A674808186062C9 +:102F900055484068002819D0A26A03990120511AA7 +:102FA0005D4AFF395539914285D23871D4E60028FF +:102FB00002D00398002803D14EA15E4808F097FF85 +:102FC0000198A16AD6380818A062D0E7F9F7B1FDD8 +:102FD000726901461046FAF7C5FFA16A081A4E4900 +:102FE000FF3850388842A5D2012009B0F0BD0098C2 +:102FF000016000985049006880354018F860298BBE +:103000000798081A00B2002804DD0598022801D0AC +:10301000022000E000207871089838700898002895 +:1030200006D03420005D002802D0022009B0F0BD97 +:1030300008980121484020346075307FF27E39467F +:10304000B37E9A4202D0FAF7E9F904E00020F07664 +:10305000B07630607062002009B0F0BDF8B5224F44 +:1030600038680468416A26460D682036717D00295B +:103070000AD0618E2A8E914206D1407A002803D16F +:103080001CA12E4808F033FFF9F753FD164F39689D +:103090004A6901461046FAF765FF3F680028796AD9 +:1030A000096807D08988194A51433A68D269891A50 +:1030B00008F0FCFD2A8E618E1318994202DB491C30 +:1030C000618602E0401C10186086B07D002806D1A1 +:1030D0009C21608E495B884201D1401C6086388B00 +:1030E000014E03282FD22BE0B0000020801E0020CC +:1030F000A81E00207372635C6C6C5F6C6D2E733065 +:103100002E6300001A05000023050000E204000001 +:1031100040420F00330400005C0800001D03000063 +:10312000BD040000C504000094FBFFFFDE040000A6 +:1031300004050000FD0400004B1700000406000019 +:10314000401C388302E0618E98204153284640306D +:103150000090C1898089081A298E401E401887B2C4 +:1031600016E03068FF49406AEB7E00795B00400062 +:10317000085AC95A081881B2207D0023FFF7C2FD02 +:1031800000280FD001280ED0F749F84808F0AFFE0C +:10319000628EB81A00B20028E3DA00980821817222 +:1031A00007F042F9F8BD608E401C6086F0E770B50C +:1031B000EF4D09292B686A687BD20C007C44247986 +:1031C0002419A7440463879784A6A675A30000204A +:1031D0001062D17E042956D20B007B441B79DB1888 +:1031E0009F4451510147516A0C6811680870116879 +:1031F000486010682030407D002808D1F9F799FC1C +:1032000069680968096CFAF7ADFE002817DC686880 +:10321000228E0168498E914205D123468033998BD5 +:103220008A1ADA8304E0891A9E2211530168498EB2 +:1032300021860268C1681164C168416111E0686853 +:103240000168098E228E8B1A22468032D383016850 +:10325000098E218601680B6CC3600B6C4361886C1E +:103260009062204607F090FD002821D0C1A1C548FA +:103270002AE0D068506106F052FC002818D0752072 +:10328000BCA1C00020E0BBA1BF481DE0D07E042847 +:1032900017D201007944097949188F441212010BA1 +:1032A00007F0CCFE002803D0B2A1B84808F01FFEFA +:1032B00070BD2EE006F068FD0028F9D0ADA1B4483D +:1032C00002E0F320ABA1800008F011FE70BDFBF717 +:1032D000A1FB70BDD87E022806D0D87E032806D078 +:1032E000FF20A4A1A4300EE0FFF7B8FE70BD00F0EF +:1032F000DEFB70BDD87E0228F6D0D87E0328F6D03B +:10330000FF209CA1AF3008F0F2FDF0E7F9F7F6FBE3 +:1033100070BDFF2097A1BE30D6E7F3B50126944CCF +:103320009C4D81B00F46092945D2080078440079A8 +:1033300000188744042D38382D40403838000121CA +:10334000944800F09BFB39460198FFF730FFE87E78 +:10335000022826D160680468406A0768F9F7C7FB4D +:10336000B9888D4A5143E269891AD639E162B72892 +:1033700003D283200001081A02E0081A8749401886 +:10338000E0628748E16A814200D80846E06205E0D1 +:103390000198FFF70CFFE87E022802D12868203050 +:1033A000067503B0F0BD25600198FFF700FF00200F +:1033B000206003B0F0BDFF206EA15C3008F097FDE7 +:1033C00003B0F0BD70B506460C4609291FD20800AF +:1033D0007844007900188744040D11110D1A1A1150 +:1033E000110001216F4800F049FB21463046FFF7EC +:1033F000DEFE70BD3046FFF7DAFE70BD5C4D6948F9 +:1034000028603046FFF7D3FE0020286070BDFF2003 +:1034100058A1823008F06BFD70BDF0B55D4985B0F4 +:10342000CA7E0026524C032A03D02831CA7E032AC2 +:1034300063D100252160002822D001280CD04DA1A5 +:10344000594808F054FD2068002E0560456225604B +:1034500053D0002005B0F0BD0320887600E020BFE7 +:103460002068C17E002903D0C17E827E9142F6D0C1 +:10347000C17E002902D000268576E4E70126FBE71D +:103480000026032708468F76C97E032903D0C07E15 +:1034900000282ED02EE0007F002803D135A143481C +:1034A00008F025FD2068067F6846077102214171FA +:1034B000F9F73FFB0290FF20F530039001216846A9 +:1034C000017069463046F9F7A9FF2068007FFAF7D6 +:1034D000D5FD00280BD02068007FF9F70FFB20688E +:1034E0000577C576857605600126456202E020BF36 +:1034F000EBE7012620688576A5E70C2005B0F0BD36 +:1035000010B5244800F019FB264800F016FB2849A6 +:1035100000200875274948701E494861214A5061BA +:103520008876907612494860086010BDF8B5224E42 +:1035300005463068002401270004810F1F480068F9 +:10354000800F814204D0FF200AA1C83008F0CFFCD0 +:1035500030681B4E0004810F30680006800F8142E6 +:1035600035D02FE0E2C10100F43001003E0600003A +:10357000B00000207372635C6C6C5F6C6D2E7330F6 +:103580002E630000A2030000AF030000C10300008F +:10359000C5030000801E0020E204000087F8FFFF42 +:1035A00038120000A81E00200A0300007302000069 +:1035B000D01E0020A900002000E400E008E400E0A4 +:1035C00018E400E0FF20FE49C93008F090FCFD48F7 +:1035D000C0693168800F0904890F884204D0FF2038 +:1035E000F749CA3008F083FCF7480570F74DEC76D0 +:1035F000AC76F74EF476B476F648077104606C62E8 +:1036000074622C602846346000F097FA304600F06F +:1036100094FAF1480475F14844706C617461AC76B9 +:10362000B476EF4844600460F8BDEA490871704719 +:10363000F8B5E649CA7EE648E94C002A02D1C27EC6 +:10364000002A03D0C97E022907D009E0E54821609D +:10365000F9F700FA216808770AE0C17E002901D055 +:103660000C20F8BD2060E048F9F7F4F921680877EC +:103670002068DA490160DD494162007F002803D1FA +:10368000CF49DB4808F033FCF9F731FAD9498842D1 +:1036900000D20846D849401886B221680320C8766F +:1036A00006F018F92168086106F03CF901270025A9 +:1036B000002827D006F036F921684A6A10600868A9 +:1036C000012107706846F8F7FBFC68460078CB4993 +:1036D000000208F0EBFA0F46F9F72BFAF119F9F7A7 +:1036E000BAFC2168C8602268032010720220507260 +:1036F0001571107FD37E111D967EB3420ED0F9F75F +:103700008DFE0FE0F9F715FA3146F9F7A4FC2168B0 +:10371000C8600868057008684770E4E7D576957654 +:10372000156055622068058300202560F8BD70474C +:10373000F8B5A64EF17E002903D1A549C97E00291E +:1037400001D00C20F8BD0221F176A24FA24C776285 +:1037500034600025386025753979C07E4A00A84953 +:1037600040008A5A085A2B46101881B22A46284629 +:10377000FFF7C8FA002803D09149A24808F0B7FB28 +:1037800025610120A5602075658625869E48857582 +:103790003968088E401E088635830020F8BD10B5B4 +:1037A0008F4801244068817E03290CD00168497844 +:1037B000002906D0006A9549884202D9002406F003 +:1037C00010FB204610BD0024FBE7854840680268D6 +:1037D0001178491C1170016A0068C26A914204D8CC +:1037E000007D012801D00120704700207047002093 +:1037F0007047F8B57A4C75482060416A00680D68DA +:10380000002134221154A621495D002951D1007DA7 +:1038100003284ED1F9F78DF9226852690146104606 +:10382000FAF7A0FB002844DD2768794A796A3E68E8 +:10383000096889885143F269891A08F037FA298E94 +:10384000401C401830869C20415B3868028E891AE3 +:1038500009B200292DDD0121203081752846403034 +:10386000C1898089664F081A298E401E401886B289 +:1038700018E0496A028E09794900795AEB7E007D89 +:103880005B00FB5A591889B20123FFF73BFA002865 +:103890000FD0012810D002280BD0BD204849C0000D +:1038A00008F025FB21680868028EB21A12B2002ABD +:1038B000DFDA00202060F8BD20680068018E491C16 +:1038C0000186EFE770B5464900244D68062849D2C5 +:1038D00002007A441279921897441E2602112A1087 +:1038E000002000F072F9EC76AC762C6000206C625F +:1038F00001F049FC0021084600F0C0F870BD3248D4 +:103900000D680078EEF7C4FCEC76AC762C600020F5 +:103910006C6201F038FC70BD012000F056F9002106 +:10392000084600F0ABF870BD29680320087570BD2B +:10393000686A29680068CA698A608188344A514384 +:103940002A68D1600146C031CA8902830A7B827528 +:103950000A8A82804A8AC280898A01812968022073 +:10396000087570BD73201649000108F0C0FA70BDDB +:1039700070B500280AD00024194D01280DD0022866 +:103980004AD00F49234808F0B2FA70BD00F074F92C +:103990000021084600F072F870BD686801684C703C +:1039A000C476847604604462032001F0ECFBF9F7EE +:1039B0000BF805486C600078EEF76AFC6C6070BD2F +:1039C0007435010000ED00E0A8000020801E0020FA +:1039D000A81E0020B8000020D01E0020A900002052 +:1039E000B00000201B330100C5330100AC000020F3 +:1039F000B5020000F6050000BB0200001027000021 +:103A0000E2C101003D030000F01E0020D982130036 +:103A1000E20400005307000000F02EF96868C47645 +:103A20008476046000214462084600F027F80420F0 +:103A300001F0A9FB70BDAD494968CA7E022A08D1D0 +:103A40000A681378002B04D150600968CA6A1018FC +:103A5000C862704710B5A54A002952680CD00129E8 +:103A600007D0022907D0EF20A149C00008F03FFA93 +:103A700010BD801E00E0401F106210BD70B59B4C51 +:103A800005466268002908D0002A04D0FF20984922 +:103A90000C3008F02CFA656070BD002A04D1FF20BC +:103AA0009349123008F023FA0020606070BD38B5E9 +:103AB0008E4C206801684978012927D00121684689 +:103AC000F8F7FEFA684600788A49000208F0EEF836 +:103AD0002068426AC06812685118F9F7BCFA216878 +:103AE000C86085482268002382421BD0108B0028C2 +:103AF00018D05372032010721371107FD47E111DE1 +:103B0000957EAC4214D0F9F789FC38BD7D21C068A0 +:103B1000C900F9F7A0FA2168C86005F0DBFE21684A +:103B20000861DEE7108B401C108302205072E1E731 +:103B3000D37693761360536238BDF8B56B4C054667 +:103B40001F27EE7E042E2ED2300078440079001814 +:103B50008744332901246948854204D0FF20644901 +:103B6000FD3008F0C4F902202560A87600E020BFEF +:103B70002168C87E002803D0CA7E887E8242F6D0A3 +:103B8000CA7E002A04D000228A760C27226011E027 +:103B900000228A760A604A6222600EE00120FFF766 +:103BA0003CFC074604E041205149C00008F09FF961 +:103BB000002F02D0E87EB042C3D1E87E002803D0B7 +:103BC0004B494F4808F093F9F8BDF8B5474D00262A +:103BD0006A680128516A0C683FD108794949400058 +:103BE0000B5A1068077D032F06D0027D022A10D0E1 +:103BF000007D012820D030E00661106886609C209E +:103C0000025BE07E4000085AC01881B20023032006 +:103C10001BE022468032D78D0761E07E928B400008 +:103C2000085AC01881B200230220FFF76BF86A68B7 +:103C30000121126811750AE09C20025BE07E4000C1 +:103C4000085AC01881B200230120FFF75BF8002852 +:103C500003D027492C4808F04AF9F8F7B5FE2B485D +:103C60000078EEF715FB686806830268218E51869E +:103C7000006820308675F8BDF8B51C4D00216868D5 +:103C80000C4600684278002A01D0447027E0007892 +:103C9000002809D001216846F8F712FA6846007832 +:103CA0001449000208F002F86868426AC0681268A5 +:103CB0005118F9F7D0F96A68D06014710220507277 +:103CC000107FD37E111D967EB34202D0F9F7A6FB7A +:103CD00003E0D47694761460546268680483F8F73D +:103CE00073FE0A480078EEF7D3FAF8BDB000002062 +:103CF0007435010010270000A81E0020801E00203F +:103D00000E020000E2C101009F060000A800002092 +:103D1000F3B5FB4F81B078600298B870002002F0D4 +:103D2000E7FF02F085F9F7490024F7480C77847122 +:103D3000C471F64EF64DF461F6482C720470F648E4 +:103D40008473847484770C758C710298FFF7EEFB92 +:103D5000F249F34805F08BFD786806F0FEFFF14864 +:103D600002F08EF9002803D0EFA1C32008F0BFF8BD +:103D7000F4612C7203B0F0BD70B582B00E461D46E2 +:103D8000144601A902F096F9002807D1FEF7B4FF06 +:103D9000022803D1DB48007D002802D0012002B0B8 +:103DA00070BD01988030807C02F0F4FF00280DD0B7 +:103DB000684602F0FFFF0028F1D0002C03D002F08B +:103DC000A7FFA0420AD2002002B070BD9320DBA161 +:103DD000800008F08CF8002002B070BD009802F05E +:103DE00025FB3146009802F026FBE2B229460098F6 +:103DF00002F0DEFC03F007F8002803D1CFA1D4487D +:103E000008F075F8BE4C0025A068A0304179002963 +:103E100002D04571FFF7EDFCA0688030458301209A +:103E200002B070BD30B40179002904D0012909D055 +:103E300030BC002070470488831D4288204630BC77 +:103E4000022199E70488831D4288204630BC012165 +:103E500092E7F8B51D4614460E460746FEF74CFF9E +:103E6000022803D0A748007D002820D0A4488168FC +:103E70004988398080688030807C03F0B1F900285F +:103E800003D1AEA1B34808F032F8684603F0B8F9A0 +:103E900000280CD0009802F005FB3070022807D0F3 +:103EA000012805D0A5A1AC4808F021F80020F8BDF4 +:103EB0002946009802F093FC2080002803D19FA19E +:103EC000A64808F014F803F0C7F9002804D1AB2085 +:103ED0009AA1800008F00BF80120F8BD38B504461F +:103EE000831D821C6946FFF7B4FF00280CD0002018 +:103EF000607168460078012807D0022805D08AA1A1 +:103F0000FD2007F0F4FF012038BD2071FBE7F0B57C +:103F100083B00546FEF7F0FE7E4F3E463C46203617 +:103F20004034022802D0207D00287DD0207F102838 +:103F30001AD1A079002803D080A1894807F0D7FFC3 +:103F40006F48816808464030827F92070CD5002276 +:103F5000227249886181C17F2173018CE181408C8B +:103F600020820120A0712277B07C002876D164489D +:103F700002A980688030807C03F00CF8002806D00D +:103F80005F486A464178127A8918417004E0EF2050 +:103F90006AA1C00007F0ABFF207D002852D058482E +:103FA000B96D806849884088884203D063A16D4814 +:103FB00007F09DFF524880688030807C03F010F944 +:103FC000002803D15DA1684807F091FF03F071F963 +:103FD000002837D04A48694680688030807C01904C +:103FE00000200870019802F0D5FF002803D153A1EA +:103FF000A32007F07CFF019802F0ABFE002803D15C +:104000004EA1A82007F073FF684601783C4842782B +:1040100089184170B96D40314A7A012A10D10022C5 +:1040200022708068408800E018E06080887A207103 +:104030000120B077207F102801D0282800D12277D6 +:10404000002020752E484178002907D082685288C8 +:10405000FA8639870121B17400214170FEF746FECE +:10406000002806D1207D002803D025488078EEF76F +:104070000FF9B07E00280BD0002068701021297045 +:10408000F17EA970317FE970B076012003B0F0BDF8 +:104090003878002809D02C22B91C284607F09DFD4D +:1040A0000E2028700020387018E0B07B002818D04F +:1040B000207F102808D0282806D0002804D0FF2010 +:1040C00019A1BF3007F013FF0120E870F07BA87042 +:1040D000307C68700F2028700020B073012003B07E +:1040E000F0BD0121284605F05FFB00283ED0207D71 +:1040F00000286FD10021284605F056FB03B0F0BD23 +:10410000C00000208C1F0020AC1F00204C2000208D +:104110002C2000204C1F00206C1F00203420002089 +:10412000B31F0020C80000207372635C6C6C5F6377 +:1041300074726C2E73302E63000000007372635C27 +:104140006C6C5F6374726C2E73302E630000000021 +:104150006A02000095020000B3020000A502000000 +:104160005F0700007D07000083070000B17CAF1CE3 +:10417000FE480090002914D0FD480178052910D28E +:10418000491C0170002068700D21297001213175D2 +:1041900000998A883A80CA887A800989B980B0747F +:1041A0009CE7F34900200870A079002813D0207FF5 +:1041B000002804D0FF20EF49FE3007F098FE0026CB +:1041C0006E70012028700A22EB49A81C07F005FD3B +:1041D000A67183E710E0284606F00BFD0028DFD12A +:1041E000B07C002802D0E2480178C9E7B07F0028FF +:1041F00002D0207D002802D0002003B0F0BD207F37 +:10420000002803D0DB49DD4807F071FE002068700C +:104210000A21297000990A8A3A804A8A7A80898A12 +:10422000B980B0775AE772E6F8B5D54C2078012509 +:10423000002809D0D3480E21837E3B22002B02D1D7 +:10424000C17602778576F8BD0020A071FEF754FD97 +:10425000CD4E022802D0307D00283FD0C44F6946A1 +:10426000B8688030807C02F0ABFE002803D1C749DB +:10427000C74807F03CFE307D002806D0A06D4030D6 +:10428000407A002801D0012600E00026B86880307E +:10429000807C02F0A5FF002803D1BC49BD4807F08F +:1042A00026FE03F006F868403146014316D0B9688F +:1042B000FD2249882181217E40004908490031437F +:1042C00011400143217668460078002802D004207E +:1042D000014301E0FB2001402176A57100202071FF +:1042E00065713B20E0702570F8BDF8B5A44C05461B +:1042F00020780126002809D0A2480E22837E37218B +:10430000002B02D1C27601778676F8BD9E48007FE9 +:10431000002802D00C2020710BE0954F2988B86846 +:104320004088884203D1FEF7E7FC022806D002202D +:10433000207166713720E0702670F8BDB9687F2063 +:1043400020310876487600208876AA788A71EA7843 +:10435000CA712A790A72EBE7F8B5894C05462078CC +:1043600000280AD087480E21837E3A22002B03D1F1 +:10437000C176027701218176F8BDFEF7BDFC0328E6 +:1043800007D0FEF7BCFC032803D07F48007F00283D +:1043900002D00C20207118E07F4BD879082812D267 +:1043A000000102191020014668326E18203EF67F87 +:1043B000471AD655491E0906090EF6D1D879401C70 +:1043C000D871002000E007202071012060713A219F +:1043D000E1702070F8BDF8B5694E044630780028C9 +:1043E0000AD068480E22837E3D21002B03D1C2767D +:1043F000017701218176F8BD6348007F002802D053 +:104400000C2030710BE05A4D2188A8684088884202 +:1044100003D1FEF771FC022807D002203071012081 +:1044200070713D21F1703070F8BDAF686488FD880F +:104430003A896800B988401C844218D357484143E0 +:104440001046574A504307F031FC401EFF2180B20E +:10445000F531884200D90846844200D22046691CC2 +:10446000401C07F023FC6D1C6843401E85B2E6200B +:10447000C05D002800D1BD84F5800020CEE7F8B5EE +:104480003F4C054620780126002809D03D480E22E1 +:10449000837E3521002B02D1C27601778676F8BD66 +:1044A0003948007F002801D00C200AE0A8780028B5 +:1044B00001D0012804D1A888FF21F531884206D90E +:1044C0001220207166713520E0702670F8BD284FEB +:1044D0002988B8684088884203D1FEF70DFC02287D +:1044E00001D00220EDE7B96800220846C0310A7009 +:1044F000AA884A80A0300671AA78012A00D000223A +:104500000A704079002801D0FFF773F90020D8E73E +:1045100070B51B4C064620780125002809D01948A3 +:104520000E22837E3321002B02D1C276017785765D +:1045300070BDFEF7E1FB002803D11348007F00287F +:1045400002D00C20207136E0317800292ED00A29C3 +:104550002CD014292AD01E2928D0282926D0322947 +:1045600024D04B2922D0642920D01BE07C1F0020BE +:10457000C000002028410100941F00201E020000FE +:104580004C1F00206C1F00208C1F00203C410100AC +:10459000140800001C080000AC1F0020C409000023 +:1045A00010270000FF2901D0122003E03046FFF75A +:1045B000BEF80020207165713320E070257070BD59 +:1045C000F1B5FA4CA07B0126002808D0A27E0F216D +:1045D0001020002A02D1E1762077A676F8BDF44DAE +:1045E000A8790C27002816D1287F002813D1FEF7C0 +:1045F00083FB022821D1EF4800998068098842880E +:104600008A421AD10146C0310A7A002A05D04030C8 +:10461000807F80070DD4E77311E05E22125C920761 +:1046200007D406220A72A0304079002801D0FFF793 +:10463000E0F810202877002000E00220E07310202E +:104640002074A673F8BDF8B5DB4C2178012700294A +:1046500009D0D6480E22837E2A21002B02D1C276B1 +:1046600001778776F8BDD54B10210A464518203DC5 +:10467000ED7F561A9D55491E0906090EF6D11021E7 +:10468000CF4B0A4610304518203DED7F561A9D55F8 +:10469000491E0906090EF6D1C848FBF7F0FFA11D17 +:1046A000C84B102002461D18203DED7F161A8D556F +:1046B000401E0006000EF6D120710E20A0702A20A8 +:1046C000E07067712770F8BDF8B5B94F0546387FBF +:1046D0000126B64C002802D00C20E07342E0A07BFB +:1046E000002808D0A27E0F212820002A02D1E176DE +:1046F0002077A676F8BDA87805280DD013280BD012 +:10470000142809D0152807D01A2805D0292803D045 +:104710003D2801D03B2803D12888AB49884201D9E4 +:1047200012201EE0FEF7E8FA02280AD1A1482A88E2 +:1047300080684188914219D10146C0310A79002A26 +:1047400001D00C200DE0AA784A710E71282139772A +:104750000021E173A0304079002803D0FFF749F829 +:1047600000E0E07328202074A673F8BD0220F8E76B +:10477000F8B5914C074620780125002809D08B48D0 +:104780000E22837E0B21002B02D1C2760177857623 +:10479000F8BDFEF7B1FA032807D0FEF7B0FA0328F8 +:1047A00003D08348007F002801D00C2005E03B782F +:1047B000002B08D0012B06D01220207165710B2030 +:1047C000E0702570F8BD814E317A082908D27A1C34 +:1047D0007F48F9F726FE307A401C30720020ECE763 +:1047E0000720EAE710B5FEF78BFE002804D02D2045 +:1047F0007849000107F07BFB02F032FA06F0A5FAD7 +:10480000002803D07349744807F071FB05F006F8DF +:10481000002803D06F49714807F069FB70490020F8 +:10482000C86120390872624B6E4918778871C87167 +:10483000603908705D4A907390749077187598711C +:104840000871012048710222CA70087010BDF8B5C5 +:10485000594C21780127002909D054480E22837E23 +:104860001B21002B02D1C27601778776F8BD6771D4 +:104870000C214F4E2171317F002957D1007800253E +:10488000012804D0002849D01220207178E0FEF7DA +:1048900033FA002803D1FEF732FA002804D0FEF7DD +:1048A0002BFA022822D06BE005F011F8002867D01F +:1048B000307D002864D13F4E0122B068032145803D +:1048C00002F003F8B06805F0E1F9B068923002F048 +:1048D00021FA002803D14449444807F008FBFEF7B9 +:1048E000A7FE00284BD04049414814E0FEF707FAE4 +:1048F000002845D1707F002842D0012840D00428EC +:104900003ED004F0E4FF00283AD0FEF791FE0028E4 +:1049100035D03549374807F0EAFA30E0FEF7ECF9D0 +:10492000032804D0FEF7EBF9032823D028E0002069 +:10493000FEF773FD002823D12571307D00281FD19B +:104940001C48694680688030867C68460570304621 +:1049500002F020FB002803D11E49A32007F0C7FA6C +:10496000304602F0F6F900280AD11A49A82007F0CB +:10497000BEFA05E00020FEF750FD002800D12571A9 +:104980001B20E0702770F8BDF8B50B4E0446307858 +:104990000C25012700282FD004480E22837E1821E1 +:1049A000002B02D1C27601778776F8BD6C1F0020FC +:1049B0008C1F0020C00000204C1F00201C1F002066 +:1049C0002C1F00203C1F0020FF0E00002C20002088 +:1049D000382000203C410100DD020000E10200001F +:1049E0004C200020AC1F00202841010021040000C1 +:1049F0002504000039040000FEF77EF903285DD08D +:104A0000FEF77DF9032859D0FE48017F002955D1D2 +:104A10006179002901D001292DD1A179002901D086 +:104A2000012928D1A17B002905D0012903D0022921 +:104A300001D003291FD1617B00291CD0C9081AD1DC +:104A40006288012189038A4202D823888B4203D9D4 +:104A5000217901290FD119E02179002906D00129F6 +:104A600014D0022905D0032905D102E0202A0BD356 +:104A70000CE0A02B0AD22179042905D12188202914 +:104A800002D36288914201D9122517E0217941773A +:104A90006079002802D0012807D00FE0DA4A00210F +:104AA000204604F044FF054608E0D84A90790028E3 +:104AB00004D00121204604F03AFF05463571777194 +:104AC0001820F0703770F8BD70B5D14C06462078CC +:104AD0000125002809D0CF480E22837E2E21002BED +:104AE00002D1C2760177857670BDFEF705F90C22FA +:104AF000022814D1C348007F002810D1C64833884B +:104B000081684888834218D10846C030037A002B58 +:104B100005D12031C97E0F290BD0102909D022716F +:104B20000E20A0702E20E0703088E0806571257026 +:104B300070BD05210172002000E002202071EFE726 +:104B4000F8B5B34C054620780127002809D0B148B4 +:104B50000E22837E2D21002B02D1C276017787762B +:104B6000F8BDFEF7C9F80C21022813D1A548007F33 +:104B700000280FD1A84E2A88B06843889A421ED1D7 +:104B8000C822125C002A05D13B22125C0F2A0BD0EE +:104B9000102A09D021710E20A0702D20E0702888E5 +:104BA000E08067712770F8BD1022A91CD63007F08D +:104BB00014F8B0680421C0300172002000E0022027 +:104BC0002071E8E7F8B5044600783F2875D2010067 +:104BD0007944097949188F447070747070E8707066 +:104BE0007070779C7070E7F6E57070E4707070A07C +:104BF00027702B4F7070707053707070E3E270709C +:104C0000C170C5C9701F2370E1E0DFDE70DD70DCAC +:104C1000DBDAD9D8D7D6D500A01CFFF791FF8FE2F9 +:104C2000A01CFFF751FF8BE2A01CFFF7ADFE87E24F +:104C3000A11C774C207800280AD076490E208B7E64 +:104C40001A22002B3FD1C8760A770120887677E2B6 +:104C500008781F280DD8481C0BD000202071087838 +:104C6000491C04F007FF012060711A21E1702070D7 +:104C700066E212202071F6E7A01CFFF7E8FD5FE274 +:104C8000A11C634C2078002806D02022A018837E27 +:104C90000E21002B75D053E208781F280ED8481C2F +:104CA0000CD0002020710878491C04F0D2FE0120AD +:104CB00060712021E170207042E262E212202071D6 +:104CC000F5E7FFF78FFD3BE2514C2078002806D036 +:104CD00050480E22837E0A21002B67D030E2FEF777 +:104CE0000BF8032807D0FEF70AF8032803D045483D +:104CF000007F002801D00C2004E048490020C86152 +:104D0000474908722071012060710A21E17020700A +:104D100016E2A01CFFF72CFD12E2A51C3C4C2078EB +:104D2000261D002806D03B480E22837E1721002B2B +:104D30003CD005E22946012004F073FE30700028C3 +:104D400006D132482946064607F0D3F90120B07152 +:104D5000012060711721E1702070F1E1A01CFFF7C4 +:104D6000B3FCEDE1A01CFFF76EFCE9E1284C2078D4 +:104D700000281CD027480E21837E2B22002B00D038 +:104D8000DEE16EE194E112E17FE17BE113E116E106 +:104D90003DE138E107E1E2E0C3E098E0E3E062E012 +:104DA000A9E1BFE142E00EE050E143E08EE00821DE +:104DB000A01DF7F7D7F900202071012060712B2189 +:104DC000E1702070BCE112480178002906D0203043 +:104DD000837E0E220F21002B78D0B1E100210171DA +:104DE000FF2181710021C94301810B4949684A783B +:104DF00082728A8882814988C181012141710E2293 +:104E000082700FE08C1F0020CC000020AC1F00201F +:104E10004C1F00206C1F0020C00000204C200020F0 +:104E20002C2000200F22C270017089E1A01CFFF726 +:104E3000C7FB85E1E94C2078002806D0E8480E221F +:104E4000837E0521002B41D07AE10020207101F002 +:104E50005FFFE08002F09BF8207201206071052165 +:104E6000E17020706CE1DD480078002806D0DC4855 +:104E70000E22837E2521002B28D061E160886946BF +:104E800001F018F900280FD00220D449002208713F +:104E9000084682600273CA80D0480E2181702521A5 +:104EA000C1700121417101E1009FCE4E3D46603548 +:104EB0000A370020A8713946304607F038F9A8793A +:104EC0000028F6D1C5486188C180E5E782E0C34D7E +:104ED0002878002806D0C2480E22837E3121002B7C +:104EE00078D02DE102202056042812D0002810D0BE +:104EF000011D0ED0091D0CD0091D0AD0091D08D0B6 +:104F0000091D06D00A3104D00A3102D012202871BE +:104F100003E0F9F7D7FA012068713120E870012029 +:104F200092E0A51CAD4C2078261D002806D0AC4888 +:104F30000E22837E3221002B4CD001E12946002035 +:104F400004F06FFD3070002803D12946A64807F011 +:104F5000D0F8012060713221E1702070F0E0A01CD7 +:104F6000FFF7D6FAECE09D4D2878002806D09C4843 +:104F70000E21837E3022002B73D0E1E0FDF7BCFED2 +:104F8000002803D19948007F002801D00C2003E0BD +:104F9000A078FEF74AFB00202871012068713021BB +:104FA000E9702870CCE0A01CFFF769FAC8E0A01CEB +:104FB000FFF711FAC4E0A01CFFF7CEF9C0E0874C60 +:104FC0002078002807D086480E21837E3922002BC6 +:104FD00047D0B5E099E0FDF78FFE032807D0FDF735 +:104FE0008EFE032803D08148007F002801D00C20CA +:104FF00002E07F490020C8712071012060713921D1 +:10500000E17020709CE0A01CFFF76FF998E0734DF1 +:105010002878002806D072480E22837E3821002B83 +:1050200073D08DE07148007F002805D00C202871D6 +:105030000120687138215CE0A07804F018FDA078A8 +:1050400006F02BF80020F2E7287079E06348017839 +:10505000002907D020300E22837E1146002B54D029 +:105060006EE069E0644A63499389CB86D3890B87F4 +:10507000128A4A8700210171012141710E22C270FA +:1050800001705DE0FFF7D0F85AE05448017800293C +:1050900006D02030837E0E223C21002B35D04FE0FD +:1050A00000210171012141713C22C270017047E071 +:1050B0004A4D2878002806D049480E21837E3E229A +:1050C000002B39D03CE0FDF717FE002807D1FDF793 +:1050D00016FE002803D14548007F002801D00C208F +:1050E00003E0A07804F0D2FC002028710120687150 +:1050F0003E21E970A8E73948017800290AD020301C +:10510000837E0E222421002B1AD1C2760177012141 +:10511000817615E0012101702422C2700C220271F7 +:1051200041710DE02D4D287800280BD02C480E2120 +:10513000837E3722002B03D1C1760277012181764D +:105140000120F8BD60882D4900F0B4FF002801D08F +:10515000022007E028488168084620308279012A29 +:1051600002D00C20287105E000222A71007E2872EE +:105170004888E880012068711321E9700E21A97028 +:1051800062E70020F8BD70B514491B4C03460A467F +:1051900001254032A068052B1DD21E007E443679C1 +:1051A000B619B7441518180215000122002101F0A4 +:1051B0008CFBA06800220146C0310A724A72FEF7D9 +:1051C000B7FA002803D00E490E4806F090FE70BDD5 +:1051D0001575886570BD0C490C48F6E74C1F00201A +:1051E0006C1F0020541F0020CC0000208C1F0020CA +:1051F000AC1F00201C1F0020C0000020C8000020A1 +:105200003C4101004E0800002841010081080000D7 +:105210008107C90E002808DA0007000F0838800847 +:10522000814A80008018C06904E080087F4A8000BD +:1052300080180068C8400006800F704710B504460B +:1052400000F0DBF8002813D02046FFF7E1FFC0B2E2 +:1052500000F0E1F800280DD07549E2060B78D20E77 +:1052600001209040002B08D04A681043486006E0B7 +:10527000704810BD6F48401C10BD6F490860002089 +:1052800010BD10B5044600F0B8F800280BD06849EE +:10529000E2060B78D20E01209040002B05D04A6820 +:1052A00082434A6004E0634810BD6349803108606E +:1052B000002010BD70B50D46044600F09EF8002891 +:1052C0000BD05E480068E206D20E012191400840F2 +:1052D00000D001202860002070BD564870BD10B578 +:1052E000044600F08AF8002807D0E106C90E012024 +:1052F000884052490860002010BD4E4810BD10B5CE +:10530000044600F07AF8002808D0E106C90E012012 +:1053100088404A4980310860002010BD454810BDD2 +:1053200070B50D46044600F068F8002819D02846EC +:1053300000F071F8002816D0A007C20EFF209040A0 +:10534000A907090E9140002C10DA2207120F083A23 +:105350009308354A9B009B18DA6982430A43DA6155 +:105360000CE0344870BD3348401C70BDA3082F4A80 +:105370009B009B181A6882430A431A60002070BD84 +:1053800070B50C46054600F038F8002805D02846D0 +:10539000FFF73EFF2070002070BD264870BDBFF3B0 +:1053A0004F8F21492648C860BFF34F8FFEE770B585 +:1053B0001F4C05462178012000290ED1207072B6BD +:1053C00000F0F4F81C4E803631688143616000F0D3 +:1053D000EDF8C043306062B600202870002070BD38 +:1053E00013490A78002A06D0002804D1124A4868D6 +:1053F0001060002008700020704710B50446202877 +:1054000005DA00F0D3F80121A140084201D00020C4 +:1054100010BD012010BD012803D0032801D00020B9 +:10542000704701207047000000ED00E000E400E05C +:10543000D40000200120000000E100E000E200E0D4 +:105440000400FA05F8B50446800700250126002867 +:1054500004DA5848C563C66302208443E00404D5D7 +:105460005548C563C66380148443600003D5534820 +:10547000456080058443E00504D55148C563C66393 +:1054800080158443A00404D54E48C563C663401408 +:10549000844360042704C00FF90F884203D04AA157 +:1054A000612006F024FDB80F0AD04C49CD634C486A +:1054B000C563C563CE63C663C663032080038443AC +:1054C00020050AD5474FFD632F20EBF76DFEFE63E5 +:1054D0002F20EBF769FEF8148443FBF773F9424879 +:1054E000044203D038A18D2006F001FDF8BDF0B5CF +:1054F00000210A46FF230446CC40E4072AD04CB2E0 +:10550000E606F60E0125B540384E3560384E35605A +:10551000002C11DA25072D0F083DAE08354DB600D9 +:105520007619F569A407E70E1C46BC40A54314464E +:10553000BC402543F5610DE0A6082F4DB600761955 +:105540003568A407E70E1C46BC40A5431446BC4082 +:1055500025433560491C2029CDD3F0BD70B5274CBB +:105560000D462060FFF76EFF2068FFF7C0FF28465A +:10557000ECF7D2FFFBF732F8F6F758FDFBF722F90C +:10558000F6F7F1FCECF74EFE00F06AF870BD10B5CE +:105590001A4C2068FFF756FF2068FFF7A8FFFBF7BB +:1055A00011F9EDF73EF80020206010BD13480068A7 +:1055B00070470000C01F0040C0CF004000E5014020 +:1055C000C08F0040C0DF00407372635C736F635F25 +:1055D000636F6E6669672E6300000000C0EF0040D5 +:1055E000C0FF0040C0BF0040FEFF0FFC80E100E0B4 +:1055F00080E200E000ED00E000E400E0DC000020DC +:1056000070B5002402460D4620462146002A1ED0D1 +:10561000012A04D0022A04D0032A1ED103E001206B +:1056200002E0022013E003202B0006F08EFD071697 +:105630000507090B0D0F1600012108E0022106E005 +:10564000032104E0042102E0052100E00621F7F730 +:105650001AFA002801D0204670BD0724FBE700009D +:10566000B448002101708170704770B5B24D0123BC +:105670006B60B24B1C68002CFCD0002407E00E6865 +:1056800006601E68002EFCD0001D091D641C94429B +:10569000F5D30020686018680028FCD070BD70B594 +:1056A000A44C0D466178884203D0A5A16F2006F076 +:1056B0001EFC2B0006F049FD0954062525545454C0 +:1056C000544B54002078022803D09DA1732006F08B +:1056D0000EFC03202070A078022802D0012804D0FC +:1056E00008E0A06806F02EFA04E02269E168A068EC +:1056F000FFF7BBFF0020A070F7F766F904202070C9 +:1057000070BDF7F716FA01466068F8F72BFC0546FE +:105710002078022803D08AA1872006F0E8FB8C4A73 +:105720008C498D48954205D86269032A02D2521CE1 +:10573000626103E0854208D802224A71401BC860BA +:1057400084496078F7F76AFE70BD032003E0A07813 +:105750000028FAD10220F7F743F800F0E1F870BD15 +:1057600077A1B12006F0C3FB70BD70B50546F7F711 +:10577000E0F9704C60602078012803D070A1B82057 +:1057800006F0B5FB73490220087000220A718D6093 +:1057900003224A71704ACA6020706078F7F73EFEB3 +:1057A00070BD10B5634CA078002802D12078002885 +:1057B00001D0112010BD6948F7F74CF9607060788E +:1057C000002804D0012020700020606110BD03205B +:1057D00010BD10B50124020B64040121604BA042EE +:1057E00002D29140186802E0203A5868914008407F +:1057F00000D0012010BDF8B50E46910005464F19A6 +:1058000014463F1F009106F0AEF9009980028919F5 +:10581000091FB14201D2012200E00022002C03D076 +:10582000FF2101318C4201D90920F8BD4D498D423B +:1058300019D3AF4217D3854205D2874203D22846F7 +:105840003043800701D01020F8BD8E420BD3002AD0 +:1058500009D12846FFF7BDFF002804D13846FFF7DD +:10586000B8FF002801D00F20F8BD3F483F4900682D +:10587000884205D0224631462846FFF7F6FE0FE063 +:10588000FFF78FFF0028EFD12A480121C66085600D +:10589000046181702046302148431830FFF765FFCE +:1058A0000020F8BD10B504462E48800A84420BD370 +:1058B00006F059F9A04201D8102010BDA0020446FC +:1058C000FFF787FF002801D00F2010BD2648274989 +:1058D0000068884203D0204606F034F90AE0FFF75A +:1058E00060FF0028F1D113480221846081702048B4 +:1058F000FFF73BFF002010BD1A48010B0120884034 +:10590000401E704700B50B460246FFF7F5FF1042F8 +:1059100001D00F2000BD124802604360002000BD8E +:1059200010B5044C6078F7F7E9F800202070A070FB +:1059300010BD0000E000002000E5014000E401404F +:105940007372635C736F635F666C6173682E630070 +:1059500030750000B01A0020D0FB01009F560100F6 +:105960000006004000D0010060000020BEBAFECA60 +:105970003A560000F74805218170002101704170FE +:10598000C1708160704710B5F3490A78022A07D0C8 +:10599000CA681018C860C8689638F8F79BFA10BD36 +:1059A0008A68101888608868F6E70378EB49EC4A43 +:1059B000002B02D0012B10D014E00379002B01D072 +:1059C000012B0FD14379002B01D0012B0AD1836821 +:1059D000643B8B4206D2C06810E00379002B03D0F1 +:1059E000012B01D0002070474379002B01D0012BFF +:1059F000F8D1C368643B8B42F4D280689042F1D8FE +:105A000001207047F8B504460226F7F7EFFE00685C +:105A1000002803D0D3A1BD2006F069FA0127CD4D9F +:105A2000002C08D02078002817D0012805D00228A3 +:105A300011D0032813D02F710DE06068C82808D357 +:105A4000F8F7BEFA002804D06068FFF79CFF012633 +:105A500003E0002601E000F0F9F93046F8BD2878AF +:105A60000028F8D16068FFF7A0FF0028E3D0606845 +:105A70000078002826D0A878042803D0B9A1F72000 +:105A800006F035FAB44F00203870606800790128BC +:105A900000D00020387160684079002837D003209A +:105AA000787160688168E868F7F7D5FAB86060686F +:105AB000C0689630F8600320A870A749E878F7F727 +:105AC000ADFCC8E7A4480221017061680979012989 +:105AD00019D00021017161684979002915D003218D +:105AE000417161688968963181606168C968C16087 +:105AF000C068984C14346060F7F71BF820606F7032 +:105B00000220A870A7E70321E4E70221E8E70220CA +:105B1000C6E7F8B58F4C0D46E178884204D0FF20E7 +:105B200090A1193006F0E3F928468A4F0025012696 +:105B30001437030006F009FB090612375A7C8D97CB +:105B4000C4A0C400A078032807D0A078022804D0FD +:105B5000FF2084A11D3006F0CAF9F8BDA078032803 +:105B600007D0A078022804D0FF207EA1213006F0C3 +:105B7000BEF90420A07025712078002810D1FFF70D +:105B800002FFE078F7F787FAE0607D49886A7D4A8E +:105B9000024022617B4AD24310408862002050E0DC +:105BA00000F054F9F8BDA078032807D0A0780228A7 +:105BB00004D0FF206BA1423006F099F9207800282C +:105BC00002D000F04FF9F8BDA07803281FD10420BF +:105BD0002AE0091A6048C1600146E078F7F71EFC28 +:105BE000F8BD0420F6F7FCFDA570F8BDA0780328E9 +:105BF00007D0A078022804D0FF205AA1633006F015 +:105C000076F920780028DCD1A07803280BD0F6F7AD +:105C100090FF01463868F8F7A5F90028E1DB7968BC +:105C20008142DEDBD5E70520F6F7DAFDA670F8BD88 +:105C3000A078042804D0FF204AA1843006F057F948 +:105C40000220A1688847FFF7DDFEFF260546BD3626 +:105C500042E0A078042804D0FF2042A1893006F059 +:105C600046F90120EDE7A078042899D0FF203DA156 +:105C70008E3006F03CF993E7A07804280AD06078CB +:105C8000002802D0A078022804D0FF2035A193304C +:105C900006F02DF92078002893D12079002804D02F +:105CA0000620F6F79DFD2571C0E76078002805D035 +:105CB0002949E078F7F7B2FB6570F8BD0720B3E734 +:105CC000FF2028A1AE3046E7002D0AD0012D06D0D6 +:105CD00024A1304606F00BF9022DF5D1F8BD0420C1 +:105CE00000E00320A1688847FFF78CFE0546F3E734 +:105CF00070B5050005D0174CA078052803D01120F9 +:105D000070BD102070BD2048F6F7A4FEE070E0786A +:105D1000002803D0A5600020A07070BD032070BDD6 +:105D200010B50C480178002901D0112010BD8178F0 +:105D300005292BD0817801292AD08178002927D004 +:105D4000012101708178012922D0807800281FD09C +:105D500020E00000F8000020C01A00203D8601006D +:105D6000FF1FA1077372635C736F635F7261646985 +:105D70006F5F74696D65736C6F742E630000000053 +:105D80000005004002810000135B01000F2010BDE0 +:105D900000F068F8002010BDF8B5394E0446B07820 +:105DA000002801D001280DD1002C0DD02046FFF78E +:105DB000FCFD00280AD02078324D002808D0B078A9 +:105DC000012823D00F20F8BD1020F8BD0720F8BD12 +:105DD00002272F702079012814D0002028716079C3 +:105DE000002811D003206871A0689630A860E06890 +:105DF000E860E868224C14346060F6F79AFE206090 +:105E0000B77019E00320E9E70220ECE700202870D2 +:105E10002079012816D0002028716079002813D03D +:105E200003206871A168F068F7F715F9A860E068C9 +:105E30009630E8600320B0701249F078F7F7EEFA78 +:105E40000020F8BD0320E7E70220EAE710B50E487E +:105E5000816A0E4A11400A4A126911438162F6F7BB +:105E6000B3FD10BD10B5064CE078F6F747FE0820EC +:105E7000F6F7B6FC0520A07000202070607010BD01 +:105E8000F8000020C01A002000050040FD7EFFFF42 +:105E9000F8B500245C48FAF77CFB002801D00C2000 +:105EA000F8BD5A4FC82026464643F51901462846F4 +:105EB00005F0F2FE0120B8556C80554900200870AD +:105EC000544A4A808035E9625349641C087029634A +:105ED0005249E4B208704A802964082CE2D34A4847 +:105EE000FAF76FFB0020F8BD10B54748FAF749FBF9 +:105EF000002803D04AA1212005F0F9FFFFF7C8FFD1 +:105F0000002803D046A1272005F0F1FF10BD10B5F1 +:105F100004463D48FAF73DFB002801D00C2010BD97 +:105F20003A4A0021C8204843105C00280AD0C82300 +:105F3000002059435054881820603348FAF741FB39 +:105F4000002010BD491CC9B20829EBD32E48FAF72E +:105F500038FB1F2010BD082805D2C82250432B4A09 +:105F6000135C002B01D012207047801808600020BD +:105F7000704710B504462448FAF70BFB002801D0FF +:105F80000C2010BD2088214A082804D2C82148438B +:105F9000105C002801D00020208000202188491CAE +:105FA00089B22180082900D300212180C8235943C8 +:105FB000515C00290BD0401CC0B20828EED3002051 +:105FC000C04320801048FAF7FCFA122010BD0E489A +:105FD000FAF7F7FA002010BD10B504460A48FAF7A0 +:105FE000D8FA002801D00C2010BD2078002804D059 +:105FF0000548FAF7E6FA0C2010BD0120207002488F +:10600000FAF7DFFA002010BD14010020F01F002075 +:1060100030260020FFFF0000150100205E26002032 +:106020007372635C6C6C5F64622E6D302E63000073 +:1060300010B53C48FAF7A5FA002803D03AA11E2073 +:1060400005F055FF3748FAF7A4FA002804D036A126 +:10605000242005F04CFF10BDFF211131364805F01A +:106060001BFE3549012008700020488033498871A3 +:1060700088748875324908712A48FAF7A2FA10BD67 +:1060800010B504462748FAF784FA002801D00C20FE +:1060900010BD29490878002807D000200870214841 +:1060A0002160FAF78EFA002010BD1E48FAF789FA2F +:1060B0001F2010BD70B505460C461A48FAF769FA5C +:1060C000002801D00C2070BD1B4A5088A84202D184 +:1060D0001078002804D01348FAF773FA122070BD24 +:1060E00010482260FAF76DFA002070BD10B5044622 +:1060F0000C48FAF74EFA002801D00C2010BD0E48CB +:106100000178002907D00020C04320800548FAF715 +:1061100058FA122010BD408820800248FAF751FA40 +:10612000002010BD1B0100207372635C6C6C5F6407 +:10613000622E73302E63000070200020502100205A +:106140007021002010B5282105F0A4FD10BD70B508 +:10615000054600780A0700090001120F1043287055 +:1061600007290ED2080078440079001887440305F7 +:10617000030503070300062408E00C2406E022249C +:1061800004E00024F8A1572005F0B1FE68788009EA +:1061900080012043687070BD00780007000F7047D1 +:1061A00010B5C01C05F0A5FF10BD0A4610B5C11CF6 +:1061B000104605F09EFF10BD10B5093005F099FF9F +:1061C00010BD0278BF23C9071A40490E0A43027066 +:1061D000704700784006C00F704702785206520E92 +:1061E000C9010A430270704770B50C460546C11CD0 +:1061F0002046093005F07DFF20784006400E2070D3 +:1062000029784906C90FC9010843207070BD70B5CF +:1062100015460E4604461F2A03D9D3A1A82005F02F +:1062200066FE20462A463146093005F0D6FC6078E5 +:10623000AD1D80098001A906890E0843607070BDFC +:1062400070B5054640780E468406A40E062C03D28F +:10625000C5A1B82005F04BFEA41FE4B21F2C00D945 +:106260001F24294622460931304605F0B6FC204657 +:1062700070BD70B515460E4604461F2A03D9BAA153 +:10628000CC2005F034FE20462A463146093005F080 +:10629000A4FC6078AD1D80098001A906890E084321 +:1062A000607070BD70B5044640780E468506AD0E30 +:1062B000062D03D2ACA1DD2005F019FEAD1FEDB215 +:1062C0001F2D03D9A8A1E12005F011FE21462A4681 +:1062D0000931304605F081FC284670BD0A78C2734A +:1062E0004A7802748A784274C978817470470A784F +:1062F000C2744A7802758978417570474176090AF7 +:1063000081767047C176090A017770474177090A9B +:1063100081777047C175090A0176704781757047AA +:1063200020300279C90652095201C90E0A4302718E +:10633000704720300279D206D20E49010A43027119 +:10634000704710B51F3005F0C9FE10BD41780078C8 +:106350008906890E0007000F06D0012808D0022800 +:1063600009D0062810D10AE0891F1F290AD90BE09D +:106370000C2907D008E0891F1F2903D904E0891FD1 +:106380001F2901D80120704700207047417800780C +:1063900089060007890E000F042805D1062903D3BA +:1063A000252901D8012070470020704770B401787A +:1063B0000907090F03292ED0052931D1411C827EFE +:1063C0000C46437E11021943037FC27D1D02037EEA +:1063D000C67E1B021343827D407835438006800EC3 +:1063E00022281DD106291BD31920C001814217D8AC +:1063F000FF26F436B54213D8002A11D0082A0FD848 +:106400008A420DD28B420BD8617F227F0902114351 +:10641000814208D904E040788006800E0C2802D022 +:1064200070BC0020704770BC0120704710B522215D +:1064300005F030FC10BD10B502788B079208920071 +:106440009B0F1A430270427852095201427001298F +:1064500008D0022906D0032905D0FF2042A1EE3042 +:1064600005F045FD10BD01210A43427010BD10B575 +:1064700002788B07920892009B0F1A4302704278B1 +:10648000520952014270012907D0022905D003297F +:1064900004D035A1384805F02AFD10BD01210A437A +:1064A000427010BD00788007800F70470278EF239C +:1064B000C9071A40C90E0A43027070474178C07874 +:1064C000C906C90E0E2835D202007A4412799218F4 +:1064D000974406090C0F1215181B1E2124272A2D7C +:1064E0000C2929D02AE0082926D027E0022923D028 +:1064F00024E0172920D021E00D291DD01EE001291C +:106500001AD01BE0012917D018E0022914D015E099 +:10651000092911D012E009290ED00FE001290BD072 +:106520000CE0012908D009E0062905D006E002297F +:1065300002D003E01B2901D80120704700207047DA +:1065400070B50546C1700E2926D20800784400793E +:106550000018874406131517191B1B151D1D1B1B3F +:106560001F150C241DE000007372635C756C5F7076 +:1065700064752E630000000007020000082410E08C +:1065800002240EE017240CE00D240AE0012408E0A8 +:10659000092406E0062404E000249A499A4805F0FC +:1065A000A6FC6878400940012043687070BDC0783F +:1065B0007047C171090A01727047017AC2790802F5 +:1065C000104370474172090A81727047817A427A9A +:1065D000080210437047C172090A01737047017BBA +:1065E000C27A0802104370474171090A81717047ED +:1065F0008179427908021043704701717047007930 +:1066000070474173090A81737047817B427B08029E +:106610001043704770B4017AC37909021943431CCF +:10662000857A1C46467A2B023343657926792C02FB +:106630003443C21C754E00798D1FB54215D8FF2515 +:10664000F435AB4211D800280FD008280DD8884265 +:106650000BD28C4209D8507A117A00020843B11D3E +:10666000884202D870BC0120704770BC002070477F +:1066700010B5001D05F032FD10BD0A4610B5011D14 +:10668000104605F02BFD10BD4172090A817270475A +:10669000817A427A0802104370470171704700798D +:1066A000704710B5001D05F031FD10BD0A4610B54C +:1066B000011D104605F02AFD10BD0A7802734978C5 +:1066C00041737047027B0A70407B4870704710B579 +:1066D0000E3005F01BFD10BD0A46014610B50E3107 +:1066E000104605F013FD10BD0A7882754A78C27510 +:1066F0008A780276C97841767047827D0A70C27DB9 +:106700004A70027E8A70407EC870704710B5001DC6 +:1067100005F0FCFC10BD0A4610B5011D104605F041 +:10672000F5FC10BD0A7802734A7842738A78827346 +:10673000C978C1737047027B0A70427B4A70827BC2 +:106740008A70C07BC8707047017170474171090A37 +:1067500081717047C171090A0172704700797047F1 +:1067600081794279080210437047017AC2790802A0 +:10677000104370470171704700797047017170478D +:1067800010B5001D05F0C2FC10BD0A4610B5011D74 +:10679000104605F0BBFC10BD10B5001D05F0B6FCA1 +:1067A00010BD0A4610B5011D104605F0AFFC10BD26 +:1067B00070B515460E4604461B2A03D911491448E4 +:1067C00005F095FB2A463146E01C05F006FA607894 +:1067D000E90640094001C90E0843607070BD70B5FC +:1067E000054640780E46C406E40E1B2C03D9054925 +:1067F000084805F07CFB2246E91C304605F0EDF91F +:10680000204670BD68650100A70200007A0C0000F8 +:10681000F70300000304000070B504460020A083C5 +:10682000208C1E4648431546114605F04DFA20843B +:10683000F000294605F03AFA401C80B201461922C0 +:1068400069439202E083914201DD401EE0837D2096 +:106850002946000205F02AFA401CA08470BD70B5DC +:106860000A7BD206D20E0A73002282758B181B7A1D +:10687000DC075B08DD07E40FED0F2C195B08DD0773 +:10688000ED0F2C195B08DD07ED0F2C195B08DD07F8 +:10689000ED0F2D195C08E307DB0F5B196508EC07AA +:1068A000E40FE4186B081B1984186374847D521C70 +:1068B000E318D2B28375052AD8D3D8B2252803D9D4 +:1068C000E2A18A2005F013FB70BDF8B50446174617 +:1068D0000E46254622462346214600203035C0324A +:1068E000A0338031032E0AD0002E37D0012E3ED0A7 +:1068F000022E03D1A11C2846FFF7B1FFF8BD288066 +:10690000A871E871E87228736873A873A870E870BA +:10691000287168716876A8832E4668842036B07125 +:106920002885B072E8752876E8732874F0723073A1 +:10693000B07337752884FF276035AF70B075088352 +:1069400048838883C883088448845871C88518732D +:1069500026210855A08410701071F8BDC885987163 +:10696000A18823890A462846FFF756FFC2E7C88553 +:10697000938A128AA1882846FFF74EFFF8BD70B5AA +:106980000446034630348033054603290AD00029E3 +:1069900034D0012939D0022903D1A91C2046FFF7A0 +:1069A0005EFF70BD00202080A071E071E072207356 +:1069B0006073A073A070E070207160716076A08336 +:1069C000214660842031887120858872E0752076A8 +:1069D000E0732074C872087388730A752084FF22DC +:1069E0006034A270887529461884A03188701876A2 +:1069F0002035D861A8710871087570BDA9882B89E8 +:106A00000A462046FFF708FFC7E7D86AA988C38966 +:106A100042892046FFF700FF70BD70B5867D0D46A8 +:106A20000446002E01D0252E01D9122070BD002A67 +:106A300018D0287EE17D50430818252105F036F94D +:106A4000E1750846CA084907490F844BAA18595CE2 +:106A5000127A914308D0314605F028F9491CCAB290 +:106A600000200AE0002070BD2076002070BD0028C4 +:106A700003D02118097C511ACAB22118497C9142CD +:106A80003AD32918097AC943CB07DB17D21A521E09 +:106A90001206120E35D08B07DB17D21A521E1206C1 +:106AA000120E32D04B07DB17D21A521E1206120EEC +:106AB00030D00B07DB17D21A521E1206120E2ED040 +:106AC000CB06DB17D21A521E1206120E2CD08B06E2 +:106AD000DB17D21A521E1206120E2AD04B06DB17F3 +:106AE000D21A521E1206120E28D00906C917511AC0 +:106AF000491E0A06120E26D0401C0528B7DB1F20AF +:106B000070BDC0002076002070BDC000401C207603 +:106B1000002070BDC000801C2076002070BDC00029 +:106B2000C01C2076002070BDC000001D2076002013 +:106B300070BDC000401D2076002070BDC000801DCB +:106B40002076002070BDC000C01D2076002070BDE2 +:106B500070B50D460446072904D9FF203BA15B30E0 +:106B600005F0C5F9E078502108406907490F8830E1 +:106B70000843E070A078A72108401830A070607822 +:106B80005E210840203060702078BC2108404030F1 +:106B9000207070BD0179490901D0002070470022A2 +:106BA00030B41146445C491CE3076408E507DB0F79 +:106BB000ED0FEB186408E507ED0FEB186408E50727 +:106BC000ED0FEB186408E507ED0FEB186408E50717 +:106BD000ED0FEB186408E507ED0FA407EB18E40FC1 +:106BE000E318D218D2B20529DCDB002A02D030BC6F +:106BF0000120704730BC0020704738B505460C4670 +:106C00006846F7F73FFE00281ED069460020085668 +:106C10002072092161560022411A00D549422035CF +:106C20006B798B420FDCFF2B0DD0A17A491CC9B2C6 +:106C3000A172AB79994202D8617A7F2903D160723F +:106C40000020A0720122104638BD00007372635C00 +:106C50006C6C5F7574696C2E63000000F2C10100FA +:106C6000F8B5F94F0024BC70FF20F84DF870287873 +:106C7000264600281CD9C0B2864204D3FF20F4A1C6 +:106C8000C03005F034F9F000811BF4480818047096 +:106C900044708470C470F978B14202D1BC70FF2195 +:106CA000F97004714471761C2878F6B28642E2D3FA +:106CB00029780020002908D9E84AC3001B1A9B182C +:106CC0009C71401CC0B28842F7D3E548FFF7AEFB89 +:106CD0000021E348FFF7EAFB0121E148FFF7ABFBA6 +:106CE000FF20E87028716871A871E8712872F8BDFA +:106CF000D6490122002805D00820087002204870DB +:106D00008A7004E00A700F20487006208870A7E798 +:106D10001B20704710B4CD4A00211378CF4A002BB6 +:106D200009D9CC00641AA418A479002C03D0491CFA +:106D3000C9B29942F5D3994208D2CC000123641A12 +:106D4000A2189371017010BC1846704710BC002047 +:106D5000704710B4BD4900230978884217D2C20099 +:106D6000BE49121A51188A79002A10D00B704B7044 +:106D70008B70CB70B44AD478844202D19370FF20D8 +:106D8000D0700B714B718B7110BC0120704710BC1F +:106D900000207047AD490A78904209D2C3001A1A00 +:106DA000AE4BD2189279002A02D0087201207047A7 +:106DB0000020704770B4A54BA84D197A82B0CA0064 +:106DC000541A2E5D6A461670621954786A46147118 +:106DD0005A78514322225143A24A8B186A461478AA +:106DE0001179614080290AD0117822224906490E82 +:106DF0005143C918016002B070BC0120704702B055 +:106E000070BC00207047914981B0087AC200121A04 +:106E10009248101843786A461370497803781278BC +:106E20005A40802A0ED003786A46137012785206B0 +:106E3000520E521C8A4208D26A461178491CC9B2C5 +:106E4000117009E0002001B0704769460978090611 +:106E500001D5002100E080210170012001B07047C0 +:106E60007A490A78904209D2C3001A1A7B4BD21889 +:106E70009279002A02D0C871012070470020704723 +:106E800070B4724B754CD97982B0CA00551A665DE0 +:106E90006A4616712A1954786A4614705A78514312 +:106EA000222251436F4A8B186A4611781279914217 +:106EB0000BD06946097822224906490E5143C91868 +:106EC000016002B070BC0120704702B070BC0020AD +:106ED000704738B55D4AD079C100091A5F48445CF3 +:106EE0006B461C70081852784478411C1B789C42F1 +:106EF00024D00C786B461C701B785B065B0E5B1C09 +:106F0000934205D26B461A78521CD2B21A7006E030 +:106F10006A461278120601D5002200E080220A702B +:106F20008178491C81708178C078814204D19F208A +:106F300047A1800004F0DBFF012038BD002038BDF0 +:106F40004248C079C100091A44480A185278405C86 +:106F5000824201D101207047002070473B48C1792F +:106F6000CA00531A3D4AD15C9A18527840781346A9 +:106F70004B40802B0AD049065206490E520E9142D0 +:106F800001D3881A01E0511A401AC0B270472F4845 +:106F9000407870472D4A1378002298420ED2C300E1 +:106FA0001B1A2E4818188379002B07D00A70827894 +:106FB000C378D31A0B70C27001207047002070474D +:106FC000224A127890420CD2C200121A234810189A +:106FD0008279002A05D08278C078101A08700120C2 +:106FE0007047002070471E490160704717490A78B2 +:106FF000904209D2C3001A1A184BD2189279002A6B +:1070000002D0C87001207047002070470E49CA782E +:10701000FF2A03D000210160084670478A78124990 +:10702000012A02D0016001207047002070470F48FC +:10703000017801291CD0012101700448C17802485F +:10704000C170012070470000F01A00201C010020D0 +:107050007372635C646D5F712E630000F41A00202C +:107060005C1E00202C1B0020D01A0020F21A0020E9 +:107070000020E7E796490A78904209D2C3001A1A1D +:10708000944BD2189279002A02D0087101207047DF +:107090000020704790498E4BCA781B799A4206D1DE +:1070A0008A788E49002A02D00160012070470020B2 +:1070B00070478948864AC1781279914209D1FF21E7 +:1070C000C17087480178002903D000210170012098 +:1070D00070470020704780487D4AC17812799142FC +:1070E00004D18078002801D000207047012070472B +:1070F00077490A78904209D2C3001A1A754BD21800 +:107100009279002A02D088710120704700207047D0 +:1071100030B46F4982B08A79D3009C1A6D4BE41861 +:1071200025796B461D7064791C710B784C788978D1 +:1071300063434A439918222251436A4A6B461C789A +:107140008A181979614080290AD0197822234906C2 +:10715000490E59438918016002B030BC01207047C4 +:1071600002B030BC00207047594981B08879C20014 +:10717000121A584812185379101D6A4613708978EC +:10718000037812785A40802A0ED003786A4613702A +:1071900012785206520E521C8A4208D26A46117860 +:1071A000491CC9B2117009E0002001B0704769465E +:1071B0000978090601D5002100E080210170012035 +:1071C00001B0704742488079C100091A4148091846 +:1071D00048790979884201D1012070470020704721 +:1071E0003B490A78904209D2C3001A1A394BD21887 +:1071F0009279002A02D04871012070470020704720 +:1072000030B4334982B04A79D3009C1A314BE41828 +:1072100025796B461D7164791C700B784C788978E0 +:1072200063434A439918222251432E4A6B468918D8 +:107230001A781B799A420BD06A461278222352069A +:10724000520E5A435118016002B030BC0120704701 +:1072500002B030BC002070471D4981B04879C2009F +:10726000121A1C48101803796A46137089784379FA +:107270001278401D934219D003786A461370127831 +:107280005206520E521C8A4205D26A461178491C97 +:10729000C9B2117006E069460978090601D50021D6 +:1072A00000E080210170012001B07047002001B092 +:1072B000704707484079C100091A064809184879FB +:1072C0000979884201D101207047002070470000F1 +:1072D0001C010020F41A0020F01A0020D01A00200F +:1072E000F21A00202C1B0020F8B5FF4E04467078DF +:1072F00001270025FD49002802D0012806D009E019 +:10730000FB48407A002805D0777003E0887F00288A +:1073100000D07570F748027D002A09D065701021F1 +:107320002170417DA170817DE17005750120F8BD5E +:1073300070782B2250434018827F002A10D00146DB +:107340002A221F31A01C04F048FC65700420207024 +:10735000A77070782B214843E4494018857711E0E5 +:107360000878012801D00020F8BD65701320207036 +:107370000E461C22891CA01C04F02FFCA571357040 +:10738000DD48C5760120F8BDF8B5D84E0746B07F78 +:1073900000282DD13846FEF7FFFE00210125D74CED +:1073A000072824D202007A441279921897440305E0 +:1073B000081F1F1F0A00217006E02570217208E0D7 +:1073C000032000E002202070CD493846FEF738FF48 +:1073D00020723846FEF7FDFE6070CA493846FEF757 +:1073E000E4FEC14CC84F20787F2807D101E021720C +:1073F000F8BDFF20C5A14F3004F079FD207838702A +:107400007F202070B5770320FBF74CFBF8BD10B54B +:107410000020FBF7CCFA002812D0F7F7B1F90021D1 +:107420000120F7F7B3F8BE48F7F7C1F9BD4C606C1F +:10743000F7F7C0F9207D032805D0022803D006E025 +:1074400000F0FFFD10BD01210020F7F72BFAF7F740 +:1074500010FAA94C607F002803D0F7F76EFDF7F70C +:10746000EEF90320E07710BD10B5AF4C002861891C +:1074700008D0FF290DD24804000C6081FF2808D9EC +:10748000FF2005E0012904D94808608101D10120CD +:10749000608195484168012901D0002901D10D2161 +:1074A0004160C94317225143627A3B23D2435A4376 +:1074B0008A1842606189900C04F0F8FB617210BD7B +:1074C000984A0023D3775062D1778B480121017607 +:1074D0007047894A00231370924B98621170012003 +:1074E00010767047F8B5844CE07F022804D0E07F26 +:1074F000012801D00C20F8BD00207C4A05462B2134 +:10750000414389188D77401CC0B20228F7D315700B +:10751000784E3575607F002804D0F7F798F9F7F7B3 +:107520001DFD65776576A576E5767E4F257701208A +:10753000F8733D75A57738737873B8737B497C48C9 +:1075400004F0FCFDF07FF877387820703846011D94 +:107550004EC9074624374EC741694163257600204E +:10756000F8BD10B564480021C1776F4A1170012140 +:10757000C177FFF7B7FF002803D064A16D4804F07E +:10758000B6FC10BDF1B586B00C205B4C0490E07FDA +:10759000012805D0E07F022802D00C2007B0F0BD02 +:1075A000F7F7F5F80020F6F7B4FE504D207E2E4692 +:1075B00060368035002838D05C485D49009004F082 +:1075C000BDFDE87FF07720782870284601462431F9 +:1075D0008EC9001D8EC0016A002701606776A776FC +:1075E000287B002805D1687B002802D1A87B0028D1 +:1075F00019D0207F002816D0287D032802D0022829 +:1076000005D008E005214C4800F039FD03E00321D6 +:10761000494800F034FDB17F0098F6F7F2FE0020F3 +:10762000049027760AE0277602E0E07F022803D064 +:10763000E07F022824D008E000200490E07F0128A9 +:1076400003D1394908720220E077F07F002803D087 +:10765000F17F6868F6F718FF2878002806D02978A7 +:10766000364AA868F7F759FC0120607706986864E5 +:107670003348F7F71BF8F7F795F8049807B0F0BD13 +:107680000120E0770C2007B0F0BDF8B5F7F77FF8E0 +:10769000194CE07F022803D0F7F784F80C20F8BDDE +:1076A000214E0120707270810220F7F76DF8254895 +:1076B000F6F73FFF244F0025A07F0321401C04F074 +:1076C000F5FAA177C85D012848D06D1CEDB2032DF5 +:1076D000F2D3FFF79CFE307800283DD001283BD044 +:1076E000022841D0032831E0280100207026002024 +:1076F000B0260020D0260020102700209026002051 +:107700009926002092260020B82600207372635C20 +:107710006C6C5F64645F7363616E2E6300000000D5 +:107720003C270020F026002030270020E8260020FB +:10773000082700205B030000642700203F2700206B +:10774000FAC1010000C20100FC2600200CD0FD207F +:10775000F849800004F0CBFB0020F8BDC8B2F64920 +:10776000085CF6F7F8FEB4E7EBF752FCF4E770B507 +:10777000F24C0125A576E37E002B01D03A2070BDA6 +:10778000EF4B0026002802D1987F884208D19977D4 +:1077900066761146EB4804F0ACFC657625772576D5 +:1077A000A676002070BD024600200123E349002A8E +:1077B00003D0012A03D012207047CB7300E0C873B6 +:1077C0000B764A757047032801D1DD4A1163DB4906 +:1077D00008750120087600207047DB49012803D096 +:1077E000032801D0002000E001200870704710B588 +:1077F000F7F719F8F7F70CF8F6F716FFF6F7BAFFF0 +:10780000CE4C607F002805D0F7F721F8F7F7A6FBEC +:1078100000206077CC48012101720220E077F6F762 +:10782000C1FF002010BD10B500F00BFC10BDF0B57D +:10783000C74C83B02146C031C44EA034009100280B +:1078400010D0C448FEF782FD002804D1C148FEF7DD +:107850009DFD002806D0BA4D287D03280DD1A07EBD +:1078600000280AD0E07F052869D20100794409790F +:1078700049188F44646464F3F200E07F052878D2ED +:1078800001007944097949188F4473737302EA003F +:10789000B048FEF781FCAD498870E87B002803D131 +:1078A000F6F744FE002800D001200190607F0028F8 +:1078B00013D00526761EF6B2F7F771FB07460228AD +:1078C00005D1002EF6D19B49A34804F010FB019886 +:1078D000002810D1012F0ED001909C4F9F4EB878F8 +:1078E000072870D201007944097949188F446CFD4A +:1078F000056B6B6B28000120EEE7607F002803D04A +:10790000F6F7A5FFF7F72AFB9048F6F7BBFF00282C +:1079100001D17F203870F6F7A3FF019800280AD024 +:10792000287D012801D0022805D1F6F77DFE89487F +:10793000FFF72AFD2EE2F6F777FEFFF768FD2BE250 +:10794000607F002803D0F6F782FFF7F707FB7F4838 +:10795000F6F798FF002801D17F203870F6F780FFF6 +:107960000198002877D0287D022803D0012878D0FC +:1079700041E218E27748FFF707FD0120FBF717F80F +:1079800000286CD076497348FEF72EFC7448F6F751 +:107990000EFF607E00280DD06948018B3180418B3D +:1079A0007180808BB08031466D48FEF7F9FB002076 +:1079B0006076A07601210846F6F774FFF6F714FF0B +:1079C0000520E077E8E14DE1607F002803D0F6F77D +:1079D0003EFFF7F7C3FA5D48F6F754FF002801D1E0 +:1079E0007F203870F6F73CFF0198002833D0287DBF +:1079F000022808D0012834D0032836D04D495948F0 +:107A000004F075FAC8E15348FFF7BEFC0120FAF70D +:107A1000CEFF002823D052494E48FEF7E5FB5048E0 +:107A2000F6F7C5FE607E00280DD04548018B3180F9 +:107A3000418B7180808BB08031464948FEF7B0FBA6 +:107A400000206076A07601210846F6F72BFFF6F7B6 +:107A5000CBFE0520F5E018E103E0B9E1A7E1B3E0D2 +:107A600017E13C48FFF790FC94E13A482969C27855 +:107A70004B7F9A421DD102798B7F9A4219D142796C +:107A8000CB7F9A4215D10A46203283791778BB42C0 +:107A90000FD1C3795778BB420BD1037A92789342C6 +:107AA00007D100780A7F4006C00F904201D1012023 +:107AB00000E000206A7D012A2FD0002800D13AE79B +:107AC0000220FAF774FF00287ED00120FAF7EAFFBF +:107AD00023492048FEF788FB2869018B2048FEF7E0 +:107AE00019FC2869817D1E4800E03DE0FEF716FC88 +:107AF0001B48F6F75CFE607E002866D01048018BBC +:107B00003180418B7180808BB08031461448FEF704 +:107B100047FB00206076A07690E00028D0D10D4889 +:107B20001D31FEF742FB0B48FEF753FB296908772E +:107B3000C6E700000C770100FDC1010010270020FE +:107B4000F0260020082700203027002028010020F0 +:107B5000702600203C270020CE040000E8260020EC +:107B600064270020C6050000607F002803D0F6F7D8 +:107B70006EFEF7F7F3F9FA48F6F784FE002801D114 +:107B80007F203870F6F76CFE019800287DD0F6F75C +:107B900041FC002879D0287D0328F24804D0FFF763 +:107BA000F3FBF6F741FDF5E02969C2784B7F9A4275 +:107BB00020D102798B7F9A421CD14279CB7F9A42A5 +:107BC00018D183790A4601E049E037E0203217787E +:107BD000BB420FD1C3795778BB420BD1037A92785D +:107BE000934207D100780A7F4006C00F904201D12E +:107BF000012000E000206A7D012A24D0002800D165 +:107C000099E60220FAF7D3FE002828D00120FAF7DF +:107C100049FFD549D348FEF7E7FA2869018BD248D6 +:107C2000FEF778FB2869817DCF48FEF777FBCE48C9 +:107C3000F6F7BDFD607E002800D05FE70120E0760A +:107C40000620E077A8E00028DBD1C6481D31FEF70A +:107C5000ACFAC448FEF7BDFA29690877D1E700F00D +:107C6000F0F999E0607F002803D0F6F7F0FDF7F710 +:107C700075F9BB48F6F706FE002801D17F20387061 +:107C8000F6F7EEFDF6F7D0FC00E0B4E0FFF7BFFB3F +:107C900082E0B448FEF780FAB070B248B249C278C8 +:107CA0004B7A9A421CD102798B7A9A4218D1427946 +:107CB000CB7A9A4214D182790B7B9A4210D1C27945 +:107CC0004B7B9A420CD1027A8B7B9A4208D1007886 +:107CD00009784006C00FC909884201D1012500E09A +:107CE0000025F6F7A1FCB078042840D1002D3ED045 +:107CF0009B48F6F7C7FD002801D17F203070F6F7CA +:107D0000AFFD0098007A002802D00020FFF7ACFBFE +:107D100000990120954D0872924F687A002839D158 +:107D20000420E8723846FEF754FA002801D00128F2 +:107D300000D128738E493846FEF737FA8D49384608 +:107D4000FEF7B0FAE8741F2801D91F20E8743078D4 +:107D5000894F7F2804D1FF2088494F3004F0C7F8AD +:107D6000307838707F2030700120687212E07C48D3 +:107D7000F6F788FD002801D17F203070F6F770FDFE +:107D80000098007A002802D10120FFF76DFB0099CE +:107D900000200872FFF73BFBE07F022840D0E07F25 +:107DA00004282FD12AE0D3207449C00028E6607F40 +:107DB000002803D0F6F74BFDF7F7D0F86848F6F740 +:107DC00061FD002801D17F203070F6F749FD12E0F7 +:107DD0006348F6F757FD002801D17F203070F6F791 +:107DE0003FFD0098007A002802D10120FFF73CFBFC +:107DF000009900200872F6F717FCCBE75F4960484E +:107E000004F075F800980078002809D001280ED0F9 +:107E1000022807D0032810D058495A4804F067F8C0 +:107E200003B0F0BDE07F032807D003B0F0BDE07FD2 +:107E3000062802D0E07F0528F7D10120F6F7E7FDFC +:107E400003B0F0BDF8B5504DE87F504F072867D21A +:107E500001007944097949188F44626262626203C1 +:107E60000B004048F6F7A3FCF6F703FD0420E87783 +:107E70005AE0F6F7D8FCF6F7CBFCF6F7D5FBF6F7A9 +:107E800079FC012038720220E877F6F78BFC404C31 +:107E9000217800203F4E01292CD0A0703E48009050 +:107EA00001694888A080087FE0713C481D3104F0DA +:107EB00020F9009800698188E182C18821830189C5 +:107EC0006183C07E2077B07FA0733549354804F0C8 +:107ED00010F9687F002803D0F7F761F8012812D065 +:107EE000607F400840006077012020700220FAF790 +:107EF000D9FD19E0317D0029F8D113217175B075D4 +:107F000001203075F2E7607F012108436077F7F7C1 +:107F10005FF8617F4000C907C90F01436177E3E75C +:107F20001649214803F0E3FFE87F022816D0E87FD6 +:107F3000032806D0E87F042803D010491B4803F02B +:107F4000D6FF3878002809D0012807D0022831D080 +:107F500003282FD00949164803F0C9FFF8BD0000D7 +:107F6000280100203C27002064270020B0260020A4 +:107F7000BD260020C4260020E32600200C77010047 +:107F8000DA060000EF06000010270020302700204E +:107F900070260020D0260020F02600207826002021 +:107FA000E82600207F260020540700005A07000022 +:107FB000660700000120F6F72AFDF8BD70B55D4C9C +:107FC000E07F5D4D052820D20100794409794918E8 +:107FD0008F441B1B1B1902005848F6F753FC00285E +:107FE00002D156497F200870F6F73AFC287A00281B +:107FF00002D10120FFF738FA00202872F6F714FBAF +:10800000FFF705FA01E000F01CF8E07F022813D02A +:10801000E07F032803D04A494A4803F068FF2878E4 +:10802000002809D0012807D0022806D0032804D050 +:108030004349454803F05BFF70BD0120F6F7E7FCBC +:1080400070BD10B5F6F7EFFBF6F7E2FBF6F7ECFACA +:10805000F6F790FB374C607F002805D0F6F7F7FB6A +:10806000F6F77CFF0020607733480121017202207F +:10807000E077F6F797FB0020FAF714FD10BD70B516 +:10808000324C0546264660367834032943D005290C +:1080900040D1FEF757F805212846FEF758F8B17F82 +:1080A0002846FEF78EF821462846FEF779F8284C38 +:1080B000284621690F31FEF711F92169284613314D +:1080C000FEF715F92069817D2846FEF727F920691A +:1080D000018B2846FEF71EF9206981882846FEF7A5 +:1080E0000DF92069C1882846FEF70CF9206901893D +:1080F0002846FEF70BF9216928460A31FEF721F9D7 +:108100002069817E2846FEF70BF92069C17E28464A +:10811000FEF70FF970BDFEF715F803212846FEF7AC +:1081200016F8B17F2846FEF74CF821462846FEF7A0 +:1081300037F870BD102700203027002028010020CC +:108140000C7701009D070000A907000070260020A1 +:10815000F0260020F8B5FEF701FF0446FEF7BBFF4E +:10816000F94E0546F0682030407D002826D00128D1 +:1081700067D0022869D0032871D0FF20F3A177309F +:1081800003F0B5FE3069F722017811400170F26802 +:108190002032937DDB071B0F1943FB23194001702D +:1081A000D37DDB075B0F19430170577DEF23022F4F +:1081B00060D0012F63D0032F65D06AE0E748FEF757 +:1081C00069FF002827D030690090F168088EC988BF +:1081D0004018801D87B20098FEF7E9F9012805D004 +:1081E0000098FEF7E4F9002808D00FE0F06839465F +:1081F0008030C7860098FEF747FA07E0F0683946F6 +:108200008030C06A87800098FEF7FBF9F168032090 +:1082100020314875B6E7D148FEF732FE002804D079 +:10822000F0685B21095C002907D0CC48FEF7DBFE33 +:10823000F168012020314875A4E702212030417502 +:10824000A0E7C648FEF7CFFE9CE7C448FEF718FE3D +:10825000002897D1FF20BDA1693008E0FFE7BF48A3 +:10826000FEF718FF00288DD1FF20B8A1713003F070 +:108270003EFE87E7012C08D8002D06D009E06D1ED0 +:108280002C4302D105E0002C03D0194010231943E0 +:1082900000E019400170D17F002915D0517D0129DE +:1082A00012D0AF48F6F783FAAE4801210176F268A2 +:1082B000916ED26E42610161A9493269F6F7B9FD4A +:1082C0000020F6F7C5FD03E0F6F771FAF6F7E3FDD7 +:1082D00001210846F6F7E6FA03203070F8BD0828B9 +:1082E0002FD203007B441B79DB189F4403060B0E3F +:1082F00011152528002926D023E0022923D003299F +:1083000021D01EE007291ED01BE008291BD018E051 +:108310000A390C2917D914E00D2914D00C2912D0D0 +:10832000002A04D00D290CD316290CD909E01129F3 +:1083300007D3162907D904E0092904D001E001294F +:1083400001D0002070470120704730B5054683B04A +:108350008248FEF75BFE002803D17CA1824803F02F +:10836000C6FD794C2069FEF761F803212069FEF70C +:108370007EF82069EF220178114001702946FEF74E +:10838000DFF80D2D76D22800784400790018874454 +:108390001F1606448080840E7280848460006A48C0 +:1083A000C1680069A0314979FEF777F975E0664840 +:1083B000C16800698031497CFEF7E0F96DE06248F0 +:1083C000C16800698031096B491CFEF751F964E00E +:1083D0005D4CE0688030C06A81792069FEF70DF954 +:1083E000E0688030C06A01892069FEF7FDF8E06826 +:1083F0008030C06A41892069FEF7DBF8E068803090 +:10840000C06A81892069FEF7DDF8E0688030C06AC3 +:10841000C1892069FEF7DFF83FE04B4CE06880300F +:10842000C16A2069091DFEF73CF9E0688030C16A25 +:1084300020690C31FEF741F9E0688030C16A20699B +:108440001E31FEF744F9E16820698831FEF74CF9E6 +:1084500023E03D4CA06941782069FEF775F9A069D9 +:1084600081882069FEF772F9A06941882069FEF7CA +:1084700071F912E00DE00020009069460190087843 +:1084800001210843694608702F480069FEF778F912 +:1084900003E02EA1354803F02AFDFEF7C8FD0028B1 +:1084A00003D12AA1324803F022FD0C2D0ED0072D56 +:1084B0000ED0012D0AD0002D08D0022D06D0224862 +:1084C0000021C068403041820121817503B030BD78 +:1084D0001D480021C0684030018303B030BDF8B5AD +:1084E000F6F7A1F9F6F794F9F6F79EF8F6F742F9E0 +:1084F000F6F7D1FCF6F756F9134CE0682030807996 +:10850000012801D1F6F7ACF9E068012502462032D6 +:10851000917F002908D1E178CB0701D1890703D5E4 +:1085200095770121FAF76EFAA079002803D100F0BF +:10853000F7FD00F015FCE0780026C0070028E06891 +:1085400018D04030868119E0300100207372635CDE +:108550006C6C5F6D61737465722E63004001002066 +:10856000B2270020D827002065060000A9060000D9 +:10857000AF06000040308189491C8181E068A42158 +:10858000095C002908D15C210A5C2030417F012070 +:10859000FFF7A5FE002804D0E0684030018A491C9E +:1085A0000182A0793D21002804D0E068403081722A +:1085B00045725BE0E07902280AD001280AD0607990 +:1085C00000281BD0420701D4C2060AD51E21ECE7C1 +:1085D0001621EAE7E068A621095C40308172457205 +:1085E00044E00207E1D4C10706D1800704D4232068 +:1085F000F5A1000103F07BFC2A21D6E7E0680246E2 +:108600004032917D002905D0518A4B1C5382938AB8 +:10861000994213D2917E002905D0138B591C1183E6 +:10862000918A8B420AD2118AD389994203D3A42713 +:108630003F5C002F02D1978AB94203D32220907267 +:10864000557213E03E21095C0029918905D09942B9 +:1086500009D308209072557208E0062903D33E2002 +:108660009072557202E0517A00290AD0E068014602 +:108670002031CE760E778E7749210D542570022158 +:1086800001E025700021FAF7BDF9F8BDF8B5044600 +:10869000D148FDF76EFC00286FD1D04E6946708935 +:1086A000FDF759FC002803D0C7A1CD4803F01FFCFB +:1086B000009800258030016C0978072920D0A21C81 +:1086C0000C292CD00B2936D0062942D07789009866 +:1086D0000146A0310A7E002A50D065701222227015 +:1086E000009AA032127E002A08D0A2300D76028BAA +:1086F0006280428BA2800A7E002AF7D10120F8BD59 +:10870000657007212170016C0A22A01C091D03F06D +:1087100064FA00988030006C05700120F8BD657027 +:108720000C212170016C8A886280C988A180006C4C +:1087300005700120F8BD65700B212170016C8B88DC +:108740001380CB88538009899180006C05700120CB +:10875000F8BD657006212170016C8B881380CB8871 +:1087600053800B8993804B89D3808B891381CB896C +:108770005381006C05700120F8BD15E09648FDF7A7 +:10878000F8FB002803D090A1964803F0B0FB69469F +:108790007089FDF7E0FB002803D08BA1924803F01D +:1087A000A6FB7089B84292D10020F8BD8B480078B2 +:1087B000012801D00C2070470020704770B5874C0D +:1087C00005462078002803D07FA1884803F08FFB5E +:1087D0000020A5612072012020702078012803D09C +:1087E00079A1834803F083FB70BDF8B57B4C2178F9 +:1087F000012901D00C20F8BDE0608030807CFEF7BC +:108800002FFB00283AD0E0688030807CFEF770FCB7 +:10881000002833D0E0688030807CFEF7E7FB00283A +:108820002CD0E0688030807CFEF724FC002825D026 +:10883000F5F7ADFF0026A6710120F5F76AFDE068A7 +:10884000014640318A7D002A03D04A8A8B8A9A42A7 +:1088500011D28A7E002A03D00A8B8B8A9A420AD2CE +:108860000B8ACA89934206D23E231B5C8989002B5E +:1088700006D0914206D30120A0703EE01220F8BD40 +:108880000629F8D2A6701330F5F710FFE0680F3014 +:10889000F5F74FFE0320F5F777FFE5684020405DD0 +:1088A000002803D13F20405D00280CD02F467837A8 +:1088B0005048A96FBB68EA6FFF688EC029464E48D2 +:1088C000883103F023FCA020405BA91C401C82B22D +:1088D00028463030FEF7A1F8002803D03AA14748D7 +:1088E00003F005FBE0684030007AF5F734FEF5F759 +:1088F00047FF01210020F5F749FEE67026716671F9 +:10890000E67102202070E06880300684F5F74AFFA7 +:108910000020F8BD10B5F5F73AFF304C207802285A +:1089200003D0F5F73FFF0C2010BDA078002802D03F +:10893000FFF7D5FD17E0F5F757FFFFF70BFCE068F1 +:1089400020308079012801D1F5F793FF207A0028A3 +:1089500009D0012809D0022805D0032805D01AA182 +:10896000274803F0C4FA002010BDEAF751FBFAE7EC +:1089700070B5044601468031088C2546401C0884A9 +:108980004035A889401CA881A87D002802D0688AAB +:10899000401C6882A87E002802D0288B401C2883B7 +:1089A000A420005D002807D13D20015D2A7F012021 +:1089B000FFF795FC002802D0288A401C2882204618 +:1089C00000F046FB002070BD7372635C6C6C5F6DE1 +:1089D00061737465722E63003A010020300100203B +:1089E00084070000CD070000D1070000EB0700005E +:1089F000F7070000D8270020F127002036080000E4 +:108A000076080000F94908727047F84A1162D0618F +:108A10007047F8B5F54C2078032803D0F449F548A1 +:108A200003F065FAE06804262030817C00250029E7 +:108A300003D0857421793143217121690127097897 +:108A4000C9438907002907D1C17C002904D1C77413 +:108A500021790222114321712179490702D5407FF2 +:108A6000022802D06079002802D0FFF738FD2AE002 +:108A7000E148FEF74DFB002801D0657002E0677009 +:108A8000DE486061E06840300078002811D0DC48A2 +:108A9000F5F78DFEDB480576E268116F526F426193 +:108AA0000161D74A6169F6F7C4F90120F6F7D0F9F8 +:108AB00004E06069F5F77BFEF6F7EDF9022100208E +:108AC000F5F7F0FE2670207801280CD0207A0028D7 +:108AD00009D0012807D0022806D0032804D0C449B1 +:108AE000C94803F004FAF8BD0120F5F790FFF8BD7E +:108AF000F8B5BE4C05462078042803D0BC49C348CD +:108B000003F0F5F9002D7DD0F6F7DDF96178012548 +:108B10000843002813D1E0684021095C00290ED0E9 +:108B200061694A78D2060AD0097820300907C07DE9 +:108B3000C90F814203D1A571FFF7D1FC8CE0E06839 +:108B400020308079012811D1F5F78AFEE168881C70 +:108B50003031FEF752F8002808D0E068BA21428888 +:108B60000A523921095CA030017705766069002638 +:108B700000784007C10FE0682030827D914236D0F6 +:108B8000407D002833D0022810D1FEF7A2F900283A +:108B900004D12F209649400103F0A9F9E26800238F +:108BA000906ED16E401C5941D1669066E0682030CD +:108BB0004675C17C012914D1C67420790821084367 +:108BC0002071FEF776FA002803D18949904803F016 +:108BD0008EF9E2680023906ED16E401C5941D16637 +:108BE0009066E0682030817D012946D085756069F6 +:108BF00001788C460907CF0FE1680A462031CB7D0A +:108C00009F4200E087E00CD16746BF07BF0F012FEE +:108C10004BD0022F49D0032F31D060790421084373 +:108C20006071E0782843E07020690078C00604D4C1 +:108C300060690078C00600D47EE720790028FBD167 +:108C400060780028F8D1F9F7D2FE0028F4D06079D6 +:108C50000028F1D1FFF77EFA207801280CD0207A85 +:108C6000002809D001285BD0022805D0032857D05E +:108C70005F49684803F03BF9F8BD8675B7E7FDF733 +:108C80001DFC00280CD0E068203085742179294330 +:108C90002171C17D012901D1C675C2E7C575C0E743 +:108CA0006079102108436071BBE74078C7062CD07B +:108CB0006378002BB5D1C006C00E1B28F0D8403217 +:108CC000127FC97E0520FFF70AFB002804D06079D7 +:108CD000082108436071A4E7E07804210843E070AC +:108CE000FEF742FA002803D141494B4803F0FFF850 +:108CF000E0680023016F426F491C5A4142670167D7 +:108D00002030C17D0129C9D1C6E7012B01D0CD7525 +:108D100087E7CE7585E7E07802210843E0700BE72E +:108D20000120F5F774FEF8BD10B53048007804282E +:108D300003D02F49394803F0DAF8FFF7D0FB10BD14 +:108D40003E210A5C40308189891C002A04D0C089F8 +:108D5000814203D3012070470629FBD200207047CF +:108D6000F0B58DB02E48FEF751F9002869D01F4CA0 +:108D70006079002865D1E0685C210A5C2030417F81 +:108D80000120FFF7ACFA00285BD1E068A421095C60 +:108D9000002901D00220BDE002462032D17E052903 +:108DA0004BD0204E0C2953D000250D294BD0132930 +:108DB00068D0127F012A7DD0052A7CD0AC221258BF +:108DC0001378002B78D0528843889A4274D140306F +:108DD000027F0020FFF783FA00286DD0E068AC2105 +:108DE00009580978891E062966D21EE03001002044 +:108DF000C8890100AB080000440100209027002032 +:108E0000B2270020D8270020D6080000DF08000085 +:108E1000F105000032090000390600003A0900009F +:108E2000400100202A0700000BE00A007A44127972 +:108E300092189744898BC4C4B5F6F849F84803F0F2 +:108E400056F80DB0F0BDD577403005700B2061E0CD +:108E5000F3F735F90C28F4D3E06808218030C06AB4 +:108E60001E30F3F72DF9002806D0E0680421883081 +:108E7000F3F726F9002803D1E849304603F037F824 +:108E8000032047E08030E749C56A10260023082206 +:108E900069440E35F41A6419203CE77F4F70A47FB3 +:108EA0008C70891C521E9B1C002AF3D1DE4C1026AC +:108EB000C56A02E03AE031E081E003A9082003310D +:108EC0001E35B31A5B19203BDF7F4F709B7F8B7081 +:108ED000401E891C921C0028F3D16846F7F7CFFB8F +:108EE000E16808AE1DCE0D46CA6778358867EC602C +:108EF000AB6000250D674D678D66CD6601253F2669 +:108F0000755440267554C94D88311DC5C84803F0B5 +:108F1000FDF80620FFF719FA0DB0F0BD0720FFF7A6 +:108F200014FAE068203005770DB0F0BD0C20FFF793 +:108F30000CFAE1680123084640318A7F1A438A7798 +:108F4000203005770DB0F0BD00200CE03F21095C1A +:108F500000290BD040300078002803D1AF49B54834 +:108F600002F0C5FF0A20FFF7F0F928E0F3F7A7F8B1 +:108F70000C2824D3E06808218030C06A1E30F3F743 +:108F80009FF8002806D0E06804218830F3F798F8AD +:108F9000002803D1A149304602F0A9FF0320E2E7EF +:108FA0004030807F80070AD10C20FFF7CEF9E168BE +:108FB000012040314D8288758A7F02438A77E068BC +:108FC0005C210A5C2030C17E0020FFF788F9002870 +:108FD000B8D0E168B420405C0028B3D0E0690078E4 +:108FE0000028AFD1088E0A28ACD905220A31206AA0 +:108FF00002F0C6FD002826D0E0688030016B0878BA +:10900000002810D00522491C206A02F0B9FD002872 +:1090100098D1E0688030006B0078002803D009E028 +:10902000FFE708209FE7E068216A8030006B401C62 +:1090300003F054F8E0688030016B0878401C087039 +:109040000120FFF782F9E068A03005750DB0F0BD92 +:10905000F8B5054606462036F07E2C4600278034BB +:1090600007281FD1288EE18E401C884257D1216BE2 +:1090700028460A30491C03F031F801220221284613 +:10908000FDF77DFCF776012166204155206B0078C5 +:10909000002803D16149684802F029FF216B087854 +:1090A000401E0870F07E082839D1E16A288E898830 +:1090B000401C884233D1206C0178002904D05749E4 +:1090C0005E4802F014FF15E06988C180E06A216CF7 +:1090D00040890881E06A216C80894881E06A216CBE +:1090E000C0898881206C0771216C07200870216C71 +:1090F00068884880012211462846FDF740FC03217C +:109100002846F9F77FFCE06A69884088884203D0E6 +:1091100042494B4802F0EBFEE06A0770F776F8BD73 +:1091200070B5414C6079002877D12079012640073D +:10913000002500284ADAE0683B21095C11293ED06D +:1091400004DC022907D0052939D107E0132936D0DC +:10915000152934D107E031493A4801E02F493A480E +:1091600002F0C5FE2BE001464031CD768D75AC2175 +:10917000095840884988814203D02849334802F081 +:10918000B6FEE06801468030C26A1570026C137842 +:10919000002B04D021492E4802F0A9FE0CE04B8898 +:1091A000D380036C027C1A71026C1572036C0B2263 +:1091B0001A70006C49884180E0682030C576E0680C +:1091C0002030417F022901D1E6714577207980075F +:1091D0004AD56079002847D12069C0780D287DD212 +:1091E00001007944097949188F446552069EFAFABC +:1091F000B9343FFA798EC700E0685C210A5C203000 +:10920000417F0120FFF76BF800282DD1E068032291 +:109210003D210A5440308575E0E0F8E0C88901003E +:1092200092050000FFFFFFFF30010020D82700203B +:10923000F12700204D050000820200008F0200008F +:10924000A3020000210400002504000034040000F3 +:1092500039040000E0685C210A5C2030017F0020B6 +:10926000FFF73DF8002879D1BEE0E0685C210A5C98 +:109270002030C17E0020FFF732F8002803D1FE49DC +:10928000FE4802F034FEE06809212030C176ABE0F0 +:10929000E0685C210A5C2030C17E0020FFF71FF8E7 +:1092A000002803D1F449F64802F021FEE0680721C6 +:1092B0002030C17698E0E0685C210A5C2030C17EF5 +:1092C0000020FFF70CF8002803D1EB49ED4802F02D +:1092D0000EFEE06808212030C17685E080E0E0687D +:1092E0005C210A5C2030C17E0020FEF7F8FF0028D8 +:1092F00003D1E149E44802F0FAFDE0685B210E5435 +:109300000A212030C1766FE0E0682030C07E0D2851 +:1093100003D0D949DD4802F0EAFDE0685C210E5433 +:109320000C212030C1765FE0E0685C210A5C2030CF +:10933000C17E0020FEF7D3FF002808D1E06840304E +:10934000007F002803D1CC49D14802F0D0FDE0686D +:109350005B210E540E212030C17645E03CE0E068F0 +:109360002030C07E132803D0C349CA4802F0BFFD95 +:10937000E06816212030C17636E0E068AC2109585B +:1093800043884A889A421DD1097806291AD15C215E +:109390000A5C2030C17E0020FEF7A1FF002804D126 +:1093A0004B20B549000102F0A2FDE06801464031C2 +:1093B0008A7F920702D42030C67603E08D75803014 +:1093C000C06A0570E0685C210A5C2030017F0020E3 +:1093D000FEF785FF002807D0E0684030857603E07F +:1093E000A549AD4802F083FD207900070AD56079D0 +:1093F000002807D1E0682030417F032902D10221F3 +:10940000E171457700F004F8E068FFF721FE70BDD8 +:1094100070B5A24C82B02079C0076ED06079002868 +:109420006BD16069C0780E2868D20100794409794F +:1094300049188F44636306632645646163FD631EB8 +:10944000A64DE0685C210A5C2030417F0120FEF7D8 +:1094500046FF002850D16069FDF721F9E168A62296 +:10946000505402223D2042540020403188768875B5 +:109470008BE1E0682030C17E0A2945D10D21C176FB +:1094800083E1E0683B21095C0E293DD1AC210958FC +:1094900040884988814203D07749814802F027FDFE +:1094A000E0688030C16A60692631FDF734F9E1680F +:1094B00060698C31FDF73FF9E0681121203005E04B +:1094C000E0682030C17E11291ED11321C1765CE1F4 +:1094D000E0683B21095C112901D00E2914D14030EC +:1094E000007F002810D16069FDF746F9E1689022FD +:1094F000505415202031C87647E14EE126E1E0685E +:109500003B21095C162902D0022060713DE1014631 +:1095100000254031CD768D75AC21095840884988A9 +:10952000814203D054495F4802F0E1FCE068014603 +:109530008031CA6A15700A6C1378002B02D04E492C +:109540005948E5E0034640331E7F002E0BD01D77BF +:109550004388D3800A6C15710B6C0C221A70096C4D +:1095600040884880EEE04388D3800A6C15710B6C0C +:1095700001221A720B6C0B221A70096C4088488009 +:10958000E0E0E0685C210A5C2030017F0020FEF70B +:10959000A6FE00280DD1E0685C210A5C2030C17E67 +:1095A0000720FEF79CFE002803D1607901210843C3 +:1095B0006071607900284ED1E0684030807F80077C +:1095C00015D46069FDF7CAF8E1684031C877606971 +:1095D000FDF7C6F8E168403108846069FDF7C5F819 +:1095E000E168022240314884887F10438877E06830 +:1095F000014640318A7FD20716D10A7F2030017F91 +:109600000020FEF76CFE002803D11B49274802F01A +:109610006EFCE06801213C2211540623A822135459 +:109620004030817600210183E0680146203100E06E +:1096300012E0CA7E012A03D10022CA7656210A54BA +:10964000AC21095840884A88824204D1087806280B +:1096500001D10020087098E0E0685C210A5C2030AD +:10966000C17E0620FEF73BFE002803D16079012170 +:109670000843607160791BE0C88901008204000022 +:10968000870400008C04000091040000970400008F +:109690009D040000A4040000CA0400003001002062 +:1096A000FE0200003A0300003F0300007A030000BE +:1096B00000286AD169466069FDF773F8684600784A +:1096C000C107C90F6846017004D0E068012160300D +:1096D000017103E0E068002160300171E06800255D +:1096E00056210D54AC21095840884988814204D044 +:1096F00075202B49C00002F0FAFBE068014680307B +:10970000C26A1570026C1378002B04D024492548D6 +:1097100002F0EDFB16E04B88D380026C6B461571AE +:10972000026C1B8813816B465B8853816B469B8858 +:1097300093816B46DB88D381036C06221A70006C20 +:1097400049884180E0682030C5761EE0E0685C21F1 +:109750000A5C2030017F0020FEF7C1FD002803D104 +:109760006079012108436071607900280DD160693A +:10977000FCF71DFFE1689122505405223C20425421 +:1097800000204031088301208876E2680023116FB1 +:10979000506F491C58411167506702B070BD0000FE +:1097A000C8890100AD03000070B50446F94882790C +:1097B0000025002A0AD000292ED1657010212170C1 +:1097C000C179A170017AE170857125E0F24E327A9B +:1097D000012A04D0427A012A0FD0002070BD00294E +:1097E0001AD16570132020701C22EC49A01C02F0D5 +:1097F000F4F90120A07135720EE000290CD16570DA +:1098000014212170E3494A8962808A89A280CA8929 +:10981000E2800A8A22814572012070BDF8B5E048D5 +:109820000178002902D00C263046F8BD0026DD4D17 +:1098300034462E756E75EE752E76AE75DA496E73FA +:109840004E73D54F7F217E718170687E002804D0D1 +:10985000F4F7FDFFF5F782FB6C763C72CD4884711E +:10986000D248FCF76FFCD248FCF76CFCDCE770B523 +:10987000CB4A00251570C84ECE4B35711966D86598 +:109880001078002805D0FF20CBA1873002F02FFBF5 +:1098900070BDC44C25756575E5752576A575C248FE +:1098A0006573457375717F209070607E002804D0C9 +:1098B000F4F7CDFFF5F752FB65763572B548857143 +:1098C0001430FCF73FFCBA48FCF73CFC70BDB548CF +:1098D000007D704710B5B349C87B897B4207830779 +:1098E000D20FDB0FC007D218C00F10184000052997 +:1098F00011D20A007A441279921897440905090294 +:109900000700B149085A10BDB04810BDB04900E089 +:10991000B049085A10BDFF20A7A1A73002F0E7FA0E +:10992000002010BD9F48AC49008A48437047F8B5F5 +:1099300006469C4C407BE07330790027A0730128D9 +:1099400025D0308820829448B37B8371994DA348F9 +:109950002970114602F0CDFBB0796873F11DA04863 +:1099600002F0C7FB607B0126002800D066758E4898 +:10997000407B002800D0A675A07B05284DD20100B1 +:109980007944097949188F440409262B0900278254 +:10999000D9E700218548FCF7DAFB25E0012183485F +:1099A000FCF7D5FBE91D8148FCF706FC687B002825 +:1099B00007D001280AD0FF207FA1EE3002F097FAED +:1099C00012E000217948FCF708FC0DE001217748FE +:1099D000FCF703FC08E006217448FCF7B8FB03E041 +:1099E00002217248FCF7B3FBE7752776691C6F48C4 +:1099F000FCF7D6FB29786D48FCF7E3FB04216C48A3 +:109A0000FCF7A5FB691C6A48FCF7CAFB2978684883 +:109A1000FCF7D7FB26750020F8BDFF2066A1F830C3 +:109A2000CCE770B55F4C012525765B4A127A002A97 +:109A300001D03A2070BD5F4A13780022834205D1DD +:109A4000E275664802F055FBE57500E022760020DD +:109A500070BD70B50446534D0020A875224661487C +:109A600002F0BBF8504844730120A87570BD4A4904 +:109A70000871704710B54B4C002262756073024646 +:109A8000594802F0AAF80120607510BD424948719A +:109A90007047F8B5F4F7C7FEF4F7BAFEF4F7C4FD63 +:109AA000F4F768FE3F4C0025607E002804D0F4F7F0 +:109AB000CEFEF5F753FA6576394F3D70F4F772FE36 +:109AC000A07B012804D000210846F9F751FFF8BD1A +:109AD00000210220F9F74CFF2F4C207A01260028A4 +:109AE00008D02C4881790029F1D11321C171057268 +:109AF0008671F8BD78780028FBD02E48417BE17351 +:109B00000078A0753649394802F0F3FA33493848ED +:109B100002F0EFFA3C20A07226727D70F8BDF8B515 +:109B20001F4D287800282CD11E4C207D002828D0DD +:109B3000F4F72DFE0026A674E6746E703046F4F736 +:109B400023FE0020F4F7E5FB2A48F4F7F2FC2A484C +:109B5000F4F7ACFDF4F748FEE07B0127C1070029CC +:109B600002D0A17CC9070ED0810747D5A17C890707 +:109B700044D42620F4F7EFFCA07C02210843A07413 +:109B800048E00C20F8BD2520F4F7E5FCA07C384324 +:109B90003FE0000000220020E0210020EA21002018 +:109BA00054010020C0210020A02100201422002008 +:109BB0003C220020802100207372635C6C6C5F612A +:109BC00064762E630000000014C201009A8913001D +:109BD0001CC201000CC201007102000081210020A2 +:109BE000872100208E210020AE210020F0210020BE +:109BF000F721002007C2010004C20100400709D577 +:109C0000A07C400706D42720F4F7A5FCA07C042103 +:109C10000843A074F4F7B4FD01210020F4F7B6FC6A +:109C20000F210520F4F7F9FBFE4D2978681CF4F7A5 +:109C3000E8FBA07B01280AD0042808D0607D00281A +:109C400005D0627BF849F948FCF7E1FA6675A07D1A +:109C5000002806D0F648F749427BF748FCF709FB95 +:109C6000A675286E0178002903D00178001DF4F74D +:109C70000BFCE86D0178002904D0F04A401CF5F790 +:109C80004CF96776F4F78EFD0020F8BDEC4948608A +:109C90007047F8B50126EB4C0546002824D0E07B40 +:109CA0002146C207897C002A01D0CA070BD082074F +:109CB0000FD58A070DD42620F4F74DFCA07C022195 +:109CC0000843A07410E02520F4F745FCA07C304345 +:109CD000F7E7400708D5480706D42720F4F73BFCF0 +:109CE000A07C04210843A074E07C00280AD0A07B5B +:109CF000012804D19920D449C00002F0F8F8FFF7F8 +:109D0000C8FEF8BD002D0CD002210020F4F73EFC67 +:109D1000CE480079032801D0012802D10220F4F7AF +:109D200076FEE07D002700280AD0BE4DBF48691CA2 +:109D3000FCF736FA691CC048FCF732FAE77527765B +:109D4000BA48F4F734FDA07B05280CD20100794411 +:109D5000097949188F440202020B020001210846CA +:109D6000F4F7A0FD03E0B849B94802F0C0F8E07B81 +:109D7000A17C884303D1A07B012803D0E674B048BE +:109D80000670F8BDA774FAE710B5F4F700FDAC480B +:109D90000078002816D1AB48007D002812D00020A2 +:109DA000FFF777FFA9480079002809D0012815D0CE +:109DB000022805D0032811D0A349A64802F097F83D +:109DC000002010BDF4F72FFDF4F722FDF4F72CFC72 +:109DD000F4F7D0FCF4F7E6FC0C2010BDE9F718F915 +:109DE000EEE79749012048707047F8B50024F9F76D +:109DF000D6FC002821D0FF202D30F4F7C4FB904D75 +:109E00002878924F01281BD0022801D0032830D097 +:109E10008D49914802F06BF8287800280CD03879E9 +:109E2000002809D0012807D0022835D0032833D0D4 +:109E300085498A4802F05BF8F8BDFFF72AFEF8BDB5 +:109E4000804EB07B032814D0707E002803D0F5F735 +:109E500074F8F4F7F4FC8248F4F7A9FCB07B01280D +:109E600012D0042810D0B879012806D0032804D0D5 +:109E700004E00120FFF70DFFCEE7102421460E205D +:109E800001430020F4F70EFD7879012801D1F4F7A1 +:109E9000F0FC02202870BFE728780228CFD10120EB +:109EA000F4F7B5FDF8BD70B56848654C40790128F8 +:109EB00008D16C48F4F7E6FC002801D17F20A0709F +:109EC000F4F7CEFC5F4D687E002803D0F4F7BFFCAA +:109ED000F5F744F8F9F763FC00280AD02078022847 +:109EE00003D05949604802F002F8A87B012803D04A +:109EF00006E0FFF7CEFD70BD99208000F4F743FB2C +:109F00000120FFF7C6FE20780028F4D02078012831 +:109F1000F1D039204C49000101F0E9FF70BDF0B5E6 +:109F2000044689B0002006900090F4F7FFFA0290F2 +:109F300043480078022803D043494C4801F0D7FF3A +:109F4000424D6879012809D14648F4F79BFC002866 +:109F500002D13B497F208870F4F782FC4048FCF72F +:109F60001BF9384E0746002C5AD03D48FCF71EFA24 +:109F7000002855D0F4F74EFA002851D0707E002802 +:109F80000AD00524641EE4B2F5F709F8022811D0BE +:109F9000012800D000200090314A354CD01C01909F +:109FA000062F3DD238007844007900188744BDBDA3 +:109FB000BD0ABD85002CE5D177202EA1C00001F09F +:109FC00096FFE7E7B07B01282AD0042828D0009923 +:109FD0000298084304D1A879002801D002281FD193 +:109FE000687901281AD1607A002817D1012060729F +:109FF00010784006C00FA0722248019902F079F84B +:10A000000F4F214CB8787F2804D1A92019A1C00096 +:10A0100001F06DFFB87820707F20B870064835E0F9 +:10A0200083E0000080210020AE21002014220020C7 +:10A03000A02100208E2100203C2200206722002049 +:10A0400054010020C0210020B89B0100E021002025 +:10A05000F6040000DE020000490300005E03000079 +:10A06000642200205601002081030000CE0300007E +:10A07000002200207372635C6C6C5F6164762E63F7 +:10A08000000000000B22002011220020F4F78FFBBB +:10A090007F48032101702879002848D0012808D082 +:10A0A000022844D0032804D07A497B4801F01FFFDE +:10A0B0003DE00120F4F7ABFC39E07848D178C07975 +:10A0C00081421CD175481179037A994217D151798F +:10A0D000437A994213D19179837A99420FD1D179F8 +:10A0E000C37A99420BD1117A037B994207D1117837 +:10A0F000407B4906C90F814201D1012100E00021C6 +:10A10000B07B012801D0042801D100290AD1002800 +:10A110000BD100990298084304D1A879002801D0F6 +:10A12000012802D1307E00281FD001200690707EC9 +:10A13000002803D0F4F78BFBF4F710FF06980028F3 +:10A1400002D00120FFF7A5FD5148017800290AD06F +:10A150000178012907D00078032804D095204D49C3 +:10A16000C00001F0C4FE09B0F0BD49484C4F406842 +:10A17000397CC173797C0174B97C4174F97C817438 +:10A18000484909784906C90F01771D30019901F046 +:10A19000B0FF3F48397D4068C174797D0175B97D54 +:10A1A0004175791C897D817501994A7D0B7D11026C +:10A1B00019430183791C8A7E4B7E12021A438280E6 +:10A1C000019A537E177E1A023A43C2808A7F4B7FE0 +:10A1D00011021943018134490A3001F07FFF3348ED +:10A1E0002B4A01795768C906C90EB976007940092A +:10A1F000F876287A002809D0A079002835D11320D4 +:10A20000E071002020720120A0712EE00020A872D1 +:10A210007888B085387FE87339461D31244801F0CD +:10A2200068FF1E4823490078A875234801F061FFA4 +:10A23000B888F087F888208038896080F87E20719F +:10A240000098002860790BD0012108436071F4F771 +:10A25000BFFE61794000C907C90F0143617102E087 +:10A2600040084000607101202872094C00202070D5 +:10A27000F4F7D9FAF4F7CCFAF4F7D6F9F4F77AFA56 +:10A28000F4F790FA01206168F9F772FB4FE70000DC +:10A290005401002074A00100160400008021002059 +:10A2A00063220020642200208322002084220020D8 +:10A2B000F021002081210020F7210020F8B5FCF7D3 +:10A2C0004DFE0446FCF707FFF84E05467069203046 +:10A2D000407D002826D0012844D0022846D00328FB +:10A2E0004DD0FF20F2A19A3001F001FEB069F722B3 +:10A2F00001781140017072692032937DDB071B0FDA +:10A300001943FB2319400170D37DDB075B0F194311 +:10A310000170577DEF23022F3CD0012F3FD0032F38 +:10A3200041D046E0E648FCF7B5FE002804D071694C +:10A33000032020314875D9E7E148FCF7A1FD00284A +:10A3400004D070695B21095C002907D0DC48FCF768 +:10A350004AFE7169012020314875C7E7022120308B +:10A360004175C3E7D648FCF73EFEBFE7D448FCF78B +:10A3700087FD0028BAD1FF20CDA18C3007E0D0485E +:10A38000FCF788FE0028B1D1FF20C9A1943001F06C +:10A39000AEFDABE7012C08D8002D06D009E06D1EFC +:10A3A0002C4302D105E0002C03D01940102319439F +:10A3B00000E019400170D17F002915D0517D01299D +:10A3C00012D0C048F4F7F3F9BF4800210176726952 +:10A3D000916ED26E42610161BA49B269F4F729FD0A +:10A3E0000020F4F735FD03E0F4F7E1F9F4F753FD4D +:10A3F000B0690078C00606D4F0690078C00602D4BF +:10A40000F079002806D0B079002803D10121084650 +:10A41000F4F748FA032030703079002803D1F4F7BC +:10A42000E3F901203071F8BD10B5A0490023486957 +:10A4300002462030C3768377012049239854A03206 +:10A440009279002A03D008700021022001E0002147 +:10A450000320F9F737FA10BD06281AD202007A4411 +:10A460001279921897440205090D101000290ED098 +:10A470000FE0891E02290AD90BE0891F012906D99C +:10A4800007E0082903D004E00B390C2901D801208A +:10A4900070470020704730B5044683B08848FCF709 +:10A4A000B5FD002803D182A1884801F020FD7F4D31 +:10A4B000A869FBF7BBFF0321A869FBF7D8FFA869D0 +:10A4C000EF220178114001702146FCF739F80E2C7B +:10A4D0005BD220007844007900188744565606560F +:10A4E0001F5A5A175642565A312B704865224169F5 +:10A4F000525C002A04D006218069FCF7CEF848E0BF +:10A50000C03149798069FCF7C8F842E06748416981 +:10A5100080698031497CFCF731F93AE0634D696923 +:10A52000A869B831FCF7F2F86969A8698C31FCF7C1 +:10A53000F9F82EE05D4806218069FCF71BF928E058 +:10A540005A4D28694178A869FCF7FEF82869818886 +:10A55000A869FCF7FBF828694188A869FCF7FAF8B4 +:10A5600017E000200090019050484169603109795E +:10A57000002905D06A461178012211436A461170FC +:10A5800069468069FCF708F903E049A1504801F0E9 +:10A59000AEFCFCF74CFD002803D145A14D4801F06D +:10A5A000A6FC0C2C0AD0072C06D04048002140699C +:10A5B000403041820121817503B030BD3B4800210C +:10A5C00040694030018303B030BDF0B5374C0546DB +:10A5D00060698DB020308079012801D1F4F740F90D +:10A5E000012D14D160694021095C002903D120307C +:10A5F000C07F002801D0F4F74EFCF4F714F9F4F70B +:10A6000007F9F4F711F8F4F7B5F8F4F7CBF8607937 +:10A610000225C107002901D1800713D560692030C8 +:10A62000817F002902D0032907D00BE00121817727 +:10A6300000210120F9F746F904E085770021012087 +:10A64000F9F740F960692030817F012903D16179F0 +:10A65000090700D5857715480024407A002866D17F +:10A6600000F005FF1648FCF7D1FC00285FD00F4D25 +:10A67000287A00285BD16869C421095C00290ED0C2 +:10A680002030C17E0120FFF7E7FE002807D168696E +:10A690002030C17E0420FFF7DFFE00281CD068694F +:10A6A000C921095C06291ED024E000005C010020BD +:10A6B0007372635C6C6C5F736C6176652E63000013 +:10A6C0007401002090220020B82200208B07000097 +:10A6D000CD070000D3070000686950210C5260309C +:10A6E0004471022051E02030C17E0420FFF7B4FE07 +:10A6F000002815D068692030C07E801E16287DD2C3 +:10A7000001007944097949188F44C3C3C31CC3C3EA +:10A71000C3BFC31EC3C3C32742C3C3C3C3C3C3A5ED +:10A7200068695E21095CC90702D0C0304472D6E076 +:10A730000C20FFF7B0FE686901224030817F114391 +:10A740008177CCE0072020E0FCF73CFD00286FD0AB +:10A750006869403004700B2017E0F1F7B0FC0C285A +:10A7600066D368690821B830F1F7AAFC002806D042 +:10A77000686904218C30F1F7A3FC002804D1C720BC +:10A78000FDA1C00001F0B3FB0420FFF784FEA6E0AA +:10A7900068698446C030007A042802D0052848D071 +:10A7A0009DE0F9496046102600230822D63069440E +:10A7B000F51A2D18203DEF7F4F70AD7F8D70891CED +:10A7C000521E9B1C002AF3D103A8624610260021CA +:10A7D00008230330B032751AAD18203DEF7F477063 +:10A7E000AD7F8570801C891C5B1EF4D16846F5F72F +:10A7F00046FFE64841690D46783500E049E008AE7D +:10A800008DCECA678867EF60AB6000250D674D6726 +:10A81000012640256E54DE4D88318DC5DD4801F09E +:10A8200075FC0520FFF737FED8484069C030047238 +:10A8300055E060464030007F002805D06046012189 +:10A8400060304171022000E00D20FFF724FE6869AE +:10A85000C030047243E0696900208866C866012040 +:10A860003F2250540F4678378A6FC948CB6FBE6875 +:10A87000FF68CCC00930883101F048FC0620FFF7A2 +:10A880000AFE68694030847529E00920FFF703FE5D +:10A8900025E06869C821095C002920D0062906D076 +:10A8A0002030C17E0020FFF7D7FD002817D068694F +:10A8B0000146C0310A7A072A11D213007B441B7962 +:10A8C000DB189F440C0C0C0C0C0C03004030807FF8 +:10A8D000C20700D12CE7C043800700D10C72AB4DFA +:10A8E00028790028686902D08030048403E0803031 +:10A8F000018C491C01846879C007686904D0AC21C7 +:10A900000C544030848103E040308189491C8181AE +:10A91000E879002806D06969A031087B022806D8AA +:10A92000401C08736869A030007B022806D968695A +:10A930000146803004844484A0310C73686920305F +:10A94000C17E0020FFF788FD002804D1686920300F +:10A95000C07E07284ED168690146C0310A7A062AAE +:10A9600048D0497A062945D03E21095C022941D1C7 +:10A97000A030007B00283DD1FCF7E2FA002839D056 +:10A98000FCF7A9FB002835D069690A468032508B54 +:10A9900001282FD90B460120A033587108464030BA +:10A9A0008789C089861EB74201DB012002E0C01BF7 +:10A9B000401E80B2168CAF89BE4201D3012602E050 +:10A9C000BE1B761CB6B2B04200D93046012800D179 +:10A9D0005C71C0310B78002B10D0528C49888A42B0 +:10A9E00001D3012102E0891A491C89B2884205D9A4 +:10A9F000084603E069690120A0314C7169690E8E37 +:10AA00000A46301883B28032084693832030877F0D +:10AA1000002F29D0012F27D0022F0CD0032F0AD0CE +:10AA200055A15D4801F063FA6879C00668691DD5D3 +:10AA30008030C4851FE0C07E03280DD0082813D0C5 +:10AA40004031C8898989401A801E80B2032800D30A +:10AA5000032018181083E7E740318889032803D3BF +:10AA6000C8893018401CF5E71383DDE78030C18DBD +:10AA7000C28B8918C18568690246C03211790029E4 +:10AA800006D0014640319E230E8A1B5AF3180B82D2 +:10AA9000697A0426002913D0014640313D230A4635 +:10AAA0008B722039CC768C7701215172A03080795D +:10AAB000002875D0297000210220F8F703FF74E008 +:10AAC00001462031CB7E042B48D02B7A002B1ED0A0 +:10AAD0005A0701D4DA0604D51E2240308272CE769F +:10AAE0003CE01A0704D53D2240308272CE7635E034 +:10AAF000D80705D1980703D41FA1284801F0F7F91A +:10AB000068692A214A2211542030C67626E0403056 +:10AB1000837D002B05D0478A7B1C4382838A9F421A +:10AB20000FD2537A062B02D0127A062A05D1038B54 +:10AB30005A1C0283828A934203D2038AC2899342B7 +:10AB400003D322228272CE7608E08B7F002B38D08E +:10AB5000838993423FD308228272CE766869492264 +:10AB600001462031CC768C7701211154A0308079B8 +:10AB700000282DD0297014E07372635C6C6C5F73D5 +:10AB80006C6176652E630000FFFFFFFF5C01002013 +:10AB9000B8220020D12200205C08000043020000FF +:10ABA00016E000210220F8F78DFEF8F720FE0028BD +:10ABB0001AD068690146FF3001300279002A0FD0AF +:10ABC00012E08289062A06D33E228272CE76C5E73B +:10ABD00000210320E7E70120287000210846E2E772 +:10ABE0004988C180012101716869A03084710DB06C +:10ABF000F0BD70B5044682B00020C04369460880AD +:10AC00006846FBF773FA002873D1684601A90088EB +:10AC1000FBF750FA002803D0FD49FE4801F067F920 +:10AC200001990A46E031887C002500280AD0657029 +:10AC300010202070C87CA070087DE0708D74012009 +:10AC400002B070BD8879F44E002815D065700720D9 +:10AC50002070887900280DD07169E6208D844554D4 +:10AC60000A22A01CE83100F0B8FF0198E03080799A +:10AC70000028F1D1A5704EE0887D00283FD0887D66 +:10AC80000D2837D203007B441B79DB189F443232F6 +:10AC90003232323232320F323225060065700C20E9 +:10ACA0002070087EA07070694088A08013E06570F5 +:10ACB00008202070706913464088FA336080188835 +:10ACC000A0805888E08098882081D888FF326081F1 +:10ACD00003321088A0818D751DE065700B202070F7 +:10ACE000087EA07070694088A080087FA0718D7573 +:10ACF00011E027E0C649C94801F0F9F80BE0D01D82 +:10AD0000F9300179002909D0112165702170821C68 +:10AD1000918861800571012002B070BD017A00291F +:10AD200010D0657012212170017A0029F3D0FF3212 +:10AD300003320572118961805189A180017A00294D +:10AD4000F7D1E8E7002002B070BDB34800780128D1 +:10AD500001D00C2070470020704770B5AE4C0546FE +:10AD60002078002803D0AA49AD4801F0C0F800209F +:10AD70002561A072012020702078012803D0A44909 +:10AD8000A84801F0B4F870BDF8B5A34F397801298F +:10AD900001D00C20F8BD0125A62178610D5480302A +:10ADA000807CFCF75DF800282ED078698030807CAC +:10ADB000FCF79EF9002827D078698030807CFCF76A +:10ADC00015F9002820D078698030807CFCF752F992 +:10ADD000002819D0F3F7DBFC786900248030408B21 +:10ADE000002826D09048FCF711F9002821D0786976 +:10ADF000C421095C00291CD02030C17E0120FFF74E +:10AE00002BFB002802D014E01220F8BD7869203016 +:10AE1000C17E0420FFF720FB00280AD17869502169 +:10AE20000C52603044710220FFF735FB7869A03086 +:10AE300044717869E621095C002905D1818CC288BA +:10AE4000914201D9B98101E0C188B98101468031BF +:10AE5000CA8B521E93B20A8CD21892B20A849446BC +:10AE60000246A0321679002E02D04C84147102E002 +:10AE70004E8CF6184E8406464036B789FF18B781C7 +:10AE80004E8B012E01D8761C4E83002B00D01473FC +:10AE90002030C07E604E042817D05079002816D08C +:10AEA000B1898C4513D2FCF74BF800280FD070699C +:10AEB0000146C0310A78002A09D08030408C498888 +:10AEC000884204D3B470F57003E0B57001E0B4704B +:10AED000F4707069A5210C543B21095C062901D04E +:10AEE000072917D1CA21028E095A511A09B200291D +:10AEF00010DB0146CC310A3001F019F901220221A0 +:10AF00007069FBF7E2FC7069C9210C543B210C54B9 +:10AF100060308571404E9E2170690A5A014630307A +:10AF2000891CFBF77AFDB078002852D17069C021E6 +:10AF3000095C002901D0803044840120F3F7E9F94D +:10AF4000354E70691330F3F7B1FB70690F30F3F7CA +:10AF5000F0FA0120F3F718FC71694020405C0028EA +:10AF600003D13F20405C00280BD00F4678378A6F12 +:10AF70002E48CB6FBE68FF68CCC02D48883101F0E9 +:10AF8000C5F8F3F7FDFB01210846F3F7FFFA224E5F +:10AF900070698030806AF3F70DFC2648FCF7B8F83A +:10AFA000002801D0747002E075702348F061706968 +:10AFB00040300078002802D07078002816D0F06960 +:10AFC000F3F7F5FBF3F767FF70694030007AF3F7AA +:10AFD000C2FA114802214471C4718471047244722E +:10AFE00004710170F3F7DEFB0020F8BD1248F3F79F +:10AFF000DEFB0E4805767269116F526F4261016186 +:10B000000D4AF169F3F715FF0120F3F721FFDBE7A4 +:10B0100078AB0100810800005C010020DE08000020 +:10B02000140900001F09000074010020B82200204C +:10B03000D1220020780100209022002010B5F94C88 +:10B040002078022801D00C2010BDA078002803D061 +:10B050000020FFF7BAFA1BE0F3F799FB012100206B +:10B06000F3F720FC042020706069203080790128EB +:10B0700001D1F3F7FEFBA07A002809D0012807D000 +:10B08000022807D0032805D0E749E84800F02FFF41 +:10B09000002010BDE7F7BCFFFAE7E249887270476D +:10B0A000F8B5E04C2078032803D0DF49E04800F0F1 +:10B0B0001EFF606900262030817C042701250029BD +:10B0C00004D086740575A1793943A171A1690A7804 +:10B0D000D243920707D1C27C002A04D1C574A0795B +:10B0E00002221043A0710878C00606D4E0690078F7 +:10B0F000C00602D4E07900280CD06078002809D17D +:10B10000A079002806D1F8F760FB002802D0207A49 +:10B11000002803D00120FFF758FA1BE0C548FBF7D1 +:10B12000F7FF002801D0667002E06570C248E06158 +:10B13000606940300078002802D0607800281AD07A +:10B14000E069F3F734FBF3F7A6FE01210020F3F7E3 +:10B15000A9FB2770207801280CD0A07A002809D0FC +:10B16000012807D0022818D0032816D0AE49B348CA +:10B1700000F0BDFEF8BDB048F3F719FBB048057606 +:10B180006269116F526F42610161AB4AE169F3F785 +:10B1900050FE0120F3F75CFED7E70120F3F737FC00 +:10B1A000F8BDF8B59F4C05462078042803D09E4989 +:10B1B000A44800F09CFE6179102001436171002DCC +:10B1C0007ED0F3F780FE617801250843002814D172 +:10B1D00060694021095C00290FD0E1694A78D206F4 +:10B1E0000BD0097820300907C07DC90F814204D1F6 +:10B1F00065720120FFF7E9F903E1E07800281ED02D +:10B20000E0694178C9061AD10078C00617D4606990 +:10B210002030807901287DD1F3F722FB6169881CF9 +:10B220003031FBF7EAFC002874D06069C11D428808 +:10B23000F9314A812030007E08730D72DBE06069CD +:10B2400020308079012811D1F3F70AFB6169881C4D +:10B250003031FBF7D2FC002808D06169C81D4A884C +:10B26000F93042812031097E01730572E0690026C0 +:10B2700000784007C10F60692030827D914244D040 +:10B28000407D082700283DD0022810D1FBF721FE81 +:10B29000002804D171206449000100F028FE626991 +:10B2A0000023906ED16E401C5941D1669066606952 +:10B2B00020304675017D012906D10675A17900E08F +:10B2C00083E010221143A171C17C012914D1C674FD +:10B2D000A0793843A071FBF7ECFE002804D1E520EB +:10B2E0005149C00000F003FE62690023906ED16EE8 +:10B2F000401C5941D166906660692030817D0129EA +:10B300002AD08575607938436071E3691A7810072F +:10B31000C70F00E06FE060692030C17D8F420BD124 +:10B320009207920F0427012A25D0022A23D0032A4C +:10B3300014D0207A38432072607928436071E67116 +:10B34000A079000704D560692030C07E032852D060 +:10B35000207A00284FD152E08675D3E76278002A20 +:10B36000EAD18574A2792A43A271012901D1C67557 +:10B37000E2E7C575E0E75A78D30623D06078002865 +:10B38000DAD1D006C00E1B2818D860793843607116 +:10B39000FBF7EAFE002804D13B202349400100F0DE +:10B3A000A6FD60690023016F426F491C5A41426744 +:10B3B00001672030C17D0129DBD1D8E7207A102137 +:10B3C0000843B8E70129D4D1D1E7022001436171D4 +:10B3D000E079401CC0B2E07101280CD860694030AF +:10B3E000007800280BD014484078C106C90E052902 +:10B3F00005D2C00603D00120FFF7E7F801E0FEF711 +:10B400005DFF207801280CD0A07A002809D00128FF +:10B410001CD0022805D0032818D003490A4800F0A0 +:10B4200066FDF8BD5C01002078AB0100F409000066 +:10B430001D0A000078010020902200205C0A000014 +:10B44000B8220020740A0000D60A00000120F3F799 +:10B45000DEFAE6E710B5FE480078042803D0FD497F +:10B46000FD4800F044FD0120FFF7AFF810BDF8B52E +:10B47000F74C0025A0790007002832DA207A00284E +:10B480002FD160692030C07E801E132829D2010090 +:10B490007944097949188F44240924242424242434 +:10B4A000242424242424242424241D0060696522C7 +:10B4B000014640318D75125C002A05D006228A7241 +:10B4C00004212030C1760CE016228A72042120303B +:10B4D000C17606E0606901464030C5768575203149 +:10B4E000CD76607940070BD560692030C17E05209C +:10B4F000FEF7B2FF002803D0207A0821084320720B +:10B5000000F032F9A37901265807002821DA207AC1 +:10B5100000281ED1606902462032D17E891E07298B +:10B5200017D20F007F443F79FF19BF440312121254 +:10B530000C120F00014640318D75C0308079887241 +:10B540000420D07605E0C030467202E00221C0300F +:10B55000417298070327002849DA207A002846D14B +:10B5600060692030C17E0120FEF776FF00283ED1C1 +:10B57000A069C0780E287DD2010079440979491864 +:10B580008F44A3A306A33646620AA317A3269354A7 +:10B5900060692030C7769CE060692030C07E052855 +:10B5A00003D0AC49AD4800F0A2FC60692030C576FC +:10B5B0008FE060692030C07E092803D0A549A848E3 +:10B5C00000F095FC606956210D542030C57680E06E +:10B5D00060692030C07E0B2803D09E49A14800F04E +:10B5E00086FC60695B210E540C212030C17670E02E +:10B5F00060692030C07E0F2803D096499A4800F039 +:10B6000076FC60695B210E5410212030C17660E029 +:10B6100060692030C07E102803D08E49934800F026 +:10B6200066FC606912212030C17652E060692030EA +:10B63000C07E102803D087498D4800F058FC60690F +:10B6400014212030C17644E060692030C07E172884 +:10B6500003D08049874800F04AFC606901464031C8 +:10B66000CD7602468D75E032937D002B09D0917C1A +:10B67000002900E029E015D10B21D17415759674CD +:10B6800010E00B7F002B06D00D774388FA210B5278 +:10B6900015760C2105E04388FA210B5215761677B2 +:10B6A0000B2191752030C57613E060690146C030EA +:10B6B000027A062A04D14031897F890700D50572B4 +:10B6C000417A062905D1457203E062496A4800F0D3 +:10B6D0000EFCA079C00613D5207A002810D160692D +:10B6E0002030C17E07290BD20A007A4412799218C1 +:10B6F000974406060606060603000721C176F8BD34 +:10B7000060693B21095C0829F9D10146028EC031EC +:10B710004B89521C9A42F2D1227A002AEFD10A8A2E +:10B7200083889A4207D14B8AC488A34203D18B8A6B +:10B730000489A34208D043884B858A854A8ACA85F2 +:10B740008A8A0A86E6210E5401221146404CFBF7F4 +:10B75000BCF800210420F8F7B5F86069C9210D5440 +:10B760002030C5768777F8BD70B5394C82B0A079A6 +:10B77000C0076BD0207A002868D160692030C17E74 +:10B780000120FEF769FE002844D1E069C0780D2849 +:10B790005DD201007944097949188F443C1506E8C7 +:10B7A0005858FD3BFC58BBD5FB00E069FAF777FF22 +:10B7B0006169C622505402223B204254002040318D +:10B7C000488201208875B0E160692030C17E002088 +:10B7D000FEF742FE0028207A02D000281AD103E0AA +:10B7E000012108432072A0E1E069FAF751FF616985 +:10B7F000CA2250520A8E801A204A00B290427DDC42 +:10B8000000287BDDCC31E069FAF737FF606906215B +:10B810002030C17689E160692030C17E0020FEF7CA +:10B820001BFE002803D1207A012108432072207AD0 +:10B83000002867D1E069FAF7EDFE002848D0E069FA +:10B84000FAF7E3FE6169CA22505219E075E154E14A +:10B850005C01002078AB0100DE0A00001905000041 +:10B860001F050000260500002D050000340500001E +:10B870003A0500004C050000BA050000FE7F0000FC +:10B880000A8E801AAE4A00B290423CDC00283ADDB3 +:10B89000E069FAF7B4FE6169C0310873E069FAF74C +:10B8A000A7FE6169C031C881E069FAF786FE616967 +:10B8B000C0310882E069FAF789FE6169C0314882C7 +:10B8C000E069FAF78CFE6169D422505208202AE11F +:10B8D00060692030C17E0020FEF7BEFD002803D144 +:10B8E000207A012108432072207A00280AD1E069D9 +:10B8F000FAF75DFE61699122505400E003E00520F3 +:10B900002031C87611E128204A22505404202031E9 +:10B91000C8760AE160692030C17E0020FEF79CFDF8 +:10B92000002803D1207A012108432072207A0028C0 +:10B9300068D160690022014640304282012282754E +:10B940000B202031C876F0E0606901462031CA7EC4 +:10B950000C2A03D0227A02231A432272227A002A66 +:10B9600050D1CA770122403002770D20DCE06069B7 +:10B970002030C17E0020FEF76FFD002808D16069ED +:10B980004030007F002803D1207A01210843207233 +:10B99000207A02E048E082E035E0002832D1606998 +:10B9A000002501464030458201268675B031E069A8 +:10B9B000FAF792FE6169E0698831FAF79EFE6069E4 +:10B9C0000146E030827D002A07D0817C002915D114 +:10B9D0000821C1740575867410E04A88F820425227 +:10B9E000FA31E069FAF762FE6169E069FF3103311B +:10B9F000FAF768FE60690821E030817560690F21FF +:10BA00002030C17691E0606901462031CA7E122A59 +:10BA100003D0227A02231A432272227A002A6BD19F +:10BA20004030827517207FE060690146C0314A7A54 +:10BA3000002A06D0097A062903D0217A012211436F +:10BA40002172217A002970D14030807F800715D47F +:10BA5000E069FAF783FE61694031C877E069FAF777 +:10BA60007FFE616940310884E069FAF77EFE616912 +:10BA7000022240314884887F1043887760690146FC +:10BA8000C030027A062A01D10022027240318A7F38 +:10BA9000D2074AD1062242720020088345E060693D +:10BAA0002030C17E0020FEF7D7FC002803D1207A89 +:10BAB000012108432072207A002836D16946E069C6 +:10BAC000FAF763FE68460078C107C90F684601703F +:10BAD00004D0606901216030017103E060690021D8 +:10BAE00060300171606900220146403042820122CB +:10BAF000827509202031C87617E060692030C17E48 +:10BB00000020FEF7A9FC002803D1207A0121084378 +:10BB10002072207A002808D1E069FAF748FD6169AF +:10BB20009122505405202031C87662690023116F9C +:10BB3000506F491C58411167506702B070BD00003A +:10BB4000FE7F00000A4A022151600A490B68002B5F +:10BB5000FCD0906008680028FCD000205060086885 +:10BB60000028FCD0704701200007406970470000A2 +:10BB700000E5014000E4014070477047704770479E +:10BB8000034610B50B439B070FD1042A0DD308C8F9 +:10BB900010C9121FA342F8D018BA21BA884201D99D +:10BBA000012010BD0020C04310BD002A03D0D307E0 +:10BBB00003D0521C07E0002010BD03780C78401C15 +:10BBC000491C1B1B07D103780C78401C491C1B1B0C +:10BBD00001D1921EF1D1184610BDF8B5042A2CD31C +:10BBE000830712D00B78491C0370401C521E830738 +:10BBF0000BD00B78491C0370401C521E830704D0E5 +:10BC00000B78491C0370401C521E8B079B0F05D0FC +:10BC1000C91ADF002023DE1B08C90AE0E5F7D4FAC1 +:10BC2000F8BD1D4608C9FD401C46B4402C4310C059 +:10BC3000121F042AF5D2F308C91A521EF0D40B7849 +:10BC4000491C0370401C521EEAD40B78491C037037 +:10BC5000401C012AE4D409780170F8BD01E004C059 +:10BC6000091F0429FBD28B0701D50280801CC9075C +:10BC700000D00270704700290BD0C30702D00270B9 +:10BC8000401C491E022904D3830702D50280801C70 +:10BC9000891EE3E70022EEE70022DFE7020A0870D0 +:10BCA0004A70020C8A70020ECA70704700220309A3 +:10BCB0008B4273D3030A8B4258D3030B8B423CD382 +:10BCC000030C8B4221D312E003460B437FD40022A6 +:10BCD00043088B4274D303098B425FD3030A8B4220 +:10BCE00044D3030B8B4228D3030C8B420DD3FF228A +:10BCF000090212BA030C8B4202D31212090265D058 +:10BD0000030B8B4219D300E0090AC30B8B4201D30A +:10BD1000CB03C01A5241830B8B4201D38B03C01A51 +:10BD20005241430B8B4201D34B03C01A5241030BC8 +:10BD30008B4201D30B03C01A5241C30A8B4201D379 +:10BD4000CB02C01A5241830A8B4201D38B02C01A24 +:10BD50005241430A8B4201D34B02C01A5241030A9B +:10BD60008B4201D30B02C01A5241CDD2C3098B4280 +:10BD700001D3CB01C01A524183098B4201D38B01FD +:10BD8000C01A524143098B4201D34B01C01A5241A0 +:10BD900003098B4201D30B01C01A5241C3088B42E5 +:10BDA00001D3CB00C01A524183088B4201D38B00D0 +:10BDB000C01A524143088B4201D34B00C01A524172 +:10BDC000411A00D201465241104670475DE0CA0F49 +:10BDD00000D04942031000D34042534000229C4609 +:10BDE00003098B422DD3030A8B4212D3FC22890113 +:10BDF00012BA030A8B420CD3890192118B4208D3E9 +:10BE0000890192118B4204D389013AD0921100E04A +:10BE10008909C3098B4201D3CB01C01A524183095E +:10BE20008B4201D38B01C01A524143098B4201D38B +:10BE30004B01C01A524103098B4201D30B01C01AB6 +:10BE40005241C3088B4201D3CB00C01A5241830830 +:10BE50008B4201D38B00C01A5241D9D243088B4286 +:10BE600001D34B00C01A5241411A00D20146634629 +:10BE700052415B10104601D34042002B00D549428D +:10BE8000704763465B1000D3404201B50020C046B6 +:10BE9000C04602BD70477047704710B500F058F8B3 +:10BEA00010BD30B58C180278401C13071B0F01D150 +:10BEB0000378401C120906D10278401C03E0057883 +:10BEC000401C0D70491C5B1EF9D101E00B70491C30 +:10BED000521EFBD1A142E6D3002030BD012308CB86 +:10BEE000134B1860134B1960134B1A607047134AB9 +:10BEF000134B13607246053AF0E7114A0F4B1B686B +:10BF00009A420ED10D4B0020186001980D4B04B5DC +:10BF100098470CBC9E460246029800990A4B1B6843 +:10BF2000184706980599094B1B68DB6818470000FD +:10BF300084010020880100208C0100207C01002069 +:10BF4000EFBEADDEC12F0000840000200400002001 +:10BF50001D481E497047FFF7FBFFE5F7EFF800BDEE +:10BF600001200007C06AC0B2FF2804D1184819494F +:10BF70000968884202D018481849016018481949D0 +:10BF80000968884203D1184A13605B68184700BDEE +:10BF900020BFFDE712481349096888420ED1134BB0 +:10BFA00018680B498842F3D080F30888104988420A +:10BFB00004DD1048026802210A4302600E488047EF +:10BFC0000E4880470E480047801E0020801E00203B +:10BFD000FFFFFFFF001000102C05004008000000CC +:10BFE00000100000000000200400002000D001002C +:10BFF0000020002024050040D72F000061BF010071 +:10C00000DDBE01001348704502D1EFF3098101E064 +:10C01000EFF30881886902380078102814DB2028A3 +:10C0200010DB2B280BDB0C4A12680C4B9A4203D115 +:10C03000602804DB0A4A1047022008607047094A5A +:10C0400010470000084A1047084A12682C3212684C +:10C0500010470000FDFFFFFF60000020BEBAFECACF +:10C06000AD12000081030100010301000400002063 +:10C070000D4B0E4908470E4B0C4908470D4B0B4919 +:10C0800008470D4B094908470C4B084908470C4B1A +:10C09000064908470B4B054908470B4B034908471E +:10C0A0000A4B02490847000039250000D921000049 +:10C0B000692B0000172A0000C5290000792700001D +:10C0C000B912000037140000D92A0000CF22000066 +:10C0D0000021018041808180C18070470A78027010 +:10C0E0004B7843708A788270CA78C2700B7903717A +:10C0F00070470A7802704B7843708A788270CA78E9 +:10C10000C2700B7903714A79427170470A780270E4 +:10C110004B7843708A788270CA78C2700B79037149 +:10C120004A7942718A798271CB79C37170470A88E2 +:10C1300002804A8842800A79027170470A68026068 +:10C140008B8883808A798271704730B47446641E0C +:10C150002578641CAB4200D21D46635D5B00E3188A +:10C1600030BC1847FFFFFFFF0000FFFF0100030086 +:10C1700000000100000000000000000000000000BE +:10C180000000000087000000000000000000000028 +:10C190000000000000000001020304000D0E0F105B +:10C1A00000000000BF680000DD6A0000A56B000011 +:10C1B000FF6B0000536C0000BB6C000019690000AD +:10C1C000D16900005D6D00006B7900001001100165 +:10C1D0003A0200001A02000004013C00050044007D +:10C1E0000E00F401FA00960064004B0032001E00BD +:10C1F00014000102040810204080555555252627BB +:10C20000D6BE898E555555D6BE898E000000700663 +:10C21000120DB413000014035A06A00900006004B4 +:10C22000F208840D54C20100080000201000000034 +:10C230000411000064C20100180000207801000011 +:10C24000A2BE01008CC2010090010020F01C000081 +:10C2500020110000024801688907FCD570470000E2 +:10C2600000E200E0D10224FF360100010050372037 +:10C27000FB349B5F80B4800010022801029C0133D4 +:0CC280007F01E2290345FFFFE4E1BE015D +:00000001FF diff --git a/components/softdevice/s120/toolchain/armgcc/armgcc_s120_nrf51422_xxaa.ld b/components/softdevice/s120/toolchain/armgcc/armgcc_s120_nrf51422_xxaa.ld new file mode 100644 index 0000000..1ce9c2f --- /dev/null +++ b/components/softdevice/s120/toolchain/armgcc/armgcc_s120_nrf51422_xxaa.ld @@ -0,0 +1,22 @@ +/* Linker script to configure memory regions. */ + +SEARCH_DIR(.) +GROUP(-lgcc -lc -lnosys) + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x1d000, LENGTH = 0x23000 + RAM (rwx) : ORIGIN = 0x20002800, LENGTH = 0x1800 +} + +SECTIONS +{ + .fs_data_out ALIGN(4): + { + PROVIDE( __start_fs_data = .); + KEEP(*(fs_data)) + PROVIDE( __stop_fs_data = .); + } = 0 +} + +INCLUDE "nrf5x_common.ld" \ No newline at end of file diff --git a/components/softdevice/s120/toolchain/armgcc/armgcc_s120_nrf51422_xxac.ld b/components/softdevice/s120/toolchain/armgcc/armgcc_s120_nrf51422_xxac.ld new file mode 100644 index 0000000..411672d --- /dev/null +++ b/components/softdevice/s120/toolchain/armgcc/armgcc_s120_nrf51422_xxac.ld @@ -0,0 +1,22 @@ +/* Linker script to configure memory regions. */ + +SEARCH_DIR(.) +GROUP(-lgcc -lc -lnosys) + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x1d000, LENGTH = 0x23000 + RAM (rwx) : ORIGIN = 0x20002800, LENGTH = 0x5800 +} + +SECTIONS +{ + .fs_data_out ALIGN(4): + { + PROVIDE( __start_fs_data = .); + KEEP(*(fs_data)) + PROVIDE( __stop_fs_data = .); + } = 0 +} + +INCLUDE "nrf5x_common.ld" \ No newline at end of file diff --git a/components/softdevice/s120/toolchain/armgcc/armgcc_s120_nrf51822_xxaa.ld b/components/softdevice/s120/toolchain/armgcc/armgcc_s120_nrf51822_xxaa.ld new file mode 100644 index 0000000..1ce9c2f --- /dev/null +++ b/components/softdevice/s120/toolchain/armgcc/armgcc_s120_nrf51822_xxaa.ld @@ -0,0 +1,22 @@ +/* Linker script to configure memory regions. */ + +SEARCH_DIR(.) +GROUP(-lgcc -lc -lnosys) + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x1d000, LENGTH = 0x23000 + RAM (rwx) : ORIGIN = 0x20002800, LENGTH = 0x1800 +} + +SECTIONS +{ + .fs_data_out ALIGN(4): + { + PROVIDE( __start_fs_data = .); + KEEP(*(fs_data)) + PROVIDE( __stop_fs_data = .); + } = 0 +} + +INCLUDE "nrf5x_common.ld" \ No newline at end of file diff --git a/components/softdevice/s120/toolchain/armgcc/armgcc_s120_nrf51822_xxab.ld b/components/softdevice/s120/toolchain/armgcc/armgcc_s120_nrf51822_xxab.ld new file mode 100644 index 0000000..4095abb --- /dev/null +++ b/components/softdevice/s120/toolchain/armgcc/armgcc_s120_nrf51822_xxab.ld @@ -0,0 +1,22 @@ +/* Linker script to configure memory regions. */ + +SEARCH_DIR(.) +GROUP(-lgcc -lc -lnosys) + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x1d000, LENGTH = 0x3000 + RAM (rwx) : ORIGIN = 0x20002800, LENGTH = 0x1800 +} + +SECTIONS +{ + .fs_data_out ALIGN(4): + { + PROVIDE( __start_fs_data = .); + KEEP(*(fs_data)) + PROVIDE( __stop_fs_data = .); + } = 0 +} + +INCLUDE "nrf5x_common.ld" \ No newline at end of file diff --git a/components/softdevice/s120/toolchain/iar/iar_s120_nrf51422_xxaa.icf b/components/softdevice/s120/toolchain/iar/iar_s120_nrf51422_xxaa.icf new file mode 100644 index 0000000..48568ea --- /dev/null +++ b/components/softdevice/s120/toolchain/iar/iar_s120_nrf51422_xxaa.icf @@ -0,0 +1,31 @@ +/*###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__ = 0x1d000; +/*-Memory Regions-*/ +define symbol __ICFEDIT_region_ROM_start__ = 0x1d000; +define symbol __ICFEDIT_region_ROM_end__ = 0x3ffff; +define symbol __ICFEDIT_region_RAM_start__ = 0x20002800; +define symbol __ICFEDIT_region_RAM_end__ = 0x20003fff; +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x800; +define symbol __ICFEDIT_size_heap__ = 0x200; +/**** End of ICF editor section. ###ICF###*/ + +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 CSTACK, + block HEAP }; diff --git a/components/softdevice/s120/toolchain/iar/iar_s120_nrf51422_xxac.icf b/components/softdevice/s120/toolchain/iar/iar_s120_nrf51422_xxac.icf new file mode 100644 index 0000000..b8b7f08 --- /dev/null +++ b/components/softdevice/s120/toolchain/iar/iar_s120_nrf51422_xxac.icf @@ -0,0 +1,31 @@ +/*###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__ = 0x1d000; +/*-Memory Regions-*/ +define symbol __ICFEDIT_region_ROM_start__ = 0x1d000; +define symbol __ICFEDIT_region_ROM_end__ = 0x3ffff; +define symbol __ICFEDIT_region_RAM_start__ = 0x20002800; +define symbol __ICFEDIT_region_RAM_end__ = 0x20007fff; +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x800; +define symbol __ICFEDIT_size_heap__ = 0x200; +/**** End of ICF editor section. ###ICF###*/ + +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 CSTACK, + block HEAP }; diff --git a/components/softdevice/s120/toolchain/iar/iar_s120_nrf51822_xxaa.icf b/components/softdevice/s120/toolchain/iar/iar_s120_nrf51822_xxaa.icf new file mode 100644 index 0000000..48568ea --- /dev/null +++ b/components/softdevice/s120/toolchain/iar/iar_s120_nrf51822_xxaa.icf @@ -0,0 +1,31 @@ +/*###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__ = 0x1d000; +/*-Memory Regions-*/ +define symbol __ICFEDIT_region_ROM_start__ = 0x1d000; +define symbol __ICFEDIT_region_ROM_end__ = 0x3ffff; +define symbol __ICFEDIT_region_RAM_start__ = 0x20002800; +define symbol __ICFEDIT_region_RAM_end__ = 0x20003fff; +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x800; +define symbol __ICFEDIT_size_heap__ = 0x200; +/**** End of ICF editor section. ###ICF###*/ + +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 CSTACK, + block HEAP }; diff --git a/components/softdevice/s120/toolchain/iar/iar_s120_nrf51822_xxab.icf b/components/softdevice/s120/toolchain/iar/iar_s120_nrf51822_xxab.icf new file mode 100644 index 0000000..1f632ab --- /dev/null +++ b/components/softdevice/s120/toolchain/iar/iar_s120_nrf51822_xxab.icf @@ -0,0 +1,31 @@ +/*###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__ = 0x1d000; +/*-Memory Regions-*/ +define symbol __ICFEDIT_region_ROM_start__ = 0x1d000; +define symbol __ICFEDIT_region_ROM_end__ = 0x1ffff; +define symbol __ICFEDIT_region_RAM_start__ = 0x20002800; +define symbol __ICFEDIT_region_RAM_end__ = 0x20003fff; +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x800; +define symbol __ICFEDIT_size_heap__ = 0x200; +/**** End of ICF editor section. ###ICF###*/ + +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 CSTACK, + block HEAP }; diff --git a/components/softdevice/s130/doc/s130_nrf51822_1.0.0_licence_agreement.pdf b/components/softdevice/s130/doc/s130_nrf51822_1.0.0_licence_agreement.pdf new file mode 100644 index 0000000000000000000000000000000000000000..8f804c0dcfb894350c209001673383302ad0811e GIT binary patch literal 5564 zcmc(jXH-+$w#RLNV51|_0@4LiNCH7b1Pn+KB=jPN5FoT*5~PD5y-F_uRFEQ7ng~jf zj&u+ZL3$AZse)8r(0lGV@0@Y(m-peV4_Ryf_ndRgHP_16zcB^0l#t?J2`HVw)O2@0 z9TWfp;LU9Sva&#Rtb-NF8UTTSVL&9#j)Wxuk#=YjRtby2TVUnnh$I3QZBOTt5@#?% z$WUSQ9MaeM@j^&J@nqGCESk1_I9~o_&b5$bPx&1FUgXnB^NKm!{TJ>fbZtK%kKmlV z!~$7Y$cBZ0_bZ2k`1jP8Q+LSm3l(1YgJEr!a>*~n+3{V6;pFQ^$?xY1e(vjI$$HMM z)So4;mbo1iN{2Mvan8vhg^iRex_XaS;ROr=4@0G0UtV@ut3$h|!Yu@yCi<7&k-&=3mz%J^;GOxs!a5CfPfPS%;1Lmf;%khREfljvrIWbE9Pk&ENMLBGPT^>+(-nrMxS) zPcAm^PD-^T3tMnsS3)P-y?CJrHIkS z?b33zT1|4DeT0e@T=PkpNW#|GeKBXmJ5~EN2l{}0gO_~Rcb479d6cIP61E39W7jNK ztJ5INAEg#hjM?u5RUg>13b-;ff+O0-tQ<||)@L^B*$erosSHCI8B#BmwupI#!95yI zkE3*!iU1{&TDy?rdR@`%)5VpmN#0hjE2Y7o3+2O)+qAsi9w@0zd6KR3JUek^zw?d# z18=LUtk)xFRe3~HqmIprd9)X^$ER>GM(GRDho#EID zLA;zRamV<(cwIvs3Tk(bZBuh)3MsCdcpL1kqGQQ|C=*oLli`g7G5MY6Bg9!L^5SOP zvkv7Vlb;i4-cX)Pb)||DSJvVfb)qXTtFig}tY%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dr_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 Mutual exclusion of radio activity and CPU execution. + * + * This option configures the application's access to the CPU when the radio is active. The + * application can configure itself to be blocked from using the CPU while the radio is + * active. By default, the application will be able to share CPU time with the SoftDevice + * during radio activity. This parameter structure is used together with @ref sd_ble_opt_set + * to configure the @ref BLE_COMMON_OPT_RADIO_CPU_MUTEX option. + * + * @note Note that the application should use this option to configure the SoftDevice to block the + * CPU during radio activity (i.e enable mutual exclusion) when running the SoftDevice on + * hardware affected by PAN #44 "CCM may exceed real time requirements"and PAN #45 "AAR may + * exceed real time requirements". + * + * @note Note that when acting as a scanner, the mutex is only enabled for radio TX activity. + * + * @note @ref sd_ble_opt_get is not supported for this option. + * + */ +typedef struct +{ + uint8_t enable : 1; /**< Enable mutual exclusion of radio activity and the CPU execution. */ +} ble_common_opt_radio_cpu_mutex_t; + +/**@brief Option structure for common options. */ +typedef union +{ + ble_common_opt_radio_cpu_mutex_t radio_cpu_mutex; /**< Parameters for the option for the mutual exclusion of radio activity and CPU execution. */ +} ble_common_opt_t; + +/**@brief Common BLE Option type, wrapping the module specific options. */ +typedef union +{ + ble_common_opt_t common_opt; /**< Common option, opt_id in BLE_COMMON_OPT_* series. */ + ble_gap_opt_t gap_opt; /**< GAP option, opt_id in BLE_GAP_OPT_* series. */ +} ble_opt_t; + +/** + * @brief BLE GATTS init options + */ +typedef struct +{ + ble_gatts_enable_params_t gatts_enable_params; /**< GATTS init options @ref ble_gatts_enable_params_t. */ +} ble_enable_params_t; + +/** @} */ + +/** @addtogroup BLE_COMMON_FUNCTIONS Functions + * @{ */ + +/**@brief Enable the BLE stack + * + * @param[in] p_ble_enable_params Pointer to ble_enable_params_t + * + * @details This call initializes the BLE stack, no other BLE related function can be called before this one. + * + * @return @ref NRF_SUCCESS BLE the BLE stack has been initialized successfully + * @retval @ref NRF_ERROR_INVALID_STATE the BLE stack had already been initialized and cannot be reinitialized. + * @return @ref NRF_ERROR_INVALID_ADDR Invalid or not sufficiently aligned pointer supplied. + * @return @ref 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. + * @return @ref NRF_ERROR_NO_MEM The Attribute Table size is too large. Decrease size in @ref ble_gatts_enable_params_t. + */ +SVCALL(SD_BLE_ENABLE, uint32_t, sd_ble_enable(ble_enable_params_t * p_ble_enable_params)); + +/**@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 signalled 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. + * + * @note The pointer supplied must be aligned to the extend defined by @ref BLE_EVTS_PTR_ALIGNMENT + * + * @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 application transmission buffers per link in the BLE stack. + * + * @details This call allows the application to obtain the total number of + * transmission buffers available per link for application data. Please note that + * this does not give the number of free buffers, but rather the total amount of them. + * The application has two options to handle its own application transmission buffers: + * - Use a simple arithmetic calculation: at boot time the application should use this function + * to find out the total amount of buffers available to it and store it in a variable. + * Every time a packet that consumes an application buffer is sent 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 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 packets. + * This mechanism allows the application to be aware at any time of the number of + * application packets available in the BLE stack's internal buffers, 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. + * - Choose to simply not keep track of available buffers at all, and instead handle the + * @ref BLE_ERROR_NO_TX_BUFFERS 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 buffer 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[out] p_count Pointer to a uint8_t which will contain the number of application transmission buffers upon + * successful return. + * + * @retval ::NRF_SUCCESS Number of application transmission buffers retrieved successfully. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + */ +SVCALL(SD_BLE_TX_BUFFER_COUNT_GET, uint32_t, sd_ble_tx_buffer_count_get(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. + * + * + * @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. + * @retval ::NRF_ERROR_FORBIDDEN If p_vs_uuid has already been added to the VS UUID table. + */ +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. + * + * @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. + * + * @param[in] opt_id Option ID. + * @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. + * @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)); + +/** @} */ + +#endif /* BLE_H__ */ + +/** + @} + @} +*/ diff --git a/components/softdevice/s130/headers/ble_err.h b/components/softdevice/s130/headers/ble_err.h new file mode 100644 index 0000000..1184f24 --- /dev/null +++ b/components/softdevice/s130/headers/ble_err.h @@ -0,0 +1,83 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/* @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_BUFFERS (NRF_ERROR_STK_BASE_NUM+0x004) /**< Buffer capacity exceeded. */ +#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. */ +/** @} */ + +#endif + + +/** + @} + @} +*/ diff --git a/components/softdevice/s130/headers/ble_gap.h b/components/softdevice/s130/headers/ble_gap.h new file mode 100644 index 0000000..5cc4df1 --- /dev/null +++ b/components/softdevice/s130/headers/ble_gap.h @@ -0,0 +1,1364 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/**@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_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. @ref ble_gap_evt_connected_t */ + BLE_GAP_EVT_DISCONNECTED, /**< Disconnected from peer. @ref ble_gap_evt_disconnected_t */ + BLE_GAP_EVT_CONN_PARAM_UPDATE, /**< Connection Parameters updated. ble_gap_evt_conn_param_update_t */ + BLE_GAP_EVT_SEC_PARAMS_REQUEST, /**< Request to provide security parameters. @ref ble_gap_evt_sec_params_request_t */ + BLE_GAP_EVT_SEC_INFO_REQUEST, /**< Request to provide security information. @ref ble_gap_evt_sec_info_request_t */ + BLE_GAP_EVT_PASSKEY_DISPLAY, /**< Request to display a passkey to the user. @ref ble_gap_evt_passkey_display_t */ + BLE_GAP_EVT_AUTH_KEY_REQUEST, /**< Request to provide an authentication key. @ref ble_gap_evt_auth_key_request_t */ + BLE_GAP_EVT_AUTH_STATUS, /**< Authentication procedure completed with status. @ref ble_gap_evt_auth_status_t */ + BLE_GAP_EVT_CONN_SEC_UPDATE, /**< Connection security updated. @ref ble_gap_evt_conn_sec_update_t */ + BLE_GAP_EVT_TIMEOUT, /**< Timeout expired. @ref ble_gap_evt_timeout_t */ + BLE_GAP_EVT_RSSI_CHANGED, /**< RSSI report. @ref ble_gap_evt_rssi_changed_t */ + BLE_GAP_EVT_ADV_REPORT, /**< Advertising report. @ref ble_gap_evt_adv_report_t */ + BLE_GAP_EVT_SEC_REQUEST, /**< Security Request. @ref ble_gap_evt_sec_request_t */ + BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST, /**< Connection Parameter Update Request. @ref ble_gap_evt_conn_param_update_request_t */ + BLE_GAP_EVT_SCAN_REQ_REPORT, /**< Scan request report. @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_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_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_RFU_RANGE2_BEGIN 0x8B /**< 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 connction interval specified in connect parameters. */ +#define BLE_GAP_CP_MIN_CONN_INTVL_MIN 0x0006 /**< Lowest mimimum 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 connction 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 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 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 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 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 or 3), 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 and scanning. */ +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 ble_gap_channel_mask_t for documentation. */ +} 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. */ +} ble_gap_sec_kdist_t; + + +/**@brief GAP security parameters. */ +typedef struct +{ + uint8_t bond : 1; /**< Perform bonding. */ + uint8_t mitm : 1; /**< Man In The Middle protection required. */ + 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_periph; /**< Key distribution bitmap: keys that the peripheral device will distribute. */ + ble_gap_sec_kdist_t kdist_central; /**< Key distribution bitmap: keys that the central 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 auth : 1; /**< Authenticated Key. */ + uint8_t ltk_len : 7; /**< 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 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). */ +} ble_gap_evt_passkey_display_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 Security levels supported. + * @note See Bluetooth Specification Version 4.1 Volume 3, Part C, Chapter 10. +*/ +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. */ +} 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_sec_keys_t; + + +/**@brief Security key set (both Peripheral and Central keys). + * Note that when distributing Bluetooth addresses pertaining to the local device those + * will have to be filled in by the user. */ +typedef struct +{ + ble_gap_sec_keys_t keys_periph; /**< Keys distributed by the device in the Peripheral role. */ + ble_gap_sec_keys_t keys_central; /**< Keys distributed by the device in the Central role. */ +} 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_periph; /**< Bitmap stating which keys were exchanged (distributed) by the peripheral. */ + ble_gap_sec_kdist_t kdist_central; /**< Bitmap stating which keys were exchanged (distributed) by the central. */ +} 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 required. */ +} 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 occured. */ + 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_auth_key_request_t auth_key_request; /**< Authentication Key Request Event Parameters. */ + 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 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. + * + * @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, const ble_gap_addr_t *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. + * + * @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_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. + * + * @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_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. + */ +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). + * + * @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. + * + * @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. + * + * @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 -40 dBm will not actually give -40 dBm, but will instead be remapped to -30 dBm. + * + * @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. + * + * @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. + * + * @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. + * + * @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. + * + * @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 timeout, bond and mitm fields of this structure are used. + * In the central role, this pointer may be NULL to reject a Security Request. + * + * @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. + * + * @note Calling this function may result in the following events depending on the outcome and parameters: @ref BLE_GAP_EVT_SEC_PARAMS_REQUEST, + * @ref BLE_GAP_EVT_SEC_INFO_REQUEST, @ref BLE_GAP_EVT_AUTH_KEY_REQUEST, @ref BLE_GAP_EVT_CONN_SEC_UPDATE, @ref BLE_GAP_EVT_AUTH_STATUS. + * + * + * @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 ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + * @retval ::NRF_ERROR_TIMEOUT A SMP timout has occured, 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. + * + * @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 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. + * The pointer to the ID key data distributed by the local device constitutes however an exception. It can either point to ID key data + * filled in by the user before calling this function, in which case a user-supplied Bluetooth address and IRK will be distributed, + * or the pointer to the ID key data structure can be NULL, in which case the device's configured (or default, if none is configured) + * Bluetooth address and IRK will be distributed. + * + * @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. + * + * @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. + */ +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. + * + * @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). + * If key type is @ref BLE_GAP_AUTH_KEY_TYPE_OOB, then a 16-byte OOB key value in Little Endian format. + * + * @details This function is only used to reply to a @ref BLE_GAP_EVT_AUTH_KEY_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. + * + * @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 Initiate GAP Encryption procedure. + * + * @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. + * + * @details In the central role, this function will initiate the encryption procedure using the encryption information provided. + * + * @note Calling this function may result in the following event depending on the outcome and parameters: @ref BLE_GAP_EVT_CONN_SEC_UPDATE. + * + * @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. + * + * @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. + * + * @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. + * + * @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. + * + * @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. + * + * @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. + * + * @param[in] conn_handle Connection handle. + * @param[out] p_rssi Pointer to the location where the RSSI measurement shall be stored. + * + * @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. + * + * @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. + * + * @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. + */ +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). + * + * @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. + * + * @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_NO_MEM limit of available connections reached. + * @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. + */ +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. + * + * @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)); + +/** @} */ + +#endif // BLE_GAP_H__ + +/** + @} +*/ diff --git a/components/softdevice/s130/headers/ble_gatt.h b/components/softdevice/s130/headers/ble_gatt.h new file mode 100644 index 0000000..cb8a67b --- /dev/null +++ b/components/softdevice/s130/headers/ble_gatt.h @@ -0,0 +1,200 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + + +/** @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 + +/** @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; + +#endif // BLE_GATT_H__ + +/** @} */ + +/** + @} + @} +*/ diff --git a/components/softdevice/s130/headers/ble_gattc.h b/components/softdevice/s130/headers/ble_gattc.h new file mode 100644 index 0000000..57ce312 --- /dev/null +++ b/components/softdevice/s130/headers/ble_gattc.h @@ -0,0 +1,441 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/** @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_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. @ref ble_gattc_evt_prim_srvc_disc_rsp_t */ + BLE_GATTC_EVT_REL_DISC_RSP, /**< Relationship Discovery Response event. @ref ble_gattc_evt_rel_disc_rsp_t */ + BLE_GATTC_EVT_CHAR_DISC_RSP, /**< Characteristic Discovery Response event. @ref ble_gattc_evt_char_disc_rsp_t */ + BLE_GATTC_EVT_DESC_DISC_RSP, /**< Descriptor Discovery Response event. @ref ble_gattc_evt_desc_disc_rsp_t */ + BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP, /**< Read By UUID Response event. @ref ble_gattc_evt_char_val_by_uuid_read_rsp_t */ + BLE_GATTC_EVT_READ_RSP, /**< Read Response event. @ref ble_gattc_evt_read_rsp_t */ + BLE_GATTC_EVT_CHAR_VALS_READ_RSP, /**< Read multiple Response event. @ref ble_gattc_evt_char_vals_read_rsp_t */ + BLE_GATTC_EVT_WRITE_RSP, /**< Write Response event. @ref ble_gattc_evt_write_rsp_t */ + BLE_GATTC_EVT_HVX, /**< Handle Value Notification or Indication event. @ref ble_gattc_evt_hvx_t */ + BLE_GATTC_EVT_TIMEOUT /**< Timeout event. @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. */ +/** @} */ + +/**@brief Last Attribute Handle. */ +#define BLE_GATTC_HANDLE_END 0xFFFF + +/** @} */ + +/** @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 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, variable length. */ +} 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, variable length. */ +} 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, variable length. */ +} 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, variable length. */ +} ble_gattc_evt_desc_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, variable length. */ +} 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, variable length. */ +} 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, variable length. */ +} 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, variable length. */ +} 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, variable length. */ +} 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. */ + } 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. + * + * @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. + * + * @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. + * + * @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. + * + * @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. + * + * @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. + * + * @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_INVALID_ADDR Invalid pointer supplied. + * @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. + * + * @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_buffer_count_get for more details. + * + * @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_BUFFERS There are no available buffers left. + */ +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. + * + * @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)); + +/** @} */ + +#endif /* BLE_GATTC_H__ */ + +/** + @} + @} +*/ diff --git a/components/softdevice/s130/headers/ble_gatts.h b/components/softdevice/s130/headers/ble_gatts.h new file mode 100644 index 0000000..756571e --- /dev/null +++ b/components/softdevice/s130/headers/ble_gatts.h @@ -0,0 +1,639 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/** @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. */ +}; + +/** + * @brief GATT Server Event IDs. + */ +enum BLE_GATTS_EVTS +{ + BLE_GATTS_EVT_WRITE = BLE_GATTS_EVT_BASE, /**< Write operation performed. @ref ble_gatts_evt_write_t */ + BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST, /**< Read/Write Authorization request.@ref ble_gatts_evt_rw_authorize_request_t */ + BLE_GATTS_EVT_SYS_ATTR_MISSING, /**< A persistent system attribute access is pending, awaiting a sd_ble_gatts_sys_attr_set(). @ref ble_gatts_evt_sys_attr_missing_t */ + BLE_GATTS_EVT_HVC, /**< Handle Value Confirmation. @ref ble_gatts_evt_hvc_t */ + BLE_GATTS_EVT_SC_CONFIRM, /**< Service Changed Confirmation. No additional event structure applies. */ + BLE_GATTS_EVT_TIMEOUT /**< Timeout. @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 (0x600 bytes for this version of the SoftDevice). */ +/** @} */ + +/** @} */ + +/** @addtogroup BLE_GATTS_STRUCTURES Structures + * @{ */ + +/** + * @brief BLE GATTS init options + */ +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 Attribute Context. */ +typedef struct +{ + ble_uuid_t srvc_uuid; /**< Service UUID. */ + ble_uuid_t char_uuid; /**< Characteristic UUID if applicable (BLE_UUID_TYPE_UNKNOWN otherwise). */ + ble_uuid_t desc_uuid; /**< Descriptor UUID if applicable (BLE_UUID_TYPE_UNKNOWN otherwise). */ + uint16_t srvc_handle; /**< Service Handle. */ + uint16_t value_handle; /**< Characteristic Value Handle if applicable (BLE_GATT_HANDLE_INVALID otherwise). */ + uint8_t type; /**< Attribute Type, see @ref BLE_GATTS_ATTR_TYPES. */ +} ble_gatts_attr_context_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 Read 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 in the ATT response. */ + 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. */ + uint8_t *p_data; /**< Pointer to new value used to update the attribute value. */ +} ble_gatts_read_authorize_params_t; + +/**@brief GATT Write Authorization parameters. */ +typedef struct +{ + uint16_t gatt_status; /**< GATT status code for the operation, see @ref BLE_GATT_STATUS_CODES. */ +} ble_gatts_write_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_read_authorize_params_t read; /**< Read authorization parameters. */ + ble_gatts_write_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. */ + uint8_t op; /**< Type of write operation, see @ref BLE_GATTS_OPS. */ + ble_gatts_attr_context_t context; /**< Attribute Context. */ + uint16_t offset; /**< Offset for the write operation. */ + uint16_t len; /**< Length of the received data. */ + uint8_t data[1]; /**< Received data, variable length. */ +} 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_gatts_attr_context_t context; /**< Attribute Context. */ + 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. + * + * @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. + * + * @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. + * + * @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. + * + * @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. + * + * @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). + * + * @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. + * + * @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. + * + * @note Values other than system attributes can be set at any time, regardless of wheter any active connections exist. + * + * @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. + * + * @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. + * + * @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. + * + * @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 ::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_BUFFERS 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_buffer_count_get for more details. + * + * @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_BUFFERS There are no available buffers to send the data, 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. + * + * @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_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_INVALID_STATE Invalid state to perform operation, notifications or indications must be enabled in the CCCD. + * @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. + * + * @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_STATE Invalid Connection State or no authorization request pending. + * @retval ::NRF_ERROR_INVALID_PARAM Authorization op invalid, + * or for Read Authorization reply: requested handles not replied with, + * or for Write Authorization reply: handle supplied does not match requested handle. + * @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. + * + * @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_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. + * + * @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. 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)); + +/** @} */ + +#endif // BLE_GATTS_H__ + +/** + @} +*/ diff --git a/components/softdevice/s130/headers/ble_hci.h b/components/softdevice/s130/headers/ble_hci.h new file mode 100644 index 0000000..2488985 --- /dev/null +++ b/components/softdevice/s130/headers/ble_hci.h @@ -0,0 +1,125 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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__ + +/** @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. */ + +/** @} */ + + +#endif // BLE_HCI_H__ + +/** @} */ diff --git a/components/softdevice/s130/headers/ble_l2cap.h b/components/softdevice/s130/headers/ble_l2cap.h new file mode 100644 index 0000000..6eab9fb --- /dev/null +++ b/components/softdevice/s130/headers/ble_l2cap.h @@ -0,0 +1,177 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/**@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, variable length. */ +} 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. + * + * @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. + * + * @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 buffer, 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_buffer_count_get for more details. + * + * @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_BUFFERS Not enough application buffers 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)); + +/** @} */ + +#endif // BLE_L2CAP_H__ + +/** + @} +*/ diff --git a/components/softdevice/s130/headers/ble_ranges.h b/components/softdevice/s130/headers/ble_ranges.h new file mode 100644 index 0000000..69100b3 --- /dev/null +++ b/components/softdevice/s130/headers/ble_ranges.h @@ -0,0 +1,119 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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__ + +#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. */ + +#endif /* BLE_RANGES_H__ */ + +/** + @} + @} +*/ diff --git a/components/softdevice/s130/headers/ble_types.h b/components/softdevice/s130/headers/ble_types.h new file mode 100644 index 0000000..d99d774 --- /dev/null +++ b/components/softdevice/s130/headers/ble_types.h @@ -0,0 +1,198 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 + +/** @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 +{ + unsigned char 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; + +/** @} */ + +#endif /* BLE_TYPES_H__ */ + +/** + @} + @} +*/ diff --git a/components/softdevice/s130/headers/nrf_error.h b/components/softdevice/s130/headers/nrf_error.h new file mode 100644 index 0000000..efa1b65 --- /dev/null +++ b/components/softdevice/s130/headers/nrf_error.h @@ -0,0 +1,78 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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__ + +/** @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 + +#endif // NRF_ERROR_H__ + +/** + @} +*/ diff --git a/components/softdevice/s130/headers/nrf_error_sdm.h b/components/softdevice/s130/headers/nrf_error_sdm.h new file mode 100644 index 0000000..25a1437 --- /dev/null +++ b/components/softdevice/s130/headers/nrf_error_sdm.h @@ -0,0 +1,60 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +#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). + +#endif // NRF_ERROR_SDM_H__ + +/** + @} + @} +*/ diff --git a/components/softdevice/s130/headers/nrf_error_soc.h b/components/softdevice/s130/headers/nrf_error_soc.h new file mode 100644 index 0000000..cfddf7e --- /dev/null +++ b/components/softdevice/s130/headers/nrf_error_soc.h @@ -0,0 +1,76 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/* 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 + +#endif // NRF_ERROR_SOC_H__ +/** + @} + @} +*/ diff --git a/components/softdevice/s130/headers/nrf_mbr.h b/components/softdevice/s130/headers/nrf_mbr.h new file mode 100644 index 0000000..111c642 --- /dev/null +++ b/components/softdevice/s130/headers/nrf_mbr.h @@ -0,0 +1,185 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 + + +/** @addtogroup NRF_MBR_DEFINES Defines + * @{ */ + +/**@brief MBR SVC Base number. */ +#define MBR_SVC_BASE (0x18) + +/**@brief Page size in words. */ +#define PAGE_SIZE_IN_WORDS 256 +/** @} */ + +/** @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 PROTENSET 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 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. + */ +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. + * + * @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. + */ +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_copy_bl_t copy_bl; /**< Parameters for copy BootLoader.*/ + sd_mbr_command_compare_t compare; /**< Parameters for verify.*/ + sd_mbr_command_vector_table_base_set_t base_set; /**< Parameters for vector table base set.*/ + } params; +} sd_mbr_command_t; + +/** @} */ + +/** @addtogroup NRF_MBR_FUNCTIONS Functions + * @{ */ + +/**@brief Issue Master Boot Record commands + * + * Commands used when updating a SoftDevice and bootloader. + * + * @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 + +*/ +SVCALL(SD_MBR_COMMAND, uint32_t, sd_mbr_command(sd_mbr_command_t* param)); + +/** @} */ +#endif // NRF_MBR_H__ + +/** + @} +*/ diff --git a/components/softdevice/s130/headers/nrf_sd_def.h b/components/softdevice/s130/headers/nrf_sd_def.h new file mode 100644 index 0000000..5b58c4f --- /dev/null +++ b/components/softdevice/s130/headers/nrf_sd_def.h @@ -0,0 +1,23 @@ +/* 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. + * + */ + +#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/components/softdevice/s130/headers/nrf_sdm.h b/components/softdevice/s130/headers/nrf_sdm.h new file mode 100644 index 0000000..4d407a9 --- /dev/null +++ b/components/softdevice/s130/headers/nrf_sdm.h @@ -0,0 +1,221 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/** @addtogroup NRF_SDM_DEFINES Defines + * @{ */ + +/** @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 usual size reserverd 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) + +/** @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) + + +/** @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 */ +}; + +/**@brief Possible lfclk oscillator sources. */ +enum NRF_CLOCK_LFCLKSRCS +{ + NRF_CLOCK_LFCLKSRC_SYNTH_250_PPM, /**< LFCLK Synthesized from HFCLK. */ + NRF_CLOCK_LFCLKSRC_XTAL_500_PPM, /**< LFCLK crystal oscillator 500 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_250_PPM, /**< LFCLK crystal oscillator 250 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_150_PPM, /**< LFCLK crystal oscillator 150 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_100_PPM, /**< LFCLK crystal oscillator 100 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_75_PPM, /**< LFCLK crystal oscillator 75 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_50_PPM, /**< LFCLK crystal oscillator 50 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_30_PPM, /**< LFCLK crystal oscillator 30 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, /**< LFCLK crystal oscillator 20 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_250MS_CALIBRATION, /**< LFCLK RC oscillator, 250ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_500MS_CALIBRATION, /**< LFCLK RC oscillator, 500ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_1000MS_CALIBRATION, /**< LFCLK RC oscillator, 1000ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_2000MS_CALIBRATION, /**< LFCLK RC oscillator, 2000ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_4000MS_CALIBRATION, /**< LFCLK RC oscillator, 4000ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_8000MS_CALIBRATION, /**< LFCLK RC oscillator, 8000ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_1000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 1000ms, if changed above a threshold, a calibration is done.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_2000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 2000ms, if changed above a threshold, a calibration is done.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_4000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 4000ms, if changed above a threshold, a calibration is done.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_8000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 8000ms, if changed above a threshold, a calibration is done.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_16000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 16000ms, if changed above a threshold, a calibration is done.*/ +}; + +/** @} */ + +/** @addtogroup NRF_SDM_TYPES Types + * @{ */ + +/**@brief Type representing lfclk oscillator source. */ +typedef uint32_t nrf_clock_lfclksrc_t; + + +/**@brief SoftDevice Assertion Handler type. + * + * When an unexpected error occurs within the SoftDevice it will call the SoftDevice assertion handler callback. + * 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 SoftDevice assert callback. + * + * @param[in] pc The program counter of the failed assert. + * @param[in] line_number Line number where the assert failed. + * @param[in] file_name File name where the assert failed. + */ +typedef void (*softdevice_assertion_handler_t)(uint32_t pc, uint16_t line_number, const uint8_t * p_file_name); + +/** @} */ + +/** @addtogroup NRF_SDM_FUNCTIONS Functions + * @{ */ + +/**@brief Enables the SoftDevice and by extension the protocol stack. + * + * Idempotent function to enable the SoftDevice. + * + * @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 clock_source Low frequency clock source and accuracy. (Note: 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 assertion_handler Callback for SoftDevice assertions. + * + * @retval ::NRF_SUCCESS + * @retval ::NRF_ERROR_INVALID_STATE SoftDevice is already enabled, and the clock source and assertion handler cannot be updated. + * @retval ::NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION SoftDeviceinterrupt 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_lfclksrc_t clock_source, softdevice_assertion_handler_t assertion_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)); + +/** @} */ + +#endif // NRF_SDM_H__ + +/** + @} +*/ diff --git a/components/softdevice/s130/headers/nrf_soc.h b/components/softdevice/s130/headers/nrf_soc.h new file mode 100644 index 0000000..07088fc --- /dev/null +++ b/components/softdevice/s130/headers/nrf_soc.h @@ -0,0 +1,992 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/**@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. */ + +#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. */ + +#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_TYPES Types + * @{ */ + +/**@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_NVIC_ENABLEIRQ, + SD_NVIC_DISABLEIRQ, + SD_NVIC_GETPENDINGIRQ, + SD_NVIC_SETPENDINGIRQ, + SD_NVIC_CLEARPENDINGIRQ, + SD_NVIC_SETPRIORITY, + SD_NVIC_GETPRIORITY, + SD_NVIC_SYSTEMRESET, + SD_NVIC_CRITICAL_REGION_ENTER, + SD_NVIC_CRITICAL_REGION_EXIT, + SD_RAND_APPLICATION_POOL_CAPACITY, + SD_RAND_APPLICATION_BYTES_AVAILABLE, + SD_RAND_APPLICATION_GET_VECTOR, + SD_POWER_MODE_SET, + SD_POWER_SYSTEM_OFF, + SD_POWER_RESET_REASON_GET, + SD_POWER_RESET_REASON_CLR, + SD_POWER_POF_ENABLE, + SD_POWER_POF_THRESHOLD_SET, + SD_POWER_RAMON_SET, + SD_POWER_RAMON_CLR, + SD_POWER_RAMON_GET, + SD_POWER_GPREGRET_SET, + SD_POWER_GPREGRET_CLR, + SD_POWER_GPREGRET_GET, + SD_POWER_DCDC_MODE_SET, + SD_APP_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_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 Possible values of ::nrf_app_irq_priority_t. */ +enum NRF_APP_PRIORITIES +{ + NRF_APP_PRIORITY_HIGH = 1, + NRF_APP_PRIORITY_LOW = 3 +}; + +/**@brief Possible values of ::nrf_power_mode_t. */ +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 Possible values of ::nrf_power_failure_threshold_t */ +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 Possible values of ::nrf_power_dcdc_mode_t. */ +enum NRF_POWER_DCDC_MODES +{ + NRF_POWER_DCDC_DISABLE, /**< The DCDC is disabled. */ + NRF_POWER_DCDC_ENABLE /**< The DCDC is enabled. */ +}; + +/**@brief Possible values of ::nrf_radio_notification_distance_t. */ +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 Possible values of ::nrf_radio_notification_type_t. */ +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 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 signal callback handler return was invalid. */ + NRF_EVT_RADIO_SESSION_IDLE, /**< Event indicating that a radio session is idle. */ + NRF_EVT_RADIO_SESSION_CLOSED, /**< Event indicating that a radio session is closed. */ + NRF_EVT_NUMBER_OF_EVTS +}; + +/**@} */ + +/**@addtogroup NRF_SOC_TYPES Types + * @{ */ + +/**@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 The interrupt priorities available to the application while the softdevice is active. */ +typedef uint8_t nrf_app_irq_priority_t; + +/**@brief Represents a power mode, used in power mode functions */ +typedef uint8_t nrf_power_mode_t; + +/**@brief Represents a power failure threshold value. */ +typedef uint8_t nrf_power_failure_threshold_t; + +/**@brief Represents a DCDC mode value. */ +typedef uint32_t nrf_power_dcdc_mode_t; + +/**@brief Radio notification distances. */ +typedef uint8_t nrf_radio_notification_distance_t; + +/**@brief Radio notification types. */ +typedef uint8_t nrf_radio_notification_type_t; + +/**@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_DEFAULT, /**< Use the currently selected oscillator as HF clock source during the timeslot (i.e. the source is not specified). */ + NRF_RADIO_HFCLK_CFG_FORCE_XTAL, /**< Force external crystal to be used as HF clock source during whole the timeslot. */ +}; + +/**@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 timeslot as early as possible. This should always be used for the first request in a session. */ + NRF_RADIO_REQ_TYPE_NORMAL /**< Normal timeslot request. */ +}; + +/**@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 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 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 a request for a timeslot as early as possible. */ + nrf_radio_request_normal_t normal; /**< Parameters for a normal radio request. */ + } 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 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 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 data structure */ +typedef struct +{ + uint8_t key[SOC_ECB_KEY_LENGTH]; /**< Encryption key. */ + uint8_t cleartext[SOC_ECB_CLEARTEXT_LENGTH]; /**< Clear Text data. */ + uint8_t ciphertext[SOC_ECB_CIPHERTEXT_LENGTH]; /**< Cipher Text data. */ +} nrf_ecb_hal_data_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 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. + */ +SVCALL(SD_NVIC_ENABLEIRQ, 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. + */ +SVCALL(SD_NVIC_DISABLEIRQ, 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. + */ +SVCALL(SD_NVIC_GETPENDINGIRQ, 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. + */ +SVCALL(SD_NVIC_SETPENDINGIRQ, 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. + */ +SVCALL(SD_NVIC_CLEARPENDINGIRQ, 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. + */ +SVCALL(SD_NVIC_SETPRIORITY, uint32_t, sd_nvic_SetPriority(IRQn_Type IRQn, nrf_app_irq_priority_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. + */ +SVCALL(SD_NVIC_GETPRIORITY, uint32_t, sd_nvic_GetPriority(IRQn_Type IRQn, nrf_app_irq_priority_t * p_priority)); + +/**@brief System Reset. + * @note Corresponds to NVIC_SystemReset in CMSIS. + * + * @retval ::NRF_ERROR_SOC_NVIC_SHOULD_NOT_RETURN + */ +SVCALL(SD_NVIC_SYSTEMRESET, 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 + */ +SVCALL(SD_NVIC_CRITICAL_REGION_ENTER, 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 + */ +SVCALL(SD_NVIC_CRITICAL_REGION_EXIT, uint32_t, sd_nvic_critical_region_exit(uint8_t is_nested_critical_region)); + +/**@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, 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, 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_GET_VECTOR, 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. @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(nrf_power_mode_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. + * + * @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(nrf_power_failure_threshold_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. + * + * This function is to enable or disable the DCDC periperhal. + * + * @param[in] dcdc_mode The mode of the DCDC. + * + * @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(nrf_power_dcdc_mode_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. + * @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. + * 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(nrf_radio_notification_type_t type, nrf_radio_notification_distance_t distance)); + +/**@brief Encrypts a block according to the specified parameters. + * + * 128-bit AES encryption. + * + * @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 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. + * + * @note Pan #28 in PAN-028 v 1.6 "Negative measured values are not represented correctly" is corrected by this function. + * + * @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 32bit words. +* +* @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 more than 256 words. +* @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 registers PROTENSETx + * + * @note To read the values in PROTENSETx you can read them directly. They are only write-protected. + * + * @param[in] protenset0 Value to be written to PROTENSET0. + * @param[in] protenset1 Value to be written to PROTENSET1. + * + * @retval ::NRF_ERROR_FORBIDDEN Tried to protect the SoftDevice. + * @retval ::NRF_SUCCESS Values successfully written to PROTENSETx. + */ +SVCALL(SD_FLASH_PROTECT, uint32_t, sd_flash_protect(uint32_t protenset0, uint32_t protenset1)); + +/**@brief Opens a session for radio 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 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 )); + +/**@} */ + +#endif // NRF_SOC_H__ + +/**@} */ diff --git a/components/softdevice/s130/headers/nrf_svc.h b/components/softdevice/s130/headers/nrf_svc.h new file mode 100644 index 0000000..8c84a9c --- /dev/null +++ b/components/softdevice/s130/headers/nrf_svc.h @@ -0,0 +1,71 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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__ + +#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__) +#define SVCALL(number, return_type, signature) \ + _Pragma("GCC diagnostic ignored \"-Wunused-function\"") \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \ + __attribute__((naked)) static return_type signature \ + { \ + __asm( \ + "svc %0\n" \ + "bx r14" : : "I" (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 +#endif // NRF_SVC__ diff --git a/components/softdevice/s130/headers/softdevice_assert.h b/components/softdevice/s130/headers/softdevice_assert.h new file mode 100644 index 0000000..a2a8af8 --- /dev/null +++ b/components/softdevice/s130/headers/softdevice_assert.h @@ -0,0 +1,73 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** @brief Utilities for verifying program logic + */ + +#ifndef SOFTDEVICE_ASSERT_H_ +#define SOFTDEVICE_ASSERT_H_ + +#include + +/** @brief This function handles assertions. + * + * + * @note + * This function is called when an assertion has triggered. + * + * + * @param line_num The line number where the assertion is called + * @param file_name Pointer to the file name + */ +void assert_softdevice_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 Check intended for production code + * + * Check passes if "expr" evaluates to true. */ +#define ASSERT(expr) \ +if (expr) \ +{ \ +} \ +else \ +{ \ + assert_softdevice_callback((uint16_t)__LINE__, (uint8_t *)__FILE__); \ + /*lint -unreachable */ \ +} + +#endif /* SOFTDEVICE_ASSERT_H_ */ diff --git a/components/softdevice/s130/hex/s130_nrf51_1.0.0_softdevice.hex b/components/softdevice/s130/hex/s130_nrf51_1.0.0_softdevice.hex new file mode 100644 index 0000000..d6fe985 --- /dev/null +++ b/components/softdevice/s130/hex/s130_nrf51_1.0.0_softdevice.hex @@ -0,0 +1,6861 @@ +:020000040000FA +:10000000C0070000D1060000D1000000B1060000CA +:1000100000000000000000000000000000000000E0 +:100020000000000000000000000000005107000078 +:100030000000000000000000DB000000E500000000 +:10004000EF000000F9000000030100000D010000B6 +:1000500017010000210100002B0100003501000004 +:100060003F01000049010000530100005D01000054 +:1000700067010000710100007B01000085010000A4 +:100080008F01000099010000A3010000AD010000F4 +:10009000B7010000C1010000CB010000D501000044 +:1000A000DF010000E9010000F3010000FD01000094 +:1000B00007020000110200001B02000025020000E0 +:1000C0001FB5C046C04600F0EFFA04B00FB41FBD24 +:1000D00008205A49096809580847382057490968CB +:1000E000095808473C2055490968095808474020E5 +:1000F0005249096809580847442050490968095875 +:10010000084748204D490968095808474C204B4981 +:10011000096809580847502048490968095808479C +:100120005420464909680958084758204349096836 +:10013000095808475C204149096809580847602068 +:100140003E4909680958084764203C49096809582C +:100150000847682039490968095808476C20374919 +:100160000968095808477020344909680958084740 +:100170007420324909680958084778202F490968CE +:10018000095808477C202D490968095808478020EC +:100190002A490968095808478420284909680958E4 +:1001A0000847882025490968095808478C202349B1 +:1001B00009680958084790202049096809580847E4 +:1001C00094201E4909680958084798201B49096866 +:1001D000095808479C201949096809580847A02070 +:1001E0001649096809580847A4201449096809589C +:1001F0000847A8201149096809580847AC200F4949 +:10020000096809580847B0200C4909680958084787 +:10021000B4200A49096809580847B82007490968FD +:1002200009580847BC2005490968095808470000D3 +:1002300003480449024A034B7047000000000020B5 +:10024000C0070000C00700000122D84B5A6000BF61 +:10025000D74A1268002AFBD0016000BFD44A126856 +:10026000002AFBD00022D14B5A6000BFD04A12684E +:10027000002AFBD07047F0B505460E46174600240D +:1002800006E0A200B158A2005019FFF7DDFF641C80 +:10029000BC42F6D30020F0BD0120C043C549086030 +:1002A000401048607047014601229204086890425D +:1002B00001D9102070470020FCE7F0B505460C4638 +:1002C0001646002706E028462168FFF7BDFF2D1DD2 +:1002D000241D7F1CB742F6D3F0BD70B505460C4611 +:1002E0002E460BE0304600F075F9FF2C01D80024B3 +:1002F00001E0FF3C013C012080023618002CF1D1C6 +:1003000070BD0146012212044868904201D90920BB +:100310007047A9484069401C01D10F20F8E7002030 +:10032000F6E7FEB504462068030000F037FA05043E +:100330002B4249598B00201DFFF7E3FF0546002D96 +:1003400001D02846FEBDFFF7A7FF0120C00200F044 +:1003500041F9042221469948FFF78DFF002801D07A +:100360000320EFE708222146944800F06DF90028A9 +:1003700006D1002192480068FFF766FF00F00CF9F3 +:100380000320DFE7A768E6686068019031463846D9 +:10039000FFF7A3FF324638460199FFF78EFFB20000 +:1003A0003846019900F050F9002800D1CAE703202F +:1003B000C8E700F0E3F9834800688349086041E03A +:1003C00060680190E668A0680090B200009901980A +:1003D00000F03AF90746002F00D1B3E70E20B1E74D +:1003E000201DFFF760FF0546002D01D02846A9E734 +:1003F0006068002807D1FFF74FFF0320800200F05C +:10040000E9F800F0C9F8FFF747FF0120C00200F04B +:10041000E1F8042221466948FFF72DFF002801D0AA +:1004200003208FE708222146644800F00DF90028D8 +:1004300006D1002162480068FFF706FF00F0ACF823 +:1004400003207FE700BF00207CE770B505460C461F +:10045000182D04D12068FFF764FF206002E001201E +:10046000206000BF00BF70BDF0B589B05248406940 +:1004700003905248806881000398081802900398FE +:10048000000B01900121090302984018401E000B47 +:1004900000900124002520462946019A00F0C4F866 +:1004A0000022401E91410791069001260027304608 +:1004B0003946009A00F0B8F80022401E914105919B +:1004C0000490049BDB43059AD2430698184307998E +:1004D00011430791069037490698086007984860CD +:1004E00009B0F0BD70B53448446934488568466841 +:1004F000AA003146204600F0A7F8002801D00020CD +:1005000070BD0120FCE72D484068002801D0012083 +:1005100000E000200546FFF7E5FF002807D0FFF7C1 +:10052000BBFE0320800200F055F800F035F8FFF71D +:100530009BFF002D0ED020484669204884684768FC +:1005400021463046FFF7C9FE224639463046FFF7BE +:10055000B4FE00BF00F020F810B5184844681A48EF +:100560000460204600F0DCF810BD15480068006803 +:10057000401C01D100BFFEE710480068002802D0EF +:10058000042806D101E0FFF7BEFFFFF7E5FF00BF3B +:10059000FEE700BF00BFFEE7BFF34F8F0B480C49DB +:1005A000C860BFF34F8F00BFFEE7000000E50140C9 +:1005B00000E40140000600400010001000080000A8 +:1005C000B8070000BC070000000000200400FA0586 +:1005D00000ED00E010B50146104B1A6808460223F2 +:1005E0000F4C636000BF0F4B1B68002BFBD0531CEC +:1005F00004D0904202D20A4B186101E0084B986087 +:1006000000BF084B1B68002BFBD00023044C636029 +:1006100000BF044B1B68002BFBD010BD0010001066 +:1006200000E5014000E4014010B5202A04DB01464A +:10063000203A9140002010BD914020239C1A03468F +:10064000E3401943904010BD034610B50B439B0790 +:100650000FD1042A0DD308C810C9121FA342F8D025 +:1006600018BA21BA884201D9012010BD0020C04328 +:1006700010BD002A03D0D30703D0521C07E000208E +:1006800010BD03780C78401C491C1B1B07D1037854 +:100690000C78401C491C1B1B01D1921EF1D118463D +:1006A00010BD70477047704710B500F007F810BDD7 +:1006B000014B1B68DB6818470000002019481A49E5 +:1006C0007047FFF7FBFFFFF7FBFC00BD20BFFDE716 +:1006D0001649174C24688C420BD1164B1B68994263 +:1006E0000CD1154B154A1360186810498842EDD09B +:1006F0000AE0134880F30888124B18470F4A13602A +:1007000018680A498842E1D080F308880E49884277 +:1007100004DD0E48026802210A4302605B68184744 +:100720000346DFE7C0070000C0070000FFFFFFFF30 +:10073000000C000014100010001000000000002049 +:10074000000400206B05000000200020240500406C +:100750000D48704502D1EFF3098101E0EFF3088104 +:10076000886902380078182802D1C046074A104725 +:10077000074A12682C3212681047000000B5054B7A +:10078000054A9B58984700BDFDFFFFFF4B04000042 +:1007900000000020001000000400000030B4744687 +:1007A000641E2578641CAB4204D3635D5B00E318D0 +:1007B00030BC18471D46F8E7000C00000010000090 +:10100000F0210020FDB101005D22000063B101006C +:1010100000000000000000000000000000000000D0 +:101020000000000000000000000000006DB20100A0 +:1010300000000000000000005D2200005D220000B2 +:10104000D9B20100DFB201005D2200005D22000084 +:101050005D2200005D2200005D2200005D22000094 +:10106000E5B201005D2200005D220000EBB201004C +:101070005D220000F1B20100F7B20100FDB20100F3 +:101080005D2200005D2200005D2200005D22000064 +:101090005D2200005D2200005D2200005D22000054 +:1010A00003B3010009B301005D2200005D220000CE +:1010B0005D2200005D2200005D2200005D22000034 +:1010C00000F002F81AF07BF80CA030C80838241899 +:1010D0002D18A246671EAB4654465D46AC4201D170 +:1010E0001AF06DF87E460F3E0FCCB646012633420D +:1010F00000D0FB1AA246AB46334318477CA301003D +:10110000ACA30100103A02D378C878C1FAD85207CC +:1011100001D330C830C101D504680C6070470000AD +:101120000023002400250026103A01D378C1FBD803 +:10113000520700D330C100D50B6070471FB5C046C1 +:10114000C04619F0DEFF04B00FB41FBDF0B4404636 +:10115000494652465B460FB402A0013001B506482D +:10116000004700BF01BC86460FBC804689469246B8 +:101170009B46F0BC70470000C11000008269024924 +:101180008161024810447047911100000100000085 +:1011900001B41EB400B501F000FF01B40198864609 +:1011A00001BC01B01EBD0000401E00BF00BF00BF5B +:1011B00000BF00BF00BF00BF00BF00BF00BF00BF37 +:1011C00000BFF1D17047000070B505460C461646C9 +:1011D00002E00FCC0FC5103E102EFAD2082E02D31B +:1011E00003CC03C5083E042E07D301CC01C5361F2E +:1011F00003E021782970641C6D1C761EF9D270BD45 +:101200008307FF22DB0E9A408907090E99400028C8 +:101210000BDA0007000F0838830828489B001818CD +:10122000C36993430B43C3617047830824489B0001 +:101230001B181868904308431860704710B504469F +:1012400000210120FFF7DCFF00211820FFF7D8FF65 +:1012500000210B20FFF7D4FF02211920FFF7D0FF58 +:1012600002210D20FFF7CCFF02210E20FFF7C8FF5F +:1012700002210F20FFF7C4FF0221C81FFFF7C0FFA4 +:1012800003211620FFF7BCFF03211520FFF7B8FF4D +:10129000204600F019F8002010BD6721018070473A +:1012A00010B500F020F810BD0648704710B500F0EA +:1012B00022F810BD704770477047000000ED00E055 +:1012C00000E400E003F9004370B505462D4C08200A +:1012D0002070A01CFFF7E1FF5920A080294620467E +:1012E00000F0B3FB70BD10B500F0B8FB254900203D +:1012F000891E087010BDF8B5224E0446B61E30781F +:1013000001270D46002807D0204660380B2808D852 +:10131000204600F059FF2BE0602CF9D01A480860F5 +:10132000F8BD20466C38032803D8204600F08DFF16 +:101330001EE0204670381F2803D8204600F047F9E9 +:1013400016E0204690380F2803D8204600F0EAF82F +:101350000EE02046A0380F2803D8204600F076F88B +:1013600006E02046B0380F2804D8204600F0E2F905 +:10137000286000E02F60602CD2D128680028CFD1EF +:101380003770F8BD1A000020013000000120254907 +:10139000C003086024490020087007202349C005C5 +:1013A0008860704770B5204D04462878A04207D069 +:1013B000002C05D0002803D01DA14D2019F0CBFE34 +:1013C0002878A0420ED000211E4A18482C70002C0C +:1013D0001BD01D4B012C06D0022C0DD014A168206F +:1013E00019F0B9FE70BD1160022111605361032133 +:1013F00009068160416070BD116003211160536175 +:101400000121C9058160416070BD11601160072133 +:10141000C905816070BD10B505A1712019F09BFE52 +:1014200010BD000080E100E02000002000F5014038 +:101430007372635C68616C5F63636D5F6161722E80 +:101440006300000000F500408401002010B5A038C2 +:10145000030019F0A1FF0B070E172028313A414B6A +:10146000525C65004B6808788A68194603F0D9F920 +:1014700010BD88888A6883B20888194680B203F054 +:10148000DFF910BD08884C68CB688A6880B22146B5 +:1014900003F0DAF910BD08884B688A6880B21946F3 +:1014A00003F0EEF910BD88888A6883B2088819466F +:1014B00080B203F0FAF910BD88888A6883B2088880 +:1014C000194680B203F034FA10BD08884A6880B229 +:1014D000114603F073FA10BD088982B2888883B27E +:1014E0000888194680B203F074FA10BD08884A686B +:1014F00080B2114603F091FA10BD08894C6882B29F +:101500000888CB6880B2214603F00AFB10BD08882A +:101510004C68CB688A6880B2214603F01BFC10BD82 +:10152000012010BD10B59038030019F035FF0906F1 +:101530000F161D242C363F464E0088888A6883B2D9 +:101540000888194680B204F01DF910BD08884A6861 +:1015500080B2114604F051F910BD08884A6880B283 +:10156000114604F056F910BD08884A6880B2114649 +:1015700004F05CF910BD08884B688A6880B219468F +:1015800004F067F910BD088982B2888883B20888A0 +:10159000194680B204F066F910BD08894B6882B222 +:1015A0000888194680B204F07CF910BD08884A68A2 +:1015B00080B2114604F087F910BD888882B208888D +:1015C000114680B204F0DBF910BD012010BD10B54A +:1015D0007038030019F0E0FE1B0F15192125282F84 +:1015E000363B4044484C53585F68707881889095EA +:1015F000999CA2A5AC004A680878114607F019FC2E +:1016000010BD086807F066FC10BD0C790B7B8A687A +:101610000868214607F06FFC10BD086807F000FD60 +:1016200010BD07F08CF910BD08884A6880B21146D9 +:1016300007F034FE10BD0A790888114680B207F021 +:10164000C4FE10BD087840B207F0CDFE10BD08887A +:1016500080B207F0E1FE10BD086807F0EFFE10BD94 +:10166000086801F0ECFB10BD086801F016FC10BD25 +:10167000088982B209C9194607F0F8FE10BD05C9EC +:10168000114607F042FF10BD08884A6880B2114633 +:1016900009F0FAF910BD0C790888CB688A6880B225 +:1016A000214609F0CDFA10BD0B7908888A6880B20E +:1016B000194609F07DFC10BD08884B688A6880B225 +:1016C000194609F0EEFC10BD08884C68CB688A68A2 +:1016D00080B2214609F053FD10BD08884A6880B2E7 +:1016E000114609F08CFD10BD0B7908880A7A80B28A +:1016F000194607F02DFF10BD088880B207F02DFFB6 +:1017000010BD086807F030FF10BD07F0FCF810BDF1 +:101710008A6809C9194607F08CFF10BD07F0DCF88C +:1017200010BD08884A6880B2114608F05BF810BD09 +:10173000012010BD10B5B02805D0B12808D0B228BE +:101740000BD0012010BD088880B20AF056F910BDF8 +:10175000088880B20AF070F910BD08884B688A6862 +:1017600080B219460AF079F910BD000010B50300E7 +:1017700019F012FE0A0609060C0C0F0F06060612D7 +:1017800007F005F910BD09F027FF10BD01F042FA7E +:1017900010BD06F075FA10BDFAA1FE4819F0DBFC89 +:1017A00010BD7FB5FC49054603C901900291132085 +:1017B000800169468881F94A0F2310460A2128389A +:1017C0000AF043FE0024F6480AF05DFE641CE4B211 +:1017D0000A2CF8D304200090F04801231A4603A9EC +:1017E000F0300AF05DFA002804D0FF20E5A1533064 +:1017F00019F0B1FC686800F024FC00211E220846A4 +:1018000004F040F907F0C6FA02222421E54801F06D +:101810007FFBE44801222C214C3001F079FBE149A7 +:101820000B20B03901F000FA002804D0FF20D5A128 +:10183000673019F090FC09F09FFE02F075F901ABDA +:1018400000220821D8A007F085F9002804D0FF2045 +:10185000CCA16D3019F07FFC284602F0C2FC0028B4 +:1018600004D0FF20C7A16F3019F075FCDB2189007F +:10187000D04819F045FBCF48012141710221817107 +:101880000621C1717FBD10B5CA4CA078092804D3C8 +:10189000FF20BCA1A73019F05EFC207860214843EE +:1018A000001900210173417BF722C908C900C91C36 +:1018B0001140EF22114041730121E1700C3010BD45 +:1018C00070B50E4600211C4619801546030019F01C +:1018D00063FD0723050B1711231D2300224629460C +:1018E000304609F096FE70BD22462946304606F085 +:1018F00098FE70BD22462946304601F0C2FF70BDF9 +:1019000022462946304603F0C0FD70BD22462946D6 +:10191000304600F010FC70BD9E489AA1D53819F0F1 +:101920001AFC032070BD70B5A24CE078002818D0D6 +:101930002078602148430019407B00254007400F74 +:1019400001190879401E08712078401CC0B220702F +:10195000092800D12570A078401CA0700AF01DFF56 +:10196000E57070BD9348C079002800D08BE77047C0 +:1019700070B5904DA86800280CD0FFF7F3FF002841 +:1019800062D06022A968FFF71FFCFFF7CCFF0020A0 +:10199000A860EFE76879002856D0FFF774FF044687 +:1019A00080484C3001F0C4FA6060002804D1C9209E +:1019B00074A1800019F0CFFB60680AF0EAF80028F3 +:1019C0000DD0204606F011FD6078010703D5C00850 +:1019D000C000401C2BE0734861684C302DE071481A +:1019E00061684C3001F0ADFA00F05AFB00282BD1B1 +:1019F000FFF749FF04466B4801F09AFA606000283F +:101A000004D164485FA16D3019F0A5FB60680AF04D +:101A1000C4F8002814D0606800886080204609F06F +:101A20002BFE6078010706D5C008C000801C6070DE +:101A3000FFF779FF9EE75B48616801F082FA99E75A +:101A40005848616801F07DFA70BD10B55A4CE160EC +:101A5000A0605A4800F034FC607010BD5649002068 +:101A60000870704770B5564E0546706A94B00C46C3 +:101A7000401C04D1B06AC0430004000C0BD0306A93 +:101A8000C007C00F2870706A19F03CFAB06A207164 +:101A9000000A607114E02B206946087009A96846A5 +:101AA0000AF04BF8002804D0972036A1800019F0E6 +:101AB00052FB0120287006220AA9204619F0C1F91C +:101AC0002878002803D06079C0210843607114B0E1 +:101AD00070BDF0B53A4C0646206895B00D463746C5 +:101AE0000837401C08D16068401C05D1A068401C24 +:101AF00002D1E068401C11D02068314619F002FA8A +:101B00006068311D19F0FEF9A068394619F0FAF93C +:101B1000E06831460C3119F0F5F925E02B206946D3 +:101B2000087009A968460AF008F8002804D0194886 +:101B300014A1553819F00FFB08220AA9304619F0F4 +:101B400080F92B206946087009A9684609F0F5FF5D +:101B5000002804D0A3200BA1800019F0FCFA082271 +:101B60000AA9384619F06DF920692E460836401C3E +:101B700029D16069401C26D1A069401C23D1E069AD +:101B8000401C1FE07372635C686F73745F636F72F5 +:101B9000652E6300DA020000B4B30100D801002012 +:101BA0006D170000A40B00206E52463531383232DA +:101BB00000000000880700202400002071190000A8 +:101BC0008000001012D02069294619F09BF9606945 +:101BD000291D19F097F9A069314619F093F9E069C8 +:101BE00029460C3119F08EF915B0F0BD2B2468464A +:101BF000047009A909F0A1FF002803D0F649F748AD +:101C000019F0A9FA082209AF28460AA919F019F90A +:101C10006846047009A909F090FF002804D0EF4835 +:101C2000ED49C01D19F097FA0822391D304619F008 +:101C300008F9D9E770B5EA4C0546A068002804D039 +:101C40000320E549000219F086FAA56070BD10B5C1 +:101C50000146E44801F075F9E1498879401CC0B2B9 +:101C60008871012803D1E048407800F04DFB10BD99 +:101C700070B50446DD4816460D46814204D1D7486A +:101C8000D549CB3019F067FA012E05D0E120D249B1 +:101C9000800019F060FA70BD66202070002020726C +:101CA000A5810120A07370BD70B515460C4606468F +:101CB000FFF758FE00280CD06621017046800121F4 +:101CC000017221680161A18881820573FFF72BFEF3 +:101CD00070BD1321304607F078FB70BDC2494968DA +:101CE000884201D210207047032101700020704704 +:101CF00070B5BD4C05462078002694B0002801D070 +:101D00000820E4E6BA4A6260954201D21020DEE67D +:101D10006868002809D00921D82804D3C31C9B086F +:101D20009B00834205D00846D1E60320400268604C +:101D30000EE0012109074B6B896B4B43AD49511AEA +:101D40000122591AD202891A814201D20421EAE7FA +:101D500000F052FF6178A0680CF04EFBE068401E76 +:101D600007280BD8302269460A70887068460DF043 +:101D700088FF002802D009A80CF0FBFC2846FFF7DA +:101D800010FD012020703046A1E6F8B504469648C3 +:101D90000F464068814208D3002C01D0844204D30E +:101DA000E01C80088000A04201D01020F8BD8C48C3 +:101DB0008178002911D039880091417860225143FF +:101DC0000D18287B0C350007000F3B4600222946E2 +:101DD000FFF776FD060004D015E0002038800520CE +:101DE000F8BD002C13D039880098814201D90C2607 +:101DF0000DE028783B460007000F22462946FFF7F2 +:101E00005FFD060005D00C2E01D000203880304642 +:101E1000F8BD734C6078401CC0B26070092801D1D5 +:101E200000206070A078401EA07068784107490FBC +:101E300001290ED0022906D003291AD066496E481E +:101E400019F089F9E3E7C006E1D46868FFF7FFFEFF +:101E5000DDE7644869684C3001F073F86079401C34 +:101E6000C0B260710128D2D15F48407800F04CFACE +:101E7000CDE7E079401CE071C9E7604A10B59042B7 +:101E800009D3594A0124A4045268A04201D39042C4 +:101E900001D3914201D2102010BD00F0FEFE10BD12 +:101EA000564B10B5994209D34F4B0124A4045B68EB +:101EB000A14201D3994201D39A4201D2102010BD10 +:101EC000022803D0102801D0092010BD00F00BFF1C +:101ED0000028FAD0052010BD484B10B598420DD30C +:101EE000414B0124A4045B68A04201D3984205D36E +:101EF000994203D3002A03D09A4201D2102010BD88 +:101F000000F017FF0028FAD0072010BD10B50446D6 +:101F1000354894B04068844202D2102014B010BDFD +:101F20000F2008A9087369460BA809F006FE0028CF +:101F3000F4D16846007A207068464089608068461F +:101F40008089A0800020E9E710B500290BD0264A3F +:101F50005268914202D30B68934201D2102010BD07 +:101F60008A88002A02D001F037FE10BD092010BD7A +:101F700010B5224A94B091420ED31B4A01239B0410 +:101F80005268994201D3914206D3441E1E2C41D877 +:101F9000994203D3914201D21020BFE7012837D1E3 +:101FA00008780024C007C00F002803D0032069462A +:101FB000887001E06846847038206946087009A975 +:101FC000684609F0BAFD002804D004480CA18B38FB +:101FD00019F0C1F82046A1E7841B0000AA02000006 +:101FE00088070020A40B002024000020FFFF000031 +:101FF00000220020000000202104000000C0010099 +:102000007372635C686F73745F636F72652E6300D5 +:10201000072083E70246203A1F2AF9D806F001FE7E +:102020007CE710B5604A5268914201D2102010BD81 +:102030000246203A1F2A02D806F068FE10BD07208B +:1020400010BD70B50546594C002020702046461939 +:1020500055484660E01C80088000A04204D0FF2064 +:102060005349293019F077F801200007C06AC043AE +:102070000006000E03D14F480068401C03D04E48B4 +:102080004E49301AC862A8B20422214604F00DF964 +:10209000002804D0FF204649393019F05CF870BDA3 +:1020A000F0B595B03B2008A9087369460BA809F064 +:1020B00044FD002804D0FF203D49813019F04BF841 +:1020C0003F4E00246D4630E02F19B87DC10706D081 +:1020D000400704D460004019C08809F0E9FB394882 +:1020E000807900281FD0B87D80071CD5600040197A +:1020F000C0880022062109F0F7FB002813D03C21FC +:1021000008A8017360004019C1886846C185694606 +:102110000BA809F012FD06000BD0FF2024499630D1 +:1021200019F019F805E0641CE4B268460079A04291 +:10213000CAD8304658E5F7B50546007800270009AB +:102140000C463E46062804D0FF201949BF3019F03E +:1021500002F8287A00280ED0012814D0FF20144954 +:10216000E03018F0F8FF0298002C068001D027809C +:1021700066800020FEBD02270926002C10D0A88909 +:10218000A080A87B0AE003271426002C08D06888CA +:10219000A0802869E060A88A2082287B2072E2E77C +:1021A00002980680E5E700002400002000220020BD +:1021B000002000000010001000000020000500407A +:1021C000043000008807002010B56038030019F0C3 +:1021D000E3F80A060A0F13181F252930353A086854 +:1021E000FFF786FD10BD05C91146FFF7CEFD10BDF6 +:1021F0000868FFF773FD10BD05C91146FFF73DFEE6 +:1022000010BD4B6808788A681946FFF749FE10BD73 +:102210008A6809C91946FFF75FFE10BD0868FFF715 +:1022200075FE10BD08884A6880B21146FFF78CFE23 +:1022300010BD05C91146FFF79BFE10BD05C911462B +:10224000FFF7EFFE10BD012010BD01207047000018 +:102250000E4A12680C498A420AD118470B4A126882 +:10226000094B9A4204D101B500F08EFE03BC8E46A4 +:10227000074909680958084706480749054A064BAF +:102280007047000000000000BEBAFECA64000020D3 +:1022900004000020F0210020F021002001203F490F +:1022A000400608603E4908603E490A68FF231B0259 +:1022B0009A4383121A430A6038498039086070478C +:1022C00010B502460420384904E0C3005B181B79AE +:1022D000002B0AD00346401EC0B2002BF5D133A11B +:1022E000432018F038FFFF2010BDC300CA50002261 +:1022F00059184A718A7101220A7110BD2A4A0021B7 +:10230000C00080180171704710B50446042803D33B +:1023100026A1522018F01FFF2348E1000C18207955 +:10232000012803D021A1532018F015FF6079A1796D +:10233000401CC0B2814200D06071012017494006A4 +:102340008031086010BD70B5164804250068164E2F +:102350000004800F1B4C02281AD014A1692018F029 +:10236000FAFE15E02078C10088190279012A07D108 +:10237000427983799A4203D04279827170588047BA +:102380002078401CC0B22070042801D300202070A7 +:1023900028466D1EEDB20028E4D170BD80E100E05A +:1023A00080E200E018E400E0200C00207372635C1F +:1023B000736F635F7369676E616C6C696E672E63C0 +:1023C000000000003400002010B5EFF31080C407B7 +:1023D000E40F72B6D2484178491C41704078012818 +:1023E00001D10AF0FFF9002C00D162B610BD70B522 +:1023F000CB4CE07800280AD10125E570FFF7E4FF17 +:102400000AF0F8F9002804D000200AF0CBF90020E7 +:1024100070BDC44865714560F9E770B5EFF3108091 +:10242000C507ED0F72B6BE4C6078002803D1BEA17F +:102430008F2018F090FE6078401E60706078002851 +:1024400001D10AF0D3F9002D00D162B670BD10B5EC +:10245000B348C178002904D000214171C170FFF751 +:10246000DCFF002010BD10B504460AF0C3F9AC49EA +:10247000C978084000D001202060002010BDF8B5C8 +:102480000246A74C0026A67108200421012510272A +:10249000130018F081FF0D080A0C0E101214161EFE +:1024A000262123252800257122E0022001E0217148 +:1024B0001EE020711CE027711AE02020F9E70126B8 +:1024C00016E0FFF781FF0AF095F90028FBD00226FD +:1024D0000EE02171A5710BE02771FBE7202000E0E1 +:1024E00040202071F6E7FF208FA1763018F033FEF0 +:1024F0000AF08CF9002809D00AF08EF9B04205D113 +:1025000030460AF08CF90028FAD02CE00120800730 +:10251000C560894900224A60884A9661814B02223F +:102520005A60856086480269D243D206D51702698F +:1025300010231A4302610F466D1C00E020BF78682B +:102540000028FBD030460AF06AF90028FAD0002DA6 +:1025500004D17B48026910218A430261714902203B +:10256000886000207860A07900280CD00AF042F939 +:1025700005460AF09FF8734A002D02D0A260E06081 +:1025800001E0E260A060002E01D100F0A5F8F8BDE6 +:1025900010B504460AF034F9002805D0604901203E +:1025A000C8704A78521C4A702046FFF768FF10BD79 +:1025B000F8B5614DA8680026012802D1AE600AF086 +:1025C000F1F86868012800D16E6028680127544C32 +:1025D000012812D12E606079002803D000200AF073 +:1025E000E1F866712078002807D00AF003F9002886 +:1025F00003D0012080070761A770286901282AD12C +:102600002E6100F05FF8012080074761A079002863 +:1026100015D00AF0EFF800900AF04CF80099002964 +:1026200001D0E16800E0A168411A022901DA8A1CA0 +:1026300011DC0099002901D0E06000E0A060FFF704 +:10264000C3FE0AF0D7F8002804D0012080070761F4 +:10265000A77000E02770E868012812D100F032F876 +:1026600000F030F800F02EF8A078002804D1FF2008 +:102670002DA1033018F06FFDEE60A6702670FFF7F5 +:10268000CCFEF8BD10B5264CE078002801D10AF048 +:10269000ADF801208107886100F014F8A0780028C7 +:1026A0000BD0254CE068002803D10AF0B8F80028C8 +:1026B000F8D10020E06000F005F800201949C0437F +:1026C000886010BD08B55020694608806A461088A9 +:1026D000411E1180FAD208BDF8B51248192787604B +:1026E000154900200860C8600AF084F8BE0701247C +:1026F0000B4D002802D03461AC7000E02C70FFF765 +:1027000063FE084847600D4928798863FFF7DAFFC0 +:10271000B461FFF7D7FF0849002008617461F8BD74 +:1027200038000020000300407372635C736F635FC6 +:10273000636C6F636B2E6300000100400005004076 +:1027400000ED00E0FFFFFF7F8107C90E002808DAD7 +:102750000007000F083880082E4A80008018C069E2 +:1027600004E080082C4A800080180068C8400006F9 +:10277000800F704710B50D20FFF7E6FFC4B20420AC +:10278000C043FFF7E1FFC0B2844203D023A11A2067 +:1027900018F0E1FC26490120486010BD0121254ABE +:1027A00048031060244B00221A60244A5160244AD6 +:1027B0001060244A11601F49803908607047012168 +:1027C0001C4A480310601F4A51601B4A00211160D7 +:1027D0001B490860704710B517490868012804D0E4 +:1027E0000EA1572018F0B7FC10BD114880680022D8 +:1027F000C0B20A6009F0BEFC10BD10B50E480168F9 +:102800000029FCD0FFF7E7FF01200D4940030860D5 +:1028100010BD000000ED00E000E400E07372635CB6 +:10282000736F635F68616C5F726E672E6300000098 +:1028300000D5004080E100E000D1004000D300401E +:1028400080E200E000D0004030B40121BC48C90261 +:102850000160CD1005604A030260BA4803681B029C +:102860001B0A036004680023240A24020460B6489B +:102870000468240A24020460B4480124446084608B +:10288000B34C23606360A360B24B19601D601A6093 +:10289000B14B19601A600121016030BC704710B45F +:1028A0000121A748CA0202600B0203600C06046003 +:1028B000A64841608160A94841680029FCD1A4492B +:1028C0000020086048608860A248026003600460DD +:1028D00010BC704701219F48C9020160C910016006 +:1028E0007047002805D0012805D0022805D19C4852 +:1028F00070479C4870479C48704710B59BA18B203F +:1029000018F029FC002010BD70B500219E4C9F4D91 +:102910009F4A8F4B002808D001281DD0022822D0C2 +:1029200092A1B32018F017FC70BD01200004A06034 +:10293000A86011601960974BC2039A60964A906034 +:102940007F4A0012106095480160864801609448F3 +:1029500001609448017070BD01204004A060A8602F +:102960005160596070BD01208004A060A860916032 +:10297000996070BDF8B59446834A8B4F834D00240F +:102980000126002808D0012832D0022840D077A1A3 +:10299000E82018F0E0FBF8BD891E0902090A0120B1 +:1029A000000490603C6468606C4A1164012B1DD087 +:1029B00000217C4A7D4B51706146DC63DE637C4BB9 +:1029C0005C6002249C6004241C61744B3D311960DE +:1029D00073490E605F4B891519606F4B58605E48F4 +:1029E00001606C49C00548601670F8BD0121E0E740 +:1029F0000120704E4004704F012B04D134645060AC +:102A000068603964F8BD9060346468603964F8BD0A +:102A100001206A4E80046A4F012BF4D1EEE74F4843 +:102A20004068704770B54A4D28680026564C01280A +:102A300006D1A068C00303D501200004A0602E6069 +:102A40006868012809D1A068800306D501204004E8 +:102A5000A0606E6001200AF0B9FEA868012809D1C3 +:102A6000A068400306D501208004A060AE6002206B +:102A70000AF0ACFE70BD10B54A490878002818D09D +:102A80000120444AC0079060434AC00B90602C4A22 +:102A900000121060414A00201060324A1060404A23 +:102AA000106008704A78002A02D048700AF08EFE42 +:102AB00010BD0320FAE70120424900060860704774 +:102AC0000120244900060860704701203D49400567 +:102AD0000860704701201F4940050860704733496E +:102AE0000020C86388151B4908607047410A364AB0 +:102AF000C005C00D5043801C5143400A0818704760 +:102B000010B4324C430B63431B0C5C020C602E4C24 +:102B10006343C31A2E485C0258432B4B400D43437A +:102B2000E31A0124DB0324041B191B1613700A6823 +:102B30001018086010BC704710B50AF01BFF10BDDC +:102B400080E100E008E400E018E400E000B00040AC +:102B500040B1004080E200E000E100E000B500404C +:102B600048B100404081004044B100407372635C52 +:102B700072656D5F68616C5F6576656E745F7469C0 +:102B80006D65722E6300000000B3004040B300404A +:102B900040B5004000F50140008300404085004002 +:102BA000008200404800002000B10040C08F00407B +:102BB0000085004004B1004004B5004008B1004069 +:102BC00008B5004000E200E0093D00003786000043 +:102BD0006F0C010010B50AF0B9FE10BD00200449C9 +:102BE000C863012001218140024A116000BF704783 +:102BF000C01F004080E200E010B50DF05DF909F063 +:102C0000F7F9FEF7C3FB0FF0F5FA0DF08FFF0DF0AB +:102C10001BFF10BD70B50C46054603F0A7FA214610 +:102C200028460EF0C2FF70BD70B50D46040012D0EC +:102C3000002D10D02101284618F060F910225449C7 +:102C4000284618F0FEF852480121083801804480D7 +:102C50004560002070BD012070BD70B54C4E002451 +:102C60000546083E11E0716820014018817BAA7B6F +:102C7000914209D1C17BEA7B914205D10C222946C0 +:102C800018F0B2F8002806D0641C30888442EADBD1 +:102C90000020C04370BD204670BD70B50D460600D3 +:102CA0000AD0002D08D03A4C083C20886188401C8E +:102CB000884203D9042070BD102070BD3046FFF754 +:102CC000CCFF002801DB401C0AE02088616800017D +:102CD00040181022314618F0B4F82088401C20809B +:102CE0002870002070BD70B514460D001FD0002C58 +:102CF0001DD00021A170022802D0102817D108E0B1 +:102D0000687829780002084311D00121A170108051 +:102D10000BE02846FFF7A1FF002808DB401CA0704D +:102D2000687B297B000208432080002070BD0120C1 +:102D300070BD70B5054614460E000AD000203070F4 +:102D4000A878012807D004D9114908390A88904287 +:102D50000BD9012070BD002C04D028782070288861 +:102D6000000A50700220087010E0002C0CD0496856 +:102D70000001411810222046103918F062F8287816 +:102D800020732888000A607310203070002070BD06 +:102D9000540000205A4910B5884207D30121890404 +:102DA000884205D357490968884201D2102010BDD6 +:102DB0000146012005F0CBF810BD30B5044693B0B4 +:102DC00000200D46079014210BA818F099F81C213B +:102DD000684618F095F86A46112010770020507761 +:102DE000107802210843107007A80C90012008AA4F +:102DF000907245486A4610850AA80B902088108476 +:102E000060885084A0889084E088D084907FF921E5 +:102E10000840801C4008400090770820908610876A +:102E200008A80F9010AA0BA9684600F05CFF0028C4 +:102E300003D110A800882880002013B030BD3EB513 +:102E400004460820694608802D48844207D30120A3 +:102E50008004844205D32B480068844201D21020AC +:102E60003EBD2146012005F072F80028F8D12088E7 +:102E7000694688806088C880A0880881E088488189 +:102E800005F065FE01AB6A46002101F0BBFB694617 +:102E900009880829E4D003203EBD1FB50446002060 +:102EA000029008206946088115480391844207D39F +:102EB00001208004844206D312480068844202D272 +:102EC000102004B010BD05F042FE014602AA0F48D2 +:102ED00001F02EFD0028F4D169460989082901D0A6 +:102EE0000320EEE7694609882180694649886180A8 +:102EF00069468988A1806946C988E180E1E70000C8 +:102F000000C0010028000020042A0000FFFF00008C +:102F100010B5031D03600020521E04E05C181C6005 +:102F2000401C2346C0B29042F8DB0020186010BD60 +:102F300001460A680020002A02D0104612680A6082 +:102F4000704702680A6001607047000010B50146D2 +:102F50002022094817F075FF07490020C877084666 +:102F600010BD0649012048610548064A01689142A2 +:102F700001D1002101607047B00E00200005004023 +:102F800064000020BEBAFECA0C4908784A78401C8A +:102F9000C0B2904200D008707047094A074820BF6D +:102FA00040BF20BF4178037843701368002B02D1E3 +:102FB00003788B42F3D00020704700006B000020A4 +:102FC00000E200E00A4A022151600A490B68002B26 +:102FD000FCD0906008680028FCD000205060086891 +:102FE0000028FCD0704701200007406970470000AE +:102FF00000E5014000E401407047704770477047AA +:1030000010FFFFFFDBE5B15100C001006700FFFFCB +:1030100003B40148019001BD09000020002803D03D +:103020008178012939D101E0102070470188FE4ADA +:10303000881A914233D01BDCFC4A881A91422ED068 +:103040000BDC00292BD00320C002081A27D001284E +:1030500025D001210903401A07E001281FD00228CA +:103060001DD0FF281BD0FF380138002815D116E0ED +:10307000FF220132811A904211D008DC01280ED0C3 +:1030800002280CD0FE280AD0FF2806D107E001292B +:1030900005D0022903D0032901D0002070470F205A +:1030A000704700B50B2826D009DC030018F074F92E +:1030B0000B1D2125251B25292325271F1B00112832 +:1030C0001BD008DC0C2816D00D281CD00F2814D0DB +:1030D000102808D10FE0822809D084280FD0852835 +:1030E0000FD0872811D0032000BD002000BD05208F +:1030F00000BDCF4800BD072000BD0F2000BD04204B +:1031000000BD062000BD0C2000BD0D20800200BDCA +:1031100070B500290BD0CB1FFA3B81241E46CDB2DF +:10312000112B1BD2012805D0022806D009E000206F +:1031300010701DE0FF20043001E0FF2003308142C9 +:1031400018D0330018F028F9111613131613161699 +:103150001316161613131313161316000846FF380A +:1031600081381F2803D9FF39FE39022902D815708A +:10317000002070BD1470072070BD00B5030018F06A +:103180000BF9060406040C080A0C002000BD1120EF +:1031900000BD072000BD082000BD032000BD007851 +:1031A0000207120F04D0012A05D0022A0AD10EE02C +:1031B000000907D108E00009012805D0022803D042 +:1031C000032801D0072070470870002070470620B0 +:1031D0007047002807D0012807D0022807D003280D +:1031E00007D007207047002004E0112002E02120D2 +:1031F00000E0312008700020704738B50C4605000B +:103200004FD06946FFF7CBFF002822D12088032149 +:1032100089028843694609788907090D0843208097 +:103220006946681CFFF7BBFF002812D121880320E4 +:1032300000038143684600788007800C01432180A9 +:10324000A8784007820F2020012A03D0022A03D049 +:10325000072038BD814300E00143218088B2010589 +:10326000890F08D0012189038843A9780907C90F6C +:1032700089030843208080B28104890F0AD0A9788D +:103280004004C906C90F400CC903084320808004CC +:10329000800F02D12088400403D5208840210843B4 +:1032A0002080002038BD70B50446002008801546F7 +:1032B0006068FFF7A2FF002815D12189A08981420B +:1032C00010D861688978C90708D00121490288426D +:1032D00008D8491C17F01EFE298009E0FF21FF31A4 +:1032E000884201D90C2070BDFF30FF3003302880A8 +:1032F000002070BD10B5137804785B08E4075B000C +:10330000E40F23431370FD2423400478A407E40F43 +:10331000640023431370FB24234004786407E40F04 +:10332000A40023431370F724234004782407E40FF8 +:10333000E40023431370EF2423400478E406E40FF1 +:10334000240123431370DF2423400478A406E40FF0 +:103350006401234313700078BF244006C00F23404C +:10336000800103431370002906D00878C10701D1FA +:10337000800701D5012000E00020C0015906490E58 +:103380000843107010BD30B50A8803239B020488DF +:103390009A4323059D0F02D1A3049C0F01D09B0FDC +:1033A00000E001239B021A4303230A801B039A4374 +:1033B00003889804840F02D11805830F01D0800F71 +:1033C00000E00120000302430A8030BDF3B593B052 +:1033D0000D000FD0139800280FD01221284617F0A7 +:1033E0008DFD03AAFF21012003F0D5F80024264615 +:1033F00037467AE0102015B0F0BD0720FBE768469D +:10340000807D01280BD16846818A0520C002081AF8 +:1034100010D0012810D0022812D0032812D0042C7A +:1034200014D0052C15D113E002290000012800005A +:1034300003300000012400E002246846468A08E0C8 +:10344000032406E068460424478A02E0052400E0DD +:1034500006246846418A1398814246D12C74002E76 +:1034600041D00DAA0EA905200292019100901023CF +:103470000022FF21304603F02FF9002823D16846AF +:10348000808E2A46C0B20EA9FFF72DFC00281AD163 +:10349000AE81002F27D00DA9052008AE0291009023 +:1034A000132300220196FF21384603F015F9002866 +:1034B00009D16846808EF11CC01EC0B22A1DFFF7DC +:1034C00012FC002801D0032095E708A881784278F3 +:1034D00008021043E881062C05D16846807DA87259 +:1034E0006846808A2881002085E703A803F05CF8FD +:1034F000002884D0FFF7D5FD7DE7002805D0FE4ADF +:10350000012903D0022903D003207047518800E02D +:103510009188814201D1002070470720704770B523 +:103520000C4605461C21204617F0E8FC00202080B0 +:10353000002D08D0012D04D0F0A1F54817F00BFEA6 +:1035400070BD062000E00520A07070BD70B592B07F +:103550001546064601206A461071107453740846D9 +:1035600008300395029048889082FEF7FBF904002A +:1035700019D06580172069468883203600940AABED +:103580007178023307AA01A80EF017F90646607891 +:10359000000701D5FEF7C7F9002E0AD03046FFF725 +:1035A000ECFD12B070BD1321284605F00EFF03207C +:1035B000F7E708A800906846838B0422012128467B +:1035C00007F0B3FEEDE770B506468AB000200D4661 +:1035D00007900590069003A90490052402460291E5 +:1035E0000190102300942946304603F075F8002816 +:1035F0000DD108A804A9009102900194684683891E +:1036000000222946304602F083FE002801D0FFF751 +:1036100048FD0AB070BD10B50EF0D5FA10BDF0B57A +:1036200089B000260546059600780C460827030059 +:1036300017F0B2FE0CFD070C390B75759BBEFCD361 +:10364000E3FD68680A38FEF702FB07E1A88800225C +:1036500080B20421009008F067FB0290002C04D097 +:10366000AB48A6A16E3017F076FD0298002804D171 +:10367000A748A2A16F3017F06EFD0298009908309C +:103680000DF0D0FCFEF76EF9040007D060783843E7 +:10369000607000986080FEF746F9E1E01321009821 +:1036A00005F093FEEAE0002C04D1BD2093A1800038 +:1036B00017F051FD60880022042108F035FB0090CE +:1036C000002804D192488DA1883017F044FD00995C +:1036D000002008802A7994461EE0C3005B199B688D +:1036E00007936B469B8B1A0708D5DA0606D560460A +:1036F000C20050194038C08F088006E05B0409D52D +:103700000871C2005019C0884880607838436070E2 +:103710000226A3E0401CC0B28445DED89EE0E888C3 +:10372000694608800090002C04D1794873A1983034 +:1037300017F011FD2878062813D10098C00B10D07F +:1037400060880022042108F0EFFA060004D17048D6 +:103750006AA1A23017F0FFFC00203071A8887080A9 +:1037600039E060783843607078E0002C04D1684814 +:1037700062A1B43017F0EFFC60880022042108F049 +:10378000D3FA0090002804D161485CA1B73017F04B +:10379000E2FC009808300EF068FA0121484002D19E +:1037A000E888C00B5AD0009861880226C180D8E70B +:1037B000002C04D1564851A1D03017F0CCFC6088C1 +:1037C0000022042108F0B0FA002804D150484BA18F +:1037D000D33017F0C0FC0226C3E7002C04D14C48BC +:1037E00046A1DC3017F0B7FC022661880122204692 +:1037F000FEF73EFA01200590B3E7A889002280B2C7 +:103800000421009008F090FA0746002C04D04048AC +:103810003AA1EE3017F09FFC002F04D13C4837A1AD +:10382000EF3017F098FC6868029001E009E010E0C2 +:10383000288969468881012202A90098FEF734FA96 +:103840000CE0002C8DD16D202CA1C00017F083FC62 +:1038500087E72F4829A1FE3017F07DFC002C0DD002 +:10386000607800070AD50598002807D184202070C9 +:103870002046582229460830FDF7A6FC304609B0FC +:10388000F0BDF7B50C460546007A224688B00A32EC +:103890000492921C01920027811E16323E4602922B +:1038A0000B0017F079FD08F405F348488ED0F2F3C9 +:1038B00068880022042108F037FA0190002803D11B +:1038C0000EA1144817F047FC01980088002802D088 +:1038D0005227072600E151271E26002C70D0688849 +:1038E000A0800120A071019804990079C0004019BE +:1038F000C089FFF76BFD0FE0400C00207372635C22 +:1039000067617474735F636F72652E6300000000FB +:103910006F0200008603000000287DD10198007925 +:10392000C0004019C089208101980079C000401969 +:10393000408AA083F0E0698A0091062820D1E889B6 +:10394000C00B1DD008462230512786B2002CC5D0AE +:10395000A8890199FFF73AFD002872D16888A080F4 +:103960000220A071A88920810120A072288AE0830A +:10397000009820846969009A029817F062FACBE0F7 +:1039800008462030502786B2002CA7D0A889049979 +:10399000FFF71CFD002854D16888A080A889E0802A +:1039A000287A06280AD002202072288AA08300984C +:1039B000E083204669692030009ADEE70120F3E7C2 +:1039C0008FE068880022042108F0AEF90690688A2A +:1039D00000900698002803D1FD49FE4817F0BBFB74 +:1039E000069808300EF041F90121484002D1E889DB +:1039F000C00B25D000985127223086B2002C7AD0F7 +:103A00006888A080A8890199FFF7E0FC002818D1F8 +:103A10000220A071A88900E013E020810420A07298 +:103A2000288AE083009820846969009A029817F038 +:103A300008FA0699002008710698A98941806BE070 +:103A400003200BB0F0BD688804F0DDF900906888B1 +:103A50000022042108F068F901900098002804D1A0 +:103A6000DC48DB492C3017F076FB0198002804D1A4 +:103A7000D848D7492D3017F06EFB0198D649C08839 +:103A8000884205D05127222604E01EE03FE035E0C1 +:103A900050272026002C2ED06888A080502F07D0D9 +:103AA0000220A0712146287B0831FFF738FD33E062 +:103AB000287BA11DFFF733FD6A8800230199009838 +:103AC000FFF744FD0028BCD126E0C449A889C98875 +:103AD000814207D154270626002C0CD06888A0808C +:103AE0001AE008E053270826002C04D06888A0803C +:103AF000A889E08010E00A98068013E05527072681 +:103B0000002CF8D0A889A0800020A07104E08D20AE +:103B1000AF49C00017F01FFB0A98002C068001D0A7 +:103B20002780668000208CE7AC4900200870704731 +:103B300030B585B00C4601F0DBF90546FF2804D10D +:103B4000A448A349953017F006FB0020208020717F +:103B50006080401EE0802046294608300DF056FA6D +:103B60006A462946012002F016FD102412E068463C +:103B7000808800070ED56846C0882946FFF723FDD8 +:103B800068468188FF2321438180C0882946019AA5 +:103B900002F02CFE684602F007FD0028E7D005B0D1 +:103BA00030BD0A46014610B5104608300DF042FA05 +:103BB00010BD70B505460022042108F0B5F80400D8 +:103BC00004D184488249B73017F0C5FA2046294607 +:103BD00008300DF027FA70BDF0B591B00C460746DD +:103BE00004F011F9050005D02878222804D2082015 +:103BF00011B0F0BD7A48FBE700220421384608F0F6 +:103C000093F80646002C02D0A08800280CD0012092 +:103C1000694608710220087400204874002C05D001 +:103C2000A0880883206802E00920E1E70883059066 +:103C30003046083003970290FDF794FE040018D038 +:103C40006780172069468883203500940AAB69781D +:103C5000023307AA01A80DF0B0FD05466078000701 +:103C600001D5FDF760FE002D09D02846FFF785FA43 +:103C7000BEE71321384605F0A8FB0320B8E708A8E3 +:103C800000906846838B04220121384607F04DFBE3 +:103C90000021C943F180ABE7FFB585B00E9E778860 +:103CA000384604F0B0F8054600220421384608F0F2 +:103CB0003BF80446002D03D145494A4817F04BFA1A +:103CC000002C04D147484249401C17F044FA0834FC +:103CD000089869460394C1C105A80DC820356978C4 +:103CE0000DF0DAF9CBE5F0B50446002099B00D46A9 +:103CF00001460D9010A88181164601818180374AC6 +:103D000068469180018510A80180684601878185F9 +:103D100081841078012808D0022806D0032804D016 +:103D2000042802D0082019B0F0BD2F4A944273D362 +:103D30002E4F0121890438688C4201D3844278D304 +:103D4000294A954275D3012189048D4201D38542C8 +:103D50006FD36168002913D0234A914269D30122AD +:103D60009204914201D3814263D3608921898842C0 +:103D700003D801225202914201D90C20D3E70D90C1 +:103D800016AA0EA92846FFF78EFA0028CBD168683C +:103D900080784007800F02280AD16846008F80048F +:103DA000800F05D02869002802D03968884240D3A6 +:103DB0000AA92069FFF721FA0028B4D12069002858 +:103DC0001CD0607880076846008D14D580040FE011 +:103DD000FC380000EE030000FFFF0000400C002054 +:103DE000023000000C05000000C001002800002087 +:103DF000800F68D002E08004800F64D16846008D97 +:103E0000810618D58004800F606806D0002812D083 +:103E1000396888420DD302E00BE000280BD0FE4940 +:103E2000884206D301218904884204D33968884234 +:103E300001D2102077E709A96069FFF7DEF90028B1 +:103E40009CD16069002808D06846808C0105890FE4 +:103E5000012938D18004800F35D00BA9A069FFF764 +:103E6000CCF900288AD16846808C80062BD468461D +:103E7000808D810627D4A169002906D00105890F0C +:103E8000012920D18004800F1DD0E068002804D0D3 +:103E90000078002817D01C2815D204AA611C2046DF +:103EA000FFF728FA0121890210A80180012768463E +:103EB0008773DA49818104AA033217A92868FEF7BB +:103EC00038FF002801D007202DE710A8007F15A992 +:103ED000C01CC2B200200C920190FF320090034639 +:103EE0000291FF3203A80332109902F0ACFA0028C5 +:103EF00026D110A9888A0F902A892969C84801917A +:103F00000092029010A90A8B6B8928680E9902F022 +:103F10009AFA01007ED1C2480025001F81886846B8 +:103F20004174090A8174052104A86A4623C210A8B5 +:103F30002A46FF21808A0C9B02F0EAF9002802D071 +:103F4000FFF7AFF8EFE66846007C0322C1090020C6 +:103F5000920290430122920280181490002928D0E6 +:103F6000014610A8018068462921877309028181D2 +:103F7000058608A8007C0023410860784900C00736 +:103F8000C00F014308A80174FD2001406078A54AD4 +:103F90008007C00F4000014308A801740CA902204B +:103FA00001910090029503A8109902F04CFA0100CB +:103FB00030D16068002828D0206900280DD10AA9D6 +:103FC0000EA8FFF7E0F96078800706D46946088DEF +:103FD0000321090388436946088590496846877329 +:103FE000FE3181818F492089891E16F093FF626816 +:103FF0000D9811AB0192009002930A46002303A88A +:104000000A9902F020FA010004D12078C10603D4F5 +:10401000800600E085E02AD56846058660690028AC +:104020000DD109A90EA8FFF7AEF96846818C0320CF +:104030008002814301208002091868468184694614 +:10404000888CC82108436946888474488F73FF3080 +:10405000888112AA0CA902200292019100900023EB +:10406000704A03A8099902F0EEF9010059D12078AD +:10407000C00729D068460586A06900280DD10BA984 +:104080000EA8FFF780F96846818D032080028143E6 +:10409000012080020918684681856846818D40208C +:1040A00001436846818587735F49818113AA0CA902 +:1040B000022002920191009000235A4A03A80B9912 +:1040C00002F0C1F901002CD1E06800282DD010A821 +:1040D00014990180544968468773491C8181E168BD +:1040E00008A80A78027449784174E068412241883E +:1040F00068464186E0680023017908A80175E068F8 +:10410000D200C18808A84175090A81750CA8072149 +:1041100001900091029503A8109902F094F9010012 +:1041200003D00F9800F0E8FEFDE53D480321001F95 +:104130000170002E0AD08088308010A8808870809E +:1041400010A80089B08010A88089F0800020EAE5DE +:1041500030B501248BB015460B46012802D0022849 +:104160001CD104E0684605218473C90203E02B4991 +:1041700068468473891E8181002B12D003210020A0 +:10418000890288430121890240186946888405AA6A +:1041900004A91846FEF7CDFD002804D007200BB077 +:1041A00030BD1020FBE76A46127C1D480092801E3D +:1041B00005A9FF3201910290FF32002303A80332C8 +:1041C000099902F040F9002802D0FEF76AFFE6E7FD +:1041D0001348001F002D01D0418829800470002061 +:1041E000DDE770B592B00446012608A886700F4935 +:1041F0006846018410AA08A93046FFF7A9FF0028E5 +:104200004ED12078064DC00700242D1F002849D02C +:104210001C2168460CE0000000C0010003280000DB +:10422000440C0020030200000329000001180000D4 +:1042300016F066FE6846017820200143684601704A +:1042400008A88670F9496846018411940794817F13 +:10425000F92001406846891C8177002001466846A4 +:104260000177002001466846417704218185C48595 +:10427000018607A80A9011A80D9008A809900EAA17 +:1042800009A96846FFF72FFD002809D16846008F6D +:10429000E8806846808F2881401C68812C7000204F +:1042A00012B070BDEC802C8110A80088F4E7F7B53F +:1042B000DF4900260A789EB0012A04D0022A02D0E3 +:1042C000082021B0F0BD4A88824201D00620F8E7DC +:1042D0001F98824201D10720F3E7012210A98A75B5 +:1042E000D4488882002003239B020146994393020D +:1042F000CB1810A90B8669468A81CF4ACA8118A9B2 +:10430000887110A9888419A904916946CA82069007 +:10431000FF20087503A802F06AF900242546274605 +:1043200008AA052103A802F065F9002810D0822808 +:104330006FD1002C6FD0002D6DD010A88480C58067 +:104340000021017418A8807B11AC012865D06DE0B4 +:1043500008A88079002F21D0012857D16846818C88 +:10436000B44881421CD113AA0DA905206B4607C38E +:104370006846408C10230022FF2102F0ADF900288E +:1043800068D110A88089042801D006284CD168463D +:10439000818E1F98814239D10F2092E7012835D1B3 +:1043A0006846808C0521C902884202D0491C884297 +:1043B0002CD19F4841886846408C814201D1012719 +:1043C00000E00027002C01D0002D10D01F9988425A +:1043D0001CD113AB0DAA05216E460EC60446102350 +:1043E0000022FF2102F078F9002833D101E03546A0 +:1043F0000CE010A88089022801D0102814D1C0B286 +:104400001BAA0DA9FEF76FFC00280DD16846468C4B +:1044100086E71FE0FFE7052053E714A91BA8221D2C +:10442000FEF787FC002801D003204AE710A8007C93 +:104430000023001DC2B210A80274209802900194BB +:10444000009215A81C9901F0FEFF002802D17849BE +:1044500002220A70FEF725FE33E710B50B46401E18 +:1044600086B084B203AA00211846FEF743FF04AACF +:10447000052103A802920191009001230022FF214F +:10448000204601F045FF04466846008A012804D012 +:104490006D206A49000116F05EFE2046FEF701FE1F +:1044A00006B010BDF0B5624F0446387887B00E46AE +:1044B000032804D0042802D0082007B0F0BD04AAC5 +:1044C00003A92046FEF7EFFE0500F6D1606880786C +:1044D0004007800F02280DD1684680898004800F34 +:1044E00008D02069002805D055490968884201D2C2 +:1044F0001020E2E7208905AA6B46216907C36946B7 +:104500000A8A63892068039901F09DFF002802D080 +:10451000FEF7C7FDD1E7002E02D06846808A3080C2 +:10452000042038702846C8E738B50C00054609D085 +:1045300000236A46FF2102F031F9002804D0FEF77B +:10454000B0FD38BD102038BD69462046FEF755FE47 +:104550000028F8D1A078FF21C307DB0F2846009A76 +:1045600002F044F9EBE73EB50C0009D002AB6A4615 +:10457000FF2102F013F9002804D0FEF792FD3EBDA2 +:1045800010203EBD0321204616F0B8FC6846008886 +:1045900001A90005800FFEF71CFE00280BD168461C +:1045A000007920706846008801A98004800FFEF71A +:1045B00010FE002801D003203EBD684600796070DF +:1045C000A278EF20024068460088C10B09010A4327 +:1045D000F7210A404104C90FC9000A43A270F9211A +:1045E0000A40800601D5022000E001204000694613 +:1045F0000243097A50084000C907C90F0843A07058 +:1046000000203EBD7FB514460522019203AD029500 +:1046100000930A462388FF2101F07AFE69468989C2 +:104620002180FEF73EFD04B070BD0000052A0000A9 +:10463000400C002002280000FFFF0000FC380000B2 +:1046400028000020F3B5002799B068460C4607877C +:104650003D4600291DD0E068002806D0A06800284B +:1046600017D001886A4611870780199803F0CBFBA1 +:10467000002811D0007822287ED3199800F038FC49 +:10468000009000220421199807F04EFB060009D182 +:1046900004E010201BB0F0BDFC48FBE7FC49FD48DE +:1046A00016F059FDA078012803D0022801D0072078 +:1046B000F0E72088002808D0401E80B203AA0099A5 +:1046C00001F069FF002859D11DE0F048401CE1E7E6 +:1046D0006946498A228891420BD26846807D00252E +:1046E000012810D16846808AEB4988420BD1012508 +:1046F00009E0914203D1002D2AD06D1C01E0022D6A +:104700000BD0032D04D203A801F04EFF0028DFD008 +:1047100082281BD0002831D11DE06946897D0129FE +:10472000F1D16946DC4B8A8A5B1ED11A9A420FD0BE +:1047300005DCDA48101A0BD00128E4D108E0012981 +:1047400006D0FF390129DED10325E1E7022D15D17D +:104750000D2080029EE7E068002816D00EA90522F1 +:1047600002910192009069460B8FA2882088FF2158 +:1047700001F0CEFD002800E01DE002D0FEF791FC24 +:1047800088E76846A168008F08806846008AC006EE +:1047900001D5C3487EE70798002803D06846008B00 +:1047A000022801D0032075E70798A1780078012935 +:1047B00003D0800710D408206CE7C007FBD000228C +:1047C0000721199807F090F8002802D00725022049 +:1047D00004E0AE48801C5DE70225032008A90870AC +:1047E000218868468185199808360A90099617210C +:1047F0006846818712AB02330FAA052108A80097EB +:104800000CF0DBFF002802D0FEF7B7FC42E710A84F +:1048100000906846838F04222946199806F085FD8A +:1048200038E770B5064615460C460846FEF7F6FB17 +:10483000002804D12A4621463046FFF789FCF3E6DA +:1048400010B5FFF734FD10BD70B51E4614460D00BF +:1048500014D0002C12D0616800290FD00121FEF77E +:104860004CFE002809D12068FEF7D8FB002804D1AF +:10487000324621462846FFF736FAD5E61020D3E621 +:1048800070B515460C000ED00221FEF736FE00284A +:1048900008D12068FEF7C2FB002803D12946204634 +:1048A000FFF700FEC0E61020BEE6F8B506467D48DC +:1048B0000D46016814468A4231D36068002808D04A +:1048C000794A90422BD301229204904201D388422C +:1048D00025D37648864204D0304603F094FA002867 +:1048E0000CD0304600F004FB0646284600F0BDFA26 +:1048F000002804D16068002802D012E06348F8BDA7 +:1049000000236A463146284601F048FF002802D0BD +:10491000FEF7C7FBF8BD68460088800601D410206A +:10492000F8BD6188224628466368FFF76BFEF8BD34 +:10493000F7B55C4E0746306886B01446824202D214 +:10494000102009B0F0BD384600F0D2FA05465748AD +:10495000874201D0FF2D08D0002304AA29460798DA +:1049600001F01CFF002826D101E04848E9E768462D +:10497000008AC00601D54A48E3E703A90020029156 +:104980000527019000976288484B2946079801F057 +:10499000A3FE00280FD161683268914208D30191CB +:1049A00002900097238862882946079801F094FEB8 +:1049B000694689892180FEF774FBC2E7002907D088 +:1049C0003B4B0A881B899A4202D83048401C7047EA +:1049D00038E610B586B004236C46A382344BDC88DD +:1049E000002C07D01B898B4201D2914204D9274861 +:1049F000401C55E5062053E56B4619825A8200217A +:104A0000009101911C800221997005A9029104A9CD +:104A100003916946FFF716FE42E5F3B50C4685B0F3 +:104A2000812069460873002C1AD0059803F0EBF931 +:104A3000070017D03878222868D3059800F058FA74 +:104A4000049000220121059806F04EFF00280BD0AB +:104A500000220421059807F067F905000AD105E056 +:104A600010202AE5094828E5112026E508491148C3 +:104A700016F071FB284608300CF0F6FA064620784E +:104A8000012819D0022838D0072016E5023000008E +:104A9000FC380000E10800000328000000280000A6 +:104AA000013400002800002000C00100FFFF0000CA +:104AB000400C0020840A0000A18803AAFEF728FB0E +:104AC0000028CED1B00721D56846007B00281FD131 +:104AD000A079C0071CD0E068002205216B4607C3FF +:104AE000638922896888049901F012FC6946087379 +:104AF00000280DD0FEF7D5FADFE4A18803AAFEF75F +:104B000007FB0028ADD13420064201D10820D4E4AF +:104B10006846037B29463846059AFEF717FDCCE424 +:104B2000FFB597B0002001901F4615460C460E4673 +:104B3000179803F068F9002804D00078222803D2DF +:104B40000820A7E5F348A5E5B80801D00720A1E5AE +:104B5000032F00D10027179800F0CAF90890002C05 +:104B60001BD0022D77D3EC48006884427CD36119B6 +:104B70000091012902D0491E814275D3AD1EAAB20F +:104B80002146E6480DF0F0F800991E394A7F0B7F68 +:104B900011021943884267D1ADB2E148B90702D585 +:104BA0000189491C00E0012189B20091F90701D077 +:104BB000078900E0D94F03AA0899009801F0EBFC9F +:104BC0000DE0F078B1780002084310284CD8019924 +:104BD000091D401880B20190A84245D82618002E21 +:104BE00060D0707831780002084300998842E8D399 +:104BF00058E06946098A0A0754D5002C3FD0019A2B +:104C0000A618121D92B20992F278B37812021A43D2 +:104C10009446102A28D8099A6244AA4224D8727865 +:104C2000337812021A4390421ED1C8061ED5099845 +:104C30000AAA052120186B4607C370783178000254 +:104C4000084363460022089901F062FB002803D064 +:104C5000FEF727FA1EE507E0F078B1780002084376 +:104C60006946098D884201D00B2013E5F078B178B0 +:104C7000000208430999401880B2019006E0C90675 +:104C800004D50899FEF79FFC0028E3D16946088AFD +:104C90001021884369460882488AFF23049A0899AC +:104CA00001F0A4FD03A801F07FFC002803D16846B1 +:104CB000408AB8429DD900220421179807F034F8A1 +:104CC000040003D19749984816F045FA2088002837 +:104CD000C0D0012108A80170017300264673218805 +:104CE0006846018620460830099017980A90FCF71C +:104CF00039FE05001BD01798688017206946888008 +:104D000010AB023301AA052108A800950CF055FD4F +:104D100007466878000704D583488249223016F098 +:104D20001AFA002F09D03846FEF727FAB2E4132109 +:104D3000179804F04AFB0320ACE40EA800906846E4 +:104D4000838804220121179806F0EFFA00288CD1FD +:104D500026809FE4F0B500248DB01F4615460E4610 +:104D6000002A04D0B90804D007200DB0F0BD1020EF +:104D7000FBE7032F00D1002700F0BAF80390FF28CB +:104D800004D06749B80703D5488902E06148ECE7D9 +:104D90000120FA0702D04989491E00E05F4906AAAE +:104DA0008FB2039901F0F7FB38E06946898B090758 +:104DB00034D504AB05210022029300910192574B98 +:104DC000039901F089FC002821D1002E21D06A46E8 +:104DD000128A2988A2183019121D914234D36946CB +:104DE000CA8B0270120A42700A8A8270120AC2705A +:104DF00004A90522001D0092029101906946C88B0A +:104E00000B8A0022039901F067FC002801D00320DF +:104E1000ABE76846008A2018001D84B206A801F09E +:104E2000C3FB002804D0822806D0FEF73AF99CE79D +:104E30006846C08BB842B8D9002C07D0002E10D0DD +:104E40002988A01C814203D20C208EE705208CE724 +:104E50002246314631480CF087FF31190870000AAC +:104E60004870A41C2C8000207FE700B585B06946FF +:104E7000FEF7ACFA00280AD16846007C030016F061 +:104E80008BFA08052F2F2F2F08080531032005B0B6 +:104E900000BD68468078012807D168460088032154 +:104EA000C902401A1CD001281AD06846807901280E +:104EB00006D16846808815214902401A05280FD975 +:104EC0006846807A012811D16846018929200002AC +:104ED000081A05D0022803D0032801D0042805D1E0 +:104EE0000F20D4E711A1164816F035F90020CEE7BF +:104EF00010B506F00FFF10BD10B50C4601F01EFBFB +:104F0000002803D009A10F4816F025F92046FEF726 +:104F1000C8F810BD0230000028000020FFFF00008C +:104F2000400C0020FC3800003F0B00007372635CF3 +:104F300067617474735F636F72652E6300000000B5 +:104F400022020000BB060000F8B500780C461646A9 +:104F500010340E36069F022809D0032836D00528C3 +:104F60007ED0FF20F6A1E53016F0F5F8F8BDCD892A +:104F70000A2068430E30188031203880002AF5D08E +:104F8000087B9581801FC7B21AE020886168308055 +:104F900048780A7800021043F080C8788A780002C6 +:104FA00010433081B21C3846091DFDF79CFE002FCE +:104FB00001D0002802D000203071708008340A36F9 +:104FC00028466D1EADB20028DFD1F8BDCD890A207C +:104FD00068430E30188032203880002AF5D0087BD4 +:104FE0009581401FC7B243E0616822880878F2804B +:104FF0003279C30752085200DB0F1A43FD231A40CF +:105000008307DB0F5B001A43FB231A404307DB0FC8 +:105010009B001A43F7231A400307DB0FDB001A43F8 +:10502000EF231A40C306DB0F1B011A43DF231A408C +:105030008306DB0F5B011A43BF231A404306DB0FD5 +:105040009B011A433271C00970718A784B78100243 +:105050001843308132463846C91CFDF744FE00E053 +:105060000CE0002802D00020B070308008340A36EE +:1050700028466D1EADB20028B6D1F8BD087BCD899B +:10508000801E86B2304608306843103018803420C5 +:105090003880002AF1D0174695811037E800D68174 +:1050A000C01900900DE02088388000987860324662 +:1050B0006168009815F0C5FE00980834801908371B +:1050C000009028466D1EADB20028ECD1F8BDFFB5AA +:1050D00081B00A9D1E460C46002A05D0607AFF303A +:1050E0000130D080E089108101980E2700780300FC +:1050F00016F052F90B7E0719293541536C787878F0 +:105100007E000092087B082805D0032803D091A1D7 +:10511000954816F020F8378030200FE000990020E5 +:10512000888105B0F0BD0092087B042804D08E4829 +:1051300088A1143016F00FF83780312028800098AD +:105140000028EBD1EDE70092087B042804D09320DF +:1051500080A1800015F0FFFF37803220EEE700923B +:10516000087B022804D080487AA13A3015F0F3FF7A +:1051700037803320E2E7087B1746042804D07A48BA +:1051800074A14C3015F0E7FF1020308034202880C7 +:10519000002FC6D00020B88116E0207B17460528D6 +:1051A00006D0062804D070486AA1603015F0D3FFFD +:1051B0001220308035202880002FB2D0E089B881BD +:1051C0000020388201984088F881AAE70092087B85 +:1051D000072804D064485FA1713015F0BCFF378008 +:1051E0003620ABE733460095019800F00AFC98E7BB +:1051F0002F2053A1000115F0AEFF92E770B50C46C9 +:10520000054602F000FE002804D00078222803D2D0 +:10521000082070BD554870BD00220521284606F0C3 +:1052200083FD2060002801D0002070BD032070BDE8 +:10523000FFB58BB00D4607461720694608850E98C6 +:1052400003261446002805D10EA93846FFF7D6FFDD +:10525000002834D1002D0BD000220321384606F05F +:1052600043FB002834D00E980078002830D108E0A5 +:105270002078092819D00F2823D031A13C4815F0F7 +:105280006AFF0E98A760801D03AA606002320AA917 +:10529000204600F00CFC002827D0030016F07CF814 +:1052A000071A182323211C1E23000726002231463B +:1052B000384606F019FB0028E3D12C48801C0FB0BB +:1052C000F0BD00220321384606F00EFB0028D8D19D +:1052D0001120F4E70020F2E70820F0E72348401C03 +:1052E000EDE70720EBE70320E9E701A80090684617 +:1052F000038D04223146384606F017F80028DED127 +:10530000002DDCD00E990D70D9E730B587B01D4661 +:105310000C46002A11D0042369460B7013888B8138 +:105320005288CA81A2788A7422880A8200236A4637 +:105330002946FFF77DFF07B030BD1020FBE70000D6 +:105340007372635C67617474635F636F72652E630D +:10535000000000007372635C67617474635F636F65 +:1053600072652E630000000025020000023000007C +:105370004F030000F3B581B001980C460078082671 +:10538000030016F009F8125E46461B134A0A0A0A81 +:105390000A0A0A0A0A0A0A0A0A5E002C02D1F64917 +:1053A000F64808E06078304360703BE0002CF9D1AB +:1053B000F248F149083015F0CEFEF3E701980022DB +:1053C0008088052187B2384606F0AEFC0546002CE1 +:1053D00004D07520E849C00015F0BDFE002D04D1B1 +:1053E000E648E549143015F0B6FE3946A81D00F030 +:1053F00055FBFCF7B7FA040006D0607830436070C4 +:105400006780FCF790FA0FE01321384603F0DDFFC8 +:1054100015E0DA48D849283002E0D848D6492D307E +:1054200015F099FE002C0AD06078000707D593206C +:1054300020702046582208300199FBF7C5FE002055 +:10544000FEBDCE48CC493130EAE710B500210170ED +:10545000801D00F020FB10BD0A4610B50146901DCE +:1054600000F024FB10BD70B505460022052106F0B2 +:105470005BFC040004D1F920BF49800015F06BFEED +:105480002946A01D00F00AFB70BDF7B5054684B0A3 +:105490000C4600206946088188806F8802460521F5 +:1054A000384606F041FC060004D1FD20B2498000D8 +:1054B00015F051FE002C03D0A7800020E080208151 +:1054C000297A20461230C91E142700900B0015F0CF +:1054D00063FF0FFDFCFB3809A95E657A2FB2C9E9AD +:1054E0009191FB003078012804D0A3497020143139 +:1054F00015F031FEA9896A46C8000E309080302030 +:105500001081002C13D0A18100200DE0C100327960 +:1055100009190A747288CA8182005319DA894A8289 +:105520001A8A401C8A8280B2A1898142EED8F1E0B9 +:1055300002A8009001AB22462946304600F02AFA24 +:10554000E8E03078042804D08B49BD20143115F0F0 +:1055500002FEA8890622014650436A460E3090801A +:1055600033201081002CE2D0A18100200BE0062125 +:1055700041434F190919FA89CA81BA7C8A743A8A57 +:10558000401C0A8280B2A1898142F0D8C2E0307802 +:1055900006280BD078491431D72005E0307806284A +:1055A00004D07549EB20143115F0D5FDE889694622 +:1055B0001230888035200881002CB8D0A989A181BB +:1055C0007188E18126E03078072804D06A49FF20FD +:1055D000143115F0C0FDA8896A4601460E3090804E +:1055E00036201081002CA2D0A1812046AA890E303D +:1055F000296954E0E8896946123080B238228880EF +:105600000A81002C7ED0A989A181287A102807D090 +:105610000221A173E9892182EA89296900983EE083 +:105620000121F6E702A8009001AB22462946304648 +:10563000FFF78AFC6EE03078082805D04E49FF203D +:105640001431EE3015F087FD6846372187800181DF +:10565000002C5FD0A989A1810020608220820120D6 +:10566000A07357E03078092805D04349FF20143152 +:10567000FF3015F070FD288A694614308880372085 +:105680000881002C46D00421A173A989A181E98950 +:105690002182298A618220462A8A1430696915F09C +:1056A000D0FB37E030780A2804D03349344814312D +:1056B00015F051FD6846372187800181002C29D0E3 +:1056C0000521A173002002E01FE004E00DE0A081AD +:1056D000208260821EE002A8009001AB224629468B +:1056E0003046FFF7F4FC15E00CE00D206946392246 +:1056F00088800A81002C05D00120E08000202081D4 +:10570000207307E00699088019E01C481A49A43064 +:1057100015F021FD6846069980880880002C0ED07F +:10572000684600892080684680886080287A03283F +:1057300005D0102803D0112801D00020307000209F +:1057400007B0F0BDF7B5568815460F4682B0002267 +:105750000521304606F0E8FA040004D1074806495E +:10576000C43015F0F8FCA41D33462A46394600948F +:10577000029800F022FBD4E440530000950300009F +:1057800013020000F7B58CB00D46144607A90C981B +:10579000FFF734FD002812D1B64E0127002C0FD0A0 +:1057A0000321684601701021818208A802460690F4 +:1057B000204605A9FDF7BDFA00280BD007207EE59D +:1057C0000821684601708581C68105218774C90258 +:1057D00001820BE00798A178017121884180684619 +:1057E00005218774C90201828581C6810246012193 +:1057F000079B0C98FFF71CFD61E508B501236A467D +:1058000093709D4B13800A4602236946FFF77DFD86 +:1058100008BD08B501236A469370974B5B1C138043 +:105820000A4603236946FFF770FD08BD00B587B03F +:1058300000290CD002236A4613700B889381498893 +:10584000D18100230421FFF7F3FC07B000BD102035 +:10585000FBE710B5002903D00523FFF756FD10BD67 +:10586000072010BD70B588B00D461446064607A93E +:10587000FFF7C4FC00280DD1002C0DD0062168468E +:1058800001708581C481079B02465C8006213046F9 +:10589000FFF7CEFC08B070BD052168460170858118 +:1058A000F1E710B588B000290BD007246B461C70B7 +:1058B0009A81049100236A462146FFF7B9FC08B09B +:1058C00010BD1020FBE770B50024172288B0002916 +:1058D00014D00D782B0015F05FFD06230505190483 +:1058E0001B231522D21E93B2CA88002A02D08E68CA +:1058F000002E03D09A4203D90C20CBE71020C9E731 +:10590000042D05D08A88002A0AD101E00620C1E7CB +:10591000012D11D0022D05D0042D18D0052D23D036 +:105920000720B7E709236A4613704B889381CB8819 +:10593000D381896804911DE00C236A4613704B885B +:105940009381CB88D38189680824049112E00D23C8 +:105950006A4613704B8893818B88D381CB881382DE +:1059600089680924059105E00E236A461370497879 +:1059700011730A2400232146FFF75AFC8AE700B579 +:1059800087B00F236A461370918100231946FFF7F1 +:105990004FFC5AE7FEB50078089D1C4616460F4698 +:1059A000012803D03549912015F0D5FBF889C000B6 +:1059B0000E30208030202880387B001FC0B201903C +:1059C000002E1DD0F889B081002516E0E80084196A +:1059D000C0190090224641690E320198FDF783F903 +:1059E000002802D000202074E08100986D1C008AFD +:1059F00060820098ADB2408AA082B089A842E5D802 +:105A0000FEBD70B514461425049A1D8037231380FB +:105A1000002C0ED0CA89A281002262820078082858 +:105A200008D0092810D00A2819D01449144815F0B4 +:105A300092FB70BD087B0C2804D011480F490C382C +:105A400015F089FB012008E0087B0D2804D00C48E4 +:105A50000A49083815F07FFB0420A07370BD087B4D +:105A60000E2804D006480549001F15F074FB0520D8 +:105A7000F3E70000FFFF000002280000545300007D +:105A8000BB02000010B5FE4B586019721A80C900A5 +:105A900015F036FA10BD00210180704710B50022C4 +:105AA000D2430280032006F0A8FD10BD7047F0B578 +:105AB0000E460446017801208840F24999B008401A +:105AC0000090616815460888EF4A904206D0009A17 +:105AD000002A06D0EB4A521E104202D0012019B013 +:105AE000F0BD009A10430880002D12D000202870CD +:105AF0002178EA1C0027681C01920B0015F04CFC71 +:105B000010F30E16233A59616F3CB4B08AB8F2F123 +:105B1000F0F320780B28EBD00420E0E70221297075 +:105B2000A1890170090A4170032097E004212970BE +:105B3000A1890170090A41700198E1890170090A7F +:105B4000417005208AE006212970A1890170090AA7 +:105B500041700199E2890A70120A4A70218A017122 +:105B6000090A4171A28AE81DA16915F06AF9A08AA3 +:105B7000C01D73E0082129702178082901D1102166 +:105B80002970A1890170090A41700198E1890170A9 +:105B9000090A41700520308020466A1D02A9103094 +:105BA000FDF7C7F800287DD169463088097A40188A +:105BB00054E00A212970A1890170090A417003206B +:105BC0000BE00C212970A1890170090A417001982C +:105BD000E1890170090A4170052030809CE0A089AC +:105BE00084464000401C81B2308888425AD305293F +:105BF00058D30E202870002008E0236942009B5AE9 +:105C0000521953701B0A401C937080B26045F4D344 +:105C10003180B9E09A48417A002973D0491E417217 +:105C2000217B4068C9004518A988286808224018C7 +:105C30000838216915F005F9022168460171002133 +:105C4000417128680390A98868460181002101A854 +:105C5000FFF790FB0020A880002E00D0308093E05A +:105C60002978802211432970297840221143297014 +:105C700029788909890112312970A1890170090ADD +:105C80004170E289E81C216915F0DBF8E089C01C4D +:105C90003080287841063FD5C00975D0012168467B +:105CA000017200E02CE0002141723188091D8181E0 +:105CB0000495E189019808180590001D0690704828 +:105CC000017A68460177002102A8FFF753FB0746D7 +:105CD00030880C303080022F06D0002F54D065E081 +:105CE0003DE033E01CE05EE065486946097F4268BC +:105CF000CB00D218037A994202D29188002902D0AF +:105D0000042753E02FE0417A491C41721560308826 +:105D100090800020308049E06168A089888033E06D +:105D200029788909890116312970A1890170090A28 +:105D300041700198E1890170090A4170228A681D49 +:105D4000616915F07EF8208A401D46E728788009B1 +:105D5000800118302870207B687002207EE7606820 +:105D60000188090401D4052720E0C088A189884260 +:105D700001D006271AE01E202870012030806068BC +:105D800001884904490C0180009800280ED03C4845 +:105D900000220088A1688300032006F087FB616869 +:105DA0002078887007E00020308003276068009921 +:105DB00002888A430280384691E6FFB59FB0289D4D +:105DC0000E46002805D0172803D82A882E4B9A4261 +:105DD00002D1072023B0F0BD3278530601D4D20996 +:105DE00001D00820F6E700226B461A715A7114465A +:105DF0003278431E1D939BB2189303AB1A939706F8 +:105E0000CB1CBF0E1B93821E711C3B0015F0C4FA05 +:105E1000209011EE66EE74EEB0EED4EEEDEEECEE08 +:105E2000EBEEEAEEE9EEEEEEE8EEE7EEE6EEE5EEBC +:105E300090EE05287CD1042168460171A978017291 +:105E4000F078B2780102114368464181317941719D +:105E500070788006800E0C282ED009DC801E03008E +:105E600015F09AFA0919661C6621662466276600F1 +:105E700012282AD00ADC0E2821D01028DAD121E0FD +:105E80004C0C0020FF710000FFFF000016281FD0FF +:105E90001828CFD11FE02878800701E02878400734 +:105EA000002845DA45E128780007F9E72878C00698 +:105EB000F6E728788006F3E728784006F0E72878A8 +:105EC0000006EDE72888C005EAE72888C004E7E770 +:105ED00028888004E4E728884004E1E72A789207CC +:105EE00026D50328A6D105206A461071487809787E +:105EF0000002084310811CE129784907F0D50628E3 +:105F000016D3717890B2012902D0022992D101E012 +:105F1000022100E01021189106216A46117100212A +:105F2000118102AF189AB11C0237921C1B921AE021 +:105F3000B3E04A780B7812021A433A80801E891C1B +:105F40001790BA1C1A911898FCF7CDFE1A99189858 +:105F5000189A091817986B46801A1A8980B2521C31 +:105F60001A811B9ABF1D8242E3D9002886D1E0E046 +:105F700028780007B4D51D98694682B207200871B9 +:105F800000200881701C0A3111E0437807781B0259 +:105F90003B430B80C37887781B023B434B806F46A3 +:105FA0003B89121F5B1C001D92B23B81091D042A14 +:105FB000EBD2002A71D1BCE02978C9066DD5022840 +:105FC0006BD30820694608710020488170780872F8 +:105FD000844692B2B01C1A9919E089E090E07EE004 +:105FE00067E05BE030E025E019E013E0BCE04378D7 +:105FF00007781B023B430B80831C4B606346D21A1D +:106000006F467B8960445B1C92B27B81083194456A +:10601000EDD9CEE7287880063FD5092203E028781D +:1060200040063AD50A2268460271AA880281189A67 +:10603000428107E0287800062FD50B206A461071B0 +:1060400018981081039174E02988C90525D5022884 +:1060500023D30C20694608710020488170780872AB +:10606000844692B2B01C1A9914E0437807781B0258 +:106070003B430B80C37887781B023B434B80031D57 +:106080004B606346D21A6F467B8960445B1C92B2B8 +:106090007B8108319445E8D98BE763E02988C904FE +:1060A00060D501285ED10D2168460171A988018162 +:1060B0003FE02988890455D5052853D30E22694627 +:1060C0000A71AA880A811B99401F4A78097812022E +:1060D0000A4369464A818881701D049029E0298815 +:1060E00049043FD501283DD10F206946087120E0C1 +:1060F0002A88120436D44A780B7812021A43EA80AE +:1061000003282FD332789206920E1B2A26D0112212 +:106110006B461A712A880123DB031A432A804A78C6 +:10612000097812020A4369460A81C01E48811B98F9 +:10613000039030788006800E1B2809D01D2807D0D8 +:106140000320229906F059FA2888C00BC003288042 +:1061500001A82199FFF70EF920463BE610226B4675 +:106160001A71DCE70724F7E70824F5E700B597B0D4 +:10617000032806D16A461070019100216846FFF796 +:10618000F9F817B000BD000010B58B78002B11D0C6 +:1061900082789A4207D10B88002B0BD003E08B79D1 +:1061A000091D002B08D08B789A42F8D103880C88FF +:1061B000A342F4D1002010BD812010BD052826D0B7 +:1061C000002A02D0012A0DD102E00988090501E068 +:1061D00009888904890F07D0012918D0022909D01C +:1061E00003290ED081207047002A01D00320704778 +:1061F0000220704703280AD0042808D0002804D0C1 +:1062000007E0042803D0022803D0052070470020AF +:1062100070470F20704770B51388054614460B80F1 +:1062200018061DD5FE481022807AA84203D81343D1 +:106230000B80002070BDA06893430078E840C00741 +:10624000C00E03430B802078A1788007800D08439F +:10625000F44914F05FFEA06869430818401C70BD43 +:10626000906870BD37B569468B88138019061BD5B9 +:10627000EB4C0125A47A9168844209D8FE280FD1FD +:10628000D80602D5A5406D1E00E000250D7007E080 +:1062900085400C78DB06DB0FAC4383401C430C705D +:1062A00010881021884310803EBDF8B50746C81CF1 +:1062B00080080E468000B04201D08620F8BD082A32 +:1062C00001D90E20F8BDD64D00202E60AF80288168 +:1062D000AA723446E88016E0E988491CE980810604 +:1062E00010D48007A178800D0843CE4914F012FE27 +:1062F000206800F0BAFA2989401880B22881381A3B +:106300008019A0600C3420884107E5D40020F8BD36 +:10631000FFB589B09F041646139DBF0C01930998E1 +:1063200000F095FA04000AD02078000609D5BC4890 +:10633000817A0A98814204D887200DB0F0BD0120EF +:10634000FBE7224669460A98FFF765FF06900020A2 +:1063500069460872052D14D0012221462846FFF710 +:106360002DFF0028E9D1207840060AD50221684691 +:106370000172099981810188C18106824782129840 +:1063800005900198000404D500273E460125079793 +:1063900009E02078A1788007800D0843A149079083 +:1063A00014F0B8FD0D46019840040AD50798A8429C +:1063B00007D12088E1788005800F00020843B042B1 +:1063C00001D3AE4201D90720B7E7B81980B20190D6 +:1063D000A84201D90D20B0E76846007A002804D011 +:1063E00002A8FDF718F90028A7D10798A8420BD1F9 +:1063F000208803210902884301998905890F090230 +:10640000084320800198E0701498002800D007808D +:106410001298002815D006983A468019129914F05F +:1064200010FD224669460A98FFF7F5FE694608887E +:106430001021884369460880224600990A98FFF790 +:1064400011FF002079E7FFB5754D0C22E888296817 +:10645000504383B00C180D9F7249059814F05AFDF3 +:106460000091049800F001FA29682A898E46611A81 +:106470000C310918944651188AB2A988914202D861 +:10648000842007B0F0BD6A46168A320603D5B206EC +:1064900001D58520F5E7EA88521C92B2EA800E9B6E +:1064A000002B00D01A80B20601D5A76006E0604438 +:1064B00080B22881091A70460818A0602246FE2082 +:1064C0000499FFF7CFFE0598A0700098E07020882F +:1064D0000599800889058000890F08430321090276 +:1064E000884300998905890F09020843042108435C +:1064F000208003988078A07103980088A0800020F5 +:106500002073310601D5AC7A00E00124B10600D534 +:10651000002700260EE0052100200191029000973F +:10652000E88831460C9B069AFFF7F2FE0028A8D1B6 +:10653000761CF6B2A642EED30020A2E7F1B5009891 +:1065400000F085F9060002D00025009C14E001202F +:10655000F8BD204600F07BF90746007831498007F6 +:10656000820DB878104314F0D5FC386800F07DF93E +:106570004019641C85B2A4B22948C188601E8142BA +:10658000E7DC00992648491EC1800189491B018129 +:1065900000203070F8BD002804D0401E108091709B +:1065A000002070470120704710B5044601881C4840 +:1065B000C288914201D3822010BD00680C22514351 +:1065C00042189079A072908820811088D178800537 +:1065D000800F00020843A081A078211DFFF71BFE59 +:1065E00020612088401C2080E080002010BD012117 +:1065F00001827047F7B50546002084B0C043108083 +:1066000068681746817868468170686801886846BE +:10661000018000218171288A2C88A04205D303E0E3 +:10662000580C00200102000004462C8235E0288A24 +:10663000401C2882301D6968FFF7A6FD00282AD17A +:1066400039889248814201D1601E38806888A04212 +:1066500028D33088F1788005800F0002084302902B +:106660006946301DFFF790FD002814D169898748DD +:1066700081421BD0002231460598FFF79FFD00287C +:1066800009D16A890298824205D1E968B06814F09C +:10669000ABFB00280AD0641CA4B2204600F0D7F857 +:1066A0000600C4D1641E2C828220EAE67C80B07988 +:1066B000B871B088B8803078B1788007800D084311 +:1066C00078810298B8813946287A32460831FFF736 +:1066D000A2FD38610020D4E6FFB585B01C460F4608 +:1066E000059800F0B4F8050009D02878000608D510 +:1066F0006748807AB84204D8872009B0F0BD0120ED +:10670000FBE707982A468605B60D69463846FFF727 +:1067100082FD07460E98052816D000222946FFF76D +:106720004DFD0028E9D1287840060DD501216846A5 +:10673000017105990181018841818681C48101A887 +:10674000FCF769FF0028D8D12888AA788107890D2D +:1067500011438005800FEA7800021043079A9642A1 +:1067600007D04C4A914204D3611E814201DD0B20C7 +:10677000C3E7864201D90720BFE7801B82B2A2424D +:1067800000D922461098002800D002800F980028D7 +:1067900002D0B91914F055FB0020AEE7F8B51D463C +:1067A00017460E4600F053F8040008D02078000683 +:1067B00007D53748807AB04203D88720F8BD01203A +:1067C000F8BD224639463046FFF725FD002D0BD097 +:1067D0002078A1788007800D08432E49884201D295 +:1067E000012000E0002028700020F8BDF8B51E460A +:1067F00017460D4600F02BF8040008D0207800065C +:1068000007D52348807AA84203D88720F8BD012005 +:10681000F8BD224639462846FFF724FDFF2E14D046 +:106820002588A178A807800D08431A4914F072FB47 +:10683000002E03D1FF31FF31033189B2A170A808C6 +:1068400080008905890F084320800020F8BD104989 +:10685000CA88824207D3002805D00C220968504319 +:106860000C38081870470020704703B50846694681 +:1068700009888A0607D4090604D50549897A41435F +:10688000491C88B20CBD00200CBD0000FFFF0000B9 +:10689000580C002001020000F8B507780D460446A8 +:1068A000012F19D0072F02D00C2F19D114E0A068A6 +:1068B000216906780B2E0BD0052005F09EFE052ED3 +:1068C0000ED0782300220520216905F0EFFD07E0B6 +:1068D000782300220620F8E70520216905F08DFEC7 +:1068E000002D0ED0002028702946204603F0E2F942 +:1068F000FE482978C05D884201D10320F8BD0220FE +:10690000F8BD0021204603F0D5F90020F8BD70B590 +:106910000E460C462036317901208AB015460029F2 +:1069200009D0012905D12978042902D10520107048 +:1069300000200AB070BD6068019005A802900D218A +:10694000C01C14F0DBFA032205A8A16814F079FA40 +:1069500001203071062069460870206A049029469B +:106960006846FFF799FFE4E770B50C4615462031FD +:106970000A790120062686B0002A2CD0012A28D1C7 +:106980002978042925D169681022A06801F0B5F999 +:106990006868C07B000606D5D44AA0681023103A68 +:1069A000014601F09FF91022A168E06801F0A5F905 +:1069B000A068C07B000606D5CC4AE0681023103AD8 +:1069C000014601F08FF92E70A0686860E068A86049 +:1069D000002006B070BD60680190C4482038029065 +:1069E0000120087168460670206A049029466846AE +:1069F000FFF752FFEDE7027B032A06D00022242393 +:106A00005A540B78092B02D003E0042070470A7611 +:106A1000CA61027B9300521C0273C150032070476D +:106A2000F0B50E4615460C46203602463179012057 +:106A3000072393B000290CD0012924D002292ED09D +:106A4000032904D12978042901D12B70002013B027 +:106A5000F0BD01203071606800280DD0A1690B7075 +:106A600060684860206988606069C860206A086260 +:106A70001046FFF7C0FFEAE706202870206968602B +:106A80006069A86009E029780629E0D10220307108 +:106A9000042028709548203868600320D7E72978BB +:106AA0000429D4D1A08910280AD9103880B2A08135 +:106AB000A1681023091805A86A6801F013F923E0FA +:106AC00010282FD0C2B21020801AA1680DAF1190EB +:106AD000C01914F0B6F911980006000E06D0401E39 +:106AE000C1B280207854384614F008FA6269102345 +:106AF0000DA909A801F0F6F8102309A905A86A68EC +:106B000001F0F0F8032030716068019005A8029050 +:106B1000062069460870206A049029466846FFF7F7 +:106B2000BBFE94E710232269A168E2E7F0B50E46A8 +:106B30000C4620363179012006278FB015460029F2 +:106B40000BD0012932D0022905D12978042902D19C +:106B50000820107000200FB0F0BD217D08A8CA07E2 +:106B6000D20F02718807C10F08A801716846027030 +:106B700041700722801CE16814F063F902A8072223 +:106B80000130216914F05DF9606805900AA806904B +:106B900010236A46A16801F0A5F80120307168460B +:106BA0000774206A0890294604A820E0297804295F +:106BB000D1D1062205A8E16914F043F906A80622FE +:106BC0000230A16914F03DF900200890606801903E +:106BD00009A80290102305AA696801F083F8022031 +:106BE000307168460770206A049029466846FFF7AE +:106BF00053FEB0E770B50D460C46203529790120CB +:106C00008CB01646002909D0012905D13178042914 +:106C100002D10920107000200CB070BD6068019096 +:106C200006A802900822E16814F00BF9082208A8CF +:106C3000A16814F006F90120287106206946087041 +:106C4000206A049031466846FFF726FEE4E770B5F7 +:106C50000D460C462035297901208CB016460029B6 +:106C600008D00129D8D131780429D5D10A20107053 +:106C70000020D1E76068019006A802900822A16870 +:106C800014F0DFF8002008900990012028710620F8 +:106C900069460870206A049031466846FFF7FCFD9B +:106CA000BAE730B50B4620331C7901208BB0002C9D +:106CB00009D0012C05D11178042902D10B201070C4 +:106CC00000200BB030BD4868019005A802908C6888 +:106CD00068462578057564784475CC68257885758F +:106CE0006478C47500200690079001E0E4B30100C9 +:106CF000089001201871062368460370086A049002 +:106D000011466846FFF7C8FDDBE770B50C46203436 +:106D1000034625790120002D0AD0012D14D0022D23 +:106D200005D111780A2902D10C201070002070BD05 +:106D300001202071C868052202704A684260F84A42 +:106D40008260921CC2600BE015780B2DEFD10220FF +:106D50002071C86804240470526842608A688260A6 +:106D6000096A016201461846FFF745FE70BD30B55D +:106D7000011D02463132947803258379ED432C437B +:106D800023408371DB070DD04B79547923404B713D +:106D90000B79127913400B718278C9788A4200D935 +:106DA000817030BD00224A710A71F5E7F7B50C46D3 +:106DB00086B00020694626460870203631790127C2 +:106DC0001E2015461F2977D24B007B449B885B0011 +:106DD0009F441E0017023E025602690288029A0270 +:106DE000D102F5022E03590371037F03AE03C303DF +:106DF000CC03F7031A0464049A04AB04DF04FE0412 +:106E000010052A0565059B05C605830587058B05C5 +:106E10006069002802D0007813287DD0A068059012 +:106E2000002849D0012168460170206A049003219E +:106E3000684601710A214171E069029020790028B9 +:106E4000EFD0059909780029E7D00C2964D20B000E +:106E500014F0A2FA0CFD1A4B90B5E8FCFBFAF9F815 +:106E600007FD022828D16069002802D00078082890 +:106E700052D1022168460170206A04900598417839 +:106E8000684601710021B9E20620216A05F0B5FBD0 +:106E900020790728E6D1606900F051FF02280CD064 +:106EA000606900F04CFF042807D060690028B8D062 +:106EB00000780128D6D103E01BE261690120087047 +:106EC00005980079C11F0A2901D30A2050E06169A1 +:106ED0000722887060690599303013F0B2FF0120F5 +:106EE000307161690320087034E00728BAD1606905 +:106EF000002896D001780929B4D10599C978890765 +:106F000007D1059949790029DFD1059989790029A7 +:106F1000DBD105994A7900E04EE2014620314B7DF4 +:106F20009A43D2D1059A8B7D92799A43CDD1059A15 +:106F30001279D31F0A2BC8D20979914236D8072279 +:106F4000C01C059913F07DFF0120307161690A2092 +:106F50000870032069460870206A04906069313027 +:106F600001906069001D029060691C300390A1E2ED +:106F70002076F2E311288DD1606900F0E0FE04284C +:106F800004D0606900F0DBFE0B2893D1606905999D +:106F900010223730491C13F054FF6069017804292E +:106FA0007CD12421095C8278914201D90620DFE757 +:106FB000052101700320307168460170E2E3112859 +:106FC00094D1606900F0BBFE062804D0606900F02F +:106FD000B6FE0C288AD1E068002813D0206900286A +:106FE00010D060690178062910D00D210170606908 +:106FF000059910225730491C13F023FF6069573060 +:1070000009218CE100206946087072E107210170B6 +:107010006069059910224730491C13F012FF60691E +:107020004730EDE70228F0D1606900F088FE0028C3 +:10703000EBD0606900F083FE0128E6D0606900F0C3 +:107040007EFE05E0B1E08DE06CE02AE00AE0D6E0EB +:107050000828DAD00521684601710598417868460C +:10706000417146E11128D0D160690028CDD0017866 +:107070000E29CAD1C16A4078022810D000201422FB +:1070800050431430085805991022491C13F0D9FEBA +:107090000520216A00F041FE0F205EE0F1E10120B1 +:1070A000EDE70B28B1D160690028AED001780F2937 +:1070B000ABD1C16A4078022826D000201422504368 +:1070C0000C300958059842780A70807848706069D9 +:1070D000C16A4078022819D0002014225043103091 +:1070E000085805990822C91C13F0ABFE0520216A37 +:1070F00000F013FE60694178022909D000220832AD +:10710000825C5208520073E00120D7E70120E4E7D7 +:107110000122F4E7012100E0002108314254BCE3E0 +:10712000BEB3010011289CD16069002899D0017874 +:10713000102996D1C16A4078022811D0002014226B +:1071400050431830085805991022491C13F079FE55 +:107150000520216A00F0E1FD112061690870B4E3A7 +:107160000120ECE7082884D1606900289DD00178CF +:10717000112997D10599C06A49780170606905990C +:10718000C06A0622401C891C13F05BFE0520216AA0 +:1071900000F0C3FD60694178022904D00022083262 +:1071A000825CFD2323E00122F9E71128BBD160694D +:1071B0000028BBD001781229B5D1C16A40780228D5 +:1071C00019D00020142250431C3008580599102271 +:1071D000491C13F036FE0520216A00F09EFD60690F +:1071E0004178022909D000220832825CFB231A4030 +:1071F000022991D18EE70120E4E70122F4E707207C +:10720000B6E6287801288ED16069696814221C309E +:10721000F9F7DAFF6069017F002901D02176ACE33C +:107220000178032901D0032037E00227C770817954 +:107230004907490F8171017A4907490F0172417A63 +:107240004907490F41726069FFF791FD377196E276 +:1072500028780F28E3D1072069460870216A049135 +:10726000916802916946087161690722C91C0298F8 +:1072700013F0E7FD61690420087000203071BBE065 +:1072800028780328CBD1606901780529696807D07F +:107290000822473013F0D5FD0420307105206FE23D +:1072A00008225730F6E728780328B8D160690178BA +:1072B0000529696811D008224F3013F0C2FD05205E +:1072C00030716069006A00280AD00220287000200E +:1072D00028716069006AA860F9E008225F30ECE775 +:1072E00004204DE22878022899D12879002801D07D +:1072F000207642E36069A96801626069002901D1D2 +:10730000F949016206200BE228780F2887D1A86886 +:10731000E0616069017805292BD047300721317180 +:10732000E16802220A706269126A4A6088606069D4 +:107330003030C8606069C01C08616269087D926A6B +:10734000400812784000D207D20F104308756269D6 +:10735000926A521C8A61FD2210406269D26A1278D8 +:10736000D207920F104308756069C06A401CC8615B +:1073700053E25730D2E728780828BAD160690178FB +:1073800005291AD00B210170072069460870206A70 +:107390000490E069029011200871029803210170A5 +:1073A00051681022401C13F04CFD00216846FFF785 +:1073B00073FA00203071E06187E20621E3E7287864 +:1073C0000F2896D1072069460870206A0490A868A3 +:1073D00002901120087102980421017061690A78F5 +:1073E000072A0ED0002232710C220A706169102225 +:1073F000401C473113F025FD00216846FFF74CFA89 +:1074000063E21022401C573113F01BFD0021684637 +:10741000FFF742FA0A203071E168032008706069C2 +:10742000006A486060695730886060694730F3E1FE +:1074300028780828A1D1606969681022373013F0D4 +:10744000D3FC002801D0042092E560690078072869 +:1074500017D00A203071E168032008706069006A63 +:10746000486060695730886060694730C860206A4A +:1074700008620698FFF7BFFA07466069FFF777FCD6 +:107480006BE208207AE1287809289AD10B20307124 +:1074900061696868897810224018511A13F02EFD2E +:1074A000082069460870206A049068680190606945 +:1074B0008078087268E129780D29BBD161698979E2 +:1074C000C90703D00C20307109203EE0307103273A +:1074D00070E228780E28ADD160691422291D1C3075 +:1074E000F9F772FE6069018DC06A4172090A817202 +:1074F00060698178C06AC1716169CA6A081D117AC0 +:10750000C909C90111724379626919438378D26A42 +:107510009B079B0F012B00D0002300799B01C0002B +:1075200003431943117260694078012876D0B4E1B1 +:1075300060694178022901D0012100E00021083171 +:10754000405CC00707D00E20EAE069460870206A58 +:107550001146049019E11320B8E728780F2894D138 +:10756000A868E0610F2030710520EEE72878032835 +:107570008BD16069C16A4078022801D0012000E007 +:10758000002014225043103008580822696813F074 +:1075900058FC10203071E16806202269087060698B +:1075A000406A48606069C36A4078022801D00120BF +:1075B00000E000201427784310301858CA60886013 +:1075C0002BE128780C2886D16069C26A40780228AD +:1075D00001D0012000E00020142148430C30105855 +:1075E00002230932696800F07DFB11203071E168E7 +:1075F000052008706069006A48606069C06A0930E7 +:1076000088603948001F07E128780B28A7D16169F5 +:107610004878CA6A022802D0012001E059E100201E +:1076200014235843143010588A78696813F009FC01 +:1076300060694178C26A022901D0012100E000217D +:107640001423594314315258817850181022511A7A +:1076500013F054FC072069460870206A0490E06922 +:107660000290112008710298062101706169CA6AAE +:107670004978022901D0012100E000211423594357 +:10768000143151581022401C13F0DBFB00216846D6 +:10769000FFF702F90020E06112206FE028780F2840 +:1076A00091D1072168460170206A04909068029089 +:1076B0000B2268460271029801706169CA6A4978B2 +:1076C000022901D0012100E00021142359430C318B +:1076D00051580A784270497881706169CA6A49785C +:1076E000022903D0012102E0C4B3010000211423C8 +:1076F0005943103151580822C01C13F0A2FB00213D +:107700006846FFF7C9F826E760694178022901D089 +:10771000012100E000210831405C800703D51420DE +:1077200030710A2011E71620D0E628780F287AD188 +:10773000A868E061072069460870206A0490E06943 +:107740000290112008710298082101706169CA6ACB +:107750004978022902D0012101E011E1002114231E +:107760005943183151581022401C13F06AFB002174 +:107770006846FFF791F80020E061152030710A207B +:1077800069460870206A049029466846FFF784F825 +:107790002BE028780F2846D1072069460870206A18 +:1077A00004909068029008200871029809210170E5 +:1077B00061690622C969097841706169801CC969DB +:1077C000491C13F03EFB00216846FFF765F8AAE765 +:1077D00060694178022901D0012200E000220832CC +:1077E000805C400703D51720C8E70746B5E00129AC +:1077F00053D070E028780F2815D1A868E0611820D0 +:107800003071E168052008706069006A486060694D +:10781000C06A09308860F848C860206A0862069823 +:10782000FFF7E9F8E1E76FE028780B286CD1606991 +:10783000C16A4078022801D0012000E00020142213 +:1078400050431C3008581022696813F0FAFA0720D8 +:1078500069460870206A0490E0690290112008715E +:1078600002980A2101706169CA6A4978022901D027 +:10787000012100E00021142359431C3151581022EA +:10788000401C13F0DEFA00216846FFF705F80020DF +:10789000E0616069407801281DD1192016E6606911 +:1078A0004278022A09D000210831411809780029BC +:1078B0000DD0CA0703D00E2106E00121F4E78907A5 +:1078C00001D5102100E012210170002772E0012A89 +:1078D00001D00D20FAE51C20F8E51D2030710B20A9 +:1078E00033E62978102948D1F0E56069017801294B +:1078F00043D0082941D00021317100F01AFA0C2040 +:1079000069460870206A049037E028780F2805D06F +:107910001020107003271B2030714BE007216846B0 +:107920000170206A0490A8680290022168460171E3 +:10793000029805210170217E417000216846FEF702 +:10794000ABFF0B2168460170206A04902946684607 +:10795000FEF7A2FF07461B203071012F0DD029E052 +:10796000012168460170206A049004216846017173 +:10797000217E41710020207612E0207E00280FD069 +:107980006169132008701A2030710A206946087056 +:10799000206A049029466846FEF77EFF074609E004 +:1079A0006069002801D01421017068460078002821 +:1079B00000D021E5384609B0F0BDF7B50F462037B5 +:1079C0003879012686B00C46002804D0012828D03A +:1079D00002281CD197E02079012804D0022811D078 +:1079E000032814D10AE0A068407801280ED10620AF +:1079F000216A04F0DCFD00287FD10CE0A16813208F +:107A0000087008E0A0684178022901D0052674E0DA +:107A10000078082871D1012038710A206946087061 +:107A200033E0089800780F2867D107216846017075 +:107A3000206A049008988568029522790220012A1C +:107A400004D0022A29D0032A57D10FE006466846FF +:107A500006710B202870207B00214007400F6870C2 +:107A60006846FEF719FFA068067045E006466846BE +:107A7000067105202870207B687000216846FEF79B +:107A80000BFF3E710B2168460170206A0490684626 +:107A90000899FEF701FF06462FE0684601710120B4 +:107AA0002870207C6870607CC007C00FA870A07C24 +:107AB0004007400FE870E17C2971C0071FD0207D8E +:107AC0004007400F6871607D4007400FA87100219A +:107AD0006846FEF7E1FEA06807222946303013F021 +:107AE000B0F9E068017AA06820300171A1682879B6 +:107AF0008870A16809200870002630465BE70020E6 +:107B0000A8716871E3E7A168142008700121684634 +:107B10000170206A0490042168460171217B417143 +:107B20000021FEF7B9FEE7E7F0B585B00F46054640 +:107B30000124287B800040198038C66F3078411EB0 +:107B40000A290AD22C498000323140188038C36F8C +:107B50003A463146284698470446002C01D0012C6D +:107B600011D1287B401E0006000E287301D003248B +:107B7000DFE70D2069460870306A04900021019605 +:107B80006846FEF789FE032CD3D0204605B0F0BD31 +:107B900070B515460A46044629461046FFF7C4FF4D +:107BA0000646002C0FD0207814280CD1207E002807 +:107BB00006D000202870204629460C30FFF7B4FF7D +:107BC000204600F0B6F8304670BD704710B5012968 +:107BD00003D0022901D0052010BD417000F0A9F8A2 +:107BE000002010BD002809D0027E002A06D00A46D7 +:107BF00001460C31CCE70000C2B301000120704700 +:107C000030B5044687B00D46062004F0F6FC294640 +:107C1000052004F0F2FC2078142805D000206946E5 +:107C200008702046FFF7DEFF07B030BD7FB50E4677 +:107C300000216A4611730178092903D00A2903D06B +:107C4000002407E0446900E08468002C02D0217E13 +:107C5000002912D0154601462846FEF7CCFE03281F +:107C600009D1324629462046FFF792FF6946097B33 +:107C7000002900D0042004B070BD25460C35EAE789 +:107C800000B50023012285B005280CD0062808D1B4 +:107C90006846027004910221017143710021FEF7D0 +:107CA000FBFD05B000BD6846027004910271F4E767 +:107CB00010B590B00C4605216B4619700190234811 +:107CC00002900892001D03900AA96846FFF7AEFFD4 +:107CD000002805D1102220460B9913F0B2F800209D +:107CE00010B010BD30B505E05B1EDBB2CC5CD55CDE +:107CF0006C40C454002BF7D130BD10B5002409E00E +:107D00000B78521E5B00234303700B78401CDC0988 +:107D1000D2B2491C002AF3D110BD70B50C460546FD +:107D200004F06BFC782300222146284604F0BEFBB9 +:107D300070BD4178012900D00821017070470028EA +:107D400001D000787047082070470000BCB30100E4 +:107D500070B5F84D040008D0012C10D0022C07D0CB +:107D6000032C05D0F4A1752007E0F3A16C2004E0FA +:107D70002878012803D0F0A1722013F0ECF92C70C0 +:107D800070BD70B5EB4D044610280AD0112C16D0EA +:107D900028468178122C07D0132C0AD0E6A1A42003 +:107DA0000BE0E5A1992008E0112908D0E2A19E206E +:107DB00003E0112903D0E0A1A12013F0CCF9AC70AD +:107DC00070BD10B5DB4894B0007B002819D0172097 +:107DD00069460870D74900A806220D31023013F019 +:107DE00030F809A9684603F0A8FE0446112805D01A +:107DF000002C03D0D0A1C02013F0ADF9204614B060 +:107E000010BD3220E4E710B50022022103F08CFF00 +:107E100010BDFFB595B01D460E460746FFF7F3FFB0 +:107E200004000AD02078222804D3A07F8006C00F47 +:107E3000A84204D1082019B0F0BDC348FBE73721A0 +:107E4000684601704780002D05D0012101714671FF +:107E50001799817102E000206946087109A96846F6 +:107E600003F06BFEA07FDF21084069010843A07783 +:107E70000020E0E770B50446084620380D460300B0 +:107E800013F08AFA0A060A11232C3342495057612B +:107E9000FF20A9A10D3052E02078202851D1FF20E9 +:107EA000A5A110304BE0A3480178032949D0807880 +:107EB000132846D02078242843D0252841D02328D1 +:107EC0003FD0FF209CA1133039E02078222838D001 +:107ED000232836D8FF2098A11A3030E020782228B5 +:107EE0002FD0FF2094A11E3029E02078222828D00E +:107EF000242826D0262824D0272822D0292820D07C +:107F0000FF208DA121301AE02078252819D0FF20EC +:107F100089A1283013E02078252812D0FF2086A1DF +:107F20002B300CE0207825280BD0FF2082A12E30AA +:107F300005E02078282804D0FF207FA1313013F0FD +:107F40000AF9257070BDFF207BA13430F7E730B50A +:107F50007E4C0B887E4A022801D0934204D09D1F9C +:107F6000A54225D2022802D04D88954203D04D88E3 +:107F7000AD1FA5421CD24C88A34219D88B88FF257F +:107F8000F435AB4214D8022802D0C888904205D0FC +:107F9000C8886E4D0A382D1FA84209D2C888904261 +:107FA00008D0944206D05B1C63438000834201DB0F +:107FB000072030BD002030BDF0B56649884245D36A +:107FC000654A0125AD041368A84201D398423DD308 +:107FD0000279002A06D0082A02D8067B082E05D985 +:107FE0000720F0BD047B002CFAD0F6E7002A06D06B +:107FF00004688C422AD3AC4201D39C4226D3002E83 +:1080000006D084688C4221D3AC4201D39C421DD35C +:1080100000240CE00568A700ED598D4216D3012716 +:10802000BF04BD4201D39D4210D3641CE4B2A242FE +:10803000F0D800220125AD040CE084689700E459D3 +:108040008C4203D3AC4203D39C4201D21020F0BD3A +:10805000521CD2B29642F0D80020F0BD10B5028971 +:108060003E4B111F994213D24189042910D3DB1CC6 +:1080700099420DD891420BD80178890706D54068FE +:10808000002803D0FFF798FF002800D1002010BD82 +:10809000072010BDFFB50022099B002802D099429D +:1080A00005DC6EE0002902D1002004B0F0BD0920FB +:1080B000FBE7845C002C12D087187D78112D59D0F5 +:1080C00010DC2B0013F068F90A561726262C2C2EEC +:1080D0002E4C4C56835C002B46D1521CD2B28A42A5 +:1080E000F8DBE1E71C2D45DA123D2B0013F054F9C3 +:1080F000044242121A42022CD9D1BB78039C072BAE +:10810000237001D25B0701D40A20CEE7029B012431 +:108110001B782CE0E343DB0708E0012C08D029E0C2 +:108120000620C2E70F2523072D075B19002BF4D08B +:108130003046BAE7640C00207372635C6761705F5D +:10814000636F72652E630000023000007B0C00003C +:10815000FFFF000000C0010028000020FD3F0000DC +:10816000029B1B789C0701D50B209EE7022423432A +:10817000029C2370835C521C9A18D2B28A4202DDA0 +:1081800095E7192676028A4293DB8DE710B50478CD +:108190000B46002C08D00121F94A012C07D0022CF3 +:1081A0000BD0032C13D10EE00021197011E01970CF +:1081B0008179890903290AD10BE01970817989092C +:1081C000012904D105E019708179890901D010468F +:1081D00010BD411C0622581C12F033FE002010BDB9 +:1081E00008B51346002806D0E6A00068009048793C +:1081F0006A468009105C18700622581C12F021FE95 +:1082000008BD30B50C46097895B0222902D2082065 +:1082100015B030BD282369460B704880132A03D05F +:108220003B2A01D00720F3E708460A7109A903F0A9 +:1082300084FC050003D121212046FFF71BFE2846C0 +:10824000E6E700B595B0232369460B704880108897 +:1082500088805088C880D088488190880881002014 +:108260008881C88109A9684603F067FC15B000BD84 +:1082700070B50C00064610D0FFF7C5FD050003D110 +:10828000C149C24812F067FFA6802889E08028898A +:10829000208168896081A889A08170BD70B50E4673 +:1082A000050003D00021092004F0A7F90120B84CF3 +:1082B000022E207324D0032E04D0D320B249800094 +:1082C00012F049FFB24806210D3003F02DFFA07CCB +:1082D0008006800EA074FFF774FDA08B00280ED0DE +:1082E000002D0CD0830001220021092004F0DEF8CB +:1082F000092804D0A548A449283012F02CFF70BDED +:10830000A3480321103003F00FFFA07C402180061A +:10831000800E0843A0749E480C3002F04EFBDAE752 +:108320007FB501A9022003F06EFD002851D09748C7 +:108330009549673012F00FFF4BE0029C207821280E +:1083400047D0A07F01072BD52046223000906846F9 +:108350002346628E80882146343301F084FC050078 +:1083600005D011282ED089488749843028E0A07F85 +:10837000F7210840A077E17F480889074000C90F2E +:1083800008432021095D4007400FC9000843E077FA +:108390002078282824D129212046FFF76BFD1FE0F3 +:1083A000400716D568462246808821460E32FFF7E0 +:1083B00048FF050008D0112804D074487249933052 +:1083C00012F0C9FE00250BE0A07FFB210840A0773A +:1083D00006E001A803F025FD0500AED0052D02D072 +:1083E000284604B070BD0020FBE7F8B5040004D1B6 +:1083F00066486549A13012F0AEFE722020706068B8 +:1084000008260178091F0B0012F0C6FF11FD0A466D +:1084100068FC460EFCFC4746464646FD92FD46007B +:108420007B205949C00035E087883846FFF7EBFCD0 +:10843000050004D11F205449400112F08CFE6078E1 +:10844000042130436070524CA07F0843A077212163 +:108450002846FFF70FFDA87F8007800F012801D174 +:10846000801EA080384603F0B1F83846FCF7FBFFC9 +:108470003846FBF79EFB3946022004F0BEF8A87F81 +:10848000EF210840A877FFF74BFF002804D03F48B2 +:108490003D49C93012F05FFEF8BD85882846FFF7D8 +:1084A000B2FC002804D139483749D33012F053FECA +:1084B00060688078012804D034483349D53012F000 +:1084C0004AFE60688179284603F09CF90028E3D0D1 +:1084D0006178314361706168C880F8BD878838462B +:1084E000FFF791FC050004D128482749E63012F037 +:1084F00032FE60783946304360706068C0882881F9 +:1085000060680089688160684089A881022004F061 +:1085100074F80020A875A87F8007800F0228DCD19E +:10852000FFF7FEFE0028D8D0212017494001B1E70F +:1085300080783C2803D00025022814D000E00125D3 +:108540000027002808D03C2806D0022804D00F4875 +:108550000D49FF3012F0FFFD002F06D002263046F5 +:1085600001F06CF9F8BD0127EBE7607830436070EB +:108570000748817F31438177002D0BD00126EEE73C +:10858000023200000302FF01388100002E030000C8 +:10859000640C002060688788384601F07BF9054646 +:1085A00060688079012832D00226A87F06228008E0 +:1085B00080003043A8776068C08A28816068008B9B +:1085C00068816068408BA8816068C079E8756168DF +:1085D00028461830083112F034FC60680622807B8F +:1085E00068706168A81C0F3112F02BFCA87F81070E +:1085F000890F384602F0D4FFA87F8007800F01283A +:10860000ADD101E005E008E0FE488780A7E701263C +:10861000CBE7204601F01EFEF8BD60783043607065 +:10862000F8BDF7B505460078002700090C463E4620 +:1086300001287DD00022F44902287AD0072804D0EE +:108640000A2877D0F149F24839E1686803780D2BA0 +:1086500035D006DC042B6ED0072B3AD00A2B69D11B +:1086600006E0122B3CD0132B44D0142BF7D1BEE0E4 +:1086700011270726002C7CD08088A0806968FB2306 +:108680008979A171DF4905468A7F1A408A770421DA +:1086900003F071FB0521284603F06DFB00212846FD +:1086A00003F069FB0121284603F065FB03212846FE +:1086B00003F061FB0221284603F05DFB01E1012785 +:1086C0000926002CD7D08088A08068688079207225 +:1086D000F7E012270E2680882146FFF7C9FDF0E05B +:1086E0001A270726002CC6D04088A0806868007929 +:1086F000A071E6E081783C293ED010271E26002C90 +:10870000B9D08088A0806868C08A20836868C08AE1 +:10871000E0826868008B60836868408BA08369682A +:10872000607D497F40084000C907C90F084303E046 +:108730006CE097E0BAE029E060756968C007497F9E +:10874000C00F49084900084360756968A21DC879CF +:108750000831FFF745FD69682246887B0D320F31ED +:10876000FFF73EFD68688079002803D0012020755E +:1087700007E076E00220FAE719270726002C70D0E0 +:10878000A271A048F722817F11407DE01B272E2691 +:10879000002C66D0A1806968A21D0879491DFFF7E9 +:1087A0001FFD68682030C07A60736868C07804284C +:1087B000A07B19D040084000A073F92108406968E7 +:1087C0001F22C9788907490F0843A07369684007C9 +:1087D000C97A400FC9000843A073696820460F306A +:1087E0000C3112F02EFB6CE001210843E4E71E2758 +:1087F0000E26002C6DD0A1806868E21D407AA07121 +:1088000069688878C91CFFF7EBFC5AE0287A0128D0 +:1088100005D0022815D07E487C4932384FE01D270C +:108820000E26002C55D06888A080A889E080E889B1 +:108830002081288A6081688AA0817248DF22817F36 +:10884000A2E712270E266888FFF712FD002C40D001 +:1088500068784007400F032833D16A48FD22817FA2 +:1088600092E736E0287A030012F096FD0604101015 +:108870002020202619270726002C2AD0A180614815 +:10888000A271817F4908490081771AE019270726DC +:10889000002C1ED0A180287A012805D00320A071C9 +:1088A0005848EF22817F6FE70220F8E721462846EB +:1088B000029A01F068FEFEBD55485449801F12F02F +:1088C0004AFC0298002C068001D027806680002098 +:1088D000FEBD02980680FAE710B54A4894B0807849 +:1088E000132802D0082014B010BD22206946087059 +:1088F00009A9684603F021F904460021072003F086 +:108900007CFE2046EFE700B53E4895B080781228FF +:1089100001D00820AAE41E21684601700021817060 +:10892000C17009A903F009F90028F3D1002107203B +:1089300003F063FE1120FFF724FA002096E400B54F +:10894000304895B00078022801D0032818D11B21A7 +:1089500008A801730021817369460BA803F0EDF8A4 +:10896000002804D1684640781B2801D003207DE40C +:108970000021084603F041FE68468078002801D0B7 +:10898000082073E40120FFF7E3F900206EE4F8B556 +:108990001C4C030012F000FD0A06791779797979E9 +:1089A00044356779FFF7CBFF00282AD1F8F7DAFFC3 +:1089B000002826D02221017000210172F8F7B3FFB0 +:1089C000A07F01214BE08EB23046FFF71CFA050074 +:1089D00004D10F480D492E3012F0BDFB2878212814 +:1089E0000FD0F8F7BFFF002814D012210170022722 +:1089F000077246800020A875F8F795FFA07F3843DE +:108A0000A077F8BD640C0020FFFF00003881000053 +:108A10005F050000132229463046FFF7F2FBF0E71E +:108A2000A578122D06D0132D07D0F849F84812F07A +:108A300092FBE6E7FFF767FF01E0FFF74DFF002835 +:108A4000DFD1F8F78FFF0028DBD022210170122D33 +:108A500007D002210172F8F766FFA07F10210843BA +:108A6000CEE70121F6E7A07C810901290BD080091E +:108A700004D0E748E549223012F06DFB03210020C5 +:108A8000FFF70CFCBDE70221F9E7E148DF49293097 +:108A9000CDE7F7B514460D0004D1DD48DB49313090 +:108AA00012F059FB28780827012807D002281FD088 +:108AB000D748D649623012F04EFBFEBD0098FFF752 +:108AC000A2F9060004D1D248D049383012F043FB55 +:108AD0000220B0751030207060783843607007CD88 +:108AE000083407C4CB482022817F11438177FEBD23 +:108AF0000098FFF788F9060004D1C548C3494630FD +:108B000012F029FBA988C448814208D1EA88824230 +:108B100005D1132231460098FFF773FBFEBD814259 +:108B200002D1E888002809D01220207060783843EC +:108B3000607007CD083407C4002006E078230022C7 +:108B40000220009903F0B2FC0120B075FEBDB148CF +:108B500040897047FFB591B01498FAF71BF90028C7 +:108B60005DD10124684603218471C90281800022FD +:108B700001A92046FBF7ECFA002850D168461521E0 +:108B800084714902818000261C2102A8009612F0FF +:108B9000B7F90120014668461031017000200146F6 +:108BA000684641708178F9273940891C21438170DA +:108BB000017A02252943017212998186C6861F21F6 +:108BC00001870C9011980F9001A80B9009AA0BA98E +:108BD00002A8FBF788F8002821D168468D4E808CCA +:108BE000F080684684718D498180807809AA384078 +:108BF000801C41084900684681708586058713A856 +:108C00000F900BA902A8FBF76EF8002807D1684661 +:108C1000808C308131460A311498FAF7CEF815B0BD +:108C2000F0BD30B50C467E4995B08C423CD37D49B1 +:108C3000012292040968944201D38C4234D3203833 +:108C400000220125030012F0A7FB06042A44484E27 +:108C5000575F0021082003F0AAFC002802D0112051 +:108C600015B030BD24206946087000A80522A11C5B +:108C7000023012F0E6F809A9684602F05EFF05002E +:108C80002FD1082300221146184603F00FFC0828B4 +:108C900027D05F485D49D63012F05DFA21E0606868 +:108CA000002803D0884201D21020D9E73D21684630 +:108CB0000170218841806188818009A902F03DFF0F +:108CC00005000ED1606800280BD06946098D01802F +:108CD00007E0206801F0B2FE02E0204600F024FE2A +:108CE00005462846BCE73E2007E0857000E082701C +:108CF00009A902F022FFF3E73420694608702078C2 +:108D0000C0076846F3D0F0E70720A9E730B50C4666 +:108D1000444995B009688C4201D21020A0E7203860 +:108D2000030012F039FB05042121232132002088A1 +:108D3000FFF769F8002804D00078222803D2082021 +:108D40008EE739488CE725216846017021884180EB +:108D500009A902F0F2FE050015D10AA90522023187 +:108D6000A01C12F06EF80EE006250CE0206800282A +:108D700005D0884201D2102505E001F055FE2548B6 +:108D80000025808BA08028466AE7072068E72148F5 +:108D90001330704710B520211E4812F0AFF80120A3 +:108DA000FEF7D6FF1120FEF7ECFF00211948C9435A +:108DB000818000218176E1218900818301460C3088 +:108DC0000D310446F8F74EFE1248072221461330B3 +:108DD00012F037F8FEF7F5FF002803D00B491348CF +:108DE00012F0B9F901F0E5F910BD10B504463C21C7 +:108DF00012F084F8A07F80088000A07720202070E7 +:108E00000020A0752034607010BD00003881000083 +:108E1000B5050000640C0020FFFF0000012A0000DF +:108E200000C0010028000020023000001C070000E4 +:108E30007047FEB50546FF480C46814207D3012026 +:108E40008004844205D3FC480068844201D210208B +:108E5000FEBD002D02D0012D32D126E0F7490822B7 +:108E60000F46684611F0EDFF39462046FFF78EF9B0 +:108E70000028EDD1FEF7A5FF060006D007226946BF +:108E8000384611F0DEFF3046FEBD2078002801D0C4 +:108E9000012805D1E94807223946C01D11F0D1FF4C +:108EA0000021092003F0A9FB0FE00978002907D071 +:108EB000012905D0022905D0032903D0E048FEBDD1 +:108EC0000720FEBD0120FFF7E9F9DC480C38857664 +:108ED0000020FEBD10B5D8490968884201D2102093 +:108EE00092E7D64902460C390B7B0D311846FFF745 +:108EF00077F9002088E7FFB599B00546002008A95A +:108F000008746946087108A908730875CA481446A8 +:108F10000121C84A890400681E46002D05D09542EB +:108F20000BD38D4201D3854207D3002C08D0944245 +:108F300003D38C4204D3844202D210201DB0F0BD72 +:108F40002846204318D01F270BAB0CAA00972846B1 +:108F50001A99FFF79FF80028F0D10DAB01AA31460E +:108F600020460097FFF796F80028E7D16846007979 +:108F7000C00703D00A20E1E70720DFE702AF002D9A +:108F80000FD01A20694608721A9888722946F81C70 +:108F90001A9A11F056FF0EA902A802F0CEFD002881 +:108FA000CCD1002C0ED02021684601728672324648 +:108FB0002146F81C11F045FF0EA902A802F0BDFDE4 +:108FC0000028BBD19D4908A8007B0C3948700020BF +:108FD000B4E770B506460A200C46087015461146DF +:108FE000204602F0AAFD002807D139212170204631 +:108FF000294602F0A2FD002804D0082801D190489B +:10900000401C70BD2A462146304600F0B9FC04469B +:10901000082803D18B498C4812F09DF8204670BD7A +:10902000F0B5044689A003C897B0824D002715917A +:109030001490AC4211D380480121890403688C420A +:1090400001D39C4209D32078012809D16268AA4241 +:1090500003D38A4204D39A4202D2102017B0F0BD43 +:1090600076490C390A78012A0CD18A88794B9A42C0 +:1090700003D0002806D0012804D08A7F13079B0F55 +:1090800006D101E00820E9E7D30701D1910701D516 +:109090001120E3E7218A704B0A46203A9A4207D30F +:1090A000012877D1002975D1628A002A72D111E096 +:1090B000022801D0032801D1A0296BD3012809D0AF +:1090C0005E4A0C3A5278D20704D0628A002A61D0F4 +:1090D000B42A5FD8002806D0012808D0022804D07E +:1090E000032857D117E0002518E0022516E00029D3 +:1090F00002D1608A00280CD004256068007800281E +:109100000CD0012809D0022807D0032805D04C48EC +:10911000A4E70125F1E7032500E00127207A0028D4 +:1091200006D0012806D0022806D0032867D105E022 +:10913000002604E0012602E0022600E00326002DBE +:1091400001D0022D16D1002E14D0E068002803D0E3 +:10915000FEF732FF002881D138480C38407880076C +:1091600002D03748401E79E7022D03D1022E46D0A7 +:10917000032E44D0182168460170218A4180218A3B +:10918000818085712D480C38007B002803D0012890 +:109190006FD104E033E000216846C17102E0012094 +:1091A0006946C8716846077221780930012920D0C4 +:1091B000062111F0A3FE69460E74207D8207C107C7 +:1091C000D20F4007C90F5200C00F11438000014366 +:1091D00014A8405C6946C873002810D009A96846E5 +:1091E00002F0ABFC002893D1002D0AD0022D08D04C +:1091F00012E061680622491C11F023FEDBE707201C +:109200002CE7002E08D0E068002805D009AA69469E +:10921000FFF7DFFE0028A6D11B2069460870012059 +:10922000887009A9684602F088FC00289BD108A82C +:10923000407913E000C0010028000020700C0020DD +:1092400002320000388100002708000007060504EC +:1092500003020100FFFF0000E13F00001B2819D1BD +:109260002B0012F099F80504040707040A000320F4 +:1092700001E00FE00220FEF76BFD012D0CD0608AAB +:10928000002809D0002283001146104603F00EF991 +:10929000002801D00320E1E60020DFE6F3B5032635 +:1092A00087B00D4600290AD0FE4885426FD30120C1 +:1092B0008004854203D3FC480068854267D3079841 +:1092C000FEF7A1FD040005D02078222804D2082052 +:1092D00009B0F0BDF548FBE7A07F8707BF0F002D61 +:1092E00005D029463846FEF732FE0600F0D1394651 +:1092F0000027EF48012907D0022931D0ED49EE4877 +:1093000011F029FF3046E3E7A27D2946012A02D069 +:10931000827F920701D51120DAE700291BD10821AD +:109320006A46049711820592418904AAE348FBF733 +:10933000FFFA0028CCD16846008A082801D0032013 +:10934000C6E7684601880181418841818188818121 +:10935000C188C18102A9079802F0E7F90646D1E762 +:10936000A17D022916D1807F800613D4002D04D060 +:10937000A07F40070CD4002100E00121079802F0F3 +:1093800014FA0600BED1A775002DBBD004E01AE088 +:109390001126B7E7002D16D02A4621460798FEF77A +:1093A00050FF06461128ADD1A07F4007AAD4204621 +:1093B000082229460E3011F044FDA07F0421084305 +:1093C000A07700269EE7102082E770B50C46054680 +:1093D000FEF719FD010004D022462846FEF711FFD2 +:1093E00070BDB24870BD00B50146143195B0192961 +:1093F00001D2810707D001461E3104D00A3102D0C4 +:10940000072015B000BD312269460A70887009A98D +:10941000684602F092FBF4E701B582B0022069468B +:109420000880A34802AB00896A460021FBF7EAF8EE +:1094300069460988022900D003200EBD1CB5002111 +:10944000009102216A46118097490190096888427B +:1094500001D210201CBD964801899848FBF768FA94 +:10946000694609880229F5D003201CBDF0B50E46D7 +:109470008C4985B0174605468E4207D38A4801229B +:1094800092040068964204D3864202D2102005B0AE +:10949000F0BD1F2F01D90C20F9E7854C8D4226D352 +:1094A000954201D3854222D3E08803A9FBF75BF8FC +:1094B0000028ECD1287869464873E08803A9FBF7B7 +:1094C00033F80028E3D16946009008780221084368 +:1094D00069460870497B090703D00821084369469B +:1094E0000870E0886946FAF7B8FF0028CFD16946CE +:1094F0008F80E088334601AA0021FBF783F8694694 +:109500008988B942C3D00320C1E71CB50C460021AD +:1095100000910191228869460A8063490190096897 +:10952000002801D0884201D38C4201D210201CBDFA +:10953000002801D0002A09D05D486A46C1885F48EA +:10954000FBF7F6F96946098821801CBD0C201CBD7B +:1095500010B50123FEF75DFC56E4002310B51A4652 +:109560001946FEF756FC4FE470B504464D4894B0DA +:10957000844207D301208004844206D34A4800680D +:10958000844202D2102014B070BD2046FEF766FD62 +:109590000028F8D146488178112901D00820F2E747 +:1095A000817FC90601D51120EDE71D2269460A70A9 +:1095B00021780025CA07D20F69468A7022898A80DD +:1095C0006289CA80217801268907CA0F69464A72D2 +:1095D000007B002803D0012804D00320D3E70846ED +:1095E0000D7201E008460E7209A902F0A6FA0028E1 +:1095F000C9D12078800708D56068002805D009AA5D +:109600006946FFF7E6FC0028BDD11E2168460170BF +:109610008670C57009A902F090FA0028B3D1A0891C +:1096200000F073F90400AED11220FEF7AAFB204629 +:10963000A9E7F0B516461C4A0C4605001948204912 +:10964000126899B005D085420FD38D4201D395425F +:109650000BD3844209D38C4201D3944205D3864272 +:1096600003D38E4204D3964202D2102019B0F0BD2B +:109670000F4FB87FC106890F01D1400701D51120D6 +:10968000F4E72046FEF7EAFC0028EFD120788107B6 +:10969000C90F294303D0800714D5002D12D007200D +:1096A000E4E7000000C001002800002002300000B4 +:1096B000640C002038810000F3090000FFFF000067 +:1096C0000000040031460220FEF741FC0028CDD105 +:1096D000C9488078112803D0122801D00820C5E796 +:1096E0000220002714A9189002F08DFB00280DD04D +:1096F000C2A1C64811F02FFD08E01598807F8107B0 +:109700001898890F814201D17F1CFFB214A802F082 +:1097100088FB0028F1D0032F01D30420A6E7B64828 +:109720008078122803D1FFF7EEF800289ED1207828 +:10973000800708D56068002805D009AA6946FFF7A8 +:1097400048FC002892D1212168460170218941807E +:1097500061898180207800278007C10F6846817168 +:1097600020788007002815DB2878002807D00128FA +:1097700008D0022806D0032804D0A54876E768461A +:10978000C77102E001206946C8710622691C02A85F +:1097900011F057FB9848007B002803D0012804D023 +:1097A000032063E76846877302E0012069468873F7 +:1097B00031886846018271884182B1888182F1884E +:1097C000C1820783478309A902F0B7F9002886D12F +:1097D000A08900F09AF80400A0D11320FEF7D1FA76 +:1097E000204643E730B505468A4895B000680C46E8 +:1097F000814202D2102015B030BD2846FEF703FB8F +:10980000002807D00178222902D3807F800603D464 +:109810000820F0E78048EEE7132168460170458094 +:1098200009A902F08AF90028E5D108AA0A215156AF +:109830007F2901D02170DEE70520DCE710B56E49F5 +:10984000012807D0022815D0FF206CA14D3011F05F +:1098500082FC81E60878032804D0FF2067A143300A +:1098600011F079FC0021084602F0C7FE0120FEF746 +:109870006FFA71E68878132804D0FF205FA1483082 +:1098800011F069FC0021072002F0B7FE1120FEF75D +:1098900078FA61E6F8B504460122022102F044FAA2 +:1098A000074601220321204602F03EFA0646012225 +:1098B0000521204602F038FA0546012204212046FF +:1098C00002F032FA0446002F04D1AF204BA18000F1 +:1098D00011F041FC002E04D14C4848A11A3811F077 +:1098E0003AFC002D04D1494844A1193811F033FC49 +:1098F000002C04D1454841A1183811F02CFC22213C +:109900003846FEF7B7FA3846F8BD10B5002809D03A +:10991000830000221146072002F0C8FD072801D06D +:10992000032019E6002017E610B504460068002859 +:109930000CD03A49884207D301218904884205D3D3 +:1099400034490968884201D2102005E601F060F828 +:10995000A088294CA083A07E01280DD100210920D8 +:1099600002F025FE002800D00120A17C89090129F0 +:1099700004D00321FEF792FC0020EDE50221F9E777 +:10998000F7B500260C4605460B271AE02968B000FB +:1099900009580978002903D0012901D00720FEBD0C +:1099A000A170296806220958E01C491C11F049FAE7 +:1099B00027702046029902F0C0F80028EFD1761CEB +:1099C000F6B22879B042E1D800263A270FE0A8681D +:1099D000B10041581022A01C11F033FA2770204624 +:1099E000029902F0AAF80028D9D1761CF6B2287B99 +:1099F000B042ECD80020FEBD640C00207372635CA2 +:109A00006761705F636F72652E630000D7020000AC +:109A100002320000280000200230000000C00100D7 +:109A200030B5FE4B9A4207D301239B049A4205D3DB +:109A3000FB4B1B689A4201D2102030BD1578EB0613 +:109A40005B0F042B07D85478072C04D39378102B82 +:109A500001D8A34201D2072030BDD3785B0702D4DE +:109A600013795B0701D5062030BDC37FAC075B08C7 +:109A70005B00E40F2343C3770878EF231840137883 +:109A80009B06DB0F1B0118430870F1231840137865 +:109A9000DB065B0F5B0018430870507808730020EA +:109AA00030BD30B500240C70C378DB07DB0F0B70C2 +:109AB000C578AD07ED0F6D002B430B70C5786D07B2 +:109AC000ED0FAD002B430B7014700179C907C90F5E +:109AD000117003799B07DB0F5B001943117000794C +:109AE0004007C00F80000143117030BD70B51446AF +:109AF0000D460646F7F736FF002809D0A22101706F +:109B0000142221460830F7F75FFBF7F70CFF70BD12 +:109B1000132229463046FEF774FB70BD70B514461B +:109B20000E460546F7F71EFF002809D022210170D6 +:109B300045802178017261784172F7F7F4FE70BDBB +:109B4000132231462846FEF75CFB70BD10B5B54CBC +:109B5000207C00280DD12046B34A21461038FEF75C +:109B6000A7F8002803D0B1A1F12011F0F4FA0120E8 +:109B7000207410BDFFB581B00A9D06461C461746ED +:109B80001421284611F0BCF90B9800210160F80758 +:109B90000ED0A34920680968884239D31230286062 +:109BA0002068143068602068A8600B982168016004 +:109BB000B80726D56068002803D09949096888420B +:109BC00026D3029900290AD0FC3600280ED031464F +:109BD0001030FEF7DBFA00281BD1606810E0002887 +:109BE00016D0E86080366068B0670AE0FFF7CFF80B +:109BF00001460722304611F024F9FFF7A7FF8948F4 +:109C0000E860780708D58649A0680968884202D2CA +:109C1000102005B0F0BD28610020FAE770B50546B8 +:109C200011200C460870002161702121495D002936 +:109C300008D003290ED0042910D0FF207BA1523078 +:109C400011F089FA20780009012802D9E87FC008BC +:109C5000607070BD0007000F203002E00007000FA9 +:109C600030302070EEE770B594B015460C462C22CB +:109C70006946189E0A704880002B17D008221946A2 +:109C800001A811F0DEF868468581102231460E30B9 +:109C900011F0D7F809A9684601F04FFF002803D159 +:109CA000A17F10221143A17714B070BD0020019054 +:109CB0000290E8E7F0B50646008A97B080B20D46FC +:109CC0000190FEF7A0F804465648317848385B4FBB +:109CD00009900B0011F060FB0EFEFD43084A7283F1 +:109CE000B8D9FCFBFAF9F8FEA07F8007800F0128A5 +:109CF00007D000210022019802F016F8050007D1D4 +:109D000001E00121F6E7FF2048A1943011F023FA89 +:109D1000387CC00904D049484038406DA86112E041 +:109D20002B20694608720BA902A801F006FF002843 +:109D300004D0FF203DA19F3011F00DFA40490C984E +:109D400011F0E8F8A9617068A862B068E86220784C +:109D5000252804D0FF2035A1A53011F0FCF93246AA +:109D600021460198FFF7C2FE17B0F0BDA07F800723 +:109D7000800F012807D000210022019801F0D4FFB4 +:109D8000060007D101E00121F6E7FF2027A1AF304F +:109D900011F0E1F92078252804D03078012108431A +:109DA0003070E1E702202870B068A860B068002831 +:109DB00002D000202871D7E70120FBE72B2069465D +:109DC0000870184968464C3901F0B7FE002804D0E5 +:109DD000FF2016A1CE3011F0BEF903201BE02A208F +:109DE0006946087000A810220230716811F029F845 +:109DF00004A810220230B16811F023F8094968461E +:109E00004C3901F09AFE002804D0FF2007A1DF3072 +:109E100011F0A1F904202870099813E000C0010096 +:109E200028000020300D0020FFFF00007372635CEB +:109E30006761705F7365632E63000000500E002041 +:109E400040420F0068608FE7B068002804D1FF200F +:109E5000F649EB3011F07FF9E07F400704D5FF2091 +:109E6000F249EC3011F077F9B06806220A38009018 +:109E700033790421019801F058FA002891D0FF208D +:109E8000EA49F13011F067F96EE7002C04D1FF20A8 +:109E9000E649F93011F05FF92046223010220546DC +:109EA000716810F0CEFF28212046FDF7E3FFA07F68 +:109EB0008007800F022814D100231A4621460095FE +:109EC0000198FFF7D0FE06E055E1B6E0ACE089E08E +:109ED0002CE065E069E111280BD029212046FDF72F +:109EE000C9FFE07F317A4007400FC9000843E0779F +:109EF0003AE7A07F000703D5CC49CD4811F02BF9F4 +:109F0000A07F08210843A0770020608620463430D7 +:109F100010F0F4FFE07FFD220146C9071040890FD1 +:109F20000843E077307A203420701DE7A07F800757 +:109F3000800F012807D000210022019801F0F4FED3 +:109F4000040007D101E00121F6E7B948B7491D3007 +:109F500011F001F92B2069460872B64902A801F0F8 +:109F6000ECFD002804D0B248B049223011F0F3F8DB +:109F7000B0488188204621300176090A41760E21B9 +:109F800029702146FC316960017E2974407E687425 +:109F9000A8482C30A860103030346C61E860E3E6EB +:109FA000002C04D1A248A149363011F0D4F8207811 +:109FB00021289DD93079012802D0022808D103E058 +:109FC000E07F04210843E077387C0121084338749E +:109FD000324621460198FFF789FD23212046FDF7EF +:109FE00049FFC1E601220421019801F07DFC00280F +:109FF0009BD0A07F8007800F012807D0002100227E +:10A00000019801F091FE040007D101E00121F6E77B +:10A0100087488649543011F09EF80F202870172089 +:10A0200028716E34AC609FE60421019801F0ABFC0E +:10A030000028B4D11020287096E6A07F8007800FFA +:10A04000012807D000210022019801F06DFE0500D3 +:10A0500007D101E00121F6E7754874496D3011F030 +:10A060007AF82E462036307E41064DD5A17F8F07E7 +:10A07000BF0FC00713D02A468032516F00290ED07F +:10A08000087CF37DC007C00F5B0018430874516F54 +:10A09000E27F40084000D207D20F10430874307EA0 +:10A0A000000713D528468030026F002A0ED0117C9D +:10A0B000F37DC907C90F5B0019431174E27F49089A +:10A0C0004900D207006FD20F11430174307E800720 +:10A0D0000BD5F8204259002A07D0012F05D0294678 +:10A0E000307C31311032FEF77BF8307EC0060BD564 +:10A0F000F8204259002A07D0012F05D12946307C8B +:10A1000031311032FEF76CF8052368460370357E56 +:10A110004570484822226038019902704278D2087E +:10A12000D200D21C4270418003724572F7F782FD63 +:10A130002078252809D021280BD0AD203B4980006C +:10A1400011F009F82078222803D922212046FDF7B2 +:10A1500091FEA07F8007800F01280AD0002101987E +:10A1600001F009FE002800D1FEE5AF202F49800054 +:10A1700088E60121F3E774682E4D207860350928C0 +:10A1800002D00A28F0D10BE0E168002902D028466D +:10A19000F8F7D7FE2169002902D02846F8F7D1FE4A +:10A1A00021462846F8F7CDFEDEE521481F49DC3080 +:10A1B00068E6204810B5072228216030F8F7A8FE8D +:10A1C0001D480024017C4906490E0174403844654D +:10A1D000FDF7FBFC17493C3108461038F7F779FCCE +:10A1E00014484C30047410BD70B50D46FDF70BFEDD +:10A1F000040004D103200D49000210F0ACFFFF2140 +:10A200000531284610F07CFEA07F8007800F0128D2 +:10A2100016D0022128468830FDF7D8FC002803D04C +:10A220000249064810F097FF70BD00002C9E000008 +:10A2300005020000E40C0020500E00200503000081 +:10A240000121E7E70A46014610B510468830FDF7C0 +:10A25000D7FC10BDF0B505464068082601789BB0D4 +:10A2600008290DD00B2903D00C293FD10121817180 +:10A27000686887883846FDF7C6FD040041D13BE099 +:10A2800047883846FDF7BFFD040003D1FD49FE486D +:10A2900010F061FF2078212828D0282828D168686C +:10A2A00002210C3000F0BEFF002821D06868082190 +:10A2B000001D00F0B7FF00281AD02D21684601705C +:10A2C000478021461022223101A810F0BAFD0FA9C3 +:10A2D000684601F032FC002804D0CB20E949800018 +:10A2E00010F039FF29212046FDF7C4FD1BB0F0BD59 +:10A2F000687830436870F9E7E348E2492D3010F0A0 +:10A300002AFFA07F8107890F022902D1EF2108408F +:10A31000A0772078212810D068688179002902D0A0 +:10A320008078002818D0A07F8007800F022864D092 +:10A330000720D449C00110F00EFFA07F8007800FD6 +:10A340000228D3D1FDF7ECFF0028CFD0CE48CD496D +:10A35000733010F000FFC9E7687830436870E07F21 +:10A36000C00701D0042100E00321212001552078FD +:10A37000292818D02428E0D13946062002F03DF9DA +:10A3800022212046FDF776FDA07F8007800F01285F +:10A3900031D00021384601F0EEFC0028CDD0BA487B +:10A3A000B8495830C7E7A07F8007800F012807D041 +:10A3B00000210022384601F0B7FC050007D101E07A +:10A3C0000121F6E71B20AF49400110F0C4FE252112 +:10A3D0002046FDF74FFD0D2008A90871284609A960 +:10A3E0008830FDF7FFFB0228A7D00028A5D0A6489B +:10A3F000A4494D309FE70121CCE76878304368706D +:10A400009BE7F7B58AB00A98FDF7FDFC050056D02A +:10A410002878222853D3232851D0E87F40074ED4F0 +:10A42000A87F8007800F01280ED0002201280DD0C0 +:10A4300000210A9801F078FC064694480290F8F74B +:10A4400077FD040009D103E00122EFE70121F0E7E5 +:10A4500075208C49C00010F07EFE002E0FD088368B +:10A4600066610298F8F764FD07460298F8F760FD08 +:10A4700006462878222807D0242805D008E00020A6 +:10A4800007460646606103E025212846FDF7F2FCF9 +:10A49000092020700A9820620C9820710B98E760C0 +:10A4A0002661A06004A92046FDF7C0FB022806D063 +:10A4B000002804D074487349AF3010F04CFE0DB042 +:10A4C000F0BD30B587B00446FDF79DFC0546807FA2 +:10A4D0008007800F01280BD000210022204601F0C8 +:10A4E00023FC0446287822281ED9002C07D101E03D +:10A4F0000121F2E764486349BB3010F02CFE0F21C4 +:10A50000684601701721017120466E30029069463D +:10A510001A30FDF767FB022806D0002804D05A48FD +:10A520005849C03010F017FE07B030BD30B587B0C5 +:10A530000446FDF768FC0546807F8007800F0128F0 +:10A540000BD000210022204601F0EEFB04462878C3 +:10A550002228E9D9002C07D101E00121F2E74A487D +:10A560004849CD3010F0F7FD1020694608702046AC +:10A570008830FDF737FB0028D6D043484149D0301A +:10A5800010F0E9FDD0E7F7B505460078002700098F +:10A5900082B00C463E4602287CD0072802D00A280A +:10A5A00049D149E068680178082906D00B292FD0E5 +:10A5B0000C292DD03349364865E114271A26002C82 +:10A5C00069D04088A080FDF71EFC0090002804D1CF +:10A5D0002F482C49243810F0BEFD00980099C07D0A +:10A5E000A21D1831FDF7FCFD686808228089E08112 +:10A5F000696820461030091D10F023FC207E0121DF +:10A600000843F9210840207600984021807F50E0DF +:10A6100018270826002CD3D08088A080FDF7F3FBF4 +:10A62000050004D11A481749401F10F094FDA11DE0 +:10A630002846FFF7F3FA28E1002C01D0288BA080F0 +:10A64000287A01287ED0022805D0032838D0104867 +:10A650000C49853017E11C270726002CB0D0A088B4 +:10A66000FDF7D1FB0090002804D1094805491330BB +:10A6700010F071FD287B8007800F0128A0791CD085 +:10A68000400809E02C9E00001A030000440D002041 +:10A6900027040000E9E0E3E04000A071FD2108404C +:10A6A000297B4907C90F49000843A0710098802100 +:10A6B000807F084300998877E7E001210843ECE7B1 +:10A6C00013270B26002CA6D0A088FDF79CFB00903A +:10A6D000807F8007800F012807D00021A0880022FA +:10A6E00001F022FB050006D101E00121F6E7FB495C +:10A6F000FB4810F030FD0098807F8007800F012814 +:10A7000050D0E86A81788907890F0129A1794BD057 +:10A7100049084900A1718278FD255207D20F2940CE +:10A7200052001143A171E322114002785207D20E68 +:10A730001143A171DF2211404278D207920E1143DA +:10A74000A17100E033E00021E171C178217242790A +:10A750000179607AD30740084000DB0F1843930764 +:10A76000DB0F28405B0018435207FB23D20F184031 +:10A77000920010436072A07ACA0740084000D20FCE +:10A7800010438A07D20F2840520049071043C90FCF +:10A79000184089000843A07200980078232874D9D3 +:10A7A0002621C4E0A86AADE701221143B2E7297B64 +:10A7B000CC48022911D017270C26002C50D0012993 +:10A7C00012D003291FD0042920D005291ED09320A0 +:10A7D000C249C00010F0BFFC23E019270726002C57 +:10A7E00053D00121A17105E00121A171E17989080E +:10A7F0008900E171017CCA094906D201890E49002C +:10A800000A4302740DE00220A07106E0687B000795 +:10A81000000F8030A07105291DD0E07980088000EC +:10A82000E071A088FDF7EFFA0546007821282CD0CA +:10A83000232804D0AA48A949573010F08CFCA87FDF +:10A840008007800F01280ED00021A08801F093FA24 +:10A85000222128466CE0E07980088000401CDFE778 +:10A860000498068017E00121EFE7002C01D06888EA +:10A87000A080287A032832D004280FD005285AD087 +:10A8800097489649B03010F066FC0498002C06807A +:10A8900001D027806680002005B0F0BD15270C266A +:10A8A000002CDDD0A088FDF7AEFA807F8007800FF6 +:10A8B000012807D00021A088002201F035FA050008 +:10A8C00007D101E00121F6E785488449763010F090 +:10A8D00042FC0622A11DA86907F036FAD5E7162723 +:10A8E0000726002CBCD0A088FDF78DFA0090807F51 +:10A8F0008007800F012807D00021A088002201F0E6 +:10A9000013FA050007D101E00121F6E77448734905 +:10A91000843010F020FC2878C00601D5022000E029 +:10A920000120A071009800782328AED92721009833 +:10A93000FDF7A0FAA9E717270C26002C90D0A088D5 +:10A94000FDF761FA00906D7A002804D164486349EC +:10A95000973010F000FC0621A01D10F0CFFA002067 +:10A96000A071207A032108432072FB21084000993E +:10A97000C97FC907490F08432072680685D5E07969 +:10A9800004210843E071A07AE90740084000C90F9C +:10A990000843E17A2A0749084900D20F1143FD22F2 +:10A9A000AB07DB0F10405B001843A072E806C00F36 +:10A9B000114040000143E17267E710B50446807919 +:10A9C00090B08009012804D045484449C93010F0AE +:10A9D000C2FBFFF7BBF801206946087042480890A7 +:10A9E00042480190201D0290601C0B900AA9684605 +:10A9F000FDF71CF9002804D039483849D43010F04C +:10AA0000AAFB0322601C0B9910F01BFA10B010BDBA +:10AA100010B5364C002805D001461022204610F013 +:10AA200010FA0120207410BD10B50446FFF78EF80F +:10AA300010222E49204610F004FA10BD70B50025F2 +:10AA4000284C00281CD02A49884207D301218904B8 +:10AA5000884205D327490968884201D210250DE0B4 +:10AA6000062107F05BF9411C07D01E4940394865B3 +:10AA7000207C80210843207400E00725284670BD13 +:10AA8000207C4006400EF6E7F3B5002089B00D4665 +:10AA9000029000290AD0164885421CD30120800468 +:10AAA000854203D313480068854214D30998FDF703 +:10AAB000AAF9060003D03078222826D102E00E48F9 +:10AAC0000BB0F0BD002D19D1B07FC10903D08007B4 +:10AAD000800F022812D01020F2E700002C9E000008 +:10AAE0004D040000500E0020FFFF0000300D00203C +:10AAF00000C001002800002002300000B07FC10625 +:10AB000001D4010703D5002D01D00820D8E7FE4964 +:10AB1000097CC90717D1F17F490701D50D20CFE77F +:10AB20008007800F01280CD000210122099801F034 +:10AB3000FBF8070007D0B07F8007800F022804D001 +:10AB40000DE00121F1E71120BAE7002D07D02A46D8 +:10AB500039463046FEF764FF02900028B0D1EB483A +:10AB6000F8F7E6F9040003D1E949EA4810F0F3FAEE +:10AB70000A2020700998206238468830A060B07F93 +:10AB8000FB218007800F012829D0002D3DD0022015 +:10AB90002071381DE06038780007400F2074387845 +:10ABA000C006C00F6074A07C2A788008D20780009D +:10ABB000D20F1043A0740840F17F01AAC907490FC2 +:10ABC0000843A074A878E07469462846FEF769FF38 +:10ABD00068460079207568460078607519E00120A4 +:10ABE0002071207B2A788008D2078000D20F104382 +:10ABF0002073084029788907C90F8900084320730A +:10AC000024213046FDF736F90BE0032020710520A2 +:10AC1000207325213046FDF72DF9B07F4006400E08 +:10AC2000B07703A92046FDF701F8022806D00028D6 +:10AC300004D0B848B6492B3010F08DFA02983FE79F +:10AC4000FFB5B54A0E4607CA97B002AB07C3002747 +:10AC500001970C971798FDF7D6F8050005D02878CE +:10AC6000262804D008201BB0F0BDAC48FBE7A87F25 +:10AC70008007800F012807D000210022179801F0DB +:10AC800053F8040007D101E00121F6E7A148A049EB +:10AC9000623010F060FAA87F8007800F16900128BC +:10ACA00014D0022824D09B4899497B3010F053FAE5 +:10ACB00001210022852E31D01EDC002E26D0812ECF +:10ACC00026D0822E26D0832E1ED125E0002EEFD155 +:10ACD00021462846199AFEF7A3FE0028C3D11998E9 +:10ACE0008078019019980078C007C00F0C90DFE7BA +:10ACF0001998002808D1DBE7862E11D0882E11D0B4 +:10AD0000892E11D08A2E11D00720ACE710460EE014 +:10AD100008460CE002200AE0032008E0052006E0D7 +:10AD2000062004E0082002E0092000E00A200022BA +:10AD3000227101216A461176211D0791002801D058 +:10AD400020710BE1169801280CD0A66AE06A022255 +:10AD5000012111900020A0602846173002291AD046 +:10AD6000012119E0E66AA06A119003203070207872 +:10AD7000FB23C006C00F7070B07801221840019B01 +:10AD8000F37080080C9B800018430221B0700020F3 +:10AD900070713071DEE70021890009190861681CB3 +:10ADA000022A01D0012100E000218900091908616F +:10ADB000B0788007800F01285ED1119880788007D5 +:10ADC000800F012858D1119800790190119840798D +:10ADD0000090169801281DD0317908A80174717966 +:10ADE000017508A8027C01980099024008A8007D1E +:10ADF0000840149010433FD049491A98884207D31D +:10AE000001218904884215D346490968884211D234 +:10AE1000102028E70CAA0DA91998FEF742FE08A8F1 +:10AE2000007C01990840307108A8007D0099084015 +:10AE30007071D6E720463C3021460090F0311698DC +:10AE40000191022834D000211A9B20460C33FEF7D2 +:10AE500091FE0028DDD12046503021460090F4318B +:10AE600016980191012825D0002120461A9B149A9A +:10AE7000FEF780FE0028CCD111988078400702D4DC +:10AE8000E87FC0072BD0169902A8012914D0119988 +:10AE900009784900405A21780907490F4900C840FC +:10AEA0008707BF0F2AD0012F14D0022F0FD113E034 +:10AEB0000121C9E70121D8E721780907490F490095 +:10AEC000405A119909784900C8408707BF0F032FDE +:10AED00004D004E0022711E001270FE002271698B2 +:10AEE00001280BD1B078FB210840E97FC907490F41 +:10AEF0000843B07020780007400F30702078400879 +:10AF00004000207011990FE0500E0020440D0020E9 +:10AF10002C9E0000A90500001CB4010002300000B6 +:10AF200000C001002800002049781022C907C90E7E +:10AF3000D243114308402070C00622D4022F20D0F3 +:10AF4000012F20D00020A061E061206260622046D5 +:10AF50001830A060E87F40084000E877204606A946 +:10AF60008830FCF73FFE002805D0022803D0B44902 +:10AF7000B44810F0F0F825212846FCF77BFF0020AC +:10AF800071E6032008E020460D211B300FF0B6FFCC +:10AF900020461830A060042069460875E87F01212A +:10AFA0000843E87705AA29461798FEF7B7FDD5E7C5 +:10AFB000F0B587B015460F0004460DD0A248854273 +:10AFC00007D301208004854206D3A048006885424B +:10AFD00002D2102007B0F0BD2046FCF714FF060097 +:10AFE00004D03078272803D00820F3E79848F1E709 +:10AFF000B07F8007800F012807D000210022204663 +:10B0000000F092FE040007D101E00121F6E78D482F +:10B010008B491F3010F09FF80020002F05D0022F21 +:10B0200008D0012F11D00720D4E701216A46117101 +:10B03000A06018E0234618336946A3600871102207 +:10B04000294618460FF0FDFE0DE021461831A1609B +:10B0500069460871A061E0612062606206212846AD +:10B0600006F05CFEA0612078C10714D040084000C3 +:10B070002070022069460870204618300290703017 +:10B08000FCF7B0FD022806D0002804D06D486C49BA +:10B09000423010F060F825213046FCF7EBFE00202E +:10B0A00098E7F8B515460E460746FCF7ACFE0400D7 +:10B0B00004D02078222803D00820F8BD6448F8BDC9 +:10B0C000A07F8007800F022802D06148C01CF8BD15 +:10B0D0005D4886420ED3012189045C4A8E4202D328 +:10B0E00013689E4206D3854204D38D4204D3106870 +:10B0F000854201D21020F8BD00953288B31C21464C +:10B100003846FEF7B0FD112816D00028F3D1E17FB4 +:10B110002A7C4908D2074900D20F1143E1772A7CE3 +:10B1200049079206490FD20ED2001143E177A17F61 +:10B130004906490EA177F8BDA17F0907FBD4204637 +:10B140000822B11C34300FF07CFE30886086204627 +:10B150001022294622300FF074FEE07FFD210840C6 +:10B16000297CC907890F0843E077287C4108202003 +:10B170000155A07F08210843A0770020D7E770B5CC +:10B1800094B00D460646002B02D0072014B070BDC7 +:10B19000FCF739FE040007D02078222802D3A07FD4 +:10B1A000400603D40820F1E72948EFE7002D19D025 +:10B1B0002D216846017046801022294601A80FF013 +:10B1C00040FEE07F297C4008C9074000C90F0843C2 +:10B1D000E077297C40078906400FC90EC900084363 +:10B1E000E07703E02E2168460170468009A9684691 +:10B1F00000F0A3FCA17FBF221140A177C6E710B5E4 +:10B200000C46FCF700FE002805D0104909688C4266 +:10B2100003D2102010BD0E4810BD2146FEF7FEFCE3 +:10B22000002010BD05E00278401C002A01D000205B +:10B2300070470A46491E89B2002AF4D1012070479E +:10B240002C9E0000ED06000000C001002800002038 +:10B250000230000030B50346072903D00620DA7813 +:10B260001C7916E00320FAE707290BD05500ED18EA +:10B270006D79072D01D0401EC0B2521CD2B2092AEE +:10B2800007D105E05500ED186D79072DF3D0F4E7EF +:10B2900000222546641EE4B2002DE5D130BDFFB585 +:10B2A00081B00C461646114620460A9F0B9DFFF7BB +:10B2B000D1FF00280AD02079092803D3FEA1A020BD +:10B2C0000FF049FFA078C00907D019E0072E02D07F +:10B2D000112005B0F0BDFD48FBE701982880381D1E +:10B2E0006880002068712871EF80049828812846C2 +:10B2F00000F04BFC002803D1EFA1AD200FF02BFF95 +:10B30000E07821794018491CC0B22171092801D385 +:10B310000938C0B24000001946718179F12249080C +:10B320004900114081710020D3E7FFB583B0164674 +:10B330000F461C46002203210C9D039800F0F4FCEC +:10B34000010008D033463A46019500940398FFF770 +:10B35000A6FF07B0F0BDDD48801EFAE7F0B5054650 +:10B3600016460F4650888DB00022032100F0DCFC09 +:10B37000040003D1D0A1DF200FF0EDFE00206946CC +:10B380000871A078400603D1CBA1E3200FF0E3FEC3 +:10B39000042F5ED32A78D007C017401C06D16178ED +:10B3A0006B78994255D12178090752D00121142A8E +:10B3B00046DA012A42D0122A02D0132A40D128E0CC +:10B3C0000C2F3DD1A2785206520E012A38D0207897 +:10B3D00000090001401C20706878607068460171A7 +:10B3E00068792A790102114368460181E879AA79CE +:10B3F0000102114368464181687A2A7A01021143A9 +:10B4000068468181E87AAA7A010211436846C181BF +:10B410001AE0062F14D120780009000120707188ED +:10B42000012001F0EAF8022168460171C91E01817C +:10B4300068792A790102114368461FE0062F0AD075 +:10B440006A461279002A1BD07088324601A9FDF79E +:10B4500020FB0DB0F0BD207800090001207071883C +:10B46000012001F0CAF802216846017168792A7941 +:10B4700001021143684601810021C9434181E3E78C +:10B480000028E6D07488684681766978C176022102 +:10B4900081830021C18304A8052200900623114660 +:10B4A0002046FFF742FF0028D3D089A1D6200FF015 +:10B4B00052FECEE7F7B58CB015460C990D98FAF709 +:10B4C00041F9C0B2082850D10020694688856888B3 +:10B4D0000022032100F028FC040004D1FF2076A103 +:10B4E00063300FF038FE01230021E07822790BE071 +:10B4F0004600361976799E4201D1491CC9B2401CDA +:10B50000C0B2092800D100201646521ED2B2002E29 +:10B51000EED1002902D117206946888504AB023399 +:10B520000BAA00950C990D98F8F7B6FB0006000ED3 +:10B5300007D002281BD0032817D0FF205EA1893036 +:10B5400011E06846808D00280FD002A9019100907B +:10B550006888042301222146FFF7A1FE002804D0B9 +:10B56000FF2055A176300FF0F6FD0FB0F0BD6878E2 +:10B57000102108436870F8E700205A49024643004A +:10B58000401CCA520828FAD3704700218170017804 +:10B5900009090901017000214170C17001717047F2 +:10B5A00070B50D460022032100F0BEFB040004D15B +:10B5B000FF2041A1CF300FF0CEFDA0786906C00971 +:10B5C000C001490E0843A07070BD704710B5014618 +:10B5D000012001F012F810BD3EB58DB2002203210A +:10B5E000284600F0A1FB040004D1FF2032A1E43082 +:10B5F0000FF0B1FD2078694600090001207002209B +:10B60000087039488880C88000222846FDF741FA32 +:10B610003EBDF7B505460078002700090C463E46BA +:10B62000012804D0FF2024A1F3300FF094FD287AE4 +:10B6300003280CD0412020A1C0000FF08CFD0298FF +:10B64000002C068001D0278066800020FEBDEA899C +:10B65000702710460A3086B2002C0AD06888A08075 +:10B66000A8892081E28020460A3029690FF0E9FB91 +:10B67000E5E702980680E8E7F8B543680246D9791D +:10B680009C79090221435C7A1E7A25025C88981D08 +:10B690003543241FA14238D11B79022B35D1042D0B +:10B6A00034D0052D3DD0062D34D0402D2DD3061D90 +:10B6B0000F461446284619E07372635C6C3263616E +:10B6C000705F636F72652E6300000000043000003D +:10B6D0007372635C6C326361705F636F72652E635B +:10B6E00000000000680E0020FFFF000000F0E3F9FA +:10B6F00008280AD01120207003202072A581E7813C +:10B7000026616078082108436070F8BD001DFFF7CE +:10B71000D1FEF8BD031D50880A461946FEF771FE9A +:10B72000F8BD001DFFF71AFEF8BD70B50D468CB0D0 +:10B7300006460022032100F0F7FA040031D02078F9 +:10B740000007000F01282ED0122069468874607807 +:10B750000523801CC874082088822888C8826888CD +:10B760000883A8884883E888888302A90C2001916F +:10B7700000901A4621463046FFF791FD00280ED171 +:10B78000F02300223146012000F090FE20780009CD +:10B790000001401C20706078801C607000200CB09C +:10B7A00070BDCB48FBE71120F9E770B50D468CB0B2 +:10B7B00006460022032100F0B7FA040006D02078E4 +:10B7C0000007000F012803D00820E8E7C048E6E79B +:10B7D0001321684681746178C17402218182C58217 +:10B7E00002A906200523019100901A462146304601 +:10B7F000FFF755FD0028D2D1207800090001207004 +:10B800000020CCE7F3B581B00D460022032101985A +:10B8100000F08AFA00260446002803D1AD49AE485C +:10B820000FF099FC2079A8423BD2AB48A949401CB3 +:10B830000FF091FC35E0E07841000F19401C797958 +:10B84000C0B20091E070092801D10020E070207999 +:10B85000401E2071B879C00708D0009801990428CB +:10B8600015D09C49822018310FF075FCB87900077B +:10B87000410F08D0400F019904280CD095498F2022 +:10B8800018310FF068FC009807280AD107E0084635 +:10B89000FEF74CFEEAE70846FEF713FEF3E7761CD8 +:10B8A000F6B228466D1EEDB20028C4D13046FEBD6A +:10B8B00010B50022032100F037FA040004D1B520AE +:10B8C000844980000FF047FCE07821794018C0B22D +:10B8D000E070092801D30938E07000202071A078B9 +:10B8E00080210843A07010BDF8B517460D46002210 +:10B8F000032100F019FA040005D0002D0CD0002F10 +:10B9000007D0062006E0072D01D00620F8BD032051 +:10B91000F8BD0820A84204D86F486E4942300FF0A5 +:10B920001AFC29462046FFF795FC0646002F28D032 +:10B93000002E26D1E07821791CE0420012195379BB +:10B94000072B03D093791B075B0F04D0401CC0B2B8 +:10B9500009280CD00CE0400000198079F123184030 +:10B960006B071B0F1843907100290AD104E00020D7 +:10B97000491EC9B20029E0D1574856495A300FF044 +:10B98000EAFB3046F8BDF8B50D460022032100F071 +:10B99000CBF9040004D150484E4968300FF0DBFB6E +:10B9A000681E052804D34C484A4969300FF0D3FB80 +:10B9B0000921E2782079002310E0560036197779C2 +:10B9C000AF4206D1B17949084900B1715B1CDBB2C5 +:10B9D0001146521CD2B2092A00D100220646401E4E +:10B9E000C0B2002EE9D1092905D248000019817999 +:10B9F0000122114381711846F8BD10B50446402854 +:10BA000001D2072010BD00F056F8082802D03120DE +:10BA1000000210BD0021314802E0491C082903D270 +:10BA20004A00825A002AF8D1082903D0490044521A +:10BA3000002010BD042010BD10B5402801D2072001 +:10BA400010BD00F038F8082805D00021234A400036 +:10BA50001152084610BD052010BDF0B58BB016463A +:10BA60000C00074607D0002E05D06188402904D27B +:10BA700007200BB0F0BD1020FBE72088002801D084 +:10BA8000172801D90C20F4E7084600F014F808281C +:10BA90000FD0258803A82A46314602300FF0D1F98D +:10BAA00001A8009062882B4607213846FFF73DFC2D +:10BAB000DFE70520DDE701460020084A02E0401CE0 +:10BAC000082803D24300D35A8B42F8D170470000B4 +:10BAD00002300000B8B60000AD020000680E002081 +:10BAE00000B51E2827D00FDC0C2820D008DC03006E +:10BAF0000FF052FC0913211521211B1B17192100DE +:10BB0000122818D1072000BD302814DD3A38030070 +:10BB10000FF042FC030F11091100002000BD214865 +:10BB200000BD042000BD0D2000BD0F2000BD082079 +:10BB300000BD112000BD032000BD10B50C4604F06F +:10BB4000A0F800281ED0204602F013FE002816D0D0 +:10BB500022780E2A0DD00F2A0BD0022A09D0032AF0 +:10BB600007D0102A09D010A17E200FF0F4FA00208F +:10BB700010BDA078FFF7B4FF10BD112010BD0AA1C1 +:10BB80008420F2E708A18A20EFE710B502F0A2FCBA +:10BB900010BD10B502F0EDFD10BD10B502F01AFD9C +:10BBA00010BD0000023000007372635C686F737434 +:10BBB0005F6863692E630000F8B5054606ACC1CC2A +:10BBC000E44C21706270A370E070681C4208277119 +:10BBD0005200E14B66710021880000198446026220 +:10BBE000605C40008218002D0AD0002005E0664607 +:10BBF0004700366A401CF353C0B2665C8642F6D8F2 +:10BC0000491CC9B20629E7D30026D21C9708B00008 +:10BC1000BF0000198760304600F02AF9A15D761C4C +:10BC20004843C219F6B2062EEFD3501B80B2F8BDBE +:10BC3000F0B504468C46C7490020A500FF23024604 +:10BC40006D18C54E0C5D0BE02F6A5100795AB14258 +:10BC500004D1401CC0B2FF2B00D11346521CD2B2FB +:10BC60009442F1D8002801D061460B70F0BD70B548 +:10BC7000B84C0023655CA678B54200D10346890024 +:10BC800009199D420AD90C6A5E00A45B844202D164 +:10BC90001370012070BD5B1C9BB2F2E7002070BDE9 +:10BCA000FFB583B00C9C1F460D46060009D0002D41 +:10BCB00007D0F01C80088000B04204D0102007B0EC +:10BCC000F0BD0E20FBE70598A04201D8A74201D99C +:10BCD0000720F4E701460094019423463A460020E9 +:10BCE0000294FFF769FF2988814207D0814201D27F +:10BCF000042100E0092128800846E0E7009401942F +:10BD000023463A46029430460599FFF755FF2880AE +:10BD10000020D4E710B5044600F0B4F8002801D0A4 +:10BD2000E0B210BDFF2010BDF8B505468A481646A2 +:10BD30000C46854201D0062C01D30020F8BD002717 +:10BD400069460F7028466A462146FFF790FF002893 +:10BD50000DD068460178204600F09CF8002EEDD00A +:10BD60000028EBD12146284600F0A0F8F8BD38465F +:10BD7000002EF7D1F8BDF8B505460C460020764EEA +:10BD80006946764F0870B5423BD0062C01D3072098 +:10BD9000F8BD0A4621462846FFF769FF002830D043 +:10BDA00068460178204600F075F823000FF0F4FA99 +:10BDB000060404090C11161B01462846FEF742FA38 +:10BDC00015E0FDF735F812E001462846FFF7FDFBC8 +:10BDD0000DE001462846F7F7E4FE08E00146284654 +:10BDE000F9F73AFB03E05EA17C200FF0B4F9594A61 +:10BDF0006846A10000788918096A40000E520020A8 +:10BE0000F8BD3846F8BD5A4A1268914201D2102056 +:10BE10007047062801D30720704708720020487237 +:10BE20007047F8B5044652480068844201D2102099 +:10BE3000F8BD207A474A83009B18617A464D125C10 +:10BE400011E01E6A4F00F65BAE420AD04A1C6272D5 +:10BE50001A6A4B00D25A228000F01CF86060002061 +:10BE6000F8BD491CC9B28A42EBD861720520F8BD01 +:10BE70000EB5404B40000ECB0091029301926946F3 +:10BE8000085A0EBD33498978814201D90120704793 +:10BE90000020704770B50C460546FFF7E9FF2D4AB4 +:10BEA000A900891889686043401870BDF8B5044638 +:10BEB0000E4600206946087005462046FFF7E2FF5F +:10BEC000002803D126A1F3200FF045F92148214B8A +:10BED000815D8278B000C718914209D1E0B269460D +:10BEE0000870396A4000085A1B49884206D02EE083 +:10BEF00069463046FFF79CFE002828D06846007847 +:10BF0000396A40000C52684601783046FFF7C2FF9C +:10BF1000054633000FF040FA060404090C0F14170D +:10BF200029462046FEF760F911E0FCF75EFF0EE0BF +:10BF3000FFF72BFB0BE029462046F7F7F9FD06E05B +:10BF4000F9F783FA03E006A162200FF004F928460E +:10BF5000F8BD0000780E0020FFFF00000230000056 +:10BF60007372635C686F73745F636D2E63000000AF +:10BF70002800002028B401008107C90E002808DA33 +:10BF80000007000F08388008C24A80008018C06986 +:10BF900004E08008C04A800080180068C84000069D +:10BFA000800F7047BD4948788978884201D3401A8C +:10BFB00002E02122511A0818C0B27047B749233154 +:10BFC00048788978884201D3401A02E02122511A28 +:10BFD0000818C0B27047B14946314878897888421C +:10BFE00001D3401A02E02122511A0818C0B270474A +:10BFF000A94910B50C310868FF22120290430122B2 +:10C00000D20310430860A54900202331487088708E +:10C01000233948708870463148708870A04806F00F +:10C02000BCF89F48401C06F0B8F8F6F7A3FB00F0F8 +:10C0300028F910BD20207047B4E770B50C460546BE +:10C040000026FFF7AFFF9549A04214D30A46203AD5 +:10C0500000232046641EE4B200280BD08878105CD0 +:10C06000287088786D1C401CC0B288702128F0D1DF +:10C070008B70EEE7012600F004F9304670BD2020F9 +:10C0800070479BE770B50C4605460026FFF796FF04 +:10C0900082492331A04214D30A46203A0023204685 +:10C0A000641EE4B200280BD08878105C2870887871 +:10C0B0006D1C401CC0B288702128F0D18B70EEE757 +:10C0C000012600F0DEF8304670BD2021017000200E +:10C0D000704710B50446FFF77EFF2070002010BDAA +:10C0E00070B50C460546FFF776FF6C494631A04215 +:10C0F00015D30A46203A00232046641EE4B20028E5 +:10C100000BD08878105C287088786D1C401CC0B2F9 +:10C1100088702128F0D18B70EEE7002400E0614C9C +:10C1200000F0AFF8204670BD70B50C4605462129D9 +:10C1300004D9FF205CA147300FF00DF85548406846 +:10C14000103840B2FFF718FFC6B20D20FFF714FFFA +:10C15000C0B2864207D2FF2053A14D300EF0FBFF44 +:10C1600001E0F6F74AFB21462846FFF766FF002864 +:10C17000F7D070BDF8B507464948484C401E474EB9 +:10C180000078254646362335002806D1A9786878F8 +:10C19000212200F06BF800280ED0A17860782122CF +:10C1A00000F064F8002814D0B1787078212200F0F3 +:10C1B0005DF8002828D033E038496878C91C0F544E +:10C1C0006878401CC0B26870212829D100206870AE +:10C1D00026E03249607820390F546078401CC0B2A4 +:10C1E0006070212801D1002060702D4F7F1E3878AB +:10C1F000002815D0A1786078212200F037F80028B7 +:10C200000ED0002038700BE02449707826310F548E +:10C210007078401CC0B27070212801D1002070706D +:10C22000A9786878212200F021F800281DD0A17893 +:10C230006078212200F01AF8002816D0B1787078C2 +:10C24000212200F013F800280FD0F6F7B8FA1448AE +:10C2500005F0ABFF01214903884203D016A1C1209C +:10C260000EF079FF0E4805F0B8FFF8BD401C88427B +:10C2700005D0904201D1002901D000207047012053 +:10C28000704710B5064805F090FF002801D1F6F779 +:10C2900085FA10BD00ED00E000E400E0F00E0020A3 +:10C2A00069000020072000007372635C736F635F96 +:10C2B00072616E642E6300007372635C736F635F00 +:10C2C00072616E642E630000FEB5F54C074660682F +:10C2D000FF213E0181552178FF2913D00901083142 +:10C2E00041583246491E083209020192090A805813 +:10C2F00000F0CCF9002802D02478254615E06168CA +:10C30000207888552770FEBDE5484268019811588D +:10C31000280100900830105800F0B8F9002806D124 +:10C32000DF482C46416800980D5CFF2DECD1DC48BD +:10C330002101406885554754FEBD70B5D84A044672 +:10C340000020157A53680AE00201561C9E5DA64241 +:10C3500003D10C329A588A4204D0401CC0B28542A4 +:10C36000F2D8FF2070BDF8B5CD4F3E7801F00AFE3F +:10C370000146FF2E68D034012546786808354059BB +:10C3800000F084F9022802D9786840595AE0C4497B +:10C390004868025D0A70A11C425C002A0CD0521E43 +:10C3A000425441590122D20589180902090A415112 +:10C3B0003046FFF789FF30E0631CC25C0092221D0B +:10C3C00094468258002A10D001239B029A420FD92A +:10C3D0009205920D43595703DB191B021B0A435167 +:10C3E0006346C3589A1A920A09E0FF21C1540AE031 +:10C3F000435952039A181202120A4251002242541F +:10C400003046FFF761FFA6480C344168C2680098C7 +:10C4100009598000125800989047A14C2078FF28B5 +:10C4200012D001F0AFFD01462078626800010830AB +:10C43000105800F02BF9012896D920786168000186 +:10C440000830085801F091FDF8BDF8B51C461546B6 +:10C450000E460746FF2B03D392A1D3200EF07BFE9E +:10C460008F48FF21C7604560047206740170002286 +:10C470004270104604E00201521C401CA954C0B294 +:10C48000A042F8D3F8BD70B5854C06466578207C8F +:10C49000854203D383A1E6200EF05DFEE068A9008B +:10C4A00046506078401C6070284670BDFFB581B072 +:10C4B0001D46FF2401F066FD794F06467978019804 +:10C4C000814203D877A1F4200EF045FE7448002184 +:10C4D000037A406810E00A019446521C825CFF2AED +:10C4E00024D0019FBA4205D162460C328758029A85 +:10C4F00097421DD0491CC9B28B42ECD8FF2C17D0F3 +:10C5000021014B1C019AC2540B33029AC250039B67 +:10C51000634F0022012B0ED00B1DC25001239B0242 +:10C520009D4216D9AA05920D08D008E00C46E1E715 +:10C53000FF2005B0F0BD0B1DC550EFE71A465303B1 +:10C540009B190E461B0208361B0AAA1A8351920A2F +:10C5500009E0002D00D101256B039B191D022D0A56 +:10C560000B460833C550891C42543D463E78204650 +:10C57000FFF7AAFE2878B04217D001F003FD01466C +:10C5800028786A6800010830105800F07FF8012808 +:10C5900007D92878696800010830085801F0E5FCDF +:10C5A00003E001F010F9F5F7AFFE0198C1E770B5AF +:10C5B0000C46054601F0E6FC064621462846FFF7F4 +:10C5C000BCFEFF2817D0364D0401204669680830AC +:10C5D0000858314600F05AF80121090340186968EB +:10C5E000A41C095D400B002901D08902081800280D +:10C5F00000D1012070BD002070BDF3B581B00F46A1 +:10C600000198FFF79AFEFF282AD0254D2E786968F9 +:10C610003246344604E0844205D026462301CC5CF1 +:10C62000FF2CF8D11CE0FF2C1AD0A64221D110011A +:10C63000085C2870FF281AD001F0A4FC2A78014673 +:10C64000120168680832805800F020F8012809D9E2 +:10C650002878696800010830085801F086FC08E075 +:10C660000020FEBD01F0AFF8F5F74EFE01E001F04D +:10C6700084FC39460198FFF79AFF22016968FF237D +:10C68000541C0B558A5C3301CA54FEBD401A00028B +:10C690000121000AC905884200D900207047000026 +:10C6A0003C0F00207372635C736F635F74696D6528 +:10C6B000722E6300F0B500241C4A01211C4B0803B4 +:10C6C000546018601B4B1C601B4C20601B480469A5 +:10C6D000E443E406E617046910252C430461184C72 +:10C6E0006160184D2960761C00E020BF1F68002F94 +:10C6F000FBD0002E03D107691026B743076190686D +:10C700008005906801D5104A10436960A16000213E +:10C7100019600121084A09031160F0BD10B50446F3 +:10C72000FFF7C8FF2060002010BD000000C50040DA +:10C7300080E100E000C1004080E200E000ED00E0A8 +:10C7400000C3004000C0004000FCFFFF70B51F495F +:10C750000A68002A17D000231D4601244A68521C8B +:10C760004A60092A00D34D600E792246B2400E6815 +:10C7700016420AD072B60B6893430B6062B64968E2 +:10C780000160002070BD052070BD5B1C092BE5D346 +:10C790000FA136200EF0DFFCF5E7012010498005DF +:10C7A00008607047EFF31081CA07D20F72B60121FB +:10C7B00081400648036819430160002A00D162B62F +:10C7C000EBE70248002101604160704770000020E3 +:10C7D0007372635C736F635F6576742E6300000031 +:10C7E00000E200E001208107086070470120810716 +:10C7F000486070471048C068C00700D001207047EB +:10C800000D488068C00700D0012070470A48406981 +:10C81000C00700D0012070470748C069704706492B +:10C820008A69D20306D589698907890F814201D1B6 +:10C83000012070470020704700040040F8B5F74C15 +:10C84000207EE17D88421CD00126F54D0027E07D49 +:10C85000215C14200A4642435019037C052B11D059 +:10C86000037C062B1CD0037C072B28D0437C012B98 +:10C8700033D0ECA1EE480EF06EFC207EE17D8842C4 +:10C88000E5D1F8BD0674E07D162807D0E07D401C98 +:10C89000E075491CC8B2AA5802210CE00020F7E755 +:10C8A0000674E07D162808D0E07D401CE075491C28 +:10C8B000C8B2AA5803219047DFE70020F6E70674C4 +:10C8C000E07D162807D0E07D401CE075491CC8B209 +:10C8D000AA580821EFE70020F7E74774E07D162803 +:10C8E00007D0E07D401CE075491CC8B2AA5807215A +:10C8F000E1E70020F7E770B50024CE4E0C207072FF +:10C90000CD4825464473047328300476C475CB485B +:10C9100005F043FCCA480575F572CA49601E886077 +:10C920007571B570F57035717570C748E839057067 +:10C9300045701420604340180574641CE4B20B2C4D +:10C94000F7D30120F5F7E0FF0020F5F7DDFF012028 +:10C95000B071F5F7A3FCBD48F5F7B2FCBC4C2070F4 +:10C96000BC48F5F7ADFC6070F5F76EFF70BD10B513 +:10C97000F5F795FFB64C2078F5F7C0FC6078F5F731 +:10C98000BDFCAC4C207A002803D0F5F746FD002012 +:10C99000207210BD70B5A74CA079002804D0A1A1C9 +:10C9A000AD480EF0D8FB70BDE07A002803D19DA100 +:10C9B000AA480EF0D0FB0126A6710025E572607A28 +:10C9C000042114225043964A801801749D488168BE +:10C9D000491C04D0691E81600120F5F795FF0020F5 +:10C9E000F5F792FFF5F776FF05F018FDF6F777F803 +:10C9F0009B480560056001209A49C0030860F6F76E +:10CA0000EDF891480078022804D0032804D1E0789A +:10CA1000002801D0A67000E0A570F6F74CF870BDB4 +:10CA200003467F490B20142242435218203A127FBA +:10CA3000002A04D0401E0006000EF4D170471422D4 +:10CA4000424351180A46803AD366012220390A77B8 +:10CA50007047012805D0032805D1002903D1002003 +:10CA600070470029FBD010B4724C00236370764AE3 +:10CA7000002890700CD002280AD007291AD208008A +:10CA800078440079001887441505070D0F1113002D +:10CA9000D37003E01B2000E03A20D07001206070CA +:10CAA00010BC70475820F8E77720F6E79620F4E7A7 +:10CAB000B520F2E710BC0020704710B562484078FE +:10CAC000F6F714F880B210BD411E1422504310B581 +:10CAD000534A8418203C0A2902D8207F002803D119 +:10CAE00050A161480EF037FB207F012804D0B3200D +:10CAF0004CA180000EF02FFB0020207710BD70B5F8 +:10CB00004D4C607B217B884201D1012500E000254E +:10CB1000F5F785FFF5F7EAFF617B227B914201D1B2 +:10CB2000012100E00021A942EBD170BDF7B5064616 +:10CB3000481E84468EB0C0B2142205905043384A35 +:10CB400085180495287C2D1D07282AD1334C0027F1 +:10CB5000E07D227E824221D0235C059A934201D15E +:10CB6000012701E0002F04D0162811D0421CA25C3E +:10CB7000225416280ED0401C227EC0B28242EBD135 +:10CB8000002F0BD0207E002806D0207E401E04E01F +:10CB90000022ECE70020EFE716202076049801221F +:10CBA00002746046234C0A2813D8142041431C48C1 +:10CBB00008182038007F00280BD00498007C01283A +:10CBC0000BD00498007C012803D01098807A0128AB +:10CBD00007D014A125480EF0BEFA1098807A0128DB +:10CBE0006DD104980E4B007C022843D00B4C207E64 +:10CBF000162870D0207EE17D401C884203D109A117 +:10CC00001B480EF0A8FA049901204874217E05986B +:10CC10006054207E162862D063E0000038110020A6 +:10CC2000541100207372635C72656D2E6300000006 +:10CC3000D40500005C1200201011002068120020B2 +:10CC4000201100203C1200207A00002067C3000061 +:10CC5000780000203DC800007D0200005E02000058 +:10CC600000F5004080E200E0CB0200001503000068 +:10CC700022030000607A059A0146904206D00146E0 +:10CC800014277843C018807C9042F8D1627A82429F +:10CC900008D1617A14225143C918897C617201213B +:10CCA000A17207E014224243D21814277943927CE0 +:10CCB000C9188A7414220C215043C018817410982A +:10CCC000007A06281DD201007944097949188F4459 +:10CCD0000C161412100EE07D002890D093E700206F +:10CCE00001E0207E401C2076B5E000210FE0B42159 +:10CCF0000DE073210BE0322109E00A2107E0062153 +:10CD000005E0FF20FDA1E0300EF025FA002110988B +:10CD100002910068401A28601099097A002912D0FF +:10CD20000221401A0102090A29601098026840682D +:10CD300010180002000A68601098807A0228109883 +:10CD400003D0007B71E00421EBE7007A002812D0C9 +:10CD500002220298121810984368104610301818D2 +:10CD60000A90E948029B4078984202D9E378002B68 +:10CD700003D00A9805E00422EBE7029BC31A0A9845 +:10CD80001818637A10300C2B1CD0637A14277B435D +:10CD9000DE4FDB195B68994214D0DD4F617ABC46E7 +:10CDA00014235943D94BC9184B6889689B1B891BAD +:10CDB0001B0209021B0A090A984237D8634535D875 +:10CDC000614533D831180A980123081A0002000A75 +:10CDD000286010998018C9680002000A471ACD4AD5 +:10CDE0009B05BC469F4201D2384610E00F1A9F4275 +:10CDF00001D260460BE0944503D9511A0818401C33 +:10CE000005E0974206D9101A4018401C40420028FD +:10CE10005FDC03E0B9A1C0480EF09DF929680A98CB +:10CE200008180002000A686000202872686810274D +:10CE300010300002000A68601098407AA8721098BA +:10CE4000007A687203280ED200280CD0FFF7D2FCBB +:10CE5000002803D007E0002011B0F0BD0298422165 +:10CE60000F1A32200290A8490878012801D003281F +:10CE700009D148780299884205D9E178002902D180 +:10CE80000299401AC7196B6828689B1B801B9C4637 +:10CE900001021B029E4A090A1B0A8F4219D8174633 +:10CEA000914216D8BB4214D8617A0C2915D0677A02 +:10CEB00061460C22039200921422944B7A43D218BA +:10CEC00093689B1B834216D80397977C0C2FF3D152 +:10CED00073E0059801F04CF9BDE70498022205992A +:10CEE0000274627A0C2A00D0627A82746172012024 +:10CEF000A07211B0F0BD0C2F5FD0002238469446CE +:10CF00001422824B4243D21853689B1B8B4225D27A +:10CF1000907BAB7A98421BD804980521059D01743B +:10CF20007E4C207E16280FD0207EE17D401C88425A +:10CF300003D172A17A480EF00EF9207E2554207E8E +:10CF4000162800D0CDE6CAE6E07D0028F1D0F4E74F +:10CF500001208446907C0C28D2D102E06146002951 +:10CF60002AD03D46009014202A46424367480621B5 +:10CF7000161831741C38007E1628684816D0017EB9 +:10CF8000C07D491C814203D15CA166480EF0E3F8E4 +:10CF90006248017E4554017E16290BD0017E491C52 +:10CFA0000176B57C0098A842DDD106E0C07D00285E +:10CFB000EAD0EDE70021F3E7009704990220534DF2 +:10CFC0000874607AB84207D104990098887405986B +:10CFD00060720120A07221E003980C2F0FD00C2862 +:10CFE00003D146A150480EF0B6F8039814225043DE +:10CFF0004019059981740499009888740EE00C28F2 +:10D0000003D13EA149480EF0A6F8039814225043DC +:10D0100040190599817404990C208874012011B07D +:10D02000F0BD70B50D46424A441900210B46101A56 +:10D030008B4103D231A13F480EF08DF83E48854226 +:10D0400003DD2EA13D480EF086F83D48854203DA07 +:10D050002AA13C480EF07FF83B48844205DA002CB8 +:10D0600001DB204670BD384800E03848201870BD0C +:10D07000401E70B5C0B21421484324494418607B57 +:10D08000062813D201007944097949188F44020C0B +:10D090000A080604002067E0B42010E073200EE0C8 +:10D0A00032200CE00A200AE0062008E0FF2013A14D +:10D0B000E0300EF050F8617B0020002954D00221AE +:10D0C0004018616840180002000AF5F70FFD0C25B2 +:10D0D0006557174A441900210B46101A8B4103D299 +:10D0E00006A114480EF037F81348854203DD03A16A +:10D0F00012480EF030F81248854229E07372635CE2 +:10D1000072656D2E630000007A000020541100202B +:10D11000FFFF3F00FFFFFF00130700003811002052 +:10D1200007020000C5030000DD030000E303000068 +:10D13000FF7F841EF50300000020A107F603000016 +:10D1400000E05EF8F70300000080841E00807BE1B1 +:10D1500003DAF749F7480DF0FEFFF748844207DA93 +:10D16000002C03DB204670BD0421A9E7F24800E053 +:10D17000F248201870BDF0B5064683B0F048019023 +:10D18000457A029534687068001B0702ED483F0A33 +:10D19000001B00900C2D2DD0142029464143EA4855 +:10D1A0000122081884464168E64892058646081B15 +:10D1B000904210D3631A93420DD3024670467245D3 +:10D1C00003D900984018401C05E073450ED9411A58 +:10D1D0000819401C404200280CDA60460295857C04 +:10D1E0000198C0790028D5D003B0F0BDD049D74808 +:10D1F0000DF0B1FF0298854226D014214843D24950 +:10D200000123401802908068CE499B058C46011B83 +:10D210008646994210D3221A9A420DD3634661453D +:10D2200003D900997144491C06E0194662452DD97D +:10D23000091A0819401C4142002905DD0298B17AFB +:10D24000807B814200D374460C2D15D0BE4914203A +:10D25000454368184268121B1202120ABA420BD2E6 +:10D26000B37A827B934200D38468857C0198C0792D +:10D270000028B9D10C2DEAD13068A042B4D0E01911 +:10D280000002000A3460706003B0F0BDA849AF48E6 +:10D290000DF061FFD8E7F0B5AD490446486885B0A8 +:10D2A000C005C00D1CD0103840B200280CDA0207AF +:10D2B000120F083A920892005118C9698007C00EEF +:10D2C000C1400806800F09E08108A24A8900891838 +:10D2D00009688007C00EC1400806800F002808D0EA +:10D2E00000272078002806D0012804D0002005B0AF +:10D2F000F0BD0127F5E72079062813D20100794413 +:10D30000097949188F44020C0A080604002018E025 +:10D31000B42010E073200EE032200CE00A200AE076 +:10D32000062008E0FF208249E0300DF014FF21794B +:10D330000020002905D002214618814D002F02D07F +:10D3400003E00421F8E70020E871694602AAA0681A +:10D35000F5F7D6FB694608228A56E06801A98018CD +:10D360000122C01C1F2801DA019209E003AAF5F787 +:10D37000C7FB6846007B002802D00198401C019042 +:10D3800000990198401810300002000A0190881B93 +:10D390000002000A00906079694688720098039044 +:10D3A000F5F73DFB009A019B121A181A6A491202FE +:10D3B0000002120A000A8A4216D8884214D8684627 +:10D3C000FFF7D9FE00990398814205D08819000221 +:10D3D000000AF5F78BFBA0600120E979002986D0CF +:10D3E000002FB0D005B0F0BD0020F6E7F3B58FB048 +:10D3F0005A480C460B9004F0D8FE594A0F99504FEA +:10D400005618584D203E00280BD05748007D002864 +:10D4100003D056A158480DF09EFE207801287CD0FC +:10D420005AE1687B16280CD0687B297B401C884217 +:10D4300003D14EA151480DF08EFE2078012804D072 +:10D440000CE0287B0028F4D0F7E7F07F002803D019 +:10D4500046A14B480DF07FFE0120F077697B0F98C5 +:10D460001422484E5143891908742078022822D08A +:10D47000687B142148438619207930726079707274 +:10D4800032460C323146A068F5F73AFB0C20305694 +:10D490000F2804DD1F3830733068401C30600C21C9 +:10D4A0007156301DE26801905018C01C1F283EDAEA +:10D4B00001200199F7E026494868C005C00D21D038 +:10D4C000103840B200280CDA0207120F083A92080E +:10D4D00092005118C9698007C00EC1400806800F2C +:10D4E00009E081081B4A8900891809688007C00E75 +:10D4F000C1400806800F002804D105201BA10002AE +:10D500000DF029FE687B1421484386190021E0684C +:10D510006A460691117006A900E0D3E0F5F7F0FA2B +:10D520006A46002010560F282EDD01202DE0AEE0C7 +:10D53000FCD00000F70300000080841E00807BE127 +:10D540005C120020FFFFFF005411002013070000B1 +:10D5500000ED00E000E400E0FFFF3F006812002063 +:10D560003012002010110020201100207372635C23 +:10D5700072656D2E6300000011050000EF040000CD +:10D58000F4040000500F0020002006994018079076 +:10D590000220B0722079307260797072A068311DFB +:10D5A000C01C06911F2801DA012009E0F5F7A8FA4E +:10D5B00068460078002804D0069806990068401C48 +:10D5C0000860307A062813D2010079440979491895 +:10D5D0008F44020C0A08060400200FE0B4200DE07E +:10D5E00073200BE0322009E00A2007E0062005E066 +:10D5F000FF20FE49E0300DF0AEFD0020217900292A +:10D6000043D002214018069071681030081807991D +:10D61000089009180698081A0C900020F871F5F780 +:10D62000FEF904463060079820180002000AF060F6 +:10D63000787A0C2825D0797A14204143EC480818D0 +:10D6400040680899029040180002000A0390707A1E +:10D650006946887402A8FFF78EFD0299039A091B98 +:10D66000121B09021202E34B090A120A0C98994292 +:10D6700007D8824205D80299069808180002000AC5 +:10D680003060F8790028C8D110E00421BAE704AA74 +:10D690000199F5F735FA6846007C002804D0019816 +:10D6A00001990068401C08602078B072687B1628D9 +:10D6B00006D0687B401C68730B9804F08EFD47E031 +:10D6C0000020F8E7F07F002804D0A320CAA1C00002 +:10D6D0000DF041FD0120F077CA490F9808742078B9 +:10D6E000022803D1C4A1C8480DF035FDC54E2079EC +:10D6F00030726079707232460C323146A068F5F7AC +:10D70000FFF90C2030560F2804DD1F3830733068C5 +:10D71000401C30600C22B256301DE1680190881820 +:10D72000C01C1F2802DA012001990BE003AA01990D +:10D73000F5F7E6F96846007B002804D001980199C6 +:10D740000068401C08602078B072AE49012008755E +:10D75000687B297B884224D07C7A0C2C23D0F5F777 +:10D760005EF914214C43A24961180A7C042A18D09E +:10D770000A7C032A15D04B6889681B1A081A1B02F9 +:10D7800000029C4A1B0A000A102B0AD3114693423E +:10D7900007D8884205D8687B297B884201D0F5F7F5 +:10D7A0008AF911B0F0BD687B297B8842F7D111B0AE +:10D7B000F0BD10B50020F5F794F810BD10B50120AC +:10D7C000F5F78FF810BD914800787047F1B50098D3 +:10D7D00002281ED08E4C607A0C2803D186A18D4879 +:10D7E0000DF0B9FC0026A6710125E572607A0321CF +:10D7F00014227F4F5043C0190174F5F761F9009866 +:10D8000000280BD001282AD003287AD07AA1824898 +:10D8100045E07E480078F4F777FDF8BD7F48007F4B +:10D82000002804D02B2074A140010DF094FC6571F8 +:10D830007A4D00202E60F5F767F8A968481C04D0DF +:10D84000012300221846F5F795F8607A617A401CAA +:10D85000C0B2142251437A5801219047F8BD0120EB +:10D86000F5F752F8607900280DD06C488068401CAC +:10D8700009D0607A617A401CC0B2142251437A58B0 +:10D8800006219047F8BD6548007F01280AD002288C +:10D8900012D0032822D0042834D057A160480DF0BC +:10D8A0005AFCF8BD2079002803D02671F5F70DF950 +:10D8B000E5705A480677F8BD207A002802D1F4F7BF +:10D8C00083FD2572607A617A401CC0B214225143F4 +:10D8D0007A580021904751480677F8BD4F4F0123F1 +:10D8E000397B78680022411A1846F5F743F8207909 +:10D8F000002803D02671F5F7E8F8E57002203877A4 +:10D90000F8BD19E0454E217870680123411A0022C4 +:10D910001846F5F72FF8207A002802D1F4F754FDC5 +:10D920002572607A617A401CC0B2142251437A5841 +:10D93000002190473577F8BD607A617A401CC0B20B +:10D94000142251437A5805219047F8BD10B5304C48 +:10D95000607A0C2803D128A132480DF0FCFB607AD4 +:10D96000617A401CC0B214225143214A525804210A +:10D97000904710BDF0B583B00C200290F5F74FF83A +:10D98000234C0090617A284801900C2920D0617ABC +:10D990001420414316480918097C042918D0617ADB +:10D9A000142251430818007C032879D0019900986B +:10D9B0000B6849681B1A081A1B0200020D4A1B0A51 +:10D9C000000A102B6CD31146934269D8884267D85D +:10D9D00012488068401C03D007A114480DF0BBFB1F +:10D9E00000206071607A0C282AD121E0FCD0000070 +:10D9F00054110020FFFF3F007372635C72656D2E4F +:10DA000063000000201100201E05000078000020A7 +:10DA10005C12002054050000A70500003C12002005 +:10DA20009B050000AE0500004C120020EA05000036 +:10DA30006078002804D0FE48C17841708178017078 +:10DA4000607A0C2815D0607A1421FA4A484380186D +:10DA5000007C04280DD1607A0290607A01211423A1 +:10DA6000584380180174607A58438018807C607233 +:10DA7000A172F14D687B297BF04F884233D0F04E84 +:10DA8000287B142148438019007CC05D0128287B35 +:10DA900007D048438019007CC05D02282FD044E0A5 +:10DAA000FCE1142148438019807A01280AD0287BA0 +:10DAB0000221142250438019007CC155287B16286E +:10DAC00008D009E0287B0021142250438019007CF3 +:10DAD000C1552AE0002001E0287B401C2873687BA8 +:10DAE000297B8842CCD1D74D287D00284DD0287C79 +:10DAF000C15D012928D0C05D022830D03BE0287BE1 +:10DB0000142148438019807A012803D0CEA1D1483E +:10DB10000DF021FB297B00201422514389198872C2 +:10DB2000297B51438919097CC855287B1421484316 +:10DB30008219287B48438019017C0098FEF7F6FF84 +:10DB4000287B1628C8D1C5E7A97A012904D002216B +:10DB5000C155002028750EE00021C1550BE0A87AC0 +:10DB6000012804D0C520B8A1C0000DF0F4FA0020AF +:10DB7000A872297CC855287D002806D0297CB14A86 +:10DB80000098FEF7D3FF0020287502980C281ED0BD +:10DB900014214843A7494018017C012917D10721C6 +:10DBA0000174AD4D287E16283CD0287EE97D401CAE +:10DBB000884203D1A4A1A9480DF0CDFA297E02988C +:10DBC0006854287E162831D0287E401C2876607A3A +:10DBD0000C287DD0A07A00287BD00020A072617A2A +:10DBE0001420414393480E189D49B56873680A464E +:10DBF000F6687C32CB67966055609A4D697E002945 +:10DC000016D00226617A14228A4851430818407BB4 +:10DC100006281BD201007944097949188F440A1457 +:10DC200012100E0CE87D0028C4D0C7E70020CDE715 +:10DC30000426E7E700210FE0B4210DE073210BE09B +:10DC4000322109E00A2107E0062105E0FF2086498C +:10DC5000E0300DF080FA00212973687E022801D09F +:10DC6000012810D12869009A4018821A1202120A5B +:10DC7000422A08D93238032100026976000A286155 +:10DC80003220287308E0322906D2207A00280AD1EF +:10DC9000F4F79AFB012005E0207A002803D0F4F77E +:10DCA000BCFB00202072624910224878207009785D +:10DCB000012901D0032906D101212171297B884244 +:10DCC00001D9421A1032A378002B00D0921C01E037 +:10DCD0008DE09BE02179002901D1002B5DD0944695 +:10DCE000624A00990092019A176852687F1A511A85 +:10DCF0003F0209023F0A090ABC451BD85B4A97420A +:10DD000018D8009A914215D8297B884223D92B69CB +:10DD1000421A9A1A1202120A101880190002000AF6 +:10DD20002A616860002914D0032028770006000EBD +:10DD30003ED14CE000202071A070297B002925D025 +:10DD40002869401880190002000A686002202877BC +:10DD50002EE00120E9E781420BD92A69511889197F +:10DD60000902090A6960002801D00420DDE70220C9 +:10DD7000DBE7002B03D134A13D480DF0ECF9286915 +:10DD800080190002000A6860002004E029698919EE +:10DD90000902090A6960287719E0287B00280FD05A +:10DDA0002969081880190002000A68600220287793 +:10DDB00028690123811900221846F4F7DBFD09E0E8 +:10DDC000286980190002000A686000202877012075 +:10DDD000F4F79AFD607A1421484316490C22401842 +:10DDE0008256012300206968F4F7C4FD0EE001208B +:10DDF000F4F78AFD0020F4F787FDF4F76BFD207A35 +:10DE0000002803D0F4F709FB00202072A078002836 +:10DE100004D0F4F75AFE0020E070A070607800286B +:10DE200004D00348C178417081780170207921E0E5 +:10DE30007A00002054110020101100202F12002021 +:10DE4000500F0020201100207372635C72656D2EEC +:10DE5000630000000C060000381100203A060000A4 +:10DE6000D01100203C120020FCD00000FFFF3F003A +:10DE70008C060000002806D00020CF49E070097809 +:10DE8000002900D12071CD48017EC07D814203D0A0 +:10DE9000CB484078F4F738FA0120E07103B0F0BDC8 +:10DEA000F0B5C84C0746607A83B00C2803D1C6A1F0 +:10DEB000C8480DF050F9607A1421C74E48438019C4 +:10DEC000007C032804D06F20BFA100010DF043F9AE +:10DED000C24DA868401C03D0BBA1C1480DF03BF95E +:10DEE000607A1421484381190C20085600216A46A3 +:10DEF00000911171C01901AA6946F4F701FE6A4642 +:10DF0000042010560F2801DD012000E000200099B8 +:10DF10004018696840180102090AA9606079002860 +:10DF200004D0012300221846F4F724FD03B0F0BD0D +:10DF300070B5AD4CAB4A0B1AA34214D3451AA54297 +:10DF400011D3934203D9101A43185B1C0BE095427E +:10DF500004D9511A0818401C434204E0A349A448BC +:10DF60000DF0F9F80023184670BD10B501460123E5 +:10DF700000220220F4F7FEFC10BD10B50220F4F7D9 +:10DF8000C3FC10BD10B5F4F74AFD10BDF0B58D4DC2 +:10DF90000446E87A83B0002803D18BA195480DF0A0 +:10DFA000DAF8642C4DD3944900200246091B8241C3 +:10DFB00047D39248417B007B814242D19048007D0B +:10DFC00000283ED1687A1421834F4843834EC519F7 +:10DFD000306801AA00196946F4F792FD69460420E9 +:10DFE0000856002802DD0098401C0090A96800989F +:10DFF0006B680A18D21A1202824B120A9A4220D86F +:10E00000AA7C0C2A08D014235A43D2195268511AF8 +:10E010000902090A814214D3B068401C05D00120CE +:10E02000F4F772FC0020C043B06030680019306023 +:10E03000A868009940180002000A7061012003B02E +:10E04000F0BD002003B0F0BDF8B50646401EC5B2D5 +:10E050001420614968434418207C002803D15AA148 +:10E0600069480DF078F86548017B407B81420CD00F +:10E07000664A14234B439B181B7CB3420CD01629D1 +:10E080000CD0491CC9B28142F3D15D48017D002901 +:10E0900064D0007CB04261D10020F8BD0021F1E7DE +:10E0A000217C052905D0217C062902D0217C072965 +:10E0B00028D101212174C17D0023027E8A4221D012 +:10E0C0000246565CAE4201D1012301E0002B04D090 +:10E0D000162911D04E1C965D565416290ED0491C97 +:10E0E000167EC9B28E42ECD1002B0BD0117E0029D6 +:10E0F00006D0117E491E04E00026ECE70021EFE780 +:10E1000016211176617C00292AD06774C17D002315 +:10E11000027E8A4224D0425CAA4201D1012301E05E +:10E12000002B04D0162912D04A1C825C42541629B6 +:10E130000FD0491C027EC9B28A42ECD1002B0FD00D +:10E14000027E0146002A06D00A7E521E04E000220A +:10E15000EBE70021EEE716220A7601E017480027D8 +:10E16000217C01299CD1617C002999D10120F8BD35 +:10E1700070B505461420184A0521684380180174BB +:10E180000E4C207E162811D0207EE17D401C884256 +:10E1900003D116491E480CF0DEFF207E2554207E58 +:10E1A000162807D0207E401C207670BDE07D002818 +:10E1B000EFD0F2E70020F7E77A00002038110020C6 +:10E1C000780000205C1200207372635C72656D2E13 +:10E1D00063000000EF060000541100203C120020F4 +:10E1E000F1060000FF7F841E0020A107FCD0000084 +:10E1F0001307000032070000FF1FA10710110020C5 +:10E2000020110020FFFF3F006F070000500F00208B +:10E210000702000010B509F063FC042803D009F0E0 +:10E220005FFC052803D106F0D1FE00280BD104F0D5 +:10E2300007F9032803D004F009F9032805D109F0F0 +:10E24000B0FD002801D0012010BD002010BDF0B5A8 +:10E2500085B00746002668460D4606726946384670 +:10E2600005F05CFA00287DD16846007800280BD0C4 +:10E2700009F009FDB84275D00022294638460AF057 +:10E28000CCFE00283ED120E006F077FCB842F2D068 +:10E2900000222946384608F01DF900287DD1019C4E +:10E2A0009020005D2834002804D1607E002801D031 +:10E2B000012000E000200490204660300390807828 +:10E2C00006F08AFB002804D008E0019C2834607E18 +:10E2D000F1E7FF20FDA1DA300CF03DFF20462030B1 +:10E2E000417B00290FD0817B89070CD56E700121FD +:10E2F0002970AE70AF80C17BA971218E2981618E9A +:10E300006981467349E0039802A9807806F030FAE3 +:10E31000002804D1FF20EDA1EE300CF01CFF684670 +:10E32000007A002809D06E700D202870AF806846F2 +:10E33000007AE8800120A8702FE0049800282FD0F0 +:10E3400006F0B5FB00282BD068460078002806D1DF +:10E3500001988030406A4188B94200D10670039824 +:10E36000807800E01CE006F0CAF8002803D1D7A1AD +:10E37000DA480CF0F0FE6E700A202870AE70AF80A4 +:10E38000A07EA8716676684605F07EFA002804D063 +:10E39000D248CEA10E300CF0DEFE012005B0F0BD5B +:10E3A0000020FBE77CB5CEA103C9CF4D002401912D +:10E3B0000090AC7001F067FD2946EC7004204039F4 +:10E3C000088710204887C81DC84AF9304280047168 +:10E3D000C280E03844740C7084730475C0300477D4 +:10E3E0001D300522694604460CF02BFD28462146C7 +:10E3F000BC3008F0F7F97CBDF8B5BD4C0D46606047 +:10E40000217006F057F805F0D1F8FFF7CBFF207820 +:10E4100009F03AF9B4498431084681380F46064676 +:10E4200006F08CFC606808F0D8F8284604F06EFC12 +:10E430003946304609F057FC60680AF08AFE01F060 +:10E4400022FDA9480021C170F8BDFEB50E461D464B +:10E45000144601A905F062F9002839D102988030EC +:10E46000807A06F079F800280CD0684606F087F824 +:10E47000002806D0002C03D006F01DF8A04206D2DA +:10E480000020FEBD91A19B480CF065FEF8E70098C6 +:10E4900005F0AAFB3146009805F0ABFBE2B2294635 +:10E4A000009805F063FD06F08FF8002804D191482C +:10E4B00086A11E300CF04FFE68460079012807D176 +:10E4C00001A801F0E7FC8A48002180688030418281 +:10E4D0000120FEBD30B40179002904D0012907D004 +:10E4E00030BC00207047831D42880488022103E06D +:10E4F00042880488831D0121204630BCA5E7FFB572 +:10E50000794C85B00E460746C0346088694608805D +:10E51000154602A905F002F9002811D0002168462D +:10E5200005F059F9002823D1684602A9008805F0B2 +:10E53000F5F8002804D06F4864A13C300CF00BFEC5 +:10E5400068460088388068460088608066480021F8 +:10E55000C23005F040F9002802D00020C04360809E +:10E5600003988030807A06F037FA002803D007E05D +:10E57000002009B0F0BD5F4854A156300CF0EBFD0F +:10E5800004A806F03CFA0028F3D0049805F068FBD4 +:10E590003070022807D0012805D056484BA17230B0 +:10E5A0000CF0D9FDE4E70899049805F0F6FC288002 +:10E5B000002804D14F4845A165300CF0CCFD06F091 +:10E5C00045FA002804D1E92040A180000CF0C3FDE9 +:10E5D0000120CEE73EB50446831D02AA694601A884 +:10E5E000FFF78DFF002813D068468088208068469A +:10E5F000008960800020607168460078012808D09A +:10E60000022806D03B4831A192380CF0A4FD01202D +:10E610003EBD2071FBE7FEB5040004D135482BA1B7 +:10E620007E380CF098FD304D0026203D687C002897 +:10E6300008D0667010202070A87CA070E87CE07084 +:10E640006E7430E0284F403F3878002808D02C22E4 +:10E65000B91C20460CF0F5FB0E2020703E7022E025 +:10E66000A87B002809D00120E070E87BA070287CFE +:10E6700060700F202070AE7315E01B480221C63079 +:10E68000029005F0A8F8002871D1174FC037F8881C +:10E690000190F888042808D0052831D02146FFF7DA +:10E6A000D6FD002859D00120FEBD0021204606F0ED +:10E6B00019FA0028F7D1287D00284ED06670132063 +:10E6C00020701C21A01C0CF019FC15E07372635C17 +:10E6D0006C6C5F6374726C2E630000000D020000AE +:10E6E000FFFFFFFF1F000000AC120020FFFF000033 +:10E6F00080000020390300000220A0702E75D2E7B0 +:10E700000021204609F098FA002826D02078132806 +:10E71000C9D1A0783C28C6D1A088694604F07CFF06 +:10E72000002803D0FD49FE480CF015FD009880300C +:10E73000807A05F0E4FE002804D1F948F749001D6D +:10E740000CF009FD009804F09FFF0028ABD0F448BE +:10E75000F24908300CF0FFFCA5E70221029805F011 +:10E760003AF8002803D1F9880198814291D100201C +:10E77000FEBD50E710B508F011FF002804D0E848AE +:10E78000E649BE300CF0E7FC07F01FFF06F09AFAEE +:10E7900004F07AFA002804D07920E049C0000CF097 +:10E7A000DAFC0AF0CEFC002804D03D20DB49000151 +:10E7B0000CF0D1FC09F070FA002804D0F520D749FC +:10E7C00080000CF0C8FCFFF7EDFD04F0ABFE002864 +:10E7D00004D0F720D14980000CF0BDFC05F01CFEF0 +:10E7E00001F051FBCF480021C17040380171012177 +:10E7F00041710222C270017010BD10B5C94C403C7D +:10E800002078002804D00A210E2001F002FB10BD60 +:10E81000FFF700FD002801D00C2002E001F033FBDF +:10E8200000202071012060710A21E170207010BD6C +:10E8300070B5BC4C0646403C2078002804D03A21F4 +:10E840000E2001F0E6FA70BDFFF7E4FC002801D0CD +:10E850000C2010E0B34DE87808280BD20001001915 +:10E8600010223146443001F0DEFAE878401CE870AE +:10E87000002000E007202071012060713A21E17042 +:10E88000207070BD70B5A74C0646403C207800282B +:10E8900004D00B210E2001F0BCFA70BD30780028A6 +:10E8A00003D0012801D0122015E09E4D8035287933 +:10E8B000082817D2FFF7AEFC002801D00C200AE090 +:10E8C000984833782979721C883001F098FB2879B0 +:10E8D000401C287100202071012060710B21E17023 +:10E8E000207070BD0720F6E710B58E4C403C2078B4 +:10E8F000002804D039210E2001F08BFA10BDFFF75B +:10E9000089FC002801D00C2002E086490020C87054 +:10E910002071012060713921E170207010BD8148A3 +:10E9200010B540380178002904D00F210E2001F0E5 +:10E9300070FA10BD002101710E2181700F21C1708C +:10E94000FF2181710021C9430181774949680A7813 +:10E9500082728A8882814988C18101214171017056 +:10E9600010BD704910B540390A78002A04D03C2106 +:10E970000E2001F04EFA10BD6A4A0088C032508065 +:10E980000120107100220A7148713C22CA7008707F +:10E9900010BD10B5634C403C2078002804D02B21DA +:10E9A0000E2001F036FA10BD0821A01DFDF7BCFBBA +:10E9B00000202071012060712B21E170207010BDBA +:10E9C00010B5584C403C2078002804D005210E207A +:10E9D00001F01FFA10BD05F06EFDE08005F0C6FEE7 +:10E9E000207200202071012060710521E1702070EB +:10E9F00010BD10B54B4C403C2178002904D031218A +:10EA00000E2001F006FA10BD00214156042911D054 +:10EA100000290FD0081D0DD0001D0BD0001D09D0FE +:10EA2000001D07D0001D05D00A3003D00A3001D0E8 +:10EA3000122003E0084601F033FB00202071312052 +:10EA4000E07001206071207010BD30B5354D044676 +:10EA5000403D28788DB0002805D02A210E2001F0F5 +:10EA6000D8F90DB030BD10222146684601F0DBF91F +:10EA70001022A11804A801F0D6F9684603F00BFC97 +:10EA800010222C46A81D08A901F0CDF90020207104 +:10EA90000E20A0702A20E070012060712070E0E755 +:10EAA000F0B5204C85B0403C2078002804D03B21B4 +:10EAB0000E2001F0AEF971E40020A07119486946FA +:10EAC000C0304088888002A904F028FE002805D0C4 +:10EAD000002101A804F07FFE002865D16846114D91 +:10EAE00081880180283D684602A9008804F016FE4E +:10EAF000002803D009490D480CF02DFB039E04A902 +:10EB000037468837B878283605F04BFE002804D100 +:10EB100006480249401D0CF01EFB09E0CCE600004F +:10EB2000FF020000AC12002080000020140500004D +:10EB3000767EB87805F050FF002803D1FB49FC48E9 +:10EB40000CF009FB05F0B3FF0121484031460143B9 +:10EB50001FD06A461188A279FD2352001219118133 +:10EB6000A2794000515D4908490031435155A279CD +:10EB70001940014351556A46107C002802D00420F8 +:10EB8000014301E0FB200140A0794155A079401CE0 +:10EB9000A0710021684604F01EFE002804D16846DA +:10EBA0000188808881429ED10020207101206071FF +:10EBB0003B21E17020707EE770B5DE4C0546207881 +:10EBC000002804D034210E2001F023F970BD08F094 +:10EBD00087FF052804D0284608F03FFD002000E00C +:10EBE0000C202071012060713421E170207070BD13 +:10EBF00010B5D04C2078002804D00E21084601F032 +:10EC000008F910BD0622CC49A01D0CF01AF900200D +:10EC10002071012060710E21E170207010BD70B56F +:10EC2000C44C06462078251D002804D032210E2031 +:10EC300001F0EFF870BD3146002009F032F928707C +:10EC400000280CD100213246084606F080F92870D1 +:10EC5000002804D106223146B7480CF0F2F8012012 +:10EC600060713221E170207070BD70B5B14C054605 +:10EC70002078002804D030210E2001F0CAF870BDA1 +:10EC800008F073FD002803D104F0DEFA00280DD04F +:10EC9000287804F08AF8287806F0C0F9002020715E +:10ECA000012060713021E170207070BD0C20F6E70A +:10ECB000F8B5A04C06462078251D002804D0172161 +:10ECC0000E2001F0A6F8F8BD3146012009F0E9F860 +:10ECD0000127287000280FD13246012106F037F9AC +:10ECE0002870002808D19348062231463C300CF0A9 +:10ECF000A8F890484030877067711720E07027703F +:10ED0000F8BDFEB58B4C05462034A07B002804D00E +:10ED100028210F2001F07DF8FEBDA8781A2824D004 +:10ED20000EDC03000CF038FB16333333333321335E +:10ED300033333333333333333333333321212133D9 +:10ED40002A2824D00ADC1E3803000CF025FB0C20F6 +:10ED5000202020202020202020200E203A380300D0 +:10ED60000CF01AFB04150315031528887349884213 +:10ED70000DD81F21E173282121740120A073288858 +:10ED8000694604F0CBFC002803D0022014E01220D6 +:10ED900012E068460078019F00280FD0C637019E18 +:10EDA00000280DD0C736684601F05CF8002802D074 +:10EDB0003878002806D00C20E073FEBD9C37EEE7C3 +:10EDC0009D36F0E701203870A87830700020E0739D +:10EDD000684601F05FF8FEBDF0B5564C0746207856 +:10EDE00085B0002804D025210E2001F012F862E63B +:10EDF000388802A904F092FC4E4E00210836002803 +:10EE00000CD00220207131603171E1800E20A070A1 +:10EE10002520E0700120607120704CE6039D28469B +:10EE20000A30483501900020A87505223046019926 +:10EE30000CF007F8A87D0028F5D13888E080E5E7D8 +:10EE4000FEB53C4C06462034A07B002804D010219F +:10EE50000F2000F0DEFFFEBD1F20E07310202074A5 +:10EE60000127A7733088694604F058FC002810D1A8 +:10EE7000684600F0F7FF00280BD06846019D007837 +:10EE800028350028019806D0CA300178002909D118 +:10EE900004E0022007E08030406AF6E72035697B15 +:10EEA000002902D03A20E073FEBDA97B89070DD16D +:10EEB0000621017068460078002804D10198318845 +:10EEC0008030406A4180684600F0E4FF0020E07333 +:10EED0006F73FEBD70B5174D04462878002804D026 +:10EEE00038210E2000F095FF70BD1F2028710120F1 +:10EEF00068713821E97028702078002808D001282E +:10EF000006D0022804D0032802D01220287170BD38 +:10EF1000002606F051F8207807F061FC207808F010 +:10EF2000E6FF20780AF0ABFA2E7170BDCCE6000047 +:10EF30001F0500006C1200208C000020FF0E000056 +:10EF4000F8B5FE4D06462878002804D01D210E2075 +:10EF500000F05FFFF8BD1F202871012068711D219E +:10EF6000E970287008F0BCFD0C27042857D005284C +:10EF700055D0B0791224012801D000281DD1307855 +:10EF8000002801D0012818D1F079002801D00128EB +:10EF900013D17088EA49021F30248A420DD2B28808 +:10EFA000121F8A4209D22887B0886887B079002466 +:10EFB000012804D000280CD016E02C71F8BDDF48E1 +:10EFC0004030807800282AD0DC4A3C3201210846B3 +:10EFD00002E0DC4A0021012005F0B9FF040003D063 +:10EFE000D949DA480CF0B7F8F079012801D00028A7 +:10EFF00002D105F0C8FF0446002C01D01F2011E00B +:10F000003078012802D0002803D00AE00021022035 +:10F0100001E00021012005F0C6FF002801D02F717A +:10F02000F8BD00202871F8BD70B5C44C21780029C6 +:10F0300004D01E210E2000F0ECFE76E71F21217186 +:10F04000012161711E22E270217002781221012AD1 +:10F0500001D0002A04D14078002803D0012801D033 +:10F06000217162E700260C25012A09D008F038FD3D +:10F07000052803D008F042FA002806D0257154E78D +:10F08000618F208F08F083FBF6E726714DE7F0B51E +:10F09000AD490446143103C987B0A84D0591203508 +:10F0A0000490A87B002805D021210F2000F0B1FE9C +:10F0B00007B0F0BD1F20E873212028740126AE732D +:10F0C00022889F4B111F3020994243D261880F1F25 +:10F0D0009F42FAD291423DD8E2899D4B911F9942BD +:10F0E000F3D2218A8F1F9F42EFD28A42F3D8628ADD +:10F0F000FF23F4339A42EED8A28A954F13460A3B77 +:10F100003F1FBB42E1D2C9088A4223D9E18A228B40 +:10F110009142E0D821791220002902D0012919D189 +:10F1200002E061790029F9D1217B002901D0012970 +:10F13000F5D108F0D5FC05280BD008F0D1FC042847 +:10F1400007D0287D002804D105F017FD81498842A9 +:10F1500001D00C20BDE0684604F0AEFA002801D0D2 +:10F160000920B6E001220321009804F0E6FF009F89 +:10F17000042178880F3703903846FCF7D5FF3846CE +:10F18000039905F0C2F874A0009F0068069003215F +:10F1900006A81337FCF751FF002006A90A5C3A5471 +:10F1A000401CC0B20328F9D30098218A8180618A6B +:10F1B000C180A18A01810146002720318F73CF735E +:10F1C0006179002902D0012903D101E0C77600E06E +:10F1D000C6760622A11D1C300BF033FE00980522D6 +:10F1E00004A90A300BF02DFE0098A0300673694682 +:10F1F0000F71012101A8FCF720FF6946087941073A +:10F20000C206490F920F80068918C00F0818694678 +:10F210000871401D009B0928987601D20830987625 +:10F2200001220021184604F088FF00988A3005F07A +:10F2300044F9002804D145484349FC300BF08BFFCA +:10F24000207B002806D0012808D03F4943480BF016 +:10F2500082FF40E000213B4A012008E0374840306F +:10F26000807800280FD0354A01213C32084605F04D +:10F270006EFE00282FD000988030807A05F03FF98C +:10F28000002816D01AE000988030807A05F037F90F +:10F29000002804D131482C490D380BF05CFF009850 +:10F2A00004F0DAFA002800D153E72C48264909383F +:10F2B00041E02A482449C01D0BF04DFF009804F09E +:10F2C000CBFA002804D025481F490B300BF043FF30 +:10F2D0001F20E873ECE62079012801D0002803D133 +:10F2E00005F051FE00280CD10320009905F05BFECB +:10F2F000002806D162882188009808F0F5F90028D6 +:10F3000007D000988030807A05F0F9F8002805D001 +:10F3100009E00098A0300770EF73C9E60F480A496A +:10F3200031300BF018FF009804F096FA0028BBD09B +:10F330000A48054935300BF00EFF0AE76C12002031 +:10F34000FD3F00008C000020CCE600000607000016 +:10F350007B0C0000FFFF0000112233001C0800009E +:10F3600038B5F94C2078002804D022210E2000F076 +:10F3700050FD38BD1F202071012565712220E070ED +:10F38000257008F0ADFB052802D00C20207138BD97 +:10F3900000202071684608F059FA0028F7D100983B +:10F3A0008030807A05F0ABF8002803D1E749E848BF +:10F3B0000BF0D1FE009804F04FFA002804D0E44886 +:10F3C000E249001D0BF0C7FEDF4820300575E1481B +:10F3D0000078F2F799FF38BDF8B5DB4D04462035CB +:10F3E000A87B002804D023210F2000F012FDF8BDD7 +:10F3F0001F20E873232028740120A8736288D64B4D +:10F40000911F302099424CD2A1888E1F9E4248D233 +:10F410008A4246D8E288FF23F4339A4241D82289AF +:10F42000CD4E13460A3B361FB3423AD2C9088A4230 +:10F4300037D96189A289914233D80026208869464C +:10F4400004F05EF9022700280BD1009800F0F8FCC8 +:10F45000002806D000988030416A0A78002A06D138 +:10F4600001E0EF73F8BD826B1278002A01D03A20D8 +:10F4700017E005228A71416A0E81426AA188518192 +:10F48000426AE1889181426A2189D181406A018979 +:10F490004289914204D88179082901D8914202D346 +:10F4A0001220E873F8BD2188418000988030406ABE +:10F4B0000770EE73F8BDFEB5A34C06462078002811 +:10F4C00004D024210E2000F0A4FCFEBD01256571AE +:10F4D0002420E0702570304604F039FF002801D068 +:10F4E000002000E0122020710028EED1964F052266 +:10F4F000E03738463D7731461D300BF0A2FC002640 +:10F500003E77701E69460880684604F031F900288D +:10F5100019D168460788684601A9008804F0F0F808 +:10F52000002804D08A4889498F300BF014FE0198D6 +:10F53000A0300573684604F01BF9002803D1684623 +:10F5400000888742E7D12671FEBD38B57E4C05465E +:10F550002034A07B002804D026210F2000F059FC85 +:10F5600038BD1F20E073262020740120A073288856 +:10F57000694604F0C5F800280BD1009800F060FC43 +:10F58000002806D000988030416A0A78002A06D107 +:10F5900001E002200DE0806B0078002801D03A20C5 +:10F5A00007E007200870009829888030406A418071 +:10F5B0000020E07338BD10B5634C2078002804D0DB +:10F5C00006210E2000F025FC10BD002020710E2029 +:10F5D000A0700620E0700821A01D0BF08FFCA1791F +:10F5E00001200143A1716071207010BD38B5564CE7 +:10F5F00005462034A07B002804D02C210F2000F0E9 +:10F6000008FC38BD1F20E0732C2020740120A0735B +:10F610002888694604F074F800280CD1009800F09E +:10F620000FFC002807D00098014680314B6A1A78F9 +:10F63000002A06D101E0022025E0896B0978002923 +:10F6400001D03A201FE04030007F00281DD0082262 +:10F65000A91C181D0BF0F5FB00986A898030416ADF +:10F660008A81406A294610220C310E300BF0E9FBEA +:10F67000009803218030406A01700098298880300A +:10F68000406A41800020E07338BD0C20FBE770B574 +:10F690002D4E044630780C25002804D018210E2069 +:10F6A00000F0B7FB41E402F0CBFE032865D002F086 +:10F6B000CDFE032861D06079002801D001282DD12A +:10F6C000A079002801D0012828D1A07B002805D0EE +:10F6D000012803D0022801D003281FD1607B002815 +:10F6E0001CD0C0081AD1628801208003824202D84F +:10F6F0002188814203D9207901280FD119E020798E +:10F70000002806D0012814D0022805D0032805D1EE +:10F7100002E0202A0BD30CE0A0290AD22079042889 +:10F7200005D12088202802D36188884201D912257A +:10F7300023E00548217920308175607900280DD0BB +:10F7400001280FD019E000006C120020CCE6000068 +:10F750007F080000800000207B0C0000FA4A002196 +:10F76000204607E0F9488078002806D0F74A0121B2 +:10F77000121F204608F01BFB0546012035717071F1 +:10F780001821F170307058E410B5F04C403C2178ED +:10F79000002904D01A210E2000F03BFB10BD017897 +:10F7A0001F2902D91220207106E000212171027860 +:10F7B000411C104608F09EFB012060711A21E17087 +:10F7C000207010BD10B5E14C403C2178002904D0D8 +:10F7D00020210E2000F01DFB10BD01781F2902D949 +:10F7E0001220207106E0002121710278411C104690 +:10F7F00008F06FFB012060712021E170207010BDC6 +:10F80000F8B5D24C403C2178002904D01B210E20B1 +:10F8100000F0FFFAF8BD012666710C212171007815 +:10F820000025012804D000285CD01220207188E037 +:10F8300002F006FE002835D102F008FE002831D182 +:10F8400008F021FAC24988422CD108F07AFA00283F +:10F8500077D0684603F0C6FEBB4A00990C3A916027 +:10F86000002803D0BB49BC480BF075FC01220321E2 +:10F87000009804F008FC009808F0CDFB00988A304E +:10F8800004F01BFE002804D1B348B24908300BF045 +:10F8900062FC009803F08CFA002851D0AE48AD49C4 +:10F8A0000C301CE002F0CCFD02284AD102F0CEFD63 +:10F8B000002846D1A5482038807D002841D0012865 +:10F8C0003FD004283DD008F03CFA002839D0002071 +:10F8D00003F06EFA002833D09F489E4924300BF085 +:10F8E0003AFC2DE002F0ACFD032804D002F0AEFD9E +:10F8F000032820D025E002F0A6FD0090002003F0B0 +:10F900004FF900281DD1257100988030807A04F0CD +:10F91000F6FD002804D190488E493E300BF01BFCC8 +:10F92000009803F0B1FE00280BD08B488949423083 +:10F930000BF011FC05E0002003F032F9002800D1A3 +:10F9400025711B20E0702670F8BD38B57F4C054648 +:10F95000403C2078002804D02D210E2000F059FAD8 +:10F9600038BD2888694603F057FE002801D00220E0 +:10F970000FE00098CA21095C002909D13321095CF4 +:10F980000F2901D0102903D1FC21095C00290BD0DB +:10F990000C2020710E20A0702D20E0702888E080BF +:10F9A00001206071207038BD1022A91CD8300BF0E6 +:10F9B00048FA00980421C03081720020E9E738B588 +:10F9C000624C0546403C2078002804D02E210E20B1 +:10F9D00000F01FFA38BD2888694603F01DFE002894 +:10F9E00001D002200CE000980146C030827A002A43 +:10F9F00005D12031C97C0F290DD010290BD00C2046 +:10FA000020710E20A0702E20E0702888E080012058 +:10FA10006071207038BD052181720020F0E77CB54F +:10FA20004A4C0546403C2078002804D037210E205F +:10FA300000F0EFF97CBD2888694603F06FFE0028CE +:10FA400007D002202071012060713721E170207001 +:10FA50007CBD01987F22014628300272427200224A +:10FA60008272A87822318870E878C8702879087185 +:10FA70002271E8E71CB5354C403C2178002904D0C0 +:10FA800013210E2000F0C5F91CBD0088694603F063 +:10FA900045FE002801D0022006E001982421095CDF +:10FAA000801C012902D00C20207107E0002201995E +:10FAB00022712831097A21720088E080012060716A +:10FAC0001321E1700E21A17020701CBDF8B51F4CF0 +:10FAD0000546403C2078002804D035210E2000F057 +:10FAE00098F9F8BDA878002801D0012804D1A88889 +:10FAF000FF21F531884201D91220207128886946FA +:10FB000003F08AFD0126002806D0022020716671CC +:10FB10003520E0702670F8BD009800270246C030FE +:10FB20000770AB8801464380104680300677AA787C +:10FB3000012A00D000220A70407F002801D003F083 +:10FB400027FA2771E3E700008C000020AC120020A8 +:10FB5000FFFF0000CCE600002D0A0000F8B5D44EEF +:10FB600004463078002804D03D210E2000F051F9E1 +:10FB7000F8BD2088694603F04FFD002801D002201F +:10FB800027E0009F6488FD883A896800B988401C96 +:10FB9000844217D3C7484143800050430BF0BAF961 +:10FBA000401EFF2180B2F531884200D908468442C8 +:10FBB00000D22046691C401C0BF0ACF96D1C684358 +:10FBC000401E85B2E820C05D002800D17D84F5800C +:10FBD00000203071012070713D21F1703070F8BD4E +:10FBE00070B5B34C05462078002804D033210E2090 +:10FBF00000F00FF956E502F023FC002801D00C209C +:10FC000018E02978002911D00A290FD014290DD025 +:10FC10001E290BD0282909D0322907D04B2905D01D +:10FC2000642903D0FF2901D0122003E0284603F005 +:10FC30004BF900202071012060713321E1702070A8 +:10FC400030E570B59A4C05462078002804D03E2156 +:10FC50000E2000F0DEF825E502F0F2FB002803D1CB +:10FC600002F0F4FB002801D00C2003E0287808F013 +:10FC70004DF900202071012060713E21E17020705B +:10FC800010E510B5017801240B000BF085FB3FBF98 +:10FC9000BF21BFBF4C94BFBFBF2427BFBF464F612A +:10FCA000BFBF59BFBFBF2B97BF9B9FBF797DBFA36E +:10FCB0008185888C6590BF5DBF555275A7ABBF37F6 +:10FCC0002F33BB6DAFBF71423F3B4969B3B7C00033 +:10FCD000FEF750FD9BE0FEF790FD98E0801CFEF7DC +:10FCE000D1FD94E0801CFEF7E3FF90E0801CFEF75E +:10FCF00080FE8CE0801CFEF792FF88E0801CFEF7FF +:10FD0000B4FF84E0801CFEF793FD80E0FEF7ECFD7D +:10FD10007DE0801CFFF7DEF879E0FEF769FF76E012 +:10FD2000FEF7BEFE73E0FEF74BFE70E0FEF7F7FD58 +:10FD30006DE0FEF72EFE6AE0801CFEF786FE66E0B0 +:10FD4000801CFFF797FE62E0801CFEF7DAFF5EE0A2 +:10FD5000801CFFF775F85AE0801CFFF73DF856E06D +:10FD6000801CFEF7FEFD52E0801CFEF725FF4EE0F2 +:10FD7000801CFFF754FE4AE0801CFFF737FC46E08A +:10FD8000801CFFF7DDF842E0801CFFF74DF93EE0F4 +:10FD9000801CFFF77CF93AE0FFF7E2FA37E0801CBD +:10FDA000FFF71AFB33E0801CFFF785FB2FE0801C78 +:10FDB000FFF7CBFB2BE0FFF7FEFB28E0801CFFF7F3 +:10FDC00066FC24E0801CFFF7DFFC20E0801CFFF7CE +:10FDD00017FD1CE0801CFFF7F5FC18E0801CFFF706 +:10FDE000B4FD14E0801CFFF7EAFD10E0801CFFF773 +:10FDF0006DFE0CE0801CFFF7B1FE08E0801CFFF7F1 +:10FE000020FF04E0801CFFF7EBFE00E0002420460A +:10FE100010BD274A2032537C002B03D19074D1743B +:10FE200001205074704730B5134606E0CC18203CD2 +:10FE3000D51AE47F5B1E4455DBB2002BF6D130BDF2 +:10FE4000017800290CD14121095C002908D18030BA +:10FE5000017C002904D0007C042801D001207047D7 +:10FE60000020704701784068002903D001780029FC +:10FE700005D100E0E4E740304078002801D00020C0 +:10FE80007047012070470A4900208031886740315F +:10FE90000871704710B50178012908D14068803099 +:10FEA000417F002903D00021417703F071F810BD94 +:10FEB0006C120020C409000070B5FC4D00246C7069 +:10FEC0002C70AC616C72AC720120E872F84844701E +:10FED000C473AC62F7482C6302F05FF9002804D0C9 +:10FEE000FF20F5A14F300BF036F92C7770BDF8B537 +:10FEF000F54902250D60F5490026CE630127CF6341 +:10FF0000F349C96A09070DD4F24AD36AF2494B6230 +:10FF1000136B8B62536BCB62936B0B63D26BCB0512 +:10FF20001A434A63ED4C002823D0012825D0FF2036 +:10FF3000E1A1A2300BF00FF9E948A063FF200430E3 +:10FF40006063276303202061E64996204860D74913 +:10FF50001C2008560B22D243811A904237D011DC64 +:10FF60001C313AD00A2938D0142934D0182911D19B +:10FF70002FE0DD486061DD4802E0DD486061DD487A +:10FF8000A061D9E708301FD004281BD0082817D05B +:10FF90000C2812D0FF20D8A176300BF0DCF8DB491A +:10FFA000D9488860DB48DA494160DB490160DB48B9 +:10FFB0000560DB4910204860F8BD0420E060EEE7F2 +:10FFC000E660ECE7FC2000E0F820E060E7E7F420E2 +:10FFD000FBE7F020F9E7EC20F7E7D820F5E710B5CC +:10FFE0000C460146CF480BF0B2F9B048047210BD80 +:10FFF000AF4840787047AD4A517010707047F8B5FF +:020000040001F9 +:1000000004460D4650791179000208436900091928 +:100010000884501C01460E78012730464E7836027F +:1000200030438E78C9783604304309060843117886 +:1000300000020843A9006050284608303E4686402A +:10004000002B0CD0012B04D0FF209BA1E9300BF03A +:1000500082F8206B3043AF4038432063F8BD206BFB +:10006000B043F8E770B50D460446082904D9FF20CF +:1000700091A1FA300BF06FF80022002D0CD9AA489C +:100080009100635809180B6053001B191B8C0B62FD +:10009000521CD2B2AA42F3D3206BA449086070BDAF +:1000A00010B504460B22D2430C308C49944223D025 +:1000B00008DC1C3026D00A2824D0142820D0182888 +:1000C00009D11BE02046083014D0042810D008289D +:1000D0000BD00C2807D0FF2087A176300BF03BF81F +:1000E0007248047710BD042000E00020C860F7E7E4 +:1000F000FC20FBE7F820F9E7F420F7E7F020F5E72C +:10010000EC20F3E7D820F1E76948007B704773499A +:10011000C2784A6202461378184653781B02184385 +:100120009378D2781B041843120610430002C8616A +:100130007047252808D0262808D0272808D0410055 +:100140000A2807D8091D06E0022105E01A2103E06C +:10015000502101E0891DC9B2604A9160614948613E +:10016000704752498861704770B5002816D0022246 +:100170004E4C6F4BA27203201860644D6248686059 +:1001800000200126207500290AD001290FD002295C +:100190001DD049A167480AF0DEFF70BD0122E7E7E4 +:1001A0006548012A01D0466070BD066070BD3F48B9 +:1001B000012A006B05D001214905084320636960CD +:1001C00070BD0121090508432063696070BDA06905 +:1001D000002804D1492038A1C0000AF0BCFFA16961 +:1001E000A06A4018554988604A4855498160554978 +:1001F000C1600120216BC0030143216368602C486A +:10020000C67370BDF8B54A4801688F084449BF00FD +:100210004A68D206D60F10228A60002404603B4848 +:10022000394981600C2069460870474D2C6142496C +:10023000012008610BE000BF00BF00BF00BF00BF8E +:1002400000BF00BF00BF69460878401E08706846BE +:100250000078002802D028690028ECD06846007891 +:10026000002804D14D2024A1C0000AF074FF2C61A5 +:100270000E48012144728472C1722D480760002E1D +:1002800002D0274910204860F8BD01460A78104680 +:100290004A78120210438A78C9781204104309067A +:1002A000084300020D49000AC86370477413002018 +:1002B00094130020A81300207372635C68616C5F64 +:1002C0007263732E6300000080E100E0C01F0040F5 +:1002D00080000010C0000010001700400015004012 +:1002E0005B060000401500400601020025000302E5 +:1002F000050103001F0003027372635C68616C5F99 +:100300007263732E630000000040000400F501409A +:100310004080004080F501401011004080E200E084 +:1003200000130040761300200016004040160040E5 +:1003300000120040550200000010004040850040BF +:10034000488100401010004000110040FB4902208D +:100350000860FB4908607047FA490220086070474E +:10036000F9490870704710B5F84801F01EFF0028E1 +:1003700003D0F749F7480AF0EEFE10BD10B5F34878 +:1003800001F02BFF10BDF4494860704770B5F34C85 +:100390000546A06AA84203D3ED49F1480AF0DBFE06 +:1003A00001202073EF49002025614860EE48456038 +:1003B0000120216B800501432163EC49486070BD39 +:1003C000E64802210173C6210161E64A002151601D +:1003D000816AE54AC63151600121026B89050A43F1 +:1003E0000263E248416070470121E048890581606D +:1003F000DA48026B8A430021026301737047DC48CC +:1004000001214160C160D74900204860D649486059 +:10041000D24988627047D74940200862D6490A68A5 +:1004200002430A607047D44801684022914301604A +:10043000D049002008627047CF48016810229143DC +:100440000160CE49012088617047CD490020C86114 +:10045000C94801681022114301607047C849CA6940 +:10046000012A01D000207047C24A92685206520EFB +:10047000524202700020C8610120704770B50C0024 +:10048000054604D1D920B24980000AF064FEE00795 +:1004900005D0012C03D0AE49BA480AF05CFE002D0D +:1004A0000DD00221AD4801294172C472B24808D072 +:1004B00002290BD0A649B4480AF04DFE70BD0121B7 +:1004C000F0E7016804221143016070BD0168082251 +:1004D0001143016070BDF8B5A04C0025E27A910788 +:1004E00001D5410713D4D306A849002B05DA4B7B6D +:1004F000002B02D08B7B002B09D0130702D50B7881 +:10050000002B04D1520703D54978002900D10125D9 +:10051000677A002201239849002F1BD00226304021 +:10052000284348D0084601688E089949B6004D68AE +:10053000ED06ED0F10278F60002101608B4A954872 +:1005400090600C206A4610708D4F39618B490120F4 +:10055000086114E0854D8F48A86008688008800015 +:100560000860A272E372F8BD00BF00BF00BF00BF09 +:1005700000BF00BF00BF00BF1078401E1070107891 +:10058000002802D038690028EED01078002804D165 +:100590004D208149C0000AF0DEFD00203861607204 +:1005A000A0720120E07274480660002DDBD078480C +:1005B00010214160F8BD012F06D0022F0CD06449F4 +:1005C00076480AF0C8FDF8BD08680425A84308600D +:1005D0006272E372A372F8BD08680825A843086038 +:1005E0006272E372A672F8BD5C4908757047F8B58F +:1005F000664D5A49EC7B086B002C58D001245B4AAD +:10060000E4039460A04308635B480768604C1021D2 +:10061000A16000210160001490600C206A461070F7 +:10062000574C21615548012606610AE000BF00BF12 +:1006300000BF00BF00BF00BF00BF00BF1078401E5A +:1006400010701078002802D020690028EED01078B1 +:10065000002804D14D205049C0000AF07CFD002044 +:10066000E060206160606061A061434807603F49CD +:1006700000144860464910204860384CA07A012890 +:100680000FD0022810D0444945480AF064FD0020EC +:10069000E873207D022803D1424801688907FCD510 +:1006A000F8BD36480660F2E734484660EFE72F4A67 +:1006B000906000200863087B2A4E002802D07068F2 +:1006C000012809D000222E4C2069012806D00023E1 +:1006D000887A012804D006E00122F4E74023F7E7F6 +:1006E000E768012F04D000271F43012802D004E04F +:1006F0002027F9E76368012B05D000233B432A4FED +:10070000022802D007E01023F8E73968012902D156 +:10071000E168012904D000211943022802D007E032 +:100720000821F9E73B68002B02D1E368012B3DD09B +:1007300000230B4302283BD03EE0000080E100E0B4 +:1007400080E200E000E100E092000020A813002019 +:10075000B8020100A202000000150040741300203E +:10076000B3020000408100404085004000F5014098 +:100770000080004040150040001200400010004082 +:1007800000110040690300007E0300009413002064 +:100790000013004000400004F8020100CF030000F5 +:1007A0005E03000000E200E0001400400423C0E704 +:1007B000002A01D0022100E000211943022807D1BC +:1007C0006068012804D17068012801D0012700E089 +:1007D000002790480F4301680906090E02D061699D +:1007E000012900D00021297300680006000E02D004 +:1007F000A069012800D0002068738748006A00289B +:1008000003D000F0DCF9012800D00020A8730020FC +:10081000E060206160606061A06180494860804E56 +:100820008049307548683C4670620968B1620B4681 +:10083000B17A022909D17178002906D07A4A526822 +:1008400012780A40317891430ED000212970774FF9 +:10085000E10710D03978032908D0022906D002F028 +:10086000D1FC0121B06A20E00121EFE707F022F975 +:100870000121B06A27E0A0060ED53878032806D0FB +:10088000022804D00221184602F0CBFC0FE002211E +:10089000184607F010F90AE0A00708D538780328B1 +:1008A0000FD002280DD00021184602F0BAFC5E4895 +:1008B00041680622B01C09310AF096FA002805D0DA +:1008C0000DE00021184607F0F6F8F0E75648317AB7 +:1008D00040680078C009814201D1012000E0002079 +:1008E00068702046FFF7F7FD387800280DD0012802 +:1008F0001ED002282FD003284AD04D494D480AF077 +:100900002AFCB07A022856D075E0A00701D507F07E +:10091000C6FC200702D5012007F0FDFC600702D5C8 +:10092000002007F0F8FCA006EBD507F059FCE8E73B +:10093000A00701D508F0E8FF200702D5012008F044 +:100940004DFE600702D5002008F048FEA006D8D56D +:1009500008F098FDD5E7A007BF25002802DA2C4053 +:1009600004F022FF200703D52C40012004F05DFB9A +:10097000600703D52C40002004F057FBA00602D5E9 +:100980002C4004F061FE6006BBD504F04AFBB8E7DA +:10099000A00701D506F0F0F8200702D5012005F0E8 +:1009A000B1FF600702D5002005F0ACFFA006A8D576 +:1009B00005F01CFFA5E7307B00281CD0174900225A +:1009C0004A60022820D0012803D019491A480AF0A9 +:1009D000C2FBB16A3069884203D8154917480AF04A +:1009E000BAFB1048316941600120316B8005014339 +:1009F000316313494860307D012800D050E611482A +:100A000001688907FCD5F8BD3169B06A411805480D +:100A10004160E9E740160040401500404081004039 +:100A20007413002040850040001500409200002013 +:100A3000B8020100FD0400001205000013050000CB +:100A400000F5014000E200E02E48002101704170F5 +:100A5000704770B5064614460D460120F0F7A2FC1B +:100A600028490120284B08709E60DC601D6170BD24 +:100A7000F8B504460120F0F795FC224901200870E2 +:100A800021494C60214900264E600321204D090672 +:100A9000A960204F002C0AD0012C03D01EA14120B8 +:100AA0000AF059FB3E60032000066860F8BD38601C +:100AB00001200006F9E710B51248017800290ED090 +:100AC0000321134A0906916010494A680021002A4F +:100AD00003D0154A1268427000E041700170002096 +:100AE000F0F760FC10BD07480178002907D00748DF +:100AF0004068002802D00C480068C0B270474078B7 +:100B0000704700009300002000F5004000F1004015 +:100B100000F5014000F200407372635C68616C5F35 +:100B200063636D2E6300000000F400403B48002129 +:100B30000170417010218170704770B506461446EF +:100B40000D460220F0F72EFC01203449344A08708B +:100B5000E41E14619660556070BD10B50220F0F778 +:100B600021FC2E49012008702E48002101604160BF +:100B7000816001202C49C005486010BD10B5274890 +:100B80000178002917D00121274AC905916025491C +:100B90000B680022002B05D04B68002B02D089681F +:100BA000002902D04270102103E0012141701F4949 +:100BB0000968817002700020F0F7F4FB10BD17483F +:100BC0000178002912D01748016800290AD001686D +:100BD000002905D04168002902D08068002803D090 +:100BE000002070470220704701207047407870470E +:100BF0000A48017800290FD00A480168002905D069 +:100C00004168002902D08068002801D01020704778 +:100C100006480068C0B27047807870479500002091 +:100C200000F5004000F1004000F5014000F40040F4 +:100C3000FFB593B0044600201D9E049015981C9D9E +:100C40001027082806D0E06901F014F8002809D020 +:100C50003770CCE028880921384328801F98022764 +:100C6000017016E0E169012088710521E269C9027D +:100C70009180E1698872E169F9480881E1690020A1 +:100C80008873288820210843288011211F98042771 +:100C900001701F980225801C0390307810900A2064 +:100CA0003070204618301190F5F7A1FC00206FE05D +:100CB0001598102809D1022D07D06846828A049918 +:100CC0000398401A8270110AC1706846C08A16994A +:100CD000884203D9E349097A149106E0884204D195 +:100CE0001099002901D0317021E003990870000AA1 +:100CF00048701E980088401BC01B83B2FF20C01B99 +:100D0000984200D203460398149AC0190CA9009285 +:100D1000019002912020015D6846C08A0022F5F70B +:100D2000DBFC3070002806D0C0B2832862D0684651 +:100D3000C08A208345E00F98002805D0C948006884 +:100D400000790A2830D33CE06846008EC119C9B248 +:100D50000491022D0FD01F99049A4978914203D132 +:100D60006A46128C824209D0BE480491006801781C +:100D7000032909D027E008461F994870B948006840 +:100D80000178042906D008E000790A281BD2012046 +:100D90000F9009E06946C98A818003990498081870 +:100DA00003900498281885B205AA14991198F5F7AC +:100DB00021FC002805D11E980088401BB84200DBAA +:100DC00076E7022D0ED01598102807D1049A0399C2 +:100DD0006846808A891A8870000AC8701E98058043 +:100DE000002030709F4800680078032802D000205F +:100DF00017B0F0BD0220FBE7F8B50446406B0026B3 +:100E0000134600282BD0491F8DB2618F2A46083225 +:100E1000278F8A18BA4221D89A7840185F78110231 +:100E200039430170090A41701A79DF781102394398 +:100E30008170090AC1700571290A41712A46591D3C +:100E4000801D09F0FEFF608FAD1D401980B26087E4 +:100E5000626B002110180170417000E009263046D5 +:100E6000F8BD30B50B88048F9C4212D9446BE01852 +:100E70004478057824022C430BD044790579240268 +:100E80002C436404640CA41D1B190B80106000200B +:100E900030BD822030BDF7B588B000256846058298 +:100EA00005275DE00398417802780E0216434179E8 +:100EB000027908021043000452D40A9801230680E4 +:100EC00005A802905B02002200970195304609991F +:100ED000F5F702FC04004AD16846018A01830398B1 +:100EE0004179027909021143437802781C021443C4 +:100EF000B4421ED10A041CD44B0401215B0C8903AB +:100F000000950B4301970295C17880780A0202434D +:100F100020460999F5F7FCF9040011D103994879A5 +:100F20000A79000210430122D20310430871000A1B +:100F3000487103AA06A90898FFF793FF0400CED0D2 +:100F400003990095019702954878097800020843B3 +:100F500069468B8A00220999F5F7DAF9822C06D1C5 +:100F600003AA04A90898FFF77CFF04009AD06846FA +:100F7000058209E003984179027909021143490485 +:100F8000490C0171090A417103AA04A90898FFF7E5 +:100F900068FF0028EED0822C02D020460BB0F0BDB6 +:100FA0000020FBE730B50446406B002597B00028D1 +:100FB0000DD00B2268460270228F0281606B039174 +:100FC000019000216846F2F72AFB684605706563C8 +:100FD0006587258717B030BDF8B50F460546696BA4 +:100FE0000020069E144600290FD0012B0DD1324659 +:100FF00039462846FFF74FFF002806D1002C04D0C1 +:1010000032463946284600F044FEF8BD00220280F0 +:10101000C262831D0263C36142634287028720303C +:101020000170704710B50022D24302800420FBF704 +:10103000E4FA10BD10B596B00446FFF7B3FF208E5A +:10104000002808D0012069460870E06A019000215C +:101050006846F2F7E4FA0020E062206316B010BDA3 +:1010600001280000AC1300200146098800200A076F +:1010700000D501200A06120F01D002221043CA0532 +:1010800001D5042210438A0501D5102210434905D9 +:1010900001D5202108437047FFB5A9B00600329D55 +:1010A000359C2B981F46229016D0007841060FD40D +:1010B0008106890E1E2909D021884A05520E0BD1BE +:1010C0003A88172A08D3FE4A914205D0C10906D0B2 +:1010D0008006800E122802D003202DB0F0BD2046DD +:1010E0002C302690F7492A980872002018AA0390FD +:1010F00010726A46107404AA0A60339A4A6020AAE1 +:10110000908090812298007801908106681C1C9044 +:10111000701F1D902B98890EC21C249222462032EB +:101120001B92083A401C02920B000AF035F91FFD91 +:10113000FD11FD1FFD8EFDFCFDFBFDFAFDF9FDFC23 +:10114000FDF8FDFDFDF7FDF6FDFDFDFDFDF5FD00E6 +:10115000032E76D102E018A9087219E30320287043 +:101160001C9917220A7000224A70CFE2052EF0D196 +:101170004178027808021043208320A98880249AAD +:101180005178127809021143618300287ED0884289 +:101190007CD800202072E080401E60840298F5F721 +:1011A00026FA05202870A81C0190022000901BAA96 +:1011B0002A990298F5F71EFA002868D118A8807CB1 +:1011C000012803D002206870102002E0012068701E +:1011D00002202490002225A91CA8F1F7AAFD0028CE +:1011E0002BD120A8007D2499814226D13A880099EC +:1011F000801C511A814220DB10A8C18D019801701A +:10120000090A417001991CA8891C01910099019A51 +:10121000891C009125A9F1F78CFD20A8007D01997A +:101220001BAA091801910099081880B200902A9908 +:101230000298F5F7DFF90028CCD00098022826D0D4 +:1012400064E272E018A9087261E2072E6DD341785A +:101250000346027808021043208320A98880249A3C +:101260005178127809021143618300280ED0884218 +:101270000CD8012020725879197900020843E080C7 +:1012800000202073E06900F0F5FC01E098E0A9E09F +:1012900000280ED1E169012088710521E269C902A7 +:1012A0009180E1698872E16987480881E1690020DD +:1012B0008873F01F60842298C01D60620298F5F761 +:1012C00096F907202870681C0090012001900020EA +:1012D00010A9C8852FE00198012814D0E069807911 +:1012E000012830D000981E38417F007F0902014359 +:1012F00000980170090A41700098801C00900198C4 +:10130000801C80B2019010A8C18D00980170090A5C +:1013100041700098801C09E00AE296E13BE1DFE0C1 +:1013200004E29BE077E036E016E2AFE0009001983F +:10133000801C80B201901BAA2A990298F5F75AF9ED +:10134000002803D007E010A8818DD1E739880198E3 +:10135000081A0428BFDA0198012843D0E06980798F +:10136000012804D010A8818D5548814206D110A8CB +:10137000818D00980170090A417009E000981E38BB +:10138000417F027F0802009910430870000A4870EC +:101390000198801CBAE1072E01D0152E76D1417834 +:1013A000027808021043208320A98880249A51786B +:1013B0001278090211436183002801D0884201D9C3 +:1013C00001203FE7012020720020E0802073052EDD +:1013D0000AD01D982299E269C0B2491DF1F783FC39 +:1013E000002801D00A202DE70020C04360841AA8FD +:1013F000019023A922980297039500910078002379 +:101400008206920E20462A99FFF712FC0390208B49 +:1014100020A988807BE1032EC0D1402220A98A81A7 +:101420004178027808021043208320A988802A99F5 +:101430001EAB1C9A02930192009139880022491E2A +:101440008BB21B990978F5F747F918A9087200289B +:1014500033D10B20287010A8008F3FE0052E9DD1BE +:10146000802220A98A8141780278080210432083D3 +:10147000249984464A78097812020A43628420A992 +:1014800088801248824202D30720DBE6AFE03F208B +:101490008002024362842A981FAB1C990293019137 +:1014A00000903888401E83B21B9801786046F5F79B +:1014B00013F918A9087200280CD08328AAD107E0D4 +:1014C000FFFF0000AC130020012800000102000013 +:1014D0000220B8E00D20287010A8808F401C15E174 +:1014E00001990C22C9095143C91CB14204D9019880 +:1014F00040067CD5002009E14278037810021843A9 +:1015000020AA9080844622980078400609D50520BC +:101510006A46107422980078C00905D00020107423 +:101520001DE106206A46107424981F902A9A0090A4 +:101530000023701A029383B21E9001921B9800221E +:1015400001786046F4F7E4FE18A9087200226946A3 +:101550000A74832801D10220039022980078400663 +:101560000DD52088C00506D520A9208B8988884202 +:1015700001D100206062002018A90872C6E0FF2196 +:10158000013120A88181808820831E9860841F9863 +:1015900060621320B8E0052E29D341780278080252 +:1015A000104320A98880218F002902D0FE4A914251 +:1015B00006D10A216A4611740121C943218702E03C +:1015C00007216A46117422992A9A491D01920091B5 +:1015D00001221D990023D203029311438BB2249957 +:1015E0004A78097812020A431B99097800E0C9E099 +:1015F000F4F78EFE18A90872002269460A740122C7 +:10160000520220A98A81832808D0002809D0218F7E +:10161000E54881427ED10020208778E088882083B9 +:101620004DE7606B002808D031462046229AFFF72C +:10163000E3FB18A90872002869D12B463A463046C8 +:10164000229900F056FB039061E02298022E407828 +:1016500001907DD1002801D0012879D10820694668 +:1016600008740198087521A800901B980022017841 +:101670002046019BFFF7B0FC6946002248758A7539 +:10168000002802D10198012809D0208F002806D017 +:10169000002008740120800220A988810EE004A89F +:1016A0003399F1F7BCFF03900020694608740120CC +:1016B000800220A988810398022807D0BB480068CF +:1016C0008079002805D018A908722BE001982083A2 +:1016D0001DE00398002803D0812018A9087240E07B +:1016E00021A800901B98012201782046019BFFF75A +:1016F00073FC18A9087220463499FFF753FC18A907 +:10170000087A002803D11920287001203880684603 +:10171000007C00E03CE0002804D004A83399F1F7F5 +:101720007EFF0390039800282ED01AE0062012E5D1 +:101730002078000713D5012E11D1092168460174C4 +:10174000A188818204203499FAF757FF082100E02C +:1017500005E020A88181CDE60198400612D503203E +:10176000039020A9208889890843208020A988899E +:101770004005400E04D026992B9808602698868054 +:101780000398AAE40420E6E418A8007A00280ED002 +:101790000120287022980078687020A88088A8709E +:1017A000000AE87018A8007A28710520388020A95E +:1017B0002088898988432080E2E7FFB50746A1B0E9 +:1017C00000201C903A7801209040794A7C681040B3 +:1017D00010AA1087744B22885B1C9A4203D0002801 +:1017E00004D0100702D5012025B0F0BD249E0020B2 +:1017F000307023980025028810A8028518A8057566 +:101800006A4B68461972057404A8186020462C308B +:101810001B902A985860249E94463878721C0521A3 +:10182000039201282DD0022808D003287DD13078DA +:10183000800980011D303070B889A0803878022876 +:1018400004D13078800980011B303070F01C1FAA51 +:1018500001900292009110A8008D0022C01E83B258 +:101860002020015DB889F4F737FF0028DED1039806 +:10187000B9890170090A417010A9888FC01C0885B8 +:1018800028E1787B18AA10753A7B012A02D0022A37 +:10189000CCD1FCE022887F231B011A4010AB1A87B1 +:1018A000802A4AD006DC102A10D0202A0ED0402AE6 +:1018B0000AD124E0FF3A013A65D0FF3A013A79D0E3 +:1018C000FF3AFF3A022A76D00525A2E02078C0062A +:1018D00001D5082000E010201C9004206A461074F6 +:1018E000002090821AA81DAA1EAB039601920290B6 +:1018F00000933B8A20461C9AFFF79AF984E0228BDA +:101900003B8A9646934268D10A221C92002839D11C +:10191000039801906046401E1FAA83B202922020C5 +:101920000091015D0022704600E0BAE0F4F7D4FEB9 +:10193000014618A801750B201AE0228B3B8A9646B7 +:1019400093424AD10C221C92002862D10398019044 +:1019500060461FAA401E0292009183B22020015DC2 +:10196000628C7046F4F7B8FE014618A801750D2088 +:10197000307010A8818F491C0185042168460174CC +:10198000218B818245E0238B3A8A9C469A4224D15E +:1019900012221C9200283CD1606A002813D0002239 +:1019A0006B4607C3638C07E0FEFF0000AC1300200A +:1019B00009F800000DE04BE02020015D6046F4F7DF +:1019C000A7FC18A9087513203070012010A90885FC +:1019D0001FE0398A228B914201D00425B6E01621FE +:1019E0001C91002815D11B98818802682046FFF7BA +:1019F00003FA18A9087500280BD11B983346016813 +:101A000080881AAA00F075F9054602281BD0042D1B +:101A100019D01B988088002811D06846007C0028C7 +:101A200004D004A82A99F1F7FAFD05460120694679 +:101A300008741B981B990068059000208880002D71 +:101A400048D0052D2ED06846007C032878D07DE054 +:101A500018211C91002806D0388A20832046B968B6 +:101A6000FFF7A0FAD5E72046183000902020015D4E +:101A7000237E01222046FFF7AFFA18A90875002837 +:101A8000ECD119203070012010A90885E6E72088E4 +:101A900001214902084010A90887FF38FF380228B1 +:101AA00006D0052510A92088098F884320804DE0A5 +:101AB000208F9849884290D116201C9038690028C0 +:101AC00005D06063B88A20870020608702E000208C +:101AD000C043208710A8008F7F21090102468A4356 +:101AE0000DD0782300220420B968FAF7DFFC38789B +:101AF000A07010A92088098F0843208002E0218867 +:101B0000814321806846007C002805D082484168D6 +:101B100004A8F1F784FD054618A8007D002815D01B +:101B20001C98707001203070208BB070000AF0702B +:101B300018A8007D3071052110A8018506E0FFE797 +:101B40007548416804A8F1F76AFD05467248017AB4 +:101B500020884005400E22D11B98808800281ED086 +:101B6000239A0026138810AA1385249A2A9B6F466D +:101B70004CC71B9A039412681AABFFF78DFA0546FF +:101B800002280CD00120694608741B982A99006825 +:101B9000059004A8F1F743FD05461B98868010A820 +:101BA000018D2398018028461EE600B597B00428D1 +:101BB00007D102206A461070019100216846F1F7B2 +:101BC0002EFD17B000BD10B5534C037800222168DC +:101BD000012B02D0022B42D126E00B78002B01D042 +:101BE000042B03D10A7122680321117021688388B4 +:101BF0000A79D200921D8B5221680A79D2000832EC +:101C00008918C2880A80216803890A79D2000A32B9 +:101C10008B52428920680179C9000C3142522168F7 +:101C20000879401C08711EE00A7482888A80216845 +:101C3000C288CA8022680189118122684189518144 +:101C4000C1682068C1606168F1F7E9FC01460228BB +:101C500007D02068007C002802D1002903D0812011 +:101C600010BD832010BD002010BD406B002800D0A7 +:101C7000012070478178012909D100880521C90216 +:101C8000884202D0491C884201D1002070470520BB +:101C90007047F7B586B00024684615460F46848124 +:101CA00005261AE004984178027809021143298038 +:101CB000811D019602940091417902790B02134330 +:101CC000C178827809020A43417800780902084302 +:101CD0003946F4F71DFB002806D104AA03A906988B +:101CE000FFF7BFF80028DDD0822800D1002009B01E +:101CF000F0BD10B51488844201D2052010BD172410 +:101D00001C701080421E581C491C09F09AF80020D3 +:101D100010BD0000FEFF0000AC13002030B50346EC +:101D2000002002460DE09C5C2546303D0A2D02D382 +:101D30000020C04330BD0A25684330382018521CAB +:101D4000D2B28A42EFD330BD70B50D46144608E0DA +:101D50000A2109F0DFF82A193031203A641ED177C0 +:101D6000E4B2002CF4D170BD10B5002310E0040AD9 +:101D700000020443A0B2CC5C44402006000F604047 +:101D80000407240C44402006C00C60405B1C9BB23E +:101D90009342ECD310BD000010B572B600F0DCF831 +:101DA00000280BD0EFF77CFAFAF7E1FD08F097FB7B +:101DB0006E490020C86288626D49086062B60020E2 +:101DC00010BDF3B5002501200007C06A81B0C043F3 +:101DD0000006000E04D167480068401C00D10125B0 +:101DE00072B600F0B9F8002802D062B60820FEBD35 +:101DF000EFF7ACF9EFF758FA5F4B604E00211A6825 +:101E0000CA40D2071FD00246CA40D20718D14AB2F0 +:101E1000002A07DA1407240F083CA408A400A41918 +:101E2000E46904E09408564FA400E419246892077A +:101E3000D20ED4402206920F012A04D0032A02D0E7 +:101E400062B65048FEBD491C2029D8D30198030032 +:101E500009F0A2FA142123232323232323230B0D88 +:101E60000F11131F1517191B1D2E002416E0012436 +:101E700014E0022412E0032410E004240EE00824FD +:101E80000CE009240AE00A2408E00B2406E00C24F4 +:101E900004E0052402E0072400E00624F0690121A3 +:101EA0000002000AC9070843F061002D04D009E0D0 +:101EB00062B601200003FEBD2C4D3348E862EFF707 +:101EC000F3F9A8622A49314808603149029808604C +:101ED000EFF7EAF9214608F0E9FAFAF70CFD08F005 +:101EE000EFFC08F065FB0198EFF7A8F9040062B673 +:101EF00003D0FFF751FF2046FEBD0020FEBD10B508 +:101F0000044600F029F8002800D0012020700020AD +:101F100010BD204908600020704710B50C461028FD +:101F200008D011280BD012280CD013280ED0012075 +:101F3000086010BD03CC083CFFF743FF0AE0FFF741 +:101F40002BFF07E02068FFF7DAFF03E01149206864 +:101F500008600020206010BD05480C4900688842D8 +:101F600001D10120704700207047000000050040AB +:101F7000640000200010001000E100E000ED00E02F +:101F800000E400E00110000000220000BEBAFECA1A +:101F9000980000200400002010B520380C460300F3 +:101FA00009F0FAF933A6AAAEB2B8BCC0C5E0DBE4CA +:101FB0001B1F23272C31373C41474D5054585C6040 +:101FC0006D71656974787C8084888C9094989C9FEE +:101FD000A2CACFE9F0F3D3D7F800206800F0DDF80B +:101FE000D6E0206800F0E1F8D2E0206800F0F5F8D3 +:101FF000CEE0207840B208F0C9F8C9E0207840B2BD +:1020000008F0E7F8C4E02078616840B208F0FAF818 +:10201000BEE0207840B208F00AF9B9E0207840B27A +:1020200008F015F9B4E02078217940B208F020F9E1 +:10203000AEE02078616840B208F04AF9A8E008F004 +:1020400056F9A5E0206808F05AF9A1E0207808F0D8 +:102050006FF99DE02068FAF738F899E02068FAF700 +:1020600038F895E021792068FAF73AF890E020688E +:1020700007F0D8FF8CE0206807F0D9FF88E02078CF +:1020800007F0D9FF84E007F0E3FF81E0207807F054 +:10209000E5FF7DE0207807F0F7FF79E0206808F0A1 +:1020A00010F875E0206808F012F871E0206808F078 +:1020B00014F86DE0206808F015F869E0206808F071 +:1020C00017F865E0206808F019F861E0206808F06A +:1020D0001AF85DE00846EFF751F859E0F0F787F994 +:1020E00056E0F0F7B4F953E02068F0F7BCF94FE0A0 +:1020F000206800F0E1F84BE0206800F0E9F847E0E4 +:10210000206800F0F0F843E02078A268616800F0F1 +:10211000F5F83DE0207800F006F939E0207800F08D +:1021200017F935E02078616800F027F930E0207871 +:10213000616800F03AF92BE02179207808F008FA7C +:1021400026E0206800F06BF822E02068FAF7FEFA3B +:102150001EE02068FAF7E2FA1AE007CC0C3C08F01F +:10216000F1FA15E0206808F044FB11E003CC083CCC +:1021700008F06FFB0CE0206808F065FD08E009E05E +:1021800003E0FFE708F077FD02E0206808F0AEFD0D +:10219000206010BD0120086010BD002101700846BC +:1021A00070470146002008707047EFF31081C9079F +:1021B000C90F72B60278012A01D0012200E0002284 +:1021C00001230370002900D162B6002A01D000204B +:1021D0007047012040037047E7E7EFF31081C9071C +:1021E000C90F72B600220270002900D162B6002029 +:1021F0007047F2E710B52848FFF7CFFF002803D05B +:1022000026A11D2008F0A7FF2348401CFFF7C5FFAB +:10221000002803D021A1212008F09DFF10BDF1B5B9 +:10222000224D6F6801261C48FFF7BFFF1A4C00289B +:1022300003D10026601CFFF7D0FF1D4A1D49012075 +:10224000506000BF00BF00BF00BF00BF00230B6095 +:102250004B60009B6B60106000BF00BF00BF00BF01 +:1022600000BF0868002802D148680028F9D04868F3 +:102270000028E4D1002E04D06F60601CFFF795FFAA +:1022800007E0601CFFF791FF0028D3D10248FFF759 +:10229000A4FF0020F8BDC2E79C0000207372635CBD +:1022A000736F635F6563622E6300000000E50040AA +:1022B00000E0004000E100405A495B4B0A685B497E +:1022C0009A42096801D18904890C01600020704795 +:1022D0005449554B0A6855499A4201D18004800CF3 +:1022E0004860002070474F494F4B0A684F499A4257 +:1022F00001D18004800C88600020704730B5494BC4 +:10230000494D1C684A4BAC4202D0102802D203E06F +:102310000E2801D3184630BDC30044481818016187 +:102320004261002030BD3F493F4B0A684049491C8B +:102330009A4202D0042802D203E0022801D30846C0 +:1023400070473C4A0121C00080180160002070479E +:102350003449354B0A683649491C9A4202D0042850 +:1023600002D203E0022801D308467047314A012116 +:10237000C000801841600020704770B5294A2C4B7E +:1023800014682D4E284D82005B1C9219AC4203D07C +:10239000042803D2116006E0022801D3184670BD5C +:1023A0008804800C1060002070BD70B51D4A204B61 +:1023B0001468214E1C4D82005B1C9219AC4203D064 +:1023C000042803D2106806E0022801D3184670BD25 +:1023D00010688004800C0860002070BD10B5134A9E +:1023E000164890600E200021C3009B1819615961A6 +:1023F000401C1028F8D300200F4A05E0022803D320 +:1024000083009B18196005E083009B181C68A404D6 +:10241000A40C1C60401C0428F0D310BD03490748DD +:102420008860704764000020BEBAFECA00F5014013 +:102430000820000000F0014000F8014000C0FFFF4C +:10244000FE48C07E7047FE4840687047FD48C07E29 +:102450007047FFB5F94E85B0706A346805686068EA +:102460000190306A0390298D0798401A80B202903B +:102470000898002804D0274638372046483002E024 +:10248000371D2846A0300090032038710598002899 +:102490001FD001287ED0022863D003287BD0EAA178 +:1024A000ED4808F058FE0898002806D0387903282F +:1024B00003D0E5A1E94808F04EFEA16A7069FAF779 +:1024C000B0FDB860216A606A814265D900990860F0 +:1024D00034E1306A002803D1DBA1E14808F03BFE7B +:1024E000288BE0494843421806980021002804D070 +:1024F0005043DD4908F00EFD411CA1610191AA88FD +:10250000D848002142430698002804D05043D649B9 +:1025100008F000FD411CE161306AD24A801CA062D3 +:10252000298BD04B5143019A891AD04A891809182E +:10253000A162AA7D01985A4340008018FF301930EB +:1025400020626062306A081AC949FF38153888422B +:10255000A9D2C84988427DD2BBA1C74808F0FBFD7B +:102560008BE0288BBF4AE16850430A180698002187 +:10257000002804D05043BC4908F0CCFC411CA161A8 +:10258000AA88B848002142430698002808D0504342 +:10259000B54902E03EE073E0CEE008F0BBFC411C30 +:1025A000E161306A002803D1A7A1B44808F0D3FD47 +:1025B000A620405BAB4A0028288BE16821D050431D +:1025C0000818A169401AA0622169A068A54A484379 +:1025D000A1694018A97D400051434018FF301730D1 +:1025E0002062A888E1695043411AA5480818606232 +:1025F000A06A316A401A9E49FF38553888423CD358 +:1026000051E750430818A169401A3168D638496823 +:102610004018D8E7284680300190C08C002802D0AE +:10262000306A002803D188A1964808F094FDA88854 +:102630008C49E3694843C01AA06201999C46CA8C40 +:102640002169A368521A4B43A16959186346534341 +:10265000C91800E011E0AA7D824B49005A4389184D +:10266000FF3117312162864941186162316A401A8F +:102670007F49FF3855388842C2D20120387112E7AD +:102680000898002803D03420005D00287ED1A88857 +:1026900074494843E169401A02994843A0622846B8 +:1026A00080300490C08C0028019825D0002803D0E9 +:1026B00065A1754808F04FFD04986A4AC18C0298DC +:1026C0000818E16948434000FF3017302062A888AD +:1026D0005043411A6A48081860626C4840680028F4 +:1026E00019D0A26A03990120511A614AFF3955395C +:1026F000914285D23871D6E6002802D0039800288E +:1027000003D151A1624808F026FD0198A16AD6388C +:102710000818A062D0E7FAF7F2F97269014610468C +:10272000FBF706FCA16A081A5149FF385038884265 +:10273000A5D2012009B0F0BD00980160009855496C +:1027400000684018F86028468030028A0799511ABC +:1027500009B2002904DD0599022901D0032100E016 +:10276000002179710E99002915D0028F002A1ED000 +:10277000418F4187A0352B7F491C4B4393420AD29E +:102780007979491E002906DD012100E00CE079710C +:10279000418F491C4187089838700898002808D054 +:1027A0003420005D002804D0022009B0F0BD0021D3 +:1027B000DFE708980121484020346075307FF27EC1 +:1027C0003946B37E9A4202D0FAF710FE04E00020A8 +:1027D000F076B07630607062002009B0F0BDF0B5E0 +:1027E0002A4F83B038680568416A2E460C68203647 +:1027F000717D00290AD0698E228D914206D1407ADE +:10280000002803D110A1244808F0A5FCFAF777F9B5 +:102810001E4F39684A6901461046FBF789FB3F683D +:102820000028796A096807D089880E4A51433A68B6 +:10283000D269891A08F06EFB698E2FE0B813002068 +:10284000B8000020E01300207372635C6C6C5F6C56 +:102850006D2E73302E630000310500003A05000034 +:10286000B7040000E204000040420F0033040000FF +:102870005C0800001D030000D4040000DC0400001C +:1028800094FBFFFFF50400001B050000A8000020DA +:1028900014050000FF0B000021060000228D131814 +:1028A000994202DB491C698602E0401C10186886C8 +:1028B000B07D002806D19421688E095B884201D141 +:1028C000401C6886388BFB4E401C388320464030C5 +:1028D0000190C1888088081A218D401E401887B257 +:1028E000C03418E03068F449406A002300794000A1 +:1028F000085A009323795B00C95A081881B2287DD1 +:102900000023FFF7A6FD00280FD001280FD0EB49C8 +:10291000EB4808F020FC6A8EB81A00B20028E1DA11 +:1029200001980821817005F0BDFF03B0F0BD688EED +:10293000401C6886EFE770B5DE4D09292B686A6890 +:102940007BD20C007C4424792419A7440463869626 +:1029500083A5A575A20000201062D17E042956D25D +:102960000B007B441B79DB189F4451510147516A8E +:102970000C68116808701168486010682030407D4C +:10298000002808D1FAF7BBF869680968096CFBF7F9 +:10299000CFFA002817DC6868228D0168498E9142C1 +:1029A00005D123468033998A8A1ADA8204E0891A8B +:1029B000962211530168498E21850268C16811640D +:1029C000C168416111E068680168098E228D8B1A27 +:1029D00022468032D3820168098E218501680B6C02 +:1029E000C3600B6C4361886C1062204606F0C8FB24 +:1029F000002821D0B3A1B74829E0D068506105F084 +:102A000088FA002818D0EF20AEA180001FE0ADA109 +:102A1000B1481CE0D07E042817D20100794409791E +:102A200049188F441212010B06F0E6FC002803D06F +:102A3000A4A1AA4808F08FFB70BD2DE005F09FFB14 +:102A40000028F9D09FA1A64801E09EA1A54808F062 +:102A500082FB70BDFDF7CBFD70BDD87E022806D08D +:102A6000D87E032806D0FF2096A1AB300EE0FFF7FA +:102A7000B6FE70BD00F013FC70BDD87E0228F6D003 +:102A8000D87E0328F6D0FF208EA1B83008F063FB73 +:102A9000F0E7FAF719F870BDFF208AA1C630D6E733 +:102AA000F3B50126834C904D81B00F46092945D2DC +:102AB00008007844007900188744042D38382D40E8 +:102AC000403838000121884800F0D0FB3946019891 +:102AD000FFF731FFE87E022826D160680468406A6B +:102AE0000768F9F7EAFFB988804A5143E269891A11 +:102AF000D639E162B72803D283200001081A02E028 +:102B0000081A7B494018E0627A48E16A814200D89D +:102B10000846E06205E00198FFF70DFFE87E022815 +:102B200002D128682030067503B0F0BD25600198F9 +:102B3000FFF701FF0020206003B0F0BDFF2061A17E +:102B4000623008F008FB03B0F0BD70B506460C46D5 +:102B500009291FD208007844007900188744040D21 +:102B600011110D1A1A1111000121634800F07EFBAA +:102B700021463046FFF7DFFE70BD3046FFF7DBFE33 +:102B800070BD4C4D5C4828603046FFF7D4FE0020F5 +:102B9000286070BDFF204BA1883008F0DCFA70BDC2 +:102BA000F0B5514985B0CA7E0026424C032A03D0B5 +:102BB0002831CA7E032A64D100252160002824D050 +:102BC00001280ED03FA14D4808F0C5FA2068002E1C +:102BD00005604562256054D049484560002005B035 +:102BE000F0BD0320887600E020BF2068C17E002968 +:102BF00003D0C17E827E9142F6D0C17E002902D0F0 +:102C000000268576E2E70126FBE700260327084633 +:102C10008F76C97E032903D0C07E00282DD02DE0F9 +:102C2000007F002803D127A1364808F094FA2068D5 +:102C3000067F684607714771F9F761FF0290FF2030 +:102C4000F530039001216846017069463046FAF775 +:102C5000CDFB2068007FFBF7F7F900280BD0206838 +:102C6000007FF9F731FF20680577C5768576056026 +:102C70000126456202E020BFEBE701262068857649 +:102C8000A4E70C2005B0F0BD10B5174800F04DFBCF +:102C9000194800F04AFB1C49002008751849487083 +:102CA00011494861144A506188769076014948601C +:102CB000086010BDA800002034B4010048280100BD +:102CC0005B0600007372635C6C6C5F6C6D2E73301E +:102CD0002E630000B6030000C3030000D60300000B +:102CE000DB030000E2030000B8130020E204000050 +:102CF00087F8FFFFEC060000E01300201E03000031 +:102D0000B80000207E02000008140020F8B5FF4E35 +:102D100005463068002401270004810FFC48006844 +:102D2000800F814204D0FF20FA49D03008F013FA16 +:102D30003068F94E0004810F30680006800F814230 +:102D400004D0FF20F349D13008F005FAF348C069F8 +:102D50003168800F0904890F884204D0FF20ED49B3 +:102D6000D23008F0F8F9EE480570EE4DEC76AC760E +:102D7000ED4EF476B476ED48077104606C627462CF +:102D80002C60EB4F346028467C6000F0CEFA304671 +:102D900000F0CBFAE74804757C706C617461AC7626 +:102DA000B476E54844600460F8BDE04908717047B6 +:102DB000F8B5DC490546CA7EDB48DF4C002A02D163 +:102DC000C27E002A03D0C97E022907D009E0DB4871 +:102DD0002160F9F725FE216808770AE0C17E002905 +:102DE00001D00C20F8BD2060D548F9F719FE216804 +:102DF0000877CF48456021680860D2484862284675 +:102E00000121BC30F9F790F9A035287F8007800FA9 +:102E1000401C28772068007F002803D1BD49CA489C +:102E200008F099F9F9F749FEC849884200D20846E6 +:102E3000C749401886B221680320C87604F084FF91 +:102E40002168086104F0A8FF01270025002826D08A +:102E500004F0A2FF21684A6A106008680121077027 +:102E60006846F9F7EAF868460078BA49000208F0BF +:102E700051F80F46F9F743FEF119FAF7D2F8216835 +:102E8000C86022680320107250721571107FD37EC3 +:102E9000111D967EB3420ED0FAF7A8FA0FE0F9F7AB +:102EA0002EFE3146FAF7BDF82168C8600868057043 +:102EB00008684770E5E7D576957615605562206815 +:102EC000058300202560F8BD7047F8B5954EF17E6A +:102ED000002903D19449C97E002901D00C20F8BDF6 +:102EE0000221F176914F934D77623560002438606E +:102EF0002C7500943979C0304A00974900798A5A74 +:102F00004000085A2346101881B222462046FFF797 +:102F1000A0FA002803D07F49904808F01CF92C61E2 +:102F20000120AC6028756C862C868D4884753968C4 +:102F3000088D401E088534830020F8BD10B57E48FA +:102F400001244068817E03290CD00168497800295A +:102F500006D0006A8349884202D9002405F03CF972 +:102F6000204610BD0024FBE77348406802681178D2 +:102F7000491C1170016A0068C26A914204D8007D40 +:102F8000012801D0012070470020704700207047C1 +:102F9000F8B5694D63482860416A00270C680068ED +:102FA000342126460F548036B17F002927D1007D79 +:102FB000032824D1F9F7A3FD29684A690146104680 +:102FC000FAF7B6FF00281ADD2D68674B6A6A296890 +:102FD000126892880091C9695A43511A07F09AFF02 +:102FE000218D401C4218009953480A862968B28AEC +:102FF0000B8ED21A12B2002A03DC0760F8BD2F60D4 +:10300000F8BD012220318A7521464031CA8889885D +:10301000514F511A228D491E89188EB20546C0346F +:1030200019E0496A09794900795A00220092028E12 +:103030002379007D5B00FB5A591889B20123FFF701 +:1030400008FA00280ED001280FD002280AD03149F2 +:10305000464808F080F829680868028EB21A12B251 +:10306000002ADEDA00202860F8BD28680068018E9A +:10307000491C0186EFE770B52F4900244D680628EA +:1030800076D202007A441279921897441820020EE0 +:10309000240D002000F08FF9EC76AC762C60002136 +:1030A00008466C6200F0E2F870BD1D480D680078BB +:1030B000EFF72AF9EC76AC762C606C6270BD0120DB +:1030C00000F079F90021084600F0D0F870BD2968B9 +:1030D0000320087570BD686A29680068CA698A603B +:1030E0008188214A51432A68D1600146C0310A8A49 +:1030F00002838A7B82754A8A82808A8AC280C98AD0 +:10310000018129680220087570BD31E000E400E00B +:1031100008E400E0C42C010018E400E000ED00E049 +:10312000A0000020B8130020E0130020B000002011 +:10313000B800002008140020A8000020A12A0100E7 +:103140004B2B0100A4000020C9020000F60500007E +:10315000BB0200001027000034B40100520300003D +:1031600028140020D9821300E204000007060000A2 +:10317000DD49DE4807F0EFFF70BD70B500280BD0C9 +:103180000024DB4D01280ED002282FD0EF20D64995 +:10319000C00007F0E0FF70BD00F06BF900210846A9 +:1031A00000F064F870BD686801684C70C47684767D +:1031B0000460D04E446201220021706800F063FF79 +:1031C00071680846C0318C72CC72FFF77EFE002811 +:1031D00003D0C549C84807F0BEFFF9F7DBFBC74875 +:1031E0006C600078EFF790F86C6070BD00F041F90A +:1031F0006868C4768476046000214462084600F062 +:1032000035F870BDBA494968CA7E022A08D10A68F1 +:103210001378002B04D150600968CA6A1018C8627C +:10322000704710B5B24A002952680BD0012906D068 +:10323000022906D0AC49B24807F08DFF10BD801EB0 +:1032400000E0401F106210BD08B50020C043694671 +:103250000880AC48C07E002801D0002008BD084688 +:1032600000F0F6F90028F9D0012008BD70B5A04C97 +:1032700005466268002908D0002A04D0FF209A4938 +:103280000D3007F068FF656070BD002A04D1FF2093 +:103290009549133007F05FFF0020606070BD38B5BE +:1032A000934C20680168497801291FD001216846A4 +:1032B000F8F7C3FE684600789349000207F02AFE3B +:1032C0002068426AC06812685118F9F7AAFE21689E +:1032D000C8608C4822680321824202D0108B0A28E1 +:1032E00010D2108B401C108351720DE07D21C068FC +:1032F000C900F9F796FE2168C86004F025FD216831 +:103300000861E6E702205072117200231371107FEA +:10331000D47E111D957EAC4202D0FAF767F838BD15 +:10332000D37693761360536238BDF8B5704C05467A +:103330001F27EE7E042E2DD230007844007900182D +:103340008744312801237148854203D0664970487B +:1033500007F001FF02202560A87600E020BF216869 +:10336000C87E002803D0CA7E887E8242F6D0CA7EFC +:10337000002A04D000228A760C27226010E0002266 +:103380008A760A604A6222600DE00120FFF708FC9D +:10339000074603E054495F4807F0DDFE002F02D0E6 +:1033A000E87EB042C5D1E87E002803D04E495A4895 +:1033B00007F0D1FEF8BDF8B54D4D01286A68516A95 +:1033C0000C6846D10879554940000B5A1068077DB2 +:1033D0000126032F06D0027D022A13D0007D01288A +:1033E00024D036E00027076110688760942000969B +:1033F000025BC420005D4000085AC01881B23B4601 +:1034000003201EE022468032D78C07610096C4203C +:10341000005D928A4000085AC01881B20023022041 +:10342000FFF717F8696809680E750CE0942000969C +:10343000025BC420005D4000085AC01881B200231E +:103440000120FFF706F8002803D02749344807F089 +:1034500082FEF9F79FFA29480078EEF755FF696870 +:10346000002008830B68228D5A86096820318875F0 +:10347000F8BDF8B51E4D002168680C46006842781A +:10348000002A01D0447027E00078002809D00121EB +:103490006846F8F7F7FD684600781B49000207F018 +:1034A00039FD6868426AC06812685118F9F7B9FDB9 +:1034B0006A68D060147103205072107FD37E111D92 +:1034C000967EB34202D0F9F791FF03E0D47694766A +:1034D0001460546268680483F9F75CFA074800785E +:1034E000EEF712FFF8BD0000C42C010056070000E3 +:1034F000A8000020B800002003070000A000002062 +:103500009D070000E013002010270000B8130020E2 +:1035100007020000130200001902000034B4010089 +:10352000BC060000F8B50024E948FEF73EFE00287E +:1035300025D1E84FC02026464643F51901462846C6 +:1035400007F0DEFC0120B8556C80E34900200870CC +:10355000E24A4A8080356962E149641C0870A962C8 +:10356000E049E4B208704A80A963032CE2D3D8484A +:10357000FEF733FED648FEF718FE002801D00C20D7 +:10358000F8BDFF211931D84807F0BAFCD64801210F +:1035900001704480D5490020087208750877D44925 +:1035A0008872CB48FEF719FE0020F8BD10B5C84858 +:1035B000FEF7F3FD002803D0CEA1282007F0CBFDB5 +:1035C000C348FEF7EAFD002803D0CAA12D2007F06A +:1035D000C2FDFFF7A7FF002803D0C6A1332007F0E4 +:1035E000BAFD10BD10B50446B948FEF7DEFD00284F +:1035F00001D00C2010BDBC490878002807D000205D +:103600000870B3482160FEF7E8FD002010BDB04807 +:10361000FEF7E3FD1F2010BD70B505460C46AC4813 +:10362000FEF7C3FD002801D00C2070BDAE4A5088C3 +:10363000A84202D11078002804D0A548FEF7CDFD9D +:10364000122070BDA2482260FEF7C7FD002070BDA9 +:1036500010B504469E48FEF7A8FD002801D00C20B6 +:1036600010BDA1480178002907D00020C043208068 +:103670009748FEF7B2FD122010BD40882080944884 +:10368000FEF7ABFD002010BD10B504469048FEF7D4 +:103690008CFD002801D00C2010BD2078002804D01B +:1036A0008B48FEF79AFD0C2010BD01202070884841 +:1036B000FEF793FD002010BD10B504468448FEF7C8 +:1036C00074FD002801D00C2010BD824A0021C020CA +:1036D0004843105C00280AD0C023002059435054AE +:1036E000881820607A48FEF778FD002010BD491C3C +:1036F000C9B20329EBD37648FEF76FFD1F2010BD3A +:10370000032805D2C0225043724A135C002B01D01B +:1037100012207047801808600020704710B5002202 +:103720000C46032809D2C02148436A490B5C002B90 +:1037300014D122704018606018E003280ED164484C +:10374000FEF733FD002809D167484188032902D1DB +:103750000178002904D05E48FEF73FFD122010BD1D +:1037600060605B48FEF739FD01202070002010BD2D +:1037700010B504465648FEF718FD002801D00C206D +:1037800010BD2088534A032804D2C0214843105C4E +:10379000002801D00020208000202188491C89B207 +:1037A0002180032900D300212180C0235943515C8B +:1037B00000290BD0401CC0B20328EED30020C04328 +:1037C00020804348FEF709FD122010BD4048FEF757 +:1037D00004FD002010BD70B505460E463C48FEF7BE +:1037E000E4FC002801D00C2070BD2888341D03287B +:1037F00004D303D0A04201D3002028800020361D2E +:103800001DD0394B33492A88521C92B22A80A242D9 +:1038100000D300222A80042A02D3A24217D301E057 +:10382000032A05D0C02672438A5C002A0FD002E02A +:103830001A78002A0BD0401CC0B2A042E3D300206B +:10384000C04328802248FEF7C8FC122070BD2048E3 +:10385000FEF7C3FC002070BD10B504461C48FEF7FF +:10386000A4FC002801D00C2010BD2078002804D032 +:103870001748FEF7B2FC0C2010BD01202070144840 +:10388000FEF7ABFC002010BD10B504461048FEF753 +:103890008CFC002801D00C2010BD217801200029CB +:1038A00002D0012905D008E061680A78002A09D011 +:1038B00003E061680A78002A04D00548FEF78DFC11 +:1038C0000C2010BD08700248FEF787FC002010BDD8 +:1038D000C00000205814002098160020FFFF0000B0 +:1038E000C1000020C6160020D8160020B8170020FE +:1038F000D81700207372635C6C6C5F64622E630087 +:1039000010B5282107F0FAFA10BD70B50546007809 +:103910000A0700090001120F1043287007290ED270 +:10392000080078440079001887440305030503075D +:103930000300062408E00C2406E0222404E000240E +:10394000F8A1572007F007FC687880098001204320 +:10395000687070BD00780007000F704710B5C01C7C +:1039600007F0F5FC10BD0A4610B5C11C104607F063 +:10397000EEFC10BD10B5093007F0E9FC10BD02786F +:10398000BF23C9071A40490E0A43027070470078E6 +:103990004006C00F704702785206520EC9010A4312 +:1039A0000270704770B50C460546C11C20460930B0 +:1039B00007F0CDFC20784006400E2070297849069B +:1039C000C90FC9010843207070BD70B515460E4679 +:1039D00004461F2A03D9D3A1A82007F0BCFB204628 +:1039E0002A463146093007F02CFA6078AD1D80096F +:1039F0008001A906890E0843607070BD70B5054648 +:103A000040780E468406A40E062C03D2C5A1B82029 +:103A100007F0A1FBA41FE4B21F2C00D91F242946E4 +:103A200022460931304607F00CFA204670BD70B5C9 +:103A300015460E4604461F2A03D9BAA1CC2007F02A +:103A40008AFB20462A463146093007F0FAF96078A9 +:103A5000AD1D80098001A906890E0843607070BD04 +:103A600070B5044640780E468506AD0E062D03D28D +:103A7000ACA1DD2007F06FFBAD1FEDB21F2D03D908 +:103A8000A8A1E12007F067FB21462A46093130460C +:103A900007F0D7F9284670BD0A78C2734A780274D5 +:103AA0008A784274C978817470470A78C2744A78F7 +:103AB00002758978417570474176090A81767047A9 +:103AC000C176090A017770474177090A8177704703 +:103AD000C175090A017670478175704720300279F7 +:103AE000C90652095201C90E0A43027170472030BB +:103AF0000279D206D20E49010A430271704710B50D +:103B00001F3007F019FC10BD417800788906890E36 +:103B10000007000F06D0012808D0022809D0062887 +:103B200010D10AE0891F1F290AD90BE00C2907D000 +:103B300008E0891F1F2903D904E0891F1F2901D824 +:103B400001207047002070474178007889060007FF +:103B5000890E000F042805D1062903D3252901D891 +:103B6000012070470020704770B401780907090FE1 +:103B700003292ED0052931D1411C827E0C46437E7B +:103B800011021943037FC27D1D02037EC67E1B0204 +:103B90001343827D407835438006800E22281DD154 +:103BA00006291BD31920C001814217D8FF26F436FD +:103BB000B54213D8002A11D0082A0FD88A420DD254 +:103BC0008B420BD8617F227F09021143814208D9C1 +:103BD00004E040788006800E0C2802D070BC0020E3 +:103BE000704770BC0120704710B5222107F086F99C +:103BF00010BD10B502788B07920892009B0F1A43F4 +:103C000002704278520952014270012908D00229FB +:103C100006D0032905D0FF2042A1E83007F09BFA27 +:103C200010BD01210A43427010BD10B502788B0708 +:103C3000920892009B0F1A43027042785209520177 +:103C40004270012907D0022905D0032904D035A1EB +:103C5000384807F080FA10BD01210A43427010BDB8 +:103C600000788007800F70470278EF23C9071A4059 +:103C7000C90E0A43027070474178C078C906C90E60 +:103C80000E2835D202007A44127992189744060918 +:103C90000C0F1215181B1E2124272A2D0C2929D0A0 +:103CA0002AE0082926D027E0022923D024E017297A +:103CB00020D021E00D291DD01EE001291AD01BE0E3 +:103CC000012917D018E0022914D015E0092911D0D4 +:103CD00012E009290ED00FE001290BD00CE00129D8 +:103CE00008D009E0062905D006E0022902D003E049 +:103CF0001B2901D8012070470020704770B5054688 +:103D0000C1700E2926D20800784400790018874433 +:103D100006131517191B1B151D1D1B1B1F150C2426 +:103D20001DE000007372635C756C5F7064752E63D8 +:103D30000000000001020000082410E002240EE050 +:103D400017240CE00D240AE0012408E0092406E011 +:103D5000062404E000249A499A4807F0FCF96878A0 +:103D6000400940012043687070BDC0787047C17140 +:103D7000090A01727047017AC2790802104370473C +:103D80004172090A81727047817A427A08021043AF +:103D90007047C172090A01737047017BC27A080239 +:103DA000104370474171090A8171704781794279E6 +:103DB00008021043704701717047007970474173E2 +:103DC000090A81737047817B427B08021043704768 +:103DD00070B4017AC37909021943431C857A1C46E1 +:103DE000467A2B023343657926792C023443C21C70 +:103DF000754E00798D1FB54215D8FF25F435AB42BD +:103E000011D800280FD008280DD888420BD28C4238 +:103E100009D8507A117A00020843B11D884202D8AD +:103E200070BC0120704770BC0020704710B5001DA9 +:103E300007F082FA10BD0A4610B5011D104607F0C2 +:103E40007BFA10BD4172090A81727047817A427A09 +:103E5000080210437047017170470079704710B530 +:103E6000001D07F081FA10BD0A4610B5011D10466D +:103E700007F07AFA10BD0A780273497841737047E7 +:103E8000027B0A70407B4870704710B50E3007F017 +:103E90006BFA10BD0A46014610B50E31104607F008 +:103EA00063FA10BD0A7882754A78C2758A780276FC +:103EB000C97841767047827D0A70C27D4A70027E61 +:103EC0008A70407EC870704710B5001D07F04CFA2C +:103ED00010BD0A4610B5011D104607F045FA10BD89 +:103EE0000A7802734A7842738A788273C978C173F8 +:103EF0007047027B0A70427B4A70827B8A70C07B6B +:103F0000C8707047017170474171090A817170472B +:103F1000C171090A0172704700797047817942794D +:103F2000080210437047017AC279080210437047B3 +:103F300001717047007970470171704710B5001D1D +:103F400007F012FA10BD0A4610B5011D104607F021 +:103F50000BFA10BD10B5001D07F006FA10BD0A4699 +:103F600010B5011D104607F0FFF910BD70B51546DC +:103F70000E4604461B2A03D91149144807F0EBF8F2 +:103F80002A463146E01C06F05CFF6078E9064009ED +:103F90004001C90E0843607070BD70B50546407899 +:103FA0000E46C406E40E1B2C03D90549084807F049 +:103FB000D2F82246E91C304606F043FF204670BD89 +:103FC000243D0100A10200007A0C0000F103000072 +:103FD000FD03000070B504460020A083208C1E461F +:103FE00048431546114606F0A3FF2084F0002946F9 +:103FF00006F090FF401C80B20146192269439202EC +:10400000E083914201DD401EE0837D2029460002CD +:1040100006F080FF401CA08470BD70B50A7BD206FC +:10402000D20E0A73002282758B181B7ADC075B089C +:10403000DD07E40FED0F2C195B08DD07ED0F2C19E0 +:104040005B08DD07ED0F2C195B08DD07ED0F2D195F +:104050005C08E307DB0F5B196508EC07E40FE41865 +:104060006B081B1984186374847D521CE318D2B248 +:104070008375052AD8D3D8B2252803D9E1A18A208F +:1040800007F069F870BD70B504460B462546264614 +:10409000214600202835C0368031032B0AD0002B62 +:1040A0003AD0012B41D0022B03D1A11C2846FFF7A7 +:1040B000B4FF70BD2880A871E871E8722873687336 +:1040C000A873A870E870287168716876A8832B4679 +:1040D00068842033987128859872E8752876E8738B +:1040E0002874D872187398731A752884FF22603563 +:1040F000AA709875088248828882C882088348839B +:104100004877C884A4221055088748872421085579 +:1041100060843070B07170BDC8848877A1882389AD +:104120000A462846FFF756FFBFE7C884F38A728A1B +:10413000A1882846FFF74EFF70BD70B504460346C0 +:1041400028348033054603290AD0002933D00129B9 +:1041500038D0022903D1A91C2046FFF75EFF70BDAD +:1041600000202080A071E071E07220736073A07362 +:10417000A070E070207160716076A0832146608439 +:104180002031887120858872E0752076E073207474 +:10419000C872087388730A752084FF226034A27085 +:1041A00088751883987618742421586148551877B3 +:1041B000A035287370BDA9882B890A462046FFF7D1 +:1041C00009FFC8E7586AA988C38942892046FFF7D2 +:1041D00001FF70BD70B5867D0D460446002E01D0EE +:1041E000252E01D9122070BD002A18D0287EE17D2D +:1041F00050430818252106F08DFEE1750846CA08CF +:104200004907490F834BAA18595C127A914308D089 +:10421000314606F07FFE491CCAB200200AE00020A9 +:1042200070BD2076002070BD002803D02118097CC5 +:10423000511ACAB22118497C91423AD32918097AF5 +:10424000C943CB07DB17D21A521E1206120E35D005 +:104250008B07DB17D21A521E1206120E32D04B07F2 +:10426000DB17D21A521E1206120E30D00B07DB17C4 +:10427000D21A521E1206120E2ED0CB06DB17D21AFD +:10428000521E1206120E2CD08B06DB17D21A521EAB +:104290001206120E2AD04B06DB17D21A521E120635 +:1042A000120E28D00906C917511A491E0A06120E05 +:1042B00026D0401C0528B7DB1F2070BDC00020762B +:1042C000002070BDC000401C2076002070BDC000E2 +:1042D000801C2076002070BDC000C01C207600200D +:1042E00070BDC000001D2076002070BDC000401DC4 +:1042F0002076002070BDC000801D2076002070BD9B +:10430000C000C01D2076002070BD70B50D4604466B +:10431000072904D9FF203BA15D3006F01CFFE0789F +:10432000502108406907490F88300843E070A078A1 +:10433000A72108401830A07060785E210840203026 +:1043400060702078BC2108404030207070BD017939 +:10435000490901D000207047002230B41146445C66 +:10436000491CE3076408E507DB0FED0FEB18640851 +:10437000E507ED0FEB186408E507ED0FEB1864088F +:10438000E507ED0FEB186408E507ED0FEB1864087F +:10439000E507ED0FA407EB18E40FE318D218D2B22B +:1043A0000529DCDB002A02D030BC0120704730BC7C +:1043B0000020704738B505460C466846FCF74EF8B5 +:1043C00000281ED069460020085620720921615637 +:1043D0000022411A00D549422035EB788B420FDC90 +:1043E000FF2B0DD0A17A491CC9B2A1722B79994239 +:1043F00002D8617A7F2903D160720020A072012265 +:10440000104638BD7372635C6C6C5F7574696C2E9A +:104410006300000044B40100F8B50024F74EFF200B +:10442000B470F0702546F64F06E0042D04D3FF204B +:10443000F4A1AB3006F08FFEFF212846A03148439F +:10444000FF213331C0194A1C0C540146FF3114546A +:1044500021310C754C75F178A94202D1B470FF215D +:10446000F170FF219D314A1C6D1C0C54EDB21454A7 +:10447000042DDAD30020FF21A0314143C919FF31B7 +:1044800081318C77401CC0B20428F4D3E048FFF798 +:10449000ABFB0021DE48FFF7E7FB0121DC48FFF71B +:1044A000A8FBDC49FF20087048708870C87008714C +:1044B0004871F8BDB0E71B20704710B4D04A002106 +:1044C000FF23A0334B439B18FF3381339B7F002B8B +:1044D00004D0491CC9B20429F2D30DE004290BD23F +:1044E000FF23A0334B439A180124FF328132947783 +:1044F0000170204610BC704710BC0020704730B4DB +:104500000025042825D2FF220146A0325143BC4A8F +:1045100089180B46FF3381339A7F002A19D0FF2474 +:104520003334621C655455541A46603A15755575F6 +:10453000B24AD478844202D19570FF20D070FF2017 +:104540009D304554FF319E310D709D7730BC012068 +:10455000704730BC0020704704280ED2FF2201466D +:10456000A0325143A64A8918FF318131897F002941 +:1045700003D0A8494871012070470020704710B44B +:10458000A449FF224979A03251439D4A82B089183B +:104590000A46FF322132937C6C462370D27C227112 +:1045A000237822795A40802A0AD022782223520680 +:1045B000520E5A435118016002B010BC01207047DE +:1045C00002B010BC002070479248FF214079A03112 +:1045D00048438B4981B041180846FF303330FF31E2 +:1045E0002131CA7C69460A7003780922097859404A +:1045F00080290ED0037869460B7009784906490E68 +:10460000491C914208D26A461178491CC9B21170FE +:1046100009E0002001B0704769460978090601D514 +:10462000002100E080210170012001B070470428C2 +:104630000ED2FF220146A0325143714A8918FF3140 +:104640008131897F002903D07249087101207047A8 +:104650000020704710B46F49FF220979A0325143FE +:10466000674A82B089180A46FF322132947C6B4631 +:104670001C71D27C1A701C781A7994420AD01A786C +:1046800022235206520E5A435118016002B010BC48 +:104690000120704702B010BC0020704738B55D485B +:1046A0000179FF20A0304143554808180146FF31E9 +:1046B00021318A7C6C4622700922FF303430037825 +:1046C0002478A34223D004786B461C701B785B06C9 +:1046D0005B0E5B1C934205D26B461A78521CD2B219 +:1046E0001A7006E06A461278120601D5002200E030 +:1046F00080220270087D401C0875087D497D884233 +:1047000003D140A1444806F026FD012038BD002019 +:1047100038BD4048FF210079A0314843384940184E +:10472000FF302130C17C807C814201D10120704763 +:10473000002070473748FF210079A03148433049B5 +:104740004018FF302130817CC27C092013464B4049 +:10475000802B0AD049065206490E520E914201D3CF +:10476000881A01E0511A401AC0B2704709207047F8 +:104770000022042813D2FF23A0335843204BC01833 +:10478000FF239F331B5C002B09D0FF300A702130C0 +:10479000027D437DD31A0B704275012070470020C3 +:1047A0007047042811D2FF22A0325043144A8018C7 +:1047B000FF229F32125C002A07D0FF302130027D99 +:1047C000407D101A08700120704700207047104982 +:1047D0000160704704280ED2FF220146A0325143E7 +:1047E000074A8918FF318131897F002903D009499F +:1047F000087001207047002070470000101800204A +:10480000141800207372635C646D5F712E63000086 +:10481000901E0020C70000205A020000AC49CA7850 +:10482000FF2A03D000210160084670478A78A94911 +:10483000012A02D001600120704700207047A6487D +:104840000178012907D001210170A4480178A0480E +:10485000C170012070470020704704280ED2FF224B +:104860000146A03251439E4A8918FF318131897F28 +:10487000002903D0994948700120704700207047F3 +:104880009349964BCA785B789A4206D18A78203948 +:10489000002A02D0016001207047002070478C4838 +:1048A0008E4AC1785278914209D1FF21C170801C93 +:1048B0000178002903D000210170012070470020F9 +:1048C00070478348854AC1785278914204D18078F4 +:1048D000002801D0002070470120704704280ED224 +:1048E000FF220146A03251437D4A8918FF318131B0 +:1048F000897F002903D07949C870012070470020C2 +:10490000704710B47549FF22C978A0325143744AE8 +:1049100082B089180A46FF328132147F6B461C70C0 +:10492000527F1A711C781A79FF3162403731802A20 +:104930000AD01A7822235206520E5A4351180160A7 +:1049400002B010BC0120704702B010BC00207047BC +:104950006248FF21C078A0314843614981B04118C5 +:104960000846FF309D30FF3181314A7F69460A7029 +:10497000037803220978594080290ED003786946CC +:104980000B7009784906490E491C914208D26A46C3 +:104990001178491CC9B2117009E0002001B07047BC +:1049A00069460978090601D5002100E080210170DF +:1049B000012001B070474948FF21C078A031484329 +:1049C00047494018FF308130417F007F814201D14B +:1049D000012070470020704704280ED2FF220146B4 +:1049E000A03251433E4A8918FF318131897F002925 +:1049F00003D03A498870012070470020704710B4F6 +:104A00003649FF228978A0325143354A82B089184D +:104A10000A46FF328132147F6B461C71527F1A7036 +:104A20001A781B79FF3137319A420BD06A461278D7 +:104A300022235206520E5A435118016002B010BC94 +:104A40000120704702B010BC002070472348FF21AE +:104A50008078A0314843224981B04018FF219D3120 +:104A6000095C6B4619700321FF309E3002781B7879 +:104A70009A4219D003786A46137012785206520E81 +:104A8000521C8A4205D26A461178491CC9B211707B +:104A900006E069460978090601D5002100E0802179 +:104AA0000170012001B07047002001B070470B4831 +:104AB000FF218078A031484309494018FF308130F8 +:104AC000417F007F814201D1012070470020704763 +:104AD00010180020F017002012180020C700002036 +:104AE00014180020F8B5FD4F0A46044600207978D6 +:104AF000FB4D0646002902D0012909D00FE0F949F3 +:104B0000497A00290BD0002A08D10120787005E0ED +:104B1000A97F002903D0002A00D17E700120797876 +:104B20002B23594349198B7F034311D0002A22D1EB +:104B30002A22A01C1F3106F084F966700420207020 +:104B40000120A07078782B2148434019867712E025 +:104B50002878012801D00020F8BD002A0BD166700A +:104B6000132020701C22A91CA01C06F06AF9A67153 +:104B70002E70DD48C6770120F8BDD948017800299C +:104B800001D080887047D9487047F8B5D44E0746A1 +:104B9000B07F00282DD13846FEF7DCFE002101252C +:104BA000D34C072824D202007A44127992189744F1 +:104BB0000305081F1F1F0A00217006E025702172DF +:104BC00008E0032000E002202070CA493846FEF7C2 +:104BD00015FF20723846FEF7DAFE6070C649384687 +:104BE000FEF7C1FEBD4CC54F20787F2807D101E0FC +:104BF0002172F8BDFF20C2A1543006F0ACFA207833 +:104C000038707F202070B577032002F0E7FEF8BDF2 +:104C100010B5002002F072FE002812D0FBF79CFBBA +:104C200000210120FBF7A0FABA48FBF7ACFBAE4C21 +:104C3000A06AFBF7ABFB2079032805D0022803D03C +:104C400006E000F0F3FD10BD01210020FBF716FC8B +:104C5000FBF7FBFBB04C6078002803D0FBF77DFF2F +:104C6000FBF7D9FB0320E07010BD70B59E4900280A +:104C7000CA8D08D0FF2A0DD25004000CC885FF2829 +:104C800008D9FF2005E0012A04D95008C88501D1C0 +:104C90000120C88591484268012A01D0002A01D12B +:104CA0000D224260D24317239B4C5A43637B3B2522 +:104CB000DB436B43D2184260C98D900C06F02AF991 +:104CC000617370BDF8B5944CE078022804D0E078A8 +:104CD000012801D00C20F8BD0020814A05462B2177 +:104CE000414389188D77401CC0B20228F7D3157054 +:104CF0006078002804D0FBF796FBFBF73FFF657058 +:104D0000794845778577C5778449257001228A7768 +:104D10000571A570CA760A774A77714E0146324608 +:104D2000736F7432B46FF66FD7688B60CC600E61AE +:104D30004F6112698A6105770020F8BD10B5764A87 +:104D40000023D3701371684B596318630120D0702E +:104D5000FFF7B8FF002803D069A1714806F0FBF9FE +:104D600010BDF1B582B00C2001906B480090C07866 +:104D7000012806D00098C078022802D00C2003B089 +:104D8000F0BDFBF7F0FA0020FBF7B1F8564C207F9E +:104D9000002837D0524920460F4682687437C368CE +:104DA000056946694A678B67CD67FE60806938612F +:104DB00000266677A677594DE87E002805D1287F22 +:104DC000002802D1687F00281AD0009800780028B7 +:104DD00016D02079032802D0022805D008E005214A +:104DE000504800F040FD03E003214E4800F03BFD39 +:104DF000A97E3846FBF7F3F80020019026770CE0F7 +:104E0000267703E00098C078022804D00098C07884 +:104E1000022828D00AE0002001900098C0780128DC +:104E200004D10099087300980221C170606B017869 +:104E3000002903D00178001DFBF714F9206B0178DD +:104E4000002906D0384A401CFBF777FE0099012064 +:104E500048700298A0623548FBF717FAFBF78EFA04 +:104E6000019803B0F0BD00990120C8700C2003B078 +:104E7000F0BD70B5FBF777FA274CE078022803D035 +:104E8000FBF77CFA0C2070BD012017496073C885C0 +:104E90000220FBF765FA2648FBF739F9254E002575 +:104EA000A0780321401C06F035F8A170885D012828 +:104EB00044D06D1CEDB2032DF2D3FFF7A9FE20798B +:104EC000002809D0012807D002283DD003283BD074 +:104ED0000BA1194806F03FF9002070BDD00000205A +:104EE000B41E0020F41E0020341F0020FFFF00002D +:104EF000D41E0020DD1E0020D61E0020FC1E002037 +:104F00007372635C6C6C5F64645F7363616E2E6369 +:104F1000000000006C1F0020541F0020141F002000 +:104F200051030000941F00206F1F00204CB40100AB +:104F300052B401002F1F0020EA030000C8B2FC4950 +:104F4000085CFBF7F6F8B8E7EEF762F8C4E770B56F +:104F5000F84C0125A577E37F002B01D03A2070BDE6 +:104F60000026002802D1A07B884209D1A173667770 +:104F70001146F14806F0EBF96577F04805702577A2 +:104F8000A677002070BD024600200123E949002ACF +:104F900003D0012A03D0122070478B7400E088747C +:104FA0000B774A767047E34A032800D151611076A7 +:104FB0000120107700207047E049012803D0032822 +:104FC00001D0002000E0012008717047D948017F1E +:104FD000002903D0407E002803D170474079002883 +:104FE000FBD00120704710B5FBF709FAFBF7FCF97D +:104FF000FBF708F9FBF7AAF9D04C6078002805D038 +:10500000FBF711FAFBF7BAFD002060700120207356 +:105010000220E070FBF7B2F9002010BDC7494871CB +:10502000704710B500F002FC10BDF0B5C44EC34D82 +:1050300083B0002810D0C348FEF766FD002804D1D5 +:10504000C048FEF781FD002806D0BA4C207903281D +:105050000DD1A07F00280AD0E87805286BD2010086 +:105060007944097949188F44666666F7F600E8784E +:1050700005287AD201007944097949188F44757559 +:105080007502EE00AF48FEF765FCAD498870AE488A +:105090000190807F002803D1FBF736F8002800D06C +:1050A000012000906878002813D00526761EF6B2FD +:1050B000FBF785FD0746022805D1002EF6D1A3494E +:1050C000A34806F048F80098002810D1012F0ED010 +:1050D00000909B4F9F4EB878072871D20100794409 +:1050E000097949188F446DFE056C6C6C280001200D +:1050F000EEE76878002803D0FBF795F9FBF73EFD53 +:105100008F48FBF7ABF9002801D17F203870FBF7FF +:1051100093F9009800280AD02079012801D00228AC +:1051200005D1FBF76FF88748FFF72FFD37E2FBF754 +:1051300069F8FFF76DFD34E26878002803D0FBF7CB +:1051400072F9FBF71BFD7E48FBF788F9002801D1B7 +:105150007F203870FBF770F90098002879D020790B +:10516000022803D001287AD047E221E27548FFF7F0 +:105170000CFD012002F0C2FB00286ED07649714878 +:10518000FEF710FC7448FBF7FEF8607F00280ED095 +:105190006848019902898A824289CA828089088383 +:1051A00031466D48FEF7DAFB00206077A0770121D9 +:1051B0000846FBF763F9FBF703F90520E870F0E117 +:1051C0005BE16878002803D0FBF72DF9FBF7D6FCEC +:1051D0005B48FBF743F9002801D17F203870FBF7CB +:1051E0002BF90098002834D02079022808D0012813 +:1051F00035D0032837D05549584805F0ACFFD0E1E9 +:105200005048FFF7C2FC012002F078FB002824D0B0 +:1052100051494C48FEF7C6FB4F48FBF7B4F8607F96 +:1052200000280ED04348019902898A824289CA82A5 +:105230008089088331464848FEF790FB002060775C +:10524000A07701210846FBF719F9FBF7B9F805200B +:1052500001E10EE103E0BFE1ADE1B3E022E1394855 +:10526000FFF793FC9BE137482168C2780B7F9A4295 +:105270001DD102794B7F9A4219D142798B7F9A4294 +:1052800015D18279CB7F9A4211D10A462032C37957 +:105290001778BB420BD1037A5278934207D100783A +:1052A000CA7E4006C00F904201D1012000E00020DC +:1052B0006279012A30D0002800D138E7022002F0BC +:1052C0001DFB00287ED0012002F088FB22491D48EA +:1052D000FEF768FB2068018B1F48FEF7F9FB20688A +:1052E000817D00E03CE01C48FEF7F6FB1A48FBF726 +:1052F0004AF8607F002866D00E48019902898A82A8 +:105300004289CA828089088331461348FEF726FB0A +:1053100000206077A0779BE00028CFD109481C319E +:10532000FEF721FB0748FEF732FB2168C876C5E788 +:105330004FB40100341F00203C1F0020541F0020E8 +:10534000D00000206C1F0020141F0020004F01001F +:10535000D4040000281F0020941F0020CC0500006A +:105360006878002803D0FBF75EF8FBF707FCF948E4 +:10537000FBF774F8002801D17F203870FBF75CF848 +:105380000098002875D0FAF733FE002871D02079F4 +:105390000328F14804D0FFF7F8FBFAF733FFFEE0EB +:1053A0002168C2780B7F9A4220D102794B7F9A42C2 +:1053B0001CD142798B7F9A4218D18279CB7F9A4255 +:1053C00014D101E056E043E00A462032C379177851 +:1053D000BB420BD1037A5278934207D10078CA7E40 +:1053E0004006C00F904201D1012000E00020627908 +:1053F000012A32D0002800D199E6022002F07EFA7C +:10540000002837D0012002F0E9FAD449D248FEF74B +:10541000C9FA2068018BD148FEF75AFB2068817DCC +:10542000CE48FEF759FBCD48FAF7ADFF607F002864 +:105430000ED0CB4901980A8982824A89C282898921 +:1054400001833146C548FEF789FA00206077A077CE +:105450000120E0770620E870A3E00028CDD1BE4807 +:105460001C31FEF780FABC48FEF791FA2168C87635 +:10547000C3E7C2E000F0DAF993E06878002803D0CF +:10548000FAF7D1FFFBF77AFBB248FAF7E7FF0028FB +:1054900001D17F203870FAF7CFFFFAF7B3FEFFF79C +:1054A000B7FB7EE0AC48FEF755FAB070AA48AB49AE +:1054B000C3784A7A93421CD103798A7A934218D1ED +:1054C0004379CA7A934214D183790A7B934210D1EB +:1054D000C3794A7B93420CD1037A8A7B934208D1E9 +:1054E000007809784006C00FC909884201D101241B +:1054F00000E00024FAF786FEB07804283ED1002CA4 +:105500003CD09448FAF7AAFF002801D17F203070E0 +:10551000FAF792FF287B002802D00020FFF7A5FBB6 +:105520000120904C28738C4F607A002837D10420DA +:10553000E0723846FEF72BFA002801D0012800D18E +:10554000207389493846FEF70EFA88493846FEF737 +:1055500087FAE0741F2801D91F20E0743078844F47 +:105560007F2804D1FF208349543005F0F4FD3078C2 +:1055700038707F2030700120607210E07548FAF7B3 +:105580006DFF002801D17F203070FAF755FF287B8E +:10559000002802D10120FFF768FB00202873FFF7E5 +:1055A00037FBE87802283DD0E87804282DD127E0A1 +:1055B0007049714821E66878002803D0FAF733FF74 +:1055C000FBF7DCFA6348FAF749FF002801D17F2096 +:1055D0003070FAF731FF10E05E48FAF73FFF00281D +:1055E00001D17F203070FAF727FF287B002802D1F5 +:1055F0000120FFF73AFB00202873FAF703FECEE7FD +:1056000037205C49400105F0A6FD2879002809D023 +:1056100001280ED0022807D0032810D0554957483A +:1056200005F099FD03B0F0BDE878032807D003B07A +:10563000F0BDE878062802D0E8780528F7D10120E7 +:10564000FAF7D2FF03B0F0BD70B54D4CE0780728F3 +:105650005FD201007944097949188F445A5A5A5A3D +:105660005A030B003C48FAF78EFEFAF7EEFE0420D0 +:10567000E07053E0FAF7C3FEFAF7B6FEFAF7C2FDA0 +:10568000FAF764FE012626730220E070FAF776FE30 +:105690003C4D2878002803D036493B4805F05BFD97 +:1056A0000020A8702E4800684188A980C17EE97159 +:1056B000818B2981C18B6981018CA9818188E982D3 +:1056C000C188298300896883607928772F48304909 +:1056D000807EA8732F4805F03AFE6078002803D03A +:1056E000FBF76DFA012808D0687F40084000687712 +:1056F0002E70022002F072F910E0687F3043687764 +:10570000FBF776FA697F4000C907C90F0143697743 +:10571000EEE775201749000105F01DFDE07802282D +:1057200016D0E078032806D0E078042803D0114989 +:10573000194805F010FD2079002809D0012807D06C +:1057400002282DD003282BD00A49144805F003FD68 +:1057500070BD0000D00000206C1F0020941F0020AE +:10576000341F0020F41E0020011F0020081F00200D +:10577000271F0020004F01009E060000F5060000D4 +:10578000541F0020B41E002029070000141F002011 +:10579000281F0020C31E00205607000062070000DB +:1057A0000120FAF721FF70BD10B55C4CE0780528A8 +:1057B00020D201007944097949188F441B1B1B1919 +:1057C00002005748FAF74AFE002802D154497F20C8 +:1057D0000870FAF731FE207B002802D10120FFF784 +:1057E00044FA00202073FAF70DFDFFF711FA01E0EB +:1057F00000F01CF8E078022813D0E078032803D0EA +:105800004849494805F0A7FC2079002809D001281B +:1058100007D0022806D0032804D04249434805F0A7 +:105820009AFC10BD0120FAF7DFFE10BD10B5FAF7A3 +:10583000E6FDFAF7D9FDFAF7E5FCFAF787FD374CF4 +:105840006078002805D0FAF7EEFDFBF797F9002005 +:105850006070012020730220E070FAF78FFD0020B5 +:1058600002F0BCF810BD70B5314C054626466036D6 +:105870007434032943D0052940D1FEF741F80521AE +:105880002846FEF742F8B17E2846FEF778F8214612 +:105890002846FEF763F8274C284621680F31FEF7AB +:1058A000FBF8216828461331FEF7FFF82068817D58 +:1058B0002846FEF711F92068018B2846FEF708F903 +:1058C000206881882846FEF7F7F82068C1882846B6 +:1058D000FEF7F6F8206801892846FEF7F5F82168FA +:1058E00028460A31FEF70BF92068817E2846FEF72C +:1058F000F5F80A4841792846FEF7F9F870BDFDF73A +:10590000FFFF03212846FEF700F8B17E2846FEF788 +:1059100036F821462846FEF721F870BD541F0020B6 +:10592000D0000020004F010099070000A5070000EB +:10593000B41E0020341F0020F8B5FEF7FBFE04461D +:10594000FEF7BFFFF74E0546F0682030407B002889 +:1059500026D0012867D0022869D0032871D0FF2003 +:10596000F1A1793005F0F7FB3069F7220178114099 +:105970000170F2682032937BDB071B0F1943FB2376 +:1059800019400170D37BDB075B0F19430170577B14 +:10599000EF23022F60D0012F63D0032F65D06AE080 +:1059A000E548FEF76DFF002827D030690090F168C8 +:1059B000088DC9884018801D87B20098FEF7D5F978 +:1059C000012805D00098FEF7D0F9002808D00FE094 +:1059D000F06839468030C7850098FEF733FA07E053 +:1059E000F06839468030406A87800098FEF7E7F912 +:1059F000F168032020314873B6E7CF48FEF72AFE4E +:105A0000002804D0F0685321095C002907D0CA4857 +:105A1000FEF7DDFEF168012020314873A4E7022182 +:105A200020304173A0E7C448FEF7D1FE9CE7C2488E +:105A3000FEF710FE002897D1FF20BBA16B3008E0D5 +:105A4000FFE7BD48FEF71CFF00288DD1FF20B6A15F +:105A5000733005F080FB87E7012C08D8002D06D0B5 +:105A600009E06D1E2C4302D105E0002C03D0194043 +:105A70001023194300E019400170D17D002915D091 +:105A8000517B012912D0AD48FAF77DFCAC480121C9 +:105A90000176F268116E526E42610161A749326966 +:105AA000FAF7D7FF0020FAF7E3FF03E0FAF76BFC01 +:105AB000FBF701F801210846FAF7E0FC03203070FB +:105AC000F8BD08282FD203007B441B79DB189F44C4 +:105AD00003060B0E11152528002926D023E00229E4 +:105AE00023D0032921D01EE007291ED01BE008295E +:105AF0001BD018E00A390B2917D914E00D2914D04E +:105B00000C2912D0002A04D00D290CD315290CD948 +:105B100009E0112907D3152907D904E0092904D080 +:105B200001E0012901D0002070470120704730B505 +:105B3000054683B08048FEF771FE002803D17AA1A4 +:105B4000804805F008FB774C2069FEF74DF80321EB +:105B50002069FEF76AF82069EF2201781140017090 +:105B60002946FEF7CBF80D2D76D22800784400792F +:105B7000001887441F1606448080840E7280848437 +:105B800060006848C16800698031497FFEF763F9A9 +:105B900075E06448C16800698031497AFEF7CCF944 +:105BA0006DE06048C16800698031896A491CFEF770 +:105BB0003DF964E05B4CE0688030406A817920699F +:105BC000FEF7F9F8E0688030406A01892069FEF745 +:105BD000E9F8E0688030406A41892069FEF7C7F83B +:105BE000E0688030406A81892069FEF7C9F8E06882 +:105BF0008030406AC1892069FEF7CBF83FE0494C0C +:105C0000E0688030416A2069091DFEF728F9E068E4 +:105C10008030416A20690C31FEF72DF9E068803050 +:105C2000416A20691E31FEF730F9E1682069803150 +:105C3000FEF738F923E03B4CA06901782069FEF7B4 +:105C400061F9A06981882069FEF75EF9A069418841 +:105C50002069FEF75DF912E00DE000200090694632 +:105C60000190087801210843694608702D480069B1 +:105C7000FEF764F903E02CA1334805F06CFAFEF757 +:105C8000DEFD002803D128A1304805F064FA0C2D70 +:105C90000ED0072D0ED0012D0AD0002D08D0022DD8 +:105CA00006D020480021C068403041810121817325 +:105CB00003B030BD1B480021C0684030018203B0F2 +:105CC00030BDF0B5174C8DB02079C0077ED060791B +:105CD00000287BD16069C0780E2878D20100794411 +:105CE000097949188F44737306733D5DE25C73FD57 +:105CF0007334FCA5E06854210A5C2030417D01200A +:105D0000FFF7DFFE00284BD16069FEF7A6F8E168D7 +:105D10009E22505402223520425400204031887483 +:105D20008873EFE1D80000207372635C6C6C5F6D68 +:105D300061737465722E6300E8000020E21F00208A +:105D40000820002083060000C7060000CD060000E2 +:105D5000E0682030C17C0A297ED10021C1750D2167 +:105D60001DE0E0683321095C0E2975D1A421095892 +:105D700040884988814203D0FAA1FE4805F0EBF93A +:105D8000E0688030416A60692631FEF7A2F8E16878 +:105D900060698431FEF7ADF8E06811212030C174EC +:105DA000B0E1E1683320405C112855D180318C4648 +:105DB0004B6AF14810260022082168440E33B51AB8 +:105DC000ED18203DEF7F4770AD7F01E0A2E17AE161 +:105DD0008570801C491E921C0029F0D161464B6AD7 +:105DE00003A810260022082103301E33B51AED182F +:105DF000203DEF7F4770AD7F8570801C491E921C4F +:105E00000029F3D16846FCF746FA08AD8DCDE1686C +:105E100000260E664E660D4670318DC10126203576 +:105E2000EE75D64E8DC6D64805F09EFA1320E8745E +:105E300068E1E0683321095C112901D00E293AD1CB +:105E40004030007D002836D16069FEF773F8E168C4 +:105E50000B460A46803300E02DE0187200254031E1 +:105E6000CD748D73586A51884088884203D0BDA193 +:105E7000C44805F070F9E06801468030426A157048 +:105E8000826B1378002B03D0D920B6A1800033E0B9 +:105E90004B88D380836B027A1A71826B1572836B85 +:105EA0000B221A70806B4988418008E1E068332139 +:105EB000095C152902D00220607123E1014600250A +:105EC0004031CD748D73A42109584088498881429E +:105ED00003D0A4A1AC4805F03EF9E068014601E01A +:105EE0002CE094E080314A6A15708A6B1378002B9D +:105EF00005D071209BA1C00005F02DF9DFE003461D +:105F000040331E7D002E0BD01D754388D3808A6BD5 +:105F100015718B6B0C221A70896B40884880CEE01B +:105F20004388D3808A6B15718B6B01221A728B6B3D +:105F30000B221A70896B40884880C0E0E0685421C9 +:105F40000A5C2030017D0020FFF7BBFD00280DD149 +:105F5000E06854210A5C2030C17C0720FFF7B1FDC6 +:105F6000002803D16079012108436071607900281D +:105F70004CD1E0684030807D800715D46069FDF722 +:105F8000CBFFE1684031C8756069FDF7C7FFE16884 +:105F9000403108836069FDF7C6FFE16802224031A5 +:105FA0004883887D10438875E068014640318A7DCA +:105FB000D20716D10A7D2030017D0020FFF781FD38 +:105FC000002803D167A1714805F0C5F8E0680121F8 +:105FD000342211540623A02213544030817400212E +:105FE0000182E06801462031CA7C012A03D10022E7 +:105FF000CA744E210A54A421095840884A88824212 +:1060000004D1087806287DD1002008707AE0E06885 +:1060100054210A5C2030C17C0620FFF752FD002885 +:1060200003D160790121084360716079002869D14A +:1060300069466069FDF793FF68460078C107C90F9C +:106040006846017004D0E06801214030017703E028 +:10605000E068002140300177E06800254E210D54B2 +:10606000A421095840884988814203D03DA148486D +:1060700005F071F8E06802468030416A0D70816B6E +:106080000B78002B04D037A1424805F064F816E0E5 +:106090005388CB80816B6B460D71816B1B880B81A4 +:1060A0006B465B884B816B469B888B816B46DB889C +:1060B000CB81836B06211970806B51884180E06829 +:1060C0002030C5741EE0E06854210A5C2030017D58 +:1060D0000020FFF7F6FC002803D160790121084376 +:1060E0006071607900280DD16069FDF73EFEE168BE +:1060F0008922505405223420425400204031088225 +:1061000001208874E2680023916ED06E491C5841CA +:106110009166D0660DB0F0BDF8B5FAF770F9FAF7F0 +:1061200063F9FAF76FF8FAF711F9FAF7C4FCFAF71E +:1061300025F9194CE06820300079012801D1FAF7DF +:106140007BF9E068012502462032917D002908D1C3 +:10615000E178CB0701D1890703D59575012101F0BD +:10616000F9FB1BE07372635C6C6C5F6D617374654B +:10617000722E630021030000FFFFFFFF08200020B4 +:10618000212000205F03000083030000C303000000 +:10619000F1030000F6030000D8000020E07900269B +:1061A00000284FD100F06DFDF848FEF737FB0028BE +:1061B00048D06079002845D1E06854210A5C20303D +:1061C000417D0120FFF77DFC00283BD1E0680246BD +:1061D0008032117F002901D0022051E00346203394 +:1061E000D97C05292AD0E927FF000C292DD00D29BB +:1061F00029D0132943D01B7D012B4BD0052B42D036 +:10620000526A1378002B61D0528843889A425DD13C +:106210004030027D0020FFF754FC00287FD0E0686A +:10622000A42109580978891E062978D20A007A44DF +:106230001279921897443A3C7373658CD449D548C7 +:1062400004F089FFB6E00B201AE0F5F71AFF0C28DE +:106250007DD3E06808218030406A1E30F5F712FFD8 +:10626000002806D0E06804218030F5F70BFF0028F5 +:1062700003D1C749384604F06EFF032000E0062032 +:10628000FFF755FC96E00720FFF751FCE06820304F +:1062900006758FE00C20FFF74AFCE06801464030AD +:1062A000827D2A43827520310E7583E000200BE049 +:1062B0002030C17D00290AD0007E002803D1B449D6 +:1062C000B54804F048FF0A20FFF731FC27E0F5F756 +:1062D000D8FE0C2823D3E06808218030406A1E30A5 +:1062E000F5F7D0FE002806D0E06804218030F5F7ED +:1062F000C9FE002803D1A649384604F02CFF03202C +:10630000E2E74030807D800709D10C20FFF70FFCC9 +:10631000E068403046818573817D294381759B48C3 +:10632000FEF77CFA002845D0E06854210A5C203052 +:10633000C17C0020FFF7C5FB00283BD0E168AC2002 +:10634000405C002836D0E0690078002802D031E0B7 +:106350000820B9E7088D0A282CD905220A31206ABD +:1063600004F042FD002822D0E0688030816A08787D +:1063700000280CD00522491C206A04F035FD0028B5 +:1063800018D1E0688030806A0078002806D1E06883 +:10639000216A8030806A401C04F0CEFFE0688030C3 +:1063A000806A0178491C01700120FFF7C0FBE0689A +:1063B000A0300673E078C007E06802D040308680E5 +:1063C00003E040308188491C8180E0689C21095CA1 +:1063D000002908D154210A5C2030417D0120FFF7BB +:1063E00070FB002804D0E06840300189491C01811D +:1063F000E0793D21002804D0E0684030817045708C +:106400005AE0207A02280AD001280AD060790028B0 +:106410001AD0420701D4C2060AD51E21ECE7162184 +:10642000EAE7E0689E21095C40308170457043E0F6 +:106430000207E1D4C10705D1800703D45449574866 +:1064400004F089FE2A21D7E7E06802464032917BBA +:10645000002905D05389591C518191898B4213D24F +:10646000917C002905D0118A4B1C13829389994293 +:106470000AD21789D3889F4203D39C21095C002943 +:1064800002D191898F4203D322209070557013E07E +:106490003621095C0029918805D0994209D308204A +:1064A0009070557008E0062903D33E209070557017 +:1064B00002E05178002908D0E06801462031CE740E +:1064C0000E758E752570022101E02570002101F006 +:1064D00041FAF8BDF8B50C4616466946FDF710F9C5 +:1064E000002801D00020F8BD009800250246803029 +:1064F000816B0B78072B1CD0A71C0C2B29D00B2BE6 +:1065000034D0062B4CD01146A031087C0028EAD0AC +:10651000657012202070087C002808D0A2320D740B +:10652000108A6080508AA080087C0028F7D1012062 +:10653000F8BD002EFBD1657007212170816B0A2206 +:10654000A01C091D04F07DFC00988030806B057054 +:10655000EDE7002EEBD165700C212170816B8A88EC +:106560006280C988A180806B0570E0E7002EDED1D3 +:1065700065700B212170816B8A883A80CA887A8085 +:106580000989B980806B0570D1E70000E800002020 +:1065900064610100BE0500007905000032020000C0 +:1065A000002EC4D1657006212170816B8A883A80E3 +:1065B000CA887A800A89BA804A89FA808A893A81A7 +:1065C000CA897A81806B0570B1E7FE48007801289E +:1065D00001D00C2070470020704770B5F94C05467B +:1065E0002078002803D0F849F84804F0B4FD0020D2 +:1065F000A5616072012020702078012803D0F24943 +:10660000F34804F0A8FD70BDF8B5EE4C21780129DF +:1066100001D00C20F8BDE0608030807AFEF707F8EA +:1066200000283AD0E0688030807AFEF757F90028D9 +:1066300033D0E0688030807AFEF7CCF800282CD088 +:10664000E0688030807AFEF708F9002825D0F9F755 +:106650008AFE0026E6710120F9F749FCE068014650 +:1066600040318A7B002A03D04A898B899A4211D211 +:106670008A7C002A03D00A8A8B899A420AD20B8923 +:10668000CA88934206D236231B5C8988002B06D029 +:10669000914206D30120A0703BE01220F8BD0629EC +:1066A000F8D2A6701330F9F7F0FDE0680F30F9F773 +:1066B0002EFD0320F9F754FEE06805462030017EE8 +:1066C000002902D1C07D002809D0294670318EC929 +:1066D000C0488EC02946C048803104F045FE98204D +:1066E000405BA91C401C82B228462830FDF772FD91 +:1066F000002803D0B449B94804F02DFDE0684030CB +:106700000078F9F716FDF9F727FE01210020F9F7C7 +:106710002BFDE67026716671A6712672022020702C +:10672000E06880300683F9F729FE0020F8BD10B537 +:10673000F9F719FEA34C2078022803D0F9F71EFEC2 +:106740000C2010BDA078002802D0FFF7E5FC17E070 +:10675000F9F736FEFFF7F0F8E068203000790128FD +:1067600001D1F9F772FE607A002809D0012809D01A +:10677000022805D0032805D09349994804F0EBFC82 +:10678000002010BDECF744FCFAE770B505468030F8 +:10679000018B2C46491C01834034A188491CA180EF +:1067A000A17B002902D06189491C6181A17C00295B +:1067B00002D0218A491C2182007F002807D1352080 +:1067C000415D227D0120FFF77CF9002802D020895D +:1067D000401C2081284600F0EBF9002070BD79496B +:1067E00048727047774A1162D0617047F8B5754CAE +:1067F0002078032803D074497A4804F0ACFCE1689F +:1068000004272031887A0025002803D08D72207952 +:1068100038432071206901260278D2439207002A6A +:106820001FD1CA7A002A1CD1CE72217902221143CB +:106830002171FDF79AFA062802D00B2811D10AE03F +:10684000E06801462030C27C132A0AD100228A6601 +:10685000CA66067605E0E0682030C17C0D2900D1CB +:1068600005762079400704D5E0682030407D022875 +:1068700005D06079002802D1A079002802D0FFF766 +:106880004BFC2AE05848FEF73CF8002801D0657020 +:1068900002E0667055486061E0682030007E0028A4 +:1068A00011D05348F9F76FFD4A480576E268916EBA +:1068B000D26E426101614E4A6169FAF7CAF801205D +:1068C000FAF7D6F804E06069F9F75DFDFAF7F3F836 +:1068D00002210020F9F7D2FD2770207801280CD082 +:1068E000607A002809D0012807D0022806D00328A2 +:1068F00004D035493F4804F02EFCF8BD0120F9F7DB +:1069000073FEF8BDF8B52F4C05462078042803D057 +:106910002D49394804F01FFC002D71D0FAF7E3F837 +:106920000125002812D1E0682030017E00290DD019 +:1069300061694A78D20609D00978C07B0907C90F76 +:10694000814203D1E571FFF7E7FBACE0E06820305E +:106950000079012811D1F9F76FFDE168881C283111 +:10696000FDF728FD002808D0E068B22142880A52CD +:106970003121095CA030017505746069002600783A +:106980004007C10FE0682030827B914255D0407BA8 +:10699000002852D002280FD1FDF780FE002803D135 +:1069A0000949164804F0D7FBE2680023106E516EC7 +:1069B000401C594151661066E06820304673C17A28 +:1069C00001291EE0D800002064610100EF070000EB +:1069D000FB07000008200020212000203A080000CA +:1069E0007A080000AF080000EC000020C01F002063 +:1069F000E21F0020F3080000FB080000FD05000076 +:106A0000B1E014D1C6722079082108432071FDF746 +:106A100046FF002803D1FE49FE4804F09CFBE268D3 +:106A20000023106E516E401C594151661066E0689B +:106A30002030817B012948D08573606901788C46BC +:106A40000907CF0FE1680A462031CB7B9F420CD16A +:106A50006746BF07BF0F012F4FD0022F4DD0032F26 +:106A600035D06079042108436071E0782843E070F4 +:106A700020690078C00604D460690078C00600D49C +:106A800061E720790028FBD160780028F8D100F078 +:106A900056FF0028F4D060790028F1D1A0790028B1 +:106AA000EED1FEF749FF207801280DD0607A00284A +:106AB0000AD001285CD0022806D0032858D095209F +:106AC000D349000104F047FBF8BD8673B5E7FDF735 +:106AD000D3F800280CD0E068203085722179294352 +:106AE0002171C17B012901D1C673BEE7C573BCE723 +:106AF0006079102108436071B7E74078C7062CD051 +:106B00006378002BB1D1C006C00E1B28F0D84032EC +:106B1000127DC97C0520FEF7D4FF002804D0A0799F +:106B200008210843A071A0E7E07804210843E07041 +:106B3000FDF70EFF002803D1B549B74804F00BFB61 +:106B4000E0680023816EC26E491C5A41C2668166AC +:106B50002030C17B0129C9D1C6E7012B01D0CD73FB +:106B600083E7CE7381E7E07802210843E070EAE62C +:106B70000120F9F739FDF8BD10B5A84800780428C0 +:106B800003D0A349A64804F0E6FAFFF7C5FA10BD02 +:106B900036210A5C40308188091D002A04D0C08853 +:106BA000814203D3012070470629FBD200207047A1 +:106BB000F8B5054606462036F07C2C460027803482 +:106BC000072820D1288DE18D401C884258D1A16A28 +:106BD00028460A30491C04F0AFFB01220221284656 +:106BE000FDF7ABFAF77401215E204155A06A0078E9 +:106BF000002804D1A1208649800004F0ACFAA16AE3 +:106C00000878401E0870F07C082839D1616A288D08 +:106C10008988401C884233D1A06B0178002904D0B8 +:106C20007B49804804F097FA15E06988C180606A62 +:106C3000A16B40890881606AA16B80894881606A84 +:106C4000A16BC0898881A06B0771A16B07200870B8 +:106C5000A16B68884880012211462846FDF76DFA2D +:106C60000321284600F076FE606A698840888842E1 +:106C700003D067496C4804F06EFA606A0770F774D5 +:106C8000F8BDF8B5654C6079002875D120790126EA +:106C900040070025002815DAE0682030C07C022873 +:106CA00002D0052807D102E05949604801E058495F +:106CB0005F4804F050FAE0682030417D022901D19C +:106CC00026724575207908278007002840DA607908 +:106CD00000283DD12069C0780D2875D20100794483 +:106CE000097949188F4449350681FCFCBB1722FC01 +:106CF0005B71CA00E06854210A5C2030417D0120AC +:106D0000FEF7DFFE002823D1E0680321352211546D +:106D100040308573E2E0E06854210A5C2030017D58 +:106D20000020FEF7CEFE002870D1DDE0E06854219F +:106D30000A5C2030C17C0020FEF7C3FE002803D18E +:106D400033493C4804F007FAE06809212030C17457 +:106D5000CAE0E06854210A5C2030C17C0020FEF7C4 +:106D6000B0FE002803D12A49334804F0F4F9E06862 +:106D700007212030C174B7E0FBE0E06854210A5CD1 +:106D80002030C17C0020FEF79CFE002803D1204962 +:106D90002A4804F0E0F9E0682030C774A4E0E06815 +:106DA00054210A5C2030C17C0020FEF78AFE0028B6 +:106DB00003D11749224804F0CEF9E06853210E545C +:106DC0000A212030C1748FE08AE0E0682030C07C66 +:106DD0000D2803D00E491B4804F0BDF9E06854218A +:106DE0000E540C212030C1747EE0E06854210A5C0E +:106DF0002030C17C0020FEF764FE002828D1E06826 +:106E00004030007D002823D101491DE064E00000EE +:106E1000646101000E06000057060000D800002043 +:106E20005809000091020000A50200006A04000059 +:106E30006E040000AC040000B1040000B6040000C1 +:106E4000BB040000C20400009920C00004F083F9D4 +:106E5000E06853210E540E212030C17444E0E068F4 +:106E60002030C07C132804D04D204349000104F099 +:106E700072F9E06815212030C17435E0E068A42182 +:106E8000095843884A889A421CD10978062919D1A1 +:106E900054210A5C2030C17C0020FEF712FE00283D +:106EA00003D13549354804F056F9E06801464031D0 +:106EB0008A7D920702D42030C67403E08D7380303F +:106EC000406A0570E06854210A5C2030017D002092 +:106ED000FEF7F7FD002807D0E0684030857403E036 +:106EE0002549274804F037F9207900070AD5607949 +:106EF000002807D1E0682030417D032902D102211A +:106F000021724575FEF7DDFEA07900072ED5E068F9 +:106F100054210A5C2030C17C0520FEF7D2FD0028F8 +:106F20000BD0607938436071E0688030816B0878FD +:106F30000B2800D10020087018E0E07804210843F5 +:106F4000E070FDF705FD002803D10B490D4804F062 +:106F500002F9E0680023816EC26E491C5A41C26684 +:106F600081662030C17B012904D0C673E068FFF739 +:106F70001FFEF8BDC573F9E764610100DC04000081 +:106F8000F6040000EA020000F7B582B00646039856 +:106F900017468188FE48FE4A41430398039D008BB3 +:106FA00000245043009080352A7C002A0CD0F948F8 +:106FB000012A40683CD0022A1FD0032A38D0F6A10B +:106FC000F94804F0C8F84BE0002F04D17D20F2A16D +:106FD000C00004F0C0F8EF4C6068002803D1EEA1B7 +:106FE000F24804F0B8F86068A168001D0918F04A7A +:106FF000009880180C18012018E0791E084303D16E +:10700000E5A1EC4804F0A7F8EB48016800980C18DB +:10701000002F0AD0DF484168E8480818A04204D988 +:107020008120DDA1C00004F096F80320287415E04B +:107030000C46002F12D0D74F002806D178780028B0 +:1070400003D0D5A1DE4804F086F8DC48796808183A +:10705000A04203D9D0A1DB4804F07DF8002C03D175 +:10706000CDA1D94804F077F821466869F5F7D9FF32 +:10707000686100203070012434716869B060039841 +:10708000FFF786FD002801D0747104E0287C0128F8 +:1070900005D003207071CD48F06005B0F0BD02202E +:1070A000F8E7F0B5054687B00F46012000F01BFD5C +:1070B000C4B20B2000F017FDC0B2844204D0FF2000 +:1070C000B5A14D3004F047F8012000F00CFDC4B22A +:1070D000182000F008FDC0B2844204D0FF20AEA109 +:1070E0004E3004F038F83846B94F6C1E6900CD199F +:1070F0000026403D09287DD20100794409794918CC +:107100008F44044150504CE9E9E9A0000B2C04DB0A +:10711000FF20B0A1213004F01EF8E88F6946FCF78B +:10712000EFFA002804D0FF209BA1563004F013F89A +:107130000B2C04DBFF20A7A1213004F00CF80099F0 +:10714000E88F4988884204D0FF2093A1583004F08A +:1071500002F800988030007C002804D1FF208EA126 +:10716000593003F0F8FF8B484660467086600098FF +:10717000FFF74AFA002804D0FF2087A1603003F00F +:10718000EAFF07B0F0BDFFF7D2FA0028F9D0FF20E0 +:1071900081A1663003F0DFFF07B0F0BDF9F727FAF1 +:1071A00007B0F0BD0420C04300F09DFCC6B219201A +:1071B00000F099FCC0B2864204D0FF2076A1723064 +:1071C00003F0C9FF0B2C04DBFF2082A1213003F068 +:1071D000C2FFE88F6946FCF793FA002804D0FF202D +:1071E0006DA1763003F0B7FF0B2C06DBFF2079A1F1 +:1071F000213000E06FE003F0AEFF0099E88F49888E +:10720000884204D0FF2064A1783003F0A4FF0098E6 +:10721000FFF7BBFA002804D0FF205FA17B3003F00A +:107220009AFF009C0022214602A8FFF7ADFE8034A1 +:10723000A07E02A9F6F7DAF80099088D401C0885AF +:1072400007B0F0BD0B2C04DBFF2062A1213003F05E +:1072500082FFE88F6946FCF753FA002804D0FF202C +:107260004DA1863003F077FF0B2C04DBFF2059A1E2 +:10727000213003F070FF0099E88F4988884204D0DC +:10728000FF2045A1883003F066FF00988030007C25 +:10729000042804D0FF2040A1893003F05CFF009C4B +:1072A00080342674A57E4F4F681E0B2804DBFF2018 +:1072B00048A1273003F04FFF4548690008184038BF +:1072C000C787A07EF5F700FC4748A6760078EBF765 +:1072D0001BF807B0F0BDFF202FA193304FE770B52A +:1072E000424C0646E08B0025401C80B2E0832378A8 +:1072F0000A46002B09D021464968042B0BD0052BE8 +:1073000017D03D2024A1000102E0ED2022A1800041 +:1073100003F021FF14E00A2801D3022000E003203B +:107320007071002A0BD00320226900F0F5FB05469E +:1073300006E002207071002A01D02D4D00E00D46BC +:1073400029462069F5F76DFE002120613170012189 +:107350003171B060A068FF303130F06070BDF0B5C1 +:10736000074685B00E46012000F0BDFBC4B20B20DD +:1073700000F0B9FBC0B2844204D0FF2006A19E30C9 +:1073800003F0E9FE012000F0AEFBC4B2182031E0AA +:10739000E2040000302000207372635C6C6C5F6C50 +:1073A0006D2E6D302E6300001C040000E903000008 +:1073B0005504000003040000000100205F040000E9 +:1073C00016040000170400001F040000F60400006B +:1073D0005C2000207372635C6C6C5F6C6D2E6D3092 +:1073E0002E630000FFFF0000FC0000203C20002076 +:1073F000B80B000000F077FBC0B2844204D0FF203D +:10740000FD499F3003F0A7FE00250120FB4C092E0B +:1074100070D231007944097949188F44041A3737FA +:10742000336B6B18520060732073607800280ED1A4 +:10743000F348456085602573A068C338FDF791FC6B +:10744000002804D0FF20EC49B33003F084FE05B0DF +:10745000F0BD6178002909D0207B002801D1FDF71B +:10746000C2FD6573F5F796FA05B0F0BDA073FDF7A0 +:1074700000FD0028F8D0FF20DF49C73003F06BFE85 +:1074800005B0F0BDF9F7B3F805B0F0BD0420C04376 +:1074900000F029FBC4B2192000F025FBC0B28442E1 +:1074A00004D0FF20D449D53003F055FE012200213D +:1074B0006846FFF714FF69463846F5F797FF05B0B1 +:1074C000F0BD2078052804D0FF20CB49E13003F03F +:1074D00042FE207F002804D1FF20C749E23003F09C +:1074E0003AFE25772570207DF5F7EEFA257505B073 +:1074F000F0BDFFE7FF20C049ED30A6E7F0B5BF4C77 +:1075000087B020780026042805D02078052802D0EE +:107510000C2007B0F0BD01276770607B00250028B4 +:1075200027D072B6607B002808D0A07B002805D049 +:10753000FDF759FD6573A573F5F72CFA62B6207D4A +:10754000F6F782FD002827D0207F002808D0257775 +:107550002078052803D0A849AA4803F0FCFD0C2692 +:1075600065702570207DF5F7AFFA2575304607B0B8 +:10757000F0BD207D00900320694608734873F5F73D +:10758000BEFA04900020C043694605900F7202A91C +:107590000098F5F72BFFD2E720BFD0E7F0B597486A +:1075A00083B00078002801D0FFF7A8FF944F012096 +:1075B0003870FF26944D2D36002405E00B2C03D3A4 +:1075C0009249304603F0C7FD204601A9FCF798F820 +:1075D000002838D101988030007C002833D00B2C53 +:1075E00003D38A49304603F0B6FD2046AC422ED084 +:1075F0006946FCF785F8002803D08449844803F0E5 +:10760000AAFD00988030807EF6F71EFD002822D06B +:107610000098002180300174847E0C2C04D3FF205C +:107620007A49273003F097FD7A48610008184038FE +:10763000C58700988030807EF5F746FA00990020D3 +:1076400080318876B8E7641CE4B2032CB6D30020FE +:10765000387003B0F0BD20BFD3E710B500786E4C92 +:1076600000280FD001280CD068496C4803F073FD46 +:10767000A0686B49884203D364496A4803F06BFDF4 +:1076800010BD6948A060F3E710B55D4900220A709B +:10769000614C207059480270427002770273427345 +:1076A0008273826102752030574B0380052143802D +:1076B0008380001D491EFAD1100004D0002A04D096 +:1076C0005948A06005E0A26003E05049534803F028 +:1076D00042FDA0685249884203D34C49514803F007 +:1076E0003AFDFFF75BFF10BD70B5444C0E462178A4 +:1076F00084B01546002902D00C2004B070BDA061F2 +:107700008030007C002803D03B49484803F023FD2B +:107710004748464345434748ED1C30186660A5601E +:10772000854200D82846A0603549002088600521A0 +:10773000217060702077E0833F48F5F771F920757C +:10774000002803D12C493D4803F005FDF5F7D7F992 +:107750002061002201216846FFF7C1FD207D6946B6 +:10776000F5F744FE002004B070BD08B50020C0430A +:107770006946088021480078002801D0002008BD13 +:107780000846FBF7F5FF0028F9D0012008BD10B529 +:107790001A4C84B02278002A02D00C2004B010BD0C +:1077A000234A51435043C91C224AA160606080189B +:1077B000814200D80846A06000206070042121703A +:1077C000E0831D48F5F72CF92075002803D10A49FC +:1077D0001B4803F0C0FCF5F792F91A49F5F721FCB4 +:1077E0002061002201216846FFF779FD207D69466E +:1077F000F5F7FCFD002027E0987301003C200020F5 +:107800003020002076020000FFFF0000D47301004A +:10781000190300005C200020FC000020510500003E +:107820006A1800005A050000C40900008B0200001D +:1078300071020000B3FBFFFF5F73010097020000BD +:10784000C6020000B80B000004B010BD10B5E14C3A +:10785000A1690160FFF752FE0021A16110BD70B562 +:10786000DC4C84B02078052802D00C2004B070BD18 +:10787000A069002803D1D849D84803F06CFCA0695E +:107880008030007C002803D0D349D54803F063FC46 +:10789000A0698030807E002803D0CF49D14803F012 +:1078A0005AFCD148F5F7BCF8A1699A225054054614 +:1078B0004E88401E0B2804DBFF20C749273003F009 +:1078C0004AFCCA49680040184038C687A069803021 +:1078D000807E002803D1C049C54803F03CFC01224A +:1078E0006846A169FFF750FBA06969468030807E39 +:1078F000F5F77CFD0020A06104B070BD10B5BD4956 +:107900004C68983400280ED001280FD0022811D0DE +:107910003520B949000103F01EFCAE488068A04242 +:107920000BD9012010BDFF347934F6E7B120800077 +:107930002418F2E7FF346134EFE7002010BDAD48B2 +:107940004178002902D10078002801D0002070473A +:107950000120704770B504460422A84E803484B0DC +:1079600000290DD0012923D0022907D0032921D0D5 +:10797000A149A34803F0EFFB04B070BD227410E0EE +:1079800005469C4800780028F8D12946012268461F +:10799000FFF7FAFAA07E6946F5F728FD288D401C0E +:1079A0002885F4F7F7FF3078EAF7AEFC04B070BD35 +:1079B000032010E08188934A5143934A1160616A21 +:1079C0000A8902838A7982754A8982808A89C2807B +:1079D000C98901810220207404B070BDF0B5874EC2 +:1079E0000146307800257B4C85B0002908D001295C +:1079F00016D0022942D0032958D07F49834839E064 +:107A0000E583EAF781FC6078002849D1002211461D +:107A10006846FFF764FC207D6946F5F7E7FC3FE028 +:107A2000744F20697968774B401879494218A069EA +:107A300081884088594300F06FF8B1680546884254 +:107A400005D2A1696F4A88884243551903E06D4900 +:107A500003F060FAA1690883A06905218175008B94 +:107A600068494843281A6B49B860884204D32520E6 +:107A70005949400103F06FFB05B0F0BDE583EAF71B +:107A800043FC01202077A0692169803041610574A1 +:107A9000FFF7E5FE002803D04F495F4803F05BFB8A +:107AA000F4F778FF6573A57305B0F0BDEAF72CFC19 +:107AB00005B0F0BD704710B54E4A00290ED001291F +:107AC00006D0022906D04C49544803F044FB10BDAF +:107AD000401E03E05178491C5170001F506010BDDA +:107AE0003C48007870478107C90E00280BDA000770 +:107AF000000F083880084A4A80008018C069C840D2 +:107B00000006800F70478008464A80008018006891 +:107B1000C8400006800F7047F7B582B00D46064694 +:107B2000414F002406E00B2C04D3FF202A492D30BE +:107B300003F011FB204601A9FBF7E2FD00280ED15E +:107B400001988030007C002809D00B2C04D3FF2042 +:107B500021492D3003F0FFFABC4204D006E0641C3A +:107B6000E4B2032CDFD3002005B0F0BD6946204607 +:107B7000FBF7C6FD002803D017492C4803F0EBFAA9 +:107B8000A64204D1DD201449800003F0E4FA28481D +:107B9000341B44430098803041690498F6F7C8F9D3 +:107BA000041908D5281B66422946401E03F0C0F977 +:107BB0006843841B05E02946204603F0B9F9684371 +:107BC000241AAC4203D904491A4803F0C4FA2046E7 +:107BD00005B0F0BD3C200020D4730100E702000096 +:107BE000E9020000EB020000A37001005C2000200D +:107BF000EE0200003020002098730100FC000020FD +:107C0000ED040000E204000000010020190500005E +:107C10004E0600006A180000B3040000360500009C +:107C200000ED00E000E400E0FFFF00007103000051 +:107C3000770800008903000070B5F84E0446B0795B +:107C40000025012805D0F64E307A01280CD00020FE +:107C500070BD002915D1657014202070F149A01C59 +:107C600003F082FBB5710CE000290AD16570132086 +:107C700020701C22EC49A01C03F0E3F80120A07145 +:107C80003572012070BDE648007A002802D0E7482E +:107C9000808D7047E6487047F8B5E64801780029BE +:107CA00002D00C263046F8BD0026E04D34462E7535 +:107CB0006E75EE752E76AE75DF496E734E73D84FC6 +:107CC0007F217E718170687E002804D0F8F7ABFBBD +:107CD000F8F754FF6C763C72D848FBF711FED84891 +:107CE000FBF70EFEDEE770B5D24A00251570CC4ECC +:107CF000D44B35711966D8651078002805D0FF205F +:107D0000D1A17A3003F027FA70BDC84C257565758E +:107D1000E5752576A575C8486573457375717F202F +:107D20009070607E002804D0F8F77DFBF8F726FFFE +:107D300065763572C148FBF7E3FDC148FBF7E0FD0E +:107D400070BDBA48007D704710B5B849C87B897BC3 +:107D500042078307D20FDB0FC007D218C00F1018DD +:107D60004000052911D20A007A44127992189744EA +:107D7000090509020700B849085A10BDB74810BDE7 +:107D8000B74900E0B749085A10BDFF20AEA19A30AC +:107D900003F0E1F9002010BDA448B349008A48432C +:107DA00070479F488079002800D001207047F8B5BF +:107DB00006469E4C407BE07330790027A073012873 +:107DC00025D0308820829648B37B83719D4DA7488B +:107DD0002970114603F0BBFAB0796873F11DA4480D +:107DE00003F0B5FA607B0126002800D06675924842 +:107DF000407B002800D0A675A07B05284DD201004D +:107E00007944097949188F440409262B09002782EF +:107E1000D9E700218948FBF778FD25E00121874853 +:107E2000FBF773FDE91D8548FBF7A4FD687B00287F +:107E300007D001280AD0FF2083A1E83003F08BF996 +:107E400012E000217D48FBF7A6FD0DE001217B48F3 +:107E5000FBF7A1FD08E006217848FBF756FD03E09B +:107E600002217648FBF751FDE7752776691C7348B8 +:107E7000FBF774FD29787148FBF781FD04217048F8 +:107E8000FBF743FD691C6E48FBF768FD29786C48D9 +:107E9000FBF775FD26750020F8BDFF206AA1F230C2 +:107EA000CCE770B5614C012525765D4A127A002A2F +:107EB00001D03A2070BD634A13780022834205D175 +:107EC000E2756A4803F043FAE57500E02276002087 +:107ED00070BD70B50446554D0020A8752246654812 +:107EE00002F0AFFF544844730120A87570BD4C499F +:107EF0000871704710B54D4C0022627560730246E0 +:107F00005D4802F09EFF0120607510BD4449487134 +:107F10007047F8B5474D287800282CD1434C207D78 +:107F2000002828D0F8F71FFA0026A674E6746E70B1 +:107F30003046F8F715FA0020F7F7D9FF4F48F8F761 +:107F4000E6F84F48F8F7A1F9F8F73AFAE07B01278D +:107F5000C107002902D0A17CC9070ED0810712D524 +:107F6000A17C89070FD42620F8F7E3F8A07C022132 +:107F70000843A07413E00C20F8BD2520F8F7D9F8C9 +:107F8000A07C38430AE0400709D5A07C400706D40E +:107F90002720F8F7CEF8A07C04210843A074F8F756 +:107FA000DBF901210020F8F7DFF80F210520F8F7B1 +:107FB00022F8244D2978681CF8F711F8A07B0128D5 +:107FC0000AD0042808D0607D002805D0627B2A49A9 +:107FD0001A48FBF7FAFC6675A07D002806D0164803 +:107FE0002449427B9830FBF722FDA675286E017864 +:107FF000002903D00178001DF8F734F8E86D017806 +:10800000002904D01F4A401CF8F797FD6776F8F75F +:10801000B5F90020F8BD074948607047F4200020FA +:10802000D4200020FB200020DE200020B4200020EF +:10803000FFFF000008010020942000200421002000 +:108040002C210020742000207372635C6C6C5F61D3 +:1080500064762E630000000066B401009A89130064 +:108060006EB401005EB401007102000075200020B2 +:108070007B20002082200020A220002059B4010093 +:1080800056B4010057210020F8B50126FE4C0546E4 +:10809000002824D0E07B2146C207897C002A01D039 +:1080A000CA070BD082070FD58A070DD42620F8F710 +:1080B00040F8A07C02210843A07410E02520F8F7C6 +:1080C00038F8A07C3043F7E7400708D5480706D4C6 +:1080D0002720F8F72EF8A07C04210843A074E07C48 +:1080E00000280AD0A07B012804D14B20E7490001D9 +:1080F00003F031F800F0BDFAF8BD002D0CD00221DC +:108100000020F8F731F8E2480079032801D001286F +:1081100002D10220F8F768FAE07D002700280AD093 +:10812000DC4DDD48691CFBF719FC691CDB48FBF7DB +:1081300015FCE7752776D848F8F725F9A07B0528C0 +:108140000CD201007944097949188F440202020BCC +:10815000020001210846F8F791F903E0CB49D04825 +:1081600002F0F9FFE07BA17C884303D1A07B0128CA +:1081700003D0E674CB480670F8BDA774FAE710B5D3 +:10818000F8F7F1F8C7480078002816D1BE48007DFE +:10819000002812D00020FFF777FFBD4800790028A3 +:1081A00009D0012815D0022805D0032811D0B749DD +:1081B000BD4802F0D0FF002010BDF8F720F9F8F715 +:1081C00013F9F8F71FF8F8F7C1F8F8F7D7F80C200B +:1081D00010BDEAF71DFFEEE7B24901204870704775 +:1081E000F8B50024FAF7AAFE002822D0FF202D308F +:1081F000F7F7B7FFAB4D2878A54F01281CD0022810 +:1082000001D0032831D0CF20A049800002F0A3FF85 +:10821000287800280CD03879002809D0012807D008 +:10822000022835D0032833D09849A04802F093FFA4 +:10823000F8BD00F01EFAF8BD934EB07B032814D0B1 +:10824000707E002803D0F8F788FCF8F7E4F8984827 +:10825000F8F799F8B07B012812D0042810D0B8792B +:10826000012806D0032804D004E00120FFF70CFF0A +:10827000CEE7102421460E2001430020F8F7FEF837 +:108280007879012801D1F8F7E0F802202870BFE7DB +:1082900028780228CFD10120F8F7A6F9F8BD70B5EB +:1082A0007B48804C4079012808D18248F8F7D6F8FD +:1082B000002801D17F20A070F8F7BEF8724D687ECB +:1082C000002803D0F8F7AFF8F8F758FCFAF736FEB5 +:1082D00000280BD02078022804D0DD206B498000D4 +:1082E00002F039FFA87B012803D006E000F0C1F9B5 +:1082F00070BD99208000F7F734FF0120FFF7C4FE1E +:1083000020780028F4D020780128F1D05F496A480D +:1083100002F021FF70BDF0B5044689B00020069040 +:108320000190F7F7F1FE03905E480078022803D031 +:108330005649624802F00FFF554D6879012809D16E +:108340005C48F8F78BF8002802D156497F208870E6 +:10835000F8F772F85648FBF7FDFA4B4E0746002C2B +:108360006FD05348FBF700FC00286AD0F7F740FEB7 +:10837000002866D0707E00280AD00524641EE4B26E +:10838000F8F71DFC022811D0012800D00020019030 +:10839000474A4B4CD01C0290062F52D238007844EA +:1083A000007900188744B4B4B409B44E002CE5D168 +:1083B00044A1484802F0CFFEE8E7B07B012840D056 +:1083C00004283ED001990398084304D1A8790028D5 +:1083D00001D0022835D1687901281AD1A079002866 +:1083E00017D10120A07110784006C00FE0713A4803 +:1083F000029902F0ACFF2B4C384FA0787F2804D1B3 +:10840000532030A1000102F0A6FEA07838707F2032 +:10841000A0702248F7F7B7FF22480321017028799E +:10842000002877D0012808D0022873D0032804D070 +:1084300024A12B4802F08FFE6CE00120F8F7D4F85D +:1084400068E065E01348D178C07981424AD111488B +:108450001179037A994245D15179437A994241D1B0 +:108460009179837A99423DD1D179C37A994239D1B0 +:10847000117A037B994235D11178407B4906C90FA7 +:1084800081422FD101212EE0B4200020488001003C +:10849000D420002074200020042100202C21002062 +:1084A000DE04000008010020D1020000510300009A +:1084B000542100200A01002083030000C1030000B2 +:1084C000F42000207372635C6C6C5F6164762E63D1 +:1084D00000000000AB030000FC200020022100206F +:1084E000090400000021B07B012801D0042801D13B +:1084F00000290AD100280BD101990398084304D11F +:10850000A879002801D0012802D1307E00281FD090 +:1085100001200690707E002803D0F7F784FFF8F75B +:108520002DFB0698002802D00120FFF7ADFD73480F +:10853000017800290AD00178012907D000780328A2 +:1085400004D049206E49000102F005FE09B0F0BDDB +:108550006A486C4F4068397BC173797B0174B97B81 +:108560004174F97B8174684909784906C90FC1765D +:108570001C30029902F0EBFE6048397C4068C174FF +:10858000797C0175B97C4175F91E897D81750299E7 +:108590004A7D0B7D110219430183F91E8A7E4B7EB1 +:1085A00012021A438280029A537E177E1A023A43BD +:1085B000C2808A7F4B7F11021943018153490A30DF +:1085C00002F0BAFE52480179CA064C49D20E4968F7 +:1085D0008A7600794009C0310871287A002803D0D2 +:1085E00047494C4802F0B7FD0020A87243484B4968 +:1085F00047687888B085F87EE873B88B2882F88B56 +:108600006882388CA88244480078A875444802F0F3 +:108610009EFEB888F087F888208038896080C0374F +:10862000387920710198002860790BD00121084326 +:108630006071F8F7DDFA61794000C907C90F01439D +:10864000617102E0400840006071012028722B4CEB +:1086500000202070F7F7D3FEF7F7C6FEF7F7D2FD3C +:10866000F7F774FEF7F78AFE01206168FAF785FDD7 +:1086700050E7F8B5F7F7C3FEF7F7B6FEF7F7C2FD18 +:10868000F7F764FE274E0027707E002804D0F7F726 +:10869000CAFEF8F773FA7776184D2F70F7F76EFE6B +:1086A000B07B012804D000210846FAF766FDF8BD2A +:1086B00000210220FAF761FD1B4C207A002803D02C +:1086C0000F491A4802F047FD68780028EFD0124899 +:1086D000417BE1730078A0751549164802F037FE1A +:1086E0000E490F4802F033FE3C20A07268684088B3 +:1086F000B085012020726F70F8BD000008010020D5 +:10870000C48401005721002054210020732100203F +:10871000742100203D0400007420002075200020FA +:10872000EB200020B4200020D42000204F020000C5 +:108730007B200020E4200020F8B5FBF7FBFF044677 +:10874000FCF7BFF8FE4E054670692030407B0028DC +:1087500026D0012844D0022846D003284DD0FF203F +:10876000F8A19C3002F0F7FCB069F72201781140C3 +:10877000017072692032937BDB071B0F1943FB23C7 +:1087800019400170D37BDB075B0F19430170577BE6 +:10879000EF23022F3CD0012F3FD0032F41D046E0E2 +:1087A000EC48FCF76DF8002804D0716903202031F3 +:1087B0004873D9E7E748FBF74DFF002804D07069FC +:1087C0005321095C002907D0E248FCF700F87169E1 +:1087D000012020314873C7E7022120304173C3E7ED +:1087E000DC48FBF7F4FFBFE7DA48FBF733FF00286C +:1087F000BAD1FF20D3A18E3007E0D648FCF740F86D +:108800000028B1D1FF20CFA1963002F0A4FCABE745 +:10881000012C08D8002D06D009E06D1E2C4302D192 +:1088200005E0002C03D019401023194300E0194043 +:108830000170D17D002915D0517B012912D0C64885 +:10884000F7F7A1FDC548002101767269116E526EDD +:1088500042610161C049B269F8F7FBF80020F8F7FE +:1088600007F903E0F7F78FFDF8F725F9B06900780D +:10887000C00606D4F0690078C00602D4F07900285A +:1088800006D0B079002803D101210846F7F7F6FD9C +:10889000032030703079002803D1F7F791FD0120D3 +:1088A0003071F8BD10B5A649002348690246203052 +:1088B000C37483750120412398548032927F002A2B +:1088C00003D008700021022001E000210320FAF704 +:1088D000D2FB10BD06281AD202007A4412799218EF +:1088E00097440205090D101000290ED00FE0891ED3 +:1088F00002290AD90BE0891F012906D907E00829B6 +:1089000003D004E00B390B2901D801207047002067 +:10891000704730B5044683B08E48FBF77FFF0028D0 +:1089200004D1F52087A1C00002F015FC844DA86990 +:10893000FBF75AF90321A869FBF777F9A869EF2239 +:108940000178114001702146FBF7D8F90E2C5BD25B +:1089500020007844007900188744565606561F5A5E +:108960005A175642565A312B75485D224169525C5E +:10897000002A04D006218069FBF76DFA48E0C03177 +:10898000C9798069FBF767FA42E06D4841698069FF +:108990008031497AFBF7D0FA3AE0694D6969A869F4 +:1089A000B031FBF791FA6969A8698431FBF798FA4D +:1089B0002EE0634806218069FBF7BAFA28E0604D93 +:1089C00028690178A869FBF79DFA28698188A86958 +:1089D000FBF79AFA28694188A869FBF799FA17E02A +:1089E000002000900190564841694031097F0029DC +:1089F00005D06A461178012211436A461170694612 +:108A00008069FBF7A7FA03E04EA1554802F0A3FBEB +:108A1000FBF715FF002804D17F204AA1000102F0D6 +:108A20009AFB0C2C0AD0072C06D04548002140693F +:108A3000403041810121817303B030BD40480021A5 +:108A400040694030018203B030BDF0B53C4D064670 +:108A500068698DB020300079012801D1F7F7ECFC6E +:108A60000024012E1ED168692030017E002902D128 +:108A7000C07D002801D0F8F71EF8F7F7C0FCF7F723 +:108A8000B3FCF7F7BFFBF7F761FCF7F777FC687902 +:108A9000C006686902D58030048703E08030018F0A +:108AA000491C018768790226C107002901D1800786 +:108AB00013D568692030817D002902D0032907D0B1 +:108AC0000BE00121817500210120FAF7D4FA04E0BE +:108AD000867500210120FAF7CEFA68692030817D81 +:108AE000012903D16979090700D586751448807A70 +:108AF000002861D100F015FF1648FBF78FFE002813 +:108B00005AD00F4D287A002856D16869C621095CD1 +:108B100000290ED02030C17C0120FFF7DBFE0028A9 +:108B200007D168692030C17C0420FFF7D3FE0028FC +:108B300018D06869CB21095C062919D01FE0000014 +:108B4000100100207372635C6C6C5F736C617665FE +:108B50002E6300002801002080210020A821002091 +:108B6000EA070000686940300481447702204DE044 +:108B70002030C17C0420FFF7ADFE002815D06869C5 +:108B80002030C07C801E15287ED2010079440979EE +:108B900049188F449B9B9B1C9B9B9B979B1E9B9B5D +:108BA0009B243E9B9B9B9B9B900068695621095C84 +:108BB000C90702D0C030C472AEE00C20FFF7A9FE96 +:108BC000686901224030817D11438175A4E007204E +:108BD0001CE0FBF7F0FE00286CD00B2016E0F3F74A +:108BE00050FA0C2866D368690821B030F3F74AFAC6 +:108BF000002806D0686904218430F3F743FA00287E +:108C000003D1F4A1F74802F0A6FA0420FFF781FE91 +:108C100082E068698446C030807A042802D0052842 +:108C200039D079E06046E030007D002874D1EE490B +:108C30006046102600230822D8306944F51A2D1802 +:108C4000203DEF7F4F70AD7F8D70891C521E9B1CA5 +:108C5000002AF3D103A86346102608210330A83365 +:108C6000B51AED18203DEF7F4770AD7F8570801CF1 +:108C7000491E921C0029F3D16846F9F70CFB08AF96 +:108C80004ECFDA4D686900E020E070304EC005201C +:108C9000FFF73FFE0BE060464030017D002903D026 +:108CA00001214177022000E00D20FFF732FE6869C4 +:108CB000C030847230E00620FFF72BFE6869403038 +:108CC000847329E00920FFF724FE25E06869CA21A2 +:108CD000095C002920D0062906D02030C17C002064 +:108CE000FFF7F8FD002817D068690146C0318A7A7D +:108CF000072A11D213007B441B79DB189F440C0C0C +:108D00000C0C0C0C03004030807DC20700D154E7EE +:108D1000C043800700D18C72B44D2879002868695F +:108D200002D08030048303E08030018B491C018332 +:108D30006879C007686904D0A4210C54403084804D +:108D400003E040308188491C8180E879002806D002 +:108D50006969A0310879022806D8401C0871686941 +:108D6000A0300079022806D9686901468030048362 +:108D70004483A0310C7168692030C17C0020FFF76A +:108D8000A9FD002804D168692030C07C07284CD197 +:108D900068690146C0318A7A062A46D0C97A06290E +:108DA00043D03621095C02293FD1A0300079002848 +:108DB0003BD1FBF7AEFC002837D0FBF782FD002843 +:108DC00033D06869014680314A8A012A2DD90122AF +:108DD0004A77024640329688D288931E9E4201DB33 +:108DE000012302E0921B521E93B20A8BAE89B2425B +:108DF00001D3012202E0B21A521C92B2934200D96E +:108E00001346012B00D14C77C0300278002A10D0D5 +:108E1000498B4088814201D3012102E0401A401C65 +:108E200081B28B4205D90B4603E06869012380308B +:108E300044776A69118D1646C81883B2104680308F +:108E400083822036B77D002F25D0012F23D0022F1B +:108E50000CD0032F0AD05FA1654802F07CF9687935 +:108E6000C006686919D58030C4841BE0F67C032EE7 +:108E700009D0082E0FD04032D1889288891A891ED5 +:108E800059180182EBE740329688032E03D3D2882B +:108E90008918491CF5E70382E1E78030C18CC28A5A +:108EA0008918C18468690246C0329179002906D0C8 +:108EB0000146403196230E891B5AF3180B81A97A7B +:108EC0000426002913D002463D214032917001460C +:108ED0002031CC748C75012151708030807F002846 +:108EE00070D0297000210220FAF7C5F85EE0014633 +:108EF0002031CB7C042B48D02B7A002B1ED05A0774 +:108F000001D4DA0604D51E2240308270CE743CE0D3 +:108F10001A0704D53D2240308270CE7435E0D80760 +:108F200005D1980703D42BA1324802F014F96869DF +:108F30002A21422211542030C67426E04030837B1F +:108F4000002B05D047897B1C438183899F420FD228 +:108F5000D37A062B02D0927A062A05D1038A5A1CAC +:108F600002828289934203D20389C288934203D347 +:108F700022228270CE7408E08B7D002B23D0838860 +:108F800093423CD308228270CE7468694122014624 +:108F90002031CC748C75012111548030807F0028E1 +:108FA0002AD0297000210220FAF765F8F9F7EEFFC0 +:108FB00000282DD068690146FF300130827A002AEE +:108FC00022D025E018E08288062A18D33E2282703B +:108FD000CE74DAE77372635C6C6C5F736C61766598 +:108FE0002E63000039060000FFFFFFFF1001002084 +:108FF000790800004502000000210320D4E7012089 +:10900000287000210846CFE74988818101218172BB +:109010006869803084770DB0F0BDF8B50C4617460E +:109020006946FAF7F9FA002801D00020F8BD009847 +:109030000146E030027AF74E0025002A17D0002FB3 +:109040007DD1657007212170007A00280DD07169EB +:10905000E8204D8445540A22A01CEA3101F0F1FEBB +:109060000098E030007A0028F1D1A57067E0027D19 +:10907000002A2AD0002F62D1017D0D2920D20A00BA +:109080007A441279921897441B1B1B1B1B1B1B1B3A +:109090001B1B1B0F060065700C212170817DA170C8 +:1090A00071694988A18009E065700B212170817D7B +:1090B000A17071694988A180817EA17105753EE02A +:1090C000D549D64802F047F839E0027F002A15D08A +:1090D000002F34D16570082222707269FF315288E6 +:1090E000628001310A88A2804A88E2808A882281CF +:1090F000CA8862810989A181057720E0FF310131A9 +:10910000887A002808D0002F19D1657011202070AE +:10911000888960808D7212E0887B002886D0002FBD +:109120000DD1657012202070887B002807D08D73C8 +:10913000088A6080488AA080887B0028F7D10120B7 +:10914000F8BDB4480078012801D00C2070470020F9 +:10915000704770B5AF4C05462078002803D0AE4963 +:10916000AF4801F0F8FF00202561E0720120207077 +:109170002078012803D0A849AA4801F0ECFF70BD6F +:10918000F8B5A44D2978012901D00C20F8BD01269D +:10919000686180308677807AFBF749FA00282ED004 +:1091A00068698030807AFBF799FB002827D06869CE +:1091B0008030807AFBF70EFB002820D06869803071 +:1091C000807AFBF74AFB002819D0F7F7CCF86869DA +:1091D00000248030408A002825D09348FBF71EFBEE +:1091E000002820D06869C621095C00291BD02030E6 +:1091F000C17C0120FFF76EFB002802D013E0122093 +:10920000F8BD68692030C17C0420FFF763FB0028AB +:1092100009D168694030048144770220FFF779FB67 +:109220006869803044776869E821095C002905D1C4 +:10923000418CC288914201D9A98101E0C188A981EC +:1092400001468031CA8A521E93B20A8BD21892B25A +:109250000A830F7F002F02D04C830C7702E04F8BE4 +:10926000FF184F8305464035AF88FF18AF804D8A01 +:10927000012D01D86D1C4D82002B01D0A4231C545C +:109280002030C07C634D042817D0487F002816D0BA +:10929000A889824213D2FBF73CFA00280FD06869F4 +:1092A0000146C0310A78002A09D08030408B4988B5 +:1092B000884204D3AC70EE7003E0AE7001E0AC7095 +:1092C000EC7068699D210C543321095C062901D09A +:1092D000072917D1CC21028D095A511A09B2002948 +:1092E00010DB0146CE310A3002F04FF80122022194 +:1092F0006869FAF7C8FE6869CB210C5433210C5415 +:1093000040308677434D962168690A5A01462830D5 +:10931000891CFAF75FFFA87800284DD16869C02141 +:10932000095C002901D0803044830120F6F7DFFD7D +:10933000384D68691330F6F7A8FF68690F30F6F703 +:10934000E6FE0120F7F70CF8686901462030027E3E +:10935000002A02D1C07D002806D07031ACC9334844 +:10936000ACC0334802F000F8F6F7F6FF01210846DA +:10937000F6F7FAFE274D68698030006AF7F706F8BD +:109380002C48FBF7BEFA002801D06C7002E06E702A +:109390002948E86168692030007E002802D068789A +:1093A000002817D0E869F6F7EEFFF7F784FB686945 +:1093B00040300078F6F7BDFE164802214471C471B2 +:1093C000847104724472847204710170F6F7D6FFDE +:1093D0000020F8BD1848F6F7D6FF144806766A69EB +:1093E000916ED26E42610161134AE969F7F731FB70 +:1093F0000120F7F73DFBDAE710B5064C207802288C +:1094000001D00C2010BDA078002817D00020FFF755 +:109410001CFB2FE010010020D48F0100DD080000AC +:109420002D0900003809000028010020A821002093 +:10943000C12100202C01002080210020F6F793FF9D +:1094400001210020F7F71AF804202070606920300D +:109450000079012801D1F6F7F8FFE07A002809D059 +:10946000012807D0022807D0032805D0F949FA4877 +:1094700001F071FE002010BDE9F7CAFDFAE7F749D7 +:10948000C8727047F8B5F54C2078032803D0F1492D +:10949000F34801F060FE616901252031887A0028D7 +:1094A00006D0002088720D73A07904221043A071A9 +:1094B000A0690278D24392072BD1C97A002928D11A +:1094C000FAF753FC04281DD0052802D00B2819D127 +:1094D00011E0606901462030C27C102A12D10022BE +:1094E0008A66CA6605767031CCC9DE48CCC0DE48D3 +:1094F00001F03AFF06E060692030C17C0B2901D100 +:1095000000210176606902212030C572A0790843EC +:10951000A071A0690078C00606D4E0690078C00692 +:1095200002D4E07900280FD0607800280CD1A0790F +:10953000002809D1F9F718FD002805D0207A002865 +:1095400002D1607A002803D00120FFF77EFA1DE0E7 +:10955000C648FBF7D6F9002802D00020607002E070 +:109560006570C348E06160692030007E002802D049 +:10957000607800281CD0E069F6F705FFF7F79BFA42 +:1095800001210020F6F77AFF0420207020780128BE +:109590000DD0E07A00280AD0012808D0022819D07E +:1095A000032817D0A920AB49000101F0D4FDF8BD74 +:1095B000AF48F6F7E8FEAB4805766269916ED26E69 +:1095C00042610161AA4AE169F7F743FA0120F7F71E +:1095D0004FFAD5E70120F7F707F8F8BDF8B59F4C2B +:1095E00005462078042803D09A49A24801F0B3FD2B +:1095F0009A481027417939434171002D7ED0F7F701 +:1096000072FA0125002814D1944842692032117E53 +:1096100000290ED0C1694B78DB060AD00978D27BCD +:109620000907C90F914204D185720120FFF70DFA95 +:1096300054E18A4CE07800281ED0E0694178C906E0 +:109640001AD10078C00617D460692030007901284B +:109650007ED1F6F7F1FE6169881C2831FAF7AAFE7F +:10966000002875D06069C21D4388F932138220300A +:10967000007C907495732BE160692030007901289B +:1096800011D1F6F7D9FE6169881C2831FAF792FEEC +:10969000002808D06069C21D4388F9321382203047 +:1096A000007C90749573E069002600784007C10F34 +:1096B00060692030827B914242D0407B00283BD0C1 +:1096C00002280FD1FAF7EAFF002803D161496A485E +:1096D00001F041FD62690023106E516E401C59413A +:1096E00051661066606920304673017B012903D101 +:1096F0000673A1793943A171C17A00E0D1E0012953 +:1097000014D1C672A07908210843A071FBF7C7F8ED +:10971000002803D14F49594801F01DFD626900231B +:10972000106E516E401C59415166106660692030C0 +:10973000817B01292ED085736079082108436071EF +:109740004649C869496903781A07D40F203100E0F7 +:109750007FE0CA7B94420CD19B07404C9B0F012BAE +:1097600048D0022B46D0032B16D0207A0421084380 +:1097700020723A48417929434171C67181790907BC +:1097800004D541692031C97C032962D0017A0029BE +:109790005FD182E08673CFE76378002BE9D18D72C9 +:1097A000A3792B43A371012A10D0CD73FAF7DDFA08 +:1097B00006280DD00B28DCD1606901462030C27C20 +:1097C0000C2AD6D1C67540310D75D2E7CE73EDE7C0 +:1097D000606901462030C27C122ACAD100220A6682 +:1097E0004A66C57570319CC91E489CC0093001F09D +:1097F000BBFDBEE74078C30649D06278002AB8D1E5 +:10980000C006C00E1B283FD8C97C0520FFF762F8B0 +:10981000002804D0607A082108436072A9E76079C3 +:10982000042108436071FBF793F8002803D109492C +:10983000134801F090FC60690023816EC26E491CE0 +:109840005A41C26681662030C17B01291AD0C57396 +:109850008FE73DE0D48F01000D0A000010010020C9 +:10986000360A0000A8210020C12100202C01002080 +:1098700080210020A80A00000A070000220700003B +:109880007C070000C67374E7207A384370E7012A2A +:1098900001D0CD736DE7CE736BE7407A002817D106 +:1098A0001AE0F948022211434171C179491CC9B239 +:1098B000C17101290CD840692030007E00280BD0EE +:1098C000F2484078C106C90E052905D2C00603D06A +:1098D0000120FFF7BAF801E0FEF72EFFEA48017811 +:1098E00001290CD0C07A002809D0012808D002280C +:1098F00005D0032804D0E649E64801F02CFCF8BD69 +:109900000120F6F771FEF8BD10B5DF480078042895 +:1099100003D0DF49E04801F01EFC0120FFF795F875 +:1099200010BDF8B5D84C0427A07900250007002801 +:109930002FDA207A00282CD160692030C07C801E6C +:10994000132826D201007944097949188F44210946 +:1099500021212121212121212121212121212121F7 +:109960001A006069014640318D734A7F002A04D095 +:1099700006228A702030C7740BE016228A702030CD +:10998000C77406E0606901464031CD748D732030A4 +:10999000C57400F063F9BC4801268279500700289D +:1099A00022DAB948017A00291ED1406901462031E6 +:1099B0000B46C97C891E072916D20C007C442479E9 +:1099C0002419A744031111110B110E000146403157 +:1099D0008D73C030007A8870DF7405E0C030C672C5 +:1099E00002E00221C030C172A74C90074AD5207A0C +:1099F000002847D160692030C17C0120FEF76AFF52 +:109A000000283FD1A069C0780E287DD2010079449A +:109A1000097949188F44A7A706A73747630BA718EA +:109A2000A7279755616903202031C8749FE06069BA +:109A30002030C07C052803D09549984801F08BFB65 +:109A400060692030C57492E060692030C07C0928CC +:109A500003D08F49924801F07EFB60694E210D547E +:109A60002030C57483E060692030C07C0B2803D0AF +:109A700087498C4801F06FFB606953210E540C211B +:109A80002030C17473E060692030C07C0F2803D09F +:109A90007F49854801F05FFB606953210E54102116 +:109AA0002030C17463E060692030C07C102803D08E +:109AB00077497E4801F04FFB606912212030C17464 +:109AC00055E060692030C07C102803D07049784888 +:109AD00001F041FB606914212030C17447E06069E6 +:109AE0002030C07C162803D06949724801F033FB4E +:109AF000606901464030C5748573E031087D0028F7 +:109B000006D063492B2000E02DE0400101F023FB4B +:109B10006069014640310A7D002A08D00D754288EF +:109B2000F8210A520146E0318D750C2207E0418888 +:109B3000F82211520146E0318D758E760B220A759E +:109B40002030C57413E060690146C030827A062A6D +:109B500004D14031897D890700D58572C17A0629F3 +:109B600005D1C57203E04A49534801F0F4FAA079DF +:109B7000C00612D5207A00280FD160692030C17C40 +:109B800007290AD20A007A441279921897440505E7 +:109B90000505050503000721C174607A000727D574 +:109BA00060692030C17C0520FEF794FE002807D0B4 +:109BB000207A0821084320726069E030057517E0BB +:109BC000607938436071FAF7C3FE002803D1304949 +:109BD0003A4801F0C0FA60690023816EC26E491CE8 +:109BE0005A41C26681662030C17B012934D0C673D8 +:109BF00060693321095C08292DD10146028DC031ED +:109C00008B89521C9A4226D1227A002A23D14A8A71 +:109C100083889A4207D18B8AC788BB4203D1CB8AFB +:109C20000789BB4208D043888B85CA858A8A0A8601 +:109C3000CA8A4A86E8210E5401221146FAF723FA0D +:109C400000210420F9F717FA6069CB210D54203068 +:109C5000C57403218175F8BDC573C9E730B50A4CD9 +:109C600083B0A079C0077DD0207A00287AD16069BE +:109C70002030C17C0120FEF72DFE00284AD1E0698A +:109C8000C0780D286FD21BE0100100208021002039 +:109C9000D48F01000E0B0000160B000027050000FA +:109CA0002D050000340500003C05000043050000C0 +:109CB000490500005B050000BD0500009E03000093 +:109CC00001007944097949188F443B1506C14D4D6F +:109CD000FE24FD4D98B2FC00E069FAF7BEF8616918 +:109CE000C82250540222332042540020403148817F +:109CF0000120887385E160692030C17C0020FEF777 +:109D0000E9FD0028207A02D0002803D103E00121D8 +:109D10000843207275E1E069FAF798F86169CC228E +:109D200050520A8D801ABC4A00B290425FDC002873 +:109D30005DDDCE31E069FAF77EF8606906212030FA +:109D400083E060692030C17C0020FEF7C3FD00285D +:109D500003D1207A012108432072207A00284CD1B7 +:109D6000E06901E055E134E1FAF732F800282ED03D +:109D7000E069FAF728F86169CC2250520A8D801AFE +:109D8000A54A00B2904232DC002830DDE069FAF7E3 +:109D900014F86169C0318873E069FAF707F86169FE +:109DA000C0310882E069F9F7E6FF6169C031488295 +:109DB000E069F9F7E9FF6169C0318882E069F9F784 +:109DC000ECFF6169D62250520820203196E060698C +:109DD0002030C17C0020FEF77DFD002803D1207AD1 +:109DE000012108432072207A002806D100E12820B2 +:109DF0004222505404202031C87402E160692030AE +:109E0000C17C0020FEF766FD002803D1207A0121E5 +:109E100008432072207A00285FD160690022014641 +:109E200040304281012282730B202031C874E8E067 +:109E300060692030C17C0C2903D0217A02221143B1 +:109E40002172217A002948D10D21C174D9E06069BD +:109E50002030C17C0020FEF73DFD002808D160695C +:109E60004030007D002803D1207A01210843207270 +:109E7000207A002831D160690022014640304281B9 +:109E800001258573A831E069FAF704F86169E06992 +:109E90008031FAF710F86069E030007F002803D0C5 +:109EA0005E495F4801F057F96169FE204A884252D5 +:109EB000FF310131E069F9F7D7FF6169E069FF31EE +:109EC000093102E01CE056E008E0F9F7D9FF6069CB +:109ED000FC210D540F212030C17492E060690146CD +:109EE0002031CA7C122A03D0227A02231A4322721A +:109EF000227A002A6CD1403082731620C87480E028 +:109F000060690146C031CA7A002A06D0897A0629DA +:109F100003D0217A012211432172217A002970D1C4 +:109F20004030807D800715D4E069F9F7F5FF61695D +:109F30004031C875E069F9F7F1FF61694031088384 +:109F4000E069F9F7F0FF6169022240314883887DBA +:109F50001043887560690146C0318A7A062A01D1AA +:109F600000228A724030827DD2074AD10622CA720C +:109F70000021018245E060692030C17C0020FEF7AD +:109F8000A9FC002803D1207A012108432072207AFD +:109F9000002836D16946E069F9F7D5FF68460078B0 +:109FA000C107C90F6846017004D0606901214030C3 +:109FB000017703E060690021403001776069002289 +:109FC0000146403042810122827309202031C87449 +:109FD00017E060692030C17C0020FEF77BFC002880 +:109FE00003D1207A012108432072207A002808D169 +:109FF000E069F9F7BAFE61698922505405202031E1 +:10A00000C87461690023886ECA6E401C5A41CA66D2 +:10A01000886603B030BD0000FE7F0000D48F0100D1 +:10A020002104000047490968016000207047454944 +:10A030000860002070470121434A002803D001280E +:10A0400003D042487047916300E0D163002070471D +:10A050003F49012008603D48801C704704223D4B69 +:10A060003B49002805D05A60086901221043086165 +:10A0700008E008694008400008619A603249002001 +:10A08000C03188600020704731490622002808D07E +:10A09000012809D002280DD003280FD02B48401CDE +:10A0A00070470869904302E008699043801C08618A +:10A0B0000020704708699043001DF8E708691043C5 +:10A0C000F5E723494A6A02434A6200207047204963 +:10A0D0004A6A82434A62002070471D49496A01600A +:10A0E000002070471A49CA690243CA6100207047BC +:10A0F0001749CA698243CA61002070471449C96977 +:10A100000160002070471249024600204031002AB9 +:10A1100003D0012A01D0072070478A6370470D4998 +:10A120000420886008490020C03188600A4801681E +:10A130008022090A090211430160084901200860D0 +:10A140007047000000040040400000400420000070 +:10A15000000500400003004000E400E000E100E0F2 +:10A160008107C90E002808DA0007000F08388008A8 +:10A17000814A80008018C06904E080087F4A80001E +:10A1800080180068C8400006800F704710B504466C +:10A1900000F0DBF8002813D02046FFF7E1FFC0B243 +:10A1A00000F0E1F800280DD07549E2060B78D20ED8 +:10A1B00001209040002B08D04A681043486006E018 +:10A1C000704810BD6F48401C10BD6F4908600020EA +:10A1D00010BD10B5044600F0B8F800280BD068494F +:10A1E000E2060B78D20E01209040002B05D04A6881 +:10A1F00082434A6004E0634810BD634980310860CF +:10A20000002010BD70B50D46044600F09EF80028F1 +:10A210000BD05E480068E206D20E01219140084052 +:10A2200000D001202860002070BD564870BD10B5D8 +:10A23000044600F08AF8002807D0E106C90E012084 +:10A24000884052490860002010BD4E4810BD10B52E +:10A25000044600F07AF8002808D0E106C90E012073 +:10A2600088404A4980310860002010BD454810BD33 +:10A2700070B50D46044600F068F8002819D028464D +:10A2800000F071F8002816D0A007C10EFF228A4006 +:10A29000A807000E8840002C10DA2107090F0839A2 +:10A2A0008B0835499B005B18D96991430143D961FB +:10A2B0000CE0344870BD3348401C70BDA3082F49E2 +:10A2C0009B005B181968914301431960002070BD21 +:10A2D00070B50C46054600F038F8002805D0284631 +:10A2E000FFF73EFF2070002070BD264870BDBFF311 +:10A2F0004F8F21492648C860BFF34F8FFEE770B5E6 +:10A300001F4C05462178012000290ED1207072B61D +:10A3100000F0F4F81C4E803631688143616000F033 +:10A32000EDF8C043306062B600202870002070BD98 +:10A3300013490A78002A06D0002804D1124A486836 +:10A340001060002008700020704710B504462028D7 +:10A3500007DA00F0D3F80121A140084201D1012021 +:10A3600010BD002010BD012803D0032801D000201B +:10A37000704701207047000000ED00E000E400E0BD +:10A38000300100200120000000E100E000E200E0D8 +:10A390000400FA05F8B504468007002501260028C8 +:10A3A00004DA5848C563C66302208443E00404D538 +:10A3B0005548C563C66380148443600003D5534881 +:10A3C000456080058443E00504D55148C563C663F4 +:10A3D00080158443A00404D54E48C563C663401469 +:10A3E000844360042704C00FF90F884203D04AA1B8 +:10A3F000612000F0B0FEB80F0AD04C49CD634C4844 +:10A40000C563C563CE63C663C6630320800384430C +:10A4100020050AD5474FFD632F20E6F7C5FEFE63F2 +:10A420002F20E6F7C1FEF8148443F7F7D7FF424820 +:10A43000044203D038A18D2000F08DFEF8BDF0B5A8 +:10A4400000210A46FF230446CC40E4072AD04CB240 +:10A45000E606F60E0125B540384E3560384E3560BB +:10A46000002C11DA25072D0F083DAE08354DB6003A +:10A470007719FD69A407E60E1C46B440A5431446AF +:10A48000B4402543FD610DE0A6082F4DB6007619B6 +:10A490003568A407E70E1C46BC40A5431446BC40E3 +:10A4A00025433560491C2029CDD3F0BD70B5274C1C +:10A4B0000D462060FFF76EFF2068FFF7C0FF2846BB +:10A4C000E8F766F8F7F796FEF1F792FDF7F786FFE3 +:10A4D000FFF725FEE7F7E2FE00F06AF870BD10B561 +:10A4E0001A4C2068FFF756FF2068FFF7A8FFF7F720 +:10A4F00075FFE8F7C7F80020206010BD134800681A +:10A5000070470000C01F0040C0CF004000E5014080 +:10A51000C08F0040C0DF00407372635C736F635F85 +:10A52000636F6E6669672E6300000000C0EF004035 +:10A53000C0FF0040C0BF0040FEFF0FFC80E100E014 +:10A5400080E200E000ED00E000E400E038010020DF +:10A5500070B5002402460D4620462146002A1ED032 +:10A56000012A04D0022A04D0032A1ED103E00120CC +:10A5700002E0022013E003202B0000F00DFF07167D +:10A580000507090B0D0F1600012108E0022106E066 +:10A59000032104E0042102E0052100E00621F2F796 +:10A5A00058FA002801D0204670BD0724FBE70000C0 +:10A5B000B348002101708170704770B5B14D01231F +:10A5C0006B60B14B1C68002CFCD0002407E00E68C7 +:10A5D00006601E68002EFCD0001D091D641C9442FC +:10A5E000F5D30020686018680028FCD070BD70B5F5 +:10A5F000A34C0E466178884203D0A4A16F2000F0DE +:10A60000AAFD0325330000F0C7FE09520624245298 +:10A610005252524952002078022803D09BA1732045 +:10A6200000F099FD2570A078022802D0012804D0FE +:10A6300008E0A068E8F7C6FC04E02046083007C838 +:10A64000FFF7BBFF0020A070F2F7A4F904202070F0 +:10A6500070BDF2F754FA01466068F3F769FC0646EC +:10A660002078022803D089A1872000F074FD8B4A4E +:10A670008B498C48964205D86269032A02D2521C43 +:10A68000626102E0864207D84D71801BC860844930 +:10A690006078F2F7ABFE70BD032003E0A0780028DD +:10A6A000FAD10220F2F77EF800F0E1F870BD77A150 +:10A6B000B12000F050FD70BD70B50546F2F71FFAED +:10A6C0006F4C60602078012803D070A1B82000F0A2 +:10A6D00042FD73490220087000220A718D60042235 +:10A6E0004A71704ACA6020706078F2F77FFE70BDD0 +:10A6F00010B5634CA078002802D12078002801D042 +:10A70000112010BD6848F2F78BF96070607800285E +:10A7100004D0012020700020606110BD032010BD16 +:10A7200010B50124020B64040121604BA04202D247 +:10A730009140186802E0203A58689140084000D0E3 +:10A74000012010BDF8B50E46910005464F1914467C +:10A750003F1F0091E8F747FC009980028919091F03 +:10A76000B14201D2012200E00022002C03D0FF21DF +:10A7700001318C4201D90920F8BD4D498D4219D3D0 +:10A78000AF4217D3854205D2874203D228463043D1 +:10A79000800701D01020F8BD8E420BD3002A09D1CA +:10A7A0002846FFF7BDFF002804D13846FFF7B8FF61 +:10A7B000002801D00F20F8BD3E483F49006888427C +:10A7C00005D0224631462846FFF7F7FE0FE0FFF797 +:10A7D0008FFF0028EFD12A480121C66085600461FF +:10A7E00081702046302148431830FFF765FF002074 +:10A7F000F8BD10B504462E48800A84420BD3E8F712 +:10A80000F2FBA04201D8102010BDA0020446FFF7C1 +:10A8100087FF002801D00F2010BD26482649006878 +:10A82000884203D02046E8F7CDFB0AE0FFF760FF3F +:10A830000028F1D112480221846081701F48FFF77F +:10A840003BFF002010BD1A48010B01208840401E2C +:10A85000704700B50B460246FFF7F5FF104201D0E6 +:10A860000F2000BD114802604360002000BD10B5FC +:10A87000034C6078F2F728F900202070A07010BD1A +:10A880003C01002000E5014000E401407372635C7C +:10A89000736F635F666C6173682E630030750000D0 +:10A8A000D0210020D0FB0100EFA5010000060040F0 +:10A8B00000C0010064000020BEBAFECA3A56000083 +:10A8C000F94805218170002101704170C1708160DB +:10A8D000704710B5F5490A78022A07D0CA681018DF +:10A8E000C860C8689638F3F7DBFA10BD8A6810189C +:10A8F00088608868F6E70378ED49EE4A002B02D0BD +:10A90000012B10D014E00379002B01D0012B0FD1C3 +:10A910004379002B01D0012B0AD18368643B8B4221 +:10A9200006D2C06810E00379002B03D0012B01D0C0 +:10A93000002070474379002B01D0012BF8D1C36868 +:10A94000643B8B42F4D280689042F1D8012070477A +:10A95000F8B504460226F2F731FF0068002803D05C +:10A96000D5A1BD2000F0F7FB0127CF4D002C08D06A +:10A970002078002817D0012805D0022811D00328FC +:10A9800013D02F710DE06068C82808D3F3F7FEFAE2 +:10A99000002804D06068FFF79CFF012603E0002632 +:10A9A00001E000F0FDF93046F8BD28780028F8D124 +:10A9B0006068FFF7A0FF0028E3D0606800780028F7 +:10A9C00026D0A878042803D0BBA1F72000F0C3FB51 +:10A9D000B64F0020387060680079012800D0002050 +:10A9E000387160684079002837D004207871606839 +:10A9F0008168E868F2F715FBB8606068C068963057 +:10AA0000F8600320A870A949E878F2F7EFFCC8E7DE +:10AA1000A6480221017061680979012919D0002135 +:10AA2000017161684979002915D00421417161687B +:10AA30008968963181606168C968C160C0689A4C54 +:10AA400014346060F2F75BF820606F700220A87029 +:10AA5000A7E70321E4E70321E8E70320C6E7F8B509 +:10AA6000914C0D46E178884204D0FF2092A11A3023 +:10AA700000F071FB2846002501268C4F030000F0F2 +:10AA80008BFC0906123C5E82939DCAA6CA00A07880 +:10AA9000032807D0A078022804D0FF2086A11E300A +:10AAA00000F059FBF8BDA078032807D0A078022851 +:10AAB00004D0FF2080A1223000F04DFB0420A070C4 +:10AAC00025712078002815D1FFF703FF3878022878 +:10AAD0000CD0B868E0607F49886A7F4A02402261F2 +:10AAE0007D4AD24310408862002055E0E078F2F7BA +:10AAF000BFFAEFE700F054F9F8BDA078032807D0BB +:10AB0000A078022804D0FF206BA14B3000F023FB7B +:10AB10002078002802D000F04FF9F8BDA078032873 +:10AB20001ED104202BE0081AF8606049E078F2F7A3 +:10AB30005DFCF8BD0420F1F735FEA570F8BDA078E6 +:10AB4000032807D0A078022804D0FF205AA16C3037 +:10AB500000F001FB20780028DDD1A07803280DD07B +:10AB6000F1F7CDFF504E014614363068F3F7E0F9A7 +:10AB70000028DFDB71688142DCDBD4E70520F1F7D8 +:10AB800011FEA670F8BDA078042804D0FF204AA1C9 +:10AB90008D3000F0E0FA0220A1688847FFF7D8FE68 +:10ABA000FF260546C63642E0A078042804D0FF20E0 +:10ABB00041A1923000F0CFFA0120EDE7A0780428FF +:10ABC00098D0FF203CA1973000F0C5FA92E7A0781A +:10ABD00004280AD06078002802D0A078022804D087 +:10ABE000FF2035A19C3000F0B6FA2078002892D1E1 +:10ABF0002079002804D00620F1F7D4FD2571C0E7A4 +:10AC00006078002805D02949E078F2F7EFFB6570FD +:10AC1000F8BD0720B3E7FF2027A1B73040E7002D9C +:10AC20000AD0012D06D024A1304600F094FA022D5E +:10AC3000F5D1F8BD042000E00320A1688847FFF7A4 +:10AC400087FE0546F3E770B5050005D0164CA078E1 +:10AC5000052803D0112070BD102070BD1F48F1F7EA +:10AC6000DFFEE070E078002803D0A5600020A0702F +:10AC700070BD032070BD10B50B480178002901D0CC +:10AC8000112010BD817805292AD08178012929D089 +:10AC90008178002926D0012101708178012921D0F5 +:10ACA000807800281ED01FE054010020E021002001 +:10ACB0003D860100FF1FA1077372635C736F635FC2 +:10ACC000726164696F5F74696D65736C6F742E6314 +:10ACD0000000000000050040028100005FAA0100A2 +:10ACE0000F2010BD00F068F8002010BDF8B5394EF7 +:10ACF0000446B078002801D001280DD1002C0DD0D9 +:10AD00002046FFF7F8FD00280AD02078324D0028B1 +:10AD100008D0B078012823D00F20F8BD1020F8BD4E +:10AD20000720F8BD02272F702079012814D00020B9 +:10AD300028716079002811D004206871A0689630CD +:10AD4000A860E068E860E868224C14346060F1F7BD +:10AD5000D6FE2060B77019E00320E9E70320ECE796 +:10AD6000002028702079012816D0002028716079F1 +:10AD7000002813D004206871A168F068F2F751F937 +:10AD8000A860E0689630E8600320B0701249F0785F +:10AD9000F2F72CFB0020F8BD0320E7E70320EAE7E9 +:10ADA00010B50E48816A0E4A11400A4A12691143D1 +:10ADB0008162F1F7EFFD10BD10B5064CE078F1F7B8 +:10ADC00083FE0820F1F7EEFC0520A0700020207023 +:10ADD000607010BD54010020E021002000050040FB +:10ADE000FD7EFFFF70477047034610B50B439B077E +:10ADF0000FD1042A0DD308C810C9121FA342F8D0DE +:10AE000018BA21BA884201D9012010BD0020C043E0 +:10AE100010BD002A03D0D30703D0521C07E0002046 +:10AE200010BD03780C78401C491C1B1B07D103780C +:10AE30000C78401C491C1B1B01D1921EF1D11846F5 +:10AE400010BDF8B5042A2CD3830712D00B78491C07 +:10AE50000370401C521E83070BD00B78491C0370F3 +:10AE6000401C521E830704D00B78491C0370401C01 +:10AE7000521E8B079B0F05D0C91ADF002023DE1B53 +:10AE800008C90AE0E6F7A0F9F8BD1D4608C9FD406B +:10AE90001C46B4402C4310C0121F042AF5D2F308FC +:10AEA000C91A521EF0D40B78491C0370401C521E64 +:10AEB000EAD40B78491C0370401C012AE4D40978B9 +:10AEC0000170F8BD01E004C0091F0429FBD28B0703 +:10AED00001D50280801CC90700D00270704700298C +:10AEE0000BD0C30702D00270401C491E022904D3B4 +:10AEF000830702D50280801C891EE3E70022EEE76B +:10AF00000022DFE7020A08704A70020C8A70020E03 +:10AF1000CA707047002203098B4273D3030A8B4225 +:10AF200058D3030B8B423CD3030C8B4221D312E04A +:10AF300003460B437FD4002243088B4274D303099A +:10AF40008B425FD3030A8B4244D3030B8B4228D33B +:10AF5000030C8B420DD3FF22090212BA030C8B4261 +:10AF600002D31212090265D0030B8B4219D300E001 +:10AF7000090AC30B8B4201D3CB03C01A5241830B86 +:10AF80008B4201D38B03C01A5241430B8B4201D336 +:10AF90004B03C01A5241030B8B4201D30B03C01A5F +:10AFA0005241C30A8B4201D3CB02C01A5241830AD9 +:10AFB0008B4201D38B02C01A5241430A8B4201D308 +:10AFC0004B02C01A5241030A8B4201D30B02C01A32 +:10AFD0005241CDD2C3098B4201D3CB01C01A524199 +:10AFE00083098B4201D38B01C01A524143098B4222 +:10AFF00001D34B01C01A524103098B4201D30B010B +:10B00000C01A5241C3088B4201D3CB00C01A52412F +:10B0100083088B4201D38B00C01A524143088B42F4 +:10B0200001D34B00C01A5241411A00D2014652418D +:10B03000104670475DE0CA0F00D04942031000D3AC +:10B040004042534000229C4603098B422DD3030A01 +:10B050008B4212D3FC22890112BA030A8B420CD311 +:10B06000890192118B4208D3890192118B4204D33A +:10B0700089013AD0921100E08909C3098B4201D3BA +:10B08000CB01C01A524183098B4201D38B01C01AF4 +:10B09000524143098B4201D34B01C01A524103096B +:10B0A0008B4201D30B01C01A5241C3088B4201D31A +:10B0B000CB00C01A524183088B4201D38B00C01AC7 +:10B0C0005241D9D243088B4201D34B00C01A52419E +:10B0D000411A00D20146634652415B10104601D32B +:10B0E0004042002B00D54942704763465B1000D3B5 +:10B0F000404201B50020C046C04602BD70477047BF +:10B10000704710B500F058F810BD30B58C180278B3 +:10B11000401C13071B0F01D10378401C120906D1F4 +:10B120000278401C03E00578401C0D70491C5B1E32 +:10B13000F9D101E00B70491C521EFBD1A142E6D3AC +:10B14000002030BD012308CB134B1860134B19604E +:10B15000134B1A607047134A134B13607246053A3B +:10B16000F0E7114A0F4B1B689A420ED10D4B00209D +:10B17000186001980D4B04B598470CBC9E460246DA +:10B18000029800990A4B1B68184706980599094BC5 +:10B190001B68DB6818470000780100207C01002054 +:10B1A0008001002070010020EFBEADDE4D2F0000B9 +:10B1B00098000020040000201D481E497047FFF73A +:10B1C000FBFFE5F7BBFF00BD01200007C06AC0B26E +:10B1D000FF2804D1184819490968884202D0184844 +:10B1E00018490160184819490968884203D1184A6A +:10B1F00013605B68184700BD20BFFDE71248134984 +:10B20000096888420ED1134B18680B498842F3D065 +:10B2100080F308881049884204DD10480268022142 +:10B220000A4302600E4880470E4880470E48004798 +:10B23000F0210020F0210020FFFFFFFF0010001090 +:10B240002C05004008000000001000000000002055 +:10B250000400002000C00100002000202405004060 +:10B26000632F0000C9B1010045B1010013487045CA +:10B2700002D1EFF3098101E0EFF308818869023818 +:10B280000078102814DB202810DB2B280BDB0C4A5D +:10B2900012680C4B9A4203D1602804DB0A4A10471B +:10B2A000022008607047094A10470000084A10470A +:10B2B000084A12682C32126810470000FDFFFFFF99 +:10B2C00064000020BEBAFECAAD120000991F010042 +:10B2D0001B1F0100040000200D4B0E4908470E4BB8 +:10B2E0000C4908470D4B0B4908470D4B09490847C6 +:10B2F0000C4B084908470C4B064908470B4B0549BE +:10B3000008470B4B034908470A4B0249084700000E +:10B31000B125000051220000D52B0000772A000043 +:10B32000252A0000D7270000B912000017140000DA +:10B33000392B0000472300000A7802704B784370D5 +:10B340008A788270CA78C2700B79037170470A7864 +:10B3500002704B7843708A788270CA78C2700B7919 +:10B3600003714A79427170470A7802704B784370D2 +:10B370008A788270CA78C2700B7903714A794271F7 +:10B380008A798271CB79C37170470A8802804A88B2 +:10B3900042800A790271704730B47446641E257881 +:10B3A000641CAB4200D21D46635D5B00E31830BCF9 +:10B3B00018470000FFFFFFFF0000FFFF0100030030 +:10B3C000000001000000000000000000000000007C +:10B3D00000000000870000000000000000000000E6 +:10B3E0000000000000000001020304000D0E0F1019 +:10B3F000000000000F6900002D6B0000F56B0000DD +:10B400004F6C0000A36C00000B6D00006969000028 +:10B41000216A0000AD6D0000BB7900001001100131 +:10B420003A0200001A020000040104013C00170067 +:10B4300044000E00F401FA00960064004B00320054 +:10B440001E001400010204081020408055555525A7 +:10B450002627D6BE898E555555D6BE898E0000004A +:10B460007006120DB413000014035A06A009000060 +:10B470006004F208840D0000A8B401000800002058 +:10B480001000000004110000B8B4010018000020F2 +:10B490006C0100000AB10100D8B401008401002051 +:10B4A0006C20000020110000024801688907FCD5CB +:10B4B0007047000000E200E0013536010001005451 +:10B4C0003720FB349B5F80B4800010026801337F1B +:08B4D0000102A029E449B101C9 +:00000001FF diff --git a/components/softdevice/s130/toolchain/armgcc/armgcc_s130_nrf51422_xxaa.ld b/components/softdevice/s130/toolchain/armgcc/armgcc_s130_nrf51422_xxaa.ld new file mode 100644 index 0000000..c925a32 --- /dev/null +++ b/components/softdevice/s130/toolchain/armgcc/armgcc_s130_nrf51422_xxaa.ld @@ -0,0 +1,22 @@ +/* Linker script to configure memory regions. */ + +SEARCH_DIR(.) +GROUP(-lgcc -lc -lnosys) + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x1c000, LENGTH = 0x24000 + RAM (rwx) : ORIGIN = 0x20002800, LENGTH = 0x1800 +} + +SECTIONS +{ + .fs_data_out ALIGN(4): + { + PROVIDE( __start_fs_data = .); + KEEP(*(fs_data)) + PROVIDE( __stop_fs_data = .); + } = 0 +} + +INCLUDE "nrf5x_common.ld" \ No newline at end of file diff --git a/components/softdevice/s130/toolchain/armgcc/armgcc_s130_nrf51422_xxac.ld b/components/softdevice/s130/toolchain/armgcc/armgcc_s130_nrf51422_xxac.ld new file mode 100644 index 0000000..987b1d2 --- /dev/null +++ b/components/softdevice/s130/toolchain/armgcc/armgcc_s130_nrf51422_xxac.ld @@ -0,0 +1,22 @@ +/* Linker script to configure memory regions. */ + +SEARCH_DIR(.) +GROUP(-lgcc -lc -lnosys) + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x1c000, LENGTH = 0x24000 + RAM (rwx) : ORIGIN = 0x20002800, LENGTH = 0x5800 +} + +SECTIONS +{ + .fs_data_out ALIGN(4): + { + PROVIDE( __start_fs_data = .); + KEEP(*(fs_data)) + PROVIDE( __stop_fs_data = .); + } = 0 +} + +INCLUDE "nrf5x_common.ld" \ No newline at end of file diff --git a/components/softdevice/s130/toolchain/armgcc/armgcc_s130_nrf51822_xxaa.ld b/components/softdevice/s130/toolchain/armgcc/armgcc_s130_nrf51822_xxaa.ld new file mode 100644 index 0000000..c925a32 --- /dev/null +++ b/components/softdevice/s130/toolchain/armgcc/armgcc_s130_nrf51822_xxaa.ld @@ -0,0 +1,22 @@ +/* Linker script to configure memory regions. */ + +SEARCH_DIR(.) +GROUP(-lgcc -lc -lnosys) + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x1c000, LENGTH = 0x24000 + RAM (rwx) : ORIGIN = 0x20002800, LENGTH = 0x1800 +} + +SECTIONS +{ + .fs_data_out ALIGN(4): + { + PROVIDE( __start_fs_data = .); + KEEP(*(fs_data)) + PROVIDE( __stop_fs_data = .); + } = 0 +} + +INCLUDE "nrf5x_common.ld" \ No newline at end of file diff --git a/components/softdevice/s130/toolchain/armgcc/armgcc_s130_nrf51822_xxab.ld b/components/softdevice/s130/toolchain/armgcc/armgcc_s130_nrf51822_xxab.ld new file mode 100644 index 0000000..9f02c11 --- /dev/null +++ b/components/softdevice/s130/toolchain/armgcc/armgcc_s130_nrf51822_xxab.ld @@ -0,0 +1,22 @@ +/* Linker script to configure memory regions. */ + +SEARCH_DIR(.) +GROUP(-lgcc -lc -lnosys) + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x1c000, LENGTH = 0x4000 + RAM (rwx) : ORIGIN = 0x20002800, LENGTH = 0x1800 +} + +SECTIONS +{ + .fs_data_out ALIGN(4): + { + PROVIDE( __start_fs_data = .); + KEEP(*(fs_data)) + PROVIDE( __stop_fs_data = .); + } = 0 +} + +INCLUDE "nrf5x_common.ld" \ No newline at end of file diff --git a/components/softdevice/s130/toolchain/iar/iar_s130_nrf51422_xxaa.icf b/components/softdevice/s130/toolchain/iar/iar_s130_nrf51422_xxaa.icf new file mode 100644 index 0000000..5d78384 --- /dev/null +++ b/components/softdevice/s130/toolchain/iar/iar_s130_nrf51422_xxaa.icf @@ -0,0 +1,31 @@ +/*###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__ = 0x3ffff; +define symbol __ICFEDIT_region_RAM_start__ = 0x20002800; +define symbol __ICFEDIT_region_RAM_end__ = 0x20003fff; +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x800; +define symbol __ICFEDIT_size_heap__ = 0x200; +/**** End of ICF editor section. ###ICF###*/ + +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 CSTACK, + block HEAP }; diff --git a/components/softdevice/s130/toolchain/iar/iar_s130_nrf51422_xxac.icf b/components/softdevice/s130/toolchain/iar/iar_s130_nrf51422_xxac.icf new file mode 100644 index 0000000..97e1f9e --- /dev/null +++ b/components/softdevice/s130/toolchain/iar/iar_s130_nrf51422_xxac.icf @@ -0,0 +1,31 @@ +/*###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__ = 0x3ffff; +define symbol __ICFEDIT_region_RAM_start__ = 0x20002800; +define symbol __ICFEDIT_region_RAM_end__ = 0x20007fff; +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x800; +define symbol __ICFEDIT_size_heap__ = 0x200; +/**** End of ICF editor section. ###ICF###*/ + +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 CSTACK, + block HEAP }; diff --git a/components/softdevice/s130/toolchain/iar/iar_s130_nrf51822_xxaa.icf b/components/softdevice/s130/toolchain/iar/iar_s130_nrf51822_xxaa.icf new file mode 100644 index 0000000..5d78384 --- /dev/null +++ b/components/softdevice/s130/toolchain/iar/iar_s130_nrf51822_xxaa.icf @@ -0,0 +1,31 @@ +/*###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__ = 0x3ffff; +define symbol __ICFEDIT_region_RAM_start__ = 0x20002800; +define symbol __ICFEDIT_region_RAM_end__ = 0x20003fff; +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x800; +define symbol __ICFEDIT_size_heap__ = 0x200; +/**** End of ICF editor section. ###ICF###*/ + +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 CSTACK, + block HEAP }; diff --git a/components/softdevice/s130/toolchain/iar/iar_s130_nrf51822_xxab.icf b/components/softdevice/s130/toolchain/iar/iar_s130_nrf51822_xxab.icf new file mode 100644 index 0000000..511e44d --- /dev/null +++ b/components/softdevice/s130/toolchain/iar/iar_s130_nrf51822_xxab.icf @@ -0,0 +1,31 @@ +/*###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__ = 0x1ffff; +define symbol __ICFEDIT_region_RAM_start__ = 0x20002800; +define symbol __ICFEDIT_region_RAM_end__ = 0x20003fff; +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x800; +define symbol __ICFEDIT_size_heap__ = 0x200; +/**** End of ICF editor section. ###ICF###*/ + +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 CSTACK, + block HEAP }; diff --git a/components/softdevice/s210/doc/s210_nrf51422_5.0.0_licence_agreement.pdf b/components/softdevice/s210/doc/s210_nrf51422_5.0.0_licence_agreement.pdf new file mode 100644 index 0000000000000000000000000000000000000000..61f64d3824ed1122550d40e296fc139bda42b74c GIT binary patch literal 7025 zcmc&(XF!un)>aV^klw42UQHn+fQZt2@4bXj1HmLf00C*zk&aa9f^?|@f&wB6Qbh!$ z2uSZ$6y*!|-rc*qcXz)Z-;Zzp%sb~j^UTbdGjE6mLEC#*-CFh%87#t;s0zd$? zy(>UQ2B?YjaKbqQATXE|P}v2ALt=o+C_5Zd5s5%MAZ2B-I1JLxogAP2!t5<(N|o-# zzKHPmqWC;19&f(B2g>;Z6MC>T9E)yZXU^`(j(*3qOC(G&2* z{fh$}Whu(pdgwjTGaP(mm?C@~9;Kfj{mf>%`f@59qd3b(^%xa~wP+kG^QJAFNS({6 zdb02qB}H3E9rJe45rTE|S)-gxL+l%m6UXY2DO4;dI#}>I-ko>T5j84(A-RVIc0~+h zc(;JRAhW;P&x{y!KdaQnj%QSJ)jU?+ZBCD(ySW;W%&w&2%q^CXc-FPK9(+7?O81hC zEaqXC?`Yq;n%DyvqGoMy)w}ZIH7xUTJzdZ*ri8O=bdbF;E&~ML((2-@m+>V;v+}tz5}{psHh79qhsy>kDB(u1bzO^(+G$?ESBjA4@rk3W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CK``d^6 zOV2A??0$*CMfgTtNCS=vZKqG#AV~}||4N?Vzw?s+NS@Al%l|uhlKcyKg2G_`ojb)P z4|;q6(e!KwMoWblW}MD0n(|5l?mT7qKr}xWC%|4!ce8=>X&Z@7f(mkjxFsd664Tqe z|GpnBE8w%?-beRIg0(*Bh1&#WD}qdC&x-6=G?Y3;<{30tXJftTGOvj1Cq`n;ii&8K zIIys5ZrGy{r!PXcYb;92bnqM3uio324dq0$Is2#e>@$SORO8JQZq}MKy`y&A1zE`4 z(D%ABbAL#L<#rx%IaR2S$nj7 zv~!}g_0$D#pt!YZnJp_+Wnc}}%Qn6@W$Q+YPJ&UjQ>Ym!3;!?##*S$&l$w{J=Y z-sXtCONw~Q!45kv4fXmp0jBu6Sx9|AY{AT@vli48Xr67<=JAUz;@bBIKQDWH=QjOo z=1To9nR}iz|L>U#{);#PpX&pCpdu2Bvp9dL4>UD1C)98#L8n*&4P9_3q@V!=3<4U6 z6MRuF2&4xV39xg*Ad&6_JtOp|ruYqtASwul_cwK;ElI^L13V!9hOl2 zK8msn=I@O^AyKQ zME@Uj7(tl*Q+EYBoE-}71pHg<0DtVyIjk1pk^^XjMgHyGZ}JiQyS)5!nczRyNl=px zUI-*c(B(HF3Aq8fAqlV)wD$#|&^~rfF31}Qw7aE{5RibZNVrE4RFsB*z)+AlNE{4- zNP@*hKwtq7NI(dvK)6`Jxu8A%tJj}%z+;e(!5)J}M!o($!4p2uZMBH8+ v1c6D)S^?EO9MOQ^azP(x;NpiQYzAR}usAym?zi26Nk~bM^YJO^D3kvW&G;@` literal 0 HcmV?d00001 diff --git a/components/softdevice/s210/doc/s210_nrf51422_5.0.0_licence_agreement.txt b/components/softdevice/s210/doc/s210_nrf51422_5.0.0_licence_agreement.txt new file mode 100644 index 0000000..e88fb31 --- /dev/null +++ b/components/softdevice/s210/doc/s210_nrf51422_5.0.0_licence_agreement.txt @@ -0,0 +1,110 @@ +S210/S310 license agreement + +S210 AND S310 LICENSE AGREEMENT + +License Agreement for the Nordic Semiconductor ASA (Nordic) S210 ANT Softdevice software package (S210) and the Nordic Semiconductor +ASA S310 ANT and BLE Softdevice software package (S310). + +You (You or Licensee) must carefully and thoroughly read this License Agreement (Agreement), and accept to adhere to this Agreement +before downloading, installing and/or using any software or content in the S210 or S310 provided herewith. + +YOU ACCEPT THIS LICENSE AGREEMENT BY (A) CLICKING ACCEPT OR AGREE TO THIS LICENSE AGREEMENT, WHERE THIS +OPTION IS MADE AVAILABLE TO YOU; OR (B) BY ACTUALLY USING THE S210 OR S310, IN THIS CASE YOU AGREE THAT THE USE OF +THE S210 OR S310 CONSTITUTES ACCEPTANCE OF THE LICENSING AGREEMENT FROM THAT POINT ONWARDS. + +IF YOU DO NOT AGREE TO BE BOUND BY THE TERMS OF THIS AGREEMENT, THEN DO NOT DOWNLOAD, INSTALL/COMPLETE +INSTALLATION OF, OR IN ANY OTHER WAY MAKE USE OF THE S210 OR S310 OR ANY DOCUMENTATION RELATED TO THE S210 OR +S310. + +1. Grant of License +Subject to the terms in this Agreement Nordic grants Licensee a limited, non-exclusive, non-transferable, non-sub licensable, revocable license +(License): (a) to use the S210 and S310 solely in connection with the nRF51422 Nordic Integrated Circuit (nRF51422 IC), and (b) to distribute +the S210 or S310 solely as implemented in Licensee products. Licensee shall not use the S210 or S310 for any purpose other than specifically +authorized herein. It is a material breach of this agreement to use or modify the S210 or S310 for use on any wireless connectivity integrated +circuit other than the nRF51422 IC. + +2. Title +Nordic or its licensors (as applicable) retain full rights, title, and ownership to the S210 and S310 and any and all patents, copyrights, trade +secrets, trade names, trademarks, and other intellectual property rights in and to the S210 and S310. Nordic licenses portions of the S210 and +S310 from third party licensors, and such licensors retain their respective full rights, title, and ownership in and of the S210 and S310 and any and +all patents, copyrights, trade secrets, trade names, trademarks, and other intellectual property rights in and to the S210 and S310. + +3. No Modifications or Reverse Engineering +Licensee shall not, modify, reverse engineer, disassemble, decompile or otherwise attempt to discover the source code of any non-source code +parts of the S210 and S310 including, but not limited to pre-compiled hex files, binaries and object code. + +4. Distribution Restrictions +Except as set forward in Section 1 above, the Licensee may not disclose or distribute any or all parts of the S210 and S310 to any third party. +Licensee agrees to provide reasonable security precautions to prevent unauthorized access to or use of the S210 and S310 as proscribed herein. +Licensee also agrees that use of and access to the S210 and S310 will be strictly limited to the employees and subcontractors of the Licensee +necessary for the performance of development, verification and production tasks under this Agreement. The Licensee is responsible for making +such employees and subcontractors agree on complying with the obligations concerning use and non-disclosure of the S210 and S310. + +5. End Use Restrictions +Licensee agrees that the S210 and S310 may not be sold, resold, transferred, diverted, exported, re-exported or disposed of (i) for use in +activities involving the development, production, handling, use, operation, maintenance, storage, detection, identification or dissemination of +nuclear, chemical, or biological weapons (including missiles and weapons of mass destruction), nor for use in any facilities engaged in activities +related to such weapons, including where there are reasonable grounds to suspect any such use; (ii) for a military end-use in China or in any +other country subject to any applicable arms embargo or for an item designed, modified, configured, or adapted for a military application in China +or any other country subject to an applicable arms embargo; (iii) to or for the benefit of individuals or entities listed on any applicable restricted or +prohibited party lists; or (iv) to the following countries: Cuba, Iran, North Korea, Sudan, and Syria. Licensee further agree to abide by all other +applicable export controls, trade sanctions and embargo laws, regulations, rules and licenses ("Export Controls and Sanctions Rules") in force +from time to time as they relate to the S210 and S310. You acknowledge that your obligation to comply with applicable Export Controls and +Sanctions Rules is independent of these terms and conditions and you agree to indemnify and hold Nordic and its licensors harmless from and +against any third-party claim, including fines, losses, liabilities or legal fees that arise as a result of the breach by you of these terms and +conditions or any applicable export controls, trade sanctions and embargo laws, regulations, rules and licenses. + +6. No Other Rights +Licensee shall use the S210 and S310 only in compliance with this Agreement and shall refrain from using the S210 and S310 in any way that +may be contrary to this Agreement. + +7. Fees +Nordic grants the License to the Licensee free of charge provided that the Licensee undertakes the obligations in the Agreement and warrants to +comply with the Agreement. + +8. DISCLAIMER OF WARRANTY +THE S210 AND S310 ARE PROVIDED AS IS" WITHOUT WARRANTY OF ANY KIND EXPRESS OR IMPLIED AND NEITHER NORDIC, ITS +LICENSORS OR AFFILIATES NOR THE COPYRIGHT HOLDERS MAKE ANY REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR +THAT THE S210 AND S310 WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. +THERE IS NO WARRANTY BY NORDIC OR BY ANY OTHER PARTY THAT THE FUNCTIONS CONTAINED IN THE S210 AND S310 WILL +MEET THE REQUIREMENTS OF LICENSEE OR THAT THE OPERATION OF THE S210 AND S310 WILL BE UNINTERRUPTED OR +ERROR-FREE. LICENSEE ASSUMES ALL RESPONSIBILITY AND RISK FOR THE SELECTION OF THE S210 AND S310 TO ACHIEVE +LICENSEES INTENDED RESULTS AND FOR THE INSTALLATION, USE AND RESULTS OBTAINED FROM IT. + +9. No Support +Nordic is not obligated to furnish or make available to Licensee any further information, software, technical information, know-how, show-how, +bug-fixes or support. Nordic reserves the right to make changes to the S210 and S310 without further notice. + +10. Limitation of Liability +In no event shall Nordic, its employees or suppliers, licensors or affiliates be liable for any lost profits, revenue, sales, data or costs of +procurement of substitute goods or services, property damage, personal injury, interruption of business, loss of business information or for any +special, direct, indirect, incidental, economic, punitive, special or consequential damages, however caused and whether arising under contract, +tort, negligence, or other theory of liability arising out of the use of or inability to use the S210 and S310, even if Nordic or its employees or +suppliers, licensors or affiliates are advised of the possibility of such damages. Because some countries/states/jurisdictions do not allow the +exclusion or limitation of liability, but may allow liability to be limited, in such cases, Nordic, its employees or licensors or affiliates liability shall be +limited to USD 50. + +11. Breach of Contract +Upon a breach of contract by the Licensee, Nordic and its licensor are entitled to damages in respect of any direct loss which can be reasonably +attributed to the breach by the Licensee. If the Licensee has acted with gross negligence or willful misconduct, the Licensee shall cover both +direct and indirect costs for Nordic and its licensors. + +12. Indemnity +Licensee undertakes to indemnify, hold harmless and defend Nordic and its directors, officers, affiliates, shareholders, licensors, employees and +agents from and against any claims or lawsuits, including attorney's fees, that arise or result of the Licensees execution of the License and which +is not due to causes for which Nordic is responsible. + +13. Governing Law +This Agreement shall be construed according to the laws of Norway, and hereby submits to the exclusive jurisdiction of the Oslo tingrett. + +14. Assignment +Licensee shall not assign this Agreement or any rights or obligations hereunder without the prior written consent of Nordic. + +15. Termination +Without prejudice to any other rights, Nordic may cancel this Agreement if Licensee does not abide by the terms and conditions of this +Agreement. Upon termination Licensee must promptly cease the use of the License and destroy all copies of the Licensed Technology and any +other material provided by Nordic or its affiliate, or produced by the Licensee in connection with the Agreement or the Licensed Technology. + +16. Third party beneficiaries +Nordics licensors are intended third party beneficiaries under this Agreement. \ No newline at end of file diff --git a/components/softdevice/s210/doc/s210_nrf51422_5.0.0_migration_document.pdf b/components/softdevice/s210/doc/s210_nrf51422_5.0.0_migration_document.pdf new file mode 100644 index 0000000000000000000000000000000000000000..e752835069a30dd6ff8dbe6ebcdcd40b11bac070 GIT binary patch literal 637984 zcmcF~1zc2HySH>mDcwUOHFQWwcX#*D-Hm{Nv`8o+(%nc)rywFocSuMHNTcu#gC6l7 z&w0;#@A>#`81|mE*8cCO)>E5GQB<6fg^2?dnW`H6gNn=oUs|O1^3vmEtEKQwt0Bl$5 z0a!R8AFRyR9}pk_*6Z(BxvnpALq6E9zhk@pj_rCL+w~BZ@AFw$uLrTPvP0&uTrZ&q zxC!rSfj_|m6T%4uh6kAsR0cWQyE>VGoWYMNZg1yu^}zz*xLOk^&I*9s6e!LHV1d8} zin9Y)t|y9f0N5aK1q6VKPWC1$AQv4Vm>ED-kcSIU$`(v*;p-2P>kp|bY(OD9J9`%} zO?a+Re+Lh_AAsfiBVJR1<$4G!gd2eGkI8yHlJz?+uZOT*lk}Qz0JiHj*&rkJ06;mA zsil#yy@w9?j?4f~Fnlf^R`7KZ@Y90n;0%C_2TC~EyE^=k8ORAx1*qy|WasQ~MK2Ri zpoj`k6y#=U0#cR`20w|ak+Cy)$hGub)6^Nje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vnD0?!LPFYvs;^8(KcJm23}$TbO`7kED9pse~)Fh4KwyukAU&kH;+ z@VvnD0?!LPFYvs;^8(KcJTLIP!1MX*wc4lPd4cBzo)>stFhAelqR4dso)>st;CX@P z1)djpUf_9w=LMb@cwXRnf#(ID7kFOad4cBzo)>st;CX@P1)eu}-r#wI=MA1Wc;4W7 zgXayN@9%rg>#D)?2G1KjZ}7aq^9IlN_gm5y@VvqE2G1KjZ}7aq^9IiwJa6#4VSe7= zd4uN-o;S?T8$56DyutGZ&l@~%@VvqE2G1KjZ}7aq^9IiwJa6#4!Se>s8$56DyutGZ z&-b^Ra_xfW4W2i6-r#wI=MD4o2G1KjZ}7aq^9IiwJm231N*{pd4W2i6-r#wI=MA1W zc;4W7gXayNH+bIQd4uN-o;P^j;CX}R4W2i6-r#wI=MA1Wc;4W7gXayNH+bIQd4uN- zo;P^j;CX}R4W2i6-r)HSp3j%0$8|q%ZRZ+#{pNe##?JL}q|KJL^LyBuSDWXzsx!Ku z=lE;c8KKYp@shS?H{tZ@nYPD-uW7TZZ=5;P_8za-w3_Zak2fR7IUg_iX2a~>PkpB4 zSn--RPu+P&oN0Spa;80F*-P4N^xOM=&a^$}d`)|1E6%^-{qp|l*WW(BzkQgW)cN~| zbk=|V>p5S49_Q2hm#;rp;Lp6~z2823{P@F9KfZnV_8SJ*+lT+9b>IK|{`rsZzBcNw XUl{u3%kT5w-ET+3XZOTa-x~fW=}6gT literal 0 HcmV?d00001 diff --git a/components/softdevice/s210/headers/ant_error.h b/components/softdevice/s210/headers/ant_error.h new file mode 100644 index 0000000..0b326b9 --- /dev/null +++ b/components/softdevice/s210/headers/ant_error.h @@ -0,0 +1,43 @@ +/* + * Dynastream Innovations Inc. + * Cochrane, AB, CANADA + * + * Copyright (c) 2012 Dynastream Innovations Inc. + * THIS SOFTWARE IS AN EXAMPLE USAGE OF THE ANT PROTOCOL MODULE. + * IT MAY BE USED, MODIFIED and DISTRIBUTED ONLY WITH THE + * APPROPRIATE LICENSE AGREEMENT. + */ + +/* Header guard */ +#ifndef ANT_ERROR_H__ +#define ANT_ERROR_H__ + +#include "ant_parameters.h" + +/** + @defgroup ant_error ANT Error Return + @{ + @ingroup ant_interface +*/ + +/** @brief ANT Error Return parameter definitions */ +#define NRF_ANT_ERROR_OFFSET 0x4000 //ANT's Exception offset + +#define NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE NRF_ANT_ERROR_OFFSET + CHANNEL_IN_WRONG_STATE ///< Response on attempt to perform an action from the wrong channel state. +#define NRF_ANT_ERROR_CHANNEL_NOT_OPENED NRF_ANT_ERROR_OFFSET + CHANNEL_NOT_OPENED ///< Response on attempt to communicate on a channel that is not open. +#define NRF_ANT_ERROR_CHANNEL_ID_NOT_SET NRF_ANT_ERROR_OFFSET + CHANNEL_ID_NOT_SET ///< Response on attempt to open a channel without setting the channel ID. +#define NRF_ANT_ERROR_CLOSE_ALL_CHANNELS NRF_ANT_ERROR_OFFSET + CLOSE_ALL_CHANNELS ///< Response when attempting to start scanning mode, when channels are still open. +#define NRF_ANT_ERROR_TRANSFER_IN_PROGRESS NRF_ANT_ERROR_OFFSET + TRANSFER_IN_PROGRESS ///< Response on attempt to communicate on a channel with a TX transfer in progress. +#define NRF_ANT_ERROR_TRANSFER_SEQUENCE_NUMBER_ERROR NRF_ANT_ERROR_OFFSET + TRANSFER_SEQUENCE_NUMBER_ERROR ///< Response when sequence number of burst message or burst data segment is out of order. +#define NRF_ANT_ERROR_TRANSFER_IN_ERROR NRF_ANT_ERROR_OFFSET + TRANSFER_IN_ERROR ///< Response when transfer error has occured on supplied burst message or burst data segment. +#define NRF_ANT_ERROR_TRANSFER_BUSY NRF_ANT_ERROR_OFFSET + TRANSFER_BUSY ///< Response when transfer is busy and cannot process supplied burst message or burst data segment. +#define NRF_ANT_ERROR_MESSAGE_SIZE_EXCEEDS_LIMIT NRF_ANT_ERROR_OFFSET + MESSAGE_SIZE_EXCEEDS_LIMIT ///< Response if a data message is provided that is too large. +#define NRF_ANT_ERROR_INVALID_MESSAGE NRF_ANT_ERROR_OFFSET + INVALID_MESSAGE ///< Response when the message has an invalid parameter. +#define NRF_ANT_ERROR_INVALID_NETWORK_NUMBER NRF_ANT_ERROR_OFFSET + INVALID_NETWORK_NUMBER ///< Response when an invalid network number is provided +#define NRF_ANT_ERROR_INVALID_LIST_ID NRF_ANT_ERROR_OFFSET + INVALID_LIST_ID ///< Response when the provided list ID or size exceeds the limit +#define NRF_ANT_ERROR_INVALID_SCAN_TX_CHANNEL NRF_ANT_ERROR_OFFSET + INVALID_SCAN_TX_CHANNEL ///< Response when attempting to transmit on channel 0 when in scan mode. +#define NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED NRF_ANT_ERROR_OFFSET + INVALID_PARAMETER_PROVIDED ///< Response when an invalid parameter is specified in a configuration message +#endif // ANT_ERROR_H__ +/** + @} + */ diff --git a/components/softdevice/s210/headers/ant_interface.h b/components/softdevice/s210/headers/ant_interface.h new file mode 100644 index 0000000..b60f60b --- /dev/null +++ b/components/softdevice/s210/headers/ant_interface.h @@ -0,0 +1,939 @@ +/* + * Dynastream Innovations Inc. + * Cochrane, AB, CANADA + * + * Copyright (c) 2014 Dynastream Innovations Inc. + * THIS SOFTWARE IS AN EXAMPLE USAGE OF THE ANT PROTOCOL MODULE. + * IT MAY BE USED, MODIFIED and DISTRIBUTED ONLY WITH THE + * APPROPRIATE LICENSE AGREEMENT. + */ +/* Header guard */ +#ifndef ANT_INTERFACE_H__ +#define ANT_INTERFACE_H__ + +#include +#include +#include "nrf_svc.h" + +/** + @addtogroup stack_ant_module ANT STACK + @{ + @defgroup ant_interface ANT Application Interface + @{ +* @brief ANT Stack Application Programming Interface (API). +*/ + +#define STK_SVC_BASE_2 0xC0 // ANT stack protocol SVC base + +/** @brief ANT Stack API SVC numbers */ +enum { + /*ant re/initialization API*/ + SVC_ANT_STACK_INIT = STK_SVC_BASE_2, + /*event API*/ + SVC_ANT_EVENT_GET, + /*channel control API*/ + SVC_ANT_CHANNEL_ASSIGN, + SVC_ANT_CHANNEL_UNASSIGN, + SVC_ANT_CHANNEL_OPEN, + SVC_ANT_CHANNEL_CLOSE, + SVC_ANT_RX_SCAN_MODE_START, + /*data APIs*/ + SVC_ANT_TX_BROADCAST_MESSAGE, + SVC_ANT_TX_ACKNOWLEDGED_MESSAGE, + SVC_ANT_BURST_HANDLER_REQUEST, + SVC_ANT_PENDING_TRANSMIT_CLEAR, + SVC_ANT_TRANSFER_STOP, + /*radio configuration APIs*/ + SVC_ANT_NETWORK_KEY_SET, + SVC_ANT_CHANNEL_RADIO_FREQ_SET, + SVC_ANT_CHANNEL_RADIO_FREQ_GET, + SVC_ANT_CHANNEL_RADIO_TX_POWER_SET, + SVC_ANT_PROX_SEARCH_SET, + /*configuration APIs*/ + SVC_ANT_CHANNEL_PERIOD_SET, + SVC_ANT_CHANNEL_PERIOD_GET, + SVC_ANT_CHANNEL_ID_SET, + SVC_ANT_CHANNEL_ID_GET, + SVC_ANT_SEARCH_WAVEFORM_SET, + SVC_ANT_CHANNEL_RX_SEARCH_TIMEOUT_SET, + SVC_ANT_SEARCH_CHANNEL_PRIORITY_SET, + SVC_ANT_ACTIVE_SEARCH_SHARING_CYCLES_SET, + SVC_ANT_ACTIVE_SEARCH_SHARING_CYCLES_GET, + SVC_ANT_CHANNEL_LOW_PRIO_RX_SEARCH_TIMEOUT_SET, + SVC_ANT_ADV_BURST_CONFIG_SET, + SVC_ANT_ADV_BURST_CONFIG_GET, + SVC_ANT_LIB_CONFIG_SET, + SVC_ANT_LIB_CONFIG_CLEAR, + SVC_ANT_LIB_CONFIG_GET, + SVC_ANT_ID_LIST_ADD, + SVC_ANT_ID_LIST_CONFIG, + SVC_ANT_AUTO_FREQ_HOP_TABLE_SET, + SVC_ANT_EVENT_FILTERING_SET, + SVC_ANT_EVENT_FILTERING_GET, + /*status APIs*/ + SVC_ANT_ACTIVE, + SVC_ANT_CHANNEL_IN_PROGRESS, + SVC_ANT_CHANNEL_STATUS_GET, + SVC_ANT_PENDING_TRANSMIT, + /*radio test APIs*/ + SVC_ANT_INIT_CW_TEST_MODE, + SVC_ANT_CW_TEST_MODE, + /*antstack version API*/ + SVC_ANT_VERSION, + /*antstack capabilities API*/ + SVC_ANT_CAPABILITIES, + /*more data APIs*/ + SVC_ANT_BURST_HANDLER_WAIT_FLAG_ENABLE, + SVC_ANT_BURST_HANDLER_WAIT_FLAG_DISABLE, + /*more configuration APIs*/ + SVC_ANT_SDU_MASK_SET, + SVC_ANT_SDU_MASK_GET, + SVC_ANT_SDU_MASK_CONFIG, + SVC_ANT_CRYPTO_CHANNEL_ENABLE, + SVC_ANT_CRYPTO_KEY_SET, + SVC_ANT_CRYPTO_INFO_SET, + SVC_ANT_CRYPTO_INFO_GET, + SVC_ANT_RFACTIVE_NOTIFICATION_CONFIG_SET, + SVC_ANT_RFACTIVE_NOTIFICATION_CONFIG_GET, + SVC_ANT_COEX_CONFIG_SET, + SVC_ANT_COEX_CONFIG_GET, + SVC_ANT_ENABLE, + /*reserved APIs*/ + SVC_ANT_RESERVED1, + SVC_ANT_RESERVED2, + /*extended APIs*/ + SVC_ANT_EXTENDED0, + SVC_ANT_EXTENDED1, + SVC_ANT_EXTENDED2, // LAST (64 SVCs) +}; + +////////////////////////////////////////////// +/** @name ANT enable channel structure + * + * @brief Structure for setting up ANT stack channels +@{ */ +////////////////////////////////////////////// +typedef struct +{ + /*Total number of channels wanted in ANT stack*/ + uint8_t ucTotalNumberOfChannels; + /*Number of encrypted channels wanted (subset of total channels)*/ + uint8_t ucNumberOfEncryptedChannels; + /*Memory location pointer to start allocating ANT channels*/ + uint8_t* pucMemoryBlockStartLocation; + /*Block byte size available for ANT channels starting at memory location pointer*/ + uint16_t usMemoryBlockByteSize; +} ANT_ENABLE; +/** @} */ + +/******************************************************************************/ +/** @name ANT API functions + * @{ */ +/******************************************************************************/ + +/******************************* RE/INITIALIZATION API *******************************/ + +/** @brief Function for initializing or re-initializing ANT Stack. + * + * @return ::NRF_SUCCESS + */ +SVCALL(SVC_ANT_STACK_INIT, uint32_t, sd_ant_stack_reset (void)); + +/******************************* EVENT API *******************************/ + +/** @brief This function returns ANT channel events and data messages. + * + * @param[out] pucChannel is the pointer to an unsigned char (1 octet) where the channel number will be copied. + * @param[out] pucEvent is the pointer to an unsigned char (1 octet) where the event code will be copied. See Channel Events and Command Response Codes in ant_parameters.h. + * @param[out] aucANTMesg is the buffer where event's message will be copied. The array size must be at least MESG_BUFFER_SIZE to accommadate the entire ANT_MESSAGE structure size. See ANT Message Structure in ant_parameters.h. + * + * @return ::NRF_SUCCESS + * @return ::NRF_ERROR_INVALID_PARAM + * @return ::NRF_ERROR_NOT_FOUND + */ +SVCALL(SVC_ANT_EVENT_GET, uint32_t, sd_ant_event_get (uint8_t *pucChannel, uint8_t *pucEvent, uint8_t *aucANTMesg)); + +/********************** CHANNEL CONTROL APIS ******************************/ + +/** @brief This function assigns and initializes a new channel. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel to assign. + * @param[in] ucChannelType is an unsigned char (1 octet) denoting the channel type. See Assign Channel Parameters/Assign Channel Types in ant_parameters.h. + * @param[in] ucNetwork is an unsigned char (1 octet) denoting the network key to associate with the channel. + * @param[in] ucExtAssign is a bit field (1 octet) for an extended assign. See Ext. Assign Channel Parameters in ant_parameters.h. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + * ::NRF_ANT_ERROR_INVALID_NETWORK_NUMBER + * ::NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE + */ +SVCALL(SVC_ANT_CHANNEL_ASSIGN, uint32_t, sd_ant_channel_assign (uint8_t ucChannel, uint8_t ucChannelType, uint8_t ucNetwork, uint8_t ucExtAssign)); + +/** @brief This function unassigns a channel. The channel to unassign must be in an assigned state. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel to unassign. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + * ::NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE + */ +SVCALL(SVC_ANT_CHANNEL_UNASSIGN, uint32_t, sd_ant_channel_unassign (uint8_t ucChannel)); + +/** @brief This function opens and activates a channel. The channel to open must be in an assigned state. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel to open. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + * ::NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE + */ +SVCALL(SVC_ANT_CHANNEL_OPEN, uint32_t, sd_ant_channel_open(uint8_t ucChannel)); + +/** @brief This function closes a channel. The channel must be in an open state (SEARCHING or TRACKING). + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel to close. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + * ::NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE + * + */ +SVCALL(SVC_ANT_CHANNEL_CLOSE, uint32_t, sd_ant_channel_close (uint8_t ucChannel)); + +/** @brief This function starts receive scanning mode feature. Channel 0 must be assigned. All other channels must be closed. + * + * @param[in] ucSyncChannelPacketsOnly is an unsigned char (1 octet) denoting synchronous channel only scanning mode. 0 = disable, 1 = enable. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_CLOSE_ALL_CHANNELS + * ::NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE + */ +SVCALL(SVC_ANT_RX_SCAN_MODE_START, uint32_t, sd_ant_rx_scan_mode_start (uint8_t ucSyncChannelPacketsOnly)); + +/*********************** DATA APIS ****************************************/ + +/** @brief This function is used to set broadcast data for transmission. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel to send the data on. + * @param[in] ucSize is an unsigned char (1 octet) denoting the size of the message, ucSize must be 8. + * @param[in] aucMesg is the buffer where the message is located (array must be 8 octets). + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + * ::NRF_ANT_ERROR_MESSAGE_SIZE_EXCEEDS_LIMIT + * ::NRF_ANT_ERROR_INVALID_SCAN_TX_CHANNEL + * ::NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE + * ::NRF_ANT_ERROR_TRANSFER_IN_PROGRESS + * ::NRF_ANT_ERROR_TRANSFER_IN_ERROR + */ +SVCALL(SVC_ANT_TX_BROADCAST_MESSAGE, uint32_t, sd_ant_broadcast_message_tx (uint8_t ucChannel, uint8_t ucSize, uint8_t *aucMesg)); + +/** @brief This function is used to send an acknowledge message. This message requests an acknowledgement from the slave to validate reception. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel to send the data on. + * @param[in] ucSize is an unsigned char (1 octet) denoting the size of the message, ucSize must be 8. + * @param[in] aucMesg is the buffer where the message is located (array must be 8 octets). + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + * ::NRF_ANT_ERROR_MESSAGE_SIZE_EXCEEDS_LIMIT + * ::NRF_ANT_ERROR_INVALID_SCAN_TX_CHANNEL + * ::NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE + * ::NRF_ANT_ERROR_TRANSFER_IN_PROGRESS + * ::NRF_ANT_ERROR_TRANSFER_IN_ERROR + */ +SVCALL(SVC_ANT_TX_ACKNOWLEDGED_MESSAGE, uint32_t, sd_ant_acknowledge_message_tx (uint8_t ucChannel, uint8_t ucSize, uint8_t *aucMesg)); + +/** @brief This function is used to queue data for burst transmission. After every successful call, the input buffer is held in use by the burst handler and must not be changed. + * When the burst handler releases the input buffer, it will either generate a EVENT_TRANSFER_NEXT_DATA_BLOCK event or clear a specified wait flag assigned to the + * burst handler. Transfer end events: EVENT_TRANSFER_TX_COMPLETED and EVENT_TRANSFER_TX_FAILED also releases the input buffer. Special care must be made to ensure that + * the input buffer does not change until it is released by the burst handler to avoid data corruption. Use of burst segment identifiers (BURST_SEGMENT_START, BURST_SEGMENT_CONTINUE, + * and BURST_SEGMENT_END) is required to indicate the sequence of the data block being sent as a burst transfer. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel to do a burst transmission. + * @param[in] usSize is an unsigned short (2 octets) denoting the size of the message block. Size must be divisible by 8. + * @param[in] aucData is the buffer where the message block is located. + * @param[in] ucBurstSegment is an unsigned char (1 octet) containing a bitfield representing the message block type. See Tx Burst Handler Request Segment Defines in ant_parameters.h. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + * ::NRF_ANT_ERROR_INVALID_SCAN_TX_CHANNEL + * ::NRF_ANT_ERROR_CHANNEL_NOT_OPENED + * ::NRF_ANT_ERROR_TRANSFER_SEQUENCE_NUMBER_ERROR + * ::NRF_ANT_ERROR_TRANSFER_IN_PROGRESS + * ::NRF_ANT_ERROR_TRANSFER_IN_ERROR + * ::NRF_ANT_ERROR_MESSAGE_SIZE_EXCEEDS_LIMIT + * ::NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE + * ::NRF_ANT_ERROR_TRANSFER_BUSY + */ +SVCALL(SVC_ANT_BURST_HANDLER_REQUEST, uint32_t, sd_ant_burst_handler_request(uint8_t ucChannel, uint16_t usSize, uint8_t *aucData, uint8_t ucBurstSegment)); + +/** @brief This function clears a pending transmit. Primarily intended for shared slave channels (receive channel). + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel to clear pending transmit. + * @param[out] pucSuccess is the pointer to an unsigned char (1 octet) where the result will be stored. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_PENDING_TRANSMIT_CLEAR, uint32_t, sd_ant_pending_transmit_clear (uint8_t ucChannel, uint8_t *pucSuccess)); + +/** @brief This function kills a receive transfer that is in progress. + * + * @return ::NRF_SUCCESS + */ +SVCALL(SVC_ANT_TRANSFER_STOP, uint32_t, sd_ant_transfer_stop (void)); + +/********************** RADIO CONFIGURATION APIS **************************/ + +/** @brief This function sets the 64bit network address. + * + * @param[in] ucNetwork is an unsigned char (1 octet) denoting the network number to assign the network address to. + * @param[in] aucNetworkKey is the pointer to location of the Network Key (8 octets in length) + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_NETWORK_NUMBER + */ +SVCALL(SVC_ANT_NETWORK_KEY_SET, uint32_t, sd_ant_network_address_set (uint8_t ucNetwork, uint8_t *aucNetworkKey)); + +/** @brief This function sets the radio frequency of an ANT channel. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to set to. + * @param[in] ucFreq is an unsigned char (1 octet) denoting the radio frequency offset from 2400MHz (eg. 2466MHz, ucFreq = 66). + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_NETWORK_NUMBER + */ +SVCALL(SVC_ANT_CHANNEL_RADIO_FREQ_SET, uint32_t, sd_ant_channel_radio_freq_set (uint8_t ucChannel, uint8_t ucFreq)); + +/** @brief This function returns the radio frequency of an ANT channel. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to query. + * @param[out] pucRfreq is the pointer to an unsigned char (1 octet) where the frequency will be stored. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_CHANNEL_RADIO_FREQ_GET, uint32_t, sd_ant_channel_radio_freq_get (uint8_t ucChannel, uint8_t *pucRfreq)); + +/** @brief This function sets the radio tx power. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to assign the radio tx power. + * @param[in] ucTxPower is an unsigned char (1 octet) denoting the ANT transmit power index. See Radio TX Power Definitions in ant_parameters.h. + * @param[in] ucCustomTxPower is an unsigned char (1 octet) denoting the custom nRF transmit power as defined in nrf51_bitfields.h. Only applicable if ucTxPower is set to custom tx power selection. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_CHANNEL_RADIO_TX_POWER_SET, uint32_t, sd_ant_channel_radio_tx_power_set (uint8_t ucChannel, uint8_t ucTxPower, uint8_t ucCustomTxPower)); + +/** @brief This function sets the sensitivity threshold for acquisition on a searching channel. One time set. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number. + * @param[in] ucProxThreshold is an unsigned char (1 octet) denoting the minimum RSSI threshold required for acquisition during a search. See Radio Proximity Search Threshold in ant_parameters.h + * @param[in] ucCustomProxThreshold is an unsigned char (1 octet) denoting the custom minimum RSSI threshold for acquisition during a search. Only applicable if ucProxThreshold is set to custom proximity selection. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_PROX_SEARCH_SET, uint32_t, sd_ant_prox_search_set (uint8_t ucChannel, uint8_t ucProxThreshold, uint8_t ucCustomProxThreshold)); + +/********************** CONFIGURATION APIS ********************************/ + +/** @brief This function sets the channel period. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to set the period to. + * @param[in] usPeriod is an unsigned short (2 octets) denoting the period in 32 kHz counts (usPeriod/32768 s). + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_CHANNEL_PERIOD_SET, uint32_t, sd_ant_channel_period_set (uint8_t ucChannel, uint16_t usPeriod)); + +/** @brief This function returns the current channel period. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to query. + * @param[out] pusPeriod is the pointer to an unsigned short (2 octets) where the channel period will be stored. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_CHANNEL_PERIOD_GET, uint32_t, sd_ant_channel_period_get (uint8_t ucChannel, uint16_t *pusPeriod)); + +/** @brief This function sets the channel ID. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to set. + * @param[in] usDeviceNumber is an unsigned short (2 octets) denoting the device number. + * @param[in] ucDeviceType is an unsigned char (1 octet) denoting the device type. + * @param[in] ucTransmitType is an unsigned char (1 octet) denoting the transmission type. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_CHANNEL_ID_SET, uint32_t, sd_ant_channel_id_set (uint8_t ucChannel, uint16_t usDeviceNumber, uint8_t ucDeviceType, uint8_t ucTransmitType)); + +/** @brief This function returns the current Channel ID of a channel. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to query. + * @param[out] pusDeviceNumber is the pointer to an unsigned short (2 octets) where the device number will be stored. + * @param[out] pucDeviceType is the pointer to an unsigned char (1 octet) where the device type will be stored. + * @param[out] pucTransmitType is the pointer to an unsigned char (1 octet) where the transmit type will be stored. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_CHANNEL_ID_GET, uint32_t, sd_ant_channel_id_get (uint8_t ucChannel, uint16_t *pusDeviceNumber, uint8_t *pucDeviceType, uint8_t *pucTransmitType)); + +/** @brief This function sets the searching waveform value of an ANT Channel. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to set. + * @param[in] usWaveform is an unsigned short (2 octets) denoting the channel waveform period (usWaveform/32768 s). Default = 316. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_SEARCH_WAVEFORM_SET, uint32_t, sd_ant_search_waveform_set (uint8_t ucChannel, uint16_t usWaveform)); + +/** @brief This function sets the receive channel search timeout. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to set. + * @param[in] ucTimeout is an unsigned char (1 octet) denoting the timeout value in 2.5 second increments. Default = 10 (25s). + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_CHANNEL_RX_SEARCH_TIMEOUT_SET, uint32_t, sd_ant_channel_rx_search_timeout_set (uint8_t ucChannel, uint8_t ucTimeout)); + +/** @brief This function sets the channel's search priority. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to set. + * @param[in] ucSearchPriority is an unsigned char (1 octet) denoting the search priority value. 0 to 7 (Default = 0). + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_SEARCH_CHANNEL_PRIORITY_SET, uint32_t, sd_ant_search_channel_priority_set (uint8_t ucChannel, uint8_t ucSearchPriority)); + +/** @brief This function sets the search cycle number of separate searching channels for active search time sharing. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to configure. + * @param[in] ucCycles is an unsigned char (1 octet) denoting the number of cycles to set. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_ACTIVE_SEARCH_SHARING_CYCLES_SET, uint32_t, sd_ant_active_search_sharing_cycles_set (uint8_t ucChannel, uint8_t ucCycles)); + +/** @brief This function returns the search sharing cycles number of the specified searching channel for active search time sharing. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to query. + * @param[out] pucCycles is the pointer to an unsigned char (1 octet) where the cycle value will be stored. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_ACTIVE_SEARCH_SHARING_CYCLES_GET, uint32_t, sd_ant_active_search_sharing_cycles_get (uint8_t ucChannel, uint8_t *pucCycles)); + +/** @brief This function sets the low priority search timeout value of a channel. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to set. + * @param[in] ucTimeout is an unsigned char (1 octet) denoting the timeout value in 2.5 seconds increments. Default = 2 (5s). + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_CHANNEL_LOW_PRIO_RX_SEARCH_TIMEOUT_SET, uint32_t, sd_ant_channel_low_priority_rx_search_timeout_set (uint8_t ucChannel, uint8_t ucTimeout)); + +/** @brief This function sets the advanced burst configuration. Configuration structure is as follows: + * Required Byte0 = 0-Disable, 1-Enable. See Advanced Burst Configuration Defines in ant_parameters.h. + * Required Byte1 = RF payload size. See Advanced Burst Configuration Defines in ant_parameters.h. + * Required Byte2 = Required advanced burst modes. See Advanced Burst Configuration Defines in ant_parameters.h. + * Required Byte3 = 0, Reserved + * Required Byte4 = 0, Reserved + * Required Byte5 = Optional advanced burst modes. See Advanced Burst Configuration Defines in ant_parameters.h. + * Required Byte6 = 0, Reserved + * Required Byte7 = 0, Reserved + * Optional Byte8 = Advanced burst stalling count config LSB. Typical is 3210 (~10s of stalling) where each count represents ~3ms of stalling. + * Optional Byte9 = Advanced burst stalling count config MSB. + * Optional Byte10 = Advanced burst retry count cycle extension. Typical is 3 (15 retries) where each count cycles represents 5 retries. + * + * @param[in] aucConfig is a buffer containing the advanced burst configuration to be set (as stated above). + * @param[in] ucSize is an unsigned char (1 octet) denoting the size of the configuration parameter buffer. Minimum config set is 8 octets, maximum is 11 octets. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_ADV_BURST_CONFIG_SET, uint32_t, sd_ant_adv_burst_config_set (uint8_t *aucConfig, uint8_t ucSize)); + +/** @brief This function gets the advance burst configuration and supported capabilities. + * Returned structure is as follows for configuration: + * Byte0 = RF payload size. See Advanced Burst Configuration Defines in ant_parameters.h. + * Byte1 = Required advanced burst modes. See Advanced Burst Configuration Defines in ant_parameters.h. + * Byte2 = 0, Reserved + * Byte3 = 0, Reserved + * Byte4 = Optional advanced burst modes. See Advanced Burst Configuration Defines in ant_parameters.h. + * Byte5 = 0, Reserved + * Byte6 = 0, Reserved + * Byte7 = Advanced burst stalling count config LSB. Each count represents ~3ms of stalling. + * Byte8 = Advanced burst stalling count config MSB + * Byte9 = Advanced burst retry count cycle extension. Each count cycle represents 5 retries. + * + * Returned structure is as follows for capabilities: + * Byte0 = Supported RF payload size. See Advanced Burst Configuration Defines in ant_parameters.h. + * Byte1 = Supported burst configurations. See Advanced Burst Configuration Defines in ant_parameters.h. + * Byte2 = 0, Reserved + * Byte3 = 0, Reserved + * + * @param[in] ucRequestType is an unsigned char (1 octet) denoting the type of request. 1 = configuration, 0 = capability. + * @param[out] aucConfig is the pointer to the buffer where the configuration/capabilities will be read to. The array should be at least 10 octets + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + */ +SVCALL(SVC_ANT_ADV_BURST_CONFIG_GET, uint32_t, sd_ant_adv_burst_config_get (uint8_t ucRequestType, uint8_t *aucConfig)); + +/** @brief This function sets the ANT Messaging Library Configuration used by Extended messaging. + * + * @param[in] ucANTLibConfig is an unsigned char (1 octet) denoting the ANT lib config bit flags. See ANT Library Config in ant_parameters.h. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_LIB_CONFIG_SET, uint32_t, sd_ant_lib_config_set (uint8_t ucANTLibConfig)); + +/** @brief This function clears the ANT Messaging Library Configuration. + * + * @param[in] ucANTLibConfig is an unsigned char (1 octet) denoting the ANT lib Config bit(s) to clear. See ANT Library Config in ant_parameters.h. + * + * @return ::NRF_SUCCESS + */ +SVCALL(SVC_ANT_LIB_CONFIG_CLEAR, uint32_t, sd_ant_lib_config_clear (uint8_t ucANTLibConfig)); + +/** @brief This function returns current ANT Messaging Library Configuration. + * + * @param[out] pucANTLibConfig is the pointer to an unsigned char (1 octet) where the bit flags will be stored. See ANT Library Config in ant_parameters.h. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + */ +SVCALL(SVC_ANT_LIB_CONFIG_GET, uint32_t, sd_ant_lib_config_get (uint8_t *pucANTLibConfig)); + +/** @brief This function is used to add a Device ID to an include or exclude list. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to add the list entry to. + * @param[in] aucDevId is the pointer to the buffer (4 octets) containing device ID information with the following format: + * Byte0 = DeviceNumber_LSB + * Byte1 = DeviceNumber_MSB + * Byte2 = DeviceType + * Byte3 = TransType + * @param[in] ucListIndex is an unsigned char (1 octet) denoting the index where the specified Channel ID is to be placed in the list (0-3). + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + * ::NRF_ANT_ERROR_INVALID_LIST_ID + */ +SVCALL(SVC_ANT_ID_LIST_ADD, uint32_t, sd_ant_id_list_add (uint8_t ucChannel, uint8_t *aucDevId, uint8_t ucListIndex)); + +/** @brief This function is used to configure the device ID list as include or exclude as well as the number of IDs to compare against. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number of the device ID list. + * @param[in] ucIDListSize is an unsigned char (1 octet) denoting the size of the inclusion or exclusion list (0-4). + * @param[in] ucIncExcFlag is an unsigned char (1 octet) denoting the type of list as Include(0) or Exclude(1) + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + * ::NRF_ANT_ERROR_INVALID_LIST_ID + */ +SVCALL(SVC_ANT_ID_LIST_CONFIG, uint32_t, sd_ant_id_list_config (uint8_t ucChannel, uint8_t ucIDListSize, uint8_t ucIncExcFlag)); + +/** @brief This function populates the frequency hop table list. This table is used when frequency hopping is enabled on a channel via extended assignment bit. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to set the frequency hop table list. + * @param[in] ucFreq0 is an unsigned char (1 octet) denoting the offset from 2400MHz of the 1st frequency hop value. + * @param[in] ucFreq1 is an unsigned char (1 octet) denoting the offset from 2400MHz of the 2nd frequency hop value. + * @param[in] ucFreq2 is an unsigned char (1 octet) denoting the offset from 2400MHz of the 3rd frequency hop value. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_AUTO_FREQ_HOP_TABLE_SET, uint32_t, sd_ant_auto_freq_hop_table_set (uint8_t ucChannel, uint8_t ucFreq0, uint8_t ucFreq1, uint8_t ucFreq2)); + +/** @brief This function is used to specify filter configuration for channel event message generation. + * + * @param[in] usFilter is an unsigned short (2 octets) denoting the filter configuration bitfield. See Event Filtering in ant_parameters.h. + * + * @return ::NRF_SUCCESS + */ +SVCALL(SVC_ANT_EVENT_FILTERING_SET, uint32_t, sd_ant_event_filtering_set (uint16_t usFilter)); + +/** @brief This function is used to retrieve the filter configuration for channel event message generation. + * + * @param[out] pusFilter is the pointer to an unsigned short (2 octets) where the filter configuration will be stored. See Event Filtering in ant_parameters.h. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + */ +SVCALL(SVC_ANT_EVENT_FILTERING_GET, uint32_t, sd_ant_event_filtering_get (uint16_t *pusFilter)); + +/*************************** STATUS APIS **********************************/ + +/** @brief This function gets the ANT activity status. + * + * @param[out] pbAntActive is the pointer to an unsigned char (1 octet) where the ANT activity value will be stored. 1 = active, 0 = otherwise. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + */ +SVCALL(SVC_ANT_ACTIVE, uint32_t, sd_ant_active (uint8_t *pbAntActive)); + +/** @brief This function gets the status if the channel is in progress. + * + * @param[out] pbChannelInProgress is the pointer to an unsigned char (1 octet) where the result will be stored. 1 = in progress, 0 = otherwise. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + */ +SVCALL(SVC_ANT_CHANNEL_IN_PROGRESS, uint32_t, sd_ant_channel_in_progress (uint8_t *pbChannelInProgress)); + +/** @brief This function gets a specific channel's status. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to query. + * @param[out] pucStatus is the pointer to an unsigned char (1 octet) where the channel status will be stored. See Channel Status in ant_parameters.h. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_CHANNEL_STATUS_GET, uint32_t, sd_ant_channel_status_get (uint8_t ucChannel, uint8_t *pucStatus)); + +/** @brief This function determines if there is a pending transmission on a specific channel. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to query. + * @param[out] pucPending is the pointer to an unsigned char (1 octet) where the pending result will be stored. 1 = pending, 0 = otherwise. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_PENDING_TRANSMIT, uint32_t, sd_ant_pending_transmit (uint8_t ucChannel, uint8_t *pucPending)); + +/*************************** TEST APIS **********************************/ + +/** @brief This function initialize the stack to get ready for a continuous wave transmission test. + * + * @return ::NRF_SUCCESS + */ +SVCALL(SVC_ANT_INIT_CW_TEST_MODE, uint32_t, sd_ant_cw_test_mode_init (void)); + +/** @brief This function starts a continuous wave test mode transmission. + * + * @param[in] ucRadioFreq is an unsigned char (1 octet) denoting the radio frequency offset from 2400MHz for continuous wave mode. (eg. 2466MHz, ucRadioFreq = 66). + * @param[in] ucTxPower is an unsigned char (1 octet) denoting the ANT transmit power index for continuous wave mode. See Radio TX Power Definitions in ant_parameters.h + * @param[in] ucCustomTxPower is an unsigned char (1 octet) denoting the custom nRF transmit power as defined in nrf51_bitfields.h. Only applicable if ucTxPower is set to custom tx power selection. + * @param[in] ucMode is an unsigned char (1 octet) denoting test mode type where 0 = cw tx carrier transmission, 1 = cw tx modulated transmission + * + * @return ::NRF_SUCCESS + */ +SVCALL(SVC_ANT_CW_TEST_MODE, uint32_t, sd_ant_cw_test_mode (uint8_t ucRadioFreq, uint8_t ucTxPower, uint8_t ucCustomTxPower, uint8_t ucMode)); + +/** @brief This function gets the version string of the ANT stack. + * + * @param[out] aucVersion is the pointer to the buffer where the version string will be copied, the array should be at least 11 octets. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + */ +SVCALL(SVC_ANT_VERSION, uint32_t, sd_ant_version_get (uint8_t* aucVersion)); + +/** @brief This function gets the capabilities of the stack. + * + * @param[out] aucCapabilities is the pointer to the buffer where the capabilities message will be copied, the array should be at least 8 octets. + * Byte0 = Maximum supported ANT channels + * Byte1 = Maximum supported ANT networks + * Byte2 = CAPABILITIES_STANDARD. See Standard capabilities defines in ant_parameters.h + * Byte3 = CAPABILITIES_ADVANCED. See Advanced capabilities defines in ant_parameters.h + * Byte4 = CAPABILITIES_ADVANCED_2. See Advanced capabilities 2 defines in ant_parameters.h + * Byte5 = Maximum support ANT data channels (only applicable for SensRcore support) + * Byte6 = CAPABILITIES_ADVANCED_3. See Advanced capabilities 3 defines in ant_parameters.h + * Byte7 = CAPABILITIES_ADVANCED_4. Advanced capabilities 4 defines in ant_parameters.h + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + */ +SVCALL(SVC_ANT_CAPABILITIES, uint32_t, sd_ant_capabilities_get (uint8_t* aucCapabilities)); + +/*********************** MORE DATA APIS ****************************************/ + +/** @brief This function assigns a wait variable to the the burst handler. When the input buffer is locked by the handler the wait flag is set to 1. When the + * input buffer is unlocked, the wait flag is set to 0. When a wait flag is assigned, EVENT_TRANSFER_NEXT_DATA_BLOCK events will not + * be generated until the wait flag unassigned. The wait flag should be declared as a static variable. + * + * @param[in] pucWaitFlag is the pointer to a static unsigned char (1 octet) where the status of the burst handler will be updated. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_TRANSFER_IN_PROGRESS + */ +SVCALL(SVC_ANT_BURST_HANDLER_WAIT_FLAG_ENABLE, uint32_t, sd_ant_burst_handler_wait_flag_enable (uint8_t* pucWaitFlag)); + +/** @brief This function unassigns any previously assigned wait variable from the burst handler. The burst handler returns to the default method in generating + * EVENT_TRANSFER_NEXT_DATA_BLOCK to indicate input buffer unlock. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_TRANSFER_IN_PROGRESS + */ +SVCALL(SVC_ANT_BURST_HANDLER_WAIT_FLAG_DISABLE, uint32_t, sd_ant_burst_handler_wait_flag_disable (void)); + +/********************** MORE CONFIGURATION API ********************************/ + +/** @brief This function is used to assign a selective data update (SDU) mask (8 octets) to an identifier, ucMask. + * + * @param[in] ucMask is an unsigned char (1 octet) denoting the index representing the SDU data mask. + * @param[in] aucMask is a buffer (8 octets) containing the SDU mask to be assigned to ucMask. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_SDU_MASK_SET, uint32_t, sd_ant_sdu_mask_set (uint8_t ucMask, uint8_t *aucMask)); + +/** @brief This function returns the selective data update (SDU) mask (8 octets) from the specified identifier, ucMask. + * + * @param[in] ucMask is an unsigned char (1 octet) denoting the index representing the SDU data mask. + * @param[out] aucMask is a pointer to the buffer where the SDU data mask will be copied, the array should be at least 8 octects. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_SDU_MASK_GET, uint32_t, sd_ant_sdu_mask_get (uint8_t ucMask, uint8_t *aucMask)); + +/** @brief This function assigns a SDU mask configuration to a particular channel. The configuration specifies the mask identifier and the type of rx data in which the mask should be applied to. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel in which the SDU mask configuration is to be applied to. + * @param[in] ucMaskConfig is an unsigned char (1 octet) denoting SDU mask configuration. See Selective Data Update Mask Configuration Defines in ant_parameters.h. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_SDU_MASK_CONFIG, uint32_t, sd_ant_sdu_mask_config (uint8_t ucChannel, uint8_t ucMaskConfig)); + +/** @brief This function enables/disables 128-bit AES encryption mode to the specified channel. Advanced burst must be enabled beforehand to enable encrypted channel. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel in which encryption mode is set. + * @param[in] ucEnable is an unsigned char (1 octet) denoting the encryption mode. See Encrypted Channel Defines in ant_parameters.h. + * @param[in] ucKeyNum is an unsigned char (1 octet) denoting the key index of the 128-bit key to be used for encryption. The key index range is bound by the number of + encrypted channels configured by sd_ant_enable(). If sd_ant_enable() is not used then by default ucKeyNum is 0. Range is [0 to (num encrypted channels - 1)], + if 1 or more encrypted channels are configured. + * @param[in] ucDecimationRate is an unsigned char (1 octet) denoting the decimate rate to apply for encrypted slave channel. Must be > 0. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + * ::NRF_ANT_ERROR_INVALID_SCAN_TX_CHANNEL + * ::NRF_ANT_ERROR_CHANNEL_NOT_OPENED + * ::NRF_ANT_ERROR_TRANSFER_SEQUENCE_NUMBER_ERROR + * ::NRF_ANT_ERROR_TRANSFER_IN_PROGRESS + * ::NRF_ANT_ERROR_TRANSFER_IN_ERROR + * ::NRF_ANT_ERROR_MESSAGE_SIZE_EXCEEDS_LIMIT + * ::NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE + * ::NRF_ANT_ERROR_TRANSFER_BUSY + */ +SVCALL(SVC_ANT_CRYPTO_CHANNEL_ENABLE, uint32_t, sd_ant_crypto_channel_enable (uint8_t ucChannel, uint8_t ucEnable, uint8_t ucKeyNum, uint8_t ucDecimationRate)); + +/** @brief This function assigns a 128-bit AES encryption key to a key index. + * + * @param[in] ucKeyNum is an unsigned char (1 octet) denoting the key index for assignment. The key index range is bound by the number of encrypted channels configured + by sd_ant_enable(). If sd_ant_enable() is not used then by default ucKeyNum is 0. Range is [0 to (num encrypted channels - 1)], if 1 or more + encrypted channels are configured. + * @param[in] aucKey is a buffer (16 octets) containing the 128-bit AES key to be assigned to the key index. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_CRYPTO_KEY_SET, uint32_t, sd_ant_crypto_key_set (uint8_t ucKeyNum, uint8_t *aucKey)); + + /** @brief This function sets specific information to be exchanged between the channel master and slave during encryption channel set-up/negotiation. + * + * @param[in] ucType is an unsigned char (1 octet) denoting the type of information being set. See Encrypted Channel Defines in ant_parameters.h. + * @param[in] aucInfo is a buffer containing the information being set (4 octets for ID, 19 octets for custom user data). + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_CRYPTO_INFO_SET, uint32_t, sd_ant_crypto_info_set (uint8_t ucType, uint8_t *aucInfo)); + + /** @brief This function retrieves specific information to be exchanged between the channel master and slave during encryption channel set-up/negotiation. + * + * @param[in] ucType is an unsigned char (1 octet) denoting the type of information being requested. See Encrypted Channel Defines in ant_parameters.h. + * @param[out] aucInfo is a pointer to a buffer in which the information retrieved will be copied to (1 octet for supported mode, 4 octets for ID, 19 octets for custom user data). + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + */ +SVCALL(SVC_ANT_CRYPTO_INFO_GET, uint32_t, sd_ant_crypto_info_get (uint8_t ucType, uint8_t *aucInfo)); + + /** @brief This function enables/disables event notifications to be generated to the application indicating the time to the next ANT radio activity exceeds the configured time threshold. + * Latency (delay in event notification being received and processed by application) must be taken into account if attempting to use this generated event to perform + * operations prior to the radio activity. Cannot be used if asynchronous tx channel is assigned or used. Please note that this only generates events for ANT radio activity. + * + * @param[in] ucMode is an unsigned char (1 octet) denoting the mode of event notification. See RFActive Notification Defines in ant_parameters.h. + * @param[in] usTimeThreshold is an unsigned short (2 octets) denoting the minimum time threshold (32 kHz counts (usTimeThreshold/32768 s)) before the next radio activity that will trigger generation of the event notification. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + * ::NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE + */ +SVCALL(SVC_ANT_RFACTIVE_NOTIFICATION_CONFIG_SET, uint32_t, sd_ant_rfactive_notification_config_set (uint8_t ucMode, uint16_t usTimeThreshold)); + + /** @brief This function retrieves the ANT rf active notification configuration + * + * @param[in] pucMode is a pointer to an unsigned char (1 octet) where the configured mode of event notification will be stored. + * @param[out] pusTimeThreshold is a pointer to an unsigned short (2 octets) where the configured time threhold value will be stored. Time threshold is in 32 kHz counts (usTimeThreshold/32768 s). + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + */ +SVCALL(SVC_ANT_RFACTIVE_NOTIFICATION_CONFIG_GET, uint32_t, sd_ant_rfactive_notification_config_get (uint8_t *pucMode, uint16_t *pusTimeThreshold)); + + /** @brief This function sets ANT radio coexistence behaviour. Supported only if ANT is sharing radio HW concurrently with another wireless protocol. + * Configuration structure is as follows: + * Byte0 = Configuration enable bitfield + * bit0 - enable/disable tx/rx channel keep alive config (Byte4/5 & Byte6/7) + * bit1 - enable/disable tx/rx channel fixed interval priority config (Byte1) + * bit2 - enable/disable transfer keep alive config (Byte2) + * bit3 - enable/disable search channel fixed interval priority config (Byte3) + * else - reserved + * Byte1 = tx/rx channel fixed interval priority configuration + * Byte2 = transfer keep alive configuration + * Byte3 = search channel fixed interval priority configuration + * Byte4(LSB)/Byte5(MSB) = tx channel keep alive configuration + * Byte6(LSB)/Byte7(MSB) = rx channel keep alive configuration + * + * Advanced configuration structure is as follows: + * Byte0 = Configuration enable bitfield + * bit0 - enable/disable priority override config (Byte1) + * bit1-7 - reserved + * Byte1 = ANT priority override. 0 = low, 1 = normal(default), 2 = high, 3 = critical + * Byte2 = Reserved + * Byte3 = Reserved + * Byte4 = Reserved + * Byte5 = Reserved + * Byte6 = Reserved + * Byte7 = Reserved + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel for which the coexistence configuration is to be set. + * @param[in] aucCoexConfig is a buffer containing the coex configuration to be set. Must be 8 octet in size. Set as null for no change. + * @param[in] aucAdvCoexConfig is a buffer containing the advanced coex configuration to be set. Must be 8 octet in size. Set as null for no change. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + */ +SVCALL(SVC_ANT_COEX_CONFIG_SET, uint32_t, sd_ant_coex_config_set (uint8_t ucChannel, uint8_t *aucCoexConfig, uint8_t *aucAdvCoexConfig)); + + /** @brief This function retrieves the configured ANT radio coexistence behaviour as described in ant_coex_config_set. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel to query. + * @param[out] aucCoexConfig is the pointer to a buffer where the coexistence configuration will be stored. Must be at least 8 octet in size. Set as null to ignore. + * @param[out] aucAdvCoexConfig is the pointer to a buffer where the advanced coexistence configuration will be stored. Must be at least 8 octet in size. Set as null to ignore. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + */ +SVCALL(SVC_ANT_COEX_CONFIG_GET, uint32_t, sd_ant_coex_config_get (uint8_t ucChannel, uint8_t *aucCoexConfig, uint8_t *aucAdvCoexConfig)); + + /** @brief This function is used to specify the total number of ANT channels, number of encrypted channels (subset of total ANT channels) and transmit burst queue size to be supported + * by the ANT stack. Upon enabling the SoftDevice successfully, the ANT stack defaults to supporting 1 ANT channel (encryption capable) and a 64 byte transmit burst buffer. If additional + * channels are needed and/or more encrypted channels are needed and/or larger tx burst buffer size is needed, then the desired configuration can be specified to the SoftDevice + * using this function. In this case, a static RAM buffer (of minimum size defined by ANT_ENABLE_GET_REQUIRED_SPACE) must be supplied by the application to be used by the ANT SoftDevice stack. + * + * Notes: - If used, function should be called immediately after sd_softdevice_enable() and before any ANT related SVC calls. + * - Using sd_ant_stack_reset() will not reset ANT stack channel allocation configuration. It will be maintained. + * - Disabling the SoftDevice and then re-enabling the SoFtDevice will reset channel allocation to default. Any previously supplied memory buffer by the application will not be used. + * + * + * @param[in] pstChannelEnable is a pointer to ANT_ENABLE structure. + * where ucTotalNumberOfChannels is an unsigned char (1 octet) denoting the total number of ANT channels desired (1 to MAX_ANT_CHANNELS, defined in ant_parameters.h) + * where ucTotalNumberOfEncryptedChannels is an unsigned char (1 octet) denoting the total number of ANT channels (0 to ucTotalNumberOfChannels) that support encryption + * where pucMemoryBlockStartLocation is the pointer to an application supplied buffer to be used by the ANT SoftDevice stack. + * where usMemoryBlockByteSize is an unsigned short (2 octet) denoting the size of the given memory block (pucMemoryBlockStartLocation). The defined ANT_ENABLE_GET_REQUIRED_SPACE + * macro (see ant_parameters.h) should be used to determine the minimum buffer size requirement + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + */ +SVCALL(SVC_ANT_ENABLE, uint32_t, sd_ant_enable(ANT_ENABLE * const pstChannelEnable)); + +/** @brief Extended0 ANT SVCs. Access extended SVC functions via ucExtID +* +* @param[in] ucExtID is the extended ID defined by SD_ANT_EXT0_ID_ +* @param[in,out] pvArg0 is first argument to extended ANT SVC function specified by ucExtID +* @param[in,out] pvArg1 is second argument to extended ANT SVC function specified by ucExtID +* @param[in,out] pvArg2 is third argument to extended ANT SVC function specified by ucExtID +* +* @return Return value(s) of extended ANT SVC function specified by ucExtID +*/ +SVCALL(SVC_ANT_EXTENDED0, uint32_t, sd_ant_extended0 (uint8_t ucExtID, void *pvArg0, void *pvArg1, void *pvArg2)); + +/** @brief This function configures CPU wake on ANT RF activity behaviour. CPU is woken up via generation of SD_EVENT_IRQn interrupt upon the start of specified RF activity. In +* order to wakeup in the event that SD_EVENT_IRQn is disabled, the SEVONPEND flag has to be set in the Cortex-M0 System Control Register (SCR). CPU is dissallowed from +* entering low power state when calling sd_app_event_wait() for the duration of the RF activity. The intention of this function is to allow/disallow sudden shifts in +* current consumption during RF transmission/ RF reception window which may impact RF performance. When enabled there is a slight increase in average current consumption for +* ANT activities. +* +* @param[in] ucExtID = SD_ANT_EXT0_ID_WAKEON_RF_ACTIVITY_CONFIG_SET +* @param[in] pvArg0 is a pointer to unsigned char (1 octet) denoting the CPU wakeup configuration. See Wake On RF Activity Defines in ant_parameters.h. +* @param[in,out] pvArg1 is unused. Set to NULL. +* @param[in,out] pvArg2 is unused. Set to NULL. +* +* @return ::NRF_SUCCESS +* ::NRF_ERROR_INVALID_PARAM +*/ +#define SD_ANT_EXT0_ID_WAKEON_RF_ACTIVITY_CONFIG_SET 0x00 + +/** @brief This function retrieves the configured CPU wake on ANT RF activity behaviour. +* +* @param[in] ucExtID = SD_ANT_EXT0_ID_WAKEON_RF_ACTIVITY_CONFIG_GET +* @param[out] pvArg0 is a pointer to unsigned char (1 octet) denoting where the CPU wakeup configuration will be stored. +* @param[in,out] pvArg1 is unused. Set to NULL. +* @param[in,out] pvArg2 is unused. Set to NULL. +* +* @return ::NRF_SUCCESS +* ::NRF_ERROR_INVALID_PARAM +*/ +#define SD_ANT_EXT0_ID_WAKEON_RF_ACTIVITY_CONFIG_GET 0x01 + +/** @brief This function enables or disables a feature for preventing long periods of consecutive multi-tracking channel collisions. This feature is +* enabled by default/upon stack reset. +* +* @param[in] ucExtID = SD_ANT_EXT0_ID_ENHANCED_CHANNEL_SPACING_SET +* @param[out] pvArg0 is a pointer to unsigned char (1 octet) denoting enable/disable control. See Enhanced Channel Spacing Defines in ant_parameters.h +* @param[in,out] pvArg1 is unused. Set to NULL. +* @param[in,out] pvArg2 is unused. Set to NULL. +* +* @return ::NRF_SUCCESS +* ::NRF_ERROR_INVALID_PARAM +*/ +#define SD_ANT_EXT0_ID_ENHANCED_CHANNEL_SPACING_SET 0x02 + + +#endif // ANT_INTERFACE_H__ + +/** + @} + @} + @} + */ diff --git a/components/softdevice/s210/headers/ant_parameters.h b/components/softdevice/s210/headers/ant_parameters.h new file mode 100644 index 0000000..d7f38e2 --- /dev/null +++ b/components/softdevice/s210/headers/ant_parameters.h @@ -0,0 +1,725 @@ +/* + * Dynastream Innovations Inc. + * Cochrane, AB, CANADA + * + * Copyright (c) 2012 Dynastream Innovations Inc. + * THIS SOFTWARE IS AN EXAMPLE USAGE OF THE ANT PROTOCOL MODULE. + * IT MAY BE USED, MODIFIED and DISTRIBUTED ONLY WITH THE + * APPROPRIATE LICENSE AGREEMENT. + */ + +#ifndef ANTDEFINES_H +#define ANTDEFINES_H + +#include + +/** + @defgroup ant_parameters ANT Stack Parameters + @{ + @ingroup ant_interface +*/ + +////////////////////////////////////////////// +/** @name ANT Channel Init Definitions +@{ */ +////////////////////////////////////////////// +#define MAX_ANT_CHANNELS ((uint8_t)15) +#define SIZE_OF_NONENCRYPTED_ANT_CHANNEL ((uint8_t)88) +#define SIZE_OF_ENCRYPTED_ANT_CHANNEL ((uint8_t)21) +#define MIN_ANT_TX_BURST_QUEUE_SIZE ((uint8_t)64) + +#define IS_POWER_OF_TWO(A) ( ((A) != 0) && ((((A) - 1) & (A)) == 0) ) + +#define GET_TX_BURST_QUEUE_SIZE(requestedSize) \ + (requestedSize < MIN_ANT_TX_BURST_QUEUE_SIZE ? MIN_ANT_TX_BURST_QUEUE_SIZE : (IS_POWER_OF_TWO(requestedSize) ? requestedSize : MIN_ANT_TX_BURST_QUEUE_SIZE)) + +#define ANT_ENABLE_GET_REQUIRED_SPACE_MORE_THAN_TWO_CH(ucTotalNumberOfChannels, ucNumberOfEncryptedChannels, usTxQueueByteSize) \ + ((ucTotalNumberOfChannels - 2) * SIZE_OF_NONENCRYPTED_ANT_CHANNEL) + (ucNumberOfEncryptedChannels * SIZE_OF_ENCRYPTED_ANT_CHANNEL) + GET_TX_BURST_QUEUE_SIZE(usTxQueueByteSize) + +#define ANT_ENABLE_GET_REQUIRED_SPACE_LESS_THAN_OR_EQ_TWO_CH(ucNumberOfEncryptedChannels, usTxQueueByteSize) \ + (ucNumberOfEncryptedChannels * SIZE_OF_ENCRYPTED_ANT_CHANNEL) + GET_TX_BURST_QUEUE_SIZE(usTxQueueByteSize) + +#define ANT_ENABLE_GET_REQUIRED_SPACE(ucTotalNumberOfChannels, ucNumberOfEncryptedChannels, usTxQueueByteSize) \ + ucTotalNumberOfChannels > 2 ? \ + ANT_ENABLE_GET_REQUIRED_SPACE_MORE_THAN_TWO_CH(ucTotalNumberOfChannels, ucNumberOfEncryptedChannels, usTxQueueByteSize) : \ + ANT_ENABLE_GET_REQUIRED_SPACE_LESS_THAN_OR_EQ_TWO_CH(ucNumberOfEncryptedChannels, usTxQueueByteSize) +/** @} */ + +////////////////////////////////////////////// +/** @brief ANT Clock Definition */ +////////////////////////////////////////////// +#define ANT_CLOCK_FREQUENCY ((uint32_t)32768) ///< ANT system clock frequency. + +////////////////////////////////////////////// +/** @brief ANT Message Payload Size */ +////////////////////////////////////////////// +#define ANT_STANDARD_DATA_PAYLOAD_SIZE ((uint8_t)8) ///< Standard data payload size + +////////////////////////////////////////////// +/** @name Radio TX Power Definitions +@{ */ +////////////////////////////////////////////// +#define RADIO_TX_POWER_LVL_CUSTOM ((uint8_t)0x80) ///< Custom tx power selection +#define RADIO_TX_POWER_LVL_0 ((uint8_t)0x00) ///< Lowest ANT Tx power level setting. (-20dBm). +#define RADIO_TX_POWER_LVL_1 ((uint8_t)0x01) ///< ANT Tx power > Lvl 0. (-12dBm) +#define RADIO_TX_POWER_LVL_2 ((uint8_t)0x02) ///< ANT Tx power > Lvl 1. (-4dBm) +#define RADIO_TX_POWER_LVL_3 ((uint8_t)0x03) ///< ANT Tx power > Lvl 2. Default tx power level. (0dBm) +#define RADIO_TX_POWER_LVL_4 ((uint8_t)0x04) ///< ANT Tx power > Lvl 3. (+4dBm) +/** @} */ + +////////////////////////////////////////////// +/** @name Radio Proximity Search Threshold +@{ */ +////////////////////////////////////////////// +#define PROXIMITY_THRESHOLD_CUSTOM ((uint8_t)0x80) ///< Custom proximity search selection. +#define PROXIMITY_THRESHOLD_OFF ((uint8_t)0x00) ///< Disable proximity search detection. +#define PROXIMITY_THRESHOLD_1 ((uint8_t)0x01) ///< Proximity search detection radius > preset threshold (~ -44dBm on nRF51) +#define PROXIMITY_THRESHOLD_2 ((uint8_t)0x02) ///< Proximity search detection radius > preset threshold (~ -48dBm on nRF51). +#define PROXIMITY_THRESHOLD_3 ((uint8_t)0x03) ///< Proximity search detection radius > preset threshold (~ -52dBm on nRF51). +#define PROXIMITY_THRESHOLD_4 ((uint8_t)0x04) ///< Proximity search detection radius > preset threshold (~ -56dBm on nRF51). +#define PROXIMITY_THRESHOLD_5 ((uint8_t)0x05) ///< Proximity search detection radius > preset threshold (~ -60dBm on nRF51). +#define PROXIMITY_THRESHOLD_6 ((uint8_t)0x06) ///< Proximity search detection radius > preset threshold (~ -64dBm on nRF51). +#define PROXIMITY_THRESHOLD_7 ((uint8_t)0x07) ///< Proximity search detection radius > preset threshold (~ -68dBm on nRF51). +#define PROXIMITY_THRESHOLD_8 ((uint8_t)0x08) ///< Proximity search detection radius > preset threshold (~ -72dBm on nRF51). +#define PROXIMITY_THRESHOLD_9 ((uint8_t)0x09) ///< Proximity search detection radius > preset threshold (~ -76dBm on nRF51). +#define PROXIMITY_THRESHOLD_10 ((uint8_t)0x0A) ///< Proximity search detection radius > preset threshold (~ -80dBm on nRF51). +/** @} */ + +////////////////////////////////////////////// +/** @name Assign Channel Parameters +@{ */ +////////////////////////////////////////////// +#define PARAMETER_RX_NOT_TX ((uint8_t)0x00) ///< Bitfield for slave channel. +#define PARAMETER_TX_NOT_RX ((uint8_t)0x10) ///< Bitfield for master channel. +#define PARAMETER_SHARED_CHANNEL ((uint8_t)0x20) ///< Bitfield for enabling shared channel mode for master or slave channel. +#define PARAMETER_NO_TX_GUARD_BAND ((uint8_t)0x40) ///< Bitfield for enabling tx only mode for master channel. +#define PARAMETER_RX_ONLY ((uint8_t)0x40) ///< Bitfield for enabling rx only mode for slave channel. +/** @} */ + +////////////////////////////////////////////// +/** @name Extended Assign Channel Parameters +@{ */ +////////////////////////////////////////////// +#define EXT_PARAM_ALWAYS_SEARCH ((uint8_t)0x01) ///< Bitfield for enabling background searching behaviour. +#define EXT_PARAM_IGNORE_TRANSMISSION_TYPE ((uint8_t)0x02) ///< Bitfield for enabling ignore transmission type behaviour. +#define EXT_PARAM_FREQUENCY_AGILITY ((uint8_t)0x04) ///< Bitfield for enabling frequency agility behaviour. +#define EXT_PARAM_AUTO_SHARED_SLAVE ((uint8_t)0x08) ///< Auto shared channel. +#define EXT_PARAM_FAST_INITIATION_MODE ((uint8_t)0x10) ///< Channel fast initiation mode. +#define EXT_PARAM_ASYNC_TX_MODE ((uint8_t)0x20) ///< Async transmit channel. +/** @} */ + +////////////////////////////////////////////// +/** @name Assign Channel Types +@{ */ +////////////////////////////////////////////// +#define CHANNEL_TYPE_SLAVE ((uint8_t) 0x00) ///< Slave channel (PARAMETER_RX_NOT_TX). +#define CHANNEL_TYPE_MASTER ((uint8_t) 0x10) ///< Master channel (PARAMETER_TX_NOT_RX). +#define CHANNEL_TYPE_SLAVE_RX_ONLY ((uint8_t) 0x40) ///< Slave rx only channel (PARAMETER_RX_NOT_TX | PARAMETER_RX_ONLY). +#define CHANNEL_TYPE_MASTER_TX_ONLY ((uint8_t) 0x50) ///< Master tx only channel (PARAMETER_TX_NOT_RX | PARAMETER_NO_TX_GUARD_BAND). +#define CHANNEL_TYPE_SHARED_SLAVE ((uint8_t) 0x20) ///< Shared slave channel (PARAMETER_RX_NOT_TX | PARAMETER_SHARED_CHANNEL). +#define CHANNEL_TYPE_SHARED_MASTER ((uint8_t) 0x30) ///< Shared master channel (PARAMETER_TX_NOT_RX | PARAMETER_SHARED_CHANNEL). +/** @} */ + +////////////////////////////////////////////// +/** @name Channel ID Definitions +@{ */ +////////////////////////////////////////////// +#define ANT_ID_SIZE ((uint8_t)4) ///< 4 octet channel ID +#define ANT_ID_TRANS_TYPE_OFFSET ((uint8_t)3) ///< Transmission type offset in channel ID +#define ANT_ID_DEVICE_TYPE_OFFSET ((uint8_t)2) ///< Device type offset in channel ID +#define ANT_ID_DEVICE_NUMBER_HIGH_OFFSET ((uint8_t)1) ///< MSB Device number in channel ID +#define ANT_ID_DEVICE_NUMBER_LOW_OFFSET ((uint8_t)0) ///< LSB Device number in channel ID +#define ANT_ID_DEVICE_TYPE_PAIRING_FLAG ((uint8_t)0x80) ///< Pairing bit in device type field + +#define ANT_TRANS_TYPE_SHARED_ADDR_MASK ((uint8_t)0x03) ///< shared address mask in transmission type field +#define ANT_TRANS_TYPE_1_BYTE_SHARED_ADDRESS ((uint8_t)0x02) ///< 1 byte shared address field +#define ANT_TRANS_TYPE_2_BYTE_SHARED_ADDRESS ((uint8_t)0x03) ///< 2 byte shared address field +/** @} */ + +////////////////////////////////////////////// +/** @name Channel Status +@{ */ +////////////////////////////////////////////// +#define STATUS_CHANNEL_STATE_MASK ((uint8_t)0x03) ///< Channel state mask +#define STATUS_UNASSIGNED_CHANNEL ((uint8_t)0x00) ///< Indicates channel has not been assigned. +#define STATUS_ASSIGNED_CHANNEL ((uint8_t)0x01) ///< Indicates channel has been assigned. +#define STATUS_SEARCHING_CHANNEL ((uint8_t)0x02) ///< Indicates channel is active and in searching state. +#define STATUS_TRACKING_CHANNEL ((uint8_t)0x03) ///< Indicates channel is active and in tracking state. +/** @} */ + +////////////////////////////////////////////// +/** @name Standard capabilities defines +@{ */ +////////////////////////////////////////////// +#define CAPABILITIES_NO_RX_CHANNELS ((uint8_t)0x01) ///< Bitfield in CAPABILITIES_STANDARD byte indicating no rx channel support. +#define CAPABILITIES_NO_TX_CHANNELS ((uint8_t)0x02) ///< Bitfield in CAPABILITIES_STANDARD byte indicating no tx channel support. +#define CAPABILITIES_NO_RX_MESSAGES ((uint8_t)0x04) ///< Bitfield in CAPABILITIES_STANDARD byte indicating no rx message support. +#define CAPABILITIES_NO_TX_MESSAGES ((uint8_t)0x08) ///< Bitfield in CAPABILITIES_STANDARD byte indicating no tx message support. +#define CAPABILITIES_NO_ACKD_MESSAGES ((uint8_t)0x10) ///< Bitfield in CAPABILITIES_STANDARD byte indicating no acknolwedged message support. +#define CAPABILITIES_NO_BURST_TRANSFER ((uint8_t)0x20) ///< Bitfield in CAPABILITIES_STANDARD byte indicating no burst transfer support. +/** @} */ + +////////////////////////////////////////////// +/** @name Advanced capabilities defines +@{ */ +////////////////////////////////////////////// +#define CAPABILITIES_NETWORK_ENABLED ((uint8_t)0x02) ///< Bitfield in CAPABILITIES_ADVANCED byte indicating network support. +#define CAPABILITIES_SERIAL_NUMBER_ENABLED ((uint8_t)0x08) ///< Bitfield in CAPABILITIES_ADVANCED byte indicating serial number support. +#define CAPABILITIES_PER_CHANNEL_TX_POWER_ENABLED ((uint8_t)0x10) ///< Bitfield in CAPABILITIES_ADVANCED byte indicating per channel transmit power support. +#define CAPABILITIES_LOW_PRIORITY_SEARCH_ENABLED ((uint8_t)0x20) ///< Bitfield in CAPABILITIES_ADVANCED byte indicating lower priority search support. +#define CAPABILITIES_SCRIPT_ENABLED ((uint8_t)0x40) ///< Bitfield in CAPABILITIES_ADVANCED byte indicating scripting support. +#define CAPABILITIES_SEARCH_LIST_ENABLED ((uint8_t)0x80) ///< Bitfield in CAPABILITIES_ADVANCED byte indicating include/exclude list support. +/** @} */ + +////////////////////////////////////////////// +/** @name Advanced capabilities 2 defines +@{ */ +////////////////////////////////////////////// +#define CAPABILITIES_LED_ENABLED ((uint8_t)0x01) ///< Bitfield in CAPABILITIES_ADVANCED_2 byte indicating built-in LED support. +#define CAPABILITIES_EXT_MESSAGE_ENABLED ((uint8_t)0x02) ///< Bitfield in CAPABILITIES_ADVANCED_2 byte indicating extended messaging support. +#define CAPABILITIES_SCAN_MODE_ENABLED ((uint8_t)0x04) ///< Bitfield in CAPABILITIES_ADVANCED_2 byte indicating scanning mode support. +#define CAPABILITIES_RESERVED ((uint8_t)0x08) ///< Bitfield in CAPABILITIES_ADVANCED_2 byte currently reserved for future use. +#define CAPABILITIES_PROX_SEARCH_ENABLED ((uint8_t)0x10) ///< Bitfield in CAPABILITIES_ADVANCED_2 byte indicating proximity search support. +#define CAPABILITIES_EXT_ASSIGN_ENABLED ((uint8_t)0x20) ///< Bitfield in CAPABILITIES_ADVANCED_2 byte indicating extended assign support. +#define CAPABILITIES_FS_ANTFS_ENABLED ((uint8_t)0x40) ///< Bitfield in CAPABILITIES_ADVANCED_2 byte indicating built-in FS/ANT-FS support +#define CAPABILITIES_FIT1_ENABLED ((uint8_t)0x80) ///< Bitfield in CAPABILITIES_ADVANCED_2 byte indicating FIT1 module support +/** @} */ + +////////////////////////////////////////////// +/** @name Advanced capabilities 3 defines +@{ */ +////////////////////////////////////////////// +#define CAPABILITIES_ADVANCED_BURST_ENABLED ((uint8_t)0x01) ///< Bitfield in CAPABILITIES_ADVANCED_3 byte indicating advanced burst support. +#define CAPABILITIES_EVENT_BUFFERING_ENABLED ((uint8_t)0x02) ///< Bitfield in CAPABILITIES_ADVANCED_3 byte indicating extended messaging support. +#define CAPABILITIES_EVENT_FILTERING_ENABLED ((uint8_t)0x04) ///< Bitfield in CAPABILITIES_ADVANCED_3 byte indicating event filtering support. +#define CAPABILITIES_HIGH_DUTY_SEARCH_MODE_ENABLED ((uint8_t)0x08) ///< Bitfield in CAPABILITIES_ADVANCED_3 byte indicating high duty search mode support. +#define CAPABILITIES_ACTIVE_SEARCH_SHARING_MODE_ENABLED ((uint8_t)0x10) ///< Bitfield in CAPABILITIES_ADVANCED_3 byte indicating active search sharing mode support. +#define CAPABILITIES_RADIO_COEX_CONFIG_ENABLED ((uint8_t)0x20) ///< Bitfield in CAPABILITIES_ADVANCED_3 byte indicating radio coexistence configuration support. +#define CAPABILITIES_SELECTIVE_DATA_UPDATE_ENABLED ((uint8_t)0x40) ///< Bitfield in CAPABILITIES_ADVANCED_3 byte indicating selective rx data update support. +#define CAPABILITIES_ENCRYPTED_CHANNEL_ENABLED ((uint8_t)0x80) ///< Bitfield in CAPABILITIES_ADVANCED_3 byte indicating encrypted channel support. +/** @} */ + +////////////////////////////////////////////// +/** @name Advanced capabilities 4 defines +@{ */ +////////////////////////////////////////////// +#define CAPABILITIES_RFACTIVE_NOTIFICATION_ENABLED ((uint8_t)0x01) ///< Bitfield in CAPABILITIES_ADVANCED_4 byte indicating rfactive notification support. +/** @} */ + + + +////////////////////////////////////////////// +/** @name Rx Burst Message Sequencing Defines +@{ */ +////////////////////////////////////////////// +#define CHANNEL_NUMBER_MASK ((uint8_t)0x1F) ///< Valid bitfields for channel number +#define SEQUENCE_NUMBER_MASK ((uint8_t)0xE0) ///< Valid bitfields for burst sequence +#define SEQUENCE_NUMBER_ROLLOVER ((uint8_t)0x60) ///< Sequence rollover +#define SEQUENCE_FIRST_MESSAGE ((uint8_t)0x00) ///< Sequence indicating first burst message +#define SEQUENCE_LAST_MESSAGE ((uint8_t)0x80) ///< Sequence indicating last burst message +#define SEQUENCE_NUMBER_INC ((uint8_t)0x20) ///< Incremental sequence value +/** @} */ + +////////////////////////////////////////////// +/** @name Tx Burst Handler Request Segment Defines +@{ */ +////////////////////////////////////////////// +#define BURST_SEGMENT_CONTINUE ((uint8_t)0x00) ///< Bitfield for indicating continuation of burst data segment (no starting or ending burst packet). +#define BURST_SEGMENT_START ((uint8_t)0x01) ///< Bitfield for indicating burst data segment containing starting burst packet. +#define BURST_SEGMENT_END ((uint8_t)0x02) ///< Bitfield for indicating burst data segment containing ending burst packet. +/** @} */ + +////////////////////////////////////////////// +/** @name ANT Library Config +@{ */ +////////////////////////////////////////////// +#define ANT_LIB_CONFIG_MASK_ALL ((uint8_t)0xFF) ///< libary configuration mask +#define ANT_LIB_CONFIG_RADIO_CONFIG_ALWAYS ((uint8_t)0x01) ///< Bitfield intended for platform specific configuration (unused) +#define ANT_LIB_CONFIG_MESG_OUT_INC_TIME_STAMP ((uint8_t)0x20) ///< Bitfield for enabling extended rx messages including ant time stamp field +#define ANT_LIB_CONFIG_MESG_OUT_INC_RSSI ((uint8_t)0x40) ///< Bitfield for enabling extended rx messages including RSSI measurement field +#define ANT_LIB_CONFIG_MESG_OUT_INC_DEVICE_ID ((uint8_t)0x80) ///< Bitfield for enabling extended rx messages including device ID field +/** @} */ + +////////////////////////////////////////////// +/** @name Extended Data Message Bitfield Definitions +@{ */ +////////////////////////////////////////////// +#define ANT_EXT_MESG_BITFIELD_DEVICE_ID ((uint8_t)0x80) ///< Bitfield for indicating device ID field present in extended data message after the extended message bitfield byte +#define ANT_EXT_MESG_BITFIELD_RSSI ((uint8_t)0x40) ///< Bitfield for indicating RSSI field present in extended data message after device id field (if present) +#define ANT_EXT_MESG_BITFIELD_TIME_STAMP ((uint8_t)0x20) ///< Bitfield for indicating timestamp field present in extended data message after rssi/agc field (if present) +#define ANT_EXT_MESG_BIFIELD_EXTENSION ((uint8_t)0x01) ///< Bitfield reserved +/** @} */ + +////////////////////////////////////////////// +/** @name RSSI Definitions in Extended Data Message +@{ */ +////////////////////////////////////////////// +#define RSSI_TYPE_AGC_EXT_MESG_FIELD_SIZE ((uint8_t)4) ///< Extended bitfield message size for AGC type RSSI measurement +#define RSSI_TYPE_DBM_EXT_MESG_FIELD_SIZE ((uint8_t)3) ///< Extended bitfield message size for DBM type RSSI measurement + +#define RSSI_TYPE_OFFSET ((uint8_t)0) ///< RSSI type offset in RSSI field in extended data message +#define RSSI_AGC_TYPE ((uint8_t)0x10) ///< RSSI type indicating support for AGC measurement +#define RSSI_DBM_TYPE ((uint8_t)0x20) ///< RSSI type indicating support for DBM measurement + +#define RSSI_TYPE_AGC_THRESHOLD_OFFSET ((uint8_t)1) ///< Offset of AGC value indicating above or below configured AGC threshold +#define RSSI_TYPE_AGC_REGISTER_LOW ((uint8_t)2) ///< Offset of LSB AGC threshold configuration in RSSI field +#define RSSI_TYPE_AGC_REGISTER_HIGH ((uint8_t)3) ///< Offset of MSB AGC threshold configuration in RSSI field + +#define RSSI_TYPE_DBM_VALUE ((uint8_t)1) ///< Offset of DBM value in RSSI field +#define RSSI_TYPE_DBM_SETTING ((uint8_t)2) ///< Offset of DBM threshold configuration in RSSI field +/** @} */ + +////////////////////////////////////////////// +/** @name Reset/Startup Mesg Codes +@{ */ +////////////////////////////////////////////// +#define RESET_FLAGS_MASK ((uint8_t)0xE0) ///< Message code mask +#define RESET_SUSPEND ((uint8_t)0x80) ///< Startup/Reset from suspend mode +#define RESET_SYNC ((uint8_t)0x40) ///< Startup/Reset from synchronous reset +#define RESET_CMD ((uint8_t)0x20) ///< Startup/Reset from ant message reset command +#define RESET_WDT ((uint8_t)0x02) ///< Startup/Reset from watchdog timeout +#define RESET_RST ((uint8_t)0x01) ///< Startup/Reset from HW reset pin +#define RESET_POR ((uint8_t)0x00) ///< Startup/Reset from HW power on reset +/** @} */ + +////////////////////////////////////////////// +/** @name Event Filtering +@{ */ +////////////////////////////////////////////// +#define FILTER_EVENT_RX_SEARCH_TIMEOUT ((uint16_t)0x0001) ///< Bitfield for filtering EVENT_RX_SEARCH_TIMEOUT +#define FILTER_EVENT_RX_FAIL ((uint16_t)0x0002) ///< Bitfield for filtering EVENT_RX_FAIL +#define FILTER_EVENT_TX ((uint16_t)0x0004) ///< Bitfield for filtering EVENT_TX +#define FILTER_EVENT_TRANSFER_RX_FAILED ((uint16_t)0x0008) ///< Bitfield for filtering EVENT_TRANSFER_RX_FAILED +#define FILTER_EVENT_TRANSFER_TX_COMPLETED ((uint16_t)0x0010) ///< Bitfield for filtering EVENT_TRANSFER_TX_COMPLETED +#define FILTER_EVENT_TRANSFER_TX_FAILED ((uint16_t)0x0020) ///< Bitfield for filtering EVENT_TRANSFER_TX_FAILED +#define FILTER_EVENT_CHANNEL_CLOSED ((uint16_t)0x0040) ///< Bitfield for filtering EVENT_CHANNEL_CLOSED +#define FILTER_EVENT_RX_FAIL_GO_TO_SEARCH ((uint16_t)0x0080) ///< Bitfield for filtering EVENT_RX_FAIL_GO_TO_SEARCH +#define FILTER_EVENT_CHANNEL_COLLISION ((uint16_t)0x0100) ///< Bitfield for filtering EVENT_CHANNEL_COLLISION +#define FILTER_EVENT_TRANSFER_TX_START ((uint16_t)0x0200) ///< Bitfield for filtering EVENT_TRANSFER_TX_START +/** @} */ + + +////////////////////////////////////////////// +/** @name Selective Data Update Mask Configuration Defines +@{ */ +////////////////////////////////////////////// +#define INVALID_SDU_MASK ((uint8_t)0xFF) ///< Selective data update configuration invalid mask. Used to disable SDU for a particular channel +#define SDU_MASK_ACK_CONFIG_BIT ((uint8_t)0x80) ///< Selective data acknowledge config bit. Use to enable SDU for acknowledged data in addition to broadcast data +/** @} */ + +////////////////////////////////////////////// +/** @name Advanced Burst Configuration Defines +@{ */ +////////////////////////////////////////////// +#define ADV_BURST_MODE_DISABLE ((uint8_t)0x00) ///< Set to disable advanced burst transfers +#define ADV_BURST_MODE_ENABLE ((uint8_t)0x01) ///< Set to enable advanced burst transfers + +#define ADV_BURST_MODES_MAX_SIZE ((uint8_t)0x03) ///< Maximum allowable value for advanced burst packets size configuration +#define ADV_BURST_MODES_SIZE_8_BYTES ((uint8_t)0x01) ///< 8-bytes packet size for maximum 20kbps advanced burst transfer rate +#define ADV_BURST_MODES_SIZE_16_BYTES ((uint8_t)0x02) ///< 16-bytes packet size for maximum 40kbps advanced burst transfer rate +#define ADV_BURST_MODES_SIZE_24_BYTES ((uint8_t)0x03) ///< 24-bytes packet size for maximum 60kbps advanced burst transfer rate + +#define ADV_BURST_MODES_MASK ((uint8_t)0x03) ///< Bitfield mask for advanced burst modes +#define ADV_BURST_MODES_FREQ_HOP ((uint8_t)0x01) ///< Bitfield for required/optional frequency hopping mode during advanced burst +#define ADV_BURST_MODES_RESERVED0 ((uint8_t)0x02) ///< Bitfield reserved +/** @} */ + +////////////////////////////////////////////// +/** @name Encrypted Channel Defines +@{ */ +////////////////////////////////////////////// +#define ENCRYPTION_DISABLED_MODE ((uint8_t) 0x00) ///< Set encryption mode to disabled +#define ENCRYPTION_BASIC_REQUEST_MODE ((uint8_t) 0x01) ///< Enable encryption mode with basic request (crypto ID exchange) +#define ENCRYPTION_USER_DATA_REQUEST_MODE ((uint8_t) 0x02) ///< Enable encryption mode with user data request (crypto ID + custom user data exchange) + +#define MAX_SUPPORTED_ENCRYPTION_MODE ENCRYPTION_USER_DATA_REQUEST_MODE ///< Maximum supported encryption mode +#define ENCRYPTION_USER_DATA_SIZE ((uint8_t)19) ///< Maximum size of custom user data + +#define ENCRYPTION_INFO_SET_CRYPTO_ID ((uint8_t)0x00) ///< Set configured crypto ID to be exchanged during encryption negotiation +#define ENCRYPTION_INFO_SET_CUSTOM_USER_DATA ((uint8_t)0x01) ///< Set configured custom user data to be exchanged during encryption negotation +#define ENCRYPTION_INFO_SET_RNG_SEED ((uint8_t)0x02) ///< Set RNG seed + +#define ENCRYPTION_INFO_GET_SUPPORTED_MODE ((uint8_t)0x00) ///< Get supported encrytped mode +#define ENCRYPTION_INFO_GET_CRYPTO_ID ((uint8_t)0x01) ///< Get configured crypto ID to be exchanged during encryption negotiation +#define ENCRYPTION_INFO_GET_CUSTOM_USER_DATA ((uint8_t)0x02) ///< Get configured custom user data to be exchanged during encryption negotiation +/** @} */ + +////////////////////////////////////////////// +/** @name RFActive Notification Defines +@{ */ +////////////////////////////////////////////// +#define RFACTIVE_NOTIFICATION_DISABLED_MODE ((uint8_t)0x00) ///< Set RF Active notification mode to disabled +#define RFACTIVE_NOTIFICATION_ONE_TIME_MODE ((uint8_t)0x01) ///< Set to generate RF Active notification event for only 1 time +#define RFACTIVE_NOTIFICATION_CONTINUOUS_MODE ((uint8_t)0x02) ///< Set to generate RF Active notification event continuously + +#define RFACTIVE_NOTIFICATION_MIN_TIME_THRESHOLD ((uint16_t)0x00A4) ///< Minimum time threshold of 5ms in 32768 time base +/** @} */ + +////////////////////////////////////////////// +/** @name WakeOn RF Activity Defines +@{ */ +////////////////////////////////////////////// +#define WAKEON_RF_ACTIVITY_NONE ((uint8_t)0x00) ///< Disable wakeon +#define WAKEON_RF_ACTIVITY_TX ((uint8_t)0x01) ///< Enable wakeon for ANT RF transmission windows +#define WAKEON_RF_ACTIVITY_RX ((uint8_t)0x02) ///< Enable wakeon for ANT RF reception windows +#define WAKEON_RF_ACTIVITY_ALL ((uint8_t)0x03) ///< (WAKE_ON_RF_ACTIVITY_TX | WAKE_ON_RF_ACTIVITY_RX)) +/** @} */ + +////////////////////////////////////////////// +/** @name Enhanced Channel Spacing Defines +@{ */ +////////////////////////////////////////////// +#define ENHANCED_CHANNEL_SPACING_DISABLE ((uint8_t)0x00) ///< Disable enhanced channel spacing +#define ENHANCED_CHANNEL_SPACING_ENABLE ((uint8_t)0x01) ///< Enable enhanced channel spacing +/** @} */ + + + + +////////////////////////////////////////////// +/** @name Channel Events and Command Response Codes +@{ */ +////////////////////////////////////////////// +#define RESPONSE_NO_ERROR ((uint8_t)0x00) ///< Command response with no error +#define NO_EVENT ((uint8_t)0x00) ///< No Event +#define EVENT_RX_SEARCH_TIMEOUT ((uint8_t)0x01) ///< ANT stack generated event when rx searching state for the channel has timed out +#define EVENT_RX_FAIL ((uint8_t)0x02) ///< ANT stack generated event when synchronous rx channel has missed receiving an ANT packet +#define EVENT_TX ((uint8_t)0x03) ///< ANT stack generated event when synchronous tx channel has occurred +#define EVENT_TRANSFER_RX_FAILED ((uint8_t)0x04) ///< ANT stack generated event when the completion of rx transfer has failed +#define EVENT_TRANSFER_TX_COMPLETED ((uint8_t)0x05) ///< ANT stack generated event when the completion of tx transfer has succeeded +#define EVENT_TRANSFER_TX_FAILED ((uint8_t)0x06) ///< ANT stack generated event when the completion of tx transfer has failed +#define EVENT_CHANNEL_CLOSED ((uint8_t)0x07) ///< ANT stack generated event when channel has closed +#define EVENT_RX_FAIL_GO_TO_SEARCH ((uint8_t)0x08) ///< ANT stack generated event when synchronous rx channel has lost tracking and is entering rx searching state +#define EVENT_CHANNEL_COLLISION ((uint8_t)0x09) ///< ANT stack generated event during a multi-channel setup where an instance of the current synchronous channel is blocked by another synchronous channel +#define EVENT_TRANSFER_TX_START ((uint8_t)0x0A) ///< ANT stack generated event when the start of tx transfer is occuring +//... +#define EVENT_TRANSFER_NEXT_DATA_BLOCK ((uint8_t)0x11) ///< ANT stack generated event when the stack requires the next transfer data block for tx transfer continuation or completion +//... +#define CHANNEL_IN_WRONG_STATE ((uint8_t)0x15) ///< Command response on attempt to perform an action from the wrong channel state +#define CHANNEL_NOT_OPENED ((uint8_t)0x16) ///< Command response on attempt to communicate on a channel that is not open +//... +#define CHANNEL_ID_NOT_SET ((uint8_t)0x18) ///< Command response on attempt to open a channel without setting the channel ID +#define CLOSE_ALL_CHANNELS ((uint8_t)0x19) ///< Command response when attempting to start scanning mode, when channels are still open +//... +#define TRANSFER_IN_PROGRESS ((uint8_t)0x1F) ///< Command response on attempt to communicate on a channel with a TX transfer in progress +#define TRANSFER_SEQUENCE_NUMBER_ERROR ((uint8_t)0x20) ///< Command response when sequence number of burst message or burst data segment is out of order +#define TRANSFER_IN_ERROR ((uint8_t)0x21) ///< Command response when transfer error has occured on supplied burst message or burst data segment +#define TRANSFER_BUSY ((uint8_t)0x22) ///< Command response when transfer is busy and cannot process supplied burst message or burst data segment +//... +#define MESSAGE_SIZE_EXCEEDS_LIMIT ((uint8_t)0x27) ///< Command response if a data message is provided that is too large +#define INVALID_MESSAGE ((uint8_t)0x28) ///< Command response when the message has an invalid parameter +#define INVALID_NETWORK_NUMBER ((uint8_t)0x29) ///< Command response when an invalid network number is provided +#define INVALID_LIST_ID ((uint8_t)0x30) ///< Command response when the provided list ID or size exceeds the limit +#define INVALID_SCAN_TX_CHANNEL ((uint8_t)0x31) ///< Command response when attempting to transmit on channel 0 when in scan mode +#define INVALID_PARAMETER_PROVIDED ((uint8_t)0x33) ///< Command response when an invalid parameter is specified in a configuration message +#define EVENT_QUE_OVERFLOW ((uint8_t)0x35) ///< ANT stack generated event when the event queue in the stack has overflowed and drop 1 or 2 events +#define EVENT_ENCRYPT_NEGOTIATION_SUCCESS ((uint8_t)0x38) ///< ANT stack generated event when connecting to an encrypted channel has succeeded +#define EVENT_ENCRYPT_NEGOTIATION_FAIL ((uint8_t)0x39) ///< ANT stack generated event when connecting to an encrypted channel has failed +#define EVENT_RFACTIVE_NOTIFICATION ((uint8_t)0x3A) ///< ANT stack generated event when the time to next synchronous channel RF activity exceeds configured time threshold +#define EVENT_CONNECTION_START ((uint8_t)0x3B) ///< Application generated event used to indicate when starting a connection to a channel +#define EVENT_CONNECTION_SUCCESS ((uint8_t)0x3C) ///< Application generated event used to indicate when successfuly connected to a channel +#define EVENT_CONNECTION_FAIL ((uint8_t)0x3D) ///< Application generated event used to indicate when failed to connect to a channel +#define EVENT_CONNECTION_TIMEOUT ((uint8_t)0x3E) ///< Application generated event used to indicate when connecting to a channel has timed out +#define EVENT_CONNECTION_UPDATE ((uint8_t)0x3F) ///< Application generated event used to indicate when connection parameters have been updated +//... +#define NO_RESPONSE_MESSAGE ((uint8_t)0x50) ///< Command response type intended to indicate that no serial reply message should be generated +#define EVENT_RX ((uint8_t)0x80) ///< ANT stack generated event indicating received data (eg. broadcast, acknowledge, burst) from the channel +#define EVENT_BLOCKED ((uint8_t)0xFF) ///< ANT stack generated event that should be ignored (eg. filtered events will generate this) +/** @} */ + + +#endif // !ANTDEFINES_H +/* + * Dynastream Innovations Inc. + * Cochrane, AB, CANADA + * + * Copyright (c) 2012 Dynastream Innovations Inc. + * THIS SOFTWARE IS AN EXAMPLE USAGE OF THE ANT PROTOCOL MODULE. + * IT MAY BE USED, MODIFIED and DISTRIBUTED ONLY WITH THE + * APPROPRIATE LICENSE AGREEMENT. + */ + +#ifndef ANTMESSAGE_H +#define ANTMESSAGE_H + +#include + +///////////////////////////////////////////////////////////////////////////// +// Message Format +// Messages are in the format: +// +// AX XX YY -------- CK +// +// where: AX is the 1 byte sync byte either transmit or recieve +// XX is the 1 byte size of the message (0-249) NOTE: THIS WILL BE LIMITED BY THE EMBEDDED RECEIVE BUFFER SIZE +// YY is the 1 byte ID of the message (1-255, 0 is invalid) +// ----- is the data of the message (0-249 bytes of data) +// CK is the 1 byte Checksum of the message +///////////////////////////////////////////////////////////////////////////// +#define MESG_TX_SYNC ((uint8_t)0xA4) +#define MESG_RX_SYNC ((uint8_t)0xA5) +#define MESG_SYNC_SIZE ((uint8_t)1) +#define MESG_SIZE_SIZE ((uint8_t)1) +#define MESG_ID_SIZE ((uint8_t)1) +#define MESG_CHANNEL_NUM_SIZE ((uint8_t)1) +#define MESG_EXT_MESG_BF_SIZE ((uint8_t)1) // NOTE: this could increase in the future +#define MESG_CHECKSUM_SIZE ((uint8_t)1) +#define MESG_DATA_SIZE ((uint8_t)9) + +////////////////////////////////////////////// +// ANT LIBRARY Extended Data Message Fields +// NOTE: You must check the extended message +// bitfield first to find out which fields +// are present before accessing them! +////////////////////////////////////////////// +#define ANT_EXT_MESG_DEVICE_ID_FIELD_SIZE ((uint8_t)4) +#define ANT_EXT_MESG_RSSI_FIELD_SIZE ((uint8_t)4) // maximum RSSI field size regardless of RSSI type +#define ANT_EXT_MESG_TIME_STAMP_FIELD_SIZE ((uint8_t)2) +#define ANT_EXT_STRING_SIZE ((uint8_t)16) // additional buffer to accommdate for 24 byte advance burst mode & encrypted usr data + +// The largest serial message is an ANT data message with all of the extended fields +#define MESG_ANT_MAX_PAYLOAD_SIZE ANT_STANDARD_DATA_PAYLOAD_SIZE + +#define MESG_MAX_EXT_DATA_SIZE (ANT_EXT_MESG_DEVICE_ID_FIELD_SIZE + ANT_EXT_MESG_RSSI_FIELD_SIZE + ANT_EXT_MESG_TIME_STAMP_FIELD_SIZE + ANT_EXT_STRING_SIZE) // ANT device ID (4 bytes) + ANT RSSI (4 bytes) + ANT timestamp (2 bytes) + ANT Ext String Size + +#define MESG_MAX_DATA_SIZE (MESG_ANT_MAX_PAYLOAD_SIZE + MESG_EXT_MESG_BF_SIZE + MESG_MAX_EXT_DATA_SIZE) // ANT data payload (8 bytes) + extended bitfield (1 byte) + extended data (10 bytes) +#define MESG_MAX_SIZE_VALUE (MESG_MAX_DATA_SIZE + MESG_CHANNEL_NUM_SIZE) // this is the maximum value that the serial message size value is allowed to be +#define MESG_BUFFER_SIZE (MESG_SIZE_SIZE + MESG_ID_SIZE + MESG_CHANNEL_NUM_SIZE + MESG_MAX_DATA_SIZE + MESG_CHECKSUM_SIZE) +#define MESG_FRAMED_SIZE (MESG_ID_SIZE + MESG_CHANNEL_NUM_SIZE + MESG_MAX_DATA_SIZE) +#define MESG_HEADER_SIZE (MESG_SYNC_SIZE + MESG_SIZE_SIZE + MESG_ID_SIZE) +#define MESG_FRAME_SIZE (MESG_HEADER_SIZE + MESG_CHECKSUM_SIZE) +#define MESG_MAX_SIZE (MESG_MAX_DATA_SIZE + MESG_FRAME_SIZE) + +#define MESG_SIZE_OFFSET (MESG_SYNC_SIZE) +#define MESG_ID_OFFSET (MESG_SYNC_SIZE + MESG_SIZE_SIZE) +#define MESG_DATA_OFFSET (MESG_HEADER_SIZE) + +////////////////////////////////////////////// +/** @name Message ID's +@{ */ +////////////////////////////////////////////// +#define MESG_INVALID_ID ((uint8_t)0x00) ///< invalid ANT message ID +#define MESG_EVENT_ID ((uint8_t)0x01) ///< ANT stack - channel event ID +//... +#define MESG_VERSION_ID ((uint8_t)0x3E) ///< ANT stack - version message ID +#define MESG_RESPONSE_EVENT_ID ((uint8_t)0x40) ///< ANT stack - channel/response event ANT message ID +#define MESG_UNASSIGN_CHANNEL_ID ((uint8_t)0x41) ///< ANT stack - channel unassign message ID +#define MESG_ASSIGN_CHANNEL_ID ((uint8_t)0x42) ///< ANT stack - channel assign message ID +#define MESG_CHANNEL_MESG_PERIOD_ID ((uint8_t)0x43) ///< ANT stack - channel period message ID +#define MESG_CHANNEL_SEARCH_TIMEOUT_ID ((uint8_t)0x44) ///< ANT stack - channel (high priority) search timeout message ID +#define MESG_CHANNEL_RADIO_FREQ_ID ((uint8_t)0x45) ///< ANT stack - channel radio frequency message ID +#define MESG_NETWORK_KEY_ID ((uint8_t)0x46) ///< ANT stack - network key message ID +#define MESG_RADIO_TX_POWER_ID ((uint8_t)0x47) ///< ANT stack - transmit power message ID +#define MESG_RADIO_CW_MODE_ID ((uint8_t)0x48) ///< ANT stack - CW test mode message ID +#define MESG_SEARCH_WAVEFORM_ID ((uint8_t)0x49) ///< ANT stack - search waveform message ID +#define MESG_SYSTEM_RESET_ID ((uint8_t)0x4A) ///< ANT application - system reset message ID +#define MESG_OPEN_CHANNEL_ID ((uint8_t)0x4B) ///< ANT stack - channel open message ID +#define MESG_CLOSE_CHANNEL_ID ((uint8_t)0x4C) ///< ANT stack - channel close message ID +#define MESG_REQUEST_ID ((uint8_t)0x4D) ///< ANT stack - request message ID +#define MESG_BROADCAST_DATA_ID ((uint8_t)0x4E) ///< ANT stack - broadcast message ID +#define MESG_ACKNOWLEDGED_DATA_ID ((uint8_t)0x4F) ///< ANT stack - acknowledged message ID +#define MESG_BURST_DATA_ID ((uint8_t)0x50) ///< ANT stack - burst message ID +#define MESG_CHANNEL_ID_ID ((uint8_t)0x51) ///< ANT stack - channel ID message ID +#define MESG_CHANNEL_STATUS_ID ((uint8_t)0x52) ///< ANT stack - channel status message ID +#define MESG_RADIO_CW_INIT_ID ((uint8_t)0x53) ///< ANT stack - CW test mode init message ID +#define MESG_CAPABILITIES_ID ((uint8_t)0x54) ///< ANT stack - capabilities message ID +//... +#define MESG_ID_LIST_ADD_ID ((uint8_t)0x59) ///< ANT stack - inc/exc list add message ID +#define MESG_ID_LIST_CONFIG_ID ((uint8_t)0x5A) ///< ANT stack - inc/exc list config message ID +#define MESG_OPEN_RX_SCAN_ID ((uint8_t)0x5B) ///< ANT stack - rx scanning channel open message ID +#define MESG_EXT_BROADCAST_DATA_ID ((uint8_t)0x5D) ///< ANT application - extended broadcast message ID +#define MESG_EXT_ACKNOWLEDGED_DATA_ID ((uint8_t)0x5E) ///< ANT application - extended acknowledged message ID +#define MESG_EXT_BURST_DATA_ID ((uint8_t)0x5F) ///< ANT application - extended burst message ID +#define MESG_CHANNEL_RADIO_TX_POWER_ID ((uint8_t)0x60) ///< ANT stack - channel transmit power message ID +#define MESG_GET_SERIAL_NUM_ID ((uint8_t)0x61) ///< ANT application - device serial number request message ID +#define MESG_SET_LP_SEARCH_TIMEOUT_ID ((uint8_t)0x63) ///< ANT stack - channel (low priority) search timeout message ID +#define MESG_SERIAL_NUM_SET_CHANNEL_ID_ID ((uint8_t)0x65) ///< ANT application - use serial number to set channel message ID +#define MESG_RX_EXT_MESGS_ENABLE_ID ((uint8_t)0x66) ///< ANT stack - extended rx message enable message ID +#define MESG_ANTLIB_CONFIG_ID ((uint8_t)0x6E) ///< ANT stack - lib config message ID +#define MESG_STARTUP_MESG_ID ((uint8_t)0x6F) ///< ANT application - startup message ID +#define MESG_AUTO_FREQ_CONFIG_ID ((uint8_t)0x70) ///< ANT stack - frequency agility config message ID +#define MESG_PROX_SEARCH_CONFIG_ID ((uint8_t)0x71) ///< ANT stack - proximity search config message ID +#define MESG_ADV_BURST_DATA_ID ((uint8_t)0x72) ///< ANT stack - advanced burst data message ID +#define MESG_COEX_PRIORITY_CONFIG_ID ((uint8_t)0x73) ///< ANT stack - coexistence priority config message ID +#define MESG_EVENT_BUFFERING_CONFIG_ID ((uint8_t)0x74) ///< ANT application - event buffering config message ID +#define MESG_SET_SEARCH_CH_PRIORITY_ID ((uint8_t)0x75) ///< ANT stack - search channel priority config message ID +#define MESG_CONFIG_ADV_BURST_ID ((uint8_t)0x78) ///< ANT stack - advanced burst config message ID +#define MESG_EVENT_FILTER_CONFIG_ID ((uint8_t)0x79) ///< ANT stack - event filtering config message ID +#define MESG_SDU_CONFIG_ID ((uint8_t)0x7A) ///< ANT stack - selective data update config message ID +#define MESG_SDU_SET_MASK_ID ((uint8_t)0x7B) ///< ANT stack - selective data update mask message ID +#define MESG_ENCRYPT_ENABLE_ID ((uint8_t)0x7D) ///< ANT stack - channel encryption mode enable message ID +#define MESG_SET_ENCRYPT_KEY_ID ((uint8_t)0x7E) ///< ANT stack - channel encryption key config message ID +#define MESG_SET_ENCRYPT_INFO_ID ((uint8_t)0x7F) ///< ANT stack - channel encryption info config message ID +#define MESG_ACTIVE_SEARCH_SHARING_ID ((uint8_t)0x81) ///< ANT stack - active seach sharing config message ID +#define MESG_COEX_ADV_PRIORITY_CONFIG_ID ((uint8_t)0x82) ///< ANT stack - advanced/platform specific coexistence priority config message ID +#define MESG_RFACTIVE_NOTIFICATION_ID ((uint8_t)0x84) ///< ANT stack - RF active notification config message ID +/** @} */ + +////////////////////////////////////////////// +/** @name Extended Message ID's +@{ */ +////////////////////////////////////////////// +#define MSG_EXT_ID_MASK ((uint8_t)0xE0) ///< ANT message ID extension mask +#define MESG_EXT_ID_0 ((uint8_t)0xE0) ///< ANT message ID extension 0xE1 +#define MESG_EXT_ID_1 ((uint8_t)0xE1) ///< ANT message ID 0xE1 extension +#define MESG_EXT_ID_2 ((uint8_t)0xE2) ///< ANT message ID 0xE2 extension +#define MESG_EXT_ID_3 ((uint8_t)0xE3) ///< ANT message ID 0xE3 extension +#define MESG_EXT_ID_4 ((uint8_t)0xE4) ///< ANT message ID 0xE4 extension + +// 0xE0 extended IDs +#define MESG_EXT_RESPONSE_ID ((uint16_t)0xE000) ///< Reserved for future use. ANT response messages using extended message IDs + +// 0xE1 extended IDs +#define MESG_EXT_REQUEST_ID ((uint16_t)0xE100) ///< Reserved for future use. ANT request messages using extended message IDs + + +// 0xE3 extended IDs +#define MESG_SET_SYNC_SERIAL_BIT_RATE ((uint16_t)0xE300) ///< ANT application - configure byte synchronous serial interface bit rate +#define MESG_SET_SYNC_SERIAL_SRDY_SLEEP ((uint16_t)0xE301) ///< ANT application - configure byte synchronous serial interface SRDY sleep delay + +// 0xE4 extended IDs +#define MESG_ANTFS_OTA_FW_UPDATE ((uint16_t)0xE400) ///< ANT application - run ANTFS over-the-air (OTA) device firmware update +/** @} */ + +////////////////////////////////////////////// +/** @name Debug Message ID's +@{ */ +////////////////////////////////////////////// +#define MESG_DEBUG_ID ((uint8_t)0xF0) // ANT application - debug message ID. Uses sub-index identifiers to differentiate message types +/** @} */ + +////////////////////////////////////////////// +/** @name Message Sizes +@{ */ +////////////////////////////////////////////// +#define MESG_INVALID_SIZE ((uint8_t)0) +#define MESG_VERSION_SIZE ((uint8_t)13) +#define MESG_RESPONSE_EVENT_SIZE ((uint8_t)3) +#define MESG_CHANNEL_STATUS_SIZE ((uint8_t)2) +#define MESG_UNASSIGN_CHANNEL_SIZE ((uint8_t)1) +#define MESG_ASSIGN_CHANNEL_SIZE ((uint8_t)3) +#define MESG_CHANNEL_ID_SIZE ((uint8_t)5) +#define MESG_CHANNEL_MESG_PERIOD_SIZE ((uint8_t)3) +#define MESG_CHANNEL_SEARCH_TIMEOUT_SIZE ((uint8_t)2) +#define MESG_CHANNEL_RADIO_FREQ_SIZE ((uint8_t)2) +#define MESG_CHANNEL_RADIO_TX_POWER_SIZE ((uint8_t)2) +#define MESG_NETWORK_KEY_SIZE ((uint8_t)9) +#define MESG_RADIO_TX_POWER_SIZE ((uint8_t)2) +#define MESG_RADIO_CW_MODE_SIZE ((uint8_t)3) +#define MESG_RADIO_CW_INIT_SIZE ((uint8_t)1) +#define MESG_SEARCH_WAVEFORM_SIZE ((uint8_t)3) +#define MESG_SYSTEM_RESET_SIZE ((uint8_t)1) +#define MESG_OPEN_CHANNEL_SIZE ((uint8_t)1) +#define MESG_CLOSE_CHANNEL_SIZE ((uint8_t)1) +#define MESG_REQUEST_SIZE ((uint8_t)2) +#define MESG_CAPABILITIES_SIZE ((uint8_t)8) +#define MESG_ID_LIST_ADD_SIZE ((uint8_t)6) +#define MESG_ID_LIST_CONFIG_SIZE ((uint8_t)3) +#define MESG_OPEN_RX_SCAN_SIZE ((uint8_t)2) +#define MESG_EXT_CHANNEL_RADIO_FREQ_SIZE ((uint8_t)3) +#define MESG_RADIO_CONFIG_ALWAYS_SIZE ((uint8_t)2) +#define MESG_RX_EXT_MESGS_ENABLE_SIZE ((uint8_t)2) +#define MESG_SET_TX_SEARCH_ON_NEXT_SIZE ((uint8_t)2) +#define MESG_SET_LP_SEARCH_TIMEOUT_SIZE ((uint8_t)2) +#define MESG_GET_SERIAL_NUM_SIZE ((uint8_t)4) +#define MESG_ANTLIB_CONFIG_SIZE ((uint8_t)2) +#define MESG_STARTUP_MESG_SIZE ((uint8_t)1) +#define MESG_AUTO_FREQ_CONFIG_SIZE ((uint8_t)4) +#define MESG_PROX_SEARCH_CONFIG_SIZE ((uint8_t)2) +#define MESG_COEX_PRIORITY_CONFIG_REQ_SIZE ((uint8_t)9) +#define MESG_EVENT_BUFFERING_CONFIG_REQ_SIZE ((uint8_t)6) +#define MESG_CONFIG_ADV_BURST_REQ_CAPABILITIES_SIZE ((uint8_t)4) +#define MESG_CONFIG_ADV_BURST_REQ_CONFIG_SIZE ((uint8_t)10) +#define MESG_CONFIG_ENCRYPT_REQ_CAPABILITIES_SIZE ((uint8_t)2) +#define MESG_CONFIG_ENCRYPT_REQ_CONFIG_ID_SIZE ((uint8_t)5) +#define MESG_CONFIG_ENCRYPT_REQ_CONFIG_USER_DATA_SIZE ((uint8_t)20) +#define MESG_CONFIG_ENCRYPT_REQ_CURRENT_CTR ((uint8_t)17) +#define MESG_EVENT_FILTER_CONFIG_REQ_SIZE ((uint8_t)3) +#define MESG_ACTIVE_SEARCH_SHARING_REQ_SIZE ((uint8_t)2) +#define MESG_COEX_ADV_PRIORITY_CONFIG_REQ_SIZE ((uint8_t)9) +#define MESG_RFACTIVE_NOTIFICATION_SIZE ((uint8_t)4) +#define MESG_FLASH_PROTECTION_CHECK_SIZE ((uint8_t)1) +#define MESG_BIST_SIZE ((uint8_t)6) +/** @} */ + +////////////////////////////////////////////// +/* ANT Message Structure */ +////////////////////////////////////////////// +/** @cond */ +typedef union +{ + uint8_t ucExtMesgBF; + struct + { + uint8_t bExtFieldCont : 1; + uint8_t : 1; + uint8_t : 1; + uint8_t : 1; + uint8_t : 1; + uint8_t bANTTimeStamp : 1; + uint8_t bANTRssi : 1; + uint8_t bANTDeviceID : 1; + }stExtMesgBF; + +} EXT_MESG_BF; // extended message bitfield + +typedef union +{ + uint32_t ulForceAlign; // force the struct to be 4-byte aligned, required for some casting in command.c + uint8_t aucMessage[MESG_BUFFER_SIZE]; // the complete message buffer pointer + struct + { + uint8_t ucSize; // the message size + union + { + uint8_t aucFramedData[MESG_FRAMED_SIZE]; // pointer for serial framer + struct + { + uint8_t ucMesgID; // the message ID + union + { + uint8_t aucMesgData[MESG_MAX_SIZE_VALUE]; // the message data + struct + { + union + { + uint8_t ucChannel; // ANT channel number + uint8_t ucSubID; // subID portion of ext ID message + }uData0; + uint8_t aucPayload[ANT_STANDARD_DATA_PAYLOAD_SIZE]; // ANT message payload + EXT_MESG_BF sExtMesgBF; // extended message bitfield (NOTE: this will not be here for longer data messages) + uint8_t aucExtData[MESG_MAX_EXT_DATA_SIZE]; // extended message data + }stMesgData; + }uMesgData; + }stFramedData; + }uFramedData; + uint8_t ucCheckSum; // the message checksum + }stMessage; + +} ANT_MESSAGE; +/* @endcond */ + +/** @brief Defines for accesssing ANT_MESSAGE members variables */ +/** @name ANT serial message structure +@{ */ +#define ANT_MESSAGE_ulForceAlign ulForceAlign +#define ANT_MESSAGE_aucMessage aucMessage +#define ANT_MESSAGE_ucSize stMessage.ucSize +#define ANT_MESSAGE_aucFramedData stMessage.uFramedData.aucFramedData +#define ANT_MESSAGE_ucMesgID stMessage.uFramedData.stFramedData.ucMesgID +#define ANT_MESSAGE_aucMesgData stMessage.uFramedData.stFramedData.uMesgData.aucMesgData +#define ANT_MESSAGE_ucChannel stMessage.uFramedData.stFramedData.uMesgData.stMesgData.uData0.ucChannel +#define ANT_MESSAGE_ucSubID stMessage.uFramedData.stFramedData.uMesgData.stMesgData.uData0.ucSubID +#define ANT_MESSAGE_aucPayload stMessage.uFramedData.stFramedData.uMesgData.stMesgData.aucPayload +#define ANT_MESSAGE_sExtMesgBF stMessage.uFramedData.stFramedData.uMesgData.stMesgData.sExtMesgBF +#define ANT_MESSAGE_ucExtMesgBF stMessage.uFramedData.stFramedData.uMesgData.stMesgData.sExtMesgBF.ucExtMesgBF +#define ANT_MESSAGE_stExtMesgBF stMessage.uFramedData.stFramedData.uMesgData.stMesgData.sExtMesgBF.stExtMesgBF +#define ANT_MESSAGE_aucExtData stMessage.uFramedData.stFramedData.uMesgData.stMesgData.aucExtData +#define ANT_MESSAGE_ucCheckSum stMessage.ucCheckSum +/** @} */ + +#endif // !ANTMESSAGE_H + +/** + @} + */ diff --git a/components/softdevice/s210/headers/nrf_error.h b/components/softdevice/s210/headers/nrf_error.h new file mode 100644 index 0000000..d580aa3 --- /dev/null +++ b/components/softdevice/s210/headers/nrf_error.h @@ -0,0 +1,78 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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__ + +/** @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 + +#endif // NRF_ERROR_H__ + +/** + @} +*/ diff --git a/components/softdevice/s210/headers/nrf_error_sdm.h b/components/softdevice/s210/headers/nrf_error_sdm.h new file mode 100644 index 0000000..b3b9b76 --- /dev/null +++ b/components/softdevice/s210/headers/nrf_error_sdm.h @@ -0,0 +1,60 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +#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). + +#endif // NRF_ERROR_SDM_H__ + +/** + @} + @} +*/ diff --git a/components/softdevice/s210/headers/nrf_error_soc.h b/components/softdevice/s210/headers/nrf_error_soc.h new file mode 100644 index 0000000..d80d626 --- /dev/null +++ b/components/softdevice/s210/headers/nrf_error_soc.h @@ -0,0 +1,76 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/* 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 + +#endif // NRF_ERROR_SOC_H__ +/** + @} + @} +*/ diff --git a/components/softdevice/s210/headers/nrf_mbr.h b/components/softdevice/s210/headers/nrf_mbr.h new file mode 100644 index 0000000..3ac6dbf --- /dev/null +++ b/components/softdevice/s210/headers/nrf_mbr.h @@ -0,0 +1,184 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 + + +/** @addtogroup NRF_MBR_DEFINES Defines + * @{ */ + +/**@brief MBR SVC Base number. */ +#define MBR_SVC_BASE (0x18) + +/** @} */ + +/** @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 PROTENSET 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 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. + */ +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 adress in NFR_UICR->BOOTADDR or to the SoftDevice if the BOOTADDR is not set. + * + * @retval ::NRF_SUCCESS + * @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. + */ +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_copy_bl_t copy_bl; /**< Parameters for copy BootLoader.*/ + sd_mbr_command_compare_t compare; /**< Parameters for verify.*/ + sd_mbr_command_vector_table_base_set_t base_set; /**< Parameters for vector table base set.*/ + } params; +} sd_mbr_command_t; + +/** @} */ + +/** @addtogroup NRF_MBR_FUNCTIONS Functions + * @{ */ + +/**@brief Issue Master Boot Record commands + * + * Commands used when updating a SoftDevice and bootloader. + * + * @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 + +*/ +SVCALL(SD_MBR_COMMAND, uint32_t, sd_mbr_command(sd_mbr_command_t* param)); + +/** @} */ +#endif // NRF_MBR_H__ + +/** + @} +*/ diff --git a/components/softdevice/s210/headers/nrf_sd_def.h b/components/softdevice/s210/headers/nrf_sd_def.h new file mode 100644 index 0000000..4740cd8 --- /dev/null +++ b/components/softdevice/s210/headers/nrf_sd_def.h @@ -0,0 +1,23 @@ +/* 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. + * + */ + +#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 th spplication). */ +#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/components/softdevice/s210/headers/nrf_sdm.h b/components/softdevice/s210/headers/nrf_sdm.h new file mode 100644 index 0000000..63a89ab --- /dev/null +++ b/components/softdevice/s210/headers/nrf_sdm.h @@ -0,0 +1,221 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 "nrf51.h" +#include "nrf_soc.h" +#include "nrf_error_sdm.h" + +/** @addtogroup NRF_SDM_DEFINES Defines + * @{ */ + +/** @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 usual size reserverd 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) + +/** @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) + + +/** @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 */ +}; + +/**@brief Possible lfclk oscillator sources. */ +enum NRF_CLOCK_LFCLKSRCS +{ + NRF_CLOCK_LFCLKSRC_SYNTH_250_PPM, /**< LFCLK Synthesized from HFCLK. */ + NRF_CLOCK_LFCLKSRC_XTAL_500_PPM, /**< LFCLK crystal oscillator 500 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_250_PPM, /**< LFCLK crystal oscillator 250 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_150_PPM, /**< LFCLK crystal oscillator 150 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_100_PPM, /**< LFCLK crystal oscillator 100 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_75_PPM, /**< LFCLK crystal oscillator 75 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_50_PPM, /**< LFCLK crystal oscillator 50 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_30_PPM, /**< LFCLK crystal oscillator 30 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, /**< LFCLK crystal oscillator 20 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_250MS_CALIBRATION, /**< LFCLK RC oscillator, 250ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_500MS_CALIBRATION, /**< LFCLK RC oscillator, 500ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_1000MS_CALIBRATION, /**< LFCLK RC oscillator, 1000ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_2000MS_CALIBRATION, /**< LFCLK RC oscillator, 2000ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_4000MS_CALIBRATION, /**< LFCLK RC oscillator, 4000ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_8000MS_CALIBRATION, /**< LFCLK RC oscillator, 8000ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_1000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 1000ms, if changed above a threshold, a calibration is done.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_2000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 2000ms, if changed above a threshold, a calibration is done.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_4000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 4000ms, if changed above a threshold, a calibration is done.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_8000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 8000ms, if changed above a threshold, a calibration is done.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_16000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 16000ms, if changed above a threshold, a calibration is done.*/ +}; + +/** @} */ + +/** @addtogroup NRF_SDM_TYPES Types + * @{ */ + +/**@brief Type representing lfclk oscillator source. */ +typedef uint32_t nrf_clock_lfclksrc_t; + + +/**@brief SoftDevice Assertion Handler type. + * + * When an unexpected error occurs within the SoftDevice it will call the SoftDevice assertion handler callback. + * 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 SoftDevice assert callback. + * + * @param[in] pc The program counter of the failed assert. + * @param[in] line_number Line number where the assert failed. + * @param[in] file_name File name where the assert failed. + */ +typedef void (*softdevice_assertion_handler_t)(uint32_t pc, uint16_t line_number, const uint8_t * p_file_name); + +/** @} */ + +/** @addtogroup NRF_SDM_FUNCTIONS Functions + * @{ */ + +/**@brief Enables the SoftDevice and by extension the protocol stack. + * + * Idempotent function to enable the SoftDevice. + * + * @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 clock_source Low frequency clock source and accuracy. (Note: 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 assertion_handler Callback for SoftDevice assertions. + * + * @retval ::NRF_SUCCESS + * @retval ::NRF_ERROR_INVALID_STATE SoftDevice is already enabled, and the clock source and assertion handler cannot be updated. + * @retval ::NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION SoftDeviceinterrupt 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_lfclksrc_t clock_source, softdevice_assertion_handler_t assertion_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)); + +/** @} */ + +#endif // NRF_SDM_H__ + +/** + @} +*/ diff --git a/components/softdevice/s210/headers/nrf_soc.h b/components/softdevice/s210/headers/nrf_soc.h new file mode 100644 index 0000000..c1f9428 --- /dev/null +++ b/components/softdevice/s210/headers/nrf_soc.h @@ -0,0 +1,993 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 "nrf51.h" +#include "nrf51_bitfields.h" +#include "nrf_error_soc.h" + +/**@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. */ + +#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. */ + +#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_TYPES Types + * @{ */ + +/**@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_NVIC_ENABLEIRQ, + SD_NVIC_DISABLEIRQ, + SD_NVIC_GETPENDINGIRQ, + SD_NVIC_SETPENDINGIRQ, + SD_NVIC_CLEARPENDINGIRQ, + SD_NVIC_SETPRIORITY, + SD_NVIC_GETPRIORITY, + SD_NVIC_SYSTEMRESET, + SD_NVIC_CRITICAL_REGION_ENTER, + SD_NVIC_CRITICAL_REGION_EXIT, + SD_RAND_APPLICATION_POOL_CAPACITY, + SD_RAND_APPLICATION_BYTES_AVAILABLE, + SD_RAND_APPLICATION_GET_VECTOR, + SD_POWER_MODE_SET, + SD_POWER_SYSTEM_OFF, + SD_POWER_RESET_REASON_GET, + SD_POWER_RESET_REASON_CLR, + SD_POWER_POF_ENABLE, + SD_POWER_POF_THRESHOLD_SET, + SD_POWER_RAMON_SET, + SD_POWER_RAMON_CLR, + SD_POWER_RAMON_GET, + SD_POWER_GPREGRET_SET, + SD_POWER_GPREGRET_CLR, + SD_POWER_GPREGRET_GET, + SD_POWER_DCDC_MODE_SET, + SD_APP_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_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 Possible values of ::nrf_app_irq_priority_t. */ +enum NRF_APP_PRIORITIES +{ + NRF_APP_PRIORITY_HIGH = 1, + NRF_APP_PRIORITY_LOW = 3 +}; + +/**@brief Possible values of ::nrf_power_mode_t. */ +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 Possible values of ::nrf_power_failure_threshold_t */ +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 Possible values of ::nrf_power_dcdc_mode_t. */ +enum NRF_POWER_DCDC_MODES +{ + NRF_POWER_DCDC_DISABLE, /**< The DCDC is disabled. */ + NRF_POWER_DCDC_ENABLE /**< The DCDC is enabled. */ +}; + +/**@brief Possible values of ::nrf_radio_notification_distance_t. */ +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 Possible values of ::nrf_radio_notification_type_t. */ +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 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 signal callback handler return was invalid. */ + NRF_EVT_RADIO_SESSION_IDLE, /**< Event indicating that a radio session is idle. */ + NRF_EVT_RADIO_SESSION_CLOSED, /**< Event indicating that a radio session is closed. */ + NRF_EVT_NUMBER_OF_EVTS +}; + +/**@} */ + +/**@addtogroup NRF_SOC_TYPES Types + * @{ */ + +/**@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 The interrupt priorities available to the application while the softdevice is active. */ +typedef uint8_t nrf_app_irq_priority_t; + +/**@brief Represents a power mode, used in power mode functions */ +typedef uint8_t nrf_power_mode_t; + +/**@brief Represents a power failure threshold value. */ +typedef uint8_t nrf_power_failure_threshold_t; + +/**@brief Represents a DCDC mode value. */ +typedef uint32_t nrf_power_dcdc_mode_t; + +/**@brief Radio notification distances. */ +typedef uint8_t nrf_radio_notification_distance_t; + +/**@brief Radio notification types. */ +typedef uint8_t nrf_radio_notification_type_t; + +/**@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_DEFAULT, /**< Use the currently selected oscillator as HF clock source during the timeslot (i.e. the source is not specified). */ + NRF_RADIO_HFCLK_CFG_FORCE_XTAL, /**< Force external crystal to be used as HF clock source during whole the timeslot. */ +}; + +/**@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 timeslot as early as possible. This should always be used for the first request in a session. */ + NRF_RADIO_REQ_TYPE_NORMAL /**< Normal timeslot request. */ +}; + +/**@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 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 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 a request for a timeslot as early as possible. */ + nrf_radio_request_normal_t normal; /**< Parameters for a normal radio request. */ + } 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 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 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 data structure */ +typedef struct +{ + uint8_t key[SOC_ECB_KEY_LENGTH]; /**< Encryption key. */ + uint8_t cleartext[SOC_ECB_CLEARTEXT_LENGTH]; /**< Clear Text data. */ + uint8_t ciphertext[SOC_ECB_CIPHERTEXT_LENGTH]; /**< Cipher Text data. */ +} nrf_ecb_hal_data_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 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. + */ +SVCALL(SD_NVIC_ENABLEIRQ, 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. + */ +SVCALL(SD_NVIC_DISABLEIRQ, 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. + */ +SVCALL(SD_NVIC_GETPENDINGIRQ, 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. + */ +SVCALL(SD_NVIC_SETPENDINGIRQ, 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. + */ +SVCALL(SD_NVIC_CLEARPENDINGIRQ, 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. + */ +SVCALL(SD_NVIC_SETPRIORITY, uint32_t, sd_nvic_SetPriority(IRQn_Type IRQn, nrf_app_irq_priority_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. + */ +SVCALL(SD_NVIC_GETPRIORITY, uint32_t, sd_nvic_GetPriority(IRQn_Type IRQn, nrf_app_irq_priority_t * p_priority)); + +/**@brief System Reset. + * @note Corresponds to NVIC_SystemReset in CMSIS. + * + * @retval ::NRF_ERROR_SOC_NVIC_SHOULD_NOT_RETURN + */ +SVCALL(SD_NVIC_SYSTEMRESET, 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 + */ +SVCALL(SD_NVIC_CRITICAL_REGION_ENTER, 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 + */ +SVCALL(SD_NVIC_CRITICAL_REGION_EXIT, uint32_t, sd_nvic_critical_region_exit(uint8_t is_nested_critical_region)); + +/**@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, 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, 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_GET_VECTOR, 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. @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(nrf_power_mode_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. + * + * @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(nrf_power_failure_threshold_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. + * + * This function is to enable or disable the DCDC periperhal. + * + * @param[in] dcdc_mode The mode of the DCDC. + * + * @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(nrf_power_dcdc_mode_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. + * @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. + * 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(nrf_radio_notification_type_t type, nrf_radio_notification_distance_t distance)); + +/**@brief Encrypts a block according to the specified parameters. + * + * 128-bit AES encryption. + * + * @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 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. + * + * @note Pan #28 in PAN-028 v 1.6 "Negative measured values are not represented correctly" is corrected by this function. + * + * @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 32bit words. +* +* @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 more than 256 words. +* @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 registers PROTENSETx + * + * @note To read the values in PROTENSETx you can read them directly. They are only write-protected. + * + * @param[in] protenset0 Value to be written to PROTENSET0. + * @param[in] protenset1 Value to be written to PROTENSET1. + * + * @retval ::NRF_ERROR_FORBIDDEN Tried to protect the SoftDevice. + * @retval ::NRF_SUCCESS Values successfully written to PROTENSETx. + */ +SVCALL(SD_FLASH_PROTECT, uint32_t, sd_flash_protect(uint32_t protenset0, uint32_t protenset1)); + +/**@brief Opens a session for radio 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 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 )); + +/**@} */ + +#endif // NRF_SOC_H__ + +/**@} */ diff --git a/components/softdevice/s210/headers/nrf_svc.h b/components/softdevice/s210/headers/nrf_svc.h new file mode 100644 index 0000000..49f1425 --- /dev/null +++ b/components/softdevice/s210/headers/nrf_svc.h @@ -0,0 +1,71 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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__ + +#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__) +#define SVCALL(number, return_type, signature) \ + _Pragma("GCC diagnostic ignored \"-Wunused-function\"") \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \ + __attribute__((naked)) static return_type signature \ + { \ + __asm( \ + "svc %0\n" \ + "bx r14" : : "I" (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 +#endif // NRF_SVC__ diff --git a/components/softdevice/s210/headers/softdevice_assert.h b/components/softdevice/s210/headers/softdevice_assert.h new file mode 100644 index 0000000..89e1d11 --- /dev/null +++ b/components/softdevice/s210/headers/softdevice_assert.h @@ -0,0 +1,73 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** @brief Utilities for verifying program logic + */ + +#ifndef SOFTDEVICE_ASSERT_H_ +#define SOFTDEVICE_ASSERT_H_ + +#include + +/** @brief This function handles assertions. + * + * + * @note + * This function is called when an assertion has triggered. + * + * + * @param line_num The line number where the assertion is called + * @param file_name Pointer to the file name + */ +void assert_softdevice_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 Check intended for production code + * + * Check passes if "expr" evaluates to true. */ +#define ASSERT(expr) \ +if (expr) \ +{ \ +} \ +else \ +{ \ + assert_softdevice_callback((uint16_t)__LINE__, (uint8_t *)__FILE__); \ + /*lint -unreachable */ \ +} + +#endif /* SOFTDEVICE_ASSERT_H_ */ diff --git a/components/softdevice/s210/hex/s210_nrf51422_5.0.0_softdevice.hex b/components/softdevice/s210/hex/s210_nrf51422_5.0.0_softdevice.hex new file mode 100644 index 0000000..88c2a46 --- /dev/null +++ b/components/softdevice/s210/hex/s210_nrf51422_5.0.0_softdevice.hex @@ -0,0 +1,2952 @@ +:020000040000FA +:10000000C0070000D1060000D1000000B1060000CA +:1000100000000000000000000000000000000000E0 +:100020000000000000000000000000005107000078 +:100030000000000000000000DB000000E500000000 +:10004000EF000000F9000000030100000D010000B6 +:1000500017010000210100002B0100003501000004 +:100060003F01000049010000530100005D01000054 +:1000700067010000710100007B01000085010000A4 +:100080008F01000099010000A3010000AD010000F4 +:10009000B7010000C1010000CB010000D501000044 +:1000A000DF010000E9010000F3010000FD01000094 +:1000B00007020000110200001B02000025020000E0 +:1000C0001FB5C046C04600F0EFFA04B00FB41FBD24 +:1000D00008205A49096809580847382057490968CB +:1000E000095808473C2055490968095808474020E5 +:1000F0005249096809580847442050490968095875 +:10010000084748204D490968095808474C204B4981 +:10011000096809580847502048490968095808479C +:100120005420464909680958084758204349096836 +:10013000095808475C204149096809580847602068 +:100140003E4909680958084764203C49096809582C +:100150000847682039490968095808476C20374919 +:100160000968095808477020344909680958084740 +:100170007420324909680958084778202F490968CE +:10018000095808477C202D490968095808478020EC +:100190002A490968095808478420284909680958E4 +:1001A0000847882025490968095808478C202349B1 +:1001B00009680958084790202049096809580847E4 +:1001C00094201E4909680958084798201B49096866 +:1001D000095808479C201949096809580847A02070 +:1001E0001649096809580847A4201449096809589C +:1001F0000847A8201149096809580847AC200F4949 +:10020000096809580847B0200C4909680958084787 +:10021000B4200A49096809580847B82007490968FD +:1002200009580847BC2005490968095808470000D3 +:1002300003480449024A034B7047000000000020B5 +:10024000C0070000C00700000122D84B5A6000BF61 +:10025000D74A1268002AFBD0016000BFD44A126856 +:10026000002AFBD00022D14B5A6000BFD04A12684E +:10027000002AFBD07047F0B505460E46174600240D +:1002800006E0A200B158A2005019FFF7DDFF641C80 +:10029000BC42F6D30020F0BD0120C043C549086030 +:1002A000401048607047014601229204086890425D +:1002B00001D9102070470020FCE7F0B505460C4638 +:1002C0001646002706E028462168FFF7BDFF2D1DD2 +:1002D000241D7F1CB742F6D3F0BD70B505460C4611 +:1002E0002E460BE0304600F075F9FF2C01D80024B3 +:1002F00001E0FF3C013C012080023618002CF1D1C6 +:1003000070BD0146012292044868904201D909203B +:100310007047A9484069401C01D10F20F8E7002030 +:10032000F6E7FEB504462068030000F037FA05043E +:100330002B4249598B00201DFFF7E3FF0546002D96 +:1003400001D02846FEBDFFF7A7FF0120C00200F044 +:1003500041F9042221469948FFF78DFF002801D07A +:100360000320EFE708222146944800F06DF90028A9 +:1003700006D1002192480068FFF766FF00F00CF9F3 +:100380000320DFE7A768E6686068019031463846D9 +:10039000FFF7A3FF324638460199FFF78EFFB20000 +:1003A0003846019900F050F9002800D1CAE703202F +:1003B000C8E700F0E3F9834800688349086041E03A +:1003C00060680190E668A0680090B200009901980A +:1003D00000F03AF90746002F00D1B3E70E20B1E74D +:1003E000201DFFF760FF0546002D01D02846A9E734 +:1003F0006068002807D1FFF74FFF0320800200F05C +:10040000E9F800F0C9F8FFF747FF0120C00200F04B +:10041000E1F8042221466948FFF72DFF002801D0AA +:1004200003208FE708222146644800F00DF90028D8 +:1004300006D1002162480068FFF706FF00F0ACF823 +:1004400003207FE700BF00207CE770B505460C461F +:10045000182D04D12068FFF764FF206002E001201E +:10046000206000BF00BF70BDF0B589B05248406940 +:1004700003905248806881000398081802900398FE +:10048000000B01900121090302984018401E000B47 +:1004900000900124002520462946019A00F0C4F866 +:1004A0000022401E91410791069001260027304608 +:1004B0003946009A00F0B8F80022401E914105919B +:1004C0000490049BDB43059AD2430698184307998E +:1004D00011430791069037490698086007984860CD +:1004E00009B0F0BD70B53448446934488568466841 +:1004F000AA003146204600F0A7F8002801D00020CD +:1005000070BD0120FCE72D484068002801D0012083 +:1005100000E000200546FFF7E5FF002807D0FFF7C1 +:10052000BBFE0320800200F055F800F035F8FFF71D +:100530009BFF002D0ED020484669204884684768FC +:1005400021463046FFF7C9FE224639463046FFF7BE +:10055000B4FE00BF00F020F810B5184844681A48EF +:100560000460204600F0DCF810BD15480068006803 +:10057000401C01D100BFFEE710480068002802D0EF +:10058000042806D101E0FFF7BEFFFFF7E5FF00BF3B +:10059000FEE700BF00BFFEE7BFF34F8F0B480C49DB +:1005A000C860BFF34F8F00BFFEE7000000E50140C9 +:1005B00000E40140000600400010001000080000A8 +:1005C000B8070000BC070000000000200400FA0586 +:1005D00000ED00E010B50146104B1A6808460223F2 +:1005E0000F4C636000BF0F4B1B68002BFBD0531CEC +:1005F00004D0904202D20A4B186101E0084B986087 +:1006000000BF084B1B68002BFBD00023044C636029 +:1006100000BF044B1B68002BFBD010BD0010001066 +:1006200000E5014000E4014010B5202A04DB01464A +:10063000203A9140002010BD914020239C1A03468F +:10064000E3401943904010BD034610B50B439B0790 +:100650000FD1042A0DD308C810C9121FA342F8D025 +:1006600018BA21BA884201D9012010BD0020C04328 +:1006700010BD002A03D0D30703D0521C07E000208E +:1006800010BD03780C78401C491C1B1B07D1037854 +:100690000C78401C491C1B1B01D1921EF1D118463D +:1006A00010BD70477047704710B500F007F810BDD7 +:1006B000014B1B68DB6818470000002019481A49E5 +:1006C0007047FFF7FBFFFFF7FBFC00BD20BFFDE716 +:1006D0001649174C24688C420BD1164B1B68994263 +:1006E0000CD1154B154A1360186810498842EDD09B +:1006F0000AE0134880F30888124B18470F4A13602A +:1007000018680A498842E1D080F308880E49884277 +:1007100004DD0E48026802210A4302605B68184744 +:100720000346DFE7C0070000C0070000FFFFFFFF30 +:10073000000C000014100010001000000000002049 +:10074000000400206B05000000200020240500406C +:100750000D48704502D1EFF3098101E0EFF3088104 +:10076000886902380078182802D1C046074A104725 +:10077000074A12682C3212681047000000B5054B7A +:10078000054A9B58984700BDFDFFFFFF4B04000042 +:1007900000000020001000000400000030B4744687 +:1007A000641E2578641CAB4204D3635D5B00E318D0 +:1007B00030BC18471D46F8E7000C00000010000090 +:101000001808002079BD000025140000DFBC000096 +:1010100000000000000000000000000000000000D0 +:10102000000000000000000000000000E9BD00001A +:10103000000000000000000025140000251400003E +:1010400055BE00005BBE0000251400002514000002 +:1010500025140000251400002514000025140000AC +:1010600061BE0000251400002514000067BE0000CA +:10107000251400006DBE000073BE000079BE0000A4 +:10108000251400002514000025140000251400007C +:10109000251400002514000025140000251400006C +:1010A0007FBE000085BE000025140000251400004E +:1010B000251400002514000025140000251400004C +:1010C00000F002F80AF039FE0CA030C808382418E5 +:1010D0002D18A246671EAB4654465D46AC4201D170 +:1010E0000AF02BFE7E460F3E0FCCB6460126334259 +:1010F00000D0FB1AA246AB463343184758AE000057 +:1011000078AE0000103A02D378C878C1FAD85207F6 +:1011100001D330C830C101D504680C6070470000AD +:101120000023002400250026103A01D378C1FBD803 +:10113000520700D330C100D50B6070471FB5C046C1 +:10114000C04601F056FF04B00FB41FBD40BA70474F +:10115000C0BA7047F0B44046494652465B460FB4A9 +:1011600002A0013001B50648004700BF01BC864619 +:101170000FBC8046894692469B46F0BC70470000F3 +:10118000C110000040BA7047C0BA70478269024976 +:101190008161024810447047A11100000100000065 +:1011A00001B41EB400B501F0CAFB01B40198864633 +:1011B00001BC01B01EBD000040BA7047C0BA704704 +:1011C000401E00BF00BF00BF00BF00BF00BF00BF88 +:1011D00000BF00BF00BF00BF00BFF1D170470000DB +:1011E00070B505460C46164602E00FCC0FC5103E02 +:1011F000102EFAD2082E02D303CC03C5083E042ECB +:1012000007D301CC01C5361F03E021782970641C87 +:101210006D1C761EF9D270BD10B572B600F0DCF808 +:1012200000280BD000F0B0F901F08BFF01F034FE84 +:101230006E490020C86288626D49086062B600206D +:1012400010BDF3B5002501200007C06A81B0C0437E +:101250000006000E04D167480068401C00D101253B +:1012600072B600F0B9F8002802D062B60820FEBDC0 +:10127000FFF770FF00F08CF95F4B604E00211A6899 +:10128000CA40D2071FD00246CA40D20718D14AB27C +:10129000002A07DA1407240F083CA408A400A419A4 +:1012A000E46904E09408564FA400E4192468920706 +:1012B000D20ED440A204120E012A04D0032A02D076 +:1012C00062B65048FEBD491C2029D8D301980300BE +:1012D0000AF00BFE142123232323232323230B0DA6 +:1012E0000F11131F1517191B1D2E002416E00124C2 +:1012F00014E0022412E0032410E004240EE0082489 +:101300000CE009240AE00A2408E00B2406E00C247F +:1013100004E0052402E0072400E00624F06901212E +:101320000002000AC9070843F061002D04D009E05B +:1013300062B601200003FEBD2C4D3348E86200F088 +:1013400027F9A8622A4931480860314902980860A3 +:1013500000F01EF9214601F086FD01F0B6FE03F013 +:1013600079FD03F0E9FB019800F0B8F8040062B6DB +:1013700003D0FFF751FF2046FEBD0020FEBD10B593 +:10138000044600F029F8002800D001202070002039 +:1013900010BD204908600020704710B50C46102889 +:1013A00008D011280BD012280CD013280ED0012001 +:1013B000086010BD61682068FFF743FF0AE0FFF78F +:1013C0002BFF07E02068FFF7DAFF03E011492068F0 +:1013D00008600020206010BD05480C490068884264 +:1013E00001D1012070470020704700000005004037 +:1013F0000C0000200010001000E100E000ED00E013 +:1014000000E400E00110000000090000BEBAFECABE +:1014100008000020040000200E4A12680C498A428D +:101420000AD118470B4A1268094B9A4204D101B5F8 +:1014300001F07CFA03BC8E46074909680958084741 +:1014400006480749054A064B7047000000000000A7 +:10145000BEBAFECA0C0000200400002018080020BC +:101460001808002010B50146202209480AF0F2FAB7 +:1014700007490020C877084610BD06490120486189 +:101480000548064A0168914201D100210160704778 +:101490002C010020000500400C000020BEBAFECA4E +:1014A0008307FF22DB0E9A408907090E9940002826 +:1014B0000BDA0007000F083883083A489B001B1816 +:1014C000D86990430843D8617047830836489B0029 +:1014D0001B181868904308431860704710B5334ACA +:1014E0000446D06980B23C2815D03149088CC0B27E +:1014F000012812D1888C00070FD1088D0006000F3B +:1015000001280AD1888D0006000F06D1D06929492B +:10151000000C884201D1022010BD00210120FFF7FC +:10152000BFFF00211820FFF7BBFF00210B20FFF7B2 +:10153000B7FF02211920FFF7B3FF02210D20FFF7AB +:10154000AFFF02210E20FFF7ABFF02210F20FFF7B4 +:10155000A7FF0221C81FFFF7A3FF03211620FFF7F3 +:101560009FFF03211520FFF79BFF134A042310461A +:101570001946103801F0B9FA204600F025F800208D +:1015800010BD69210180704710B500F030F810BD22 +:101590000A48704710B500F037FD10BD704770471E +:1015A0007047704700ED00E000E400E040000010EC +:1015B000C00F00F0FFFF00005C01002003F90043B2 +:1015C00010B508F0F2FF10BD10B5FD4801780029F4 +:1015D0000CD101210170FB484173203804F0A6FBB7 +:1015E000F94804F0F3FB012006F07CF810BD10B5BB +:1015F000F3480178002907D000210170F1484173B8 +:1016000004F0C6FB04F0A8FC10BD10B5EC4800784F +:10161000002808D004F0BCFB04F09EFC002006F07B +:1016200061F8002010BD022010BDF8B516460C462A +:10163000054600F0CCFC002809D1204600F0C7FC8C +:10164000002804D1304600F0C2FC002801D0072059 +:10165000F8BD304606F0EBFD6946009048782070F2 +:1016600009782970002801D00020F8BD0520F8BDB8 +:1016700070B50446D5481D460078401E844201DD01 +:10168000D34870BD072A02D9D1480A3870BD204618 +:1016900006F0E4F9002805D12946204606F056FA5E +:1016A0000028F3D001218903084370BD10B5C74954 +:1016B0000978491E884201DDC54810BD06F070FA60 +:1016C0000028FAD001218903084310BD10B5BF4995 +:1016D0000978491E884201DDBD4810BD05F0D2FCE5 +:1016E0000028FAD001218903084310BD10B5B7497D +:1016F0000978491E884201DDB54810BD06F062FA3E +:101700000028FAD001218903084310BD10B506F066 +:1017100098FA002802D001218903084310BD70B552 +:101720000446AA480E4600781546401E844201DD54 +:10173000A74870BD104600F04AFC002801D00720E1 +:1017400070BD2B4632460021204604F07EFF502813 +:1017500003D001218903084370BD002070BD70B51E +:1017600004469A480E4600781546401E844201DD24 +:10177000974870BD104600F02AFC002801D00720D1 +:1017800070BD2B463246A021204604F05EFF502853 +:1017900003D001218903084370BD002070BDF8B556 +:1017A00004468A481E4600780F46401E154684426D +:1017B00001DD8748F8BD104600F009FC002801D083 +:1017C0000720F8BD33462A463946204605F04DFD30 +:1017D000502803D0012189030843F8BD0020F8BD3B +:1017E00010B5044600F0F3FB002801D0072010BD1F +:1017F000204605F0A3FD0028F9D001218903084304 +:1018000010BD10B505F0A6FD002802D00121890306 +:10181000084310BD70B505466C480C460078401E64 +:10182000854201DD6A4870BD084600F0D0FB002803 +:1018300001D0072070BD284606F035FA2070002040 +:1018400070BD10B506F00DFB002010BD70B504464C +:101850000D46072802D95E480A3870BD084600F0D8 +:10186000B6FB002801D0072070BD2946204605F0B0 +:1018700038FB002070BD10B5544A1278521E9042B9 +:1018800001DD534810BD05F022F9002010BD70B5F0 +:1018900005464E480C460078401E854201DD4C4806 +:1018A00070BD084600F093FB002801D0072070BDF2 +:1018B000284605F01BF92070002070BD10B5434B81 +:1018C0001B785B1E984201DD414810BD05F0E5F82C +:1018D000002010BD10B53D4B1B785B1E984201DD0A +:1018E0003B4810BD05F01BF9002010BD10B5374A6C +:1018F0001278521E904201DD354810BD06F04AF8BC +:10190000002010BD70B5054630480C460078401EDA +:10191000854201DD2E4870BD084600F058FB0028C6 +:1019200001D0072070BD284606F04FF82080002027 +:1019300070BD38B5254C2478641EA04201DD2448D2 +:1019400038BD6C462170090A6170A270E370694667 +:1019500006F014F80028F3D001218903084338BDAC +:10196000F8B5074619481C4600781546401E0E4635 +:10197000874201DD1648F8BD084600F028FB002824 +:1019800009D1284600F023FB002804D1204600F0AE +:101990001EFB002801D00720F8BD6946384605F037 +:1019A000CBFF6846017840780002084330806846E3 +:1019B000807828706846C07820700020F8BD00004C +:1019C00010000020BC010020C1150000780000209C +:1019D0003340000010B5FC4A1278521E904201DDDF +:1019E000FA4810BD06F001F8002010BD10B5F64A07 +:1019F0001278521E904201DDF44810BD05F0F0FF50 +:101A0000002010BD10B5F04A1278521E904201DD40 +:101A1000EE4810BD05F0EEFF002010BD10B5EA4AFB +:101A20001278521E904201DDE84810BD05F0E9FF32 +:101A3000002010BD70B50546E3480C460078401EF6 +:101A4000854201DDE14870BD084600F0C0FA00287B +:101A500001D0072070BD284605F0D9FF2070002076 +:101A600070BD10B5D84A1278521E904201DDD74899 +:101A700010BD05F0AFFF002010BD70B50C46054647 +:101A800000F0A5FA002801D0072070BD21462846A5 +:101A900006F0EEF90028F8D001218903084370BD53 +:101AA00070B505460C46084600F091FA002801D0B2 +:101AB000072070BD2146284606F011FA0028F8D00C +:101AC00001218903084370BD10B505F00AFF002805 +:101AD00002D001218903084310BD10B505F00AFFAB +:101AE000002010BD10B5044600F071FA002801D0A6 +:101AF000072010BD05F003FF2070002010BD7CB54D +:101B00000546B148164600780C46401E854201DD68 +:101B1000AE487CBD084600F05AFA002801D00720E4 +:101B20007CBD21786846017061784170A178817030 +:101B3000E178C17006716946284605F031FC00283D +:101B4000EED00121890308437CBD08B59E4B1B786C +:101B50005B1E984201DD9D4808BD6B4619705A70A6 +:101B6000694605F001FC0028F6D0012189030843ED +:101B700008BD10B5944C2478641EA04201DD934842 +:101B800010BD05F035FC002010BD10B505F026FC99 +:101B9000002010BD38B5044600F019FA002801D025 +:101BA000072038BD684605F01CFC6946087849786E +:101BB000090201432180002038BD70B505460C465E +:101BC000084600F004FA002801D0072070BD214625 +:101BD000284606F084FC0028F8D001218903084338 +:101BE00070BD70B505460C46084600F0F0F90028B7 +:101BF00001D0072070BD2146284606F07CFC002855 +:101C0000F8D001218903084370BD10B56E4A1278DF +:101C1000521E904201DD6D4810BD06F07AFC00288E +:101C2000FAD001218903084310BD10B5664C247811 +:101C3000641EA04201DD654810BD06F079FC002855 +:101C4000FAD001218903084310BD70B505460C4642 +:101C5000084600F0BCF9002801D0072070BD2146DD +:101C6000284606F04DFD0028F8D0012189030843DD +:101C700070BD70B505460C46084600F0A8F900286E +:101C800001D0072070BD2146284606F057FD0028E8 +:101C9000F8D001218903084370BD70B505460C4694 +:101CA000084600F094F9002801D0072070BD2146B5 +:101CB000284606F056FD002070BD10B506F067FD01 +:101CC000002802D001218903084310BD70B50C46DD +:101CD000054600F07CF9002804D1204600F077F991 +:101CE000002801D0072070BD2146284606F096FD49 +:101CF000002070BD70B506463348144600780D4686 +:101D0000401E864201DD314870BD002D04D00846DA +:101D100000F05DF9002806D1002C06D0204600F026 +:101D200056F9002801D0072070BD002D03D02946A8 +:101D3000304605F0A5FB002C03D02146304605F0C7 +:101D4000E3FB002070BD70B506461F4814460078BE +:101D50000D46401E864201DD1C4870BD002D04D09A +:101D6000084600F034F9002806D1002C06D02046A1 +:101D700000F02DF9002801D0072070BD002D03D000 +:101D80002946304605F0A1FB002C03D02146304601 +:101D900005F0CFFB002070BD10B504460C4800785C +:101DA000002817D003F0F4FF04F0D6F8204605F021 +:101DB00029FD002810D0044920780870002005F083 +:101DC00091FC002010BD000078000020334000008E +:101DD000100000200220F5E70720F3E710B50446C5 +:101DE00000F0F5F8002801D00720EBE705F08AFDA8 +:101DF00020700020E6E710B5044600F0E8F800285F +:101E000001D00720DEE705F082FD20700020D9E731 +:101E100070B5054676480C460078401E854201DDC7 +:101E2000744870BD084600F0D2F8002801D00720A1 +:101E300070BD284605F071FD2070002070BD70B5A2 +:101E400005466B480C460078401E854201DD694816 +:101E500070BD084600F0BBF8002801D0072070BD17 +:101E6000284605F060FD2070002070BD10B504F01C +:101E7000F9FD0020A6E710B504F0FAFD0020A1E767 +:101E800010B5044600F0A3F8002801D0072099E718 +:101E900059480021425C6254491CC9B20B29F9D34C +:101EA00000208FE710B5044600F091F8002801D01B +:101EB000072087E74E48B221007820700820607024 +:101EC0000020A070E170362121716071F520A071B1 +:101ED0000120E071002075E7FFB5062581B01E46A0 +:101EE00017460C46002904D0084600F070F8002878 +:101EF0000DD1002F04D0384600F069F8002806D133 +:101F0000002E07D0304600F062F8002802D00720EB +:101F100005B0F0BD0198002804D0012806D00228A1 +:101F200008D109E0207804F04BF802E004F04CF806 +:101F3000207000252846EBE7207806F076FCF8E7CD +:101F4000FFB5062581B01E4617460C46002904D071 +:101F5000084600F03CF800280DD1002F04D0384688 +:101F600000F035F8002806D1002E06D0304600F0EB +:101F70002EF8002801D00720CAE70198002804D0D5 +:101F8000012811D002280DD119E0002528461B4E4A +:101F9000256004E0297801F011F86D1C2060B5423D +:101FA000F8D300252846B3E7154822788105002A92 +:101FB000826A02D00A438262F3E78A43FBE7207811 +:101FC00006F03EFCEDE710B509F0D9FCFAE6002872 +:101FD00009D00A49884206D301214907884204D31F +:101FE0000849884201D20120704700207047000054 +:101FF000780000203340000004BF000000D0000043 +:10200000000500400009002010B5C0380C46030050 +:1020100009F06BFF4021242933373B3F434A515A93 +:102020005F62676D727A82888D979DA3A9AFB5BAFA +:10203000C0C6CBEFF3F7FEEAE9E8E7E6E5E4E3E262 +:10204000E1E0DFDEDDDCDBDAD9D8D7D6D5D4D3D2F8 +:10205000D1D1D0D1CFD1FFF7D8FA71E1204607C84E +:10206000FFF7E3FA6CE1207BC3B2207AC2B2207999 +:10207000C1B22078FFF7FCFA62E12078FFF716FB87 +:102080005EE12078FFF722FB5AE12078FFF72EFB74 +:1020900056E12078FFF73AFB52E12079A268C1B2FD +:1020A0002078FFF73CFB4BE12079A268C1B2207891 +:1020B000FFF755FB44E1207BA268C3B2A08881B240 +:1020C0002078FFF76CFB3BE120786168FFF7A2FB0B +:1020D00036E1FFF7B6FB33E120786168FFF7B6FB26 +:1020E0002EE12079C1B22078FFF7C5FB28E12078E6 +:1020F0006168FFF7CCFB23E1207AC2B22079C1B23C +:102100002078FFF7DBFB1BE1207AC2B22079C1B255 +:102110002078FFF7DFFB13E1A08881B22078FFF77A +:10212000E5FB0DE120786168FFF7ECFB08E1207B1F +:10213000C3B2207AC2B2A08881B22078FFF7F9FB3F +:10214000FEE0211D0EC92078FFF70AFCF8E0A08808 +:1021500081B22078FFF73EFCF2E02079C1B220780E +:10216000FFF744FCECE02079C1B22078FFF74AFC8D +:10217000E6E02079C1B22078FFF750FCE0E020785B +:102180006168FFF757FCDBE02079C1B22078FFF7E8 +:1021900068FCD5E02079C1B22068FFF76EFCCFE083 +:1021A00020786168FFF77CFCCAE02078FFF78CFCA0 +:1021B000C6E0C0E0B9E0C4E0B3E0ACE0A5E09FE079 +:1021C00098E092E08CE086E07BE074E06EE068E00E +:1021D00064E05FE05AE055E04AE046E040E03AE083 +:1021E00035E030E02BE025E01AE011E009E004E002 +:1021F000FFE72078FFF771FCA2E02068FFF772FC90 +:102200009EE0207A6168C2B22078FFF778FC97E000 +:10221000207AC2B22079C1B22078FFF796FC8FE015 +:10222000207BC3B2207AC2B22079C1B22078FFF7F6 +:10223000A0FC85E0208880B2FFF7A7FC80E0206842 +:10224000FFF7A8FC7CE02068FFF7C8FD78E0206875 +:10225000FFF7D1FD74E020786168FFF7D9FD6FE0EA +:1022600020786168FFF7EBFD6AE0FFF7FFFD67E0AC +:10227000207BC3B2207AC2B22079C1B22078FFF7A6 +:10228000FAFD5DE02068FFF7FBFD59E02068FFF7ED +:1022900009FE55E02068FFF7A3FA51E0FFF7B1FA15 +:1022A0004EE020786168FFF788FC49E0207861689B +:1022B000FFF797FC44E02079C1B22078FFF7A5FC36 +:1022C0003EE0207BC3B2207AC2B22079C1B220782E +:1022D000FFF7ABFC34E020786168FFF7B6FC2FE035 +:1022E00020786168FFF7C5FC2AE020786168FFF775 +:1022F000D4FC25E0A08881B22078FFF7DEFC1FE047 +:1023000061682068FFF7E2FC1AE02078A268616843 +:10231000FFF7F0FC14E02078A2686168FFF713FD76 +:102320000EE02068FFF738FD0AE0211D0EC9207875 +:10233000FFF7D2FD04E0211D0EC92078FFF700FE53 +:10234000206010BD30B40121BD48C9020160CD102C +:1023500005604A030260BB4803681B021B0A036056 +:1023600004680023240A24020460B7480468240A8D +:1023700024020460B548012444608460B44C2360A6 +:102380006360A360B34B19601D601A60B24B1960A3 +:102390001A600121016030BC704710B40121A848C7 +:1023A000CA0202600B0203600C060460A748416089 +:1023B0008160AA4841680029FCD1A5490020086035 +:1023C00048608860A34802600360046010BC7047E6 +:1023D0000121A048C9020160C910016070470028AE +:1023E00005D0012805D0022805D19D4870479D4899 +:1023F00070479D48704710B59CA18C2009F069FC7E +:10240000002010BD70B500219F4CA04DA04A904BFC +:10241000002808D001281DD0022822D093A1B42082 +:1024200009F057FC70BD01200004A060A860116095 +:102430001960984BC2039A60974A9060804A0012D4 +:102440001060964801608748016095480160954892 +:10245000017070BD01204004A060A8605160596007 +:1024600070BD01208004A060A8609160996070BD7B +:10247000F8B59446844A764F844D002401260028FE +:1024800008D0012832D0022840D078A1E92009F0F4 +:1024900020FCF8BD891E0902090A01200004906091 +:1024A0003C6068607A4A1160012B1DD000217D4A92 +:1024B0007D4B517061463D31DC63DE637B4B5C607C +:1024C00002249C6004241C61744B196074490E60E2 +:1024D000604B89151960704B58605F4801606D4909 +:1024E000C00548601670F8BD0121E0E701205E4E8E +:1024F00040046F4F012B04D1346050606860396034 +:10250000F8BD9060346068603960F8BD0120544EB9 +:102510008004684F012BF4D1EEE7504840687047C3 +:1025200070B54B4D28680026574C012806D1A0688D +:10253000C00303D501200004A0602E606868012854 +:1025400009D1A068800306D501204004A0606E6018 +:10255000012001F033FDA868012809D1A0684003DB +:1025600006D501208004A060AE60022001F026FDA7 +:1025700070BD10B54B490878002818D00120454A95 +:10258000C0079060444AC00B90602D4A0012106052 +:10259000424A00201060334A1060414A10600870BF +:1025A0004A78002A02D0487001F008FD10BD0320CF +:1025B000FAE70120404900060860704701202549DC +:1025C00000060860704701203B49400508607047DD +:1025D0000120204940050860704733490020C86346 +:1025E00088151C4908607047410A344AC005C00D6F +:1025F00050435143801C08225040400A081870473D +:1026000010B42F4C430B63431B0C5C020C602B4C2F +:102610006343C31A2B485C025843284B400D434385 +:10262000E31A9B1C082463405B1213700A6810189D +:10263000086010BC704710B501F097FD10BD000098 +:1026400080E100E008E400E018E400E000B00040B1 +:1026500040B1004080E200E000E100E000B5004051 +:1026600048B100404081004044B100407372635C57 +:1026700072656D5F68616C5F6576656E745F7469C5 +:102680006D65722E6300000000B3004040B300404F +:1026900040B5004000F50140008300404085004007 +:1026A000008200401C000020C08F004000850040D8 +:1026B00044B5004048B5004000E200E0093D00009C +:1026C000378600006F0C010010B501F03AFD10BD17 +:1026D00000200449C863012001218140024A1160A1 +:1026E00000BF7047C01F004080E200E070B5203896 +:1026F0000C46030009F0F9FB33BCC0C4C8CED2D6E7 +:10270000DBEFFCED1B1F23272C31373C41484E519A +:1027100055595D616F73676B767A7E82868A8E9279 +:10272000969AB2B5B8E0F0EBEAE9F4F8E600206872 +:1027300008F008FEF4E0206808F00CFEF0E02068E5 +:1027400008F020FEECE0207840B208F03EFEE7E022 +:10275000207840B208F05FFEE2E02078616840B285 +:1027600008F075FEDCE0207840B208F085FED7E086 +:10277000207840B208F090FED2E02079C1B22078F3 +:1027800040B208F09AFECBE02078616840B208F0D1 +:10279000CAFEC5E008F0D6FEC2E0206808F0DAFE06 +:1027A000BEE0207808F0EFFEBAE0206808F0D2FC26 +:1027B000B6E0206808F0D2FCB2E02079C1B220680F +:1027C00008F0D3FCACE0206808F07EFBA8E02068AD +:1027D00008F07FFBA4E0207808F07FFBA0E008F081 +:1027E00089FB9DE0207808F08BFB99E0207808F0C9 +:1027F0009DFB95E0206808F0B6FB91E0206808F0AA +:10280000B8FB8DE0206808F0BAFB89E0206808F08A +:10281000BBFB85E0206808F0BDFB81E0206808F084 +:10282000BFFB7DE0206808F0C0FB79E003F0CCFB43 +:10283000C0070025002805D003F0CAFB002801D0FE +:10284000256070BD03F0C0FB800703D503F0C7FB14 +:102850000028F5D12046FEF799FC61E002F099FDD1 +:102860005EE002F0C6FD5BE0206802F0CEFD57E0BE +:10287000206808F01DFF53E0206808F025FF4FE0B6 +:10288000206808F02CFF4BE02078A268616808F00F +:1028900031FF45E0207808F042FF41E0207808F061 +:1028A00053FF3DE02078616808F063FF38E020784E +:1028B000616808F075FF33E02079C1B2207808F034 +:1028C000BDFF2DE02EE00FE00AE026E022E01DE053 +:1028D00002E016E00CE010E0206808F09AFE1FE02D +:1028E000206809F025F81BE0206809F00AF817E0D5 +:1028F000204607C802F0EAF912E0206802F041FA27 +:102900000EE06168206802F06CFA09E0206802F0CD +:102910005EFC05E002F073FC02E0206802F0AAFC15 +:10292000206070BD0120086070BD00000C4908786F +:102930004A78401CC0B2904200D008707047094AE3 +:10294000074820BF40BF20BF417803784370136819 +:10295000002B02D103788B42F3D000207047000097 +:102960001E00002000E200E0FEB5F34C0746606860 +:10297000FF213E0181552178FF2913D0090108313B +:1029800041583246491E083209020192090A80580C +:1029900000F0C8F9002802D02478254615E06168C7 +:1029A000207888552770FEBDE34842680198115889 +:1029B000280100900830105800F0B4F9002806D122 +:1029C000DD482C46416800980D5CFF2DECD1DA48BB +:1029D0002101406885554754FEBD70B5D64A04466E +:1029E0000020157A53680AE00201561C9E5DA6423B +:1029F00003D10C329A588A4204D0401CC0B285429E +:102A0000F2D8FF2070BDF8B5CB4F3E7801F0B8FE8C +:102A10000146FF2E68D034012546786808354059B4 +:102A200000F080F9022802D9786840595AE0C2497A +:102A30004868025D0A70A11C425C002A0CD0521E3C +:102A4000425441590122D20589180902090A41510B +:102A50003046FFF789FF30E0631CC25C0092221D04 +:102A600094468258002A10D001239B029A420FD923 +:102A70009205920D43595703DB191B021B0A435160 +:102A80006346C3589A1A920A09E0FF21C1540AE02A +:102A9000435952039A181202120A42510022425418 +:102AA0003046FFF761FFA4480C344168C2680098C3 +:102AB000095980001258009890479F4C2078FF28B1 +:102AC00012D001F05DFE01462078626800010830F6 +:102AD000105800F027F9012896D920786168000184 +:102AE0000830085801F03FFEF8BDF8B51C46154601 +:102AF0000E460746FF2B03D390A1D32009F0E9F837 +:102B00008D48FF21C7604560047206740170002281 +:102B10004270104604E00201521C401CA954C0B28D +:102B2000A042F8D3F8BD70B5834C06466578207C8A +:102B3000854203D381A1E62009F0CBF8E068A90023 +:102B400046506078401C6070284670BDFFB581B06B +:102B50001D46FF2401F014FE774F06467978019850 +:102B6000814203D875A1F42009F0B3F8724800211E +:102B7000037A406810E00A019446521C825CFF2AE6 +:102B800024D0019FBA4205D162460C328758029A7E +:102B900097421DD0491CC9B28B42ECD8FF2C17D0EC +:102BA00021014B1C019AC2540B33029AC250039B61 +:102BB000614F0022012B0ED00B1DC25001239B023E +:102BC0009D4216D9AA05920D08D008E00C46E1E70F +:102BD000FF2005B0F0BD0B1DC550EFE71A465303AB +:102BE0009B190E461B0208361B0AAA1A8351920A29 +:102BF00009E0002D00D101256B039B191D022D0A50 +:102C00000B460833C550891C42543D463E78204649 +:102C1000FFF7AAFE2878B04215D001F0B1FD0146B9 +:102C200028786A6800010830105800F07BF8012805 +:102C300007D92878696800010830085801F093FD29 +:102C400001E0FFF7E0FE0198C3E770B50C460546CA +:102C500001F096FD064621462846FFF7BEFEFF28F6 +:102C600017D0354D040120466968083008583146B0 +:102C700000F058F80121090340186968A41C095D97 +:102C8000400B002901D089020818002800D101203A +:102C900070BD002070BDF3B581B007460299FFF703 +:102CA0009CFEFF282AD0244D2E786968324634468F +:102CB00004E0844205D026462301CC5CFF2CF8D1E9 +:102CC0001CE0FF2C1AD0A6421FD11001085C28700E +:102CD000FF2818D001F054FD2A78014612016868D7 +:102CE0000832805800F01EF8012809D92878696850 +:102CF00000010830085801F036FD06E00020FEBD56 +:102D0000FFF781FE01E001F036FD38460299FFF73A +:102D10009CFF22016968FF23541C0B558A5C330118 +:102D2000CA54FEBD401A00020121000AC9058842AA +:102D300000D9002070470000680300207372635CB4 +:102D4000736F635F74696D65722E6300F8B5044636 +:102D5000800700250126002804DA5848C563C663A9 +:102D600002208443E00404D55548C563C66380143B +:102D70008443600003D55348456080058443E005E3 +:102D800004D55148C563C66380158443A00404D5A7 +:102D90004E48C563C6634014844360042104C00FD9 +:102DA000C90F884203D04AA1612008F092FF200495 +:102DB000800F0AD04B49CD634B48C563C563CE63D2 +:102DC000C663C66303208003844320050AD5474FAA +:102DD000FD632F20FEF7F4F9FE632F20FEF7F0F9D4 +:102DE000F814844308F0F7FC4148044203D038A1AA +:102DF0008D2008F06EFFF8BDF0B500210A46FF23D4 +:102E00000446CC40E4072AD04CB2E606F60E012573 +:102E1000B540384E3560384E3560002C11DA250744 +:102E20002D0F083DAE08354DB6007719FD69A40792 +:102E3000E60E1C46B440A5431446B4402543FD614C +:102E40000DE0A6082E4DB60076193568A407E70EEA +:102E50001C46BC40A5431446BC4025433560491C74 +:102E60002029CDD3F0BD70B5264C0D462060FFF76C +:102E70006DFF2068FFF7C0FF284602F05BFB08F0FB +:102E8000B3FB08F0FAF808F0A6FC08F09AF801F095 +:102E9000BFFD01F051FE70BD10B51A4C2068FFF760 +:102EA00055FF2068FFF7A8FF08F095FC02F0BCFB77 +:102EB0000020206010BD134800687047C01F00400C +:102EC000C0CF004000E50140C08F0040C0DF00409F +:102ED0007372635C736F635F636F6E6669672E63A3 +:102EE00000000000C0EF0040C0FF0040C0BF004035 +:102EF000FEFF0FFC80E100E080E200E000ED00E07A +:102F000000E400E02000002008B5027869460A705D +:102F100040784870088808BD08B5027869460A708C +:102F200042784A7082788A70C078C870009808BD6C +:102F300003E00B78491C0370401C1346521ED2B2AA +:102F4000002BF6D1704701E00170401C1346521E61 +:102F5000D2B2002BF8D1704710B507E003780C7897 +:102F6000401C491CA34201D0012010BD1346521E33 +:102F7000D2B2002BF2D1002010BD02090007000ED2 +:102F80000243CC20104081083320024090000143CE +:102F9000AA200840552240081140490008437047C4 +:102FA0000204120E000202434A401006000F504075 +:102FB000010341400806C00C48407047C0434840E8 +:102FC000064A0021C30702D04008504000E04008F4 +:102FD000491CC9B20829F5D3C04370472083B8ED16 +:102FE0007047704770477047704770477047704729 +:102FF000704710B508F09EFE10BD000000000000F4 +:1030000010FFFFFFDBE5B15100D000006900FFFFBA +:10301000F8B5F74C207BE17A88421CD00126F54DAB +:103020000027E07A215C14200A4642435019037CB1 +:10303000052B11D0037C062B1CD0037C072B28D03A +:10304000437C012B33D0ECA1EE4808F042FE207BFC +:10305000E17A8842E5D1F8BD0674E07A0A2807D003 +:10306000E07A401CE072491CC8B2AA5802210CE068 +:103070000020F7E70674E07A0A2808D0E07A401CBE +:10308000E072491CC8B2AA5803219047DFE700202C +:10309000F6E70674E07A0A2807D0E07A401CE0726E +:1030A000491CC8B2AA580821EFE70020F7E7477487 +:1030B000E07A0A2807D0E07A401CE072491CC8B2C6 +:1030C000AA580721E1E70020F7E770B50024CE4EAB +:1030D00006207072CD482546447704773830047353 +:1030E000C472CB4808F02EF9CA480575F572CA4972 +:1030F000601E88607571B570F57035717570C74860 +:103100006439057045701420604340180574641CD0 +:10311000E4B2052CF7D30120FFF774F90020FFF784 +:1031200071F90120B07101F073FCBD4801F082FC1F +:10313000BC4C2070BC4801F07DFC6070FFF702F9C8 +:1031400070BD10B5FFF729F9B64C207801F090FC5E +:10315000607801F08DFCAC4C207A002803D002F09E +:103160002EF90020207210BD70B5A74CA079002860 +:1031700004D0A1A1AD4808F0ACFD70BDE07A0028F4 +:1031800003D19DA1AA4808F0A4FD0126A67100253F +:10319000E572607A042114225043964A8018017423 +:1031A0009D488168491C04D0691E81600120FFF799 +:1031B00029F90020FFF726F9FFF70AF908F02BFBA1 +:1031C000FFF70BFA9B480560056001209A49C00390 +:1031D0000860FFF77DFA91480078022804D00328A0 +:1031E00004D1E078002801D0A67000E0A570FFF7B8 +:1031F000E0F970BD03467F4905201422424352186E +:10320000203A127F002A04D0401E0006000EF4D19E +:1032100070471422424351180A46403AD3620122B1 +:1032200020390A777047012805D0032805D10029E5 +:1032300003D1002070470029FBD010B4724C00234A +:103240006370764A002890700CD002280AD00729B3 +:103250001AD20B007B441B79DB189F441505070D20 +:103260000F111300D37003E01B2000E03A20D07050 +:103270000120607010BC70475820F8E77720F6E70F +:103280009620F4E7B520F2E710BC0020704710B597 +:1032900062484078FFF7A8F980B210BD411E1422A1 +:1032A000504310B5534A8418203C042902D8207F8B +:1032B000002803D150A1614808F00BFD207F0128B0 +:1032C00004D0B3204CA1800008F003FD002020773B +:1032D00010BD70B54D4C607F217F884201D1012522 +:1032E00000E00025FFF719F9FFF77EF9617F227FE3 +:1032F000914201D1012100E00021A942EBD170BD32 +:10330000F7B50646481E84468EB0C0B2142202901D +:103310005043384A851828460695007C2D1D0728FD +:103320002AD1334F0022F87A3B7B834221D03C5C88 +:10333000029B9C4201D1012201E0002A04D00A280C +:1033400011D0431CFB5C3B540A280ED0401C3B7B35 +:10335000C0B28342EBD1002A0BD0387B002806D0C4 +:10336000387B401E04E00023ECE70020EFE70A2052 +:103370003873069A012010746046234C042813D831 +:10338000142041431B4808182038007F00280BD028 +:103390000698007C01280BD00698007C012803D0F9 +:1033A0001098807A012807D013A1254808F091FCD5 +:1033B0001098807A01286CD106980E4A007C022869 +:1033C00042D00B4C207B0A286FD0207BE17A401C36 +:1033D000884203D108A11B4808F07BFC0699012014 +:1033E0004874217B02986054207B0A2861D062E0F7 +:1033F000C4020020D40200207372635C72656D2EDB +:1034000063000000CF050000580300208C0200205C +:1034100064030020AC0200203803002013000020C9 +:10342000072A000011000020113000007D0200007A +:103430005E02000000F5004080E200E0CB020000E8 +:103440001503000022030000607A029B01469842A7 +:1034500006D00146142778438018807C9842F8D122 +:10346000637A834208D1617A142359438918897C8D +:1034700061720121A17207E0142343439B181427B2 +:1034800079439B7C89188B74142306215843801838 +:1034900081741098007A06281DD203007B441B79A2 +:1034A000DB189F440C161412100EE07A002891D0FD +:1034B00094E7002001E0207B401C2073B9E000204D +:1034C0000FE0B4200DE073200BE0322009E00A2069 +:1034D00007E0072005E0FF20FD49E03008F0F9FB98 +:1034E00000200190109801680198081A286010992E +:1034F000097A002912D00221401A0102090A296022 +:1035000010980268406810180002000A686010985D +:10351000807A0228109803D0007B74E00421EBE746 +:10352000007A002813D002220198101884461098BF +:103530004268604608301718E648019A4078904281 +:1035400002D9E278002A04D03846083005E0042287 +:10355000EAE7019A801AC0190830627A062A1CD05C +:10356000627A14235A43DC4BD2185268914214D029 +:10357000DA4B0793617A14225143D74A89184A6873 +:103580008968921B891B12020902120A090A9042D9 +:103590003AD89A4238D8994236D83018C01B00021F +:1035A000000A286010996044CD4AC9680002000AE8 +:1035B0009446421A01239B0507929A4201D2104673 +:1035C00014E00A1A08929A4201D207980EE0079A6C +:1035D0006346624503D9591A0818401C06E0089A48 +:1035E000624506D9181A4018401C4042002860DC89 +:1035F00003E0B749BB4808F06CFB2868C01900021B +:10360000000A6860002028726868082708300002F5 +:10361000000A68601098407AA8721098007A687260 +:1036200003280ED200280CD008F0F0F9002803D0AF +:1036300007E0002011B0F0BD01983A210F1A3220A6 +:103640000190A4480178012901D0032909D14078CB +:103650000199884205D9E178002902D10199401ADF +:10366000C71928689D4A801B844601026868090AB8 +:10367000801B03021B0A03938F421AD81346914200 +:1036800017D80399994214D8617A062915D0677A18 +:10369000614606220392019214228F4B7A43D2187C +:1036A00093689B1B8B4216D80397977C062FF3D108 +:1036B00073E0029801F05AF9BBE7069902220298DA +:1036C0000A74627A062A00D0627A8A7460720120D3 +:1036D000A07211B0F0BD062F5FD00022394694468B +:1036E00014227D4B4A43D21853689B1B834225D238 +:1036F000917BAB7A99421BD806980521029D0174F3 +:10370000794C207B0A280FD0207BE17A401C88422C +:1037100003D16F49754808F0DCFA207B2554207BE3 +:103720000A2800D0C7E6C4E6E07A0028F1D0F4E722 +:1037300001218C46917C0629D2D102E06046002806 +:103740002AD03D46019114202A4642436248062170 +:10375000161831741038007B0A28634816D0017B94 +:10376000C07A491C814203D161A1644808F0B1FAD2 +:103770005D48017B4554017B0A290BD0017B491C24 +:103780000173B57C0198A842DDD106E0C07A00281B +:10379000EAD0EDE70021F3E70197069902204E4DAC +:1037A0000874607AB84207D1069901988874029823 +:1037B00060720120A07221E00398062F0FD0062826 +:1037C00003D14BA14E4808F084FA039814225043C9 +:1037D0004019029981740699019888740EE00628B0 +:1037E00003D143A1474808F074FA039814225043C8 +:1037F000401902998174069906208874012011B03D +:10380000F0BD70B50D46404A441900210B46101A10 +:103810008B4103D236A13D4808F05BFA3C48854213 +:1038200003DD33A13B4808F054FA3B48854203DAF4 +:103830002FA13A4808F04DFA3948844205DA002CA5 +:1038400001DB204670BD364800E03648201870BDC8 +:10385000401E70B5C0B2142148431F494418607B14 +:10386000062813D203007B441B79DB189F44020C0B +:103870000A080604002069E0B42010E073200EE07E +:1038800032200CE00A200AE0072008E0FF2018A1FF +:10389000E03008F01EFA617B0020002956D002219A +:1038A0004018616840180002000AFEF79DFE0C25D2 +:1038B0006557154A441900210B46101A8B4103D253 +:1038C0000BA1124808F005FA1148854230DD2BE0C3 +:1038D000F833000013000020D4020020FFFF3F0057 +:1038E000FFFFFF000E070000C402002007020000D7 +:1038F0007372635C72656D2E63000000C503000087 +:10390000DD030000E3030000FF7F841EF5030000D9 +:103910000020A107F603000000E05EF8F7030000B6 +:103920000080841E00807BE1FA49FB4808F0D1F951 +:10393000FA48854203DAF749F94808F0CAF9F94824 +:10394000844207DA002C03DB204670BD0421A7E780 +:10395000F44800E0F448201870BDF0B5064683B086 +:10396000F2480190457A029534687068001B07029E +:10397000EF483F0A001B0090062D2DD01420294649 +:103980004143EC480122081884464168E848920502 +:103990008646081B904210D3631A93420DD3024609 +:1039A0007046724503D900984018401C05E07345E5 +:1039B0000ED9411A0819401C404200280CDA604612 +:1039C0000295857C0198C0790028D5D003B0F0BD60 +:1039D000D049D94808F07DF90298854226D01421B3 +:1039E0004843D4490123401802908068D0499B0580 +:1039F0008C46011B8646994210D3221A9A420DD357 +:103A00006346614503D900997144491C06E0194693 +:103A100062452DD9091A0819401C4142002905DDCB +:103A20000298B17A807B814200D37446062D15D06E +:103A3000C0491420454368184268121B1202120A3A +:103A4000BA420BD2B27A837B9A4200D38468857CD7 +:103A50000198C0790028B9D1062DEAD13068A0427A +:103A6000B4D0E0190002000A3460706003B0F0BD09 +:103A7000A849B14808F02DF9D8E7F0B5AF49044698 +:103A8000486885B0C005C00D1BD0103840B2002872 +:103A90000BDA0207120F083A920892005118C9690E +:103AA0008007C00EC140880908E08108A44A890047 +:103AB000891809688007C00EC14088090006000EF9 +:103AC00008D000262078002806D0012804D0002045 +:103AD00005B0F0BD0126F5E72079062813D20300D2 +:103AE0007B441B79DB189F44020C0A080604002063 +:103AF00018E0B42010E073200EE032200CE00A2021 +:103B00000AE0072008E0FF208249E03008F0E1F8F1 +:103B100021790020002905D002214718834D002E6D +:103B200002D003E00421F8E70020E87102AA694608 +:103B3000A068FEF765FD694608228A56E06801A97B +:103B40008018C01C01221F2801DA019209E003AA93 +:103B5000FEF756FD6846007B002802D00198401C05 +:103B6000019000990198401808300002000A019065 +:103B7000C81B0002000A00906079694688720098AC +:103B80000390FEF7CAFC009A019B121A181A6D499D +:103B900012020002120A000A8A4210D888420ED885 +:103BA0006846FFF7DAFE00990398814205D0C819EC +:103BB0000002000AFEF718FDA060012000E00020CE +:103BC000E979002984D0002EAED005B0F0BDF0B563 +:103BD00005468FB05C480C460B9007F0BBFB534E7C +:103BE0005A4F00280BD05A48007D002803D059A115 +:103BF0005B4808F06EF8207801287DD068E1787F76 +:103C00000A280CD0787F397F401C884203D151A10B +:103C1000544808F05EF82078012804D011E0387F7D +:103C20000028F4D0F7E75048401920380090C07FB2 +:103C3000002803D047A14D4808F04BF80099012017 +:103C4000C877797F28461422494D51434919087491 +:103C50002078022823D0787F142148434519207901 +:103C60002872607968722A460C322946A068FEF7ED +:103C7000C7FC0C2028560F2804DD1F38287328683D +:103C8000401C28600C216956281DE26801905018DC +:103C9000C01C1F286EDA019901200860FBE027494B +:103CA0004868C005C00D20D0103840B200280BDA9B +:103CB0000207120F083A920892005118C96980074A +:103CC000C00EC140880908E081081D4A8900891892 +:103CD00009688007C00EC14088090006000E04D1A3 +:103CE00005201CA1000207F0F4FF787F142148434F +:103CF00045190021E06800E0DBE06A46049111709C +:103D000004A9FEF77DFC6A46002010560F2832DD1C +:103D1000012031E0F0380000F603000000E05EF81A +:103D2000F70300000080841E00807BE15803002020 +:103D3000FFFFFF00D40200200E07000000ED00E0AE +:103D400000E400E0FFFF3F00640300208C0200203D +:103D5000AC0200207372635C72656D2E630000001C +:103D600011050000EF04000017000020F40400001B +:103D7000CC01002082E00020049940180790022026 +:103D8000A8722079287260796872A068291DC01C09 +:103D900004911F2801DA012009E0FEF731FC684692 +:103DA0000078002804D0049804990068401C08603A +:103DB000287A062813D203007B441B79DB189F4422 +:103DC000020C0A08060400200FE0B4200DE0732066 +:103DD0000BE0322009E00A2007E0072005E0FF2081 +:103DE000FD49E03007F075FF00202179002943D01C +:103DF0000221401804906968083008180799089053 +:103E000009180498081A0C900020F071FEF785FB41 +:103E100004462860079820180002000AE860707ABB +:103E2000062825D0707A14214843EC494018406890 +:103E30000899019040180002000A0290687A6946C9 +:103E4000887301A8FFF789FD0199029A091B121BCB +:103E500009021202E24B090A120A0C98994207D889 +:103E6000824205D80199049808180002000A2860C7 +:103E7000F0790028C8D110E00421BAE704AA01991A +:103E8000FEF7BEFB6846007C002804D0019801992B +:103E90000068401C08602078A872787F0A2806D045 +:103EA000787F401C78770B9807F06CFA4BE0002085 +:103EB000F8E7CC48401920380090C07F002804D093 +:103EC000A320C9A1C00007F004FF00990120C87712 +:103ED000C84805742078022803D1C3A1C64807F05A +:103EE000F8FEC44D20792872607968722A460C3237 +:103EF0002946A068FEF784FB0C2028560F2804DD15 +:103F00001F3828732868401C28600C216956E06817 +:103F10002A1D4018C01C01921F2802DA01201060DF +:103F20000CE004AA0199FEF76BFB6846007C0028B0 +:103F300004D0019801990068401C08602078A8729C +:103F4000AC4901200875787F397F884224D0747A83 +:103F5000062C23D0FEF7E1FA14214C439F49611847 +:103F60000A7C042A18D00A7C032A15D04B68896879 +:103F70001B1A081A1B020002994A1B0A000A082B86 +:103F80000AD31146934207D8884205D8787F397FF3 +:103F9000884201D0FEF70DFB0FB0F0BD787F397F6E +:103FA0008842F7D10FB0F0BD10B50020FEF717FA28 +:103FB00010BD10B50120FEF712FA10BDF1B5009842 +:103FC00002287DD08D4C607A062803D186A18C48CA +:103FD00007F07FFE0026A6710125E572607A0321B5 +:103FE00014227E4F5043C0190174FEF7E7FA00987F +:103FF000002808D0012826D0022861D0032876D0D6 +:1040000079A180483FE08048007F002803D076A156 +:104010007E4807F05EFE65717B4D00202E60FEF746 +:10402000F1F9A968481C04D0012300221846FEF7C4 +:104030001FFA607A617A401CC0B2142251437A5848 +:1040400001219047F8BD0120FEF7DCF960790028D6 +:104050000DD06D488068401C09D0607A617A401CA0 +:10406000C0B2142251437A5806219047F8BD6648E1 +:10407000007F01280AD0022812D0032824D0042867 +:1040800036D059A1624807F024FEF8BD20790028F7 +:1040900003D02671FEF797FAE5705B480677F8BD06 +:1040A000207A002802D101F061F92572607A617AE4 +:1040B000401CC0B2142251437A580021904700E0BE +:1040C00030E051480677F8BD4F4F0123397B7868BF +:1040D0000022411A1846FEF7CBF92079002803D0B8 +:1040E0002671FEF770FAE57002203877F8BD1EE001 +:1040F000454E217870680123411A00221846FEF7C8 +:10410000B7F9207A002802D101F030F92572607ADF +:10411000617A401CC0B2142251437A580021904762 +:104120003577F8BD3B48007800F0A8FCF8BD607A10 +:10413000617A401CC0B2142251437A58052190473D +:10414000F8BD10B52D4C607A062803D126A132485F +:1041500007F0BFFD607A617A401CC0B2142251435F +:104160001E4A52580421904710BDF0B583B0062076 +:104170000290FEF7D2F9214C0090617A2748019015 +:10418000062920D0617A1420414314480918097C7B +:10419000042918D0617A142251430818007C03289E +:1041A0007DD00198009E02684068921B801B0C49DC +:1041B00012020002120A000A0B46082A6FD39A4222 +:1041C0006DD888426BD810488068401C03D006A187 +:1041D000134807F07EFD25E0543D0000D402002086 +:1041E000FFFF3F00170000207372635C72656D2E45 +:1041F00063000000AC0200201E05000058030020F0 +:104200004F050000A2050000380300205B050000F8 +:104210009605000011000020A905000048030020B9 +:10422000E505000000206071607A062807D16078FB +:10423000002804D0FE48C178417081780170607A0E +:10424000062815D0617A14204143FA480918097CE0 +:1042500004290DD1617A0291627A012114235A4313 +:1042600012181174627A5A431018807C6072A1721D +:10427000F14D687F297FF14F884233D0F04E287F7F +:10428000142148438019007CC05D0128287F07D095 +:1042900048438019007CC05D02282FD044E0FCE137 +:1042A000142148438019807A01280AD0297F0220EE +:1042B000142251438919097CC855287F0A2808D03F +:1042C00009E0297F0020142251438919097CC8552F +:1042D0002AE0002001E0287F401C2877687F297FA2 +:1042E0008842CCD1D74D287D00284CD0287CC15D98 +:1042F000012928D0C05D022830D03AE0287F14215F +:1043000048438019807A012803D0CFA1D14807F013 +:10431000E0FC297F00201422514389198872297FEB +:1043200051438919097CC855287F142148438219B3 +:10433000287F48438019017C0098FEF7E1FF287F21 +:104340000A28C8D1C5E7A97A012904D00221C1559C +:10435000002028750DE00021C1550AE0A87A012847 +:1043600003D0B9A1BC4807F0B4FC0020A872297C96 +:10437000C855287D002806D0297CB24A0098FEF74F +:10438000BFFF00202875029806281ED0142148433C +:10439000A8494018017C012917D107210174AF4DAC +:1043A000287B0A283CD0287BE97A401C884203D12C +:1043B000A5A1AB4807F08DFC297B02986854287BA7 +:1043C0000A2831D0287B401C2873607A06287DD0CB +:1043D000A07A00287BD00020A072617A142041438B +:1043E0009448A04B0A18566891681D46D2687C35DF +:1043F000DE67AA6069609C4D697E002916D002269E +:10440000617A14228B4851430818407B06281BD23E +:1044100003007B441B79DB189F440A1412100E0C16 +:10442000E87A0028C4D0C7E70020CDE70426E7E7F4 +:1044300000200FE0B4200DE073200BE0322009E0F3 +:104440000A2007E0072005E0FF207FA1E03007F009 +:1044500040FC0020C1B22973687E022801D00128E7 +:1044600010D1286942180098101A0002000A3A2850 +:1044700008D903206876323A1002000A28613220F7 +:10448000287308E0322906D2207A00280AD100F0E9 +:104490006DFF012005E0207A002803D000F08FFF97 +:1044A000002020726249082248782070097801298A +:1044B00001D0032906D101212171297B884201D92C +:1044C000421A0832A378002B03D001E08EE09CE072 +:1044D000921C2179002901D1002B5DD09446634ABA +:1044E00000990092019A176852687F1A511A3F0288 +:1044F00009023F0A090ABC4538D85C4A974235D8B8 +:10450000009A914232D8297B884214D92B69421AE9 +:104510009A1A1202120A101880190002000A2A615F +:104520006860002905D0032028770006000E3ED1E0 +:104530004CE00120F8E781420BD92A69511889190A +:104540000902090A6960002801D00420ECE7022072 +:10455000EAE7002B03D13CA1454807F0BAFB2869E4 +:1045600080190002000A6860002013E0002020711A +:10457000A070297B002908D0286940188019000202 +:10458000000A68600220287711E029698919090268 +:10459000090A6960287719E0287B00280FD029696B +:1045A000081880190002000A68600220287728692C +:1045B0000123811900221846FDF75AFF09E02869F6 +:1045C00080190002000A6860002028770120FDF7AA +:1045D00019FF617A1420414316480C2208188256AC +:1045E000012300206968FDF743FF0EE00120FDF77D +:1045F00009FF0020FDF706FFFDF7EAFE207A0028FC +:1046000003D000F0DCFE00202072A078002804D047 +:10461000FDF7D9FF0020E070A0706078002804D07A +:104620000348C1784170817801702079002821E029 +:1046300013000020D40200208C020020160000206D +:10464000CC010020AC0200207372635C72656D2E99 +:10465000630000000706000023060000C4020020DB +:1046600035060000CC02002038030020FFFF3F0089 +:104670008706000006D00020CE49E07009780029A6 +:1046800000D12071CC48017BC07A814203D0CB4855 +:10469000407800F0F3F90120E07103B0F0BDF0B50F +:1046A000C74C0746607A83B0062803D1C5A1C84825 +:1046B00007F00FFB607A1421C64E48438019007C36 +:1046C000032803D0BFA1C44807F003FBC34DA8686B +:1046D000401C03D0BBA1C24807F0FBFA607A14214A +:1046E000484381190C20085600216A460091117137 +:1046F000C01901AA6946FDF783FF6A4604201056D7 +:104700000F2801DD012000E00020009940186968B1 +:1047100040180102090AA9606079002804D0012329 +:1047200000221846FDF7A4FE03B0F0BD70B5AE4CF4 +:10473000AC4A0B1AA34214D3451AA54211D3934293 +:1047400003D9101A43185B1C0BE0954204D9511A87 +:104750000818401C434204E09AA1A44807F0B9FAA3 +:104760000023184670BD10B5014601230022022027 +:10477000FDF77EFE10BD10B50220FDF743FE10BD13 +:1047800010B5FDF7CAFE10BDF0B58D4D0446E87AB0 +:1047900083B0002803D18BA1954807F09AFA642CC6 +:1047A0004DD3944A00210846121B884147D39248B2 +:1047B000417F007F814242D19048007D00283ED158 +:1047C000687A1421834F4843844EC519306801AA82 +:1047D00000196946FDF714FF6946042008560028B1 +:1047E00002DD0098401C0090A96800986B680A18C8 +:1047F000D21A1202824B120A9A4220D8AA7C062AA6 +:1048000008D014235A43D2195268511A0902090ACE +:10481000814214D3B068401C05D00120FDF7F2FDA1 +:104820000020C043B060306800193060A86800996B +:1048300040180002000A7061012003B0F0BD0020A2 +:1048400003B0F0BDF8B50646401EC5B2142061495C +:1048500068434418207C002803D15AA1694807F016 +:1048600038FA6548017F407F81420CD0664A1423A4 +:104870004B439B181B7CB3420CD00A290CD0491C1B +:10488000C9B28142F3D15D48017D002964D0007C2A +:10489000B04261D10020F8BD0021F1E7217C05295B +:1048A00005D0217C062902D0217C072928D10121AD +:1048B0002174C17A0023027B8A4221D00246565CD1 +:1048C000AE4201D1012301E0002B04D00A2911D00E +:1048D0004E1C965D56540A290ED0491C167BC9B24F +:1048E0008E42ECD1002B0BD0117B002906D0117B1E +:1048F000491E04E00026ECE70021EFE70A211173CE +:10490000617C00292AD06774C17A0023027B8A4225 +:1049100024D0425CAA4201D1012301E0002B04D043 +:104920000A2912D04A1C825C42540A290FD0491C21 +:10493000027BC9B28A42ECD1002B0FD0027B014628 +:10494000002A06D00A7B521E04E00022EBE7002179 +:10495000EEE70A220A7301E017480027217C0129AB +:104960009CD1617C002999D10120F8BD70B5054624 +:104970001420184A05216843801801740E4C207BCE +:104980000A2811D0207BE17A401C884203D10DA176 +:104990001E4807F09EF9207B2554207B0A2807D06B +:1049A000207B401C207370BDE07A0028EFD0F2E736 +:1049B0000020F7E713000020C402002011000020AF +:1049C000580300207372635C72656D2E63000000F3 +:1049D000EA060000D4020020EB06000038030020A5 +:1049E000EC060000FF7F841E0020A1070E070000D8 +:1049F0002D070000FF1FA1078C020020AC02002041 +:104A0000FFFF3F006A070000CC0100200702000002 +:104A100001203E49400608603D4908603D490A685A +:104A2000FF231B029A4383121A430A6037498039D5 +:104A30000860704710B502460420374904E0C300FF +:104A40005B181B79002B0AD00346401EC0B2002B16 +:104A5000F5D132A1482007F03CF9FF2010BDC3007A +:104A6000CA50002259184A718A7101220A7110BD78 +:104A7000294A0021C00080180171704710B5044612 +:104A8000042803D325A1572007F023F92248E10089 +:104A90000C182079012803D020A1582007F019F91B +:104AA0006079A179401CC0B2814200D060710120C0 +:104AB000164940068031086010BD70B51548006881 +:104AC000800B022803D015A1722007F002F9124DC5 +:104AD000184C03262078C10048190279012A07D111 +:104AE000427983799A4203D042798271685880472B +:104AF0002078401CC0B22070042801D30020207010 +:104B00003046761EF6B20028E4D170BD80E100E0A8 +:104B100080E200E018E400E07C0300207372635C34 +:104B2000736F635F7369676E616C6C696E672E6328 +:104B30000000000024000020B548002101708170B1 +:104B4000704770B5B34D01236B60B34B1C68002CEC +:104B5000FCD0002407E00E6806601E68002EFCD022 +:104B6000001D091D641C9442F5D30020686018687C +:104B70000028FCD070BD70B5A54C0E466178884207 +:104B800003D0A6A16F2007F0A4F80325330007F097 +:104B9000ACF909520624245252525249520020784C +:104BA000022803D09DA1732007F093F82570A07808 +:104BB000022802D0012804D008E0A06806F004FF13 +:104BC00004E02269E168A068FFF7BBFF0020A07045 +:104BD000FEF7CAFA0420207070BDFEF77AFB01468A +:104BE0006068FFF7A3FD06462078022803D08BA15A +:104BF000872007F06EF88D4A8D498E48964205D879 +:104C00006269032A02D2521C626102E0864207D81E +:104C10004D71801BC86086496078FEF7D8FF70BD73 +:104C2000032003E0A0780028FAD1022006F0ACFEB1 +:104C300000F0E5F870BD79A1B12007F04AF870BD29 +:104C400070B50546FEF745FB714C60602078012881 +:104C500003D072A1B82007F03CF875490220087013 +:104C600000220A718D6004224A71724ACA60207063 +:104C70006078FEF7ACFF70BD10B5654CA0780028D9 +:104C800002D12078002801D0112010BD6A48FEF71B +:104C9000B1FA60706078002804D0012020700020F4 +:104CA000606110BD032010BD10B50124020B640427 +:104CB0000121624BA04202D29140186802E0203AE2 +:104CC00058689140084000D0012010BDF8B50E464C +:104CD000910004460F1915463F1F009106F085FE0E +:104CE000009980028919091FB14201D2012200E016 +:104CF0000022002D03D0FF2101318D4201D909206E +:104D0000F8BD4F498C421DD3A7421BD3844201D228 +:104D1000874203D34B4820187C2803D820463043D1 +:104D2000800701D01020F8BD8E420BD3002A09D194 +:104D30002046FFF7B9FF002804D13846FFF7B4FF3B +:104D4000002801D00F20F8BD3F4840490068884244 +:104D500005D02A4631462046FFF7F3FE0FE0FFF765 +:104D60008BFF0028EFD12A480121C66005618460CD +:104D700081702846302148431830FFF761FF00203A +:104D8000F8BD10B504462E48800A84420BD306F0C5 +:104D90002CFEA04201D8102010BDA4022046FFF72F +:104DA00083FF002801D00F2010BD27482749006845 +:104DB000884203D0204606F007FE0AE0FFF75CFFBA +:104DC0000028F1D112480221846081702048FFF749 +:104DD00037FF002010BD1A48010B01208840401EFB +:104DE000704700B50B460246FFF7F5FF104201D0B1 +:104DF0000F2000BD114802604360002000BD10B5C7 +:104E0000034C6078FEF74AFA00202070A07010BDB5 +:104E10002800002000E5014000E401407372635C5B +:104E2000736F635F666C6173682E6300307500009A +:104E30009C030020D0FB0100774B000000060040DF +:104E400000D0000080EFFFEF0C000020BEBAFECAC9 +:104E50003A560000F7480521817000210170417029 +:104E6000C1708160704710B5F3490A78022A07D0F3 +:104E7000CA681018C860C8689638FFF710FC10BDE3 +:104E80008A68101888608868F6E70378EB49EC4A6E +:104E9000002B02D0012B10D014E00379002B01D09D +:104EA000012B0FD14379002B01D0012B0AD183684C +:104EB000643B8B4206D2C06810E00379002B03D01C +:104EC000012B01D0002070474379002B01D0012B2A +:104ED000F8D1C368643B8B42F4D280689042F1D829 +:104EE00001207047F8B504460226FFF762F8006813 +:104EF000002803D0D3A1BD2006F0EBFE0127CD4D45 +:104F0000002C08D02078002817D0012805D00228CE +:104F100011D0032813D02F710DE06068C82808D382 +:104F2000FFF732FC002804D06068FFF79CFF0126E1 +:104F300003E0002601E000F0F7F93046F8BD2878DC +:104F40000028F8D16068FFF7A0FF0028E3D0606870 +:104F50000078002826D0A878042803D0B9A1F7202B +:104F600006F0B7FEB44F0020387060680079012861 +:104F700000D00020387160684079002837D00420C4 +:104F8000787160688168E868FEF73BFCB86060682B +:104F9000C0689630F8600320A870A749E878FEF74B +:104FA00016FEC8E7A4480221017061680979012949 +:104FB00019D00021017161684979002915D00421B7 +:104FC000417161688968963181606168C968C160B2 +:104FD000C068984C14346060FEF77BF920606F70F5 +:104FE0000220A870A7E70321E4E70321E8E70320F4 +:104FF000C6E7F8B58F4C0D46E178884204D0FF2013 +:1050000090A1193006F065FE28468A4F002501263A +:105010001437030006F069FF09061237607B8C968F +:10502000C39FC300A078032807D0A078022804D02B +:10503000FF2084A11D3006F04CFEF8BDA0780328A7 +:1050400007D0A078022804D0FF207EA1213006F0EE +:1050500040FE0420A07025712078002810D1FFF7B1 +:1050600002FFE078FEF7F4FBE0607D49886A7D4A44 +:10507000024022617B4AD2431040886200204FE008 +:1050800000F052F9F8BDA078032807D0A0780228D4 +:1050900004D0FF206BA1423006F01BFE20780028D0 +:1050A00002D000F04DF9F8BDA078032801D104200A +:1050B00024E0FEF70EF901463868FFF737FB0028B9 +:1050C00020DB796881421DDB091A5B48C16001461B +:1050D000E078FEF77CFDF8BDA078032807D0A07823 +:1050E000022804D0FF2057A1633006F0F2FD20789B +:1050F0000028D6D1A0780328DBD1052006F044FC97 +:10510000A670F8BD042006F03FFCA570F8BDA0789D +:10511000042804D0FF204BA1843006F0DAFD0220E1 +:10512000A1688847FFF7DEFEFF260546BD3642E050 +:10513000A078042804D0FF2042A1893006F0C9FDE0 +:105140000120EDE7A07804289AD0FF203DA18E3001 +:1051500006F0BFFD94E7A07804280AD06078002804 +:1051600002D0A078022804D0FF2036A1933006F0A8 +:10517000B0FD2078002894D12079002804D00620A2 +:1051800006F002FC2571BBE76078002805D02A49AB +:10519000E078FEF71CFD6570F8BD0720AEE7FF2044 +:1051A00028A1AE3047E7002D0AD0012D06D025A159 +:1051B000304606F08EFD022DF5D1F8BD042000E04A +:1051C0000320A1688847FFF78DFE0546F3E770B519 +:1051D000050005D0174CA078052803D0112070BD1C +:1051E000102070BD2048FEF705F8E070E078002838 +:1051F00003D0A5600020A07070BD032070BD10B565 +:105200000C480178002901D0112010BD81780529B2 +:105210000ED08178012929D08178002926D001215A +:1052200001708178012921D0807800281ED01FE0EC +:105230000F2010BD40000020AC0300203D8601007F +:10524000FF1FA1077372635C736F635F72616469B0 +:105250006F5F74696D65736C6F742E63000000007E +:105260000005004002810000F34F000000F068F8E4 +:10527000002010BDF8B5394E0446B078002801D0A2 +:1052800001280DD1002C0DD02046FFF7FEFD00288F +:105290000AD02078324D002808D0B078012823D0D9 +:1052A0000F20F8BD1020F8BD0720F8BD02272F7091 +:1052B0002079012814D0002028716079002811D0AD +:1052C00004206871A0689630A860E068E860E8682B +:1052D000224C14346060FDF7FCFF2060B77019E0C9 +:1052E0000320E9E70320ECE700202870207901285B +:1052F00016D0002028716079002813D0042068712E +:10530000A168F068FEF77DFAA860E0689630E86072 +:105310000320B0701249F078FEF759FC0020F8BD68 +:105320000320E7E70320EAE710B50E48816A0E4A3A +:1053300011400A4A126911438162FDF715FF10BD41 +:1053400010B5064CE078FDF7A9FF082006F01CFB1D +:105350000520A07000202070607010BD400000206B +:10536000AC03002000050040FD7EFFFF10B5EFF309 +:105370001080C407E40F72B6D1484178491C4170CF +:105380004078012801D106F039FB002C00D162B62B +:1053900010BD70B5CA4CE07800280AD10125E5702F +:1053A000FFF7E4FF06F032FB002804D0002006F0EF +:1053B000EBFA002070BDC34865714560F9E770B530 +:1053C000EFF31080C507ED0F72B6BD4C6078002872 +:1053D00003D1BDA18F2006F07CFC6078401E607078 +:1053E0006078002801D106F00DFB002D00D162B6D7 +:1053F00070BD10B5B248C178002904D000214171B8 +:10540000C170FFF7DCFF002010BD10B5044606F0A8 +:10541000FDFAAB49C978084000D001202060002087 +:1054200010BDF8B50246A64C0026A6710420202126 +:1054300001251027130006F058FD0D080A0B0D0F6B +:105440001113151D1F2124262800257122E002209A +:1054500020711FE00820FBE727711BE0217119E094 +:10546000012617E0FFF782FF06F0D0FA0028FBD0F4 +:1054700002260FE0207102E00820FBE72771A571EA +:1054800008E02171FBE74020F4E7FF208EA1763091 +:1054900006F01FFC06F0C6FA002809D006F0C8FA8C +:1054A000B04205D1304606F0C6FA0028FAD02CE00A +:1054B00001208007C5608C4900224A608B4A9661B2 +:1054C000804B02225A60856089480269D243D20625 +:1054D000D51702696D1C10231A4302610F4600E0C4 +:1054E00020BF78680028FBD0304606F0A4FA0028D8 +:1054F000FAD0002D04D17E48026910218A4302614E +:1055000070490220886000207860A07900280CD0C3 +:1055100006F07CFA054606F0C1F9764A002D02D065 +:10552000A260E06001E0E260A060002E01D100F026 +:10553000A2F8F8BD10B5044606F06EFA002805D0B2 +:105540005F490120C8704A78521C4A702046FFF714 +:1055500068FF10BDF8B5644DA8680026012802D187 +:10556000AE6006F011FA6868012800D16E60286804 +:105570000127534C012812D12E606079002803D0F6 +:10558000002006F001FA66712078002807D006F0A6 +:105590003DFA002803D0012080070761A770286921 +:1055A00001282AD12E6100F05FF8012080074761B1 +:1055B000A079002815D006F029FA009006F06EF9BF +:1055C0000099002901D0E16800E0A168411A022990 +:1055D00001DA8A1C11DC0099002901D0E06000E0AA +:1055E000A060FFF7C3FE06F011FA002804D00120E6 +:1055F00080070761A77000E02770E868012812D1D2 +:1056000000F032F800F030F800F02EF8A078002812 +:1056100004D1FF202CA1033006F05BFBEE60A670E6 +:105620002670FFF7CCFEF8BD10B5254CE0780028B9 +:1056300001D106F0E7F901208107886100F014F834 +:10564000A07800280BD0284CE068002803D106F091 +:10565000F2F90028F8D10020E06000F005F8002001 +:105660001849C043886010BD50210846491E89B2C0 +:105670000028FAD17047F8B51248192787601A49EF +:1056800000200860C86006F0C1F9BE0701240C4D77 +:10569000002802D03461AC7000E02C70FFF766FE89 +:1056A00008484760114928798863FFF7DDFFB46136 +:1056B000FFF7DAFF0C49002008617461F8BD0000B3 +:1056C0005C000020000300402E2E5C2E2E5C6C69D6 +:1056D00062735C736F635C7372635C736F635F634D +:1056E0006C6F636B2E6300000001004000050040FA +:1056F00000ED00E0FFFFFF7F8107C90E002808DAF8 +:105700000007000F083880082D4A80008018C06903 +:1057100004E080082B4A800080180068C840800997 +:10572000704710B50D20FFF7E7FFC4B20420C04357 +:10573000FFF7E2FFC0B2844203D023A11B2006F092 +:10574000C8FA26490120486010BD0121244A4803B7 +:105750001060244B00221A60234A5160234A1060D3 +:10576000234A11601E4980390860704701211C4A94 +:10577000480310601E4A51601A4A002111601B49FB +:105780000860704710B517490868012804D00EA1B9 +:105790005C2006F09EFA10BD104880680022C0B25E +:1057A0000A6005F02CFD10BD10B50E4801680029F7 +:1057B000FCD0FFF7E7FF01200C494003086010BD53 +:1057C00000ED00E000E400E07372635C736F635F00 +:1057D00068616C5F726E672E6300000000D5004048 +:1057E00080E100E000D1004000D3004080E200E012 +:1057F00000D000408307FF22DB0E9A408907090E84 +:10580000994000280BDA0007000F08388308FF488A +:105810009B001B18D86990430843D86170478308E0 +:10582000FB489B001B18186890430843186070479A +:10583000F849C86AC0070ED1F7480A6B42624A6B42 +:1058400082628A6BC262C96B0163F24940310968A6 +:10585000C20511434163704710B5F0494968487269 +:10586000097ACA0701D0012803D0890703D5022885 +:1058700001D1FCF7A8FB10BD70B5E9480024C46352 +:105880000125C563E7480460284600F0B8FBE649F7 +:10589000601E8860E5480461E5490D6101690029E1 +:1058A000FCD00461C460446084600460012000F0A6 +:1058B000AEFB70BDF8B5DF480125C560D8480026AD +:1058C000C663C563FFF7B4FFDB4C6661D34FDB4AA9 +:1058D0007868C17809028918A161A1696A069143B3 +:1058E000A161D04A03211160D0490E61CE604E60A3 +:1058F0000E60D349A16309078A692B4693431A02B4 +:10590000921C6263CF4AE2638279E2602563E662B9 +:105910008B692A4689699A438D43AA409107890F6A +:105920002161001D00F0D7FB78688078A060BE4937 +:105930001020486000210120FFF75CFF012000F0EB +:1059400057FBBC48C660F8BDF1B5BB4EB068B34C60 +:105950006568A97888420ED12D1D6878FDF70DFB8A +:10596000716AC9B2884206D12878FDF706FBF16951 +:105970000006884201D00020F8BDFDF7AAFC0746CA +:1059800060683946C069FEF7D1FE0546642800D23A +:1059900064256068816A02694919914203D97D21B1 +:1059A00049020161E7E72846FEF7EEFE0028E3D052 +:1059B0006168CF61886A40198862FEF770FE0098BE +:1059C000012500280DD0FFF775FF01F047F8706042 +:1059D00097484560964A95491432091D0E2000F0FB +:1059E0001DFB082000F00BFB0120974900044860D4 +:1059F0009648C56060689649406A086095490020ED +:105A0000086001460820FFF7F5FE082000F0FFFAC5 +:105A1000082000F0EDFA01F054FA0120F8BDF8B5C5 +:105A20000A467E4901268A4D00244868130006F084 +:105A30005CFA090631ECEC7BEBEA1EE91E000F462E +:105A40000978022912D040787B4C834D01280FD071 +:105A500001F0EDF8FFF72EFF01F002F86060012081 +:105A6000000568607868806AFEF719FE7E70F8BDF0 +:105A700001F057F9FFF71EFF00F0F0FF6060012012 +:105A8000400568606A4A69491432091D0E2000F019 +:105A9000C5FAE7E70F46497800291ED03978022970 +:105AA00022D0082000F0ABFA6A490C607868426A9C +:105AB0002A60027B002A25D020300673012062492B +:105AC0000004486000210820FFF794FE082000F041 +:105AD0009EFA082000F08CFA1BE0407801F0E9F90A +:105AE000F878FEF7CBFF06E04078012807D000F0F9 +:105AF00017FB00F09FFA3C70FDF736FB10E000F05A +:105B0000ABFAF6E720304A4A047310320F2000F057 +:105B100085FA78684078012804D00120FFF79CFEC0 +:105B20007C70F8BD0220F9E74C4A002753683B49D6 +:105B3000DB07DB0F8B70407801281ED001F03DF9A8 +:105B400000F0EEFA3548007802282BD033482C219B +:105B50004068095C002941D0007B00283ED001F05C +:105B600008FF384323D0002F38D02C4847683969C4 +:105B7000B86A884221D93C6121E02C48416801295A +:105B800005D1C068012802D11068012802D000F0B8 +:105B90009CFAD7E7012701F049F801F00EF900F06F +:105BA0005BFACFE700F046FA1C48047083E001205E +:105BB000FFF7CAFE002811D0F8BD081A386139690C +:105BC00000917D214902009805F085FF7D22C0B239 +:105BD000520200995043081A801838610F4F7868B4 +:105BE00020300473F878FEF749FF0020FFF734FEF9 +:105BF0003C70082000F003FA0120134900044860BB +:105C000012482DE03DE08EE03DE02FE000ED00E0A9 +:105C100000E400E080000010001700406C0000204D +:105C2000C01F00400012004000130040001100405F +:105C300000100040000A0040001500401E00010155 +:105C400021100000FFFF00000083004000800040A2 +:105C5000408500404081004000F5014000140040B4 +:105C6000C660FF20913049E02C70F8BD0D460978E0 +:105C70000229F9D0407801F01CF9E878FEF7FEFE21 +:105C8000F2E70C70F8BDFE4A1368002BFAD01460DE +:105C90002C22125C002A3FD00F460978022907D037 +:105CA000007B00280FD001F064FE002806D00AE037 +:105CB00000F0C0F93C70FDF757FAF8BD0020FFF77F +:105CC00043FE0028F9D1012000F099F9ED48006960 +:105CD00000F0FBF9786820300473F878FEF7CEFE08 +:105CE0000020FFF7B9FD3C70082000F088F9012082 +:105CF000E54900044860E548C66096202860E04811 +:105D0000046000210820FFF775FD082000F07FF9EE +:105D1000082000F06DF9F8BD0878012803D0286844 +:105D200096302860F8BD00F085F9C4E770B5D84D0D +:105D30006860012000F063F9012000F068F900219B +:105D40000120FFF757FD012000F052F90024D1484F +:105D5000AC60FDF74FFA69680870CC7101200872D9 +:105D60004C728C72CC727D200C7340020861203121 +:105D70000C732C706C70AC7070BD10B5C44840686A +:105D8000C179002903D00021C171FFF718FB10BDB4 +:105D900010B5BF482D224168525C002A0AD009780C +:105DA000002907D00178002904D002210170017870 +:105DB0000029FCD172B6FFF7E0FF62B610BDB4480F +:105DC0008168002901D000200847704710B50028DD +:105DD00005D0AF4CA060B048FEF72CFEE07010BDBF +:105DE00070B50C46054600F03BFE2246294605F0FC +:105DF00031FE70BDF8B5A64C154600266268012735 +:105E00005670D0615176002B01D0177500E01675E1 +:105E100001F07DFD002804D060687D210776C9006F +:105E200003E06068032101769C496918016261689A +:105E30004D62086A643888620E7308781431FDF781 +:105E4000C6FE2770F8BDF8B5914C1646012562686C +:105E5000069F5570D0615176002B01D0157501E079 +:105E60000020107501F053FD002804D060687D21EA +:105E70000576C90003E0606803210176874971183F +:105E8000016261684E62086A643888620F7308783C +:105E90001431FDF79CFE2570F8BD10B57C48C07824 +:105EA000FEF7ECFD10BD10B5FDF7ABFC10BD10B555 +:105EB000FDF70FFA10BD764949688871704774493B +:105EC000496888707047724949688880704770498E +:105ED0004968C87070476E4901204968C8727047A8 +:105EE000F0B56B4D07466868C1B0807A002831D1A3 +:105EF0006B480026C6630124C463FFF799FCFFF7D3 +:105F000035FA6A6867489179C16006619178816065 +:105F1000654BF90716D0AA2141626449C161082185 +:105F20004161634981614663FE216D46297000210C +:105F30006E187170491CC9B2FE29F9D3456007205B +:105F4000186004E01C6057490320403108604D4848 +:105F50000460947241B0F0BD70B54D4D6868807AB0 +:105F6000002814D0FFF788FC4F48002404605148F3 +:105F700004614C4940310C60424A012111610169C0 +:105F80000029FCD00461FFF71AFA6868847270BDBA +:105F90004848C069002804D04248403080684042E8 +:105FA00040B270473A488078704710B5384840682A +:105FB000C179002903D10121C171FFF7D7F910BDC3 +:105FC000334949680872704731484068007A704721 +:105FD0002F484068407A012800D0002070472C48A4 +:105FE0004068407A022801D00020704701207047A5 +:105FF000C106C90E012088402F4908607047C106BC +:10600000C90E012088402C49803108607047C106C4 +:10601000C90E0120884029490860704710B5284CF6 +:10602000C3001B1919605A600121814024481038AF +:10603000416010BD10B50120134900048860134968 +:10604000012048600E49002008600820FFF7D7FFB4 +:106050000820FFF7DCFF10BD10B50A490120886158 +:1060600014490020C8610E2000F065F80120144991 +:106070004005103988600F2000F05DF822E0000034 +:10608000408100400010004000830040008000403C +:106090006C0000201F5A0000BF5D0000B80B00001C +:1060A000C01F00400015004000120040BEBAFECAEA +:1060B000FF0004030011004000E100E080E200E086 +:1060C00010F50140FFF7D8FB10BD10B500F075FECC +:1060D000FFF7C2FF10BD70B505461C48002640689A +:1060E0001B4CC17A002907D0C672606A000A000200 +:1060F0006062E069E66170BD606A000A0002606289 +:106100006878FCF73AFF616A08436062E069E6611B +:106110002878FCF732FFE16900060843E06170BDB2 +:1061200010B501200B49000588600F2000F003F82E +:10613000FFF7A2FB10BD0121064A814091600021BA +:10614000C000801801614161704700006C000020B0 +:106150000015004000F5014070B50C460546FFF7FC +:10616000A6FE01462846FEF7E1FAFE49002805DAB8 +:106170004042400205F0AFFC201A03E0400205F067 +:10618000AAFC001980B270BD10B5F74C208F618F4A +:10619000626E401AF34980B24843410AC005C00DFF +:1061A00080186066820500D5491CC005C00D606678 +:1061B000E06DFFF778FEA06510BD8100EB48415807 +:1061C000084640308278D20701D0C078704720312D +:1061D000C8797047E64A04211078030741D5F8B51D +:1061E000F72318401070E04A507A8300DF48C35804 +:1061F000184640308478E40701D0C07801E02033AD +:10620000D879002804D0012804D0022803D101E065 +:10621000032100E00221D748D74C85792078C307B5 +:10622000D148DB0F006E002D05D0D27ED200E132C6 +:10623000FFF7E0FD0BE0157ACB4ACA4ED28D7243D0 +:10624000520A122D08D000250095FFF7FCFD20789A +:10625000400840002070F8BD01250095FFF7F3FDD0 +:10626000F5E77047C048407A8100C0484058017F38 +:10627000490702D501212030C1717047012A00DC95 +:106280000122491E401ED30703D0491C0B78401C35 +:106290000370521007D04B784370891C801C0B7818 +:1062A0000370521EF7D17047C27B0F21521CC2737C +:1062B00004E0491EC9B2425C521C4254425C002AAE +:1062C00001D10029F5D17047002A4ED0FFB5AB4867 +:1062D00083B001461F311030154601910090102DFA +:1062E00004D91024A54805F0D2F905E02C46A348AE +:1062F00005F0CDF9002C22D003990498491E401EC8 +:10630000019AE30706D0491C521C0B78167873409B +:10631000401C037063080CD04E785778891C7E406F +:106320004670921C0E781778801C7E4006705B1EAB +:10633000F2D1039800190390049800190490009971 +:106340000F20CA7B521CCA7304E0401EC0B20A5C14 +:10635000521C0A540A5C002A01D10028F5D1281BDE +:1063600005062D0EBBD107B0F0BD7047F8B58048CB +:106370007D4C00787D4E8107607A8300002967DBC1 +:106380007F48814D007882077E4801780DD17F4893 +:106390000078400709D5C80607D52878C20904D176 +:1063A000A22210432870F25810712878C7076E484F +:1063B000C27E501F002F30D0754F09072BD575496D +:1063C000921FA164082A09DDD2B20023891DB81DDD +:1063D000FFF77AFFA16C7879487105E0C2B200231B +:1063E000491D781DFFF770FF607A800031586948B9 +:1063F00004F0FCFBA16C387908712878000704D5FB +:10640000082265496548FFF739FF65488022017811 +:1064100011430170F8BDA764F8BD090718D55D4F99 +:10642000C2B2A764F0580023401D791DFFF74CFF4E +:10643000607A052280003158A06CFFF71FFF287892 +:106440000007E9D50822791D5448FFF717FFF8BD6A +:10645000F058A064F8BDF8B5474C434D207880064D +:1064600005D400266E87FFF722FD6E66E865698F0A +:10647000E86DFFF771FE2887FFF719FDA865298FE2 +:106480006987E865FFF768FE07462078F72108402E +:10649000207072B6FFF789FD62B641373448012695 +:1064A0000178314301702F8704F06DFBFFF7F5FC95 +:1064B0002078810601D53043207010202872207882 +:1064C000202108432070F8BDF8B527482D4D017AEA +:1064D000467A264F102941D1E91C0978490604D58E +:1064E000002141721121017238E02E4C2178CA0638 +:1064F00034D5FF22427203799E4200D10271B0006E +:1065000038584030007A800611D5EF2001401D48F0 +:10651000217000780A0780088000002A01DA801CB8 +:1065200000E0401C2870F7200140217016E0072190 +:10653000304600F06AFA2078EF2108402070287871 +:10654000114C80088000401C28702078C00903D0BE +:106550000621304600F059FA022020700A480178DE +:10656000B00021E0093D0000780000205804002020 +:10657000A000002098000020870000206C07002069 +:106580008E000020840000208C0000208500002068 +:10659000FA030020BC030020C1030020F600002005 +:1065A00088000020890000203A581171FE490978BE +:1065B000490603D4385829784030C171F8BDF8B580 +:1065C000FA4D07468600A8594030017A89060DD554 +:1065D000C1798907890F012908D100218171A85942 +:1065E0004030C17989088900891CC171EE48007862 +:1065F000800627D5EE4C618FE06DFFF7ADFDEA49CF +:1066000009780A07EB4909D5627AFF2A13D092006C +:10661000AA58128A101A80B258280CD8A8594030AB +:10662000007A800606D5607A874203D1087808226E +:1066300010430870F8BD0878C00603D510202072FA +:10664000FFF742FFFFF707FFF8BD082A01D927200F +:106650007047FFB50546D44881B00278D348530649 +:1066600004D5002D08D1312005B0F0BDAB00C358D2 +:106670004033DB799B0716D0CC48AF00C3599C460A +:106680004033D879C40611D41B7A9C060BD4440637 +:1066900009D4DB0707D1520608D40A0606D58007BD +:1066A000800F022802D2152005B0F0BDA0200140C5 +:1066B00002200143C04EBE48F571427ABF480C46E5 +:1066C000002100789646954208D1002806D043075D +:1066D00004D4BB490978C9092AD10121B54B1B78DB +:1066E0009A0613D5DF221340B24A7545137003D1C1 +:1066F000002901D100280FD1B24801788906890EFE +:106700000170FF20F071212005B0F0BD62461379C1 +:106710001B0601D500290BD0754512D1AA4A0029C4 +:106720000BD0D11C0C70491EF7231840087007E0ED +:10673000FF20F0711F2005B0F0BD107820431070CD +:1067400014789A4861460C71C0590822401D04997A +:10675000FFF794FD9648407A854207D19748007824 +:10676000002803D1200601D5FFF77CFD8F49DF23E8 +:10677000C859403082791A408271FF20F071C8599F +:106780004030007A800605D52846FFF718FF5020D4 +:1067900005B0F0BD502005B0F0BD01898388C288E6 +:1067A000481E934201D180B270479A1A891A01405B +:1067B000491E88B27047F0B5844B0F461C4606460A +:1067C00025899888D9886C1E884201D1A1B204E03D +:1067D000411A691A2140491E89B2914227D31446B1 +:1067E000281A734A794985B28988D06E0818AC4254 +:1067F00002D82246394608E0EAB23946FFF73EFDA4 +:10680000601BC2B26A487919C06EFFF737FDB00647 +:1068100004D5684880220178114301706B48818853 +:1068200002890919521E114081805020F0BD22209A +:10683000F0BDF8B5604C8227A07A012813D1644DD1 +:10684000A88800280FD05A4E706F002804D001216C +:106850000170A88800285BD0207B810706D5A98815 +:10686000082902D002E02120F8BDA027C00720D1CE +:10687000E07A81004D4840580079000614D508227E +:106880003846316FFFF797FF502859D1306F0830E5 +:106890003067A8880838A880B80636D545488022D1 +:1068A00001781143017030E0424820220178114301 +:1068B000017008223946E07A336FFFF7C6FE502890 +:1068C000D2D1306F08303067A8880838A880227B82 +:1068D000D0071AD03F480378590608D5811D09789A +:1068E00000291DD0490702D420210B430370E07A10 +:1068F0006072364900208880C8802E480178490699 +:10690000490E0170500840002073A8880028A3D1C8 +:106910000220A072706F00280ED0002101700FE0DD +:1069200010210B4303702C49002008702070B08E9A +:106930007086A0786070DAE71121607A00F065F85F +:106940005020F8BD10B51C4AD37A984215D10529BC +:1069500007D0062905D085290FD1FFF76AFF00214E +:106960000BE0FF231A4CD3720020A0809072403CB1 +:10697000646F002C00D020705372084610BD10B414 +:10698000164B0A4A09292BD002290AD18000105837 +:106990004721095CC90604D42721095C00292ED0AF +:1069A000438410BC7047000087000020580400207A +:1069B0007800002089000020980000208E00002030 +:1069C0008F0000208B0000208C0000209C070020FE +:1069D000B80000208800002097000020FFFF000082 +:1069E000810050584724245CE40601D5038400E06C +:1069F00043845058FE232030437110BC7047418CB3 +:106A0000428A8918418410BC704770B504460D460F +:106A1000FFF7B5FF29462046FFF794FFFC4B1D7892 +:106A20006907C90F491E014217D0FA49CA78561C96 +:106A3000F6B2CE70202E01D30026CE708978F6B241 +:106A40008E4203D1042005431D7035205100F24AC7 +:106A5000545489184870FBF7B6FA70BDEF48704778 +:106A6000EF48704710B5FFF793F9FFF775FA10BDBF +:106A700070B505461C46080601D5104604E00529F8 +:106A800000D30421E748405CFFF715FA2846FFF7DA +:106A900016FA2046FFF724FA70BD70B5E24C850067 +:106AA00063590E062033002E01DADA7705E0052956 +:106AB00000D30421DB4A515CD977D649497A884210 +:106AC00004D160592030C07FFFF7F5F970BDD64A78 +:106AD0008300D25820329177CE4A527A904204D124 +:106AE00010B50846FFF7EBF910BD7047CE4980009E +:106AF00008582030807F7047CC4B42009952C54ADD +:106B0000527AFF2A0AD0C84B92009A58527B82428E +:106B100004D110B50846FFF7D6F910BD70478300C1 +:106B200030B4C148B024C55840356C70C4584034A6 +:106B3000A5796D066D0EA5710D068024002D09DA6C +:106B4000C15840314A70C058403081792143817129 +:106B500030BC70470029FBD027228900D243511A4C +:106B6000C25840325170C058403081792143817100 +:106B700030BC7047704770B5A64CE18FA06EFFF730 +:106B8000EBFAAB49A0870978A74D890706D0617A4F +:106B90008900695840318979C90646D4A54910232E +:106BA0000A781A430A70218FE27E081A411E1346A2 +:106BB0000D3BDB105B1C0904490CDBB20004A37124 +:106BC000000C05D00126F603B04201D85818A07178 +:106BD0000D2A1CD991489849012A00DC0122401E47 +:106BE000491ED30705D0491C43780E787340437083 +:106BF000401C52100BD046784B78891C5E40467082 +:106C000083780E7873408370801C521EF3D1FFF797 +:106C1000BFF9617A8900695840310870207A1228DA +:106C200003D1A08F20870520A07170BDA3E7F8B520 +:106C3000FFF79CFB7F4EF72130780840307072B62A +:106C4000FFF7B3F962B67D48724C00782546C0075D +:106C50002035002805D0E878062802D27849085C5B +:106C60000EE030784106704805D500682030807FFE +:106C7000FFF725F906E0617A890040582030807FCF +:106C8000FFF71DF9E07EFFF722F96E486E490078A4 +:106C900008716E490978890701D4A16C0871C00791 +:106CA00034D0E07E84460D2826D969480078C00992 +:106CB000A06C1DD06646604A012E00DC0126401EF5 +:106CC000521EF10705D0521C437817787B40437061 +:106CD000401C731010D047785178921C4F40477079 +:106CE000877811784F408770801C5B1EF3D103E0DA +:106CF0000179ED2251400171554801784906490E4C +:106D000001706146A06CFFF76BF803E00D21A06CE9 +:106D1000FFF766F8E879617A884201D1FFF7DBF87E +:106D2000F8BD70B5434CF72120780840207072B64A +:106D3000FFF73BF962B64148364D0078C00706D0F0 +:106D40004448C078062802D23D49085C0EE020780D +:106D50004106354805D500682030807FFFF7AFF841 +:106D600006E0697A890040582030807FFFF7A7F855 +:106D7000E87EFFF7ACF870BD26492648497AC3790A +:106D8000002229488900092B09D0032B0ED0042B9F +:106D900004D140582421095CC90705D070474058E8 +:106DA0004721095C4906F9D502847047214B1B78BD +:106DB000DB06FAD5405842847047DDE770B41549C8 +:106DC0001448497AC279244C012317488900092ABA +:106DD00044D0032A4DD0042A52D00C2A01D0052ACF +:106DE0004CD1134A1278920748D04258107F40077E +:106DF00044D518491446487B2034401CC5B24D7315 +:106E0000E6790020002E4DD00222E2714EE0000013 +:106E100089000020780000200806002036040020A9 +:106E2000DA03002010BF0000580400205C07002097 +:106E30008E0000208700002015BF00009700002072 +:106E4000F00000208C000020FA030020A0000020A9 +:106E50008800002098000020FFFF000042582725EE +:106E6000AD5C002D01D0148403E0148C558A6419A4 +:106E700014844058203001791943017170BC704767 +:106E80004058014620310A79D207F7D1C979002943 +:106E900002D0048470BC7047018C428A8918018436 +:106EA00070BC7047D27FAA42FAD8E371487370BCB5 +:106EB000704710B5002801D1FFF758FAFFF77EFFA1 +:106EC00010BD10B5F74CE18F6187A06EE065FFF74C +:106ED00043F92087FFF758F9208FE087A06DA0665F +:106EE00010BDF3B5CF788B788FB05F40CF700E793F +:106EF0007E400E714D79B44675404D710B95887981 +:106F000068408871CA794240CA714C7854404C70CC +:106F100008940E78A64666400E70EF240796264029 +:106F20008F24664000967446BE2634403626744050 +:106F3000009E3443A646EC241E462640202466408C +:106F400074462643B646BC06A40E1A2674407646FE +:106F50003443A6466646D7242640472466407446F6 +:106F60002643DB2425401124654035437926044619 +:106F70003440502674402C43F72515409326754025 +:106F8000254305D0C8490F98FFF7B6FD11B0F0BDF5 +:106F9000079C10252C40089D41263540254364461A +:106FA000282634402C4386252840204313242340A0 +:106FB000BC09A40108701C430B9B24252B402343D0 +:106FC000082422401A434A70110201430F98FFF728 +:106FD00093FD11B0F0BD7047704710B504F0E9F8AB +:106FE00010BD10B5102104F0E4F810BD00B5014645 +:106FF0001022AE48FFF742F900BD00B5014610224D +:10700000AB48FFF73BF900BD30B50D460446002AFA +:1070100013D0012A10D1214603220D312846FFF753 +:107020002DF90A22E11CE81CFFF728F92846032263 +:1070300021460D30FFF722F930BD214604220C31E4 +:107040002846FFF71BF90822211D281DFFF716F916 +:107050000422284621460C30ECE710B4914B954AA7 +:10706000D86E1060002090809349D0804C881481A5 +:10707000924AFF2454720880D472888090725867B4 +:1070800010BC704770B58E4982008B5840331C7A13 +:10709000A40608D4DC79A407A40F012C03D1894CE1 +:1070A0002478650601D5152070BD9D79ED0901D0C4 +:1070B000A02500E020259D718B584033DD79AD0877 +:1070C000AD00AD1CDD718B58DD7D6D086D00DD758B +:1070D0008D580023EB81A30602D4FFF7BCF906E02C +:1070E00089584031097AC90601D5FFF768FA0020AE +:1070F00070BD13B582B0714A0C466846017A537A66 +:10710000407A994205D1382801D0392801D1FF2091 +:10711000507288006A4908584030007A400703D509 +:107120002146029803F06BFD029800906846407873 +:10713000421E092A06D8012191405F4A1288114255 +:1071400000D0FF20694648720021FF2800D121703D +:107150006846008904B010BD402801D20020704765 +:107160000120704710B4544AFF28508002D9FF20F4 +:107170000130508053884020402B09D05488430070 +:10718000A34201D898B200E0508053888342F5D1E1 +:107190004448C16610BC70478188C2880089891A3A +:1071A000401E014088B27047F8B504464148464E3B +:1071B0008288C3880089D21A401E0240C806002176 +:1071C0006170050E832192B2A01C217095420ED9E8 +:1071D0003178C9091CD001216170D1080170471CA8 +:1071E000D5B2072200213846FBF7ADFEF81D29462F +:1071F00003F05FFD3078C00910D02E488188C28826 +:107200000089891A401E01400804000C02D005E0E4 +:107210000020F8BD20782021084320700120F8BD0F +:1072200070B5244D0446A888E988401A2989491E6A +:1072300008400004000C17D0822020700821601C38 +:1072400003F037FD20480078C0090CD0A888E988F1 +:10725000401A2989491E08400004000C03D12078F7 +:10726000202108432070012070BDF8B59446154ACE +:1072700006461D461278CB082120520603D5002E63 +:1072800024D13120F8BD0E4AB40012594032147A8C +:10729000A4061BD4D2799207920F022A16D8162080 +:1072A000F8BD0000780000205B2500006C0700207E +:1072B0007C0700209C070020B800002098000020D8 +:1072C000580400208700002089000020FB4CA27A8F +:1072D000E77A002A09D0012A2ED0022AE0D1F84804 +:1072E0000078C0090AD01F20DAE7E80708D0FF2F8E +:1072F000F9D1D80088420AD1E6720AE0E80701D045 +:107300002020CDE7B74202D1D800884201D03320F7 +:10731000C6E7EC4A60461067EB4881802573012080 +:10732000A072FFF786FAE907BAD05028B8D0FF213B +:10733000E1720021A172B3E72220B1E7DF49897A27 +:10734000002901D01F2103E0DE4A002150670170AF +:1073500008467047D948807A002801D01F2070471E +:10736000D84A0020506770470B78042B01D9302091 +:10737000704730B4D54C850062595B064032507A74 +:107380005B0EC009C001184350726259400649782B +:107390004032400EC9010843507230BC0020704793 +:1073A0000A79042A01D33020704700B5C74B80000A +:1073B0001B5890002E3018180422FEF75FFF0020A3 +:1073C00000BD8200C148835859718058C278920725 +:1073D000920F022A01D0090A81717047BA490880C8 +:1073E0007047B9490A7802700988090A41707047E4 +:1073F00070B5B64C850066592036F1726659203654 +:107400003273625920325373FFF761FB70BDF0B4E1 +:10741000AC48002305781A46002D2DD9AB48042727 +:10742000990046580D24347744585B1C62774458C1 +:10743000DBB2A7771D244658640234834658748310 +:1074400046580324F47744584034A2704658022426 +:107450004036F4704458203422714458203462710C +:1074600044582034A27144582284445862844158BC +:107470002031CA71AB42D3D390484273F0BC7047FD +:1074800010B40A781307820090481B0F84582377A2 +:107490004B7884581B071B0F63778B7884581B0726 +:1074A0001B0FE377CB7884581B071B0FA3774B790F +:1074B0000C791B02234384582383CB798C791902DE +:1074C00080582143418310BC704782007F48835815 +:1074D0001B7F1B071B0F0B7083585B7F4B70835800 +:1074E000DB7F8B7083589B7FCB7083581B7E0B7127 +:1074F00083581B8B1B0A4B7183589B7E8B71805862 +:10750000408B000AC871704710B40A78D407820013 +:107510006E48E40F835840339C7083584978403359 +:10752000D97080584030022901D90221C17010BCA5 +:10753000704782006548835840339B780B708058B1 +:107540004030C078487000208870C8700871487159 +:107550008871C8717047F0B45A4900234A7A5B4970 +:10756000840094461D4690420CD10A59FB272032D4 +:1075700016797608760016710A5920323E40167147 +:107580004E4A55730A594726B65CB707BF0F022FFC +:1075900010D0F043800756D1107FC00733D04C483D +:1075A000F60626D5168C178BBE422CD386421DD1EB +:1075B00002231CE0434E604502D1F079082810D028 +:1075C00020329079401CC6B296710A59107F00078C +:1075D0002CD51046927F2030964227D30123857107 +:1075E00024E0107F00072BD5012329E00123158417 +:1075F00009E0568C578BBE4205D3864201D1022347 +:1076000000E001235584085920304279521CD6B23B +:1076100046710A59107F800708D51046527F2030E6 +:10762000964203D3FF2E10D00123457108594030F4 +:10763000C0798207920F022A02D0C043800702D18C +:1076400008592030C371F0BC70470223EDE7214890 +:107650001E4A007881061B48407A80001058002995 +:1076600003DB1D490978890606D5017F490702D544 +:1076700002212030C1717047014620310A7952073A +:1076800005D5007F4007F6D50120C871704700205E +:10769000C8710A494873704700B50C490F48086023 +:1076A00008490120087048700C490D4A08465830B6 +:1076B00010606D314320FFF755FD00BD980000209C +:1076C0008900002078000020B80000205804002025 +:1076D000FFFF00008C0000208D000020D00400205F +:1076E00080050020F8B58446FE4800250570FE4858 +:1076F000FF260090C671FD48FD4C021D29460F2350 +:107700008F00E55116700832491C5B1EF8D16146A6 +:107710000127F84C00290CD0F849F74A0A60783163 +:107720000A4627706770583202606D314320FFF7B8 +:1077300019FDFFF792FCFFF76AFEF149002008707F +:10774000F04A02211170FF212171EF4A6071F04B64 +:1077500017701870EF4BED4A1870EF4B1870EF4B25 +:107760001870A070E07020726172ED4908700D21F0 +:10777000E1760321A1762077EA48A08600988170FF +:107780000A20107072B6FEF7F8FA62B6E64E0020D4 +:107790003146FFF7B1F9E54F012569007E52617A64 +:1077A0003046FF2907D0D54A890051584A7BAA4262 +:1077B00001D1FEF788FB6D1CEDB2082DEDD30099C9 +:1077C00000200871411EE186D949DA4A0870217803 +:1077D000491E1170C949FF2613789C000D59403588 +:1077E000A8710D594035E8710D59403528720D5971 +:1077F000403568720C594034A6725C1E1470002B20 +:10780000EAD1F8BDF0B502784378048941680F2ABF +:1078100021D893421FD8002A1DD000291BD0002C4C +:1078200019D018461525684384460846022A06D909 +:10783000951E002D03DD582555436818B038002BE0 +:1078400000D06044401A80B2A04204D8201A864674 +:1078500080B2402801D20020F0BDA648A74C02709B +:1078600043700020A44F08E0582545438600ED19D9 +:10787000401CC0B2A551022801D29042F4D3951EFB +:10788000002D10DD0020EDB2582646438700761803 +:107890003F19401C6D1E2D06BE602D0EF4D15820E0 +:1078A00042435118B039002B15D0A3480022DC0701 +:1078B00002D00830012201605B080BD0152454432C +:1078C0006418846015341030921C5B1E1B06046023 +:1078D0001B0EF3D16144704680B2FFF743FC0120D8 +:1078E000F0BD89490A780243C0060A70000F00D033 +:1078F0003320704784490A7882430A70704782486F +:1079000000787047814800788006C00F70477F4834 +:1079100000780007C017401C70477849800008585D +:107920004030C079704775498000085840308079F0 +:107930008006C017401C704710B50C466F49800088 +:107940000958204603F052F9A0784006400EA07076 +:1079500010BD6A4980000858C078704781006748A8 +:107960004158088A4031C979C90601D55B3080B2D7 +:10797000704768480078C006C00F704710B55A4C71 +:107980005E4AE0718000105803F030F9FF20E0718A +:10799000002010BD70B5594D0C468600A9594A8A81 +:1079A000A2420FD20B8A9A1A0A82A95912190A8284 +:1079B0005049497A884205D154480078000701D5DA +:1079C000FEF749FDA859448270BD4C498000085813 +:1079D000408A7047494A80001058403041717047D2 +:1079E000464A8000105881757047444A80001058FC +:1079F000818270470907C90E404A80001058C1753E +:107A000070473E4A800010584030017170473B4932 +:107A100080000858403000797047384A8300D258B7 +:107A2000C9074032D379090E5B065B0E0B43D37155 +:107A3000304A527A904205D1404802785206520E9E +:107A40000A43027070470B4600B52C498000095864 +:107A50000822491D1846FEF711FC00BDF0B4274B63 +:107A600080001D584724645DA40702D0F0BC152097 +:107A70007047082A02D3F0BC292070470024203523 +:107A8000EC771D5842262035AE771E58B02540367B +:107A900075701E58022540367571FF261F583D36F9 +:107AA000BE821F580A26BE751E580909F4751E5855 +:107AB0000901403634711E58491C35711D58403536 +:107AC000E97101211D584903698219584A731958EF +:107AD0004C711858C1788907890F022900D0847128 +:107AE00017482FE0A000002098000020800500200B +:107AF0009404002078000020D004002058040020C6 +:107B00008E0000208F0000208600002087000020CB +:107B100088000020890000208A0000208C000020BE +:107B2000850000208A0C00005B2500005C07002017 +:107B30009D0000208B00002078050020840000209C +:107B4000970000200470F0BC00207047F8B50C4688 +:107B5000FA4A8100535840331C725558630713D5B5 +:107B600000232035AB7255584B262B8557580323DD +:107B70002037FB725758272520373D735158203145 +:107B80004E731946FEF7A3FFC820044201D03320EC +:107B9000F8BDA00602D5EA49002008710020F8BD12 +:107BA0008300E648C1584031CA799207920F012AF2 +:107BB00001D0152070470022CA71C05840300272AF +:107BC00010467047F8B5DD4C05468600A0590146C1 +:107BD00040310A7A920604D4C9798907890F0129AC +:107BE00001D81520F8BDD64F0621FD7120308172D5 +:107BF000D448417A8D4205D1D348102201781143EF +:107C000001701AE001798D4201D1FF210171A05963 +:107C10004030C17989088900491CC1710721284673 +:107C2000FEF7F3FEA0590079000603D50621284689 +:107C3000FEF7EBFEA15902200871FF20F871002029 +:107C4000F8BDF8B50446C1480078800601D5192072 +:107C5000F8BD0020FFF716FA0028F9D1BA49FD2235 +:107C600008781040E207920F10430870B34CB848F0 +:107C7000216802F0BBFFB34901200B78012B0DD91D +:107C8000202602278200A158401C40318D79C0B2C5 +:107C900035438D71A15898420F71F3D3A948112132 +:107CA00001720020F8BD70B5A54CA649E0714A7A72 +:107CB000FF25022190420AD1A64A1278002A02D05A +:107CC000E571002070BDA44A1170A44A11709B4A4E +:107CD0008300D6583171D158202340318A791A4314 +:107CE0008A710621FEF791FEE571012070BDF8B59D +:107CF000994900240B789A495D06097820D4002818 +:107D000007D0480703D5C80601D4382413E005245A +:107D100011E093484A0706D5CA0604D43924F7224D +:107D20001140017000E00624980604D48D480178C3 +:107D30008906890E017002208749012208704AE0F5 +:107D4000844B1B78002B46D0002805D048072BD544 +:107D5000C80629D538242AE0480703D5C80601D526 +:107D6000392400E0042477498878CB78497A98420E +:107D700011D07D4A4500AE187778802F04D1555D2B +:107D80008D4201D1FF257570401CC0B2202800D360 +:107D900000209842EED1694889004058EF224030D7 +:107DA00081791140817102E0002002F0B8FF6F4933 +:107DB000EF250878684B02469206D20F2840120140 +:107DC0001043DF2210400870C81D00781870881D0D +:107DD00000780007C20F5B480D21C1760027634B76 +:107DE00007761D78F7263540614E06213770761CE0 +:107DF0003770F1706906490E1970591C0B78BF2550 +:107E00002B400B70C91C0B785A49067FDD0705D043 +:107E100002252E4306770E782E4304E0FD252E40E2 +:107E200006770E782E400E70382C01D0392C04D1F4 +:107E30004B49FB260D7835400D70464D3F492F705C +:107E4000407AD20785004E59920E33714959DF2589 +:107E500040318B792B4013438B712146FEF7D5FDC2 +:107E6000F8BD3C480078002801D000203FE770476B +:107E70004378032B01D93320704710B4314A9376ED +:107E800083789C080FD1C478002C0CD10479002C85 +:107E900009D1137743799C0805D18479002C02D14C +:107EA000C479002C02D010BC3320704753770A29C4 +:107EB00004D3437A047A1B02234393860B2902D30B +:107EC0001F49827A8A70294900780A78BF23C0073F +:107ED0001A40400E02430A7010BC00207047002276 +:107EE000002812D01748837E0B70037F4B708A7076 +:107EF000CA70437F0B714A718A71808EC871000A03 +:107F000008720F488078487204E0032008704870B7 +:107F10008A70CA7000207047F7B50C4A0C464109B8 +:107F2000C606127800274901F60E82B0520623D504 +:107F3000002E30D1312005B0F0BD000058040020E3 +:107F40009800002078000020890000208700002091 +:107F5000C40000208E0000208C0000208F00002034 +:107F6000840000208B0000200806002088000020EC +:107F70009700002096000020FE4AB300D2584032FD +:107F8000137A9B0607D4D2799207920F022A02D85D +:107F9000162005B0F0BD620702D0272005B0F0BD65 +:107FA0000A0600D5012749060A0EF34D0092697AA8 +:107FB0000DD0F24A009B12789509AD019D4242D046 +:107FC000EE489106890E0170202005B0F0BDFF2912 +:107FD00002D01F2005B0F0BD082282213046049B4C +:107FE000FEF733FB5028F5D1E5490A78530608D54A +:107FF000E44B1B78002B19D05B0702D420231A43D3 +:108000000A70E1496E7200228A80CA80DF490A78CC +:108010005206520E0A70891C0A789206920E0A7055 +:1080200004990831083CE4B2049116E010231A4385 +:108030000A70D74A002111702970D6498A8E4A8663 +:10804000A9786970DDE7B14202D0212005B0F0BD0A +:10805000CD498A88CB889A4204D1CB490989491EE7 +:1080600089B206E00989D21A8A1A491E0A40521EAC +:1080700091B2C900A14202D2222005B0F0BD002F6A +:1080800005D0BE490A789206920E0A7006E0009961 +:10809000C029BA490A7814D040320A70002C04D0A2 +:1080A000224600200499FEF786FB5028E5D1002FD8 +:1080B00004D0B6488022017811430170502005B0E9 +:1080C000F0BD5206520EE8E7F7B58E46AB49097887 +:1080D0008A0994467246082A02D9272003B0F0BDC7 +:1080E0004209C406AC4852010078E40E400604D5AB +:1080F000002C11D1312003B0F0BD9E48A300C05820 +:108100004030037A9B0607D4C0798007800F02288D +:1081100002D8162003B0F0BD8226100600D5A02696 +:108120005006954D070E687A024643D093488B0956 +:1081300000789B018006800EBB4204D08F490870F6 +:10814000202003B0F0BDB30602D58C49087004E0CE +:108150008A48C02F11D0403101708648A100405894 +:108160000079000620D5A2420AD172463046029913 +:10817000FEF721FB502804D10DE04906490EEBE73C +:1081800021207E490A7893069B0E62469201134392 +:108190000B7003B0F0BDB106FBD57C4980230A7893 +:1081A0001A430A7003B0F0BD7848202201781143C9 +:1081B000017004E0FF2802D01F2003B0F0BD72461A +:1081C00031462046029BFEF740FA0346002F1FD19E +:1081D000502B1DD16A48002201784E06002E08DA85 +:1081E000861D3678002E16D0760702D4202631431D +:1081F000017065486C728280C280644801784906CB +:10820000490E0170801C01788906890E4031017089 +:10821000184603B0F0BD1026314301705C4802706F +:108220002A701F38818E4186A8786870E1E7F8B51A +:1082300004460020207069464870544B5548197810 +:1082400082784D0705D4C578AA4202D168460088D5 +:10825000F8BD5500514E521CAD192D886E46D2B254 +:1082600035808270202A01D300228270FB200140D9 +:1082700019703778A7707678404D802E11D0832EF4 +:1082800076D0842E74D0802E06D203202070402019 +:1082900060700120E0702671382E6AD0392E68D0C7 +:1082A0000EE1092020703348BE0081594F20475C01 +:1082B00050310822E01CFDF7E1FF2E48815920468D +:1082C0004B310C3002F092FC2A48EF2281594031A8 +:1082D000887910408871274989594031C979490600 +:1082E00028D4390626D5800708D52878CF2108401C +:1082F0002870B80602D54F20607012E050206070E0 +:108300002020074028783022790002400A4351009B +:10831000A2780A438106890FA270032907D0103082 +:1083200028700020E072A078400905D0C8E0DF2165 +:108330000840F5E74E20DFE7194900200A78D10907 +:1083400002D08020E0720420510632D5E17A402329 +:108350001943E1722318202119730649401C8B59D7 +:10836000C0B2403325181B78401C2B73C0B219E0F3 +:1083700042E086E058040020980000208B00002096 +:10838000880000208E0000209C070020890000202B +:1083900097000020780000208700002008060020B9 +:1083A000860000208959231840314978401C1973F0 +:1083B000C0B2910618D5F84920258A59138AE27A65 +:1083C0002A43E2728A59518A591A4032D27989B2C3 +:1083D000D20601D55B3100E0153189B22218117344 +:1083E000090A801C5173C0B2E17A002901D0401CF7 +:1083F000C0B22178081862E0E849842E08798446E2 +:1084000033D04879891DC006020E2270E01CFDF7AA +:1084100035FFE149BA008858EF2640308379334070 +:1084200083712078401C2070885840308079800704 +:1084300003D52878CF2108402870722060706046EC +:108440002021084041002878302202400A43510090 +:10845000A2780A438106890FA27003290ED010303A +:1084600028708020694648702AE08879CC49C00687 +:10847000020E2270E01CFDF701FFCAE7DF21084071 +:10848000EEE70422C749601DFDF7F8FE2078001DC5 +:108490002070382E14D1C049B80009584031C9792C +:1084A000C9060DD5C0490858407C022808D120468D +:1084B0001322BE490930FDF7E1FE20781330207009 +:1084C00021460098FEF715FE009068460088F8BD2A +:1084D00010B5FEF79AFA10BDB548407A70470228E9 +:1084E00001D333207047B34A10B5C000801803F0A1 +:1084F000EBFC002010BD022801D333207047AD4AA9 +:10850000C000821810B50846114603F0DDFC0020BB +:1085100010BDFF2903D0CA06D20E022A06D29E4AF7 +:10852000800010584030817200207047332070471F +:10853000FFB5054681B09E4802999F4A40789A4B04 +:10854000002954D09D490978490614D50499002979 +:1085500011D0AC001946095900291AD1002818D9A0 +:10856000471E1646CA0093191B79AB4211D0FF2B48 +:1085700004D0B94209D1332005B0F0BDC80031584C +:10858000894801519019057103E0491CC9B2814223 +:10859000E8D3814808230159834E4031CA79012725 +:1085A0001A43CA7132590399117400594030C07985 +:1085B000C006002878DB304602592846802108434F +:1085C0001021FFF7A9FC5028D6D1794902200A7F53 +:1085D00002430A777A490A7802436F480A700359BE +:1085E000784A197910780E46864328D029E0002170 +:1085F0006F4C002810D9CE00B6183679AE4207D19C +:108600000020AE009851FF20C9008918087103E0CE +:10861000491CC9B28142EED3607A854204D16A48CE +:10862000F7220178114001705B48A9004058F722F9 +:108630004030C1791140C171002005B0F0BD384310 +:108640001070554839431971005904224030C179DE +:108650001143C171544802990359597403590021B7 +:1086600099740659049BF374005901755048407A77 +:10867000854242D1544D2878104328700398102227 +:108680000101524809185248FDF7F8FD2878F721F2 +:108690000840414909594031C9790907C90FC90042 +:1086A0000843287029E0FFE73059102102F081FDCE +:1086B000315910224748FDF7E1FD315900208874F7 +:1086C0003159CF74315908753948407A854214D1EF +:1086D0000398102201013D4809183D48FDF7CEFDE1 +:1086E0003948F722017811402B4A12594032D27989 +:1086F0001207D20FD20011430170002005B0F0BD67 +:108700000F2801D33320704730B5054602012F48AA +:10871000101804461022FDF7B1FD2548407AFF28C5 +:108720000AD0214980000858007CA84204D1214683 +:1087300010222748FDF7A2FD002030BD10B500280B +:1087400005D0012807D0022809D0332010BD2248C7 +:1087500002F04CFA03E013221448FDF78FFD0020CD +:1087600010BD10B50B46002809D001280AD00228F8 +:1087700004D113220D491846FDF780FD10BD0220DB +:10878000087010BD1449184602F030FA10BDA42933 +:1087900024D2332070470000580400201804002021 +:1087A00026040020CC00002094040020480600206D +:1087B00078000020F80500208005002088000020B7 +:1087C000960000208C000020840000206B06002012 +:1087D0006C0700207C070020C800002070B4FE4D0C +:1087E00000222B78002B0DD9FC4E940034594034D4 +:1087F000247AA40602D570BC15207047521CD2B250 +:108800009A42F2D3002803D0F54A1071E98602E0BB +:108810000020C043E88670BC00207047F04A1279FF +:108820000270ED48C08E08807047EE4A002811782B +:1088300002D00220014301E0FD2001401170704789 +:10884000E9490870704770B48200E44882581046C5 +:108850002E304032557A6A06520E29D00478012310 +:10886000002C02D14678002E07D00E78A64203D104 +:108870004C784678B44200D000238478002C03D092 +:108880008E78A64200D00023C478002C04D0CE7885 +:10889000A64201D0001D05E0001D002B02D0E80912 +:1088A00006D008E0521E1206120ED7D1E80902D0F7 +:1088B00070BC0120704770BC00207047F8B5CB48F1 +:1088C000CB4A00781378C407CA48C34D017802D058 +:1088D000D8070FD10CE0C748CC067DD5EF24214046 +:1088E0000170580840001070287F800775D4D0E2CE +:1088F000C80671D5687AB94E80003158BE4CBF4F5A +:10890000BF4802F073F9BF4800784107B44873D5F7 +:10891000B84909788C46C9066FD502780223032A24 +:108920006FD006DC002A09D0012A30D0022A7DD17E +:1089300039E0042A7BD0FF2A78D116E02178641C24 +:1089400022295CD12278AB7E61789A4201D22A76C4 +:1089500000E02B762A7F13468B4350D16B7FAA4CC5 +:1089600019400A432270FF2144E02178222946D190 +:10897000297EA54CC900891D69762178A34A8B08F8 +:108980009B0089071370890F2170FE2109E021786F +:10899000242966D19D4901230A781A430A70FE21D1 +:1089A000C170017084E02178641C292959D1974A4B +:1089B0001178194311702378641C22789449641C3F +:1089C0000A7022784A70641C22788A70641C2278AB +:1089D000641CCA70012B01E05BE210E00FD0697AE1 +:1089E00023788A008B4989580B708A4B61789A5892 +:1089F0005170032101706BE07CE110E201E0052081 +:108A0000F8BD2178641C2A292BD1804A117819439A +:108A10001170697A7F4A89005258237893707D4A91 +:108A200063785258D370A3787A4A01E019E014E0D1 +:108A300052581371774AE37852585371754A237923 +:108A400052589371734A63795258D371714BA2791A +:108A500059580A72042101703AE02178641C2B29CC +:108A600002D0FE2A24D033E0684A117819431170ED +:108A7000697A684A8900525823785372654A637844 +:108A800052589372634AA3785258D372614AE3787A +:108A9000525813735F4A2379525853735D4A63796E +:108AA000525893735B4BA2795958CA73FE210170D7 +:108AB000554C2278002A0BD00121D307DB0F04D1BB +:108AC0004906090E13460B42FAD001708A43227000 +:108AD000007803287ED004DC01282AD0022804D1A3 +:108AE0009FE0042877D0FF2805D042486146EF2256 +:108AF0001140017001E23E490122087810430870DC +:108B0000387020207870287EB8703F4804220078A2 +:108B1000F870002038717871B871F87138720D20D2 +:108B20006876687A800030582030017911430171ED +:108B3000AAE1288F0007000F0C2800D90C20C11CC7 +:108B4000CAB235490A70009202462A32D2B2CA70BD +:108B5000322A01D13022CA706A7A92009446B25801 +:108B60002032947F23071B0F43400C2B00D90C238A +:108B700018461030C2B22730C0B24A700871392886 +:108B800002D04D79422D01D1801E08712009584034 +:108B90000C2800D90C2003461D338B704430144D33 +:108BA00048712C78012634432C703C7023247C704F +:108BB000FE24BC70009CFC703A717B71CA78BA715B +:108BC0000979F971387205486146405820300179B9 +:108BD000042223E04AE06BE07800002058040020E3 +:108BE00098000020870000209D0000208D000020BC +:108BF0008C000020880000203B040020FE030020A1 +:108C0000FA0300208E00002096000020970000202C +:108C1000CC00002094040020F000002011430171DA +:108C200032E1FE490122087810430870387026208E +:108C30007870687AFA4980000958497CB970F94916 +:108C40000A78FA704A783A718A787A71C978B97173 +:108C5000F5490A78FA714A783A7289787972305807 +:108C6000042220300179114301710DE1EB49012209 +:108C7000087810430870387027207870EA4804227A +:108C8000C178B9700179F970417939718179797157 +:108C9000C179B971017AF971417A3972807A787241 +:108CA000687A800030582030017911430171EBE07F +:108CB000DA4901220878104308703870282078704B +:108CC000D9480422C17AB970017BF970417B3971AE +:108CD000817B7971C17BB971017CF971417C3972F9 +:108CE000807C7872687A8000305820300179114396 +:108CF0000171C9E022217970A97EB9700321F97050 +:108D0000002139717971B971F9712178641C2039A8 +:108D100009297DD20B007B441B79DB189F4404EDAD +:108D2000ED17EDED4082BB0021782976BF4A6378CC +:108D300013700622C270C800801D6876687A04220B +:108D40008000305820300179114301719CE0217876 +:108D5000C170B74967780F700097A7784F70BE460B +:108D6000E7788F702379CB7062790A71A4794C719E +:108D7000BC46B04924274F71C0788871009FCF71DD +:108D800077460F7267464F728B72CA720C73687A9D +:108D9000042280003058203001791143017173E0C2 +:108DA000687A9F4F8200BB5821785974A249637832 +:108DB0000B70A3784B70E3788B702379CB709A4952 +:108DC00063790B70A3794B70E3798B70B9589B4C26 +:108DD000497C012901D0022922D19749FFF733FDAF +:108DE00000281DD000202921217060708D48017855 +:108DF000A1704178E17081782171C0786071687AE2 +:108E0000800039580978A17139584978E17100E03A +:108E100073E030580422203001791143017133E0AE +:108E20000120E0E780482178C17061780171A17864 +:108E30004171E17881712179C17161790172A17902 +:108E40004172E17981727B482A214171697A744AC1 +:108E5000890053589B7883715358DB78C3715358FA +:108E60001B79037253585B79437253589B79837211 +:108E70005358DB79C3725258127A02737058042225 +:108E800020300179114301716D48082201781143A6 +:108E900001700220F8BD64482178C17261780173C5 +:108EA000A1784173E17881732179C173617901748B +:108EB000A1794174E17981745E482B214171697A0D +:108EC000574A890053585B7A837153589B7AC37110 +:108ED0005358DB7A037253581B7B437253585B7BA6 +:108EE000837253589B7BC3725258D27B0273705863 +:108EF0000422203001791143C5E7687AFB22800003 +:108F00003058203001791140BDE7F8B54D4801785F +:108F10004A064D49520E0D78AB07DB0FDB011A43B1 +:108F20000270E8090AD049483C4C0278207893073F +:108F300019D0014669404B0601D40520F8BDC90689 +:108F400002D4410602D503E0410601D50320F8BD55 +:108F5000A90606D5510701D50420F8BD20210843F4 +:108F600020700220F8BD50210D4201D00720F8BD2D +:108F70003749384B08700D21D976002230491A76CE +:108F80000978F7263140294E3270334E3270B77867 +:108F900077709E8E5E86DF260E40C906C90F490196 +:108FA0000E43EF210E4026490E7071061AD52B4E46 +:108FB000012720491F7637780F7077784F70B77880 +:108FC0008F70F678CE7003260E7122274F719B7E2C +:108FD0008B71CE710A724A728A72CA720A73012147 +:108FE000084320701E4E3078010714D5E90712D0CF +:108FF000C00610D51B4802F05DFF08221A491B4825 +:10900000FDF73CF9194910221948FDF737F9307876 +:10901000042108433070207800072BE08C000020EA +:1090200094040020C800002048060020970000207B +:10903000F0000020FA030020CC000020FF030020F5 +:1090400088000020870000208D0000208E00002076 +:109050008F000020780000209800002036040020B7 +:109060008400002063060020F60000205B0600203C +:109070007C070020FE49000F09780909090108430F +:1090800020700120F8BDF8B50546FA48FA4C007882 +:1090900001071DD5400708D5F5480078000704D51D +:1090A0000822F649F648FDF7E9F8E07E0146801F00 +:1090B000082805DDC2B2F3480123811D801D05E0AB +:1090C000491FF048CAB2411D0123401DFDF7FCF8BD +:1090D000012D01D0002D36D1EB48FB220178114043 +:1090E0000170607A8C468100E84841584A20405C13 +:1090F000FF2828D0C206E34FC0093B79D20EC00139 +:109100001E0608D500281ED0A02098431BD1E04899 +:109110000078800717D1DF4B0020D200D318024619 +:109120005032D84F8E5C1A5C3F187F79164017403A +:10913000BE4208D1401CC0B20828F0D3D2486146D4 +:10914000042211430170022D01D0042D04D1FFF738 +:10915000B5FB022800D00546002001220227CE4E92 +:10916000CE49082D77D22B007B441B79DB189F4416 +:1091700003072DAFECF19E0501F0BDFD0020F8BD09 +:109180003078502148403070607AC04985004C5991 +:10919000BF4B4034A0793843A0718406E40F49598D +:1091A000E40022431A70DF22403110408871B14838 +:1091B0000078410701D5C00605D4AD480078800687 +:1091C00001D401F098FDFDF74DF8B9E0B04B0C2546 +:1091D0001A782A403A431A70327810235A40B04D18 +:1091E00032702B781F0702D58878487000E04870ED +:1091F000AC48BF27017839400170500607D59C481C +:109200000078800650D4012001F089FD4CE0D8069A +:1092100003D5802003432B7042E0D00726D0A24F15 +:10922000217E381DFDF7C0FF002815D03078397930 +:10923000DF22084330703871A08E6086607A81002A +:1092400092484058403081791140817128788021BE +:109250000843287024E07DE0607A202281008B485A +:109260004058403081791143817119E0607A874D0F +:1092700080002858001DFDF7D3FF002808D0617A30 +:109280003078890069580A7910433070087107E016 +:10929000607A202280002858403081791143817102 +:1092A0008521607AFDF7B1FBFEF7D1F948E0784AF5 +:1092B0001278520702D43278920646D4627A93002A +:1092C000724AD25840329279D20601D46D4A507116 +:1092D0006F4A107803091B01502B3BD2931F1B7858 +:1092E0001B0718D5638E002B15D045070FD48507B3 +:1092F00011D0657AAE00654DAD594035AD79ED06BA +:1093000009D5252168485B1E4171638612E05D4DD9 +:109310006D79252D16D01030C3B2180900011370D5 +:10932000502807D34878002804D01B071B0F137060 +:10933000401E487010780321800880000843107098 +:109340000120F8BD5B1E6386F4E70120FEF7CFFC29 +:109350000020F8BD0020FEF7CAFC0FE7534909784A +:109360008A07484907D4C278002A04D0CB789A42A9 +:1093700001D00020704730B48478424B62069B785D +:10938000520E03D05D066D0E954212D10278002A6E +:1093900005D14578002D02D15C40230606D50B7817 +:1093A0009A4206D140784978884202D130BC0120E7 +:1093B000704730BC0020704770B52F4D298F401882 +:1093C00084B2698FE86DFCF7C7FE401C83B2384851 +:1093D000F7220178CE07002E02D02C8711400DE035 +:1093E000294E367836070BD4E31A01269BB2F603D2 +:1093F000B34205D9114001222C871143017070BD81 +:109400002C8701F0C0FB70BDF8B519481F4D0778D7 +:109410001538437A1B49980028580C791449064698 +:109420000C701539CA790F310E360978052A7DD0AE +:1094300006DC022A5AD0032A3FD0042A55D15CE226 +:10944000082A43D0122A50D10E490B4C1846FFF778 +:10945000FAF9002849D0607A800028584030817994 +:10946000CA0642D4C90928D000214156012221E070 +:109470008D00002084000020780000203B040020A4 +:10948000F600002036040020870000205804002049 +:109490008E000020F80500208C000020980000209D +:1094A0008800002089000020FA03002085000020A9 +:1094B000A00000208256914217DBFE4F3878C0068C +:1094C0007ED5FD4CE07903287BD118E1C9060CD488 +:1094D000018A428A8918F94A89180182002030805D +:1094E000F7480322017811430170F8BDC90669D518 +:1094F000210767D540308279FD231A408271F148F7 +:10950000ED49027813090A781B011407240F23433D +:10951000521E0370D4B2A700E859FFF71FFF0028BE +:109520005AD0E85901464031CA7900E078E1132366 +:109530001A40032A02D0022A0BD04DE0E148DE4A4D +:1095400001781278090909011207120F11430170FD +:1095500047E0D94A1279A2420FD084462030837F57 +:109560009000285800902030827F934234D1009898 +:109570006246527B407B82422ED1D248007802075D +:10958000CD48120F0078824202D0087AC00723D15A +:10959000CD492046FFF757F900281DD0E859403043 +:1095A0008179C90910D0C4490022497A0123890070 +:1095B0006958C35640318A569A420DDB097802E059 +:1095C000E3E0A0E061E00170BE49220708780009ED +:1095D0000001120F104308702046641EE4B20028F8 +:1095E00099D1B848B44A017812780907090F914215 +:1095F0004BD0880028584821095C2C46C90726D141 +:10960000B04FB14901F0F2FA38780107090F8B0029 +:10961000E25803204032D7790743D771E2584032ED +:109620009379DF0902D05B065B0E9371A24A537AED +:10963000994205D1FF2313710C3213780343137041 +:10964000084601F0F1FBA1480078C0091DD19D4FEB +:10965000472138780007800E2058095C890614D409 +:10966000994A002111714B300D229749FCF706FEF3 +:10967000387810230007000F8100615840318A7943 +:109680001A438A718021FDF7C0F98B48407A810026 +:109690006A5840325279FF2A00D126E732780A2AE6 +:1096A000FBD30A3A32708A4A1378DC0712D07478F6 +:1096B000641CE4B274706F5840377F79BC42ECD3BD +:1096C0005B085B001370002272706958897D002965 +:1096D0000CD0F8BD6A58927DFF2AFAD07278521CDD +:1096E000D2B272706958897D8A42F2D379491023C7 +:1096F0000A781A430A700121FDF787F9F8BD73480B +:109700000078000741D5607A80002858FFF726FED0 +:1097100000283AD0607AFD238100695840318A7967 +:109720001A408A7101F080FB012001F057FB0028EC +:1097300019D0E079122807D166480078800703D550 +:109740006248007800070ED50620E0715C4800787A +:10975000C10901D1400602D501F0CDFA03E0FFF7BF +:10976000D4FBFFF790FC3878400707D556480179BD +:10977000607A800028584030C173F8BD607A524941 +:10978000800028584B300D220CE138784006F4D484 +:109790004948514B407A02218200AC58678A9F4267 +:1097A000737814D95B1CDBB27370042B28D3444943 +:1097B0000B789B089B009B1C0B70AB580821DC7D31 +:1097C00064086400DC75AA580023D38118E03F0ABE +:1097D000FF18FFB2BB4201D17F1CFFB2BB4201D2D6 +:1097E00077700DE036490B789B089B009B1C0B7033 +:1097F000E37D08215B085B00E375AA580023D38151 +:10980000FDF703F935480078C009B6D02C48007838 +:109810008007800F0228B0D10020FEF768FAF8BD5B +:109820000624C90610D5FFF799FD00280CD0224860 +:10983000FD22407A800028584030817911408171A2 +:10984000FFF763FB044601E02048077024480078D6 +:109850004007C70F2046FFF716FC8446062C14D09D +:109860001A480078C00707D01348017E002903D0AA +:10987000C27E15491B4806E00F480D22407A124966 +:10988000800028584B30FCF7F9FC60460028C6D110 +:1098900009480021C1710A49002F097824D0C9065E +:1098A000BDD5062C04D1034980230A781A430A70D7 +:1098B0000B211CE087000020780000200300FFFF40 +:1098C000840000208B000020360400208D00002042 +:1098D00088000020890000205D7400008C000020BA +:1098E0008E00002018040020C90602D40521C17191 +:1098F000F8BD062CFCD10421C1717278002A1DD05C +:10990000FE49FF4B887A497A890069584C8A9C4203 +:1099100000D94008D20902D10A8A121A0A82717843 +:109920004A06520E824202D80020707006E0CA0930 +:10993000081AD2014006400E02437270F1480078C6 +:10994000C006D5D5ED4C607A80002858FFF706FD9B +:1099500000286DD0EC4F3878400769D4607AFD223A +:109960008000285840308179114081710A20E071CF +:10997000E6480078C10901D1400602D501F0BBF9E3 +:1099800007E0FFF7C2FAFFF77EFB002801D00520B1 +:10999000E0713878C00708D0207E002805D0E27E2C +:1099A000DB49DC48FCF76AFCF8BDD6480078400784 +:1099B00007D5D7480179607A800028584030C173B4 +:1099C00007E0607A0D2280002858D1494B30FCF71F +:1099D00055FCD14A1378D807E6D0607AA0278400D6 +:1099E000285901464030C67B3E42DDD0067C442EDD +:1099F000DAD1467C022ED7D1C07C5E0703D5400762 +:109A0000000FC64E02E04007C54E000F305A002836 +:109A100008D00E8A4F8AF61B0E82295936180E82FC +:109A2000295948829807BFD4580840001070F8BDE3 +:109A3000B5480078010701D44007F8D570780028B0 +:109A40001FD1FCF734FAC0B21A2102F044F80746DD +:109A5000FCF72DFA1A214F43C01BC0B24106490E34 +:109A600070700D2905D280210843C009C0017E30E5 +:109A700006E00721C8411921C90640181921C8412B +:109A80007070A1480078400703D570784006400EFA +:109A90007070A449A08F0A785307C8D4238FC01AC6 +:109AA0001330012380B2DB03984201D9032006E082 +:109AB000022801D2022002E00428B8D201200423A7 +:109AC0001A430A70617A890069580A8A101A088252 +:109AD000F8BDF0B48B488D4C0178954F4906490E7E +:109AE00001700F38417A8A008F498A588F49138A4A +:109AF000038615790D7011464031CE792670B40772 +:109B0000A40FC471097A3970F10608D5A41DC47177 +:109B10000824F91D25430D701571DB1E03860021F5 +:109B200001768049FB230A781A400A702021C185FA +:109B3000C1790172F0BC70477248007840067DD44C +:109B4000F0B56E488BB0018F09318FB2017A1029C0 +:109B500001D10C37BFB2417A734A89005158403164 +:109B60008979490703D5018EFF392D390186018E88 +:109B7000791A018600246C49A50048594722125CD5 +:109B80009207920F012A74D9664B1B780593DB0765 +:109B900006D05A4E33799C4202D1338E5A333386E3 +:109BA000038AF91A8EB25549098E8E427ED8032A4D +:109BB00010D05248007907915B49019048590346FB +:109BC00040339C46DB7902469E070E32B60F022ECA +:109BD0006DD0FBE0428A54499A1802824748407A85 +:109BE000844211D14A590020907348594030C079BD +:109BF00000075BD54F484059017D002956D1817C33 +:109C0000C27C89188174ECE08000474907900858AD +:109C10004721095C8907890F02295AD04249468A9F +:109C200048590890408A0090864214D9014630462F +:109C300001F051FF00994143701A00E0F6E00099ED +:109C400080B24908814204D20099081A80B20021EA +:109C500011E001210FE0314601F03DFF0099704312 +:109C6000081A80B27108814204D2301A80B20121F0 +:109C700001E0C1E00021002800D10121089A927B77 +:109C8000521CD3B2089A022B937306D3264A042699 +:109C900052594032937933439371052819D2224E99 +:109CA000079846223058125C520701E06BE06BE0E7 +:109CB00001D500290DD115490A78132191433FD0D0 +:109CC0001A4904200A7802430A701B490A780243A1 +:109CD0000A7009212046FCF798FE1348405940308D +:109CE000C07900077DD5134A00235059C07C002855 +:109CF00077D951590F20CE7B761C1FE078000020C9 +:109D00005D740000870000208D000020840000208A +:109D100036040020180400209D00002044BF0000ED +:109D200034BF000088000020580400208C00002070 +:109D300085000020940400208F000020CE7317E0DF +:109D40000599FA4A4907C4D40599042319431170A7 +:109D5000028AD21E028207983058C17B0029B8D1EE +:109D60007E21C173B5E7401EC0B20E5C761C0E5456 +:109D70000E5C002E01D10028F5D150595B1CC07C2F +:109D8000DBB29842B5D82CE0DB061FD4038A868A62 +:109D9000DB04DB0CF618B6B29E4201D2082300E0C9 +:109DA000730B0093019BA3420CD0FF2B0ED0634694 +:109DB0001B79002B0AD0C37D019880000858C07D14 +:109DC000834203D113780098181810704A59138AE7 +:109DD000908A18181082381A82B20798824200D8E6 +:109DE000ECE6D2480078C00706D0D14801798C4211 +:109DF00002D1018E5A390186CD48641C0078E4B244 +:109E0000844200D2B7E6CA480786407A8300C94830 +:109E1000C058403081794A0702D5FB221140817138 +:109E2000C5490020C95808750BB0F0BD7047F0B5A2 +:109E3000BF4885B0102101720D21C1720179103027 +:109E40000078FF29844603D0C00701D1B849C87102 +:109E5000BA480678BA480090BA480490B448B107A6 +:109E6000447AB948A200007800297AD0B049B84BAA +:109E7000CF79B6491D7809780391B649CB785B1C38 +:109E8000DBB20293AA4B052F5B7E019322D0A84B35 +:109E9000062F9B7907D0092F7AD00C2F33D00020C2 +:109EA000FDF725FF60E1A2490C230B720B469B795D +:109EB000ED095B00002D03D02525EB1ACB7202E0E3 +:109EC0001625EB1ACB7205238B7100075FD5FF2C8B +:109ED00079D149E196480C220272EA0901D00722A1 +:109EE000C2726246120752D5720701D40D2168E092 +:109EF000039AD20705D0029ACA70062A01D100221D +:109F0000CA70C37630E1904CC00607D492480078FE +:109F1000800603D5B007800F012808D084480522A9 +:109F20000272EA0938D02322D21AC27237E0012025 +:109F3000FDF7DDFE00F095FF002828D07C4D0C20B9 +:109F40002872217808071AD5687AFF2817D04907A0 +:109F500008D481007848012240588049FDF754F820 +:109F600008E041E0049801F0A5FF08227C497B4805 +:109F7000FCF784F9794910220098FCF77FF97448BE +:109F80000078C009A87904D07621081AE872EBE0BD +:109F90001AE07821081AE6E03822D21AC272624624 +:109FA00012077AD5720702D50D21C176DCE0039A3B +:109FB000D20705D0029ACA70062A01D10022CA70BF +:109FC0000199C176D0E008E0594905230B72352389 +:109FD000CB72000761D5FF2C5FD057485F4980588E +:109FE0000022FDF711F878E0514D0421EE79761F3B +:109FF000072E52D233007B441B79DB189F44733DFC +:10A00000B4B4030D2500430647D429723521E97203 +:10A01000000742D5FF2CE0D1A6E0297200070CD53D +:10A02000FF2C0AD044484D4980580122FCF7ECFF30 +:10A030004A4910220098FCF721F945480078C009E8 +:10A0400001D03A208FE060208DE0297200070CD506 +:10A05000FF2C0AD03848414980580122FCF7D4FF30 +:10A060003E4910220098FCF709F939480078C009E8 +:10A0700001D04A2077E05F2075E000F0F2FE002872 +:10A0800072D00C20287232480078C009A87905D017 +:10A0900041002520401AE87204E065E041001620E6 +:10A0A000401AE8720520A8712748007801075BD59F +:10A0B000697AFF2958D0400707D41F4889004058C3 +:10A0C00000222649FCF7A0FF07E0049801F0F2FE09 +:10A0D000082223492148FCF7D1F820491022009892 +:10A0E000FCF7CCF840E000F0BCFE00283CD00C208F +:10A0F00028721548007800070ED5687AFF280BD023 +:10A1000081000D48012240581449FCF77DFF134996 +:10A1100010220098FCF7B2F80D480078C00921D051 +:10A120002020E8720620A8711EE0000088000020B0 +:10A130007800002058040020940400208E000020A5 +:10A140007C07002063060020840000209700002088 +:10A1500087000020980000208C0000205B06002073 +:10A16000F60000200D20E872FC4CE07AFFF724F99D +:10A170001020E0721520E085207AE07105B0F0BD76 +:10A18000F0B58FB0F648F54B0690597A0091002152 +:10A1900019721A8F1886093294B2FF20F14A587248 +:10A1A0001070187905901B780A46EF4D9600AE594D +:10A1B0004725AD5DAC46AD07AD0F022D0CD1FF2894 +:10A1C00006D0E94D8700ED59F67DED7DAE4203D90D +:10A1D0006546ED0600D41046521CD2B29A42E4D332 +:10A1E000059A904202D0DD4D00226A71FF283AD0D4 +:10A1F000DD4F85007A590D9240321579D74A56794C +:10A20000B5422CD8002509965E1E02460E96521CB9 +:10A21000D2B29A4200D30022D34E9700F6590C9640 +:10A220004036B446F679B707BF0F022F0FD1F606B6 +:10A230000DD466463679002E09D00C9EF77D0D9E12 +:10A24000F67DB74203D300200990104604E06D1C50 +:10A250000E9EEDB2B542DADBC04A099D5571BF4A88 +:10A2600055796D1C5571059A904214D0FF2A0ED075 +:10A27000BD4F9600BA59D57D6D086D00D575BB4AA6 +:10A280001278D20703D1BA5901263543D5758022F9 +:10A290001043B24A1071B4488A0085584726765D4B +:10A2A000B707BF0F022F02D0032F53D125E0F606C8 +:10A2B00002D5AC4801704DE0A84E37797E06760E87 +:10A2C0008E4247D13E0618D52C82A44DA74E297147 +:10A2D000357845276D086D0035708658BF5D002FB5 +:10A2E00003D001273D43A14F3D70F57DED0704D01C +:10A2F0009E4D2E78760876002E708558974A288ACB +:10A300001679001B80B2B1420BD1984E3678F60711 +:10A3100001D05A3004E01E2801D2002001E01E388E +:10A3200080B24035EE79F643B7070BD1AD796D07B2 +:10A3300008D5FF252D35A84201D2002002E0FF38C4 +:10A340002D3880B2158EA84204D810865172B207FB +:10A3500000D10690491CC9B299429CD37F48457AE6 +:10A36000FF2D09D001798D4206D180490978C907AE +:10A3700002D0018E5A3901867D4800780590800709 +:10A3800056D57648008E0790CB2851D2FF2D4FD05E +:10A390000098FF284CD085424AD0800072490A902C +:10A3A0000F584720C05D0990C043800740D1A800E6 +:10A3B00008584722125CD243920739D1408A019053 +:10A3C0007E8AB04211D9314601F085FB0199704374 +:10A3D000081A80B27108814204D2301A80B205286E +:10A3E00019D316E0032816D313E00146304601F0D6 +:10A3F00072FB01994143701A019980B24908814268 +:10A4000005D20199081A80B2032804D301E0052877 +:10A4100001D300280CD109981321534E8143042203 +:10A4200000294CD00798C12802D9387910433871D7 +:10A430004C480278FF2A58D00698CB2855D9FF2DD2 +:10A4400018D046480079854214D14749AB00CB5813 +:10A450001B8A1B1B9BB2B42B0CD8AD008300C858C1 +:10A46000068A878AF61906824859008A001B80B23C +:10A47000B428F4D93C48960081590B4640331D7AE4 +:10A48000EF0601D4AD062BD50979090604D5FF25C1 +:10A4900006994935A94246D3D97903252943D9716B +:10A4A00081590C822D494A7280594030007A8006C9 +:10A4B00039D53048102201781143017033E02B491F +:10A4C00008784307B4D4FB7B002BB1D10323FB7383 +:10A4D000104308700A983058018AC91E0182A7E704 +:10A4E000B4341E480C8242721DE01C4D288E522846 +:10A4F00019D905981E4908221043087072B6FBF757 +:10A500003CFC62B61C4C207900280CD0288EE98EC9 +:10A51000884208D33A21687AFCF777FA2079012833 +:10A5200001D1002020710D4C607AFF282ED0FFF75A +:10A53000D0FA607A472281000B484058018A125CA9 +:10A54000C904C90C491CD243920717D0828A5018FB +:10A5500080B2884216D2082015E000007800002062 +:10A56000FFFF00008C00002058040020880000201D +:10A57000870000208900002098000020428A50189F +:10A5800080B2E6E7400BA0720FB0F0BDF74C082197 +:10A5900020780843207072B6FBF7EFFB62B6207894 +:10A5A000DF21084020700FB0F0BDF0B5F04EF14C47 +:10A5B00083B0F7272078C10706D1317A122919D044 +:10A5C000318F7187B16DF1654008400038402070CF +:10A5D000307A801E11287CD203007B441B79DB1863 +:10A5E0009F440C113434777711607777853D54FEA2 +:10A5F00077FDFC00F18F7187B16EE4E7308E1E3875 +:10A6000030862920F0852078400840002070707A3C +:10A61000FCF7A1FF707AD84D80002858018A318755 +:10A620002030C07FFBF747FC707A8000285820302C +:10A63000807FFBF744FC707AD04980002858407B2B +:10A640004000085AFBF73FFC0020F07220784008D9 +:10A6500040002070F07AFEF7AFFE0D2030722078B7 +:10A66000C00703D1308F7087B06DF065308FF087F1 +:10A67000B06DB066F08DFEF79FFE0320B071BB4851 +:10A68000EF220178114001700E2001E120780121B4 +:10A69000084320700E20FEF78FFEFEF7B5FE0F2058 +:10A6A00030726AE22078400840002070707AFCF72F +:10A6B00052FF707AB04D80002858018A31872030CF +:10A6C000C07FFBF7F8FB707A800028582030807F2D +:10A6D00000E000E2FBF7F3FB707AA84980002858FD +:10A6E000407B4000085AFBF7EEFB0C2030722078CC +:10A6F000400840002070A2480078800772D0717A2C +:10A700009D4D88002B584620C25C92066AD59D4A12 +:10A710001278D20747D09C48407A884226D19B487D +:10A720000078400622D4317E9948FCF73DFD002890 +:10A730001CD0707A80002958964800F057FA914B47 +:10A74000944918780A79104318700871707ADF21DB +:10A7500080002A584032907908409071B08E7086FF +:10A760008D4880220178114301703BE0708E0028F3 +:10A770004ED0707A80002958864800F037FA814818 +:10A78000802201788348017125214171708E401E1D +:10A7900070868148017811430170401C0178402285 +:10A7A000114301701EE0784A527A8A4230D1181D56 +:10A7B000FCF736FD00282BD0717A72488D006E4967 +:10A7C00000784A596F4913791843087010716A4824 +:10A7D000DF22405940308179114002E09AE060E088 +:10A7E00019E18171707A644980000858FB22001DCC +:10A7F00001781140017063490D78690703D56049FC +:10A800000978002909D05E480078800725D028E023 +:10A81000207805210843207023E0604AFB2113784B +:10A820000D400B401370D21E15700C210170431E99 +:10A830001A7855214A401A70801E02784A400270E8 +:10A84000401E02784A400270401E02784A40027060 +:10A85000207802210843207003E0E80901D0FBF7CB +:10A8600001FD48480078000703D50720FEF7A4FD46 +:10A8700008E03E480078C00901D00D2000E01E200D +:10A88000FEF79AFD2078C00706D0FBF76FFD0F207A +:10A890003072FBF79FFC70E1308F7087B06DF06510 +:10A8A000F5E720784008400020702920FEF784FD5D +:10A8B000308FF087B06DB06600207072FFF709F935 +:10A8C000707A2D4D80002858354900F08FF9707A44 +:10A8D000800028582030C07FFBF7EDFA707A8000A6 +:10A8E00028582030807FFBF7EAFA707A23498000ED +:10A8F0002858407B4000085AFBF7E5FA1B49EF2235 +:10A900000878104040221043087012203072212035 +:10A91000F085BEE7154D2878C0060DD4F18FB06ED6 +:10A92000FBF71AFCF18F0123421A92B2DB039A4221 +:10A9300001D9318700E03087207814494008400071 +:10A9400020701220F07128784006400E2870097897 +:10A95000C90627D510213172BF21084028700A4846 +:10A96000FF214172FBF7B0FD3FE0000087000020AF +:10A9700078000020A0000020580400205C07002080 +:10A980008E0000208C00002098000020890000200C +:10A99000FE030020FA030020880000208F00002022 +:10A9A000C4000020C00620D5FEF72EFDF079062851 +:10A9B0001BD1F9480078002803D100F0D5F9002810 +:10A9C00013D000F0D1F9F54D80002858F44900F07B +:10A9D0000DF9707AF2498000285800F007F9182024 +:10A9E000FEF7EAFC0F20307206E02878EF210840DD +:10A9F0002870307A122804D0207801210843207072 +:10AA0000BBE02120F0852920FEF7D6FC308FF087AF +:10AA1000B06DB0663DE7F079092801D00C284FD120 +:10AA2000E0480178394001708C462178480703D509 +:10AA3000FB200140217043E0707A00908000D74DE8 +:10AA400001902858FB23001D02781A4002708A07E3 +:10AA500014D5FD2211402170421E137855214B4020 +:10AA60001370801E02784A400270401E02784A40ED +:10AA70000270401E02784A40027021E0C648017808 +:10AA800089071DD16146C9090FD05E21017060465A +:10AA9000800615D4C4480078410701D5C0060FD5FB +:10AAA0000A210098FBF7B1FF0AE0019820222858FC +:10AAB000403081791143817103210098FBF7A5FF94 +:10AAC0002078012108432070FFF7B1F9FFF734F82F +:10AAD000FBF7FAFC51E0207841084900B3482170A7 +:10AAE0000278930646D50120014321700C20FEF721 +:10AAF00063FCAD480078000720D5707AFF281DD090 +:10AB0000AB4A81005158897C002917D08300D15865 +:10AB10000F20CD7B6D1CCD7304E0401EC0B20D5CD8 +:10AB20006D1C0D540D5C002D01D10028F5D1D158BC +:10AB3000887C401E0006000E8874E8D1FFF720FBD9 +:10AB400099480078000718D5707AFF2815D0984DDD +:10AB5000800028589749007C10220001411896482F +:10AB6000FBF78CFB707A1022800029589348FBF782 +:10AB700085FB02E05108490001702078C00700D031 +:10AB800018E503B0F0BD10B58D48007A801E11287D +:10AB90001AD203007B441B79DB189F44080808087D +:10ABA0001515081615151624151515080800FBF7B8 +:10ABB000EBFA83480822816D016682480021817189 +:10ABC000814801781143017010BDFBF7DDFA7C4824 +:10ABD0000822816D016601212030817108300178E1 +:10ABE0001143017010BDFBF7CFFA10BD0A78027057 +:10ABF0004A7842708A788270C978C170704773B59C +:10AC00006A461078654B840019594722525CD60673 +:10AC10006A4655780022002E20DA052D05D0062D33 +:10AC200007D0072D03D120318A721859028502B04E +:10AC300070BD0D8D4E8AAE19B6B20E851959AE4251 +:10AC4000F5D820318D7AED1CEDB28D7219590E4672 +:10AC5000B67D2031B542EAD98A7212E0012D0CD0BE +:10AC6000072D16D0082D0CD0802DE0D12031887A08 +:10AC70000628DCD28A7202B070BD20318A7A521C5A +:10AC80008A721A592032937FD17A8B4209D1117B73 +:10AC90000BE020318B7A062BECD2FCF7F3F902B0F3 +:10ACA00070BD147BA34200D1517BFBF710FF02B0B3 +:10ACB00070BDF0B5454C8446E288414F0E46208970 +:10ACC000F96E801A85B25118AE4202D832466046FB +:10ACD00008E0EAB26046FBF7D1FA701BC2B26046E8 +:10ACE0004019F96EFBF7CAFAE08821898019491EDC +:10ACF0000840E080F0BD2D48007840070ED410B524 +:10AD00002F482649407A10238200895840318A7999 +:10AD10001A438A718021FBF778FE10BD704770B529 +:10AD20002B490978C9071CD02A4C002800D02A4C8E +:10AD30002078002801D0012812D1214D1749687AC6 +:10AD400010238200895840318A791A438A71217808 +:10AD50008331C9B2FBF759FE287E2070A88E688621 +:10AD600070BDFFF7C8FF70BD70B515480078401E74 +:10AD70000406240E0ED0094DA00028584621095C77 +:10AD8000890603D4FEF7EAFA002803D1641E2406DC +:10AD9000240EF1D1204670BD8E0000205804002002 +:10ADA000360400208C000020840000208700002052 +:10ADB000940400206B0600206C0700207C07002014 +:10ADC0007800002098000020A00000209C070020B0 +:10ADD0008D0000201D0400203B0400203349497AE7 +:10ADE0008A0033498B58334AD97812788907890FFA +:10ADF000920601D40120704730B42F4A5D7954790E +:10AE00009279AC4207D1022902D09B799A4202D1B1 +:10AE1000012030BC7047002C03D10229F9D0002A50 +:10AE2000F7D030BC0020704710B4214980001F4B80 +:10AE30000A589B8F548A153BE31813820B58002243 +:10AE4000DA8109584031C979090708D51B4A1158D8 +:10AE50008B7CCC7C1B198B7410580121017510BCA4 +:10AE6000704770B51648114C0078114D154E4006CC +:10AE700008D5FBF729FBFFF777FF607280002858A1 +:10AE800000793070307840070BD4607A8000285801 +:10AE900040308079800606D40020FFF79FFF00280D +:10AEA00001D0012070BD002070BD0000780000209E +:10AEB0005804002084000020360400209404002060 +:10AEC000870000208C0000204749096801600020AD +:10AED000704745490860002070470121434A002817 +:10AEE00003D0012803D042487047916300E0D1634A +:10AEF000002070473F49012008603D48801C704792 +:10AF000004223D4B3B49002805D05A6008690122C4 +:10AF10001043086108E008694008400008619A6031 +:10AF200032490020C0318860002070473149062234 +:10AF3000002808D0012809D002280DD003280FD0FE +:10AF40002B48401C70470869904302E00869904311 +:10AF5000801C08610020704708699043001DF8E7D5 +:10AF600008691043F5E723494A6A02434A62002010 +:10AF7000704720494A6A82434A62002070471D494F +:10AF8000496A0160002070471A49CA690243CA61D0 +:10AF9000002070471749CA698243CA610020704780 +:10AFA0001449C96901600020704712490246002017 +:10AFB0004031002A03D0012A01D0072070478A635C +:10AFC00070470D490420886008490020C03188601E +:10AFD0000A4801688022090A0902114301600849F0 +:10AFE000012008607047000000040040400000405D +:10AFF00004200000000500400003004000E400E0E1 +:10B0000000E100E08107C90E002808DA0007000F00 +:10B0100008388008C24A80008018C06904E08008AF +:10B02000C04A800080180068C84080097047BE4947 +:10B0300048788978884201D3401A02E02122511AC7 +:10B040000818C0B27047B8492331487889788842D7 +:10B0500001D3401A02E02122511A0818C0B27047E9 +:10B06000B149463148788978884201D3401A02E0D4 +:10B070002122511A0818C0B27047AA4910B50C31E4 +:10B080000868FF22120290430122D2031043086095 +:10B09000A549002023314870887023394870887092 +:10B0A000463148708870A14800F04CF99F48401C18 +:10B0B00000F048F9FAF735FB00F028F910BD202020 +:10B0C0007047B4E770B50C4605460026FFF7AFFFA2 +:10B0D0009549A04214D30A46203A00232046641E14 +:10B0E000E4B200280BD08878105C287088786D1C3A +:10B0F000401CC0B288702128F0D18B70EEE7012689 +:10B1000000F004F9304670BD202070479BE770B511 +:10B110000C4605460026FFF796FF83492331A042DF +:10B1200014D30A46203A00232046641EE4B20028C5 +:10B130000BD08878105C287088786D1C401CC0B2D9 +:10B1400088702128F0D18B70EEE7012600F0DEF840 +:10B15000304670BD202101700020704710B50446B4 +:10B16000FFF77EFF2070002010BD70B50C4605462D +:10B17000FFF776FF6C494631A04215D30A46203AC4 +:10B1800000232046641EE4B200280BD08878105CAF +:10B19000287088786D1C401CC0B288702128F0D1BE +:10B1A0008B70EEE7002400E0614C00F0AFF8204621 +:10B1B00070BD70B50C460546212904D9FF205DA15C +:10B1C000473000F086FD56484068103840B2FFF71F +:10B1D00019FFC6B20D20FFF715FFC0B2864207D295 +:10B1E000FF2054A14D3000F074FD01E0FAF7DCFAC5 +:10B1F00021462846FFF766FF0028F7D070BDF8B556 +:10B2000007464A48484C401E474E00782546463679 +:10B210002335002806D1A9786878212200F06BF840 +:10B2200000280ED0A1786078212200F064F8002870 +:10B2300014D0B1787078212200F05DF8002828D071 +:10B2400033E039496878C91C0F546878401CC0B293 +:10B250006870212829D10020687026E03249607882 +:10B2600020390F546078401CC0B26070212801D191 +:10B27000002060702D4F7F1E3878002815D0A178EF +:10B280006078212200F037F800280ED000203870B6 +:10B290000BE02549707826310F547078401CC0B2FD +:10B2A0007070212801D100207070A978687821225F +:10B2B00000F021F800281DD0A1786078212200F04C +:10B2C0001AF8002816D0B1787078212200F013F80F +:10B2D00000280FD0FAF74AFA144800F03BF8012191 +:10B2E0004903884203D013A1C12000F0F2FC0F48AB +:10B2F00000F048F8F8BD401C884205D0904201D1CA +:10B30000002901D0002070470120704710B5074880 +:10B3100000F020F8002801D1FAF717FA10BD00005C +:10B3200000ED00E000E400E0C8070020FF0000207E +:10B33000072000007372635C736F635F72616E64F9 +:10B340002E6300000021017008467047014600206E +:10B3500008707047EFF31081C907C90F72B6027801 +:10B36000012A01D0012200E00022012303700029FC +:10B3700000D162B6002A01D00020704701204003AE +:10B380007047E7E7EFF31081C907C90F72B60022D3 +:10B390000270002900D162B600207047F2E7000079 +:10B3A0008107C90E002808DA0007000F0838800856 +:10B3B000864A80008018C06904E08008844A8000C2 +:10B3C00080180068C8408009704710B5044600F036 +:10B3D000E7F8002813D02046FFF7E2FFC0B200F0E4 +:10B3E000EDF800280DD07B4801210278002A0BD00F +:10B3F000E206D20E914042681143416009E076486E +:10B4000010BD7548401C10BDE006C00E8140734859 +:10B410000160002010BD10B5044600F0C1F80028FE +:10B420000BD06C4901200A78002A08D0E206D20E1F +:10B4300090404A6882434A6007E0674810BDE106D1 +:10B44000C90E8840654980310860002010BD70B584 +:10B450000D46044600F0A4F800280BD060480068B0 +:10B46000E206D20E01219140084000D00120286060 +:10B47000002070BD584870BD10B5044600F090F82B +:10B48000002807D0E106C90E012088405449086011 +:10B49000002010BD504810BD10B5044600F080F8E3 +:10B4A000002808D0E106C90E012088404C498031AF +:10B4B0000860002010BD484810BD70B50D46044618 +:10B4C00000F06EF8002819D0284600F077F8002820 +:10B4D00016D0FF20002C16DA2107090F08398A0838 +:10B4E0003A4992005118CB69A207D20E904083438B +:10B4F000A807000E90400343CB6112E0364870BDB0 +:10B500003548401C70BDA2083149920051180A68A4 +:10B51000A307DB0E98408243A807000E9840024321 +:10B520000A60002070BD70B50C46054600F038F882 +:10B53000002805D02846FFF733FF2070002070BD9B +:10B54000254870BDBFF34F8F20492648C860BFF320 +:10B550004F8FFEE770B51F4C05462178012000296A +:10B560000ED1207072B6F7F7A6FC1C4E80363168FB +:10B5700081436160F7F79FFCC043306062B60020F2 +:10B580002870002070BD13490A78002A06D00028D0 +:10B5900004D1124A486810600020087000207047EB +:10B5A00010B50446202805DAF7F785FC0121A140F3 +:10B5B000084201D0002010BD012010BD012803D099 +:10B5C000032801D0002070470120704700ED00E003 +:10B5D00000E400E0040100200120000000E100E0A0 +:10B5E00000E200E00400FA0510B52948FFF7AAFEC2 +:10B5F000002803D027A11D2000F06BFB2448401C2D +:10B60000FFF7A0FE002803D022A1212000F061FB5B +:10B6100010BDF8B5234D07466868009001261C4808 +:10B62000FFF798FE1A4C002803D10026601CFFF794 +:10B63000A9FE1D4A1D4900230120506000BF00BF24 +:10B6400000BF00BF00BF0B604B606F60106000BFA9 +:10B6500000BF00BF00BF00BF0868002802D14868D3 +:10B660000028F9D048680028E6D1002E05D00098BF +:10B670006860601CFFF76EFE07E0601CFFF76AFE63 +:10B680000028D3D10248FFF77DFE0020F8BDC0E7B7 +:10B690000C0100207372635C736F635F6563622EDD +:10B6A0006300000000E5004000E0004000E10040D1 +:10B6B0005B495C4B0A685C499A42096801D189047C +:10B6C000890C0160002070475549564B0A6856495D +:10B6D0009A4201D18004800C486000207047504994 +:10B6E000504B0A6850499A4201D18004800C88600E +:10B6F0000020704730B54A4B4A4D1C684B4BAC425A +:10B7000002D0102802D203E00E2801D3184630BD23 +:10B71000C3004548181801614261002030BD40490E +:10B72000404B0A684149491C9A4202D0042802D27F +:10B7300003E0022801D3084670473D4A0121C000BA +:10B7400080180160002070473549364B0A68374938 +:10B75000491C9A4202D0042802D203E0022801D3F5 +:10B7600008467047324A0121C0008018416000201D +:10B77000704730B52A4A2D4B2A4D14685B1C2D4A60 +:10B78000AC4206D0042806D2800080180160002058 +:10B7900030BD022801D3184630BD8904890CF3E777 +:10B7A00030B51F4A214B1F4D14685B1C214AAC4227 +:10B7B00005D0042805D280008018006808E002281F +:10B7C00001D3184630BD8000801800688004800CCA +:10B7D0000860002030BD10B5134A174890600E2055 +:10B7E0000021C3009B1819615961401C1028F8D32F +:10B7F0000020104A05E0022803D383009B1819603B +:10B8000005E083009B181C68A404A40C1C60401C69 +:10B810000428F0D310BD0449074888607047000031 +:10B820000C000020BEBAFECA00F50140082000004E +:10B8300000F0014000F8014000C0FFFF70B5002497 +:10B8400002460D4620462146002A20D0012A04D077 +:10B85000022A04D0032A0DD103E0012002E00220D5 +:10B8600015E003202B0000F040FB070507090B0D36 +:10B870000F11050007240EE0012108E0022106E077 +:10B88000032104E0042102E0052100E00621F7F78E +:10B89000CAFC0028EED0204670BD0000F0B51C4860 +:10B8A000002701211B4A8314476013601A4A17605E +:10B8B0001A4C23601A4B1C691E69E443E406E41722 +:10B8C000641C10252E431E61164B5960164E3160C4 +:10B8D00000E020BF1668002EFBD0002C03D1104CD6 +:10B8E0002669AE43266184688068A40501D50F4CA3 +:10B8F00020430D4C616099601760084AA1141160E3 +:10B90000F0BD10B50446FFF7C9FF2060002010BD50 +:10B9100000C5004080E100E000C1004080E200E09E +:10B9200000ED00E000C3004000C0004000FCFFFF4D +:10B9300070B51F490A68002A17D000231D4601244C +:10B940004A68521C4A60092A00D34D600E7922468B +:10B95000B2400E6816420AD072B60B6893430B6071 +:10B9600062B649680160002070BD052070BD5B1C97 +:10B97000092BE5D30FA1362000F0ABF9F5E7012044 +:10B980001049800508607047EFF31081CA07D20F95 +:10B9900072B6012181400648036819430160002AFC +:10B9A00000D162B6EBE702480021016041607047B8 +:10B9B000100100207372635C736F635F6576742E91 +:10B9C0006300000000E200E00A4A022151600A49D7 +:10B9D0000B68002BFCD0906008680028FCD0002089 +:10B9E000506008680028FCD07047012000074069BB +:10B9F0007047000000E5014000E40140012081079C +:10BA00000860704701208107486070471048C0688F +:10BA1000C00700D0012070470D488068C00700D0E3 +:10BA2000012070470A484069C00700D001207047D4 +:10BA30000748C069704706498A69D20306D58969F3 +:10BA40008907890F814201D101207047002070478A +:10BA500000040040F8B5042A2CD3830712D00B78D9 +:10BA6000491C0370401C521E83070BD00B78491CE5 +:10BA70000370401C521E830704D00B78491C0370CE +:10BA8000401C521E8B079B0F05D0C91ADF002023D4 +:10BA9000DE1B08C90AE0F5F7A3FBF8BD1D4608C97F +:10BAA000FD401C46B4402C4310C0121F042AF5D29E +:10BAB000F308C91A521EF0D40B78491C0370401CBD +:10BAC000521EEAD40B78491C0370401C521EE4D469 +:10BAD00009780170F8BD002203098B4273D3030A71 +:10BAE0008B4258D3030B8B423CD3030C8B4221D3A4 +:10BAF00012E003460B437FD4002243088B4274D3E9 +:10BB000003098B425FD3030A8B4244D3030B8B425E +:10BB100028D3030C8B420DD3FF22090212BA030C67 +:10BB20008B4202D31212090265D0030B8B4219D348 +:10BB300000E0090AC30B8B4201D3CB03C01A524168 +:10BB4000830B8B4201D38B03C01A5241430B8B42B0 +:10BB500001D34B03C01A5241030B8B4201D30B0399 +:10BB6000C01A5241C30A8B4201D3CB02C01A5241C0 +:10BB7000830A8B4201D38B02C01A5241430A8B4283 +:10BB800001D34B02C01A5241030A8B4201D30B026C +:10BB9000C01A5241CDD2C3098B4201D3CB01C01A86 +:10BBA000524183098B4201D38B01C01A5241430990 +:10BBB0008B4201D34B01C01A524103098B4201D37E +:10BBC0000B01C01A5241C3088B4201D3CB00C01AEB +:10BBD000524183088B4201D38B00C01A5241430863 +:10BBE0008B4201D34B00C01A5241411A00D2014688 +:10BBF0005241104670475DE0CA0F00D04942031021 +:10BC000000D34042534000229C4603098B422DD36F +:10BC1000030A8B4212D3FC22890112BA030A8B4217 +:10BC20000CD3890192118B4208D3890192118B4266 +:10BC300004D389013AD0921100E08909C3098B42EB +:10BC400001D3CB01C01A524183098B4201D38B012E +:10BC5000C01A524143098B4201D34B01C01A5241D1 +:10BC600003098B4201D30B01C01A5241C3088B4216 +:10BC700001D3CB00C01A524183088B4201D38B0001 +:10BC8000C01A5241D9D243088B4201D34B00C01A8B +:10BC90005241411A00D20146634652415B101046A0 +:10BCA00001D34042002B00D54942704763465B10E8 +:10BCB00000D3404201B50020C046C04602BD00008E +:10BCC000012308CB134B1860134B1960134B1A60F8 +:10BCD0007047134A134B13607246053AF0E7114A56 +:10BCE0000F4B1B689A420ED10D4B00201860019833 +:10BCF0000D4B04B598470CBC9E460246029800992D +:10BD00000A4B1B68184706980599094B1B68DB68A6 +:10BD100018470000200100202401002028010020F5 +:10BD200018010020EFBEADDE651400000800002001 +:10BD3000040000201D481E497047FFF7FBFFF5F780 +:10BD4000FDF900BD01200007C06AC0B2FF2804D180 +:10BD5000184819490968884202D0184818490160F2 +:10BD6000184819490968884203D1184A13605B686A +:10BD7000184700BD20BFFDE71248134909688842F3 +:10BD80000ED1134B18680B498842F3D080F3088812 +:10BD90001049884204DD1048026802210A4302600B +:10BDA0000E4880470E4880470E480047180800207C +:10BDB00018080020FFFFFFFF001000102C050040B6 +:10BDC0000800000000100000000000200400002017 +:10BDD00000D0000000200020240500407B1400005B +:10BDE00045BD0000C1BC00001348704502D1EFF30F +:10BDF000098101E0EFF30881886902380078102892 +:10BE000014DB202810DB2B280BDB0C4A12680C4BB0 +:10BE10009A4203D1602804DB0A4A104702200860D6 +:10BE20007047094A10470000084A1047084A12683C +:10BE30002C32126810470000FDFFFFFF0C000020AD +:10BE4000BEBAFECA95150000ED2600009B13000047 +:10BE5000040000200D4B0E4908470E4B0C490847C3 +:10BE60000D4B0B4908470D4B094908470C4B084936 +:10BE700008470C4B064908470B4B054908470B4B35 +:10BE8000034908470A4B024908470000555500007E +:10BE900019140000C92600007325000021250000A8 +:10BEA00085570000A1150000A315000037260000EB +:10BEB000BB4A00000021017041708170C1700171A6 +:10BEC00041718171C17170470A7802704B7843707B +:10BED0008A788270CA78C2700B7903714A7942718C +:10BEE0008A798271CB79C371704730B47446641E0D +:10BEF0002578641CAB4200D21D46635D5B00E318ED +:10BF000030BC1847415858352E3030423030000090 +:10BF1000ECF4FC0004FFE11D9AED853324EA7AD2AB +:10BF2000397097570A547D2DD86D0DBA8F6759C750 +:10BF3000A2BF3400FFFF008000400020001000007E +:10BF400000000000F8FC7C7E3E3F9F1FCF0FE707FC +:10BF50000000000074BF0000080000202401000061 +:10BF60000411000098C000002C010020EC06000025 +:10BF70002011000000000000000000000000000090 +:10BF800000000000000000000000000000000000B1 +:10BF900000000000000000000000000000000000A1 +:10BFA0000000000000000000000000000000000091 +:10BFB0000000000000000000000000000000000081 +:10BFC0000000000000000000000000000000000071 +:10BFD0000000000000000000000000000000000061 +:10BFE0000000000000000000000000000000000051 +:10BFF0000000000000000000000000000000000041 +:10C000000000000000000000000000000000000030 +:10C010000000000000000000000000000000000020 +:10C020000000000000000000000000000000000010 +:10C030000000000000000000000000000000000000 +:10C0400000000000000000000000000000000000F0 +:10C0500000000000000000000000000000000000E0 +:10C0600000000000000000000000010000000000CF +:10C0700000000000000000000000000000000000C0 +:10C080000000000000000000C5BC0000000000002F +:08C090000000000000000000A8 +:00000001FF diff --git a/components/softdevice/s210/toolchain/armgcc/armgcc_s210_nrf51422_xxaa.ld b/components/softdevice/s210/toolchain/armgcc/armgcc_s210_nrf51422_xxaa.ld new file mode 100644 index 0000000..ba46908 --- /dev/null +++ b/components/softdevice/s210/toolchain/armgcc/armgcc_s210_nrf51422_xxaa.ld @@ -0,0 +1,22 @@ +/* Linker script to configure memory regions. */ + +SEARCH_DIR(.) +GROUP(-lgcc -lc -lnosys) + +MEMORY +{ + FLASH (rx) : ORIGIN = 0xd000, LENGTH = 0x33000 + RAM (rwx) : ORIGIN = 0x20000900, LENGTH = 0x3700 +} + +SECTIONS +{ + .fs_data_out ALIGN(4): + { + PROVIDE( __start_fs_data = .); + KEEP(*(fs_data)) + PROVIDE( __stop_fs_data = .); + } = 0 +} + +INCLUDE "nrf5x_common.ld" \ No newline at end of file diff --git a/components/softdevice/s210/toolchain/armgcc/armgcc_s210_nrf51422_xxac.ld b/components/softdevice/s210/toolchain/armgcc/armgcc_s210_nrf51422_xxac.ld new file mode 100644 index 0000000..11eb042 --- /dev/null +++ b/components/softdevice/s210/toolchain/armgcc/armgcc_s210_nrf51422_xxac.ld @@ -0,0 +1,22 @@ +/* Linker script to configure memory regions. */ + +SEARCH_DIR(.) +GROUP(-lgcc -lc -lnosys) + +MEMORY +{ + FLASH (rx) : ORIGIN = 0xd000, LENGTH = 0x33000 + RAM (rwx) : ORIGIN = 0x20000900, LENGTH = 0x7700 +} + +SECTIONS +{ + .fs_data_out ALIGN(4): + { + PROVIDE( __start_fs_data = .); + KEEP(*(fs_data)) + PROVIDE( __stop_fs_data = .); + } = 0 +} + +INCLUDE "nrf5x_common.ld" \ No newline at end of file diff --git a/components/softdevice/s210/toolchain/iar/iar_s210_nrf51422_xxaa.icf b/components/softdevice/s210/toolchain/iar/iar_s210_nrf51422_xxaa.icf new file mode 100644 index 0000000..8369cf3 --- /dev/null +++ b/components/softdevice/s210/toolchain/iar/iar_s210_nrf51422_xxaa.icf @@ -0,0 +1,31 @@ +/*###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__ = 0xd000; +/*-Memory Regions-*/ +define symbol __ICFEDIT_region_ROM_start__ = 0xd000; +define symbol __ICFEDIT_region_ROM_end__ = 0x3ffff; +define symbol __ICFEDIT_region_RAM_start__ = 0x20000900; +define symbol __ICFEDIT_region_RAM_end__ = 0x20003fff; +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x800; +define symbol __ICFEDIT_size_heap__ = 0x200; +/**** End of ICF editor section. ###ICF###*/ + +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 CSTACK, + block HEAP }; diff --git a/components/softdevice/s210/toolchain/iar/iar_s210_nrf51422_xxac.icf b/components/softdevice/s210/toolchain/iar/iar_s210_nrf51422_xxac.icf new file mode 100644 index 0000000..9ae7e3d --- /dev/null +++ b/components/softdevice/s210/toolchain/iar/iar_s210_nrf51422_xxac.icf @@ -0,0 +1,31 @@ +/*###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__ = 0xd000; +/*-Memory Regions-*/ +define symbol __ICFEDIT_region_ROM_start__ = 0xd000; +define symbol __ICFEDIT_region_ROM_end__ = 0x3ffff; +define symbol __ICFEDIT_region_RAM_start__ = 0x20000900; +define symbol __ICFEDIT_region_RAM_end__ = 0x20007fff; +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x800; +define symbol __ICFEDIT_size_heap__ = 0x200; +/**** End of ICF editor section. ###ICF###*/ + +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 CSTACK, + block HEAP }; diff --git a/components/softdevice/s310/doc/s310_nrf51822_3.0.0_licence_agreement.pdf b/components/softdevice/s310/doc/s310_nrf51822_3.0.0_licence_agreement.pdf new file mode 100644 index 0000000000000000000000000000000000000000..61f64d3824ed1122550d40e296fc139bda42b74c GIT binary patch literal 7025 zcmc&(XF!un)>aV^klw42UQHn+fQZt2@4bXj1HmLf00C*zk&aa9f^?|@f&wB6Qbh!$ z2uSZ$6y*!|-rc*qcXz)Z-;Zzp%sb~j^UTbdGjE6mLEC#*-CFh%87#t;s0zd$? zy(>UQ2B?YjaKbqQATXE|P}v2ALt=o+C_5Zd5s5%MAZ2B-I1JLxogAP2!t5<(N|o-# zzKHPmqWC;19&f(B2g>;Z6MC>T9E)yZXU^`(j(*3qOC(G&2* z{fh$}Whu(pdgwjTGaP(mm?C@~9;Kfj{mf>%`f@59qd3b(^%xa~wP+kG^QJAFNS({6 zdb02qB}H3E9rJe45rTE|S)-gxL+l%m6UXY2DO4;dI#}>I-ko>T5j84(A-RVIc0~+h zc(;JRAh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.txt b/components/softdevice/s310/doc/s310_nrf51822_3.0.0_licence_agreement.txt new file mode 100644 index 0000000..e88fb31 --- /dev/null +++ b/components/softdevice/s310/doc/s310_nrf51822_3.0.0_licence_agreement.txt @@ -0,0 +1,110 @@ +S210/S310 license agreement + +S210 AND S310 LICENSE AGREEMENT + +License Agreement for the Nordic Semiconductor ASA (Nordic) S210 ANT Softdevice software package (S210) and the Nordic Semiconductor +ASA S310 ANT and BLE Softdevice software package (S310). + +You (You or Licensee) must carefully and thoroughly read this License Agreement (Agreement), and accept to adhere to this Agreement +before downloading, installing and/or using any software or content in the S210 or S310 provided herewith. + +YOU ACCEPT THIS LICENSE AGREEMENT BY (A) CLICKING ACCEPT OR AGREE TO THIS LICENSE AGREEMENT, WHERE THIS +OPTION IS MADE AVAILABLE TO YOU; OR (B) BY ACTUALLY USING THE S210 OR S310, IN THIS CASE YOU AGREE THAT THE USE OF +THE S210 OR S310 CONSTITUTES ACCEPTANCE OF THE LICENSING AGREEMENT FROM THAT POINT ONWARDS. + +IF YOU DO NOT AGREE TO BE BOUND BY THE TERMS OF THIS AGREEMENT, THEN DO NOT DOWNLOAD, INSTALL/COMPLETE +INSTALLATION OF, OR IN ANY OTHER WAY MAKE USE OF THE S210 OR S310 OR ANY DOCUMENTATION RELATED TO THE S210 OR +S310. + +1. Grant of License +Subject to the terms in this Agreement Nordic grants Licensee a limited, non-exclusive, non-transferable, non-sub licensable, revocable license +(License): (a) to use the S210 and S310 solely in connection with the nRF51422 Nordic Integrated Circuit (nRF51422 IC), and (b) to distribute +the S210 or S310 solely as implemented in Licensee products. Licensee shall not use the S210 or S310 for any purpose other than specifically +authorized herein. It is a material breach of this agreement to use or modify the S210 or S310 for use on any wireless connectivity integrated +circuit other than the nRF51422 IC. + +2. Title +Nordic or its licensors (as applicable) retain full rights, title, and ownership to the S210 and S310 and any and all patents, copyrights, trade +secrets, trade names, trademarks, and other intellectual property rights in and to the S210 and S310. Nordic licenses portions of the S210 and +S310 from third party licensors, and such licensors retain their respective full rights, title, and ownership in and of the S210 and S310 and any and +all patents, copyrights, trade secrets, trade names, trademarks, and other intellectual property rights in and to the S210 and S310. + +3. No Modifications or Reverse Engineering +Licensee shall not, modify, reverse engineer, disassemble, decompile or otherwise attempt to discover the source code of any non-source code +parts of the S210 and S310 including, but not limited to pre-compiled hex files, binaries and object code. + +4. Distribution Restrictions +Except as set forward in Section 1 above, the Licensee may not disclose or distribute any or all parts of the S210 and S310 to any third party. +Licensee agrees to provide reasonable security precautions to prevent unauthorized access to or use of the S210 and S310 as proscribed herein. +Licensee also agrees that use of and access to the S210 and S310 will be strictly limited to the employees and subcontractors of the Licensee +necessary for the performance of development, verification and production tasks under this Agreement. The Licensee is responsible for making +such employees and subcontractors agree on complying with the obligations concerning use and non-disclosure of the S210 and S310. + +5. End Use Restrictions +Licensee agrees that the S210 and S310 may not be sold, resold, transferred, diverted, exported, re-exported or disposed of (i) for use in +activities involving the development, production, handling, use, operation, maintenance, storage, detection, identification or dissemination of +nuclear, chemical, or biological weapons (including missiles and weapons of mass destruction), nor for use in any facilities engaged in activities +related to such weapons, including where there are reasonable grounds to suspect any such use; (ii) for a military end-use in China or in any +other country subject to any applicable arms embargo or for an item designed, modified, configured, or adapted for a military application in China +or any other country subject to an applicable arms embargo; (iii) to or for the benefit of individuals or entities listed on any applicable restricted or +prohibited party lists; or (iv) to the following countries: Cuba, Iran, North Korea, Sudan, and Syria. Licensee further agree to abide by all other +applicable export controls, trade sanctions and embargo laws, regulations, rules and licenses ("Export Controls and Sanctions Rules") in force +from time to time as they relate to the S210 and S310. You acknowledge that your obligation to comply with applicable Export Controls and +Sanctions Rules is independent of these terms and conditions and you agree to indemnify and hold Nordic and its licensors harmless from and +against any third-party claim, including fines, losses, liabilities or legal fees that arise as a result of the breach by you of these terms and +conditions or any applicable export controls, trade sanctions and embargo laws, regulations, rules and licenses. + +6. No Other Rights +Licensee shall use the S210 and S310 only in compliance with this Agreement and shall refrain from using the S210 and S310 in any way that +may be contrary to this Agreement. + +7. Fees +Nordic grants the License to the Licensee free of charge provided that the Licensee undertakes the obligations in the Agreement and warrants to +comply with the Agreement. + +8. DISCLAIMER OF WARRANTY +THE S210 AND S310 ARE PROVIDED AS IS" WITHOUT WARRANTY OF ANY KIND EXPRESS OR IMPLIED AND NEITHER NORDIC, ITS +LICENSORS OR AFFILIATES NOR THE COPYRIGHT HOLDERS MAKE ANY REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR +THAT THE S210 AND S310 WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. +THERE IS NO WARRANTY BY NORDIC OR BY ANY OTHER PARTY THAT THE FUNCTIONS CONTAINED IN THE S210 AND S310 WILL +MEET THE REQUIREMENTS OF LICENSEE OR THAT THE OPERATION OF THE S210 AND S310 WILL BE UNINTERRUPTED OR +ERROR-FREE. LICENSEE ASSUMES ALL RESPONSIBILITY AND RISK FOR THE SELECTION OF THE S210 AND S310 TO ACHIEVE +LICENSEES INTENDED RESULTS AND FOR THE INSTALLATION, USE AND RESULTS OBTAINED FROM IT. + +9. No Support +Nordic is not obligated to furnish or make available to Licensee any further information, software, technical information, know-how, show-how, +bug-fixes or support. Nordic reserves the right to make changes to the S210 and S310 without further notice. + +10. Limitation of Liability +In no event shall Nordic, its employees or suppliers, licensors or affiliates be liable for any lost profits, revenue, sales, data or costs of +procurement of substitute goods or services, property damage, personal injury, interruption of business, loss of business information or for any +special, direct, indirect, incidental, economic, punitive, special or consequential damages, however caused and whether arising under contract, +tort, negligence, or other theory of liability arising out of the use of or inability to use the S210 and S310, even if Nordic or its employees or +suppliers, licensors or affiliates are advised of the possibility of such damages. Because some countries/states/jurisdictions do not allow the +exclusion or limitation of liability, but may allow liability to be limited, in such cases, Nordic, its employees or licensors or affiliates liability shall be +limited to USD 50. + +11. Breach of Contract +Upon a breach of contract by the Licensee, Nordic and its licensor are entitled to damages in respect of any direct loss which can be reasonably +attributed to the breach by the Licensee. If the Licensee has acted with gross negligence or willful misconduct, the Licensee shall cover both +direct and indirect costs for Nordic and its licensors. + +12. Indemnity +Licensee undertakes to indemnify, hold harmless and defend Nordic and its directors, officers, affiliates, shareholders, licensors, employees and +agents from and against any claims or lawsuits, including attorney's fees, that arise or result of the Licensees execution of the License and which +is not due to causes for which Nordic is responsible. + +13. Governing Law +This Agreement shall be construed according to the laws of Norway, and hereby submits to the exclusive jurisdiction of the Oslo tingrett. + +14. Assignment +Licensee shall not assign this Agreement or any rights or obligations hereunder without the prior written consent of Nordic. + +15. Termination +Without prejudice to any other rights, Nordic may cancel this Agreement if Licensee does not abide by the terms and conditions of this +Agreement. Upon termination Licensee must promptly cease the use of the License and destroy all copies of the Licensed Technology and any +other material provided by Nordic or its affiliate, or produced by the Licensee in connection with the Agreement or the Licensed Technology. + +16. Third party beneficiaries +Nordics licensors are intended third party beneficiaries under this Agreement. \ No newline at end of file diff --git a/components/softdevice/s310/doc/s310_nrf51822_3.0.0_migration_document.pdf b/components/softdevice/s310/doc/s310_nrf51822_3.0.0_migration_document.pdf new file mode 100644 index 0000000000000000000000000000000000000000..d8a089f314ee9b02413449acf38f94c249f2e7fc GIT binary patch literal 432939 zcmdR$1yoks_UHlW?v4)xX+FBUJEU9Uqf5Gx?k=KfERDF9pyBnbXNK?K>EK6G*4*l&G3^Z^vJcd>H@urdSXEKQws z0c`i}0a)(^10T2_4r~u{0NB`noN@j*{J6)?@o>ieAP0cs#~CN{!$r;?6*zxX;QDcq z>qlc;Kkjk;aqmZC+&_wNKM0`@_*MG*OaCN2SWS+gd+G1H13m>g*}FKJfSkZukhHgR zzCW-49wY)vvI2f+N|Fu0^H5rn9l-J+15lC!!15r5pde7$(cVNATMDQKa(4#G z*n&+V`r{z>;~;Y{8c+dbYH1{D@2(4Ojv2to0`7r_RUZIWsGT!dC?~*=)}(fpgG}sAK|pzs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z%?F+*@H~O%2|Q2Wc>>Q9c%EQ>p1|`2o+t1;f#(T4PvCii`FR4*6L_A$^RgGpTvyhqDo z^9-Jsy?v%Ec%H%Y44!B3JcH*M=I0qa&)|94i(=Xgo@em9>}|1StsfcY=NUZD;CY7m zc?Qojc%H%Y44!B3JcH*MJkQ{H2G28ip271Bo@ekp!~8sh=NUXN`<~2s1J5&fo?(8T z!Sf8BXYf3O=NUZD;CTkmGkBh1exAYe44!B3JcH*MJlBn0wx7ZCvNzJ45AZyL=NUZD z;CTkmGkBiC^9-J6@LV?<+Bm@T44#*Le5Mb;^9-J6@H~U(WxuYe13b^*c?QojcwY80 z+B)p`O2Bj7d}zuFcrM_%fae09mpz4b`vg1}@La%i0nY_I7w}xba{z;gl5 z1w0q!1MB*4%7GG zxq#;ao|nD<_ITFw@~sk^&pu}m@La%i0nY_I7w}xba{z;gl51?K0v<9>9% z=*FO^eOk8SANzKUrgiFIm8P#q>$Fb4$x(g(Ko`}U?+a*J@p9DhbfLZZc8qUz8&LKA zgOaA#{phl-ZgZ%<=b;N`%QNKB`Si_+dNevsXTa?;hcT}1#xGQ~MrMdR_ z_AOhw;CnYOUfS2A-}F2BCBOVX|9szP-{)JfblGR03)01X`c;*_p7YN8>YUkqJ^%fN oP}A4*e`(z%S1(<>eClV7`t%cr*Dkw7|F`s8-EduEf2`sE0e*D-#Q*>R literal 0 HcmV?d00001 diff --git a/components/softdevice/s310/doc/s310_nrf51822_3.0.0_readme.txt b/components/softdevice/s310/doc/s310_nrf51822_3.0.0_readme.txt new file mode 100644 index 0000000..c617a24 --- /dev/null +++ b/components/softdevice/s310/doc/s310_nrf51822_3.0.0_readme.txt @@ -0,0 +1,14 @@ +s310_nrf51422_3.0.0 + +This release consists of the following: +- This readme file +- The s310_nrf51422_3.0.0 softdevice (binary hex file) +- The s310_nrf51422_3.0.0 API (softdevice header files) +- The s210 and s310 licence agreement +- The s310_nrf51422_3.0.0 release notes +- The s310_nrf51422_3.0.0 migration-document.pdf + + +IMPORTANT NOTE: If you intend to use the softdevice with the nRF51 +SDK only, you do _not_ need the API files. The API header files are +already installed as part of the nRF51 SDK version 7.1.0 or newer. diff --git a/components/softdevice/s310/doc/s310_nrf51822_3.0.0_releasenotes.pdf b/components/softdevice/s310/doc/s310_nrf51822_3.0.0_releasenotes.pdf new file mode 100644 index 0000000000000000000000000000000000000000..3c7d5b04242f921e753cbaf3e6bbab1b00f1d484 GIT binary patch literal 140119 zcmb@u1ymf%+AfT{TW|~RFt`TS1PM+EI=H(-fZ*=Ig1ftGfZ*;H9D+MR{|VXIa?knX z{`bsUte)FGH1p z_STMe20(j|84}i34nGg9q`xebU?b)FDUewLK+5{7xdb~Y>$4Jqg3Jnb)&_5Z4qD70 z4>KzRT^yLDEkQ06`E?Neb&&q45%X)Hp{bsTwTl*LI2KY)&|q9VY}%wCM_4(4bg?IW z9+O$p&f3xDcUYcJnBOuh+v!=^+x*noz?E6_EwdQV$|jF5#=!&l*~{L+4yb2|jNp>m zsM@ zF_sH(z7%XdM@76U+B*tNmDS!=T-GCkY2No8RrS{Mcc?pZ6^oOx;=MQ@*P#bLe*35g zwE7lk>FH*7UO$O>b)IkEn_9bmP``DXKzZqQdOT`cJ$@HD8C$Ib6`QQRl$s8g&`HvX z&<|*cQ-dD0cRHQjlMcWETwPDb3dKlLD#aTnn%_9P8%&6&!!fSG!q1R=2R5{_A_rDxaow)|USNuWqo1lY zCdGlQGwaRB>fTaD1rcuwaftZEaB>_N7F&iVC zYIozXQyn6?-7=Q;cCgkvnP+~ObBeS{zO$Ll8=3a&3`$A^}Qdq}bauw@L4ks@BE( z5u^gbxKTxVjIxF*>PLsg>fLxT%W@T{MvfD{4A*nme#33x1uLWBz;Y2vr?Ci)8B8@* z*N}K+uAez9D_<*!xnOn4UQ?EfR&%Tfx16<}iO`4tNOGBMn{-Y(6cBnw(?FAYPFNd= z^KKKJ`$Z*piZ7x7!49a;2&m6U`*Obc*$W3)y}K_MwKRoq%*Z!P0+Uo<75f;hqOu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olaYVTKj#1Ela61_Dh`g0c{Qy~ zPEeC`!0c=~cJv(XWoPqxuAAP@=KrO2ZX=?@X1cy=)XRz4J~30|OY?fOY`A>XKwmff Fe*nT1-H!kO literal 0 HcmV?d00001 diff --git a/components/softdevice/s310/headers/ant_error.h b/components/softdevice/s310/headers/ant_error.h new file mode 100644 index 0000000..0b326b9 --- /dev/null +++ b/components/softdevice/s310/headers/ant_error.h @@ -0,0 +1,43 @@ +/* + * Dynastream Innovations Inc. + * Cochrane, AB, CANADA + * + * Copyright (c) 2012 Dynastream Innovations Inc. + * THIS SOFTWARE IS AN EXAMPLE USAGE OF THE ANT PROTOCOL MODULE. + * IT MAY BE USED, MODIFIED and DISTRIBUTED ONLY WITH THE + * APPROPRIATE LICENSE AGREEMENT. + */ + +/* Header guard */ +#ifndef ANT_ERROR_H__ +#define ANT_ERROR_H__ + +#include "ant_parameters.h" + +/** + @defgroup ant_error ANT Error Return + @{ + @ingroup ant_interface +*/ + +/** @brief ANT Error Return parameter definitions */ +#define NRF_ANT_ERROR_OFFSET 0x4000 //ANT's Exception offset + +#define NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE NRF_ANT_ERROR_OFFSET + CHANNEL_IN_WRONG_STATE ///< Response on attempt to perform an action from the wrong channel state. +#define NRF_ANT_ERROR_CHANNEL_NOT_OPENED NRF_ANT_ERROR_OFFSET + CHANNEL_NOT_OPENED ///< Response on attempt to communicate on a channel that is not open. +#define NRF_ANT_ERROR_CHANNEL_ID_NOT_SET NRF_ANT_ERROR_OFFSET + CHANNEL_ID_NOT_SET ///< Response on attempt to open a channel without setting the channel ID. +#define NRF_ANT_ERROR_CLOSE_ALL_CHANNELS NRF_ANT_ERROR_OFFSET + CLOSE_ALL_CHANNELS ///< Response when attempting to start scanning mode, when channels are still open. +#define NRF_ANT_ERROR_TRANSFER_IN_PROGRESS NRF_ANT_ERROR_OFFSET + TRANSFER_IN_PROGRESS ///< Response on attempt to communicate on a channel with a TX transfer in progress. +#define NRF_ANT_ERROR_TRANSFER_SEQUENCE_NUMBER_ERROR NRF_ANT_ERROR_OFFSET + TRANSFER_SEQUENCE_NUMBER_ERROR ///< Response when sequence number of burst message or burst data segment is out of order. +#define NRF_ANT_ERROR_TRANSFER_IN_ERROR NRF_ANT_ERROR_OFFSET + TRANSFER_IN_ERROR ///< Response when transfer error has occured on supplied burst message or burst data segment. +#define NRF_ANT_ERROR_TRANSFER_BUSY NRF_ANT_ERROR_OFFSET + TRANSFER_BUSY ///< Response when transfer is busy and cannot process supplied burst message or burst data segment. +#define NRF_ANT_ERROR_MESSAGE_SIZE_EXCEEDS_LIMIT NRF_ANT_ERROR_OFFSET + MESSAGE_SIZE_EXCEEDS_LIMIT ///< Response if a data message is provided that is too large. +#define NRF_ANT_ERROR_INVALID_MESSAGE NRF_ANT_ERROR_OFFSET + INVALID_MESSAGE ///< Response when the message has an invalid parameter. +#define NRF_ANT_ERROR_INVALID_NETWORK_NUMBER NRF_ANT_ERROR_OFFSET + INVALID_NETWORK_NUMBER ///< Response when an invalid network number is provided +#define NRF_ANT_ERROR_INVALID_LIST_ID NRF_ANT_ERROR_OFFSET + INVALID_LIST_ID ///< Response when the provided list ID or size exceeds the limit +#define NRF_ANT_ERROR_INVALID_SCAN_TX_CHANNEL NRF_ANT_ERROR_OFFSET + INVALID_SCAN_TX_CHANNEL ///< Response when attempting to transmit on channel 0 when in scan mode. +#define NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED NRF_ANT_ERROR_OFFSET + INVALID_PARAMETER_PROVIDED ///< Response when an invalid parameter is specified in a configuration message +#endif // ANT_ERROR_H__ +/** + @} + */ diff --git a/components/softdevice/s310/headers/ant_interface.h b/components/softdevice/s310/headers/ant_interface.h new file mode 100644 index 0000000..b60f60b --- /dev/null +++ b/components/softdevice/s310/headers/ant_interface.h @@ -0,0 +1,939 @@ +/* + * Dynastream Innovations Inc. + * Cochrane, AB, CANADA + * + * Copyright (c) 2014 Dynastream Innovations Inc. + * THIS SOFTWARE IS AN EXAMPLE USAGE OF THE ANT PROTOCOL MODULE. + * IT MAY BE USED, MODIFIED and DISTRIBUTED ONLY WITH THE + * APPROPRIATE LICENSE AGREEMENT. + */ +/* Header guard */ +#ifndef ANT_INTERFACE_H__ +#define ANT_INTERFACE_H__ + +#include +#include +#include "nrf_svc.h" + +/** + @addtogroup stack_ant_module ANT STACK + @{ + @defgroup ant_interface ANT Application Interface + @{ +* @brief ANT Stack Application Programming Interface (API). +*/ + +#define STK_SVC_BASE_2 0xC0 // ANT stack protocol SVC base + +/** @brief ANT Stack API SVC numbers */ +enum { + /*ant re/initialization API*/ + SVC_ANT_STACK_INIT = STK_SVC_BASE_2, + /*event API*/ + SVC_ANT_EVENT_GET, + /*channel control API*/ + SVC_ANT_CHANNEL_ASSIGN, + SVC_ANT_CHANNEL_UNASSIGN, + SVC_ANT_CHANNEL_OPEN, + SVC_ANT_CHANNEL_CLOSE, + SVC_ANT_RX_SCAN_MODE_START, + /*data APIs*/ + SVC_ANT_TX_BROADCAST_MESSAGE, + SVC_ANT_TX_ACKNOWLEDGED_MESSAGE, + SVC_ANT_BURST_HANDLER_REQUEST, + SVC_ANT_PENDING_TRANSMIT_CLEAR, + SVC_ANT_TRANSFER_STOP, + /*radio configuration APIs*/ + SVC_ANT_NETWORK_KEY_SET, + SVC_ANT_CHANNEL_RADIO_FREQ_SET, + SVC_ANT_CHANNEL_RADIO_FREQ_GET, + SVC_ANT_CHANNEL_RADIO_TX_POWER_SET, + SVC_ANT_PROX_SEARCH_SET, + /*configuration APIs*/ + SVC_ANT_CHANNEL_PERIOD_SET, + SVC_ANT_CHANNEL_PERIOD_GET, + SVC_ANT_CHANNEL_ID_SET, + SVC_ANT_CHANNEL_ID_GET, + SVC_ANT_SEARCH_WAVEFORM_SET, + SVC_ANT_CHANNEL_RX_SEARCH_TIMEOUT_SET, + SVC_ANT_SEARCH_CHANNEL_PRIORITY_SET, + SVC_ANT_ACTIVE_SEARCH_SHARING_CYCLES_SET, + SVC_ANT_ACTIVE_SEARCH_SHARING_CYCLES_GET, + SVC_ANT_CHANNEL_LOW_PRIO_RX_SEARCH_TIMEOUT_SET, + SVC_ANT_ADV_BURST_CONFIG_SET, + SVC_ANT_ADV_BURST_CONFIG_GET, + SVC_ANT_LIB_CONFIG_SET, + SVC_ANT_LIB_CONFIG_CLEAR, + SVC_ANT_LIB_CONFIG_GET, + SVC_ANT_ID_LIST_ADD, + SVC_ANT_ID_LIST_CONFIG, + SVC_ANT_AUTO_FREQ_HOP_TABLE_SET, + SVC_ANT_EVENT_FILTERING_SET, + SVC_ANT_EVENT_FILTERING_GET, + /*status APIs*/ + SVC_ANT_ACTIVE, + SVC_ANT_CHANNEL_IN_PROGRESS, + SVC_ANT_CHANNEL_STATUS_GET, + SVC_ANT_PENDING_TRANSMIT, + /*radio test APIs*/ + SVC_ANT_INIT_CW_TEST_MODE, + SVC_ANT_CW_TEST_MODE, + /*antstack version API*/ + SVC_ANT_VERSION, + /*antstack capabilities API*/ + SVC_ANT_CAPABILITIES, + /*more data APIs*/ + SVC_ANT_BURST_HANDLER_WAIT_FLAG_ENABLE, + SVC_ANT_BURST_HANDLER_WAIT_FLAG_DISABLE, + /*more configuration APIs*/ + SVC_ANT_SDU_MASK_SET, + SVC_ANT_SDU_MASK_GET, + SVC_ANT_SDU_MASK_CONFIG, + SVC_ANT_CRYPTO_CHANNEL_ENABLE, + SVC_ANT_CRYPTO_KEY_SET, + SVC_ANT_CRYPTO_INFO_SET, + SVC_ANT_CRYPTO_INFO_GET, + SVC_ANT_RFACTIVE_NOTIFICATION_CONFIG_SET, + SVC_ANT_RFACTIVE_NOTIFICATION_CONFIG_GET, + SVC_ANT_COEX_CONFIG_SET, + SVC_ANT_COEX_CONFIG_GET, + SVC_ANT_ENABLE, + /*reserved APIs*/ + SVC_ANT_RESERVED1, + SVC_ANT_RESERVED2, + /*extended APIs*/ + SVC_ANT_EXTENDED0, + SVC_ANT_EXTENDED1, + SVC_ANT_EXTENDED2, // LAST (64 SVCs) +}; + +////////////////////////////////////////////// +/** @name ANT enable channel structure + * + * @brief Structure for setting up ANT stack channels +@{ */ +////////////////////////////////////////////// +typedef struct +{ + /*Total number of channels wanted in ANT stack*/ + uint8_t ucTotalNumberOfChannels; + /*Number of encrypted channels wanted (subset of total channels)*/ + uint8_t ucNumberOfEncryptedChannels; + /*Memory location pointer to start allocating ANT channels*/ + uint8_t* pucMemoryBlockStartLocation; + /*Block byte size available for ANT channels starting at memory location pointer*/ + uint16_t usMemoryBlockByteSize; +} ANT_ENABLE; +/** @} */ + +/******************************************************************************/ +/** @name ANT API functions + * @{ */ +/******************************************************************************/ + +/******************************* RE/INITIALIZATION API *******************************/ + +/** @brief Function for initializing or re-initializing ANT Stack. + * + * @return ::NRF_SUCCESS + */ +SVCALL(SVC_ANT_STACK_INIT, uint32_t, sd_ant_stack_reset (void)); + +/******************************* EVENT API *******************************/ + +/** @brief This function returns ANT channel events and data messages. + * + * @param[out] pucChannel is the pointer to an unsigned char (1 octet) where the channel number will be copied. + * @param[out] pucEvent is the pointer to an unsigned char (1 octet) where the event code will be copied. See Channel Events and Command Response Codes in ant_parameters.h. + * @param[out] aucANTMesg is the buffer where event's message will be copied. The array size must be at least MESG_BUFFER_SIZE to accommadate the entire ANT_MESSAGE structure size. See ANT Message Structure in ant_parameters.h. + * + * @return ::NRF_SUCCESS + * @return ::NRF_ERROR_INVALID_PARAM + * @return ::NRF_ERROR_NOT_FOUND + */ +SVCALL(SVC_ANT_EVENT_GET, uint32_t, sd_ant_event_get (uint8_t *pucChannel, uint8_t *pucEvent, uint8_t *aucANTMesg)); + +/********************** CHANNEL CONTROL APIS ******************************/ + +/** @brief This function assigns and initializes a new channel. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel to assign. + * @param[in] ucChannelType is an unsigned char (1 octet) denoting the channel type. See Assign Channel Parameters/Assign Channel Types in ant_parameters.h. + * @param[in] ucNetwork is an unsigned char (1 octet) denoting the network key to associate with the channel. + * @param[in] ucExtAssign is a bit field (1 octet) for an extended assign. See Ext. Assign Channel Parameters in ant_parameters.h. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + * ::NRF_ANT_ERROR_INVALID_NETWORK_NUMBER + * ::NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE + */ +SVCALL(SVC_ANT_CHANNEL_ASSIGN, uint32_t, sd_ant_channel_assign (uint8_t ucChannel, uint8_t ucChannelType, uint8_t ucNetwork, uint8_t ucExtAssign)); + +/** @brief This function unassigns a channel. The channel to unassign must be in an assigned state. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel to unassign. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + * ::NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE + */ +SVCALL(SVC_ANT_CHANNEL_UNASSIGN, uint32_t, sd_ant_channel_unassign (uint8_t ucChannel)); + +/** @brief This function opens and activates a channel. The channel to open must be in an assigned state. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel to open. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + * ::NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE + */ +SVCALL(SVC_ANT_CHANNEL_OPEN, uint32_t, sd_ant_channel_open(uint8_t ucChannel)); + +/** @brief This function closes a channel. The channel must be in an open state (SEARCHING or TRACKING). + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel to close. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + * ::NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE + * + */ +SVCALL(SVC_ANT_CHANNEL_CLOSE, uint32_t, sd_ant_channel_close (uint8_t ucChannel)); + +/** @brief This function starts receive scanning mode feature. Channel 0 must be assigned. All other channels must be closed. + * + * @param[in] ucSyncChannelPacketsOnly is an unsigned char (1 octet) denoting synchronous channel only scanning mode. 0 = disable, 1 = enable. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_CLOSE_ALL_CHANNELS + * ::NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE + */ +SVCALL(SVC_ANT_RX_SCAN_MODE_START, uint32_t, sd_ant_rx_scan_mode_start (uint8_t ucSyncChannelPacketsOnly)); + +/*********************** DATA APIS ****************************************/ + +/** @brief This function is used to set broadcast data for transmission. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel to send the data on. + * @param[in] ucSize is an unsigned char (1 octet) denoting the size of the message, ucSize must be 8. + * @param[in] aucMesg is the buffer where the message is located (array must be 8 octets). + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + * ::NRF_ANT_ERROR_MESSAGE_SIZE_EXCEEDS_LIMIT + * ::NRF_ANT_ERROR_INVALID_SCAN_TX_CHANNEL + * ::NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE + * ::NRF_ANT_ERROR_TRANSFER_IN_PROGRESS + * ::NRF_ANT_ERROR_TRANSFER_IN_ERROR + */ +SVCALL(SVC_ANT_TX_BROADCAST_MESSAGE, uint32_t, sd_ant_broadcast_message_tx (uint8_t ucChannel, uint8_t ucSize, uint8_t *aucMesg)); + +/** @brief This function is used to send an acknowledge message. This message requests an acknowledgement from the slave to validate reception. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel to send the data on. + * @param[in] ucSize is an unsigned char (1 octet) denoting the size of the message, ucSize must be 8. + * @param[in] aucMesg is the buffer where the message is located (array must be 8 octets). + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + * ::NRF_ANT_ERROR_MESSAGE_SIZE_EXCEEDS_LIMIT + * ::NRF_ANT_ERROR_INVALID_SCAN_TX_CHANNEL + * ::NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE + * ::NRF_ANT_ERROR_TRANSFER_IN_PROGRESS + * ::NRF_ANT_ERROR_TRANSFER_IN_ERROR + */ +SVCALL(SVC_ANT_TX_ACKNOWLEDGED_MESSAGE, uint32_t, sd_ant_acknowledge_message_tx (uint8_t ucChannel, uint8_t ucSize, uint8_t *aucMesg)); + +/** @brief This function is used to queue data for burst transmission. After every successful call, the input buffer is held in use by the burst handler and must not be changed. + * When the burst handler releases the input buffer, it will either generate a EVENT_TRANSFER_NEXT_DATA_BLOCK event or clear a specified wait flag assigned to the + * burst handler. Transfer end events: EVENT_TRANSFER_TX_COMPLETED and EVENT_TRANSFER_TX_FAILED also releases the input buffer. Special care must be made to ensure that + * the input buffer does not change until it is released by the burst handler to avoid data corruption. Use of burst segment identifiers (BURST_SEGMENT_START, BURST_SEGMENT_CONTINUE, + * and BURST_SEGMENT_END) is required to indicate the sequence of the data block being sent as a burst transfer. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel to do a burst transmission. + * @param[in] usSize is an unsigned short (2 octets) denoting the size of the message block. Size must be divisible by 8. + * @param[in] aucData is the buffer where the message block is located. + * @param[in] ucBurstSegment is an unsigned char (1 octet) containing a bitfield representing the message block type. See Tx Burst Handler Request Segment Defines in ant_parameters.h. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + * ::NRF_ANT_ERROR_INVALID_SCAN_TX_CHANNEL + * ::NRF_ANT_ERROR_CHANNEL_NOT_OPENED + * ::NRF_ANT_ERROR_TRANSFER_SEQUENCE_NUMBER_ERROR + * ::NRF_ANT_ERROR_TRANSFER_IN_PROGRESS + * ::NRF_ANT_ERROR_TRANSFER_IN_ERROR + * ::NRF_ANT_ERROR_MESSAGE_SIZE_EXCEEDS_LIMIT + * ::NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE + * ::NRF_ANT_ERROR_TRANSFER_BUSY + */ +SVCALL(SVC_ANT_BURST_HANDLER_REQUEST, uint32_t, sd_ant_burst_handler_request(uint8_t ucChannel, uint16_t usSize, uint8_t *aucData, uint8_t ucBurstSegment)); + +/** @brief This function clears a pending transmit. Primarily intended for shared slave channels (receive channel). + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel to clear pending transmit. + * @param[out] pucSuccess is the pointer to an unsigned char (1 octet) where the result will be stored. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_PENDING_TRANSMIT_CLEAR, uint32_t, sd_ant_pending_transmit_clear (uint8_t ucChannel, uint8_t *pucSuccess)); + +/** @brief This function kills a receive transfer that is in progress. + * + * @return ::NRF_SUCCESS + */ +SVCALL(SVC_ANT_TRANSFER_STOP, uint32_t, sd_ant_transfer_stop (void)); + +/********************** RADIO CONFIGURATION APIS **************************/ + +/** @brief This function sets the 64bit network address. + * + * @param[in] ucNetwork is an unsigned char (1 octet) denoting the network number to assign the network address to. + * @param[in] aucNetworkKey is the pointer to location of the Network Key (8 octets in length) + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_NETWORK_NUMBER + */ +SVCALL(SVC_ANT_NETWORK_KEY_SET, uint32_t, sd_ant_network_address_set (uint8_t ucNetwork, uint8_t *aucNetworkKey)); + +/** @brief This function sets the radio frequency of an ANT channel. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to set to. + * @param[in] ucFreq is an unsigned char (1 octet) denoting the radio frequency offset from 2400MHz (eg. 2466MHz, ucFreq = 66). + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_NETWORK_NUMBER + */ +SVCALL(SVC_ANT_CHANNEL_RADIO_FREQ_SET, uint32_t, sd_ant_channel_radio_freq_set (uint8_t ucChannel, uint8_t ucFreq)); + +/** @brief This function returns the radio frequency of an ANT channel. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to query. + * @param[out] pucRfreq is the pointer to an unsigned char (1 octet) where the frequency will be stored. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_CHANNEL_RADIO_FREQ_GET, uint32_t, sd_ant_channel_radio_freq_get (uint8_t ucChannel, uint8_t *pucRfreq)); + +/** @brief This function sets the radio tx power. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to assign the radio tx power. + * @param[in] ucTxPower is an unsigned char (1 octet) denoting the ANT transmit power index. See Radio TX Power Definitions in ant_parameters.h. + * @param[in] ucCustomTxPower is an unsigned char (1 octet) denoting the custom nRF transmit power as defined in nrf51_bitfields.h. Only applicable if ucTxPower is set to custom tx power selection. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_CHANNEL_RADIO_TX_POWER_SET, uint32_t, sd_ant_channel_radio_tx_power_set (uint8_t ucChannel, uint8_t ucTxPower, uint8_t ucCustomTxPower)); + +/** @brief This function sets the sensitivity threshold for acquisition on a searching channel. One time set. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number. + * @param[in] ucProxThreshold is an unsigned char (1 octet) denoting the minimum RSSI threshold required for acquisition during a search. See Radio Proximity Search Threshold in ant_parameters.h + * @param[in] ucCustomProxThreshold is an unsigned char (1 octet) denoting the custom minimum RSSI threshold for acquisition during a search. Only applicable if ucProxThreshold is set to custom proximity selection. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_PROX_SEARCH_SET, uint32_t, sd_ant_prox_search_set (uint8_t ucChannel, uint8_t ucProxThreshold, uint8_t ucCustomProxThreshold)); + +/********************** CONFIGURATION APIS ********************************/ + +/** @brief This function sets the channel period. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to set the period to. + * @param[in] usPeriod is an unsigned short (2 octets) denoting the period in 32 kHz counts (usPeriod/32768 s). + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_CHANNEL_PERIOD_SET, uint32_t, sd_ant_channel_period_set (uint8_t ucChannel, uint16_t usPeriod)); + +/** @brief This function returns the current channel period. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to query. + * @param[out] pusPeriod is the pointer to an unsigned short (2 octets) where the channel period will be stored. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_CHANNEL_PERIOD_GET, uint32_t, sd_ant_channel_period_get (uint8_t ucChannel, uint16_t *pusPeriod)); + +/** @brief This function sets the channel ID. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to set. + * @param[in] usDeviceNumber is an unsigned short (2 octets) denoting the device number. + * @param[in] ucDeviceType is an unsigned char (1 octet) denoting the device type. + * @param[in] ucTransmitType is an unsigned char (1 octet) denoting the transmission type. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_CHANNEL_ID_SET, uint32_t, sd_ant_channel_id_set (uint8_t ucChannel, uint16_t usDeviceNumber, uint8_t ucDeviceType, uint8_t ucTransmitType)); + +/** @brief This function returns the current Channel ID of a channel. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to query. + * @param[out] pusDeviceNumber is the pointer to an unsigned short (2 octets) where the device number will be stored. + * @param[out] pucDeviceType is the pointer to an unsigned char (1 octet) where the device type will be stored. + * @param[out] pucTransmitType is the pointer to an unsigned char (1 octet) where the transmit type will be stored. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_CHANNEL_ID_GET, uint32_t, sd_ant_channel_id_get (uint8_t ucChannel, uint16_t *pusDeviceNumber, uint8_t *pucDeviceType, uint8_t *pucTransmitType)); + +/** @brief This function sets the searching waveform value of an ANT Channel. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to set. + * @param[in] usWaveform is an unsigned short (2 octets) denoting the channel waveform period (usWaveform/32768 s). Default = 316. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_SEARCH_WAVEFORM_SET, uint32_t, sd_ant_search_waveform_set (uint8_t ucChannel, uint16_t usWaveform)); + +/** @brief This function sets the receive channel search timeout. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to set. + * @param[in] ucTimeout is an unsigned char (1 octet) denoting the timeout value in 2.5 second increments. Default = 10 (25s). + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_CHANNEL_RX_SEARCH_TIMEOUT_SET, uint32_t, sd_ant_channel_rx_search_timeout_set (uint8_t ucChannel, uint8_t ucTimeout)); + +/** @brief This function sets the channel's search priority. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to set. + * @param[in] ucSearchPriority is an unsigned char (1 octet) denoting the search priority value. 0 to 7 (Default = 0). + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_SEARCH_CHANNEL_PRIORITY_SET, uint32_t, sd_ant_search_channel_priority_set (uint8_t ucChannel, uint8_t ucSearchPriority)); + +/** @brief This function sets the search cycle number of separate searching channels for active search time sharing. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to configure. + * @param[in] ucCycles is an unsigned char (1 octet) denoting the number of cycles to set. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_ACTIVE_SEARCH_SHARING_CYCLES_SET, uint32_t, sd_ant_active_search_sharing_cycles_set (uint8_t ucChannel, uint8_t ucCycles)); + +/** @brief This function returns the search sharing cycles number of the specified searching channel for active search time sharing. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to query. + * @param[out] pucCycles is the pointer to an unsigned char (1 octet) where the cycle value will be stored. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_ACTIVE_SEARCH_SHARING_CYCLES_GET, uint32_t, sd_ant_active_search_sharing_cycles_get (uint8_t ucChannel, uint8_t *pucCycles)); + +/** @brief This function sets the low priority search timeout value of a channel. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to set. + * @param[in] ucTimeout is an unsigned char (1 octet) denoting the timeout value in 2.5 seconds increments. Default = 2 (5s). + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_CHANNEL_LOW_PRIO_RX_SEARCH_TIMEOUT_SET, uint32_t, sd_ant_channel_low_priority_rx_search_timeout_set (uint8_t ucChannel, uint8_t ucTimeout)); + +/** @brief This function sets the advanced burst configuration. Configuration structure is as follows: + * Required Byte0 = 0-Disable, 1-Enable. See Advanced Burst Configuration Defines in ant_parameters.h. + * Required Byte1 = RF payload size. See Advanced Burst Configuration Defines in ant_parameters.h. + * Required Byte2 = Required advanced burst modes. See Advanced Burst Configuration Defines in ant_parameters.h. + * Required Byte3 = 0, Reserved + * Required Byte4 = 0, Reserved + * Required Byte5 = Optional advanced burst modes. See Advanced Burst Configuration Defines in ant_parameters.h. + * Required Byte6 = 0, Reserved + * Required Byte7 = 0, Reserved + * Optional Byte8 = Advanced burst stalling count config LSB. Typical is 3210 (~10s of stalling) where each count represents ~3ms of stalling. + * Optional Byte9 = Advanced burst stalling count config MSB. + * Optional Byte10 = Advanced burst retry count cycle extension. Typical is 3 (15 retries) where each count cycles represents 5 retries. + * + * @param[in] aucConfig is a buffer containing the advanced burst configuration to be set (as stated above). + * @param[in] ucSize is an unsigned char (1 octet) denoting the size of the configuration parameter buffer. Minimum config set is 8 octets, maximum is 11 octets. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_ADV_BURST_CONFIG_SET, uint32_t, sd_ant_adv_burst_config_set (uint8_t *aucConfig, uint8_t ucSize)); + +/** @brief This function gets the advance burst configuration and supported capabilities. + * Returned structure is as follows for configuration: + * Byte0 = RF payload size. See Advanced Burst Configuration Defines in ant_parameters.h. + * Byte1 = Required advanced burst modes. See Advanced Burst Configuration Defines in ant_parameters.h. + * Byte2 = 0, Reserved + * Byte3 = 0, Reserved + * Byte4 = Optional advanced burst modes. See Advanced Burst Configuration Defines in ant_parameters.h. + * Byte5 = 0, Reserved + * Byte6 = 0, Reserved + * Byte7 = Advanced burst stalling count config LSB. Each count represents ~3ms of stalling. + * Byte8 = Advanced burst stalling count config MSB + * Byte9 = Advanced burst retry count cycle extension. Each count cycle represents 5 retries. + * + * Returned structure is as follows for capabilities: + * Byte0 = Supported RF payload size. See Advanced Burst Configuration Defines in ant_parameters.h. + * Byte1 = Supported burst configurations. See Advanced Burst Configuration Defines in ant_parameters.h. + * Byte2 = 0, Reserved + * Byte3 = 0, Reserved + * + * @param[in] ucRequestType is an unsigned char (1 octet) denoting the type of request. 1 = configuration, 0 = capability. + * @param[out] aucConfig is the pointer to the buffer where the configuration/capabilities will be read to. The array should be at least 10 octets + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + */ +SVCALL(SVC_ANT_ADV_BURST_CONFIG_GET, uint32_t, sd_ant_adv_burst_config_get (uint8_t ucRequestType, uint8_t *aucConfig)); + +/** @brief This function sets the ANT Messaging Library Configuration used by Extended messaging. + * + * @param[in] ucANTLibConfig is an unsigned char (1 octet) denoting the ANT lib config bit flags. See ANT Library Config in ant_parameters.h. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_LIB_CONFIG_SET, uint32_t, sd_ant_lib_config_set (uint8_t ucANTLibConfig)); + +/** @brief This function clears the ANT Messaging Library Configuration. + * + * @param[in] ucANTLibConfig is an unsigned char (1 octet) denoting the ANT lib Config bit(s) to clear. See ANT Library Config in ant_parameters.h. + * + * @return ::NRF_SUCCESS + */ +SVCALL(SVC_ANT_LIB_CONFIG_CLEAR, uint32_t, sd_ant_lib_config_clear (uint8_t ucANTLibConfig)); + +/** @brief This function returns current ANT Messaging Library Configuration. + * + * @param[out] pucANTLibConfig is the pointer to an unsigned char (1 octet) where the bit flags will be stored. See ANT Library Config in ant_parameters.h. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + */ +SVCALL(SVC_ANT_LIB_CONFIG_GET, uint32_t, sd_ant_lib_config_get (uint8_t *pucANTLibConfig)); + +/** @brief This function is used to add a Device ID to an include or exclude list. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to add the list entry to. + * @param[in] aucDevId is the pointer to the buffer (4 octets) containing device ID information with the following format: + * Byte0 = DeviceNumber_LSB + * Byte1 = DeviceNumber_MSB + * Byte2 = DeviceType + * Byte3 = TransType + * @param[in] ucListIndex is an unsigned char (1 octet) denoting the index where the specified Channel ID is to be placed in the list (0-3). + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + * ::NRF_ANT_ERROR_INVALID_LIST_ID + */ +SVCALL(SVC_ANT_ID_LIST_ADD, uint32_t, sd_ant_id_list_add (uint8_t ucChannel, uint8_t *aucDevId, uint8_t ucListIndex)); + +/** @brief This function is used to configure the device ID list as include or exclude as well as the number of IDs to compare against. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number of the device ID list. + * @param[in] ucIDListSize is an unsigned char (1 octet) denoting the size of the inclusion or exclusion list (0-4). + * @param[in] ucIncExcFlag is an unsigned char (1 octet) denoting the type of list as Include(0) or Exclude(1) + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + * ::NRF_ANT_ERROR_INVALID_LIST_ID + */ +SVCALL(SVC_ANT_ID_LIST_CONFIG, uint32_t, sd_ant_id_list_config (uint8_t ucChannel, uint8_t ucIDListSize, uint8_t ucIncExcFlag)); + +/** @brief This function populates the frequency hop table list. This table is used when frequency hopping is enabled on a channel via extended assignment bit. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to set the frequency hop table list. + * @param[in] ucFreq0 is an unsigned char (1 octet) denoting the offset from 2400MHz of the 1st frequency hop value. + * @param[in] ucFreq1 is an unsigned char (1 octet) denoting the offset from 2400MHz of the 2nd frequency hop value. + * @param[in] ucFreq2 is an unsigned char (1 octet) denoting the offset from 2400MHz of the 3rd frequency hop value. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_AUTO_FREQ_HOP_TABLE_SET, uint32_t, sd_ant_auto_freq_hop_table_set (uint8_t ucChannel, uint8_t ucFreq0, uint8_t ucFreq1, uint8_t ucFreq2)); + +/** @brief This function is used to specify filter configuration for channel event message generation. + * + * @param[in] usFilter is an unsigned short (2 octets) denoting the filter configuration bitfield. See Event Filtering in ant_parameters.h. + * + * @return ::NRF_SUCCESS + */ +SVCALL(SVC_ANT_EVENT_FILTERING_SET, uint32_t, sd_ant_event_filtering_set (uint16_t usFilter)); + +/** @brief This function is used to retrieve the filter configuration for channel event message generation. + * + * @param[out] pusFilter is the pointer to an unsigned short (2 octets) where the filter configuration will be stored. See Event Filtering in ant_parameters.h. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + */ +SVCALL(SVC_ANT_EVENT_FILTERING_GET, uint32_t, sd_ant_event_filtering_get (uint16_t *pusFilter)); + +/*************************** STATUS APIS **********************************/ + +/** @brief This function gets the ANT activity status. + * + * @param[out] pbAntActive is the pointer to an unsigned char (1 octet) where the ANT activity value will be stored. 1 = active, 0 = otherwise. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + */ +SVCALL(SVC_ANT_ACTIVE, uint32_t, sd_ant_active (uint8_t *pbAntActive)); + +/** @brief This function gets the status if the channel is in progress. + * + * @param[out] pbChannelInProgress is the pointer to an unsigned char (1 octet) where the result will be stored. 1 = in progress, 0 = otherwise. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + */ +SVCALL(SVC_ANT_CHANNEL_IN_PROGRESS, uint32_t, sd_ant_channel_in_progress (uint8_t *pbChannelInProgress)); + +/** @brief This function gets a specific channel's status. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to query. + * @param[out] pucStatus is the pointer to an unsigned char (1 octet) where the channel status will be stored. See Channel Status in ant_parameters.h. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_CHANNEL_STATUS_GET, uint32_t, sd_ant_channel_status_get (uint8_t ucChannel, uint8_t *pucStatus)); + +/** @brief This function determines if there is a pending transmission on a specific channel. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel number to query. + * @param[out] pucPending is the pointer to an unsigned char (1 octet) where the pending result will be stored. 1 = pending, 0 = otherwise. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_PENDING_TRANSMIT, uint32_t, sd_ant_pending_transmit (uint8_t ucChannel, uint8_t *pucPending)); + +/*************************** TEST APIS **********************************/ + +/** @brief This function initialize the stack to get ready for a continuous wave transmission test. + * + * @return ::NRF_SUCCESS + */ +SVCALL(SVC_ANT_INIT_CW_TEST_MODE, uint32_t, sd_ant_cw_test_mode_init (void)); + +/** @brief This function starts a continuous wave test mode transmission. + * + * @param[in] ucRadioFreq is an unsigned char (1 octet) denoting the radio frequency offset from 2400MHz for continuous wave mode. (eg. 2466MHz, ucRadioFreq = 66). + * @param[in] ucTxPower is an unsigned char (1 octet) denoting the ANT transmit power index for continuous wave mode. See Radio TX Power Definitions in ant_parameters.h + * @param[in] ucCustomTxPower is an unsigned char (1 octet) denoting the custom nRF transmit power as defined in nrf51_bitfields.h. Only applicable if ucTxPower is set to custom tx power selection. + * @param[in] ucMode is an unsigned char (1 octet) denoting test mode type where 0 = cw tx carrier transmission, 1 = cw tx modulated transmission + * + * @return ::NRF_SUCCESS + */ +SVCALL(SVC_ANT_CW_TEST_MODE, uint32_t, sd_ant_cw_test_mode (uint8_t ucRadioFreq, uint8_t ucTxPower, uint8_t ucCustomTxPower, uint8_t ucMode)); + +/** @brief This function gets the version string of the ANT stack. + * + * @param[out] aucVersion is the pointer to the buffer where the version string will be copied, the array should be at least 11 octets. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + */ +SVCALL(SVC_ANT_VERSION, uint32_t, sd_ant_version_get (uint8_t* aucVersion)); + +/** @brief This function gets the capabilities of the stack. + * + * @param[out] aucCapabilities is the pointer to the buffer where the capabilities message will be copied, the array should be at least 8 octets. + * Byte0 = Maximum supported ANT channels + * Byte1 = Maximum supported ANT networks + * Byte2 = CAPABILITIES_STANDARD. See Standard capabilities defines in ant_parameters.h + * Byte3 = CAPABILITIES_ADVANCED. See Advanced capabilities defines in ant_parameters.h + * Byte4 = CAPABILITIES_ADVANCED_2. See Advanced capabilities 2 defines in ant_parameters.h + * Byte5 = Maximum support ANT data channels (only applicable for SensRcore support) + * Byte6 = CAPABILITIES_ADVANCED_3. See Advanced capabilities 3 defines in ant_parameters.h + * Byte7 = CAPABILITIES_ADVANCED_4. Advanced capabilities 4 defines in ant_parameters.h + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + */ +SVCALL(SVC_ANT_CAPABILITIES, uint32_t, sd_ant_capabilities_get (uint8_t* aucCapabilities)); + +/*********************** MORE DATA APIS ****************************************/ + +/** @brief This function assigns a wait variable to the the burst handler. When the input buffer is locked by the handler the wait flag is set to 1. When the + * input buffer is unlocked, the wait flag is set to 0. When a wait flag is assigned, EVENT_TRANSFER_NEXT_DATA_BLOCK events will not + * be generated until the wait flag unassigned. The wait flag should be declared as a static variable. + * + * @param[in] pucWaitFlag is the pointer to a static unsigned char (1 octet) where the status of the burst handler will be updated. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_TRANSFER_IN_PROGRESS + */ +SVCALL(SVC_ANT_BURST_HANDLER_WAIT_FLAG_ENABLE, uint32_t, sd_ant_burst_handler_wait_flag_enable (uint8_t* pucWaitFlag)); + +/** @brief This function unassigns any previously assigned wait variable from the burst handler. The burst handler returns to the default method in generating + * EVENT_TRANSFER_NEXT_DATA_BLOCK to indicate input buffer unlock. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_TRANSFER_IN_PROGRESS + */ +SVCALL(SVC_ANT_BURST_HANDLER_WAIT_FLAG_DISABLE, uint32_t, sd_ant_burst_handler_wait_flag_disable (void)); + +/********************** MORE CONFIGURATION API ********************************/ + +/** @brief This function is used to assign a selective data update (SDU) mask (8 octets) to an identifier, ucMask. + * + * @param[in] ucMask is an unsigned char (1 octet) denoting the index representing the SDU data mask. + * @param[in] aucMask is a buffer (8 octets) containing the SDU mask to be assigned to ucMask. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_SDU_MASK_SET, uint32_t, sd_ant_sdu_mask_set (uint8_t ucMask, uint8_t *aucMask)); + +/** @brief This function returns the selective data update (SDU) mask (8 octets) from the specified identifier, ucMask. + * + * @param[in] ucMask is an unsigned char (1 octet) denoting the index representing the SDU data mask. + * @param[out] aucMask is a pointer to the buffer where the SDU data mask will be copied, the array should be at least 8 octects. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_SDU_MASK_GET, uint32_t, sd_ant_sdu_mask_get (uint8_t ucMask, uint8_t *aucMask)); + +/** @brief This function assigns a SDU mask configuration to a particular channel. The configuration specifies the mask identifier and the type of rx data in which the mask should be applied to. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel in which the SDU mask configuration is to be applied to. + * @param[in] ucMaskConfig is an unsigned char (1 octet) denoting SDU mask configuration. See Selective Data Update Mask Configuration Defines in ant_parameters.h. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_SDU_MASK_CONFIG, uint32_t, sd_ant_sdu_mask_config (uint8_t ucChannel, uint8_t ucMaskConfig)); + +/** @brief This function enables/disables 128-bit AES encryption mode to the specified channel. Advanced burst must be enabled beforehand to enable encrypted channel. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel in which encryption mode is set. + * @param[in] ucEnable is an unsigned char (1 octet) denoting the encryption mode. See Encrypted Channel Defines in ant_parameters.h. + * @param[in] ucKeyNum is an unsigned char (1 octet) denoting the key index of the 128-bit key to be used for encryption. The key index range is bound by the number of + encrypted channels configured by sd_ant_enable(). If sd_ant_enable() is not used then by default ucKeyNum is 0. Range is [0 to (num encrypted channels - 1)], + if 1 or more encrypted channels are configured. + * @param[in] ucDecimationRate is an unsigned char (1 octet) denoting the decimate rate to apply for encrypted slave channel. Must be > 0. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + * ::NRF_ANT_ERROR_INVALID_SCAN_TX_CHANNEL + * ::NRF_ANT_ERROR_CHANNEL_NOT_OPENED + * ::NRF_ANT_ERROR_TRANSFER_SEQUENCE_NUMBER_ERROR + * ::NRF_ANT_ERROR_TRANSFER_IN_PROGRESS + * ::NRF_ANT_ERROR_TRANSFER_IN_ERROR + * ::NRF_ANT_ERROR_MESSAGE_SIZE_EXCEEDS_LIMIT + * ::NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE + * ::NRF_ANT_ERROR_TRANSFER_BUSY + */ +SVCALL(SVC_ANT_CRYPTO_CHANNEL_ENABLE, uint32_t, sd_ant_crypto_channel_enable (uint8_t ucChannel, uint8_t ucEnable, uint8_t ucKeyNum, uint8_t ucDecimationRate)); + +/** @brief This function assigns a 128-bit AES encryption key to a key index. + * + * @param[in] ucKeyNum is an unsigned char (1 octet) denoting the key index for assignment. The key index range is bound by the number of encrypted channels configured + by sd_ant_enable(). If sd_ant_enable() is not used then by default ucKeyNum is 0. Range is [0 to (num encrypted channels - 1)], if 1 or more + encrypted channels are configured. + * @param[in] aucKey is a buffer (16 octets) containing the 128-bit AES key to be assigned to the key index. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_CRYPTO_KEY_SET, uint32_t, sd_ant_crypto_key_set (uint8_t ucKeyNum, uint8_t *aucKey)); + + /** @brief This function sets specific information to be exchanged between the channel master and slave during encryption channel set-up/negotiation. + * + * @param[in] ucType is an unsigned char (1 octet) denoting the type of information being set. See Encrypted Channel Defines in ant_parameters.h. + * @param[in] aucInfo is a buffer containing the information being set (4 octets for ID, 19 octets for custom user data). + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + */ +SVCALL(SVC_ANT_CRYPTO_INFO_SET, uint32_t, sd_ant_crypto_info_set (uint8_t ucType, uint8_t *aucInfo)); + + /** @brief This function retrieves specific information to be exchanged between the channel master and slave during encryption channel set-up/negotiation. + * + * @param[in] ucType is an unsigned char (1 octet) denoting the type of information being requested. See Encrypted Channel Defines in ant_parameters.h. + * @param[out] aucInfo is a pointer to a buffer in which the information retrieved will be copied to (1 octet for supported mode, 4 octets for ID, 19 octets for custom user data). + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + */ +SVCALL(SVC_ANT_CRYPTO_INFO_GET, uint32_t, sd_ant_crypto_info_get (uint8_t ucType, uint8_t *aucInfo)); + + /** @brief This function enables/disables event notifications to be generated to the application indicating the time to the next ANT radio activity exceeds the configured time threshold. + * Latency (delay in event notification being received and processed by application) must be taken into account if attempting to use this generated event to perform + * operations prior to the radio activity. Cannot be used if asynchronous tx channel is assigned or used. Please note that this only generates events for ANT radio activity. + * + * @param[in] ucMode is an unsigned char (1 octet) denoting the mode of event notification. See RFActive Notification Defines in ant_parameters.h. + * @param[in] usTimeThreshold is an unsigned short (2 octets) denoting the minimum time threshold (32 kHz counts (usTimeThreshold/32768 s)) before the next radio activity that will trigger generation of the event notification. + * + * @return ::NRF_SUCCESS + * ::NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED + * ::NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE + */ +SVCALL(SVC_ANT_RFACTIVE_NOTIFICATION_CONFIG_SET, uint32_t, sd_ant_rfactive_notification_config_set (uint8_t ucMode, uint16_t usTimeThreshold)); + + /** @brief This function retrieves the ANT rf active notification configuration + * + * @param[in] pucMode is a pointer to an unsigned char (1 octet) where the configured mode of event notification will be stored. + * @param[out] pusTimeThreshold is a pointer to an unsigned short (2 octets) where the configured time threhold value will be stored. Time threshold is in 32 kHz counts (usTimeThreshold/32768 s). + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + */ +SVCALL(SVC_ANT_RFACTIVE_NOTIFICATION_CONFIG_GET, uint32_t, sd_ant_rfactive_notification_config_get (uint8_t *pucMode, uint16_t *pusTimeThreshold)); + + /** @brief This function sets ANT radio coexistence behaviour. Supported only if ANT is sharing radio HW concurrently with another wireless protocol. + * Configuration structure is as follows: + * Byte0 = Configuration enable bitfield + * bit0 - enable/disable tx/rx channel keep alive config (Byte4/5 & Byte6/7) + * bit1 - enable/disable tx/rx channel fixed interval priority config (Byte1) + * bit2 - enable/disable transfer keep alive config (Byte2) + * bit3 - enable/disable search channel fixed interval priority config (Byte3) + * else - reserved + * Byte1 = tx/rx channel fixed interval priority configuration + * Byte2 = transfer keep alive configuration + * Byte3 = search channel fixed interval priority configuration + * Byte4(LSB)/Byte5(MSB) = tx channel keep alive configuration + * Byte6(LSB)/Byte7(MSB) = rx channel keep alive configuration + * + * Advanced configuration structure is as follows: + * Byte0 = Configuration enable bitfield + * bit0 - enable/disable priority override config (Byte1) + * bit1-7 - reserved + * Byte1 = ANT priority override. 0 = low, 1 = normal(default), 2 = high, 3 = critical + * Byte2 = Reserved + * Byte3 = Reserved + * Byte4 = Reserved + * Byte5 = Reserved + * Byte6 = Reserved + * Byte7 = Reserved + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel for which the coexistence configuration is to be set. + * @param[in] aucCoexConfig is a buffer containing the coex configuration to be set. Must be 8 octet in size. Set as null for no change. + * @param[in] aucAdvCoexConfig is a buffer containing the advanced coex configuration to be set. Must be 8 octet in size. Set as null for no change. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + */ +SVCALL(SVC_ANT_COEX_CONFIG_SET, uint32_t, sd_ant_coex_config_set (uint8_t ucChannel, uint8_t *aucCoexConfig, uint8_t *aucAdvCoexConfig)); + + /** @brief This function retrieves the configured ANT radio coexistence behaviour as described in ant_coex_config_set. + * + * @param[in] ucChannel is an unsigned char (1 octet) denoting the channel to query. + * @param[out] aucCoexConfig is the pointer to a buffer where the coexistence configuration will be stored. Must be at least 8 octet in size. Set as null to ignore. + * @param[out] aucAdvCoexConfig is the pointer to a buffer where the advanced coexistence configuration will be stored. Must be at least 8 octet in size. Set as null to ignore. + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + */ +SVCALL(SVC_ANT_COEX_CONFIG_GET, uint32_t, sd_ant_coex_config_get (uint8_t ucChannel, uint8_t *aucCoexConfig, uint8_t *aucAdvCoexConfig)); + + /** @brief This function is used to specify the total number of ANT channels, number of encrypted channels (subset of total ANT channels) and transmit burst queue size to be supported + * by the ANT stack. Upon enabling the SoftDevice successfully, the ANT stack defaults to supporting 1 ANT channel (encryption capable) and a 64 byte transmit burst buffer. If additional + * channels are needed and/or more encrypted channels are needed and/or larger tx burst buffer size is needed, then the desired configuration can be specified to the SoftDevice + * using this function. In this case, a static RAM buffer (of minimum size defined by ANT_ENABLE_GET_REQUIRED_SPACE) must be supplied by the application to be used by the ANT SoftDevice stack. + * + * Notes: - If used, function should be called immediately after sd_softdevice_enable() and before any ANT related SVC calls. + * - Using sd_ant_stack_reset() will not reset ANT stack channel allocation configuration. It will be maintained. + * - Disabling the SoftDevice and then re-enabling the SoFtDevice will reset channel allocation to default. Any previously supplied memory buffer by the application will not be used. + * + * + * @param[in] pstChannelEnable is a pointer to ANT_ENABLE structure. + * where ucTotalNumberOfChannels is an unsigned char (1 octet) denoting the total number of ANT channels desired (1 to MAX_ANT_CHANNELS, defined in ant_parameters.h) + * where ucTotalNumberOfEncryptedChannels is an unsigned char (1 octet) denoting the total number of ANT channels (0 to ucTotalNumberOfChannels) that support encryption + * where pucMemoryBlockStartLocation is the pointer to an application supplied buffer to be used by the ANT SoftDevice stack. + * where usMemoryBlockByteSize is an unsigned short (2 octet) denoting the size of the given memory block (pucMemoryBlockStartLocation). The defined ANT_ENABLE_GET_REQUIRED_SPACE + * macro (see ant_parameters.h) should be used to determine the minimum buffer size requirement + * + * @return ::NRF_SUCCESS + * ::NRF_ERROR_INVALID_PARAM + */ +SVCALL(SVC_ANT_ENABLE, uint32_t, sd_ant_enable(ANT_ENABLE * const pstChannelEnable)); + +/** @brief Extended0 ANT SVCs. Access extended SVC functions via ucExtID +* +* @param[in] ucExtID is the extended ID defined by SD_ANT_EXT0_ID_ +* @param[in,out] pvArg0 is first argument to extended ANT SVC function specified by ucExtID +* @param[in,out] pvArg1 is second argument to extended ANT SVC function specified by ucExtID +* @param[in,out] pvArg2 is third argument to extended ANT SVC function specified by ucExtID +* +* @return Return value(s) of extended ANT SVC function specified by ucExtID +*/ +SVCALL(SVC_ANT_EXTENDED0, uint32_t, sd_ant_extended0 (uint8_t ucExtID, void *pvArg0, void *pvArg1, void *pvArg2)); + +/** @brief This function configures CPU wake on ANT RF activity behaviour. CPU is woken up via generation of SD_EVENT_IRQn interrupt upon the start of specified RF activity. In +* order to wakeup in the event that SD_EVENT_IRQn is disabled, the SEVONPEND flag has to be set in the Cortex-M0 System Control Register (SCR). CPU is dissallowed from +* entering low power state when calling sd_app_event_wait() for the duration of the RF activity. The intention of this function is to allow/disallow sudden shifts in +* current consumption during RF transmission/ RF reception window which may impact RF performance. When enabled there is a slight increase in average current consumption for +* ANT activities. +* +* @param[in] ucExtID = SD_ANT_EXT0_ID_WAKEON_RF_ACTIVITY_CONFIG_SET +* @param[in] pvArg0 is a pointer to unsigned char (1 octet) denoting the CPU wakeup configuration. See Wake On RF Activity Defines in ant_parameters.h. +* @param[in,out] pvArg1 is unused. Set to NULL. +* @param[in,out] pvArg2 is unused. Set to NULL. +* +* @return ::NRF_SUCCESS +* ::NRF_ERROR_INVALID_PARAM +*/ +#define SD_ANT_EXT0_ID_WAKEON_RF_ACTIVITY_CONFIG_SET 0x00 + +/** @brief This function retrieves the configured CPU wake on ANT RF activity behaviour. +* +* @param[in] ucExtID = SD_ANT_EXT0_ID_WAKEON_RF_ACTIVITY_CONFIG_GET +* @param[out] pvArg0 is a pointer to unsigned char (1 octet) denoting where the CPU wakeup configuration will be stored. +* @param[in,out] pvArg1 is unused. Set to NULL. +* @param[in,out] pvArg2 is unused. Set to NULL. +* +* @return ::NRF_SUCCESS +* ::NRF_ERROR_INVALID_PARAM +*/ +#define SD_ANT_EXT0_ID_WAKEON_RF_ACTIVITY_CONFIG_GET 0x01 + +/** @brief This function enables or disables a feature for preventing long periods of consecutive multi-tracking channel collisions. This feature is +* enabled by default/upon stack reset. +* +* @param[in] ucExtID = SD_ANT_EXT0_ID_ENHANCED_CHANNEL_SPACING_SET +* @param[out] pvArg0 is a pointer to unsigned char (1 octet) denoting enable/disable control. See Enhanced Channel Spacing Defines in ant_parameters.h +* @param[in,out] pvArg1 is unused. Set to NULL. +* @param[in,out] pvArg2 is unused. Set to NULL. +* +* @return ::NRF_SUCCESS +* ::NRF_ERROR_INVALID_PARAM +*/ +#define SD_ANT_EXT0_ID_ENHANCED_CHANNEL_SPACING_SET 0x02 + + +#endif // ANT_INTERFACE_H__ + +/** + @} + @} + @} + */ diff --git a/components/softdevice/s310/headers/ant_parameters.h b/components/softdevice/s310/headers/ant_parameters.h new file mode 100644 index 0000000..d7f38e2 --- /dev/null +++ b/components/softdevice/s310/headers/ant_parameters.h @@ -0,0 +1,725 @@ +/* + * Dynastream Innovations Inc. + * Cochrane, AB, CANADA + * + * Copyright (c) 2012 Dynastream Innovations Inc. + * THIS SOFTWARE IS AN EXAMPLE USAGE OF THE ANT PROTOCOL MODULE. + * IT MAY BE USED, MODIFIED and DISTRIBUTED ONLY WITH THE + * APPROPRIATE LICENSE AGREEMENT. + */ + +#ifndef ANTDEFINES_H +#define ANTDEFINES_H + +#include + +/** + @defgroup ant_parameters ANT Stack Parameters + @{ + @ingroup ant_interface +*/ + +////////////////////////////////////////////// +/** @name ANT Channel Init Definitions +@{ */ +////////////////////////////////////////////// +#define MAX_ANT_CHANNELS ((uint8_t)15) +#define SIZE_OF_NONENCRYPTED_ANT_CHANNEL ((uint8_t)88) +#define SIZE_OF_ENCRYPTED_ANT_CHANNEL ((uint8_t)21) +#define MIN_ANT_TX_BURST_QUEUE_SIZE ((uint8_t)64) + +#define IS_POWER_OF_TWO(A) ( ((A) != 0) && ((((A) - 1) & (A)) == 0) ) + +#define GET_TX_BURST_QUEUE_SIZE(requestedSize) \ + (requestedSize < MIN_ANT_TX_BURST_QUEUE_SIZE ? MIN_ANT_TX_BURST_QUEUE_SIZE : (IS_POWER_OF_TWO(requestedSize) ? requestedSize : MIN_ANT_TX_BURST_QUEUE_SIZE)) + +#define ANT_ENABLE_GET_REQUIRED_SPACE_MORE_THAN_TWO_CH(ucTotalNumberOfChannels, ucNumberOfEncryptedChannels, usTxQueueByteSize) \ + ((ucTotalNumberOfChannels - 2) * SIZE_OF_NONENCRYPTED_ANT_CHANNEL) + (ucNumberOfEncryptedChannels * SIZE_OF_ENCRYPTED_ANT_CHANNEL) + GET_TX_BURST_QUEUE_SIZE(usTxQueueByteSize) + +#define ANT_ENABLE_GET_REQUIRED_SPACE_LESS_THAN_OR_EQ_TWO_CH(ucNumberOfEncryptedChannels, usTxQueueByteSize) \ + (ucNumberOfEncryptedChannels * SIZE_OF_ENCRYPTED_ANT_CHANNEL) + GET_TX_BURST_QUEUE_SIZE(usTxQueueByteSize) + +#define ANT_ENABLE_GET_REQUIRED_SPACE(ucTotalNumberOfChannels, ucNumberOfEncryptedChannels, usTxQueueByteSize) \ + ucTotalNumberOfChannels > 2 ? \ + ANT_ENABLE_GET_REQUIRED_SPACE_MORE_THAN_TWO_CH(ucTotalNumberOfChannels, ucNumberOfEncryptedChannels, usTxQueueByteSize) : \ + ANT_ENABLE_GET_REQUIRED_SPACE_LESS_THAN_OR_EQ_TWO_CH(ucNumberOfEncryptedChannels, usTxQueueByteSize) +/** @} */ + +////////////////////////////////////////////// +/** @brief ANT Clock Definition */ +////////////////////////////////////////////// +#define ANT_CLOCK_FREQUENCY ((uint32_t)32768) ///< ANT system clock frequency. + +////////////////////////////////////////////// +/** @brief ANT Message Payload Size */ +////////////////////////////////////////////// +#define ANT_STANDARD_DATA_PAYLOAD_SIZE ((uint8_t)8) ///< Standard data payload size + +////////////////////////////////////////////// +/** @name Radio TX Power Definitions +@{ */ +////////////////////////////////////////////// +#define RADIO_TX_POWER_LVL_CUSTOM ((uint8_t)0x80) ///< Custom tx power selection +#define RADIO_TX_POWER_LVL_0 ((uint8_t)0x00) ///< Lowest ANT Tx power level setting. (-20dBm). +#define RADIO_TX_POWER_LVL_1 ((uint8_t)0x01) ///< ANT Tx power > Lvl 0. (-12dBm) +#define RADIO_TX_POWER_LVL_2 ((uint8_t)0x02) ///< ANT Tx power > Lvl 1. (-4dBm) +#define RADIO_TX_POWER_LVL_3 ((uint8_t)0x03) ///< ANT Tx power > Lvl 2. Default tx power level. (0dBm) +#define RADIO_TX_POWER_LVL_4 ((uint8_t)0x04) ///< ANT Tx power > Lvl 3. (+4dBm) +/** @} */ + +////////////////////////////////////////////// +/** @name Radio Proximity Search Threshold +@{ */ +////////////////////////////////////////////// +#define PROXIMITY_THRESHOLD_CUSTOM ((uint8_t)0x80) ///< Custom proximity search selection. +#define PROXIMITY_THRESHOLD_OFF ((uint8_t)0x00) ///< Disable proximity search detection. +#define PROXIMITY_THRESHOLD_1 ((uint8_t)0x01) ///< Proximity search detection radius > preset threshold (~ -44dBm on nRF51) +#define PROXIMITY_THRESHOLD_2 ((uint8_t)0x02) ///< Proximity search detection radius > preset threshold (~ -48dBm on nRF51). +#define PROXIMITY_THRESHOLD_3 ((uint8_t)0x03) ///< Proximity search detection radius > preset threshold (~ -52dBm on nRF51). +#define PROXIMITY_THRESHOLD_4 ((uint8_t)0x04) ///< Proximity search detection radius > preset threshold (~ -56dBm on nRF51). +#define PROXIMITY_THRESHOLD_5 ((uint8_t)0x05) ///< Proximity search detection radius > preset threshold (~ -60dBm on nRF51). +#define PROXIMITY_THRESHOLD_6 ((uint8_t)0x06) ///< Proximity search detection radius > preset threshold (~ -64dBm on nRF51). +#define PROXIMITY_THRESHOLD_7 ((uint8_t)0x07) ///< Proximity search detection radius > preset threshold (~ -68dBm on nRF51). +#define PROXIMITY_THRESHOLD_8 ((uint8_t)0x08) ///< Proximity search detection radius > preset threshold (~ -72dBm on nRF51). +#define PROXIMITY_THRESHOLD_9 ((uint8_t)0x09) ///< Proximity search detection radius > preset threshold (~ -76dBm on nRF51). +#define PROXIMITY_THRESHOLD_10 ((uint8_t)0x0A) ///< Proximity search detection radius > preset threshold (~ -80dBm on nRF51). +/** @} */ + +////////////////////////////////////////////// +/** @name Assign Channel Parameters +@{ */ +////////////////////////////////////////////// +#define PARAMETER_RX_NOT_TX ((uint8_t)0x00) ///< Bitfield for slave channel. +#define PARAMETER_TX_NOT_RX ((uint8_t)0x10) ///< Bitfield for master channel. +#define PARAMETER_SHARED_CHANNEL ((uint8_t)0x20) ///< Bitfield for enabling shared channel mode for master or slave channel. +#define PARAMETER_NO_TX_GUARD_BAND ((uint8_t)0x40) ///< Bitfield for enabling tx only mode for master channel. +#define PARAMETER_RX_ONLY ((uint8_t)0x40) ///< Bitfield for enabling rx only mode for slave channel. +/** @} */ + +////////////////////////////////////////////// +/** @name Extended Assign Channel Parameters +@{ */ +////////////////////////////////////////////// +#define EXT_PARAM_ALWAYS_SEARCH ((uint8_t)0x01) ///< Bitfield for enabling background searching behaviour. +#define EXT_PARAM_IGNORE_TRANSMISSION_TYPE ((uint8_t)0x02) ///< Bitfield for enabling ignore transmission type behaviour. +#define EXT_PARAM_FREQUENCY_AGILITY ((uint8_t)0x04) ///< Bitfield for enabling frequency agility behaviour. +#define EXT_PARAM_AUTO_SHARED_SLAVE ((uint8_t)0x08) ///< Auto shared channel. +#define EXT_PARAM_FAST_INITIATION_MODE ((uint8_t)0x10) ///< Channel fast initiation mode. +#define EXT_PARAM_ASYNC_TX_MODE ((uint8_t)0x20) ///< Async transmit channel. +/** @} */ + +////////////////////////////////////////////// +/** @name Assign Channel Types +@{ */ +////////////////////////////////////////////// +#define CHANNEL_TYPE_SLAVE ((uint8_t) 0x00) ///< Slave channel (PARAMETER_RX_NOT_TX). +#define CHANNEL_TYPE_MASTER ((uint8_t) 0x10) ///< Master channel (PARAMETER_TX_NOT_RX). +#define CHANNEL_TYPE_SLAVE_RX_ONLY ((uint8_t) 0x40) ///< Slave rx only channel (PARAMETER_RX_NOT_TX | PARAMETER_RX_ONLY). +#define CHANNEL_TYPE_MASTER_TX_ONLY ((uint8_t) 0x50) ///< Master tx only channel (PARAMETER_TX_NOT_RX | PARAMETER_NO_TX_GUARD_BAND). +#define CHANNEL_TYPE_SHARED_SLAVE ((uint8_t) 0x20) ///< Shared slave channel (PARAMETER_RX_NOT_TX | PARAMETER_SHARED_CHANNEL). +#define CHANNEL_TYPE_SHARED_MASTER ((uint8_t) 0x30) ///< Shared master channel (PARAMETER_TX_NOT_RX | PARAMETER_SHARED_CHANNEL). +/** @} */ + +////////////////////////////////////////////// +/** @name Channel ID Definitions +@{ */ +////////////////////////////////////////////// +#define ANT_ID_SIZE ((uint8_t)4) ///< 4 octet channel ID +#define ANT_ID_TRANS_TYPE_OFFSET ((uint8_t)3) ///< Transmission type offset in channel ID +#define ANT_ID_DEVICE_TYPE_OFFSET ((uint8_t)2) ///< Device type offset in channel ID +#define ANT_ID_DEVICE_NUMBER_HIGH_OFFSET ((uint8_t)1) ///< MSB Device number in channel ID +#define ANT_ID_DEVICE_NUMBER_LOW_OFFSET ((uint8_t)0) ///< LSB Device number in channel ID +#define ANT_ID_DEVICE_TYPE_PAIRING_FLAG ((uint8_t)0x80) ///< Pairing bit in device type field + +#define ANT_TRANS_TYPE_SHARED_ADDR_MASK ((uint8_t)0x03) ///< shared address mask in transmission type field +#define ANT_TRANS_TYPE_1_BYTE_SHARED_ADDRESS ((uint8_t)0x02) ///< 1 byte shared address field +#define ANT_TRANS_TYPE_2_BYTE_SHARED_ADDRESS ((uint8_t)0x03) ///< 2 byte shared address field +/** @} */ + +////////////////////////////////////////////// +/** @name Channel Status +@{ */ +////////////////////////////////////////////// +#define STATUS_CHANNEL_STATE_MASK ((uint8_t)0x03) ///< Channel state mask +#define STATUS_UNASSIGNED_CHANNEL ((uint8_t)0x00) ///< Indicates channel has not been assigned. +#define STATUS_ASSIGNED_CHANNEL ((uint8_t)0x01) ///< Indicates channel has been assigned. +#define STATUS_SEARCHING_CHANNEL ((uint8_t)0x02) ///< Indicates channel is active and in searching state. +#define STATUS_TRACKING_CHANNEL ((uint8_t)0x03) ///< Indicates channel is active and in tracking state. +/** @} */ + +////////////////////////////////////////////// +/** @name Standard capabilities defines +@{ */ +////////////////////////////////////////////// +#define CAPABILITIES_NO_RX_CHANNELS ((uint8_t)0x01) ///< Bitfield in CAPABILITIES_STANDARD byte indicating no rx channel support. +#define CAPABILITIES_NO_TX_CHANNELS ((uint8_t)0x02) ///< Bitfield in CAPABILITIES_STANDARD byte indicating no tx channel support. +#define CAPABILITIES_NO_RX_MESSAGES ((uint8_t)0x04) ///< Bitfield in CAPABILITIES_STANDARD byte indicating no rx message support. +#define CAPABILITIES_NO_TX_MESSAGES ((uint8_t)0x08) ///< Bitfield in CAPABILITIES_STANDARD byte indicating no tx message support. +#define CAPABILITIES_NO_ACKD_MESSAGES ((uint8_t)0x10) ///< Bitfield in CAPABILITIES_STANDARD byte indicating no acknolwedged message support. +#define CAPABILITIES_NO_BURST_TRANSFER ((uint8_t)0x20) ///< Bitfield in CAPABILITIES_STANDARD byte indicating no burst transfer support. +/** @} */ + +////////////////////////////////////////////// +/** @name Advanced capabilities defines +@{ */ +////////////////////////////////////////////// +#define CAPABILITIES_NETWORK_ENABLED ((uint8_t)0x02) ///< Bitfield in CAPABILITIES_ADVANCED byte indicating network support. +#define CAPABILITIES_SERIAL_NUMBER_ENABLED ((uint8_t)0x08) ///< Bitfield in CAPABILITIES_ADVANCED byte indicating serial number support. +#define CAPABILITIES_PER_CHANNEL_TX_POWER_ENABLED ((uint8_t)0x10) ///< Bitfield in CAPABILITIES_ADVANCED byte indicating per channel transmit power support. +#define CAPABILITIES_LOW_PRIORITY_SEARCH_ENABLED ((uint8_t)0x20) ///< Bitfield in CAPABILITIES_ADVANCED byte indicating lower priority search support. +#define CAPABILITIES_SCRIPT_ENABLED ((uint8_t)0x40) ///< Bitfield in CAPABILITIES_ADVANCED byte indicating scripting support. +#define CAPABILITIES_SEARCH_LIST_ENABLED ((uint8_t)0x80) ///< Bitfield in CAPABILITIES_ADVANCED byte indicating include/exclude list support. +/** @} */ + +////////////////////////////////////////////// +/** @name Advanced capabilities 2 defines +@{ */ +////////////////////////////////////////////// +#define CAPABILITIES_LED_ENABLED ((uint8_t)0x01) ///< Bitfield in CAPABILITIES_ADVANCED_2 byte indicating built-in LED support. +#define CAPABILITIES_EXT_MESSAGE_ENABLED ((uint8_t)0x02) ///< Bitfield in CAPABILITIES_ADVANCED_2 byte indicating extended messaging support. +#define CAPABILITIES_SCAN_MODE_ENABLED ((uint8_t)0x04) ///< Bitfield in CAPABILITIES_ADVANCED_2 byte indicating scanning mode support. +#define CAPABILITIES_RESERVED ((uint8_t)0x08) ///< Bitfield in CAPABILITIES_ADVANCED_2 byte currently reserved for future use. +#define CAPABILITIES_PROX_SEARCH_ENABLED ((uint8_t)0x10) ///< Bitfield in CAPABILITIES_ADVANCED_2 byte indicating proximity search support. +#define CAPABILITIES_EXT_ASSIGN_ENABLED ((uint8_t)0x20) ///< Bitfield in CAPABILITIES_ADVANCED_2 byte indicating extended assign support. +#define CAPABILITIES_FS_ANTFS_ENABLED ((uint8_t)0x40) ///< Bitfield in CAPABILITIES_ADVANCED_2 byte indicating built-in FS/ANT-FS support +#define CAPABILITIES_FIT1_ENABLED ((uint8_t)0x80) ///< Bitfield in CAPABILITIES_ADVANCED_2 byte indicating FIT1 module support +/** @} */ + +////////////////////////////////////////////// +/** @name Advanced capabilities 3 defines +@{ */ +////////////////////////////////////////////// +#define CAPABILITIES_ADVANCED_BURST_ENABLED ((uint8_t)0x01) ///< Bitfield in CAPABILITIES_ADVANCED_3 byte indicating advanced burst support. +#define CAPABILITIES_EVENT_BUFFERING_ENABLED ((uint8_t)0x02) ///< Bitfield in CAPABILITIES_ADVANCED_3 byte indicating extended messaging support. +#define CAPABILITIES_EVENT_FILTERING_ENABLED ((uint8_t)0x04) ///< Bitfield in CAPABILITIES_ADVANCED_3 byte indicating event filtering support. +#define CAPABILITIES_HIGH_DUTY_SEARCH_MODE_ENABLED ((uint8_t)0x08) ///< Bitfield in CAPABILITIES_ADVANCED_3 byte indicating high duty search mode support. +#define CAPABILITIES_ACTIVE_SEARCH_SHARING_MODE_ENABLED ((uint8_t)0x10) ///< Bitfield in CAPABILITIES_ADVANCED_3 byte indicating active search sharing mode support. +#define CAPABILITIES_RADIO_COEX_CONFIG_ENABLED ((uint8_t)0x20) ///< Bitfield in CAPABILITIES_ADVANCED_3 byte indicating radio coexistence configuration support. +#define CAPABILITIES_SELECTIVE_DATA_UPDATE_ENABLED ((uint8_t)0x40) ///< Bitfield in CAPABILITIES_ADVANCED_3 byte indicating selective rx data update support. +#define CAPABILITIES_ENCRYPTED_CHANNEL_ENABLED ((uint8_t)0x80) ///< Bitfield in CAPABILITIES_ADVANCED_3 byte indicating encrypted channel support. +/** @} */ + +////////////////////////////////////////////// +/** @name Advanced capabilities 4 defines +@{ */ +////////////////////////////////////////////// +#define CAPABILITIES_RFACTIVE_NOTIFICATION_ENABLED ((uint8_t)0x01) ///< Bitfield in CAPABILITIES_ADVANCED_4 byte indicating rfactive notification support. +/** @} */ + + + +////////////////////////////////////////////// +/** @name Rx Burst Message Sequencing Defines +@{ */ +////////////////////////////////////////////// +#define CHANNEL_NUMBER_MASK ((uint8_t)0x1F) ///< Valid bitfields for channel number +#define SEQUENCE_NUMBER_MASK ((uint8_t)0xE0) ///< Valid bitfields for burst sequence +#define SEQUENCE_NUMBER_ROLLOVER ((uint8_t)0x60) ///< Sequence rollover +#define SEQUENCE_FIRST_MESSAGE ((uint8_t)0x00) ///< Sequence indicating first burst message +#define SEQUENCE_LAST_MESSAGE ((uint8_t)0x80) ///< Sequence indicating last burst message +#define SEQUENCE_NUMBER_INC ((uint8_t)0x20) ///< Incremental sequence value +/** @} */ + +////////////////////////////////////////////// +/** @name Tx Burst Handler Request Segment Defines +@{ */ +////////////////////////////////////////////// +#define BURST_SEGMENT_CONTINUE ((uint8_t)0x00) ///< Bitfield for indicating continuation of burst data segment (no starting or ending burst packet). +#define BURST_SEGMENT_START ((uint8_t)0x01) ///< Bitfield for indicating burst data segment containing starting burst packet. +#define BURST_SEGMENT_END ((uint8_t)0x02) ///< Bitfield for indicating burst data segment containing ending burst packet. +/** @} */ + +////////////////////////////////////////////// +/** @name ANT Library Config +@{ */ +////////////////////////////////////////////// +#define ANT_LIB_CONFIG_MASK_ALL ((uint8_t)0xFF) ///< libary configuration mask +#define ANT_LIB_CONFIG_RADIO_CONFIG_ALWAYS ((uint8_t)0x01) ///< Bitfield intended for platform specific configuration (unused) +#define ANT_LIB_CONFIG_MESG_OUT_INC_TIME_STAMP ((uint8_t)0x20) ///< Bitfield for enabling extended rx messages including ant time stamp field +#define ANT_LIB_CONFIG_MESG_OUT_INC_RSSI ((uint8_t)0x40) ///< Bitfield for enabling extended rx messages including RSSI measurement field +#define ANT_LIB_CONFIG_MESG_OUT_INC_DEVICE_ID ((uint8_t)0x80) ///< Bitfield for enabling extended rx messages including device ID field +/** @} */ + +////////////////////////////////////////////// +/** @name Extended Data Message Bitfield Definitions +@{ */ +////////////////////////////////////////////// +#define ANT_EXT_MESG_BITFIELD_DEVICE_ID ((uint8_t)0x80) ///< Bitfield for indicating device ID field present in extended data message after the extended message bitfield byte +#define ANT_EXT_MESG_BITFIELD_RSSI ((uint8_t)0x40) ///< Bitfield for indicating RSSI field present in extended data message after device id field (if present) +#define ANT_EXT_MESG_BITFIELD_TIME_STAMP ((uint8_t)0x20) ///< Bitfield for indicating timestamp field present in extended data message after rssi/agc field (if present) +#define ANT_EXT_MESG_BIFIELD_EXTENSION ((uint8_t)0x01) ///< Bitfield reserved +/** @} */ + +////////////////////////////////////////////// +/** @name RSSI Definitions in Extended Data Message +@{ */ +////////////////////////////////////////////// +#define RSSI_TYPE_AGC_EXT_MESG_FIELD_SIZE ((uint8_t)4) ///< Extended bitfield message size for AGC type RSSI measurement +#define RSSI_TYPE_DBM_EXT_MESG_FIELD_SIZE ((uint8_t)3) ///< Extended bitfield message size for DBM type RSSI measurement + +#define RSSI_TYPE_OFFSET ((uint8_t)0) ///< RSSI type offset in RSSI field in extended data message +#define RSSI_AGC_TYPE ((uint8_t)0x10) ///< RSSI type indicating support for AGC measurement +#define RSSI_DBM_TYPE ((uint8_t)0x20) ///< RSSI type indicating support for DBM measurement + +#define RSSI_TYPE_AGC_THRESHOLD_OFFSET ((uint8_t)1) ///< Offset of AGC value indicating above or below configured AGC threshold +#define RSSI_TYPE_AGC_REGISTER_LOW ((uint8_t)2) ///< Offset of LSB AGC threshold configuration in RSSI field +#define RSSI_TYPE_AGC_REGISTER_HIGH ((uint8_t)3) ///< Offset of MSB AGC threshold configuration in RSSI field + +#define RSSI_TYPE_DBM_VALUE ((uint8_t)1) ///< Offset of DBM value in RSSI field +#define RSSI_TYPE_DBM_SETTING ((uint8_t)2) ///< Offset of DBM threshold configuration in RSSI field +/** @} */ + +////////////////////////////////////////////// +/** @name Reset/Startup Mesg Codes +@{ */ +////////////////////////////////////////////// +#define RESET_FLAGS_MASK ((uint8_t)0xE0) ///< Message code mask +#define RESET_SUSPEND ((uint8_t)0x80) ///< Startup/Reset from suspend mode +#define RESET_SYNC ((uint8_t)0x40) ///< Startup/Reset from synchronous reset +#define RESET_CMD ((uint8_t)0x20) ///< Startup/Reset from ant message reset command +#define RESET_WDT ((uint8_t)0x02) ///< Startup/Reset from watchdog timeout +#define RESET_RST ((uint8_t)0x01) ///< Startup/Reset from HW reset pin +#define RESET_POR ((uint8_t)0x00) ///< Startup/Reset from HW power on reset +/** @} */ + +////////////////////////////////////////////// +/** @name Event Filtering +@{ */ +////////////////////////////////////////////// +#define FILTER_EVENT_RX_SEARCH_TIMEOUT ((uint16_t)0x0001) ///< Bitfield for filtering EVENT_RX_SEARCH_TIMEOUT +#define FILTER_EVENT_RX_FAIL ((uint16_t)0x0002) ///< Bitfield for filtering EVENT_RX_FAIL +#define FILTER_EVENT_TX ((uint16_t)0x0004) ///< Bitfield for filtering EVENT_TX +#define FILTER_EVENT_TRANSFER_RX_FAILED ((uint16_t)0x0008) ///< Bitfield for filtering EVENT_TRANSFER_RX_FAILED +#define FILTER_EVENT_TRANSFER_TX_COMPLETED ((uint16_t)0x0010) ///< Bitfield for filtering EVENT_TRANSFER_TX_COMPLETED +#define FILTER_EVENT_TRANSFER_TX_FAILED ((uint16_t)0x0020) ///< Bitfield for filtering EVENT_TRANSFER_TX_FAILED +#define FILTER_EVENT_CHANNEL_CLOSED ((uint16_t)0x0040) ///< Bitfield for filtering EVENT_CHANNEL_CLOSED +#define FILTER_EVENT_RX_FAIL_GO_TO_SEARCH ((uint16_t)0x0080) ///< Bitfield for filtering EVENT_RX_FAIL_GO_TO_SEARCH +#define FILTER_EVENT_CHANNEL_COLLISION ((uint16_t)0x0100) ///< Bitfield for filtering EVENT_CHANNEL_COLLISION +#define FILTER_EVENT_TRANSFER_TX_START ((uint16_t)0x0200) ///< Bitfield for filtering EVENT_TRANSFER_TX_START +/** @} */ + + +////////////////////////////////////////////// +/** @name Selective Data Update Mask Configuration Defines +@{ */ +////////////////////////////////////////////// +#define INVALID_SDU_MASK ((uint8_t)0xFF) ///< Selective data update configuration invalid mask. Used to disable SDU for a particular channel +#define SDU_MASK_ACK_CONFIG_BIT ((uint8_t)0x80) ///< Selective data acknowledge config bit. Use to enable SDU for acknowledged data in addition to broadcast data +/** @} */ + +////////////////////////////////////////////// +/** @name Advanced Burst Configuration Defines +@{ */ +////////////////////////////////////////////// +#define ADV_BURST_MODE_DISABLE ((uint8_t)0x00) ///< Set to disable advanced burst transfers +#define ADV_BURST_MODE_ENABLE ((uint8_t)0x01) ///< Set to enable advanced burst transfers + +#define ADV_BURST_MODES_MAX_SIZE ((uint8_t)0x03) ///< Maximum allowable value for advanced burst packets size configuration +#define ADV_BURST_MODES_SIZE_8_BYTES ((uint8_t)0x01) ///< 8-bytes packet size for maximum 20kbps advanced burst transfer rate +#define ADV_BURST_MODES_SIZE_16_BYTES ((uint8_t)0x02) ///< 16-bytes packet size for maximum 40kbps advanced burst transfer rate +#define ADV_BURST_MODES_SIZE_24_BYTES ((uint8_t)0x03) ///< 24-bytes packet size for maximum 60kbps advanced burst transfer rate + +#define ADV_BURST_MODES_MASK ((uint8_t)0x03) ///< Bitfield mask for advanced burst modes +#define ADV_BURST_MODES_FREQ_HOP ((uint8_t)0x01) ///< Bitfield for required/optional frequency hopping mode during advanced burst +#define ADV_BURST_MODES_RESERVED0 ((uint8_t)0x02) ///< Bitfield reserved +/** @} */ + +////////////////////////////////////////////// +/** @name Encrypted Channel Defines +@{ */ +////////////////////////////////////////////// +#define ENCRYPTION_DISABLED_MODE ((uint8_t) 0x00) ///< Set encryption mode to disabled +#define ENCRYPTION_BASIC_REQUEST_MODE ((uint8_t) 0x01) ///< Enable encryption mode with basic request (crypto ID exchange) +#define ENCRYPTION_USER_DATA_REQUEST_MODE ((uint8_t) 0x02) ///< Enable encryption mode with user data request (crypto ID + custom user data exchange) + +#define MAX_SUPPORTED_ENCRYPTION_MODE ENCRYPTION_USER_DATA_REQUEST_MODE ///< Maximum supported encryption mode +#define ENCRYPTION_USER_DATA_SIZE ((uint8_t)19) ///< Maximum size of custom user data + +#define ENCRYPTION_INFO_SET_CRYPTO_ID ((uint8_t)0x00) ///< Set configured crypto ID to be exchanged during encryption negotiation +#define ENCRYPTION_INFO_SET_CUSTOM_USER_DATA ((uint8_t)0x01) ///< Set configured custom user data to be exchanged during encryption negotation +#define ENCRYPTION_INFO_SET_RNG_SEED ((uint8_t)0x02) ///< Set RNG seed + +#define ENCRYPTION_INFO_GET_SUPPORTED_MODE ((uint8_t)0x00) ///< Get supported encrytped mode +#define ENCRYPTION_INFO_GET_CRYPTO_ID ((uint8_t)0x01) ///< Get configured crypto ID to be exchanged during encryption negotiation +#define ENCRYPTION_INFO_GET_CUSTOM_USER_DATA ((uint8_t)0x02) ///< Get configured custom user data to be exchanged during encryption negotiation +/** @} */ + +////////////////////////////////////////////// +/** @name RFActive Notification Defines +@{ */ +////////////////////////////////////////////// +#define RFACTIVE_NOTIFICATION_DISABLED_MODE ((uint8_t)0x00) ///< Set RF Active notification mode to disabled +#define RFACTIVE_NOTIFICATION_ONE_TIME_MODE ((uint8_t)0x01) ///< Set to generate RF Active notification event for only 1 time +#define RFACTIVE_NOTIFICATION_CONTINUOUS_MODE ((uint8_t)0x02) ///< Set to generate RF Active notification event continuously + +#define RFACTIVE_NOTIFICATION_MIN_TIME_THRESHOLD ((uint16_t)0x00A4) ///< Minimum time threshold of 5ms in 32768 time base +/** @} */ + +////////////////////////////////////////////// +/** @name WakeOn RF Activity Defines +@{ */ +////////////////////////////////////////////// +#define WAKEON_RF_ACTIVITY_NONE ((uint8_t)0x00) ///< Disable wakeon +#define WAKEON_RF_ACTIVITY_TX ((uint8_t)0x01) ///< Enable wakeon for ANT RF transmission windows +#define WAKEON_RF_ACTIVITY_RX ((uint8_t)0x02) ///< Enable wakeon for ANT RF reception windows +#define WAKEON_RF_ACTIVITY_ALL ((uint8_t)0x03) ///< (WAKE_ON_RF_ACTIVITY_TX | WAKE_ON_RF_ACTIVITY_RX)) +/** @} */ + +////////////////////////////////////////////// +/** @name Enhanced Channel Spacing Defines +@{ */ +////////////////////////////////////////////// +#define ENHANCED_CHANNEL_SPACING_DISABLE ((uint8_t)0x00) ///< Disable enhanced channel spacing +#define ENHANCED_CHANNEL_SPACING_ENABLE ((uint8_t)0x01) ///< Enable enhanced channel spacing +/** @} */ + + + + +////////////////////////////////////////////// +/** @name Channel Events and Command Response Codes +@{ */ +////////////////////////////////////////////// +#define RESPONSE_NO_ERROR ((uint8_t)0x00) ///< Command response with no error +#define NO_EVENT ((uint8_t)0x00) ///< No Event +#define EVENT_RX_SEARCH_TIMEOUT ((uint8_t)0x01) ///< ANT stack generated event when rx searching state for the channel has timed out +#define EVENT_RX_FAIL ((uint8_t)0x02) ///< ANT stack generated event when synchronous rx channel has missed receiving an ANT packet +#define EVENT_TX ((uint8_t)0x03) ///< ANT stack generated event when synchronous tx channel has occurred +#define EVENT_TRANSFER_RX_FAILED ((uint8_t)0x04) ///< ANT stack generated event when the completion of rx transfer has failed +#define EVENT_TRANSFER_TX_COMPLETED ((uint8_t)0x05) ///< ANT stack generated event when the completion of tx transfer has succeeded +#define EVENT_TRANSFER_TX_FAILED ((uint8_t)0x06) ///< ANT stack generated event when the completion of tx transfer has failed +#define EVENT_CHANNEL_CLOSED ((uint8_t)0x07) ///< ANT stack generated event when channel has closed +#define EVENT_RX_FAIL_GO_TO_SEARCH ((uint8_t)0x08) ///< ANT stack generated event when synchronous rx channel has lost tracking and is entering rx searching state +#define EVENT_CHANNEL_COLLISION ((uint8_t)0x09) ///< ANT stack generated event during a multi-channel setup where an instance of the current synchronous channel is blocked by another synchronous channel +#define EVENT_TRANSFER_TX_START ((uint8_t)0x0A) ///< ANT stack generated event when the start of tx transfer is occuring +//... +#define EVENT_TRANSFER_NEXT_DATA_BLOCK ((uint8_t)0x11) ///< ANT stack generated event when the stack requires the next transfer data block for tx transfer continuation or completion +//... +#define CHANNEL_IN_WRONG_STATE ((uint8_t)0x15) ///< Command response on attempt to perform an action from the wrong channel state +#define CHANNEL_NOT_OPENED ((uint8_t)0x16) ///< Command response on attempt to communicate on a channel that is not open +//... +#define CHANNEL_ID_NOT_SET ((uint8_t)0x18) ///< Command response on attempt to open a channel without setting the channel ID +#define CLOSE_ALL_CHANNELS ((uint8_t)0x19) ///< Command response when attempting to start scanning mode, when channels are still open +//... +#define TRANSFER_IN_PROGRESS ((uint8_t)0x1F) ///< Command response on attempt to communicate on a channel with a TX transfer in progress +#define TRANSFER_SEQUENCE_NUMBER_ERROR ((uint8_t)0x20) ///< Command response when sequence number of burst message or burst data segment is out of order +#define TRANSFER_IN_ERROR ((uint8_t)0x21) ///< Command response when transfer error has occured on supplied burst message or burst data segment +#define TRANSFER_BUSY ((uint8_t)0x22) ///< Command response when transfer is busy and cannot process supplied burst message or burst data segment +//... +#define MESSAGE_SIZE_EXCEEDS_LIMIT ((uint8_t)0x27) ///< Command response if a data message is provided that is too large +#define INVALID_MESSAGE ((uint8_t)0x28) ///< Command response when the message has an invalid parameter +#define INVALID_NETWORK_NUMBER ((uint8_t)0x29) ///< Command response when an invalid network number is provided +#define INVALID_LIST_ID ((uint8_t)0x30) ///< Command response when the provided list ID or size exceeds the limit +#define INVALID_SCAN_TX_CHANNEL ((uint8_t)0x31) ///< Command response when attempting to transmit on channel 0 when in scan mode +#define INVALID_PARAMETER_PROVIDED ((uint8_t)0x33) ///< Command response when an invalid parameter is specified in a configuration message +#define EVENT_QUE_OVERFLOW ((uint8_t)0x35) ///< ANT stack generated event when the event queue in the stack has overflowed and drop 1 or 2 events +#define EVENT_ENCRYPT_NEGOTIATION_SUCCESS ((uint8_t)0x38) ///< ANT stack generated event when connecting to an encrypted channel has succeeded +#define EVENT_ENCRYPT_NEGOTIATION_FAIL ((uint8_t)0x39) ///< ANT stack generated event when connecting to an encrypted channel has failed +#define EVENT_RFACTIVE_NOTIFICATION ((uint8_t)0x3A) ///< ANT stack generated event when the time to next synchronous channel RF activity exceeds configured time threshold +#define EVENT_CONNECTION_START ((uint8_t)0x3B) ///< Application generated event used to indicate when starting a connection to a channel +#define EVENT_CONNECTION_SUCCESS ((uint8_t)0x3C) ///< Application generated event used to indicate when successfuly connected to a channel +#define EVENT_CONNECTION_FAIL ((uint8_t)0x3D) ///< Application generated event used to indicate when failed to connect to a channel +#define EVENT_CONNECTION_TIMEOUT ((uint8_t)0x3E) ///< Application generated event used to indicate when connecting to a channel has timed out +#define EVENT_CONNECTION_UPDATE ((uint8_t)0x3F) ///< Application generated event used to indicate when connection parameters have been updated +//... +#define NO_RESPONSE_MESSAGE ((uint8_t)0x50) ///< Command response type intended to indicate that no serial reply message should be generated +#define EVENT_RX ((uint8_t)0x80) ///< ANT stack generated event indicating received data (eg. broadcast, acknowledge, burst) from the channel +#define EVENT_BLOCKED ((uint8_t)0xFF) ///< ANT stack generated event that should be ignored (eg. filtered events will generate this) +/** @} */ + + +#endif // !ANTDEFINES_H +/* + * Dynastream Innovations Inc. + * Cochrane, AB, CANADA + * + * Copyright (c) 2012 Dynastream Innovations Inc. + * THIS SOFTWARE IS AN EXAMPLE USAGE OF THE ANT PROTOCOL MODULE. + * IT MAY BE USED, MODIFIED and DISTRIBUTED ONLY WITH THE + * APPROPRIATE LICENSE AGREEMENT. + */ + +#ifndef ANTMESSAGE_H +#define ANTMESSAGE_H + +#include + +///////////////////////////////////////////////////////////////////////////// +// Message Format +// Messages are in the format: +// +// AX XX YY -------- CK +// +// where: AX is the 1 byte sync byte either transmit or recieve +// XX is the 1 byte size of the message (0-249) NOTE: THIS WILL BE LIMITED BY THE EMBEDDED RECEIVE BUFFER SIZE +// YY is the 1 byte ID of the message (1-255, 0 is invalid) +// ----- is the data of the message (0-249 bytes of data) +// CK is the 1 byte Checksum of the message +///////////////////////////////////////////////////////////////////////////// +#define MESG_TX_SYNC ((uint8_t)0xA4) +#define MESG_RX_SYNC ((uint8_t)0xA5) +#define MESG_SYNC_SIZE ((uint8_t)1) +#define MESG_SIZE_SIZE ((uint8_t)1) +#define MESG_ID_SIZE ((uint8_t)1) +#define MESG_CHANNEL_NUM_SIZE ((uint8_t)1) +#define MESG_EXT_MESG_BF_SIZE ((uint8_t)1) // NOTE: this could increase in the future +#define MESG_CHECKSUM_SIZE ((uint8_t)1) +#define MESG_DATA_SIZE ((uint8_t)9) + +////////////////////////////////////////////// +// ANT LIBRARY Extended Data Message Fields +// NOTE: You must check the extended message +// bitfield first to find out which fields +// are present before accessing them! +////////////////////////////////////////////// +#define ANT_EXT_MESG_DEVICE_ID_FIELD_SIZE ((uint8_t)4) +#define ANT_EXT_MESG_RSSI_FIELD_SIZE ((uint8_t)4) // maximum RSSI field size regardless of RSSI type +#define ANT_EXT_MESG_TIME_STAMP_FIELD_SIZE ((uint8_t)2) +#define ANT_EXT_STRING_SIZE ((uint8_t)16) // additional buffer to accommdate for 24 byte advance burst mode & encrypted usr data + +// The largest serial message is an ANT data message with all of the extended fields +#define MESG_ANT_MAX_PAYLOAD_SIZE ANT_STANDARD_DATA_PAYLOAD_SIZE + +#define MESG_MAX_EXT_DATA_SIZE (ANT_EXT_MESG_DEVICE_ID_FIELD_SIZE + ANT_EXT_MESG_RSSI_FIELD_SIZE + ANT_EXT_MESG_TIME_STAMP_FIELD_SIZE + ANT_EXT_STRING_SIZE) // ANT device ID (4 bytes) + ANT RSSI (4 bytes) + ANT timestamp (2 bytes) + ANT Ext String Size + +#define MESG_MAX_DATA_SIZE (MESG_ANT_MAX_PAYLOAD_SIZE + MESG_EXT_MESG_BF_SIZE + MESG_MAX_EXT_DATA_SIZE) // ANT data payload (8 bytes) + extended bitfield (1 byte) + extended data (10 bytes) +#define MESG_MAX_SIZE_VALUE (MESG_MAX_DATA_SIZE + MESG_CHANNEL_NUM_SIZE) // this is the maximum value that the serial message size value is allowed to be +#define MESG_BUFFER_SIZE (MESG_SIZE_SIZE + MESG_ID_SIZE + MESG_CHANNEL_NUM_SIZE + MESG_MAX_DATA_SIZE + MESG_CHECKSUM_SIZE) +#define MESG_FRAMED_SIZE (MESG_ID_SIZE + MESG_CHANNEL_NUM_SIZE + MESG_MAX_DATA_SIZE) +#define MESG_HEADER_SIZE (MESG_SYNC_SIZE + MESG_SIZE_SIZE + MESG_ID_SIZE) +#define MESG_FRAME_SIZE (MESG_HEADER_SIZE + MESG_CHECKSUM_SIZE) +#define MESG_MAX_SIZE (MESG_MAX_DATA_SIZE + MESG_FRAME_SIZE) + +#define MESG_SIZE_OFFSET (MESG_SYNC_SIZE) +#define MESG_ID_OFFSET (MESG_SYNC_SIZE + MESG_SIZE_SIZE) +#define MESG_DATA_OFFSET (MESG_HEADER_SIZE) + +////////////////////////////////////////////// +/** @name Message ID's +@{ */ +////////////////////////////////////////////// +#define MESG_INVALID_ID ((uint8_t)0x00) ///< invalid ANT message ID +#define MESG_EVENT_ID ((uint8_t)0x01) ///< ANT stack - channel event ID +//... +#define MESG_VERSION_ID ((uint8_t)0x3E) ///< ANT stack - version message ID +#define MESG_RESPONSE_EVENT_ID ((uint8_t)0x40) ///< ANT stack - channel/response event ANT message ID +#define MESG_UNASSIGN_CHANNEL_ID ((uint8_t)0x41) ///< ANT stack - channel unassign message ID +#define MESG_ASSIGN_CHANNEL_ID ((uint8_t)0x42) ///< ANT stack - channel assign message ID +#define MESG_CHANNEL_MESG_PERIOD_ID ((uint8_t)0x43) ///< ANT stack - channel period message ID +#define MESG_CHANNEL_SEARCH_TIMEOUT_ID ((uint8_t)0x44) ///< ANT stack - channel (high priority) search timeout message ID +#define MESG_CHANNEL_RADIO_FREQ_ID ((uint8_t)0x45) ///< ANT stack - channel radio frequency message ID +#define MESG_NETWORK_KEY_ID ((uint8_t)0x46) ///< ANT stack - network key message ID +#define MESG_RADIO_TX_POWER_ID ((uint8_t)0x47) ///< ANT stack - transmit power message ID +#define MESG_RADIO_CW_MODE_ID ((uint8_t)0x48) ///< ANT stack - CW test mode message ID +#define MESG_SEARCH_WAVEFORM_ID ((uint8_t)0x49) ///< ANT stack - search waveform message ID +#define MESG_SYSTEM_RESET_ID ((uint8_t)0x4A) ///< ANT application - system reset message ID +#define MESG_OPEN_CHANNEL_ID ((uint8_t)0x4B) ///< ANT stack - channel open message ID +#define MESG_CLOSE_CHANNEL_ID ((uint8_t)0x4C) ///< ANT stack - channel close message ID +#define MESG_REQUEST_ID ((uint8_t)0x4D) ///< ANT stack - request message ID +#define MESG_BROADCAST_DATA_ID ((uint8_t)0x4E) ///< ANT stack - broadcast message ID +#define MESG_ACKNOWLEDGED_DATA_ID ((uint8_t)0x4F) ///< ANT stack - acknowledged message ID +#define MESG_BURST_DATA_ID ((uint8_t)0x50) ///< ANT stack - burst message ID +#define MESG_CHANNEL_ID_ID ((uint8_t)0x51) ///< ANT stack - channel ID message ID +#define MESG_CHANNEL_STATUS_ID ((uint8_t)0x52) ///< ANT stack - channel status message ID +#define MESG_RADIO_CW_INIT_ID ((uint8_t)0x53) ///< ANT stack - CW test mode init message ID +#define MESG_CAPABILITIES_ID ((uint8_t)0x54) ///< ANT stack - capabilities message ID +//... +#define MESG_ID_LIST_ADD_ID ((uint8_t)0x59) ///< ANT stack - inc/exc list add message ID +#define MESG_ID_LIST_CONFIG_ID ((uint8_t)0x5A) ///< ANT stack - inc/exc list config message ID +#define MESG_OPEN_RX_SCAN_ID ((uint8_t)0x5B) ///< ANT stack - rx scanning channel open message ID +#define MESG_EXT_BROADCAST_DATA_ID ((uint8_t)0x5D) ///< ANT application - extended broadcast message ID +#define MESG_EXT_ACKNOWLEDGED_DATA_ID ((uint8_t)0x5E) ///< ANT application - extended acknowledged message ID +#define MESG_EXT_BURST_DATA_ID ((uint8_t)0x5F) ///< ANT application - extended burst message ID +#define MESG_CHANNEL_RADIO_TX_POWER_ID ((uint8_t)0x60) ///< ANT stack - channel transmit power message ID +#define MESG_GET_SERIAL_NUM_ID ((uint8_t)0x61) ///< ANT application - device serial number request message ID +#define MESG_SET_LP_SEARCH_TIMEOUT_ID ((uint8_t)0x63) ///< ANT stack - channel (low priority) search timeout message ID +#define MESG_SERIAL_NUM_SET_CHANNEL_ID_ID ((uint8_t)0x65) ///< ANT application - use serial number to set channel message ID +#define MESG_RX_EXT_MESGS_ENABLE_ID ((uint8_t)0x66) ///< ANT stack - extended rx message enable message ID +#define MESG_ANTLIB_CONFIG_ID ((uint8_t)0x6E) ///< ANT stack - lib config message ID +#define MESG_STARTUP_MESG_ID ((uint8_t)0x6F) ///< ANT application - startup message ID +#define MESG_AUTO_FREQ_CONFIG_ID ((uint8_t)0x70) ///< ANT stack - frequency agility config message ID +#define MESG_PROX_SEARCH_CONFIG_ID ((uint8_t)0x71) ///< ANT stack - proximity search config message ID +#define MESG_ADV_BURST_DATA_ID ((uint8_t)0x72) ///< ANT stack - advanced burst data message ID +#define MESG_COEX_PRIORITY_CONFIG_ID ((uint8_t)0x73) ///< ANT stack - coexistence priority config message ID +#define MESG_EVENT_BUFFERING_CONFIG_ID ((uint8_t)0x74) ///< ANT application - event buffering config message ID +#define MESG_SET_SEARCH_CH_PRIORITY_ID ((uint8_t)0x75) ///< ANT stack - search channel priority config message ID +#define MESG_CONFIG_ADV_BURST_ID ((uint8_t)0x78) ///< ANT stack - advanced burst config message ID +#define MESG_EVENT_FILTER_CONFIG_ID ((uint8_t)0x79) ///< ANT stack - event filtering config message ID +#define MESG_SDU_CONFIG_ID ((uint8_t)0x7A) ///< ANT stack - selective data update config message ID +#define MESG_SDU_SET_MASK_ID ((uint8_t)0x7B) ///< ANT stack - selective data update mask message ID +#define MESG_ENCRYPT_ENABLE_ID ((uint8_t)0x7D) ///< ANT stack - channel encryption mode enable message ID +#define MESG_SET_ENCRYPT_KEY_ID ((uint8_t)0x7E) ///< ANT stack - channel encryption key config message ID +#define MESG_SET_ENCRYPT_INFO_ID ((uint8_t)0x7F) ///< ANT stack - channel encryption info config message ID +#define MESG_ACTIVE_SEARCH_SHARING_ID ((uint8_t)0x81) ///< ANT stack - active seach sharing config message ID +#define MESG_COEX_ADV_PRIORITY_CONFIG_ID ((uint8_t)0x82) ///< ANT stack - advanced/platform specific coexistence priority config message ID +#define MESG_RFACTIVE_NOTIFICATION_ID ((uint8_t)0x84) ///< ANT stack - RF active notification config message ID +/** @} */ + +////////////////////////////////////////////// +/** @name Extended Message ID's +@{ */ +////////////////////////////////////////////// +#define MSG_EXT_ID_MASK ((uint8_t)0xE0) ///< ANT message ID extension mask +#define MESG_EXT_ID_0 ((uint8_t)0xE0) ///< ANT message ID extension 0xE1 +#define MESG_EXT_ID_1 ((uint8_t)0xE1) ///< ANT message ID 0xE1 extension +#define MESG_EXT_ID_2 ((uint8_t)0xE2) ///< ANT message ID 0xE2 extension +#define MESG_EXT_ID_3 ((uint8_t)0xE3) ///< ANT message ID 0xE3 extension +#define MESG_EXT_ID_4 ((uint8_t)0xE4) ///< ANT message ID 0xE4 extension + +// 0xE0 extended IDs +#define MESG_EXT_RESPONSE_ID ((uint16_t)0xE000) ///< Reserved for future use. ANT response messages using extended message IDs + +// 0xE1 extended IDs +#define MESG_EXT_REQUEST_ID ((uint16_t)0xE100) ///< Reserved for future use. ANT request messages using extended message IDs + + +// 0xE3 extended IDs +#define MESG_SET_SYNC_SERIAL_BIT_RATE ((uint16_t)0xE300) ///< ANT application - configure byte synchronous serial interface bit rate +#define MESG_SET_SYNC_SERIAL_SRDY_SLEEP ((uint16_t)0xE301) ///< ANT application - configure byte synchronous serial interface SRDY sleep delay + +// 0xE4 extended IDs +#define MESG_ANTFS_OTA_FW_UPDATE ((uint16_t)0xE400) ///< ANT application - run ANTFS over-the-air (OTA) device firmware update +/** @} */ + +////////////////////////////////////////////// +/** @name Debug Message ID's +@{ */ +////////////////////////////////////////////// +#define MESG_DEBUG_ID ((uint8_t)0xF0) // ANT application - debug message ID. Uses sub-index identifiers to differentiate message types +/** @} */ + +////////////////////////////////////////////// +/** @name Message Sizes +@{ */ +////////////////////////////////////////////// +#define MESG_INVALID_SIZE ((uint8_t)0) +#define MESG_VERSION_SIZE ((uint8_t)13) +#define MESG_RESPONSE_EVENT_SIZE ((uint8_t)3) +#define MESG_CHANNEL_STATUS_SIZE ((uint8_t)2) +#define MESG_UNASSIGN_CHANNEL_SIZE ((uint8_t)1) +#define MESG_ASSIGN_CHANNEL_SIZE ((uint8_t)3) +#define MESG_CHANNEL_ID_SIZE ((uint8_t)5) +#define MESG_CHANNEL_MESG_PERIOD_SIZE ((uint8_t)3) +#define MESG_CHANNEL_SEARCH_TIMEOUT_SIZE ((uint8_t)2) +#define MESG_CHANNEL_RADIO_FREQ_SIZE ((uint8_t)2) +#define MESG_CHANNEL_RADIO_TX_POWER_SIZE ((uint8_t)2) +#define MESG_NETWORK_KEY_SIZE ((uint8_t)9) +#define MESG_RADIO_TX_POWER_SIZE ((uint8_t)2) +#define MESG_RADIO_CW_MODE_SIZE ((uint8_t)3) +#define MESG_RADIO_CW_INIT_SIZE ((uint8_t)1) +#define MESG_SEARCH_WAVEFORM_SIZE ((uint8_t)3) +#define MESG_SYSTEM_RESET_SIZE ((uint8_t)1) +#define MESG_OPEN_CHANNEL_SIZE ((uint8_t)1) +#define MESG_CLOSE_CHANNEL_SIZE ((uint8_t)1) +#define MESG_REQUEST_SIZE ((uint8_t)2) +#define MESG_CAPABILITIES_SIZE ((uint8_t)8) +#define MESG_ID_LIST_ADD_SIZE ((uint8_t)6) +#define MESG_ID_LIST_CONFIG_SIZE ((uint8_t)3) +#define MESG_OPEN_RX_SCAN_SIZE ((uint8_t)2) +#define MESG_EXT_CHANNEL_RADIO_FREQ_SIZE ((uint8_t)3) +#define MESG_RADIO_CONFIG_ALWAYS_SIZE ((uint8_t)2) +#define MESG_RX_EXT_MESGS_ENABLE_SIZE ((uint8_t)2) +#define MESG_SET_TX_SEARCH_ON_NEXT_SIZE ((uint8_t)2) +#define MESG_SET_LP_SEARCH_TIMEOUT_SIZE ((uint8_t)2) +#define MESG_GET_SERIAL_NUM_SIZE ((uint8_t)4) +#define MESG_ANTLIB_CONFIG_SIZE ((uint8_t)2) +#define MESG_STARTUP_MESG_SIZE ((uint8_t)1) +#define MESG_AUTO_FREQ_CONFIG_SIZE ((uint8_t)4) +#define MESG_PROX_SEARCH_CONFIG_SIZE ((uint8_t)2) +#define MESG_COEX_PRIORITY_CONFIG_REQ_SIZE ((uint8_t)9) +#define MESG_EVENT_BUFFERING_CONFIG_REQ_SIZE ((uint8_t)6) +#define MESG_CONFIG_ADV_BURST_REQ_CAPABILITIES_SIZE ((uint8_t)4) +#define MESG_CONFIG_ADV_BURST_REQ_CONFIG_SIZE ((uint8_t)10) +#define MESG_CONFIG_ENCRYPT_REQ_CAPABILITIES_SIZE ((uint8_t)2) +#define MESG_CONFIG_ENCRYPT_REQ_CONFIG_ID_SIZE ((uint8_t)5) +#define MESG_CONFIG_ENCRYPT_REQ_CONFIG_USER_DATA_SIZE ((uint8_t)20) +#define MESG_CONFIG_ENCRYPT_REQ_CURRENT_CTR ((uint8_t)17) +#define MESG_EVENT_FILTER_CONFIG_REQ_SIZE ((uint8_t)3) +#define MESG_ACTIVE_SEARCH_SHARING_REQ_SIZE ((uint8_t)2) +#define MESG_COEX_ADV_PRIORITY_CONFIG_REQ_SIZE ((uint8_t)9) +#define MESG_RFACTIVE_NOTIFICATION_SIZE ((uint8_t)4) +#define MESG_FLASH_PROTECTION_CHECK_SIZE ((uint8_t)1) +#define MESG_BIST_SIZE ((uint8_t)6) +/** @} */ + +////////////////////////////////////////////// +/* ANT Message Structure */ +////////////////////////////////////////////// +/** @cond */ +typedef union +{ + uint8_t ucExtMesgBF; + struct + { + uint8_t bExtFieldCont : 1; + uint8_t : 1; + uint8_t : 1; + uint8_t : 1; + uint8_t : 1; + uint8_t bANTTimeStamp : 1; + uint8_t bANTRssi : 1; + uint8_t bANTDeviceID : 1; + }stExtMesgBF; + +} EXT_MESG_BF; // extended message bitfield + +typedef union +{ + uint32_t ulForceAlign; // force the struct to be 4-byte aligned, required for some casting in command.c + uint8_t aucMessage[MESG_BUFFER_SIZE]; // the complete message buffer pointer + struct + { + uint8_t ucSize; // the message size + union + { + uint8_t aucFramedData[MESG_FRAMED_SIZE]; // pointer for serial framer + struct + { + uint8_t ucMesgID; // the message ID + union + { + uint8_t aucMesgData[MESG_MAX_SIZE_VALUE]; // the message data + struct + { + union + { + uint8_t ucChannel; // ANT channel number + uint8_t ucSubID; // subID portion of ext ID message + }uData0; + uint8_t aucPayload[ANT_STANDARD_DATA_PAYLOAD_SIZE]; // ANT message payload + EXT_MESG_BF sExtMesgBF; // extended message bitfield (NOTE: this will not be here for longer data messages) + uint8_t aucExtData[MESG_MAX_EXT_DATA_SIZE]; // extended message data + }stMesgData; + }uMesgData; + }stFramedData; + }uFramedData; + uint8_t ucCheckSum; // the message checksum + }stMessage; + +} ANT_MESSAGE; +/* @endcond */ + +/** @brief Defines for accesssing ANT_MESSAGE members variables */ +/** @name ANT serial message structure +@{ */ +#define ANT_MESSAGE_ulForceAlign ulForceAlign +#define ANT_MESSAGE_aucMessage aucMessage +#define ANT_MESSAGE_ucSize stMessage.ucSize +#define ANT_MESSAGE_aucFramedData stMessage.uFramedData.aucFramedData +#define ANT_MESSAGE_ucMesgID stMessage.uFramedData.stFramedData.ucMesgID +#define ANT_MESSAGE_aucMesgData stMessage.uFramedData.stFramedData.uMesgData.aucMesgData +#define ANT_MESSAGE_ucChannel stMessage.uFramedData.stFramedData.uMesgData.stMesgData.uData0.ucChannel +#define ANT_MESSAGE_ucSubID stMessage.uFramedData.stFramedData.uMesgData.stMesgData.uData0.ucSubID +#define ANT_MESSAGE_aucPayload stMessage.uFramedData.stFramedData.uMesgData.stMesgData.aucPayload +#define ANT_MESSAGE_sExtMesgBF stMessage.uFramedData.stFramedData.uMesgData.stMesgData.sExtMesgBF +#define ANT_MESSAGE_ucExtMesgBF stMessage.uFramedData.stFramedData.uMesgData.stMesgData.sExtMesgBF.ucExtMesgBF +#define ANT_MESSAGE_stExtMesgBF stMessage.uFramedData.stFramedData.uMesgData.stMesgData.sExtMesgBF.stExtMesgBF +#define ANT_MESSAGE_aucExtData stMessage.uFramedData.stFramedData.uMesgData.stMesgData.aucExtData +#define ANT_MESSAGE_ucCheckSum stMessage.ucCheckSum +/** @} */ + +#endif // !ANTMESSAGE_H + +/** + @} + */ diff --git a/components/softdevice/s310/headers/ble.h b/components/softdevice/s310/headers/ble.h new file mode 100644 index 0000000..b06321d --- /dev/null +++ b/components/softdevice/s310/headers/ble.h @@ -0,0 +1,455 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/** @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_BUFFER_COUNT_GET, /**< Get the total number of available application transmission buffers from the BLE stack. */ + 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 Common Option IDs. + * IDs that uniquely identify a common option. + */ +enum BLE_COMMON_OPTS +{ + BLE_COMMON_OPT_RADIO_CPU_MUTEX = BLE_OPT_BASE /**< Radio CPU mutex option. @ref ble_common_opt_radio_cpu_mutex_t */ +}; +/** @} */ + +/** @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. */ +/** @} */ + +/** @brief Maximum number of Vendor Specific UUIDs. +*/ +#define BLE_UUID_VS_MAX_COUNT 10 + +/** @} */ + +/** @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 excluding 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 Mutual exclusion of radio activity and CPU execution. + * + * This option configures the application's access to the CPU when the radio is active. The + * application can configure itself to be blocked from using the CPU while the radio is + * active. By default, the application will be able to share CPU time with the SoftDevice + * during radio activity. This parameter structure is used together with @ref sd_ble_opt_set + * to configure the @ref BLE_COMMON_OPT_RADIO_CPU_MUTEX option. + * + * @note Note that the application should use this option to configure the SoftDevice to block the + * CPU during radio activity (i.e enable mutual exclusion) when running the SoftDevice on + * hardware affected by PAN #44 "CCM may exceed real time requirements"and PAN #45 "AAR may + * exceed real time requirements". + * + * @note Note that when acting as a scanner, the mutex is only enabled for radio TX activity. + * + * @note @ref sd_ble_opt_get is not supported for this option. + * + */ +typedef struct +{ + uint8_t enable : 1; /**< Enable mutual exclusion of radio activity and the CPU execution. */ +} ble_common_opt_radio_cpu_mutex_t; + +/**@brief Option structure for common options. */ +typedef union +{ + ble_common_opt_radio_cpu_mutex_t radio_cpu_mutex; /**< Parameters for the option for the mutual exclusion of radio activity and CPU execution. */ +} ble_common_opt_t; + +/**@brief Common BLE Option type, wrapping the module specific options. */ +typedef union +{ + ble_common_opt_t common_opt; /**< Common option, opt_id in BLE_COMMON_OPT_* series. */ + ble_gap_opt_t gap_opt; /**< GAP option, opt_id in BLE_GAP_OPT_* series. */ +} ble_opt_t; + +/** + * @brief BLE GATTS init options + */ +typedef struct +{ + ble_gatts_enable_params_t gatts_enable_params; /**< GATTS init options @ref ble_gatts_enable_params_t. */ +} ble_enable_params_t; + +/** @} */ + +/** @addtogroup BLE_COMMON_FUNCTIONS Functions + * @{ */ + +/**@brief Enable the BLE stack + * + * @param[in] p_ble_enable_params Pointer to ble_enable_params_t + * + * @details This call initializes the BLE stack, no other BLE related function can be called before this one. + * + * @return @ref NRF_SUCCESS BLE the BLE stack has been initialized successfully + * @retval @ref NRF_ERROR_INVALID_STATE the BLE stack had already been initialized and cannot be reinitialized. + * @return @ref NRF_ERROR_INVALID_ADDR Invalid or not sufficiently aligned pointer supplied. + * @return @ref 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. + * @return @ref NRF_ERROR_NO_MEM The Attribute Table size is too large. Decrease size in @ref ble_gatts_enable_params_t. + */ +SVCALL(SD_BLE_ENABLE, uint32_t, sd_ble_enable(ble_enable_params_t * p_ble_enable_params)); + +/**@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 signalled 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. + * + * @note The pointer supplied must be aligned to the extend defined by @ref BLE_EVTS_PTR_ALIGNMENT + * + * @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 application transmission buffers per link in the BLE stack. + * + * @details This call allows the application to obtain the total number of + * transmission buffers available per link for application data. Please note that + * this does not give the number of free buffers, but rather the total amount of them. + * The application has two options to handle its own application transmission buffers: + * - Use a simple arithmetic calculation: at boot time the application should use this function + * to find out the total amount of buffers available to it and store it in a variable. + * Every time a packet that consumes an application buffer is sent 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 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 packets. + * This mechanism allows the application to be aware at any time of the number of + * application packets available in the BLE stack's internal buffers, 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. + * - Choose to simply not keep track of available buffers at all, and instead handle the + * @ref BLE_ERROR_NO_TX_BUFFERS 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 buffer 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[out] p_count Pointer to a uint8_t which will contain the number of application transmission buffers upon + * successful return. + * + * @retval ::NRF_SUCCESS Number of application transmission buffers retrieved successfully. + * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. + */ +SVCALL(SD_BLE_TX_BUFFER_COUNT_GET, uint32_t, sd_ble_tx_buffer_count_get(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. + * + * + * @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. + * @retval ::NRF_ERROR_FORBIDDEN If p_vs_uuid has already been added to the VS UUID table. + */ +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. + * + * @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. + * + * @param[in] opt_id Option ID. + * @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. + * @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)); + +/** @} */ + +#endif /* BLE_H__ */ + +/** + @} + @} +*/ diff --git a/components/softdevice/s310/headers/ble_err.h b/components/softdevice/s310/headers/ble_err.h new file mode 100644 index 0000000..6805e0e --- /dev/null +++ b/components/softdevice/s310/headers/ble_err.h @@ -0,0 +1,83 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/* @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_BUFFERS (NRF_ERROR_STK_BASE_NUM+0x004) /**< Buffer capacity exceeded. */ +#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. */ +/** @} */ + +#endif + + +/** + @} + @} +*/ diff --git a/components/softdevice/s310/headers/ble_gap.h b/components/softdevice/s310/headers/ble_gap.h new file mode 100644 index 0000000..63d9274 --- /dev/null +++ b/components/softdevice/s310/headers/ble_gap.h @@ -0,0 +1,1349 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/**@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_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. @ref ble_gap_evt_connected_t */ + BLE_GAP_EVT_DISCONNECTED, /**< Disconnected from peer. @ref ble_gap_evt_disconnected_t */ + BLE_GAP_EVT_CONN_PARAM_UPDATE, /**< Connection Parameters updated. ble_gap_evt_conn_param_update_t */ + BLE_GAP_EVT_SEC_PARAMS_REQUEST, /**< Request to provide security parameters. @ref ble_gap_evt_sec_params_request_t */ + BLE_GAP_EVT_SEC_INFO_REQUEST, /**< Request to provide security information. @ref ble_gap_evt_sec_info_request_t */ + BLE_GAP_EVT_PASSKEY_DISPLAY, /**< Request to display a passkey to the user. @ref ble_gap_evt_passkey_display_t */ + BLE_GAP_EVT_AUTH_KEY_REQUEST, /**< Request to provide an authentication key. @ref ble_gap_evt_auth_key_request_t */ + BLE_GAP_EVT_AUTH_STATUS, /**< Authentication procedure completed with status. @ref ble_gap_evt_auth_status_t */ + BLE_GAP_EVT_CONN_SEC_UPDATE, /**< Connection security updated. @ref ble_gap_evt_conn_sec_update_t */ + BLE_GAP_EVT_TIMEOUT, /**< Timeout expired. @ref ble_gap_evt_timeout_t */ + BLE_GAP_EVT_RSSI_CHANGED, /**< RSSI report. @ref ble_gap_evt_rssi_changed_t */ + BLE_GAP_EVT_ADV_REPORT, /**< Advertising report. @ref ble_gap_evt_adv_report_t */ + BLE_GAP_EVT_SEC_REQUEST, /**< Security Request. @ref ble_gap_evt_sec_request_t */ + BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST, /**< Connection Parameter Update Request. @ref ble_gap_evt_conn_param_update_request_t */ + BLE_GAP_EVT_SCAN_REQ_REPORT, /**< Scan request report. @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. */ +/**@} */ + + +/**@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_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_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_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. */ +/**@} */ + +/**@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 connction interval specified in connect parameters. */ +#define BLE_GAP_CP_MIN_CONN_INTVL_MIN 0x0006 /**< Lowest mimimum 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 connction 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 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 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 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 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 or 3), 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 and scanning. */ +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 none is given. */ + 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 ble_gap_channel_mask_t for documentation. */ +} 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 none is given. */ + 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. */ +} ble_gap_sec_kdist_t; + + +/**@brief GAP security parameters. */ +typedef struct +{ + uint8_t bond : 1; /**< Perform bonding. */ + uint8_t mitm : 1; /**< Man In The Middle protection required. */ + 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_periph; /**< Key distribution bitmap: keys that the peripheral device will distribute. */ + ble_gap_sec_kdist_t kdist_central; /**< Key distribution bitmap: keys that the central 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 auth : 1; /**< Authenticated Key. */ + uint8_t ltk_len : 7; /**< 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 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 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). */ +} ble_gap_evt_passkey_display_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 Security levels supported. + * @note See Bluetooth Specification Version 4.1 Volume 3, Part C, Chapter 10. +*/ +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. */ +} 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_sec_keys_t; + + +/**@brief Security key set (both Peripheral and Central keys). + * Note that when distributing Bluetooth addresses pertaining to the local device those + * will have to be filled in by the user. */ +typedef struct +{ + ble_gap_sec_keys_t keys_periph; /**< Keys distributed by the device in the Peripheral role. */ + ble_gap_sec_keys_t keys_central; /**< Keys distributed by the device in the Central role. */ +} 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_periph; /**< Bitmap stating which keys were exchanged (distributed) by the peripheral. */ + ble_gap_sec_kdist_t kdist_central; /**< Bitmap stating which keys were exchanged (distributed) by the central. */ +} 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 required. */ +} 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 occured. */ + 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_auth_key_request_t auth_key_request; /**< Authentication Key Request Event Parameters. */ + 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 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. + * + * @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, const ble_gap_addr_t *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. + * + * @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_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. + * + * @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_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. + */ +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). + * + * @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. + * + * @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. + * + * @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 -40 dBm will not actually give -40 dBm, but will instead be remapped to -30 dBm. + * + * @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. + * + * @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. + * + * @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. + * + * @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. + * + * @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 timeout, bond and mitm fields of this structure are used. + * In the central role, this pointer may be NULL to reject a Security Request. + * + * @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. + * + * @note Calling this function may result in the following events depending on the outcome and parameters: @ref BLE_GAP_EVT_SEC_PARAMS_REQUEST, + * @ref BLE_GAP_EVT_SEC_INFO_REQUEST, @ref BLE_GAP_EVT_AUTH_KEY_REQUEST, @ref BLE_GAP_EVT_CONN_SEC_UPDATE, @ref BLE_GAP_EVT_AUTH_STATUS. + * + * + * @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 ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied. + * @retval ::NRF_ERROR_TIMEOUT A SMP timout has occured, 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. + * + * @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 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. + * The pointer to the ID key data distributed by the local device constitutes however an exception. It can either point to ID key data + * filled in by the user before calling this function, in which case a user-supplied Bluetooth address and IRK will be distributed, + * or the pointer to the ID key data structure can be NULL, in which case the device's configured (or default, if none is configured) + * Bluetooth address and IRK will be distributed. + * + * @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. + * + * @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. + */ +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. + * + * @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). + * If key type is @ref BLE_GAP_AUTH_KEY_TYPE_OOB, then a 16-byte OOB key value in Little Endian format. + * + * @details This function is only used to reply to a @ref BLE_GAP_EVT_AUTH_KEY_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. + * + * @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 Initiate GAP Encryption procedure. + * + * @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. + * + * @details In the central role, this function will initiate the encryption procedure using the encryption information provided. + * + * @note Calling this function may result in the following event depending on the outcome and parameters: @ref BLE_GAP_EVT_CONN_SEC_UPDATE. + * + * @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. + * + * @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. + * + * @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. + * + * @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. + * + * @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. + * + * @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. + * + * @param[in] conn_handle Connection handle. + * @param[out] p_rssi Pointer to the location where the RSSI measurement shall be stored. + * + * @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. + * + * @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). + * + * @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_NOT_SUPPORTED A selected feature is not supported (selective scanning). + */ +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). + * + * @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). + * + * @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_NO_MEM limit of available connections reached. + * @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. +*/ +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. + * + * @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)); + +/** @} */ + +#endif // BLE_GAP_H__ + +/** + @} +*/ diff --git a/components/softdevice/s310/headers/ble_gatt.h b/components/softdevice/s310/headers/ble_gatt.h new file mode 100644 index 0000000..2e85599 --- /dev/null +++ b/components/softdevice/s310/headers/ble_gatt.h @@ -0,0 +1,200 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + + +/** @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 + +/** @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; + +#endif // BLE_GATT_H__ + +/** @} */ + +/** + @} + @} +*/ diff --git a/components/softdevice/s310/headers/ble_gattc.h b/components/softdevice/s310/headers/ble_gattc.h new file mode 100644 index 0000000..dc476aa --- /dev/null +++ b/components/softdevice/s310/headers/ble_gattc.h @@ -0,0 +1,441 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/** @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_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. @ref ble_gattc_evt_prim_srvc_disc_rsp_t */ + BLE_GATTC_EVT_REL_DISC_RSP, /**< Relationship Discovery Response event. @ref ble_gattc_evt_rel_disc_rsp_t */ + BLE_GATTC_EVT_CHAR_DISC_RSP, /**< Characteristic Discovery Response event. @ref ble_gattc_evt_char_disc_rsp_t */ + BLE_GATTC_EVT_DESC_DISC_RSP, /**< Descriptor Discovery Response event. @ref ble_gattc_evt_desc_disc_rsp_t */ + BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP, /**< Read By UUID Response event. @ref ble_gattc_evt_char_val_by_uuid_read_rsp_t */ + BLE_GATTC_EVT_READ_RSP, /**< Read Response event. @ref ble_gattc_evt_read_rsp_t */ + BLE_GATTC_EVT_CHAR_VALS_READ_RSP, /**< Read multiple Response event. @ref ble_gattc_evt_char_vals_read_rsp_t */ + BLE_GATTC_EVT_WRITE_RSP, /**< Write Response event. @ref ble_gattc_evt_write_rsp_t */ + BLE_GATTC_EVT_HVX, /**< Handle Value Notification or Indication event. @ref ble_gattc_evt_hvx_t */ + BLE_GATTC_EVT_TIMEOUT /**< Timeout event. @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. */ +/** @} */ + +/**@brief Last Attribute Handle. */ +#define BLE_GATTC_HANDLE_END 0xFFFF + +/** @} */ + +/** @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 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, variable length. */ +} 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, variable length. */ +} 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, variable length. */ +} 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, variable length. */ +} ble_gattc_evt_desc_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, variable length. */ +} 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, variable length. */ +} 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, variable length. */ +} 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, variable length. */ +} 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, variable length. */ +} 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. */ + } 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. + * + * @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. + * + * @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. + * + * @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. + * + * @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. + * + * @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. + * + * @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_INVALID_ADDR Invalid pointer supplied. + * @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. + * + * @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_buffer_count_get for more details. + * + * @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_BUFFERS There are no available buffers left. + */ +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. + * + * @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)); + +/** @} */ + +#endif /* BLE_GATTC_H__ */ + +/** + @} + @} +*/ diff --git a/components/softdevice/s310/headers/ble_gatts.h b/components/softdevice/s310/headers/ble_gatts.h new file mode 100644 index 0000000..faec547 --- /dev/null +++ b/components/softdevice/s310/headers/ble_gatts.h @@ -0,0 +1,639 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/** @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. */ +}; + +/** + * @brief GATT Server Event IDs. + */ +enum BLE_GATTS_EVTS +{ + BLE_GATTS_EVT_WRITE = BLE_GATTS_EVT_BASE, /**< Write operation performed. @ref ble_gatts_evt_write_t */ + BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST, /**< Read/Write Authorization request.@ref ble_gatts_evt_rw_authorize_request_t */ + BLE_GATTS_EVT_SYS_ATTR_MISSING, /**< A persistent system attribute access is pending, awaiting a sd_ble_gatts_sys_attr_set(). @ref ble_gatts_evt_sys_attr_missing_t */ + BLE_GATTS_EVT_HVC, /**< Handle Value Confirmation. @ref ble_gatts_evt_hvc_t */ + BLE_GATTS_EVT_SC_CONFIRM, /**< Service Changed Confirmation. No additional event structure applies. */ + BLE_GATTS_EVT_TIMEOUT /**< Timeout. @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 (0x700 bytes for this version of the SoftDevice). */ +/** @} */ + +/** @} */ + +/** @addtogroup BLE_GATTS_STRUCTURES Structures + * @{ */ + +/** + * @brief BLE GATTS init options + */ +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 Attribute Context. */ +typedef struct +{ + ble_uuid_t srvc_uuid; /**< Service UUID. */ + ble_uuid_t char_uuid; /**< Characteristic UUID if applicable (BLE_UUID_TYPE_UNKNOWN otherwise). */ + ble_uuid_t desc_uuid; /**< Descriptor UUID if applicable (BLE_UUID_TYPE_UNKNOWN otherwise). */ + uint16_t srvc_handle; /**< Service Handle. */ + uint16_t value_handle; /**< Characteristic Value Handle if applicable (BLE_GATT_HANDLE_INVALID otherwise). */ + uint8_t type; /**< Attribute Type, see @ref BLE_GATTS_ATTR_TYPES. */ +} ble_gatts_attr_context_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 Read 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 in the ATT response. */ + 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. */ + uint8_t *p_data; /**< Pointer to new value used to update the attribute value. */ +} ble_gatts_read_authorize_params_t; + +/**@brief GATT Write Authorization parameters. */ +typedef struct +{ + uint16_t gatt_status; /**< GATT status code for the operation, see @ref BLE_GATT_STATUS_CODES. */ +} ble_gatts_write_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_read_authorize_params_t read; /**< Read authorization parameters. */ + ble_gatts_write_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. */ + uint8_t op; /**< Type of write operation, see @ref BLE_GATTS_OPS. */ + ble_gatts_attr_context_t context; /**< Attribute Context. */ + uint16_t offset; /**< Offset for the write operation. */ + uint16_t len; /**< Length of the received data. */ + uint8_t data[1]; /**< Received data, variable length. */ +} 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_gatts_attr_context_t context; /**< Attribute Context. */ + 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. + * + * @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. + * + * @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. + * + * @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. + * + * @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. + * + * @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). + * + * @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. + * + * @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. + * + * @note Values other than system attributes can be set at any time, regardless of wheter any active connections exist. + * + * @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. + * + * @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. + * + * @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. + * + * @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 ::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_BUFFERS 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_buffer_count_get for more details. + * + * @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_BUFFERS There are no available buffers to send the data, 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. + * + * @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_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_INVALID_STATE Invalid state to perform operation, notifications or indications must be enabled in the CCCD. + * @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. + * + * @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_STATE Invalid Connection State or no authorization request pending. + * @retval ::NRF_ERROR_INVALID_PARAM Authorization op invalid, + * or for Read Authorization reply: requested handles not replied with, + * or for Write Authorization reply: handle supplied does not match requested handle. + * @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. + * + * @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_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. + * + * @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. 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)); + +/** @} */ + +#endif // BLE_GATTS_H__ + +/** + @} +*/ diff --git a/components/softdevice/s310/headers/ble_hci.h b/components/softdevice/s310/headers/ble_hci.h new file mode 100644 index 0000000..978f885 --- /dev/null +++ b/components/softdevice/s310/headers/ble_hci.h @@ -0,0 +1,125 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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__ + +/** @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. */ + +/** @} */ + + +#endif // BLE_HCI_H__ + +/** @} */ diff --git a/components/softdevice/s310/headers/ble_l2cap.h b/components/softdevice/s310/headers/ble_l2cap.h new file mode 100644 index 0000000..bd4099e --- /dev/null +++ b/components/softdevice/s310/headers/ble_l2cap.h @@ -0,0 +1,177 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/**@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, variable length. */ +} 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. + * + * @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. + * + * @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 buffer, 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_buffer_count_get for more details. + * + * @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_BUFFERS Not enough application buffers 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)); + +/** @} */ + +#endif // BLE_L2CAP_H__ + +/** + @} +*/ diff --git a/components/softdevice/s310/headers/ble_ranges.h b/components/softdevice/s310/headers/ble_ranges.h new file mode 100644 index 0000000..4d5c05b --- /dev/null +++ b/components/softdevice/s310/headers/ble_ranges.h @@ -0,0 +1,119 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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__ + +#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. */ + +#endif /* BLE_RANGES_H__ */ + +/** + @} + @} +*/ diff --git a/components/softdevice/s310/headers/ble_types.h b/components/softdevice/s310/headers/ble_types.h new file mode 100644 index 0000000..643208e --- /dev/null +++ b/components/softdevice/s310/headers/ble_types.h @@ -0,0 +1,198 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 + +/** @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 +{ + unsigned char 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; + +/** @} */ + +#endif /* BLE_TYPES_H__ */ + +/** + @} + @} +*/ diff --git a/components/softdevice/s310/headers/nrf_error.h b/components/softdevice/s310/headers/nrf_error.h new file mode 100644 index 0000000..d580aa3 --- /dev/null +++ b/components/softdevice/s310/headers/nrf_error.h @@ -0,0 +1,78 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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__ + +/** @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 + +#endif // NRF_ERROR_H__ + +/** + @} +*/ diff --git a/components/softdevice/s310/headers/nrf_error_sdm.h b/components/softdevice/s310/headers/nrf_error_sdm.h new file mode 100644 index 0000000..b3b9b76 --- /dev/null +++ b/components/softdevice/s310/headers/nrf_error_sdm.h @@ -0,0 +1,60 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +#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). + +#endif // NRF_ERROR_SDM_H__ + +/** + @} + @} +*/ diff --git a/components/softdevice/s310/headers/nrf_error_soc.h b/components/softdevice/s310/headers/nrf_error_soc.h new file mode 100644 index 0000000..d80d626 --- /dev/null +++ b/components/softdevice/s310/headers/nrf_error_soc.h @@ -0,0 +1,76 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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" + +/* 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 + +#endif // NRF_ERROR_SOC_H__ +/** + @} + @} +*/ diff --git a/components/softdevice/s310/headers/nrf_mbr.h b/components/softdevice/s310/headers/nrf_mbr.h new file mode 100644 index 0000000..3ac6dbf --- /dev/null +++ b/components/softdevice/s310/headers/nrf_mbr.h @@ -0,0 +1,184 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 + + +/** @addtogroup NRF_MBR_DEFINES Defines + * @{ */ + +/**@brief MBR SVC Base number. */ +#define MBR_SVC_BASE (0x18) + +/** @} */ + +/** @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 PROTENSET 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 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. + */ +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 adress in NFR_UICR->BOOTADDR or to the SoftDevice if the BOOTADDR is not set. + * + * @retval ::NRF_SUCCESS + * @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. + */ +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_copy_bl_t copy_bl; /**< Parameters for copy BootLoader.*/ + sd_mbr_command_compare_t compare; /**< Parameters for verify.*/ + sd_mbr_command_vector_table_base_set_t base_set; /**< Parameters for vector table base set.*/ + } params; +} sd_mbr_command_t; + +/** @} */ + +/** @addtogroup NRF_MBR_FUNCTIONS Functions + * @{ */ + +/**@brief Issue Master Boot Record commands + * + * Commands used when updating a SoftDevice and bootloader. + * + * @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 + +*/ +SVCALL(SD_MBR_COMMAND, uint32_t, sd_mbr_command(sd_mbr_command_t* param)); + +/** @} */ +#endif // NRF_MBR_H__ + +/** + @} +*/ diff --git a/components/softdevice/s310/headers/nrf_sd_def.h b/components/softdevice/s310/headers/nrf_sd_def.h new file mode 100644 index 0000000..bda93bd --- /dev/null +++ b/components/softdevice/s310/headers/nrf_sd_def.h @@ -0,0 +1,23 @@ +/* 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. + * + */ + +#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 th 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/components/softdevice/s310/headers/nrf_sdm.h b/components/softdevice/s310/headers/nrf_sdm.h new file mode 100644 index 0000000..63a89ab --- /dev/null +++ b/components/softdevice/s310/headers/nrf_sdm.h @@ -0,0 +1,221 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 "nrf51.h" +#include "nrf_soc.h" +#include "nrf_error_sdm.h" + +/** @addtogroup NRF_SDM_DEFINES Defines + * @{ */ + +/** @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 usual size reserverd 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) + +/** @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) + + +/** @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 */ +}; + +/**@brief Possible lfclk oscillator sources. */ +enum NRF_CLOCK_LFCLKSRCS +{ + NRF_CLOCK_LFCLKSRC_SYNTH_250_PPM, /**< LFCLK Synthesized from HFCLK. */ + NRF_CLOCK_LFCLKSRC_XTAL_500_PPM, /**< LFCLK crystal oscillator 500 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_250_PPM, /**< LFCLK crystal oscillator 250 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_150_PPM, /**< LFCLK crystal oscillator 150 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_100_PPM, /**< LFCLK crystal oscillator 100 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_75_PPM, /**< LFCLK crystal oscillator 75 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_50_PPM, /**< LFCLK crystal oscillator 50 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_30_PPM, /**< LFCLK crystal oscillator 30 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, /**< LFCLK crystal oscillator 20 PPM accuracy. */ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_250MS_CALIBRATION, /**< LFCLK RC oscillator, 250ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_500MS_CALIBRATION, /**< LFCLK RC oscillator, 500ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_1000MS_CALIBRATION, /**< LFCLK RC oscillator, 1000ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_2000MS_CALIBRATION, /**< LFCLK RC oscillator, 2000ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_4000MS_CALIBRATION, /**< LFCLK RC oscillator, 4000ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_8000MS_CALIBRATION, /**< LFCLK RC oscillator, 8000ms calibration interval.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_1000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 1000ms, if changed above a threshold, a calibration is done.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_2000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 2000ms, if changed above a threshold, a calibration is done.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_4000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 4000ms, if changed above a threshold, a calibration is done.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_8000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 8000ms, if changed above a threshold, a calibration is done.*/ + NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_16000MS_CALIBRATION, /**< LFCLK RC oscillator. Temperature checked every 16000ms, if changed above a threshold, a calibration is done.*/ +}; + +/** @} */ + +/** @addtogroup NRF_SDM_TYPES Types + * @{ */ + +/**@brief Type representing lfclk oscillator source. */ +typedef uint32_t nrf_clock_lfclksrc_t; + + +/**@brief SoftDevice Assertion Handler type. + * + * When an unexpected error occurs within the SoftDevice it will call the SoftDevice assertion handler callback. + * 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 SoftDevice assert callback. + * + * @param[in] pc The program counter of the failed assert. + * @param[in] line_number Line number where the assert failed. + * @param[in] file_name File name where the assert failed. + */ +typedef void (*softdevice_assertion_handler_t)(uint32_t pc, uint16_t line_number, const uint8_t * p_file_name); + +/** @} */ + +/** @addtogroup NRF_SDM_FUNCTIONS Functions + * @{ */ + +/**@brief Enables the SoftDevice and by extension the protocol stack. + * + * Idempotent function to enable the SoftDevice. + * + * @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 clock_source Low frequency clock source and accuracy. (Note: 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 assertion_handler Callback for SoftDevice assertions. + * + * @retval ::NRF_SUCCESS + * @retval ::NRF_ERROR_INVALID_STATE SoftDevice is already enabled, and the clock source and assertion handler cannot be updated. + * @retval ::NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION SoftDeviceinterrupt 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_lfclksrc_t clock_source, softdevice_assertion_handler_t assertion_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)); + +/** @} */ + +#endif // NRF_SDM_H__ + +/** + @} +*/ diff --git a/components/softdevice/s310/headers/nrf_soc.h b/components/softdevice/s310/headers/nrf_soc.h new file mode 100644 index 0000000..752778a --- /dev/null +++ b/components/softdevice/s310/headers/nrf_soc.h @@ -0,0 +1,993 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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 "nrf51.h" +#include "nrf51_bitfields.h" +#include "nrf_error_soc.h" + +/**@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. */ + +#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. */ + +#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_TYPES Types + * @{ */ + +/**@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_NVIC_ENABLEIRQ, + SD_NVIC_DISABLEIRQ, + SD_NVIC_GETPENDINGIRQ, + SD_NVIC_SETPENDINGIRQ, + SD_NVIC_CLEARPENDINGIRQ, + SD_NVIC_SETPRIORITY, + SD_NVIC_GETPRIORITY, + SD_NVIC_SYSTEMRESET, + SD_NVIC_CRITICAL_REGION_ENTER, + SD_NVIC_CRITICAL_REGION_EXIT, + SD_RAND_APPLICATION_POOL_CAPACITY, + SD_RAND_APPLICATION_BYTES_AVAILABLE, + SD_RAND_APPLICATION_GET_VECTOR, + SD_POWER_MODE_SET, + SD_POWER_SYSTEM_OFF, + SD_POWER_RESET_REASON_GET, + SD_POWER_RESET_REASON_CLR, + SD_POWER_POF_ENABLE, + SD_POWER_POF_THRESHOLD_SET, + SD_POWER_RAMON_SET, + SD_POWER_RAMON_CLR, + SD_POWER_RAMON_GET, + SD_POWER_GPREGRET_SET, + SD_POWER_GPREGRET_CLR, + SD_POWER_GPREGRET_GET, + SD_POWER_DCDC_MODE_SET, + SD_APP_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_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 Possible values of ::nrf_app_irq_priority_t. */ +enum NRF_APP_PRIORITIES +{ + NRF_APP_PRIORITY_HIGH = 1, + NRF_APP_PRIORITY_LOW = 3 +}; + +/**@brief Possible values of ::nrf_power_mode_t. */ +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 Possible values of ::nrf_power_failure_threshold_t */ +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 Possible values of ::nrf_power_dcdc_mode_t. */ +enum NRF_POWER_DCDC_MODES +{ + NRF_POWER_DCDC_DISABLE, /**< The DCDC is disabled. */ + NRF_POWER_DCDC_ENABLE /**< The DCDC is enabled. */ +}; + +/**@brief Possible values of ::nrf_radio_notification_distance_t. */ +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 Possible values of ::nrf_radio_notification_type_t. */ +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 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 signal callback handler return was invalid. */ + NRF_EVT_RADIO_SESSION_IDLE, /**< Event indicating that a radio session is idle. */ + NRF_EVT_RADIO_SESSION_CLOSED, /**< Event indicating that a radio session is closed. */ + NRF_EVT_NUMBER_OF_EVTS +}; + +/**@} */ + +/**@addtogroup NRF_SOC_TYPES Types + * @{ */ + +/**@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 The interrupt priorities available to the application while the softdevice is active. */ +typedef uint8_t nrf_app_irq_priority_t; + +/**@brief Represents a power mode, used in power mode functions */ +typedef uint8_t nrf_power_mode_t; + +/**@brief Represents a power failure threshold value. */ +typedef uint8_t nrf_power_failure_threshold_t; + +/**@brief Represents a DCDC mode value. */ +typedef uint32_t nrf_power_dcdc_mode_t; + +/**@brief Radio notification distances. */ +typedef uint8_t nrf_radio_notification_distance_t; + +/**@brief Radio notification types. */ +typedef uint8_t nrf_radio_notification_type_t; + +/**@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_DEFAULT, /**< Use the currently selected oscillator as HF clock source during the timeslot (i.e. the source is not specified). */ + NRF_RADIO_HFCLK_CFG_FORCE_XTAL, /**< Force external crystal to be used as HF clock source during whole the timeslot. */ +}; + +/**@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 timeslot as early as possible. This should always be used for the first request in a session. */ + NRF_RADIO_REQ_TYPE_NORMAL /**< Normal timeslot request. */ +}; + +/**@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 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 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 a request for a timeslot as early as possible. */ + nrf_radio_request_normal_t normal; /**< Parameters for a normal radio request. */ + } 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 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 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 data structure */ +typedef struct +{ + uint8_t key[SOC_ECB_KEY_LENGTH]; /**< Encryption key. */ + uint8_t cleartext[SOC_ECB_CLEARTEXT_LENGTH]; /**< Clear Text data. */ + uint8_t ciphertext[SOC_ECB_CIPHERTEXT_LENGTH]; /**< Cipher Text data. */ +} nrf_ecb_hal_data_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 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. + */ +SVCALL(SD_NVIC_ENABLEIRQ, 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. + */ +SVCALL(SD_NVIC_DISABLEIRQ, 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. + */ +SVCALL(SD_NVIC_GETPENDINGIRQ, 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. + */ +SVCALL(SD_NVIC_SETPENDINGIRQ, 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. + */ +SVCALL(SD_NVIC_CLEARPENDINGIRQ, 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. + */ +SVCALL(SD_NVIC_SETPRIORITY, uint32_t, sd_nvic_SetPriority(IRQn_Type IRQn, nrf_app_irq_priority_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. + */ +SVCALL(SD_NVIC_GETPRIORITY, uint32_t, sd_nvic_GetPriority(IRQn_Type IRQn, nrf_app_irq_priority_t * p_priority)); + +/**@brief System Reset. + * @note Corresponds to NVIC_SystemReset in CMSIS. + * + * @retval ::NRF_ERROR_SOC_NVIC_SHOULD_NOT_RETURN + */ +SVCALL(SD_NVIC_SYSTEMRESET, 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 + */ +SVCALL(SD_NVIC_CRITICAL_REGION_ENTER, 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 + */ +SVCALL(SD_NVIC_CRITICAL_REGION_EXIT, uint32_t, sd_nvic_critical_region_exit(uint8_t is_nested_critical_region)); + +/**@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, 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, 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_GET_VECTOR, 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. @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(nrf_power_mode_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. + * + * @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(nrf_power_failure_threshold_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. + * + * This function is to enable or disable the DCDC periperhal. + * + * @param[in] dcdc_mode The mode of the DCDC. + * + * @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(nrf_power_dcdc_mode_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. + * @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. + * 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(nrf_radio_notification_type_t type, nrf_radio_notification_distance_t distance)); + +/**@brief Encrypts a block according to the specified parameters. + * + * 128-bit AES encryption. + * + * @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 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. + * + * @note Pan #28 in PAN-028 v 1.6 "Negative measured values are not represented correctly" is corrected by this function. + * + * @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 32bit words. +* +* @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 more than 256 words. +* @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 registers PROTENSETx + * + * @note To read the values in PROTENSETx you can read them directly. They are only write-protected. + * + * @param[in] protenset0 Value to be written to PROTENSET0. + * @param[in] protenset1 Value to be written to PROTENSET1. + * + * @retval ::NRF_ERROR_FORBIDDEN Tried to protect the SoftDevice. + * @retval ::NRF_SUCCESS Values successfully written to PROTENSETx. + */ +SVCALL(SD_FLASH_PROTECT, uint32_t, sd_flash_protect(uint32_t protenset0, uint32_t protenset1)); + +/**@brief Opens a session for radio 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 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 )); + +/**@} */ + +#endif // NRF_SOC_H__ + +/**@} */ diff --git a/components/softdevice/s310/headers/nrf_svc.h b/components/softdevice/s310/headers/nrf_svc.h new file mode 100644 index 0000000..49f1425 --- /dev/null +++ b/components/softdevice/s310/headers/nrf_svc.h @@ -0,0 +1,71 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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__ + +#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__) +#define SVCALL(number, return_type, signature) \ + _Pragma("GCC diagnostic ignored \"-Wunused-function\"") \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \ + __attribute__((naked)) static return_type signature \ + { \ + __asm( \ + "svc %0\n" \ + "bx r14" : : "I" (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 +#endif // NRF_SVC__ diff --git a/components/softdevice/s310/headers/softdevice_assert.h b/components/softdevice/s310/headers/softdevice_assert.h new file mode 100644 index 0000000..89e1d11 --- /dev/null +++ b/components/softdevice/s310/headers/softdevice_assert.h @@ -0,0 +1,73 @@ +/* + * 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 must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of Nordic Semiconductor ASA nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 4. This software must only be used in a processor manufactured by Nordic + * Semiconductor ASA, or in a processor manufactured by a third party that + * is used in combination with a processor manufactured by Nordic Semiconductor. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** @brief Utilities for verifying program logic + */ + +#ifndef SOFTDEVICE_ASSERT_H_ +#define SOFTDEVICE_ASSERT_H_ + +#include + +/** @brief This function handles assertions. + * + * + * @note + * This function is called when an assertion has triggered. + * + * + * @param line_num The line number where the assertion is called + * @param file_name Pointer to the file name + */ +void assert_softdevice_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 Check intended for production code + * + * Check passes if "expr" evaluates to true. */ +#define ASSERT(expr) \ +if (expr) \ +{ \ +} \ +else \ +{ \ + assert_softdevice_callback((uint16_t)__LINE__, (uint8_t *)__FILE__); \ + /*lint -unreachable */ \ +} + +#endif /* SOFTDEVICE_ASSERT_H_ */ diff --git a/components/softdevice/s310/hex/s310_nrf51422_3.0.0_softdevice.hex b/components/softdevice/s310/hex/s310_nrf51422_3.0.0_softdevice.hex new file mode 100644 index 0000000..c48d2be --- /dev/null +++ b/components/softdevice/s310/hex/s310_nrf51422_3.0.0_softdevice.hex @@ -0,0 +1,7295 @@ +:020000040000FA +:10000000C0070000D1060000D1000000B1060000CA +:1000100000000000000000000000000000000000E0 +:100020000000000000000000000000005107000078 +:100030000000000000000000DB000000E500000000 +:10004000EF000000F9000000030100000D010000B6 +:1000500017010000210100002B0100003501000004 +:100060003F01000049010000530100005D01000054 +:1000700067010000710100007B01000085010000A4 +:100080008F01000099010000A3010000AD010000F4 +:10009000B7010000C1010000CB010000D501000044 +:1000A000DF010000E9010000F3010000FD01000094 +:1000B00007020000110200001B02000025020000E0 +:1000C0001FB5C046C04600F0EFFA04B00FB41FBD24 +:1000D00008205A49096809580847382057490968CB +:1000E000095808473C2055490968095808474020E5 +:1000F0005249096809580847442050490968095875 +:10010000084748204D490968095808474C204B4981 +:10011000096809580847502048490968095808479C +:100120005420464909680958084758204349096836 +:10013000095808475C204149096809580847602068 +:100140003E4909680958084764203C49096809582C +:100150000847682039490968095808476C20374919 +:100160000968095808477020344909680958084740 +:100170007420324909680958084778202F490968CE +:10018000095808477C202D490968095808478020EC +:100190002A490968095808478420284909680958E4 +:1001A0000847882025490968095808478C202349B1 +:1001B00009680958084790202049096809580847E4 +:1001C00094201E4909680958084798201B49096866 +:1001D000095808479C201949096809580847A02070 +:1001E0001649096809580847A4201449096809589C +:1001F0000847A8201149096809580847AC200F4949 +:10020000096809580847B0200C4909680958084787 +:10021000B4200A49096809580847B82007490968FD +:1002200009580847BC2005490968095808470000D3 +:1002300003480449024A034B7047000000000020B5 +:10024000C0070000C00700000122D84B5A6000BF61 +:10025000D74A1268002AFBD0016000BFD44A126856 +:10026000002AFBD00022D14B5A6000BFD04A12684E +:10027000002AFBD07047F0B505460E46174600240D +:1002800006E0A200B158A2005019FFF7DDFF641C80 +:10029000BC42F6D30020F0BD0120C043C549086030 +:1002A000401048607047014601229204086890425D +:1002B00001D9102070470020FCE7F0B505460C4638 +:1002C0001646002706E028462168FFF7BDFF2D1DD2 +:1002D000241D7F1CB742F6D3F0BD70B505460C4611 +:1002E0002E460BE0304600F075F9FF2C01D80024B3 +:1002F00001E0FF3C013C012080023618002CF1D1C6 +:1003000070BD0146012292044868904201D909203B +:100310007047A9484069401C01D10F20F8E7002030 +:10032000F6E7FEB504462068030000F037FA05043E +:100330002B4249598B00201DFFF7E3FF0546002D96 +:1003400001D02846FEBDFFF7A7FF0120C00200F044 +:1003500041F9042221469948FFF78DFF002801D07A +:100360000320EFE708222146944800F06DF90028A9 +:1003700006D1002192480068FFF766FF00F00CF9F3 +:100380000320DFE7A768E6686068019031463846D9 +:10039000FFF7A3FF324638460199FFF78EFFB20000 +:1003A0003846019900F050F9002800D1CAE703202F +:1003B000C8E700F0E3F9834800688349086041E03A +:1003C00060680190E668A0680090B200009901980A +:1003D00000F03AF90746002F00D1B3E70E20B1E74D +:1003E000201DFFF760FF0546002D01D02846A9E734 +:1003F0006068002807D1FFF74FFF0320800200F05C +:10040000E9F800F0C9F8FFF747FF0120C00200F04B +:10041000E1F8042221466948FFF72DFF002801D0AA +:1004200003208FE708222146644800F00DF90028D8 +:1004300006D1002162480068FFF706FF00F0ACF823 +:1004400003207FE700BF00207CE770B505460C461F +:10045000182D04D12068FFF764FF206002E001201E +:10046000206000BF00BF70BDF0B589B05248406940 +:1004700003905248806881000398081802900398FE +:10048000000B01900121090302984018401E000B47 +:1004900000900124002520462946019A00F0C4F866 +:1004A0000022401E91410791069001260027304608 +:1004B0003946009A00F0B8F80022401E914105919B +:1004C0000490049BDB43059AD2430698184307998E +:1004D00011430791069037490698086007984860CD +:1004E00009B0F0BD70B53448446934488568466841 +:1004F000AA003146204600F0A7F8002801D00020CD +:1005000070BD0120FCE72D484068002801D0012083 +:1005100000E000200546FFF7E5FF002807D0FFF7C1 +:10052000BBFE0320800200F055F800F035F8FFF71D +:100530009BFF002D0ED020484669204884684768FC +:1005400021463046FFF7C9FE224639463046FFF7BE +:10055000B4FE00BF00F020F810B5184844681A48EF +:100560000460204600F0DCF810BD15480068006803 +:10057000401C01D100BFFEE710480068002802D0EF +:10058000042806D101E0FFF7BEFFFFF7E5FF00BF3B +:10059000FEE700BF00BFFEE7BFF34F8F0B480C49DB +:1005A000C860BFF34F8F00BFFEE7000000E50140C9 +:1005B00000E40140000600400010001000080000A8 +:1005C000B8070000BC070000000000200400FA0586 +:1005D00000ED00E010B50146104B1A6808460223F2 +:1005E0000F4C636000BF0F4B1B68002BFBD0531CEC +:1005F00004D0904202D20A4B186101E0084B986087 +:1006000000BF084B1B68002BFBD00023044C636029 +:1006100000BF044B1B68002BFBD010BD0010001066 +:1006200000E5014000E4014010B5202A04DB01464A +:10063000203A9140002010BD914020239C1A03468F +:10064000E3401943904010BD034610B50B439B0790 +:100650000FD1042A0DD308C810C9121FA342F8D025 +:1006600018BA21BA884201D9012010BD0020C04328 +:1006700010BD002A03D0D30703D0521C07E000208E +:1006800010BD03780C78401C491C1B1B07D1037854 +:100690000C78401C491C1B1B01D1921EF1D118463D +:1006A00010BD70477047704710B500F007F810BDD7 +:1006B000014B1B68DB6818470000002019481A49E5 +:1006C0007047FFF7FBFFFFF7FBFC00BD20BFFDE716 +:1006D0001649174C24688C420BD1164B1B68994263 +:1006E0000CD1154B154A1360186810498842EDD09B +:1006F0000AE0134880F30888124B18470F4A13602A +:1007000018680A498842E1D080F308880E49884277 +:1007100004DD0E48026802210A4302605B68184744 +:100720000346DFE7C0070000C0070000FFFFFFFF30 +:10073000000C000014100010001000000000002049 +:10074000000400206B05000000200020240500406C +:100750000D48704502D1EFF3098101E0EFF3088104 +:10076000886902380078182802D1C046074A104725 +:10077000074A12682C3212681047000000B5054B7A +:10078000054A9B58984700BDFDFFFFFF4B04000042 +:1007900000000020001000000400000030B4744687 +:1007A000641E2578641CAB4204D3635D5B00E318D0 +:1007B00030BC18471D46F8E7000C00000010000090 +:10100000C01900201DCC01002514000083CB010075 +:1010100000000000000000000000000000000000D0 +:101020000000000000000000000000008DCC010066 +:10103000000000000000000025140000251400003E +:10104000F9CC0100FFCC010025140000251400009C +:1010500025140000251400002514000025140000AC +:1010600005CD010025140000251400000BCD010062 +:101070002514000011CD010017CD01001DCD010088 +:10108000251400002514000025140000251400007C +:10109000251400002514000025140000251400006C +:1010A00023CD010029CD01002514000025140000E6 +:1010B000251400002514000025140000251400004C +:1010C00000F002F81BF08BFD0CA030C80838241883 +:1010D0002D18A246671EAB4654465D46AC4201D170 +:1010E0001BF07DFD7E460F3E0FCCB64601263342F7 +:1010F00000D0FB1AA246AB4633431847A4BE0100FA +:10110000D4BE0100103A02D378C878C1FAD8520789 +:1011100001D330C830C101D504680C6070470000AD +:101120000023002400250026103A01D378C1FBD803 +:10113000520700D330C100D50B6070471FB5C046C1 +:10114000C0461BF0EEFC04B00FB41FBD40BA7047A0 +:10115000C0BA7047F0B44046494652465B460FB4A9 +:1011600002A0013001B50648004700BF01BC864619 +:101170000FBC8046894692469B46F0BC70470000F3 +:10118000C110000040BA7047C0BA70478269024976 +:101190008161024810447047A11100000100000065 +:1011A00001B41EB400B501F08EFC01B4019886466E +:1011B00001BC01B01EBD000040BA7047C0BA704704 +:1011C000401E00BF00BF00BF00BF00BF00BF00BF88 +:1011D00000BF00BF00BF00BF00BFF1D170470000DB +:1011E00070B505460C46164602E00FCC0FC5103E02 +:1011F000102EFAD2082E02D303CC03C5083E042ECB +:1012000007D301CC01C5361F03E021782970641C87 +:101210006D1C761EF9D270BD10B572B600F0DCF808 +:1012200000280BD000F0ACF901F091FF01F006FDB1 +:101230006E490020C86288626D49086062B600206D +:1012400010BDF3B5002501200007C06A81B0C0437E +:101250000006000E04D167480068401C00D101253B +:1012600072B600F0B9F8002802D062B60820FEBDC0 +:10127000FFF770FF00F08AF95F4B604E00211A689B +:10128000CA40D2071FD00246CA40D20718D14AB27C +:10129000002A07DA1407240F083CA408A400A419A4 +:1012A000E46904E09408564FA400E4192468920706 +:1012B000D20ED440A204120E012A04D0032A02D076 +:1012C00062B65048FEBD491C2029D8D301980300BE +:1012D0001BF06AFD142123232323232323230B0D37 +:1012E0000F11131F1517191B1D2E002416E00124C2 +:1012F00014E0022412E0032410E004240EE0082489 +:101300000CE009240AE00A2408E00B2406E00C247F +:1013100004E0052402E0072400E00624F06901212E +:101320000002000AC9070843F061002D04D009E05B +:1013300062B601200003FEBD2C4D3348E86200F088 +:1013400025F9A8622A4931480860314902980860A5 +:1013500000F01CF9214601F058FC01F0BCFE03F03E +:10136000EBFC03F05BFB019800F0B8F8040062B6F8 +:1013700003D0FFF751FF2046FEBD0020FEBD10B593 +:10138000044600F029F8002800D001202070002039 +:1013900010BD204908600020704710B50C46102889 +:1013A00008D011280BD012280CD013280ED0012001 +:1013B000086010BD61682068FFF743FF0AE0FFF78F +:1013C0002BFF07E02068FFF7DAFF03E011492068F0 +:1013D00008600020206010BD05480C490068884264 +:1013E00001D1012070470020704700000005004037 +:1013F0001C0000200010001000E100E000ED00E003 +:1014000000E400E001100000401A0000BEBAFECA6D +:1014100018000020040000200E4A12680C498A427D +:101420000AD118470B4A1268094B9A4204D101B5F8 +:1014300001F040FB03BC8E4607490968095808477C +:1014400006480749054A064B7047000000000000A7 +:10145000BEBAFECA1C00002004000020C0190020F3 +:10146000C019002010B50146202209481BF0F8F9E8 +:1014700007490020C877084610BD06490120486189 +:101480000548064A0168914201D100210160704778 +:10149000D4010020000500401C000020BEBAFECA96 +:1014A0008307FF22DB0E9A408907090E9940002826 +:1014B0000BDA0007000F083883083B489B001B1815 +:1014C000D86990430843D8617047830837489B0028 +:1014D0001B181868904308431860704710B5344AC9 +:1014E0000446D06980B23C2815D03249088CC0B27D +:1014F000012812D1888C00070FD1088D0006000F3B +:1015000001280AD1888D0006000F06D1D0692A492A +:10151000000C884201D1022010BD00210120FFF7FC +:10152000BFFF00211820FFF7BBFF00210B20FFF7B2 +:10153000B7FF02211920FFF7B3FF02210D20FFF7AB +:10154000AFFF02210E20FFF7ABFF02210F20FFF7B4 +:10155000A7FF0221C81FFFF7A3FF03211620FFF7F3 +:101560009FFF03211520FFF79BFF204600F0EAFEB6 +:10157000204600F029F8002010BD65210180704749 +:1015800010B500F0EEFE00F032F810BD0B487047C9 +:1015900010B5C02802D300F037FD10BD00F0E9FE01 +:1015A00010BD70477047704700ED00E000E400E0B8 +:1015B00040000010C00F00F0FFFF000003F90043DF +:1015C00010B508F0E6FE10BD10B5FD480178002901 +:1015D0000CD101210170FB484173203804F09AFAC4 +:1015E000F94804F0E7FA012005F070FF10BD10B5CE +:1015F000F3480178002907D000210170F1484173B8 +:1016000004F0BAFA04F09CFB10BD10B5EC48007869 +:10161000002808D004F0B0FA04F092FB002005F096 +:1016200055FF002010BD022010BDF8B516460C462F +:10163000054600F0CCFC002809D1204600F0C7FC8C +:10164000002804D1304600F0C2FC002801D0072059 +:10165000F8BD304606F0DFFC6946009048782070FF +:1016600009782970002801D00020F8BD0520F8BDB8 +:1016700070B50446D5481D460078401E844201DD01 +:10168000D34870BD072A02D9D1480A3870BD204618 +:1016900006F0D8F8002805D12946204606F04AF978 +:1016A0000028F3D001218903084370BD10B5C74954 +:1016B0000978491E884201DDC54810BD06F064F96D +:1016C0000028FAD001218903084310BD10B5BF4995 +:1016D0000978491E884201DDBD4810BD05F0C6FBF2 +:1016E0000028FAD001218903084310BD10B5B7497D +:1016F0000978491E884201DDB54810BD06F056F94B +:101700000028FAD001218903084310BD10B506F066 +:101710008CF9002802D001218903084310BD70B55F +:101720000446AA480E4600781546401E844201DD54 +:10173000A74870BD104600F04AFC002801D00720E1 +:1017400070BD2B4632460021204604F072FE502820 +:1017500003D001218903084370BD002070BD70B51E +:1017600004469A480E4600781546401E844201DD24 +:10177000974870BD104600F02AFC002801D00720D1 +:1017800070BD2B463246A021204604F052FE502860 +:1017900003D001218903084370BD002070BDF8B556 +:1017A00004468A481E4600780F46401E154684426D +:1017B00001DD8748F8BD104600F009FC002801D083 +:1017C0000720F8BD33462A463946204605F041FC3D +:1017D000502803D0012189030843F8BD0020F8BD3B +:1017E00010B5044600F0F3FB002801D0072010BD1F +:1017F000204605F097FC0028F9D001218903084311 +:1018000010BD10B505F09AFC002802D00121890313 +:10181000084310BD70B505466C480C460078401E64 +:10182000854201DD6A4870BD084600F0D0FB002803 +:1018300001D0072070BD284606F029F9207000204D +:1018400070BD10B506F001FA002010BD70B5044659 +:101850000D46072802D95E480A3870BD084600F0D8 +:10186000B6FB002801D0072070BD2946204605F0B0 +:101870002CFA002070BD10B5544A1278521E9042C6 +:1018800001DD534810BD05F016F8002010BD70B5FD +:1018900005464E480C460078401E854201DD4C4806 +:1018A00070BD084600F093FB002801D0072070BDF2 +:1018B000284605F00FF82070002070BD10B5434B8E +:1018C0001B785B1E984201DD414810BD04F0D9FF32 +:1018D000002010BD10B53D4B1B785B1E984201DD0A +:1018E0003B4810BD05F00FF8002010BD10B5374A79 +:1018F0001278521E904201DD354810BD05F03EFFC2 +:10190000002010BD70B5054630480C460078401EDA +:10191000854201DD2E4870BD084600F058FB0028C6 +:1019200001D0072070BD284605F043FF208000202D +:1019300070BD38B5254C2478641EA04201DD2448D2 +:1019400038BD6C462170090A6170A270E370694667 +:1019500005F008FF0028F3D001218903084338BDB2 +:10196000F8B5074619481C4600781546401E0E4635 +:10197000874201DD1648F8BD084600F028FB002824 +:1019800009D1284600F023FB002804D1204600F0AE +:101990001EFB002801D00720F8BD6946384605F037 +:1019A000BFFE6846017840780002084330806846F0 +:1019B000807828706846C07820700020F8BD00004C +:1019C0002000002014020020C11500009400002017 +:1019D0003340000010B5FC4A1278521E904201DDDF +:1019E000FA4810BD05F0F5FE002010BD10B5F64A0E +:1019F0001278521E904201DDF44810BD05F0E4FE5D +:101A0000002010BD10B5F04A1278521E904201DD40 +:101A1000EE4810BD05F0E2FE002010BD10B5EA4A08 +:101A20001278521E904201DDE84810BD05F0DDFE3F +:101A3000002010BD70B50546E3480C460078401EF6 +:101A4000854201DDE14870BD084600F0C0FA00287B +:101A500001D0072070BD284605F0CDFE2070002083 +:101A600070BD10B5D84A1278521E904201DDD74899 +:101A700010BD05F0A3FE002010BD70B50C46054654 +:101A800000F0A5FA002801D0072070BD21462846A5 +:101A900006F0E2F80028F8D001218903084370BD60 +:101AA00070B505460C46084600F091FA002801D0B2 +:101AB000072070BD2146284606F005F90028F8D019 +:101AC00001218903084370BD10B505F0FEFD002813 +:101AD00002D001218903084310BD10B505F0FEFDB9 +:101AE000002010BD10B5044600F071FA002801D0A6 +:101AF000072010BD05F0F7FD2070002010BD7CB55B +:101B00000546B148164600780C46401E854201DD68 +:101B1000AE487CBD084600F05AFA002801D00720E4 +:101B20007CBD21786846017061784170A178817030 +:101B3000E178C17006716946284605F025FB00284A +:101B4000EED00121890308437CBD08B59E4B1B786C +:101B50005B1E984201DD9D4808BD6B4619705A70A6 +:101B6000694605F0F5FA0028F6D0012189030843FB +:101B700008BD10B5944C2478641EA04201DD934842 +:101B800010BD05F029FB002010BD10B505F01AFBB3 +:101B9000002010BD38B5044600F019FA002801D025 +:101BA000072038BD684605F010FB6946087849787B +:101BB000090201432180002038BD70B505460C465E +:101BC000084600F004FA002801D0072070BD214625 +:101BD000284606F078FB0028F8D001218903084345 +:101BE00070BD70B505460C46084600F0F0F90028B7 +:101BF00001D0072070BD2146284606F070FB002862 +:101C0000F8D001218903084370BD10B56E4A1278DF +:101C1000521E904201DD6D4810BD06F06EFB00289B +:101C2000FAD001218903084310BD10B5664C247811 +:101C3000641EA04201DD654810BD06F06DFB002862 +:101C4000FAD001218903084310BD70B505460C4642 +:101C5000084600F0BCF9002801D0072070BD2146DD +:101C6000284606F041FC0028F8D0012189030843EA +:101C700070BD70B505460C46084600F0A8F900286E +:101C800001D0072070BD2146284606F04BFC0028F5 +:101C9000F8D001218903084370BD70B505460C4694 +:101CA000084600F094F9002801D0072070BD2146B5 +:101CB000284606F04AFC002070BD10B506F05BFC1B +:101CC000002802D001218903084310BD70B50C46DD +:101CD000054600F07CF9002804D1204600F077F991 +:101CE000002801D0072070BD2146284606F08AFC56 +:101CF000002070BD70B506463348144600780D4686 +:101D0000401E864201DD314870BD002D04D00846DA +:101D100000F05DF9002806D1002C06D0204600F026 +:101D200056F9002801D0072070BD002D03D02946A8 +:101D3000304605F099FA002C03D02146304605F0D4 +:101D4000D7FA002070BD70B506461F4814460078CB +:101D50000D46401E864201DD1C4870BD002D04D09A +:101D6000084600F034F9002806D1002C06D02046A1 +:101D700000F02DF9002801D0072070BD002D03D000 +:101D80002946304605F095FA002C03D0214630460E +:101D900005F0C3FA002070BD10B504460C48007869 +:101DA000002817D003F0E8FE03F0CAFF204605F034 +:101DB0001DFC002810D0044920780870002005F090 +:101DC00085FB002010BD000094000020334000007F +:101DD000200000200220F5E70720F3E710B50446B5 +:101DE00000F0F5F8002801D00720EBE705F07EFCB5 +:101DF00020700020E6E710B5044600F0E8F800285F +:101E000001D00720DEE705F076FC20700020D9E73E +:101E100070B5054676480C460078401E854201DDC7 +:101E2000744870BD084600F0D2F8002801D00720A1 +:101E300070BD284605F065FC2070002070BD70B5AF +:101E400005466B480C460078401E854201DD694816 +:101E500070BD084600F0BBF8002801D0072070BD17 +:101E6000284605F054FC2070002070BD10B504F029 +:101E7000EDFC0020A6E710B504F0EEFC0020A1E781 +:101E800010B5044600F0A3F8002801D0072099E718 +:101E900059480021425C6254491CC9B20B29F9D34C +:101EA00000208FE710B5044600F091F8002801D01B +:101EB000072087E74E48B221007820700820607024 +:101EC0000020A070E170362121716071F520A071B1 +:101ED0000120E071002075E7FFB5062581B01E46A0 +:101EE00017460C46002904D0084600F070F8002878 +:101EF0000DD1002F04D0384600F069F8002806D133 +:101F0000002E07D0304600F062F8002802D00720EB +:101F100005B0F0BD0198002804D0012806D00228A1 +:101F200008D109E0207803F03FFF02E003F040FF12 +:101F3000207000252846EBE7207806F06AFBF8E7DA +:101F4000FFB5062581B01E4617460C46002904D071 +:101F5000084600F03CF800280DD1002F04D0384688 +:101F600000F035F8002806D1002E06D0304600F0EB +:101F70002EF8002801D00720CAE70198002804D0D5 +:101F8000012811D002280DD119E0002528461B4E4A +:101F9000256004E0297800F0F5FF6D1C2060B54253 +:101FA000F8D300252846B3E7154822788105002A92 +:101FB000826A02D00A438262F3E78A43FBE7207811 +:101FC00006F032FBEDE710B50AF08BFCFAE60028CC +:101FD00009D00A49884206D301214907884204D31F +:101FE0000849884201D20120704700207047000054 +:101FF000940000203340000096CE010000D0010084 +:1020000000050040401A002010B5C0380C460300FF +:102010001AF0CAFE4021242933373B3F434A515A24 +:102020005F62676D727A82888D979DA3A9AFB5BAFA +:10203000C0C6CBEFF3F7FEEAE9E8E7E6E5E4E3E262 +:10204000E1E0DFDEDDDCDBDAD9D8D7D6D5D4D3D2F8 +:10205000D1D1D0D1CFD1FFF7D8FA71E1204607C84E +:10206000FFF7E3FA6CE1207BC3B2207AC2B2207999 +:10207000C1B22078FFF7FCFA62E12078FFF716FB87 +:102080005EE12078FFF722FB5AE12078FFF72EFB74 +:1020900056E12078FFF73AFB52E12079A268C1B2FD +:1020A0002078FFF73CFB4BE12079A268C1B2207891 +:1020B000FFF755FB44E1207BA268C3B2A08881B240 +:1020C0002078FFF76CFB3BE120786168FFF7A2FB0B +:1020D00036E1FFF7B6FB33E120786168FFF7B6FB26 +:1020E0002EE12079C1B22078FFF7C5FB28E12078E6 +:1020F0006168FFF7CCFB23E1207AC2B22079C1B23C +:102100002078FFF7DBFB1BE1207AC2B22079C1B255 +:102110002078FFF7DFFB13E1A08881B22078FFF77A +:10212000E5FB0DE120786168FFF7ECFB08E1207B1F +:10213000C3B2207AC2B2A08881B22078FFF7F9FB3F +:10214000FEE0211D0EC92078FFF70AFCF8E0A08808 +:1021500081B22078FFF73EFCF2E02079C1B220780E +:10216000FFF744FCECE02079C1B22078FFF74AFC8D +:10217000E6E02079C1B22078FFF750FCE0E020785B +:102180006168FFF757FCDBE02079C1B22078FFF7E8 +:1021900068FCD5E02079C1B22068FFF76EFCCFE083 +:1021A00020786168FFF77CFCCAE02078FFF78CFCA0 +:1021B000C6E0C0E0B9E0C4E0B3E0ACE0A5E09FE079 +:1021C00098E092E08CE086E07BE074E06EE068E00E +:1021D00064E05FE05AE055E04AE046E040E03AE083 +:1021E00035E030E02BE025E01AE011E009E004E002 +:1021F000FFE72078FFF771FCA2E02068FFF772FC90 +:102200009EE0207A6168C2B22078FFF778FC97E000 +:10221000207AC2B22079C1B22078FFF796FC8FE015 +:10222000207BC3B2207AC2B22079C1B22078FFF7F6 +:10223000A0FC85E0208880B2FFF7A7FC80E0206842 +:10224000FFF7A8FC7CE02068FFF7C8FD78E0206875 +:10225000FFF7D1FD74E020786168FFF7D9FD6FE0EA +:1022600020786168FFF7EBFD6AE0FFF7FFFD67E0AC +:10227000207BC3B2207AC2B22079C1B22078FFF7A6 +:10228000FAFD5DE02068FFF7FBFD59E02068FFF7ED +:1022900009FE55E02068FFF7A3FA51E0FFF7B1FA15 +:1022A0004EE020786168FFF788FC49E0207861689B +:1022B000FFF797FC44E02079C1B22078FFF7A5FC36 +:1022C0003EE0207BC3B2207AC2B22079C1B220782E +:1022D000FFF7ABFC34E020786168FFF7B6FC2FE035 +:1022E00020786168FFF7C5FC2AE020786168FFF775 +:1022F000D4FC25E0A08881B22078FFF7DEFC1FE047 +:1023000061682068FFF7E2FC1AE02078A268616843 +:10231000FFF7F0FC14E02078A2686168FFF713FD76 +:102320000EE02068FFF738FD0AE0211D0EC9207875 +:10233000FFF7D2FD04E0211D0EC92078FFF700FE53 +:10234000206010BD70B505462D4C07202070A01CE4 +:10235000FFF713F95920A0802946204608F073FFA3 +:1023600070BD10B508F078FF25490020891E08705F +:1023700010BDF8B5224E0446B61E307801270D4632 +:10238000002807D0204660380B2808D8204609F0DE +:1023900017FB2BE0602CF9D01A480860F8BD2046E6 +:1023A0006C38032803D8204609F04BFB1EE020467A +:1023B00070381F2803D8204608F07AFC16E0204623 +:1023C00090380F2803D8204608F00FFD0EE0204675 +:1023D000A0380F2803D8204608F05CFD06E0204610 +:1023E000B0380F2804D8204600F0DEFD286000E059 +:1023F0002F60602CD2D128680028CFD13770F8BD6B +:10240000240000200130000001202549C00308609D +:1024100024490020087007202349C00588607047C0 +:1024200070B5204D04462878A04207D0002C05D076 +:10243000002803D01DA14D201AF09DFB2878A04252 +:102440000ED000211F4A18482C70002C1BD01E4BA8 +:10245000012C06D0022C0DD014A168201AF08BFBA1 +:1024600070BD116002211160536103210906816072 +:10247000416070BD11600321116053610121C905E4 +:102480008160416070BD116011600721C9058160E4 +:1024900070BD10B505A171201AF06DFB10BD0000D4 +:1024A00080E100E02A00002000F5014068616C5CDA +:1024B0007372635C68616C5F63636D5F6161722EF0 +:1024C0006300000000F500402402002030B4012128 +:1024D000BD48C9020160CD1005604A030260BB48D7 +:1024E00003681B021B0A036004680023240A2402F9 +:1024F0000460B7480468240A24020460B548012433 +:1025000044608460B44C23606360A360B34B196083 +:102510001D601A60B24B19601A600121016030BC65 +:10252000704710B40121A848CA0202600B02036080 +:102530000C060460A74841608160AA4841680029F0 +:10254000FCD1A5490020086048608860A34802606B +:102550000360046010BC70470121A048C9020160FB +:10256000C91001607047002805D0012805D0022855 +:1025700005D19D4870479D4870479D48704710B5EC +:102580009CA18C201AF0F7FA002010BD70B5002134 +:102590009F4CA04DA04A904B002808D001281DD088 +:1025A000022822D093A1B4201AF0E5FA70BD0120D0 +:1025B0000004A060A86011601960984BC2039A6083 +:1025C000974A9060804A00121060964801608748E0 +:1025D0000160954801609548017070BD012040047C +:1025E000A060A8605160596070BD01208004A060A7 +:1025F000A8609160996070BDF8B59446844A764FA2 +:10260000844D00240126002808D0012832D0022859 +:1026100040D078A1E9201AF0AEFAF8BD891E09026F +:10262000090A0120000490603C6068607A4A1160E9 +:10263000012B1DD000217D4A7D4B517061463D31FB +:10264000DC63DE637B4B5C6002249C6004241C61C1 +:10265000744B196074490E60604B89151960704B9A +:1026600058605F4801606D49C00548601670F8BD4C +:102670000121E0E701205E4E40046F4F012B04D1A1 +:102680003460506068603960F8BD906034606860A4 +:102690003960F8BD0120544E8004684F012BF4D1FD +:1026A000EEE750484068704770B54B4D28680026EB +:1026B000574C012806D1A068C00303D501200004AF +:1026C000A0602E606868012809D1A068800306D543 +:1026D00001204004A0606E60012001F075FCA86834 +:1026E000012809D1A068400306D501208004A0601C +:1026F000AE60022001F068FC70BD10B54B4908784F +:10270000002818D00120454AC0079060444AC00BF9 +:1027100090602D4A00121060424A00201060334A37 +:102720001060414A106008704A78002A02D0487050 +:1027300001F04AFC10BD0320FAE7012040490006E1 +:102740000860704701202549000608607047012095 +:102750003B4940050860704701202049400508605A +:10276000704733490020C86388151C4908607047CA +:10277000410A344AC005C00D50435143801C082211 +:102780005040400A0818704710B42F4C430B634365 +:102790001B0C5C020C602B4C6343C31A2B485C027D +:1027A0005843284B400D4343E31A9B1C08246340C5 +:1027B0005B1213700A681018086010BC704710B5DF +:1027C00001F0D9FC10BD000080E100E008E400E069 +:1027D00018E400E000B0004040B1004080E200E0BA +:1027E00000E100E000B5004048B1004040810040F9 +:1027F00044B100407372635C72656D5F68616C5FC9 +:102800006576656E745F74696D65722E6300000095 +:1028100000B3004040B3004040B5004000F5014027 +:1028200000830040408500400082004036000020C8 +:10283000C08F00400085004044B5004048B50040CE +:1028400000E200E0093D0000378600006F0C010047 +:1028500010B501F07CFC10BD00200449C8630120C4 +:1028600001218140024A116000BF7047C01F004033 +:1028700080E200E070B520380C4603001AF094FAAC +:1028800033BCC0C4C8CED2D6DBEFFCED1B1F232760 +:102890002C31373C41484E5155595D616F73676B20 +:1028A000767A7E82868A8E92969AB2B5B8E0F0EBFE +:1028B000EAE9F4F8E600206809F004FBF4E0206897 +:1028C00009F008FBF0E0206809F01CFBECE0207840 +:1028D00040B209F03AFBE7E0207840B209F05BFB38 +:1028E000E2E02078616840B209F071FBDCE020781A +:1028F00040B209F081FBD7E0207840B209F08CFBB0 +:10290000D2E02079C1B2207840B209F096FBCBE04A +:102910002078616840B209F0C6FBC5E009F0D2FB3F +:10292000C2E0206809F0D6FBBEE0207809F0EBFB9E +:10293000BAE0206809F0CEF9B6E0206809F0CEF9D7 +:10294000B2E02079C1B2206809F0CFF9ACE020688C +:1029500009F07AF8A8E0206809F07BF8A4E0207874 +:1029600009F07BF8A0E009F085F89DE0207809F0F7 +:1029700087F899E0207809F099F895E0206809F047 +:10298000B2F891E0206809F0B4F88DE0206809F011 +:10299000B6F889E0206809F0B7F885E0206809F00A +:1029A000B9F881E0206809F0BBF87DE0206809F003 +:1029B000BCF879E003F0FCF9C0070025002805D039 +:1029C00003F0FAF9002801D0256070BD03F0F0F99A +:1029D000800703D503F0F7F90028F5D12046FEF76C +:1029E000D5FB61E002F047FC5EE002F074FC5BE0C6 +:1029F000206802F07CFC57E0206809F019FC53E0E5 +:102A0000206809F021FC4FE0206809F028FC4BE029 +:102A10002078A268616809F02DFC45E0207809F073 +:102A20003EFC41E0207809F04FFC3DE020786168F1 +:102A300009F05FFC38E02078616809F071FC33E050 +:102A40002079C1B2207809F0ABFE2DE02EE00FE036 +:102A50000AE026E022E01DE002E016E00CE010E0D3 +:102A6000206809F096FB1FE0206809F013FF1BE0C7 +:102A7000206809F0F8FE17E0204607C802F098F831 +:102A800012E0206802F0EFF80EE06168206802F0C2 +:102A90001AF909E0206802F00CFB05E002F021FBC6 +:102AA00002E0206802F058FB206070BD0120086041 +:102AB00070BD00000C4908784A78401CC0B29042B2 +:102AC00000D008707047094A074820BF40BF20BFA8 +:102AD0004178037843701368002B02D103788B424E +:102AE000F3D00020704700003800002000E200E032 +:102AF000F8B50446800700250126002804DA584866 +:102B0000C563C66302208443E00404D55548C56309 +:102B1000C66380148443600003D553484560800534 +:102B20008443E00504D55148C563C66380158443DA +:102B3000A00404D54E48C563C663401484436004B2 +:102B40002104C00FC90F884203D04AA161201AF0A6 +:102B500012F82004800F0AD04B49CD634B48C5635F +:102B6000C563CE63C663C663032080038443200528 +:102B70000AD5474FFD632F20FEF722FBFE632F206F +:102B8000FEF71EFBF814844309F0E5FB41480442BC +:102B900003D038A18D2019F0EEFFF8BDF0B500216B +:102BA0000A46FF230446CC40E4072AD04CB2E6068E +:102BB000F60E0125B540384E3560384E3560002C94 +:102BC00011DA25072D0F083DAE08354DB6007719EF +:102BD000FD69A407E60E1C46B440A5431446B44064 +:102BE0002543FD610DE0A6082E4DB6007619356827 +:102BF000A407E70E1C46BC40A5431446BC40254331 +:102C00003560491C2029CDD3F0BD70B5264C0D464A +:102C10002060FFF76DFF2068FFF7C0FF284602F035 +:102C2000FBFB09F0A1FA08F0E8FF09F094FB08F0BB +:102C300088FF00F03BF801F0F1FE70BD10B51A4CB2 +:102C40002068FFF755FF2068FFF7A8FF09F083FB16 +:102C500002F05CFC0020206010BD13480068704743 +:102C6000C01F0040C0CF004000E50140C08F0040C1 +:102C7000C0DF00407372635C736F635F636F6E6687 +:102C800069672E6300000000C0EF0040C0FF0040F5 +:102C9000C0BF0040FEFF0FFC80E100E080E200E0EA +:102CA00000ED00E000E400E03C00002001203E498F +:102CB000400608603D4908603D490A68FF231B0241 +:102CC0009A4383121A430A60374980390860704773 +:102CD00010B502460620374904E0C3005B181B7993 +:102CE000002B0AD00346401EC0B2002BF5D132A102 +:102CF000482019F040FFFF2010BDC300CA50002239 +:102D000059184A718A7101220A7110BD294A00219D +:102D1000C00080180171704710B50446062803D31F +:102D200025A1572019F027FF2248E1000C1820792F +:102D3000012803D020A1582019F01DFF6079A17946 +:102D4000401CC0B2814200D060710120164940068B +:102D50008031086010BD70B515480068800B0228EE +:102D600003D015A1722019F006FF124D184C05264C +:102D70002078C10048190279012A07D14279837964 +:102D80009A4203D042798271685880472078401C6B +:102D9000C0B22070062801D3002020703046761E75 +:102DA000F6B20028E4D170BD80E100E080E200E0EE +:102DB00018E400E0EC0300207372635C736F635FE0 +:102DC0007369676E616C6C696E672E63000000004A +:102DD000400000208107C90E002808DA0007000F14 +:102DE000083880082D4A80008018C06904E08008F7 +:102DF0002B4A800080180068C8408009704710B5D1 +:102E00000D20FFF7E7FFC4B20420C043FFF7E2FF45 +:102E1000C0B2844203D023A11B2019F0ACFE264986 +:102E20000120486010BD0121244A48031060244B52 +:102E300000221A60234A5160234A1060234A11601D +:102E40001E4980390860704701211C4A4803106000 +:102E50001E4A51601A4A002111601B4908607047E0 +:102E600010B517490868012804D00EA15C2019F09C +:102E700082FE10BD104880680022C0B20A6008F0CF +:102E80007EFF10BD10B50E4801680029FCD0FFF789 +:102E9000E7FF01200C494003086010BD00ED00E091 +:102EA00000E400E07372635C736F635F68616C5F82 +:102EB000726E672E6300000000D5004080E100E0E4 +:102EC00000D1004000D3004080E200E000D000408C +:102ED00008B5027869460A7040784870088808BDCD +:102EE00008B5027869460A7042784A7082788A701A +:102EF000C078C870009808BD03E00B78491C0370C7 +:102F0000401C1346521ED2B2002BF6D1704701E08E +:102F10000170401C1346521ED2B2002BF8D17047EC +:102F200010B507E003780C78401C491CA34201D07F +:102F3000012010BD1346521ED2B2002BF2D1002048 +:102F400010BD02090007000E0243CC20104081088A +:102F50003320024090000143AA2008405522400837 +:102F600011404900084370470204120E0002024358 +:102F70004A401006000F5040010341400806C00CB3 +:102F800048407047C0434840064A0021C30702D06A +:102F90004008504000E04008491CC9B20829F5D358 +:102FA000C04370472083B8ED10B5B02805D0B128D4 +:102FB00008D0B2280BD0012010BD088880B212F0D2 +:102FC000FFF810BD088880B212F019F910BD08880A +:102FD0004B688A6880B2194612F022F910BD70B5AC +:102FE0000C4605460AF05CF82146284614F07FFDA1 +:102FF00070BD7047704770477047704770477047A3 +:1030000010FFFFFFDBE5B15100D001006500FFFFBD +:1030100003B40148019001BD09000020F8B5F74C48 +:10302000207BE17A88421CD00126F54D0027E07A0A +:10303000215C14200A4642435019037C052B11D011 +:10304000037C062B1CD0037C072B28D0437C012B50 +:1030500033D0ECA1EE4819F08EFD207BE17A884256 +:10306000E5D1F8BD0674E07A0A2807D0E07A401C62 +:10307000E072491CC8B2AA5802210CE00020F7E710 +:103080000674E07A0A2808D0E07A401CE072491CF5 +:10309000C8B2AA5803219047DFE70020F6E706747C +:1030A000E07A0A2807D0E07A401CE072491CC8B2D6 +:1030B000AA580821EFE70020F7E74774E07A0A28CA +:1030C00007D0E07A401CE072491CC8B2AA58072118 +:1030D000E1E70020F7E770B50024CE4E06207072BD +:1030E000CD4825464477047738300473C472CB4802 +:1030F00008F0E8FECA480575F572CA49601E886086 +:103100007571B570F57035717570C74864390570A3 +:1031100045701420604340180574641CE4B2052C0B +:10312000F7D30120FFF732FA0020FFF72FFA012032 +:10313000B071FFF7BBFDBD48FFF7CAFDBC4C207066 +:10314000BC48FFF7C5FD6070FFF7C0F970BD10B552 +:10315000FFF7E7F9B64C2078FFF7D8FD6078FFF766 +:10316000D5FDAC4C207A002803D002F09AF800205C +:10317000207210BD70B5A74CA079002804D0A1A181 +:10318000AD4819F0F8FC70BDE07A002803D19DA18C +:10319000AA4819F0F0FC0126A6710025E572607AB4 +:1031A000042114225043964A801801749D48816876 +:1031B000491C04D0691E81600120FFF7E7F9002057 +:1031C000FFF7E4F9FFF7C8F909F0E5F8FFF7C9FAE6 +:1031D0009B480560056001209A49C0030860FFF71D +:1031E0003BFB91480078022804D0032804D1E07802 +:1031F000002801D0A67000E0A570FFF79EFA70BD10 +:1032000003467F490520142242435218203A127F78 +:10321000002A04D0401E0006000EF4D1704714228C +:10322000424351180A46403AD362012220390A77B4 +:103230007047012805D0032805D1002903D10020BB +:1032400070470029FBD010B4724C00236370764A9B +:10325000002890700CD002280AD007291AD20B003F +:103260007B441B79DB189F441505070D0F111300D4 +:10327000D37003E01B2000E03A20D0700120607082 +:1032800010BC70475820F8E77720F6E79620F4E75F +:10329000B520F2E710BC0020704710B562484078B6 +:1032A000FFF766FA80B210BD411E1422504310B5DC +:1032B000534A8418203C042902D8207F002803D1D7 +:1032C00050A1614819F057FC207F012804D0B32099 +:1032D0004CA1800019F04FFC0020207710BD70B584 +:1032E0004D4C607F217F884201D1012500E00025FF +:1032F000FFF7D7F9FFF73CFA617F227F914201D1B6 +:10330000012100E00021A942EBD170BDF7B50646CE +:10331000481E84468EB0C0B2142202905043384AF0 +:10332000851828460695007C2D1D07282AD1334F85 +:103330000022F87A3B7B834221D03C5C029B9C427A +:1033400001D1012201E0002A04D00A2811D0431C37 +:10335000FB5C3B540A280ED0401C3B7BC0B283422E +:10336000EBD1002A0BD0387B002806D0387B401EDA +:1033700004E00023ECE70020EFE70A203873069A08 +:10338000012010746046234C042813D814204143B4 +:103390001B4808182038007F00280BD00698007CB6 +:1033A00001280BD00698007C012803D01098807A61 +:1033B000012807D013A1254819F0DDFB1098807A69 +:1033C00001286CD106980E4A007C022842D00B4C92 +:1033D000207B0A286FD0207BE17A401C884203D1F1 +:1033E00008A11B4819F0C7FB069901204874217BEE +:1033F00002986054207B0A2861D062E048030020D4 +:10340000580300207372635C72656D2E63000000C8 +:10341000CF050000DC03002010030020E80300209B +:1034200030030020BC0300202D0000205BC40000FE +:103430002B0000201D3000007D0200005E02000015 +:1034400000F5004080E200E0CB0200001503000020 +:1034500022030000607A029B0146984206D0014692 +:10346000142778438018807C9842F8D1637A83428D +:1034700008D1617A142359438918897C617201212A +:10348000A17207E0142343439B18142779439B7CC4 +:1034900089188B741423062158438018817410985E +:1034A000007A06281DD203007B441B79DB189F4459 +:1034B0000C161412100EE07A002891D094E7002028 +:1034C00001E0207B401C2073B9E000200FE0B42015 +:1034D0000DE073200BE0322009E00A2007E007200E +:1034E00005E0FF20FD49E03019F045FB0020019088 +:1034F000109801680198081A28601099097A002923 +:1035000012D00221401A0102090A296010980268AB +:10351000406810180002000A68601098807A02283B +:10352000109803D0007B74E00421EBE7007A0028B8 +:1035300013D0022201981018844610984268604601 +:1035400008301718E648019A4078904202D9E2788C +:10355000002A04D03846083005E00422EAE7019A40 +:10356000801AC0190830627A062A1CD0627A1423A5 +:103570005A43DC4BD2185268914214D0DA4B07936D +:10358000617A14225143D74A89184A688968921B84 +:10359000891B12020902120A090A90423AD89A4279 +:1035A00038D8994236D83018C01B0002000A28606B +:1035B00010996044CD4AC9680002000A9446421A34 +:1035C00001239B0507929A4201D2104614E00A1A81 +:1035D00008929A4201D207980EE0079A6346624524 +:1035E00003D9591A0818401C06E0089A624506D902 +:1035F000181A4018401C4042002860DC03E0B7491C +:10360000BB4819F0B8FA2868C0190002000A6860BF +:10361000002028726868082708300002000A6860E5 +:103620001098407AA8721098007A687203280ED217 +:1036300000280CD009F09CF9002803D007E00020F6 +:1036400011B0F0BD01983A210F1A32200190A44820 +:103650000178012901D0032909D1407801998842D4 +:1036600005D9E178002902D10199401AC7192868C3 +:103670009D4A801B844601026868090A801B030278 +:103680001B0A03938F421AD81346914217D8039905 +:10369000994214D8617A062915D0677A61460622C4 +:1036A0000392019214228F4B7A43D21893689B1B8A +:1036B0008B4216D80397977C062FF3D173E00298BC +:1036C00001F05AF9BBE70699022202980A74627A5D +:1036D000062A00D0627A8A7460720120A07211B04A +:1036E000F0BD062F5FD000223946944614227D4B50 +:1036F0004A43D21853689B1B834225D2917BAB7AF5 +:1037000099421BD806980521029D0174794C207BB3 +:103710000A280FD0207BE17A401C884203D16F49F0 +:10372000754819F028FA207B2554207B0A2800D000 +:10373000C7E6C4E6E07A0028F1D0F4E701218C4620 +:10374000917C0629D2D102E0604600282AD03D466D +:10375000019114202A46424362480621161831740A +:103760001038007B0A28634816D0017BC07A491CB8 +:10377000814203D161A1644819F0FDF95D48017BE4 +:103780004554017B0A290BD0017B491C0173B57C90 +:103790000198A842DDD106E0C07A0028EAD0EDE722 +:1037A0000021F3E70197069902204E4D0874607AD4 +:1037B000B84207D106990198887402986072012076 +:1037C000A07221E00398062F0FD0062803D14BA149 +:1037D0004E4819F0D0F90398142250434019029929 +:1037E00081740699019888740EE0062803D143A1DC +:1037F000474819F0C0F90398142250434019029920 +:103800008174069906208874012011B0F0BD70B54E +:103810000D46404A441900210B46101A8B4103D231 +:1038200036A13D4819F0A7F93C48854203DD33A194 +:103830003B4819F0A0F93B48854203DA2FA13A48EA +:1038400019F099F93948844205DA002C01DB204649 +:1038500070BD364800E03648201870BD401E70B577 +:10386000C0B2142148431F494418607B062813D274 +:1038700003007B441B79DB189F44020C0A080604F2 +:10388000002069E0B42010E073200EE032200CE04C +:103890000A200AE0072008E0FF2018A1E03019F014 +:1038A0006AF9617B0020002956D002214018616826 +:1038B00040180002000AFEF75BFF0C256557154A09 +:1038C000441900210B46101A8B4103D20BA1124858 +:1038D00019F051F91148854230DD2BE00434000025 +:1038E0002D00002058030020FFFF3F00FFFFFF00D6 +:1038F0000E07000048030020070200007372635C9B +:1039000072656D2E63000000C5030000DD0300003A +:10391000E3030000FF7F841EF50300000020A107E1 +:10392000F603000000E05EF8F70300000080841E4C +:1039300000807BE1FA49FB4819F01DF9FA488542FD +:1039400003DAF749F94819F016F9F948844207DA19 +:10395000002C03DB204670BD0421A7E7F44800E0FB +:10396000F448201870BDF0B5064683B0F2480190C7 +:10397000457A029534687068001B0702EF483F0AD9 +:10398000001B0090062D2DD0142029464143EC4801 +:103990000122081884464168E84892058646081BBB +:1039A000904210D3631A93420DD30246704672457B +:1039B00003D900984018401C05E073450ED9411A00 +:1039C0000819401C404200280CDA60460295857CAC +:1039D0000198C0790028D5D003B0F0BDD049D948AE +:1039E00019F0C9F80298854226D014214843D449D9 +:1039F0000123401802908068D0499B058C46011B2A +:103A00008646994210D3221A9A420DD363466145E5 +:103A100003D900997144491C06E0194662452DD925 +:103A2000091A0819401C4142002905DD0298B17AA3 +:103A3000807B814200D37446062D15D0C0491420E6 +:103A4000454368184268121B1202120ABA420BD28E +:103A5000B27A837B9A4200D38468857C0198C079CE +:103A60000028B9D1062DEAD13068A042B4D0E019BF +:103A70000002000A3460706003B0F0BDA849B1488C +:103A800019F079F8D8E7F0B5AF490446486885B031 +:103A9000C005C00D1BD0103840B200280BDA020759 +:103AA000120F083A920892005118C9698007C00E97 +:103AB000C140880908E08108A44A8900891809687A +:103AC0008007C00EC14088090006000E08D00026FD +:103AD0002078002806D0012804D0002005B0F0BDD1 +:103AE0000126F5E72079062813D203007B441B79D1 +:103AF000DB189F44020C0A080604002018E0B420DA +:103B000010E073200EE032200CE00A200AE00720CB +:103B100008E0FF208249E03019F02DF821790020DB +:103B2000002905D002214718834D002E02D003E062 +:103B30000421F8E70020E87102AA6946A068FEF7B0 +:103B400023FE694608228A56E06801A98018C01C35 +:103B500001221F2801DA019209E003AAFEF714FEF0 +:103B60006846007B002802D00198401C0190009913 +:103B70000198401808300002000A0190C81B00029A +:103B8000000A009060796946887200980390FEF7F9 +:103B900088FD009A019B121A181A6D491202000240 +:103BA000120A000A8A4210D888420ED86846FFF7E7 +:103BB000DAFE00990398814205D0C8190002000A74 +:103BC000FEF7D6FDA060012000E00020E979002981 +:103BD00084D0002EAED005B0F0BDF0B505468FB054 +:103BE0005C480C460B9008F075F9534E5A4F00286C +:103BF0000BD05A48007D002803D059A15B4818F02B +:103C0000BAFF207801287DD068E1787F0A280CD09F +:103C1000787F397F401C884203D151A1544818F065 +:103C2000AAFF2078012804D011E0387F0028F4D0C2 +:103C3000F7E75048401920380090C07F002803D093 +:103C400047A14D4818F097FF00990120C877797F68 +:103C500028461422494D51434919087420780228F6 +:103C600023D0787F14214843451920792872607940 +:103C700068722A460C322946A068FEF785FD0C20A2 +:103C800028560F2804DD1F3828732868401C286038 +:103C90000C216956281DE26801905018C01C1F288D +:103CA0006EDA019901200860FBE027494868C005E9 +:103CB000C00D20D0103840B200280BDA0207120FD6 +:103CC000083A920892005118C9698007C00EC14095 +:103CD000880908E081081D4A890089180968800759 +:103CE000C00EC14088090006000E04D105201CA1A9 +:103CF000000218F040FF787F142148434519002145 +:103D0000E06800E0DBE06A460491117004A9FEF768 +:103D10003BFD6A46002010560F2832DD012031E0BD +:103D2000FC380000F603000000E05EF8F703000036 +:103D30000080841E00807BE1DC030020FFFFFF0089 +:103D4000580300200E07000000ED00E000E400E052 +:103D5000FFFF3F00E8030020100300203003002095 +:103D60007372635C72656D2E6300000011050000C4 +:103D7000EF04000031000020F40400005002002095 +:103D800082E000200499401807900220A872207950 +:103D9000287260796872A068291DC01C04911F28D0 +:103DA00001DA012009E0FEF7EFFC68460078002800 +:103DB00004D0049804990068401C0860287A0628FA +:103DC00013D203007B441B79DB189F44020C0A08C2 +:103DD000060400200FE0B4200DE073200BE0322039 +:103DE00009E00A2007E0072005E0FF20FD49E03058 +:103DF00018F0C1FE00202179002943D0022140188B +:103E00000490696808300818079908900918049800 +:103E1000081A0C900020F071FEF743FC044628605D +:103E2000079820180002000AE860707A062825D05A +:103E3000707A14214843EC49401840680899019071 +:103E400040180002000A0290687A6946887301A847 +:103E5000FFF789FD0199029A091B121B0902120240 +:103E6000E24B090A120A0C98994207D8824205D8F7 +:103E70000199049808180002000A2860F0790028C7 +:103E8000C8D110E00421BAE704AA0199FEF77CFC2E +:103E90006846007C002804D0019801990068401C05 +:103EA00008602078A872787F0A2806D0787F401CA6 +:103EB00078770B9808F026F84BE00020F8E7CC481C +:103EC000401920380090C07F002804D0A320C9A149 +:103ED000C00018F050FE00990120C877C84805744A +:103EE0002078022803D1C3A1C64818F044FEC44D6F +:103EF00020792872607968722A460C322946A068B7 +:103F0000FEF742FC0C2028560F2804DD1F382873CA +:103F10002868401C28600C216956E0682A1D40185A +:103F2000C01C01921F2802DA012010600CE004AAD4 +:103F30000199FEF729FC6846007C002804D001980E +:103F400001990068401C08602078A872AC490120E3 +:103F50000875787F397F884224D0747A062C23D064 +:103F6000FEF79FFB14214C439F4961180A7C042AE9 +:103F700018D00A7C032A15D04B6889681B1A081AC6 +:103F80001B020002994A1B0A000A082B0AD3114699 +:103F9000934207D8884205D8787F397F884201D07C +:103FA000FEF7CBFB0FB0F0BD787F397F8842F7D1A9 +:103FB0000FB0F0BD10B50020FEF7D5FA10BD10B55A +:103FC0000120FEF7D0FA10BDF1B5009802287DD08F +:103FD0008D4C607A062803D186A18C4818F0CBFD61 +:103FE0000026A6710125E572607A032114227E4F16 +:103FF0005043C0190174FEF7A5FB0098002808D0B3 +:10400000012826D0022861D0032876D079A18048E3 +:104010003FE08048007F002803D076A17E4818F05A +:10402000AAFD65717B4D00202E60FEF7AFFAA968EE +:10403000481C04D0012300221846FEF7DDFA607AFE +:10404000617A401CC0B2142251437A580121904732 +:10405000F8BD0120FEF79AFA607900280DD06D486E +:104060008068401C09D0607A617A401CC0B214227A +:1040700051437A5806219047F8BD6648007F0128D1 +:104080000AD0022812D0032824D0042836D059A1FF +:10409000624818F070FDF8BD2079002803D0267121 +:1040A000FEF755FBE5705B480677F8BD207A0028DF +:1040B00002D101F0CDF82572607A617A401CC0B25D +:1040C000142251437A580021904700E030E05148D3 +:1040D0000677F8BD4F4F0123397B78680022411ADB +:1040E0001846FEF789FA2079002803D02671FEF7DA +:1040F0002EFBE57002203877F8BD1EE0454E217892 +:1041000070680123411A00221846FEF775FA207ADA +:10411000002802D101F09CF82572607A617A401C77 +:10412000C0B2142251437A58002190473577F8BD28 +:104130003B480078FEF7F0FDF8BD607A617A401CDC +:10414000C0B2142251437A5805219047F8BD10B5EA +:104150002D4C607A062803D126A1324818F00BFDB9 +:10416000607A617A401CC0B2142251431E4A5258F0 +:104170000421904710BDF0B583B006200290FEF7F1 +:1041800090FA214C0090617A27480190062920D0AE +:10419000617A1420414314480918097C042918D075 +:1041A000617A142251430818007C03287DD00198BD +:1041B000009E02684068921B801B0C49120200029C +:1041C000120A000A0B46082A6FD39A426DD8884219 +:1041D0006BD810488068401C03D006A1134818F023 +:1041E000CAFC25E0603D000058030020FFFF3F00AF +:1041F000310000207372635C72656D2E63000000F5 +:10420000300300201E050000DC0300204F050000E5 +:10421000A2050000BC0300205B050000960500001D +:104220002B000020A9050000CC030020E5050000BC +:1042300000206071607A062807D16078002804D0D9 +:10424000FE48C178417081780170607A062815D0E7 +:10425000617A14204143FA480918097C04290DD1D8 +:10426000617A0291627A012114235A43121811745F +:10427000627A5A431018807C6072A172F14D687F97 +:10428000297FF14F884233D0F04E287F14214843D4 +:104290008019007CC05D0128287F07D04843801921 +:1042A000007CC05D02282FD044E0FCE1142148438B +:1042B0008019807A01280AD0297F022014225143D4 +:1042C0008919097CC855287F0A2808D009E0297F68 +:1042D0000020142251438919097CC8552AE0002086 +:1042E00001E0287F401C2877687F297F8842CCD155 +:1042F000D74D287D00284CD0287CC15D012928D0CD +:10430000C05D022830D03AE0287F1421484380194C +:10431000807A012803D0CFA1D14818F02CFC297F46 +:1043200000201422514389198872297F5143891929 +:10433000097CC855287F142148438219287F4843A7 +:104340008019017C0098FEF7E1FF287F0A28C8D178 +:10435000C5E7A97A012904D00221C155002028759A +:104360000DE00021C1550AE0A87A012803D0B9A1C7 +:10437000BC4818F000FC0020A872297CC855287D94 +:10438000002806D0297CB24A0098FEF7BFFF002023 +:104390002875029806281ED014214843A8494018C1 +:1043A000017C012917D107210174AF4D287B0A2810 +:1043B0003CD0287BE97A401C884203D1A5A1AB48B8 +:1043C00018F0D9FB297B02986854287B0A2831D041 +:1043D000287B401C2873607A06287DD0A07A0028AC +:1043E0007BD00020A072617A142041439448A04BF6 +:1043F0000A18566891681D46D2687C35DE67AA6047 +:1044000069609C4D697E002916D00226617A1422CB +:104410008B4851430818407B06281BD203007B447D +:104420001B79DB189F440A1412100E0CE87A00283E +:10443000C4D0C7E70020CDE70426E7E700200FE05F +:10444000B4200DE073200BE0322009E00A2007E0E1 +:10445000072005E0FF207FA1E03018F08CFB002052 +:10446000C1B22973687E022801D0012810D12869C1 +:1044700042180098101A0002000A3A2808D90320AE +:104480006876323A1002000A28613220287308E068 +:10449000322906D2207A00280AD100F0D9FE012064 +:1044A00005E0207A002803D000F0FBFE00202072F7 +:1044B00062490822487820700978012901D003292F +:1044C00006D101212171297B884201D9421A083283 +:1044D000A378002B03D001E08EE09CE0921C2179B0 +:1044E000002901D1002B5DD09446634A00990092C7 +:1044F000019A176852687F1A511A3F0209023F0A4F +:10450000090ABC4538D85C4A974235D8009A91428E +:1045100032D8297B884214D92B69421A9A1A12027E +:10452000120A101880190002000A2A616860002926 +:1045300005D0032028770006000E3ED14CE0012074 +:10454000F8E781420BD92A69511889190902090A29 +:104550006960002801D00420ECE70220EAE7002B84 +:1045600003D13CA1454818F006FB286980190002D8 +:10457000000A6860002013E000202071A070297BF1 +:10458000002908D02869401880190002000A6860D4 +:104590000220287711E0296989190902090A69604E +:1045A000287719E0287B00280FD02969081880197E +:1045B0000002000A68600220287728690123811917 +:1045C00000221846FEF718F809E028698019000251 +:1045D000000A6860002028770120FDF7D7FF617A84 +:1045E0001420414316480C2208188256012300204B +:1045F0006968FEF701F80EE00120FDF7C7FF002013 +:10460000FDF7C4FFFDF7A8FF207A002803D000F0D3 +:1046100048FE00202072A078002804D0FEF797F80A +:104620000020E070A0706078002804D00348C178B2 +:104630004170817801702079002821E02D00002050 +:1046400058030020100300203000002050020020FA +:10465000300300207372635C72656D2E630000008E +:10466000070600002306000048030020350600006E +:1046700050030020BC030020FFFF3F00870600001E +:1046800006D00020CE49E0700978002900D12071C1 +:10469000CC48017BC07A814203D0CB484078FEF7FA +:1046A0003BFB0120E07103B0F0BDF0B5C74C0746FD +:1046B000607A83B0062803D1C5A1C84818F05BFA18 +:1046C000607A1421C64E48438019007C032803D029 +:1046D000BFA1C44818F04FFAC34DA868401C03D0CE +:1046E000BBA1C24818F047FA607A142148438119E7 +:1046F0000C20085600216A4600911171C01901AAC8 +:104700006946FEF741F86A46042010560F2801DD7D +:10471000012000E00020009940186968401801025B +:10472000090AA9606079002804D0012300221846F4 +:10473000FDF762FF03B0F0BD70B5AE4CAC4A0B1A8A +:10474000A34214D3451AA54211D3934203D9101A98 +:1047500043185B1C0BE0954204D9511A0818401C01 +:10476000434204E09AA1A44818F005FA0023184631 +:1047700070BD10B50146012300220220FDF73CFF69 +:1047800010BD10B50220FDF701FF10BD10B5FDF7FB +:1047900088FF10BDF0B58D4D0446E87A83B000283F +:1047A00003D18BA1954818F0E6F9642C4DD3944AB7 +:1047B00000210846121B884147D39248417F007F61 +:1047C000814242D19048007D00283ED1687A142170 +:1047D000834F4843844EC519306801AA00196946C1 +:1047E000FDF7D2FF694604200856002802DD009834 +:1047F000401C0090A96800986B680A18D21A12022F +:10480000824B120A9A4220D8AA7C062A08D0142386 +:104810005A43D2195268511A0902090A814214D323 +:10482000B068401C05D00120FDF7B0FE0020C04359 +:10483000B060306800193060A86800994018000224 +:10484000000A7061012003B0F0BD002003B0F0BD8C +:10485000F8B50646401EC5B21420614968434418A5 +:10486000207C002803D15AA1694818F084F96548D2 +:10487000017F407F81420CD0664A14234B439B1832 +:104880001B7CB3420CD00A290CD0491CC9B281420E +:10489000F3D15D48017D002964D0007CB04261D134 +:1048A0000020F8BD0021F1E7217C052905D0217CFD +:1048B000062902D0217C072928D101212174C17A3F +:1048C0000023027B8A4221D00246565CAE4201D1CF +:1048D000012301E0002B04D00A2911D04E1C965D63 +:1048E00056540A290ED0491C167BC9B28E42ECD10F +:1048F000002B0BD0117B002906D0117B491E04E050 +:104900000026ECE70021EFE70A211173617C002902 +:104910002AD06774C17A0023027B8A4224D0425C89 +:10492000AA4201D1012301E0002B04D00A2912D0B0 +:104930004A1C825C42540A290FD0491C027BC9B22E +:104940008A42ECD1002B0FD0027B0146002A06D010 +:104950000A7B521E04E00022EBE70021EEE70A2268 +:104960000A7301E017480027217C01299CD1617C52 +:10497000002999D10120F8BD70B505461420184AC8 +:1049800005216843801801740E4C207B0A2811D041 +:10499000207BE17A401C884203D10DA11E4818F00B +:1049A000EAF8207B2554207B0A2807D0207B401C76 +:1049B000207370BDE07A0028EFD0F2E70020F7E71F +:1049C0002D000020480300202B000020DC030020E5 +:1049D0007372635C72656D2E63000000EA0600006E +:1049E00058030020EB060000BC030020EC0600008A +:1049F000FF7F841E0020A1070E0700002D07000086 +:104A0000FF1FA1071003002030030020FFFF3F001D +:104A10006A0700005002002007020000B54800218C +:104A200001708170704770B5B34D01236B60B34B5B +:104A30001C68002CFCD0002407E00E6806601E688D +:104A4000002EFCD0001D091D641C9442F5D30020EB +:104A5000686018680028FCD070BD70B5A54C0E4683 +:104A60006178884203D0A6A16F2018F084F803254E +:104A7000330018F099F9095206242452525252492F +:104A800052002078022803D09DA1732018F073F8FB +:104A90002570A078022802D0012804D008E0A06880 +:104AA00007F044FF04E02269E168A068FFF7BBFF5C +:104AB0000020A070FEF75EFB0420207070BDFEF7A2 +:104AC0000EFC01466068FFF737FE06462078022894 +:104AD00003D08BA1872018F04EF88D4A8D498E485F +:104AE000964205D86269032A02D2521C626102E032 +:104AF000864207D84D71801BC86086496078FFF7F1 +:104B00006CF870BD032003E0A0780028FAD10220E1 +:104B100007F0ECFE00F0E5F870BD79A1B12018F0C7 +:104B20002AF870BD70B50546FEF7D9FB714C606080 +:104B30002078012803D072A1B82018F01CF875491C +:104B40000220087000220A718D6004224A71724AA4 +:104B5000CA6020706078FFF740F870BD10B5654CF2 +:104B6000A078002802D12078002801D0112010BDA3 +:104B70006A48FEF745FB60706078002804D0012089 +:104B800020700020606110BD032010BD10B501240D +:104B9000020B64040121624BA04202D291401868CA +:104BA00002E0203A58689140084000D0012010BD32 +:104BB000F8B50E46910004460F1915463F1F0091A7 +:104BC00007F0C5FE009980028919091FB14201D280 +:104BD000012200E00022002D03D0FF2101318D428F +:104BE00001D90920F8BD4F498C421DD3A7421BD3E0 +:104BF000844201D2874203D34B4820187C2803D833 +:104C000020463043800701D01020F8BD8E420BD3E0 +:104C1000002A09D12046FFF7B9FF002804D1384601 +:104C2000FFF7B4FF002801D00F20F8BD3F484049EE +:104C30000068884205D02A4631462046FFF7F3FE39 +:104C40000FE0FFF78BFF0028EFD12A480121C66053 +:104C50000561846081702846302148431830FFF791 +:104C600061FF0020F8BD10B504462E48800A84423A +:104C70000BD307F06CFEA04201D8102010BDA40297 +:104C80002046FFF783FF002801D00F2010BD2748E2 +:104C900027490068884203D0204607F047FE0AE013 +:104CA000FFF75CFF0028F1D1124802218460817077 +:104CB0002048FFF737FF002010BD1A48010B0120E4 +:104CC0008840401E704700B50B460246FFF7F5FFCF +:104CD000104201D00F2000BD114802604360002047 +:104CE00000BD10B5034C6078FEF7DEFA002020709E +:104CF000A07010BD4400002000E5014000E4014028 +:104D00007372635C736F635F666C6173682E6300BC +:104D1000307500001C040020D0FB01005B4A00003D +:104D20000006004000D0010080EFFFEF1C000020D3 +:104D3000BEBAFECA3A560000F7480521817000212C +:104D400001704170C1708160704710B5F3490A78F5 +:104D5000022A07D0CA681018C860C8689638FFF7DA +:104D6000A4FC10BD8A68101888608868F6E703788C +:104D7000EB49EC4A002B02D0012B10D014E0037950 +:104D8000002B01D0012B0FD14379002B01D0012B37 +:104D90000AD18368643B8B4206D2C06810E0037975 +:104DA000002B03D0012B01D0002070474379002B4A +:104DB00001D0012BF8D1C368643B8B42F4D28068E8 +:104DC0009042F1D801207047F8B504460226FFF75B +:104DD000F6F80068002803D0D3A1BD2017F0CBFE61 +:104DE0000127CD4D002C08D02078002817D00128AD +:104DF00005D0022811D0032813D02F710DE0606870 +:104E0000C82808D3FFF7C6FC002804D06068FFF765 +:104E10009CFF012603E0002601E000F0F7F9304690 +:104E2000F8BD28780028F8D16068FFF7A0FF0028B7 +:104E3000E3D060680078002826D0A878042803D042 +:104E4000B9A1F72017F097FEB44F002038706068C2 +:104E50000079012800D0002038716068407900286E +:104E600037D00420787160688168E868FEF7CFFC6D +:104E7000B8606068C0689630F8600320A870A749E1 +:104E8000E878FEF7AAFEC8E7A4480221017061682D +:104E90000979012919D00021017161684979002936 +:104EA00015D004214171616889689631816061681B +:104EB000C968C160C068984C14346060FEF70FFA8E +:104EC00020606F700220A870A7E70321E4E70321A8 +:104ED000E8E70320C6E7F8B58F4C0D46E178884235 +:104EE00004D0FF2090A1193017F045FE28468A4FC4 +:104EF000002501261437030017F056FF0906123764 +:104F0000607B8C96C39FC300A078032807D0A0784D +:104F1000022804D0FF2084A11D3017F02CFEF8BD1C +:104F2000A078032807D0A078022804D0FF207EA113 +:104F3000213017F020FE0420A07025712078002871 +:104F400010D1FFF702FFE078FEF788FCE0607D49B2 +:104F5000886A7D4A024022617B4AD24310408862BF +:104F600000204FE000F052F9F8BDA078032807D0E8 +:104F7000A078022804D0FF206BA1423017F0FBFD7F +:104F80002078002802D000F04DF9F8BDA078032861 +:104F900001D1042024E0FEF7A2F901463868FFF7AA +:104FA000CBFB002820DB796881421DDB091A5B48B6 +:104FB000C1600146E078FEF710FEF8BDA078032836 +:104FC00007D0A078022804D0FF2057A1633017F043 +:104FD000D2FD20780028D6D1A0780328DBD1052087 +:104FE00007F084FCA670F8BD042007F07FFCA570D4 +:104FF000F8BDA078042804D0FF204BA1843017F01E +:10500000BAFD0220A1688847FFF7DEFEFF260546AD +:10501000BD3642E0A078042804D0FF2042A18930A8 +:1050200017F0A9FD0120EDE7A07804289AD0FF2011 +:105030003DA18E3017F09FFD94E7A07804280AD098 +:105040006078002802D0A078022804D0FF2036A182 +:10505000933017F090FD2078002894D12079002813 +:1050600004D0062007F042FC2571BBE760780028D9 +:1050700005D02A49E078FEF7B0FD6570F8BD07203D +:10508000AEE7FF2028A1AE3047E7002D0AD0012D62 +:1050900006D025A1304617F06EFD022DF5D1F8BDE2 +:1050A000042000E00320A1688847FFF78DFE054635 +:1050B000F3E770B5050005D0174CA078052803D09C +:1050C000112070BD102070BD2048FEF799F8E070E7 +:1050D000E078002803D0A5600020A07070BD0320F8 +:1050E00070BD10B50C480178002901D0112010BD09 +:1050F000817805290ED08178012929D0817800296D +:1051000026D0012101708178012921D080780028E2 +:105110001ED01FE00F2010BD5C0000202C040020DA +:105120003D860100FF1FA1077372635C736F635FAD +:10513000726164696F5F74696D65736C6F742E63FF +:10514000000000000005004002810000D74E000072 +:1051500000F068F8002010BDF8B5394E0446B0786C +:10516000002801D001280DD1002C0DD02046FFF7DA +:10517000FEFD00280AD02078324D002808D0B078F3 +:10518000012823D00F20F8BD1020F8BD0720F8BD5E +:1051900002272F702079012814D00020287160790F +:1051A000002811D004206871A0689630A860E068DB +:1051B000E860E868224C14346060FEF790F82060E4 +:1051C000B77019E00320E9E70320ECE7002028701E +:1051D0002079012816D0002028716079002813D08A +:1051E00004206871A168F068FEF711FBA860E06810 +:1051F0009630E8600320B0701249F078FEF7EDFCBD +:105200000020F8BD0320E7E70320EAE710B50E48C9 +:10521000816A0E4A11400A4A126911438162FDF700 +:10522000A9FF10BD10B5064CE078FEF73DF8082048 +:1052300007F05CFB0520A07000202070607010BD9E +:105240005C0000202C04002000050040FD7EFFFFD4 +:1052500010B5EFF31080C407E40F72B6D14841785F +:10526000491C41704078012801D107F079FB002CDE +:1052700000D162B610BD70B5CA4CE07800280AD1E2 +:105280000125E570FFF7E4FF07F072FB002804D06A +:10529000002007F02BFB002070BDC34865714560FE +:1052A000F9E770B5EFF31080C507ED0F72B6BD4C8E +:1052B0006078002803D1BDA18F2017F05CFC6078D6 +:1052C000401E60706078002801D107F04DFB002D72 +:1052D00000D162B670BD10B5B248C178002904D0C3 +:1052E00000214171C170FFF7DCFF002010BD10B537 +:1052F000044607F03DFBAB49C978084000D00120C7 +:105300002060002010BDF8B50246A64C0026A6710C +:105310000420202101251027130017F045FD0D085A +:105320000A0B0D0F1113151D1F21242628002571AE +:1053300022E0022020711FE00820FBE727711BE01C +:10534000217119E0012617E0FFF782FF07F010FB3B +:105350000028FBD002260FE0207102E00820FBE7C6 +:105360002771A57108E02171FBE74020F4E7FF20D9 +:105370008EA1763017F0FFFB07F006FB002809D05E +:1053800007F008FBB04205D1304607F006FB0028C5 +:10539000FAD02CE001208007C5608C4900224A60C9 +:1053A0008B4A9661804B02225A6085608948026967 +:1053B000D243D206D51702696D1C10231A4302612D +:1053C0000F4600E020BF78680028FBD0304607F089 +:1053D000E4FA0028FAD0002D04D17E480269102199 +:1053E0008A43026170490220886000207860A079B9 +:1053F00000280CD007F0BCFA054607F001FA764AFF +:10540000002D02D0A260E06001E0E260A060002E0A +:1054100001D100F0A2F8F8BD10B5044607F0AEFACD +:10542000002805D05F490120C8704A78521C4A7094 +:105430002046FFF768FF10BDF8B5644DA868002648 +:10544000012802D1AE6007F051FA6868012800D146 +:105450006E6028680127534C012812D12E606079B4 +:10546000002803D0002007F041FA66712078002858 +:1054700007D007F07DFA002803D0012080070761DC +:10548000A770286901282AD12E6100F05FF8012059 +:1054900080074761A079002815D007F069FA0090CD +:1054A00007F0AEF90099002901D0E16800E0A16899 +:1054B000411A022901DA8A1C11DC0099002901D065 +:1054C000E06000E0A060FFF7C3FE07F051FA00289B +:1054D00004D0012080070761A77000E02770E8680A +:1054E000012812D100F032F800F030F800F02EF868 +:1054F000A078002804D1FF202CA1033017F03BFB3B +:10550000EE60A6702670FFF7CCFEF8BD10B5254CF6 +:10551000E078002801D107F027FA0120810788618F +:1055200000F014F8A07800280BD0284CE068002880 +:1055300003D107F032FA0028F8D10020E06000F033 +:1055400005F800201849C043886010BD5021084666 +:10555000491E89B20028FAD17047F8B512481927B8 +:1055600087601A4900200860C86007F001FABE078A +:1055700001240C4D002802D03461AC7000E02C7086 +:10558000FFF766FE08484760114928798863FFF7EE +:10559000DDFFB461FFF7DAFF0C4900200861746198 +:1055A000F8BD000078000020000300402E2E5C2E85 +:1055B0002E5C6C6962735C736F635C7372635C73A3 +:1055C0006F635F636C6F636B2E63000000010040CC +:1055D0000005004000ED00E0FFFFFF7F8307FF2292 +:1055E000DB0E9A408907090E994000280BDA000764 +:1055F000000F08388308FF489B001B18D8699043A8 +:105600000843D86170478308FB489B001B18186843 +:105610009043084318607047F849C86AC0070ED124 +:10562000F7480A6B42624A6B82628A6BC262C96B3C +:105630000163F24940310968C20511434163704773 +:1056400010B5F04949684872097ACA0701D00128A3 +:1056500003D0890703D5022801D1FCF7B4FC10BDA3 +:1056600070B5E9480024C4630125C563E7480460B8 +:10567000284600F0B8FBE649601E8860E5480461F2 +:10568000E5490D6101690029FCD00461C4604460F2 +:1056900084600460012000F0AEFB70BDF8B5DF4807 +:1056A0000125C560D8480026C663C563FFF7B4FF6F +:1056B000DB4C6661D34FDB4A7868C17809028918F0 +:1056C000A161A1696A069143A161D04A03211160D9 +:1056D000D0490E61CE604E600E60D349A1630907C8 +:1056E0008A692B4693431A02921C6263CF4AE26393 +:1056F0008279E2602563E6628B692A4689699A436A +:105700008D43AA409107890F2161001D00F0D7FB4E +:1057100078688078A060BE49102048600021012090 +:10572000FFF75CFF012000F057FBBC48C660F8BDE6 +:10573000F1B5BB4EB068B34C6568A97888420ED10C +:105740002D1D6878FDF7FDFB716AC9B2884206D14C +:105750002878FDF7F6FBF1690006884201D00020A9 +:10576000F8BDFDF7BCFD074660683946C069FEF725 +:10577000E3FF0546642800D264256068816A0269F7 +:105780004919914203D97D2149020161E7E7284681 +:10579000FFF700F80028E3D06168CF61886A4019FC +:1057A0008862FEF782FF0098012500280DD0FFF7E0 +:1057B00075FF01F047F8706097484560964A954933 +:1057C0001432091D0E2000F01DFB082000F00BFB19 +:1057D00001209749000448609648C5606068964972 +:1057E000406A086095490020086001460820FFF7DC +:1057F000F5FE082000F0FFFA082000F0EDFA01F0B5 +:1058000054FA0120F8BDF8B50A467E4901268A4DB2 +:1058100000244868130017F0C7FA090631ECEC7B46 +:10582000EBEA1EE91E000F460978022912D04078E3 +:105830007B4C834D01280FD001F0EDF8FFF72EFFD0 +:1058400001F002F860600120000568607868806AF5 +:10585000FEF72BFF7E70F8BD01F057F9FFF71EFF32 +:1058600000F0F0FF60600120400568606A4A694905 +:105870001432091D0E2000F0C5FAE7E70F464978FB +:1058800000291ED03978022922D0082000F0ABFA76 +:105890006A490C607868426A2A60027B002A25D037 +:1058A000203006730120624900044860002108206E +:1058B000FFF794FE082000F09EFA082000F08CFA12 +:1058C0001BE0407801F0E9F9F878FDF725FA06E0E9 +:1058D0004078012807D000F017FB00F09FFA3C70D9 +:1058E000FDF748FC10E000F0ABFAF6E720304A4A3A +:1058F000047310320F2000F085FA78684078012890 +:1059000004D00120FFF79CFE7C70F8BD0220F9E76F +:105910004C4A002753683B49DB07DB0F8B7040780C +:1059200001281ED001F03DF900F0EEFA354800786C +:1059300002282BD033482C214068095C002941D033 +:10594000007B00283ED001F008FF384323D0002F11 +:1059500038D02C4847683969B86A884221D93C61F7 +:1059600021E02C484168012905D1C068012802D1F5 +:105970001068012802D000F09CFAD7E7012701F057 +:1059800049F801F00EF900F05BFACFE700F046FAB3 +:105990001C48047083E00120FFF7CAFE002811D0E4 +:1059A000F8BD081A3861396900917D2149020098D3 +:1059B00016F0BFFF7D22C0B2520200995043081A70 +:1059C000801838610F4F786820300473F878FDF73D +:1059D000A3F90020FFF734FE3C70082000F003FA22 +:1059E000012013490004486012482DE03DE08EE09C +:1059F0003DE02FE000ED00E000E400E0800000105A +:105A00000017004088000020C01F00400012004026 +:105A1000001300400011004000100040000A004048 +:105A2000001500401E00010121100000FFFF0000D2 +:105A300000830040008000404085004040810040DD +:105A400000F5014000140040C660FF20913049E09D +:105A50002C70F8BD0D4609780229F9D0407801F084 +:105A60001CF9E878FDF758F9F2E70C70F8BDFE4A2A +:105A70001368002BFAD014602C22125C002A3FD04D +:105A80000F460978022907D0007B00280FD001F0CB +:105A900064FE002806D00AE000F0C0F93C70FDF773 +:105AA00069FBF8BD0020FFF743FE0028F9D1012073 +:105AB00000F099F9ED48006900F0FBF978682030B2 +:105AC0000473F878FDF728F90020FFF7B9FD3C7062 +:105AD000082000F088F90120E54900044860E54805 +:105AE000C66096202860E048046000210820FFF787 +:105AF00075FD082000F07FF9082000F06DF9F8BD71 +:105B00000878012803D0286896302860F8BD00F096 +:105B100085F9C4E770B5D84D6860012000F063F9DD +:105B2000012000F068F900210120FFF757FD012056 +:105B300000F052F90024D148AC60FDF761FB6968C0 +:105B40000870CC71012008724C728C72CC727D206E +:105B50000C734002086120310C732C706C70AC70B7 +:105B600070BD10B5C4484068C179002903D0002138 +:105B7000C171FFF796FB10BD10B5BF482D224168DB +:105B8000525C002A0AD00978002907D00178002940 +:105B900004D00221017001780029FCD172B6FFF710 +:105BA000E0FF62B610BDB4488168002901D0002032 +:105BB0000847704710B5002805D0AF4CA060B0482A +:105BC000FDF786F8E07010BD70B50C46054600F094 +:105BD0003BFE2246294616F043FE70BDF8B5A64CA2 +:105BE00015460026626801275670D0615176002B59 +:105BF00001D0177500E0167501F07DFD002804D076 +:105C000060687D210776C90003E0606803210176A2 +:105C10009C496918016261684D62086A643888624B +:105C20000E7308781431FDF7D8FF2770F8BDF8B56A +:105C3000914C164601256268069F5570D0615176D9 +:105C4000002B01D0157501E00020107501F053FD07 +:105C5000002804D060687D210576C90003E06068F3 +:105C60000321017687497118016261684E62086AF2 +:105C7000643888620F7308781431FDF7AEFF257021 +:105C8000F8BD10B57C48C078FDF746F810BD10B5DA +:105C9000FDF7BDFD10BD10B5FDF721FB10BD764928 +:105CA00049688871704774494968887070477249BB +:105CB00049688880704770494968C87070476E4964 +:105CC00001204968C8727047F0B56B4D0746686897 +:105CD000C1B0807A002831D16B480026C663012408 +:105CE000C463FFF799FCFFF7B3FA6A6867489179D4 +:105CF000C160066191788160654BF90716D0AA21D1 +:105D000041626449C161082141616349816146631F +:105D1000FE216D46297000216E187170491CC9B2B0 +:105D2000FE29F9D345600720186004E01C6057493C +:105D30000320403108604D480460947241B0F0BDCA +:105D400070B54D4D6868807A002814D0FFF788FC44 +:105D50004F4800240460514804614C4940310C60B4 +:105D6000424A0121116101690029FCD00461FFF759 +:105D700098FA6868847270BD4848C069002804D0E9 +:105D8000424840308068404240B270473A4880788C +:105D9000704710B538484068C179002903D1012106 +:105DA000C171FFF755FA10BD334949680872704751 +:105DB00031484068007A70472F484068407A01288F +:105DC00000D0002070472C484068407A022801D05B +:105DD0000020704701207047C106C90E012088408D +:105DE0002F4908607047C106C90E012088402C4920 +:105DF000803108607047C106C90E012088402949DA +:105E00000860704710B5284CC3001B1919605A6010 +:105E10000121814024481038416010BD10B5012097 +:105E20001349000488601349012048600E4900208E +:105E300008600820FFF7D7FF0820FFF7DCFF10BD40 +:105E400010B50A490120886114490020C8610E205C +:105E500000F065F8012014494005103988600F20D2 +:105E600000F05DF822E0000040810040001000409A +:105E70000083004000800040880000200758000098 +:105E8000A75B0000B80B0000C01F004000150040D9 +:105E900000120040BEBAFECAFF0004030011004019 +:105EA00000E100E080E200E010F50140FFF7D8FBE0 +:105EB00010BD10B500F075FEFFF7C2FF10BD70B544 +:105EC00005461C48002640681B4CC17A002907D0B3 +:105ED000C672606A000A00026062E069E66170BD35 +:105EE000606A000A000260626878FDF72AF8616A59 +:105EF00008436062E069E6612878FDF722F8E1690D +:105F000000060843E06170BD10B501200B49000593 +:105F100088600F2000F003F8FFF7A2FB10BD0121FD +:105F2000064A814091600021C000801801614161F2 +:105F300070470000880000200015004000F5014077 +:105F400070B50C460546FFF7A6FE01462846FEF74B +:105F5000F3FBFE49002805DA4042400216F0E9FC56 +:105F6000201A03E0400216F0E4FC001980B270BD74 +:105F700010B5F74C208F618F626E401AF34980B2E2 +:105F80004843410AC005C00D80186066820500D5EF +:105F9000491CC005C00D6066E06DFFF778FEA06586 +:105FA00010BD8100EB484158084640308278D20746 +:105FB00001D0C07870472031C8797047E64A042183 +:105FC0001078030741D5F8B5F72318401070E04A60 +:105FD000507A8300DF48C358184640308478E4077D +:105FE00001D0C07801E02033D879002804D00128FE +:105FF00004D0022803D101E0032100E00221D748A8 +:10600000D74C85792078C307D148DB0F006E002D6F +:1060100005D0D27ED200E132FFF7E0FD0BE0157A29 +:10602000CB4ACA4ED28D7243520A122D08D0002597 +:106030000095FFF7FCFD2078400840002070F8BD77 +:1060400001250095FFF7F3FDF5E77047C048407A5A +:106050008100C0484058017F490702D50121203006 +:10606000C1717047012A00DC0122491E401ED3077E +:1060700003D0491C0B78401C0370521007D04B789A +:106080004370891C801C0B780370521EF7D1704737 +:10609000C27B0F21521CC27304E0491EC9B2425C8C +:1060A000521C4254425C002A01D10029F5D17047AC +:1060B000002A4ED0FFB5AB4883B001461F311030E7 +:1060C000154601910090102D04D91024A54806F022 +:1060D0009EF805E02C46A34806F099F8002C22D043 +:1060E00003990498491E401E019AE30706D0491CF3 +:1060F000521C0B7816787340401C037063080CD058 +:106100004E785778891C7E404670921C0E7817781E +:10611000801C7E4006705B1EF2D10398001903902C +:1061200004980019049000990F20CA7B521CCA736E +:1061300004E0401EC0B20A5C521C0A540A5C002AE9 +:1061400001D10028F5D1281B05062D0EBBD107B0C3 +:10615000F0BD7047F8B580487D4C00787D4E8107D2 +:10616000607A8300002967DB7F48814D00788207D1 +:106170007E4801780DD17F480078400709D5C806D0 +:1061800007D52878C20904D1A22210432870F258FA +:1061900010712878C7076E48C27E501F002F30D07C +:1061A000754F09072BD57549921FA164082A09DD8F +:1061B000D2B20023891DB81DFFF77AFFA16C787950 +:1061C000487105E0C2B20023491D781DFFF770FF3A +:1061D000607A80003158694804F0FCFBA16C387982 +:1061E00008712878000704D5082265496548FFF73B +:1061F00039FF65488022017811430170F8BDA7641A +:10620000F8BD090718D55D4FC2B2A764F058002346 +:10621000401D791DFFF74CFF607A05228000315840 +:10622000A06CFFF71FFF28780007E9D50822791D29 +:106230005448FFF717FFF8BDF058A064F8BDF8B553 +:10624000474C434D2078800605D400266E87FFF723 +:1062500022FD6E66E865698FE86DFFF771FE28879D +:10626000FFF719FDA865298F6987E865FFF768FEC4 +:1062700007462078F7210840207072B6FFF789FDA5 +:1062800062B64137344801260178314301702F87C7 +:1062900004F06DFBFFF7F5FC2078810601D5304353 +:1062A0002070102028722078202108432070F8BD2B +:1062B000F8B527482D4D017A467A264F102941D14D +:1062C000E91C0978490604D50021417211210172A7 +:1062D00038E02E4C2178CA0634D5FF224272037969 +:1062E0009E4200D10271B00038584030007A8006DA +:1062F00011D5EF2001401D48217000780A07800861 +:106300008000002A01DA801C00E0401C2870F72081 +:106310000140217016E00721304600F06AFA20782B +:10632000EF21084020702878114C80088000401C24 +:1063300028702078C00903D00621304600F059FAB1 +:10634000022020700A480178B00021E0093D0000D9 +:1063500094000020D8040020BC000020B4000020DD +:10636000A3000020EC070020AA000020A0000020CD +:10637000A8000020A10000207A0400203C04002096 +:106380004104002012010020A4000020A5000020EC +:106390003A581171FE490978490603D438582978CA +:1063A0004030C171F8BDF8B5FA4D07468600A859CE +:1063B0004030017A89060DD5C1798907890F0129F5 +:1063C00008D100218171A8594030C179890889001C +:1063D000891CC171EE480078800627D5EE4C618F8C +:1063E000E06DFFF7ADFDEA4909780A07EB4909D5E9 +:1063F000627AFF2A13D09200AA58128A101A80B229 +:1064000058280CD8A8594030007A800606D5607A02 +:10641000874203D10878082210430870F8BD087835 +:10642000C00603D510202072FFF742FFFFF707FFD9 +:10643000F8BD082A01D927207047FFB50546D44882 +:1064400081B00278D348530604D5002D08D13120FD +:1064500005B0F0BDAB00C3584033DB799B0716D0C5 +:10646000CC48AF00C3599C464033D879C40611D4F8 +:106470001B7A9C060BD4440609D4DB0707D15206CD +:1064800008D40A0606D58007800F022802D21520FC +:1064900005B0F0BDA020014002200143C04EBE481F +:1064A000F571427ABF480C46002100789646954225 +:1064B00008D1002806D0430704D4BB490978C9098C +:1064C0002AD10121B54B1B789A0613D5DF22134040 +:1064D000B24A7545137003D1002901D100280FD1AC +:1064E000B24801788906890E0170FF20F0712120E1 +:1064F00005B0F0BD624613791B0601D500290BD00B +:10650000754512D1AA4A00290BD0D11C0C70491E26 +:10651000F7231840087007E0FF20F0711F2005B036 +:10652000F0BD10782043107014789A4861460C71C1 +:10653000C0590822401D0499FFF794FD9648407AFF +:10654000854207D197480078002803D1200601D55D +:10655000FFF77CFD8F49DF23C859403082791A400C +:106560008271FF20F071C8594030007A800605D54D +:106570002846FFF718FF502005B0F0BD502005B0A9 +:10658000F0BD01898388C288481E934201D180B240 +:1065900070479A1A891A0140491E88B27047F0B5AF +:1065A000844B0F461C46064625899888D9886C1E60 +:1065B000884201D1A1B204E0411A691A2140491E62 +:1065C00089B2914227D31446281A734A794985B271 +:1065D0008988D06E0818AC4202D82246394608E0B5 +:1065E000EAB23946FFF73EFD601BC2B26A4879192C +:1065F000C06EFFF737FDB00604D5684880220178E9 +:10660000114301706B48818802890919521E11409B +:1066100081805020F0BD2220F0BDF8B5604C82276B +:10662000A07A012813D1644DA88800280FD05A4EB3 +:10663000706F002804D001210170A88800285BD069 +:10664000207B810706D5A988082902D002E02120F5 +:10665000F8BDA027C00720D1E07A81004D484058FE +:106660000079000614D508223846316FFFF797FFEE +:10667000502859D1306F08303067A8880838A88072 +:10668000B80636D54548802201781143017030E0C4 +:106690004248202201781143017008223946E07AED +:1066A000336FFFF7C6FE5028D2D1306F0830306705 +:1066B000A8880838A880227BD0071AD03F480378E2 +:1066C000590608D5811D097800291DD0490702D433 +:1066D00020210B430370E07A6072364900208880E5 +:1066E000C8802E4801784906490E017050084000C4 +:1066F0002073A8880028A3D10220A072706F002800 +:106700000ED0002101700FE010210B4303702C49C3 +:10671000002008702070B08E7086A0786070DAE774 +:106720001121607A00F065F85020F8BD10B51C4AC0 +:10673000D37A984215D1052907D0062905D0852995 +:106740000FD1FFF76AFF00210BE0FF231A4CD37231 +:106750000020A0809072403C646F002C00D020701C +:106760005372084610BD10B4164B0A4A09292BD0A3 +:1067700002290AD1800010584721095CC90604D4B7 +:106780002721095C00292ED0438410BC70470000EB +:10679000A3000020D804002094000020A5000020C1 +:1067A000B4000020AA000020AB000020A7000020B9 +:1067B000A80000201C080020D4000020A400002015 +:1067C000B3000020FFFF0000810050584724245CE4 +:1067D000E40601D5038400E043845058FE232030B2 +:1067E000437110BC7047418C428A8918418410BCA7 +:1067F000704770B504460D46FFF7B5FF29462046A1 +:10680000FFF794FFFC4B1D786907C90F491E014231 +:1068100017D0FA49CA78561CF6B2CE70202E01D392 +:106820000026CE708978F6B28E4203D1042005434B +:106830001D7035205100F24A545489184870FBF7F6 +:10684000C2FB70BDEF487047EF48704710B5FFF7C7 +:1068500093F9FFF775FA10BD70B505461C4608069A +:1068600001D5104604E0052900D30421E748405C27 +:10687000FFF715FA2846FFF716FA2046FFF724FA25 +:1068800070BD70B5E24C850063590E062033002EB2 +:1068900001DADA7705E0052900D30421DB4A515CEF +:1068A000D977D649497A884204D160592030C07FCF +:1068B000FFF7F5F970BDD64A8300D25820329177A0 +:1068C000CE4A527A904204D110B50846FFF7EBF950 +:1068D00010BD7047CE49800008582030807F704737 +:1068E000CC4B42009952C54A527AFF2A0AD0C84B73 +:1068F00092009A58527B824204D110B50846FFF7A5 +:10690000D6F910BD7047830030B4C148B024C558D3 +:1069100040356C70C4584034A5796D066D0EA57174 +:106920000D068024002D09DAC15840314A70C05844 +:10693000403081792143817130BC70470029FBD000 +:1069400027228900D243511AC25840325170C05890 +:10695000403081792143817130BC7047704770B5F8 +:10696000A64CE18FA06EFFF7EBFAAB49A087097840 +:10697000A74D890706D0617A890069584031897925 +:10698000C90646D4A54910230A781A430A70218FF4 +:10699000E27E081A411E13460D3BDB105B1C090406 +:1069A000490CDBB20004A371000C05D00126F603EC +:1069B000B04201D85818A0710D2A1CD991489849A5 +:1069C000012A00DC0122401E491ED30705D0491CC4 +:1069D00043780E7873404370401C52100BD04678B9 +:1069E0004B78891C5E40467083780E7873408370C4 +:1069F000801C521EF3D1FFF7BFF9617A89006958F4 +:106A000040310870207A122803D1A08F20870520FA +:106A1000A07170BDA3E7F8B5FFF79CFB7F4EF7218F +:106A200030780840307072B6FFF7B3F962B67D482F +:106A3000724C00782546C0072035002805D0E8783C +:106A4000062802D27849085C0EE03078410670488A +:106A500005D500682030807FFFF725F906E0617AD0 +:106A6000890040582030807FFFF71DF9E07EFFF756 +:106A700022F96E486E49007808716E4909788907D5 +:106A800001D4A16C0871C00734D0E07E84460D2883 +:106A900026D969480078C009A06C1DD06646604AB6 +:106AA000012E00DC0126401E521EF10705D0521CAB +:106AB000437817787B404370401C731010D04778A0 +:106AC0005178921C4F404770877811784F408770FB +:106AD000801C5B1EF3D103E00179ED22514001716E +:106AE000554801784906490E01706146A06CFFF7D0 +:106AF0006BF803E00D21A06CFFF766F8E879617A86 +:106B0000884201D1FFF7DBF8F8BD70B5434CF7219F +:106B100020780840207072B6FFF73BF962B6414812 +:106B2000364D0078C00706D04448C078062802D207 +:106B30003D49085C0EE020784106354805D50068DF +:106B40002030807FFFF7AFF806E0697A890040586F +:106B50002030807FFFF7A7F8E87EFFF7ACF870BD24 +:106B600026492648497AC379002229488900092BF9 +:106B700009D0032B0ED0042B04D140582421095CEA +:106B8000C90705D0704740584721095C4906F9D527 +:106B900002847047214B1B78DB06FAD540584284AB +:106BA0007047DDE770B415491448497AC279244C1E +:106BB000012317488900092A44D0032A4DD0042A0A +:106BC00052D00C2A01D0052A4CD1134A12789207D0 +:106BD00048D04258107F400744D518491446487B96 +:106BE0002034401CC5B24D73E6790020002E4DD0F4 +:106BF0000222E2714EE00000A50000209400002077 +:106C000088060020B60400205A040020A2CE01000D +:106C1000D8040020DC070020AA000020A3000020E8 +:106C2000A7CE0100B30000200C010020A800002026 +:106C30007A040020BC000020A4000020B400002042 +:106C4000FFFF000042582725AD5C002D01D01484C1 +:106C500003E0148C558A641914844058203001795B +:106C60001943017170BC70474058014620310A79C0 +:106C7000D207F7D1C979002902D0048470BC7047CB +:106C8000018C428A8918018470BC7047D27FAA4265 +:106C9000FAD8E371487370BC704710B5002801D171 +:106CA000FFF758FAFFF77EFF10BD10B5F74CE18FE4 +:106CB0006187A06EE065FFF743F92087FFF758F979 +:106CC000208FE087A06DA06610BDF3B5CF788B78DC +:106CD0008FB05F40CF700E797E400E714D79B44613 +:106CE00075404D710B95887968408871CA7942402A +:106CF000CA714C7854404C7008940E78A646664091 +:106D00000E70EF24079626408F2466400096744646 +:106D1000BE26344036267440009E3443A646EC24FA +:106D20001E4626402024664074462643B646BC06CE +:106D3000A40E1A26744076463443A6466646D724E7 +:106D400026404724664074462643DB242540112410 +:106D500065403543792604463440502674402C4320 +:106D6000F725154093267540254305D0C8490F984F +:106D7000FFF7B6FD11B0F0BD079C10252C40089D13 +:106D80004126354025436446282634402C43862539 +:106D90002840204313242340BC09A40108701C434D +:106DA0000B9B24252B402343082422401A434A707E +:106DB000110201430F98FFF793FD11B0F0BD70472A +:106DC000704710B504F0B5FF10BD10B5102104F0E8 +:106DD000B0FF10BD00B501461022AE48FFF742F9E2 +:106DE00000BD00B501461022AB48FFF73BF900BDDE +:106DF00030B50D460446002A13D0012A10D1214691 +:106E000003220D312846FFF72DF90A22E11CE81C68 +:106E1000FFF728F92846032221460D30FFF722F913 +:106E200030BD214604220C312846FFF71BF9082209 +:106E3000211D281DFFF716F90422284621460C3093 +:106E4000ECE710B4914B954AD86E1060002090800A +:106E50009349D0804C881481924AFF245472088050 +:106E6000D47288809072586710BC704770B58E4994 +:106E700082008B5840331C7AA40608D4DC79A4071E +:106E8000A40F012C03D1894C2478650601D5152067 +:106E900070BD9D79ED0901D0A02500E020259D71F0 +:106EA0008B584033DD79AD08AD00AD1CDD718B58DA +:106EB000DD7D6D086D00DD758D580023EB81A30627 +:106EC00002D4FFF7BCF906E089584031097AC906B7 +:106ED00001D5FFF768FA002070BD13B582B0714A82 +:106EE0000C466846017A537A407A994205D138288F +:106EF00001D0392801D1FF20507288006A49085812 +:106F00004030007A400703D52146029803F06BFD1C +:106F10000298009068464078421E092A06D801214E +:106F200091405F4A1288114200D0FF2069464872A2 +:106F30000021FF2800D121706846008904B010BDEF +:106F4000402801D2002070470120704710B4544AF5 +:106F5000FF28508002D9FF20013050805388402004 +:106F6000402B09D054884300A34201D898B200E0D6 +:106F7000508053888342F5D14448C16610BC7047A5 +:106F80008188C2880089891A401E014088B27047F2 +:106F9000F8B504464148464E8288C3880089D21A13 +:106FA000401E0240C80600216170050E832192B286 +:106FB000A01C217095420ED93178C9091CD001213D +:106FC0006170D1080170471CD5B2072200213846F4 +:106FD000FBF79DFFF81D294603F05FFD3078C009DF +:106FE00010D02E488188C2880089891A401E01402D +:106FF0000804000C02D005E00020F8BD2078202114 +:10700000084320700120F8BD70B5244D0446A888BF +:10701000E988401A2989491E08400004000C17D04D +:10702000822020700821601C03F037FD2048007882 +:10703000C0090CD0A888E988401A2989491E08404F +:107040000004000C03D12078202108432070012087 +:1070500070BDF8B59446154A06461D461278CB0811 +:107060002120520603D5002E24D13120F8BD0E4A2E +:10707000B40012594032147AA4061BD4D279920774 +:10708000920F022A16D81620F8BD000094000020A6 +:107090005B250000EC070020FC0700201C080020F6 +:1070A000D4000020B4000020D8040020A300002059 +:1070B000A5000020FB4CA27AE77A002A09D0012A19 +:1070C0002ED0022AE0D1F8480078C0090AD01F204B +:1070D000DAE7E80708D0FF2FF9D1D80088420AD1B3 +:1070E000E6720AE0E80701D02020CDE7B74202D1DE +:1070F000D800884201D03320C6E7EC4A60461067CA +:10710000EB48818025730120A072FFF786FAE9071A +:10711000BAD05028B8D0FF21E1720021A172B3E7A4 +:107120002220B1E7DF49897A002901D01F2103E03D +:10713000DE4A00215067017008467047D948807ABE +:10714000002801D01F207047D84A002050677047A0 +:107150000B78042B01D93020704730B4D54C850012 +:1071600062595B064032507A5B0EC009C001184379 +:1071700050726259400649784032400EC9010843B6 +:10718000507230BC002070470A79042A01D33020A5 +:10719000704700B5C74B80001B5890002E30181860 +:1071A0000422FEF75FFF002000BD8200C148835823 +:1071B00059718058C2789207920F022A01D0090AA9 +:1071C00081717047BA4908807047B9490A780270DE +:1071D0000988090A4170704770B5B64C8500665938 +:1071E0002036F17266592036327362592032537359 +:1071F000FFF761FB70BDF0B4AC48002305781A4678 +:10720000002D2DD9AB480427990046580D2434771A +:1072100044585B1C62774458DBB2A7771D2446585C +:10722000640234834658748346580324F4774458E0 +:107230004034A270465802244036F470445820343A +:10724000227144582034627144582034A271445849 +:1072500022844458628441582031CA71AB42D3D34E +:1072600090484273F0BC704710B40A78130782004C +:1072700090481B0F845823774B7884581B071B0FAB +:1072800063778B7884581B071B0FE377CB78845880 +:107290001B071B0FA3774B790C791B0223438458E0 +:1072A0002383CB798C79190280582143418310BC08 +:1072B000704782007F4883581B7F1B071B0F0B7092 +:1072C00083585B7F4B708358DB7F8B7083589B7F29 +:1072D000CB7083581B7E0B7183581B8B1B0A4B7121 +:1072E00083589B7E8B718058408B000AC871704711 +:1072F00010B40A78D40782006E48E40F83584033F4 +:107300009C70835849784033D970805840300229A6 +:1073100001D90221C17010BC7047820065488358B2 +:1073200040339B780B7080584030C0784870002004 +:107330008870C870087148718871C8717047F0B45E +:107340005A4900234A7A5B49840094461D4690427C +:107350000CD10A59FB27203216797608760016716F +:107360000A5920323E4016714E4A55730A59472633 +:10737000B65CB707BF0F022F10D0F043800756D17D +:10738000107FC00733D04C48F60626D5168C178BD5 +:10739000BE422CD386421DD102231CE0434E6045E1 +:1073A00002D1F079082810D020329079401CC6B262 +:1073B00096710A59107F00072CD51046927F203015 +:1073C000964227D30123857124E0107F00072BD537 +:1073D000012329E00123158409E0568C578BBE4216 +:1073E00005D3864201D1022300E0012355840859C8 +:1073F00020304279521CD6B246710A59107F80075C +:1074000008D51046527F2030964203D3FF2E10D06D +:107410000123457108594030C0798207920F022A32 +:1074200002D0C043800702D108592030C371F0BC9C +:1074300070470223EDE721481E4A007881061B4869 +:10744000407A80001058002903DB1D49097889061D +:1074500006D5017F490702D502212030C17170474E +:10746000014620310A79520705D5007F4007F6D53D +:107470000120C87170470020C8710A4948737047DD +:1074800000B50C490F480860084901200870487091 +:107490000C490D4A0846583010606D314320FFF703 +:1074A00055FD00BDB4000020A50000209400002080 +:1074B000D4000020D8040020FFFF0000A800002016 +:1074C000A90000205005002000060020F8B58446E1 +:1074D000FE4800250570FE48FF260090C671FD4855 +:1074E000FD4C021D29460F238F00E551167008320E +:1074F000491C5B1EF8D161460127F84C00290CD0CD +:10750000F849F74A0A6078310A462770677058329E +:1075100002606D314320FFF719FDFFF792FCFFF782 +:107520006AFEF14900200870F04A02211170FF2123 +:107530002171EF4A6071F04B17701870EF4BED4AF4 +:107540001870EF4B1870EF4B1870A070E07020723D +:107550006172ED4908700D21E1760321A176207753 +:10756000EA48A086009881700A20107072B6FEF773 +:10757000F8FA62B6E64E00203146FFF7B1F9E54F62 +:10758000012569007E52617A3046FF2907D0D54A2D +:10759000890051584A7BAA4201D1FEF788FB6D1C35 +:1075A000EDB2082DEDD3009900200871411EE1864F +:1075B000D949DA4A08702178491E1170C949FF2655 +:1075C00013789C000D594035A8710D594035E8716C +:1075D0000D59403528720D59403568720C594034A8 +:1075E000A6725C1E1470002BEAD1F8BDF0B50278CB +:1075F0004378048941680F2A21D893421FD8002A72 +:107600001DD000291BD0002C19D018461525684321 +:1076100084460846022A06D9951E002D03DD58250A +:1076200055436818B038002B00D06044401A80B22F +:10763000A04204D8201A864680B2402801D20020F9 +:10764000F0BDA648A74C027043700020A44F08E08C +:10765000582545438600ED19401CC0B2A5510228AB +:1076600001D29042F4D3951E002D10DD0020EDB222 +:1076700058264643870076183F19401C6D1E2D067C +:10768000BE602D0EF4D1582042435118B039002B62 +:1076900015D0A3480022DC0702D008300122016087 +:1076A0005B080BD0152454436418846015341030E3 +:1076B000921C5B1E1B0604601B0EF3D161447046D6 +:1076C00080B2FFF743FC0120F0BD89490A780243EC +:1076D000C0060A70000F00D03320704784490A7832 +:1076E00082430A707047824800787047814800786A +:1076F0008006C00F70477F4800780007C017401C05 +:1077000070477849800008584030C0797047754903 +:1077100080000858403080798006C017401C7047B0 +:1077200010B50C466F4980000958204603F052F905 +:10773000A0784006400EA07010BD6A49800008582D +:10774000C0787047810067484158088A4031C9793C +:10775000C90601D55B3080B2704768480078C00622 +:10776000C00F704710B55A4C5E4AE0718000105847 +:1077700003F030F9FF20E071002010BD70B5594DC5 +:107780000C468600A9594A8AA2420FD20B8A9A1A3D +:107790000A82A95912190A825049497A884205D1A8 +:1077A00054480078000701D5FEF749FDA8594482E6 +:1077B00070BD4C4980000858408A7047494A800093 +:1077C0001058403041717047464A8000105881750A +:1077D0007047444A80001058818270470907C90EDB +:1077E000404A80001058C17570473E4A80001058CA +:1077F0004030017170473B498000085840300079A3 +:107800007047384A8300D258C9074032D379090EED +:107810005B065B0E0B43D371304A527A904205D11E +:10782000404802785206520E0A43027070470B46D7 +:1078300000B52C49800009580822491D1846FEF75A +:1078400011FC00BDF0B4274B80001D584724645D37 +:10785000A40702D0F0BC15207047082A02D3F0BC60 +:107860002920704700242035EC771D58422620350A +:10787000AE771E58B025403675701E58022540362A +:107880007571FF261F583D36BE821F580A26BE75E9 +:107890001E580909F4751E580901403634711E58E6 +:1078A000491C35711D584035E97101211D584903A6 +:1078B000698219584A7319584C711858C178890748 +:1078C000890F022900D0847117482FE0BC000020E6 +:1078D000B4000020000600201405002094000020C1 +:1078E00050050020D8040020AA000020AB00002092 +:1078F000A2000020A3000020A4000020A50000207A +:10790000A6000020A8000020A10000208A0C000092 +:107910005B250000DC070020B9000020A700002044 +:10792000F8050020A0000020B30000200470F0BC87 +:1079300000207047F8B50C46FA4A8100535840338E +:107940001C725558630713D500232035AB72555868 +:107950004B262B85575803232037FB725758272572 +:1079600020373D73515820314E731946FEF7A3FF5F +:10797000C820044201D03320F8BDA00602D5EA4950 +:10798000002008710020F8BD8300E648C15840314E +:10799000CA799207920F012A01D015207047002260 +:1079A000CA71C0584030027210467047F8B5DD4CBD +:1079B00005468600A059014640310A7A920604D451 +:1079C000C9798907890F012901D81520F8BDD64F3B +:1079D0000621FD7120308172D448417A8D4205D153 +:1079E000D34810220178114301701AE001798D42C9 +:1079F00001D1FF210171A0594030C1798908890066 +:107A0000491CC17107212846FEF7F3FEA0590079F1 +:107A1000000603D506212846FEF7EBFEA1590220F9 +:107A20000871FF20F8710020F8BDF8B50446C14880 +:107A30000078800601D51920F8BD0020FFF716FA5E +:107A40000028F9D1BA49FD2208781040E207920FC8 +:107A500010430870B34CB848216802F0BBFFB3492B +:107A600001200B78012B0DD9202602278200A15876 +:107A7000401C40318D79C0B235438D71A158984278 +:107A80000F71F3D3A948112101720020F8BD70B520 +:107A9000A54CA649E0714A7AFF25022190420AD1FD +:107AA000A64A1278002A02D0E571002070BDA44ACF +:107AB0001170A44A11709B4A8300D6583171D15875 +:107AC000202340318A791A438A710621FEF791FEFC +:107AD000E571012070BDF8B5994900240B789A49E9 +:107AE0005D06097820D4002807D0480703D5C806CA +:107AF00001D4382413E0052411E093484A0706D541 +:107B0000CA0604D43924F7221140017000E006248B +:107B1000980604D48D4801788906890E01700220E8 +:107B20008749012208704AE0844B1B78002B46D01D +:107B3000002805D048072BD5C80629D538242AE0C7 +:107B4000480703D5C80601D5392400E00424774945 +:107B50008878CB78497A984211D07D4A4500AE1892 +:107B60007778802F04D1555D8D4201D1FF25757046 +:107B7000401CC0B2202800D300209842EED16948B2 +:107B800089004058EF22403081791140817102E034 +:107B9000002002F0B8FF6F49EF250878684B0246D5 +:107BA0009206D20F284012011043DF2210400870C5 +:107BB000C81D00781870881D00780007C20F5B4848 +:107BC0000D21C1760027634B07761D78F7263540D7 +:107BD000614E06213770761C3770F1706906490EC8 +:107BE0001970591C0B78BF252B400B70C91C0B78E2 +:107BF0005A49067FDD0705D002252E4306770E7809 +:107C00002E4304E0FD252E4006770E782E400E70A0 +:107C1000382C01D0392C04D14B49FB260D78354046 +:107C20000D70464D3F492F70407AD20785004E595E +:107C3000920E33714959DF2540318B792B40134324 +:107C40008B712146FEF7D5FDF8BD3C480078002831 +:107C500001D000203FE770474378032B01D9332040 +:107C6000704710B4314A937683789C080FD1C4785A +:107C7000002C0CD10479002C09D1137743799C088E +:107C800005D18479002C02D1C479002C02D010BC1B +:107C90003320704753770A2904D3437A047A1B02AE +:107CA000234393860B2902D31F49827A8A7029497C +:107CB00000780A78BF23C0071A40400E02430A70BA +:107CC00010BC002070470022002812D01748837E85 +:107CD0000B70037F4B708A70CA70437F0B714A71BF +:107CE0008A71808EC871000A08720F4880784872C5 +:107CF00004E00320087048708A70CA700020704742 +:107D0000F7B50C4A0C464109C6061278002749010E +:107D1000F60E82B0520623D5002E30D1312005B0A8 +:107D2000F0BD0000D8040020B40000209400002022 +:107D3000A5000020A3000020E0000020AA000020F1 +:107D4000A8000020AB000020A0000020A700002019 +:107D500088060020A4000020B3000020B20000200C +:107D6000FE4AB300D2584032137A9B0607D4D27928 +:107D70009207920F022A02D8162005B0F0BD6207C2 +:107D800002D0272005B0F0BD0A0600D5012749061C +:107D90000A0EF34D0092697A0DD0F24A009B1278D8 +:107DA0009509AD019D4242D0EE489106890E0170C1 +:107DB000202005B0F0BDFF2902D01F2005B0F0BD86 +:107DC000082282213046049BFEF733FB5028F5D170 +:107DD000E5490A78530608D5E44B1B78002B19D0E7 +:107DE0005B0702D420231A430A70E1496E72002215 +:107DF0008A80CA80DF490A785206520E0A70891CAE +:107E00000A789206920E0A7004990831083CE4B28E +:107E1000049116E010231A430A70D74A002111700A +:107E20002970D6498A8E4A86A9786970DDE7B14201 +:107E300002D0212005B0F0BDCD498A88CB889A4276 +:107E400004D1CB490989491E89B206E00989D21AB1 +:107E50008A1A491E0A40521E91B2C900A14202D29A +:107E6000222005B0F0BD002F05D0BE490A78920649 +:107E7000920E0A7006E00099C029BA490A7814D017 +:107E800040320A70002C04D0224600200499FEF7EC +:107E900086FB5028E5D1002F04D0B6488022017817 +:107EA00011430170502005B0F0BD5206520EE8E7B4 +:107EB000F7B58E46AB4909788A0994467246082A76 +:107EC00002D9272003B0F0BD4209C406AC485201D4 +:107ED0000078E40E400604D5002C11D1312003B007 +:107EE000F0BD9E48A300C0584030037A9B0607D4DB +:107EF000C0798007800F022802D8162003B0F0BD99 +:107F00008226100600D5A0265006954D070E687AE9 +:107F1000024643D093488B0900789B018006800E6F +:107F2000BB4204D08F490870202003B0F0BDB306D7 +:107F300002D58C49087004E08A48C02F11D0403126 +:107F400001708648A10040580079000620D5A24261 +:107F50000AD1724630460299FEF721FB502804D11F +:107F60000DE04906490EEBE721207E490A78930689 +:107F70009B0E6246920113430B7003B0F0BDB10635 +:107F8000FBD57C4980230A781A430A7003B0F0BD00 +:107F90007848202201781143017004E0FF2802D0C4 +:107FA0001F2003B0F0BD724631462046029BFEF70B +:107FB00040FA0346002F1FD1502B1DD16A480022E2 +:107FC00001784E06002E08DA861D3678002E16D06F +:107FD000760702D420263143017065486C72828096 +:107FE000C280644801784906490E0170801C0178FE +:107FF0008906890E40310170184603B0F0BD102685 +:10800000314301705C4802702A701F38818E4186AE +:10801000A8786870E1E7F8B504460020207069464A +:108020004870544B5548197882784D0705D4C57867 +:10803000AA4202D168460088F8BD5500514E521C34 +:10804000AD192D886E46D2B235808270202A01D3B8 +:1080500000228270FB20014019703778A770767873 +:10806000404D802E11D0832E76D0842E74D0802E59 +:1080700006D203202070402060700120E07026713D +:10808000382E6AD0392E68D00EE10920207033488E +:10809000BE0081594F20475C50310822E01CFDF79B +:1080A000E1FF2E48815920464B310C3002F092FC02 +:1080B0002A48EF2281594031887910408871274938 +:1080C00089594031C979490628D4390626D580070F +:1080D00008D52878CF2108402870B80602D54F204F +:1080E000607012E050206070202007402878302215 +:1080F000790002400A435100A2780A438106890FA1 +:10810000A270032907D0103028700020E072A078F8 +:10811000400905D0C8E0DF210840F5E74E20DFE741 +:10812000194900200A78D10902D08020E072042089 +:10813000510632D5E17A40231943E17223182021F8 +:1081400019730649401C8B59C0B2403325181B785F +:10815000401C2B73C0B219E042E086E0D804002036 +:10816000B4000020A7000020A4000020AA000020E6 +:108170001C080020A5000020B3000020940000206F +:10818000A300002088060020A2000020895923189F +:1081900040314978401C1973C0B2910618D5F8498E +:1081A00020258A59138AE27A2A43E2728A59518A2F +:1081B000591A4032D27989B2D20601D55B3100E03A +:1081C000153189B222181173090A801C5173C0B28B +:1081D000E17A002901D0401CC0B22178081862E081 +:1081E000E849842E0879844633D04879891DC00631 +:1081F000020E2270E01CFDF735FFE149BA008858F5 +:10820000EF2640308379334083712078401C207002 +:10821000885840308079800703D52878CF210840DE +:108220002870722060706046202108404100287844 +:10823000302202400A435100A2780A438106890F86 +:10824000A27003290ED01030287080206946487033 +:108250002AE08879CC49C006020E2270E01CFDF7A6 +:1082600001FFCAE7DF210840EEE70422C749601D8D +:10827000FDF7F8FE2078001D2070382E14D1C0497B +:10828000B80009584031C979C9060DD5C049085808 +:10829000407C022808D120461322BE490930FDF750 +:1082A000E1FE20781330207021460098FEF715FE7D +:1082B000009068460088F8BD10B5FEF79AFA10BD28 +:1082C000B548407A7047022801D333207047B34A3B +:1082D00010B5C000801814F056FD002010BD022813 +:1082E00001D333207047AD4AC000821810B508464C +:1082F000114614F048FD002010BDFF2903D0CA0626 +:10830000D20E022A06D29E4A800010584030817256 +:108310000020704733207047FFB5054681B09E4866 +:1083200002999F4A40789A4B002954D09D49097878 +:10833000490614D50499002911D0AC0019460959F1 +:1083400000291AD1002818D9471E1646CA009319C9 +:108350001B79AB4211D0FF2B04D0B94209D1332095 +:1083600005B0F0BDC8003158894801519019057118 +:1083700003E0491CC9B28142E8D38148082301596E +:10838000834E4031CA7901271A43CA713259039981 +:10839000117400594030C079C006002878DB30469F +:1083A00002592846802108431021FFF7A9FC5028D4 +:1083B000D6D1794902200A7F02430A777A490A789E +:1083C00002436F480A700359784A197910780E46AB +:1083D000864328D029E000216F4C002810D9CE0018 +:1083E000B6183679AE4207D10020AE009851FF2072 +:1083F000C9008918087103E0491CC9B28142EED353 +:10840000607A854204D16A48F722017811400170F0 +:108410005B48A9004058F7224030C1791140C17132 +:10842000002005B0F0BD384310705548394319712C +:10843000005904224030C1791143C1715448029956 +:10844000035959740359002199740659049BF37414 +:10845000005901755048407A854242D1544D2878E0 +:1084600010432870039810220101524809185248FD +:10847000FDF7F8FD2878F7210840414909594031B6 +:10848000C9790907C90FC9000843287029E0FFE727 +:108490003059102103F04DFC315910224748FDF7A7 +:1084A000E1FD3159002088743159CF743159087574 +:1084B0003948407A854214D10398102201013D4881 +:1084C00009183D48FDF7CEFD3948F72201781140E3 +:1084D0002B4A12594032D2791207D20FD2001143DF +:1084E0000170002005B0F0BD0F2801D33320704784 +:1084F00030B5054602012F48101804461022FDF73A +:10850000B1FD2548407AFF280AD02149800008584B +:10851000007CA84204D1214610222748FDF7A2FD85 +:10852000002030BD10B5002805D0012807D0022852 +:1085300009D0332010BD224802F04CFA03E0132288 +:108540001448FDF78FFD002010BD10B50B46002824 +:1085500009D001280AD0022804D113220D49184657 +:10856000FDF780FD10BD0220087010BD14491846AB +:1085700002F030FA10BDA42924D233207047000045 +:10858000D804002098040020A6040020E800002061 +:1085900014050020C8060020940000207806002062 +:1085A00000060020A4000020B2000020A800002047 +:1085B000A0000020EB060020EC070020FC070020B4 +:1085C000E400002070B4FE4D00222B78002B0DD962 +:1085D000FC4E940034594034247AA40602D570BC71 +:1085E00015207047521CD2B29A42F2D3002803D011 +:1085F000F54A1071E98602E00020C043E88670BCAD +:1086000000207047F04A12790270ED48C08E088051 +:108610007047EE4A0028117802D00220014301E0A1 +:10862000FD20014011707047E9490870704770B42F +:108630008200E448825810462E304032557A6A064D +:10864000520E29D004780123002C02D14678002E46 +:1086500007D00E78A64203D14C784678B44200D0B9 +:1086600000238478002C03D08E78A64200D000230B +:10867000C478002C04D0CE78A64201D0001D05E0BD +:10868000001D002B02D0E80906D008E0521E120699 +:10869000120ED7D1E80902D070BC0120704770BC1F +:1086A00000207047F8B5CB48CB4A00781378C40750 +:1086B000CA48C34D017802D0D8070FD10CE0C74893 +:1086C000CC067DD5EF242140017058084000107081 +:1086D000287F800775D4D0E2C80671D5687AB94E74 +:1086E00080003158BE4CBF4FBF4802F073F9BF48FD +:1086F00000784107B44873D5B84909788C46C90653 +:108700006FD502780223032A6FD006DC002A09D035 +:10871000012A30D0022A7DD139E0042A7BD0FF2AF9 +:1087200078D116E02178641C22295CD12278AB7EB6 +:1087300061789A4201D22A7600E02B762A7F13468E +:108740008B4350D16B7FAA4C19400A432270FF2102 +:1087500044E02178222946D1297EA54CC900891DF3 +:1087600069762178A34A8B089B0089071370890FCB +:108770002170FE2109E02178242966D19D49012339 +:108780000A781A430A70FE21C170017084E02178D2 +:10879000641C292959D1974A1178194311702378FB +:1087A000641C22789449641C0A7022784A70641C04 +:1087B00022788A70641C2278641CCA70012B01E044 +:1087C0005BE210E00FD0697A23788A008B498958E0 +:1087D0000B708A4B61789A585170032101706BE0DD +:1087E0007CE110E201E00520F8BD2178641C2A2913 +:1087F0002BD1804A117819431170697A7F4A890018 +:108800005258237893707D4A63785258D370A37876 +:108810007A4A01E019E014E052581371774AE3787C +:1088200052585371754A237952589371734A637938 +:108830005258D371714BA27959580A7204210170B0 +:108840003AE02178641C2B2902D0FE2A24D033E0A0 +:10885000684A117819431170697A684A8900525838 +:1088600023785372654A637852589372634AA378A7 +:108870005258D372614AE378525813735F4A23798E +:10888000525853735D4A6379525893735B4BA27984 +:108890005958CA73FE210170554C2278002A0BD01A +:1088A0000121D307DB0F04D14906090E13460B4201 +:1088B000FAD001708A432270007803287ED004DC4D +:1088C00001282AD0022804D19FE0042877D0FF286D +:1088D00005D042486146EF221140017001E23E4955 +:1088E0000122087810430870387020207870287EA4 +:1088F000B8703F4804220078F87000203871787111 +:10890000B871F87138720D206876687A8000305836 +:108910002030017911430171AAE1288F0007000F6F +:108920000C2800D90C20C11CCAB235490A7000922B +:1089300002462A32D2B2CA70322A01D13022CA701B +:108940006A7A92009446B2582032947F23071B0F14 +:1089500043400C2B00D90C2318461030C2B22730EC +:10896000C0B24A700871392802D04D79422D01D128 +:10897000801E0871200958400C2800D90C2003469D +:108980001D338B704430144D48712C7801263443CC +:108990002C703C7023247C70FE24BC70009CFC7006 +:1089A0003A717B71CA78BA710979F97138720548E0 +:1089B0006146405820300179042223E04AE06BE010 +:1089C00094000020D8040020B4000020A300002060 +:1089D000B9000020A9000020A8000020A400002069 +:1089E000BB0400207E0400207A040020AA0000209E +:1089F000B2000020B3000020E80000201405002091 +:108A00000C0100201143017132E1FE490122087876 +:108A100010430870387026207870687AFA49800010 +:108A20000958497CB970F9490A78FA704A783A715C +:108A30008A787A71C978B971F5490A78FA714A78F1 +:108A40003A728978797230580422203001791143C2 +:108A500001710DE1EB49012208781043087038706C +:108A600027207870EA480422C178B9700179F9703A +:108A70004179397181797971C179B971017AF97165 +:108A8000417A3972807A7872687A80003058203062 +:108A9000017911430171EBE0DA49012208781043B2 +:108AA0000870387028207870D9480422C17AB970CB +:108AB000017BF970417B3971817B7971C17BB9711F +:108AC000017CF971417C3972807C7872687A80000F +:108AD00030582030017911430171C9E022217970A9 +:108AE000A97EB9700321F970002139717971B971CA +:108AF000F9712178641C203909297DD20B007B444F +:108B00001B79DB189F4404EDED17EDED4082BB00AF +:108B100021782976BF4A637813700622C270C80094 +:108B2000801D6876687A04228000305820300179F0 +:108B3000114301719CE02178C170B74967780F70CB +:108B40000097A7784F70BE46E7788F702379CB7077 +:108B500062790A71A4794C71BC46B04924274F71DF +:108B6000C0788871009FCF7177460F7267464F7249 +:108B70008B72CA720C73687A0422800030582030DD +:108B800001791143017173E0687A9F4F8200BB58ED +:108B900021785974A24963780B70A3784B70E378FD +:108BA0008B702379CB709A4963790B70A3794B70E2 +:108BB000E3798B70B9589B4C497C012901D002297B +:108BC00022D19749FFF733FD00281DD0002029212D +:108BD000217060708D480178A1704178E1708178D2 +:108BE0002171C0786071687A800039580978A17164 +:108BF00039584978E17100E073E0305804222030A0 +:108C000001791143017133E00120E0E780482178C8 +:108C1000C17061780171A1784171E1788171217928 +:108C2000C17161790172A1794172E17981727B48E8 +:108C30002A214171697A744A890053589B7883715B +:108C40005358DB78C37153581B79037253585B79BF +:108C5000437253589B7983725358DB79C3725258CD +:108C6000127A027370580422203001791143017185 +:108C70006D4808220178114301700220F8BD644854 +:108C80002178C17261780173A1784173E1788173B1 +:108C90002179C17361790174A1794174E179817499 +:108CA0005E482B214171697A574A890053585B7A93 +:108CB000837153589B7AC3715358DB7A03725358AC +:108CC0001B7B437253585B7B837253589B7BC372ED +:108CD0005258D27B0273705804222030017911431C +:108CE000C5E7687AFB2280003058203001791140B6 +:108CF000BDE7F8B54D4801784A064D49520E0D784A +:108D0000AB07DB0FDB011A430270E8090AD04948C0 +:108D10003C4C02782078930719D0014669404B06F5 +:108D200001D40520F8BDC90602D4410602D503E0EE +:108D3000410601D50320F8BDA90606D5510701D586 +:108D40000420F8BD2021084320700220F8BD5021E6 +:108D50000D4201D00720F8BD3749384B08700D216E +:108D6000D976002230491A760978F7263140294E03 +:108D70003270334E3270B77877709E8E5E86DF2603 +:108D80000E40C906C90F49010E43EF210E40264986 +:108D90000E7071061AD52B4E012720491F763778A1 +:108DA0000F7077784F70B7788F70F678CE70032693 +:108DB0000E7122274F719B7E8B71CE710A724A729F +:108DC0008A72CA720A730121084320701E4E3078DD +:108DD000010714D5E90712D0C00610D51B4813F0BF +:108DE000BBFF08221A491B48FDF73CF9194910221C +:108DF0001948FDF737F9307804210843307020789E +:108E000000072BE0A800002014050020E40000204B +:108E1000C8060020B30000200C0100207A040020C6 +:108E2000E80000207F040020A4000020A300002010 +:108E3000A9000020AA000020AB0000209400002020 +:108E4000B4000020B6040020A0000020E3060020AB +:108E500012010020DB060020FC070020FE49000F65 +:108E6000097809090901084320700120F8BDF8B507 +:108E70000546FA48FA4C007801071DD5400708D589 +:108E8000F5480078000704D50822F649F648FDF7B2 +:108E9000E9F8E07E0146801F082805DDC2B2F348EC +:108EA0000123811D801D05E0491FF048CAB2411D04 +:108EB0000123401DFDF7FCF8012D01D0002D36D116 +:108EC000EB48FB22017811400170607A8C468100EA +:108ED000E84841584A20405CFF2828D0C206E34FAA +:108EE000C0093B79D20EC0011E0608D500281ED04D +:108EF000A02098431BD1E0480078800717D1DF4BB2 +:108F00000020D200D31802465032D84F8E5C1A5C33 +:108F10003F187F7916401740BE4208D1401CC0B2AE +:108F20000828F0D3D2486146042211430170022D73 +:108F300001D0042D04D1FFF7B5FB022800D005466F +:108F4000002001220227CE4ECE49082D77D22B00D9 +:108F50007B441B79DB189F4403072DAFECF19E0582 +:108F600001F0BDFD0020F8BD307850214840307040 +:108F7000607AC04985004C59BF4B4034A0793843D2 +:108F8000A0718406E40F4959E40022431A70DF22DD +:108F9000403110408871B1480078410701D5C006C2 +:108FA00005D4AD480078800601D401F098FDFDF7A6 +:108FB0004DF8B9E0B04B0C251A782A403A431A70A4 +:108FC000327810235A40B04D32702B781F0702D5EB +:108FD0008878487000E04870AC48BF270178394075 +:108FE0000170500607D59C480078800650D40120B7 +:108FF00001F089FD4CE0D80603D5802003432B7097 +:1090000042E0D00726D0A24F217E381DFDF7C0FFD9 +:10901000002815D030783979DF2208433070387154 +:10902000A08E6086607A81009248405840308179F5 +:1090300011408171287880210843287024E07DE068 +:10904000607A202281008B4840584030817911435A +:10905000817119E0607A874D80002858001DFDF766 +:10906000D3FF002808D0617A3078890069580A79DE +:1090700010433070087107E0607A20228000285881 +:1090800040308179114381718521607AFDF7B1FB10 +:10909000FEF7D1F948E0784A1278520702D43278C4 +:1090A000920646D4627A9300724AD258403292793C +:1090B000D20601D46D4A50716F4A107803091B0122 +:1090C000502B3BD2931F1B781B0718D5638E002BA8 +:1090D00015D045070FD4850711D0657AAE00654DD0 +:1090E000AD594035AD79ED0609D5252168485B1E9F +:1090F0004171638612E05D4D6D79252D16D01030DB +:10910000C3B2180900011370502807D3487800280B +:1091100004D01B071B0F1370401E487010780321EA +:1091200080088000084310700120F8BD5B1E638634 +:10913000F4E70120FEF7CFFC0020F8BD0020FEF789 +:10914000CAFC0FE7534909788A07484907D4C2780F +:10915000002A04D0CB789A4201D00020704730B466 +:109160008478424B62069B78520E03D05D066D0EEA +:10917000954212D10278002A05D14578002D02D1FE +:109180005C40230606D50B789A4206D14078497890 +:10919000884202D130BC0120704730BC00207047AB +:1091A00070B52F4D298F401884B2698FE86DFCF798 +:1091B000C7FE401C83B23848F7220178CE07002E44 +:1091C00002D02C8711400DE0294E367836070BD49B +:1091D000E31A01269BB2F603B34205D911400122DE +:1091E0002C871143017070BD2C8701F0C0FB70BD4E +:1091F000F8B519481F4D07781538437A1B49980070 +:1092000028580C79144906460C701539CA790F3163 +:109210000E360978052A7DD006DC022A5AD0032AA8 +:109220003FD0042A55D15CE2082A43D0122A50D1FB +:109230000E490B4C1846FFF7FAF9002849D0607A1E +:109240008000285840308179CA0642D4C90928D004 +:1092500000214156012221E0A9000020A0000020A9 +:1092600094000020BB04002012010020B60400205E +:10927000A3000020D8040020AA00002078060020C7 +:10928000A8000020B4000020A4000020A5000020B9 +:109290007A040020A1000020BC00002082569142E8 +:1092A00017DBFE4F3878C0067ED5FD4CE0790328E9 +:1092B0007BD118E1C9060CD4018A428A8918F94A7F +:1092C0008918018200203080F74803220178114379 +:1092D0000170F8BDC90669D5210767D5403082798C +:1092E000FD231A408271F148ED49027813090A788A +:1092F0001B011407240F2343521E0370D4B2A7008E +:10930000E859FFF71FFF00285AD0E85901464031BD +:10931000CA7900E078E113231A40032A02D0022A16 +:109320000BD04DE0E148DE4A0178127809090901C5 +:109330001207120F1143017047E0D94A1279A24275 +:109340000FD084462030837F900028580090203032 +:10935000827F934234D100986246527B407B8242A6 +:109360002ED1D24800780207CD48120F00788242F1 +:1093700002D0087AC00723D1CD492046FFF757F91C +:1093800000281DD0E85940308179C90910D0C4495E +:109390000022497A012389006958C35640318A5610 +:1093A0009A420DDB097802E0E3E0A0E061E00170A1 +:1093B000BE492207087800090001120F1043087007 +:1093C0002046641EE4B2002899D1B848B44A017816 +:1093D00012780907090F91424BD08800285848217C +:1093E000095C2C46C90726D1B04FB14901F0F2FA09 +:1093F00038780107090F8B00E25803204032D779F3 +:109400000743D771E25840329379DF0902D05B06F7 +:109410005B0E9371A24A537A994205D1FF231371CF +:109420000C32137803431370084601F0F1FBA14896 +:109430000078C0091DD19D4F472138780007800E64 +:109440002058095C890614D4994A002111714B30C7 +:109450000D229749FCF706FE387810230007000F0D +:109460008100615840318A791A438A718021FDF761 +:10947000C0F98B48407A81006A5840325279FF2AFD +:1094800000D126E732780A2AFBD30A3A32708A4A98 +:109490001378DC0712D07478641CE4B274706F58CF +:1094A00040377F79BC42ECD35B085B00137000222D +:1094B00072706958897D00290CD0F8BD6A58927D78 +:1094C000FF2AFAD07278521CD2B272706958897D24 +:1094D0008A42F2D3794910230A781A430A7001218B +:1094E000FDF787F9F8BD73480078000741D5607A29 +:1094F00080002858FFF726FE00283AD0607AFD2326 +:109500008100695840318A791A408A7101F080FBE4 +:10951000012001F057FB002819D0E079122807D16B +:1095200066480078800703D56248007800070ED5AA +:109530000620E0715C480078C10901D1400602D5DF +:1095400001F0CDFA03E0FFF7D4FBFFF790FC387889 +:10955000400707D556480179607A80002858403086 +:10956000C173F8BD607A5249800028584B300D22F3 +:109570000CE138784006F4D44948514B407A022136 +:109580008200AC58678A9F42737814D95B1CDBB2A7 +:109590007370042B28D344490B789B089B009B1CB9 +:1095A0000B70AB580821DC7D64086400DC75AA5898 +:1095B0000023D38118E03F0AFF18FFB2BB4201D15C +:1095C0007F1CFFB2BB4201D277700DE036490B78A9 +:1095D0009B089B009B1C0B70E37D08215B085B00D4 +:1095E000E375AA580023D381FDF703F935480078C5 +:1095F000C009B6D02C4800788007800F0228B0D16F +:109600000020FEF768FAF8BD0624C90610D5FFF75A +:1096100099FD00280CD02248FD22407A800028586D +:109620004030817911408171FFF763FB044601E00E +:1096300020480770244800784007C70F2046FFF7EE +:1096400016FC8446062C14D01A480078C00707D0B0 +:109650001348017E002903D0C27E15491B4806E04D +:109660000F480D22407A1249800028584B30FCF7F1 +:10967000F9FC60460028C6D109480021C1710A4999 +:10968000002F097824D0C906BDD5062C04D1034982 +:1096900080230A781A430A700B211CE0A3000020E3 +:1096A000940000200300FFFFA0000020A70000207E +:1096B000B6040020A9000020A4000020A50000207E +:1096C0005D740000A8000020AA000020980400207B +:1096D000C90602D40521C171F8BD062CFCD10421B4 +:1096E000C1717278002A1DD0FE49FF4B887A497AF1 +:1096F000890069584C8A9C4200D94008D20902D19D +:109700000A8A121A0A8271784A06520E824202D8D6 +:109710000020707006E0CA09081AD2014006400E07 +:1097200002437270F1480078C006D5D5ED4C607ADE +:1097300080002858FFF706FD00286DD0EC4F3878E0 +:10974000400769D4607AFD22800028584030817932 +:10975000114081710A20E071E6480078C10901D109 +:10976000400602D501F0BBF907E0FFF7C2FAFFF7A8 +:109770007EFB002801D00520E0713878C00708D0B2 +:10978000207E002805D0E27EDB49DC48FCF76AFC3D +:10979000F8BDD6480078400707D5D7480179607AE8 +:1097A000800028584030C17307E0607A0D228000A5 +:1097B0002858D1494B30FCF755FCD14A1378D807CB +:1097C000E6D0607AA0278400285901464030C67B45 +:1097D0003E42DDD0067C442EDAD1467C022ED7D123 +:1097E000C07C5E0703D54007000FC64E02E040076D +:1097F000C54E000F305A002808D00E8A4F8AF61B3B +:109800000E82295936180E82295948829807BFD4EA +:10981000580840001070F8BDB5480078010701D421 +:109820004007F8D5707800281FD1FCF734FAC0B291 +:109830001A2113F07EF80746FCF72DFA1A214F4340 +:10984000C01BC0B24106490E70700D2905D280219F +:109850000843C009C0017E3006E00721C841192134 +:10986000C90640181921C8417070A1480078400706 +:1098700003D570784006400E7070A449A08F0A7816 +:109880005307C8D4238FC01A1330012380B2DB03DF +:10989000984201D9032006E0022801D2022002E00A +:1098A0000428B8D2012004231A430A70617A89007F +:1098B00069580A8A101A0882F8BDF0B48B488D4C9A +:1098C0000178954F4906490E01700F38417A8A0098 +:1098D0008F498A588F49138A038615790D7011466E +:1098E0004031CE792670B407A40FC471097A39705B +:1098F000F10608D5A41DC4710824F91D25430D7077 +:109900001571DB1E0386002101768049FB230A784E +:109910001A400A702021C185C1790172F0BC7047DC +:109920007248007840067DD4F0B56E488BB0018F48 +:1099300009318FB2017A102901D10C37BFB2417AB7 +:10994000734A8900515840318979490703D5018EFE +:10995000FF392D390186018E791A018600246C4960 +:10996000A50048594722125C9207920F012A74D928 +:10997000664B1B780593DB0706D05A4E33799C4221 +:1099800002D1338E5A333386038AF91A8EB255497F +:10999000098E8E427ED8032A10D052480079079152 +:1099A0005B4901904859034640339C46DB790246A7 +:1099B0009E070E32B60F022E6DD0FBE0428A54494C +:1099C0009A1802824748407A844211D14A590020AD +:1099D000907348594030C07900075BD54F484059D3 +:1099E000017D002956D1817CC27C89188174ECE00C +:1099F00080004749079008584721095C8907890F6B +:109A000002295AD04249468A48590890408A009013 +:109A1000864214D90146304612F08BFF009941432B +:109A2000701A00E0F6E0009980B24908814204D241 +:109A30000099081A80B2002111E001210FE031469F +:109A400012F077FF00997043081A80B271088142C2 +:109A500004D2301A80B2012101E0C1E000210028C7 +:109A600000D10121089A927B521CD3B2089A022B92 +:109A7000937306D3264A04265259403293793343CE +:109A80009371052819D2224E079846223058125C4D +:109A9000520701E06BE06BE001D500290DD11549BB +:109AA0000A78132191433FD01A4904200A780243CF +:109AB0000A701B490A7802430A7009212046FCF704 +:109AC00098FE134840594030C07900077DD5134AAD +:109AD00000235059C07C002877D951590F20CE7BE4 +:109AE000761C1FE0940000205D740000A30000209D +:109AF000A9000020A0000020B60400209804002047 +:109B0000B9000020D6CE0100C6CE0100A40000207E +:109B1000D8040020A8000020A10000201405002087 +:109B2000AB000020CE7317E00599FA4A4907C4D468 +:109B30000599042319431170028AD21E02820798E4 +:109B40003058C17B0029B8D17E21C173B5E7401ED2 +:109B5000C0B20E5C761C0E540E5C002E01D10028A3 +:109B6000F5D150595B1CC07CDBB29842B5D82CE0D3 +:109B7000DB061FD4038A868ADB04DB0CF618B6B238 +:109B80009E4201D2082300E0730B0093019BA34285 +:109B90000CD0FF2B0ED063461B79002B0AD0C37D5F +:109BA000019880000858C07D834203D11378009843 +:109BB000181810704A59138A908A18181082381A87 +:109BC00082B20798824200D8ECE6D2480078C007FB +:109BD00006D0D14801798C4202D1018E5A390186D2 +:109BE000CD48641C0078E4B2844200D2B7E6CA488B +:109BF0000786407A8300C948C058403081794A07B7 +:109C000002D5FB2211408171C5490020C958087551 +:109C10000BB0F0BD7047F0B5BF4885B010210172A0 +:109C20000D21C172017910300078FF29844603D0DC +:109C3000C00701D1B849C871BA480678BA4800903F +:109C4000BA480490B448B107447AB948A2000078F1 +:109C500000297AD0B049B84BCF79B6491D78097838 +:109C60000391B649CB785B1CDBB20293AA4B052F5C +:109C70005B7E019322D0A84B062F9B7907D0092F3A +:109C80007AD00C2F33D00020FDF725FF60E1A249E8 +:109C90000C230B720B469B79ED095B00002D03D062 +:109CA0002525EB1ACB7202E01625EB1ACB720523A1 +:109CB0008B7100075FD5FF2C79D149E196480C22C2 +:109CC0000272EA0901D00722C2726246120752D517 +:109CD000720701D40D2168E0039AD20705D0029AD9 +:109CE000CA70062A01D10022CA70C37630E1904CB6 +:109CF000C00607D492480078800603D5B007800FCD +:109D0000012808D0844805220272EA0938D02322AB +:109D1000D21AC27237E00120FDF7DDFE00F095FF98 +:109D2000002828D07C4D0C202872217808071AD5ED +:109D3000687AFF2817D0490708D4810078480122A3 +:109D400040588049FDF754F808E041E0049813F0CA +:109D500003F808227C497B48FCF784F979491022F2 +:109D60000098FCF77FF974480078C009A87904D0FE +:109D70007621081AE872EBE01AE07821081AE6E08A +:109D80003822D21AC272624612077AD5720702D5F9 +:109D90000D21C176DCE0039AD20705D0029ACA7081 +:109DA000062A01D10022CA700199C176D0E008E0EC +:109DB000594905230B723523CB72000761D5FF2C5F +:109DC0005FD057485F4980580022FDF711F878E0CE +:109DD000514D0421EE79761F072E52D233007B4479 +:109DE0001B79DB189F44733DB4B4030D2500430673 +:109DF00047D429723521E972000742D5FF2CE0D102 +:109E0000A6E0297200070CD5FF2C0AD044484D4922 +:109E100080580122FCF7ECFF4A4910220098FCF719 +:109E200021F945480078C00901D03A208FE0602030 +:109E30008DE0297200070CD5FF2C0AD03848414923 +:109E400080580122FCF7D4FF3E4910220098FCF70D +:109E500009F939480078C00901D04A2077E05F202D +:109E600075E000F0F2FE002872D00C202872324813 +:109E70000078C009A87905D041002520401AE87271 +:109E800004E065E041001620401AE8720520A87140 +:109E90002748007801075BD5697AFF2958D0400729 +:109EA00007D41F488900405800222649FCF7A0FF2C +:109EB00007E0049812F050FF082223492148FCF7DC +:109EC000D1F8204910220098FCF7CCF840E000F0CF +:109ED000BCFE00283CD00C202872154800780007F2 +:109EE0000ED5687AFF280BD081000D48012240581A +:109EF0001449FCF77DFF134910220098FCF7B2F8D3 +:109F00000D480078C00921D02020E8720620A871F1 +:109F10001EE00000A400002094000020D8040020CF +:109F200014050020AA000020FC070020E306002002 +:109F3000A0000020B3000020A3000020B4000020F7 +:109F4000A8000020DB060020120100200D20E8728E +:109F5000FC4CE07AFFF724F91020E0721520E08530 +:109F6000207AE07105B0F0BDF0B58FB0F648F54B42 +:109F70000690597A0091002119721A8F18860932B9 +:109F800094B2FF20F14A58721070187905901B782E +:109F90000A46EF4D9600AE594725AD5DAC46AD077C +:109FA000AD0F022D0CD1FF2806D0E94D8700ED59E9 +:109FB000F67DED7DAE4203D96546ED0600D4104630 +:109FC000521CD2B29A42E4D3059A904202D0DD4D9F +:109FD00000226A71FF283AD0DD4F85007A590D9230 +:109FE00040321579D74A5679B5422CD800250996C2 +:109FF0005E1E02460E96521CD2B29A4200D3002236 +:10A00000D34E9700F6590C964036B446F679B7070A +:10A01000BF0F022F0FD1F6060DD466463679002EFB +:10A0200009D00C9EF77D0D9EF67DB74203D300202C +:10A030000990104604E06D1C0E9EEDB2B542DADBCD +:10A04000C04A099D5571BF4A55796D1C5571059AD5 +:10A05000904214D0FF2A0ED0BD4F9600BA59D57D3C +:10A060006D086D00D575BB4A1278D20703D1BA5975 +:10A0700001263543D57580221043B24A1071B44889 +:10A080008A0085584726765DB707BF0F022F02D09A +:10A09000032F53D125E0F60602D5AC4801704DE000 +:10A0A000A84E37797E06760E8E4247D13E0618D5E9 +:10A0B0002C82A44DA74E2971357845276D086D0077 +:10A0C00035708658BF5D002F03D001273D43A14F57 +:10A0D0003D70F57DED0704D09E4D2E787608760014 +:10A0E0002E708558974A288A1679001B80B2B14293 +:10A0F0000BD1984E3678F60701D05A3004E01E286E +:10A1000001D2002001E01E3880B24035EE79F643DE +:10A11000B7070BD1AD796D0708D5FF252D35A842BE +:10A1200001D2002002E0FF382D3880B2158EA842FF +:10A1300004D810865172B20700D10690491CC9B2EA +:10A1400099429CD37F48457AFF2D09D001798D42F1 +:10A1500006D180490978C90702D0018E5A39018693 +:10A160007D4800780590800756D57648008E079088 +:10A17000CB2851D2FF2D4FD00098FF284CD08542DC +:10A180004AD0800072490A900F584720C05D09905C +:10A19000C043800740D1A80008584722125CD24330 +:10A1A000920739D1408A01907E8AB04211D9314656 +:10A1B00012F0BFFB01997043081A80B27108814206 +:10A1C00004D2301A80B2052819D316E0032816D31A +:10A1D00013E00146304612F0ACFB01994143701A7E +:10A1E000019980B24908814205D20199081A80B2CA +:10A1F000032804D301E0052801D300280CD10998D5 +:10A200001321534E8143042200294CD00798C128C2 +:10A2100002D93879104338714C480278FF2A58D057 +:10A220000698CB2855D9FF2D18D04648007985428D +:10A2300014D14749AB00CB581B8A1B1B9BB2B42BD4 +:10A240000CD8AD008300C858068A878AF6190682A2 +:10A250004859008A001B80B2B428F4D93C489600C3 +:10A2600081590B4640331D7AEF0601D4AD062BD53C +:10A270000979090604D5FF2506994935A94246D32F +:10A28000D97903252943D97181590C822D494A7204 +:10A2900080594030007A800639D530481022017844 +:10A2A0001143017033E02B4908784307B4D4FB7B9A +:10A2B000002BB1D10323FB73104308700A98305868 +:10A2C000018AC91E0182A7E7B4341E480C8242727B +:10A2D0001DE01C4D288E522819D905981E490822C8 +:10A2E0001043087072B6FBF73CFC62B61C4C207938 +:10A2F00000280CD0288EE98E884208D33A21687A4B +:10A30000FCF777FA2079012801D1002020710D4C4B +:10A31000607AFF282ED0FFF7D0FA607A47228100BA +:10A320000B484058018A125CC904C90C491CD2432D +:10A33000920717D0828A501880B2884216D208201D +:10A3400015E0000094000020FFFF0000A80000209E +:10A35000D8040020A4000020A3000020A5000020B5 +:10A36000B4000020428A501880B2E6E7400BA07289 +:10A370000FB0F0BDF74C082120780843207072B66A +:10A38000FBF7EFFB62B62078DF21084020700FB0AA +:10A39000F0BDF0B5F04EF14C83B0F7272078C1073F +:10A3A00006D1317A122919D0318F7187B16DF165DB +:10A3B0004008400038402070307A801E11287CD23E +:10A3C00003007B441B79DB189F440C1134347777EE +:10A3D00011607777853D54FE77FDFC00F18F718722 +:10A3E000B16EE4E7308E1E3830862920F085207863 +:10A3F000400840002070707AFCF7A1FF707AD84DB9 +:10A4000080002858018A31872030C07FFBF747FC45 +:10A41000707A800028582030807FFBF744FC707AE7 +:10A42000D04980002858407B4000085AFBF73FFC89 +:10A430000020F0722078400840002070F07AFEF78B +:10A44000AFFE0D2030722078C00703D1308F7087A7 +:10A45000B06DF065308FF087B06DB066F08DFEF7AF +:10A460009FFE0320B071BB48EF22017811400170BC +:10A470000E2001E120780121084320700E20FEF714 +:10A480008FFEFEF7B5FE0F2030726AE2207840089A +:10A4900040002070707AFCF752FF707AB04D800057 +:10A4A0002858018A31872030C07FFBF7F8FB707A8B +:10A4B000800028582030807F00E000E2FBF7F3FBAB +:10A4C000707AA84980002858407B4000085AFBF762 +:10A4D000EEFB0C2030722078400840002070A2482B +:10A4E0000078800772D0717A9D4D88002B584620E5 +:10A4F000C25C92066AD59D4A1278D20747D09C4822 +:10A50000407A884226D19B480078400622D4317E8A +:10A510009948FCF73DFD00281CD0707A800029582E +:10A52000964800F057FA914B944918780A791043ED +:10A5300018700871707ADF2180002A5840329079B3 +:10A5400008409071B08E70868D488022017811434A +:10A5500001703BE0708E00284ED0707A8000295840 +:10A56000864800F037FA81488022017883480171DB +:10A5700025214171708E401E7086814801781143FB +:10A580000170401C01784022114301701EE0784A9E +:10A59000527A8A4230D1181DFCF736FD00282BD0A4 +:10A5A000717A72488D006E4900784A596F49137963 +:10A5B0001843087010716A48DF2240594030817991 +:10A5C000114002E09AE060E019E18171707A64491B +:10A5D00080000858FB22001D01781140017063497A +:10A5E0000D78690703D560490978002909D05E48CC +:10A5F0000078800725D028E02078052108432070C6 +:10A6000023E0604AFB2113780D400B401370D21EEB +:10A6100015700C210170431E1A7855214A401A709A +:10A62000801E02784A400270401E02784A40027042 +:10A63000401E02784A4002702078022108432070B0 +:10A6400003E0E80901D0FBF701FD48480078000766 +:10A6500003D50720FEF7A4FD08E03E480078C009B6 +:10A6600001D00D2000E01E20FEF79AFD2078C007E3 +:10A6700006D0FBF76FFD0F203072FBF79FFC70E1F7 +:10A68000308F7087B06DF065F5E7207840084000A6 +:10A6900020702920FEF784FD308FF087B06DB06602 +:10A6A00000207072FFF709F9707A2D4D800028584C +:10A6B000354900F08FF9707A800028582030C07F2B +:10A6C000FBF7EDFA707A800028582030807FFBF786 +:10A6D000EAFA707A234980002858407B4000085AE3 +:10A6E000FBF7E5FA1B49EF2208781040402210439F +:10A6F0000870122030722120F085BEE7154D2878B1 +:10A70000C0060DD4F18FB06EFBF71AFCF18F012358 +:10A71000421A92B2DB039A4201D9318700E03087B6 +:10A72000207814494008400020701220F0712878E9 +:10A730004006400E28700978C90627D510213172CD +:10A74000BF21084028700A48FF214172FBF7B0FD85 +:10A750003FE00000A300002094000020BC00002087 +:10A76000D8040020DC070020AA000020A800002058 +:10A77000B4000020A50000207E0400207A04002000 +:10A78000A4000020AB000020E0000020C00620D57F +:10A79000FEF72EFDF07906281BD1F9480078002835 +:10A7A00003D100F0D5F9002813D000F0D1F9F54D10 +:10A7B00080002858F44900F00DF9707AF2498000C1 +:10A7C000285800F007F91820FEF7EAFC0F20307235 +:10A7D00006E02878EF2108402870307A122804D04B +:10A7E0002078012108432070BBE02120F08529203A +:10A7F000FEF7D6FC308FF087B06DB0663DE7F0799C +:10A80000092801D00C284FD1E04801783940017067 +:10A810008C462178480703D5FB200140217043E096 +:10A82000707A00908000D74D01902858FB23001DBE +:10A8300002781A4002708A0714D5FD221140217057 +:10A84000421E137855214B401370801E02784A40F7 +:10A850000270401E02784A400270401E02784A4050 +:10A86000027021E0C648017889071DD16146C909F7 +:10A870000FD05E2101706046800615D4C448007870 +:10A88000410701D5C0060FD50A210098FBF7B1FF9B +:10A890000AE00198202228584030817911438171C3 +:10A8A00003210098FBF7A5FF2078012108432070C1 +:10A8B000FFF7B1F9FFF734F8FBF7FAFC51E0207825 +:10A8C00041084900B34821700278930646D501201B +:10A8D000014321700C20FEF763FCAD4800780007AF +:10A8E00020D5707AFF281DD0AB4A81005158897C51 +:10A8F000002917D08300D1580F20CD7B6D1CCD735C +:10A9000004E0401EC0B20D5C6D1C0D540D5C002DAA +:10A9100001D10028F5D1D158887C401E0006000ED8 +:10A920008874E8D1FFF720FB99480078000718D514 +:10A93000707AFF2815D0984D800028589749007CE0 +:10A940001022000141189648FBF78CFB707A102208 +:10A95000800029589348FBF785FB02E05108490025 +:10A9600001702078C00700D018E503B0F0BD10B525 +:10A970008D48007A801E11281AD203007B441B796F +:10A98000DB189F4408080808151508161515162425 +:10A99000151515080800FBF7EBFA83480822816DAE +:10A9A000016682480021817181480178114301705C +:10A9B00010BDFBF7DDFA7C480822816D016601219C +:10A9C00020308171083001781143017010BDFBF710 +:10A9D000CFFA10BD0A7802704A7842708A78827085 +:10A9E000C978C170704773B56A461078654B8400AA +:10A9F00019594722525CD6066A4655780022002E25 +:10AA000020DA052D05D0062D07D0072D03D12031E2 +:10AA10008A721859028502B070BD0D8D4E8AAE192A +:10AA2000B6B20E851959AE42F5D820318D7AED1C9B +:10AA3000EDB28D7219590E46B67D2031B542EAD974 +:10AA40008A7212E0012D0CD0072D16D0082D0CD0E3 +:10AA5000802DE0D12031887A0628DCD28A7202B0BB +:10AA600070BD20318A7A521C8A721A592032937F23 +:10AA7000D17A8B4209D1117B0BE020318B7A062BE6 +:10AA8000ECD2FCF7F3F902B070BD147BA34200D105 +:10AA9000517BFBF710FF02B070BDF0B5454C84460A +:10AAA000E288414F0E462089F96E801A85B251180E +:10AAB000AE4202D83246604608E0EAB26046FBF792 +:10AAC000D1FA701BC2B260464019F96EFBF7CAFAA0 +:10AAD000E08821898019491E0840E080F0BD2D489A +:10AAE000007840070ED410B52F482649407A10232D +:10AAF0008200895840318A791A438A718021FBF794 +:10AB000078FE10BD704770B52B490978C9071CD075 +:10AB10002A4C002800D02A4C2078002801D0012897 +:10AB200012D1214D1749687A10238200895840318B +:10AB30008A791A438A7121788331C9B2FBF759FEA9 +:10AB4000287E2070A88E688670BDFFF7C8FF70BD94 +:10AB500070B515480078401E0406240E0ED0094D2D +:10AB6000A00028584621095C890603D4FEF7EAFABA +:10AB7000002803D1641E2406240EF1D1204670BDA6 +:10AB8000AA000020D8040020B6040020A80000205D +:10AB9000A0000020A300002014050020EB060020E8 +:10ABA000EC070020FC07002094000020B4000020E7 +:10ABB000BC0000201C080020A90000209D040020EB +:10ABC000BB0400203349497A8A0033498B58334A01 +:10ABD000D97812788907890F920601D4012070472D +:10ABE00030B42F4A5D7954799279AC4207D1022969 +:10ABF00002D09B799A4202D1012030BC7047002CD0 +:10AC000003D10229F9D0002AF7D030BC00207047C8 +:10AC100010B4214980001F4B0A589B8F548A153B62 +:10AC2000E31813820B580022DA8109584031C979A0 +:10AC3000090708D51B4A11588B7CCC7C1B198B74D7 +:10AC400010580121017510BC704770B51648114CA1 +:10AC50000078114D154E400608D5FBF729FBFFF78C +:10AC600077FF607280002858007930703078400794 +:10AC70000BD4607A8000285840308079800606D452 +:10AC80000020FFF79FFF002801D0012070BD0020A9 +:10AC900070BD000094000020D8040020A000002017 +:10ACA000B604002014050020A3000020A800002006 +:10ACB00010B57038030012F077F81B0F1519212515 +:10ACC000282F363B4044484C53585F688D7079803C +:10ACD000888D8D8D8D8F96004A680878114605F015 +:10ACE000DCF810BD086805F029F910BD0C790B7B64 +:10ACF0008A680868214605F032F910BD086805F039 +:10AD0000F0F910BD04F044FE10BD08884A6880B216 +:10AD1000114605F022FB10BD0A790888114680B261 +:10AD200005F0B2FB10BD087840B205F0BBFB10BDCA +:10AD3000088880B205F0CFFB10BD086805F0DDFB88 +:10AD400010BD086805F06BFD10BD086805F095FDA5 +:10AD500010BD088982B209C9194605F0E6FB10BD8D +:10AD600005C9114605F030FC10BD08884A6880B25C +:10AD7000114606F043FD10BD0C790888CB688A683F +:10AD800080B2214606F062FE10BD0B7908888A6801 +:10AD900080B2194607F00AF810BD08884C68CB68E5 +:10ADA0008A6880B2214607F072F810BD08884A68A8 +:10ADB00080B2114607F0B5F810BD0B7908880A7A01 +:10ADC00080B2194605F023FC10BD088880B205F05A +:10ADD00023FC10BD062010BD08884A6880B21146C9 +:10ADE00005F021FC10BD012010BD10B59038030006 +:10ADF00011F0DAFF09060F161D242C363F464E00CF +:10AE000088888A6883B20888194680B207F0D6FC21 +:10AE100010BD08884A6880B2114607F00AFD10BDCF +:10AE200008884A6880B2114607F00FFD10BD0888F7 +:10AE30004A6880B2114607F015FD10BD08884B68BE +:10AE40008A6880B2194607F020FD10BD088982B2D9 +:10AE5000888883B20888194680B207F01FFD10BDAC +:10AE600008894B6882B20888194680B207F035FD20 +:10AE700010BD08884A6880B2114607F040FD10BD39 +:10AE8000888882B20888114680B207F094FD10BD10 +:10AE9000012010BD10B5A038030011F085FF0B078D +:10AEA0000E172028313A414B525C65004B680878F8 +:10AEB0008A68194609F010FA10BD88888A6883B23A +:10AEC0000888194680B209F016FA10BD08884C6847 +:10AED000CB688A6880B2214609F011FA10BD088853 +:10AEE0004B688A6880B2194609F025FA10BD888837 +:10AEF0008A6883B20888194680B209F031FA10BD19 +:10AF000088888A6883B20888194680B209F06BFA8B +:10AF100010BD08884A6880B2114609F0AAFA10BD2F +:10AF2000088982B2888883B20888194680B209F0FD +:10AF3000ABFA10BD08884A6880B2114609F0C8FA19 +:10AF400010BD08894C6882B20888CB6880B221465F +:10AF500009F042FB10BD08884C68CB688A6880B253 +:10AF6000214609F054FC10BD012010BD10B50300AE +:10AF700011F01AFF0A0609060C0C0F0F060606123E +:10AF800004F02EFD10BD09F003FF10BDF8F727F8FF +:10AF900010BD03F00FFE10BDFAA1FE4811F0EBFD4D +:10AFA00010BD3EB5FC49054603C900900191FF2044 +:10AFB000C33069460881F94A092310460A21283816 +:10AFC00001F0BDFA0024F64801F0D7FA641CE4B29F +:10AFD0000A2CF8D3F14801231A4602A990300AF04E +:10AFE00064FA002804D0FF20E6A13D3011F0C3FD33 +:10AFF000686800F024FC00211E22084601F0DCFCF9 +:10B0000004F0FDFE02222421E6480AF04BF9E5484F +:10B0100001222C214C300AF045F9E2490B20B039CD +:10B0200003F02EFE002804D0FF20D6A1513011F0ED +:10B03000A2FD09F07CFE08F0CFFA6B460022082141 +:10B04000D9A004F0B7FD002804D0FF20CDA15730CF +:10B0500011F091FD284608F01FFE002804D0FF20C3 +:10B06000C8A1593011F087FDF3218900D14811F0B2 +:10B0700056FCD04801214171022181710721C17123 +:10B080003EBD10B5CB4CA0780A2804D3FF20BDA14B +:10B09000903011F070FD20786021484300190021A4 +:10B0A0000173417BF722C908C900C91C1140EF2276 +:10B0B000114041730121E1700C3010BD70B50E4696 +:10B0C00000211C4619801546030011F06DFE072370 +:10B0D000050B1711231D230022462946304609F08F +:10B0E00075FE70BD22462946304604F0CFFA70BD89 +:10B0F00022462946304608F01AF970BD22462946F4 +:10B10000304607F0DCF970BD22462946304600F093 +:10B1100010FC70BDFF209BA1EF3011F02CFD03202F +:10B1200070BD70B5A34CE078002818D0207860215D +:10B1300048430019407B00254007400F011908795A +:10B14000401E08712078401CC0B220700A2800D12F +:10B150002570A078401CA07001F0C3FBE57070BDA5 +:10B160009448C079002800D08BE7704770B5914DA6 +:10B17000A86800280CD0FFF7F3FF002862D06022F7 +:10B18000A968F6F72DF8FFF7CCFF0020A860EFE7DD +:10B190006879002856D0FFF774FF044681484C3088 +:10B1A0000AF090F86060002804D17A4875A14A300E +:10B1B00011F0E1FC60680AF0E8F800280DD02046A4 +:10B1C00004F045F96078010703D5C008C000401CB1 +:10B1D0002BE0744861684C302DE0724861684C3057 +:10B1E0000AF079F800F05AFB00282BD1FFF749FF4D +:10B1F00004466C480AF066F86060002804D13320E9 +:10B2000060A1000111F0B7FC60680AF0C2F80028E4 +:10B2100014D0606800886080204609F00AFE6078DB +:10B22000010706D5C008C000801C6070FFF779FFD9 +:10B230009EE75C4861680AF04EF899E759486168F2 +:10B240000AF049F870BD10B55B4CE160A0605B4846 +:10B25000F7F73EFD607010BD574900200870704739 +:10B2600070B5574E0546706A94B00C46401C04D128 +:10B27000B06AC0430004000C0BD0306AC007C00F96 +:10B280002870706A11F04DFBB06A2071000A60717D +:10B2900014E02B206946087009A968460AF049F8AD +:10B2A000002804D03B4837A17E3811F064FC01200F +:10B2B000287006220AA9204611F0D2FA2878002820 +:10B2C00003D06079C0210843607114B070BDF0B53F +:10B2D0003B4C0646206895B00D4637460837401C63 +:10B2E00008D16068401C05D1A068401C02D1E0680C +:10B2F000401C11D02068314611F013FB6068311DED +:10B3000011F00FFBA068394611F00BFBE0683146E5 +:10B310000C3111F006FB25E02B206946087009A9C5 +:10B3200068460AF006F8002804D01A4815A15538D6 +:10B3300011F021FC08220AA9304611F091FA2B20C5 +:10B340006946087009A9684609F0F3FF002804D08F +:10B3500010480CA14E3811F00EFC08220AA93846FC +:10B3600011F07EFA20692E460836401C08D160692B +:10B37000401C05D1A069401C02D1E069401C33D0BB +:10B3800020691FE07372635C686F73745F636F7230 +:10B39000652E6300C3020000E8CE010050080020C3 +:10B3A0006DAF0000200F00206E524635313832322A +:10B3B00000000000A40A00201C0100206DB1000064 +:10B3C00080000010294611F0ACFA6069291D11F0C7 +:10B3D000A8FAA069314611F0A4FAE06929460C31B7 +:10B3E00011F09FFA15B0F0BD2B246846047009A92E +:10B3F00009F09FFF002803D0F649F74811F0BBFB86 +:10B40000082209AF28460AA911F02AFA68460470F2 +:10B4100009A909F08EFF002804D0EF48ED49C01DAE +:10B4200011F0A9FB0822391D304611F019FAD9E7AD +:10B4300070B5EA4C0546A068002804D0E648E54906 +:10B44000563011F098FBA56070BD10B50146E44878 +:10B4500009F041FFE1498879401CC0B28871012898 +:10B4600003D1E0484078F7F757FC10BD70B50446AB +:10B47000DD4816460D46814204D1D748D549CB3028 +:10B4800011F079FB012E05D0D348D249DA3011F002 +:10B4900072FB70BD6620207000202072A581012003 +:10B4A000A07370BD70B515460C460646FFF758FEF2 +:10B4B00000280CD0662101704680012101722168AC +:10B4C0000161A18881820573FFF72BFE70BD1321F6 +:10B4D000304604F0D9FF70BDC2494968884201D2A4 +:10B4E00010207047072101700020704770B5BD4CD7 +:10B4F00005462078002694B0002801D00820E4E614 +:10B50000BA4A6260954201D21020DEE668680028DF +:10B5100009D00921D82804D3C31C9B089B0083426F +:10B5200005D00846D1E60720000268600EE0012140 +:10B5300009074B6B896B4B43AD49511A0122591ACC +:10B54000D202891A814201D20421EAE70BF004FBFE +:10B550006178A0680AF042F9E068401E07280BD81D +:10B56000302269460A70887068460BF0F7F90028A7 +:10B5700002D009A80AF06CFB2846FFF712FD012053 +:10B5800020703046A1E6F8B5044696480F4640685C +:10B59000814208D3002C01D0844204D3E01C8008EF +:10B5A0008000A04201D01020F8BD8C48817800298D +:10B5B00011D0398800914178602251430D18287BC1 +:10B5C0000C350007000F3B4600222946FFF776FDA9 +:10B5D000060004D015E0002038800520F8BD002CBE +:10B5E00013D039880098814201D90C260DE02878C3 +:10B5F0003B460007000F22462946FFF75FFD060085 +:10B6000005D00C2E01D0002038803046F8BD734C98 +:10B610006078401CC0B260700A2801D100206070C0 +:10B62000A078401EA07068784107490F01290ED00C +:10B63000022906D003291AD066496E4811F09BFAF8 +:10B64000E3E7C006E1D46868FFF7FFFEDDE7644882 +:10B6500069684C3009F03FFE6079401CC0B26071EF +:10B660000128D2D15F484078F7F756FBCDE7E07963 +:10B67000401CE071C9E7604A10B5904209D3594AAD +:10B680000124A4045268A04201D3904201D3914204 +:10B6900001D2102010BD03F02CFB10BD564B10B58D +:10B6A000994209D34F4B0124A4045B68A14201D302 +:10B6B000994201D39A4201D2102010BD022803D032 +:10B6C000102801D0092010BD03F039FB0028FAD062 +:10B6D000052010BD484B10B598420DD3414B0124B5 +:10B6E000A4045B68A04201D3984205D3994203D3D6 +:10B6F000002A03D09A4201D2102010BD03F045FB6E +:10B700000028FAD0072010BD10B50446354894B083 +:10B710004068844202D2102014B010BD0F2008A946 +:10B72000087369460BA809F004FE0028F4D16846A6 +:10B73000007A207068464089608068468089A080D1 +:10B740000020E9E710B500290BD0264A5268914243 +:10B7500002D30B68934201D2102010BD8A88002AC0 +:10B7600002D007F092FF10BD092010BD10B5224A8B +:10B7700094B091420ED31B4A01239B045268994214 +:10B7800001D3914206D3441E1E2C41D8994203D3C3 +:10B79000914201D21020BFE7012837D10878002458 +:10B7A000C007C00F002803D003206946887001E05D +:10B7B0006846847038206946087009A9684609F00F +:10B7C000B8FD002804D041200CA1C00011F0D3F92D +:10B7D0002046A1E784B3000093020000A40A0020E1 +:10B7E000200F00201C010020FFFF0000401A002055 +:10B7F000000000200A04000000D001007372635CA6 +:10B80000686F73745F636F72652E6300072083E750 +:10B810000246203A1F2AF9D804F033FA7CE710B523 +:10B820005F4A5268914201D2102010BD0246203A70 +:10B830001F2A02D804F09FFA10BD072010BD70B572 +:10B840000546584C00202070204646195448466052 +:10B85000E01C80088000A04204D0FF205249133031 +:10B8600011F089F901200007C06AC0430006000EEC +:10B8700003D14E480068401C03D04D484D49301A52 +:10B88000C862A8B20122214601F0A9FC002804D018 +:10B89000FF204549233011F06EF970BDF0B595B029 +:10B8A0003B2008A9087369460BA809F042FD00284F +:10B8B00004D0FF203C496B3011F05DF93E4E00246E +:10B8C0006D4630E02F19B87DC10706D0400704D47B +:10B8D00060004019C08809F0CBFB38488079002807 +:10B8E0001FD0B87D80071CD560004019C088002299 +:10B8F000062109F0DAFB002813D03C2108A80173C7 +:10B9000060004019C1886846C18569460BA809F0E6 +:10B9100010FD06000BD0FF2023497F3011F02BF9DA +:10B9200005E0641CE4B268460079A042CAD83046FB +:10B9300058E5F7B505460078002700090C463E4655 +:10B94000062804D0FF201849A83011F014F9287AED +:10B9500000280ED0012814D0FF201349C93011F05F +:10B960000AF90298002C068001D02780668000200A +:10B97000FEBD02270926002C0ED0A889A080A87B36 +:10B9800008E003271426002C06D02869E060A88A66 +:10B990002082287B2072E4E702980680E7E7000017 +:10B9A0001C010020401A0020FCB70000001000100D +:10B9B000000000200005004004300000A40A002020 +:10B9C00010B56038030011F0EFF90A060A0F1318DA +:10B9D0001F252930353A0868FFF788FD10BD05C9D5 +:10B9E0001146FFF7D0FD10BD0868FFF775FD10BDCB +:10B9F00005C91146FFF73FFE10BD4B6808788A68FD +:10BA00001946FFF74BFE10BD8A6809C91946FFF7B2 +:10BA100061FE10BD0868FFF777FE10BD08884A6810 +:10BA200080B21146FFF78EFE10BD05C91146FFF723 +:10BA30009DFE10BD05C91146FFF7F1FE10BD0120A6 +:10BA400010BD0120704700004749096801600020CF +:10BA5000704745490860002070470121434A00288B +:10BA600003D0012803D042487047916300E0D163BE +:10BA7000002070473F49012008603D48801C704706 +:10BA800004223D4B3B49002805D05A600869012239 +:10BA90001043086108E008694008400008619A60A6 +:10BAA00032490020C03188600020704731490622A9 +:10BAB000002808D0012809D002280DD003280FD073 +:10BAC0002B48401C70470869904302E00869904386 +:10BAD000801C08610020704708699043001DF8E74A +:10BAE00008691043F5E723494A6A02434A62002085 +:10BAF000704720494A6A82434A62002070471D49C4 +:10BB0000496A0160002070471A49CA690243CA6144 +:10BB1000002070471749CA698243CA6100207047F4 +:10BB20001449C9690160002070471249024600208B +:10BB30004031002A03D0012A01D0072070478A63D0 +:10BB400070470D490420886008490020C031886092 +:10BB50000A4801688022090A090211430160084964 +:10BB600001200860704700000004004040000040D1 +:10BB700004200000000500400003004000E400E055 +:10BB800000E100E08107C90E002808DA0007000F75 +:10BB900008388008C24A80008018C06904E0800824 +:10BBA000C04A800080180068C84080097047BE49BC +:10BBB00048788978884201D3401A02E02122511A3C +:10BBC0000818C0B27047B84923314878897888424C +:10BBD00001D3401A02E02122511A0818C0B270475E +:10BBE000B149463148788978884201D3401A02E049 +:10BBF0002122511A0818C0B27047AA4910B50C3159 +:10BC00000868FF22120290430122D2031043086009 +:10BC1000A549002023314870887023394870887006 +:10BC2000463148708870A14800F04CF99F48401C8C +:10BC300000F048F9F7F7E3F800F028F910BD2020EC +:10BC40007047B4E770B50C4605460026FFF7AFFF16 +:10BC50009549A04214D30A46203A00232046641E88 +:10BC6000E4B200280BD08878105C287088786D1CAE +:10BC7000401CC0B288702128F0D18B70EEE70126FD +:10BC800000F004F9304670BD202070479BE770B586 +:10BC90000C4605460026FFF796FF83492331A04254 +:10BCA00014D30A46203A00232046641EE4B200283A +:10BCB0000BD08878105C287088786D1C401CC0B24E +:10BCC00088702128F0D18B70EEE7012600F0DEF8B5 +:10BCD000304670BD202101700020704710B5044629 +:10BCE000FFF77EFF2070002010BD70B50C460546A2 +:10BCF000FFF776FF6C494631A04215D30A46203A39 +:10BD000000232046641EE4B200280BD08878105C23 +:10BD1000287088786D1C401CC0B288702128F0D132 +:10BD20008B70EEE7002400E0614C00F0AFF8204695 +:10BD300070BD70B50C460546212904D9FF205DA1D0 +:10BD4000473010F018FF56484068103840B2FFF7EF +:10BD500019FFC6B20D20FFF715FFC0B2864207D209 +:10BD6000FF2054A14D3010F006FF01E0F7F78AF8EC +:10BD700021462846FFF766FF0028F7D070BDF8B5CA +:10BD800007464A48484C401E474E007825464636EE +:10BD90002335002806D1A9786878212200F06BF8B5 +:10BDA00000280ED0A1786078212200F064F80028E5 +:10BDB00014D0B1787078212200F05DF8002828D0E6 +:10BDC00033E039496878C91C0F546878401CC0B208 +:10BDD0006870212829D10020687026E032496078F7 +:10BDE00020390F546078401CC0B26070212801D106 +:10BDF000002060702D4F7F1E3878002815D0A17864 +:10BE00006078212200F037F800280ED0002038702A +:10BE10000BE02549707826310F547078401CC0B271 +:10BE20007070212801D100207070A97868782122D3 +:10BE300000F021F800281DD0A1786078212200F0C0 +:10BE40001AF8002816D0B1787078212200F013F883 +:10BE500000280FD0F6F7F8FF144800F03BF8012156 +:10BE60004903884203D013A1C12010F084FE0F487B +:10BE700000F048F8F8BD401C884205D0904201D13E +:10BE8000002901D0002070470120704710B50748F5 +:10BE900000F020F8002801D1F6F7C5FF10BD000022 +:10BEA00000ED00E000E400E0BC0F00202D010020C8 +:10BEB000072000007372635C736F635F72616E646E +:10BEC0002E630000002101700846704701460020E3 +:10BED00008707047EFF31081C907C90F72B6027876 +:10BEE000012A01D0012200E0002201230370002971 +:10BEF00000D162B6002A01D0002070470120400323 +:10BF00007047E7E7EFF31081C907C90F72B6002247 +:10BF10000270002900D162B600207047F2E70000ED +:10BF20008107C90E002808DA0007000F08388008CA +:10BF3000864A80008018C06904E08008844A800036 +:10BF400080180068C8408009704710B5044600F0AA +:10BF5000E7F8002813D02046FFF7E2FFC0B200F058 +:10BF6000EDF800280DD07B4801210278002A0BD083 +:10BF7000E206D20E914042681143416009E07648E2 +:10BF800010BD7548401C10BDE006C00E81407348CE +:10BF90000160002010BD10B5044600F0C1F8002873 +:10BFA0000BD06C4901200A78002A08D0E206D20E94 +:10BFB00090404A6882434A6007E0674810BDE10646 +:10BFC000C90E8840654980310860002010BD70B5F9 +:10BFD0000D46044600F0A4F800280BD06048006825 +:10BFE000E206D20E01219140084000D001202860D5 +:10BFF000002070BD584870BD10B5044600F090F8A0 +:10C00000002807D0E106C90E012088405449086085 +:10C01000002010BD504810BD10B5044600F080F857 +:10C02000002808D0E106C90E012088404C49803123 +:10C030000860002010BD484810BD70B50D4604468C +:10C0400000F06EF8002819D0284600F077F8002894 +:10C0500016D0FF20002C16DA2107090F08398A08AC +:10C060003A4992005118CB69A207D20E90408343FF +:10C07000A807000E90400343CB6112E0364870BD24 +:10C080003548401C70BDA2083149920051180A6819 +:10C09000A307DB0E98408243A807000E9840024396 +:10C0A0000A60002070BD70B50C46054600F038F8F7 +:10C0B000002805D02846FFF733FF2070002070BD10 +:10C0C000254870BDBFF34F8F20492648C860BFF395 +:10C0D0004F8FFEE770B51F4C0546217801200029DF +:10C0E0000ED1207072B6F6F7B8FD1C4E803631685E +:10C0F00081436160F6F7B1FDC043306062B6002055 +:10C100002870002070BD13490A78002A06D0002844 +:10C1100004D1124A4868106000200870002070475F +:10C1200010B50446202805DAF6F797FD0121A14055 +:10C13000084201D0002010BD012010BD012803D00D +:10C14000032801D0002070470120704700ED00E077 +:10C1500000E400E0300100200120000000E100E0E8 +:10C1600000E200E00400FA0510B52948FFF7AAFE36 +:10C17000002803D027A11D2010F0FDFC2448401CFE +:10C18000FFF7A0FE002803D022A1212010F0F3FC2D +:10C1900010BDF8B5234D07466868009001261C487D +:10C1A000FFF798FE1A4C002803D10026601CFFF709 +:10C1B000A9FE1D4A1D4900230120506000BF00BF99 +:10C1C00000BF00BF00BF0B604B606F60106000BF1E +:10C1D00000BF00BF00BF00BF0868002802D1486848 +:10C1E0000028F9D048680028E6D1002E05D0009834 +:10C1F0006860601CFFF76EFE07E0601CFFF76AFED8 +:10C200000028D3D10248FFF77DFE0020F8BDC0E72B +:10C21000380100207372635C736F635F6563622E25 +:10C220006300000000E5004000E0004000E1004045 +:10C230005B495C4B0A685C499A42096801D18904F0 +:10C24000890C0160002070475549564B0A685649D1 +:10C250009A4201D18004800C486000207047504908 +:10C26000504B0A6850499A4201D18004800C886082 +:10C270000020704730B54A4B4A4D1C684B4BAC42CE +:10C2800002D0102802D203E00E2801D3184630BD98 +:10C29000C3004548181801614261002030BD404983 +:10C2A000404B0A684149491C9A4202D0042802D2F4 +:10C2B00003E0022801D3084670473D4A0121C0002F +:10C2C00080180160002070473549364B0A683749AD +:10C2D000491C9A4202D0042802D203E0022801D36A +:10C2E00008467047324A0121C00080184160002092 +:10C2F000704730B52A4A2D4B2A4D14685B1C2D4AD5 +:10C30000AC4206D0042806D28000801801600020CC +:10C3100030BD022801D3184630BD8904890CF3E7EB +:10C3200030B51F4A214B1F4D14685B1C214AAC429B +:10C3300005D0042805D280008018006808E0022893 +:10C3400001D3184630BD8000801800688004800C3E +:10C350000860002030BD10B5134A174890600E20C9 +:10C360000021C3009B1819615961401C1028F8D3A3 +:10C370000020104A05E0022803D383009B181960AF +:10C3800005E083009B181C68A404A40C1C60401CDE +:10C390000428F0D310BD04490748886070470000A6 +:10C3A0001C000020BEBAFECA00F5014008200000B3 +:10C3B00000F0014000F8014000C0FFFFFEB5F34C63 +:10C3C00007466068FF213E0181552178FF2913D07F +:10C3D0000901083141583246491E083209020192CA +:10C3E000090A805800F0C8F9002802D024782546B0 +:10C3F00015E06168207888552770FEBDE3484268E3 +:10C4000001981158280100900830105800F0B4F934 +:10C41000002806D1DD482C46416800980D5CFF2DB0 +:10C42000ECD1DA482101406885554754FEBD70B50E +:10C43000D64A04460020157A53680AE00201561CC9 +:10C440009E5DA64203D10C329A588A4204D0401C09 +:10C45000C0B28542F2D8FF2070BDF8B5CB4F3E7810 +:10C46000F8F794F90146FF2E68D034012546786824 +:10C470000835405900F080F9022802D978684059FF +:10C480005AE0C2494868025D0A70A11C425C002A59 +:10C490000CD0521E425441590122D205891809027A +:10C4A000090A41513046FFF789FF30E0631CC25C46 +:10C4B0000092221D94468258002A10D001239B022C +:10C4C0009A420FD99205920D43595703DB191B026B +:10C4D0001B0A43516346C3589A1A920A09E0FF2186 +:10C4E000C1540AE0435952039A181202120A4251E7 +:10C4F000002242543046FFF761FFA4480C344168E3 +:10C50000C2680098095980001258009890479F4CC3 +:10C510002078FF2812D0F8F739F9014620786268B0 +:10C5200000010830105800F027F9012896D920782A +:10C530006168000108300858F8F71BF9F8BDF8B534 +:10C540001C4615460E460746FF2B03D390A1D32069 +:10C5500010F011FB8D48FF21C7604560047206741E +:10C56000017000224270104604E00201521C401C7F +:10C57000A954C0B2A042F8D3F8BD70B5834C0646AA +:10C580006578207C854203D381A1E62010F0F3FA80 +:10C59000E068A90046506078401C6070284670BD75 +:10C5A000FFB581B01D46FF24F8F7F0F8774F064637 +:10C5B00079780198814203D875A1F42010F0DBFA54 +:10C5C00072480021037A406810E00A019446521C28 +:10C5D000825CFF2A24D0019FBA4205D162460C3208 +:10C5E0008758029A97421DD0491CC9B28B42ECD899 +:10C5F000FF2C17D021014B1C019AC2540B33029A15 +:10C60000C250039B614F0022012B0ED00B1DC25064 +:10C6100001239B029D4216D9AA05920D08D008E07D +:10C620000C46E1E7FF2005B0F0BD0B1DC550EFE75C +:10C630001A4653039B190E461B0208361B0AAA1AF8 +:10C640008351920A09E0002D00D101256B039B194B +:10C650001D022D0A0B460833C550891C42543D4625 +:10C660003E782046FFF7AAFE2878B04215D0F8F7AA +:10C670008DF8014628786A6800010830105800F0EB +:10C680007BF8012807D92878696800010830085824 +:10C69000F8F76FF801E0FFF7E0FE0198C3E770B527 +:10C6A0000C460546F8F772F8064621462846FFF77D +:10C6B000BEFEFF2817D0354D0401204669680830BA +:10C6C0000858314600F058F80121090340186968FC +:10C6D000A41C095D400B002901D08902081800281C +:10C6E00000D1012070BD002070BDF3B581B00746B8 +:10C6F0000299FFF79CFEFF282AD0244D2E78696806 +:10C700003246344604E0844205D026462301CC5C00 +:10C71000FF2CF8D11CE0FF2C1AD0A6421FD110012B +:10C72000085C2870FF2818D0F8F730F82A780146FE +:10C73000120168680832805800F01EF8012809D9F3 +:10C7400028786968000108300858F8F712F806E000 +:10C750000020FEBDFFF781FE01E0F8F712F8384631 +:10C760000299FFF79CFF22016968FF23541C0B55B7 +:10C770008A5C3301CA54FEBD401A00020121000A3E +:10C78000C905884200D90020704700000810002029 +:10C790007372635C736F635F74696D65722E63009F +:10C7A00070B5002402460D4620462146002A20D0BE +:10C7B000012A04D0022A04D0032A0DD103E001206B +:10C7C00002E0022015E003202B0010F0EDFA07052F +:10C7D00007090B0D0F11050007240EE0012108E0E9 +:10C7E000022106E0032104E0042102E0052100E02B +:10C7F0000621F6F71EFD0028EED0204670BD000091 +:10C80000F0B51C48002701211B4A831447601360C0 +:10C810001A4A17601A4C23601A4B1C691E69E443BC +:10C82000E406E417641C10252E431E61164B596064 +:10C83000164E316000E020BF1668002EFBD0002CA1 +:10C8400003D1104C2669AE43266184688068A40534 +:10C8500001D50F4C20430D4C616099601760084A68 +:10C86000A1141160F0BD10B50446FFF7C9FF2060A8 +:10C87000002010BD00C5004080E100E000C1004084 +:10C8800080E200E000ED00E000C3004000C0004096 +:10C8900000FCFFFF70B51F490A68002A17D000236B +:10C8A0001D4601244A68521C4A60092A00D34D6083 +:10C8B0000E792246B2400E6816420AD072B60B6854 +:10C8C00093430B6062B649680160002070BD05208B +:10C8D00070BD5B1C092BE5D30FA1362010F04BF97E +:10C8E000F5E701201049800508607047EFF31081DB +:10C8F000CA07D20F72B60121814006480368194366 +:10C900000160002A00D162B6EBE702480021016015 +:10C91000416070473C0100207372635C736F635F1A +:10C920006576742E6300000000E200E00A4A0221EE +:10C9300051600A490B68002BFCD090600868002801 +:10C94000FCD00020506008680028FCD0704701200F +:10C95000000740697047000000E5014000E4014025 +:10C9600001208107086070470120810748607047F7 +:10C970001048C068C00700D0012070470D4880688B +:10C98000C00700D0012070470A484069C00700D0A6 +:10C99000012070470748C069704706498A69D20379 +:10C9A00006D589698907890F814201D10120704725 +:10C9B000002070470004004010B5FE4B586019720B +:10C9C0001A80C9000FF0ABFF10BD00210180704735 +:10C9D00010B50022D24302800320FFF786FE10BD6F +:10C9E0007047F0B50E460446017801208840F249B0 +:10C9F00099B008400090616815460888EF4A904257 +:10CA000006D0009A002A06D0EB4A521E104202D0ED +:10CA1000012019B0F0BD009A10430880002D12D0FB +:10CA2000002028702178EA1C0027681C01920B0066 +:10CA300010F0BAF910F30E16233A59616F3CB4B0F6 +:10CA40008AB8F2F1F0F320780B28EBD00420E0E76D +:10CA500002212970A1890170090A4170032097E021 +:10CA600004212970A1890170090A41700198E189A6 +:10CA70000170090A417005208AE006212970A18908 +:10CA80000170090A41700199E2890A70120A4A701C +:10CA9000218A0171090A4171A28AE81DA1690FF07A +:10CAA000DFFEA08AC01D73E00821297021780829C3 +:10CAB00001D110212970A1890170090A41700198E2 +:10CAC000E1890170090A41700520308020466A1D05 +:10CAD00002A9103002F059F900287DD1694630884A +:10CAE000097A401854E00A212970A1890170090AC5 +:10CAF000417003200BE00C212970A1890170090A03 +:10CB000041700198E1890170090A41700520308067 +:10CB10009CE0A08984464000401C81B23088884255 +:10CB20005AD3052958D30E202870002008E0236925 +:10CB300042009B5A521953701B0A401C937080B2DA +:10CB40006045F4D33180B9E09A48417A002973D026 +:10CB5000491E4172217B4068C9004518A988286890 +:10CB600008224018083821690FF07AFE0221684631 +:10CB700001710021417128680390A98868460181EC +:10CB8000002101A805F00EFC0020A880002E00D096 +:10CB9000308093E02978802211432970297840223F +:10CBA0001143297029788909890112312970A189D5 +:10CBB0000170090A4170E289E81C21690FF050FEFA +:10CBC000E089C01C3080287841063FD5C00975D067 +:10CBD00001216846017200E02CE000214172318899 +:10CBE000091D81810495E189019808180590001DAF +:10CBF00006907048017A68460177002102A805F086 +:10CC0000D1FB074630880C303080022F06D0002F31 +:10CC100054D065E03DE033E01CE05EE065486946E5 +:10CC2000097F4268CB00D218037A994202D29188D8 +:10CC3000002902D0042753E02FE0417A491C4172B9 +:10CC40001560308890800020308049E06168A089BC +:10CC5000888033E029788909890116312970A189F2 +:10CC60000170090A41700198E1890170090A417057 +:10CC7000228A681D61690FF0F3FD208A401D46E796 +:10CC800028788009800118302870207B6870022085 +:10CC90007EE760680188090401D4052720E0C08888 +:10CCA000A189884201D006271AE01E2028700120A1 +:10CCB0003080606801884904490C01800098002890 +:10CCC0000ED03C4800220088A16883000320FFF7B3 +:10CCD00067FC61682078887007E0002030800327B7 +:10CCE0006068009902888A430280384691E6FFB561 +:10CCF0009FB0289D0E46002805D0172803D82A8803 +:10CD00002E4B9A4202D1072023B0F0BD3278530651 +:10CD100001D4D20901D00820F6E700226B461A712F +:10CD20005A7114463278431E1D939BB2189303AB7D +:10CD30001A939706CB1CBF0E1B93821E711C3B00DF +:10CD400010F032F8209011EE66EE74EEB0EED4EEF4 +:10CD5000EDEEECEEEBEEEAEEE9EEEEEEE8EEE7EE0F +:10CD6000E6EEE5EE90EE05287CD1042168460171DF +:10CD7000A9780172F078B2780102114368464181C6 +:10CD80003179417170788006800E0C282ED009DC34 +:10CD9000801E030010F008F80919661C662166243D +:10CDA0006627660012282AD00ADC0E2821D0102817 +:10CDB000DAD121E01C100020FF710000FFFF00000D +:10CDC00016281FD01828CFD11FE02878800701E04F +:10CDD00028784007002845DA45E128780007F9E778 +:10CDE0002878C006F6E728788006F3E7287840061A +:10CDF000F0E728780006EDE72888C005EAE72888EC +:10CE0000C004E7E728888004E4E728884004E1E7D5 +:10CE10002A78920726D50328A6D105206A461071E4 +:10CE2000487809780002084310811CE129784907F5 +:10CE3000F0D5062816D3717890B2012902D00229C4 +:10CE400092D101E0022100E01021189106216A46EA +:10CE500011710021118102AF189AB11C0237921C86 +:10CE60001B921AE0B3E04A780B7812021A433A8018 +:10CE7000801E891C1790BA1C1A91189801F05FFF48 +:10CE80001A991898189A091817986B46801A1A89CF +:10CE900080B2521C1A811B9ABF1D8242E3D900281E +:10CEA00086D1E0E028780007B4D51D98694682B2A3 +:10CEB0000720087100200881701C0A3111E04378B6 +:10CEC00007781B023B430B80C37887781B023B43E8 +:10CED0004B806F463B89121F5B1C001D92B23B8149 +:10CEE000091D042AEBD2002A71D1BCE02978C906B9 +:10CEF0006DD502286BD3082069460871002048814F +:10CF000070780872844692B2B01C1A9919E089E0D0 +:10CF100090E07EE067E05BE030E025E019E013E0C0 +:10CF2000BCE0437807781B023B430B80831C4B60BB +:10CF30006346D21A6F467B8960445B1C92B27B8148 +:10CF400008319445EDD9CEE7287880063FD50922EF +:10CF500003E0287840063AD50A2268460271AA887A +:10CF60000281189A428107E0287800062FD50B200D +:10CF70006A46107118981081039174E02988C905D8 +:10CF800025D5022823D30C2069460871002048814A +:10CF900070780872844692B2B01C1A9914E04378F3 +:10CFA00007781B023B430B80C37887781B023B4307 +:10CFB0004B80031D4B606346D21A6F467B896044E9 +:10CFC0005B1C92B27B8108319445E8D98BE763E022 +:10CFD0002988C90460D501285ED10D2168460171F8 +:10CFE000A98801813FE02988890455D5052853D3B4 +:10CFF0000E2269460A71AA880A811B99401F4A7845 +:10D00000097812020A4369464A818881701D04909A +:10D0100029E0298849043FD501283DD10F206946E0 +:10D02000087120E02A88120436D44A780B7812025C +:10D030001A43EA8003282FD332789206920E1B2AD5 +:10D0400026D011226B461A712A880123DB031A436A +:10D050002A804A78097812020A4369460A81C01E6A +:10D0600048811B98039030788006800E1B2809D0D9 +:10D070001D2807D003202299FFF737FB2888C00B13 +:10D08000C003288001A8219905F08CF920463BE6D1 +:10D0900010226B461A71DCE70724F7E70824F5E74E +:10D0A00000B597B0032806D16A461070019100219F +:10D0B000684605F077F917B000BD000010B58B7811 +:10D0C000002B11D082789A4207D10B88002B0BD00D +:10D0D00003E08B79091D002B08D08B789A42F8D198 +:10D0E00003880C88A342F4D1002010BD812010BD1C +:10D0F000052826D0002A02D0012A0DD102E0098895 +:10D10000090501E009888904890F07D0012918D091 +:10D11000022909D003290ED081207047002A01D0AE +:10D12000032070470220704703280AD0042808D043 +:10D13000002804D007E0042803D0022803D00520EB +:10D140007047002070470F20704770B51388054660 +:10D1500014460B8018061DD5FE481022807AA8427E +:10D1600003D813430B80002070BDA0689343007860 +:10D17000E840C007C00E03430B802078A1788007E9 +:10D18000800D0843F4490FF0D4FBA06869430818E8 +:10D19000401C70BD906870BD37B569468B881380A0 +:10D1A00019061BD5EB4C0125A47A9168844209D855 +:10D1B000FE280FD1D80602D5A5406D1E00E000253F +:10D1C0000D7007E085400C78DB06DB0FAC43834035 +:10D1D0001C430C7010881021884310803EBDF8B5A8 +:10D1E0000746C81C80080E468000B04201D0862049 +:10D1F000F8BD082A01D90E20F8BDD64D00202E60BA +:10D20000AF802881AA723446E88016E0E988491C7C +:10D21000E980810610D48007A178800D0843CE49AB +:10D220000FF087FB206800F0BAFA2989401880B215 +:10D230002881381A8019A0600C3420884107E5D471 +:10D240000020F8BDFFB589B09F041646139DBF0CA2 +:10D250000193099800F095FA04000AD0207800069E +:10D2600009D5BC48817A0A98814204D887200DB03C +:10D27000F0BD0120FBE7224669460A98FFF765FFEB +:10D280000690002069460872052D14D0012221461F +:10D290002846FFF72DFF0028E9D1207840060AD55F +:10D2A000022168460172099981810188C181068243 +:10D2B0004782129805900198000404D500273E4645 +:10D2C0000125079709E02078A1788007800D0843A1 +:10D2D000A14907900FF02DFB0D46019840040AD597 +:10D2E0000798A84207D12088E1788005800F0002C6 +:10D2F0000843B04201D3AE4201D90720B7E7B819BD +:10D3000080B20190A84201D90D20B0E76846007AAA +:10D31000002804D002A805F0CEFE0028A7D1079867 +:10D32000A8420BD12088032109028843019989056D +:10D33000890F0902084320800198E07014980028A2 +:10D3400000D007801298002815D006983A46801918 +:10D3500012990FF085FA224669460A98FFF7F5FE02 +:10D36000694608881021884369460880224600994A +:10D370000A98FFF711FF002079E7FFB5754D0C22E1 +:10D38000E8882968504383B00C180D9F72490598AE +:10D390000FF0CFFA0091049800F001FA29682A8969 +:10D3A0008E46611A0C310918944651188AB2A98820 +:10D3B000914202D8842007B0F0BD6A46168A320630 +:10D3C00003D5B20601D58520F5E7EA88521C92B252 +:10D3D000EA800E9B002B00D01A80B20601D5A76010 +:10D3E00006E0604480B22881091A70460818A060DF +:10D3F0002246FE200499FFF7CFFE0598A070009802 +:10D40000E07020880599800889058000890F08430D +:10D4100003210902884300998905890F09020843FD +:10D4200004210843208003988078A0710398008825 +:10D43000A08000202073310601D5AC7A00E00124E1 +:10D44000B10600D5002700260EE00521002001913D +:10D4500002900097E88831460C9B069AFFF7F2FE8F +:10D460000028A8D1761CF6B2A642EED30020A2E78F +:10D47000F1B5009800F085F9060002D00025009C67 +:10D4800014E00120F8BD204600F07BF90746007843 +:10D4900031498007820DB87810430FF04AFA386896 +:10D4A00000F07DF94019641C85B2A4B22948C188F6 +:10D4B000601E8142E7DC00992648491EC18001892F +:10D4C000491B018100203070F8BD002804D0401EA7 +:10D4D00010809170002070470120704710B50446FD +:10D4E00001881C48C288914201D3822010BD006887 +:10D4F0000C22514342189079A072908820811088A4 +:10D50000D1788005800F00020843A081A078211DFA +:10D51000FFF71BFE20612088401C2080E080002057 +:10D5200010BD012101827047F7B50546002084B087 +:10D53000C0431080686817468178684681706868C3 +:10D5400001886846018000218171288A2C88A042C8 +:10D5500005D303E0281000200102000004462C82BD +:10D5600035E0288A401C2882301D6968FFF7A6FD37 +:10D5700000282AD139889248814201D1601E388022 +:10D580006888A04228D33088F1788005800F000297 +:10D59000084302906946301DFFF790FD002814D122 +:10D5A0006989874881421BD0002231460598FFF7E0 +:10D5B0009FFD002809D16A890298824205D1E96855 +:10D5C000B0680FF020F900280AD0641CA4B22046ED +:10D5D00000F0D7F80600C4D1641E2C828220EAE64F +:10D5E0007C80B079B871B088B8803078B178800725 +:10D5F000800D084378810298B8813946287A3246EE +:10D600000831FFF7A2FD38610020D4E6FFB585B0F0 +:10D610001C460F46059800F0B4F8050009D028789C +:10D62000000608D56748807AB84204D8872009B038 +:10D63000F0BD0120FBE707982A468605B60D69462E +:10D640003846FFF782FD07460E98052816D00022BF +:10D650002946FFF74DFD0028E9D1287840060DD571 +:10D660000121684601710599018101884181868106 +:10D67000C48101A805F01FFD0028D8D12888AA7808 +:10D680008107890D11438005800FEA78000210435D +:10D69000079A964207D04C4A914204D3611E8142B8 +:10D6A00001DD0B20C3E7864201D90720BFE7801BBD +:10D6B00082B2A24200D922461098002800D00280EF +:10D6C0000F98002802D0B9190FF0CAF80020AEE771 +:10D6D000F8B51D4617460E4600F053F8040008D072 +:10D6E0002078000607D53748807AB04203D88720D3 +:10D6F000F8BD0120F8BD224639463046FFF725FD2A +:10D70000002D0BD02078A1788007800D08432E498A +:10D71000884201D2012000E0002028700020F8BDDE +:10D72000F8B51E4617460D4600F02BF8040008D049 +:10D730002078000607D52348807AA84203D887209E +:10D74000F8BD0120F8BD224639462846FFF724FDE2 +:10D75000FF2E14D02588A178A807800D08431A4908 +:10D760000FF0E7F8002E03D1FF31FF31033189B20A +:10D77000A170A80880008905890F08432080002037 +:10D78000F8BD1049CA88824207D3002805D00C2270 +:10D79000096850430C38081870470020704703B5DB +:10D7A0000846694609888A0607D4090604D505494A +:10D7B000897A4143491C88B20CBD00200CBD000091 +:10D7C000FFFF00002810002001020000F8B50778D4 +:10D7D0000D460446012F19D0072F02D00C2F19D166 +:10D7E00014E0A068216906780B2E0BD00520FEF707 +:10D7F0007CFF052E0ED07823002205202169FEF73C +:10D80000CFFE07E0782300220620F8E705202169F3 +:10D81000FEF76BFF002D0ED0002028702946204611 +:10D8200003F036F9FE482978C05D884201D1032013 +:10D83000F8BD0220F8BD0021204603F029F90020A0 +:10D84000F8BD70B50E460C462036317901208AB0FD +:10D850001546002909D0012905D12978042902D1CA +:10D860000520107000200AB070BD6068019005A806 +:10D8700002900D21C01C0FF050F8032205A8A168EA +:10D880000EF0EEFF01203071062069460870206A14 +:10D89000049029466846FFF799FFE4E770B50C4607 +:10D8A000154620310A790120062686B0002A2CD0A0 +:10D8B000012A28D12978042925D169681022A06875 +:10D8C00001F0B4F96868C07B000606D5D44AA068A8 +:10D8D0001023103A014601F09EF91022A168E06879 +:10D8E00001F0A4F9A068C07B000606D5CC4AE06828 +:10D8F0001023103A014601F08EF92E70A06868607E +:10D90000E068A860002006B070BD60680190C4485F +:10D91000203802900120087168460670206A049041 +:10D9200029466846FFF752FFEDE7027B032A06D03F +:10D93000002224235A540B78092B02D003E0042040 +:10D9400070470A76CA61027B9300521C0273C15071 +:10D9500003207047F0B50E4615460C4620360246A9 +:10D9600031790120072393B000290CD0012924D05C +:10D9700002292ED0032904D12978042901D12B7042 +:10D98000002013B0F0BD01203071606800280DD078 +:10D99000A1690B7060684860206988606069C86030 +:10D9A000206A08621046FFF7C0FFEAE706202870E9 +:10D9B000206968606069A86009E029780629E0D1DB +:10D9C00002203071042028709548203868600320B8 +:10D9D000D7E729780429D4D1A08910280AD910388A +:10D9E00080B2A081A1681023091805A86A6801F017 +:10D9F00012F923E010282FD0C2B21020801AA1689B +:10DA00000DAF1190C0190EF02BFF11980006000EFB +:10DA100006D0401EC1B28020785438460EF07DFFFB +:10DA2000626910230DA909A801F0F5F8102309A9CE +:10DA300005A86A6801F0EFF8032030716068019072 +:10DA400005A80290062069460870206A04902946BD +:10DA50006846FFF7BBFE94E710232269A168E2E75E +:10DA6000F0B50E460C4620363179012006278FB0DE +:10DA7000154600290BD0012932D0022905D1297879 +:10DA8000042902D10820107000200FB0F0BD217DC4 +:10DA900008A8CA07D20F02718807C10F08A8017130 +:10DAA0006846027041700722801CE1680EF0D8FEC3 +:10DAB00002A80722013021690EF0D2FE60680590AD +:10DAC0000AA8069010236A46A16801F0A4F8012074 +:10DAD000307168460774206A0890294604A820E03F +:10DAE00029780429D1D1062205A8E1690EF0B8FEF3 +:10DAF00006A806220230A1690EF0B2FE00200890AE +:10DB00006068019009A80290102305AA696801F0D5 +:10DB100082F80220307168460770206A0490294616 +:10DB20006846FFF753FEB0E770B50D460C4620354A +:10DB3000297901208CB01646002909D0012905D188 +:10DB40003178042902D10920107000200CB070BD7A +:10DB50006068019006A802900822E1680EF080FE3D +:10DB6000082208A8A1680EF07BFE0120287106207B +:10DB700069460870206A049031466846FFF726FE21 +:10DB8000E4E770B50D460C462035297901208CB0AC +:10DB90001646002908D00129D8D131780429D5D1D9 +:10DBA0000A2010700020D1E76068019006A802905A +:10DBB0000822A1680EF054FE002008900990012070 +:10DBC0002871062069460870206A0490314668462C +:10DBD000FFF7FCFDBAE730B50B4620331C79012076 +:10DBE0008BB0002C09D0012C05D11178042902D169 +:10DBF0000B20107000200BB030BD4868019005A8C4 +:10DC000002908C6868462578057564784475CC6800 +:10DC1000257885756478C47500200690079001E02A +:10DC200018CF010008900120187106236846037080 +:10DC3000086A049011466846FFF7C8FDDBE770B537 +:10DC40000C462034034625790120002D0AD0012DF1 +:10DC500014D0022D05D111780A2902D10C201070A0 +:10DC6000002070BD01202071C868052202704A683A +:10DC70004260F84A8260921CC2600BE015780B2D5E +:10DC8000EFD102202071C8680424047052684260F9 +:10DC90008A688260096A016201461846FFF745FEFC +:10DCA00070BD30B5011D0246313294780325837969 +:10DCB000ED432C4323408371DB070DD04B7954791E +:10DCC00023404B710B79127913400B718278C9781C +:10DCD0008A4200D9817030BD00224A710A71F5E78D +:10DCE000F7B50C4686B000206946264608702036F7 +:10DCF000317901271E2015461F2977D24B007B441E +:10DD00009B885B009F441E0017023E025602690278 +:10DD100088029A02D102F5022E03590371037F0390 +:10DD2000AE03C303CC03F7031A0464049A04AB04E0 +:10DD3000DF04FE0410052A0565059B05C60583055D +:10DD400087058B056069002802D0007813287DD0F4 +:10DD5000A0680590002849D0012168460170206A1A +:10DD600004900321684601710A214171E069029023 +:10DD700020790028EFD0059909780029E7D00C29EF +:10DD800064D20B000FF010F80CFD1A4B90B5E8FCB4 +:10DD9000FBFAF9F807FD022828D16069002802D0B3 +:10DDA0000078082852D1022168460170206A049048 +:10DDB00005984178684601710021B9E20620216A80 +:10DDC000FEF793FC20790728E6D1606900F050FF48 +:10DDD00002280CD0606900F04BFF042807D060696E +:10DDE0000028B8D000780128D6D103E01BE2616991 +:10DDF0000120087005980079C11F0A2901D30A2063 +:10DE000050E06169072288706069059930300EF032 +:10DE100027FD0120307161690320087034E0072874 +:10DE2000BAD16069002896D001780929B4D1059942 +:10DE3000C978890707D1059949790029DFD1059962 +:10DE400089790029DBD105994A7900E04EE2014643 +:10DE500020314B7D9A43D2D1059A8B7D92799A439A +:10DE6000CDD1059A1279D31F0A2BC8D209799142D4 +:10DE700036D80722C01C05990EF0F2FC0120307143 +:10DE800061690A200870032069460870206A0490BE +:10DE90006069313001906069001D029060691C303A +:10DEA0000390A1E22076F2E311288DD1606900F0A1 +:10DEB000DFFE042804D0606900F0DAFE0B2893D15D +:10DEC0006069059910223730491C0EF0C9FC606961 +:10DED000017804297CD12421095C8278914201D9FE +:10DEE0000620DFE7052101700320307168460170CC +:10DEF000E2E3112894D1606900F0BAFE062804D04C +:10DF0000606900F0B5FE0C288AD1E068002813D0C3 +:10DF10002069002810D060690178062910D00D21F1 +:10DF200001706069059910225730491C0EF098FC69 +:10DF30006069573009218CE100206946087072E160 +:10DF4000072101706069059910224730491C0EF0C5 +:10DF500087FC60694730EDE70228F0D1606900F086 +:10DF600087FE0028EBD0606900F082FE0128E6D031 +:10DF7000606900F07DFE05E0B1E08DE06CE02AE034 +:10DF80000AE0D6E00828DAD0052168460171059834 +:10DF900041786846417146E11128D0D16069002876 +:10DFA000CDD001780E29CAD1C16A4078022810D09C +:10DFB0000020142250431430085805991022491C9F +:10DFC0000EF04EFC0520216A00F040FE0F205EE0BE +:10DFD000F1E10120EDE70B28B1D160690028AED056 +:10DFE00001780F29ABD1C16A4078022826D00020E1 +:10DFF000142250430C300958059842780A708078F2 +:10E0000048706069C16A4078022819D00020142243 +:10E0100050431030085805990822C91C0EF020FC06 +:10E020000520216A00F012FE60694178022909D0BA +:10E0300000220832825C5208520073E00120D7E7C8 +:10E040000120E4E70122F4E7012100E0002108318A +:10E050004254BCE3F2CE010011289CD16069002833 +:10E0600099D00178102996D1C16A4078022811D040 +:10E070000020142250431830085805991022491CDA +:10E080000EF0EEFB0520216A00F0E0FD1120616931 +:10E090000870B4E30120ECE7082884D16069002807 +:10E0A0009DD00178112997D10599C06A49780170EE +:10E0B00060690599C06A0622401C891C0EF0D0FBDD +:10E0C0000520216A00F0C2FD60694178022904D070 +:10E0D00000220832825CFD2323E00122F9E71128A7 +:10E0E000BBD160690028BBD001781229B5D1C16AC3 +:10E0F0004078022819D00020142250431C300858C0 +:10E1000005991022491C0EF0ABFB0520216A00F096 +:10E110009DFD60694178022909D000220832825CA5 +:10E12000FB231A40022991D18EE70120E4E7012266 +:10E13000F4E70720B6E6287801288ED1606969687F +:10E1400014221C30F3F74CF86069017F002901D0DC +:10E150002176ACE30178032901D0032037E00227C0 +:10E16000C77081794907490F8171017A4907490FC1 +:10E170000172417A4907490F41726069FFF791FDC9 +:10E18000377196E228780F28E3D107206946087096 +:10E19000216A0491916802916946087161690722B8 +:10E1A000C91C02980EF05CFB616904200870002015 +:10E1B0003071BBE028780328CBD16069017805294C +:10E1C000696807D0082247300EF04AFB04203071FE +:10E1D00005206FE208225730F6E728780328B8D1E7 +:10E1E000606901780529696811D008224F300EF066 +:10E1F00037FB052030716069006A00280AD00220D0 +:10E200002870002028716069006AA860F9E008227F +:10E210005F30ECE704204DE22878022899D1287974 +:10E22000002801D0207642E36069A9680162606934 +:10E23000002901D1F949016206200BE228780F2854 +:10E2400087D1A868E0616069017805292BD0473043 +:10E2500007213171E16802220A706269126A4A601C +:10E26000886060693030C8606069C01C086162699C +:10E27000087D926A400812784000D207D20F1043FE +:10E2800008756269926A521C8A61FD2210406269B7 +:10E29000D26A1278D207920F104308756069C06A7B +:10E2A000401CC86153E25730D2E728780828BAD119 +:10E2B0006069017805291AD00B2101700720694691 +:10E2C0000870206A0490E069029011200871029899 +:10E2D0000321017051681022401C0EF0C1FA002188 +:10E2E0006846FFF773FA00203071E06187E206218B +:10E2F000E3E728780F2896D1072069460870206A3E +:10E300000490A868029011200871029804210170FD +:10E3100061690A78072A0ED0002232710C220A7035 +:10E3200061691022401C47310EF09AFA00216846BC +:10E33000FFF74CFA63E21022401C57310EF090FABE +:10E3400000216846FFF742FA0A203071E168032095 +:10E3500008706069006A4860606957308860606969 +:10E360004730F3E128780828A1D160696968102254 +:10E3700037300EF048FA002801D0042092E5606999 +:10E380000078072817D00A203071E1680320087050 +:10E390006069006A4860606957308860606947302A +:10E3A000C860206A08620698FFF7BFFA07466069EE +:10E3B000FFF777FC6BE208207AE1287809289AD1E8 +:10E3C0000B20307161696868897810224018511AF1 +:10E3D0000EF0A3FA082069460870206A0490686865 +:10E3E000019060698078087268E129780D29BBD1B5 +:10E3F00061698979C90703D00C20307109203EE09A +:10E400003071032770E228780E28ADD1606914229C +:10E41000291D1C30F2F7E4FE6069018DC06A41726B +:10E42000090A817260698178C06AC1716169CA6ACA +:10E43000081D117AC909C90111724379626919432A +:10E440008378D26A9B079B0F012B00D000230079B1 +:10E450009B01C00003431943117260694078012891 +:10E4600076D0B4E160694178022901D0012100E051 +:10E4700000210831405CC00707D00E20EAE0694661 +:10E480000870206A1146049019E11320B8E7287833 +:10E490000F2894D1A868E0610F2030710520EEE7C5 +:10E4A000287803288BD16069C16A4078022801D09E +:10E4B000012000E0002014225043103008580822A8 +:10E4C00069680EF0CDF910203071E16806202269EC +:10E4D00008706069406A48606069C36A40780228D1 +:10E4E00001D0012000E00020142778431030185894 +:10E4F000CA6088602BE128780C2886D16069C26ADE +:10E500004078022801D0012000E000201421484377 +:10E510000C30105802230932696800F07CFB11208E +:10E520003071E168052008706069006A48606069C0 +:10E53000C06A093088603948001F07E128780B2835 +:10E54000A7D161694878CA6A022802D0012001E097 +:10E5500059E1002014235843143010588A78696810 +:10E560000EF07EF960694178C26A022901D001216A +:10E5700000E0002114235943143152588178501877 +:10E580001022511A0EF0C9F9072069460870206A56 +:10E590000490E06902901120087102980621017030 +:10E5A0006169CA6A4978022901D0012100E000218D +:10E5B00014235943143151581022401C0EF050F9C5 +:10E5C00000216846FFF702F90020E06112206FE0A9 +:10E5D00028780F2891D1072168460170206A04909D +:10E5E000906802900B22684602710298017061697E +:10E5F000CA6A4978022901D0012100E000211423D0 +:10E6000059430C3151580A784270497881706169D8 +:10E61000CA6A4978022903D0012102E0F8CE01003C +:10E62000002114235943103151580822C01C0EF008 +:10E6300017F900216846FFF7C9F826E760694178B5 +:10E64000022901D0012100E000210831405C80074F +:10E6500003D5142030710A2011E71620D0E628785F +:10E660000F287AD1A868E061072069460870206AFF +:10E670000490E0690290112008710298082101704D +:10E680006169CA6A4978022902D0012101E011E1D9 +:10E69000002114235943183151581022401C0EF008 +:10E6A000DFF800216846FFF791F80020E0611520AF +:10E6B00030710A2069460870206A0490294668462D +:10E6C000FFF784F82BE028780F2846D10720694609 +:10E6D0000870206A049090680290082008710298DF +:10E6E0000921017061690622C9690978417061696F +:10E6F000801CC969491C0EF0B3F800216846FFF779 +:10E7000065F8AAE760694178022901D0012200E09A +:10E7100000220832805C400703D51720C8E707466F +:10E72000B5E0012953D070E028780F2815D1A868EA +:10E73000E06118203071E168052008706069006AA6 +:10E7400048606069C06A09308860F848C860206A1B +:10E7500008620698FFF7E9F8E1E76FE028780B28F0 +:10E760006CD16069C16A4078022801D0012000E0C4 +:10E770000020142250431C300858102269680EF003 +:10E780006FF8072069460870206A0490E0690290DB +:10E790001120087102980A2101706169CA6A4978DA +:10E7A000022901D0012100E00021142359431C312A +:10E7B00051581022401C0EF053F800216846FFF714 +:10E7C00005F80020E0616069407801281DD119201A +:10E7D00016E660694278022A09D000210831411802 +:10E7E000097800290DD0CA0703D00E2106E00121C7 +:10E7F000F4E7890701D5102100E0122101700027FC +:10E8000072E0012A01D00D20FAE51C20F8E51D2058 +:10E8100030710B2033E62978102948D1F0E5606982 +:10E820000178012943D0082941D00021317100F03D +:10E8300019FA0C2069460870206A049037E028789D +:10E840000F2805D01020107003271B2030714BE0DB +:10E85000072168460170206A0490A868029002218E +:10E8600068460171029805210170217E41700021E6 +:10E870006846FEF7ABFF0B2168460170206A0490E2 +:10E8800029466846FEF7A2FF07461B203071012F7C +:10E890000DD029E0012168460170206A049004210E +:10E8A00068460171217E41710020207612E0207EB1 +:10E8B00000280FD06169132008701A2030710A20D7 +:10E8C00069460870206A049029466846FEF77EFF74 +:10E8D000074609E06069002801D0142101706846EC +:10E8E0000078002800D021E5384609B0F0BDF7B522 +:10E8F0000F4620373879012686B00C46002804D010 +:10E90000012828D002281CD197E02079012804D0C2 +:10E91000022811D0032814D10AE0A0684078012809 +:10E920000ED10620216AFDF7BAFE00287FD10CE047 +:10E93000A1681320087008E0A0684178022901D07E +:10E94000052674E00078082871D1012038710A206A +:10E950006946087033E0089800780F2867D10721CE +:10E9600068460170206A04900898856802952279AB +:10E970000220012A04D0022A29D0032A57D10FE00D +:10E980000646684606710B202870207B0021400750 +:10E99000400F68706846FEF719FFA068067045E0F2 +:10E9A00006466846067105202870207B68700021A5 +:10E9B0006846FEF70BFF3E710B2168460170206A26 +:10E9C000049068460899FEF701FF06462FE0684666 +:10E9D000017101202870207C6870607CC007C00F26 +:10E9E000A870A07C4007400FE870E17C2971C00747 +:10E9F0001FD0207D4007400F6871607D4007400FA9 +:10EA0000A87100216846FEF7E1FEA06807222946AA +:10EA100030300DF025FFE068017AA06820300171E8 +:10EA2000A16828798870A1680920087000263046FE +:10EA30005BE70020A8716871E3E7A1681420087003 +:10EA4000012168460170206A049004216846017122 +:10EA5000217B41710021FEF7B9FEE7E7F0B585B0F3 +:10EA60000F4605460124287B800040198038C66F78 +:10EA70003078411E0A290AD22C49800032314018D0 +:10EA80008038C36F3A463146284698470446002CE2 +:10EA900001D0012C11D1287B401E0006000E2873E6 +:10EAA00001D00324DFE70D2069460870306A049026 +:10EAB000002101966846FEF789FE032CD3D020463C +:10EAC00005B0F0BD70B515460A4604462946104605 +:10EAD000FFF7C4FF0646002C0FD0207814280CD175 +:10EAE000207E002806D000202870204629460C30C1 +:10EAF000FFF7B4FF204600F0B5F8304670BD704710 +:10EB000010B5012903D0022901D0052010BD4170A4 +:10EB100000F0A8F8002010BD002809D0027E002ACD +:10EB200006D00A4601460C31CCE70000F6CE0100C3 +:10EB30000120704730B5044687B00D460620FDF72A +:10EB4000D4FD29460520FDF7D0FD2078142805D0F6 +:10EB50000020694608702046FFF7DEFF07B030BD91 +:10EB60007FB50E4600216A4611730178092903D04A +:10EB70000A2903D0002407E0446900E08468002CDF +:10EB800002D0217E002912D0154601462846FEF704 +:10EB9000CCFE032809D1324629462046FFF792FFD2 +:10EBA0006946097B002900D0042004B070BD2546C9 +:10EBB0000C35EAE700B50023012285B005280CD00A +:10EBC000062808D168460270049102210171437140 +:10EBD0000021FEF7FBFD05B000BD68460270049100 +:10EBE0000271F4E710B590B00C4605216A46117029 +:10EBF000019022480290001D03900AA96846FFF781 +:10EC0000AFFF002805D1102220460B990DF028FEF9 +:10EC1000002010B010BD30B505E05B1EDBB2CC5C4F +:10EC2000D55C6C40C454002BF7D130BD10B5002426 +:10EC300009E00B78521E5B00234303700B78401CE5 +:10EC4000DC09D2B2491C002AF3D110BD70B50C46C4 +:10EC50000546FDF74AFD7823002221462846FDF7A8 +:10EC60009FFC70BD4178012900D0082101707047D8 +:10EC7000002801D00078704708207047F0CE0100CE +:10EC800070B50D46040012D0002D10D02101284689 +:10EC90000DF043FE1022544928460DF0E1FD524884 +:10ECA00001210838018044804560002070BD0120AA +:10ECB00070BD70B54C4E00240546083E11E07168E9 +:10ECC00020014018817BAA7B914209D1C17BEA7B5C +:10ECD000914205D10C2229460DF095FD002806D061 +:10ECE000641C30888442EADB0020C04370BD2046AB +:10ECF00070BD70B50D4606000AD0002D08D03A4C04 +:10ED0000083C20886188401C884203D9042070BDDB +:10ED1000102070BD3046FFF7CCFF002801DB401CFF +:10ED20000AE02088616800014018102231460DF089 +:10ED300097FD2088401C20802870002070BD70B591 +:10ED400014460D001FD0002C1DD00021A1700228F8 +:10ED500002D0102817D108E068782978000208430B +:10ED600011D00121A17010800BE02846FFF7A1FF10 +:10ED7000002808DB401CA070687B297B0002084348 +:10ED80002080002070BD012070BD70B5054614467E +:10ED90000E000AD000203070A878012807D004D9CE +:10EDA000114908390A8890420BD9012070BD002C06 +:10EDB00004D0287820702888000A5070022008703B +:10EDC00010E0002C0CD049680001411810222046A8 +:10EDD00010390DF045FD287820732888000A6073EB +:10EDE00010203070002070BD4C01002070B5FD4D2A +:10EDF000040008D0012C10D0022C07D0032C05D021 +:10EE0000F9A1702007E0F8A1672004E02878012824 +:10EE100003D0F5A16D200DF0AEFE2C7070BD70B565 +:10EE2000F04D044610280AD0112C16D028468178BF +:10EE3000122C07D0132C0AD0EBA19F200BE0EAA1E3 +:10EE4000942008E0112908D0E7A1992003E01129B6 +:10EE500003D0E5A19C200DF08EFEAC7070BD10B506 +:10EE6000E04894B0007B002819D01720694608704C +:10EE7000DC4900A806220D3102300DF0F1FC09A991 +:10EE8000684606F056FA0446112805D0002C03D037 +:10EE9000D5A1BB200DF06FFE204614B010BD32206E +:10EEA000E4E710B501220023114606F03FFB10BD38 +:10EEB000FFB595B01D460E460746FFF7F2FF04006A +:10EEC0000AD02078222804D3A07F8006C00FA84251 +:10EED00004D1082019B0F0BDC748FBE737216846C8 +:10EEE00001704780002D05D00121017146711799ED +:10EEF000817102E000206946087109A9684606F0A0 +:10EF000018FAA07FDF21084069010843A07700209C +:10EF1000E0E770B50446084620380D4603000DF0C2 +:10EF200043FF0A060A11232C334249505761FF2040 +:10EF3000ADA1083052E02078202851D1FF20AAA1AD +:10EF40000B304BE0A7480178032949D0807813287B +:10EF500046D02078242843D0252841D023283FD0EC +:10EF6000FF20A1A10E3039E02078222838D02328B4 +:10EF700036D8FF209CA1153030E0207822282FD0F1 +:10EF8000FF2099A1193029E02078222828D02428B0 +:10EF900026D0262824D0272822D0292820D0FF2098 +:10EFA00091A11C301AE02078252819D0FF208EA1CD +:10EFB000233013E02078252812D0FF208AA12630A4 +:10EFC0000CE0207825280BD0FF2087A1293005E010 +:10EFD0002078282804D0FF2083A12C300DF0CBFD11 +:10EFE000257070BDFF2080A12F30F7E730B5834C2E +:10EFF0000B88834A022801D0934204D09D1FA5426A +:10F0000025D2022802D04D88954203D04D88AD1FED +:10F01000A5421CD24C88A34219D88B88FF25F43511 +:10F02000AB4214D8022802D0C888904205D0C888C4 +:10F03000724D0A382D1FA84209D2C888904208D0C4 +:10F04000944206D05B1C63438000834201DB0720AF +:10F0500030BD002030BDF0B56A49884245D36A4AC8 +:10F060000125AD041368A84201D398423DD302792B +:10F07000002A06D0082A02D8067B082E05D90720C8 +:10F08000F0BD047B002CFAD0F6E7002A06D0046815 +:10F090008C422AD3AC4201D39C4226D3002E06D008 +:10F0A00084688C4221D3AC4201D39C421DD30024FE +:10F0B0000CE00568A700ED598D4216D30127BF0467 +:10F0C000BD4201D39D4210D3641CE4B2A242F0D8E9 +:10F0D00000220125AD040CE084689700E4598C42BD +:10F0E00003D3AC4203D39C4201D21020F0BD521C8A +:10F0F000D2B29642F0D80020F0BDFFB50022099BA5 +:10F10000002802D0994205DC58E0002902D10020F5 +:10F1100004B0F0BD0920FBE7845C002C12D08718F6 +:10F120007D78112D43D010DC2B000DF03DFE0A4000 +:10F130001726262C2C2E2E363640835C002B30D101 +:10F14000521CD2B28A42F8DBE1E71C2D2FDA123DC5 +:10F150002B000DF029FE042C2C121A2C022CD9D1D4 +:10F16000BB78039C072B237001D25B0701D40A20D4 +:10F17000CEE7029B01241B7816E0E343DB0708E09F +:10F18000012C08D013E00620C2E70F2523072D0726 +:10F190005B19002BF4D03046BAE7029B1B789C0722 +:10F1A00001D50B20B4E702242343029C2370835C27 +:10F1B000521C9A18D2B28A4202DDABE719267602B7 +:10F1C0008A42A9DBA3E710B504780B46002C1FD0B8 +:10F1D00001210E4A012C1ED0022C22D0032C2AD150 +:10F1E00025E00000341000207372635C6761705F7B +:10F1F000636F72652E630000023000007B0C00001C +:10F20000FFFF000000D001002001002002320000BA +:10F210000021197011E019708179890903290AD137 +:10F220000BE0197081798909012904D105E0197071 +:10F230008179890901D0104610BD411C0622581C55 +:10F240000DF00EFB002010BD08B51346002806D0B7 +:10F25000FEA00068009048796A468009105C18702A +:10F260000622581C0DF0FCFA08BD30B50C46097892 +:10F2700095B0222902D2082015B030BD2823694656 +:10F280000B704880132A03D03B2A01D00720F3E7F4 +:10F2900008460A7109A906F04CF8050003D121219E +:10F2A0002046FFF736FE2846E6E700B595B0232353 +:10F2B00069460B704880108888805088C880D08844 +:10F2C00048819088088100208881C88109A9684602 +:10F2D00006F02FF815B000BD70B50C00064610D032 +:10F2E000FFF7DFFD050003D1D949DA480DF043FCF3 +:10F2F000A6802889E0802889208168896081A88982 +:10F30000A08170BD70B50E46050003D00021092014 +:10F31000FDF7EBF90120D04C022E207324D0032EF0 +:10F3200004D0CC48CA491E300DF025FCCA4806213D +:10F330000D30FCF7FEFCA07C8006800EA074FFF769 +:10F340008EFDA08B00280ED0002D0CD08300012252 +:10F3500000210920FDF724F9092804D0BD48BC4943 +:10F3600028300DF008FC70BDBB4803211030FCF7BD +:10F37000E0FCA07C40218006800E0843A074B648C3 +:10F380000C3002F0D3F9DAE77FB501A9012006F0CD +:10F390004DF9002804D0AF48AD4967300DF0EBFBC4 +:10F3A000AE4E01A806F050F9050002D0052D4CD054 +:10F3B00048E0029CA07F01072CD520462230009017 +:10F3C00068462346628E80882146343301F039FB3B +:10F3D0000546A07FF7210840A077002D05D0B54253 +:10F3E0002FD09C489A49783029E0E17F4808890766 +:10F3F0004000C90F08432021095D4007400FC900A4 +:10F400000843E077207828281CD129212046FFF7DF +:10F4100080FD17E04007C4D5684622468088214613 +:10F420000E32FFF742FF0546A07FFB210840A07780 +:10F43000002D07D0B54204D08648854992300DF0A2 +:10F440009AFB0025284604B070BD0020FBE7F8B504 +:10F45000040004D1ED207E4980000DF08CFB722069 +:10F460002070606808250178091F0B000DF09CFCD6 +:10F4700011F90A3D5FF83D0EF8F83E3D3D3D3DF97E +:10F4800086F93D0073487249AA3074E0878838468F +:10F49000FFF707FD060004D16E486D49B2300DF04C +:10F4A0006AFB60780421284360706B4CA07F08439E +:10F4B000A07721213046FFF72CFDB07F8007800F19 +:10F4C000012801D1801EA080384605F05BFC38463B +:10F4D00002F0E2FF384604F0C4F839460220FDF796 +:10F4E00004F9B07FEF210840B077F8BD8688304638 +:10F4F000FFF7D7FC002804D156485549D0300DF00D +:10F500003AFB60688078012804D052485049D230D4 +:10F510000DF031FB60688179304605F052FD00281E +:10F52000E3D06178294361706168C880F8BD87883D +:10F530003846FFF7B6FC060004D146484449E3309C +:10F540000DF019FB60783946284360706068C08808 +:10F55000308160680089708160684089B0810220D4 +:10F56000FDF7C3F80020B075FFF70EFF0028DDD0CF +:10F570000120374980020DF0FEFAF8BD80783C2862 +:10F5800015D00027022815D00026002804D03148C5 +:10F590002F49F8300DF0EFFA00210846FDF7A5F8E5 +:10F5A00000210720FDF7A1F8002E05D046E0012735 +:10F5B0000026F1E70126EAE76078284360702648D4 +:10F5C000817F29438177002F38D160688688304653 +:10F5D00001F055F80546807F6168800889798000D0 +:10F5E000012900D002210843A87760680622C08A5A +:10F5F00028816068008B68816068408BA8816068A2 +:10F60000C079E87561682846183008310DF028F98E +:10F6100060680622807B68706168A81C0F310DF05D +:10F620001FF9A87F8107890F304605F094FBA87F5A +:10F630008007800F012801D107488680064801789D +:10F64000032913D08078132814D00BE00302FF01A4 +:10F65000E8F1000013030000341000200230000025 +:10F660000CE00FE0FF20FCA1453084E70120FFF70C +:10F67000BDFBF8BD1120FFF7D2FBF8BD204601F01D +:10F68000E8FCF8BD607828436070F8BDF7B5054622 +:10F690000078002700090C463E4601287ED0002253 +:10F6A000F14902287BD0072804D00A2878D0EAA1A3 +:10F6B000EE482DE1686803780D2B31D006DC042B71 +:10F6C0006FD0072B36D00A2B6AD106E0122B38D028 +:10F6D000132B40D0142BF7D1B2E011270726002CB2 +:10F6E00072D08088A0806968FB238979A171E04984 +:10F6F00005468A7F1A408A77032105F04FFF0421CF +:10F70000284605F04BFF0021284605F047FF02215F +:10F71000284605F043FF0121284605F03FFFF9E0A8 +:10F7200001270926002CDBD08088A08068688079BA +:10F730002072EFE012270E2680882146FFF7CCFDCD +:10F74000E8E01A270726002CCAD04088A080686805 +:10F750000079A071DEE081783C2936D010271E2682 +:10F76000002CBDD08088A0806868C08A208368682B +:10F77000C08AE0826868008B60836868408BA083E1 +:10F780006968207D497F4008C9074000C90F0843C8 +:10F7900020756968C007C00F497F03E05FE08AE019 +:10F7A000ADE01CE049084900084320756968A21DC6 +:10F7B000C8790831FFF748FD69682246887B0D3219 +:10F7C0000F31FFF741FD05E074E019270726002CF3 +:10F7D00070D0A271A648F722817F11407DE01B27DF +:10F7E0002E26002C66D0A1806968A21D0879491DCB +:10F7F000FFF72AFD68682030C07A60736868C078B7 +:10F800000428A07B19D040084000A073F9210840CB +:10F8100069681F22C9788907490F0843A07369687E +:10F820004007C97A400FC9000843A07369682046A1 +:10F830000F300C310DF014F86CE001210843E4E7BF +:10F840001E270E26002C6DD0A1806868E21D407A2C +:10F85000A07169688878C91CFFF7F6FC5AE0287A1D +:10F86000012805D0022815D080487BA132384FE00E +:10F870001D270E26002C55D06888A080A889E0801E +:10F88000E8892081288A6081688AA0817848DF22FF +:10F89000817FA2E712270E266888FFF71DFD002C46 +:10F8A00040D068784007400F032833D17048FD22CC +:10F8B000817F92E736E0287A03000DF075FA06049E +:10F8C00010102020202619270726002C2AD0A180DE +:10F8D0006748A271817F4908490081771AE019279A +:10F8E0000726002C1ED0A180287A012805D00320ED +:10F8F000A0715F48EF22817F6FE70220F8E7214681 +:10F900002846029A01F009FDFEBD532052A10001D4 +:10F910000DF031F90298002C068001D02780668016 +:10F920000020FEBD02980680FAE710B5504894B05A +:10F930008078132802D0082014B010BD2220694618 +:10F94000087009A9684605F0F4FC04460021072068 +:10F95000FCF7CBFE2046EFE700B5454895B0807830 +:10F96000122801D00820B5E41E216846017000214C +:10F970008170C17009A905F0DCFC0028F3D10021D9 +:10F980000720FCF7B2FE1120FFF749FA0020A1E49E +:10F9900000B5374895B00078022801D0032818D167 +:10F9A0001B2108A801730021817369460BA805F08B +:10F9B000C0FC002804D1684640781B2801D00320F1 +:10F9C00088E400210846FCF790FE6846807800280D +:10F9D00001D008207EE40120FFF708FA002079E436 +:10F9E000F8B5234C03000DF0DFF90A06801780807C +:10F9F00080804B356E80FFF7CBFF00282AD1FBF7C4 +:10FA0000AFFB002826D02221017000210172FBF7F4 +:10FA100088FBA07F012152E08EB23046FFF741FA09 +:10FA2000050004D111480CA12E300DF0A4F828785F +:10FA300021280FD0FBF794FB00281BD01221017066 +:10FA40000227077246800020A875FBF76AFBA07F9B +:10FA50003843A077F8BD00007372635C6761705F24 +:10FA6000636F72652E630000FFFF00003605000023 +:10FA700034100020132229463046FFF7F6FBE9E751 +:10FA8000A578122D06D0132D07D0FA49FA480DF0AB +:10FA900072F8DFE7FFF760FF01E0FFF746FF00289D +:10FAA000D8D1FBF75DFB0028D4D022210170122DA4 +:10FAB00007D002210172FBF734FBA07F102108431D +:10FAC000C7E70121F6E7A07C810901290BD0800955 +:10FAD00004D0E948E74922300DF04DF80321002019 +:10FAE000FFF710FCB6E70221F9E7E348E1492930C6 +:10FAF000CDE7F7B514460D0004D1DF48DD493130BC +:10FB00000DF039F828780827012807D002281FD0DF +:10FB1000D948D84962300DF02EF8FEBD0098FFF7A5 +:10FB2000C0F9060004D1D448D24938300DF023F88A +:10FB30000220B0751030207060783843607007CDB7 +:10FB4000083407C4CD482022817F11438177FEBD50 +:10FB50000098FFF7A6F9060004D1C748C54946300A +:10FB60000DF009F8A988C648814208D1EA88824286 +:10FB700005D1132231460098FFF777FBFEBD814285 +:10FB800002D1E888002809D012202070607838431C +:10FB9000607007CD083407C4002006E078230022F7 +:10FBA00002200099FCF7FCFC0120B075FEBDB348B3 +:10FBB00040897047FFB591B0149800F0DBFD002834 +:10FBC0005DD10124684603218471C902818000222D +:10FBD00001A9204604F017F8002850D168461521E5 +:10FBE00084714902818000261C2102A800960CF035 +:10FBF00096FE012001466846103101700020014642 +:10FC0000684641708178F9273940891C2143817009 +:10FC1000017A02252943017212998186C6861F2125 +:10FC200001870C9011980F9001A80B9009AA0BA9BD +:10FC300002A803F0B3FD002821D168468F4E808CC6 +:10FC4000F080684684718F498180807809AA3840A5 +:10FC5000801C41084900684681708586058713A885 +:10FC60000F900BA902A803F099FD002807D1684660 +:10FC7000808C308131460A31149800F08EFD15B029 +:10FC8000F0BD30B50C46804995B08C4241D37F49D8 +:10FC9000012292040968944201D38C4239D320385E +:10FCA0000022012503000DF07FF806042F494D5373 +:10FCB0005C6400210820FCF7F2FC002802D011202F +:10FCC00015B030BD24206946087000A80522A11C8B +:10FCD00002300CF0C5FD09A9684605F02AFB0500B5 +:10FCE00002D0082D0ED031E008230022114618461C +:10FCF000FCF756FC082829D05F485E49D6300CF046 +:10FD00003AFF23E00620DBE76068002803D0884242 +:10FD100001D21020D4E73D2168460170218841803E +:10FD20006188818009A905F004FB05000ED1606897 +:10FD300000280BD06946098D018007E0206801F09A +:10FD400037FD02E0204600F0D8FC05462846B7E71C +:10FD50003E2007E0857000E0827009A905F0E9FA0D +:10FD6000F3E73420694608702078C0076846F3D06E +:10FD7000F0E70720A4E730B50C46444995B0096880 +:10FD80008C4201D210209BE7203803000DF00CF8C4 +:10FD900005042121232132002088FFF782F8002862 +:10FDA00004D00078222803D2082089E7384887E762 +:10FDB0002521684601702188418009A905F0B9FA1A +:10FDC000050015D10AA905220231A01C0CF048FD3E +:10FDD0000EE006250CE02068002805D0884201D2FC +:10FDE000102505E001F0D9FC24480025808BA08077 +:10FDF000284665E7072063E720481330704710B5B1 +:10FE000020211E480CF089FD0120FEF7EFFF112094 +:10FE1000FFF705F800211948C94381800021817648 +:10FE2000E1218900818301460C300D310446FBF746 +:10FE300017FA12480722214613300CF011FDFFF784 +:10FE40000EF8002803D00B4912480CF094FE01F084 +:10FE500093F810BD10B504463C210CF05EFDA07F68 +:10FE600080088000A077202020700020A07520341A +:10FE7000607010BD58FA00008C050000341000209E +:10FE8000FFFF0000012A000000D001002001002037 +:10FE900002300000FB0600007047FEB50546FF4833 +:10FEA0000C46814207D301208004844205D3FC48DC +:10FEB0000068844201D21020FEBD002D02D0012D29 +:10FEC00032D126E0F74908220F4668460CF0C8FCFC +:10FED00039462046FFF777F90028EDD1FEF7BFFF3E +:10FEE000060006D00722694638460CF0B9FC3046B9 +:10FEF000FEBD2078002801D0012805D1E94807225D +:10FF00003946C01D0CF0ACFC00210920FCF7EDFBCC +:10FF10000FE00978002907D0012905D0022905D072 +:10FF2000032903D0E048FEBD0720FEBD0120FFF7F6 +:10FF3000E9F9DC480C3885760020FEBD10B5D849BB +:10FF40000968884201D2102093E7D64902460C394D +:10FF50000B7B0D311846FFF777F9002089E7FFB5D5 +:10FF600099B00546002069460871087208A908740E +:10FF700008751446CA480122C849920400681E4602 +:10FF8000002D05D08D420BD3954201D3854207D376 +:10FF9000002C08D08C4203D3944204D3844202D272 +:10FFA00010201DB0F0BD2846204318D01F270CABF1 +:10FFB00001AA009728461A99FFF79FF80028F0D168 +:10FFC0000DAB02AA314620460097FFF796F80028AD +:10FFD000E7D16846007AC10703D00A20E1E707208D +:10FFE000DFE7800705D568460079800701D50B203B +:10FFF000D7E703AF002D0FD01A20694608731A986F +:020000040001F9 +:1000000088732946F81C1A9A0CF02AFC0EA903A83A +:1000100005F08FF90028C4D1002C0ED020216846AD +:100020000173867332462146F81C0CF019FC0EA9A8 +:1000300003A805F07EF90028B3D19A4908A8007CEE +:100040000C3948700020ACE770B504460A202070D7 +:100050000D46204605F06DF9002805D139202070A5 +:100060002946204605F065F970BDF7B500260C4617 +:1000700005460B271AE02968B000095809780029BD +:1000800003D0012901D00720FEBDA17029680622F6 +:100090000958E01C491C0CF0E3FB2770204602992C +:1000A00005F047F90028EFD1761CF6B22879B04266 +:1000B000E1D800263A270FE0A868B1004158102285 +:1000C000A01C0CF0CDFB27702046029905F031F9F9 +:1000D0000028D9D1761CF6B2287BB042ECD800209B +:1000E000FEBDF0B5044671A003C897B06B4B002766 +:1000F000159114909C4211D369480125AD04026802 +:10010000AC4201D3944209D32078012809D1616817 +:10011000994203D3A94204D3914202D2102017B0CE +:10012000F0BD60490C390A78012A0CD18A88614BEC +:100130009A4203D0002806D0012804D08A7F1307F2 +:100140009B0F06D101E00820E9E7D30701D1910711 +:1001500001D51120E3E7218A574B0A46203A9A42FB +:1001600007D3012875D1002973D1628A002A70D182 +:1001700011E0022801D0032801D1A02969D3012868 +:1001800009D0484A0C3A5278D20704D0628A002A31 +:100190005FD0B42A5DD8002806D0012808D00228F4 +:1001A00004D0032855D117E0002518E0022516E0F9 +:1001B000002902D1608A00280CD0042560680078EC +:1001C00000280CD0012809D0022807D0032805D028 +:1001D0003548A4E70125F1E7032500E00127207A4F +:1001E000002806D0012806D0022806D003287CD19A +:1001F00005E0002604E0012602E0022600E00326D6 +:10020000002D01D0022D14D1002E12D0E068FEF78F +:1002100022FF002883D123480C384078800702D081 +:100220002148401E7BE7022D03D1022E5DD0032E14 +:100230005BD0182168460170218A4180218A818023 +:10024000857118480C38007B002803D001286FD135 +:1002500004E04AE000216846C17102E001206946DD +:10026000C8716846077221780930012937D0062104 +:100270000CF053FB69460E74207D8207C107D20F34 +:100280004007C90F5200C00F11438000014314A85A +:10029000405C6946C873002827D00FE000D00100F9 +:1002A0002001002040100020023200000706050453 +:1002B00003020100FFFF0000E13F000009A96846BA +:1002C00005F037F8002884D109A96846FFF7BCFE7D +:1002D0000028A7D1002D0AD0022D08D010E06168B7 +:1002E0000622491C0CF0BCFAC4E7072017E7002ED1 +:1002F00006D009AA6946E068FFF7B7FE002891D149 +:100300001B20694608700120887009A9684605F01D +:1003100010F8002886D108A840791B2819D12B0095 +:100320000CF042FD0504040707040A00032001E065 +:100330000FE00220FEF75AFD012D0CD0608A002844 +:1003400009D00022830011461046FCF729F9002845 +:1003500001D00320E3E60020E1E6F3B5032687B0F1 +:100360000D4600290AD0FA4885426FD30120800447 +:10037000854203D3F7480068854267D30798FEF7A4 +:1003800090FD040005D02078222804D2082009B06E +:10039000F0BDF148FBE7A07F8707BF0F002D05D018 +:1003A00029463846FEF722FE0600F0D139460027DE +:1003B000EA48012907D0022931D0E949E9480CF07F +:1003C000DAFB3046E3E7A27D2946012A02D0827F8C +:1003D000920701D51120DAE700291BD108216A46CE +:1003E000049711820592418904AADF4803F0FBFFBC +:1003F0000028CCD16846008A082801D00320C6E72F +:100400006846018801814188418181888181C18854 +:10041000C18102A9079804F065FD0646D1E7A17DD8 +:10042000022916D1807F800613D4002D04D0A07F2E +:1004300040070CD4002100E00121079804F093FD4F +:100440000600BED1A775002DBBD004E01AE011262E +:10045000B7E7002D16D02A4621460798FEF725FF5C +:1004600006461128ADD1A07F4007AAD42046082215 +:1004700029460E300CF0F4F9A07F04210843A07740 +:1004800000269EE7102082E770B50C460546FEF771 +:1004900008FD010004D022462846FEF7E6FE70BDA6 +:1004A000AD4870BD00B50146143195B0192901D28F +:1004B000810707D001461E3104D00A3102D007203F +:1004C00015B000BD312269460A70887009A96846D6 +:1004D00004F02FFFF4E701B582B0022069460880DE +:1004E0009E4802AB00896A46002103F0E5FD69469B +:1004F0000988022900D003200EBD1CB500210091FF +:1005000002216A461180934901900968884201D20C +:1005100010201CBD91480189934803F064FF69468F +:1005200009880229F5D003201CBDF0B50E46884984 +:1005300085B0174605468E4207D3864801229204AD +:100540000068964204D3864202D2102005B0F0BD66 +:100550001F2F01D90C20F9E7804C8D4226D39542FC +:1005600001D3854222D3E08803A903F056FD002879 +:10057000ECD1287869464873E08803A903F02EFD82 +:100580000028E3D1694600900878022108436946B3 +:100590000870497B090703D00821084369460870A1 +:1005A000E088694603F0B3FC0028CFD169468F800C +:1005B000E088334601AA002103F07EFD6946898860 +:1005C000B942C3D00320C1E71CB50C4600210091FD +:1005D0000191228869460A805E49019009680028D5 +:1005E00001D0884201D38C4201D210201CBD0028CA +:1005F00001D0002A09D059486A46C1885A4803F0F8 +:10060000F2FE6946098821801CBD0C201CBD10B576 +:100610000123FEF74DFC2CE4002310B51A461946C1 +:10062000FEF746FC25E430B505464A4895B000681B +:100630000C46814202D2102015B030BD2846FEF78C +:1006400030FC002807D00178222902D3807F800661 +:1006500003D40820F0E74048EEE713216846017014 +:10066000458009A904F065FE0028E5D108AA0A2101 +:1006700051567F2901D02170DEE70520DCE7F8B56F +:10068000012304461A46194604F050FF0746012389 +:100690001A460221204604F049FF064601231A4665 +:1006A0000421204604F042FF054601231A46032197 +:1006B000204604F03BFF0446002F03D128492B4875 +:1006C0000CF059FA002E04D1AD20254980000CF021 +:1006D00052FA002D04D125482149801C0CF04BFA18 +:1006E000002C04D121481E49C01C0CF044FA2221E0 +:1006F0003846FEF70EFC3846F8BD10B504460068D3 +:1007000000280CD01249884207D30121890488426D +:1007100005D310490968884201D2102014E401F081 +:100720002FF8A0880D4CA083A07E01280DD10021B8 +:100730000920FBF7B4FF002800D00120A17C890923 +:10074000012915D00321FEF7DDFD002006E400009D +:1007500000D00100200100200230000034100020F1 +:1007600058FA0000C6090000FFFF0000B3020000B5 +:100770000221E8E75A4910B5884207D301218904CC +:10078000884205D357490968884201D2102010BD1C +:1007900001460120FEF72AFC10BD30B5044693B097 +:1007A00000200D46079014210BA80CF0B8F81C216E +:1007B00068460CF0B4F86A46112010770020507794 +:1007C000107802210843107007A80C90012008AA95 +:1007D000907245486A4610850AA80B9020881084BC +:1007E00060885084A0889084E088D084907FF9212C +:1007F0000840801C400840009077082090861087B1 +:1008000008A80F9010AA0BA9684602F0C7FF00289D +:1008100003D110A800882880002013B030BD3EB559 +:1008200004460820694608802D48844207D30120E9 +:100830008004844205D32B480068844201D21020F2 +:100840003EBD21460120FEF7D1FB0028F8D12088CB +:10085000694688806088C880A0880881E0884881CF +:10086000FFF7A5F901AB6A46002103F025FC6946B4 +:1008700009880829E4D003203EBD1FB504460020A6 +:10088000029008206946088115480391844207D3E5 +:1008900001208004844206D312480068844202D2B8 +:1008A000102004B010BDFFF782F9014602AA0F48DC +:1008B00003F099FD0028F4D169460989082901D07F +:1008C0000320EEE7694609882180694649886180EE +:1008D00069468988A1806946C988E180E1E700000E +:1008E00000D0010020010020042A0000FFFF0000CA +:1008F00030B5F74B9A4207D301239B049A4205D3A4 +:10090000F44B1B689A4201D2102030BD1578EB06DB +:100910005B0F042B07D85478072C04D39378102B43 +:1009200001D8A34201D2072030BDD3785B0702D49F +:1009300013795B0701D5062030BDC37FAC075B0888 +:100940005B00E40F2343C3770878EF231840137844 +:100950009B06DB0F1B0118430870F1231840137826 +:10096000DB065B0F5B0018430870507808730020AB +:1009700030BD30B500240C70C378DB07DB0F0B7083 +:10098000C578AD07ED0F6D002B430B70C5786D0773 +:10099000ED0FAD002B430B7014700179C907C90F1F +:1009A000117003799B07DB0F5B001943117000790D +:1009B0004007C00F80000143117030BD70B5144670 +:1009C0000D460646FAF7CCFB002809D0A22101709B +:1009D000142221460830F0F703FCFAF7A2FB70BDA1 +:1009E000132229463046FEF740FC70BD70B5144610 +:1009F0000E460546FAF7B4FB002809D02221017003 +:100A000045802178017261784172FAF78AFB70BDE6 +:100A1000132231462846FEF728FC70BD10B5AE4CB7 +:100A2000207C00280CD1204621461038FEF7DAF849 +:100A3000002803D0A9A1F2200CF09DF80120207419 +:100A400010BD70B594B015460C462C226946189E10 +:100A50000A704880002B17D00822194601A80BF015 +:100A6000FFFE68468581102231460E300BF0F8FEFD +:100A700009A9684604F05DFC002803D1A17F10227B +:100A80001143A17714B070BD002001900290E8E7F7 +:100A9000F0B50646008A97B080B20D460190FEF789 +:100AA00000FA04468C48317848380746E837099000 +:100AB0000B000CF079F90EFCFB48085F8798B8D959 +:100AC000FAF9F8F7F6FC002301221946019804F020 +:100AD0002DFD050004D1FF2080A130300CF04BF833 +:100AE000002C04D1FF207DA131300CF044F8387E79 +:100AF000C00904D078486030C06DA86112E02B2096 +:100B0000694608720BA902A804F013FC002804D05F +:100B1000FF2072A13C300CF02EF874490C980BF0B9 +:100B200008FFA9617068A862B068E862A07F8007CA +:100B3000800F012820780DD0252804D0FF2067A140 +:100B40004D300CF018F8324621460198FFF736FF79 +:100B500017B0F0BD2528F6D0222806D0242804D0CE +:100B6000FF205EA146300CF006F825212046FEF756 +:100B7000D0F9E8E7002301221946019804F0D6FCD9 +:100B8000060004D1FF2055A158300BF0F4FF002CD3 +:100B900004D1FF2051A159300BF0EDFF207825281A +:100BA00004D03078012108433070D1E7022028704A +:100BB000B068A860B068002802D000202871C7E79C +:100BC0000120FBE72B2069460870434968464C39F1 +:100BD00004F0AFFB002804D0FF2040A178300BF0D8 +:100BE000CAFF03201BE02A206946087000A81022D3 +:100BF000023071680BF034FE04A810220230B16894 +:100C00000BF02EFE344968464C3904F092FB002864 +:100C100004D0FF2031A189300BF0ADFF04202870F3 +:100C20000998686094E7B068002804D1FF202BA1E0 +:100C300095300BF0A0FFE07F400704D5FF2027A1EF +:100C400096300BF098FFB06806220A38009033798E +:100C50000421019803F041FF0028A6D0FF201FA126 +:100C60009B300BF088FF73E7002C04D1FF201BA101 +:100C7000A3300BF080FF2046223010220546716819 +:100C80000BF0EEFD28212046FEF743F9A07F8007F8 +:100C9000800F022814D100231A462146009501989E +:100CA00006E04BE1BAE0B0E095E03FE071E05FE1E3 +:100CB000FFF7C7FE11281BD029212046FEF729F98E +:100CC000E07F317A4007400FC9000843E0773FE7F3 +:100CD00000D0010020010020001100207372635C2D +:100CE0006761705F7365632E6300000040420F0010 +:100CF000A07F000704D5FF20FD49B0300BF03BFF7B +:100D0000A07F08210843A077002060862046343069 +:100D10000BF003FEE07FFD220146C9071040890F5A +:100D20000843E077307A2034207011E70023012255 +:100D30001946019804F0FAFB040004D1FF20EC49A5 +:100D4000CD300BF018FF2B2069460872E94902A844 +:100D500004F0EFFA002804D0FF20E549D2300BF070 +:100D60000AFFE4488188204621300176090A41764D +:100D70000E2129702146FC316960017E2974407E74 +:100D80006874DC482C30A860103030346C61E86046 +:100D9000DEE6002C04D1FF20D549E6300BF0EBFE57 +:100DA0002078212893D93079012802D0022808D14F +:100DB00003E0E07F04210843E077387E0121084307 +:100DC0003876324621460198FFF7F8FD2321204668 +:100DD000FEF79FF8BCE601220421019804F065F9B2 +:100DE0000028A2D0002301221946019804F09EFB9E +:100DF000040003D1BE49C0480BF0BDFE0F2028708F +:100E0000172028716E34AC60A2E60421019804F02A +:100E10009CF9002889D11020287099E6002301222E +:100E20001946019804F082FB050004D18720B049DF +:100E300080000BF0A0FE2E462036307E41064DD5B8 +:100E4000A17F8F07BF0FC00713D029468031486F9D +:100E500000280ED0027CF37DD207D20F5B001A432C +:100E60000274486F5108E27F4900D207D20F114344 +:100E70000174307E000713D52A468032116F002995 +:100E80000ED0087CF37DC007C00F5B0018430874C8 +:100E9000116FE27F40084000D207D20F1043087460 +:100EA000307E80070BD5F8204259002A07D0012F49 +:100EB00005D02946307C31311032FEF7C5F9307E3D +:100EC000C0060BD5F8204259002A07D0012F05D1C2 +:100ED0002946307C31311032FEF7B6F905236846D9 +:100EE0000370357E4570834822216038019A017075 +:100EF0004178C908C900C91C41704280037245721B +:100F0000FAF796FA2078252809D021280BD07A48BC +:100F100077495B300BF02FFE2078222803D922215D +:100F20002046FDF7F6FF0021019804F037FB00286A +:100F300000D10DE670486E49633092E674686D4DDD +:100F400020786035092802D00A28F2D10BE0E16848 +:100F5000002902D0284604F0BEF92169002902D0F8 +:100F6000284604F0B8F92146284604F0B4F9EFE524 +:100F700061485F49883074E65E4810B50422282134 +:100F8000603004F08FF95B480024EC30017E4906A4 +:100F9000490E01764038C465FDF7B1FD55493C3135 +:100FA00008461038FAF793F952484C30047410BDD3 +:100FB00070B50D46FDF775FF040004D14E484C494D +:100FC000A7300BF0D8FDFF21053128460BF0A7FC18 +:100FD000A07F8007800F01280CD00221284688308E +:100FE000FDF78EFD002804D043484149AC300BF09A +:100FF000C2FD70BD0121F1E70A46014610B5104659 +:101000008830FDF797FD10BD70B5054611200C46E0 +:101010000870002161702121495D002908D0032951 +:101020000ED0042910D034483149C6300BF0A3FD4E +:1010300020780009012802D9E87FC008607070BDDF +:101040000007000F203002E00007000F3030207052 +:10105000EEE7F0B504464068082601789BB0082901 +:101060000DD00B2903D00C294BD10121817160686F +:1010700087883846FDF715FF05004CD147E04788C3 +:101080003846FDF70EFF050004D11720184940012E +:101090000BF071FD2878212833D0282833D16068DF +:1010A00002210C3000F050FF00282CD0606808218D +:1010B000001D00F049FF002825D02D216846017051 +:1010C000478029461022223101A80BF0C9FB0FA945 +:1010D000684604F02EF9002804D007480449EF3090 +:1010E0000BF049FDA87F10210843A877292105E0CE +:1010F000DC0C0100B4100020030200002846FDF7BC +:1011000008FF1BB0F0BD607830436070F9E7FE491E +:10111000FE480BF030FDA87FEF210840A877297822 +:1011200021290FD061688A79002A02D089780029A4 +:1011300012D08007800F022849D0F448F249343099 +:101140000BF019FDFEF720F90028DAD0EF48EE4940 +:101150003F300BF010FDD4E7607830436070E87FDB +:10116000C00701D0042100E0032121204155287847 +:1011700029280BD039460620FBF7B7FA287824280F +:10118000E0D122212846FDF7C4FEDBE7002301223F +:101190001946384604F0CAF9040004D1C920DA49D6 +:1011A00080000BF0E8FC25212846FDF7B2FE0D205B +:1011B00008A90871204609A98830FDF7ADFC02286E +:1011C000C0D00028BED0D148CF491D30B8E76078E4 +:1011D00030436070B6E7F7B58AB015460646FDF7AE +:1011E00060FE002841D0017822293ED323293CD03B +:1011F000C17F490739D4807F8007800F01280DD037 +:10120000002301220021304604F090F90746C0482F +:10121000029004F057F8040007D101E00123F0E741 +:10122000BA48B94959300BF0A6FC002F1FD08837B7 +:101230006761029804F046F80746029804F042F805 +:1012400009212170266225710B99E760A160206158 +:1012500003A92046FDF784FC022806D0002804D00C +:10126000AA48A94975300BF086FC0DB0F0BD0020EE +:1012700007466061E4E730B5002387B005460122E8 +:10128000194604F053F904462846FDF70AFE007893 +:1012900022281BD9002C04D19C489B4981300BF09B +:1012A0006AFC0F21684601701721017120466E30DB +:1012B000029069461A30FDF72FFC022806D000285C +:1012C00004D0E520904980000BF055FC07B030BDFC +:1012D00030B5002387B005460122194604F026F9EF +:1012E00004462846FDF7DDFD00782228EED9002CC3 +:1012F00004D18648844993300BF03DFC10206946A8 +:10130000087020468830FDF707FC0028DED0E92071 +:101310007D4980000BF02FFCD8E7F7B50546007833 +:101320000027000982B00C463E4602287ED00728DE +:1013300002D00A284AD14AE068680178082907D013 +:101340000B2930D00C292ED070486F49D33060E182 +:1013500014271A26002C6AD04088A080FDF7A1FD32 +:101360000090002804D169486749AF300BF003FCB6 +:1013700000980099C07DA21D1831FDF765FF6868CF +:1013800008228089E081696820461030091D0BF031 +:1013900067FA207E01210843F92108402076009851 +:1013A0004021807F47E018270826002CD3D0808872 +:1013B000A080FDF776FD050004D1F720524980009A +:1013C0000BF0D9FBA11D2846FFF71EFE23E1002CE0 +:1013D00001D0288BA080287A01287DD0022804D053 +:1013E00003282FD048494B4813E11C270726002C1F +:1013F000B1D0A088FDF755FD0090002804D1FD2054 +:10140000414980000BF0B7FB287B8007800F012843 +:10141000A07914D040084000A071FD210840297B2C +:101420004907C90F49000843A07101E0E3E0DFE08C +:1014300000988021807F084300998877EBE00121A4 +:101440000843E9E713270B26002C84D0A088FDF77A +:1014500028FD00900023A0880122194604F066F8B8 +:1014600005460098002804D12A48274960380BF027 +:1014700082FB002D04D181202349C0000BF07BFBAF +:101480000098807F8007800F012859D0E86A817812 +:101490008907890F0129A17954D049084900A17110 +:1014A0008278FD255207D20F294052001143A171C5 +:1014B000E322114002785207D20E1143A171DF22BC +:1014C00011404278D207920E1143A1710021E171BF +:1014D000C1782172427900E037E00179607AD30760 +:1014E00040084000DB0F18439307DB0F28405B00E8 +:1014F00018435207FB23D20F18409200104360722A +:10150000A07A4008400007E0DC0C01000E03000058 +:101510001411002067040000CA07D20F10438A0785 +:10152000D20F2840520049071043C90F18408900C4 +:101530000843A0720098007823286CD92621AFE0D8 +:10154000A86AA4E701221143A9E7297BFE480229E2 +:1015500010D017270C26002C4AD0012911D00329BE +:101560001ED004291FD005291DD0F849F8480BF0DA +:1015700002FB23E019270726002C4CD00121A17182 +:1015800005E00121A171E17989088900E171017EFD +:10159000CA094906D201890E49000A4302760DE0C4 +:1015A0000220A07106E0687B0007000F8030A07168 +:1015B000052918D0E07980088000E071A088FDF747 +:1015C00070FC05460078212825D0232804D0E04867 +:1015D000DE490C300BF0CFFAA088002103F0DEFFCB +:1015E000222128465DE0E07980088000401CE4E785 +:1015F0000498068015E0002C01D06888A080287A25 +:10160000032828D004280FD005284DD0D048CF4932 +:1016100064300BF0B0FA0498002C068001D02780CB +:101620006680002005B0F0BD15270C26002CDFD009 +:101630000023A0880122194603F078FF050004D199 +:10164000C348C2492A300BF096FA0622A11DA869A8 +:1016500006F01CFBDFE716270726002CC8D0A08861 +:10166000FDF71FFC00900023A0880122194603F01B +:101670005DFF05460098002801D0002D04D1B44834 +:10168000B24938300BF077FA2878C00601D502202D +:1016900000E00120A071009800782328BBD9272101 +:1016A0000098FDF736FCB6E717270C26002C9FD0D4 +:1016B000A088FDF7F6FB00906D7A002804D1A448BD +:1016C000A2494B300BF057FA0621A01D0BF025F96B +:1016D0000020A071207A032108432072FB210840DA +:1016E0000099C97FC907490F08432072680692D53F +:1016F000E07904210843E071A07AE907400840003E +:10170000C90F0843E17A2A0749084900D20F11435B +:10171000FD22AB07DB0F10405B001843A072E80608 +:10172000C00F114040000143E17274E710B5044658 +:10173000807990B08009012804D04D2083490001B0 +:101740000BF019FAFFF76AF90120694608707E4824 +:101750000AA9A0380190201D0290601C0B906846D9 +:10176000FDF7FEF9002804D07948784987300BF05E +:1017700002FA0322601C0B990BF072F810B010BD36 +:1017800010B5714CA03C002805D00146102220461F +:101790000BF066F80120207410BD10B50446FFF769 +:1017A0003DF969491022A03920460BF059F810BDC7 +:1017B00070B50025644C00281CD06649884207D3C8 +:1017C00001218904884205D363490968884201D20E +:1017D00010250DE0062106F043FA411C07D05A49B6 +:1017E0004039C865207E80210843207600E0072527 +:1017F000284670BD207E4006400EF6E7F3B5002077 +:1018000089B00D46029000290AD0524885421CD367 +:1018100001208004854203D34F480068854214D3D9 +:101820000998FDF73EFB060003D03078222815D139 +:1018300002E04A480BB0F0BD002D08D1B07FC109CD +:1018400003D08007800F022801D01020F2E7B07F7C +:10185000C10601D4000703D5002D01D00820E9E717 +:101860003948007EC00712D1F07F400701D50D2016 +:10187000E0E7002201231146099803F057FE070014 +:1018800005D0B07F8007800F022802D00BE0112026 +:10189000D0E7002D07D02A4639463046FFF728F812 +:1018A00002900028C6D128488C3803F00BFD0400B4 +:1018B00003D126492A480BF05EF90A2020700998C6 +:1018C000206238468830A060B07FFB218007800FFF +:1018D000012829D0002D4CD002202071381DE06055 +:1018E00038780007400F20743878C006C00F607445 +:1018F000A07C2A788008D2078000D20F1043A07401 +:101900000840F17F01AAC907490F0843A074A878CD +:10191000E07469462846FFF72CF868460079207580 +:1019200068460078607528E001202071207B2A78C5 +:101930008008D2078000D20F104320730840297816 +:101940008907C90F89000DE0A0110020DC0C0100FF +:101950005304000000D001002001002002300000EC +:10196000630500000843207324213046FDF7D1FAB7 +:101970000BE0032020710520207325213046FDF760 +:10198000C8FAB07F4006400EB07703A92046FDF7A5 +:10199000E7F8022805D0002803D0FD49FD480BF0E8 +:1019A000EAF8029846E7FFB581B00A9D06461C4654 +:1019B0001746142128460AF0B2FF0B980021016057 +:1019C000F8070ED0F44920680968884239D31230EC +:1019D00028602068143068602068A8600B9821682F +:1019E0000160B80726D56068002803D0EA49096875 +:1019F000884226D3029900290AD0FC3600280ED04E +:101A000031461030FDF7DFFB00281BD1606810E085 +:101A1000002816D0E86080366068B0670AE0FEF7FC +:101A2000EBF90146072230460AF01AFFFEF7F6FFEF +:101A3000DA48E860780707D5D749A068096888427E +:101A400001D21020EEE528610020EBE5FFB5D44A75 +:101A50000E4607CA97B002AB07C30027009701974D +:101A60001798FDF71EFA050005D02878262804D01F +:101A700008201BB0F0BDCB48FBE700231A461946EF +:101A8000179803F053FD040004D1C248C0498030C8 +:101A90000BF071F8A87F8007800F1690012814D0F2 +:101AA000022824D0BB48BA4999300BF064F80121D0 +:101AB0000022852E31D01EDC002E26D0812E26D08D +:101AC000822E26D0832E1ED125E0002EEFD1214676 +:101AD0002846199AFEF70CFF0028CAD11998807879 +:101AE000009019980078C007C00F0190DFE719989F +:101AF000002808D1DBE7862E11D0882E11D0892E40 +:101B000011D08A2E11D00720B3E710460EE0084608 +:101B10000CE002200AE0032008E0052006E0062091 +:101B200004E0082002E0092000E00A2000222271DF +:101B300001216A461176211D0791002801D02071EC +:101B4000FAE0169801280CD0A66AE06A0222012168 +:101B500010900020A0602846173002291AD00121D9 +:101B600019E0E66AA06A1090032030702078FB2309 +:101B7000C006C00F7070B07801221840009BF3704F +:101B80008008019B800018430221B0700020707112 +:101B90003071DEE70021890009190861681C022AFA +:101BA00001D0012100E00021890009190861B07805 +:101BB0008007800F01285ED1109880788007800F01 +:101BC000012858D1109800798446109840790090E7 +:101BD000169801281DD0317908A801747179017512 +:101BE00008A8027C6046024008A8007D00990840D1 +:101BF000139010433FD06C491A98884207D30121B3 +:101C00008904884215D364490968884211D210209A +:101C10002FE70CAA0DA91998FEF7ABFE08A8007CC7 +:101C200061460840307108A8007D00990840707135 +:101C3000D6E720463C3021460090F03116980191BD +:101C4000022834D000211A9B20460C33FFF7ABFE4C +:101C50000028DDD12046503021460090F4311698FE +:101C60000191012825D0002120461A9B139AFFF7E5 +:101C70009AFE0028CCD110988078400702D4E87FE3 +:101C8000C0072BD0169902A8012914D01099097801 +:101C90004900405A21780907490F4900C840870781 +:101CA000BF0F2AD0012F14D0022F0FD113E0012132 +:101CB000C9E70121D8E721780907490F4900405AAF +:101CC000109909784900C8408707BF0F032F04D037 +:101CD00004E0022711E001270FE0022716980128EF +:101CE0000BD1B078FB210840E97FC907490F0843B1 +:101CF000B07020780007400F307020781022400824 +:101D0000400020701099D2434978C907C90E114389 +:101D100008402070C00623D4022F21D0012F21D0EB +:101D20000020A061E0612062606220461830A0605F +:101D3000E87F40084000E877204606A98830FCF795 +:101D4000EBFE002806D0022804D06F2010490001C5 +:101D50000AF011FF25212846FDF7DBF8002088E670 +:101D6000032008E020460D211B300AF0D6FD204656 +:101D70001830A060042069460875E87F01210843F7 +:101D8000E87705AA29461798FEF730FED4E7000049 +:101D9000DC0C01008E050000200100200011002055 +:101DA00050CF01000230000000D00100F0B587B034 +:101DB00015460E0004460DD06A48854207D301201F +:101DC0008004854206D368480068854202D210200C +:101DD00007B0F0BD2046FDF764F8070004D038785E +:101DE000272803D00820F3E76048F1E700231A46CC +:101DF0001946204603F09AFB040003D15C495D4874 +:101E00000AF0B9FE0020002E05D0022E08D0012EC7 +:101E100011D00720DCE701216A461171A06018E0AB +:101E2000234618336946A3600871102229461846D4 +:101E30000AF016FD0DE021461831A16069460871CF +:101E4000A061E061206260620621284605F008FF7B +:101E5000A0612078C10714D0400840002070022003 +:101E6000694608702046183002907030FCF754FE26 +:101E7000022806D0002804D03E483D4923300AF00D +:101E80007AFE25213846FDF744F80020A0E770B51A +:101E900094B00D460646002B02D0072014B070BD4A +:101EA000FCF7FFFF040007D02078222802D3A07F90 +:101EB000400603D40820F1E72C48EFE7002D19D0A5 +:101EC0002D216846017046801022294601A80AF09B +:101ED000C7FCE07F297C4008C9074000C90F0843C0 +:101EE000E077297C40078906400FC90EC9000843E6 +:101EF000E07703E02E2168460170468009A9684614 +:101F000003F017FA694609782D2905D1002803D175 +:101F1000A17F10221143A177A17FBF221140A17799 +:101F2000BCE710B50C46FCF7BCFF002805D00E49F5 +:101F300009688C4203D2102010BD0C4810BD214608 +:101F4000FFF762F8002010BD05E00278401C002A6F +:101F500001D0002070470A46491E89B2002AF4D1F8 +:101F60000120704700D00100200100200230000055 +:101F7000DC0C01000F070000F8B500780C4616468F +:101F800010340E36069F022809D0032836D00528C3 +:101F90007ED0FF20F6A1E5300AF0EDFDF8BDCD8939 +:101FA0000A2068430E30188031203880002AF5D08E +:101FB000087B9581801FC7B21AE020886168308055 +:101FC00048780A7800021043F080C8788A780002C6 +:101FD00010433081B21C3846091DFCF7B0FE002FBB +:101FE00001D0002802D000203071708008340A36F9 +:101FF00028466D1EADB20028DFD1F8BDCD890A207C +:1020000068430E30188032203880002AF5D0087BD3 +:102010009581401FC7B243E0616822880878F2804A +:102020003279C30752085200DB0F1A43FD231A40CE +:102030008307DB0F5B001A43FB231A404307DB0FC8 +:102040009B001A43F7231A400307DB0FDB001A43F8 +:10205000EF231A40C306DB0F1B011A43DF231A408C +:102060008306DB0F5B011A43BF231A404306DB0FD5 +:102070009B011A433271C00970718A784B78100243 +:102080001843308132463846C91CFCF758FE00E040 +:102090000CE0002802D00020B070308008340A36EE +:1020A00028466D1EADB20028B6D1F8BD087BCD899B +:1020B000801E86B2304608306843103018803420C5 +:1020C0003880002AF1D0174695811037E800D68174 +:1020D000C01900900DE02088388000987860324662 +:1020E000616800980AF0BCFB009808348019083732 +:1020F000009028466D1EADB20028ECD1F8BDFFB5AA +:1021000081B00A9D1E460C46002A05D0607AFF3039 +:102110000130D080E089108101980E2700780300FB +:102120000AF042FE0B7E0719293541536C78787806 +:102130007E000092087B082805D0032803D091A1D7 +:1021400095480AF018FD378030200FE000990020F4 +:10215000888105B0F0BD0092087B042804D08E4829 +:1021600088A114300AF007FD3780312028800098BC +:102170000028EBD1EDE70092087B042804D09320DF +:1021800080A180000AF0F7FC37803220EEE7009251 +:10219000087B022804D080487AA13A300AF0EBFC90 +:1021A00037803320E2E7087B1746042804D07A48BA +:1021B00074A14C300AF0DFFC1020308034202880DD +:1021C000002FC6D00020B88116E0207B17460528D6 +:1021D00006D0062804D070486AA160300AF0CBFC13 +:1021E0001220308035202880002FB2D0E089B881BD +:1021F0000020388201984088F881AAE70092087B85 +:10220000072804D064485FA171300AF0B4FC37801D +:102210003620ABE733460095019800F00EFC98E7B6 +:102220002F2053A100010AF0A6FC92E770B50C46DE +:102230000546FCF736FE002804D00078222803D299 +:10224000082070BD554870BD00231A460421284659 +:1022500003F06CF92060002801D0002070BD03203D +:1022600070BDFFB58BB00D4607461720694608853F +:102270000E9803261446002805D10EA93846FFF70C +:10228000D5FF002834D1002D0BD000220321384681 +:1022900002F00BFF002834D00E980078002830D1CF +:1022A00008E02078092819D00F2823D030A13C4815 +:1022B0000AF061FC0E98A760801D03AA60600232DC +:1022C0000AA92046FAF78DFB002827D003000AF060 +:1022D0006BFD071A182323211C1E2300072600224A +:1022E0003146384602F0E1FE0028E3D12B48801C3D +:1022F0000FB0F0BD00220321384602F0D6FE0028C0 +:10230000D8D11120F4E70020F2E70820F0E72348B5 +:10231000401CEDE70720EBE70320E9E701A8009068 +:102320006846038D04223146384602F0D6FB002869 +:10233000DED1002DDCD00E990D70D9E730B587B015 +:102340001D460C46002A11D0042369460B701388E1 +:102350008B815288CA81A2788A7422880A820023DB +:102360006A462946FFF77DFF07B030BD1020FBE726 +:102370007372635C67617474635F636F72652E630D +:10238000000000007372635C67617474635F636F65 +:1023900072652E630000000025020000023000007C +:1023A0004F030000F3B581B001980C460078082671 +:1023B00003000AF0F9FC125F47471B134B0A0A0A95 +:1023C0000A0A0A0A0A0A0A0A0A5F002C02D1F84914 +:1023D000F84808E06078304360703CE0002CF9D1A8 +:1023E000F448F34908300AF0C6FBF3E701980023EC +:1023F0008088012287B20421384603F097F8054609 +:10240000002C04D07520EA49C0000AF0B4FB002D6E +:1024100004D1E848E64914300AF0ADFB3946A81D5E +:10242000FAF7D6FAF8F79CFE040006D0607830433D +:1024300060706780F8F775FE0FE013213846FEF7ED +:1024400023F815E0DB48DA49283002E0D948D849BA +:102450002D300AF090FB002C0AD06078000707D5D9 +:10246000932020702046582208300199EEF7B8FEDC +:102470000020FEBDCF48CE493130EAE710B500213B +:102480000170801DFAF7A1FA10BD0A4610B5014689 +:10249000901DFAF7A5FA10BD70B5002305461A463F +:1024A000042103F043F8040004D1F920C04980005E +:1024B0000AF061FB2946A01DFAF78AFA70BDF7B54C +:1024C000054684B00C4600206946088188806F88E4 +:1024D000034601220421384603F028F8060004D1FF +:1024E000FD20B34980000AF046FB002C03D0A780F2 +:1024F0000020E0802081297A20461230C91E14274E +:1025000000900B000AF050FC0FFEFDFC3809A95E9C +:10251000657A2FB2C9E99191FC003078012804D086 +:10252000A349702014310AF026FBA9896A46C80025 +:102530000E30908030201081002C13D0A18100201B +:102540000DE0C100327909190A747288CA818200CB +:102550005319DA894A821A8A401C8A8280B2A18978 +:102560008142EED8F1E002A8009001AB2246294654 +:10257000304600F02BFAE8E03078042804D08C498B +:10258000BD2014310AF0F7FAA8890622014650430B +:102590006A460E30908033201081002CE2D0A18159 +:1025A00000200BE0062141434F190919FA89CA811D +:1025B000BA7C8A743A8A401C0A8280B2A18981421C +:1025C000F0D8C2E0307806280BD079491431D720F2 +:1025D00005E03078062804D07549EB2014310AF064 +:1025E000CAFAE88969461230888035200881002CB3 +:1025F000B8D0A989A1817188E18126E030780728C7 +:1026000004D06B49FF2014310AF0B5FAA8896A4654 +:1026100001460E30908036201081002CA2D0A1817E +:102620002046AA890E30296954E0E88969461230AB +:1026300080B2382288800A81002C7ED0A989A181AD +:10264000287A102807D00221A173E9892182EA891A +:10265000296900983EE00121F6E702A8009001AB4D +:10266000224629463046FFF787FC6EE0307808287E +:1026700005D04F49FF201431EE300AF07CFA68464D +:10268000372187800181002C5FD0A989A18100209A +:10269000608220820120A07357E03078092805D09D +:1026A0004349FF201431FF300AF065FA288A694651 +:1026B0001430888037200881002C46D00421A17373 +:1026C000A989A181E9892182298A618220462A8AF1 +:1026D000143069690AF0C4F837E030780A2804D069 +:1026E0003349354814310AF046FA68463721878065 +:1026F0000181002C29D00521A1730020A08102E0D6 +:102700001EE003E00CE0208260821EE002A8009040 +:1027100001AB224629463046FFF7F1FC15E00CE0FC +:102720000D206946392288800A81002C05D00120BD +:10273000E08000202081207307E00699088019E0DE +:102740001C481B49A4300AF016FA6846069980888E +:102750000880002C0ED0684600892080684680885A +:102760006080287A032805D0102803D0112801D0D2 +:1027700000203070002007B0F0BDF7B55688154630 +:102780000F46002382B01A460421304602F0CEFEE6 +:10279000040004D107480649C4300AF0ECF9A41D2E +:1027A00033462A46394600940298FAF7A0FAD0E454 +:1027B000702301009503000013020000F7B58CB0F0 +:1027C0000D46144607A90C98FFF730FD002812D1DA +:1027D000B64E0127002C0FD003216846017010214E +:1027E000818208A802460690204605A9FCF7CDFA8A +:1027F00000280BD007207BE5082168460170858101 +:10280000C68105218774C90201820BE00798A1786F +:10281000017121884180684605218774C9020182BF +:102820008581C68102460121079B0C98FFF719FD9F +:102830005EE508B501236A4693709D4B13800A46F6 +:1028400002236946FFF77AFD08BD08B501236A46F1 +:102850009370974B5B1C13800A4603236946FFF76E +:102860006DFD08BD00B587B000290CD002236A4673 +:1028700013700B8893814988D18100230421FFF7CD +:10288000F0FC07B000BD1020FBE710B5002903D015 +:102890000523FFF753FD10BD072010BD70B588B0AC +:1028A0000D461446064607A9FFF7C0FC00280DD1C7 +:1028B000002C0DD00621684601708581C481079BDC +:1028C00002465C8006213046FFF7CBFC08B070BDA5 +:1028D0000521684601708581F1E710B588B00029AF +:1028E0000BD007246B461C709A81049100236A4622 +:1028F0002146FFF7B6FC08B010BD1020FBE770B50D +:102900000024172288B0002914D00D782B000AF07B +:102910004BFA0623050519041B231522D21E93B278 +:10292000CA88002A02D08E68002E03D09A4203D9AA +:102930000C20CBE71020C9E7042D05D08A88002A97 +:102940000AD101E00620C1E7012D11D0022D05D0EA +:10295000042D18D0052D23D00720B7E709236A4698 +:1029600013704B889381CB88D381896804911DE0D3 +:102970000C236A4613704B889381CB88D381896876 +:102980000824049112E00D236A4613704B8893814A +:102990008B88D381CB88138289680924059105E04F +:1029A0000E236A461370497811730A2400232146C6 +:1029B000FFF757FC8AE700B587B00F236A4613700C +:1029C000918100231946FFF74CFC5AE7FEB50078C9 +:1029D000089D1C4616460F46012803D03549912014 +:1029E0000AF0C9F8F889C0000E3020803020288015 +:1029F000387B001FC0B20190002E1DD0F889B08135 +:102A0000002516E0E8008419C019009022464169AB +:102A10000E320198FCF793F9002802D000202074B0 +:102A2000E08100986D1C008A60820098ADB2408AF7 +:102A3000A082B089A842E5D8FEBD70B51446142521 +:102A4000049A1D8037231380002C0ED0CA89A281DE +:102A5000002262820078082808D0092810D00A28AD +:102A600019D0144914480AF086F870BD087B0C2868 +:102A700004D011480F490C380AF07DF8012008E015 +:102A8000087B0D2804D00C480A4908380AF073F86E +:102A90000420A07370BD087B0E2804D006480549A9 +:102AA000001F0AF068F80520F3E70000FFFF0000B0 +:102AB0000228000084230100BB020000002803D08C +:102AC0008178012939D101E0102070470188FE4A40 +:102AD000881A914233D01BDCFC4A881A91422ED0CE +:102AE0000BDC00292BD00320C002081A27D00128B4 +:102AF00025D001210903401A07E001281FD0022830 +:102B00001DD0FF281BD0FF380138002815D116E052 +:102B1000FF220132811A904211D008DC01280ED028 +:102B200002280CD0FE280AD0FF2806D107E0012990 +:102B300005D0022903D0032901D0002070470F20BF +:102B4000704700B50B2826D009DC03000AF02CF9E9 +:102B50000B1D2125251B25292325271F1B00112897 +:102B60001BD008DC0C2816D00D281CD00F2814D040 +:102B7000102808D10FE0822809D084280FD085289A +:102B80000FD0872811D0032000BD002000BD0520F4 +:102B900000BDCF4800BD072000BD0F2000BD0420B0 +:102BA00000BD062000BD0C2000BD0D20800200BD30 +:102BB00070B500290BD0CB1FFA3B81241E46CDB245 +:102BC000112B1BD2012805D0022806D009E00020D5 +:102BD00010701DE0FF20043001E0FF20033081422F +:102BE00018D033000AF0E0F8111613131613161656 +:102BF0001316161613131313161316000846FF3870 +:102C000081381F2803D9FF39FE39022902D81570EF +:102C1000002070BD1470072070BD00B503000AF0DD +:102C2000C3F8060406040C080A0C002000BD11209D +:102C300000BD072000BD082000BD032000BD0078B6 +:102C40000207120F04D0012A05D0022A0AD10EE091 +:102C5000000907D108E00009012805D0022803D0A7 +:102C6000032801D007207047087000207047062015 +:102C70007047002807D0012807D0022807D0032872 +:102C800007D007207047002004E0112002E0212037 +:102C900000E0312008700020704738B50C46050070 +:102CA0004FD06946FFF7CBFF002822D120880321AF +:102CB00089028843694609788907090D08432080FD +:102CC0006946681CFFF7BBFF002812D1218803204A +:102CD00000038143684600788007800C014321800F +:102CE000A8784007820F2020012A03D0022A03D0AF +:102CF000072038BD814300E00143218088B20105EF +:102D0000890F08D0012189038843A9780907C90FD1 +:102D100089030843208080B28104890F0AD0A978F2 +:102D20004004C906C90F400CC90308432080800431 +:102D3000800F02D12088400403D520884021084319 +:102D40002080002038BD70B504460020088015465C +:102D50006068FFF7A2FF002815D12189A089814270 +:102D600010D861688978C90708D0012149028842D2 +:102D700008D8491C09F0DDFD298009E0FF21FF3159 +:102D8000884201D90C2070BDFF30FF30033028800D +:102D9000002070BD10B5137804785B08E4075B0071 +:102DA000E40F23431370FD2423400478A407E40FA9 +:102DB000640023431370FB24234004786407E40F6A +:102DC000A40023431370F724234004782407E40F5E +:102DD000E40023431370EF2423400478E406E40F57 +:102DE000240123431370DF2423400478A406E40F56 +:102DF0006401234313700078BF244006C00F2340B2 +:102E0000800103431370002906D00878C10701D15F +:102E1000800701D5012000E00020C0015906490EBD +:102E20000843107010BD30B50A8803239B02048844 +:102E30009A4323059D0F02D1A3049C0F01D09B0F41 +:102E400000E001239B021A4303230A801B039A43D9 +:102E500003889804840F02D11805830F01D0800FD6 +:102E600000E00120000302430A8030BDF3B593B0B7 +:102E70000D000FD0139800280FD01221284609F01A +:102E80004CFD03AAFF210120FAF71FFB0024264670 +:102E900037467AE0102015B0F0BD0720FBE7684602 +:102EA000807D01280BD16846818A0520C002081A5E +:102EB00010D0012810D0022812D0032812D0042CE0 +:102EC00014D0052C15D113E00229000001280000C0 +:102ED00003300000012400E002246846468A08E02E +:102EE000032406E068460424478A02E0052400E043 +:102EF00006246846418A1398814246D12C74002EDC +:102F000041D00DAA0EA90520029201910090102334 +:102F10000022FF213046FAF779FB002823D16846CA +:102F2000808E2A46C0B20EA9FBF709FF00281AD1ED +:102F3000AE81002F27D00DA9052008AE0291009088 +:102F4000132300220196FF213846FAF75FFB002881 +:102F500009D16846808EF11CC01EC0B22A1DFBF745 +:102F6000EEFE002801D0032095E708A8817842787A +:102F700008021043E881062C05D16846807DA872BE +:102F80006846808A2881002085E703A8FAF7A6FA18 +:102F9000002884D0FFF7D5FD7DE7002805D0F94A49 +:102FA000012903D0022903D003207047518800E093 +:102FB0009188814201D1002070470720704770B589 +:102FC0000C4605461C21204609F0A7FC0020208065 +:102FD000002D08D0012D04D0EBA1F04809F0CBFD65 +:102FE00070BD062000E00520A07070BD70B592B0E5 +:102FF0001546064601206A4610711074537408463F +:1030000008300395029048889082F8F7A9F80400E8 +:1030100019D06580172069468883203600940AAB52 +:103020007178023307AA01A804F069FB06466078AC +:10303000000701D5F8F775F8002E0AD03046FFF7E3 +:10304000ECFD12B070BD13212846FDF71DFA0320D8 +:10305000F7E708A800906846838B042201212846E0 +:1030600001F03BFDEDE770B506468AB000200D4645 +:1030700007900590069003A904900524024602914A +:1030800001901023009429463046FAF7BFFA002831 +:103090000DD108A804A90091029001946846838983 +:1030A000002229463046FAF7CDF8002801D0FFF774 +:1030B00048FD0AB070BD10B504F027FD10BDF0B595 +:1030C00089B000260546059600780C4608270300BF +:1030D00009F06AFE0CFD070C3A0B77779EC2FCD80C +:1030E000E8FD68680A38F8F7B0F90DE1A888002310 +:1030F00080B201220321009002F018FA0290002C05 +:1031000004D0A648A0A16E3009F035FD0298002831 +:1031100004D1A2489CA16F3009F02DFD02980099BE +:10312000083003F021FFF8F71BF8040007D060789F +:103130003843607000986080F7F7F3FFE6E01321F2 +:103140000098FDF7A1F9EFE0002C04D1BD208EA17D +:10315000800009F010FD608800230122032102F0A5 +:10316000E5F90090002804D18C4887A1883009F047 +:1031700002FD0099002008802A7994461EE0C300D1 +:103180005B199B6807936B469B8B1A0708D5DA0679 +:1031900006D56046C20050194038C08F088006E04E +:1031A0005B0409D50871C2005019C0884880607856 +:1031B000384360700226A7E0401CC0B28445DED8C8 +:1031C000A2E0E888694608800090002C04D173488A +:1031D0006DA1983009F0CFFC2878062814D100980A +:1031E000C00B11D0608800230122032102F09EF958 +:1031F000060004D1694864A1A23009F0BCFC00209B +:103200003071A88870803BE06078384360707BE064 +:10321000002C04D161485CA1B43009F0ACFC60889A +:1032200000230122032102F081F90090002804D13B +:103230005A4855A1B73009F09EFC0098083004F0B8 +:10324000B6FC0121484002D1E888C00B5CD0009850 +:1032500061880226C180D7E7002C04D14F484AA1DB +:10326000D03009F088FC608800230122032102F09D +:103270005DF9002804D1494843A1D33009F07BFC13 +:103280000226C1E7002C04D144483FA1DC3009F0FC +:1032900072FC0226618801222046F8F7E7F8012037 +:1032A0000590B1E7A889002380B201220321009094 +:1032B00002F03CF90746002C04D0384832A1EE3029 +:1032C00009F059FC002F07D12FA101E00FE016E013 +:1032D0003248EF3009F04FFC68680290288969464F +:1032E0008881012202A90098F8F7DCF80CE0002C94 +:1032F0008AD16D2024A1C00009F03DFC84E7274855 +:1033000021A1FE3009F037FC002C0DD060780007B9 +:103310000AD50598002807D184202070204658221D +:1033200029460830EDF75CFF304609B0F0BDF7B52F +:103330000C460546007A224688B00A320292921C58 +:1033400004920027811E16323E4601920B0009F0BE +:103350002BFD08F605F548488DD1F4F56888002363 +:103360000122032102F0E2F80190002803D106A116 +:103370000B4809F000FC01980088002812D0522761 +:10338000072601E1C01100207372635C67617474E9 +:10339000735F636F72652E63000000006F020000B0 +:1033A0008603000051271E26002C7DD06888A0804F +:1033B0000120A071019802990079C0004019C089CC +:1033C000FFF754FD002870D101980079C000401922 +:1033D000C089208101980079C0004019408AA083EB +:1033E000F2E0698A0091062820D1E889C00B1DD03F +:1033F00008462230512786B2002CD6D0A8890499DD +:10340000FFF734FD002873D16888A0800220A071E6 +:10341000A88920810120A072288AE0830098208456 +:103420006969009A019809F01BFACDE0084620303E +:10343000502786B2002CB8D0A8890299FFF716FD54 +:10344000002855D16888A080A889E080287A0628BD +:103450000AD002202072288AA0830098E0832046A8 +:1034600069692030009ADEE70120F3E768880023CD +:103470000122032102F05AF80690688A009006980B +:10348000002803D1FD49FE4809F075FB0698083075 +:1034900004F08DFB0121484002D1E889C00B26D001 +:1034A0000098223086B201E073E021E05127002C21 +:1034B00079D06888A080A8890499FFF7D7FC0028F4 +:1034C00016D10220A071A88920810420A072288A28 +:1034D000E083009820846969009A019809F0C0F996 +:1034E0000699002008710698A98941806CE00320A4 +:1034F0000BB0F0BD6888FBF7D4FC0190688800230E +:103500000122032102F012F800900198002804D152 +:10351000DB48DA492C3009F02EFB0098002804D152 +:10352000D748D6492D3009F026FB0098D549C088E8 +:10353000884205D05127222604E01EE03FE035E016 +:1035400050272026002C2ED06888A080502F07D02E +:103550000220A0712146287B0831FFF730FD33E0BF +:10356000287BA11DFFF72BFD6A8800230099019895 +:10357000FFF73CFD0028BBD126E0C349A889C988D4 +:10358000814207D154270626002C0CD06888A080E1 +:103590001AE008E053270826002C04D06888A08091 +:1035A000A889E08010E00A98068013E055270726D6 +:1035B000002CF8D0A889A0800020A07104E08D2004 +:1035C000AE49C00009F0D7FA0A98002C068001D055 +:1035D0002780668000208BE7AB4900200870704789 +:1035E00030B585B00C4601F0E0F90546FF2804D15E +:1035F000A348A249953009F0BEFA0020208020712E +:103600006080401EE08020462946083003F0A0FC80 +:103610006A4629460120F9F758FF102412E068464F +:10362000808800070ED56846C0882946FFF71BFD35 +:1036300068468188FF2321438180C0882946019AFA +:10364000FAF76EF86846F9F749FF0028E7D005B0A9 +:1036500030BD0A46014610B51046083003F08CFC18 +:1036600010BD70B5002305461A46032101F05EFF28 +:10367000040004D182488149B73009F07CFA204621 +:103680002946083003F070FC70BDF0B591B00C46CF +:103690000746FBF706FC050005D02878222804D24F +:1036A000082011B0F0BD7948FBE700231A4603213A +:1036B000384601F03BFF0646002C02D0A0880028C7 +:1036C0000CD001206946087102200874002048745B +:1036D000002C05D0A0880883206802E00920E0E7DC +:1036E000088305903046083003970290F7F738FDBD +:1036F000040018D06780172069468883203500941D +:103700000AAB6978023307AA01A803F0F8FF05465F +:103710006078000701D5F7F704FD002D09D0284691 +:10372000FFF77BFABDE713213846FCF7ADFE032017 +:10373000B7E708A800906846838B04220121384629 +:1037400001F0CBF90021C943F180AAE7FFB585B0AC +:103750000E9E77883846FBF7A4FB054600231A46E1 +:103760000321384601F0E2FE0446002D03D143490F +:10377000474809F000FA002C04D145483F49401C55 +:1037800009F0F9F90834089869460394C1C105A8FD +:103790000DC82035697803F021FCC6E5F0B5044674 +:1037A000002099B00D4601460D9010A88181164663 +:1037B00001818180344A68469180018510A801808A +:1037C00068460187818581841078012808D0022805 +:1037D00006D0032804D0042802D0082019B0F0BD78 +:1037E0002C4A944273D32C4F0121890438688C42AF +:1037F00001D3844278D3274A954275D301218904A5 +:103800008D4201D385426FD36168002913D0214ACC +:10381000914269D301229204914201D3814263D340 +:1038200060892189884203D801225202914201D93C +:103830000C20D3E70D9016AA0EA92846FFF783FAAD +:103840000028CBD1686880784007800F02280AD111 +:103850006846008F8004800F05D02869002802D0B8 +:103860003968884240D30AA92069FFF716FA002870 +:10387000B4D1206900281CD060780FE088330100A3 +:10388000EE030000FFFF0000C01100200230000026 +:103890000C05000000D001002001002080076846D0 +:1038A000008D03D58004800F68D002E08004800F73 +:1038B00064D16846008D810618D58004800F606849 +:1038C00006D0002812D0396888420DD302E00BE000 +:1038D00000280BD0FE49884206D301218904884282 +:1038E00004D33968884201D2102077E709A96069BA +:1038F000FFF7D3F900289CD16069002808D06846FA +:10390000808C0105890F012938D18004800F35D0C2 +:103910000BA9A069FFF7C1F900288AD16846808CFD +:1039200080062BD46846808D810627D4A1690029A2 +:1039300006D00105890F012920D18004800F1DD0F8 +:10394000E068002804D00078002817D01C2815D281 +:1039500004AA611C2046FFF71DFA0121890210A864 +:103960000180012768468773DA49818104AA0332FE +:1039700017A92868FBF709FA002801D007202DE7CE +:1039800010A8007F15A9C01CC2B200200C920190A3 +:10399000FF32009003460291FF3203A803321099D0 +:1039A000F9F7EBFC002826D110A9888A0F902A8904 +:1039B0002969C94801910092029010A90A8B6B896C +:1039C00028680E99F9F7D9FC01007DD1C24800257D +:1039D000001F818868464174090A8174052104A882 +:1039E0006A4623C210A82A46FF21808A0C9BF9F759 +:1039F00029FC002802D0FFF7A4F8EFE66846007C17 +:103A00000322C109002092029043012292028018F1 +:103A10001490002928D0014610A801806846292169 +:103A2000877309028181058608A8007C002341086C +:103A300060784900C007C00F014308A80174FD2049 +:103A400001406078A54A8007C00F4000014308A8E4 +:103A500001740CA9022001910090029503A810990D +:103A6000F9F78BFC01002FD16068002828D020696D +:103A700000280DD10AA90EA8FFF7D5F960788007B4 +:103A800006D46946088D03210903884369460885E1 +:103A9000904968468773FE31818190492089891E4B +:103AA00008F047FF62680D9811AB019200900293F5 +:103AB0000A46002303A80A99F9F75FFC010003D125 +:103AC0002078C10603D400E086E080062AD5684647 +:103AD0000586606900280DD109A90EA8FFF7A3F992 +:103AE0006846818C032080028143012080020918EE +:103AF000684681846946888CC82108436946888461 +:103B000074488F73FF30888112AA0CA90220029298 +:103B1000019100900023714A03A80999F9F72DFC3F +:103B2000010059D12078C00729D068460586A069D0 +:103B300000280DD10BA90EA8FFF775F96846818DF5 +:103B40000320800281430120800209186846818594 +:103B50006846818D402001436846818587736049AE +:103B6000818113AA0CA902200292019100900023E6 +:103B70005A4A03A80B99F9F700FC01002CD1E06820 +:103B800000282DD010A814990180554968468773E4 +:103B9000491C8181E16808A80A7802744978417457 +:103BA000E0684122418868464186E0680023017947 +:103BB00008A80175E068D200C18808A84175090A03 +:103BC00081750CA8072101900091029503A8109916 +:103BD000F9F7D3FB010003D00F9800F0EAFEFDE5F2 +:103BE0003D480321001F0170002E0AD080883080DC +:103BF00010A88088708010A80089B08010A88089E3 +:103C0000F0800020EAE530B501248BB015460B4664 +:103C1000012802D002281CD104E0684605218473E3 +:103C2000C90203E02B4968468473891E8181002BF9 +:103C300012D0032100208902884301218902401803 +:103C40006946888405AA04A91846FBF79EF800284F +:103C500004D007200BB030BD1020FBE76A46127C71 +:103C60001D480092801E05A9FF3201910290FF328B +:103C7000002303A803320999F9F77FFB002802D03B +:103C8000FEF75FFFE6E71448001F002D01D04188D2 +:103C9000298004700020DDE770B592B0044601264B +:103CA00008A886700F496846018410AA08A9304602 +:103CB000FFF7A9FF00284DD12078074DC007002449 +:103CC0002D1F002848D01C21684608F028FE0BE074 +:103CD00000D0010003280000C411002003020000EE +:103CE00003290000011800006846017820200143E4 +:103CF0006846017008A88670F949684601841194E5 +:103D00000794817FF92001406846891C8177002053 +:103D10000146684601770020014668464177042144 +:103D20008185C485018607A80A9011A80D9008A86E +:103D300009900EAA09A96846FFF730FD002809D1AD +:103D40006846008FE8806846808F2881401C688123 +:103D50002C70002012B070BDEC802C8110A800885F +:103D6000F4E7F7B5DF4900260A789EB0012A04D0AF +:103D7000022A02D0082021B0F0BD4A88824201D038 +:103D80000620F8E71F98824201D10720F3E70122BD +:103D900010A98A75D4488882002003239B0201461B +:103DA00099439302CB1810A90B8669468A81CF4AA2 +:103DB000CA8118A9887110A9888419A90491694633 +:103DC000CA820690FF20087503A8F9F7AAFB002411 +:103DD0002546274608AA052103A8F9F7A5FB0028D0 +:103DE00010D082286FD1002C6FD0002D6DD010A87C +:103DF0008480C5800021017418A8807B11AC012843 +:103E000065D06DE008A88079002F21D0012857D116 +:103E10006846818CB44881421CD113AA0DA90520A3 +:103E20006B4607C36846408C10230022FF21F9F738 +:103E3000EDFB002868D110A88089042801D006284D +:103E40004CD16846818E1F98814239D10F2092E76C +:103E5000012835D16846808C0521C902884202D0EC +:103E6000491C88422CD19F4841886846408C814239 +:103E700001D1012700E00027002C01D0002D10D037 +:103E80001F9988421CD113AB0DAA05216E460EC6A0 +:103E9000044610230022FF21F9F7B8FB002833D194 +:103EA00001E035460CE010A88089022801D01028D6 +:103EB00014D1C0B21BAA0DA9FAF741FF00280DD1F9 +:103EC0006846468C86E71FE0FFE7052053E714A904 +:103ED0001BA8221DFAF759FF002801D003204AE74A +:103EE00010A8007C0023001DC2B210A80274209804 +:103EF00002900194009215A81C99F9F73EFA002847 +:103F000002D1784902220A70FEF71BFE33E710B592 +:103F10000B46401E86B084B203AA00211846FEF765 +:103F200039FF04AA052103A8029201910090012300 +:103F30000022FF212046F9F785F904466846008AE9 +:103F4000012804D06D206A49000108F014FE2046C3 +:103F5000FEF7F7FD06B010BDF0B5624F04463878A5 +:103F600087B00E46032804D0042802D0082007B0EA +:103F7000F0BD04AA03A92046FEF7E5FE0500F6D130 +:103F8000606880784007800F02280DD168468089DC +:103F90008004800F08D02069002805D055490968A1 +:103FA000884201D21020E2E7208905AA6B462169E8 +:103FB00007C369460A8A638920680399F9F7DDF91E +:103FC000002802D0FEF7BDFDD1E7002E02D06846E2 +:103FD000808A3080042038702846C8E738B50C0045 +:103FE000054609D000236A46FF21F9F771FB002836 +:103FF00004D0FEF7A6FD38BD102038BD6946204626 +:10400000FEF74BFE0028F8D1A078FF21C307DB0F95 +:104010002846009AF9F784FBEBE73EB50C0009D07F +:1040200002AB6A46FF21F9F753FB002804D0FEF7E4 +:1040300088FD3EBD10203EBD0321204608F06DFCEA +:104040006846008801A90005800FFEF712FE0028CF +:104050000BD16846007920706846008801A9800469 +:10406000800FFEF706FE002801D003203EBD684603 +:1040700000796070A278EF20024068460088C10B8A +:1040800009010A43F7210A404104C90FC9000A4344 +:10409000A270F9210A40800601D5022000E001202B +:1040A000400069460243097A50084000C907C90F19 +:1040B0000843A07000203EBD7FB514460522019242 +:1040C00003AD029500930A462388FF21F9F7BAF859 +:1040D000694689892180FEF734FD04B070BD000077 +:1040E000052A0000C011002002280000FFFF000088 +:1040F0008833010020010020F3B5002799B06846FD +:104100000C4607873D4600291ED0E068002806D0EF +:10411000A068002818D001886A461187078019987E +:10412000FAF7BFFE002812D0007822287ED3199813 +:1041300000F03BFC002300901A460321199801F07F +:10414000F5F9060009D104E010201BB0F0BDFD48D0 +:10415000FBE7FD49FD4808F00EFDA078012803D0DB +:10416000022801D00720F0E72088002808D0401E50 +:1041700080B203AA0099F9F7A8F9002859D11DE0E7 +:10418000F048401CE1E76946498A228891420BD2F7 +:104190006846807D0025012810D16846808AEC4958 +:1041A00088420BD1012509E0914203D1002D2AD08C +:1041B0006D1C01E0022D0BD0032D04D203A8F9F7EA +:1041C0008DF90028DFD082281BD0002831D11DE0D6 +:1041D0006946897D0129F1D16946DD4B8A8A5B1EDA +:1041E000D11A9A420FD005DCDA48101A0BD00128F8 +:1041F000E4D108E0012906D0FF390129DED10325E9 +:10420000E1E7022D15D10D2080029EE7E06800282D +:1042100016D00EA9052202910192009069460B8FDB +:10422000A2882088FF21F9F70DF800E01EE00028A1 +:1042300002D0FEF786FC88E76846A168008F0880F8 +:104240006846008AC00601D5C3487EE70798002863 +:1042500003D06846008B022801D0032075E7079839 +:10426000A1780078012903D0800710D408206CE7DA +:10427000C007FBD000220721199800F016FF002884 +:1042800002D00725022004E0AE48801C5DE702252D +:10429000032008A908702188684681851998083686 +:1042A0000A90099617216846818712AB02330FAA3C +:1042B000052108A8009703F022FA002802D0FEF793 +:1042C000ACFC42E710A800906846838F0422294680 +:1042D000199800F002FC38E770B5064615460C4602 +:1042E0000846FEF7EBFB002804D12A46214630465B +:1042F000FFF789FCF2E610B5FFF733FD10BD70B58E +:104300001E4614460D0014D0002C12D061680029FE +:104310000FD00121FEF741FE002809D12068FEF7E9 +:10432000CDFB002804D1324621462846FFF736FA55 +:10433000D4E61020D2E670B515460C000ED002214E +:10434000FEF72BFE002808D12068FEF7B7FB0028F7 +:1043500003D129462046FFF7FFFDBFE61020BDE64A +:10436000F8B506467D480D46016814468A4231D3A9 +:104370006068002808D07A4A90422BD30122920428 +:10438000904201D3884225D37648864204D03046F5 +:10439000FAF787FD00280CD0304600F006FB0646F1 +:1043A000284600F0BFFA002804D16068002802D037 +:1043B00012E06448F8BD00236A4631462846F9F702 +:1043C00087F9002802D0FEF7BCFBF8BD68460088DC +:1043D000800601D41020F8BD618822462846636813 +:1043E000FFF76AFEF8BDF7B55C4E0746306886B049 +:1043F0001446824202D2102009B0F0BD384600F0C7 +:10440000D4FA05465748874201D0FF2D08D0002333 +:1044100004AA29460798F9F75BF9002826D101E09C +:104420004848E9E76846008AC00601D54A48E3E7FC +:1044300003A9002002910527019000976288494B4B +:1044400029460798F9F7E2F800280FD16168326829 +:10445000914208D3019102900097238862882946EF +:104460000798F9F7D3F8694689892180FEF769FB37 +:10447000C2E7002907D03C4B0A881B899A4202D820 +:104480003048401C704737E610B586B004236C46B0 +:10449000A382354BDC88002C07D01B898B4201D2CC +:1044A000914204D92748401C54E5062052E56B464A +:1044B00019825A820021009101911C800221997079 +:1044C00005A9029104A903916946FFF715FE41E58C +:1044D000F3B50C4685B0812069460873002C1BD0CB +:1044E0000598FAF7DEFC070018D03878222869D33F +:1044F000059800F05AFA049000220121059800F076 +:10450000D4FD00280CD000231A460321059801F0A1 +:104510000DF805000AD105E0102028E5094826E538 +:10452000112024E50849114808F025FB28460830E9 +:1045300002F03CFD06462078012819D0022838D028 +:10454000072014E50230000088330100E108000074 +:104550000328000000280000013400002001002092 +:1045600000D00100FFFF0000C0110020840A0000FD +:10457000A18803AAFEF71CFB0028CED1B00721D5E5 +:104580006846007B00281FD1A079C0071CD0E068D6 +:10459000002205216B4607C3638922896888049934 +:1045A000F8F750FE6946087300280DD0FEF7C9FAE7 +:1045B000DDE4A18803AAFEF7FBFA0028ADD1342080 +:1045C000064201D10820D2E46846037B29463846DA +:1045D000059AFEF70BFDCAE4FFB597B000200190E5 +:1045E0001F4615460C460E461798FAF75AFC002847 +:1045F00004D00078222803D20820A6E5F448A4E5D8 +:10460000B80801D00720A0E5032F00D10027179894 +:1046100000F0CBF90890002C1BD0022D77D3ED4889 +:10462000006884427CD361190091012902D0491E9F +:10463000814275D3AD1EAAB22146E74803F036FB8E +:1046400000991E394A7F0B7F11021943884267D1B6 +:10465000ADB2E248B90702D50189491C00E0012149 +:1046600089B20091F90701D0078900E0DA4F03AA67 +:1046700008990098F8F729FF0DE0F078B17800026A +:10468000084310284CD80199091D401880B20190A8 +:10469000A84245D82618002E60D0707831780002E4 +:1046A000084300998842E8D358E06946098A0A0716 +:1046B00054D5002C3FD0019AA618121D92B209922F +:1046C000F278B37812021A439446102A28D8099A2D +:1046D0006244AA4224D87278337812021A43904274 +:1046E0001ED1C8061ED509980AAA052120186B46B6 +:1046F00007C37078317800020843634600220899A6 +:10470000F8F7A0FD002803D0FEF71BFA1DE507E02F +:10471000F078B178000208436946098D884201D0DB +:104720000B2012E5F078B17800020843099940188F +:1047300080B2019006E0C90604D50899FEF793FC03 +:104740000028E3D16946088A102188436946088217 +:10475000488AFF23049A0899F8F7E2FF03A8F8F7BC +:10476000BDFE002803D16846408AB8429DD9002387 +:104770001A460321179800F0D9FE040003D1984986 +:10478000984808F0F8F920880028BFD0012108A82F +:104790000170017300264673218868460186204611 +:1047A0000830099017980A90F6F7DAFC05001BD03C +:1047B0001798688017206946888010AB023301AAD9 +:1047C000052108A8009502F09AFF074668780007BF +:1047D00004D584488249223008F0CDF9002F09D051 +:1047E0003846FEF71AFAB0E413211798FBF74CFE8F +:1047F0000320AAE40EA800906846838804220121C1 +:10480000179800F06AF900288BD126809DE4F0B556 +:1048100000248DB01F4615460E46002A04D0B90864 +:1048200004D007200DB0F0BD1020FBE7032F00D10E +:10483000002700F0BAF80390FF2804D06749B807B2 +:1048400003D5488902E06248ECE70120FA0702D06C +:104850004989491E00E0604906AA8FB20399F8F71A +:1048600034FE38E06946898B090734D504AB05214D +:104870000022029300910192574B0399F8F7C6FE6C +:10488000002821D1002E21D06A46128A2988A21838 +:104890003019121D914234D36946CA8B0270120A34 +:1048A00042700A8A8270120AC27004A90522001D91 +:1048B0000092029101906946C88B0B8A00220399ED +:1048C000F8F7A4FE002801D00320ABE76846008A71 +:1048D0002018001D84B206A8F8F700FE002804D0B6 +:1048E000822806D0FEF72DF99CE76846C08BB842B7 +:1048F000B8D9002C07D0002E10D02988A01C8142E6 +:1049000003D20C208EE705208CE722463146324840 +:1049100003F0CCF931190870000A4870A41C2C80EF +:1049200000207FE700B585B06946FEF79FFA0028B2 +:104930000AD16846007C030008F036FA08052F2FDC +:104940002F2F08080531032005B000BD6846807888 +:10495000012807D1684600880321C902401A1CD0EB +:1049600001281AD068468079012806D168468088D7 +:1049700015214902401A05280FD96846807A012876 +:1049800011D16846018929200002081A05D00228A1 +:1049900003D0032801D0042805D10F20D4E712A1A9 +:1049A000164808F0E8F80020CEE710B500F0B4FD96 +:1049B00010BD10B50C46F8F75BFD002803D00AA126 +:1049C0000F4808F0D8F82046FEF7BBF810BD0000ED +:1049D0000230000020010020FFFF0000C011002075 +:1049E000883301003F0B00007372635C676174746D +:1049F000735F636F72652E63000000002202000087 +:104A0000BB06000030B50346072903D00820DA783A +:104A10001C7916E00720FAE707290BD05500ED189E +:104A20006D79072D01D0401EC0B2521CD2B20F2AA0 +:104A300007D105E05500ED186D79072DF3D0F4E7A7 +:104A400000222546641EE4B2002DE5D130BDFFB53D +:104A500081B00C461646114620460A9F0B9DFFF773 +:104A6000D1FF00280AD020790F2803D3FEA1A0206F +:104A700008F081F8A078C00907D019E0072E02D00D +:104A8000112005B0F0BDFD48FBE701982880381DD6 +:104A90006880002068712871EF800498288128467A +:104AA00000F06FFC002803D1EFA1AD2008F063F8FF +:104AB000E07821794018491CC0B221710F2801D338 +:104AC0000F38C0B24000001946718179F1224908BF +:104AD0004900114081710020D3E7FFB583B01C4627 +:104AE00016460F4600231A4602210C9D039800F03B +:104AF0001DFD010008D033463A4601950094039805 +:104B0000FFF7A5FF07B0F0BDDC48801EFAE7F0B55F +:104B1000054616460F4650888DB00023012202211B +:104B200000F004FD040003D1CFA1DF2008F023F83A +:104B3000002069460871A078400603D1CAA1E3208D +:104B400008F019F8042F5ED32A78D007C017401C4C +:104B500006D161786B78994255D12178090752D0F6 +:104B60000121142A46DA012A42D0122A02D0132A3D +:104B700040D128E00C2F3DD1A2785206520E012AD6 +:104B800038D0207800090001401C207068786070DF +:104B90006846017168792A790102114368460181EA +:104BA000E879AA790102114368464181687A2A7A34 +:104BB0000102114368468181E87AAA7A0102114311 +:104BC0006846C1811AE0062F14D12078000900013F +:104BD000207071880120F7F788FD02216846017175 +:104BE000C91E018168792A790102114368461FE0D4 +:104BF000062F0AD06A461279002A1BD070883246E6 +:104C000001A9FAF776FF0DB0F0BD20780009000188 +:104C1000207071880120F7F768FD02216846017154 +:104C200068792A7901021143684601810021C9434C +:104C30004181E3E70028E6D0748868468176697888 +:104C4000C176022181830021C18304A8052200903E +:104C5000062311462046FFF740FF0028D3D088A145 +:104C6000D62007F088FFCEE7F7B58CB015460C9933 +:104C70000D98FDF782FDC0B2082851D10020694689 +:104C80008885688800230122022100F04FFC04007F +:104C900004D1FF2074A1633007F06DFF01230021D0 +:104CA000E07822790BE04600361976799E4201D1F0 +:104CB000491CC9B2401CC0B20F2800D100201646C2 +:104CC000521ED2B2002EEED1002902D11720694621 +:104CD000888504AB02330BAA00950C990D98FEF75A +:104CE00035FD0006000E07D002281BD0032817D080 +:104CF000FF205DA1893011E06846808D00280FD02B +:104D000002A9019100906888042301222146FFF73F +:104D10009EFE002804D0FF2053A1763007F02BFF21 +:104D20000FB0F0BD6878102108436870F8E70020E4 +:104D3000584902464300401CCA520828FAD370471B +:104D40000021817001780909090101700021417079 +:104D5000C1700171704770B50D4600230122022118 +:104D600000F0E4FB040004D1FF203FA1CF3007F0A6 +:104D700002FFA0786906C009C001490E0843A0706F +:104D800070BD704710B501460120F7F7AEFC10BDAD +:104D90003EB58DB2002301220221284600F0C6FB59 +:104DA000040004D1FF2030A1E43007F0E4FE2078B5 +:104DB000694600090001207002200870364888808A +:104DC000C88000222846FAF794FE3EBDF7B5054696 +:104DD0000078002700090C463E46012804D0FF2039 +:104DE00021A1F33007F0C7FE287A03280CD0412018 +:104DF0001DA1C00007F0BFFE0298002C068001D064 +:104E0000278066800020FEBDEA89702710460A30A0 +:104E100086B2002C0AD06888A080A8892081E28010 +:104E200020460A30296907F01BFDE5E70298068055 +:104E3000E8E7F8B543680246D9799C79090221432D +:104E40005C7A1E7A25025C88981D3543241FA14296 +:104E500038D11B79022B35D1042D34D0052D3DD00E +:104E6000062D34D0402D19E07372635C6C3263619F +:104E7000705F636F72652E630000000004300000F5 +:104E80007372635C6C326361705F636F72652E6313 +:104E900000000000CC110020FFFF000012D3061D0F +:104EA0000F461446284600F0E9F908280AD01120D8 +:104EB000207003202072A581E78126616078082197 +:104EC00008436070F8BD001DFFF7CEFEF8BD031D5E +:104ED00050880A461946FCF77EF9F8BD001DFFF719 +:104EE00016FEF8BD70B50D4600238CB006461A4676 +:104EF000022100F01BFB040031D020780007000FD6 +:104F000001282ED012206946887460780523801C01 +:104F1000C874082088822888C88268880883A8887E +:104F20004883E888888302A90C20019100901A46E2 +:104F300021463046FFF78BFD00280ED1F0230022DA +:104F400031460120F7F72CFB207800090001401CB6 +:104F500020706078801C607000200CB070BDCD485F +:104F6000FBE71120F9E770B50D4600238CB006462B +:104F70001A46022100F0DAFA040006D02078000771 +:104F8000000F012803D00820E7E7C248E5E7132116 +:104F9000684681746178C17402218182C58202A948 +:104FA00006200523019100901A4621463046FFF75E +:104FB0004EFD0028D1D1207800090001207000208A +:104FC000CBE7F3B581B00D46002301220221019801 +:104FD00000F0ACFA00260446002803D1AE49AF48E1 +:104FE00007F0C9FD2079A8423BD2AC48AA49401C31 +:104FF00007F0C1FD35E0E07841000F19401C7979D8 +:10500000C0B20091E0700F2801D10020E07020793B +:10501000401E2071B879C00708D000980199042873 +:1050200015D09D498220183107F0A5FDB8790007F9 +:10503000410F08D0400F019904280CD096498F20C9 +:10504000183107F098FD009807280AD107E00846B4 +:10505000FCF73EF9EAE70846FCF70DF9F3E7761CA2 +:10506000F6B228466D1EEDB20028C4D13046FEBD12 +:1050700010B500230122022100F058FA040004D1E7 +:10508000B5208549800007F076FDE0782179401849 +:10509000C0B2E0700F2801D30F38E07000202071FB +:1050A000A07880210843A07010BDF8B517460D46C2 +:1050B00000231A46022100F039FA040005D0002D21 +:1050C0000CD0002F07D0062006E0072D01D00820C5 +:1050D000F8BD0720F8BD0820A84204D86F486E49E3 +:1050E000423007F048FD29462046FFF78BFC064674 +:1050F000002F28D0002E26D1E07821791CE0420034 +:1051000012195379072B03D093791B075B0F04D037 +:10511000401CC0B20F280CD00CE040000019807970 +:10512000F12318406B071B0F1843907100290AD117 +:1051300004E00020491EC9B20029E0D15748564971 +:105140005A3007F018FD3046F8BDF8B50D4600237B +:105150001A46022100F0EAF9040004D14F484E49F2 +:10516000683007F008FD681E052804D34B484A49FB +:10517000693007F000FD0F21E2782079002310E06C +:10518000560036197779AF4206D1B17949084900FE +:10519000B1715B1CDBB21146521CD2B20F2A00D196 +:1051A00000220646401EC0B2002EE9D10F2905D2CA +:1051B0004800001981790122114381711846F8BD18 +:1051C00010B50446402801D2072010BD00F056F863 +:1051D000082802D03120000210BD0021304802E032 +:1051E000491C082903D24A00825A002AF8D108290A +:1051F00003D049004452002010BD042010BD10B55A +:10520000402801D2072010BD00F038F8082805D04A +:105210000021234A40001152084610BD052010BD50 +:10522000F0B58BB016460C00074607D0002E05D00F +:105230006188402904D207200BB0F0BD1020FBE7A5 +:105240002088002801D0172801D90C20F4E708464F +:1052500000F014F808280FD0258803A82A46314604 +:10526000023007F0FDFA01A8009062882B46072162 +:105270003846FFF732FCDFE70520DDE70146002076 +:10528000074A02E0401C082803D24300D35A8B424D +:10529000F8D1704702300000684E0100AD020000F6 +:1052A000CC11002010B5031D03600020521E04E045 +:1052B0005C181C60401C2346C0B29042F8DB002002 +:1052C000186010BD01460A680020002A02D010466E +:1052D00012680A60704702680A6001607047000047 +:1052E00000B51E2823D00BDC0C281CD01FDC0300CB +:1052F00007F05AFD090F1D111D1D171713151D006D +:10530000302814DD3A38030007F04EFD030F110971 +:105310001100002000BD214800BD042000BD0D206B +:1053200000BD0F2000BD082000BD112000BD0320DE +:1053300000BD10B50C4601F011FB00281ED0204620 +:1053400000F086FC002816D022780E2A0DD00F2AF5 +:105350000BD0022A09D0032A07D0102A09D010A1A5 +:105360007C2007F008FC002010BDA078FFF7B8FFF4 +:1053700010BD112010BD0AA18220F2E708A18820EB +:10538000EFE710B500F0A5FA10BD10B500F060FC15 +:1053900010BD10B500F0FBFA10BD00000230000097 +:1053A0007372635C686F73745F6863692E63000077 +:1053B000F8B50546E54C079E069821706270A3700B +:1053C000E6702071681C42085200E14B0021880001 +:1053D00000198446C261605C40008218002D0AD02A +:1053E000002005E066464700F669401CF353C0B252 +:1053F000665C8642F6D8491CC9B20529E7D3002667 +:10540000D21C9708B000BF0000198760304600F03A +:1054100042F9A15D761C4843C219F6B2052EEFD3BE +:10542000501B80B2F8BDF0B50546C84F8C46002031 +:10543000FF247E5DA90096460346CF190CE0F9696A +:105440005A008A5AC2498A4204D1401CC0B2FF2C79 +:1054500000D11C465B1CDBB29E42F0D8614600299D +:1054600009D100280BD0002D07D0B84949788E42C9 +:1054700003D2401EC0B2002801D071460C70F0BDAE +:1054800070B5B24C8D0000232D19615C09E0EC6908 +:105490005E00A45B844202D11370012070BD5B1CCE +:1054A000DBB29942F3D8002070BDFEB51C4617460A +:1054B0000D46060008D0002D06D0F01C80088000A4 +:1054C000B04203D01020FEBD0E20FEBD002F03D041 +:1054D000002C01D0A74201D90720FEBD009423462D +:1054E0002246394600200194FFF762FF2988814255 +:1054F00007D0814201D2042100E00921288008461A +:10550000FEBD009423462246394630460194FFF7FB +:105510004FFF28800020FEBD10B5044600F0C5F8FE +:10552000002801D0E0B210BDFF2010BDFFB5054638 +:10553000874881B01E460C46854204D0052C02D215 +:105540000398022802D3002005B0F0BD0027694669 +:105550000F7028466A462146FFF792FF00280ED0BA +:1055600068460178204600F0A8F8002EECD000280C +:10557000EAD1284600F099F8002809D103E038461E +:10558000002EF6D1E0E7FF2072A15C3007F0F3FABD +:1055900021462846039A00F09CF8D5E7F8B5054661 +:1055A0000C4600206A4E69466E4F0870B5423BD0EB +:1055B000052C01D30720F8BD0A4621462846FFF7EF +:1055C0005FFF002830D068460178204600F075F86B +:1055D000230007F0E9FB0504090C11161B00014626 +:1055E0002846FBF709FD15E0FAF756FC12E00146E4 +:1055F0002846FFF7C6FB0DE001462846FEF729F8CE +:1056000008E001462846FCF740FF03E056A17B2056 +:1056100007F0B1FA4D4A6846A10000788918C969B7 +:1056200040000E520020F8BD3846F8BD524A1268BC +:10563000914201D210207047052801D307207047FE +:105640000872002048727047F8B504464A4800685E +:10565000844201D21020F8BD207A3C4A83009B1876 +:10566000617A3B4D125C11E0DE694F00F65BAE42A1 +:105670000AD04A1C6272DA694B00D25A228000F0CA +:105680001CF860600020F8BD491CC9B28A42EBD802 +:1056900061720520F8BD0EB5384B40000ECB00916D +:1056A000029301926946085A0EBD28494978814201 +:1056B00001D9012070470020704770B50C4605469F +:1056C000FFF7E9FF214AA90089188968604340185B +:1056D00070BDF8B50C4606460020694613460870B2 +:1056E0006A4619462046FFF79EFE002500282BD06B +:1056F000164A6846A10000788918C96940000E5210 +:10570000684601782046FFF7D8FF0546230007F0DA +:105710004BFB0504090C0F14170029463046FBF714 +:1057200047FC11E0FAF796FB0EE0FFF709FB0BE0F0 +:1057300029463046FDF754FF06E0FCF79FFE03E0E4 +:1057400009A1622007F017FA2846F8BDDC110020F5 +:10575000FFFF00007372635C686F73745F636D2E8C +:1057600063000000023000007372635C686F737442 +:105770005F636D2E63000000200100205CCF0100FC +:1057800038B50446002069460870204602F0E3FF61 +:10579000002803D1FBA1A32007F0EDF9204602F079 +:1057A00029FF002803D1F7A1A82007F0E4F96846F3 +:1057B000007838BD70B5F84D002428462C7720308D +:1057C0008471C47101F09AF9284640380470203081 +:1057D0008473847484772C75AC7170BD10B50C46DD +:1057E000EE4982888A8042884A800078087008469C +:1057F0000E38847002F0E0FE02F08DFAFFF7DAFF57 +:10580000204604F0A3FAE449A8310846813803F0A1 +:105810003DF9E24805F0B1FDE0480A3802F08EFAA1 +:10582000002803D0D7A1C52007F0A5F901F066F93B +:1058300010BD7CB50E461D46144601A902F098FA2B +:10584000002807D103F021FE022803D1D248007DB1 +:10585000002801D001207CBD01988030807C02F0BE +:10586000DDFE00280CD0684602F0E2FE0028F2D0EF +:10587000002C03D002F0A1FEA04206D200207CBD85 +:10588000C0A1C74807F077F9F8E7009802F068FB75 +:105890003146009802F06BFBE2B22946009802F014 +:1058A00080FC02F0D5FE002804D1BD48B5A11E3011 +:1058B00007F061F9B94C00250E3C6068A0304179D1 +:1058C000002902D0457104F068FB60688030458390 +:1058D000C0E730B40179002904D0012907D030BCD9 +:1058E00000207047831D42880488022103E042881B +:1058F0000488831D0121204630BC9AE7F8B51D4677 +:1059000014460E46074603F0C0FD022803D0A24805 +:10591000007D002823D0A1480E384168498839808D +:1059200040688030807C02F0F9FF002804D15320C9 +:1059300094A1C00007F01FF9684602F0F9FF0028A3 +:105940000DD0009802F04AFB3070022808D00128E0 +:1059500006D093488BA1673007F00DF90020F8BD01 +:105960002946009802F034FC2080002804D15520FC +:1059700084A1C00007F0FFF802F0EDFF002804D179 +:10598000874880A1603007F0F6F80120F8BD38B5EF +:105990000446831D821C6946FFF7B0FF00280DD026 +:1059A0000020607168460078012808D0022806D0DF +:1059B000FF2074A1013007F0DEF8012038BD20710E +:1059C000FBE7F8B503F061FD744D734C0E3D022802 +:1059D00002D0207D00287DD0207F0026102818D1FD +:1059E000A079002803D067A16E4807F0C4F8686862 +:1059F00001464030827F92070BD52672498861812B +:105A0000C17F2173018CE181408C20820120A07133 +:105A10002677614F203FB87C00285ED168686946D0 +:105A20008030807C02F097FE002805D069466878B7 +:105A300009784018687004E05A4852A1193007F0FC +:105A40009AF8207D00283AD068684188524840384A +:105A5000806D4088814204D00F204AA1C00107F028 +:105A60008AF868688030807C02F058FF002804D1F2 +:105A70004C4844A1243007F07EF802F07EFF002855 +:105A80001DD068688030807CFFF77AFE6978401806 +:105A9000687041484038806D4030417A01290DD10D +:105AA0002670696849886180807A20710120B87702 +:105AB000207F102801D0282800D126772675697804 +:105AC00000290AD06868428833484038C286018776 +:105AD000012000E001E0B8746E7003F0B9FC00280A +:105AE00005D1207D002802D0A878EDF715F9F8BD82 +:105AF000F8B50446FFF765FF274D0026203DA87E38 +:105B0000002808D0667010202070E87EA070287FE2 +:105B1000E070AE769AE0204F403F3878002808D0F9 +:105B20002C22B91C204606F09BFE0E2020703E70F1 +:105B30008CE0A87B184F002815D0387F102808D09B +:105B4000282806D0002804D0FF200EA1C23007F07C +:105B500012F80120E070E87BA070287C60700F20B4 +:105B60002070AE7372E00121204602F029FF002868 +:105B70001AD0387D002857D10021204602F020FF9E +:105B8000F8BD00007372635C6C6C5F6374726C2EA2 +:105B900073302E63000000007C1200206A01002098 +:105BA0004F02000062070000A97CF8480090F84806 +:105BB000002910D0017805290DD2491C01706670AA +:105BC0000D202070012028750622A01C009906F0E7 +:105BD00047FEAE743AE0EE480670B879002812D05D +:105BE000387F002804D00120EA49400206F0C3FFB4 +:105BF00066700120E54920700A221431A01C06F0CD +:105C00002FFEBE7122E0204605F013FB00281DD1B7 +:105C1000A87C002802D0DE480178CEE7A87F0028C3 +:105C200002D0387D002801D00020A9E7387F002865 +:105C300003D0D849D84806F09EFF66700A2020702D +:105C400006223946A01C06F00BFEAE77012097E72E +:105C50004EE710B5CD4C343C2178002904D01321F7 +:105C60000E2000F052FF10BDC9490088091D02F046 +:105C70007FF8002801D0022007E0C54840680146AF +:105C800020318A79012A02D00C20207105E00022FF +:105C90002271097E21724088E08001206071132109 +:105CA000E1700E21A170207010BDB84810B53438D5 +:105CB0000178002904D024210E2000F026FF10BD19 +:105CC000012101702422C2700C220271417110BDA9 +:105CD00070B5AE4C0546343C2078002804D03E21F7 +:105CE0000E2000F012FF70BD03F0CFFB002808D19A +:105CF00003F0CEFB002804D1A4480C30007F00281C +:105D000001D00C2003E0287802F0C3FF00202071AE +:105D1000012060713E21E170207070BD9B4810B57C +:105D200034380178002904D03C210E2000F0EDFE2B +:105D300010BD00210171012141713C22C27001702E +:105D400010BDF8B5914C343C2078002804D03B219C +:105D50000E2000F0DAFE13E70020A07103F095FB9F +:105D60008A4E01250C36022802D0307D002840D012 +:105D7000874F694678688030807C02F003FD0028F8 +:105D800003D18449854806F0F6FE307D002806D010 +:105D9000A06D4030407A002801D0012600E00026A6 +:105DA00078688030807C02F0B9FD002804D17B48FF +:105DB0007849083006F0DFFE02F0DFFD684031462A +:105DC000014316D07968FD2249882181217E400057 +:105DD0004908490031431140014321766846007863 +:105DE000002802D00420014301E0FB20014021767D +:105DF000A5710020207165713B20E0702570BFE621 +:105E000010B5624C343C2078002804D00E2108469E +:105E100000F07BFE10BD5E4906220831A01D06F091 +:105E20001FFD00202071012060710E21E1702070A3 +:105E300010BD70B5554C0546343C2078002804D080 +:105E400038210E2000F061FE70BD50480C30007FFC +:105E5000002807D00C202071012060713821E170EA +:105E6000207070BD287802F002FF287805F0EBFB67 +:105E70000020F0E770B5454D0446343D28780028F1 +:105E800004D037210E2000F040FE70BD3F480C309A +:105E9000007F002801D00C200AE03D4E2188706868 +:105EA0004088884203D103F0F0FA022807D002208C +:105EB0002871012068713721E970287070BD716800 +:105EC0007F2020310876487600208876A2788A7173 +:105ED000E278CA7122790A72EAE710B52B4C343C99 +:105EE0002078002804D039210E2000F00EFE10BDCD +:105EF00003F0CBFA032808D003F0CAFA032804D031 +:105F000022480C30007F002801D00C2003E01F49FC +:105F100000202C31C8712071012060713921E1709D +:105F2000207010BD70B5194C0646343C207800280E +:105F300004D03A210E2000F0E8FD70BD03F0A5FA70 +:105F4000032808D003F0A4FA032804D00F480C302B +:105F5000007F002801D00C2011E00C4D2C35E87991 +:105F600008280BD20001001910223146683000F0D9 +:105F7000D6FDE879401CE871002000E00720207180 +:105F8000012060713A21E170207070BD7012002014 +:105F90005C010020845B0100210200001708000062 +:105FA000F8B5FA4E04463078002804D03D210E2082 +:105FB00000F0ABFDE4E5F5484030007F002801D05B +:105FC0000C2034E0F24D218868684088884203D173 +:105FD00003F05BFA022801D0022028E06F68648891 +:105FE000FD883A896800B988401C844218D3E94882 +:105FF00041431046E84A504306F09BFC401EFF21F7 +:1060000080B2F531884200D90846844200D2204649 +:10601000691C401C06F08DFC6D1C6843401E85B257 +:10602000E620C05D002800D1BD84F58000203071DD +:10603000012070713D21F1703070A1E5F8B5D34CAD +:1060400005462078002804D035210E2000F05DFDA3 +:1060500096E5CE484030007F002801D00C2016E0A5 +:10606000A878002801D0012804D1A888FF21F531A3 +:10607000884201D912200AE0C54F298878684088F3 +:10608000884203D103F001FA022807D002202071D0 +:10609000012060713521E170207071E5796800267A +:1060A0000846C0310E70AA884A800122A0300271D1 +:1060B000AA78012A00D000220A704079002801D075 +:1060C00003F06BFF2671E3E770B5B04C054620780E +:1060D000002804D030210E2000F017FD55E703F012 +:1060E000D4F9002804D1A9484030007F002801D00D +:1060F0000C2003E0287803F070FE002020710120BE +:1061000060713021E17020703FE770B59F4C05460B +:106110002078002804D033210E2000F0F6FC34E76C +:1061200003F0B3F9002804D198484030007F0028DC +:1061300001D00C2018E02978002911D00A290FD0AD +:1061400014290DD01E290BD0282909D0322907D0B7 +:106150004B2905D0642903D0FF2901D0122003E088 +:10616000284603F0B3FE0020207101206071332126 +:10617000E170207009E770B5844C06462078251D33 +:10618000002804D032210E2000F0BFFCFDE631468D +:10619000002002F03EFD2870002805D17C48062230 +:1061A0003146083006F05CFB012060713221E1705D +:1061B0002070EAE670B5754C2178002904D03121B1 +:1061C0000E2000F0A2FCE0E6002141560125042942 +:1061D00012D0002910D0081D0ED0001D0CD0001DBB +:1061E0000AD0001D08D0001D06D00A3004D00A30A5 +:1061F00002D01220207103E0084605F063FE6571AD +:106200003120E0702570C0E6FEB5604C074620786E +:10621000002804D025210E2000F077FCFEBD388830 +:10622000694601F0A5FD594D0146002008350029B9 +:1062300004D002212171286028710FE00098009E8F +:106240000A30019060360020B0710522284601997D +:1062500006F006FBB0790028F5D13888E0800E20E2 +:10626000A0702520E070012060712070FEBD10B587 +:10627000464C2078002804D005210E2000F045FC73 +:1062800010BD0020207102F098F9E08002F061FA60 +:106290002072012060710521E170207010BDF1B500 +:1062A0003A4C2034A07B002804D010210F2000F0AD +:1062B0002CFC65E4354D4035A8790C2610270028C4 +:1062C00016D1287F002813D103F0DFF8022824D14B +:1062D0002F4800994068098842888A421DD10146AA +:1062E000C0310A7A002A05D04030807F80070DD463 +:1062F000E6730EE05E22125C920707D406220A7251 +:10630000A0304079002801D003F047FE2F7700200D +:10631000E07327740120A07332E40220F8E710B57F +:106320001A480178002904D00F210E2000F0EDFB5F +:1063300010BD00210171FF2181710021C94301813C +:1063400013490E310A7882728A8882814988C18114 +:10635000012141710E2282700F22C270017010BDA6 +:1063600010B50A4C2078002804D02B210E2000F014 +:10637000CCFB10BD0821A01DF5F7DBFC002020712F +:10638000012060712B21E170207010BD3C120020B3 +:106390005C010020C40900001027000070B5FA4D10 +:1063A00004462878002804D02A210E2000F0ADFBF6 +:1063B000EBE5F54810222146303800F0B0FBF248FA +:1063C0001022A118203800F0AAFBEF483038F5F76A +:1063D0001EFFED49102210392C46A81D00F09FFB2E +:1063E000002020710E20A0702A20E0700120607132 +:1063F0002070CAE5F8B50546E348E34C403000900C +:10640000007F0C2628272034002801D0E6733EE0C8 +:10641000A07B002804D028210F2000F076FB04E4A4 +:10642000A87805280DD013280BD0142809D01528DA +:1064300007D01A2805D0292803D03D2801D03B28B1 +:1064400003D12888D149884201D912201EE003F0E7 +:106450001CF80228DAD1CE482A8840684188914247 +:1064600013D10146C0310A79002ACFD1AA784A71E6 +:1064700001220A710099A0300F770021E173407961 +:10648000002804D003F089FD01E00220E0732774A6 +:106490000120A0735FE4F8B5BB4F064638783D1D78 +:1064A000002804D017210E2000F02FFB53E43146C2 +:1064B000012002F0AEFB01242870002807D1B24869 +:1064C000062260303146054606F0CAF9AC717C718F +:1064D0001720F8703C703EE470B5AB4C064620784F +:1064E000002804D00B210E2000F00FFB4DE502F038 +:1064F000CCFF032808D002F0CBFF032804D0A24829 +:106500004030007F002801D00C2016E03378002BAB +:1065100003D0012B01D012200FE09B4DE035297AEA +:10652000082909D22846721C0C3005F07AFC287A1A +:10653000401C2872002000E00720207101206071BB +:106540000B21E170207020E510B58F4C20780028D9 +:1065500004D00A210E2000F0D8FA16E702F095FFC9 +:10656000032808D002F094FF032804D08648403066 +:10657000007F002801D00C2002E000F0BFFA0020CC +:106580002071012060710A21E1702070FDE610B5D4 +:1065900003F0C2FB002803D07E497F4806F0EBFAE7 +:1065A00001F0DBFF04F0E1FE002804D01720794958 +:1065B000400106F0E0FA02F03CFA002804D0B920CD +:1065C0007449800006F0D7FA00F098FAFFF7F2F865 +:1065D0006D4800210171012141710222C2700170D8 +:1065E000D3E610B5684C2178002904D020210E2074 +:1065F00000F08BFAC9E601781F290ED8411C0CD097 +:10660000002121710278411C104602F01FFB01207D +:1066100060712021E1702070B7E612202071F6E74A +:10662000F8B5594C2178002904D01B210E2000F028 +:106630006CFABFE401216171534E0C212171403687 +:10664000317F00296FD10078514F0025012804D0F7 +:1066500000284AD01220207165E002F016FF0028C1 +:1066600003D102F015FF002804D002F00EFF02282B +:1066700022D058E002F01FFA002854D0307D0028C4 +:1066800051D1786801224580032101F044FE7868E9 +:1066900002F0EAFB7868923001F091FF002803D104 +:1066A0003C493E4806F067FA03F09BFB002839D0CE +:1066B00085203849C00015E002F0EAFE002832D1FA +:1066C000707F00282FD001282DD004282BD002F075 +:1066D000F2F9002827D003F084FB002822D02F48AD +:1066E0002C49183006F047FA1CE002F0CEFE0328D1 +:1066F00004D002F0CDFE03280FD014E0002003F0F8 +:1067000095FA00280FD12571307D00280BD17868CB +:106710008030807CFFF734F805E0002003F086FA33 +:10672000002800D125711B20E0700120207041E479 +:1067300010B5154C2178002904D01A210E2000F044 +:10674000E4F922E601781F290ED8411C0CD0002163 +:1067500021710278411C104602F08DFA012060710F +:106760001A21E170207010E612202071F6E770B552 +:10677000054E044630780C25002811D018210E2033 +:1067800000F0C3F9AAE400003C120020FF0E000054 +:106790005C010020845B0100D3020000240400009F +:1067A00002F073FE03285AD002F072FE032856D07E +:1067B000E14A107F002852D16079002801D00128D9 +:1067C0002DD1A079002801D0012828D1A07B002854 +:1067D00005D0012803D0022801D003281FD1607BF7 +:1067E00000281CD0C0081AD1618801208003814292 +:1067F00002D82388834203D9207901280FD119E0D8 +:106800002079002806D0012814D0022805D00328BA +:1068100005D102E020290BD30CE0A02B0AD220796D +:10682000042805D12088202802D36188884201D914 +:10683000122514E0207950776079002802D00128D1 +:1068400003D00CE0BD4A002105E0BB4A203290791C +:10685000002804D00121204602F05EF905460120FF +:10686000357170711821F170307037E470B5B24C29 +:106870000546403C2078002804D02E210E2000F050 +:1068800044F92BE402F001FE0C22022815D1AA489B +:10689000007F002811D1A9482B8808384168488812 +:1068A00083421AD10846C030037A002B05D120312B +:1068B000C97E0F2903D0102901D0227103E00521E0 +:1068C0000172002020710E20A0702E20E070288818 +:1068D000E08001206071207016E40220F2E770B5BC +:1068E000954C0546403C2078002804D02D210E20F0 +:1068F00000F00BF908E402F0C8FD0C21022814D1C5 +:106900008D48007F002810D18C4E2A88083E706880 +:1069100043889A4220D1C822125C002A05D13B222A +:10692000125C0F2A03D0102A01D021710AE0102234 +:10693000A91CD63005F094FF70680421C0300172A4 +:10694000002020710E20A0702D20E0702888E080AB +:106950000120607120700DE40220F2E710B501788B +:106960000B0006F021FA3F9E9E399E9E599E9E9EE8 +:106970009E3C3F9E9E8752559E9E999E9E9E432979 +:106980009E2D319E9E9E9E359E9E9E955C9E9E4710 +:106990009E4B4F9E21259E6C6064689E709E7F83F7 +:1069A0007C788A8D74919E00801CFFF798FF76E0BA +:1069B000801CFFF75BFF72E0801CFFF7D8FE6EE0E3 +:1069C000801CFFF7B5FE6AE0801CFFF729FE66E039 +:1069D000801CFFF706FE62E0FFF7D9FD5FE0FFF7DE +:1069E000B3FD5CE0801CFFF777FD58E0801CFFF7EB +:1069F00052FD54E0801CFFF7FDFC50E0801CFFF7C7 +:106A0000CDFC4CE0FFF7ACFC49E0FFF788FC46E02A +:106A1000801CFFF744FC42E0FFF729FC3FE0801CAC +:106A2000FFF7F2FB3BE0801CFFF7C4FB37E0801C64 +:106A3000FFF7A1FB33E0801CFFF767FB2FE0801C12 +:106A4000FFF742FB2BE0801CFFF7F8FA27E0801CE1 +:106A5000FFF7A6FA23E0801CFFF764FA1FE0FFF7B8 +:106A60003CFA1CE0801CFFF705FA18E0801CFFF7D9 +:106A7000E0F914E0FFF7C4F911E0FFF762F90EE066 +:106A8000801CFFF74BF90AE0801CFFF721F906E0B4 +:106A9000801CFFF70AF902E0801CFFF7DAF80120FA +:106AA00073E4002071E470B52349244C0546403955 +:106AB000083C0A460126403260682B0006F074F953 +:106AC00005171A1A04171A000122002101F023FCED +:106AD000616800220846C0310A724A7203F0F7F971 +:106AE000002803D016A11B4806F045F860E416758F +:106AF00088655DE4174812A13330F5E70E490020A0 +:106B0000C031C8612039087270470B4A203A937E21 +:106B1000002B03D1D076117701209076704730B5E5 +:106B2000134606E0CC18203CE47FD51A44555B1E82 +:106B3000DBB2002BF6D130BD7C12002064010020B6 +:106B40007372635C6C6C5F6374726C2E73302E6353 +:106B5000000000005108000010B505F0BFF8F5F77F +:106B60004CF8EBF751FCF5F7FFFA04F0C1FF05F024 +:106B700041F810BDFFB593B0044600201D9E04905F +:106B800015981C9D1027082806D0E06901F014F81C +:106B9000002809D03770CCE02888092138432880A4 +:106BA0001F980227017016E0E16901208871052114 +:106BB000E269C9029180E1698872E169F948088156 +:106BC000E16900208873288820210843288011214A +:106BD0001F98042701701F980225801C03903078AD +:106BE00010900A203070204618301190F6F799FC6A +:106BF00000206FE01598102809D1022D07D06846B3 +:106C0000828A04990398401A8270110AC1706846FA +:106C1000C08A1699884203D9E349097A149106E09B +:106C2000884204D11099002901D0317021E00399E4 +:106C30000870000A48701E980088401BC01B83B271 +:106C4000FF20C01B984200D203460398149AC01933 +:106C50000CA90092019002912020015D6846C08A33 +:106C60000022F6F7D3FC3070002806D0C0B283288B +:106C700062D06846C08A208345E00F98002805D07E +:106C8000C948006800790A2830D33CE06846008E85 +:106C9000C119C9B20491022D0FD01F99049A4978E5 +:106CA000914203D16A46128C824209D0BE480491B7 +:106CB00000680178032909D027E008461F99487029 +:106CC000B94800680178042906D008E000790A284C +:106CD0001BD201200F9009E06946C98A818003997F +:106CE0000498081803900498281885B205AA1499E6 +:106CF0001198F6F719FC002805D11E980088401B52 +:106D0000B84200DB76E7022D0ED01598102807D187 +:106D1000049A03996846808A891A8870000AC870A4 +:106D20001E980580002030709F4800680078032876 +:106D300002D0002017B0F0BD0220FBE7F8B50446F2 +:106D4000406B0026134600282BD0491F8DB2618F5F +:106D50002A460832278F8A18BA4221D89A784018D2 +:106D60005F78110239430170090A41701A79DF789E +:106D7000110239438170090AC1700571290A4171F4 +:106D80002A46591D801D05F06BFD608FAD1D401911 +:106D900080B26087626B002110180170417000E0C2 +:106DA00009263046F8BD30B50B88048F9C4212D9B5 +:106DB000446BE0184478057824022C430BD04479C6 +:106DC000057924022C436404640CA41D1B190B8058 +:106DD0001060002030BD822030BDF7B588B000259E +:106DE0006846058205275DE00398417802780E0227 +:106DF00016434179027908021043000452D40A98DC +:106E00000123068005A802905B02002200970195ED +:106E100030460999F6F7FAFB04004AD16846018A20 +:106E2000018303984179027909021143437802787A +:106E30001C021443B4421ED10A041CD44B04012189 +:106E40005B0C890300950B4301970295C17880780C +:106E50000A02024320460999F6F7F4F9040011D119 +:106E6000039948790A79000210430122D2031043A2 +:106E70000871000A487103AA06A90898FFF793FF52 +:106E80000400CED0039900950197029548780978BF +:106E90000002084369468B8A00220999F6F7D2F965 +:106EA000822C06D103AA04A90898FFF77CFF0400EE +:106EB0009AD06846058209E003984179027909026F +:106EC00011434904490C0171090A417103AA04A93B +:106ED0000898FFF768FF0028EED0822C02D02046E9 +:106EE0000BB0F0BD0020FBE730B50446406B002539 +:106EF00097B000280DD00B2268460270228F0281C5 +:106F0000606B0391019000216846FCF7D8F8684651 +:106F1000057065636587258717B030BDF8B50F46E6 +:106F20000546696B0020069E144600290FD0012BF0 +:106F30000DD1324639462846FFF74FFF002806D1CB +:106F4000002C04D032463946284600F044FEF8BDF5 +:106F500000220280C262831D0263C36142634287D2 +:106F6000028720300170704710B50022D2430280A2 +:106F70000420F5F7BAFB10BD10B596B00446FFF734 +:106F8000B3FF208E002808D0012069460870E06A0F +:106F9000019000216846FCF792F80020E06220632F +:106FA00016B010BD012800005C13002001460988BE +:106FB00000200A0700D501200A06120F01D0022284 +:106FC0001043CA0501D5042210438A0501D51022B9 +:106FD0001043490501D5202108437047FFB5A9B0EA +:106FE0000600329D359C2B981F46229016D00078C3 +:106FF00041060FD48106890E1E2909D021884A0531 +:10700000520E0BD13A88172A08D3FE4A914205D076 +:10701000C10906D08006800E122802D003202DB0B0 +:10702000F0BD20462C302690F7492A98087200209F +:1070300018AA039010726A46107404AA0A60339A60 +:107040004A6020AA90809081229800780190810661 +:10705000681C1C90701F1D902B98890EC21C2492D6 +:10706000224620321B92083A401C02920B0005F087 +:107070009BFE1FFDFD11FD1FFD8EFDFCFDFBFDFABE +:10708000FDF9FDFCFDF8FDFDFDF7FDF6FDFDFDFD47 +:10709000FDF5FD00032E76D102E018A9087219E370 +:1070A000032028701C9917220A7000224A70CFE230 +:1070B000052EF0D14178027808021043208320A9E0 +:1070C0008880249A5178127809021143618300283C +:1070D0007ED088427CD800202072E080401E6084F0 +:1070E0000298F6F71EFA05202870A81C01900220CD +:1070F00000901BAA2A990298F6F716FA002868D180 +:1071000018A8807C012803D002206870102002E0BB +:107110000120687002202490002225A91CA8F7F7FE +:1071200034FE00282BD120A8007D2499814226D14D +:107130003A880099801C511A814220DB10A8C18D29 +:1071400001980170090A417001991CA8891C0191DC +:107150000099019A891C009125A9F7F716FE20A82D +:10716000007D01991BAA091801910099081880B2A5 +:1071700000902A990298F6F7D7F90028CCD0009809 +:10718000022826D064E272E018A9087261E2072E94 +:107190006DD341780346027808021043208320A96A +:1071A0008880249A5178127809021143618300285B +:1071B0000ED088420CD8012020725879197900022B +:1071C0000843E08000202073E06900F0F5FC01E056 +:1071D00098E0A9E000280ED1E1690120887105211D +:1071E000E269C9029180E1698872E1698748088192 +:1071F000E16900208873F01F60842298C01D6062DE +:107200000298F6F78EF907202870681C009001207C +:107210000190002010A9C8852FE00198012814D002 +:10722000E0698079012830D000981E38417F007FC6 +:107230000902014300980170090A41700098801CFE +:1072400000900198801C80B2019010A8C18D009818 +:107250000170090A41700098801C09E00AE296E179 +:107260003BE1DFE004E29BE077E036E016E2AFE0EE +:1072700000900198801C80B201901BAA2A99029864 +:10728000F6F752F9002803D007E010A8818DD1E766 +:1072900039880198081A0428BFDA0198012843D0D8 +:1072A000E0698079012804D010A8818D5548814279 +:1072B00006D110A8818D00980170090A417009E07B +:1072C00000981E38417F027F080200991043087021 +:1072D000000A48700198801CBAE1072E01D0152ED3 +:1072E00076D14178027808021043208320A9888053 +:1072F000249A51781278090211436183002801D041 +:10730000884201D901203FE7012020720020E0805F +:107310002073052E0AD01D982299E269C0B2491D3A +:10732000F7F70DFD002801D00A202DE70020C0430B +:1073300060841AA8019023A92298029703950091CE +:10734000007800238206920E20462A99FFF712FC4D +:107350000390208B20A988807BE1032EC0D140229E +:1073600020A98A814178027808021043208320A94D +:1073700088802A991EAB1C9A029301920091398849 +:107380000022491E8BB21B990978F6F73FF918A91C +:107390000872002833D10B20287010A8008F3FE01E +:1073A000052E9DD1802220A98A8141780278080289 +:1073B00010432083249984464A78097812020A43AC +:1073C000628420A988801248824202D30720DBE62B +:1073D000AFE03F208002024362842A981FAB1C99D1 +:1073E0000293019100903888401E83B21B98017867 +:1073F0006046F6F70BF918A9087200280CD083280C +:10740000AAD107E0FFFF00005C1300200128000064 +:10741000010200000220B8E00D20287010A8808F23 +:10742000401C15E101990C22C9095143C91CB14204 +:1074300004D9019840067CD5002009E14278037800 +:107440001002184320AA90808446229800784006B3 +:1074500009D505206A46107422980078C00905D025 +:10746000002010741DE106206A46107424981F90B5 +:107470002A9A00900023701A029383B21E90019200 +:107480001B98002201786046F5F7DCFE18A9087207 +:10749000002269460A74832801D1022003902298B1 +:1074A000007840060DD52088C00506D520A9208B80 +:1074B0008988884201D100206062002018A90872E2 +:1074C000C6E0FF21013120A88181808820831E9899 +:1074D00060841F9860621320B8E0052E29D341789C +:1074E00002780802104320A98880218F002902D049 +:1074F000FE4A914206D10A216A4611740121C9430C +:10750000218702E007216A46117422992A9A491DAF +:107510000192009101221D990023D203029311438D +:107520008BB224994A78097812020A431B99097888 +:1075300000E0C9E0F5F786FE18A908720022694646 +:107540000A740122520220A98A81832808D00028C7 +:1075500009D0218FE54881427ED10020208778E044 +:10756000888820834DE7606B002808D0314620468C +:10757000229AFFF7E3FB18A90872002869D12B466D +:107580003A463046229900F056FB039061E022987B +:10759000022E407801907DD1002801D0012879D1B8 +:1075A0000820694608740198087521A800901B9866 +:1075B000002201782046019BFFF7B0FC69460022BB +:1075C00048758A75002802D10198012809D0208FBA +:1075D000002806D0002008740120800220A988819C +:1075E0000EE004A83399FBF76AFD0390002069467A +:1075F00008740120800220A988810398022807D0FE +:10760000BB4800688079002805D018A908722BE0D3 +:10761000019820831DE00398002803D0812018A939 +:10762000087240E021A800901B98012201782046B2 +:10763000019BFFF773FC18A9087220463499FFF7E5 +:1076400053FC18A9087A002803D1192028700120BA +:1076500038806846007C00E03CE0002804D004A8A4 +:107660003399FBF72CFD0390039800282ED01AE0E5 +:10767000062012E52078000713D5012E11D109212B +:1076800068460174A188818204203499F5F72DF8A9 +:10769000082100E005E020A88181CDE601984006A0 +:1076A00012D50320039020A92088898908432080CF +:1076B00020A988894005400E04D026992B9808609F +:1076C000269886800398AAE40420E6E418A8007AA5 +:1076D00000280ED00120287022980078687020A819 +:1076E0008088A870000AE87018A8007A2871052020 +:1076F000388020A92088898988432080E2E7FFB567 +:107700000746A1B000201C903A7801209040794AA9 +:107710007C68104010AA1087744B22885B1C9A4228 +:1077200003D0002804D0100702D5012025B0F0BDF9 +:10773000249E0020307023980025028810A802851E +:1077400018A805756A4B68461972057404A8186074 +:1077500020462C301B902A985860249E94463878F6 +:10776000721C0521039201282DD0022808D003287D +:107770007DD13078800980011D303070B889A080BB +:107780003878022804D13078800980011B303070AD +:10779000F01C1FAA01900292009110A8008D0022F7 +:1077A000C01E83B22020015DB889F5F72FFF0028A5 +:1077B000DED10398B9890170090A417010A9888F38 +:1077C000C01C088528E1787B18AA10753A7B012A2D +:1077D00002D0022ACCD1FCE022887F231B011A4070 +:1077E00010AB1A87802A4AD006DC102A10D0202A33 +:1077F0000ED0402A0AD124E0FF3A013A65D0FF3A80 +:10780000013A79D0FF3AFF3A022A76D00525A2E064 +:107810002078C00601D5082000E010201C9004202C +:107820006A461074002090821AA81DAA1EAB039607 +:107830000192029000933B8A20461C9AFFF79AF926 +:1078400084E0228B3B8A9646934268D10A221C929E +:10785000002839D1039801906046401E1FAA83B2C8 +:10786000029220200091015D0022704600E0BAE003 +:10787000F5F7CCFE014618A801750B201AE0228B03 +:107880003B8A964693424AD10C221C92002862D130 +:107890000398019060461FAA401E0292009183B295 +:1078A0002020015D628C7046F5F7B0FE014618A8F5 +:1078B00001750D20307010A8818F491C01850421AD +:1078C00068460174218B818245E0238B3A8A9C466D +:1078D0009A4224D112221C9200283CD1606A0028CE +:1078E00013D000226B4607C3638C07E0FEFF000045 +:1078F0005C13002009F800000DE04BE02020015D42 +:107900006046F5F79FFC18A9087513203070012018 +:1079100010A908851FE0398A228B914201D00425E5 +:10792000B6E016211C91002815D11B9881880268A9 +:107930002046FFF703FA18A9087500280BD11B98F9 +:107940003346016880881AAA00F075F905460228B6 +:107950001BD0042D19D01B988088002811D06846B0 +:10796000007C002804D004A82A99FBF7A8FB054650 +:107970000120694608741B981B9900680590002037 +:107980008880002D48D0052D2ED06846007C032825 +:1079900078D07DE018211C91002806D0388A2083F9 +:1079A0002046B968FFF7A0FAD5E7204618300090C6 +:1079B0002020015D237E01222046FFF7AFFA18A99F +:1079C00008750028ECD119203070012010A9088515 +:1079D000E6E7208801214902084010A90887FF38FE +:1079E000FF38022806D0052510A92088098F884372 +:1079F00020804DE0208F9849884290D116201C901D +:107A00003869002805D06063B88A20870020608725 +:107A100002E00020C043208710A8008F7F210901C9 +:107A200002468A430DD0782300220420B968F4F777 +:107A3000B7FD3878A07010A92088098F08432080EE +:107A400002E02188814321806846007C002805D01F +:107A50008248416804A8FBF732FB054618A8007D60 +:107A6000002815D01C98707001203070208BB070E9 +:107A7000000AF07018A8007D3071052110A801855A +:107A800006E0FFE77548416804A8FBF718FB0546C8 +:107A90007248017A20884005400E22D11B988088C8 +:107AA00000281ED0239A0026138810AA1385249A32 +:107AB0002A9B6F464CC71B9A039412681AABFFF7B8 +:107AC0008DFA054602280CD00120694608741B98DF +:107AD0002A990068059004A8FBF7F1FA05461B985F +:107AE000868010A8018D2398018028461EE600B5E7 +:107AF00097B0042807D102206A4610700191002136 +:107B00006846FBF7DCFA17B000BD10B5534C03789C +:107B100000222168012B02D0022B42D126E00B78F3 +:107B2000002B01D0042B03D10A71226803211170AC +:107B3000216883880A79D200921D8B5221680A79C4 +:107B4000D20008328918C2880A80216803890A791C +:107B5000D2000A328B52428920680179C9000C3167 +:107B6000425221680879401C08711EE00A7482881C +:107B70008A802168C288CA802268018911812268AE +:107B800041895181C1682068C1606168FBF797FA3B +:107B90000146022807D02068007C002802D1002975 +:107BA00003D0812010BD832010BD002010BD406B8C +:107BB000002800D0012070478178012909D1008870 +:107BC0000521C902884202D0491C884201D1002007 +:107BD000704705207047F7B586B000246846154603 +:107BE0000F46848105261AE004984178027809023C +:107BF00011432980811D01960294009141790279F7 +:107C00000B021343C178827809020A434178007855 +:107C1000090208433946F5F715FB002806D104AAE6 +:107C200003A90698FFF7BFF80028DDD0822800D10D +:107C3000002009B0F0BD10B51488844201D205209F +:107C400010BD17241C701080421E581C491C04F0E3 +:107C500007FE002010BD0000FEFF00005C130020A6 +:107C600030B50346002002460DE09C5C2546303DC1 +:107C70000A2D02D30020C04330BD0A2568433038A6 +:107C80002018521CD2B28A42EFD330BD70B50D46D7 +:107C9000144608E00A2104F04CFE2A193031203A3B +:107CA000641ED177E4B2002CF4D170BD10B500236E +:107CB00010E0040A00020443A0B2CC5C4440200659 +:107CC000000F60400407240C44402006C00C6040B4 +:107CD0005B1C9BB29342ECD310BD000010B5404832 +:107CE000F4F7F8F8002801D00C2010BDFF21113165 +:107CF0003C4804F014FE3B490120087000204880F5 +:107D0000E031887188748875203108713448F4F73F +:107D1000F9F8002010BD10B53148F4F7D3F8002869 +:107D200003D031A1312004F026FFFFF7D7FF002850 +:107D300003D02DA1382004F01EFF10BD10B504465D +:107D40002748F4F7C7F8002801D00C2010BD2549BA +:107D50000878002807D00020087021482160F4F737 +:107D6000D1F8002010BD1E48F4F7CCF81F2010BD3C +:107D700070B505460C461A48F4F7ACF8002801D057 +:107D80000C2070BD174A5088A84202D110780028F4 +:107D900004D01348F4F7B6F8122070BD10482260E2 +:107DA000F4F7B0F8002070BD10B504460C48F4F7A5 +:107DB00091F8002801D00C2010BD0A480178002954 +:107DC00007D00020C04320800548F4F79BF812201C +:107DD00010BD408820800248F4F794F8002010BDC0 +:107DE00070010020681300207372635C6C6C5F6428 +:107DF000622E630010B5282104F08FFD10BD70B510 +:107E0000054600780A0700090001120F1043287088 +:107E10000B0004F0C9FF07050705070509050B005E +:107E2000062408E00C2406E0222404E00024F2A149 +:107E3000572004F0A0FE6878800980012043687014 +:107E400070BD00780007000F704710B50622C01CF7 +:107E500004F006FD10BD10B50622093004F000FD47 +:107E600010BD0278BF23C9071A40490E0A430270A9 +:107E7000704702785206520EC9010A4302707047D9 +:107E800070B515460E4604461F2A03D9DAA1A8206C +:107E900004F071FE20462A463146093004F0E0FC29 +:107EA0006078AD1D80098001A906890E08436070C5 +:107EB00070BD70B515460E4604461F2A03D9CEA1E3 +:107EC000CC2004F058FE20462A463146093004F002 +:107ED000C7FC6078AD1D80098001A906890E0843A2 +:107EE000607070BD70B501780907090F03292ED0A5 +:107EF000052931D1411C827E0C46437E1102194373 +:107F0000037FC27D1D02037EC67E1B021343827D5A +:107F1000407835438006800E22281DD106291BD3C8 +:107F20001920C001814217D8FF26F436B54213D874 +:107F3000002A11D0082A0FD88A420DD28B420BD8C2 +:107F4000617F227F09021143814207D904E0407812 +:107F50008006800E0C2801D0002070BD012070BD6D +:107F600000210A464254491C2229FBDB704710B508 +:107F700002788B07920892009B0F1A430270427896 +:107F8000520952014270012908D0022906D0032962 +:107F900005D0FF2098A1EE3004F0EDFD10BD0121C9 +:107FA0000A43427010BD10B502788B079208920008 +:107FB0009B0F1A4302704278520952014270012904 +:107FC00007D0022905D0032904D08BA18E4804F0E4 +:107FD000D2FD10BD01210A43427010BD0078800718 +:107FE000800F70470278EF23C9071A40C90E0A4371 +:107FF0000270704770B50546C1700B0004F0D4FEE6 +:108000000E080A0C0E1012120C14141212160C1870 +:108010000C2413E0082411E002240FE017240DE0E3 +:108020000D240BE0012409E0092407E0062405E003 +:108030007548002470A1A03004F09DFD68784009C7 +:1080400040012043687070BDC0787047017AC279E2 +:10805000080210437047817A427A08021043704741 +:10806000017BC27A08021043704781794279080285 +:108070001043704700797047817B427B08021043B0 +:10808000704770B5017AC37909021943431C857A98 +:108090001C46467A2B023343657926792C023443F9 +:1080A000C21C5A4E00798D1FB54214D8FF25F435F5 +:1080B000AB4210D800280ED008280CD888420AD22B +:1080C0008C4208D8507A117A00020843B11D8842C8 +:1080D00001D8012070BD002070BD0B4610B5011DF8 +:1080E0000522184604F0BCFB10BD817A427A0802D2 +:1080F0001043704701717047007970470B4610B507 +:10810000011D0822184604F0ABFB10BD027B0A706B +:10811000407B487070470B46014610B508220E316F +:10812000184604F09DFB10BD0B46014610B5042215 +:108130001631184604F094FB10BD10B50822001D3E +:1081400004F08EFB10BD10B504220C3004F088FB47 +:1081500010BD017170474171090A81717047C17189 +:10816000090A0172704700797047817942790802E3 +:1081700010437047017AC2790802104370470171B9 +:108180007047017170470B4610B5011D0822184653 +:1081900004F066FB10BD10B50822001D04F060FB62 +:1081A00010BD70B515460E4604461B2A03D912A110 +:1081B000174804F0E0FC2A463146E01C04F050FB6E +:1081C0006078E90640094001C90E0843607070BD3F +:1081D00070B5054640780E46C406E40E1B2C04D943 +:1081E0000B4805A10C3004F0C6FC2246E91C3046C1 +:1081F00004F036FB204670BD7372635C756C5F7073 +:1082000064752E6300000000070200007A0C000075 +:10821000F7030000C1074008C207C90FD20F511869 +:108220004008C207D20F51184008C207D20F511898 +:108230004008C207D20F51184208D007C00F40189B +:108240005208D107C90F091850084018704700227A +:1082500002808271C271C272027342738273827031 +:10826000C270027142714276828303464284203397 +:108270009A7102859A72C2750276C2730274DA72BA +:108280001A739A7319750284FF21603081709A7590 +:10829000704770B504460020A083208C1E464843DA +:1082A0001546114604F053FB2084F000294604F0E3 +:1082B00040FB401C80B20146192269439202E083D0 +:1082C000914201DD401EE0837D202946000204F03A +:1082D00030FB401CA08470BD70B50546087B0E467F +:1082E000C006C00E08730020A87504463019007A35 +:1082F000FFF790FF29194874A97D641C0818E4B29F +:10830000A875052CF2D3C0B2252803D979A18A20FB +:1083100004F031FC70BDF8B50446303026462746DF +:108320002546C036A03780350090032909D00029A2 +:108330001AD0012924D0022902D1A11CFFF7CCFFB9 +:10834000F8BD1146FFF783FF002028836883A883C8 +:10835000E883288468847871E88538732621085575 +:10836000A08430703071F8BD0020E885B871A18814 +:1083700023890A460098FFF78CFFA11C0098DDE7CF +:108380000020E885B38A328AA1880098FFF781FF30 +:10839000F8BD70B5867D0D460446002E01D0252E11 +:1083A00001D9122070BD002A18D0287EE17D5043EB +:1083B0000818252104F0BDFA0846E1754207520F5E +:1083C000C908504B69189A5C097A8A4368D03146CB +:1083D00004F0AFFA491CCAB2002007E0002070BDCB +:1083E000002803D02118097C511ACAB22118497CEF +:1083F00091423AD32918097AC943CB07DB17D21A1D +:10840000521E1206120E35D08B07DB17D21A521EDF +:108410001206120E30D04B07DB17D21A521E12066C +:10842000120E2CD00B07DB17D21A521E1206120E98 +:1084300028D0CB06DB17D21A521E1206120E24D0F9 +:108440008B06DB17D21A521E1206120E20D04B06D4 +:10845000DB17D21A521E1206120E1CD00906C917BB +:10846000511A491E0A06120E18D0401C0528B7DB07 +:108470001F2070BDC00013E0C000401C10E0C00011 +:10848000801C0DE0C000C01C0AE0C000001D07E019 +:10849000C000401D04E0C000801D01E0C000C01D00 +:1084A00020769BE738B505460C46684603F0E0FEAB +:1084B00000281ED069460020085620720921615606 +:1084C0000022411A00D5494220356B798B420FDCDE +:1084D000FF2B0DD0A17A491CC9B2A172AB79994288 +:1084E00002D8617A7F2903D160720020A072012234 +:1084F000104638BD7372635C6C6C5F7574696C2E6A +:108500006300000066CF010010B5040004D0FF2016 +:10851000FAA1AB3004F02FFBFB4821464143FB4856 +:10852000FF230918FF330022581C5A544254C81D17 +:10853000FF30FA3002704270F448001FC378A34243 +:1085400002D18270FF23C370EF48EF4BC01E0818A2 +:108550009B1EC91802700A7010BD70B5EB4800264A +:10856000001F8670FF24C47035462846FFF7CCFFF5 +:108570006D1C2D062D0EF8D00020E4490B2292012F +:10858000E14B43435B189B181E74401C0006000E11 +:10859000F6D0DF48FFF7E4FC0021DD48FFF722FDBD +:1085A0000121DB48FFF7E3FCDA4804704470847073 +:1085B000C4700471447170BDCFE71B20704730B5A3 +:1085C0000021D24A0B239B01CF4C4C43A418E41842 +:1085D000247C002C05D0491C0906090EF4D000208B +:1085E00030BDC94C01254C43A218D2181574017036 +:1085F000284630BD10B5044600F0D0F900280CD054 +:108600002046FFF781FFC0490B224C43BF490020A1 +:108610006118920189180874012010BD10B5044634 +:1086200000F0BCF9002802D0BA484471012010BD06 +:10863000034610B5B748B44940794843B349421896 +:108640001046FF30E130C17F807F04F00DFC10BD8B +:1086500010B5B048AC4940790F224843AB494018A7 +:10866000A949D239095CFF30FF3004F0D7FB10BDB7 +:1086700010B5044600F092F9002802D0A548047114 +:10868000012010BD034610B5A2489F490079484318 +:108690009E4942181046FF30E130C17F807F04F0D0 +:1086A000D0FB10BD70B59B4C97492079974D48433E +:1086B0004019C11DFF31F931FF30E130807F0F22B9 +:1086C00004F09CFB002813D020798F4948434019BF +:1086D000FF30FF3002300178491C0170017840788A +:1086E000814204D1884885A1773804F044FA0120FA +:1086F00070BD884884490079484384494018FF3058 +:10870000E130C17F807F814201D10120704700208C +:10871000704770B57F487C49007948437B494018D1 +:10872000FF30E130867FC57F0F242946304604F0B4 +:108730005EFB002801D0204670BD70066906400E21 +:10874000490E884201D3401A01E0081A201AC0B22B +:1087500070BD0F20704770B50C46054600F01EF93D +:1087600000280ED00020207067484543674828182D +:10877000FF30FF300230017842788A1A227041704F +:10878000012070BD70B50C46054600F007F90028C1 +:108790000BD05D4845435D482818FF30FF3002305C +:1087A00001784078081A2070012070BD5849016096 +:1087B000704710B5044600F0F1F8002802D0554883 +:1087C0000470012010BD5149091FCA78FF2A02D048 +:1087D0000021016007E08A784C492439012A02D03F +:1087E000016001207047002070474848801E0178D2 +:1087F000012908D001210170464801784348001F33 +:10880000C170012070470020704710B5044600F089 +:10881000C5F8002802D03F484470012010BD3B49F4 +:108820003C4B091FCA785B789A4206D18A78203976 +:10883000002A02D0016001207047002070473348B1 +:10884000344A001FC1785278914209D1FF21C1708A +:10885000801C0178002903D000210170012070479D +:108860000020704729482B4A001FC1785278914256 +:1088700004D18078002801D0002070470120704783 +:1088800010B5044600F08AF8002802D02148C470D0 +:10889000012010BD034610B51E481B49C07848434F +:1088A0001A494018C21DFF320B21FC3289014018C1 +:1088B000C17B807B04F0D8FA10BD10B51548124971 +:1088C000C0784843114940180B2189014118C97BE0 +:1088D0000D4AD21E8018062204F0A0FA10BD0D48E1 +:1088E0000949C0784843094941180B2080010818FC +:1088F000C17B807B81420FD1012070477372635C22 +:10890000646D5F712E630000D10200009C14002092 +:108910006D170020710100200020EEE710B504461D +:1089200000F03CF8002802D021488470012010BDDE +:10893000034610B51E481F49807848431E49401819 +:10894000C21DFF320B21FC3289014018C17B807BA4 +:1089500004F077FA10BD10B51548164980780B223F +:1089600048431549920140181249891E4118801840 +:10897000807B062204F042FA10BD0D480D49807834 +:1089800048430D4941180B2080010818C17B807BAA +:10899000814201D10120B0E70020AEE7002805D1D7 +:1089A0000648007C002801D00120A6E70020A4E7AB +:1089B00071010020D10200009C1400205C170020EF +:1089C000F8B5FF4E0446B079002500280AD00029EA +:1089D0002DD1657010202070F079A070307AE07091 +:1089E000B57124E0F64F203F387A012804D0707A20 +:1089F000012810D00020F8BD002918D1657013207F +:108A0000EF4920701C221639A01C03F029FF012019 +:108A1000A0713D720BE0002909D165701420E8496E +:108A2000207008220A31A01C03F01AFF7572012081 +:108A3000F8BDF8B5E3480178002902D00C2630468D +:108A4000F8BD0026DE4D3446403D2E756E75EE7540 +:108A50002E76AE75294620396E730F464E73403719 +:108A60007E717F218170687E002804D003F0E5FBD1 +:108A700003F066F86C763C72D14884711430FFF7CD +:108A8000B9F9CF483C30FFF7B5F9D8E710B5CD4B71 +:108A900000221A70CA4B203B1A711A46603A1166BE +:108AA000D065FFF7C6FF002804D0FF20C6A187309D +:108AB00004F061F810BDC2484038007D7047C049DD +:108AC00010B54039C87B897B42078307D20FDB0F83 +:108AD000D218C007C00F101840000B0004F064F952 +:108AE000050B060B04080F00BB4906E0BB4810BD90 +:108AF000B949083101E0B8490839085A10BDFF20CA +:108B0000B1A1A73004F037F8002010BDAC48B4493B +:108B10004038008A48437047F8B5A94C0646407B68 +:108B2000403CE07337791346A773012F26D0308875 +:108B30002082A348B27B203882710546603D2970AF +:108B400006221946681C03F08BFEB0796873062272 +:108B5000F11DE81D03F084FE607B0126002800D093 +:108B6000667597486038407B002800D0A6753B00AA +:108B700004F01AF90506082549084B000020D7E73C +:108B800000211DE08E4801211430FFF738F98C4890 +:108B9000E91D1430FFF75FF9687B002807D0012832 +:108BA00007D0FF2088A1EE3003F0E5FF0CE00021A4 +:108BB00000E0012182481430FFF75BF904E0062150 +:108BC0007F481430FFF71BF90020E07520767C48C1 +:108BD000691C1430FFF739F9794829781430FFF708 +:108BE00040F9774804213C30FFF709F97448691CC3 +:108BF0003C30FFF72AF9724829783C30FFF731F909 +:108C000026750020F8BD0221DAE7FF206EA1F830BA +:108C1000CAE770B56A4C0125403C034625762046DC +:108C20002030007A002801D03A2070BD644800222C +:108C3000803806789E4206D1E2750622401C03F079 +:108C40000FFEE57500E02276002070BD70B5044689 +:108C50005B4D0020403DA87528462246323803F07F +:108C6000FFFD2846203844730120A87570BD544983 +:108C700020390871704710B5514C0022403C627594 +:108C8000607302462046123803F0EAFD0120607549 +:108C900010BD4B49203948717047F8B500F0A4FB6E +:108CA000474C0025403C607E002804D003F0C5FA04 +:108CB00002F046FF6576434F3D7003F069FAA07BF2 +:108CC000012804D00021084601F0A6FAF8BD0021D1 +:108CD000022001F0A1FA3A4C203C207A002809D069 +:108CE000374881790029F1D11321C1710572012121 +:108CF0008171F8BD78780028FBD0314E0622803E85 +:108D0000707BE0733078A0753046F11D703003F051 +:108D1000A7FD30460622711C773003F0A1FD3C20F0 +:108D2000A072012020727D70F8BD10B5244C403C2B +:108D3000E17BA07CCA0701D0C2070BD08A070FD500 +:108D400082070DD4262003F006F9A07C02210843F7 +:108D5000A07410BD252003F0FEF8A07C0121F6E7E9 +:108D60004907F6D54007F4D4272003F0F4F8A07C97 +:108D70000421ECE770B5134E3078002872D1104C06 +:108D8000403C207D00286DD003F0F7F90025A57444 +:108D9000E5747570284603F0EDF9002002F0B9FF84 +:108DA0000D480D3803F0C5F80B48103803F077F97B +:108DB00003F010FAFFF7B9FF03F0D8F9012111E031 +:108DC00010180020780100207372635C6C6C5F6186 +:108DD00064762E63000000007ECF01009A891300A4 +:108DE00071020000002003F0D2F80F21052003F0EB +:108DF00014F82646403E3178701C03F002F8A07B40 +:108E000001280CD004280AD0607D002807D0214614 +:108E100012390846627B6630FFF732F86575A07D2F +:108E2000002807D0FE480146427B12399C30FFF7EC +:108E300040F8A575306E0178002903D00178001D37 +:108E400003F022F8F06D0178002906D0F44A401CA6 +:108E5000C73202F054FE0120607603F099F9002039 +:108E600070BDFFE70C20FBE7EE494860704770B526 +:108E7000050001D0FFF759FFE94C2034E07C0028C1 +:108E80000AD0A07B012804D19920E749C00003F053 +:108E900072FEFFF702FFE3E7002D0DD00221002054 +:108EA00003F075F8DE4840300079032801D001282E +:108EB00002D1022003F09AFAE07D002600280DD0AE +:108EC000D74D203D2846691C9430FEF7BEFF28464A +:108ED000691CBC30FEF7B9FFE6752676D0487430C1 +:108EE00003F05BF9A07B030003F05EFF05040404BC +:108EF0000D0409000121084603F0CAF903E0CA493C +:108F0000CA4803F038FEE17BA07C814301200029A0 +:108F100003D1A17B012903D0E074C24908709FE707 +:108F2000A674FAE710B503F028F9BE4800780028C7 +:108F300018D1BB482030007D002813D00020FFF757 +:108F400096FFB74840300079002809D001280FD09B +:108F5000022805D003280BD0B349B54803F00BFE17 +:108F6000002010BD00F040FA03F012F90C2010BDF3 +:108F7000EAF74EF8F4E7AB49012048707047F8B5BE +:108F8000002400F0E0FF002824D0FF202D3002F064 +:108F9000FBFFA44D2878A24F403701281DD002289E +:108FA00001D0032834D0A2489F496B3003F0E3FD81 +:108FB000287800280DD0387900280AD0012808D058 +:108FC000022838D0032836D099489749803003F0DA +:108FD000D2FDF8BDFFF761FEF8BD914E2036B07BA3 +:108FE000032815D0707E002803D002F098FD03F00E +:108FF0001CF98B48C43003F0D0F8B07B012812D0A4 +:10900000042810D0B879012806D0032804D004E041 +:109010000120FFF72CFFCBE7102421460E2001434F +:10902000002003F035F97879012801D103F017F910 +:1090300002202870BCE728780228CDD1012003F057 +:10904000D5F9F8BD70B5764840304079012801D196 +:1090500000F0D4F9724C2034607E002803D003F075 +:10906000ECF802F06DFD00F06EFF00280CD06D4DA5 +:109070002878022804D06E486B49A33003F07BFDAA +:10908000A07B012803D006E0FFF707FEE8E6992061 +:10909000800002F079FF0120FFF7E9FE2878002820 +:1090A000F4D028780128F1D039205F49000103F07D +:1090B00062FDD5E6F0B5074689B00020069002F0C3 +:1090C00035FF00900020019056480078022804D017 +:1090D00057485549F03003F04EFD514D4035687901 +:1090E000012801D100F08AF94D48C430FEF7A9FEED +:1090F0004B4E04462036002F70D03046A430FEF789 +:10910000F1FE0028F8D002F085FE0028F4D0707E31 +:1091100000280AD005277F1EFFB202F032FD022888 +:109120000FD0012800D0002001903D492046C431D5 +:109130000C46643C030003F037FE06A4A4A40CA470 +:1091400056A4002FE7D177203AA1C00003F013FD09 +:10915000E9E7B07B012841D004283FD0019A00986C +:10916000104304D1A879002801D0022836D16879AB +:1091700001281DD1607A00281AD101206072087878 +:1091800006224006C00FA0722548C91C6B3003F0B0 +:1091900067FB244C224FA07871377F2804D1A92087 +:1091A00024A1C00003F0E7FCA07838707F20A070F5 +:1091B0001B489C3002F0F1FF1A4803210170287906 +:1091C000002860D001280AD002285CD0032806D0ED +:1091D000164818A1E03803F0CEFC54E051E001201D +:1091E00003F004F94FE00E480F462038C978C079E3 +:1091F000814230D10A4839792038027A91422AD105 +:109200007979427A914226D1B979827A914222D1F2 +:10921000F979C27A91421ED1397A027B914211E0EA +:10922000B017002078010020C88D0100F60400006E +:10923000DE0200007372635C6C6C5F6164762E63A7 +:109240000000000007D13978407B4906C90F8142F0 +:1092500001D1012100E00021B07B012801D00428C8 +:1092600001D100290AD100280BD1019900980843A7 +:1092700004D1A879002801D0012802D1307E00282D +:109280001FD001200690707E002803D002F0D5FF89 +:1092900002F056FC0698002802D00120FFF7E7FDF7 +:1092A0005D48017800290AD00178012907D00078AB +:1092B000032804D095205949C00003F05CFC09B094 +:1092C000F0BD55480422406855490F3003F0C8FAF4 +:1092D000387806224006C10F4F4840680177F91CD4 +:1092E0001D3003F0BDFA4C484D4940680322091D6A +:1092F000133003F0B5FA4848494A4068B97D817592 +:109300000F3A117ED37D09021943018311468B7EEA +:109310004F7E1B023B438380137FD77E1A023A4362 +:10932000C2808A7F4B7F1102194301813C4905228B +:1093300010310A3003F094FA3948374A1130017974 +:109340005768C906C90EB97600794009F876287AB7 +:10935000002809D0A07900283AD11320E07100201C +:1093600020720120A07133E00020A8727888B085B7 +:10937000387FE8732A48394606221D31833803F0C6 +:109380006FFA27490622F3390878A875084677301E +:10939000491C03F065FAB888F087F888208038897E +:1093A0006080F87E20710198002860790BD001213F +:1093B0000843607102F0FEFB61794000C907C90FE4 +:1093C0000143617102E04008400060710120287291 +:1093D000114C0020207000F007F802F0D9FE0120A7 +:1093E000616800F019FF4EE710B502F012FF02F0BD +:1093F00005FF02F01AFE02F0B3FE10BD064810B5DC +:10940000801C02F035FF002802D103497F208870BC +:1094100002F01CFF10BD0000780100203492010012 +:10942000831800208107C90E002808DA0007000F02 +:1094300008388008F74A80008018C06904E0800876 +:10944000F54A800080180068C8400006800F704709 +:1094500010B500F03BFF10BD70B5F04C05466268DA +:10946000002908D0002A04D0FF20EDA10C3003F021 +:1094700082FB656070BD002A04D1FF20E8A1123094 +:1094800003F079FB0020606070BDE948C07E704742 +:10949000E7482830C07E704738B5E04C2068016846 +:1094A0004978012925D001216846F2F7F0FB68468A +:1094B0000078E049000203F03CFA2068426AC06884 +:1094C00012685118EAF7A3F92168C860D84A2068E1 +:1094D00028320321904218D0028B002A15D0012295 +:1094E0004272017200210171021D017F00F0FBFE3A +:1094F00038BD7D21C068C900EAF789F92168C860D4 +:10950000FFF7DDFA21680861E0E7028B521C028355 +:109510004172E6E7FFB5C64E85B0706A34680568EB +:1095200060680190306A0390298E0798401A80B2D3 +:1095300002900898002804D0274638372046483043 +:1095400002E0371D2846A8300090032038710598A6 +:10955000002820D001287DD002285ED003287AD0B0 +:10956000AFA1B54803F007FB0898002807D0387969 +:10957000032804D0B048AAA1093003F0FCFAA16A7C +:109580007069EAF744F9B860616A206A88427DD957 +:10959000009801601FE1306A002804D1A648A0A10C +:1095A0007A3803F0E8FAA449288B37394843401841 +:1095B000069900F0A6FEA0619F49A8883739484364 +:1095C000069900F09EFEE061316A9B48891CA16209 +:1095D0002A8B37384243A069974B121AE63BD218C0 +:1095E0005118A162944BAA7D373B5A434000801822 +:1095F000FF30193020626062306A081AED21FF38AE +:10960000C90015388842AFD28C49884204D28A48B2 +:1096100083A15D3803F0AFFAB6E0874A288B373A6A +:10962000E16850430818069900F06BFEA06182497A +:10963000A88837394843069900F063FEE061306A34 +:10964000002804D17C4876A1553803F094FAAE2066 +:10965000405B01E02CE05AE00028288B784AE16862 +:109660001DD050430818A169401AA0622169A06862 +:10967000734A4843A1694018A97D400051434018EE +:10968000FF3017302062A888504300E0A1E0E16974 +:10969000411A6F20C000081A6062A06A34E050438B +:1096A0000818A169401A3168D63849684018DCE7C3 +:1096B000284680300190C08D002802D0306A0028F2 +:1096C00004D15F4856A1401F03F055FAA8885C49B1 +:1096D000E3694843C01AA06201999C46CA8D21697A +:1096E000A368521A4B43A169591863465343C918DA +:1096F000AA7D534B49005A438918FF311731216223 +:109700006F21C900411A6162316A401A35E0089838 +:10971000002803D03420005D002878D1A88848496B +:109720004843E169401A02994843A06228468030C4 +:109730000490C08D0028019829D0002804D03E480C +:1097400037A1163803F017FA04983D4AC18D0298E4 +:109750000818E16948434000FF3017302062A888AC +:109760005043411A6F20C000081A606200F0AEFD3D +:1097700000281CD0A16A0398081AED21FF38C900FF +:109780005538884200D3EFE601203871ECE6002816 +:1097900002D00398002804D1294821A11A3003F0EF +:1097A000EAF90198A16AD6380818A062CCE7E9F76F +:1097B00096FD726901461046EAF7BEFFA16A081AD3 +:1097C000ED21FF38C90050388842DCD2012009B0B1 +:1097D000F0BD0099086000981A49006880350818A3 +:1097E000F860298B0798081A00B2002804DD059854 +:1097F000022801D0032000E0012078710898387019 +:109800000898002820D03420005D00281CD00220B9 +:10981000DDE7000000ED00E000E400E0880100204A +:109820007372635C6C6C5F6C6D2E73302E63000022 +:109830009C180020102700001905000029020000D4 +:10984000E20400004B170000089801214840203432 +:109850006075317F3A46304600F045FD0020B6E79E +:1098600010B5FE4900280A68516A096807D01268D5 +:109870008988FB4BD2695943891A03F05AF810BD05 +:10988000F8B5F64F38680468416A26460D682036F8 +:10989000717D00290AD0618E2A8E914206D1407ACC +:1098A000012803D1EF49F04803F065F9E9F717FD06 +:1098B000014638684069EAF73FFFFFF7D1FF2A8E7B +:1098C000618E1318994202DB491C618602E0401C3C +:1098D00010186086B07D002806D19C21608E495BFF +:1098E000884201D1401C6086DC480168088B03284F +:1098F00002D2401C088302E0618E98204153284622 +:1099000040300646C1898089081A298E401E4018B9 +:1099100087B218E0D148EB7E00685B00406A0079AE +:109920004100D248415AC05A401881B2207D0023DC +:10993000FFF7F0FD00280FD001280ED0CA48C94912 +:109940003A3003F018F9628EB81A00B20028E1DA52 +:109950000820B07200F010FEF8BD608E401C6086DA +:10996000F1E770B5BD4D002168680162C27E130049 +:1099700003F01AFA045656034A56426A14680268FB +:1099800011700268516000682030407D002808D1C5 +:10999000E9F7A5FC69680968096CEAF7CDFE0028BB +:1099A00018DC6868228E0168498E914206D12146F2 +:1099B00080318B8B9A1ACA83238605E0891A9E22EE +:1099C00011530168498E21860268C1681164C1681B +:1099D000416111E068680168098E228E8B1A224667 +:1099E0008032D3830168098E218601680B6CC360C5 +:1099F0000B6C4361886C9062204601F0D8FC002813 +:109A00000DD098499A4808E0C1684161FFF7B2F962 +:109A1000002804D096489349801D03F0ACF870BD2F +:109A2000934890490D30F8E710B58C4A0B00126846 +:109A300003F0BAF90906090F1F0C2E2E082B2E0071 +:109A4000FFF78FFF10BD00F068FC10BD02F0D1FCE5 +:109A500010BDD07E022806D0D07E032806D0FF207D +:109A60008049A3300EE0FFF70BFF10BDFFF714FD98 +:109A700010BDD07E0228F6D0D07E0328F6D0FF207D +:109A80007849AE3003F077F8F0E7E9F70DFC10BD48 +:109A9000FF207449BC3003F06EF810BDF3B581B0FF +:109AA0000E4601276D4D734C0B0003F07DF909063E +:109AB0002F39392F40403939400001216D48FFF7D7 +:109AC000CBFC31460198FFF7AFFFE07E022826D19C +:109AD00068680568406A0668E9F7DFFBB188604A94 +:109AE0005143EA69891AD639E962B72802D2624835 +:109AF000081803E0081A6049B7314018E8625F4867 +:109B0000E96A814200D80846E86205E00198FFF75B +:109B10008BFFE07E022802D1206820300775FEBD51 +:109B20002C600198FFF780FF00202860FEBDFF2019 +:109B30004C495C3003F01FF8FEBD70B50C4606467C +:109B40000B0003F031F909060D10100D1A1A101050 +:109B50001A00484801212830FFF77EFC2146304694 +:109B6000FFF762FF70BD43483C4D28302860304607 +:109B7000FFF75AFF0020286070BDFF20394982306E +:109B800002F0F9FF70BDF0B5344C0020216885B0BB +:109B900003258D76CA7E0746032A03D0C97E002995 +:109BA00029D029E0087F002803D12E49344802F04B +:109BB000E2FF2068067F684605714571E9F78FFB73 +:109BC0000290FF20F530039001216846017069463C +:109BD0003046EAF702F800E020BF2068007FEAF78D +:109BE00037FE0028F8D02068007FE9F75DFB206889 +:109BF000077700F072FB012021688F7605B0F0BD79 +:109C000016490A68907600E020BF0A68D07E0028D6 +:109C100003D0D07E937E9842F6D0D07E002803D029 +:109C200000200021917670470120FAE770B51149B4 +:109C30000024CA7E094D032A03D02831CA7E032A94 +:109C40002ED12960002827D0012821D00C480549B1 +:109C5000973002F090FF0020296813E0880100206F +:109C6000E204000020980100F70500008ECF0100FB +:109C7000A10300009C180020C4F8FFFF3812000068 +:109C800072020000086048622860002C08D070BD95 +:109C90000320FFF7B5FF01E0FFF775FF0446DAE7A1 +:109CA0000C2070BDF8B5F94F04461F25E67E330041 +:109CB00003F07AF8042920031B20F548844204D0DD +:109CC000FF20F449FC3002F056FF02203C60FFF711 +:109CD00097FF002805D03968002008604862386086 +:109CE00011E00C25002038600AE00120FFF79EFFFC +:109CF000054603E0E749E84802F03DFF002D02D0A9 +:109D0000E07EB042D2D1E07E002804D0E248E149B2 +:109D1000801D02F030FFF8BD10B5DD48FFF7C2FF2F +:109D2000DB482830FFF7BEFFD949002050310875C5 +:109D3000D649C91F4870D64948610A462832506141 +:109D400088769076D1494860086010BD70B50446A9 +:109D50000120FFF767FBC5B20B20FFF763FBC0B222 +:109D6000854204D0FF20CB49C63002F004FF012019 +:109D7000FFF758FBC5B21820FFF754FBC0B285426D +:109D800004D0FF20C349C73002F0F5FE0420C043D1 +:109D9000FFF748FBC5B21920FFF744FBC0B285426C +:109DA00004D0FF20BB49C83002F0E5FEB748B849EF +:109DB000083804700020C87688760A462832D076A3 +:109DC0009076B24B012408331C71186048625062CF +:109DD00008601060FFF7A0FF70BDAC490831087142 +:109DE0007047FEB5AA49CA7E08462830A74C002A0B +:109DF00002D1C27E002A03D0C97E022903D005E029 +:109E0000A648216006E0C17E002901D00C20FEBDDD +:109E10002060A348E9F7F4F9216808779B49206896 +:109E2000C91F0160C91C4162007F002804D1AD2018 +:109E30009849800002F09FFEE9F72FFA994988427D +:109E400000D20846FF30C83086B220680325C576A8 +:109E5000FEF735FE21680861FEF758FE002700284E +:109E600027D0FEF753FE21684A6A10600968012076 +:109E7000087001466846F1F70AFF684600788A498B +:109E8000000202F056FD0191E9F729FA01997118D3 +:109E9000E9F7BDFC2168C86020680572457207714A +:109EA000021D017F00F01FFA206807830020276051 +:109EB000FEBDE9F714FA3146E9F7A9FC2168C8604C +:109EC00008680770096801204870E5E77047F8B531 +:109ED0006F4EF17E002904D131462831C97E002918 +:109EE00001D00C20F8BD0221F176694C674F503447 +:109EF0000837776234600025386025753979C07E6F +:109F00004A006A4940008A5A085A2B46101881B202 +:109F10002A462846FFF7FEFA002804D0CF205D49E4 +:109F2000800002F028FE25610120A560207565866D +:109F300025865748703085753968088E401E08861A +:109F400035830020F8BD10B5504801244068817E5B +:109F500003290CD001684978002906D0006A5449C9 +:109F6000884202D90024FFF706F8204610BD0024DD +:109F7000FBE74648406802681178491C1170016A85 +:109F80000068C26A914204D8007D012801D00120F6 +:109F900070470020704700207047F8B53B4C3C48A4 +:109FA0002060416A00680D68002634210E54A62105 +:109FB000495D00294BD1007D032848D1E9F78FF98D +:109FC000014620684069EAF7B7FB00283FDDFFF74C +:109FD00047FC298E401C41182068026811860068E1 +:109FE000018E9C22525B511A09B200292FDD0121FA +:109FF0002030817528464030C1898089081A298E11 +:10A00000401E401887B21BE0496A09794A00274977 +:10A010008B5A028E007D9446EA7E5200895AC918F6 +:10A0200089B201236246FFF775FA00280FD0012894 +:10A030000FD002280BD01B481649193802F09BFD9F +:10A0400021680868028EBA1A12B2002ADCDA266089 +:10A05000F8BD20680068018E491C0186F0E7F8B55C +:10A060000A4D00266A680128516A0C6853D10879A4 +:10A070000E4940000B5A1068077D032F1AD0027D4D +:10A08000022A24D0007D012834D044E08801002039 +:10A090009C18002020980100070200009D9A0100F2 +:10A0A0003B9B0100F6050000102700008ECF010049 +:10A0B000D98213000661106886609C20025BE07EF6 +:10A0C0004000085AC01881B2002303201BE022463A +:10A0D0008032D78D0761E07E928B4000085AC0180D +:10A0E00081B200230220FFF715FA6A680121126885 +:10A0F00011750AE09C20025BE07E4000085AC018FF +:10A1000081B200230120FFF705FA002803D09C4903 +:10A110009C4802F030FDE9F72DF89B480078E8F7FD +:10A12000FBFD686806830268218E51860068203036 +:10A130008675F8BD38B5944C0021083460680D462A +:10A1400000684278002A01D045701FE0007800289E +:10A1500009D001216846F1F79AFD684600788B49DD +:10A16000000202F0E6FB6068426AC068126851189B +:10A17000E9F74DFB01466068C1600571032141723A +:10A18000021D017F00F0AFF860680583E8F7F2FF79 +:10A190007D480078E8F7C0FD38BD7B4A10B5014620 +:10A1A000083250680B0002F0FFFD060D1504081779 +:10A1B0000C31012100F0D1F807E00021106800F017 +:10A1C000CCF810BD0120FFF74AFF00210846FFF739 +:10A1D00043F910BD032116E0416A02680968D3699A +:10A1E00093608A886A4B5A430368DA600A46C03231 +:10A1F000D3890B83137B8B75138A8B80538ACB8017 +:10A20000928A0A8102210068017510BD5D485C498F +:10A21000913002F0B0FC10BD70B500280BD05A4C44 +:10A22000083401280ED002281ED056485449B430B4 +:10A2300002F0A1FC70BDFFF77DFF00210846FFF78B +:10A240000BF970BD6068002501684D7000F045F89D +:10A250000320FCF728FCE8F78DFF4B486560007889 +:10A26000E8F75AFD656070BDFFF764FF606800F0B5 +:10A2700034F800210846FFF7EFF80420FCF713FC40 +:10A2800070BD414908314968CA7E022A08D10A686E +:10A290001378002B04D150600968CA6A1018C8628C +:10A2A0007047394A10B50832526800290CD001298C +:10A2B00007D0022907D033483149D93002F05BFC7E +:10A2C00010BD801E00E0401F106210BD2E480830F7 +:10A2D0004068002800D0012070470021C1768176B7 +:10A2E00001604162704710B50B46C17E847EA14279 +:10A2F00004D011461846E9F770FC10BDFFF7EDFFDA +:10A3000010BD024610B50020002905D00846504374 +:10A31000204902F00EFB401C10BD1B4810B5083050 +:10A320004068C07E030002F03FFD041515030B15C5 +:10A3300001F05EF900280CD00F2017A1800106E083 +:10A34000FEF7F0FD002804D0F12013A1800002F0F8 +:10A3500012FC10BD10A11448F9E710B504460029FD +:10A3600003D00020FFF77BFE03E007480078E8F702 +:10A37000D3FC2046FFF7B1FF0020FCF794FB10BD93 +:10A3800020980100920600008001002010270000A4 +:10A39000E204000040420F007372635C6C6C5F6CFF +:10A3A0006D2E73302E630000CB030000F8B5FEF76E +:10A3B000B0F90446FEF756FAF84E054670692030AB +:10A3C000407D002809D0012827D002282AD0032860 +:10A3D00032D0FF20F2A19A3037E0F0481830FEF773 +:10A3E0001EFA002801D003200FE0EC481830FEF7D9 +:10A3F00049F9002804D070695B21095C002908D064 +:10A40000E6481830FEF7D2F901207169203148750D +:10A410001DE002212030417519E0E0481830FEF7B8 +:10A42000C5F914E0DD481830FEF72CF900280ED1EC +:10A43000FF20DBA18C3008E0D8481830FEF7EFF998 +:10A44000002804D1FF20D6A1943002F094FBB0691B +:10A45000F72201781140017072692032937DDB0789 +:10A460001B0F1943FB2319400170D37DDB075B0FE2 +:10A4700019430170577DEF23022F04D0012F07D01D +:10A48000032F07D00CE0012C06D8002D04D007E0E4 +:10A490006D1E2C43002C03D019401023194300E0FB +:10A4A00019400170D17F002916D0517D012913D0A8 +:10A4B000BF4801F072FEBE48002128300176726963 +:10A4C000916ED26E42610161B949B26901F097FBA8 +:10A4D000002001F0A3FB03E001F05FFE01F0C1FBEF +:10A4E000B0690078C00606D4F0690078C00602D4CE +:10A4F000F079002806D0B079002803D10121084660 +:10A5000001F0C6FE032030703079002803D101F03D +:10A5100061FE01203071F8BD70B5A0481C30FEF717 +:10A52000B9F901259D4C002802D00020607002E09E +:10A5300065709F48E061606940300078002802D073 +:10A540006078002805D0E06901F027FE01F089FB62 +:10A5500070BD974801F021FE954828300576626964 +:10A56000116F526F42610161914AE16901F047FB4D +:10A57000012001F053FB70BD10B5884900234869E4 +:10A5800002462030C3768377012049239854A032B5 +:10A590009279002A03D008700021022001E00021F6 +:10A5A0000320FFF7FAFD10BD70B57C4C6079C20640 +:10A5B0002046406901468031002A01DA002202E08B +:10A5C000CA8DCB8BD218CA850246C0321379002BB4 +:10A5D00005D0034640331D8AC98B69181982617AF8 +:10A5E000002903D03D2001F051F94AE00346203311 +:10A5F000D97E042945D0217A002913D0480701D4F7 +:10A60000C80601D51E2030E0080701D53D202CE00A +:10A61000C80705D1880703D461A1664802F0ABFAE8 +:10A620002A2022E04030817D002905D0418A4D1C3E +:10A630004582858AA9420FD2517A062902D0117A21 +:10A64000062905D1018B4A1C0283828A914203D2DA +:10A65000028AC1898A4201D3222006E09A7F80893A +:10A66000002A0AD088420FD3082001F00FF9606950 +:10A670002030C07E042804D006E0062804D33E2003 +:10A68000F3E7FFF779FF70BD012020700021084635 +:10A69000FFF783FD70BD10B5404840690146203189 +:10A6A0008A7F002A29D0012A27D0022A06D0032A2D +:10A6B00004D03BA1404802F05EFA10BDC97E0329D8 +:10A6C0000FD0082919D001464031CA898989511A09 +:10A6D000891E89B2032900D303218030828B51184F +:10A6E00009E0014640318A89032A06D3028EC989CE +:10A6F00080305118491C018310BD8030818BFAE7EE +:10A7000000B5030002F050FB0604070B0F121217EE +:10A7100000290ED00FE0891E02290AD90BE0891FFB +:10A72000012906D907E0082903D004E00B390C29D8 +:10A7300001D8012000BD002000BDFEB50546174828 +:10A740001830FEF740F8002804D11B4814A1D13876 +:10A7500002F011FA114CA069FDF702FC0321A06977 +:10A76000FDF721FCA069EF22017811400170294614 +:10A77000FDF740FC002601272B0002F015FB0E5CC4 +:10A780005C085C2C6060255C4C5C603C375C6069FC +:10A790006521095C002911D0062111E098010020F3 +:10A7A0007372635C6C6C5F736C6176652E63000022 +:10A7B00038190020430200005C080000C0304179D5 +:10A7C000A069FDF797FC3AE060698030417CA069A0 +:10A7D000FDF7D7FC33E06169A069B831FDF7ADFC46 +:10A7E0006169A0698C31FDF7AEFC28E00621A06903 +:10A7F000FDF7C5FC23E020690178A069FDF7A9FCFD +:10A8000020698188A069FDF7A6FC20694188A069BC +:10A81000FDF7A5FC13E000960196606960300079B1 +:10A82000002803D069460878384308706946A06953 +:10A83000FDF7B1FC03E0F949F94802F09CF9FDF796 +:10A84000D4FF002804D1F648F449801D02F093F9A2 +:10A850000C2D06D0072D03D06069403046828775E5 +:10A86000FEBD606940300683FEBDF0B5ED4CC820EA +:10A8700061698DB0405C04280AD0052835D15C2080 +:10A88000405C00282AD0012060314871022026E077 +:10A8900010226846D63101F030F86169102204A810 +:10A8A000B03101F02AF86846F1F7B1FC08AE8DCE60 +:10A8B000616984250E4678360DC66F5000250D67F8 +:10A8C0004D67012540267554D74D88318DC52846E2 +:10A8D0000822093001F0C4FF052000E00D20FFF739 +:10A8E0002CFF61690020C03108720DB0F0BDF8B5D1 +:10A8F000CC481830FDF767FF002848D0C94C207AB3 +:10A90000002844D16069C421095C002500290ED0CB +:10A910002030C17E0120FFF7F3FE002807D16069D7 +:10A920002030C17E0420FFF7EBFE002806D06069CE +:10A93000C921095C0126062907D00DE06069502174 +:10A940000D526030457102204EE02030C17E04205F +:10A95000FFF7D6FE002813D0616908462030C27E7A +:10A96000921E130002F020FA166262621D62626299 +:10A9700060621F6262622843626262626262466271 +:10A9800060695E21095CC90702D0C0304572F8BD1C +:10A990000C20FFF7D2FE60694030817F3143817720 +:10A9A000F8BD072020E0FDF79AFF0028F8D0606985 +:10A9B000403005700B2017E0F1F768F90C28EFD351 +:10A9C00060690821B830F1F762F9002806D06069A3 +:10A9D00004218C30F1F75BF9002804D1C72093A142 +:10A9E000C00002F0C8F80420FFF7A7FEF8BDFFF78B +:10A9F0003CFFF8BD00228A66CA66C6770A467831EF +:10AA0000C8C9894878322838D26842632830C8C01B +:10AA100008220D30091D01F023FF0620FFF78DFEEF +:10AA2000606940308575F8BD0920DDE700F036FF2C +:10AA3000F8BD70B57B4C3B216069095C08292FD1BA +:10AA40000146028EC0314B89521C9A4228D1227A8B +:10AA5000002A25D10A8A83889A4207D14B8AC58861 +:10AA6000AB4203D18B8A0589AB4209D043884B8521 +:10AA70008A854A8ACA858A8A0A860122E6210A5478 +:10AA800001221146FDF747FC00210420FFF785FB5A +:10AA900060690021C92211542030C17603218177D9 +:10AAA00070BD70B55F4C60692030C07E172803D040 +:10AAB0005EA1624802F05FF8616900220B464033F4 +:10AAC000DA7608469A75E030867D0B240125002E43 +:10AAD00006D0837C002B14D1C4740275857410E0F9 +:10AAE0001E7F002E07D01A774C88FA235C5202761C +:10AAF0000C23837505E04E88FA235E5202760577B3 +:10AB000084752031CA7670BD70B5464CA079800737 +:10AB100036D5207A002833D160692030C17E0120EB +:10AB2000FFF7EEFD00282BD1A0690126C078002593 +:10AB3000030002F039F90E8585088537465F0A85DE +:10AB4000168526625285032152E060692030C07E5E +:10AB5000052804D0394835A1333802F00CF8606973 +:10AB60000CE060692030C07E092804D033482FA152 +:10AB70002D3802F000F8606956210D542030C5765A +:10AB800070BD60692030C07E0B2804D02B4827A1FF +:10AB9000263801F0F0FF60695B210E540C21203053 +:10ABA000C17670BD60692030C07E0F2804D0234874 +:10ABB0001EA11F3801F0DFFF60695B210E541021D8 +:10ABC000EDE760692030C07E102804D01B4817A133 +:10ABD000183801F0D0FF12210AE060692030C07EF1 +:10ABE000102804D0154811A1123801F0C4FF142117 +:10ABF0006069D4E7FFF755FF70BD60690146C0305A +:10AC0000027A062A04D14031897F890700D505726E +:10AC1000417A0629F0D1457270BD0000A0A701005D +:10AC2000CD07000098010020601900207372635C5A +:10AC30006C6C5F736C6176652E6300004C050000E0 +:10AC4000FD49FE4801F097FFE6E710B5FC4C60694E +:10AC50002030C17E0020FFF753FD002803D1207A69 +:10AC6000012108432072207A002808D1E069FDF70D +:10AC7000EBF961699122505405202031C87610BD4E +:10AC800010B5EF4C60690146C0314A7A002A06D0FF +:10AC9000097A062903D0217A012211432172217AEF +:10ACA000002928D14030807F800715D4E069FDF766 +:10ACB0005AFA61694031C877E069FDF756FA61696F +:10ACC00040310884E069FDF755FA6169022240319C +:10ACD0004884887F10438877606900220146C0312C +:10ACE0000B7A062B00D10A724030837FDB0702D13A +:10ACF00006234B72028310BDF8B5D14C6069203039 +:10AD0000C17E0020FFF7FCFC0125002807D1606907 +:10AD10004030007F002802D1207A28432072207A18 +:10AD2000002830D160690026014640304682857592 +:10AD3000B031E069FDF7EFF96169E0698831FDF74D +:10AD4000F3F960690146E030827D0827002A06D0C9 +:10AD5000817C002913D1C774067585740FE04A8879 +:10AD6000F8204252FA31E069FDF7C8F96169E069FB +:10AD7000FF310331FDF7CAF96069E030877560691A +:10AD80000F212030C176F8BD10B5AD4C6069203080 +:10AD9000C17E0020FFF7B4FC002803D1207A0121F6 +:10ADA00008432072207A002812D1E069FDF769F982 +:10ADB00000280ED0E069FDF75FF96169CA225052A0 +:10ADC000098E00F0D6FD002806D0282000F05EFD98 +:10ADD00010BDFFF73AFF10BDE069FDF74BF961695F +:10ADE000C0310873E069FDF740F96169C031C8817D +:10ADF000E069FDF72BF96169C0310882E069FDF770 +:10AE00002AF96169C0314882E069FDF729F9616971 +:10AE1000D422505208202031C87610BDF8B5884C95 +:10AE2000A079C00776D0207A002873D160692030DD +:10AE3000C17E0120FFF764FC002863D1E069002592 +:10AE4000C178022701260B0001F0AEFF0D16130892 +:10AE5000415A5A445C575A192F545A00FDF74CF97D +:10AE60006169C62250543B20475440314D828E7553 +:10AE700048E000F093FD45E0FFF786FF42E060699F +:10AE80002030C17E0020FFF73BFC002802D1207A51 +:10AE900030432072207A002834D160690146403165 +:10AEA0004D828E750B2120300FE060690146203005 +:10AEB000C27E0C2A02D0227A3A432272227A002AD7 +:10AEC00020D1C57740310E770D21C1761AE0FFF70A +:10AED00013FF17E0606901462030C27E122A02D0BB +:10AEE000227A3A432272227A002A0BD140318D75A0 +:10AEF0001721EAE7FFF7C4FE04E000F00DFD01E0D2 +:10AF0000FFF7A3FE62690023106F516F401C594187 +:10AF100051671067F8BDF8B5494C054660692030A7 +:10AF20008079012801D101F091F9012D14D16069D6 +:10AF30004021095C002903D12030C07F002801D0C6 +:10AF400000F08FFE01F065F901F058F901F06DF89D +:10AF500001F006F901F01CF960790225C10701260C +:10AF6000002901D180070ED560692030817F00293A +:10AF700002D0032902D006E0867700E08577002121 +:10AF80000120FFF70AF960692030817F012903D190 +:10AF90006179090700D58577607A002803D100F030 +:10AFA00027FDFFF7A4FC207900250028606902D066 +:10AFB0008030058403E08030018C491C0184607975 +:10AFC000C00705D06069AC210D544030858104E094 +:10AFD000616940318889401C8881E079002806D069 +:10AFE0006169A031087B022806D8401C087360699B +:10AFF000A030007B022806D96069014680300584B4 +:10B000004584A0310D7360692030C17E0020FFF7B8 +:10B0100077FB002804D160692030C07E072855D115 +:10B0200060690146C0310A7A062A4FD0497A06295A +:10B030004CD03E21095C05E02CAC0100BA050000B3 +:10B0400098010020022941D1A030007B00283DD189 +:10B05000FDF74FFB002839D0FDF704FC002835D060 +:10B0600061690A468032508B01282FD90846A030EA +:10B07000844646716038C7898389B81E834201DBE4 +:10B08000012002E0F81A401E80B2138CA789BB424F +:10B0900001D3012302E0FB1A5B1C9BB2984200D94A +:10B0A0001846012801D163465D71C0310B78002B31 +:10B0B00010D0528C49888A4201D3012102E0891ABA +:10B0C000491C89B2884205D9084603E0616901201C +:10B0D000A0314D7161690A8E803110188883FFF7A5 +:10B0E000DAFAFFF761FAFEF756FF002809D0606927 +:10B0F0000146FF3001300279002A02D14988C1801F +:10B1000006716069A0308571F8BD70B5F84C606952 +:10B110002030407D00283ED0022810D1FDF7C2FA31 +:10B12000002804D17120F349000101F024FD626977 +:10B130000023916ED06E491C58419166D0666069BB +:10B14000002520304575017D012904D10575A179BF +:10B1500010221143A171C17C012915D1C574A079B8 +:10B1600008210843A071FDF76AFB002804D1E520FF +:10B17000E049C00001F0FFFC60690023816EC26EEF +:10B18000491C5A41C266816660692030817D01296F +:10B1900002D0012181753FE585753DE570B5D44C40 +:10B1A0000026E169012508788207920F0420012A10 +:10B1B00015D0022A13D0032A03D0217A0143217229 +:10B1C0002AE560780028FBD1606920308574A17978 +:10B1D0002943A17122E0C6751EE5C5751CE54978B5 +:10B1E000CA0624D06278002AEAD1C906C90E1B29F2 +:10B1F00018D8617901436171FDF75FFB002804D124 +:10B200003B20BC49400101F0B6FC60690023016F9E +:10B21000426F491C5A41426701672030C17D0129B4 +:10B22000DBD1D8E7207A102108432072F4E460696A +:10B23000F3E77CB504460020C0436946888001A836 +:10B24000FCF7B2FD00287AD169468888FCF790FDAA +:10B25000002803D0A749A84801F08DFC00980146BA +:10B26000E030827C0025002A08D065701021217012 +:10B27000C17CA170017DE170857472E082799C4E81 +:10B28000002A13D065700720207008E07169E6205D +:10B290008D8445540A22A01CE83101F0E1FA00989F +:10B2A000E03080790028F1D1A5705AE0827D002A33 +:10B2B00038D0827D130001F077FD0D2F2F2F2F2F17 +:10B2C0002F2F2F112F2F24082F0065700C21217094 +:10B2D000017EA17071694988A18010E06570082025 +:10B2E00020707069082240886080201DFA3101F0CA +:10B2F000B7FAFF2100980331095AA181E030857522 +:10B300002FE065700B212170017EA1707169498861 +:10B31000A180017FA171F2E7774876495D3001F0A5 +:10B320002AFC1EE0C81DF9300279002A08D011223B +:10B3300065702270811C89886180057111E012E0BE +:10B34000027A002A0FD012226570FF312270033179 +:10B3500004E005720A8962804A89A280027A002A82 +:10B36000F7D101207CBD00207CBD61480078012818 +:10B3700001D00C2070470020704770B55C4C05462A +:10B380002078002804D05C485A49933001F0F3FB40 +:10B3900000202561A07201202070FFF7E6FF002841 +:10B3A00004D0554853499E3001F0E5FB34E4F8B52C +:10B3B0004F4F3978012901D00C20F8BD0126A62174 +:10B3C00078610E548030807CFDF752F900282FD030 +:10B3D00078698030807CFDF753FA002828D078699E +:10B3E0008030807CFDF7E5F9002821D07869803035 +:10B3F000807CFDF70AFA00281AD000F0BEFE7869BA +:10B4000000258030408B002827D039481830FDF7C0 +:10B41000DAF9002821D07869C421095C00291CD000 +:10B420002030C17E0120FFF76BF9002802D014E024 +:10B430001220F8BD78692030C17E0420FFF760F942 +:10B4400000280AD1786950210D52603045710220E0 +:10B45000FFF773F97869A03045717869E621095CD6 +:10B46000002903D1818CC288914200D8C188B9815A +:10B4700001468031CA8B521E93B20A8CD21892B206 +:10B480000A8494460246A0321479002C02D04D84DE +:10B49000157102E04C8CE4184C8404464034A789B2 +:10B4A000FF18A7814C8B012C01D8641C4C83002B06 +:10B4B00000D015732030C07E0D4C04281ED050796A +:10B4C00000281DD0A1898C451AD2FDF712F9002859 +:10B4D00016D060690146C0310A78002A10D0803049 +:10B4E000408C498888420BD3A570E6700AE00000C2 +:10B4F000980100202CAC010081080000A67001E03A +:10B50000A570E5706069A5210D543B21095C0629F1 +:10B5100001D0072918D1CA21028E095A511A09B23D +:10B52000002911DB01460522CC310A3001F098F9DF +:10B53000012202216069FCF7EEFE6069C9210D5409 +:10B540003B210D546030867160699E210A5A811C2E +:10B550003030FCF71EFFA07800283DD16069C02183 +:10B56000095C002901D080304584012000F0D1FB26 +:10B570006069133000F093FD60690F3000F0D9FC72 +:10B58000012000F0F7FD61694020405C002803D1F4 +:10B590003F20405C00280DD00A467831C8C9F948E0 +:10B5A0007832D26842632830C8C008220D30091DA5 +:10B5B00001F056F900F0DAFD0121084600F0E7FC41 +:10B5C00060698030806A00F0EBFDFEF7A5FF6069DE +:10B5D0004030007A00F0BFFC6571E571A5712572FD +:10B5E000657225710220207000F0D2FD0020F8BDA8 +:10B5F00010B5E54C2078022801D00C2010BDA078B1 +:10B60000002803D00020FFF786FC17E000F0B5FD0E +:10B6100000F033F9606920308079012801D100F011 +:10B620001EFEA07A002809D0012807D0022807D0E2 +:10B63000032805D0D549D64801F09DFA002010BD59 +:10B64000E7F7E6FCFAE7D0498872704710B5CE4CB0 +:10B650002078032804D0CE48CC49293001F08BFA59 +:10B66000606901212030827C002A06D00022827489 +:10B670000175A27904231A43A271A2691378DB43EE +:10B680009B0707D1C37C002B04D1C174A079022190 +:10B690000843A0711078C00606D4E0690078C0069F +:10B6A00002D4E07900280CD06078002809D1A07974 +:10B6B000002806D1FEF75DFC002802D0207A002881 +:10B6C00003D00120FFF727FC03E0FEF725FF00F081 +:10B6D000D4F8207801280DD0A07A00280AD00128BB +:10B6E00008D0022807D0032805D0A948A749683008 +:10B6F00001F041FA10BD012000F078FE10BD10B538 +:10B70000A14C606920308079012812D100F09EFDA3 +:10B710006169881C3031FCF7C5FE002809D06069DA +:10B72000C21D4388F93253812030007E10730120FE +:10B73000107210BD70B5944C05462078042804D0D2 +:10B7400093489249803001F016FA61791020014344 +:10B750006171002D50D000F09CFA617801250843FA +:10B76000002811D160694021095C00290CD0E169F1 +:10B770004A78D20608D0097820300907C07DC90F61 +:10B78000814201D165724EE0E078002809D0E0697D +:10B790004178C90605D10078C00602D4FFF7AFFF93 +:10B7A00041E0FFF7ACFFE06900784007C10F606936 +:10B7B0002030807D814205D0FFF7A7FC6079082109 +:10B7C00008436071E06900780007C10F60692030AC +:10B7D000C07D814201D1FFF7E1FC607928436071AF +:10B7E0000020E071A079000704D560692030C07E98 +:10B7F000032818D0207A14E0022001436171E07917 +:10B80000401CC0B2E07101280DD86069403000785A +:10B8100000280CD05B484078C106C90E052906D225 +:10B82000C006002803D00120FFF775FB01E0FEF7FA +:10B83000BDFD207801280DD0A07A00280AD001286B +:10B8400009D0022806D0032805D051484F49E230DC +:10B8500001F091F99FE4012000F0C8FD9BE410B5D0 +:10B8600049480078042804D049484849EA3001F0A2 +:10B8700082F90120FFF74FFB10BD10B50121002018 +:10B8800000F006FD40490420087010BD3E494A22E0 +:10B890004969505404202031C876704710B53A4C9D +:10B8A000C8206169405C00281CD0062806D02031E1 +:10B8B000C97E0020FEF724FF002813D060690146EE +:10B8C000C0310A7A130001F06FFA070D0D0D0D0D4E +:10B8D0000D050D004030807FC20704D0C0438007B3 +:10B8E00000D1087210BD0C20FEF727FF606901220D +:10B8F0004030817F1143817710BD10B5002A0AD0F6 +:10B90000002306E0D41A6418203CE47FC4545B1C76 +:10B91000DBB29342F6D310BD7CB51B4C606920307E +:10B92000C17E0020FEF7ECFE0125002802D1207A1E +:10B9300028432072207A00281AD16946E069FCF772 +:10B9400022FC684600780022C107C90F68460170D2 +:10B950006069002902D06030057101E06030027139 +:10B960006069014640304282857509202031C876E1 +:10B970007CBD401A074900B2884201DC00280BDC7C +:10B980000120704738190020980100202CAC0100DC +:10B99000F4090000FE7F00000020F2E710B5534CD0 +:10B9A00060692030C17E0020FEF7AAFE0028207AC0 +:10B9B00010D000280DD1E069FCF797FB6169CA221D +:10B9C0005052098EFFF7D5FF002807D02820FFF737 +:10B9D0005DFF10BD01210843207210BD6169E0695F +:10B9E000CC31FCF77AFB606906212030C17610BDAE +:10B9F00010B500F04EF83D4C607940070BD56069FA +:10BA00002030C17E0520FEF77BFE002803D0207A7F +:10BA1000082108432072FFF701FA00F018F8FFF739 +:10BA200073F8A079C0060FD5207A00280CD1606980 +:10BA30002030C17E0B0001F0B7F9070707070707A1 +:10BA4000070507000721C176FEF7F3FF10BD10B50B +:10BA500026488179490715D5017A002912D1406914 +:10BA60003B21095C891E0B0001F09EF907050C0CB7 +:10BA70000C0D0C0F0C00002256210A54C0308079A6 +:10BA8000FFF704FF10BD012100E00221C030417228 +:10BA900010BD10B515488179090720D5017A002914 +:10BAA0001DD1406902462032D47EA41E230001F03D +:10BAB0007BF913160B1616161616161616161616EC +:10BAC00016161616161716005622115460304079B5 +:10BAD000002801D0062000E01620FFF7D7FE10BD99 +:10BAE0004030C1768175D17610BD000098010020EC +:10BAF0003B4800210170417010218170704770B582 +:10BB0000064614460D460220E6F78AFC0120344919 +:10BB1000344A0870E41E14619660556070BD10B51B +:10BB20000220E6F77DFC2E49012008702E480021F6 +:10BB300001604160816001202C49C005486010BD52 +:10BB400010B527480178002917D00121274AC905D7 +:10BB5000916025490B680022002B05D04B68002B13 +:10BB600002D08968002902D04270102103E001212F +:10BB700041701F490968817002700020E6F750FC8F +:10BB800010BD17480178002912D017480168002914 +:10BB90000AD00168002905D04168002902D08068D8 +:10BBA000002803D000207047022070470120704712 +:10BBB000407870470A48017800290FD00A48016888 +:10BBC000002905D04168002902D08068002801D0F2 +:10BBD0001020704706480068C0B2704780787047F0 +:10BBE000B801002000F5004000F1004000F50140E0 +:10BBF00000F400402E48002101704170704770B57C +:10BC0000064614460D460120E6F70AFC28490120A5 +:10BC1000284B08709E60DC601D6170BDF8B504465D +:10BC20000120E6F7FDFB22490120087021494C6004 +:10BC3000214900264E600321204D0906A960204FAE +:10BC4000002C0AD0012C03D01EA1412000F093FF4C +:10BC50003E60032000066860F8BD386001200006E1 +:10BC6000F9E710B51248017800290ED00321134AD4 +:10BC70000906916010494A680021002A03D0164A3B +:10BC80001268427000E0417001700020E6F7C8FBC6 +:10BC900010BD07480178002907D0074840680028F0 +:10BCA00002D00D480068C0B270474078704700006D +:10BCB000BB01002000F5004000F1004000F501400C +:10BCC00000F2004068616C5C7372635C68616C5F79 +:10BCD00063636D2E6300000000F4004070B5F84D02 +:10BCE00000246C702C70AC616C72AC720120E87234 +:10BCF000F4484470C473AC62F3482C63F0F7E2F884 +:10BD0000002804D0FF20F1A14E3000F034FF2C7742 +:10BD100070BDF8B5F24902250D60F2490026CE63E8 +:10BD20000127CF63F049C96A09070DD4EF49CB6AEF +:10BD3000EF4A53620B6B93624B6BD3628B6B136353 +:10BD4000C96BD30519435163EA4C002823D001285D +:10BD500025D0FF20DDA1A13000F00DFFE648A06353 +:10BD6000FF2004306063276303202061E3499620AD +:10BD70004860D3491C2008560B22D243811A9042B6 +:10BD800037D011DC1C313AD00A2938D0142934D0EC +:10BD9000182911D12FE0DA486061DA4802E0DA4868 +:10BDA0006061DA48A061D9E708301FD004281BD0B1 +:10BDB000082817D00C2812D0FF20C4A1753000F03D +:10BDC000DAFED449D2488860D448D3494160D44986 +:10BDD0000160D4480560D44910204860F8BD0420B3 +:10BDE000E060EEE7E660ECE7FC2000E0F820E060D1 +:10BDF000E7E7F420FBE7F020F9E7EC20F7E7D820AD +:10BE0000F5E710B50C460146C84800F0AFFFAC4856 +:10BE1000047210BDAB4840787047A94A5170107049 +:10BE20007047F8B504460D46507911790002084371 +:10BE3000690009190884501C01460E780127304614 +:10BE40004E78360230438E78C9783604304309067E +:10BE50000843117800020843A900605028460830C2 +:10BE60003E468640002B0CD0012B04D0FF2097A12A +:10BE7000E83000F080FE206B3043AF403843206351 +:10BE8000F8BD206BB043F8E770B50D4604460829AD +:10BE900004D9FF208DA1F93000F06DFE0022002DA5 +:10BEA0000CD9A3489100635809180B6053001B1963 +:10BEB0001B8C0B62521CD2B2AA42F3D3206B9D4959 +:10BEC000086070BD10B504460B22D2430C3089497E +:10BED000944223D008DC1C3026D00A2824D0142811 +:10BEE00020D0182809D11BE02046083014D004289F +:10BEF00010D008280BD00C2807D0FF2073A1753074 +:10BF000000F039FE6E48047710BD042000E00020E8 +:10BF1000C860F7E7FC20FBE7F820F9E7F420F7E733 +:10BF2000F020F5E7EC20F3E7D820F1E76548007B47 +:10BF300070477049C2784A620246137818465378AF +:10BF40001B0218439378D2781B041843120610433F +:10BF50000002C8617047252808D0262808D0272865 +:10BF600008D00A2808D84100091D07E0022106E090 +:10BF70001A2104E0502102E04100891DC9B25D4A46 +:10BF800091605E49486170474D498861704770B55E +:10BF9000002817D002224A4C674BA2720320186077 +:10BFA0005C4D5B48686000200126207500290BD09D +:10BFB000012910D002291ED0952044A1800000F054 +:10BFC000DAFD70BD0122E6E75C48012A01D0466037 +:10BFD00070BD066070BD3A48012A006B05D0012192 +:10BFE000490508432063696070BD012109050843C4 +:10BFF0002063696070BDA069002803D133A1504857 +:10C0000000F0B9FDA169A06A40184E498860434814 +:10C010004D4981604D49C1600120216BC00301433E +:10C02000216368602748C67370BDF8B54249086847 +:10C0300087083D48BF004268D206D60F10228260B2 +:10C0400000240C60334932488860414D0C202C613B +:10C050003A4A012111610BE000BF00BF00BF00BFE1 +:10C0600000BF00BF00BF00BF401E0006000E04D08E +:10C0700029690029F0D0002803D114A1354800F027 +:10C080007AFD2C610E48012144728472C1722A48E3 +:10C090000760002E02D0244910204860F8BD0146F8 +:10C0A0000A7810464A78120210438A78C978120436 +:10C0B00010430906084300020E49000AC86370478E +:10C0C00088190020A8190020BC19002068616C5C48 +:10C0D0007372635C68616C5F7263732E630000004F +:10C0E00080E100E0C01F004080000010C000001090 +:10C0F00000170040001500405B060000401500409E +:10C100000601020025000302050103001F000302CF +:10C110000040000400F501404080004080F50140EF +:10C120001011004080E200E0001300408A19002056 +:10C130000016004040160040001200400010004071 +:10C140004702000040850040488100401010004038 +:10C150000011004067020000F749022008607047A4 +:10C16000F54902200860F54908607047F44902204B +:10C1700008607047F3490870704710B5F248EFF750 +:10C18000A9FE002803D0F149F14800F0F4FC10BDED +:10C1900010B5ED48EFF7B6FE10BDEE4948607047A8 +:10C1A00070B5ED4C0546A06AA84203D3E749EB48B9 +:10C1B00000F0E1FC01202073E9490020256148607E +:10C1C000E84845600120216B800501432163E64971 +:10C1D000486070BDE04802210173C6210161E04A58 +:10C1E00000215160816ADF4AC63151600121026B32 +:10C1F00089050A430263DC48416070470121DA483F +:10C2000089058160D448026B8A430021026301736F +:10C210007047D64801214160C160D1490020486083 +:10C22000D0494860CC4988627047D14940200862B3 +:10C23000D0490A6802430A607047CE48016840222C +:10C2400091430160CA49002008627047C9480168EB +:10C25000102291430160C849012088617047C74995 +:10C260000020C861C3480168102211430160704773 +:10C27000C249CA69012A01D000207047BC4A9268AD +:10C280005206520E524202700020C86101207047CF +:10C2900070B50C00054603D1AC49B94800F06BFC01 +:10C2A000E00706D0012C04D06D20A849C00000F0A2 +:10C2B00062FC002D0DD00221A74801294172C472F1 +:10C2C000AC4808D002290BD0A049AE4800F053FC7E +:10C2D00070BD0121F0E7016804221143016070BDC7 +:10C2E000016808221143016070BDF8B59A4C002323 +:10C2F000E27A910701D5410712D4A349D50605D5A5 +:10C300004D7B002D02D08D7B002D09D0150702D565 +:10C310000D78002D04D1520703D54978002900D1AA +:10C320000123657A00210122924E002D18D00227A8 +:10C330003840184341D0304603689F08934BBF00F4 +:10C340005D68ED06EE0F10259D600160864B9048FC +:10C3500098608A4D0C202961874A0121116115E0FE +:10C36000814B8B4898603068800880003060A172F3 +:10C37000E272F8BD00BF00BF00BF00BF00BF00BF3A +:10C3800000BF00BF401E0006000E04D0296900292E +:10C39000F0D0002803D16D497E4800F0ECFB00206E +:10C3A00028616072A0720120E07272480760002E5E +:10C3B000DFD0764910204860F8BD012D06D0022D4F +:10C3C0000CD06249744800F0D6FBF8BD30680423F5 +:10C3D000984330606172E272A272F8BD306808233F +:10C3E000984330606172E272A772F8BD5A490875CD +:10C3F0007047F8B5644E584AF07B604D0024136BCB +:10C40000002851D05849E813886083435948136382 +:10C4100007685E4B10229A60002202600014886058 +:10C420000C202C462A61544D012129610BE000BFEC +:10C4300000BF00BF00BF00BF00BF00BF00BF401E65 +:10C440000006000E04D021690029F0D0002803D195 +:10C450003E49504800F08FFB0020E06020616060A2 +:10C460006061A061434807603F4900144860474944 +:10C4700010204860384CA07A01280FD0022810D034 +:10C480003249464800F077FB0020F073207D0228F7 +:10C4900003D1434801688907FCD5F8BD0120286015 +:10C4A000F2E701206860EFE72F4883601463107B98 +:10C4B0002746002803D02A484068012809D00023D5 +:10C4C00028692C46012806D00025907A012804D03E +:10C4D00006E00123F4E74025F7E7E168012904D0ED +:10C4E00000212943012802D004E02021F9E76568F2 +:10C4F000012D05D000250D432A4A022802D007E06D +:10C500001025F8E71168012902D1E168012904D05A +:10C5100000212943022802D007E00821F9E7126828 +:10C52000002A02D1E268012A04D000220A4302282C +:10C530003AD03DE00422F9E780E100E080E200E04B +:10C5400000E100E0BD010020BC190020CCC00100CA +:10C55000A10200000015004088190020B20200006E +:10C56000408100404085004000F5014000800040CF +:10C570004015004000120040001000400011004033 +:10C58000630300007D030000A81900200013004091 +:10C590000040000467020000CE0300005D030000BD +:10C5A00000E200E000140040002B01D0022100E076 +:10C5B00000211143022808D16068012805D1824872 +:10C5C0004068012801D0012500E000257F480D4387 +:10C5D00001680906090E02D06169012900D0002115 +:10C5E000317300680006000E02D0A069012800D057 +:10C5F000002070737648006A002803D0FFF7C1FA64 +:10C60000012800D00020B073E76027616760676190 +:10C61000A7616D4847602C466E4D6F482F75436883 +:10C620006B620068A862A97A022909D16978002999 +:10C6300006D06A4A526812780A40297891430AD093 +:10C640003770E1070AD01846FDF71BFE0121A86AE2 +:10C65000FDF727FE0BE001213170F2E7A10601D5BD +:10C66000022102E0A10702D50021FDF71AFE5B4876 +:10C67000416806220931A81C00F0C5F8002808D13D +:10C680005648297A40680078C009814201D10120CA +:10C6900000E0002070702046FFF727FE5048007829 +:10C6A00000280DD001281ED002282FD003284AD000 +:10C6B0004C494D4800F05FFAA87A022856D074E041 +:10C6C000A00701D5FCF7BEFC200702D50120FCF72E +:10C6D000F1FC600702D50020FCF7ECFCA006EBD5CE +:10C6E000FCF74DFCE8E7A00701D5FFF7B8F82007F5 +:10C6F00002D50120FFF71EF8600702D50020FFF7E2 +:10C7000019F8A006D8D5FEF7A1FFD5E7A007BF26E8 +:10C71000002802DA3440E6F76EFC200703D53440E7 +:10C720000120E6F767FC600703D534400020E6F7F8 +:10C7300061FCA00602D53440E6F75BFC6006BBD581 +:10C74000E6F75AFCB8E7A00701D5E6F758FC200742 +:10C7500002D50120E6F752FC600702D50020E6F77B +:10C760004DFCA006A8D5E6F748FCA5E7287B0028E5 +:10C770001BD015494F60022820D0012803D0194949 +:10C780001A4800F0F8F9A96A2869884203D81549BF +:10C79000174800F0F0F91048296941600120296B21 +:10C7A00080050143296313494860287D012800D092 +:10C7B00073E6114801688907FCD5F8BD2969A86AA4 +:10C7C000411805484160E9E74081004040160040BB +:10C7D00040150040881900204085004000150040A9 +:10C7E000BD010020CCC00100E6040000FB040000F5 +:10C7F000FC04000000F5014000E200E070477047D3 +:10C80000704770477047034610B50B439B070FD125 +:10C81000042A0DD308C810C9121FA342F8D018BAB1 +:10C8200021BA884201D9012010BD0020C04310BDAB +:10C83000002A03D0D30703D0521C07E0002010BD0C +:10C8400003780C78401C491C1B1B07D103780C781B +:10C85000401C491C1B1B01D1921EF1D1184610BD72 +:10C86000F8B5042A2CD3830712D00B78491C037027 +:10C87000401C521E83070BD00B78491C0370401CD0 +:10C88000521E830704D00B78491C0370401C521EB3 +:10C890008B079B0F05D0C91ADF002023DE1B08C9B8 +:10C8A0000AE0E4F79DFCF8BD1D4608C9FD401C46A2 +:10C8B000B4402C4310C0121F042AF5D2F308C91A41 +:10C8C000521EF0D40B78491C0370401C521EEAD44F +:10C8D0000B78491C0370401C521EE4D40978017087 +:10C8E000F8BD01E004C0091F0429FBD28B0701D564 +:10C8F0000280801CC90700D00270704700290BD04D +:10C90000C30702D00270401C491E022904D38307CA +:10C9100002D50280801C891EE3E70022EEE7002298 +:10C92000DFE7020A08704A70020C8A70020ECA70B1 +:10C930007047002203098B4273D3030A8B4258D3FA +:10C94000030B8B423CD3030C8B4221D312E00346F2 +:10C950000B437FD4002243088B4274D303098B42DC +:10C960005FD3030A8B4244D3030B8B4228D3030CBF +:10C970008B420DD3FF22090212BA030C8B4202D361 +:10C980001212090265D0030B8B4219D300E0090A89 +:10C99000C30B8B4201D3CB03C01A5241830B8B4292 +:10C9A00001D38B03C01A5241430B8B4201D34B037B +:10C9B000C01A5241030B8B4201D30B03C01A5241E0 +:10C9C000C30A8B4201D3CB02C01A5241830A8B4265 +:10C9D00001D38B02C01A5241430A8B4201D34B024E +:10C9E000C01A5241030A8B4201D30B02C01A5241B2 +:10C9F000CDD2C3098B4201D3CB01C01A5241830966 +:10CA00008B4201D38B01C01A524143098B4201D39F +:10CA10004B01C01A524103098B4201D30B01C01ACA +:10CA20005241C3088B4201D3CB00C01A5241830844 +:10CA30008B4201D38B00C01A524143088B4201D371 +:10CA40004B00C01A5241411A00D2014652411046D1 +:10CA500070475DE0CA0F00D04942031000D3404246 +:10CA6000534000229C4603098B422DD3030A8B427C +:10CA700012D3FC22890112BA030A8B420CD389011A +:10CA800092118B4208D3890192118B4204D3890100 +:10CA90003AD0921100E08909C3098B4201D3CB013E +:10CAA000C01A524183098B4201D38B01C01A5241F3 +:10CAB00043098B4201D34B01C01A524103098B42F7 +:10CAC00001D30B01C01A5241C3088B4201D3CB00E2 +:10CAD000C01A524183088B4201D38B00C01A5241C5 +:10CAE000D9D243088B4201D34B00C01A5241411A9C +:10CAF00000D20146634652415B10104601D34042CA +:10CB0000002B00D54942704763465B1000D340427A +:10CB100001B50020C046C04602BD7047704770474F +:10CB2000704710B500F058F810BD30B58C18027879 +:10CB3000401C13071B0F01D10378401C120906D1BA +:10CB40000278401C03E00578401C0D70491C5B1EF8 +:10CB5000F9D101E00B70491C521EFBD1A142E6D372 +:10CB6000002030BD012308CB134B1860134B196014 +:10CB7000134B1A607047134A134B13607246053A01 +:10CB8000F0E7114A0F4B1B689A420ED10D4B002063 +:10CB9000186001980D4B04B598470CBC9E460246A0 +:10CBA000029800990A4B1B68184706980599094B8B +:10CBB0001B68DB6818470000C8010020CC0100207A +:10CBC000D0010020C0010020EFBEADDE65140000E2 +:10CBD00018000020040000201D481E497047FFF780 +:10CBE000FBFFE4F7ABFA00BD01200007C06AC0B24A +:10CBF000FF2804D1184819490968884202D018480A +:10CC000018490160184819490968884203D1184A2F +:10CC100013605B68184700BD20BFFDE71248134949 +:10CC2000096888420ED1134B18680B498842F3D02B +:10CC300080F308881049884204DD10480268022108 +:10CC40000A4302600E4880470E4880470E4800475E +:10CC5000C0190020C0190020FFFFFFFF00100010C6 +:10CC60002C0500400800000000100000000000201B +:10CC70000400002000D00100002000202405004016 +:10CC80007B140000E9CB010065CB0100134870451F +:10CC900002D1EFF3098101E0EFF3088188690238DE +:10CCA0000078102814DB202810DB2B280BDB0C4A23 +:10CCB00012680C4B9A4203D1602804DB0A4A1047E1 +:10CCC000022008607047094A10470000084A1047D0 +:10CCD000084A12682C32126810470000FDFFFFFF5F +:10CCE0001C000020BEBAFECA911500007528000085 +:10CCF0009B130000040000200D4B0E4908470E4B0B +:10CD00000C4908470D4B0B4908470D4B094908478B +:10CD10000C4B084908470C4B064908470B4B054983 +:10CD200008470B4B034908470A4B024908470000D4 +:10CD3000395400001914000051280000FB2600009F +:10CD4000A9260000612E0000A71500009324000012 +:10CD5000BF270000572D0000002101704170817035 +:10CD6000C170017141718171C17170470A7802709F +:10CD70004B7843708A788270CA78C2700B790371DD +:10CD80004A79427170470A7802704B7843708A780A +:10CD90008270CA78C2700B7903714A7942718A79BC +:10CDA0008271CB79C371704730B47446641E2578A4 +:10CDB000641CAB4200D21D46635D5B00E31830BCCF +:10CDC000184703B5684600784006400E401C88426C +:10CDD00005D269460878401CC0B208700CBD684690 +:10CDE0000078000601D500200CBD80200CBD41401C +:10CDF000802901D0002070470120704737B508789E +:10CE00000C4669460978884206D020781146FFF71B +:10CE1000D8FF207001203EBD00203EBD37B504463E +:10CE20000078154669460979FFF7E1FF002801D02F +:10CE300000203EBD20782946FFF7C3FF2070012067 +:10CE40003EBD0FB568460179007881420AD0684638 +:10CE5000007922214006400E4843801818600120C6 +:10CE600004B000BD0020FBE77FB5684601791C4691 +:10CE700015460078FFF7BBFF002802D0002004B061 +:10CE800070BD6846007822214006400E4843401994 +:10CE900020600120F3E742414A352E3030423030E5 +:10CEA0000000ECF4FC0004FFE11D9AED853324EA58 +:10CEB0007AD2397097570A547D2DD86D0DBA8F6785 +:10CEC00059C7A2BF3400FFFF0080004000200010BF +:10CED000000000000000F8FC7C7E3E3F9F1FCF0F4B +:10CEE000E707000000000000FFFFFFFF0000FFFF5A +:10CEF000010003000000010000000000000000002D +:10CF0000000000000000000087000000000000009A +:10CF10000000000000000000000000010203040007 +:10CF20000D0E0F100000000043D8000061DA000071 +:10CF300029DB000083DB0000D7DB00003FDC0000C2 +:10CF40009DD8000055D90000E1DC0000EFE80000AA +:10CF5000100110013A0200001A02000004013C0016 +:10CF6000230044000E0001020408102040805555A3 +:10CF700055D6BE898E0000007006120DB413000055 +:10CF800014035A06A00900006004F208840DF4019D +:10CF9000FA00960064004B0032001E0014000000EE +:10CFA000D0CF010008000020100000000411000094 +:10CFB000E0CF010018000020BC0100002ACB0100D6 +:10CFC00000D00100D4010020EC1700002011000067 +:10CFD000024801688907FCD57047000000E200E0C4 +:10CFE00001FF01170218013E010001004C01002061 +:10CFF000FB349B5F80046F800010E469CB0100006C +:00000001FF diff --git a/components/softdevice/s310/toolchain/armgcc/armgcc_s310_nrf51422_xxaa.ld b/components/softdevice/s310/toolchain/armgcc/armgcc_s310_nrf51422_xxaa.ld new file mode 100644 index 0000000..c7ded65 --- /dev/null +++ b/components/softdevice/s310/toolchain/armgcc/armgcc_s310_nrf51422_xxaa.ld @@ -0,0 +1,22 @@ +/* Linker script to configure memory regions. */ + +SEARCH_DIR(.) +GROUP(-lgcc -lc -lnosys) + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x1d000, LENGTH = 0x23000 + RAM (rwx) : ORIGIN = 0x20002200, LENGTH = 0x1e00 +} + +SECTIONS +{ + .fs_data_out ALIGN(4): + { + PROVIDE( __start_fs_data = .); + KEEP(*(fs_data)) + PROVIDE( __stop_fs_data = .); + } = 0 +} + +INCLUDE "nrf5x_common.ld" \ No newline at end of file diff --git a/components/softdevice/s310/toolchain/armgcc/armgcc_s310_nrf51422_xxac.ld b/components/softdevice/s310/toolchain/armgcc/armgcc_s310_nrf51422_xxac.ld new file mode 100644 index 0000000..1e0d676 --- /dev/null +++ b/components/softdevice/s310/toolchain/armgcc/armgcc_s310_nrf51422_xxac.ld @@ -0,0 +1,22 @@ +/* Linker script to configure memory regions. */ + +SEARCH_DIR(.) +GROUP(-lgcc -lc -lnosys) + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x1d000, LENGTH = 0x23000 + RAM (rwx) : ORIGIN = 0x20002200, LENGTH = 0x5e00 +} + +SECTIONS +{ + .fs_data_out ALIGN(4): + { + PROVIDE( __start_fs_data = .); + KEEP(*(fs_data)) + PROVIDE( __stop_fs_data = .); + } = 0 +} + +INCLUDE "nrf5x_common.ld" \ No newline at end of file diff --git a/components/softdevice/s310/toolchain/iar/iar_s310_nrf51422_xxaa.icf b/components/softdevice/s310/toolchain/iar/iar_s310_nrf51422_xxaa.icf new file mode 100644 index 0000000..9d9cd00 --- /dev/null +++ b/components/softdevice/s310/toolchain/iar/iar_s310_nrf51422_xxaa.icf @@ -0,0 +1,31 @@ +/*###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__ = 0x1d000; +/*-Memory Regions-*/ +define symbol __ICFEDIT_region_ROM_start__ = 0x1d000; +define symbol __ICFEDIT_region_ROM_end__ = 0x3ffff; +define symbol __ICFEDIT_region_RAM_start__ = 0x20002200; +define symbol __ICFEDIT_region_RAM_end__ = 0x20003fff; +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x800; +define symbol __ICFEDIT_size_heap__ = 0x200; +/**** End of ICF editor section. ###ICF###*/ + +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 CSTACK, + block HEAP }; diff --git a/components/softdevice/s310/toolchain/iar/iar_s310_nrf51422_xxac.icf b/components/softdevice/s310/toolchain/iar/iar_s310_nrf51422_xxac.icf new file mode 100644 index 0000000..f809761 --- /dev/null +++ b/components/softdevice/s310/toolchain/iar/iar_s310_nrf51422_xxac.icf @@ -0,0 +1,31 @@ +/*###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__ = 0x1d000; +/*-Memory Regions-*/ +define symbol __ICFEDIT_region_ROM_start__ = 0x1d000; +define symbol __ICFEDIT_region_ROM_end__ = 0x3ffff; +define symbol __ICFEDIT_region_RAM_start__ = 0x20002200; +define symbol __ICFEDIT_region_RAM_end__ = 0x20007fff; +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x800; +define symbol __ICFEDIT_size_heap__ = 0x200; +/**** End of ICF editor section. ###ICF###*/ + +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 CSTACK, + block HEAP }; diff --git a/components/toolchain/arm/arm_startup_nrf51.s b/components/toolchain/arm/arm_startup_nrf51.s new file mode 100644 index 0000000..ee2c1c0 --- /dev/null +++ b/components/toolchain/arm/arm_startup_nrf51.s @@ -0,0 +1,255 @@ +; 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. + +; NOTE: Template files (including this one) are application specific and therefore +; expected to be copied into the application project folder prior to its use! + +; Description message + + IF :DEF: __STACK_SIZE +Stack_Size EQU __STACK_SIZE + ELSE +Stack_Size EQU 2048 + ENDIF + + AREA STACK, NOINIT, READWRITE, ALIGN=3 +Stack_Mem SPACE Stack_Size +__initial_sp + + IF :DEF: __HEAP_SIZE +Heap_Size EQU __HEAP_SIZE + ELSE +Heap_Size EQU 2048 + ENDIF + + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +Heap_Mem SPACE Heap_Size +__heap_limit + + 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 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD SVC_Handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD PendSV_Handler + DCD SysTick_Handler + + ; External Interrupts + DCD POWER_CLOCK_IRQHandler + DCD RADIO_IRQHandler + DCD UART0_IRQHandler + DCD SPI0_TWI0_IRQHandler + DCD SPI1_TWI1_IRQHandler + DCD 0 ; Reserved + DCD GPIOTE_IRQHandler + DCD ADC_IRQHandler + DCD TIMER0_IRQHandler + DCD TIMER1_IRQHandler + DCD TIMER2_IRQHandler + DCD RTC0_IRQHandler + DCD TEMP_IRQHandler + DCD RNG_IRQHandler + DCD ECB_IRQHandler + DCD CCM_AAR_IRQHandler + DCD WDT_IRQHandler + DCD RTC1_IRQHandler + DCD QDEC_IRQHandler + DCD LPCOMP_IRQHandler + DCD SWI0_IRQHandler + DCD SWI1_IRQHandler + DCD SWI2_IRQHandler + DCD SWI3_IRQHandler + DCD SWI4_IRQHandler + DCD SWI5_IRQHandler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + +__Vectors_End + +__Vectors_Size EQU __Vectors_End - __Vectors + + AREA |.text|, CODE, READONLY + +; Reset Handler + +NRF_POWER_RAMON_ADDRESS EQU 0x40000524 ; NRF_POWER->RAMON address +NRF_POWER_RAMONB_ADDRESS EQU 0x40000554 ; NRF_POWER->RAMONB address +NRF_POWER_RAMONx_RAMxON_ONMODE_Msk EQU 0x3 ; All RAM blocks on in onmode bit mask + +Reset_Handler PROC + EXPORT Reset_Handler [WEAK] + IMPORT SystemInit + IMPORT __main + + MOVS R1, #NRF_POWER_RAMONx_RAMxON_ONMODE_Msk + + LDR R0, =NRF_POWER_RAMON_ADDRESS + LDR R2, [R0] + ORRS R2, R2, R1 + STR R2, [R0] + + LDR R0, =NRF_POWER_RAMONB_ADDRESS + LDR R2, [R0] + ORRS R2, R2, R1 + STR R2, [R0] + + LDR R0, =SystemInit + 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 +SVC_Handler PROC + EXPORT SVC_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 UART0_IRQHandler [WEAK] + EXPORT SPI0_TWI0_IRQHandler [WEAK] + EXPORT SPI1_TWI1_IRQHandler [WEAK] + EXPORT GPIOTE_IRQHandler [WEAK] + EXPORT ADC_IRQHandler [WEAK] + EXPORT TIMER0_IRQHandler [WEAK] + EXPORT TIMER1_IRQHandler [WEAK] + EXPORT TIMER2_IRQHandler [WEAK] + EXPORT RTC0_IRQHandler [WEAK] + EXPORT TEMP_IRQHandler [WEAK] + EXPORT RNG_IRQHandler [WEAK] + EXPORT ECB_IRQHandler [WEAK] + EXPORT CCM_AAR_IRQHandler [WEAK] + EXPORT WDT_IRQHandler [WEAK] + EXPORT RTC1_IRQHandler [WEAK] + EXPORT QDEC_IRQHandler [WEAK] + EXPORT LPCOMP_IRQHandler [WEAK] + EXPORT SWI0_IRQHandler [WEAK] + EXPORT SWI1_IRQHandler [WEAK] + EXPORT SWI2_IRQHandler [WEAK] + EXPORT SWI3_IRQHandler [WEAK] + EXPORT SWI4_IRQHandler [WEAK] + EXPORT SWI5_IRQHandler [WEAK] +POWER_CLOCK_IRQHandler +RADIO_IRQHandler +UART0_IRQHandler +SPI0_TWI0_IRQHandler +SPI1_TWI1_IRQHandler +GPIOTE_IRQHandler +ADC_IRQHandler +TIMER0_IRQHandler +TIMER1_IRQHandler +TIMER2_IRQHandler +RTC0_IRQHandler +TEMP_IRQHandler +RNG_IRQHandler +ECB_IRQHandler +CCM_AAR_IRQHandler +WDT_IRQHandler +RTC1_IRQHandler +QDEC_IRQHandler +LPCOMP_IRQHandler +SWI0_IRQHandler +SWI1_IRQHandler +SWI2_IRQHandler +SWI3_IRQHandler +SWI4_IRQHandler +SWI5_IRQHandler + B . + ENDP + ALIGN + +; User Initial Stack & Heap + + IF :DEF:__MICROLIB + + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + + ELSE + + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + + LDR R0, = Heap_Mem + LDR R1, = (Stack_Mem + Stack_Size) + LDR R2, = (Heap_Mem + Heap_Size) + LDR R3, = Stack_Mem + BX LR + + ALIGN + + ENDIF + + END diff --git a/components/toolchain/arm/arm_startup_nrf52.s b/components/toolchain/arm/arm_startup_nrf52.s new file mode 100644 index 0000000..5c763b5 --- /dev/null +++ b/components/toolchain/arm/arm_startup_nrf52.s @@ -0,0 +1,485 @@ +; 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. + +; NOTE: Template files (including this one) are application specific and therefore +; expected to be copied into the application project folder prior to its use! + +; Description message + + IF :DEF: __STACK_SIZE +Stack_Size EQU __STACK_SIZE + ELSE +Stack_Size EQU 8192 + ENDIF + + AREA STACK, NOINIT, READWRITE, ALIGN=3 +Stack_Mem SPACE Stack_Size +__initial_sp + + IF :DEF: __HEAP_SIZE +Heap_Size EQU __HEAP_SIZE + ELSE +Heap_Size EQU 8192 + ENDIF + + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +Heap_Mem SPACE Heap_Size +__heap_limit + + 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 0 ; Reserved + DCD 0 ; Reserved + DCD PendSV_Handler + DCD SysTick_Handler + + ; External Interrupts + DCD POWER_CLOCK_IRQHandler + DCD RADIO_IRQHandler + DCD UARTE0_UART0_IRQHandler + DCD SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler + DCD SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler + DCD NFCT_IRQHandler + DCD GPIOTE_IRQHandler + DCD SAADC_IRQHandler + DCD TIMER0_IRQHandler + DCD TIMER1_IRQHandler + DCD TIMER2_IRQHandler + DCD RTC0_IRQHandler + DCD TEMP_IRQHandler + DCD RNG_IRQHandler + DCD ECB_IRQHandler + DCD CCM_AAR_IRQHandler + DCD WDT_IRQHandler + DCD RTC1_IRQHandler + DCD QDEC_IRQHandler + DCD COMP_LPCOMP_IRQHandler + DCD SWI0_EGU0_IRQHandler + DCD SWI1_EGU1_IRQHandler + DCD SWI2_EGU2_IRQHandler + DCD SWI3_EGU3_IRQHandler + DCD SWI4_EGU4_IRQHandler + DCD SWI5_EGU5_IRQHandler + DCD TIMER3_IRQHandler + DCD TIMER4_IRQHandler + DCD PWM0_IRQHandler + DCD PDM_IRQHandler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD MWU_IRQHandler + DCD PWM1_IRQHandler + DCD PWM2_IRQHandler + DCD SPIM2_SPIS2_SPI2_IRQHandler + DCD RTC2_IRQHandler + DCD I2S_IRQHandler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + +__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 + + LDR R0, =SystemInit + 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 +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 [WEAK] + EXPORT SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler [WEAK] + EXPORT SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler [WEAK] + EXPORT NFCT_IRQHandler [WEAK] + EXPORT GPIOTE_IRQHandler [WEAK] + EXPORT SAADC_IRQHandler [WEAK] + EXPORT TIMER0_IRQHandler [WEAK] + EXPORT TIMER1_IRQHandler [WEAK] + EXPORT TIMER2_IRQHandler [WEAK] + EXPORT RTC0_IRQHandler [WEAK] + EXPORT TEMP_IRQHandler [WEAK] + EXPORT RNG_IRQHandler [WEAK] + EXPORT ECB_IRQHandler [WEAK] + EXPORT CCM_AAR_IRQHandler [WEAK] + EXPORT WDT_IRQHandler [WEAK] + EXPORT RTC1_IRQHandler [WEAK] + EXPORT QDEC_IRQHandler [WEAK] + EXPORT COMP_LPCOMP_IRQHandler [WEAK] + EXPORT SWI0_EGU0_IRQHandler [WEAK] + EXPORT SWI1_EGU1_IRQHandler [WEAK] + EXPORT SWI2_EGU2_IRQHandler [WEAK] + EXPORT SWI3_EGU3_IRQHandler [WEAK] + EXPORT SWI4_EGU4_IRQHandler [WEAK] + EXPORT SWI5_EGU5_IRQHandler [WEAK] + EXPORT TIMER3_IRQHandler [WEAK] + EXPORT TIMER4_IRQHandler [WEAK] + EXPORT PWM0_IRQHandler [WEAK] + EXPORT PDM_IRQHandler [WEAK] + EXPORT MWU_IRQHandler [WEAK] + EXPORT PWM1_IRQHandler [WEAK] + EXPORT PWM2_IRQHandler [WEAK] + EXPORT SPIM2_SPIS2_SPI2_IRQHandler [WEAK] + EXPORT RTC2_IRQHandler [WEAK] + EXPORT I2S_IRQHandler [WEAK] +POWER_CLOCK_IRQHandler +RADIO_IRQHandler +UARTE0_UART0_IRQHandler +SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler +SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler +NFCT_IRQHandler +GPIOTE_IRQHandler +SAADC_IRQHandler +TIMER0_IRQHandler +TIMER1_IRQHandler +TIMER2_IRQHandler +RTC0_IRQHandler +TEMP_IRQHandler +RNG_IRQHandler +ECB_IRQHandler +CCM_AAR_IRQHandler +WDT_IRQHandler +RTC1_IRQHandler +QDEC_IRQHandler +COMP_LPCOMP_IRQHandler +SWI0_EGU0_IRQHandler +SWI1_EGU1_IRQHandler +SWI2_EGU2_IRQHandler +SWI3_EGU3_IRQHandler +SWI4_EGU4_IRQHandler +SWI5_EGU5_IRQHandler +TIMER3_IRQHandler +TIMER4_IRQHandler +PWM0_IRQHandler +PDM_IRQHandler +MWU_IRQHandler +PWM1_IRQHandler +PWM2_IRQHandler +SPIM2_SPIS2_SPI2_IRQHandler +RTC2_IRQHandler +I2S_IRQHandler + B . + ENDP + ALIGN + +; User Initial Stack & Heap + + IF :DEF:__MICROLIB + + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + + ELSE + + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + + LDR R0, = Heap_Mem + LDR R1, = (Stack_Mem + Stack_Size) + LDR R2, = (Heap_Mem + Heap_Size) + LDR R3, = Stack_Mem + BX LR + + ALIGN + + ENDIF + + END diff --git a/components/toolchain/arm/uicr_config.h b/components/toolchain/arm/uicr_config.h new file mode 100644 index 0000000..64ba577 --- /dev/null +++ b/components/toolchain/arm/uicr_config.h @@ -0,0 +1,104 @@ +/* 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. + * + */ + +/* Template files (including this one) are application specific and therefore expected to + be copied into the application project folder prior to its use! */ + +#ifndef _UICR_CONFIG_H +#define _UICR_CONFIG_H + +/*lint ++flb "Enter library region" */ + +#include + +/* + * Include this file in your project if you want to include in your compiled code files data + * for the User Information Configuration Registers (UICR) area; see nRF51 Series Reference + * Manual chapter User Information Configuration Registers. This file declares one variable + * per register of the UICR area and informs the linker where to place them. To include + * the desired value in the desired address, uncomment the variable with the proper address + * at the target area and update the assignment value. + * + * Please note that UICR values are stored in a reserved area of the flash and should only be + * stored into when downloading a hex file. Do not use these defined variables to store data + * at run time. + * + * Note as well that this file uses one non-standard attribute ("at"). It will only function + * with the ARMCC compiler toolset. + * + * Note that the hex file generated when this file is included will fail to download when using + * the standard download algorithm provided by Nordic. See example project "uicr_config_example" + * in any of the board example folders for an example of the recommended download method as well + * as the documentation that follows with the SDK. nrfjprog can be used as normal. + * + * Please note as well that if you are using a SoftDevice the UICR_CLENR0 address will + * already be in use. Do not uncomment that line. + */ + +// const uint32_t UICR_CLENR0 __attribute__((at(0x10001000))) __attribute__((used)) = 0xFFFFFFFF; // WARNING: This address might be used by the SoftDevice. Use with care. +// const uint32_t UICR_RBPCONF __attribute__((at(0x10001004))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_XTALFREQ __attribute__((at(0x10001008))) __attribute__((used)) = 0xFFFFFFFF; + +// const uint32_t UICR_ADDR_0x80 __attribute__((at(0x10001080))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0x84 __attribute__((at(0x10001084))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0x88 __attribute__((at(0x10001088))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0x8C __attribute__((at(0x1000108C))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0x90 __attribute__((at(0x10001090))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0x94 __attribute__((at(0x10001094))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0x98 __attribute__((at(0x10001098))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0x9C __attribute__((at(0x1000109C))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0xA0 __attribute__((at(0x100010A0))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0xA4 __attribute__((at(0x100010A4))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0xA8 __attribute__((at(0x100010A8))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0xAC __attribute__((at(0x100010AC))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0xB0 __attribute__((at(0x100010B0))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0xB4 __attribute__((at(0x100010B4))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0xB8 __attribute__((at(0x100010B8))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0xBC __attribute__((at(0x100010BC))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0xC0 __attribute__((at(0x100010C0))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0xC4 __attribute__((at(0x100010C4))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0xC8 __attribute__((at(0x100010C8))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0xCC __attribute__((at(0x100010CC))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0xD0 __attribute__((at(0x100010D0))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0xD4 __attribute__((at(0x100010D4))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0xD8 __attribute__((at(0x100010D8))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0xDC __attribute__((at(0x100010DC))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0xE0 __attribute__((at(0x100010E0))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0xE4 __attribute__((at(0x100010E4))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0xE8 __attribute__((at(0x100010E8))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0xEC __attribute__((at(0x100010EC))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0xF0 __attribute__((at(0x100010F0))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0xF4 __attribute__((at(0x100010F4))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0xF8 __attribute__((at(0x100010F8))) __attribute__((used)) = 0xFFFFFFFF; +// const uint32_t UICR_ADDR_0xFC __attribute__((at(0x100010FC))) __attribute__((used)) = 0xFFFFFFFF; + +/*lint --flb "Leave library region" */ + +#endif //_UICR_CONFIG_H diff --git a/components/toolchain/gcc/Makefile.common b/components/toolchain/gcc/Makefile.common new file mode 100644 index 0000000..50c69ad --- /dev/null +++ b/components/toolchain/gcc/Makefile.common @@ -0,0 +1,156 @@ +DEVICE := NRF51 +DEVICESERIES := nrf51 + +SDK_INCLUDE_PATH = $(SDK_PATH)/Include/ +SDK_SOURCE_PATH = $(SDK_PATH)/Source/ +TEMPLATE_PATH += $(SDK_SOURCE_PATH)/templates/gcc/ +OUTPUT_BINARY_DIRECTORY := _build + +ifeq ($(OS),Windows_NT) +include $(TEMPLATE_PATH)Makefile.windows +else +include $(TEMPLATE_PATH)Makefile.posix +endif + +ifeq ($(LINKER_SCRIPT),) + ifeq ($(USE_SOFTDEVICE), S110) + LINKER_SCRIPT = gcc_$(DEVICESERIES)_s110_$(DEVICE_VARIANT).ld + OUTPUT_FILENAME := $(OUTPUT_FILENAME)_s110_$(DEVICE_VARIANT) + else + ifeq ($(USE_SOFTDEVICE), S210) + LINKER_SCRIPT = gcc_$(DEVICESERIES)_s210_$(DEVICE_VARIANT).ld + OUTPUT_FILENAME := $(OUTPUT_FILENAME)_s210_$(DEVICE_VARIANT) + else + LINKER_SCRIPT = gcc_$(DEVICESERIES)_blank_$(DEVICE_VARIANT).ld + OUTPUT_FILENAME := $(OUTPUT_FILENAME)_$(DEVICE_VARIANT) + endif + endif +else +# Use externally defined settings +endif + +CPU := cortex-m0 + +# Toolchain commands +CC := "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-gcc" +AS := "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-as" +AR := "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-ar" -r +LD := "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-ld" +NM := "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-nm" +OBJDUMP := "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-objdump" +OBJCOPY := "$(GNU_INSTALL_ROOT)/bin/$(GNU_PREFIX)-objcopy" + +MK := mkdir +RM := rm -rf + +OBJECT_DIRECTORY := _build +LISTING_DIRECTORY := _build + +C_SOURCE_FILES += system_$(DEVICESERIES).c +ASSEMBLER_SOURCE_FILES += gcc_startup_$(DEVICESERIES).s + +# Linker flags +#LDFLAGS += -L"$(GNU_INSTALL_ROOT)/arm-none-eabi/lib/armv6-m" +#LDFLAGS += -L"$(GNU_INSTALL_ROOT)/lib/gcc/arm-none-eabi/$(GNU_VERSION)/armv6-m" +LDFLAGS += -Xlinker -Map=$(LISTING_DIRECTORY)/$(OUTPUT_FILENAME).map +LDFLAGS += -mcpu=$(CPU) -mthumb -mabi=aapcs -L $(TEMPLATE_PATH) -T$(LINKER_SCRIPT) + +# Compiler flags +CFLAGS += -mcpu=$(CPU) -mthumb -mabi=aapcs -D$(DEVICE) -D$(BOARD) -D$(TARGET_CHIP) --std=gnu99 +CFLAGS += -Wall -Werror +CFLAGS += -mfloat-abi=soft + +# Assembler flags +ASMFLAGS += -x assembler-with-cpp + +INCLUDEPATHS += -I"../" +INCLUDEPATHS += -I"$(SDK_PATH)Include" +INCLUDEPATHS += -I"$(SDK_PATH)Include/gcc" +INCLUDEPATHS += -I"$(SDK_PATH)Include/ext_sensors" + +# Sorting removes duplicates +BUILD_DIRECTORIES := $(sort $(OBJECT_DIRECTORY) $(OUTPUT_BINARY_DIRECTORY) $(LISTING_DIRECTORY) ) + +#################################################################### +# Rules # +#################################################################### + +C_SOURCE_FILENAMES = $(notdir $(C_SOURCE_FILES) ) +ASSEMBLER_SOURCE_FILENAMES = $(notdir $(ASSEMBLER_SOURCE_FILES) ) + +# Make a list of source paths +C_SOURCE_PATHS += ../ $(SDK_SOURCE_PATH) $(TEMPLATE_PATH) $(wildcard $(SDK_SOURCE_PATH)*/) $(wildcard $(SDK_SOURCE_PATH)ext_sensors/*/) $(wildcard $(SDK_SOURCE_PATH)ble/*/) +ASSEMBLER_SOURCE_PATHS = ../ $(SDK_SOURCE_PATH) $(TEMPLATE_PATH) $(wildcard $(SDK_SOURCE_PATH)*/) + +C_OBJECTS = $(addprefix $(OBJECT_DIRECTORY)/, $(C_SOURCE_FILENAMES:.c=.o) ) +ASSEMBLER_OBJECTS = $(addprefix $(OBJECT_DIRECTORY)/, $(ASSEMBLER_SOURCE_FILENAMES:.s=.o) ) + +# Set source lookup paths +vpath %.c $(C_SOURCE_PATHS) +vpath %.s $(ASSEMBLER_SOURCE_PATHS) + +# Include automatically previously generated dependencies +-include $(addprefix $(OBJECT_DIRECTORY)/, $(COBJS:.o=.d)) + +### Targets +debug: CFLAGS += -DDEBUG -g3 -O0 +debug: ASMFLAGS += -DDEBUG -g3 -O0 +debug: $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).bin $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).hex + +.PHONY: release +release: clean +release: CFLAGS += -DNDEBUG -O3 +release: ASMFLAGS += -DNDEBUG -O3 +release: $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).bin $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).hex + +echostuff: + @echo C_OBJECTS: [$(C_OBJECTS)] + @echo C_SOURCE_FILES: [$(C_SOURCE_FILES)] + @echo C_SOURCE_PATHS: [$(C_SOURCE_PATHS)] + +## Create build directories +$(BUILD_DIRECTORIES): + $(MK) $@ + +## Create objects from C source files +$(OBJECT_DIRECTORY)/%.o: %.c +# Build header dependencies + $(CC) $(CFLAGS) $(INCLUDEPATHS) -M $< -MF "$(@:.o=.d)" -MT $@ +# Do the actual compilation + $(CC) $(CFLAGS) $(INCLUDEPATHS) -c -o $@ $< + +## Assemble .s files +$(OBJECT_DIRECTORY)/%.o: %.s + $(CC) $(ASMFLAGS) $(INCLUDEPATHS) -c -o $@ $< + +## Link C and assembler objects to an .out file +$(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).out: $(BUILD_DIRECTORIES) $(C_OBJECTS) $(ASSEMBLER_OBJECTS) $(LIBRARIES) + $(CC) $(LDFLAGS) $(C_OBJECTS) $(ASSEMBLER_OBJECTS) $(LIBRARIES) -o $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).out + +## Create binary .bin file from the .out file +$(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).bin: $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).out + $(OBJCOPY) -O binary $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).out $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).bin + +## Create binary .hex file from the .out file +$(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).hex: $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).out + $(OBJCOPY) -O ihex $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).out $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).hex + +## Default build target +.PHONY: all +all: clean release + +clean: + $(RM) $(OUTPUT_BINARY_DIRECTORY) + +## Program device +.PHONY: flash +flash: $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).hex + nrfjprog --reset --program $(OUTPUT_BINARY_DIRECTORY)/$(OUTPUT_FILENAME).hex + +.PHONY: reset +reset: + nrfjprog --reset + +.PHONY: erase +erase: + nrfjprog --erase diff --git a/components/toolchain/gcc/Makefile.posix b/components/toolchain/gcc/Makefile.posix new file mode 100644 index 0000000..6994c4b --- /dev/null +++ b/components/toolchain/gcc/Makefile.posix @@ -0,0 +1,4 @@ +GNU_INSTALL_ROOT := /usr/local/gcc-arm-none-eabi-4_9-2015q1 +GNU_VERSION := 4.9.3 +GNU_PREFIX := arm-none-eabi + diff --git a/components/toolchain/gcc/Makefile.windows b/components/toolchain/gcc/Makefile.windows new file mode 100644 index 0000000..5b36007 --- /dev/null +++ b/components/toolchain/gcc/Makefile.windows @@ -0,0 +1,10 @@ +ifeq ($(findstring 86, $(ProgramFiles)), ) + PROGFILES := C:/Program Files +else + PROGFILES := C:/Program Files (x86) +endif + +GNU_INSTALL_ROOT := $(PROGFILES)/GNU Tools ARM Embedded/4.9 2015q1 +GNU_VERSION := 4.9.3 +GNU_PREFIX := arm-none-eabi + diff --git a/components/toolchain/gcc/arm_common_tables.h b/components/toolchain/gcc/arm_common_tables.h new file mode 100644 index 0000000..76aadca --- /dev/null +++ b/components/toolchain/gcc/arm_common_tables.h @@ -0,0 +1,136 @@ +/* ---------------------------------------------------------------------- +* Copyright (C) 2010-2014 ARM Limited. All rights reserved. +* +* $Date: 31. July 2014 +* $Revision: V1.4.4 +* +* Project: CMSIS DSP Library +* Title: arm_common_tables.h +* +* Description: This file has extern declaration for common tables like Bitreverse, reciprocal etc which are used across different functions +* +* Target Processor: Cortex-M4/Cortex-M3 +* +* 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 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 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +* LIABILITY, OR TORT (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 _ARM_COMMON_TABLES_H +#define _ARM_COMMON_TABLES_H + +#include "arm_math.h" + +extern const uint16_t armBitRevTable[1024]; +extern const q15_t armRecipTableQ15[64]; +extern const q31_t armRecipTableQ31[64]; +//extern const q31_t realCoefAQ31[1024]; +//extern const q31_t realCoefBQ31[1024]; +extern const float32_t twiddleCoef_16[32]; +extern const float32_t twiddleCoef_32[64]; +extern const float32_t twiddleCoef_64[128]; +extern const float32_t twiddleCoef_128[256]; +extern const float32_t twiddleCoef_256[512]; +extern const float32_t twiddleCoef_512[1024]; +extern const float32_t twiddleCoef_1024[2048]; +extern const float32_t twiddleCoef_2048[4096]; +extern const float32_t twiddleCoef_4096[8192]; +#define twiddleCoef twiddleCoef_4096 +extern const q31_t twiddleCoef_16_q31[24]; +extern const q31_t twiddleCoef_32_q31[48]; +extern const q31_t twiddleCoef_64_q31[96]; +extern const q31_t twiddleCoef_128_q31[192]; +extern const q31_t twiddleCoef_256_q31[384]; +extern const q31_t twiddleCoef_512_q31[768]; +extern const q31_t twiddleCoef_1024_q31[1536]; +extern const q31_t twiddleCoef_2048_q31[3072]; +extern const q31_t twiddleCoef_4096_q31[6144]; +extern const q15_t twiddleCoef_16_q15[24]; +extern const q15_t twiddleCoef_32_q15[48]; +extern const q15_t twiddleCoef_64_q15[96]; +extern const q15_t twiddleCoef_128_q15[192]; +extern const q15_t twiddleCoef_256_q15[384]; +extern const q15_t twiddleCoef_512_q15[768]; +extern const q15_t twiddleCoef_1024_q15[1536]; +extern const q15_t twiddleCoef_2048_q15[3072]; +extern const q15_t twiddleCoef_4096_q15[6144]; +extern const float32_t twiddleCoef_rfft_32[32]; +extern const float32_t twiddleCoef_rfft_64[64]; +extern const float32_t twiddleCoef_rfft_128[128]; +extern const float32_t twiddleCoef_rfft_256[256]; +extern const float32_t twiddleCoef_rfft_512[512]; +extern const float32_t twiddleCoef_rfft_1024[1024]; +extern const float32_t twiddleCoef_rfft_2048[2048]; +extern const float32_t twiddleCoef_rfft_4096[4096]; + + +/* floating-point bit reversal tables */ +#define ARMBITREVINDEXTABLE__16_TABLE_LENGTH ((uint16_t)20 ) +#define ARMBITREVINDEXTABLE__32_TABLE_LENGTH ((uint16_t)48 ) +#define ARMBITREVINDEXTABLE__64_TABLE_LENGTH ((uint16_t)56 ) +#define ARMBITREVINDEXTABLE_128_TABLE_LENGTH ((uint16_t)208 ) +#define ARMBITREVINDEXTABLE_256_TABLE_LENGTH ((uint16_t)440 ) +#define ARMBITREVINDEXTABLE_512_TABLE_LENGTH ((uint16_t)448 ) +#define ARMBITREVINDEXTABLE1024_TABLE_LENGTH ((uint16_t)1800) +#define ARMBITREVINDEXTABLE2048_TABLE_LENGTH ((uint16_t)3808) +#define ARMBITREVINDEXTABLE4096_TABLE_LENGTH ((uint16_t)4032) + +extern const uint16_t armBitRevIndexTable16[ARMBITREVINDEXTABLE__16_TABLE_LENGTH]; +extern const uint16_t armBitRevIndexTable32[ARMBITREVINDEXTABLE__32_TABLE_LENGTH]; +extern const uint16_t armBitRevIndexTable64[ARMBITREVINDEXTABLE__64_TABLE_LENGTH]; +extern const uint16_t armBitRevIndexTable128[ARMBITREVINDEXTABLE_128_TABLE_LENGTH]; +extern const uint16_t armBitRevIndexTable256[ARMBITREVINDEXTABLE_256_TABLE_LENGTH]; +extern const uint16_t armBitRevIndexTable512[ARMBITREVINDEXTABLE_512_TABLE_LENGTH]; +extern const uint16_t armBitRevIndexTable1024[ARMBITREVINDEXTABLE1024_TABLE_LENGTH]; +extern const uint16_t armBitRevIndexTable2048[ARMBITREVINDEXTABLE2048_TABLE_LENGTH]; +extern const uint16_t armBitRevIndexTable4096[ARMBITREVINDEXTABLE4096_TABLE_LENGTH]; + +/* fixed-point bit reversal tables */ +#define ARMBITREVINDEXTABLE_FIXED___16_TABLE_LENGTH ((uint16_t)12 ) +#define ARMBITREVINDEXTABLE_FIXED___32_TABLE_LENGTH ((uint16_t)24 ) +#define ARMBITREVINDEXTABLE_FIXED___64_TABLE_LENGTH ((uint16_t)56 ) +#define ARMBITREVINDEXTABLE_FIXED__128_TABLE_LENGTH ((uint16_t)112 ) +#define ARMBITREVINDEXTABLE_FIXED__256_TABLE_LENGTH ((uint16_t)240 ) +#define ARMBITREVINDEXTABLE_FIXED__512_TABLE_LENGTH ((uint16_t)480 ) +#define ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH ((uint16_t)992 ) +#define ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH ((uint16_t)1984) +#define ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH ((uint16_t)4032) + +extern const uint16_t armBitRevIndexTable_fixed_16[ARMBITREVINDEXTABLE_FIXED___16_TABLE_LENGTH]; +extern const uint16_t armBitRevIndexTable_fixed_32[ARMBITREVINDEXTABLE_FIXED___32_TABLE_LENGTH]; +extern const uint16_t armBitRevIndexTable_fixed_64[ARMBITREVINDEXTABLE_FIXED___64_TABLE_LENGTH]; +extern const uint16_t armBitRevIndexTable_fixed_128[ARMBITREVINDEXTABLE_FIXED__128_TABLE_LENGTH]; +extern const uint16_t armBitRevIndexTable_fixed_256[ARMBITREVINDEXTABLE_FIXED__256_TABLE_LENGTH]; +extern const uint16_t armBitRevIndexTable_fixed_512[ARMBITREVINDEXTABLE_FIXED__512_TABLE_LENGTH]; +extern const uint16_t armBitRevIndexTable_fixed_1024[ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH]; +extern const uint16_t armBitRevIndexTable_fixed_2048[ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH]; +extern const uint16_t armBitRevIndexTable_fixed_4096[ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH]; + +/* Tables for Fast Math Sine and Cosine */ +extern const float32_t sinTable_f32[FAST_MATH_TABLE_SIZE + 1]; +extern const q31_t sinTable_q31[FAST_MATH_TABLE_SIZE + 1]; +extern const q15_t sinTable_q15[FAST_MATH_TABLE_SIZE + 1]; + +#endif /* ARM_COMMON_TABLES_H */ diff --git a/components/toolchain/gcc/arm_const_structs.h b/components/toolchain/gcc/arm_const_structs.h new file mode 100644 index 0000000..217f1d5 --- /dev/null +++ b/components/toolchain/gcc/arm_const_structs.h @@ -0,0 +1,79 @@ +/* ---------------------------------------------------------------------- +* Copyright (C) 2010-2014 ARM Limited. All rights reserved. +* +* $Date: 31. July 2014 +* $Revision: V1.4.4 +* +* Project: CMSIS DSP Library +* Title: arm_const_structs.h +* +* Description: This file has constant structs that are initialized for +* user convenience. For example, some can be given as +* arguments to the arm_cfft_f32() function. +* +* Target Processor: Cortex-M4/Cortex-M3 +* +* 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 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 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +* LIABILITY, OR TORT (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 _ARM_CONST_STRUCTS_H +#define _ARM_CONST_STRUCTS_H + +#include "arm_math.h" +#include "arm_common_tables.h" + + extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len16; + extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len32; + extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len64; + extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len128; + extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len256; + extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len512; + extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len1024; + extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len2048; + extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len4096; + + extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len16; + extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len32; + extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len64; + extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len128; + extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len256; + extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len512; + extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len1024; + extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len2048; + extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len4096; + + extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len16; + extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len32; + extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len64; + extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len128; + extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len256; + extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len512; + extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len1024; + extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len2048; + extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len4096; + +#endif diff --git a/components/toolchain/gcc/arm_math.h b/components/toolchain/gcc/arm_math.h new file mode 100644 index 0000000..49e23ee --- /dev/null +++ b/components/toolchain/gcc/arm_math.h @@ -0,0 +1,7544 @@ +/* ---------------------------------------------------------------------- +* Copyright (C) 2010-2014 ARM Limited. All rights reserved. +* +* $Date: 12. March 2014 +* $Revision: V1.4.4 +* +* Project: CMSIS DSP Library +* Title: arm_math.h +* +* Description: Public header file for CMSIS DSP Library +* +* Target Processor: Cortex-M7/Cortex-M4/Cortex-M3/Cortex-M0 +* +* 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 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 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. + * -------------------------------------------------------------------- */ + +/** + \mainpage CMSIS DSP Software Library + * + * Introduction + * ------------ + * + * This user manual describes the CMSIS DSP software library, + * a suite of common signal processing functions for use on Cortex-M processor based devices. + * + * The library is divided into a number of functions each covering a specific category: + * - Basic math functions + * - Fast math functions + * - Complex math functions + * - Filters + * - Matrix functions + * - Transforms + * - Motor control functions + * - Statistical functions + * - Support functions + * - Interpolation functions + * + * The library has separate functions for operating on 8-bit integers, 16-bit integers, + * 32-bit integer and 32-bit floating-point values. + * + * Using the Library + * ------------ + * + * The library installer contains prebuilt versions of the libraries in the Lib folder. + * - arm_cortexM7lfdp_math.lib (Little endian and Double Precision Floating Point Unit on Cortex-M7) + * - arm_cortexM7bfdp_math.lib (Big endian and Double Precision Floating Point Unit on Cortex-M7) + * - arm_cortexM7lfsp_math.lib (Little endian and Single Precision Floating Point Unit on Cortex-M7) + * - arm_cortexM7bfsp_math.lib (Big endian and Single Precision Floating Point Unit on Cortex-M7) + * - arm_cortexM7l_math.lib (Little endian on Cortex-M7) + * - arm_cortexM7b_math.lib (Big endian on Cortex-M7) + * - arm_cortexM4lf_math.lib (Little endian and Floating Point Unit on Cortex-M4) + * - arm_cortexM4bf_math.lib (Big endian and Floating Point Unit on Cortex-M4) + * - arm_cortexM4l_math.lib (Little endian on Cortex-M4) + * - arm_cortexM4b_math.lib (Big endian on Cortex-M4) + * - arm_cortexM3l_math.lib (Little endian on Cortex-M3) + * - arm_cortexM3b_math.lib (Big endian on Cortex-M3) + * - arm_cortexM0l_math.lib (Little endian on Cortex-M0 / CortexM0+) + * - arm_cortexM0b_math.lib (Big endian on Cortex-M0 / CortexM0+) + * + * The library functions are declared in the public file arm_math.h which is placed in the Include folder. + * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single + * public header file arm_math.h for Cortex-M7/M4/M3/M0/M0+ with little endian and big endian. Same header file will be used for floating point unit(FPU) variants. + * Define the appropriate pre processor MACRO ARM_MATH_CM7 or ARM_MATH_CM4 or ARM_MATH_CM3 or + * ARM_MATH_CM0 or ARM_MATH_CM0PLUS depending on the target processor in the application. + * + * Examples + * -------- + * + * The library ships with a number of examples which demonstrate how to use the library functions. + * + * Toolchain Support + * ------------ + * + * The library has been developed and tested with MDK-ARM version 4.60. + * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly. + * + * Building the Library + * ------------ + * + * The library installer contains a project file to re build libraries on MDK-ARM Tool chain in the CMSIS\\DSP_Lib\\Source\\ARM folder. + * - arm_cortexM_math.uvproj + * + * + * The libraries can be built by opening the arm_cortexM_math.uvproj project in MDK-ARM, selecting a specific target, and defining the optional pre processor MACROs detailed above. + * + * Pre-processor Macros + * ------------ + * + * Each library project have differant pre-processor macros. + * + * - UNALIGNED_SUPPORT_DISABLE: + * + * Define macro UNALIGNED_SUPPORT_DISABLE, If the silicon does not support unaligned memory access + * + * - ARM_MATH_BIG_ENDIAN: + * + * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets. + * + * - ARM_MATH_MATRIX_CHECK: + * + * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices + * + * - ARM_MATH_ROUNDING: + * + * Define macro ARM_MATH_ROUNDING for rounding on support functions + * + * - ARM_MATH_CMx: + * + * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target + * and ARM_MATH_CM0 for building library on cortex-M0 target, ARM_MATH_CM0PLUS for building library on cortex-M0+ target. + * + * - __FPU_PRESENT: + * + * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for M4bf and M4lf libraries + * + *


+ * CMSIS-DSP in ARM::CMSIS Pack + * ----------------------------- + * + * The following files relevant to CMSIS-DSP are present in the ARM::CMSIS Pack directories: + * |File/Folder |Content | + * |------------------------------|------------------------------------------------------------------------| + * |\b CMSIS\\Documentation\\DSP | This documentation | + * |\b CMSIS\\DSP_Lib | Software license agreement (license.txt) | + * |\b CMSIS\\DSP_Lib\\Examples | Example projects demonstrating the usage of the library functions | + * |\b CMSIS\\DSP_Lib\\Source | Source files for rebuilding the library | + * + *
+ * Revision History of CMSIS-DSP + * ------------ + * Please refer to \ref ChangeLog_pg. + * + * Copyright Notice + * ------------ + * + * Copyright (C) 2010-2014 ARM Limited. All rights reserved. + */ + + +/** + * @defgroup groupMath Basic Math Functions + */ + +/** + * @defgroup groupFastMath Fast Math Functions + * This set of functions provides a fast approximation to sine, cosine, and square root. + * As compared to most of the other functions in the CMSIS math library, the fast math functions + * operate on individual values and not arrays. + * There are separate functions for Q15, Q31, and floating-point data. + * + */ + +/** + * @defgroup groupCmplxMath Complex Math Functions + * This set of functions operates on complex data vectors. + * The data in the complex arrays is stored in an interleaved fashion + * (real, imag, real, imag, ...). + * In the API functions, the number of samples in a complex array refers + * to the number of complex values; the array contains twice this number of + * real values. + */ + +/** + * @defgroup groupFilters Filtering Functions + */ + +/** + * @defgroup groupMatrix Matrix Functions + * + * This set of functions provides basic matrix math operations. + * The functions operate on matrix data structures. For example, + * the type + * definition for the floating-point matrix structure is shown + * below: + *
+ *     typedef struct
+ *     {
+ *       uint16_t numRows;     // number of rows of the matrix.
+ *       uint16_t numCols;     // number of columns of the matrix.
+ *       float32_t *pData;     // points to the data of the matrix.
+ *     } arm_matrix_instance_f32;
+ * 
+ * There are similar definitions for Q15 and Q31 data types. + * + * The structure specifies the size of the matrix and then points to + * an array of data. The array is of size numRows X numCols + * and the values are arranged in row order. That is, the + * matrix element (i, j) is stored at: + *
+ *     pData[i*numCols + j]
+ * 
+ * + * \par Init Functions + * There is an associated initialization function for each type of matrix + * data structure. + * The initialization function sets the values of the internal structure fields. + * Refer to the function arm_mat_init_f32(), arm_mat_init_q31() + * and arm_mat_init_q15() for floating-point, Q31 and Q15 types, respectively. + * + * \par + * Use of the initialization function is optional. However, if initialization function is used + * then the instance structure cannot be placed into a const data section. + * To place the instance structure in a const data + * section, manually initialize the data structure. For example: + *
+ * arm_matrix_instance_f32 S = {nRows, nColumns, pData};
+ * arm_matrix_instance_q31 S = {nRows, nColumns, pData};
+ * arm_matrix_instance_q15 S = {nRows, nColumns, pData};
+ * 
+ * where nRows specifies the number of rows, nColumns + * specifies the number of columns, and pData points to the + * data array. + * + * \par Size Checking + * By default all of the matrix functions perform size checking on the input and + * output matrices. For example, the matrix addition function verifies that the + * two input matrices and the output matrix all have the same number of rows and + * columns. If the size check fails the functions return: + *
+ *     ARM_MATH_SIZE_MISMATCH
+ * 
+ * Otherwise the functions return + *
+ *     ARM_MATH_SUCCESS
+ * 
+ * There is some overhead associated with this matrix size checking. + * The matrix size checking is enabled via the \#define + *
+ *     ARM_MATH_MATRIX_CHECK
+ * 
+ * within the library project settings. By default this macro is defined + * and size checking is enabled. By changing the project settings and + * undefining this macro size checking is eliminated and the functions + * run a bit faster. With size checking disabled the functions always + * return ARM_MATH_SUCCESS. + */ + +/** + * @defgroup groupTransforms Transform Functions + */ + +/** + * @defgroup groupController Controller Functions + */ + +/** + * @defgroup groupStats Statistics Functions + */ +/** + * @defgroup groupSupport Support Functions + */ + +/** + * @defgroup groupInterpolation Interpolation Functions + * These functions perform 1- and 2-dimensional interpolation of data. + * Linear interpolation is used for 1-dimensional data and + * bilinear interpolation is used for 2-dimensional data. + */ + +/** + * @defgroup groupExamples Examples + */ +#ifndef _ARM_MATH_H +#define _ARM_MATH_H + +#define __CMSIS_GENERIC /* disable NVIC and Systick functions */ + +#if defined(ARM_MATH_CM7) + #include "core_cm7.h" +#elif defined (ARM_MATH_CM4) + #include "core_cm4.h" +#elif defined (ARM_MATH_CM3) + #include "core_cm3.h" +#elif defined (ARM_MATH_CM0) + #include "core_cm0.h" +#define ARM_MATH_CM0_FAMILY + #elif defined (ARM_MATH_CM0PLUS) +#include "core_cm0plus.h" + #define ARM_MATH_CM0_FAMILY +#else + #error "Define according the used Cortex core ARM_MATH_CM7, ARM_MATH_CM4, ARM_MATH_CM3, ARM_MATH_CM0PLUS or ARM_MATH_CM0" +#endif + +#undef __CMSIS_GENERIC /* enable NVIC and Systick functions */ +#include "string.h" +#include "math.h" +#ifdef __cplusplus +extern "C" +{ +#endif + + + /** + * @brief Macros required for reciprocal calculation in Normalized LMS + */ + +#define DELTA_Q31 (0x100) +#define DELTA_Q15 0x5 +#define INDEX_MASK 0x0000003F +#ifndef PI +#define PI 3.14159265358979f +#endif + + /** + * @brief Macros required for SINE and COSINE Fast math approximations + */ + +#define FAST_MATH_TABLE_SIZE 512 +#define FAST_MATH_Q31_SHIFT (32 - 10) +#define FAST_MATH_Q15_SHIFT (16 - 10) +#define CONTROLLER_Q31_SHIFT (32 - 9) +#define TABLE_SIZE 256 +#define TABLE_SPACING_Q31 0x400000 +#define TABLE_SPACING_Q15 0x80 + + /** + * @brief Macros required for SINE and COSINE Controller functions + */ + /* 1.31(q31) Fixed value of 2/360 */ + /* -1 to +1 is divided into 360 values so total spacing is (2/360) */ +#define INPUT_SPACING 0xB60B61 + + /** + * @brief Macro for Unaligned Support + */ +#ifndef UNALIGNED_SUPPORT_DISABLE + #define ALIGN4 +#else + #if defined (__GNUC__) + #define ALIGN4 __attribute__((aligned(4))) + #else + #define ALIGN4 __align(4) + #endif +#endif /* #ifndef UNALIGNED_SUPPORT_DISABLE */ + + /** + * @brief Error status returned by some functions in the library. + */ + + typedef enum + { + ARM_MATH_SUCCESS = 0, /**< No error */ + ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */ + ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */ + ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation. */ + ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */ + ARM_MATH_SINGULAR = -5, /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */ + ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */ + } arm_status; + + /** + * @brief 8-bit fractional data type in 1.7 format. + */ + typedef int8_t q7_t; + + /** + * @brief 16-bit fractional data type in 1.15 format. + */ + typedef int16_t q15_t; + + /** + * @brief 32-bit fractional data type in 1.31 format. + */ + typedef int32_t q31_t; + + /** + * @brief 64-bit fractional data type in 1.63 format. + */ + typedef int64_t q63_t; + + /** + * @brief 32-bit floating-point type definition. + */ + typedef float float32_t; + + /** + * @brief 64-bit floating-point type definition. + */ + typedef double float64_t; + + /** + * @brief definition to read/write two 16 bit values. + */ +#if defined __CC_ARM +#define __SIMD32_TYPE int32_t __packed +#define CMSIS_UNUSED __attribute__((unused)) +#elif defined __ICCARM__ +#define CMSIS_UNUSED +#define __SIMD32_TYPE int32_t __packed +#elif defined __GNUC__ +#define __SIMD32_TYPE int32_t +#define CMSIS_UNUSED __attribute__((unused)) +#elif defined __CSMC__ /* Cosmic */ +#define CMSIS_UNUSED +#define __SIMD32_TYPE int32_t +#else +#error Unknown compiler +#endif + +#define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr)) +#define __SIMD32_CONST(addr) ((__SIMD32_TYPE *)(addr)) + +#define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE *) (addr)) + +#define __SIMD64(addr) (*(int64_t **) & (addr)) + +#if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) + /** + * @brief definition to pack two 16 bit values. + */ +#define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \ + (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) ) +#define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \ + (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) ) + +#endif + + + /** + * @brief definition to pack four 8 bit values. + */ +#ifndef ARM_MATH_BIG_ENDIAN + +#define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \ + (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \ + (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \ + (((int32_t)(v3) << 24) & (int32_t)0xFF000000) ) +#else + +#define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \ + (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \ + (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \ + (((int32_t)(v0) << 24) & (int32_t)0xFF000000) ) + +#endif + + + /** + * @brief Clips Q63 to Q31 values. + */ + static __INLINE q31_t clip_q63_to_q31( + q63_t x) + { + return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ? + ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x; + } + + /** + * @brief Clips Q63 to Q15 values. + */ + static __INLINE q15_t clip_q63_to_q15( + q63_t x) + { + return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ? + ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15); + } + + /** + * @brief Clips Q31 to Q7 values. + */ + static __INLINE q7_t clip_q31_to_q7( + q31_t x) + { + return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ? + ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x; + } + + /** + * @brief Clips Q31 to Q15 values. + */ + static __INLINE q15_t clip_q31_to_q15( + q31_t x) + { + return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ? + ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x; + } + + /** + * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format. + */ + + static __INLINE q63_t mult32x64( + q63_t x, + q31_t y) + { + return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) + + (((q63_t) (x >> 32) * y))); + } + + +#if defined (ARM_MATH_CM0_FAMILY) && defined ( __CC_ARM ) +#define __CLZ __clz +#endif + +#if defined (ARM_MATH_CM0_FAMILY) && ((defined (__ICCARM__)) ||(defined (__GNUC__)) || defined (__TASKING__) ) + + static __INLINE uint32_t __CLZ( + q31_t data); + + + static __INLINE uint32_t __CLZ( + q31_t data) + { + uint32_t count = 0; + uint32_t mask = 0x80000000; + + while((data & mask) == 0) + { + count += 1u; + mask = mask >> 1u; + } + + return (count); + + } + +#endif + + /** + * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type. + */ + + static __INLINE uint32_t arm_recip_q31( + q31_t in, + q31_t * dst, + q31_t * pRecipTable) + { + + uint32_t out, tempVal; + uint32_t index, i; + uint32_t signBits; + + if(in > 0) + { + signBits = __CLZ(in) - 1; + } + else + { + signBits = __CLZ(-in) - 1; + } + + /* Convert input sample to 1.31 format */ + in = in << signBits; + + /* calculation of index for initial approximated Val */ + index = (uint32_t) (in >> 24u); + index = (index & INDEX_MASK); + + /* 1.31 with exp 1 */ + out = pRecipTable[index]; + + /* calculation of reciprocal value */ + /* running approximation for two iterations */ + for (i = 0u; i < 2u; i++) + { + tempVal = (q31_t) (((q63_t) in * out) >> 31u); + tempVal = 0x7FFFFFFF - tempVal; + /* 1.31 with exp 1 */ + //out = (q31_t) (((q63_t) out * tempVal) >> 30u); + out = (q31_t) clip_q63_to_q31(((q63_t) out * tempVal) >> 30u); + } + + /* write output */ + *dst = out; + + /* return num of signbits of out = 1/in value */ + return (signBits + 1u); + + } + + /** + * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type. + */ + static __INLINE uint32_t arm_recip_q15( + q15_t in, + q15_t * dst, + q15_t * pRecipTable) + { + + uint32_t out = 0, tempVal = 0; + uint32_t index = 0, i = 0; + uint32_t signBits = 0; + + if(in > 0) + { + signBits = __CLZ(in) - 17; + } + else + { + signBits = __CLZ(-in) - 17; + } + + /* Convert input sample to 1.15 format */ + in = in << signBits; + + /* calculation of index for initial approximated Val */ + index = in >> 8; + index = (index & INDEX_MASK); + + /* 1.15 with exp 1 */ + out = pRecipTable[index]; + + /* calculation of reciprocal value */ + /* running approximation for two iterations */ + for (i = 0; i < 2; i++) + { + tempVal = (q15_t) (((q31_t) in * out) >> 15); + tempVal = 0x7FFF - tempVal; + /* 1.15 with exp 1 */ + out = (q15_t) (((q31_t) out * tempVal) >> 14); + } + + /* write output */ + *dst = out; + + /* return num of signbits of out = 1/in value */ + return (signBits + 1); + + } + + + /* + * @brief C custom defined intrinisic function for only M0 processors + */ +#if defined(ARM_MATH_CM0_FAMILY) + + static __INLINE q31_t __SSAT( + q31_t x, + uint32_t y) + { + int32_t posMax, negMin; + uint32_t i; + + posMax = 1; + for (i = 0; i < (y - 1); i++) + { + posMax = posMax * 2; + } + + if(x > 0) + { + posMax = (posMax - 1); + + if(x > posMax) + { + x = posMax; + } + } + else + { + negMin = -posMax; + + if(x < negMin) + { + x = negMin; + } + } + return (x); + + + } + +#endif /* end of ARM_MATH_CM0_FAMILY */ + + + + /* + * @brief C custom defined intrinsic function for M3 and M0 processors + */ +#if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) + + /* + * @brief C custom defined QADD8 for M3 and M0 processors + */ + static __INLINE q31_t __QADD8( + q31_t x, + q31_t y) + { + + q31_t sum; + q7_t r, s, t, u; + + r = (q7_t) x; + s = (q7_t) y; + + r = __SSAT((q31_t) (r + s), 8); + s = __SSAT(((q31_t) (((x << 16) >> 24) + ((y << 16) >> 24))), 8); + t = __SSAT(((q31_t) (((x << 8) >> 24) + ((y << 8) >> 24))), 8); + u = __SSAT(((q31_t) ((x >> 24) + (y >> 24))), 8); + + sum = + (((q31_t) u << 24) & 0xFF000000) | (((q31_t) t << 16) & 0x00FF0000) | + (((q31_t) s << 8) & 0x0000FF00) | (r & 0x000000FF); + + return sum; + + } + + /* + * @brief C custom defined QSUB8 for M3 and M0 processors + */ + static __INLINE q31_t __QSUB8( + q31_t x, + q31_t y) + { + + q31_t sum; + q31_t r, s, t, u; + + r = (q7_t) x; + s = (q7_t) y; + + r = __SSAT((r - s), 8); + s = __SSAT(((q31_t) (((x << 16) >> 24) - ((y << 16) >> 24))), 8) << 8; + t = __SSAT(((q31_t) (((x << 8) >> 24) - ((y << 8) >> 24))), 8) << 16; + u = __SSAT(((q31_t) ((x >> 24) - (y >> 24))), 8) << 24; + + sum = + (u & 0xFF000000) | (t & 0x00FF0000) | (s & 0x0000FF00) | (r & + 0x000000FF); + + return sum; + } + + /* + * @brief C custom defined QADD16 for M3 and M0 processors + */ + + /* + * @brief C custom defined QADD16 for M3 and M0 processors + */ + static __INLINE q31_t __QADD16( + q31_t x, + q31_t y) + { + + q31_t sum; + q31_t r, s; + + r = (q15_t) x; + s = (q15_t) y; + + r = __SSAT(r + s, 16); + s = __SSAT(((q31_t) ((x >> 16) + (y >> 16))), 16) << 16; + + sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); + + return sum; + + } + + /* + * @brief C custom defined SHADD16 for M3 and M0 processors + */ + static __INLINE q31_t __SHADD16( + q31_t x, + q31_t y) + { + + q31_t sum; + q31_t r, s; + + r = (q15_t) x; + s = (q15_t) y; + + r = ((r >> 1) + (s >> 1)); + s = ((q31_t) ((x >> 17) + (y >> 17))) << 16; + + sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); + + return sum; + + } + + /* + * @brief C custom defined QSUB16 for M3 and M0 processors + */ + static __INLINE q31_t __QSUB16( + q31_t x, + q31_t y) + { + + q31_t sum; + q31_t r, s; + + r = (q15_t) x; + s = (q15_t) y; + + r = __SSAT(r - s, 16); + s = __SSAT(((q31_t) ((x >> 16) - (y >> 16))), 16) << 16; + + sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); + + return sum; + } + + /* + * @brief C custom defined SHSUB16 for M3 and M0 processors + */ + static __INLINE q31_t __SHSUB16( + q31_t x, + q31_t y) + { + + q31_t diff; + q31_t r, s; + + r = (q15_t) x; + s = (q15_t) y; + + r = ((r >> 1) - (s >> 1)); + s = (((x >> 17) - (y >> 17)) << 16); + + diff = (s & 0xFFFF0000) | (r & 0x0000FFFF); + + return diff; + } + + /* + * @brief C custom defined QASX for M3 and M0 processors + */ + static __INLINE q31_t __QASX( + q31_t x, + q31_t y) + { + + q31_t sum = 0; + + sum = + ((sum + + clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) + (q15_t) y))) << 16) + + clip_q31_to_q15((q31_t) ((q15_t) x - (q15_t) (y >> 16))); + + return sum; + } + + /* + * @brief C custom defined SHASX for M3 and M0 processors + */ + static __INLINE q31_t __SHASX( + q31_t x, + q31_t y) + { + + q31_t sum; + q31_t r, s; + + r = (q15_t) x; + s = (q15_t) y; + + r = ((r >> 1) - (y >> 17)); + s = (((x >> 17) + (s >> 1)) << 16); + + sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); + + return sum; + } + + + /* + * @brief C custom defined QSAX for M3 and M0 processors + */ + static __INLINE q31_t __QSAX( + q31_t x, + q31_t y) + { + + q31_t sum = 0; + + sum = + ((sum + + clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) - (q15_t) y))) << 16) + + clip_q31_to_q15((q31_t) ((q15_t) x + (q15_t) (y >> 16))); + + return sum; + } + + /* + * @brief C custom defined SHSAX for M3 and M0 processors + */ + static __INLINE q31_t __SHSAX( + q31_t x, + q31_t y) + { + + q31_t sum; + q31_t r, s; + + r = (q15_t) x; + s = (q15_t) y; + + r = ((r >> 1) + (y >> 17)); + s = (((x >> 17) - (s >> 1)) << 16); + + sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); + + return sum; + } + + /* + * @brief C custom defined SMUSDX for M3 and M0 processors + */ + static __INLINE q31_t __SMUSDX( + q31_t x, + q31_t y) + { + + return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) - + ((q15_t) (x >> 16) * (q15_t) y))); + } + + /* + * @brief C custom defined SMUADX for M3 and M0 processors + */ + static __INLINE q31_t __SMUADX( + q31_t x, + q31_t y) + { + + return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) + + ((q15_t) (x >> 16) * (q15_t) y))); + } + + /* + * @brief C custom defined QADD for M3 and M0 processors + */ + static __INLINE q31_t __QADD( + q31_t x, + q31_t y) + { + return clip_q63_to_q31((q63_t) x + y); + } + + /* + * @brief C custom defined QSUB for M3 and M0 processors + */ + static __INLINE q31_t __QSUB( + q31_t x, + q31_t y) + { + return clip_q63_to_q31((q63_t) x - y); + } + + /* + * @brief C custom defined SMLAD for M3 and M0 processors + */ + static __INLINE q31_t __SMLAD( + q31_t x, + q31_t y, + q31_t sum) + { + + return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) + + ((q15_t) x * (q15_t) y)); + } + + /* + * @brief C custom defined SMLADX for M3 and M0 processors + */ + static __INLINE q31_t __SMLADX( + q31_t x, + q31_t y, + q31_t sum) + { + + return (sum + ((q15_t) (x >> 16) * (q15_t) (y)) + + ((q15_t) x * (q15_t) (y >> 16))); + } + + /* + * @brief C custom defined SMLSDX for M3 and M0 processors + */ + static __INLINE q31_t __SMLSDX( + q31_t x, + q31_t y, + q31_t sum) + { + + return (sum - ((q15_t) (x >> 16) * (q15_t) (y)) + + ((q15_t) x * (q15_t) (y >> 16))); + } + + /* + * @brief C custom defined SMLALD for M3 and M0 processors + */ + static __INLINE q63_t __SMLALD( + q31_t x, + q31_t y, + q63_t sum) + { + + return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) + + ((q15_t) x * (q15_t) y)); + } + + /* + * @brief C custom defined SMLALDX for M3 and M0 processors + */ + static __INLINE q63_t __SMLALDX( + q31_t x, + q31_t y, + q63_t sum) + { + + return (sum + ((q15_t) (x >> 16) * (q15_t) y)) + + ((q15_t) x * (q15_t) (y >> 16)); + } + + /* + * @brief C custom defined SMUAD for M3 and M0 processors + */ + static __INLINE q31_t __SMUAD( + q31_t x, + q31_t y) + { + + return (((x >> 16) * (y >> 16)) + + (((x << 16) >> 16) * ((y << 16) >> 16))); + } + + /* + * @brief C custom defined SMUSD for M3 and M0 processors + */ + static __INLINE q31_t __SMUSD( + q31_t x, + q31_t y) + { + + return (-((x >> 16) * (y >> 16)) + + (((x << 16) >> 16) * ((y << 16) >> 16))); + } + + + /* + * @brief C custom defined SXTB16 for M3 and M0 processors + */ + static __INLINE q31_t __SXTB16( + q31_t x) + { + + return ((((x << 24) >> 24) & 0x0000FFFF) | + (((x << 8) >> 8) & 0xFFFF0000)); + } + + +#endif /* defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */ + + + /** + * @brief Instance structure for the Q7 FIR filter. + */ + typedef struct + { + uint16_t numTaps; /**< number of filter coefficients in the filter. */ + q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ + q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ + } arm_fir_instance_q7; + + /** + * @brief Instance structure for the Q15 FIR filter. + */ + typedef struct + { + uint16_t numTaps; /**< number of filter coefficients in the filter. */ + q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ + q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ + } arm_fir_instance_q15; + + /** + * @brief Instance structure for the Q31 FIR filter. + */ + typedef struct + { + uint16_t numTaps; /**< number of filter coefficients in the filter. */ + q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ + q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ + } arm_fir_instance_q31; + + /** + * @brief Instance structure for the floating-point FIR filter. + */ + typedef struct + { + uint16_t numTaps; /**< number of filter coefficients in the filter. */ + float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ + float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ + } arm_fir_instance_f32; + + + /** + * @brief Processing function for the Q7 FIR filter. + * @param[in] *S points to an instance of the Q7 FIR filter structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + * @return none. + */ + void arm_fir_q7( + const arm_fir_instance_q7 * S, + q7_t * pSrc, + q7_t * pDst, + uint32_t blockSize); + + + /** + * @brief Initialization function for the Q7 FIR filter. + * @param[in,out] *S points to an instance of the Q7 FIR structure. + * @param[in] numTaps Number of filter coefficients in the filter. + * @param[in] *pCoeffs points to the filter coefficients. + * @param[in] *pState points to the state buffer. + * @param[in] blockSize number of samples that are processed. + * @return none + */ + void arm_fir_init_q7( + arm_fir_instance_q7 * S, + uint16_t numTaps, + q7_t * pCoeffs, + q7_t * pState, + uint32_t blockSize); + + + /** + * @brief Processing function for the Q15 FIR filter. + * @param[in] *S points to an instance of the Q15 FIR structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + * @return none. + */ + void arm_fir_q15( + const arm_fir_instance_q15 * S, + q15_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + /** + * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4. + * @param[in] *S points to an instance of the Q15 FIR filter structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + * @return none. + */ + void arm_fir_fast_q15( + const arm_fir_instance_q15 * S, + q15_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + /** + * @brief Initialization function for the Q15 FIR filter. + * @param[in,out] *S points to an instance of the Q15 FIR filter structure. + * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4. + * @param[in] *pCoeffs points to the filter coefficients. + * @param[in] *pState points to the state buffer. + * @param[in] blockSize number of samples that are processed at a time. + * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if + * numTaps is not a supported value. + */ + + arm_status arm_fir_init_q15( + arm_fir_instance_q15 * S, + uint16_t numTaps, + q15_t * pCoeffs, + q15_t * pState, + uint32_t blockSize); + + /** + * @brief Processing function for the Q31 FIR filter. + * @param[in] *S points to an instance of the Q31 FIR filter structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + * @return none. + */ + void arm_fir_q31( + const arm_fir_instance_q31 * S, + q31_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + /** + * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4. + * @param[in] *S points to an instance of the Q31 FIR structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + * @return none. + */ + void arm_fir_fast_q31( + const arm_fir_instance_q31 * S, + q31_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + /** + * @brief Initialization function for the Q31 FIR filter. + * @param[in,out] *S points to an instance of the Q31 FIR structure. + * @param[in] numTaps Number of filter coefficients in the filter. + * @param[in] *pCoeffs points to the filter coefficients. + * @param[in] *pState points to the state buffer. + * @param[in] blockSize number of samples that are processed at a time. + * @return none. + */ + void arm_fir_init_q31( + arm_fir_instance_q31 * S, + uint16_t numTaps, + q31_t * pCoeffs, + q31_t * pState, + uint32_t blockSize); + + /** + * @brief Processing function for the floating-point FIR filter. + * @param[in] *S points to an instance of the floating-point FIR structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + * @return none. + */ + void arm_fir_f32( + const arm_fir_instance_f32 * S, + float32_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + /** + * @brief Initialization function for the floating-point FIR filter. + * @param[in,out] *S points to an instance of the floating-point FIR filter structure. + * @param[in] numTaps Number of filter coefficients in the filter. + * @param[in] *pCoeffs points to the filter coefficients. + * @param[in] *pState points to the state buffer. + * @param[in] blockSize number of samples that are processed at a time. + * @return none. + */ + void arm_fir_init_f32( + arm_fir_instance_f32 * S, + uint16_t numTaps, + float32_t * pCoeffs, + float32_t * pState, + uint32_t blockSize); + + + /** + * @brief Instance structure for the Q15 Biquad cascade filter. + */ + typedef struct + { + int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ + q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ + q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ + int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */ + + } arm_biquad_casd_df1_inst_q15; + + + /** + * @brief Instance structure for the Q31 Biquad cascade filter. + */ + typedef struct + { + uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ + q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ + q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ + uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */ + + } arm_biquad_casd_df1_inst_q31; + + /** + * @brief Instance structure for the floating-point Biquad cascade filter. + */ + typedef struct + { + uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ + float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ + float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ + + + } arm_biquad_casd_df1_inst_f32; + + + + /** + * @brief Processing function for the Q15 Biquad cascade filter. + * @param[in] *S points to an instance of the Q15 Biquad cascade structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + * @return none. + */ + + void arm_biquad_cascade_df1_q15( + const arm_biquad_casd_df1_inst_q15 * S, + q15_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + /** + * @brief Initialization function for the Q15 Biquad cascade filter. + * @param[in,out] *S points to an instance of the Q15 Biquad cascade structure. + * @param[in] numStages number of 2nd order stages in the filter. + * @param[in] *pCoeffs points to the filter coefficients. + * @param[in] *pState points to the state buffer. + * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format + * @return none + */ + + void arm_biquad_cascade_df1_init_q15( + arm_biquad_casd_df1_inst_q15 * S, + uint8_t numStages, + q15_t * pCoeffs, + q15_t * pState, + int8_t postShift); + + + /** + * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4. + * @param[in] *S points to an instance of the Q15 Biquad cascade structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + * @return none. + */ + + void arm_biquad_cascade_df1_fast_q15( + const arm_biquad_casd_df1_inst_q15 * S, + q15_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + + /** + * @brief Processing function for the Q31 Biquad cascade filter + * @param[in] *S points to an instance of the Q31 Biquad cascade structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + * @return none. + */ + + void arm_biquad_cascade_df1_q31( + const arm_biquad_casd_df1_inst_q31 * S, + q31_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + /** + * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4. + * @param[in] *S points to an instance of the Q31 Biquad cascade structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + * @return none. + */ + + void arm_biquad_cascade_df1_fast_q31( + const arm_biquad_casd_df1_inst_q31 * S, + q31_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + /** + * @brief Initialization function for the Q31 Biquad cascade filter. + * @param[in,out] *S points to an instance of the Q31 Biquad cascade structure. + * @param[in] numStages number of 2nd order stages in the filter. + * @param[in] *pCoeffs points to the filter coefficients. + * @param[in] *pState points to the state buffer. + * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format + * @return none + */ + + void arm_biquad_cascade_df1_init_q31( + arm_biquad_casd_df1_inst_q31 * S, + uint8_t numStages, + q31_t * pCoeffs, + q31_t * pState, + int8_t postShift); + + /** + * @brief Processing function for the floating-point Biquad cascade filter. + * @param[in] *S points to an instance of the floating-point Biquad cascade structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + * @return none. + */ + + void arm_biquad_cascade_df1_f32( + const arm_biquad_casd_df1_inst_f32 * S, + float32_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + /** + * @brief Initialization function for the floating-point Biquad cascade filter. + * @param[in,out] *S points to an instance of the floating-point Biquad cascade structure. + * @param[in] numStages number of 2nd order stages in the filter. + * @param[in] *pCoeffs points to the filter coefficients. + * @param[in] *pState points to the state buffer. + * @return none + */ + + void arm_biquad_cascade_df1_init_f32( + arm_biquad_casd_df1_inst_f32 * S, + uint8_t numStages, + float32_t * pCoeffs, + float32_t * pState); + + + /** + * @brief Instance structure for the floating-point matrix structure. + */ + + typedef struct + { + uint16_t numRows; /**< number of rows of the matrix. */ + uint16_t numCols; /**< number of columns of the matrix. */ + float32_t *pData; /**< points to the data of the matrix. */ + } arm_matrix_instance_f32; + + + /** + * @brief Instance structure for the floating-point matrix structure. + */ + + typedef struct + { + uint16_t numRows; /**< number of rows of the matrix. */ + uint16_t numCols; /**< number of columns of the matrix. */ + float64_t *pData; /**< points to the data of the matrix. */ + } arm_matrix_instance_f64; + + /** + * @brief Instance structure for the Q15 matrix structure. + */ + + typedef struct + { + uint16_t numRows; /**< number of rows of the matrix. */ + uint16_t numCols; /**< number of columns of the matrix. */ + q15_t *pData; /**< points to the data of the matrix. */ + + } arm_matrix_instance_q15; + + /** + * @brief Instance structure for the Q31 matrix structure. + */ + + typedef struct + { + uint16_t numRows; /**< number of rows of the matrix. */ + uint16_t numCols; /**< number of columns of the matrix. */ + q31_t *pData; /**< points to the data of the matrix. */ + + } arm_matrix_instance_q31; + + + + /** + * @brief Floating-point matrix addition. + * @param[in] *pSrcA points to the first input matrix structure + * @param[in] *pSrcB points to the second input matrix structure + * @param[out] *pDst points to output matrix structure + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ + + arm_status arm_mat_add_f32( + const arm_matrix_instance_f32 * pSrcA, + const arm_matrix_instance_f32 * pSrcB, + arm_matrix_instance_f32 * pDst); + + /** + * @brief Q15 matrix addition. + * @param[in] *pSrcA points to the first input matrix structure + * @param[in] *pSrcB points to the second input matrix structure + * @param[out] *pDst points to output matrix structure + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ + + arm_status arm_mat_add_q15( + const arm_matrix_instance_q15 * pSrcA, + const arm_matrix_instance_q15 * pSrcB, + arm_matrix_instance_q15 * pDst); + + /** + * @brief Q31 matrix addition. + * @param[in] *pSrcA points to the first input matrix structure + * @param[in] *pSrcB points to the second input matrix structure + * @param[out] *pDst points to output matrix structure + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ + + arm_status arm_mat_add_q31( + const arm_matrix_instance_q31 * pSrcA, + const arm_matrix_instance_q31 * pSrcB, + arm_matrix_instance_q31 * pDst); + + /** + * @brief Floating-point, complex, matrix multiplication. + * @param[in] *pSrcA points to the first input matrix structure + * @param[in] *pSrcB points to the second input matrix structure + * @param[out] *pDst points to output matrix structure + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ + + arm_status arm_mat_cmplx_mult_f32( + const arm_matrix_instance_f32 * pSrcA, + const arm_matrix_instance_f32 * pSrcB, + arm_matrix_instance_f32 * pDst); + + /** + * @brief Q15, complex, matrix multiplication. + * @param[in] *pSrcA points to the first input matrix structure + * @param[in] *pSrcB points to the second input matrix structure + * @param[out] *pDst points to output matrix structure + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ + + arm_status arm_mat_cmplx_mult_q15( + const arm_matrix_instance_q15 * pSrcA, + const arm_matrix_instance_q15 * pSrcB, + arm_matrix_instance_q15 * pDst, + q15_t * pScratch); + + /** + * @brief Q31, complex, matrix multiplication. + * @param[in] *pSrcA points to the first input matrix structure + * @param[in] *pSrcB points to the second input matrix structure + * @param[out] *pDst points to output matrix structure + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ + + arm_status arm_mat_cmplx_mult_q31( + const arm_matrix_instance_q31 * pSrcA, + const arm_matrix_instance_q31 * pSrcB, + arm_matrix_instance_q31 * pDst); + + + /** + * @brief Floating-point matrix transpose. + * @param[in] *pSrc points to the input matrix + * @param[out] *pDst points to the output matrix + * @return The function returns either ARM_MATH_SIZE_MISMATCH + * or ARM_MATH_SUCCESS based on the outcome of size checking. + */ + + arm_status arm_mat_trans_f32( + const arm_matrix_instance_f32 * pSrc, + arm_matrix_instance_f32 * pDst); + + + /** + * @brief Q15 matrix transpose. + * @param[in] *pSrc points to the input matrix + * @param[out] *pDst points to the output matrix + * @return The function returns either ARM_MATH_SIZE_MISMATCH + * or ARM_MATH_SUCCESS based on the outcome of size checking. + */ + + arm_status arm_mat_trans_q15( + const arm_matrix_instance_q15 * pSrc, + arm_matrix_instance_q15 * pDst); + + /** + * @brief Q31 matrix transpose. + * @param[in] *pSrc points to the input matrix + * @param[out] *pDst points to the output matrix + * @return The function returns either ARM_MATH_SIZE_MISMATCH + * or ARM_MATH_SUCCESS based on the outcome of size checking. + */ + + arm_status arm_mat_trans_q31( + const arm_matrix_instance_q31 * pSrc, + arm_matrix_instance_q31 * pDst); + + + /** + * @brief Floating-point matrix multiplication + * @param[in] *pSrcA points to the first input matrix structure + * @param[in] *pSrcB points to the second input matrix structure + * @param[out] *pDst points to output matrix structure + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ + + arm_status arm_mat_mult_f32( + const arm_matrix_instance_f32 * pSrcA, + const arm_matrix_instance_f32 * pSrcB, + arm_matrix_instance_f32 * pDst); + + /** + * @brief Q15 matrix multiplication + * @param[in] *pSrcA points to the first input matrix structure + * @param[in] *pSrcB points to the second input matrix structure + * @param[out] *pDst points to output matrix structure + * @param[in] *pState points to the array for storing intermediate results + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ + + arm_status arm_mat_mult_q15( + const arm_matrix_instance_q15 * pSrcA, + const arm_matrix_instance_q15 * pSrcB, + arm_matrix_instance_q15 * pDst, + q15_t * pState); + + /** + * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4 + * @param[in] *pSrcA points to the first input matrix structure + * @param[in] *pSrcB points to the second input matrix structure + * @param[out] *pDst points to output matrix structure + * @param[in] *pState points to the array for storing intermediate results + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ + + arm_status arm_mat_mult_fast_q15( + const arm_matrix_instance_q15 * pSrcA, + const arm_matrix_instance_q15 * pSrcB, + arm_matrix_instance_q15 * pDst, + q15_t * pState); + + /** + * @brief Q31 matrix multiplication + * @param[in] *pSrcA points to the first input matrix structure + * @param[in] *pSrcB points to the second input matrix structure + * @param[out] *pDst points to output matrix structure + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ + + arm_status arm_mat_mult_q31( + const arm_matrix_instance_q31 * pSrcA, + const arm_matrix_instance_q31 * pSrcB, + arm_matrix_instance_q31 * pDst); + + /** + * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4 + * @param[in] *pSrcA points to the first input matrix structure + * @param[in] *pSrcB points to the second input matrix structure + * @param[out] *pDst points to output matrix structure + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ + + arm_status arm_mat_mult_fast_q31( + const arm_matrix_instance_q31 * pSrcA, + const arm_matrix_instance_q31 * pSrcB, + arm_matrix_instance_q31 * pDst); + + + /** + * @brief Floating-point matrix subtraction + * @param[in] *pSrcA points to the first input matrix structure + * @param[in] *pSrcB points to the second input matrix structure + * @param[out] *pDst points to output matrix structure + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ + + arm_status arm_mat_sub_f32( + const arm_matrix_instance_f32 * pSrcA, + const arm_matrix_instance_f32 * pSrcB, + arm_matrix_instance_f32 * pDst); + + /** + * @brief Q15 matrix subtraction + * @param[in] *pSrcA points to the first input matrix structure + * @param[in] *pSrcB points to the second input matrix structure + * @param[out] *pDst points to output matrix structure + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ + + arm_status arm_mat_sub_q15( + const arm_matrix_instance_q15 * pSrcA, + const arm_matrix_instance_q15 * pSrcB, + arm_matrix_instance_q15 * pDst); + + /** + * @brief Q31 matrix subtraction + * @param[in] *pSrcA points to the first input matrix structure + * @param[in] *pSrcB points to the second input matrix structure + * @param[out] *pDst points to output matrix structure + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ + + arm_status arm_mat_sub_q31( + const arm_matrix_instance_q31 * pSrcA, + const arm_matrix_instance_q31 * pSrcB, + arm_matrix_instance_q31 * pDst); + + /** + * @brief Floating-point matrix scaling. + * @param[in] *pSrc points to the input matrix + * @param[in] scale scale factor + * @param[out] *pDst points to the output matrix + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ + + arm_status arm_mat_scale_f32( + const arm_matrix_instance_f32 * pSrc, + float32_t scale, + arm_matrix_instance_f32 * pDst); + + /** + * @brief Q15 matrix scaling. + * @param[in] *pSrc points to input matrix + * @param[in] scaleFract fractional portion of the scale factor + * @param[in] shift number of bits to shift the result by + * @param[out] *pDst points to output matrix + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ + + arm_status arm_mat_scale_q15( + const arm_matrix_instance_q15 * pSrc, + q15_t scaleFract, + int32_t shift, + arm_matrix_instance_q15 * pDst); + + /** + * @brief Q31 matrix scaling. + * @param[in] *pSrc points to input matrix + * @param[in] scaleFract fractional portion of the scale factor + * @param[in] shift number of bits to shift the result by + * @param[out] *pDst points to output matrix structure + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ + + arm_status arm_mat_scale_q31( + const arm_matrix_instance_q31 * pSrc, + q31_t scaleFract, + int32_t shift, + arm_matrix_instance_q31 * pDst); + + + /** + * @brief Q31 matrix initialization. + * @param[in,out] *S points to an instance of the floating-point matrix structure. + * @param[in] nRows number of rows in the matrix. + * @param[in] nColumns number of columns in the matrix. + * @param[in] *pData points to the matrix data array. + * @return none + */ + + void arm_mat_init_q31( + arm_matrix_instance_q31 * S, + uint16_t nRows, + uint16_t nColumns, + q31_t * pData); + + /** + * @brief Q15 matrix initialization. + * @param[in,out] *S points to an instance of the floating-point matrix structure. + * @param[in] nRows number of rows in the matrix. + * @param[in] nColumns number of columns in the matrix. + * @param[in] *pData points to the matrix data array. + * @return none + */ + + void arm_mat_init_q15( + arm_matrix_instance_q15 * S, + uint16_t nRows, + uint16_t nColumns, + q15_t * pData); + + /** + * @brief Floating-point matrix initialization. + * @param[in,out] *S points to an instance of the floating-point matrix structure. + * @param[in] nRows number of rows in the matrix. + * @param[in] nColumns number of columns in the matrix. + * @param[in] *pData points to the matrix data array. + * @return none + */ + + void arm_mat_init_f32( + arm_matrix_instance_f32 * S, + uint16_t nRows, + uint16_t nColumns, + float32_t * pData); + + + + /** + * @brief Instance structure for the Q15 PID Control. + */ + typedef struct + { + q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ +#ifdef ARM_MATH_CM0_FAMILY + q15_t A1; + q15_t A2; +#else + q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/ +#endif + q15_t state[3]; /**< The state array of length 3. */ + q15_t Kp; /**< The proportional gain. */ + q15_t Ki; /**< The integral gain. */ + q15_t Kd; /**< The derivative gain. */ + } arm_pid_instance_q15; + + /** + * @brief Instance structure for the Q31 PID Control. + */ + typedef struct + { + q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ + q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */ + q31_t A2; /**< The derived gain, A2 = Kd . */ + q31_t state[3]; /**< The state array of length 3. */ + q31_t Kp; /**< The proportional gain. */ + q31_t Ki; /**< The integral gain. */ + q31_t Kd; /**< The derivative gain. */ + + } arm_pid_instance_q31; + + /** + * @brief Instance structure for the floating-point PID Control. + */ + typedef struct + { + float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ + float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */ + float32_t A2; /**< The derived gain, A2 = Kd . */ + float32_t state[3]; /**< The state array of length 3. */ + float32_t Kp; /**< The proportional gain. */ + float32_t Ki; /**< The integral gain. */ + float32_t Kd; /**< The derivative gain. */ + } arm_pid_instance_f32; + + + + /** + * @brief Initialization function for the floating-point PID Control. + * @param[in,out] *S points to an instance of the PID structure. + * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. + * @return none. + */ + void arm_pid_init_f32( + arm_pid_instance_f32 * S, + int32_t resetStateFlag); + + /** + * @brief Reset function for the floating-point PID Control. + * @param[in,out] *S is an instance of the floating-point PID Control structure + * @return none + */ + void arm_pid_reset_f32( + arm_pid_instance_f32 * S); + + + /** + * @brief Initialization function for the Q31 PID Control. + * @param[in,out] *S points to an instance of the Q15 PID structure. + * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. + * @return none. + */ + void arm_pid_init_q31( + arm_pid_instance_q31 * S, + int32_t resetStateFlag); + + + /** + * @brief Reset function for the Q31 PID Control. + * @param[in,out] *S points to an instance of the Q31 PID Control structure + * @return none + */ + + void arm_pid_reset_q31( + arm_pid_instance_q31 * S); + + /** + * @brief Initialization function for the Q15 PID Control. + * @param[in,out] *S points to an instance of the Q15 PID structure. + * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. + * @return none. + */ + void arm_pid_init_q15( + arm_pid_instance_q15 * S, + int32_t resetStateFlag); + + /** + * @brief Reset function for the Q15 PID Control. + * @param[in,out] *S points to an instance of the q15 PID Control structure + * @return none + */ + void arm_pid_reset_q15( + arm_pid_instance_q15 * S); + + + /** + * @brief Instance structure for the floating-point Linear Interpolate function. + */ + typedef struct + { + uint32_t nValues; /**< nValues */ + float32_t x1; /**< x1 */ + float32_t xSpacing; /**< xSpacing */ + float32_t *pYData; /**< pointer to the table of Y values */ + } arm_linear_interp_instance_f32; + + /** + * @brief Instance structure for the floating-point bilinear interpolation function. + */ + + typedef struct + { + uint16_t numRows; /**< number of rows in the data table. */ + uint16_t numCols; /**< number of columns in the data table. */ + float32_t *pData; /**< points to the data table. */ + } arm_bilinear_interp_instance_f32; + + /** + * @brief Instance structure for the Q31 bilinear interpolation function. + */ + + typedef struct + { + uint16_t numRows; /**< number of rows in the data table. */ + uint16_t numCols; /**< number of columns in the data table. */ + q31_t *pData; /**< points to the data table. */ + } arm_bilinear_interp_instance_q31; + + /** + * @brief Instance structure for the Q15 bilinear interpolation function. + */ + + typedef struct + { + uint16_t numRows; /**< number of rows in the data table. */ + uint16_t numCols; /**< number of columns in the data table. */ + q15_t *pData; /**< points to the data table. */ + } arm_bilinear_interp_instance_q15; + + /** + * @brief Instance structure for the Q15 bilinear interpolation function. + */ + + typedef struct + { + uint16_t numRows; /**< number of rows in the data table. */ + uint16_t numCols; /**< number of columns in the data table. */ + q7_t *pData; /**< points to the data table. */ + } arm_bilinear_interp_instance_q7; + + + /** + * @brief Q7 vector multiplication. + * @param[in] *pSrcA points to the first input vector + * @param[in] *pSrcB points to the second input vector + * @param[out] *pDst points to the output vector + * @param[in] blockSize number of samples in each vector + * @return none. + */ + + void arm_mult_q7( + q7_t * pSrcA, + q7_t * pSrcB, + q7_t * pDst, + uint32_t blockSize); + + /** + * @brief Q15 vector multiplication. + * @param[in] *pSrcA points to the first input vector + * @param[in] *pSrcB points to the second input vector + * @param[out] *pDst points to the output vector + * @param[in] blockSize number of samples in each vector + * @return none. + */ + + void arm_mult_q15( + q15_t * pSrcA, + q15_t * pSrcB, + q15_t * pDst, + uint32_t blockSize); + + /** + * @brief Q31 vector multiplication. + * @param[in] *pSrcA points to the first input vector + * @param[in] *pSrcB points to the second input vector + * @param[out] *pDst points to the output vector + * @param[in] blockSize number of samples in each vector + * @return none. + */ + + void arm_mult_q31( + q31_t * pSrcA, + q31_t * pSrcB, + q31_t * pDst, + uint32_t blockSize); + + /** + * @brief Floating-point vector multiplication. + * @param[in] *pSrcA points to the first input vector + * @param[in] *pSrcB points to the second input vector + * @param[out] *pDst points to the output vector + * @param[in] blockSize number of samples in each vector + * @return none. + */ + + void arm_mult_f32( + float32_t * pSrcA, + float32_t * pSrcB, + float32_t * pDst, + uint32_t blockSize); + + + + + + + /** + * @brief Instance structure for the Q15 CFFT/CIFFT function. + */ + + typedef struct + { + uint16_t fftLen; /**< length of the FFT. */ + uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ + uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ + q15_t *pTwiddle; /**< points to the Sin twiddle factor table. */ + uint16_t *pBitRevTable; /**< points to the bit reversal table. */ + uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ + uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ + } arm_cfft_radix2_instance_q15; + +/* Deprecated */ + arm_status arm_cfft_radix2_init_q15( + arm_cfft_radix2_instance_q15 * S, + uint16_t fftLen, + uint8_t ifftFlag, + uint8_t bitReverseFlag); + +/* Deprecated */ + void arm_cfft_radix2_q15( + const arm_cfft_radix2_instance_q15 * S, + q15_t * pSrc); + + + + /** + * @brief Instance structure for the Q15 CFFT/CIFFT function. + */ + + typedef struct + { + uint16_t fftLen; /**< length of the FFT. */ + uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ + uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ + q15_t *pTwiddle; /**< points to the twiddle factor table. */ + uint16_t *pBitRevTable; /**< points to the bit reversal table. */ + uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ + uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ + } arm_cfft_radix4_instance_q15; + +/* Deprecated */ + arm_status arm_cfft_radix4_init_q15( + arm_cfft_radix4_instance_q15 * S, + uint16_t fftLen, + uint8_t ifftFlag, + uint8_t bitReverseFlag); + +/* Deprecated */ + void arm_cfft_radix4_q15( + const arm_cfft_radix4_instance_q15 * S, + q15_t * pSrc); + + /** + * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function. + */ + + typedef struct + { + uint16_t fftLen; /**< length of the FFT. */ + uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ + uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ + q31_t *pTwiddle; /**< points to the Twiddle factor table. */ + uint16_t *pBitRevTable; /**< points to the bit reversal table. */ + uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ + uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ + } arm_cfft_radix2_instance_q31; + +/* Deprecated */ + arm_status arm_cfft_radix2_init_q31( + arm_cfft_radix2_instance_q31 * S, + uint16_t fftLen, + uint8_t ifftFlag, + uint8_t bitReverseFlag); + +/* Deprecated */ + void arm_cfft_radix2_q31( + const arm_cfft_radix2_instance_q31 * S, + q31_t * pSrc); + + /** + * @brief Instance structure for the Q31 CFFT/CIFFT function. + */ + + typedef struct + { + uint16_t fftLen; /**< length of the FFT. */ + uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ + uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ + q31_t *pTwiddle; /**< points to the twiddle factor table. */ + uint16_t *pBitRevTable; /**< points to the bit reversal table. */ + uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ + uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ + } arm_cfft_radix4_instance_q31; + +/* Deprecated */ + void arm_cfft_radix4_q31( + const arm_cfft_radix4_instance_q31 * S, + q31_t * pSrc); + +/* Deprecated */ + arm_status arm_cfft_radix4_init_q31( + arm_cfft_radix4_instance_q31 * S, + uint16_t fftLen, + uint8_t ifftFlag, + uint8_t bitReverseFlag); + + /** + * @brief Instance structure for the floating-point CFFT/CIFFT function. + */ + + typedef struct + { + uint16_t fftLen; /**< length of the FFT. */ + uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ + uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ + float32_t *pTwiddle; /**< points to the Twiddle factor table. */ + uint16_t *pBitRevTable; /**< points to the bit reversal table. */ + uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ + uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ + float32_t onebyfftLen; /**< value of 1/fftLen. */ + } arm_cfft_radix2_instance_f32; + +/* Deprecated */ + arm_status arm_cfft_radix2_init_f32( + arm_cfft_radix2_instance_f32 * S, + uint16_t fftLen, + uint8_t ifftFlag, + uint8_t bitReverseFlag); + +/* Deprecated */ + void arm_cfft_radix2_f32( + const arm_cfft_radix2_instance_f32 * S, + float32_t * pSrc); + + /** + * @brief Instance structure for the floating-point CFFT/CIFFT function. + */ + + typedef struct + { + uint16_t fftLen; /**< length of the FFT. */ + uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ + uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ + float32_t *pTwiddle; /**< points to the Twiddle factor table. */ + uint16_t *pBitRevTable; /**< points to the bit reversal table. */ + uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ + uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ + float32_t onebyfftLen; /**< value of 1/fftLen. */ + } arm_cfft_radix4_instance_f32; + +/* Deprecated */ + arm_status arm_cfft_radix4_init_f32( + arm_cfft_radix4_instance_f32 * S, + uint16_t fftLen, + uint8_t ifftFlag, + uint8_t bitReverseFlag); + +/* Deprecated */ + void arm_cfft_radix4_f32( + const arm_cfft_radix4_instance_f32 * S, + float32_t * pSrc); + + /** + * @brief Instance structure for the fixed-point CFFT/CIFFT function. + */ + + typedef struct + { + uint16_t fftLen; /**< length of the FFT. */ + const q15_t *pTwiddle; /**< points to the Twiddle factor table. */ + const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ + uint16_t bitRevLength; /**< bit reversal table length. */ + } arm_cfft_instance_q15; + +void arm_cfft_q15( + const arm_cfft_instance_q15 * S, + q15_t * p1, + uint8_t ifftFlag, + uint8_t bitReverseFlag); + + /** + * @brief Instance structure for the fixed-point CFFT/CIFFT function. + */ + + typedef struct + { + uint16_t fftLen; /**< length of the FFT. */ + const q31_t *pTwiddle; /**< points to the Twiddle factor table. */ + const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ + uint16_t bitRevLength; /**< bit reversal table length. */ + } arm_cfft_instance_q31; + +void arm_cfft_q31( + const arm_cfft_instance_q31 * S, + q31_t * p1, + uint8_t ifftFlag, + uint8_t bitReverseFlag); + + /** + * @brief Instance structure for the floating-point CFFT/CIFFT function. + */ + + typedef struct + { + uint16_t fftLen; /**< length of the FFT. */ + const float32_t *pTwiddle; /**< points to the Twiddle factor table. */ + const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ + uint16_t bitRevLength; /**< bit reversal table length. */ + } arm_cfft_instance_f32; + + void arm_cfft_f32( + const arm_cfft_instance_f32 * S, + float32_t * p1, + uint8_t ifftFlag, + uint8_t bitReverseFlag); + + /** + * @brief Instance structure for the Q15 RFFT/RIFFT function. + */ + + typedef struct + { + uint32_t fftLenReal; /**< length of the real FFT. */ + uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ + uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ + uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ + q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ + q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ + const arm_cfft_instance_q15 *pCfft; /**< points to the complex FFT instance. */ + } arm_rfft_instance_q15; + + arm_status arm_rfft_init_q15( + arm_rfft_instance_q15 * S, + uint32_t fftLenReal, + uint32_t ifftFlagR, + uint32_t bitReverseFlag); + + void arm_rfft_q15( + const arm_rfft_instance_q15 * S, + q15_t * pSrc, + q15_t * pDst); + + /** + * @brief Instance structure for the Q31 RFFT/RIFFT function. + */ + + typedef struct + { + uint32_t fftLenReal; /**< length of the real FFT. */ + uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ + uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ + uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ + q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ + q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ + const arm_cfft_instance_q31 *pCfft; /**< points to the complex FFT instance. */ + } arm_rfft_instance_q31; + + arm_status arm_rfft_init_q31( + arm_rfft_instance_q31 * S, + uint32_t fftLenReal, + uint32_t ifftFlagR, + uint32_t bitReverseFlag); + + void arm_rfft_q31( + const arm_rfft_instance_q31 * S, + q31_t * pSrc, + q31_t * pDst); + + /** + * @brief Instance structure for the floating-point RFFT/RIFFT function. + */ + + typedef struct + { + uint32_t fftLenReal; /**< length of the real FFT. */ + uint16_t fftLenBy2; /**< length of the complex FFT. */ + uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ + uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ + uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ + float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ + float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ + arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */ + } arm_rfft_instance_f32; + + arm_status arm_rfft_init_f32( + arm_rfft_instance_f32 * S, + arm_cfft_radix4_instance_f32 * S_CFFT, + uint32_t fftLenReal, + uint32_t ifftFlagR, + uint32_t bitReverseFlag); + + void arm_rfft_f32( + const arm_rfft_instance_f32 * S, + float32_t * pSrc, + float32_t * pDst); + + /** + * @brief Instance structure for the floating-point RFFT/RIFFT function. + */ + +typedef struct + { + arm_cfft_instance_f32 Sint; /**< Internal CFFT structure. */ + uint16_t fftLenRFFT; /**< length of the real sequence */ + float32_t * pTwiddleRFFT; /**< Twiddle factors real stage */ + } arm_rfft_fast_instance_f32 ; + +arm_status arm_rfft_fast_init_f32 ( + arm_rfft_fast_instance_f32 * S, + uint16_t fftLen); + +void arm_rfft_fast_f32( + arm_rfft_fast_instance_f32 * S, + float32_t * p, float32_t * pOut, + uint8_t ifftFlag); + + /** + * @brief Instance structure for the floating-point DCT4/IDCT4 function. + */ + + typedef struct + { + uint16_t N; /**< length of the DCT4. */ + uint16_t Nby2; /**< half of the length of the DCT4. */ + float32_t normalize; /**< normalizing factor. */ + float32_t *pTwiddle; /**< points to the twiddle factor table. */ + float32_t *pCosFactor; /**< points to the cosFactor table. */ + arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */ + arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */ + } arm_dct4_instance_f32; + + /** + * @brief Initialization function for the floating-point DCT4/IDCT4. + * @param[in,out] *S points to an instance of floating-point DCT4/IDCT4 structure. + * @param[in] *S_RFFT points to an instance of floating-point RFFT/RIFFT structure. + * @param[in] *S_CFFT points to an instance of floating-point CFFT/CIFFT structure. + * @param[in] N length of the DCT4. + * @param[in] Nby2 half of the length of the DCT4. + * @param[in] normalize normalizing factor. + * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if fftLenReal is not a supported transform length. + */ + + arm_status arm_dct4_init_f32( + arm_dct4_instance_f32 * S, + arm_rfft_instance_f32 * S_RFFT, + arm_cfft_radix4_instance_f32 * S_CFFT, + uint16_t N, + uint16_t Nby2, + float32_t normalize); + + /** + * @brief Processing function for the floating-point DCT4/IDCT4. + * @param[in] *S points to an instance of the floating-point DCT4/IDCT4 structure. + * @param[in] *pState points to state buffer. + * @param[in,out] *pInlineBuffer points to the in-place input and output buffer. + * @return none. + */ + + void arm_dct4_f32( + const arm_dct4_instance_f32 * S, + float32_t * pState, + float32_t * pInlineBuffer); + + /** + * @brief Instance structure for the Q31 DCT4/IDCT4 function. + */ + + typedef struct + { + uint16_t N; /**< length of the DCT4. */ + uint16_t Nby2; /**< half of the length of the DCT4. */ + q31_t normalize; /**< normalizing factor. */ + q31_t *pTwiddle; /**< points to the twiddle factor table. */ + q31_t *pCosFactor; /**< points to the cosFactor table. */ + arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */ + arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */ + } arm_dct4_instance_q31; + + /** + * @brief Initialization function for the Q31 DCT4/IDCT4. + * @param[in,out] *S points to an instance of Q31 DCT4/IDCT4 structure. + * @param[in] *S_RFFT points to an instance of Q31 RFFT/RIFFT structure + * @param[in] *S_CFFT points to an instance of Q31 CFFT/CIFFT structure + * @param[in] N length of the DCT4. + * @param[in] Nby2 half of the length of the DCT4. + * @param[in] normalize normalizing factor. + * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if N is not a supported transform length. + */ + + arm_status arm_dct4_init_q31( + arm_dct4_instance_q31 * S, + arm_rfft_instance_q31 * S_RFFT, + arm_cfft_radix4_instance_q31 * S_CFFT, + uint16_t N, + uint16_t Nby2, + q31_t normalize); + + /** + * @brief Processing function for the Q31 DCT4/IDCT4. + * @param[in] *S points to an instance of the Q31 DCT4 structure. + * @param[in] *pState points to state buffer. + * @param[in,out] *pInlineBuffer points to the in-place input and output buffer. + * @return none. + */ + + void arm_dct4_q31( + const arm_dct4_instance_q31 * S, + q31_t * pState, + q31_t * pInlineBuffer); + + /** + * @brief Instance structure for the Q15 DCT4/IDCT4 function. + */ + + typedef struct + { + uint16_t N; /**< length of the DCT4. */ + uint16_t Nby2; /**< half of the length of the DCT4. */ + q15_t normalize; /**< normalizing factor. */ + q15_t *pTwiddle; /**< points to the twiddle factor table. */ + q15_t *pCosFactor; /**< points to the cosFactor table. */ + arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */ + arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */ + } arm_dct4_instance_q15; + + /** + * @brief Initialization function for the Q15 DCT4/IDCT4. + * @param[in,out] *S points to an instance of Q15 DCT4/IDCT4 structure. + * @param[in] *S_RFFT points to an instance of Q15 RFFT/RIFFT structure. + * @param[in] *S_CFFT points to an instance of Q15 CFFT/CIFFT structure. + * @param[in] N length of the DCT4. + * @param[in] Nby2 half of the length of the DCT4. + * @param[in] normalize normalizing factor. + * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if N is not a supported transform length. + */ + + arm_status arm_dct4_init_q15( + arm_dct4_instance_q15 * S, + arm_rfft_instance_q15 * S_RFFT, + arm_cfft_radix4_instance_q15 * S_CFFT, + uint16_t N, + uint16_t Nby2, + q15_t normalize); + + /** + * @brief Processing function for the Q15 DCT4/IDCT4. + * @param[in] *S points to an instance of the Q15 DCT4 structure. + * @param[in] *pState points to state buffer. + * @param[in,out] *pInlineBuffer points to the in-place input and output buffer. + * @return none. + */ + + void arm_dct4_q15( + const arm_dct4_instance_q15 * S, + q15_t * pState, + q15_t * pInlineBuffer); + + /** + * @brief Floating-point vector addition. + * @param[in] *pSrcA points to the first input vector + * @param[in] *pSrcB points to the second input vector + * @param[out] *pDst points to the output vector + * @param[in] blockSize number of samples in each vector + * @return none. + */ + + void arm_add_f32( + float32_t * pSrcA, + float32_t * pSrcB, + float32_t * pDst, + uint32_t blockSize); + + /** + * @brief Q7 vector addition. + * @param[in] *pSrcA points to the first input vector + * @param[in] *pSrcB points to the second input vector + * @param[out] *pDst points to the output vector + * @param[in] blockSize number of samples in each vector + * @return none. + */ + + void arm_add_q7( + q7_t * pSrcA, + q7_t * pSrcB, + q7_t * pDst, + uint32_t blockSize); + + /** + * @brief Q15 vector addition. + * @param[in] *pSrcA points to the first input vector + * @param[in] *pSrcB points to the second input vector + * @param[out] *pDst points to the output vector + * @param[in] blockSize number of samples in each vector + * @return none. + */ + + void arm_add_q15( + q15_t * pSrcA, + q15_t * pSrcB, + q15_t * pDst, + uint32_t blockSize); + + /** + * @brief Q31 vector addition. + * @param[in] *pSrcA points to the first input vector + * @param[in] *pSrcB points to the second input vector + * @param[out] *pDst points to the output vector + * @param[in] blockSize number of samples in each vector + * @return none. + */ + + void arm_add_q31( + q31_t * pSrcA, + q31_t * pSrcB, + q31_t * pDst, + uint32_t blockSize); + + /** + * @brief Floating-point vector subtraction. + * @param[in] *pSrcA points to the first input vector + * @param[in] *pSrcB points to the second input vector + * @param[out] *pDst points to the output vector + * @param[in] blockSize number of samples in each vector + * @return none. + */ + + void arm_sub_f32( + float32_t * pSrcA, + float32_t * pSrcB, + float32_t * pDst, + uint32_t blockSize); + + /** + * @brief Q7 vector subtraction. + * @param[in] *pSrcA points to the first input vector + * @param[in] *pSrcB points to the second input vector + * @param[out] *pDst points to the output vector + * @param[in] blockSize number of samples in each vector + * @return none. + */ + + void arm_sub_q7( + q7_t * pSrcA, + q7_t * pSrcB, + q7_t * pDst, + uint32_t blockSize); + + /** + * @brief Q15 vector subtraction. + * @param[in] *pSrcA points to the first input vector + * @param[in] *pSrcB points to the second input vector + * @param[out] *pDst points to the output vector + * @param[in] blockSize number of samples in each vector + * @return none. + */ + + void arm_sub_q15( + q15_t * pSrcA, + q15_t * pSrcB, + q15_t * pDst, + uint32_t blockSize); + + /** + * @brief Q31 vector subtraction. + * @param[in] *pSrcA points to the first input vector + * @param[in] *pSrcB points to the second input vector + * @param[out] *pDst points to the output vector + * @param[in] blockSize number of samples in each vector + * @return none. + */ + + void arm_sub_q31( + q31_t * pSrcA, + q31_t * pSrcB, + q31_t * pDst, + uint32_t blockSize); + + /** + * @brief Multiplies a floating-point vector by a scalar. + * @param[in] *pSrc points to the input vector + * @param[in] scale scale factor to be applied + * @param[out] *pDst points to the output vector + * @param[in] blockSize number of samples in the vector + * @return none. + */ + + void arm_scale_f32( + float32_t * pSrc, + float32_t scale, + float32_t * pDst, + uint32_t blockSize); + + /** + * @brief Multiplies a Q7 vector by a scalar. + * @param[in] *pSrc points to the input vector + * @param[in] scaleFract fractional portion of the scale value + * @param[in] shift number of bits to shift the result by + * @param[out] *pDst points to the output vector + * @param[in] blockSize number of samples in the vector + * @return none. + */ + + void arm_scale_q7( + q7_t * pSrc, + q7_t scaleFract, + int8_t shift, + q7_t * pDst, + uint32_t blockSize); + + /** + * @brief Multiplies a Q15 vector by a scalar. + * @param[in] *pSrc points to the input vector + * @param[in] scaleFract fractional portion of the scale value + * @param[in] shift number of bits to shift the result by + * @param[out] *pDst points to the output vector + * @param[in] blockSize number of samples in the vector + * @return none. + */ + + void arm_scale_q15( + q15_t * pSrc, + q15_t scaleFract, + int8_t shift, + q15_t * pDst, + uint32_t blockSize); + + /** + * @brief Multiplies a Q31 vector by a scalar. + * @param[in] *pSrc points to the input vector + * @param[in] scaleFract fractional portion of the scale value + * @param[in] shift number of bits to shift the result by + * @param[out] *pDst points to the output vector + * @param[in] blockSize number of samples in the vector + * @return none. + */ + + void arm_scale_q31( + q31_t * pSrc, + q31_t scaleFract, + int8_t shift, + q31_t * pDst, + uint32_t blockSize); + + /** + * @brief Q7 vector absolute value. + * @param[in] *pSrc points to the input buffer + * @param[out] *pDst points to the output buffer + * @param[in] blockSize number of samples in each vector + * @return none. + */ + + void arm_abs_q7( + q7_t * pSrc, + q7_t * pDst, + uint32_t blockSize); + + /** + * @brief Floating-point vector absolute value. + * @param[in] *pSrc points to the input buffer + * @param[out] *pDst points to the output buffer + * @param[in] blockSize number of samples in each vector + * @return none. + */ + + void arm_abs_f32( + float32_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + /** + * @brief Q15 vector absolute value. + * @param[in] *pSrc points to the input buffer + * @param[out] *pDst points to the output buffer + * @param[in] blockSize number of samples in each vector + * @return none. + */ + + void arm_abs_q15( + q15_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + /** + * @brief Q31 vector absolute value. + * @param[in] *pSrc points to the input buffer + * @param[out] *pDst points to the output buffer + * @param[in] blockSize number of samples in each vector + * @return none. + */ + + void arm_abs_q31( + q31_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + /** + * @brief Dot product of floating-point vectors. + * @param[in] *pSrcA points to the first input vector + * @param[in] *pSrcB points to the second input vector + * @param[in] blockSize number of samples in each vector + * @param[out] *result output result returned here + * @return none. + */ + + void arm_dot_prod_f32( + float32_t * pSrcA, + float32_t * pSrcB, + uint32_t blockSize, + float32_t * result); + + /** + * @brief Dot product of Q7 vectors. + * @param[in] *pSrcA points to the first input vector + * @param[in] *pSrcB points to the second input vector + * @param[in] blockSize number of samples in each vector + * @param[out] *result output result returned here + * @return none. + */ + + void arm_dot_prod_q7( + q7_t * pSrcA, + q7_t * pSrcB, + uint32_t blockSize, + q31_t * result); + + /** + * @brief Dot product of Q15 vectors. + * @param[in] *pSrcA points to the first input vector + * @param[in] *pSrcB points to the second input vector + * @param[in] blockSize number of samples in each vector + * @param[out] *result output result returned here + * @return none. + */ + + void arm_dot_prod_q15( + q15_t * pSrcA, + q15_t * pSrcB, + uint32_t blockSize, + q63_t * result); + + /** + * @brief Dot product of Q31 vectors. + * @param[in] *pSrcA points to the first input vector + * @param[in] *pSrcB points to the second input vector + * @param[in] blockSize number of samples in each vector + * @param[out] *result output result returned here + * @return none. + */ + + void arm_dot_prod_q31( + q31_t * pSrcA, + q31_t * pSrcB, + uint32_t blockSize, + q63_t * result); + + /** + * @brief Shifts the elements of a Q7 vector a specified number of bits. + * @param[in] *pSrc points to the input vector + * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. + * @param[out] *pDst points to the output vector + * @param[in] blockSize number of samples in the vector + * @return none. + */ + + void arm_shift_q7( + q7_t * pSrc, + int8_t shiftBits, + q7_t * pDst, + uint32_t blockSize); + + /** + * @brief Shifts the elements of a Q15 vector a specified number of bits. + * @param[in] *pSrc points to the input vector + * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. + * @param[out] *pDst points to the output vector + * @param[in] blockSize number of samples in the vector + * @return none. + */ + + void arm_shift_q15( + q15_t * pSrc, + int8_t shiftBits, + q15_t * pDst, + uint32_t blockSize); + + /** + * @brief Shifts the elements of a Q31 vector a specified number of bits. + * @param[in] *pSrc points to the input vector + * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. + * @param[out] *pDst points to the output vector + * @param[in] blockSize number of samples in the vector + * @return none. + */ + + void arm_shift_q31( + q31_t * pSrc, + int8_t shiftBits, + q31_t * pDst, + uint32_t blockSize); + + /** + * @brief Adds a constant offset to a floating-point vector. + * @param[in] *pSrc points to the input vector + * @param[in] offset is the offset to be added + * @param[out] *pDst points to the output vector + * @param[in] blockSize number of samples in the vector + * @return none. + */ + + void arm_offset_f32( + float32_t * pSrc, + float32_t offset, + float32_t * pDst, + uint32_t blockSize); + + /** + * @brief Adds a constant offset to a Q7 vector. + * @param[in] *pSrc points to the input vector + * @param[in] offset is the offset to be added + * @param[out] *pDst points to the output vector + * @param[in] blockSize number of samples in the vector + * @return none. + */ + + void arm_offset_q7( + q7_t * pSrc, + q7_t offset, + q7_t * pDst, + uint32_t blockSize); + + /** + * @brief Adds a constant offset to a Q15 vector. + * @param[in] *pSrc points to the input vector + * @param[in] offset is the offset to be added + * @param[out] *pDst points to the output vector + * @param[in] blockSize number of samples in the vector + * @return none. + */ + + void arm_offset_q15( + q15_t * pSrc, + q15_t offset, + q15_t * pDst, + uint32_t blockSize); + + /** + * @brief Adds a constant offset to a Q31 vector. + * @param[in] *pSrc points to the input vector + * @param[in] offset is the offset to be added + * @param[out] *pDst points to the output vector + * @param[in] blockSize number of samples in the vector + * @return none. + */ + + void arm_offset_q31( + q31_t * pSrc, + q31_t offset, + q31_t * pDst, + uint32_t blockSize); + + /** + * @brief Negates the elements of a floating-point vector. + * @param[in] *pSrc points to the input vector + * @param[out] *pDst points to the output vector + * @param[in] blockSize number of samples in the vector + * @return none. + */ + + void arm_negate_f32( + float32_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + /** + * @brief Negates the elements of a Q7 vector. + * @param[in] *pSrc points to the input vector + * @param[out] *pDst points to the output vector + * @param[in] blockSize number of samples in the vector + * @return none. + */ + + void arm_negate_q7( + q7_t * pSrc, + q7_t * pDst, + uint32_t blockSize); + + /** + * @brief Negates the elements of a Q15 vector. + * @param[in] *pSrc points to the input vector + * @param[out] *pDst points to the output vector + * @param[in] blockSize number of samples in the vector + * @return none. + */ + + void arm_negate_q15( + q15_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + /** + * @brief Negates the elements of a Q31 vector. + * @param[in] *pSrc points to the input vector + * @param[out] *pDst points to the output vector + * @param[in] blockSize number of samples in the vector + * @return none. + */ + + void arm_negate_q31( + q31_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + /** + * @brief Copies the elements of a floating-point vector. + * @param[in] *pSrc input pointer + * @param[out] *pDst output pointer + * @param[in] blockSize number of samples to process + * @return none. + */ + void arm_copy_f32( + float32_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + /** + * @brief Copies the elements of a Q7 vector. + * @param[in] *pSrc input pointer + * @param[out] *pDst output pointer + * @param[in] blockSize number of samples to process + * @return none. + */ + void arm_copy_q7( + q7_t * pSrc, + q7_t * pDst, + uint32_t blockSize); + + /** + * @brief Copies the elements of a Q15 vector. + * @param[in] *pSrc input pointer + * @param[out] *pDst output pointer + * @param[in] blockSize number of samples to process + * @return none. + */ + void arm_copy_q15( + q15_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + /** + * @brief Copies the elements of a Q31 vector. + * @param[in] *pSrc input pointer + * @param[out] *pDst output pointer + * @param[in] blockSize number of samples to process + * @return none. + */ + void arm_copy_q31( + q31_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + /** + * @brief Fills a constant value into a floating-point vector. + * @param[in] value input value to be filled + * @param[out] *pDst output pointer + * @param[in] blockSize number of samples to process + * @return none. + */ + void arm_fill_f32( + float32_t value, + float32_t * pDst, + uint32_t blockSize); + + /** + * @brief Fills a constant value into a Q7 vector. + * @param[in] value input value to be filled + * @param[out] *pDst output pointer + * @param[in] blockSize number of samples to process + * @return none. + */ + void arm_fill_q7( + q7_t value, + q7_t * pDst, + uint32_t blockSize); + + /** + * @brief Fills a constant value into a Q15 vector. + * @param[in] value input value to be filled + * @param[out] *pDst output pointer + * @param[in] blockSize number of samples to process + * @return none. + */ + void arm_fill_q15( + q15_t value, + q15_t * pDst, + uint32_t blockSize); + + /** + * @brief Fills a constant value into a Q31 vector. + * @param[in] value input value to be filled + * @param[out] *pDst output pointer + * @param[in] blockSize number of samples to process + * @return none. + */ + void arm_fill_q31( + q31_t value, + q31_t * pDst, + uint32_t blockSize); + +/** + * @brief Convolution of floating-point sequences. + * @param[in] *pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] *pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1. + * @return none. + */ + + void arm_conv_f32( + float32_t * pSrcA, + uint32_t srcALen, + float32_t * pSrcB, + uint32_t srcBLen, + float32_t * pDst); + + + /** + * @brief Convolution of Q15 sequences. + * @param[in] *pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] *pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. + * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. + * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen). + * @return none. + */ + + + void arm_conv_opt_q15( + q15_t * pSrcA, + uint32_t srcALen, + q15_t * pSrcB, + uint32_t srcBLen, + q15_t * pDst, + q15_t * pScratch1, + q15_t * pScratch2); + + +/** + * @brief Convolution of Q15 sequences. + * @param[in] *pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] *pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1. + * @return none. + */ + + void arm_conv_q15( + q15_t * pSrcA, + uint32_t srcALen, + q15_t * pSrcB, + uint32_t srcBLen, + q15_t * pDst); + + /** + * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 + * @param[in] *pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] *pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. + * @return none. + */ + + void arm_conv_fast_q15( + q15_t * pSrcA, + uint32_t srcALen, + q15_t * pSrcB, + uint32_t srcBLen, + q15_t * pDst); + + /** + * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 + * @param[in] *pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] *pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. + * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. + * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen). + * @return none. + */ + + void arm_conv_fast_opt_q15( + q15_t * pSrcA, + uint32_t srcALen, + q15_t * pSrcB, + uint32_t srcBLen, + q15_t * pDst, + q15_t * pScratch1, + q15_t * pScratch2); + + + + /** + * @brief Convolution of Q31 sequences. + * @param[in] *pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] *pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. + * @return none. + */ + + void arm_conv_q31( + q31_t * pSrcA, + uint32_t srcALen, + q31_t * pSrcB, + uint32_t srcBLen, + q31_t * pDst); + + /** + * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 + * @param[in] *pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] *pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. + * @return none. + */ + + void arm_conv_fast_q31( + q31_t * pSrcA, + uint32_t srcALen, + q31_t * pSrcB, + uint32_t srcBLen, + q31_t * pDst); + + + /** + * @brief Convolution of Q7 sequences. + * @param[in] *pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] *pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. + * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. + * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). + * @return none. + */ + + void arm_conv_opt_q7( + q7_t * pSrcA, + uint32_t srcALen, + q7_t * pSrcB, + uint32_t srcBLen, + q7_t * pDst, + q15_t * pScratch1, + q15_t * pScratch2); + + + + /** + * @brief Convolution of Q7 sequences. + * @param[in] *pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] *pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. + * @return none. + */ + + void arm_conv_q7( + q7_t * pSrcA, + uint32_t srcALen, + q7_t * pSrcB, + uint32_t srcBLen, + q7_t * pDst); + + + /** + * @brief Partial convolution of floating-point sequences. + * @param[in] *pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] *pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] *pDst points to the block of output data + * @param[in] firstIndex is the first output sample to start with. + * @param[in] numPoints is the number of output points to be computed. + * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. + */ + + arm_status arm_conv_partial_f32( + float32_t * pSrcA, + uint32_t srcALen, + float32_t * pSrcB, + uint32_t srcBLen, + float32_t * pDst, + uint32_t firstIndex, + uint32_t numPoints); + + /** + * @brief Partial convolution of Q15 sequences. + * @param[in] *pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] *pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] *pDst points to the block of output data + * @param[in] firstIndex is the first output sample to start with. + * @param[in] numPoints is the number of output points to be computed. + * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. + * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen). + * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. + */ + + arm_status arm_conv_partial_opt_q15( + q15_t * pSrcA, + uint32_t srcALen, + q15_t * pSrcB, + uint32_t srcBLen, + q15_t * pDst, + uint32_t firstIndex, + uint32_t numPoints, + q15_t * pScratch1, + q15_t * pScratch2); + + +/** + * @brief Partial convolution of Q15 sequences. + * @param[in] *pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] *pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] *pDst points to the block of output data + * @param[in] firstIndex is the first output sample to start with. + * @param[in] numPoints is the number of output points to be computed. + * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. + */ + + arm_status arm_conv_partial_q15( + q15_t * pSrcA, + uint32_t srcALen, + q15_t * pSrcB, + uint32_t srcBLen, + q15_t * pDst, + uint32_t firstIndex, + uint32_t numPoints); + + /** + * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 + * @param[in] *pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] *pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] *pDst points to the block of output data + * @param[in] firstIndex is the first output sample to start with. + * @param[in] numPoints is the number of output points to be computed. + * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. + */ + + arm_status arm_conv_partial_fast_q15( + q15_t * pSrcA, + uint32_t srcALen, + q15_t * pSrcB, + uint32_t srcBLen, + q15_t * pDst, + uint32_t firstIndex, + uint32_t numPoints); + + + /** + * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 + * @param[in] *pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] *pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] *pDst points to the block of output data + * @param[in] firstIndex is the first output sample to start with. + * @param[in] numPoints is the number of output points to be computed. + * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. + * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen). + * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. + */ + + arm_status arm_conv_partial_fast_opt_q15( + q15_t * pSrcA, + uint32_t srcALen, + q15_t * pSrcB, + uint32_t srcBLen, + q15_t * pDst, + uint32_t firstIndex, + uint32_t numPoints, + q15_t * pScratch1, + q15_t * pScratch2); + + + /** + * @brief Partial convolution of Q31 sequences. + * @param[in] *pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] *pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] *pDst points to the block of output data + * @param[in] firstIndex is the first output sample to start with. + * @param[in] numPoints is the number of output points to be computed. + * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. + */ + + arm_status arm_conv_partial_q31( + q31_t * pSrcA, + uint32_t srcALen, + q31_t * pSrcB, + uint32_t srcBLen, + q31_t * pDst, + uint32_t firstIndex, + uint32_t numPoints); + + + /** + * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 + * @param[in] *pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] *pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] *pDst points to the block of output data + * @param[in] firstIndex is the first output sample to start with. + * @param[in] numPoints is the number of output points to be computed. + * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. + */ + + arm_status arm_conv_partial_fast_q31( + q31_t * pSrcA, + uint32_t srcALen, + q31_t * pSrcB, + uint32_t srcBLen, + q31_t * pDst, + uint32_t firstIndex, + uint32_t numPoints); + + + /** + * @brief Partial convolution of Q7 sequences + * @param[in] *pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] *pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] *pDst points to the block of output data + * @param[in] firstIndex is the first output sample to start with. + * @param[in] numPoints is the number of output points to be computed. + * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. + * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). + * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. + */ + + arm_status arm_conv_partial_opt_q7( + q7_t * pSrcA, + uint32_t srcALen, + q7_t * pSrcB, + uint32_t srcBLen, + q7_t * pDst, + uint32_t firstIndex, + uint32_t numPoints, + q15_t * pScratch1, + q15_t * pScratch2); + + +/** + * @brief Partial convolution of Q7 sequences. + * @param[in] *pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] *pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] *pDst points to the block of output data + * @param[in] firstIndex is the first output sample to start with. + * @param[in] numPoints is the number of output points to be computed. + * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. + */ + + arm_status arm_conv_partial_q7( + q7_t * pSrcA, + uint32_t srcALen, + q7_t * pSrcB, + uint32_t srcBLen, + q7_t * pDst, + uint32_t firstIndex, + uint32_t numPoints); + + + + /** + * @brief Instance structure for the Q15 FIR decimator. + */ + + typedef struct + { + uint8_t M; /**< decimation factor. */ + uint16_t numTaps; /**< number of coefficients in the filter. */ + q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ + q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ + } arm_fir_decimate_instance_q15; + + /** + * @brief Instance structure for the Q31 FIR decimator. + */ + + typedef struct + { + uint8_t M; /**< decimation factor. */ + uint16_t numTaps; /**< number of coefficients in the filter. */ + q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ + q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ + + } arm_fir_decimate_instance_q31; + + /** + * @brief Instance structure for the floating-point FIR decimator. + */ + + typedef struct + { + uint8_t M; /**< decimation factor. */ + uint16_t numTaps; /**< number of coefficients in the filter. */ + float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ + float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ + + } arm_fir_decimate_instance_f32; + + + + /** + * @brief Processing function for the floating-point FIR decimator. + * @param[in] *S points to an instance of the floating-point FIR decimator structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data + * @param[in] blockSize number of input samples to process per call. + * @return none + */ + + void arm_fir_decimate_f32( + const arm_fir_decimate_instance_f32 * S, + float32_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + + /** + * @brief Initialization function for the floating-point FIR decimator. + * @param[in,out] *S points to an instance of the floating-point FIR decimator structure. + * @param[in] numTaps number of coefficients in the filter. + * @param[in] M decimation factor. + * @param[in] *pCoeffs points to the filter coefficients. + * @param[in] *pState points to the state buffer. + * @param[in] blockSize number of input samples to process per call. + * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if + * blockSize is not a multiple of M. + */ + + arm_status arm_fir_decimate_init_f32( + arm_fir_decimate_instance_f32 * S, + uint16_t numTaps, + uint8_t M, + float32_t * pCoeffs, + float32_t * pState, + uint32_t blockSize); + + /** + * @brief Processing function for the Q15 FIR decimator. + * @param[in] *S points to an instance of the Q15 FIR decimator structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data + * @param[in] blockSize number of input samples to process per call. + * @return none + */ + + void arm_fir_decimate_q15( + const arm_fir_decimate_instance_q15 * S, + q15_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + /** + * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4. + * @param[in] *S points to an instance of the Q15 FIR decimator structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data + * @param[in] blockSize number of input samples to process per call. + * @return none + */ + + void arm_fir_decimate_fast_q15( + const arm_fir_decimate_instance_q15 * S, + q15_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + + + /** + * @brief Initialization function for the Q15 FIR decimator. + * @param[in,out] *S points to an instance of the Q15 FIR decimator structure. + * @param[in] numTaps number of coefficients in the filter. + * @param[in] M decimation factor. + * @param[in] *pCoeffs points to the filter coefficients. + * @param[in] *pState points to the state buffer. + * @param[in] blockSize number of input samples to process per call. + * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if + * blockSize is not a multiple of M. + */ + + arm_status arm_fir_decimate_init_q15( + arm_fir_decimate_instance_q15 * S, + uint16_t numTaps, + uint8_t M, + q15_t * pCoeffs, + q15_t * pState, + uint32_t blockSize); + + /** + * @brief Processing function for the Q31 FIR decimator. + * @param[in] *S points to an instance of the Q31 FIR decimator structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data + * @param[in] blockSize number of input samples to process per call. + * @return none + */ + + void arm_fir_decimate_q31( + const arm_fir_decimate_instance_q31 * S, + q31_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + /** + * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4. + * @param[in] *S points to an instance of the Q31 FIR decimator structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data + * @param[in] blockSize number of input samples to process per call. + * @return none + */ + + void arm_fir_decimate_fast_q31( + arm_fir_decimate_instance_q31 * S, + q31_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + + /** + * @brief Initialization function for the Q31 FIR decimator. + * @param[in,out] *S points to an instance of the Q31 FIR decimator structure. + * @param[in] numTaps number of coefficients in the filter. + * @param[in] M decimation factor. + * @param[in] *pCoeffs points to the filter coefficients. + * @param[in] *pState points to the state buffer. + * @param[in] blockSize number of input samples to process per call. + * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if + * blockSize is not a multiple of M. + */ + + arm_status arm_fir_decimate_init_q31( + arm_fir_decimate_instance_q31 * S, + uint16_t numTaps, + uint8_t M, + q31_t * pCoeffs, + q31_t * pState, + uint32_t blockSize); + + + + /** + * @brief Instance structure for the Q15 FIR interpolator. + */ + + typedef struct + { + uint8_t L; /**< upsample factor. */ + uint16_t phaseLength; /**< length of each polyphase filter component. */ + q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ + q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */ + } arm_fir_interpolate_instance_q15; + + /** + * @brief Instance structure for the Q31 FIR interpolator. + */ + + typedef struct + { + uint8_t L; /**< upsample factor. */ + uint16_t phaseLength; /**< length of each polyphase filter component. */ + q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ + q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */ + } arm_fir_interpolate_instance_q31; + + /** + * @brief Instance structure for the floating-point FIR interpolator. + */ + + typedef struct + { + uint8_t L; /**< upsample factor. */ + uint16_t phaseLength; /**< length of each polyphase filter component. */ + float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ + float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */ + } arm_fir_interpolate_instance_f32; + + + /** + * @brief Processing function for the Q15 FIR interpolator. + * @param[in] *S points to an instance of the Q15 FIR interpolator structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data. + * @param[in] blockSize number of input samples to process per call. + * @return none. + */ + + void arm_fir_interpolate_q15( + const arm_fir_interpolate_instance_q15 * S, + q15_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + + /** + * @brief Initialization function for the Q15 FIR interpolator. + * @param[in,out] *S points to an instance of the Q15 FIR interpolator structure. + * @param[in] L upsample factor. + * @param[in] numTaps number of filter coefficients in the filter. + * @param[in] *pCoeffs points to the filter coefficient buffer. + * @param[in] *pState points to the state buffer. + * @param[in] blockSize number of input samples to process per call. + * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if + * the filter length numTaps is not a multiple of the interpolation factor L. + */ + + arm_status arm_fir_interpolate_init_q15( + arm_fir_interpolate_instance_q15 * S, + uint8_t L, + uint16_t numTaps, + q15_t * pCoeffs, + q15_t * pState, + uint32_t blockSize); + + /** + * @brief Processing function for the Q31 FIR interpolator. + * @param[in] *S points to an instance of the Q15 FIR interpolator structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data. + * @param[in] blockSize number of input samples to process per call. + * @return none. + */ + + void arm_fir_interpolate_q31( + const arm_fir_interpolate_instance_q31 * S, + q31_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + /** + * @brief Initialization function for the Q31 FIR interpolator. + * @param[in,out] *S points to an instance of the Q31 FIR interpolator structure. + * @param[in] L upsample factor. + * @param[in] numTaps number of filter coefficients in the filter. + * @param[in] *pCoeffs points to the filter coefficient buffer. + * @param[in] *pState points to the state buffer. + * @param[in] blockSize number of input samples to process per call. + * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if + * the filter length numTaps is not a multiple of the interpolation factor L. + */ + + arm_status arm_fir_interpolate_init_q31( + arm_fir_interpolate_instance_q31 * S, + uint8_t L, + uint16_t numTaps, + q31_t * pCoeffs, + q31_t * pState, + uint32_t blockSize); + + + /** + * @brief Processing function for the floating-point FIR interpolator. + * @param[in] *S points to an instance of the floating-point FIR interpolator structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data. + * @param[in] blockSize number of input samples to process per call. + * @return none. + */ + + void arm_fir_interpolate_f32( + const arm_fir_interpolate_instance_f32 * S, + float32_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + /** + * @brief Initialization function for the floating-point FIR interpolator. + * @param[in,out] *S points to an instance of the floating-point FIR interpolator structure. + * @param[in] L upsample factor. + * @param[in] numTaps number of filter coefficients in the filter. + * @param[in] *pCoeffs points to the filter coefficient buffer. + * @param[in] *pState points to the state buffer. + * @param[in] blockSize number of input samples to process per call. + * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if + * the filter length numTaps is not a multiple of the interpolation factor L. + */ + + arm_status arm_fir_interpolate_init_f32( + arm_fir_interpolate_instance_f32 * S, + uint8_t L, + uint16_t numTaps, + float32_t * pCoeffs, + float32_t * pState, + uint32_t blockSize); + + /** + * @brief Instance structure for the high precision Q31 Biquad cascade filter. + */ + + typedef struct + { + uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ + q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */ + q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ + uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */ + + } arm_biquad_cas_df1_32x64_ins_q31; + + + /** + * @param[in] *S points to an instance of the high precision Q31 Biquad cascade filter structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data + * @param[in] blockSize number of samples to process. + * @return none. + */ + + void arm_biquad_cas_df1_32x64_q31( + const arm_biquad_cas_df1_32x64_ins_q31 * S, + q31_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + + /** + * @param[in,out] *S points to an instance of the high precision Q31 Biquad cascade filter structure. + * @param[in] numStages number of 2nd order stages in the filter. + * @param[in] *pCoeffs points to the filter coefficients. + * @param[in] *pState points to the state buffer. + * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format + * @return none + */ + + void arm_biquad_cas_df1_32x64_init_q31( + arm_biquad_cas_df1_32x64_ins_q31 * S, + uint8_t numStages, + q31_t * pCoeffs, + q63_t * pState, + uint8_t postShift); + + + + /** + * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. + */ + + typedef struct + { + uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ + float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */ + float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ + } arm_biquad_cascade_df2T_instance_f32; + + + + /** + * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. + */ + + typedef struct + { + uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ + float32_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */ + float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ + } arm_biquad_cascade_stereo_df2T_instance_f32; + + + + /** + * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. + */ + + typedef struct + { + uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ + float64_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */ + float64_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ + } arm_biquad_cascade_df2T_instance_f64; + + + /** + * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. + * @param[in] *S points to an instance of the filter data structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data + * @param[in] blockSize number of samples to process. + * @return none. + */ + + void arm_biquad_cascade_df2T_f32( + const arm_biquad_cascade_df2T_instance_f32 * S, + float32_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + + /** + * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 2 channels + * @param[in] *S points to an instance of the filter data structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data + * @param[in] blockSize number of samples to process. + * @return none. + */ + + void arm_biquad_cascade_stereo_df2T_f32( + const arm_biquad_cascade_stereo_df2T_instance_f32 * S, + float32_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + /** + * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. + * @param[in] *S points to an instance of the filter data structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data + * @param[in] blockSize number of samples to process. + * @return none. + */ + + void arm_biquad_cascade_df2T_f64( + const arm_biquad_cascade_df2T_instance_f64 * S, + float64_t * pSrc, + float64_t * pDst, + uint32_t blockSize); + + + /** + * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. + * @param[in,out] *S points to an instance of the filter data structure. + * @param[in] numStages number of 2nd order stages in the filter. + * @param[in] *pCoeffs points to the filter coefficients. + * @param[in] *pState points to the state buffer. + * @return none + */ + + void arm_biquad_cascade_df2T_init_f32( + arm_biquad_cascade_df2T_instance_f32 * S, + uint8_t numStages, + float32_t * pCoeffs, + float32_t * pState); + + + /** + * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. + * @param[in,out] *S points to an instance of the filter data structure. + * @param[in] numStages number of 2nd order stages in the filter. + * @param[in] *pCoeffs points to the filter coefficients. + * @param[in] *pState points to the state buffer. + * @return none + */ + + void arm_biquad_cascade_stereo_df2T_init_f32( + arm_biquad_cascade_stereo_df2T_instance_f32 * S, + uint8_t numStages, + float32_t * pCoeffs, + float32_t * pState); + + + /** + * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. + * @param[in,out] *S points to an instance of the filter data structure. + * @param[in] numStages number of 2nd order stages in the filter. + * @param[in] *pCoeffs points to the filter coefficients. + * @param[in] *pState points to the state buffer. + * @return none + */ + + void arm_biquad_cascade_df2T_init_f64( + arm_biquad_cascade_df2T_instance_f64 * S, + uint8_t numStages, + float64_t * pCoeffs, + float64_t * pState); + + + + /** + * @brief Instance structure for the Q15 FIR lattice filter. + */ + + typedef struct + { + uint16_t numStages; /**< number of filter stages. */ + q15_t *pState; /**< points to the state variable array. The array is of length numStages. */ + q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ + } arm_fir_lattice_instance_q15; + + /** + * @brief Instance structure for the Q31 FIR lattice filter. + */ + + typedef struct + { + uint16_t numStages; /**< number of filter stages. */ + q31_t *pState; /**< points to the state variable array. The array is of length numStages. */ + q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ + } arm_fir_lattice_instance_q31; + + /** + * @brief Instance structure for the floating-point FIR lattice filter. + */ + + typedef struct + { + uint16_t numStages; /**< number of filter stages. */ + float32_t *pState; /**< points to the state variable array. The array is of length numStages. */ + float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ + } arm_fir_lattice_instance_f32; + + /** + * @brief Initialization function for the Q15 FIR lattice filter. + * @param[in] *S points to an instance of the Q15 FIR lattice structure. + * @param[in] numStages number of filter stages. + * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages. + * @param[in] *pState points to the state buffer. The array is of length numStages. + * @return none. + */ + + void arm_fir_lattice_init_q15( + arm_fir_lattice_instance_q15 * S, + uint16_t numStages, + q15_t * pCoeffs, + q15_t * pState); + + + /** + * @brief Processing function for the Q15 FIR lattice filter. + * @param[in] *S points to an instance of the Q15 FIR lattice structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + * @return none. + */ + void arm_fir_lattice_q15( + const arm_fir_lattice_instance_q15 * S, + q15_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + /** + * @brief Initialization function for the Q31 FIR lattice filter. + * @param[in] *S points to an instance of the Q31 FIR lattice structure. + * @param[in] numStages number of filter stages. + * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages. + * @param[in] *pState points to the state buffer. The array is of length numStages. + * @return none. + */ + + void arm_fir_lattice_init_q31( + arm_fir_lattice_instance_q31 * S, + uint16_t numStages, + q31_t * pCoeffs, + q31_t * pState); + + + /** + * @brief Processing function for the Q31 FIR lattice filter. + * @param[in] *S points to an instance of the Q31 FIR lattice structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data + * @param[in] blockSize number of samples to process. + * @return none. + */ + + void arm_fir_lattice_q31( + const arm_fir_lattice_instance_q31 * S, + q31_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + +/** + * @brief Initialization function for the floating-point FIR lattice filter. + * @param[in] *S points to an instance of the floating-point FIR lattice structure. + * @param[in] numStages number of filter stages. + * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages. + * @param[in] *pState points to the state buffer. The array is of length numStages. + * @return none. + */ + + void arm_fir_lattice_init_f32( + arm_fir_lattice_instance_f32 * S, + uint16_t numStages, + float32_t * pCoeffs, + float32_t * pState); + + /** + * @brief Processing function for the floating-point FIR lattice filter. + * @param[in] *S points to an instance of the floating-point FIR lattice structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data + * @param[in] blockSize number of samples to process. + * @return none. + */ + + void arm_fir_lattice_f32( + const arm_fir_lattice_instance_f32 * S, + float32_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + /** + * @brief Instance structure for the Q15 IIR lattice filter. + */ + typedef struct + { + uint16_t numStages; /**< number of stages in the filter. */ + q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ + q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ + q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ + } arm_iir_lattice_instance_q15; + + /** + * @brief Instance structure for the Q31 IIR lattice filter. + */ + typedef struct + { + uint16_t numStages; /**< number of stages in the filter. */ + q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ + q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ + q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ + } arm_iir_lattice_instance_q31; + + /** + * @brief Instance structure for the floating-point IIR lattice filter. + */ + typedef struct + { + uint16_t numStages; /**< number of stages in the filter. */ + float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ + float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ + float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ + } arm_iir_lattice_instance_f32; + + /** + * @brief Processing function for the floating-point IIR lattice filter. + * @param[in] *S points to an instance of the floating-point IIR lattice structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + * @return none. + */ + + void arm_iir_lattice_f32( + const arm_iir_lattice_instance_f32 * S, + float32_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + /** + * @brief Initialization function for the floating-point IIR lattice filter. + * @param[in] *S points to an instance of the floating-point IIR lattice structure. + * @param[in] numStages number of stages in the filter. + * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages. + * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1. + * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize-1. + * @param[in] blockSize number of samples to process. + * @return none. + */ + + void arm_iir_lattice_init_f32( + arm_iir_lattice_instance_f32 * S, + uint16_t numStages, + float32_t * pkCoeffs, + float32_t * pvCoeffs, + float32_t * pState, + uint32_t blockSize); + + + /** + * @brief Processing function for the Q31 IIR lattice filter. + * @param[in] *S points to an instance of the Q31 IIR lattice structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + * @return none. + */ + + void arm_iir_lattice_q31( + const arm_iir_lattice_instance_q31 * S, + q31_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + + /** + * @brief Initialization function for the Q31 IIR lattice filter. + * @param[in] *S points to an instance of the Q31 IIR lattice structure. + * @param[in] numStages number of stages in the filter. + * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages. + * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1. + * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize. + * @param[in] blockSize number of samples to process. + * @return none. + */ + + void arm_iir_lattice_init_q31( + arm_iir_lattice_instance_q31 * S, + uint16_t numStages, + q31_t * pkCoeffs, + q31_t * pvCoeffs, + q31_t * pState, + uint32_t blockSize); + + + /** + * @brief Processing function for the Q15 IIR lattice filter. + * @param[in] *S points to an instance of the Q15 IIR lattice structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + * @return none. + */ + + void arm_iir_lattice_q15( + const arm_iir_lattice_instance_q15 * S, + q15_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + +/** + * @brief Initialization function for the Q15 IIR lattice filter. + * @param[in] *S points to an instance of the fixed-point Q15 IIR lattice structure. + * @param[in] numStages number of stages in the filter. + * @param[in] *pkCoeffs points to reflection coefficient buffer. The array is of length numStages. + * @param[in] *pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1. + * @param[in] *pState points to state buffer. The array is of length numStages+blockSize. + * @param[in] blockSize number of samples to process per call. + * @return none. + */ + + void arm_iir_lattice_init_q15( + arm_iir_lattice_instance_q15 * S, + uint16_t numStages, + q15_t * pkCoeffs, + q15_t * pvCoeffs, + q15_t * pState, + uint32_t blockSize); + + /** + * @brief Instance structure for the floating-point LMS filter. + */ + + typedef struct + { + uint16_t numTaps; /**< number of coefficients in the filter. */ + float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ + float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ + float32_t mu; /**< step size that controls filter coefficient updates. */ + } arm_lms_instance_f32; + + /** + * @brief Processing function for floating-point LMS filter. + * @param[in] *S points to an instance of the floating-point LMS filter structure. + * @param[in] *pSrc points to the block of input data. + * @param[in] *pRef points to the block of reference data. + * @param[out] *pOut points to the block of output data. + * @param[out] *pErr points to the block of error data. + * @param[in] blockSize number of samples to process. + * @return none. + */ + + void arm_lms_f32( + const arm_lms_instance_f32 * S, + float32_t * pSrc, + float32_t * pRef, + float32_t * pOut, + float32_t * pErr, + uint32_t blockSize); + + /** + * @brief Initialization function for floating-point LMS filter. + * @param[in] *S points to an instance of the floating-point LMS filter structure. + * @param[in] numTaps number of filter coefficients. + * @param[in] *pCoeffs points to the coefficient buffer. + * @param[in] *pState points to state buffer. + * @param[in] mu step size that controls filter coefficient updates. + * @param[in] blockSize number of samples to process. + * @return none. + */ + + void arm_lms_init_f32( + arm_lms_instance_f32 * S, + uint16_t numTaps, + float32_t * pCoeffs, + float32_t * pState, + float32_t mu, + uint32_t blockSize); + + /** + * @brief Instance structure for the Q15 LMS filter. + */ + + typedef struct + { + uint16_t numTaps; /**< number of coefficients in the filter. */ + q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ + q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ + q15_t mu; /**< step size that controls filter coefficient updates. */ + uint32_t postShift; /**< bit shift applied to coefficients. */ + } arm_lms_instance_q15; + + + /** + * @brief Initialization function for the Q15 LMS filter. + * @param[in] *S points to an instance of the Q15 LMS filter structure. + * @param[in] numTaps number of filter coefficients. + * @param[in] *pCoeffs points to the coefficient buffer. + * @param[in] *pState points to the state buffer. + * @param[in] mu step size that controls filter coefficient updates. + * @param[in] blockSize number of samples to process. + * @param[in] postShift bit shift applied to coefficients. + * @return none. + */ + + void arm_lms_init_q15( + arm_lms_instance_q15 * S, + uint16_t numTaps, + q15_t * pCoeffs, + q15_t * pState, + q15_t mu, + uint32_t blockSize, + uint32_t postShift); + + /** + * @brief Processing function for Q15 LMS filter. + * @param[in] *S points to an instance of the Q15 LMS filter structure. + * @param[in] *pSrc points to the block of input data. + * @param[in] *pRef points to the block of reference data. + * @param[out] *pOut points to the block of output data. + * @param[out] *pErr points to the block of error data. + * @param[in] blockSize number of samples to process. + * @return none. + */ + + void arm_lms_q15( + const arm_lms_instance_q15 * S, + q15_t * pSrc, + q15_t * pRef, + q15_t * pOut, + q15_t * pErr, + uint32_t blockSize); + + + /** + * @brief Instance structure for the Q31 LMS filter. + */ + + typedef struct + { + uint16_t numTaps; /**< number of coefficients in the filter. */ + q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ + q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ + q31_t mu; /**< step size that controls filter coefficient updates. */ + uint32_t postShift; /**< bit shift applied to coefficients. */ + + } arm_lms_instance_q31; + + /** + * @brief Processing function for Q31 LMS filter. + * @param[in] *S points to an instance of the Q15 LMS filter structure. + * @param[in] *pSrc points to the block of input data. + * @param[in] *pRef points to the block of reference data. + * @param[out] *pOut points to the block of output data. + * @param[out] *pErr points to the block of error data. + * @param[in] blockSize number of samples to process. + * @return none. + */ + + void arm_lms_q31( + const arm_lms_instance_q31 * S, + q31_t * pSrc, + q31_t * pRef, + q31_t * pOut, + q31_t * pErr, + uint32_t blockSize); + + /** + * @brief Initialization function for Q31 LMS filter. + * @param[in] *S points to an instance of the Q31 LMS filter structure. + * @param[in] numTaps number of filter coefficients. + * @param[in] *pCoeffs points to coefficient buffer. + * @param[in] *pState points to state buffer. + * @param[in] mu step size that controls filter coefficient updates. + * @param[in] blockSize number of samples to process. + * @param[in] postShift bit shift applied to coefficients. + * @return none. + */ + + void arm_lms_init_q31( + arm_lms_instance_q31 * S, + uint16_t numTaps, + q31_t * pCoeffs, + q31_t * pState, + q31_t mu, + uint32_t blockSize, + uint32_t postShift); + + /** + * @brief Instance structure for the floating-point normalized LMS filter. + */ + + typedef struct + { + uint16_t numTaps; /**< number of coefficients in the filter. */ + float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ + float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ + float32_t mu; /**< step size that control filter coefficient updates. */ + float32_t energy; /**< saves previous frame energy. */ + float32_t x0; /**< saves previous input sample. */ + } arm_lms_norm_instance_f32; + + /** + * @brief Processing function for floating-point normalized LMS filter. + * @param[in] *S points to an instance of the floating-point normalized LMS filter structure. + * @param[in] *pSrc points to the block of input data. + * @param[in] *pRef points to the block of reference data. + * @param[out] *pOut points to the block of output data. + * @param[out] *pErr points to the block of error data. + * @param[in] blockSize number of samples to process. + * @return none. + */ + + void arm_lms_norm_f32( + arm_lms_norm_instance_f32 * S, + float32_t * pSrc, + float32_t * pRef, + float32_t * pOut, + float32_t * pErr, + uint32_t blockSize); + + /** + * @brief Initialization function for floating-point normalized LMS filter. + * @param[in] *S points to an instance of the floating-point LMS filter structure. + * @param[in] numTaps number of filter coefficients. + * @param[in] *pCoeffs points to coefficient buffer. + * @param[in] *pState points to state buffer. + * @param[in] mu step size that controls filter coefficient updates. + * @param[in] blockSize number of samples to process. + * @return none. + */ + + void arm_lms_norm_init_f32( + arm_lms_norm_instance_f32 * S, + uint16_t numTaps, + float32_t * pCoeffs, + float32_t * pState, + float32_t mu, + uint32_t blockSize); + + + /** + * @brief Instance structure for the Q31 normalized LMS filter. + */ + typedef struct + { + uint16_t numTaps; /**< number of coefficients in the filter. */ + q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ + q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ + q31_t mu; /**< step size that controls filter coefficient updates. */ + uint8_t postShift; /**< bit shift applied to coefficients. */ + q31_t *recipTable; /**< points to the reciprocal initial value table. */ + q31_t energy; /**< saves previous frame energy. */ + q31_t x0; /**< saves previous input sample. */ + } arm_lms_norm_instance_q31; + + /** + * @brief Processing function for Q31 normalized LMS filter. + * @param[in] *S points to an instance of the Q31 normalized LMS filter structure. + * @param[in] *pSrc points to the block of input data. + * @param[in] *pRef points to the block of reference data. + * @param[out] *pOut points to the block of output data. + * @param[out] *pErr points to the block of error data. + * @param[in] blockSize number of samples to process. + * @return none. + */ + + void arm_lms_norm_q31( + arm_lms_norm_instance_q31 * S, + q31_t * pSrc, + q31_t * pRef, + q31_t * pOut, + q31_t * pErr, + uint32_t blockSize); + + /** + * @brief Initialization function for Q31 normalized LMS filter. + * @param[in] *S points to an instance of the Q31 normalized LMS filter structure. + * @param[in] numTaps number of filter coefficients. + * @param[in] *pCoeffs points to coefficient buffer. + * @param[in] *pState points to state buffer. + * @param[in] mu step size that controls filter coefficient updates. + * @param[in] blockSize number of samples to process. + * @param[in] postShift bit shift applied to coefficients. + * @return none. + */ + + void arm_lms_norm_init_q31( + arm_lms_norm_instance_q31 * S, + uint16_t numTaps, + q31_t * pCoeffs, + q31_t * pState, + q31_t mu, + uint32_t blockSize, + uint8_t postShift); + + /** + * @brief Instance structure for the Q15 normalized LMS filter. + */ + + typedef struct + { + uint16_t numTaps; /**< Number of coefficients in the filter. */ + q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ + q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ + q15_t mu; /**< step size that controls filter coefficient updates. */ + uint8_t postShift; /**< bit shift applied to coefficients. */ + q15_t *recipTable; /**< Points to the reciprocal initial value table. */ + q15_t energy; /**< saves previous frame energy. */ + q15_t x0; /**< saves previous input sample. */ + } arm_lms_norm_instance_q15; + + /** + * @brief Processing function for Q15 normalized LMS filter. + * @param[in] *S points to an instance of the Q15 normalized LMS filter structure. + * @param[in] *pSrc points to the block of input data. + * @param[in] *pRef points to the block of reference data. + * @param[out] *pOut points to the block of output data. + * @param[out] *pErr points to the block of error data. + * @param[in] blockSize number of samples to process. + * @return none. + */ + + void arm_lms_norm_q15( + arm_lms_norm_instance_q15 * S, + q15_t * pSrc, + q15_t * pRef, + q15_t * pOut, + q15_t * pErr, + uint32_t blockSize); + + + /** + * @brief Initialization function for Q15 normalized LMS filter. + * @param[in] *S points to an instance of the Q15 normalized LMS filter structure. + * @param[in] numTaps number of filter coefficients. + * @param[in] *pCoeffs points to coefficient buffer. + * @param[in] *pState points to state buffer. + * @param[in] mu step size that controls filter coefficient updates. + * @param[in] blockSize number of samples to process. + * @param[in] postShift bit shift applied to coefficients. + * @return none. + */ + + void arm_lms_norm_init_q15( + arm_lms_norm_instance_q15 * S, + uint16_t numTaps, + q15_t * pCoeffs, + q15_t * pState, + q15_t mu, + uint32_t blockSize, + uint8_t postShift); + + /** + * @brief Correlation of floating-point sequences. + * @param[in] *pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] *pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. + * @return none. + */ + + void arm_correlate_f32( + float32_t * pSrcA, + uint32_t srcALen, + float32_t * pSrcB, + uint32_t srcBLen, + float32_t * pDst); + + + /** + * @brief Correlation of Q15 sequences + * @param[in] *pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] *pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. + * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. + * @return none. + */ + void arm_correlate_opt_q15( + q15_t * pSrcA, + uint32_t srcALen, + q15_t * pSrcB, + uint32_t srcBLen, + q15_t * pDst, + q15_t * pScratch); + + + /** + * @brief Correlation of Q15 sequences. + * @param[in] *pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] *pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. + * @return none. + */ + + void arm_correlate_q15( + q15_t * pSrcA, + uint32_t srcALen, + q15_t * pSrcB, + uint32_t srcBLen, + q15_t * pDst); + + /** + * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4. + * @param[in] *pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] *pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. + * @return none. + */ + + void arm_correlate_fast_q15( + q15_t * pSrcA, + uint32_t srcALen, + q15_t * pSrcB, + uint32_t srcBLen, + q15_t * pDst); + + + + /** + * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4. + * @param[in] *pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] *pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. + * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. + * @return none. + */ + + void arm_correlate_fast_opt_q15( + q15_t * pSrcA, + uint32_t srcALen, + q15_t * pSrcB, + uint32_t srcBLen, + q15_t * pDst, + q15_t * pScratch); + + /** + * @brief Correlation of Q31 sequences. + * @param[in] *pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] *pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. + * @return none. + */ + + void arm_correlate_q31( + q31_t * pSrcA, + uint32_t srcALen, + q31_t * pSrcB, + uint32_t srcBLen, + q31_t * pDst); + + /** + * @brief Correlation of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 + * @param[in] *pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] *pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. + * @return none. + */ + + void arm_correlate_fast_q31( + q31_t * pSrcA, + uint32_t srcALen, + q31_t * pSrcB, + uint32_t srcBLen, + q31_t * pDst); + + + + /** + * @brief Correlation of Q7 sequences. + * @param[in] *pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] *pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. + * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. + * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). + * @return none. + */ + + void arm_correlate_opt_q7( + q7_t * pSrcA, + uint32_t srcALen, + q7_t * pSrcB, + uint32_t srcBLen, + q7_t * pDst, + q15_t * pScratch1, + q15_t * pScratch2); + + + /** + * @brief Correlation of Q7 sequences. + * @param[in] *pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] *pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. + * @return none. + */ + + void arm_correlate_q7( + q7_t * pSrcA, + uint32_t srcALen, + q7_t * pSrcB, + uint32_t srcBLen, + q7_t * pDst); + + + /** + * @brief Instance structure for the floating-point sparse FIR filter. + */ + typedef struct + { + uint16_t numTaps; /**< number of coefficients in the filter. */ + uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ + float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ + float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ + uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ + int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ + } arm_fir_sparse_instance_f32; + + /** + * @brief Instance structure for the Q31 sparse FIR filter. + */ + + typedef struct + { + uint16_t numTaps; /**< number of coefficients in the filter. */ + uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ + q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ + q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ + uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ + int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ + } arm_fir_sparse_instance_q31; + + /** + * @brief Instance structure for the Q15 sparse FIR filter. + */ + + typedef struct + { + uint16_t numTaps; /**< number of coefficients in the filter. */ + uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ + q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ + q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ + uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ + int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ + } arm_fir_sparse_instance_q15; + + /** + * @brief Instance structure for the Q7 sparse FIR filter. + */ + + typedef struct + { + uint16_t numTaps; /**< number of coefficients in the filter. */ + uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ + q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ + q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ + uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ + int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ + } arm_fir_sparse_instance_q7; + + /** + * @brief Processing function for the floating-point sparse FIR filter. + * @param[in] *S points to an instance of the floating-point sparse FIR structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data + * @param[in] *pScratchIn points to a temporary buffer of size blockSize. + * @param[in] blockSize number of input samples to process per call. + * @return none. + */ + + void arm_fir_sparse_f32( + arm_fir_sparse_instance_f32 * S, + float32_t * pSrc, + float32_t * pDst, + float32_t * pScratchIn, + uint32_t blockSize); + + /** + * @brief Initialization function for the floating-point sparse FIR filter. + * @param[in,out] *S points to an instance of the floating-point sparse FIR structure. + * @param[in] numTaps number of nonzero coefficients in the filter. + * @param[in] *pCoeffs points to the array of filter coefficients. + * @param[in] *pState points to the state buffer. + * @param[in] *pTapDelay points to the array of offset times. + * @param[in] maxDelay maximum offset time supported. + * @param[in] blockSize number of samples that will be processed per block. + * @return none + */ + + void arm_fir_sparse_init_f32( + arm_fir_sparse_instance_f32 * S, + uint16_t numTaps, + float32_t * pCoeffs, + float32_t * pState, + int32_t * pTapDelay, + uint16_t maxDelay, + uint32_t blockSize); + + /** + * @brief Processing function for the Q31 sparse FIR filter. + * @param[in] *S points to an instance of the Q31 sparse FIR structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data + * @param[in] *pScratchIn points to a temporary buffer of size blockSize. + * @param[in] blockSize number of input samples to process per call. + * @return none. + */ + + void arm_fir_sparse_q31( + arm_fir_sparse_instance_q31 * S, + q31_t * pSrc, + q31_t * pDst, + q31_t * pScratchIn, + uint32_t blockSize); + + /** + * @brief Initialization function for the Q31 sparse FIR filter. + * @param[in,out] *S points to an instance of the Q31 sparse FIR structure. + * @param[in] numTaps number of nonzero coefficients in the filter. + * @param[in] *pCoeffs points to the array of filter coefficients. + * @param[in] *pState points to the state buffer. + * @param[in] *pTapDelay points to the array of offset times. + * @param[in] maxDelay maximum offset time supported. + * @param[in] blockSize number of samples that will be processed per block. + * @return none + */ + + void arm_fir_sparse_init_q31( + arm_fir_sparse_instance_q31 * S, + uint16_t numTaps, + q31_t * pCoeffs, + q31_t * pState, + int32_t * pTapDelay, + uint16_t maxDelay, + uint32_t blockSize); + + /** + * @brief Processing function for the Q15 sparse FIR filter. + * @param[in] *S points to an instance of the Q15 sparse FIR structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data + * @param[in] *pScratchIn points to a temporary buffer of size blockSize. + * @param[in] *pScratchOut points to a temporary buffer of size blockSize. + * @param[in] blockSize number of input samples to process per call. + * @return none. + */ + + void arm_fir_sparse_q15( + arm_fir_sparse_instance_q15 * S, + q15_t * pSrc, + q15_t * pDst, + q15_t * pScratchIn, + q31_t * pScratchOut, + uint32_t blockSize); + + + /** + * @brief Initialization function for the Q15 sparse FIR filter. + * @param[in,out] *S points to an instance of the Q15 sparse FIR structure. + * @param[in] numTaps number of nonzero coefficients in the filter. + * @param[in] *pCoeffs points to the array of filter coefficients. + * @param[in] *pState points to the state buffer. + * @param[in] *pTapDelay points to the array of offset times. + * @param[in] maxDelay maximum offset time supported. + * @param[in] blockSize number of samples that will be processed per block. + * @return none + */ + + void arm_fir_sparse_init_q15( + arm_fir_sparse_instance_q15 * S, + uint16_t numTaps, + q15_t * pCoeffs, + q15_t * pState, + int32_t * pTapDelay, + uint16_t maxDelay, + uint32_t blockSize); + + /** + * @brief Processing function for the Q7 sparse FIR filter. + * @param[in] *S points to an instance of the Q7 sparse FIR structure. + * @param[in] *pSrc points to the block of input data. + * @param[out] *pDst points to the block of output data + * @param[in] *pScratchIn points to a temporary buffer of size blockSize. + * @param[in] *pScratchOut points to a temporary buffer of size blockSize. + * @param[in] blockSize number of input samples to process per call. + * @return none. + */ + + void arm_fir_sparse_q7( + arm_fir_sparse_instance_q7 * S, + q7_t * pSrc, + q7_t * pDst, + q7_t * pScratchIn, + q31_t * pScratchOut, + uint32_t blockSize); + + /** + * @brief Initialization function for the Q7 sparse FIR filter. + * @param[in,out] *S points to an instance of the Q7 sparse FIR structure. + * @param[in] numTaps number of nonzero coefficients in the filter. + * @param[in] *pCoeffs points to the array of filter coefficients. + * @param[in] *pState points to the state buffer. + * @param[in] *pTapDelay points to the array of offset times. + * @param[in] maxDelay maximum offset time supported. + * @param[in] blockSize number of samples that will be processed per block. + * @return none + */ + + void arm_fir_sparse_init_q7( + arm_fir_sparse_instance_q7 * S, + uint16_t numTaps, + q7_t * pCoeffs, + q7_t * pState, + int32_t * pTapDelay, + uint16_t maxDelay, + uint32_t blockSize); + + + /* + * @brief Floating-point sin_cos function. + * @param[in] theta input value in degrees + * @param[out] *pSinVal points to the processed sine output. + * @param[out] *pCosVal points to the processed cos output. + * @return none. + */ + + void arm_sin_cos_f32( + float32_t theta, + float32_t * pSinVal, + float32_t * pCcosVal); + + /* + * @brief Q31 sin_cos function. + * @param[in] theta scaled input value in degrees + * @param[out] *pSinVal points to the processed sine output. + * @param[out] *pCosVal points to the processed cosine output. + * @return none. + */ + + void arm_sin_cos_q31( + q31_t theta, + q31_t * pSinVal, + q31_t * pCosVal); + + + /** + * @brief Floating-point complex conjugate. + * @param[in] *pSrc points to the input vector + * @param[out] *pDst points to the output vector + * @param[in] numSamples number of complex samples in each vector + * @return none. + */ + + void arm_cmplx_conj_f32( + float32_t * pSrc, + float32_t * pDst, + uint32_t numSamples); + + /** + * @brief Q31 complex conjugate. + * @param[in] *pSrc points to the input vector + * @param[out] *pDst points to the output vector + * @param[in] numSamples number of complex samples in each vector + * @return none. + */ + + void arm_cmplx_conj_q31( + q31_t * pSrc, + q31_t * pDst, + uint32_t numSamples); + + /** + * @brief Q15 complex conjugate. + * @param[in] *pSrc points to the input vector + * @param[out] *pDst points to the output vector + * @param[in] numSamples number of complex samples in each vector + * @return none. + */ + + void arm_cmplx_conj_q15( + q15_t * pSrc, + q15_t * pDst, + uint32_t numSamples); + + + + /** + * @brief Floating-point complex magnitude squared + * @param[in] *pSrc points to the complex input vector + * @param[out] *pDst points to the real output vector + * @param[in] numSamples number of complex samples in the input vector + * @return none. + */ + + void arm_cmplx_mag_squared_f32( + float32_t * pSrc, + float32_t * pDst, + uint32_t numSamples); + + /** + * @brief Q31 complex magnitude squared + * @param[in] *pSrc points to the complex input vector + * @param[out] *pDst points to the real output vector + * @param[in] numSamples number of complex samples in the input vector + * @return none. + */ + + void arm_cmplx_mag_squared_q31( + q31_t * pSrc, + q31_t * pDst, + uint32_t numSamples); + + /** + * @brief Q15 complex magnitude squared + * @param[in] *pSrc points to the complex input vector + * @param[out] *pDst points to the real output vector + * @param[in] numSamples number of complex samples in the input vector + * @return none. + */ + + void arm_cmplx_mag_squared_q15( + q15_t * pSrc, + q15_t * pDst, + uint32_t numSamples); + + + /** + * @ingroup groupController + */ + + /** + * @defgroup PID PID Motor Control + * + * A Proportional Integral Derivative (PID) controller is a generic feedback control + * loop mechanism widely used in industrial control systems. + * A PID controller is the most commonly used type of feedback controller. + * + * This set of functions implements (PID) controllers + * for Q15, Q31, and floating-point data types. The functions operate on a single sample + * of data and each call to the function returns a single processed value. + * S points to an instance of the PID control data structure. in + * is the input sample value. The functions return the output value. + * + * \par Algorithm: + *
+   *    y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]
+   *    A0 = Kp + Ki + Kd
+   *    A1 = (-Kp ) - (2 * Kd )
+   *    A2 = Kd  
+ * + * \par + * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant + * + * \par + * \image html PID.gif "Proportional Integral Derivative Controller" + * + * \par + * The PID controller calculates an "error" value as the difference between + * the measured output and the reference input. + * The controller attempts to minimize the error by adjusting the process control inputs. + * The proportional value determines the reaction to the current error, + * the integral value determines the reaction based on the sum of recent errors, + * and the derivative value determines the reaction based on the rate at which the error has been changing. + * + * \par Instance Structure + * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure. + * A separate instance structure must be defined for each PID Controller. + * There are separate instance structure declarations for each of the 3 supported data types. + * + * \par Reset Functions + * There is also an associated reset function for each data type which clears the state array. + * + * \par Initialization Functions + * There is also an associated initialization function for each data type. + * The initialization function performs the following operations: + * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains. + * - Zeros out the values in the state buffer. + * + * \par + * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function. + * + * \par Fixed-Point Behavior + * Care must be taken when using the fixed-point versions of the PID Controller functions. + * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered. + * Refer to the function specific documentation below for usage guidelines. + */ + + /** + * @addtogroup PID + * @{ + */ + + /** + * @brief Process function for the floating-point PID Control. + * @param[in,out] *S is an instance of the floating-point PID Control structure + * @param[in] in input sample to process + * @return out processed output sample. + */ + + + static __INLINE float32_t arm_pid_f32( + arm_pid_instance_f32 * S, + float32_t in) + { + float32_t out; + + /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */ + out = (S->A0 * in) + + (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]); + + /* Update state */ + S->state[1] = S->state[0]; + S->state[0] = in; + S->state[2] = out; + + /* return to application */ + return (out); + + } + + /** + * @brief Process function for the Q31 PID Control. + * @param[in,out] *S points to an instance of the Q31 PID Control structure + * @param[in] in input sample to process + * @return out processed output sample. + * + * Scaling and Overflow Behavior: + * \par + * The function is implemented using an internal 64-bit accumulator. + * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit. + * Thus, if the accumulator result overflows it wraps around rather than clip. + * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions. + * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format. + */ + + static __INLINE q31_t arm_pid_q31( + arm_pid_instance_q31 * S, + q31_t in) + { + q63_t acc; + q31_t out; + + /* acc = A0 * x[n] */ + acc = (q63_t) S->A0 * in; + + /* acc += A1 * x[n-1] */ + acc += (q63_t) S->A1 * S->state[0]; + + /* acc += A2 * x[n-2] */ + acc += (q63_t) S->A2 * S->state[1]; + + /* convert output to 1.31 format to add y[n-1] */ + out = (q31_t) (acc >> 31u); + + /* out += y[n-1] */ + out += S->state[2]; + + /* Update state */ + S->state[1] = S->state[0]; + S->state[0] = in; + S->state[2] = out; + + /* return to application */ + return (out); + + } + + /** + * @brief Process function for the Q15 PID Control. + * @param[in,out] *S points to an instance of the Q15 PID Control structure + * @param[in] in input sample to process + * @return out processed output sample. + * + * Scaling and Overflow Behavior: + * \par + * The function is implemented using a 64-bit internal accumulator. + * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result. + * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format. + * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved. + * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits. + * Lastly, the accumulator is saturated to yield a result in 1.15 format. + */ + + static __INLINE q15_t arm_pid_q15( + arm_pid_instance_q15 * S, + q15_t in) + { + q63_t acc; + q15_t out; + +#ifndef ARM_MATH_CM0_FAMILY + __SIMD32_TYPE *vstate; + + /* Implementation of PID controller */ + + /* acc = A0 * x[n] */ + acc = (q31_t) __SMUAD(S->A0, in); + + /* acc += A1 * x[n-1] + A2 * x[n-2] */ + vstate = __SIMD32_CONST(S->state); + acc = __SMLALD(S->A1, (q31_t) *vstate, acc); + +#else + /* acc = A0 * x[n] */ + acc = ((q31_t) S->A0) * in; + + /* acc += A1 * x[n-1] + A2 * x[n-2] */ + acc += (q31_t) S->A1 * S->state[0]; + acc += (q31_t) S->A2 * S->state[1]; + +#endif + + /* acc += y[n-1] */ + acc += (q31_t) S->state[2] << 15; + + /* saturate the output */ + out = (q15_t) (__SSAT((acc >> 15), 16)); + + /* Update state */ + S->state[1] = S->state[0]; + S->state[0] = in; + S->state[2] = out; + + /* return to application */ + return (out); + + } + + /** + * @} end of PID group + */ + + + /** + * @brief Floating-point matrix inverse. + * @param[in] *src points to the instance of the input floating-point matrix structure. + * @param[out] *dst points to the instance of the output floating-point matrix structure. + * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match. + * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR. + */ + + arm_status arm_mat_inverse_f32( + const arm_matrix_instance_f32 * src, + arm_matrix_instance_f32 * dst); + + + /** + * @brief Floating-point matrix inverse. + * @param[in] *src points to the instance of the input floating-point matrix structure. + * @param[out] *dst points to the instance of the output floating-point matrix structure. + * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match. + * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR. + */ + + arm_status arm_mat_inverse_f64( + const arm_matrix_instance_f64 * src, + arm_matrix_instance_f64 * dst); + + + + /** + * @ingroup groupController + */ + + + /** + * @defgroup clarke Vector Clarke Transform + * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector. + * Generally the Clarke transform uses three-phase currents Ia, Ib and Ic to calculate currents + * in the two-phase orthogonal stator axis Ialpha and Ibeta. + * When Ialpha is superposed with Ia as shown in the figure below + * \image html clarke.gif Stator current space vector and its components in (a,b). + * and Ia + Ib + Ic = 0, in this condition Ialpha and Ibeta + * can be calculated using only Ia and Ib. + * + * The function operates on a single sample of data and each call to the function returns the processed output. + * The library provides separate functions for Q31 and floating-point data types. + * \par Algorithm + * \image html clarkeFormula.gif + * where Ia and Ib are the instantaneous stator phases and + * pIalpha and pIbeta are the two coordinates of time invariant vector. + * \par Fixed-Point Behavior + * Care must be taken when using the Q31 version of the Clarke transform. + * In particular, the overflow and saturation behavior of the accumulator used must be considered. + * Refer to the function specific documentation below for usage guidelines. + */ + + /** + * @addtogroup clarke + * @{ + */ + + /** + * + * @brief Floating-point Clarke transform + * @param[in] Ia input three-phase coordinate a + * @param[in] Ib input three-phase coordinate b + * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha + * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta + * @return none. + */ + + static __INLINE void arm_clarke_f32( + float32_t Ia, + float32_t Ib, + float32_t * pIalpha, + float32_t * pIbeta) + { + /* Calculate pIalpha using the equation, pIalpha = Ia */ + *pIalpha = Ia; + + /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */ + *pIbeta = + ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib); + + } + + /** + * @brief Clarke transform for Q31 version + * @param[in] Ia input three-phase coordinate a + * @param[in] Ib input three-phase coordinate b + * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha + * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta + * @return none. + * + * Scaling and Overflow Behavior: + * \par + * The function is implemented using an internal 32-bit accumulator. + * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. + * There is saturation on the addition, hence there is no risk of overflow. + */ + + static __INLINE void arm_clarke_q31( + q31_t Ia, + q31_t Ib, + q31_t * pIalpha, + q31_t * pIbeta) + { + q31_t product1, product2; /* Temporary variables used to store intermediate results */ + + /* Calculating pIalpha from Ia by equation pIalpha = Ia */ + *pIalpha = Ia; + + /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */ + product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30); + + /* Intermediate product is calculated by (2/sqrt(3) * Ib) */ + product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30); + + /* pIbeta is calculated by adding the intermediate products */ + *pIbeta = __QADD(product1, product2); + } + + /** + * @} end of clarke group + */ + + /** + * @brief Converts the elements of the Q7 vector to Q31 vector. + * @param[in] *pSrc input pointer + * @param[out] *pDst output pointer + * @param[in] blockSize number of samples to process + * @return none. + */ + void arm_q7_to_q31( + q7_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + + + + /** + * @ingroup groupController + */ + + /** + * @defgroup inv_clarke Vector Inverse Clarke Transform + * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases. + * + * The function operates on a single sample of data and each call to the function returns the processed output. + * The library provides separate functions for Q31 and floating-point data types. + * \par Algorithm + * \image html clarkeInvFormula.gif + * where pIa and pIb are the instantaneous stator phases and + * Ialpha and Ibeta are the two coordinates of time invariant vector. + * \par Fixed-Point Behavior + * Care must be taken when using the Q31 version of the Clarke transform. + * In particular, the overflow and saturation behavior of the accumulator used must be considered. + * Refer to the function specific documentation below for usage guidelines. + */ + + /** + * @addtogroup inv_clarke + * @{ + */ + + /** + * @brief Floating-point Inverse Clarke transform + * @param[in] Ialpha input two-phase orthogonal vector axis alpha + * @param[in] Ibeta input two-phase orthogonal vector axis beta + * @param[out] *pIa points to output three-phase coordinate a + * @param[out] *pIb points to output three-phase coordinate b + * @return none. + */ + + + static __INLINE void arm_inv_clarke_f32( + float32_t Ialpha, + float32_t Ibeta, + float32_t * pIa, + float32_t * pIb) + { + /* Calculating pIa from Ialpha by equation pIa = Ialpha */ + *pIa = Ialpha; + + /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */ + *pIb = -0.5 * Ialpha + (float32_t) 0.8660254039 *Ibeta; + + } + + /** + * @brief Inverse Clarke transform for Q31 version + * @param[in] Ialpha input two-phase orthogonal vector axis alpha + * @param[in] Ibeta input two-phase orthogonal vector axis beta + * @param[out] *pIa points to output three-phase coordinate a + * @param[out] *pIb points to output three-phase coordinate b + * @return none. + * + * Scaling and Overflow Behavior: + * \par + * The function is implemented using an internal 32-bit accumulator. + * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. + * There is saturation on the subtraction, hence there is no risk of overflow. + */ + + static __INLINE void arm_inv_clarke_q31( + q31_t Ialpha, + q31_t Ibeta, + q31_t * pIa, + q31_t * pIb) + { + q31_t product1, product2; /* Temporary variables used to store intermediate results */ + + /* Calculating pIa from Ialpha by equation pIa = Ialpha */ + *pIa = Ialpha; + + /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */ + product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31); + + /* Intermediate product is calculated by (1/sqrt(3) * pIb) */ + product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31); + + /* pIb is calculated by subtracting the products */ + *pIb = __QSUB(product2, product1); + + } + + /** + * @} end of inv_clarke group + */ + + /** + * @brief Converts the elements of the Q7 vector to Q15 vector. + * @param[in] *pSrc input pointer + * @param[out] *pDst output pointer + * @param[in] blockSize number of samples to process + * @return none. + */ + void arm_q7_to_q15( + q7_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + + + /** + * @ingroup groupController + */ + + /** + * @defgroup park Vector Park Transform + * + * Forward Park transform converts the input two-coordinate vector to flux and torque components. + * The Park transform can be used to realize the transformation of the Ialpha and the Ibeta currents + * from the stationary to the moving reference frame and control the spatial relationship between + * the stator vector current and rotor flux vector. + * If we consider the d axis aligned with the rotor flux, the diagram below shows the + * current vector and the relationship from the two reference frames: + * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame" + * + * The function operates on a single sample of data and each call to the function returns the processed output. + * The library provides separate functions for Q31 and floating-point data types. + * \par Algorithm + * \image html parkFormula.gif + * where Ialpha and Ibeta are the stator vector components, + * pId and pIq are rotor vector components and cosVal and sinVal are the + * cosine and sine values of theta (rotor flux position). + * \par Fixed-Point Behavior + * Care must be taken when using the Q31 version of the Park transform. + * In particular, the overflow and saturation behavior of the accumulator used must be considered. + * Refer to the function specific documentation below for usage guidelines. + */ + + /** + * @addtogroup park + * @{ + */ + + /** + * @brief Floating-point Park transform + * @param[in] Ialpha input two-phase vector coordinate alpha + * @param[in] Ibeta input two-phase vector coordinate beta + * @param[out] *pId points to output rotor reference frame d + * @param[out] *pIq points to output rotor reference frame q + * @param[in] sinVal sine value of rotation angle theta + * @param[in] cosVal cosine value of rotation angle theta + * @return none. + * + * The function implements the forward Park transform. + * + */ + + static __INLINE void arm_park_f32( + float32_t Ialpha, + float32_t Ibeta, + float32_t * pId, + float32_t * pIq, + float32_t sinVal, + float32_t cosVal) + { + /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */ + *pId = Ialpha * cosVal + Ibeta * sinVal; + + /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */ + *pIq = -Ialpha * sinVal + Ibeta * cosVal; + + } + + /** + * @brief Park transform for Q31 version + * @param[in] Ialpha input two-phase vector coordinate alpha + * @param[in] Ibeta input two-phase vector coordinate beta + * @param[out] *pId points to output rotor reference frame d + * @param[out] *pIq points to output rotor reference frame q + * @param[in] sinVal sine value of rotation angle theta + * @param[in] cosVal cosine value of rotation angle theta + * @return none. + * + * Scaling and Overflow Behavior: + * \par + * The function is implemented using an internal 32-bit accumulator. + * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. + * There is saturation on the addition and subtraction, hence there is no risk of overflow. + */ + + + static __INLINE void arm_park_q31( + q31_t Ialpha, + q31_t Ibeta, + q31_t * pId, + q31_t * pIq, + q31_t sinVal, + q31_t cosVal) + { + q31_t product1, product2; /* Temporary variables used to store intermediate results */ + q31_t product3, product4; /* Temporary variables used to store intermediate results */ + + /* Intermediate product is calculated by (Ialpha * cosVal) */ + product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31); + + /* Intermediate product is calculated by (Ibeta * sinVal) */ + product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31); + + + /* Intermediate product is calculated by (Ialpha * sinVal) */ + product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31); + + /* Intermediate product is calculated by (Ibeta * cosVal) */ + product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31); + + /* Calculate pId by adding the two intermediate products 1 and 2 */ + *pId = __QADD(product1, product2); + + /* Calculate pIq by subtracting the two intermediate products 3 from 4 */ + *pIq = __QSUB(product4, product3); + } + + /** + * @} end of park group + */ + + /** + * @brief Converts the elements of the Q7 vector to floating-point vector. + * @param[in] *pSrc is input pointer + * @param[out] *pDst is output pointer + * @param[in] blockSize is the number of samples to process + * @return none. + */ + void arm_q7_to_float( + q7_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + + /** + * @ingroup groupController + */ + + /** + * @defgroup inv_park Vector Inverse Park transform + * Inverse Park transform converts the input flux and torque components to two-coordinate vector. + * + * The function operates on a single sample of data and each call to the function returns the processed output. + * The library provides separate functions for Q31 and floating-point data types. + * \par Algorithm + * \image html parkInvFormula.gif + * where pIalpha and pIbeta are the stator vector components, + * Id and Iq are rotor vector components and cosVal and sinVal are the + * cosine and sine values of theta (rotor flux position). + * \par Fixed-Point Behavior + * Care must be taken when using the Q31 version of the Park transform. + * In particular, the overflow and saturation behavior of the accumulator used must be considered. + * Refer to the function specific documentation below for usage guidelines. + */ + + /** + * @addtogroup inv_park + * @{ + */ + + /** + * @brief Floating-point Inverse Park transform + * @param[in] Id input coordinate of rotor reference frame d + * @param[in] Iq input coordinate of rotor reference frame q + * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha + * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta + * @param[in] sinVal sine value of rotation angle theta + * @param[in] cosVal cosine value of rotation angle theta + * @return none. + */ + + static __INLINE void arm_inv_park_f32( + float32_t Id, + float32_t Iq, + float32_t * pIalpha, + float32_t * pIbeta, + float32_t sinVal, + float32_t cosVal) + { + /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */ + *pIalpha = Id * cosVal - Iq * sinVal; + + /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */ + *pIbeta = Id * sinVal + Iq * cosVal; + + } + + + /** + * @brief Inverse Park transform for Q31 version + * @param[in] Id input coordinate of rotor reference frame d + * @param[in] Iq input coordinate of rotor reference frame q + * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha + * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta + * @param[in] sinVal sine value of rotation angle theta + * @param[in] cosVal cosine value of rotation angle theta + * @return none. + * + * Scaling and Overflow Behavior: + * \par + * The function is implemented using an internal 32-bit accumulator. + * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. + * There is saturation on the addition, hence there is no risk of overflow. + */ + + + static __INLINE void arm_inv_park_q31( + q31_t Id, + q31_t Iq, + q31_t * pIalpha, + q31_t * pIbeta, + q31_t sinVal, + q31_t cosVal) + { + q31_t product1, product2; /* Temporary variables used to store intermediate results */ + q31_t product3, product4; /* Temporary variables used to store intermediate results */ + + /* Intermediate product is calculated by (Id * cosVal) */ + product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31); + + /* Intermediate product is calculated by (Iq * sinVal) */ + product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31); + + + /* Intermediate product is calculated by (Id * sinVal) */ + product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31); + + /* Intermediate product is calculated by (Iq * cosVal) */ + product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31); + + /* Calculate pIalpha by using the two intermediate products 1 and 2 */ + *pIalpha = __QSUB(product1, product2); + + /* Calculate pIbeta by using the two intermediate products 3 and 4 */ + *pIbeta = __QADD(product4, product3); + + } + + /** + * @} end of Inverse park group + */ + + + /** + * @brief Converts the elements of the Q31 vector to floating-point vector. + * @param[in] *pSrc is input pointer + * @param[out] *pDst is output pointer + * @param[in] blockSize is the number of samples to process + * @return none. + */ + void arm_q31_to_float( + q31_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + /** + * @ingroup groupInterpolation + */ + + /** + * @defgroup LinearInterpolate Linear Interpolation + * + * Linear interpolation is a method of curve fitting using linear polynomials. + * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line + * + * \par + * \image html LinearInterp.gif "Linear interpolation" + * + * \par + * A Linear Interpolate function calculates an output value(y), for the input(x) + * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values) + * + * \par Algorithm: + *
+   *       y = y0 + (x - x0) * ((y1 - y0)/(x1-x0))
+   *       where x0, x1 are nearest values of input x
+   *             y0, y1 are nearest values to output y
+   * 
+ * + * \par + * This set of functions implements Linear interpolation process + * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single + * sample of data and each call to the function returns a single processed value. + * S points to an instance of the Linear Interpolate function data structure. + * x is the input sample value. The functions returns the output value. + * + * \par + * if x is outside of the table boundary, Linear interpolation returns first value of the table + * if x is below input range and returns last value of table if x is above range. + */ + + /** + * @addtogroup LinearInterpolate + * @{ + */ + + /** + * @brief Process function for the floating-point Linear Interpolation Function. + * @param[in,out] *S is an instance of the floating-point Linear Interpolation structure + * @param[in] x input sample to process + * @return y processed output sample. + * + */ + + static __INLINE float32_t arm_linear_interp_f32( + arm_linear_interp_instance_f32 * S, + float32_t x) + { + + float32_t y; + float32_t x0, x1; /* Nearest input values */ + float32_t y0, y1; /* Nearest output values */ + float32_t xSpacing = S->xSpacing; /* spacing between input values */ + int32_t i; /* Index variable */ + float32_t *pYData = S->pYData; /* pointer to output table */ + + /* Calculation of index */ + i = (int32_t) ((x - S->x1) / xSpacing); + + if(i < 0) + { + /* Iniatilize output for below specified range as least output value of table */ + y = pYData[0]; + } + else if((uint32_t)i >= S->nValues) + { + /* Iniatilize output for above specified range as last output value of table */ + y = pYData[S->nValues - 1]; + } + else + { + /* Calculation of nearest input values */ + x0 = S->x1 + i * xSpacing; + x1 = S->x1 + (i + 1) * xSpacing; + + /* Read of nearest output values */ + y0 = pYData[i]; + y1 = pYData[i + 1]; + + /* Calculation of output */ + y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0)); + + } + + /* returns output value */ + return (y); + } + + /** + * + * @brief Process function for the Q31 Linear Interpolation Function. + * @param[in] *pYData pointer to Q31 Linear Interpolation table + * @param[in] x input sample to process + * @param[in] nValues number of table values + * @return y processed output sample. + * + * \par + * Input sample x is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. + * This function can support maximum of table size 2^12. + * + */ + + + static __INLINE q31_t arm_linear_interp_q31( + q31_t * pYData, + q31_t x, + uint32_t nValues) + { + q31_t y; /* output */ + q31_t y0, y1; /* Nearest output values */ + q31_t fract; /* fractional part */ + int32_t index; /* Index to read nearest output values */ + + /* Input is in 12.20 format */ + /* 12 bits for the table index */ + /* Index value calculation */ + index = ((x & 0xFFF00000) >> 20); + + if(index >= (int32_t)(nValues - 1)) + { + return (pYData[nValues - 1]); + } + else if(index < 0) + { + return (pYData[0]); + } + else + { + + /* 20 bits for the fractional part */ + /* shift left by 11 to keep fract in 1.31 format */ + fract = (x & 0x000FFFFF) << 11; + + /* Read two nearest output values from the index in 1.31(q31) format */ + y0 = pYData[index]; + y1 = pYData[index + 1u]; + + /* Calculation of y0 * (1-fract) and y is in 2.30 format */ + y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32)); + + /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */ + y += ((q31_t) (((q63_t) y1 * fract) >> 32)); + + /* Convert y to 1.31 format */ + return (y << 1u); + + } + + } + + /** + * + * @brief Process function for the Q15 Linear Interpolation Function. + * @param[in] *pYData pointer to Q15 Linear Interpolation table + * @param[in] x input sample to process + * @param[in] nValues number of table values + * @return y processed output sample. + * + * \par + * Input sample x is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. + * This function can support maximum of table size 2^12. + * + */ + + + static __INLINE q15_t arm_linear_interp_q15( + q15_t * pYData, + q31_t x, + uint32_t nValues) + { + q63_t y; /* output */ + q15_t y0, y1; /* Nearest output values */ + q31_t fract; /* fractional part */ + int32_t index; /* Index to read nearest output values */ + + /* Input is in 12.20 format */ + /* 12 bits for the table index */ + /* Index value calculation */ + index = ((x & 0xFFF00000) >> 20u); + + if(index >= (int32_t)(nValues - 1)) + { + return (pYData[nValues - 1]); + } + else if(index < 0) + { + return (pYData[0]); + } + else + { + /* 20 bits for the fractional part */ + /* fract is in 12.20 format */ + fract = (x & 0x000FFFFF); + + /* Read two nearest output values from the index */ + y0 = pYData[index]; + y1 = pYData[index + 1u]; + + /* Calculation of y0 * (1-fract) and y is in 13.35 format */ + y = ((q63_t) y0 * (0xFFFFF - fract)); + + /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */ + y += ((q63_t) y1 * (fract)); + + /* convert y to 1.15 format */ + return (y >> 20); + } + + + } + + /** + * + * @brief Process function for the Q7 Linear Interpolation Function. + * @param[in] *pYData pointer to Q7 Linear Interpolation table + * @param[in] x input sample to process + * @param[in] nValues number of table values + * @return y processed output sample. + * + * \par + * Input sample x is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. + * This function can support maximum of table size 2^12. + */ + + + static __INLINE q7_t arm_linear_interp_q7( + q7_t * pYData, + q31_t x, + uint32_t nValues) + { + q31_t y; /* output */ + q7_t y0, y1; /* Nearest output values */ + q31_t fract; /* fractional part */ + uint32_t index; /* Index to read nearest output values */ + + /* Input is in 12.20 format */ + /* 12 bits for the table index */ + /* Index value calculation */ + if (x < 0) + { + return (pYData[0]); + } + index = (x >> 20) & 0xfff; + + + if(index >= (nValues - 1)) + { + return (pYData[nValues - 1]); + } + else + { + + /* 20 bits for the fractional part */ + /* fract is in 12.20 format */ + fract = (x & 0x000FFFFF); + + /* Read two nearest output values from the index and are in 1.7(q7) format */ + y0 = pYData[index]; + y1 = pYData[index + 1u]; + + /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */ + y = ((y0 * (0xFFFFF - fract))); + + /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */ + y += (y1 * fract); + + /* convert y to 1.7(q7) format */ + return (y >> 20u); + + } + + } + /** + * @} end of LinearInterpolate group + */ + + /** + * @brief Fast approximation to the trigonometric sine function for floating-point data. + * @param[in] x input value in radians. + * @return sin(x). + */ + + float32_t arm_sin_f32( + float32_t x); + + /** + * @brief Fast approximation to the trigonometric sine function for Q31 data. + * @param[in] x Scaled input value in radians. + * @return sin(x). + */ + + q31_t arm_sin_q31( + q31_t x); + + /** + * @brief Fast approximation to the trigonometric sine function for Q15 data. + * @param[in] x Scaled input value in radians. + * @return sin(x). + */ + + q15_t arm_sin_q15( + q15_t x); + + /** + * @brief Fast approximation to the trigonometric cosine function for floating-point data. + * @param[in] x input value in radians. + * @return cos(x). + */ + + float32_t arm_cos_f32( + float32_t x); + + /** + * @brief Fast approximation to the trigonometric cosine function for Q31 data. + * @param[in] x Scaled input value in radians. + * @return cos(x). + */ + + q31_t arm_cos_q31( + q31_t x); + + /** + * @brief Fast approximation to the trigonometric cosine function for Q15 data. + * @param[in] x Scaled input value in radians. + * @return cos(x). + */ + + q15_t arm_cos_q15( + q15_t x); + + + /** + * @ingroup groupFastMath + */ + + + /** + * @defgroup SQRT Square Root + * + * Computes the square root of a number. + * There are separate functions for Q15, Q31, and floating-point data types. + * The square root function is computed using the Newton-Raphson algorithm. + * This is an iterative algorithm of the form: + *
+   *      x1 = x0 - f(x0)/f'(x0)
+   * 
+ * where x1 is the current estimate, + * x0 is the previous estimate, and + * f'(x0) is the derivative of f() evaluated at x0. + * For the square root function, the algorithm reduces to: + *
+   *     x0 = in/2                         [initial guess]
+   *     x1 = 1/2 * ( x0 + in / x0)        [each iteration]
+   * 
+ */ + + + /** + * @addtogroup SQRT + * @{ + */ + + /** + * @brief Floating-point square root function. + * @param[in] in input value. + * @param[out] *pOut square root of input value. + * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if + * in is negative value and returns zero output for negative values. + */ + + static __INLINE arm_status arm_sqrt_f32( + float32_t in, + float32_t * pOut) + { + if(in > 0) + { + +// #if __FPU_USED +#if (__FPU_USED == 1) && defined ( __CC_ARM ) + *pOut = __sqrtf(in); +#else + *pOut = sqrtf(in); +#endif + + return (ARM_MATH_SUCCESS); + } + else + { + *pOut = 0.0f; + return (ARM_MATH_ARGUMENT_ERROR); + } + + } + + + /** + * @brief Q31 square root function. + * @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF. + * @param[out] *pOut square root of input value. + * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if + * in is negative value and returns zero output for negative values. + */ + arm_status arm_sqrt_q31( + q31_t in, + q31_t * pOut); + + /** + * @brief Q15 square root function. + * @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF. + * @param[out] *pOut square root of input value. + * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if + * in is negative value and returns zero output for negative values. + */ + arm_status arm_sqrt_q15( + q15_t in, + q15_t * pOut); + + /** + * @} end of SQRT group + */ + + + + + + + /** + * @brief floating-point Circular write function. + */ + + static __INLINE void arm_circularWrite_f32( + int32_t * circBuffer, + int32_t L, + uint16_t * writeOffset, + int32_t bufferInc, + const int32_t * src, + int32_t srcInc, + uint32_t blockSize) + { + uint32_t i = 0u; + int32_t wOffset; + + /* Copy the value of Index pointer that points + * to the current location where the input samples to be copied */ + wOffset = *writeOffset; + + /* Loop over the blockSize */ + i = blockSize; + + while(i > 0u) + { + /* copy the input sample to the circular buffer */ + circBuffer[wOffset] = *src; + + /* Update the input pointer */ + src += srcInc; + + /* Circularly update wOffset. Watch out for positive and negative value */ + wOffset += bufferInc; + if(wOffset >= L) + wOffset -= L; + + /* Decrement the loop counter */ + i--; + } + + /* Update the index pointer */ + *writeOffset = wOffset; + } + + + + /** + * @brief floating-point Circular Read function. + */ + static __INLINE void arm_circularRead_f32( + int32_t * circBuffer, + int32_t L, + int32_t * readOffset, + int32_t bufferInc, + int32_t * dst, + int32_t * dst_base, + int32_t dst_length, + int32_t dstInc, + uint32_t blockSize) + { + uint32_t i = 0u; + int32_t rOffset, dst_end; + + /* Copy the value of Index pointer that points + * to the current location from where the input samples to be read */ + rOffset = *readOffset; + dst_end = (int32_t) (dst_base + dst_length); + + /* Loop over the blockSize */ + i = blockSize; + + while(i > 0u) + { + /* copy the sample from the circular buffer to the destination buffer */ + *dst = circBuffer[rOffset]; + + /* Update the input pointer */ + dst += dstInc; + + if(dst == (int32_t *) dst_end) + { + dst = dst_base; + } + + /* Circularly update rOffset. Watch out for positive and negative value */ + rOffset += bufferInc; + + if(rOffset >= L) + { + rOffset -= L; + } + + /* Decrement the loop counter */ + i--; + } + + /* Update the index pointer */ + *readOffset = rOffset; + } + + /** + * @brief Q15 Circular write function. + */ + + static __INLINE void arm_circularWrite_q15( + q15_t * circBuffer, + int32_t L, + uint16_t * writeOffset, + int32_t bufferInc, + const q15_t * src, + int32_t srcInc, + uint32_t blockSize) + { + uint32_t i = 0u; + int32_t wOffset; + + /* Copy the value of Index pointer that points + * to the current location where the input samples to be copied */ + wOffset = *writeOffset; + + /* Loop over the blockSize */ + i = blockSize; + + while(i > 0u) + { + /* copy the input sample to the circular buffer */ + circBuffer[wOffset] = *src; + + /* Update the input pointer */ + src += srcInc; + + /* Circularly update wOffset. Watch out for positive and negative value */ + wOffset += bufferInc; + if(wOffset >= L) + wOffset -= L; + + /* Decrement the loop counter */ + i--; + } + + /* Update the index pointer */ + *writeOffset = wOffset; + } + + + + /** + * @brief Q15 Circular Read function. + */ + static __INLINE void arm_circularRead_q15( + q15_t * circBuffer, + int32_t L, + int32_t * readOffset, + int32_t bufferInc, + q15_t * dst, + q15_t * dst_base, + int32_t dst_length, + int32_t dstInc, + uint32_t blockSize) + { + uint32_t i = 0; + int32_t rOffset, dst_end; + + /* Copy the value of Index pointer that points + * to the current location from where the input samples to be read */ + rOffset = *readOffset; + + dst_end = (int32_t) (dst_base + dst_length); + + /* Loop over the blockSize */ + i = blockSize; + + while(i > 0u) + { + /* copy the sample from the circular buffer to the destination buffer */ + *dst = circBuffer[rOffset]; + + /* Update the input pointer */ + dst += dstInc; + + if(dst == (q15_t *) dst_end) + { + dst = dst_base; + } + + /* Circularly update wOffset. Watch out for positive and negative value */ + rOffset += bufferInc; + + if(rOffset >= L) + { + rOffset -= L; + } + + /* Decrement the loop counter */ + i--; + } + + /* Update the index pointer */ + *readOffset = rOffset; + } + + + /** + * @brief Q7 Circular write function. + */ + + static __INLINE void arm_circularWrite_q7( + q7_t * circBuffer, + int32_t L, + uint16_t * writeOffset, + int32_t bufferInc, + const q7_t * src, + int32_t srcInc, + uint32_t blockSize) + { + uint32_t i = 0u; + int32_t wOffset; + + /* Copy the value of Index pointer that points + * to the current location where the input samples to be copied */ + wOffset = *writeOffset; + + /* Loop over the blockSize */ + i = blockSize; + + while(i > 0u) + { + /* copy the input sample to the circular buffer */ + circBuffer[wOffset] = *src; + + /* Update the input pointer */ + src += srcInc; + + /* Circularly update wOffset. Watch out for positive and negative value */ + wOffset += bufferInc; + if(wOffset >= L) + wOffset -= L; + + /* Decrement the loop counter */ + i--; + } + + /* Update the index pointer */ + *writeOffset = wOffset; + } + + + + /** + * @brief Q7 Circular Read function. + */ + static __INLINE void arm_circularRead_q7( + q7_t * circBuffer, + int32_t L, + int32_t * readOffset, + int32_t bufferInc, + q7_t * dst, + q7_t * dst_base, + int32_t dst_length, + int32_t dstInc, + uint32_t blockSize) + { + uint32_t i = 0; + int32_t rOffset, dst_end; + + /* Copy the value of Index pointer that points + * to the current location from where the input samples to be read */ + rOffset = *readOffset; + + dst_end = (int32_t) (dst_base + dst_length); + + /* Loop over the blockSize */ + i = blockSize; + + while(i > 0u) + { + /* copy the sample from the circular buffer to the destination buffer */ + *dst = circBuffer[rOffset]; + + /* Update the input pointer */ + dst += dstInc; + + if(dst == (q7_t *) dst_end) + { + dst = dst_base; + } + + /* Circularly update rOffset. Watch out for positive and negative value */ + rOffset += bufferInc; + + if(rOffset >= L) + { + rOffset -= L; + } + + /* Decrement the loop counter */ + i--; + } + + /* Update the index pointer */ + *readOffset = rOffset; + } + + + /** + * @brief Sum of the squares of the elements of a Q31 vector. + * @param[in] *pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] *pResult is output value. + * @return none. + */ + + void arm_power_q31( + q31_t * pSrc, + uint32_t blockSize, + q63_t * pResult); + + /** + * @brief Sum of the squares of the elements of a floating-point vector. + * @param[in] *pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] *pResult is output value. + * @return none. + */ + + void arm_power_f32( + float32_t * pSrc, + uint32_t blockSize, + float32_t * pResult); + + /** + * @brief Sum of the squares of the elements of a Q15 vector. + * @param[in] *pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] *pResult is output value. + * @return none. + */ + + void arm_power_q15( + q15_t * pSrc, + uint32_t blockSize, + q63_t * pResult); + + /** + * @brief Sum of the squares of the elements of a Q7 vector. + * @param[in] *pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] *pResult is output value. + * @return none. + */ + + void arm_power_q7( + q7_t * pSrc, + uint32_t blockSize, + q31_t * pResult); + + /** + * @brief Mean value of a Q7 vector. + * @param[in] *pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] *pResult is output value. + * @return none. + */ + + void arm_mean_q7( + q7_t * pSrc, + uint32_t blockSize, + q7_t * pResult); + + /** + * @brief Mean value of a Q15 vector. + * @param[in] *pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] *pResult is output value. + * @return none. + */ + void arm_mean_q15( + q15_t * pSrc, + uint32_t blockSize, + q15_t * pResult); + + /** + * @brief Mean value of a Q31 vector. + * @param[in] *pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] *pResult is output value. + * @return none. + */ + void arm_mean_q31( + q31_t * pSrc, + uint32_t blockSize, + q31_t * pResult); + + /** + * @brief Mean value of a floating-point vector. + * @param[in] *pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] *pResult is output value. + * @return none. + */ + void arm_mean_f32( + float32_t * pSrc, + uint32_t blockSize, + float32_t * pResult); + + /** + * @brief Variance of the elements of a floating-point vector. + * @param[in] *pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] *pResult is output value. + * @return none. + */ + + void arm_var_f32( + float32_t * pSrc, + uint32_t blockSize, + float32_t * pResult); + + /** + * @brief Variance of the elements of a Q31 vector. + * @param[in] *pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] *pResult is output value. + * @return none. + */ + + void arm_var_q31( + q31_t * pSrc, + uint32_t blockSize, + q31_t * pResult); + + /** + * @brief Variance of the elements of a Q15 vector. + * @param[in] *pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] *pResult is output value. + * @return none. + */ + + void arm_var_q15( + q15_t * pSrc, + uint32_t blockSize, + q15_t * pResult); + + /** + * @brief Root Mean Square of the elements of a floating-point vector. + * @param[in] *pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] *pResult is output value. + * @return none. + */ + + void arm_rms_f32( + float32_t * pSrc, + uint32_t blockSize, + float32_t * pResult); + + /** + * @brief Root Mean Square of the elements of a Q31 vector. + * @param[in] *pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] *pResult is output value. + * @return none. + */ + + void arm_rms_q31( + q31_t * pSrc, + uint32_t blockSize, + q31_t * pResult); + + /** + * @brief Root Mean Square of the elements of a Q15 vector. + * @param[in] *pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] *pResult is output value. + * @return none. + */ + + void arm_rms_q15( + q15_t * pSrc, + uint32_t blockSize, + q15_t * pResult); + + /** + * @brief Standard deviation of the elements of a floating-point vector. + * @param[in] *pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] *pResult is output value. + * @return none. + */ + + void arm_std_f32( + float32_t * pSrc, + uint32_t blockSize, + float32_t * pResult); + + /** + * @brief Standard deviation of the elements of a Q31 vector. + * @param[in] *pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] *pResult is output value. + * @return none. + */ + + void arm_std_q31( + q31_t * pSrc, + uint32_t blockSize, + q31_t * pResult); + + /** + * @brief Standard deviation of the elements of a Q15 vector. + * @param[in] *pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] *pResult is output value. + * @return none. + */ + + void arm_std_q15( + q15_t * pSrc, + uint32_t blockSize, + q15_t * pResult); + + /** + * @brief Floating-point complex magnitude + * @param[in] *pSrc points to the complex input vector + * @param[out] *pDst points to the real output vector + * @param[in] numSamples number of complex samples in the input vector + * @return none. + */ + + void arm_cmplx_mag_f32( + float32_t * pSrc, + float32_t * pDst, + uint32_t numSamples); + + /** + * @brief Q31 complex magnitude + * @param[in] *pSrc points to the complex input vector + * @param[out] *pDst points to the real output vector + * @param[in] numSamples number of complex samples in the input vector + * @return none. + */ + + void arm_cmplx_mag_q31( + q31_t * pSrc, + q31_t * pDst, + uint32_t numSamples); + + /** + * @brief Q15 complex magnitude + * @param[in] *pSrc points to the complex input vector + * @param[out] *pDst points to the real output vector + * @param[in] numSamples number of complex samples in the input vector + * @return none. + */ + + void arm_cmplx_mag_q15( + q15_t * pSrc, + q15_t * pDst, + uint32_t numSamples); + + /** + * @brief Q15 complex dot product + * @param[in] *pSrcA points to the first input vector + * @param[in] *pSrcB points to the second input vector + * @param[in] numSamples number of complex samples in each vector + * @param[out] *realResult real part of the result returned here + * @param[out] *imagResult imaginary part of the result returned here + * @return none. + */ + + void arm_cmplx_dot_prod_q15( + q15_t * pSrcA, + q15_t * pSrcB, + uint32_t numSamples, + q31_t * realResult, + q31_t * imagResult); + + /** + * @brief Q31 complex dot product + * @param[in] *pSrcA points to the first input vector + * @param[in] *pSrcB points to the second input vector + * @param[in] numSamples number of complex samples in each vector + * @param[out] *realResult real part of the result returned here + * @param[out] *imagResult imaginary part of the result returned here + * @return none. + */ + + void arm_cmplx_dot_prod_q31( + q31_t * pSrcA, + q31_t * pSrcB, + uint32_t numSamples, + q63_t * realResult, + q63_t * imagResult); + + /** + * @brief Floating-point complex dot product + * @param[in] *pSrcA points to the first input vector + * @param[in] *pSrcB points to the second input vector + * @param[in] numSamples number of complex samples in each vector + * @param[out] *realResult real part of the result returned here + * @param[out] *imagResult imaginary part of the result returned here + * @return none. + */ + + void arm_cmplx_dot_prod_f32( + float32_t * pSrcA, + float32_t * pSrcB, + uint32_t numSamples, + float32_t * realResult, + float32_t * imagResult); + + /** + * @brief Q15 complex-by-real multiplication + * @param[in] *pSrcCmplx points to the complex input vector + * @param[in] *pSrcReal points to the real input vector + * @param[out] *pCmplxDst points to the complex output vector + * @param[in] numSamples number of samples in each vector + * @return none. + */ + + void arm_cmplx_mult_real_q15( + q15_t * pSrcCmplx, + q15_t * pSrcReal, + q15_t * pCmplxDst, + uint32_t numSamples); + + /** + * @brief Q31 complex-by-real multiplication + * @param[in] *pSrcCmplx points to the complex input vector + * @param[in] *pSrcReal points to the real input vector + * @param[out] *pCmplxDst points to the complex output vector + * @param[in] numSamples number of samples in each vector + * @return none. + */ + + void arm_cmplx_mult_real_q31( + q31_t * pSrcCmplx, + q31_t * pSrcReal, + q31_t * pCmplxDst, + uint32_t numSamples); + + /** + * @brief Floating-point complex-by-real multiplication + * @param[in] *pSrcCmplx points to the complex input vector + * @param[in] *pSrcReal points to the real input vector + * @param[out] *pCmplxDst points to the complex output vector + * @param[in] numSamples number of samples in each vector + * @return none. + */ + + void arm_cmplx_mult_real_f32( + float32_t * pSrcCmplx, + float32_t * pSrcReal, + float32_t * pCmplxDst, + uint32_t numSamples); + + /** + * @brief Minimum value of a Q7 vector. + * @param[in] *pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] *result is output pointer + * @param[in] index is the array index of the minimum value in the input buffer. + * @return none. + */ + + void arm_min_q7( + q7_t * pSrc, + uint32_t blockSize, + q7_t * result, + uint32_t * index); + + /** + * @brief Minimum value of a Q15 vector. + * @param[in] *pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] *pResult is output pointer + * @param[in] *pIndex is the array index of the minimum value in the input buffer. + * @return none. + */ + + void arm_min_q15( + q15_t * pSrc, + uint32_t blockSize, + q15_t * pResult, + uint32_t * pIndex); + + /** + * @brief Minimum value of a Q31 vector. + * @param[in] *pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] *pResult is output pointer + * @param[out] *pIndex is the array index of the minimum value in the input buffer. + * @return none. + */ + void arm_min_q31( + q31_t * pSrc, + uint32_t blockSize, + q31_t * pResult, + uint32_t * pIndex); + + /** + * @brief Minimum value of a floating-point vector. + * @param[in] *pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] *pResult is output pointer + * @param[out] *pIndex is the array index of the minimum value in the input buffer. + * @return none. + */ + + void arm_min_f32( + float32_t * pSrc, + uint32_t blockSize, + float32_t * pResult, + uint32_t * pIndex); + +/** + * @brief Maximum value of a Q7 vector. + * @param[in] *pSrc points to the input buffer + * @param[in] blockSize length of the input vector + * @param[out] *pResult maximum value returned here + * @param[out] *pIndex index of maximum value returned here + * @return none. + */ + + void arm_max_q7( + q7_t * pSrc, + uint32_t blockSize, + q7_t * pResult, + uint32_t * pIndex); + +/** + * @brief Maximum value of a Q15 vector. + * @param[in] *pSrc points to the input buffer + * @param[in] blockSize length of the input vector + * @param[out] *pResult maximum value returned here + * @param[out] *pIndex index of maximum value returned here + * @return none. + */ + + void arm_max_q15( + q15_t * pSrc, + uint32_t blockSize, + q15_t * pResult, + uint32_t * pIndex); + +/** + * @brief Maximum value of a Q31 vector. + * @param[in] *pSrc points to the input buffer + * @param[in] blockSize length of the input vector + * @param[out] *pResult maximum value returned here + * @param[out] *pIndex index of maximum value returned here + * @return none. + */ + + void arm_max_q31( + q31_t * pSrc, + uint32_t blockSize, + q31_t * pResult, + uint32_t * pIndex); + +/** + * @brief Maximum value of a floating-point vector. + * @param[in] *pSrc points to the input buffer + * @param[in] blockSize length of the input vector + * @param[out] *pResult maximum value returned here + * @param[out] *pIndex index of maximum value returned here + * @return none. + */ + + void arm_max_f32( + float32_t * pSrc, + uint32_t blockSize, + float32_t * pResult, + uint32_t * pIndex); + + /** + * @brief Q15 complex-by-complex multiplication + * @param[in] *pSrcA points to the first input vector + * @param[in] *pSrcB points to the second input vector + * @param[out] *pDst points to the output vector + * @param[in] numSamples number of complex samples in each vector + * @return none. + */ + + void arm_cmplx_mult_cmplx_q15( + q15_t * pSrcA, + q15_t * pSrcB, + q15_t * pDst, + uint32_t numSamples); + + /** + * @brief Q31 complex-by-complex multiplication + * @param[in] *pSrcA points to the first input vector + * @param[in] *pSrcB points to the second input vector + * @param[out] *pDst points to the output vector + * @param[in] numSamples number of complex samples in each vector + * @return none. + */ + + void arm_cmplx_mult_cmplx_q31( + q31_t * pSrcA, + q31_t * pSrcB, + q31_t * pDst, + uint32_t numSamples); + + /** + * @brief Floating-point complex-by-complex multiplication + * @param[in] *pSrcA points to the first input vector + * @param[in] *pSrcB points to the second input vector + * @param[out] *pDst points to the output vector + * @param[in] numSamples number of complex samples in each vector + * @return none. + */ + + void arm_cmplx_mult_cmplx_f32( + float32_t * pSrcA, + float32_t * pSrcB, + float32_t * pDst, + uint32_t numSamples); + + /** + * @brief Converts the elements of the floating-point vector to Q31 vector. + * @param[in] *pSrc points to the floating-point input vector + * @param[out] *pDst points to the Q31 output vector + * @param[in] blockSize length of the input vector + * @return none. + */ + void arm_float_to_q31( + float32_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + /** + * @brief Converts the elements of the floating-point vector to Q15 vector. + * @param[in] *pSrc points to the floating-point input vector + * @param[out] *pDst points to the Q15 output vector + * @param[in] blockSize length of the input vector + * @return none + */ + void arm_float_to_q15( + float32_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + /** + * @brief Converts the elements of the floating-point vector to Q7 vector. + * @param[in] *pSrc points to the floating-point input vector + * @param[out] *pDst points to the Q7 output vector + * @param[in] blockSize length of the input vector + * @return none + */ + void arm_float_to_q7( + float32_t * pSrc, + q7_t * pDst, + uint32_t blockSize); + + + /** + * @brief Converts the elements of the Q31 vector to Q15 vector. + * @param[in] *pSrc is input pointer + * @param[out] *pDst is output pointer + * @param[in] blockSize is the number of samples to process + * @return none. + */ + void arm_q31_to_q15( + q31_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + /** + * @brief Converts the elements of the Q31 vector to Q7 vector. + * @param[in] *pSrc is input pointer + * @param[out] *pDst is output pointer + * @param[in] blockSize is the number of samples to process + * @return none. + */ + void arm_q31_to_q7( + q31_t * pSrc, + q7_t * pDst, + uint32_t blockSize); + + /** + * @brief Converts the elements of the Q15 vector to floating-point vector. + * @param[in] *pSrc is input pointer + * @param[out] *pDst is output pointer + * @param[in] blockSize is the number of samples to process + * @return none. + */ + void arm_q15_to_float( + q15_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + + /** + * @brief Converts the elements of the Q15 vector to Q31 vector. + * @param[in] *pSrc is input pointer + * @param[out] *pDst is output pointer + * @param[in] blockSize is the number of samples to process + * @return none. + */ + void arm_q15_to_q31( + q15_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + + /** + * @brief Converts the elements of the Q15 vector to Q7 vector. + * @param[in] *pSrc is input pointer + * @param[out] *pDst is output pointer + * @param[in] blockSize is the number of samples to process + * @return none. + */ + void arm_q15_to_q7( + q15_t * pSrc, + q7_t * pDst, + uint32_t blockSize); + + + /** + * @ingroup groupInterpolation + */ + + /** + * @defgroup BilinearInterpolate Bilinear Interpolation + * + * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid. + * The underlying function f(x, y) is sampled on a regular grid and the interpolation process + * determines values between the grid points. + * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension. + * Bilinear interpolation is often used in image processing to rescale images. + * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types. + * + * Algorithm + * \par + * The instance structure used by the bilinear interpolation functions describes a two dimensional data table. + * For floating-point, the instance structure is defined as: + *
+   *   typedef struct
+   *   {
+   *     uint16_t numRows;
+   *     uint16_t numCols;
+   *     float32_t *pData;
+   * } arm_bilinear_interp_instance_f32;
+   * 
+ * + * \par + * where numRows specifies the number of rows in the table; + * numCols specifies the number of columns in the table; + * and pData points to an array of size numRows*numCols values. + * The data table pTable is organized in row order and the supplied data values fall on integer indexes. + * That is, table element (x,y) is located at pTable[x + y*numCols] where x and y are integers. + * + * \par + * Let (x, y) specify the desired interpolation point. Then define: + *
+   *     XF = floor(x)
+   *     YF = floor(y)
+   * 
+ * \par + * The interpolated output point is computed as: + *
+   *  f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF))
+   *           + f(XF+1, YF) * (x-XF)*(1-(y-YF))
+   *           + f(XF, YF+1) * (1-(x-XF))*(y-YF)
+   *           + f(XF+1, YF+1) * (x-XF)*(y-YF)
+   * 
+ * Note that the coordinates (x, y) contain integer and fractional components. + * The integer components specify which portion of the table to use while the + * fractional components control the interpolation processor. + * + * \par + * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output. + */ + + /** + * @addtogroup BilinearInterpolate + * @{ + */ + + /** + * + * @brief Floating-point bilinear interpolation. + * @param[in,out] *S points to an instance of the interpolation structure. + * @param[in] X interpolation coordinate. + * @param[in] Y interpolation coordinate. + * @return out interpolated value. + */ + + + static __INLINE float32_t arm_bilinear_interp_f32( + const arm_bilinear_interp_instance_f32 * S, + float32_t X, + float32_t Y) + { + float32_t out; + float32_t f00, f01, f10, f11; + float32_t *pData = S->pData; + int32_t xIndex, yIndex, index; + float32_t xdiff, ydiff; + float32_t b1, b2, b3, b4; + + xIndex = (int32_t) X; + yIndex = (int32_t) Y; + + /* Care taken for table outside boundary */ + /* Returns zero output when values are outside table boundary */ + if(xIndex < 0 || xIndex > (S->numRows - 1) || yIndex < 0 + || yIndex > (S->numCols - 1)) + { + return (0); + } + + /* Calculation of index for two nearest points in X-direction */ + index = (xIndex - 1) + (yIndex - 1) * S->numCols; + + + /* Read two nearest points in X-direction */ + f00 = pData[index]; + f01 = pData[index + 1]; + + /* Calculation of index for two nearest points in Y-direction */ + index = (xIndex - 1) + (yIndex) * S->numCols; + + + /* Read two nearest points in Y-direction */ + f10 = pData[index]; + f11 = pData[index + 1]; + + /* Calculation of intermediate values */ + b1 = f00; + b2 = f01 - f00; + b3 = f10 - f00; + b4 = f00 - f01 - f10 + f11; + + /* Calculation of fractional part in X */ + xdiff = X - xIndex; + + /* Calculation of fractional part in Y */ + ydiff = Y - yIndex; + + /* Calculation of bi-linear interpolated output */ + out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff; + + /* return to application */ + return (out); + + } + + /** + * + * @brief Q31 bilinear interpolation. + * @param[in,out] *S points to an instance of the interpolation structure. + * @param[in] X interpolation coordinate in 12.20 format. + * @param[in] Y interpolation coordinate in 12.20 format. + * @return out interpolated value. + */ + + static __INLINE q31_t arm_bilinear_interp_q31( + arm_bilinear_interp_instance_q31 * S, + q31_t X, + q31_t Y) + { + q31_t out; /* Temporary output */ + q31_t acc = 0; /* output */ + q31_t xfract, yfract; /* X, Y fractional parts */ + q31_t x1, x2, y1, y2; /* Nearest output values */ + int32_t rI, cI; /* Row and column indices */ + q31_t *pYData = S->pData; /* pointer to output table values */ + uint32_t nCols = S->numCols; /* num of rows */ + + + /* Input is in 12.20 format */ + /* 12 bits for the table index */ + /* Index value calculation */ + rI = ((X & 0xFFF00000) >> 20u); + + /* Input is in 12.20 format */ + /* 12 bits for the table index */ + /* Index value calculation */ + cI = ((Y & 0xFFF00000) >> 20u); + + /* Care taken for table outside boundary */ + /* Returns zero output when values are outside table boundary */ + if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1)) + { + return (0); + } + + /* 20 bits for the fractional part */ + /* shift left xfract by 11 to keep 1.31 format */ + xfract = (X & 0x000FFFFF) << 11u; + + /* Read two nearest output values from the index */ + x1 = pYData[(rI) + nCols * (cI)]; + x2 = pYData[(rI) + nCols * (cI) + 1u]; + + /* 20 bits for the fractional part */ + /* shift left yfract by 11 to keep 1.31 format */ + yfract = (Y & 0x000FFFFF) << 11u; + + /* Read two nearest output values from the index */ + y1 = pYData[(rI) + nCols * (cI + 1)]; + y2 = pYData[(rI) + nCols * (cI + 1) + 1u]; + + /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */ + out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32)); + acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32)); + + /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */ + out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32)); + acc += ((q31_t) ((q63_t) out * (xfract) >> 32)); + + /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */ + out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32)); + acc += ((q31_t) ((q63_t) out * (yfract) >> 32)); + + /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */ + out = ((q31_t) ((q63_t) y2 * (xfract) >> 32)); + acc += ((q31_t) ((q63_t) out * (yfract) >> 32)); + + /* Convert acc to 1.31(q31) format */ + return (acc << 2u); + + } + + /** + * @brief Q15 bilinear interpolation. + * @param[in,out] *S points to an instance of the interpolation structure. + * @param[in] X interpolation coordinate in 12.20 format. + * @param[in] Y interpolation coordinate in 12.20 format. + * @return out interpolated value. + */ + + static __INLINE q15_t arm_bilinear_interp_q15( + arm_bilinear_interp_instance_q15 * S, + q31_t X, + q31_t Y) + { + q63_t acc = 0; /* output */ + q31_t out; /* Temporary output */ + q15_t x1, x2, y1, y2; /* Nearest output values */ + q31_t xfract, yfract; /* X, Y fractional parts */ + int32_t rI, cI; /* Row and column indices */ + q15_t *pYData = S->pData; /* pointer to output table values */ + uint32_t nCols = S->numCols; /* num of rows */ + + /* Input is in 12.20 format */ + /* 12 bits for the table index */ + /* Index value calculation */ + rI = ((X & 0xFFF00000) >> 20); + + /* Input is in 12.20 format */ + /* 12 bits for the table index */ + /* Index value calculation */ + cI = ((Y & 0xFFF00000) >> 20); + + /* Care taken for table outside boundary */ + /* Returns zero output when values are outside table boundary */ + if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1)) + { + return (0); + } + + /* 20 bits for the fractional part */ + /* xfract should be in 12.20 format */ + xfract = (X & 0x000FFFFF); + + /* Read two nearest output values from the index */ + x1 = pYData[(rI) + nCols * (cI)]; + x2 = pYData[(rI) + nCols * (cI) + 1u]; + + + /* 20 bits for the fractional part */ + /* yfract should be in 12.20 format */ + yfract = (Y & 0x000FFFFF); + + /* Read two nearest output values from the index */ + y1 = pYData[(rI) + nCols * (cI + 1)]; + y2 = pYData[(rI) + nCols * (cI + 1) + 1u]; + + /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */ + + /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */ + /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */ + out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4u); + acc = ((q63_t) out * (0xFFFFF - yfract)); + + /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */ + out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4u); + acc += ((q63_t) out * (xfract)); + + /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */ + out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4u); + acc += ((q63_t) out * (yfract)); + + /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */ + out = (q31_t) (((q63_t) y2 * (xfract)) >> 4u); + acc += ((q63_t) out * (yfract)); + + /* acc is in 13.51 format and down shift acc by 36 times */ + /* Convert out to 1.15 format */ + return (acc >> 36); + + } + + /** + * @brief Q7 bilinear interpolation. + * @param[in,out] *S points to an instance of the interpolation structure. + * @param[in] X interpolation coordinate in 12.20 format. + * @param[in] Y interpolation coordinate in 12.20 format. + * @return out interpolated value. + */ + + static __INLINE q7_t arm_bilinear_interp_q7( + arm_bilinear_interp_instance_q7 * S, + q31_t X, + q31_t Y) + { + q63_t acc = 0; /* output */ + q31_t out; /* Temporary output */ + q31_t xfract, yfract; /* X, Y fractional parts */ + q7_t x1, x2, y1, y2; /* Nearest output values */ + int32_t rI, cI; /* Row and column indices */ + q7_t *pYData = S->pData; /* pointer to output table values */ + uint32_t nCols = S->numCols; /* num of rows */ + + /* Input is in 12.20 format */ + /* 12 bits for the table index */ + /* Index value calculation */ + rI = ((X & 0xFFF00000) >> 20); + + /* Input is in 12.20 format */ + /* 12 bits for the table index */ + /* Index value calculation */ + cI = ((Y & 0xFFF00000) >> 20); + + /* Care taken for table outside boundary */ + /* Returns zero output when values are outside table boundary */ + if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1)) + { + return (0); + } + + /* 20 bits for the fractional part */ + /* xfract should be in 12.20 format */ + xfract = (X & 0x000FFFFF); + + /* Read two nearest output values from the index */ + x1 = pYData[(rI) + nCols * (cI)]; + x2 = pYData[(rI) + nCols * (cI) + 1u]; + + + /* 20 bits for the fractional part */ + /* yfract should be in 12.20 format */ + yfract = (Y & 0x000FFFFF); + + /* Read two nearest output values from the index */ + y1 = pYData[(rI) + nCols * (cI + 1)]; + y2 = pYData[(rI) + nCols * (cI + 1) + 1u]; + + /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */ + out = ((x1 * (0xFFFFF - xfract))); + acc = (((q63_t) out * (0xFFFFF - yfract))); + + /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */ + out = ((x2 * (0xFFFFF - yfract))); + acc += (((q63_t) out * (xfract))); + + /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */ + out = ((y1 * (0xFFFFF - xfract))); + acc += (((q63_t) out * (yfract))); + + /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */ + out = ((y2 * (yfract))); + acc += (((q63_t) out * (xfract))); + + /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */ + return (acc >> 40); + + } + + /** + * @} end of BilinearInterpolate group + */ + + +//SMMLAR +#define multAcc_32x32_keep32_R(a, x, y) \ + a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32) + +//SMMLSR +#define multSub_32x32_keep32_R(a, x, y) \ + a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32) + +//SMMULR +#define mult_32x32_keep32_R(a, x, y) \ + a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32) + +//SMMLA +#define multAcc_32x32_keep32(a, x, y) \ + a += (q31_t) (((q63_t) x * y) >> 32) + +//SMMLS +#define multSub_32x32_keep32(a, x, y) \ + a -= (q31_t) (((q63_t) x * y) >> 32) + +//SMMUL +#define mult_32x32_keep32(a, x, y) \ + a = (q31_t) (((q63_t) x * y ) >> 32) + + +#if defined ( __CC_ARM ) //Keil + +//Enter low optimization region - place directly above function definition + #ifdef ARM_MATH_CM4 + #define LOW_OPTIMIZATION_ENTER \ + _Pragma ("push") \ + _Pragma ("O1") + #else + #define LOW_OPTIMIZATION_ENTER + #endif + +//Exit low optimization region - place directly after end of function definition + #ifdef ARM_MATH_CM4 + #define LOW_OPTIMIZATION_EXIT \ + _Pragma ("pop") + #else + #define LOW_OPTIMIZATION_EXIT + #endif + +//Enter low optimization region - place directly above function definition + #define IAR_ONLY_LOW_OPTIMIZATION_ENTER + +//Exit low optimization region - place directly after end of function definition + #define IAR_ONLY_LOW_OPTIMIZATION_EXIT + +#elif defined(__ICCARM__) //IAR + +//Enter low optimization region - place directly above function definition + #ifdef ARM_MATH_CM4 + #define LOW_OPTIMIZATION_ENTER \ + _Pragma ("optimize=low") + #else + #define LOW_OPTIMIZATION_ENTER + #endif + +//Exit low optimization region - place directly after end of function definition + #define LOW_OPTIMIZATION_EXIT + +//Enter low optimization region - place directly above function definition + #ifdef ARM_MATH_CM4 + #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \ + _Pragma ("optimize=low") + #else + #define IAR_ONLY_LOW_OPTIMIZATION_ENTER + #endif + +//Exit low optimization region - place directly after end of function definition + #define IAR_ONLY_LOW_OPTIMIZATION_EXIT + +#elif defined(__GNUC__) + + #define LOW_OPTIMIZATION_ENTER __attribute__(( optimize("-O1") )) + + #define LOW_OPTIMIZATION_EXIT + + #define IAR_ONLY_LOW_OPTIMIZATION_ENTER + + #define IAR_ONLY_LOW_OPTIMIZATION_EXIT + +#elif defined(__CSMC__) // Cosmic + +#define LOW_OPTIMIZATION_ENTER +#define LOW_OPTIMIZATION_EXIT +#define IAR_ONLY_LOW_OPTIMIZATION_ENTER +#define IAR_ONLY_LOW_OPTIMIZATION_EXIT + +#endif + + +#ifdef __cplusplus +} +#endif + + +#endif /* _ARM_MATH_H */ + +/** + * + * End of file. + */ diff --git a/components/toolchain/gcc/core_cm0.h b/components/toolchain/gcc/core_cm0.h new file mode 100644 index 0000000..5186cb4 --- /dev/null +++ b/components/toolchain/gcc/core_cm0.h @@ -0,0 +1,711 @@ +/**************************************************************************//** + * @file core_cm0.h + * @brief CMSIS Cortex-M0 Core Peripheral Access Layer Header File + * @version V4.00 + * @date 22. August 2014 + * + * @note + * + ******************************************************************************/ +/* Copyright (c) 2009 - 2014 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. + ---------------------------------------------------------------------------*/ + + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#endif + +#ifndef __CORE_CM0_H_GENERIC +#define __CORE_CM0_H_GENERIC + +#ifdef __cplusplus + extern "C" { +#endif + +/** \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** \ingroup Cortex_M0 + @{ + */ + +/* CMSIS CM0 definitions */ +#define __CM0_CMSIS_VERSION_MAIN (0x04) /*!< [31:16] CMSIS HAL main version */ +#define __CM0_CMSIS_VERSION_SUB (0x00) /*!< [15:0] CMSIS HAL sub version */ +#define __CM0_CMSIS_VERSION ((__CM0_CMSIS_VERSION_MAIN << 16) | \ + __CM0_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */ + +#define __CORTEX_M (0x00) /*!< Cortex-M Core */ + + +#if defined ( __CC_ARM ) + #define __ASM __asm /*!< asm keyword for ARM Compiler */ + #define __INLINE __inline /*!< inline keyword for ARM Compiler */ + #define __STATIC_INLINE static __inline + +#elif defined ( __GNUC__ ) + #define __ASM __asm /*!< asm keyword for GNU Compiler */ + #define __INLINE inline /*!< inline keyword for GNU Compiler */ + #define __STATIC_INLINE static inline + +#elif defined ( __ICCARM__ ) + #define __ASM __asm /*!< asm keyword for IAR Compiler */ + #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */ + #define __STATIC_INLINE static inline + +#elif defined ( __TMS470__ ) + #define __ASM __asm /*!< asm keyword for TI CCS Compiler */ + #define __STATIC_INLINE static inline + +#elif defined ( __TASKING__ ) + #define __ASM __asm /*!< asm keyword for TASKING Compiler */ + #define __INLINE inline /*!< inline keyword for TASKING Compiler */ + #define __STATIC_INLINE static inline + +#elif defined ( __CSMC__ ) + #define __packed + #define __ASM _asm /*!< asm keyword for COSMIC Compiler */ + #define __INLINE inline /*use -pc99 on compile line !< inline keyword for COSMIC Compiler */ + #define __STATIC_INLINE static inline + +#endif + +/** __FPU_USED indicates whether an FPU is used or not. + This core does not support an FPU at all +*/ +#define __FPU_USED 0 + +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TMS470__ ) + #if defined __TI__VFP_SUPPORT____ + #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __CSMC__ ) /* Cosmic */ + #if ( __CSMC__ & 0x400) // FPU present for parser + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif +#endif + +#include /* standard types definitions */ +#include /* Core Instruction Access */ +#include /* Core Function Access */ + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM0_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_CM0_H_DEPENDANT +#define __CORE_CM0_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __CM0_REV + #define __CM0_REV 0x0000 + #warning "__CM0_REV not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 2 + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0 + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/*@} end of group Cortex_M0 */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + ******************************************************************************/ +/** \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { +#if (__CORTEX_M != 0x04) + uint32_t _reserved0:27; /*!< bit: 0..26 Reserved */ +#else + uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */ + uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ + uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */ +#endif + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + + +/** \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + + +/** \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ +#if (__CORTEX_M != 0x04) + uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */ +#else + uint32_t _reserved0:7; /*!< bit: 9..15 Reserved */ + uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ + uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */ +#endif + uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ + uint32_t IT:2; /*!< bit: 25..26 saved IT state (read 0) */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + + +/** \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ + uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ + uint32_t FPCA:1; /*!< bit: 2 FP extension active flag */ + uint32_t _reserved0:29; /*!< bit: 3..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/*@} end of group CMSIS_CORE */ + + +/** \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IO uint32_t ISER[1]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[31]; + __IO uint32_t ICER[1]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[31]; + __IO uint32_t ISPR[1]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[31]; + __IO uint32_t ICPR[1]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[31]; + uint32_t RESERVED4[64]; + __IO uint32_t IP[8]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */ +} NVIC_Type; + +/*@} end of group CMSIS_NVIC */ + + +/** \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __I uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IO uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ + uint32_t RESERVED0; + __IO uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IO uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IO uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + uint32_t RESERVED1; + __IO uint32_t SHP[2]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */ + __IO uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24 /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20 /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16 /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4 /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0 /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL << SCB_CPUID_REVISION_Pos) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_NMIPENDSET_Pos 31 /*!< SCB ICSR: NMIPENDSET Position */ +#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28 /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27 /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26 /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25 /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23 /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22 /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12 /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0 /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL << SCB_ICSR_VECTACTIVE_Pos) /*!< SCB ICSR: VECTACTIVE Mask */ + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16 /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16 /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15 /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2 /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1 /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4 /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2 /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1 /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_STKALIGN_Pos 9 /*!< SCB CCR: STKALIGN Position */ +#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3 /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_SVCALLPENDED_Pos 15 /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IO uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IO uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IO uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __I uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16 /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2 /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1 /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0 /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL << SysTick_CTRL_ENABLE_Pos) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0 /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL << SysTick_LOAD_RELOAD_Pos) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0 /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31 /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30 /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0 /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL << SysTick_CALIB_TENMS_Pos) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + + +/** \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Cortex-M0 Core Debug Registers (DCB registers, SHCSR, and DFSR) + are only accessible over DAP and not via processor. Therefore + they are not covered by the Cortex-M0 header file. + @{ + */ +/*@} end of group CMSIS_CoreDebug */ + + +/** \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Cortex-M0 Hardware */ +#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ +#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ +#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ +#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + +#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ +#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ +#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ + + +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Register Access Functions + ******************************************************************************/ +/** \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +/* Interrupt Priorities are WORD accessible only under ARMv6M */ +/* The following MACROS handle generation of the register offset and byte masks */ +#define _BIT_SHIFT(IRQn) ( (((uint32_t)(IRQn) ) & 0x03) * 8 ) +#define _SHP_IDX(IRQn) ( ((((uint32_t)(IRQn) & 0x0F)-8) >> 2) ) +#define _IP_IDX(IRQn) ( ((uint32_t)(IRQn) >> 2) ) + + +/** \brief Enable External Interrupt + + The function enables a device-specific interrupt in the NVIC interrupt controller. + + \param [in] IRQn External interrupt number. Value cannot be negative. + */ +__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn) +{ + NVIC->ISER[0] = (1 << ((uint32_t)(IRQn) & 0x1F)); +} + + +/** \brief Disable External Interrupt + + The function disables a device-specific interrupt in the NVIC interrupt controller. + + \param [in] IRQn External interrupt number. Value cannot be negative. + */ +__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn) +{ + NVIC->ICER[0] = (1 << ((uint32_t)(IRQn) & 0x1F)); +} + + +/** \brief Get Pending Interrupt + + The function reads the pending register in the NVIC and returns the pending bit + for the specified interrupt. + + \param [in] IRQn Interrupt number. + + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + */ +__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + return((uint32_t) ((NVIC->ISPR[0] & (1 << ((uint32_t)(IRQn) & 0x1F)))?1:0)); +} + + +/** \brief Set Pending Interrupt + + The function sets the pending bit of an external interrupt. + + \param [in] IRQn Interrupt number. Value cannot be negative. + */ +__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + NVIC->ISPR[0] = (1 << ((uint32_t)(IRQn) & 0x1F)); +} + + +/** \brief Clear Pending Interrupt + + The function clears the pending bit of an external interrupt. + + \param [in] IRQn External interrupt number. Value cannot be negative. + */ +__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + NVIC->ICPR[0] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* Clear pending interrupt */ +} + + +/** \brief Set Interrupt Priority + + The function sets the priority of an interrupt. + + \note The priority cannot be set for every core interrupt. + + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + */ +__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if(IRQn < 0) { + SCB->SHP[_SHP_IDX(IRQn)] = (SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFF << _BIT_SHIFT(IRQn))) | + (((priority << (8 - __NVIC_PRIO_BITS)) & 0xFF) << _BIT_SHIFT(IRQn)); } + else { + NVIC->IP[_IP_IDX(IRQn)] = (NVIC->IP[_IP_IDX(IRQn)] & ~(0xFF << _BIT_SHIFT(IRQn))) | + (((priority << (8 - __NVIC_PRIO_BITS)) & 0xFF) << _BIT_SHIFT(IRQn)); } +} + + +/** \brief Get Interrupt Priority + + The function reads the priority of an interrupt. The interrupt + number can be positive to specify an external (device specific) + interrupt, or negative to specify an internal (core) interrupt. + + + \param [in] IRQn Interrupt number. + \return Interrupt Priority. Value is aligned automatically to the implemented + priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn) +{ + + if(IRQn < 0) { + return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & 0xFF) >> (8 - __NVIC_PRIO_BITS))); } /* get priority for Cortex-M0 system interrupts */ + else { + return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & 0xFF) >> (8 - __NVIC_PRIO_BITS))); } /* get priority for device specific interrupts */ +} + + +/** \brief System Reset + + The function initiates a system reset request to reset the MCU. + */ +__STATIC_INLINE void NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = ((0x5FA << SCB_AIRCR_VECTKEY_Pos) | + SCB_AIRCR_SYSRESETREQ_Msk); + __DSB(); /* Ensure completion of memory access */ + while(1); /* wait until reset */ +} + +/*@} end of CMSIS_Core_NVICFunctions */ + + + +/* ################################## SysTick function ############################################ */ +/** \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if (__Vendor_SysTickConfig == 0) + +/** \brief System Tick Configuration + + The function initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + + \param [in] ticks Number of ticks between two interrupts. + + \return 0 Function succeeded. + \return 1 Function failed. + + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1) > SysTick_LOAD_RELOAD_Msk) return (1); /* Reload value impossible */ + + SysTick->LOAD = ticks - 1; /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1<<__NVIC_PRIO_BITS) - 1); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0); /* Function successful */ +} + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM0_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/components/toolchain/gcc/core_cm4.h b/components/toolchain/gcc/core_cm4.h new file mode 100644 index 0000000..bb6be13 --- /dev/null +++ b/components/toolchain/gcc/core_cm4.h @@ -0,0 +1,1802 @@ +/**************************************************************************//** + * @file core_cm4.h + * @brief CMSIS Cortex-M4 Core Peripheral Access Layer Header File + * @version V4.00 + * @date 22. August 2014 + * + * @note + * + ******************************************************************************/ +/* Copyright (c) 2009 - 2014 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. + ---------------------------------------------------------------------------*/ + + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#endif + +#ifndef __CORE_CM4_H_GENERIC +#define __CORE_CM4_H_GENERIC + +#ifdef __cplusplus + extern "C" { +#endif + +/** \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** \ingroup Cortex_M4 + @{ + */ + +/* CMSIS CM4 definitions */ +#define __CM4_CMSIS_VERSION_MAIN (0x04) /*!< [31:16] CMSIS HAL main version */ +#define __CM4_CMSIS_VERSION_SUB (0x00) /*!< [15:0] CMSIS HAL sub version */ +#define __CM4_CMSIS_VERSION ((__CM4_CMSIS_VERSION_MAIN << 16) | \ + __CM4_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */ + +#define __CORTEX_M (0x04) /*!< Cortex-M Core */ + + +#if defined ( __CC_ARM ) + #define __ASM __asm /*!< asm keyword for ARM Compiler */ + #define __INLINE __inline /*!< inline keyword for ARM Compiler */ + #define __STATIC_INLINE static __inline + +#elif defined ( __GNUC__ ) + #define __ASM __asm /*!< asm keyword for GNU Compiler */ + #define __INLINE inline /*!< inline keyword for GNU Compiler */ + #define __STATIC_INLINE static inline + +#elif defined ( __ICCARM__ ) + #define __ASM __asm /*!< asm keyword for IAR Compiler */ + #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */ + #define __STATIC_INLINE static inline + +#elif defined ( __TMS470__ ) + #define __ASM __asm /*!< asm keyword for TI CCS Compiler */ + #define __STATIC_INLINE static inline + +#elif defined ( __TASKING__ ) + #define __ASM __asm /*!< asm keyword for TASKING Compiler */ + #define __INLINE inline /*!< inline keyword for TASKING Compiler */ + #define __STATIC_INLINE static inline + +#elif defined ( __CSMC__ ) + #define __packed + #define __ASM _asm /*!< asm keyword for COSMIC Compiler */ + #define __INLINE inline /*use -pc99 on compile line !< inline keyword for COSMIC Compiler */ + #define __STATIC_INLINE static inline + +#endif + +/** __FPU_USED indicates whether an FPU is used or not. + For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions. +*/ +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #if (__FPU_PRESENT == 1) + #define __FPU_USED 1 + #else + #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0 + #endif + #else + #define __FPU_USED 0 + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #if (__FPU_PRESENT == 1) + #define __FPU_USED 1 + #else + #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0 + #endif + #else + #define __FPU_USED 0 + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #if (__FPU_PRESENT == 1) + #define __FPU_USED 1 + #else + #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0 + #endif + #else + #define __FPU_USED 0 + #endif + +#elif defined ( __TMS470__ ) + #if defined __TI_VFP_SUPPORT__ + #if (__FPU_PRESENT == 1) + #define __FPU_USED 1 + #else + #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0 + #endif + #else + #define __FPU_USED 0 + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #if (__FPU_PRESENT == 1) + #define __FPU_USED 1 + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0 + #endif + #else + #define __FPU_USED 0 + #endif + +#elif defined ( __CSMC__ ) /* Cosmic */ + #if ( __CSMC__ & 0x400) // FPU present for parser + #if (__FPU_PRESENT == 1) + #define __FPU_USED 1 + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0 + #endif + #else + #define __FPU_USED 0 + #endif +#endif + +#include /* standard types definitions */ +#include /* Core Instruction Access */ +#include /* Core Function Access */ +#include /* Compiler specific SIMD Intrinsics */ + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM4_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_CM4_H_DEPENDANT +#define __CORE_CM4_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __CM4_REV + #define __CM4_REV 0x0000 + #warning "__CM4_REV not defined in device header file; using default!" + #endif + + #ifndef __FPU_PRESENT + #define __FPU_PRESENT 0 + #warning "__FPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __MPU_PRESENT + #define __MPU_PRESENT 0 + #warning "__MPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 4 + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0 + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/*@} end of group Cortex_M4 */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + - Core Debug Register + - Core MPU Register + - Core FPU Register + ******************************************************************************/ +/** \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { +#if (__CORTEX_M != 0x04) + uint32_t _reserved0:27; /*!< bit: 0..26 Reserved */ +#else + uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */ + uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ + uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */ +#endif + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + + +/** \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + + +/** \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ +#if (__CORTEX_M != 0x04) + uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */ +#else + uint32_t _reserved0:7; /*!< bit: 9..15 Reserved */ + uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ + uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */ +#endif + uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ + uint32_t IT:2; /*!< bit: 25..26 saved IT state (read 0) */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + + +/** \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ + uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ + uint32_t FPCA:1; /*!< bit: 2 FP extension active flag */ + uint32_t _reserved0:29; /*!< bit: 3..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/*@} end of group CMSIS_CORE */ + + +/** \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IO uint32_t ISER[8]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[24]; + __IO uint32_t ICER[8]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[24]; + __IO uint32_t ISPR[8]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[24]; + __IO uint32_t ICPR[8]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[24]; + __IO uint32_t IABR[8]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */ + uint32_t RESERVED4[56]; + __IO uint8_t IP[240]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */ + uint32_t RESERVED5[644]; + __O uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */ +} NVIC_Type; + +/* Software Triggered Interrupt Register Definitions */ +#define NVIC_STIR_INTID_Pos 0 /*!< STIR: INTLINESNUM Position */ +#define NVIC_STIR_INTID_Msk (0x1FFUL << NVIC_STIR_INTID_Pos) /*!< STIR: INTLINESNUM Mask */ + +/*@} end of group CMSIS_NVIC */ + + +/** \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __I uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IO uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ + __IO uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ + __IO uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IO uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IO uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + __IO uint8_t SHP[12]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */ + __IO uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ + __IO uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */ + __IO uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */ + __IO uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */ + __IO uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */ + __IO uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */ + __IO uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */ + __I uint32_t PFR[2]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */ + __I uint32_t DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */ + __I uint32_t ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */ + __I uint32_t MMFR[4]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */ + __I uint32_t ISAR[5]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */ + uint32_t RESERVED0[5]; + __IO uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24 /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20 /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16 /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4 /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0 /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL << SCB_CPUID_REVISION_Pos) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_NMIPENDSET_Pos 31 /*!< SCB ICSR: NMIPENDSET Position */ +#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28 /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27 /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26 /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25 /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23 /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22 /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12 /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_RETTOBASE_Pos 11 /*!< SCB ICSR: RETTOBASE Position */ +#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0 /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL << SCB_ICSR_VECTACTIVE_Pos) /*!< SCB ICSR: VECTACTIVE Mask */ + +/* SCB Vector Table Offset Register Definitions */ +#define SCB_VTOR_TBLOFF_Pos 7 /*!< SCB VTOR: TBLOFF Position */ +#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16 /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16 /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15 /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_PRIGROUP_Pos 8 /*!< SCB AIRCR: PRIGROUP Position */ +#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2 /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1 /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +#define SCB_AIRCR_VECTRESET_Pos 0 /*!< SCB AIRCR: VECTRESET Position */ +#define SCB_AIRCR_VECTRESET_Msk (1UL << SCB_AIRCR_VECTRESET_Pos) /*!< SCB AIRCR: VECTRESET Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4 /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2 /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1 /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_STKALIGN_Pos 9 /*!< SCB CCR: STKALIGN Position */ +#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ + +#define SCB_CCR_BFHFNMIGN_Pos 8 /*!< SCB CCR: BFHFNMIGN Position */ +#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */ + +#define SCB_CCR_DIV_0_TRP_Pos 4 /*!< SCB CCR: DIV_0_TRP Position */ +#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3 /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +#define SCB_CCR_USERSETMPEND_Pos 1 /*!< SCB CCR: USERSETMPEND Position */ +#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */ + +#define SCB_CCR_NONBASETHRDENA_Pos 0 /*!< SCB CCR: NONBASETHRDENA Position */ +#define SCB_CCR_NONBASETHRDENA_Msk (1UL << SCB_CCR_NONBASETHRDENA_Pos) /*!< SCB CCR: NONBASETHRDENA Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_USGFAULTENA_Pos 18 /*!< SCB SHCSR: USGFAULTENA Position */ +#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */ + +#define SCB_SHCSR_BUSFAULTENA_Pos 17 /*!< SCB SHCSR: BUSFAULTENA Position */ +#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */ + +#define SCB_SHCSR_MEMFAULTENA_Pos 16 /*!< SCB SHCSR: MEMFAULTENA Position */ +#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */ + +#define SCB_SHCSR_SVCALLPENDED_Pos 15 /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +#define SCB_SHCSR_BUSFAULTPENDED_Pos 14 /*!< SCB SHCSR: BUSFAULTPENDED Position */ +#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */ + +#define SCB_SHCSR_MEMFAULTPENDED_Pos 13 /*!< SCB SHCSR: MEMFAULTPENDED Position */ +#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */ + +#define SCB_SHCSR_USGFAULTPENDED_Pos 12 /*!< SCB SHCSR: USGFAULTPENDED Position */ +#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */ + +#define SCB_SHCSR_SYSTICKACT_Pos 11 /*!< SCB SHCSR: SYSTICKACT Position */ +#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */ + +#define SCB_SHCSR_PENDSVACT_Pos 10 /*!< SCB SHCSR: PENDSVACT Position */ +#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */ + +#define SCB_SHCSR_MONITORACT_Pos 8 /*!< SCB SHCSR: MONITORACT Position */ +#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */ + +#define SCB_SHCSR_SVCALLACT_Pos 7 /*!< SCB SHCSR: SVCALLACT Position */ +#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */ + +#define SCB_SHCSR_USGFAULTACT_Pos 3 /*!< SCB SHCSR: USGFAULTACT Position */ +#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */ + +#define SCB_SHCSR_BUSFAULTACT_Pos 1 /*!< SCB SHCSR: BUSFAULTACT Position */ +#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */ + +#define SCB_SHCSR_MEMFAULTACT_Pos 0 /*!< SCB SHCSR: MEMFAULTACT Position */ +#define SCB_SHCSR_MEMFAULTACT_Msk (1UL << SCB_SHCSR_MEMFAULTACT_Pos) /*!< SCB SHCSR: MEMFAULTACT Mask */ + +/* SCB Configurable Fault Status Registers Definitions */ +#define SCB_CFSR_USGFAULTSR_Pos 16 /*!< SCB CFSR: Usage Fault Status Register Position */ +#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */ + +#define SCB_CFSR_BUSFAULTSR_Pos 8 /*!< SCB CFSR: Bus Fault Status Register Position */ +#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */ + +#define SCB_CFSR_MEMFAULTSR_Pos 0 /*!< SCB CFSR: Memory Manage Fault Status Register Position */ +#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL << SCB_CFSR_MEMFAULTSR_Pos) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */ + +/* SCB Hard Fault Status Registers Definitions */ +#define SCB_HFSR_DEBUGEVT_Pos 31 /*!< SCB HFSR: DEBUGEVT Position */ +#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */ + +#define SCB_HFSR_FORCED_Pos 30 /*!< SCB HFSR: FORCED Position */ +#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */ + +#define SCB_HFSR_VECTTBL_Pos 1 /*!< SCB HFSR: VECTTBL Position */ +#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */ + +/* SCB Debug Fault Status Register Definitions */ +#define SCB_DFSR_EXTERNAL_Pos 4 /*!< SCB DFSR: EXTERNAL Position */ +#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */ + +#define SCB_DFSR_VCATCH_Pos 3 /*!< SCB DFSR: VCATCH Position */ +#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */ + +#define SCB_DFSR_DWTTRAP_Pos 2 /*!< SCB DFSR: DWTTRAP Position */ +#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */ + +#define SCB_DFSR_BKPT_Pos 1 /*!< SCB DFSR: BKPT Position */ +#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */ + +#define SCB_DFSR_HALTED_Pos 0 /*!< SCB DFSR: HALTED Position */ +#define SCB_DFSR_HALTED_Msk (1UL << SCB_DFSR_HALTED_Pos) /*!< SCB DFSR: HALTED Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** \ingroup CMSIS_core_register + \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB) + \brief Type definitions for the System Control and ID Register not in the SCB + @{ + */ + +/** \brief Structure type to access the System Control and ID Register not in the SCB. + */ +typedef struct +{ + uint32_t RESERVED0[1]; + __I uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */ + __IO uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */ +} SCnSCB_Type; + +/* Interrupt Controller Type Register Definitions */ +#define SCnSCB_ICTR_INTLINESNUM_Pos 0 /*!< ICTR: INTLINESNUM Position */ +#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL << SCnSCB_ICTR_INTLINESNUM_Pos) /*!< ICTR: INTLINESNUM Mask */ + +/* Auxiliary Control Register Definitions */ +#define SCnSCB_ACTLR_DISOOFP_Pos 9 /*!< ACTLR: DISOOFP Position */ +#define SCnSCB_ACTLR_DISOOFP_Msk (1UL << SCnSCB_ACTLR_DISOOFP_Pos) /*!< ACTLR: DISOOFP Mask */ + +#define SCnSCB_ACTLR_DISFPCA_Pos 8 /*!< ACTLR: DISFPCA Position */ +#define SCnSCB_ACTLR_DISFPCA_Msk (1UL << SCnSCB_ACTLR_DISFPCA_Pos) /*!< ACTLR: DISFPCA Mask */ + +#define SCnSCB_ACTLR_DISFOLD_Pos 2 /*!< ACTLR: DISFOLD Position */ +#define SCnSCB_ACTLR_DISFOLD_Msk (1UL << SCnSCB_ACTLR_DISFOLD_Pos) /*!< ACTLR: DISFOLD Mask */ + +#define SCnSCB_ACTLR_DISDEFWBUF_Pos 1 /*!< ACTLR: DISDEFWBUF Position */ +#define SCnSCB_ACTLR_DISDEFWBUF_Msk (1UL << SCnSCB_ACTLR_DISDEFWBUF_Pos) /*!< ACTLR: DISDEFWBUF Mask */ + +#define SCnSCB_ACTLR_DISMCYCINT_Pos 0 /*!< ACTLR: DISMCYCINT Position */ +#define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL << SCnSCB_ACTLR_DISMCYCINT_Pos) /*!< ACTLR: DISMCYCINT Mask */ + +/*@} end of group CMSIS_SCnotSCB */ + + +/** \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IO uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IO uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IO uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __I uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16 /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2 /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1 /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0 /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL << SysTick_CTRL_ENABLE_Pos) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0 /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL << SysTick_LOAD_RELOAD_Pos) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0 /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31 /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30 /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0 /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL << SysTick_CALIB_TENMS_Pos) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + + +/** \ingroup CMSIS_core_register + \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM) + \brief Type definitions for the Instrumentation Trace Macrocell (ITM) + @{ + */ + +/** \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM). + */ +typedef struct +{ + __O union + { + __O uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */ + __O uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */ + __O uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */ + } PORT [32]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */ + uint32_t RESERVED0[864]; + __IO uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */ + uint32_t RESERVED1[15]; + __IO uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */ + uint32_t RESERVED2[15]; + __IO uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */ + uint32_t RESERVED3[29]; + __O uint32_t IWR; /*!< Offset: 0xEF8 ( /W) ITM Integration Write Register */ + __I uint32_t IRR; /*!< Offset: 0xEFC (R/ ) ITM Integration Read Register */ + __IO uint32_t IMCR; /*!< Offset: 0xF00 (R/W) ITM Integration Mode Control Register */ + uint32_t RESERVED4[43]; + __O uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */ + __I uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */ + uint32_t RESERVED5[6]; + __I uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */ + __I uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */ + __I uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */ + __I uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */ + __I uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */ + __I uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */ + __I uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */ + __I uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */ + __I uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */ + __I uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */ + __I uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */ + __I uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */ +} ITM_Type; + +/* ITM Trace Privilege Register Definitions */ +#define ITM_TPR_PRIVMASK_Pos 0 /*!< ITM TPR: PRIVMASK Position */ +#define ITM_TPR_PRIVMASK_Msk (0xFUL << ITM_TPR_PRIVMASK_Pos) /*!< ITM TPR: PRIVMASK Mask */ + +/* ITM Trace Control Register Definitions */ +#define ITM_TCR_BUSY_Pos 23 /*!< ITM TCR: BUSY Position */ +#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */ + +#define ITM_TCR_TraceBusID_Pos 16 /*!< ITM TCR: ATBID Position */ +#define ITM_TCR_TraceBusID_Msk (0x7FUL << ITM_TCR_TraceBusID_Pos) /*!< ITM TCR: ATBID Mask */ + +#define ITM_TCR_GTSFREQ_Pos 10 /*!< ITM TCR: Global timestamp frequency Position */ +#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */ + +#define ITM_TCR_TSPrescale_Pos 8 /*!< ITM TCR: TSPrescale Position */ +#define ITM_TCR_TSPrescale_Msk (3UL << ITM_TCR_TSPrescale_Pos) /*!< ITM TCR: TSPrescale Mask */ + +#define ITM_TCR_SWOENA_Pos 4 /*!< ITM TCR: SWOENA Position */ +#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */ + +#define ITM_TCR_DWTENA_Pos 3 /*!< ITM TCR: DWTENA Position */ +#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */ + +#define ITM_TCR_SYNCENA_Pos 2 /*!< ITM TCR: SYNCENA Position */ +#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */ + +#define ITM_TCR_TSENA_Pos 1 /*!< ITM TCR: TSENA Position */ +#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */ + +#define ITM_TCR_ITMENA_Pos 0 /*!< ITM TCR: ITM Enable bit Position */ +#define ITM_TCR_ITMENA_Msk (1UL << ITM_TCR_ITMENA_Pos) /*!< ITM TCR: ITM Enable bit Mask */ + +/* ITM Integration Write Register Definitions */ +#define ITM_IWR_ATVALIDM_Pos 0 /*!< ITM IWR: ATVALIDM Position */ +#define ITM_IWR_ATVALIDM_Msk (1UL << ITM_IWR_ATVALIDM_Pos) /*!< ITM IWR: ATVALIDM Mask */ + +/* ITM Integration Read Register Definitions */ +#define ITM_IRR_ATREADYM_Pos 0 /*!< ITM IRR: ATREADYM Position */ +#define ITM_IRR_ATREADYM_Msk (1UL << ITM_IRR_ATREADYM_Pos) /*!< ITM IRR: ATREADYM Mask */ + +/* ITM Integration Mode Control Register Definitions */ +#define ITM_IMCR_INTEGRATION_Pos 0 /*!< ITM IMCR: INTEGRATION Position */ +#define ITM_IMCR_INTEGRATION_Msk (1UL << ITM_IMCR_INTEGRATION_Pos) /*!< ITM IMCR: INTEGRATION Mask */ + +/* ITM Lock Status Register Definitions */ +#define ITM_LSR_ByteAcc_Pos 2 /*!< ITM LSR: ByteAcc Position */ +#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */ + +#define ITM_LSR_Access_Pos 1 /*!< ITM LSR: Access Position */ +#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */ + +#define ITM_LSR_Present_Pos 0 /*!< ITM LSR: Present Position */ +#define ITM_LSR_Present_Msk (1UL << ITM_LSR_Present_Pos) /*!< ITM LSR: Present Mask */ + +/*@}*/ /* end of group CMSIS_ITM */ + + +/** \ingroup CMSIS_core_register + \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT) + \brief Type definitions for the Data Watchpoint and Trace (DWT) + @{ + */ + +/** \brief Structure type to access the Data Watchpoint and Trace Register (DWT). + */ +typedef struct +{ + __IO uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ + __IO uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ + __IO uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */ + __IO uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */ + __IO uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */ + __IO uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */ + __IO uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */ + __I uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */ + __IO uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */ + __IO uint32_t MASK0; /*!< Offset: 0x024 (R/W) Mask Register 0 */ + __IO uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */ + uint32_t RESERVED0[1]; + __IO uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */ + __IO uint32_t MASK1; /*!< Offset: 0x034 (R/W) Mask Register 1 */ + __IO uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */ + uint32_t RESERVED1[1]; + __IO uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */ + __IO uint32_t MASK2; /*!< Offset: 0x044 (R/W) Mask Register 2 */ + __IO uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */ + uint32_t RESERVED2[1]; + __IO uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */ + __IO uint32_t MASK3; /*!< Offset: 0x054 (R/W) Mask Register 3 */ + __IO uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */ +} DWT_Type; + +/* DWT Control Register Definitions */ +#define DWT_CTRL_NUMCOMP_Pos 28 /*!< DWT CTRL: NUMCOMP Position */ +#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */ + +#define DWT_CTRL_NOTRCPKT_Pos 27 /*!< DWT CTRL: NOTRCPKT Position */ +#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */ + +#define DWT_CTRL_NOEXTTRIG_Pos 26 /*!< DWT CTRL: NOEXTTRIG Position */ +#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */ + +#define DWT_CTRL_NOCYCCNT_Pos 25 /*!< DWT CTRL: NOCYCCNT Position */ +#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */ + +#define DWT_CTRL_NOPRFCNT_Pos 24 /*!< DWT CTRL: NOPRFCNT Position */ +#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */ + +#define DWT_CTRL_CYCEVTENA_Pos 22 /*!< DWT CTRL: CYCEVTENA Position */ +#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */ + +#define DWT_CTRL_FOLDEVTENA_Pos 21 /*!< DWT CTRL: FOLDEVTENA Position */ +#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */ + +#define DWT_CTRL_LSUEVTENA_Pos 20 /*!< DWT CTRL: LSUEVTENA Position */ +#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */ + +#define DWT_CTRL_SLEEPEVTENA_Pos 19 /*!< DWT CTRL: SLEEPEVTENA Position */ +#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */ + +#define DWT_CTRL_EXCEVTENA_Pos 18 /*!< DWT CTRL: EXCEVTENA Position */ +#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */ + +#define DWT_CTRL_CPIEVTENA_Pos 17 /*!< DWT CTRL: CPIEVTENA Position */ +#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */ + +#define DWT_CTRL_EXCTRCENA_Pos 16 /*!< DWT CTRL: EXCTRCENA Position */ +#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */ + +#define DWT_CTRL_PCSAMPLENA_Pos 12 /*!< DWT CTRL: PCSAMPLENA Position */ +#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */ + +#define DWT_CTRL_SYNCTAP_Pos 10 /*!< DWT CTRL: SYNCTAP Position */ +#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */ + +#define DWT_CTRL_CYCTAP_Pos 9 /*!< DWT CTRL: CYCTAP Position */ +#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */ + +#define DWT_CTRL_POSTINIT_Pos 5 /*!< DWT CTRL: POSTINIT Position */ +#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */ + +#define DWT_CTRL_POSTPRESET_Pos 1 /*!< DWT CTRL: POSTPRESET Position */ +#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */ + +#define DWT_CTRL_CYCCNTENA_Pos 0 /*!< DWT CTRL: CYCCNTENA Position */ +#define DWT_CTRL_CYCCNTENA_Msk (0x1UL << DWT_CTRL_CYCCNTENA_Pos) /*!< DWT CTRL: CYCCNTENA Mask */ + +/* DWT CPI Count Register Definitions */ +#define DWT_CPICNT_CPICNT_Pos 0 /*!< DWT CPICNT: CPICNT Position */ +#define DWT_CPICNT_CPICNT_Msk (0xFFUL << DWT_CPICNT_CPICNT_Pos) /*!< DWT CPICNT: CPICNT Mask */ + +/* DWT Exception Overhead Count Register Definitions */ +#define DWT_EXCCNT_EXCCNT_Pos 0 /*!< DWT EXCCNT: EXCCNT Position */ +#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL << DWT_EXCCNT_EXCCNT_Pos) /*!< DWT EXCCNT: EXCCNT Mask */ + +/* DWT Sleep Count Register Definitions */ +#define DWT_SLEEPCNT_SLEEPCNT_Pos 0 /*!< DWT SLEEPCNT: SLEEPCNT Position */ +#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL << DWT_SLEEPCNT_SLEEPCNT_Pos) /*!< DWT SLEEPCNT: SLEEPCNT Mask */ + +/* DWT LSU Count Register Definitions */ +#define DWT_LSUCNT_LSUCNT_Pos 0 /*!< DWT LSUCNT: LSUCNT Position */ +#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL << DWT_LSUCNT_LSUCNT_Pos) /*!< DWT LSUCNT: LSUCNT Mask */ + +/* DWT Folded-instruction Count Register Definitions */ +#define DWT_FOLDCNT_FOLDCNT_Pos 0 /*!< DWT FOLDCNT: FOLDCNT Position */ +#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL << DWT_FOLDCNT_FOLDCNT_Pos) /*!< DWT FOLDCNT: FOLDCNT Mask */ + +/* DWT Comparator Mask Register Definitions */ +#define DWT_MASK_MASK_Pos 0 /*!< DWT MASK: MASK Position */ +#define DWT_MASK_MASK_Msk (0x1FUL << DWT_MASK_MASK_Pos) /*!< DWT MASK: MASK Mask */ + +/* DWT Comparator Function Register Definitions */ +#define DWT_FUNCTION_MATCHED_Pos 24 /*!< DWT FUNCTION: MATCHED Position */ +#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */ + +#define DWT_FUNCTION_DATAVADDR1_Pos 16 /*!< DWT FUNCTION: DATAVADDR1 Position */ +#define DWT_FUNCTION_DATAVADDR1_Msk (0xFUL << DWT_FUNCTION_DATAVADDR1_Pos) /*!< DWT FUNCTION: DATAVADDR1 Mask */ + +#define DWT_FUNCTION_DATAVADDR0_Pos 12 /*!< DWT FUNCTION: DATAVADDR0 Position */ +#define DWT_FUNCTION_DATAVADDR0_Msk (0xFUL << DWT_FUNCTION_DATAVADDR0_Pos) /*!< DWT FUNCTION: DATAVADDR0 Mask */ + +#define DWT_FUNCTION_DATAVSIZE_Pos 10 /*!< DWT FUNCTION: DATAVSIZE Position */ +#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */ + +#define DWT_FUNCTION_LNK1ENA_Pos 9 /*!< DWT FUNCTION: LNK1ENA Position */ +#define DWT_FUNCTION_LNK1ENA_Msk (0x1UL << DWT_FUNCTION_LNK1ENA_Pos) /*!< DWT FUNCTION: LNK1ENA Mask */ + +#define DWT_FUNCTION_DATAVMATCH_Pos 8 /*!< DWT FUNCTION: DATAVMATCH Position */ +#define DWT_FUNCTION_DATAVMATCH_Msk (0x1UL << DWT_FUNCTION_DATAVMATCH_Pos) /*!< DWT FUNCTION: DATAVMATCH Mask */ + +#define DWT_FUNCTION_CYCMATCH_Pos 7 /*!< DWT FUNCTION: CYCMATCH Position */ +#define DWT_FUNCTION_CYCMATCH_Msk (0x1UL << DWT_FUNCTION_CYCMATCH_Pos) /*!< DWT FUNCTION: CYCMATCH Mask */ + +#define DWT_FUNCTION_EMITRANGE_Pos 5 /*!< DWT FUNCTION: EMITRANGE Position */ +#define DWT_FUNCTION_EMITRANGE_Msk (0x1UL << DWT_FUNCTION_EMITRANGE_Pos) /*!< DWT FUNCTION: EMITRANGE Mask */ + +#define DWT_FUNCTION_FUNCTION_Pos 0 /*!< DWT FUNCTION: FUNCTION Position */ +#define DWT_FUNCTION_FUNCTION_Msk (0xFUL << DWT_FUNCTION_FUNCTION_Pos) /*!< DWT FUNCTION: FUNCTION Mask */ + +/*@}*/ /* end of group CMSIS_DWT */ + + +/** \ingroup CMSIS_core_register + \defgroup CMSIS_TPI Trace Port Interface (TPI) + \brief Type definitions for the Trace Port Interface (TPI) + @{ + */ + +/** \brief Structure type to access the Trace Port Interface Register (TPI). + */ +typedef struct +{ + __IO uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */ + __IO uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */ + uint32_t RESERVED0[2]; + __IO uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */ + uint32_t RESERVED1[55]; + __IO uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */ + uint32_t RESERVED2[131]; + __I uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */ + __IO uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */ + __I uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */ + uint32_t RESERVED3[759]; + __I uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER */ + __I uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */ + __I uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */ + uint32_t RESERVED4[1]; + __I uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */ + __I uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */ + __IO uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */ + uint32_t RESERVED5[39]; + __IO uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */ + __IO uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */ + uint32_t RESERVED7[8]; + __I uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */ + __I uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */ +} TPI_Type; + +/* TPI Asynchronous Clock Prescaler Register Definitions */ +#define TPI_ACPR_PRESCALER_Pos 0 /*!< TPI ACPR: PRESCALER Position */ +#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL << TPI_ACPR_PRESCALER_Pos) /*!< TPI ACPR: PRESCALER Mask */ + +/* TPI Selected Pin Protocol Register Definitions */ +#define TPI_SPPR_TXMODE_Pos 0 /*!< TPI SPPR: TXMODE Position */ +#define TPI_SPPR_TXMODE_Msk (0x3UL << TPI_SPPR_TXMODE_Pos) /*!< TPI SPPR: TXMODE Mask */ + +/* TPI Formatter and Flush Status Register Definitions */ +#define TPI_FFSR_FtNonStop_Pos 3 /*!< TPI FFSR: FtNonStop Position */ +#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */ + +#define TPI_FFSR_TCPresent_Pos 2 /*!< TPI FFSR: TCPresent Position */ +#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */ + +#define TPI_FFSR_FtStopped_Pos 1 /*!< TPI FFSR: FtStopped Position */ +#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */ + +#define TPI_FFSR_FlInProg_Pos 0 /*!< TPI FFSR: FlInProg Position */ +#define TPI_FFSR_FlInProg_Msk (0x1UL << TPI_FFSR_FlInProg_Pos) /*!< TPI FFSR: FlInProg Mask */ + +/* TPI Formatter and Flush Control Register Definitions */ +#define TPI_FFCR_TrigIn_Pos 8 /*!< TPI FFCR: TrigIn Position */ +#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */ + +#define TPI_FFCR_EnFCont_Pos 1 /*!< TPI FFCR: EnFCont Position */ +#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */ + +/* TPI TRIGGER Register Definitions */ +#define TPI_TRIGGER_TRIGGER_Pos 0 /*!< TPI TRIGGER: TRIGGER Position */ +#define TPI_TRIGGER_TRIGGER_Msk (0x1UL << TPI_TRIGGER_TRIGGER_Pos) /*!< TPI TRIGGER: TRIGGER Mask */ + +/* TPI Integration ETM Data Register Definitions (FIFO0) */ +#define TPI_FIFO0_ITM_ATVALID_Pos 29 /*!< TPI FIFO0: ITM_ATVALID Position */ +#define TPI_FIFO0_ITM_ATVALID_Msk (0x3UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */ + +#define TPI_FIFO0_ITM_bytecount_Pos 27 /*!< TPI FIFO0: ITM_bytecount Position */ +#define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */ + +#define TPI_FIFO0_ETM_ATVALID_Pos 26 /*!< TPI FIFO0: ETM_ATVALID Position */ +#define TPI_FIFO0_ETM_ATVALID_Msk (0x3UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */ + +#define TPI_FIFO0_ETM_bytecount_Pos 24 /*!< TPI FIFO0: ETM_bytecount Position */ +#define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */ + +#define TPI_FIFO0_ETM2_Pos 16 /*!< TPI FIFO0: ETM2 Position */ +#define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */ + +#define TPI_FIFO0_ETM1_Pos 8 /*!< TPI FIFO0: ETM1 Position */ +#define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */ + +#define TPI_FIFO0_ETM0_Pos 0 /*!< TPI FIFO0: ETM0 Position */ +#define TPI_FIFO0_ETM0_Msk (0xFFUL << TPI_FIFO0_ETM0_Pos) /*!< TPI FIFO0: ETM0 Mask */ + +/* TPI ITATBCTR2 Register Definitions */ +#define TPI_ITATBCTR2_ATREADY_Pos 0 /*!< TPI ITATBCTR2: ATREADY Position */ +#define TPI_ITATBCTR2_ATREADY_Msk (0x1UL << TPI_ITATBCTR2_ATREADY_Pos) /*!< TPI ITATBCTR2: ATREADY Mask */ + +/* TPI Integration ITM Data Register Definitions (FIFO1) */ +#define TPI_FIFO1_ITM_ATVALID_Pos 29 /*!< TPI FIFO1: ITM_ATVALID Position */ +#define TPI_FIFO1_ITM_ATVALID_Msk (0x3UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */ + +#define TPI_FIFO1_ITM_bytecount_Pos 27 /*!< TPI FIFO1: ITM_bytecount Position */ +#define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */ + +#define TPI_FIFO1_ETM_ATVALID_Pos 26 /*!< TPI FIFO1: ETM_ATVALID Position */ +#define TPI_FIFO1_ETM_ATVALID_Msk (0x3UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */ + +#define TPI_FIFO1_ETM_bytecount_Pos 24 /*!< TPI FIFO1: ETM_bytecount Position */ +#define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */ + +#define TPI_FIFO1_ITM2_Pos 16 /*!< TPI FIFO1: ITM2 Position */ +#define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */ + +#define TPI_FIFO1_ITM1_Pos 8 /*!< TPI FIFO1: ITM1 Position */ +#define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */ + +#define TPI_FIFO1_ITM0_Pos 0 /*!< TPI FIFO1: ITM0 Position */ +#define TPI_FIFO1_ITM0_Msk (0xFFUL << TPI_FIFO1_ITM0_Pos) /*!< TPI FIFO1: ITM0 Mask */ + +/* TPI ITATBCTR0 Register Definitions */ +#define TPI_ITATBCTR0_ATREADY_Pos 0 /*!< TPI ITATBCTR0: ATREADY Position */ +#define TPI_ITATBCTR0_ATREADY_Msk (0x1UL << TPI_ITATBCTR0_ATREADY_Pos) /*!< TPI ITATBCTR0: ATREADY Mask */ + +/* TPI Integration Mode Control Register Definitions */ +#define TPI_ITCTRL_Mode_Pos 0 /*!< TPI ITCTRL: Mode Position */ +#define TPI_ITCTRL_Mode_Msk (0x1UL << TPI_ITCTRL_Mode_Pos) /*!< TPI ITCTRL: Mode Mask */ + +/* TPI DEVID Register Definitions */ +#define TPI_DEVID_NRZVALID_Pos 11 /*!< TPI DEVID: NRZVALID Position */ +#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */ + +#define TPI_DEVID_MANCVALID_Pos 10 /*!< TPI DEVID: MANCVALID Position */ +#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */ + +#define TPI_DEVID_PTINVALID_Pos 9 /*!< TPI DEVID: PTINVALID Position */ +#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */ + +#define TPI_DEVID_MinBufSz_Pos 6 /*!< TPI DEVID: MinBufSz Position */ +#define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */ + +#define TPI_DEVID_AsynClkIn_Pos 5 /*!< TPI DEVID: AsynClkIn Position */ +#define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */ + +#define TPI_DEVID_NrTraceInput_Pos 0 /*!< TPI DEVID: NrTraceInput Position */ +#define TPI_DEVID_NrTraceInput_Msk (0x1FUL << TPI_DEVID_NrTraceInput_Pos) /*!< TPI DEVID: NrTraceInput Mask */ + +/* TPI DEVTYPE Register Definitions */ +#define TPI_DEVTYPE_SubType_Pos 0 /*!< TPI DEVTYPE: SubType Position */ +#define TPI_DEVTYPE_SubType_Msk (0xFUL << TPI_DEVTYPE_SubType_Pos) /*!< TPI DEVTYPE: SubType Mask */ + +#define TPI_DEVTYPE_MajorType_Pos 4 /*!< TPI DEVTYPE: MajorType Position */ +#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */ + +/*@}*/ /* end of group CMSIS_TPI */ + + +#if (__MPU_PRESENT == 1) +/** \ingroup CMSIS_core_register + \defgroup CMSIS_MPU Memory Protection Unit (MPU) + \brief Type definitions for the Memory Protection Unit (MPU) + @{ + */ + +/** \brief Structure type to access the Memory Protection Unit (MPU). + */ +typedef struct +{ + __I uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ + __IO uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ + __IO uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */ + __IO uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ + __IO uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */ + __IO uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Alias 1 Region Base Address Register */ + __IO uint32_t RASR_A1; /*!< Offset: 0x018 (R/W) MPU Alias 1 Region Attribute and Size Register */ + __IO uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Alias 2 Region Base Address Register */ + __IO uint32_t RASR_A2; /*!< Offset: 0x020 (R/W) MPU Alias 2 Region Attribute and Size Register */ + __IO uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Alias 3 Region Base Address Register */ + __IO uint32_t RASR_A3; /*!< Offset: 0x028 (R/W) MPU Alias 3 Region Attribute and Size Register */ +} MPU_Type; + +/* MPU Type Register */ +#define MPU_TYPE_IREGION_Pos 16 /*!< MPU TYPE: IREGION Position */ +#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ + +#define MPU_TYPE_DREGION_Pos 8 /*!< MPU TYPE: DREGION Position */ +#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ + +#define MPU_TYPE_SEPARATE_Pos 0 /*!< MPU TYPE: SEPARATE Position */ +#define MPU_TYPE_SEPARATE_Msk (1UL << MPU_TYPE_SEPARATE_Pos) /*!< MPU TYPE: SEPARATE Mask */ + +/* MPU Control Register */ +#define MPU_CTRL_PRIVDEFENA_Pos 2 /*!< MPU CTRL: PRIVDEFENA Position */ +#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ + +#define MPU_CTRL_HFNMIENA_Pos 1 /*!< MPU CTRL: HFNMIENA Position */ +#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ + +#define MPU_CTRL_ENABLE_Pos 0 /*!< MPU CTRL: ENABLE Position */ +#define MPU_CTRL_ENABLE_Msk (1UL << MPU_CTRL_ENABLE_Pos) /*!< MPU CTRL: ENABLE Mask */ + +/* MPU Region Number Register */ +#define MPU_RNR_REGION_Pos 0 /*!< MPU RNR: REGION Position */ +#define MPU_RNR_REGION_Msk (0xFFUL << MPU_RNR_REGION_Pos) /*!< MPU RNR: REGION Mask */ + +/* MPU Region Base Address Register */ +#define MPU_RBAR_ADDR_Pos 5 /*!< MPU RBAR: ADDR Position */ +#define MPU_RBAR_ADDR_Msk (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */ + +#define MPU_RBAR_VALID_Pos 4 /*!< MPU RBAR: VALID Position */ +#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */ + +#define MPU_RBAR_REGION_Pos 0 /*!< MPU RBAR: REGION Position */ +#define MPU_RBAR_REGION_Msk (0xFUL << MPU_RBAR_REGION_Pos) /*!< MPU RBAR: REGION Mask */ + +/* MPU Region Attribute and Size Register */ +#define MPU_RASR_ATTRS_Pos 16 /*!< MPU RASR: MPU Region Attribute field Position */ +#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */ + +#define MPU_RASR_XN_Pos 28 /*!< MPU RASR: ATTRS.XN Position */ +#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */ + +#define MPU_RASR_AP_Pos 24 /*!< MPU RASR: ATTRS.AP Position */ +#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */ + +#define MPU_RASR_TEX_Pos 19 /*!< MPU RASR: ATTRS.TEX Position */ +#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */ + +#define MPU_RASR_S_Pos 18 /*!< MPU RASR: ATTRS.S Position */ +#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */ + +#define MPU_RASR_C_Pos 17 /*!< MPU RASR: ATTRS.C Position */ +#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */ + +#define MPU_RASR_B_Pos 16 /*!< MPU RASR: ATTRS.B Position */ +#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */ + +#define MPU_RASR_SRD_Pos 8 /*!< MPU RASR: Sub-Region Disable Position */ +#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */ + +#define MPU_RASR_SIZE_Pos 1 /*!< MPU RASR: Region Size Field Position */ +#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */ + +#define MPU_RASR_ENABLE_Pos 0 /*!< MPU RASR: Region enable bit Position */ +#define MPU_RASR_ENABLE_Msk (1UL << MPU_RASR_ENABLE_Pos) /*!< MPU RASR: Region enable bit Disable Mask */ + +/*@} end of group CMSIS_MPU */ +#endif + + +#if (__FPU_PRESENT == 1) +/** \ingroup CMSIS_core_register + \defgroup CMSIS_FPU Floating Point Unit (FPU) + \brief Type definitions for the Floating Point Unit (FPU) + @{ + */ + +/** \brief Structure type to access the Floating Point Unit (FPU). + */ +typedef struct +{ + uint32_t RESERVED0[1]; + __IO uint32_t FPCCR; /*!< Offset: 0x004 (R/W) Floating-Point Context Control Register */ + __IO uint32_t FPCAR; /*!< Offset: 0x008 (R/W) Floating-Point Context Address Register */ + __IO uint32_t FPDSCR; /*!< Offset: 0x00C (R/W) Floating-Point Default Status Control Register */ + __I uint32_t MVFR0; /*!< Offset: 0x010 (R/ ) Media and FP Feature Register 0 */ + __I uint32_t MVFR1; /*!< Offset: 0x014 (R/ ) Media and FP Feature Register 1 */ +} FPU_Type; + +/* Floating-Point Context Control Register */ +#define FPU_FPCCR_ASPEN_Pos 31 /*!< FPCCR: ASPEN bit Position */ +#define FPU_FPCCR_ASPEN_Msk (1UL << FPU_FPCCR_ASPEN_Pos) /*!< FPCCR: ASPEN bit Mask */ + +#define FPU_FPCCR_LSPEN_Pos 30 /*!< FPCCR: LSPEN Position */ +#define FPU_FPCCR_LSPEN_Msk (1UL << FPU_FPCCR_LSPEN_Pos) /*!< FPCCR: LSPEN bit Mask */ + +#define FPU_FPCCR_MONRDY_Pos 8 /*!< FPCCR: MONRDY Position */ +#define FPU_FPCCR_MONRDY_Msk (1UL << FPU_FPCCR_MONRDY_Pos) /*!< FPCCR: MONRDY bit Mask */ + +#define FPU_FPCCR_BFRDY_Pos 6 /*!< FPCCR: BFRDY Position */ +#define FPU_FPCCR_BFRDY_Msk (1UL << FPU_FPCCR_BFRDY_Pos) /*!< FPCCR: BFRDY bit Mask */ + +#define FPU_FPCCR_MMRDY_Pos 5 /*!< FPCCR: MMRDY Position */ +#define FPU_FPCCR_MMRDY_Msk (1UL << FPU_FPCCR_MMRDY_Pos) /*!< FPCCR: MMRDY bit Mask */ + +#define FPU_FPCCR_HFRDY_Pos 4 /*!< FPCCR: HFRDY Position */ +#define FPU_FPCCR_HFRDY_Msk (1UL << FPU_FPCCR_HFRDY_Pos) /*!< FPCCR: HFRDY bit Mask */ + +#define FPU_FPCCR_THREAD_Pos 3 /*!< FPCCR: processor mode bit Position */ +#define FPU_FPCCR_THREAD_Msk (1UL << FPU_FPCCR_THREAD_Pos) /*!< FPCCR: processor mode active bit Mask */ + +#define FPU_FPCCR_USER_Pos 1 /*!< FPCCR: privilege level bit Position */ +#define FPU_FPCCR_USER_Msk (1UL << FPU_FPCCR_USER_Pos) /*!< FPCCR: privilege level bit Mask */ + +#define FPU_FPCCR_LSPACT_Pos 0 /*!< FPCCR: Lazy state preservation active bit Position */ +#define FPU_FPCCR_LSPACT_Msk (1UL << FPU_FPCCR_LSPACT_Pos) /*!< FPCCR: Lazy state preservation active bit Mask */ + +/* Floating-Point Context Address Register */ +#define FPU_FPCAR_ADDRESS_Pos 3 /*!< FPCAR: ADDRESS bit Position */ +#define FPU_FPCAR_ADDRESS_Msk (0x1FFFFFFFUL << FPU_FPCAR_ADDRESS_Pos) /*!< FPCAR: ADDRESS bit Mask */ + +/* Floating-Point Default Status Control Register */ +#define FPU_FPDSCR_AHP_Pos 26 /*!< FPDSCR: AHP bit Position */ +#define FPU_FPDSCR_AHP_Msk (1UL << FPU_FPDSCR_AHP_Pos) /*!< FPDSCR: AHP bit Mask */ + +#define FPU_FPDSCR_DN_Pos 25 /*!< FPDSCR: DN bit Position */ +#define FPU_FPDSCR_DN_Msk (1UL << FPU_FPDSCR_DN_Pos) /*!< FPDSCR: DN bit Mask */ + +#define FPU_FPDSCR_FZ_Pos 24 /*!< FPDSCR: FZ bit Position */ +#define FPU_FPDSCR_FZ_Msk (1UL << FPU_FPDSCR_FZ_Pos) /*!< FPDSCR: FZ bit Mask */ + +#define FPU_FPDSCR_RMode_Pos 22 /*!< FPDSCR: RMode bit Position */ +#define FPU_FPDSCR_RMode_Msk (3UL << FPU_FPDSCR_RMode_Pos) /*!< FPDSCR: RMode bit Mask */ + +/* Media and FP Feature Register 0 */ +#define FPU_MVFR0_FP_rounding_modes_Pos 28 /*!< MVFR0: FP rounding modes bits Position */ +#define FPU_MVFR0_FP_rounding_modes_Msk (0xFUL << FPU_MVFR0_FP_rounding_modes_Pos) /*!< MVFR0: FP rounding modes bits Mask */ + +#define FPU_MVFR0_Short_vectors_Pos 24 /*!< MVFR0: Short vectors bits Position */ +#define FPU_MVFR0_Short_vectors_Msk (0xFUL << FPU_MVFR0_Short_vectors_Pos) /*!< MVFR0: Short vectors bits Mask */ + +#define FPU_MVFR0_Square_root_Pos 20 /*!< MVFR0: Square root bits Position */ +#define FPU_MVFR0_Square_root_Msk (0xFUL << FPU_MVFR0_Square_root_Pos) /*!< MVFR0: Square root bits Mask */ + +#define FPU_MVFR0_Divide_Pos 16 /*!< MVFR0: Divide bits Position */ +#define FPU_MVFR0_Divide_Msk (0xFUL << FPU_MVFR0_Divide_Pos) /*!< MVFR0: Divide bits Mask */ + +#define FPU_MVFR0_FP_excep_trapping_Pos 12 /*!< MVFR0: FP exception trapping bits Position */ +#define FPU_MVFR0_FP_excep_trapping_Msk (0xFUL << FPU_MVFR0_FP_excep_trapping_Pos) /*!< MVFR0: FP exception trapping bits Mask */ + +#define FPU_MVFR0_Double_precision_Pos 8 /*!< MVFR0: Double-precision bits Position */ +#define FPU_MVFR0_Double_precision_Msk (0xFUL << FPU_MVFR0_Double_precision_Pos) /*!< MVFR0: Double-precision bits Mask */ + +#define FPU_MVFR0_Single_precision_Pos 4 /*!< MVFR0: Single-precision bits Position */ +#define FPU_MVFR0_Single_precision_Msk (0xFUL << FPU_MVFR0_Single_precision_Pos) /*!< MVFR0: Single-precision bits Mask */ + +#define FPU_MVFR0_A_SIMD_registers_Pos 0 /*!< MVFR0: A_SIMD registers bits Position */ +#define FPU_MVFR0_A_SIMD_registers_Msk (0xFUL << FPU_MVFR0_A_SIMD_registers_Pos) /*!< MVFR0: A_SIMD registers bits Mask */ + +/* Media and FP Feature Register 1 */ +#define FPU_MVFR1_FP_fused_MAC_Pos 28 /*!< MVFR1: FP fused MAC bits Position */ +#define FPU_MVFR1_FP_fused_MAC_Msk (0xFUL << FPU_MVFR1_FP_fused_MAC_Pos) /*!< MVFR1: FP fused MAC bits Mask */ + +#define FPU_MVFR1_FP_HPFP_Pos 24 /*!< MVFR1: FP HPFP bits Position */ +#define FPU_MVFR1_FP_HPFP_Msk (0xFUL << FPU_MVFR1_FP_HPFP_Pos) /*!< MVFR1: FP HPFP bits Mask */ + +#define FPU_MVFR1_D_NaN_mode_Pos 4 /*!< MVFR1: D_NaN mode bits Position */ +#define FPU_MVFR1_D_NaN_mode_Msk (0xFUL << FPU_MVFR1_D_NaN_mode_Pos) /*!< MVFR1: D_NaN mode bits Mask */ + +#define FPU_MVFR1_FtZ_mode_Pos 0 /*!< MVFR1: FtZ mode bits Position */ +#define FPU_MVFR1_FtZ_mode_Msk (0xFUL << FPU_MVFR1_FtZ_mode_Pos) /*!< MVFR1: FtZ mode bits Mask */ + +/*@} end of group CMSIS_FPU */ +#endif + + +/** \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Type definitions for the Core Debug Registers + @{ + */ + +/** \brief Structure type to access the Core Debug Register (CoreDebug). + */ +typedef struct +{ + __IO uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */ + __O uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */ + __IO uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */ + __IO uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */ +} CoreDebug_Type; + +/* Debug Halting Control and Status Register */ +#define CoreDebug_DHCSR_DBGKEY_Pos 16 /*!< CoreDebug DHCSR: DBGKEY Position */ +#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */ + +#define CoreDebug_DHCSR_S_RESET_ST_Pos 25 /*!< CoreDebug DHCSR: S_RESET_ST Position */ +#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */ + +#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24 /*!< CoreDebug DHCSR: S_RETIRE_ST Position */ +#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */ + +#define CoreDebug_DHCSR_S_LOCKUP_Pos 19 /*!< CoreDebug DHCSR: S_LOCKUP Position */ +#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */ + +#define CoreDebug_DHCSR_S_SLEEP_Pos 18 /*!< CoreDebug DHCSR: S_SLEEP Position */ +#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */ + +#define CoreDebug_DHCSR_S_HALT_Pos 17 /*!< CoreDebug DHCSR: S_HALT Position */ +#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */ + +#define CoreDebug_DHCSR_S_REGRDY_Pos 16 /*!< CoreDebug DHCSR: S_REGRDY Position */ +#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */ + +#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5 /*!< CoreDebug DHCSR: C_SNAPSTALL Position */ +#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */ + +#define CoreDebug_DHCSR_C_MASKINTS_Pos 3 /*!< CoreDebug DHCSR: C_MASKINTS Position */ +#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */ + +#define CoreDebug_DHCSR_C_STEP_Pos 2 /*!< CoreDebug DHCSR: C_STEP Position */ +#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */ + +#define CoreDebug_DHCSR_C_HALT_Pos 1 /*!< CoreDebug DHCSR: C_HALT Position */ +#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */ + +#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0 /*!< CoreDebug DHCSR: C_DEBUGEN Position */ +#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL << CoreDebug_DHCSR_C_DEBUGEN_Pos) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */ + +/* Debug Core Register Selector Register */ +#define CoreDebug_DCRSR_REGWnR_Pos 16 /*!< CoreDebug DCRSR: REGWnR Position */ +#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */ + +#define CoreDebug_DCRSR_REGSEL_Pos 0 /*!< CoreDebug DCRSR: REGSEL Position */ +#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL << CoreDebug_DCRSR_REGSEL_Pos) /*!< CoreDebug DCRSR: REGSEL Mask */ + +/* Debug Exception and Monitor Control Register */ +#define CoreDebug_DEMCR_TRCENA_Pos 24 /*!< CoreDebug DEMCR: TRCENA Position */ +#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */ + +#define CoreDebug_DEMCR_MON_REQ_Pos 19 /*!< CoreDebug DEMCR: MON_REQ Position */ +#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */ + +#define CoreDebug_DEMCR_MON_STEP_Pos 18 /*!< CoreDebug DEMCR: MON_STEP Position */ +#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */ + +#define CoreDebug_DEMCR_MON_PEND_Pos 17 /*!< CoreDebug DEMCR: MON_PEND Position */ +#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */ + +#define CoreDebug_DEMCR_MON_EN_Pos 16 /*!< CoreDebug DEMCR: MON_EN Position */ +#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */ + +#define CoreDebug_DEMCR_VC_HARDERR_Pos 10 /*!< CoreDebug DEMCR: VC_HARDERR Position */ +#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */ + +#define CoreDebug_DEMCR_VC_INTERR_Pos 9 /*!< CoreDebug DEMCR: VC_INTERR Position */ +#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */ + +#define CoreDebug_DEMCR_VC_BUSERR_Pos 8 /*!< CoreDebug DEMCR: VC_BUSERR Position */ +#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */ + +#define CoreDebug_DEMCR_VC_STATERR_Pos 7 /*!< CoreDebug DEMCR: VC_STATERR Position */ +#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */ + +#define CoreDebug_DEMCR_VC_CHKERR_Pos 6 /*!< CoreDebug DEMCR: VC_CHKERR Position */ +#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */ + +#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5 /*!< CoreDebug DEMCR: VC_NOCPERR Position */ +#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */ + +#define CoreDebug_DEMCR_VC_MMERR_Pos 4 /*!< CoreDebug DEMCR: VC_MMERR Position */ +#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */ + +#define CoreDebug_DEMCR_VC_CORERESET_Pos 0 /*!< CoreDebug DEMCR: VC_CORERESET Position */ +#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL << CoreDebug_DEMCR_VC_CORERESET_Pos) /*!< CoreDebug DEMCR: VC_CORERESET Mask */ + +/*@} end of group CMSIS_CoreDebug */ + + +/** \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Cortex-M4 Hardware */ +#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ +#define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */ +#define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */ +#define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */ +#define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */ +#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ +#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ +#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + +#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */ +#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ +#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ +#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ +#define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */ +#define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */ +#define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */ +#define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug configuration struct */ + +#if (__MPU_PRESENT == 1) + #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ + #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ +#endif + +#if (__FPU_PRESENT == 1) + #define FPU_BASE (SCS_BASE + 0x0F30UL) /*!< Floating Point Unit */ + #define FPU ((FPU_Type *) FPU_BASE ) /*!< Floating Point Unit */ +#endif + +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Debug Functions + - Core Register Access Functions + ******************************************************************************/ +/** \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +/** \brief Set Priority Grouping + + The function sets the priority grouping field using the required unlock sequence. + The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field. + Only values from 0..7 are used. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + + \param [in] PriorityGroup Priority grouping field. + */ +__STATIC_INLINE void NVIC_SetPriorityGrouping(uint32_t PriorityGroup) +{ + uint32_t reg_value; + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07); /* only values 0..7 are used */ + + reg_value = SCB->AIRCR; /* read old register configuration */ + reg_value &= ~(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk); /* clear bits to change */ + reg_value = (reg_value | + ((uint32_t)0x5FA << SCB_AIRCR_VECTKEY_Pos) | + (PriorityGroupTmp << 8)); /* Insert write key and priorty group */ + SCB->AIRCR = reg_value; +} + + +/** \brief Get Priority Grouping + + The function reads the priority grouping field from the NVIC Interrupt Controller. + + \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field). + */ +__STATIC_INLINE uint32_t NVIC_GetPriorityGrouping(void) +{ + return ((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos); /* read priority grouping field */ +} + + +/** \brief Enable External Interrupt + + The function enables a device-specific interrupt in the NVIC interrupt controller. + + \param [in] IRQn External interrupt number. Value cannot be negative. + */ +__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn) +{ +/* NVIC->ISER[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); enable interrupt */ + NVIC->ISER[(uint32_t)((int32_t)IRQn) >> 5] = (uint32_t)(1 << ((uint32_t)((int32_t)IRQn) & (uint32_t)0x1F)); /* enable interrupt */ +} + + +/** \brief Disable External Interrupt + + The function disables a device-specific interrupt in the NVIC interrupt controller. + + \param [in] IRQn External interrupt number. Value cannot be negative. + */ +__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn) +{ + NVIC->ICER[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* disable interrupt */ +} + + +/** \brief Get Pending Interrupt + + The function reads the pending register in the NVIC and returns the pending bit + for the specified interrupt. + + \param [in] IRQn Interrupt number. + + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + */ +__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + return((uint32_t) ((NVIC->ISPR[(uint32_t)(IRQn) >> 5] & (1 << ((uint32_t)(IRQn) & 0x1F)))?1:0)); /* Return 1 if pending else 0 */ +} + + +/** \brief Set Pending Interrupt + + The function sets the pending bit of an external interrupt. + + \param [in] IRQn Interrupt number. Value cannot be negative. + */ +__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + NVIC->ISPR[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* set interrupt pending */ +} + + +/** \brief Clear Pending Interrupt + + The function clears the pending bit of an external interrupt. + + \param [in] IRQn External interrupt number. Value cannot be negative. + */ +__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + NVIC->ICPR[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* Clear pending interrupt */ +} + + +/** \brief Get Active Interrupt + + The function reads the active register in NVIC and returns the active bit. + + \param [in] IRQn Interrupt number. + + \return 0 Interrupt status is not active. + \return 1 Interrupt status is active. + */ +__STATIC_INLINE uint32_t NVIC_GetActive(IRQn_Type IRQn) +{ + return((uint32_t)((NVIC->IABR[(uint32_t)(IRQn) >> 5] & (1 << ((uint32_t)(IRQn) & 0x1F)))?1:0)); /* Return 1 if active else 0 */ +} + + +/** \brief Set Interrupt Priority + + The function sets the priority of an interrupt. + + \note The priority cannot be set for every core interrupt. + + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + */ +__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if(IRQn < 0) { + SCB->SHP[((uint32_t)(IRQn) & 0xF)-4] = ((priority << (8 - __NVIC_PRIO_BITS)) & 0xff); } /* set Priority for Cortex-M System Interrupts */ + else { + NVIC->IP[(uint32_t)(IRQn)] = ((priority << (8 - __NVIC_PRIO_BITS)) & 0xff); } /* set Priority for device specific Interrupts */ +} + + +/** \brief Get Interrupt Priority + + The function reads the priority of an interrupt. The interrupt + number can be positive to specify an external (device specific) + interrupt, or negative to specify an internal (core) interrupt. + + + \param [in] IRQn Interrupt number. + \return Interrupt Priority. Value is aligned automatically to the implemented + priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn) +{ + + if(IRQn < 0) { + return((uint32_t)(SCB->SHP[((uint32_t)(IRQn) & 0xF)-4] >> (8 - __NVIC_PRIO_BITS))); } /* get priority for Cortex-M system interrupts */ + else { + return((uint32_t)(NVIC->IP[(uint32_t)(IRQn)] >> (8 - __NVIC_PRIO_BITS))); } /* get priority for device specific interrupts */ +} + + +/** \brief Encode Priority + + The function encodes the priority for an interrupt with the given priority group, + preemptive priority value, and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + + \param [in] PriorityGroup Used priority group. + \param [in] PreemptPriority Preemptive priority value (starting from 0). + \param [in] SubPriority Subpriority value (starting from 0). + \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). + */ +__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & 0x07); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7 - PriorityGroupTmp) > __NVIC_PRIO_BITS) ? __NVIC_PRIO_BITS : 7 - PriorityGroupTmp; + SubPriorityBits = ((PriorityGroupTmp + __NVIC_PRIO_BITS) < 7) ? 0 : PriorityGroupTmp - 7 + __NVIC_PRIO_BITS; + + return ( + ((PreemptPriority & ((1 << (PreemptPriorityBits)) - 1)) << SubPriorityBits) | + ((SubPriority & ((1 << (SubPriorityBits )) - 1))) + ); +} + + +/** \brief Decode Priority + + The function decodes an interrupt priority value with a given priority group to + preemptive priority value and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. + + \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). + \param [in] PriorityGroup Used priority group. + \param [out] pPreemptPriority Preemptive priority value (starting from 0). + \param [out] pSubPriority Subpriority value (starting from 0). + */ +__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* pPreemptPriority, uint32_t* pSubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & 0x07); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7 - PriorityGroupTmp) > __NVIC_PRIO_BITS) ? __NVIC_PRIO_BITS : 7 - PriorityGroupTmp; + SubPriorityBits = ((PriorityGroupTmp + __NVIC_PRIO_BITS) < 7) ? 0 : PriorityGroupTmp - 7 + __NVIC_PRIO_BITS; + + *pPreemptPriority = (Priority >> SubPriorityBits) & ((1 << (PreemptPriorityBits)) - 1); + *pSubPriority = (Priority ) & ((1 << (SubPriorityBits )) - 1); +} + + +/** \brief System Reset + + The function initiates a system reset request to reset the MCU. + */ +__STATIC_INLINE void NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = ((0x5FA << SCB_AIRCR_VECTKEY_Pos) | + (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) | + SCB_AIRCR_SYSRESETREQ_Msk); /* Keep priority group unchanged */ + __DSB(); /* Ensure completion of memory access */ + while(1); /* wait until reset */ +} + +/*@} end of CMSIS_Core_NVICFunctions */ + + + +/* ################################## SysTick function ############################################ */ +/** \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if (__Vendor_SysTickConfig == 0) + +/** \brief System Tick Configuration + + The function initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + + \param [in] ticks Number of ticks between two interrupts. + + \return 0 Function succeeded. + \return 1 Function failed. + + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1) > SysTick_LOAD_RELOAD_Msk) return (1); /* Reload value impossible */ + + SysTick->LOAD = ticks - 1; /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1<<__NVIC_PRIO_BITS) - 1); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0); /* Function successful */ +} + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + +/* ##################################### Debug In/Output function ########################################### */ +/** \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_core_DebugFunctions ITM Functions + \brief Functions that access the ITM debug interface. + @{ + */ + +extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */ +#define ITM_RXBUFFER_EMPTY 0x5AA55AA5 /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */ + + +/** \brief ITM Send Character + + The function transmits a character via the ITM channel 0, and + \li Just returns when no debugger is connected that has booked the output. + \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted. + + \param [in] ch Character to transmit. + + \returns Character to transmit. + */ +__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch) +{ + if ((ITM->TCR & ITM_TCR_ITMENA_Msk) && /* ITM enabled */ + (ITM->TER & (1UL << 0) ) ) /* ITM Port #0 enabled */ + { + while (ITM->PORT[0].u32 == 0); + ITM->PORT[0].u8 = (uint8_t) ch; + } + return (ch); +} + + +/** \brief ITM Receive Character + + The function inputs a character via the external variable \ref ITM_RxBuffer. + + \return Received character. + \return -1 No character pending. + */ +__STATIC_INLINE int32_t ITM_ReceiveChar (void) { + int32_t ch = -1; /* no character available */ + + if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) { + ch = ITM_RxBuffer; + ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */ + } + + return (ch); +} + + +/** \brief ITM Check Character + + The function checks whether a character is pending for reading in the variable \ref ITM_RxBuffer. + + \return 0 No character available. + \return 1 Character available. + */ +__STATIC_INLINE int32_t ITM_CheckChar (void) { + + if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) { + return (0); /* no character available */ + } else { + return (1); /* character available */ + } +} + +/*@} end of CMSIS_core_DebugFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM4_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/components/toolchain/gcc/core_cmFunc.h b/components/toolchain/gcc/core_cmFunc.h new file mode 100644 index 0000000..01089f1 --- /dev/null +++ b/components/toolchain/gcc/core_cmFunc.h @@ -0,0 +1,637 @@ +/**************************************************************************//** + * @file core_cmFunc.h + * @brief CMSIS Cortex-M Core Function Access Header File + * @version V4.00 + * @date 28. August 2014 + * + * @note + * + ******************************************************************************/ +/* Copyright (c) 2009 - 2014 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. + ---------------------------------------------------------------------------*/ + + +#ifndef __CORE_CMFUNC_H +#define __CORE_CMFUNC_H + + +/* ########################### Core Function Access ########################### */ +/** \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions + @{ + */ + +#if defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/ +/* ARM armcc specific functions */ + +#if (__ARMCC_VERSION < 400677) + #error "Please use ARM Compiler Toolchain V4.0.677 or later!" +#endif + +/* intrinsic void __enable_irq(); */ +/* intrinsic void __disable_irq(); */ + +/** \brief Get Control Register + + This function returns the content of the Control Register. + + \return Control Register value + */ +__STATIC_INLINE uint32_t __get_CONTROL(void) +{ + register uint32_t __regControl __ASM("control"); + return(__regControl); +} + + +/** \brief Set Control Register + + This function writes the given value to the Control Register. + + \param [in] control Control Register value to set + */ +__STATIC_INLINE void __set_CONTROL(uint32_t control) +{ + register uint32_t __regControl __ASM("control"); + __regControl = control; +} + + +/** \brief Get IPSR Register + + This function returns the content of the IPSR Register. + + \return IPSR Register value + */ +__STATIC_INLINE uint32_t __get_IPSR(void) +{ + register uint32_t __regIPSR __ASM("ipsr"); + return(__regIPSR); +} + + +/** \brief Get APSR Register + + This function returns the content of the APSR Register. + + \return APSR Register value + */ +__STATIC_INLINE uint32_t __get_APSR(void) +{ + register uint32_t __regAPSR __ASM("apsr"); + return(__regAPSR); +} + + +/** \brief Get xPSR Register + + This function returns the content of the xPSR Register. + + \return xPSR Register value + */ +__STATIC_INLINE uint32_t __get_xPSR(void) +{ + register uint32_t __regXPSR __ASM("xpsr"); + return(__regXPSR); +} + + +/** \brief Get Process Stack Pointer + + This function returns the current value of the Process Stack Pointer (PSP). + + \return PSP Register value + */ +__STATIC_INLINE uint32_t __get_PSP(void) +{ + register uint32_t __regProcessStackPointer __ASM("psp"); + return(__regProcessStackPointer); +} + + +/** \brief Set Process Stack Pointer + + This function assigns the given value to the Process Stack Pointer (PSP). + + \param [in] topOfProcStack Process Stack Pointer value to set + */ +__STATIC_INLINE void __set_PSP(uint32_t topOfProcStack) +{ + register uint32_t __regProcessStackPointer __ASM("psp"); + __regProcessStackPointer = topOfProcStack; +} + + +/** \brief Get Main Stack Pointer + + This function returns the current value of the Main Stack Pointer (MSP). + + \return MSP Register value + */ +__STATIC_INLINE uint32_t __get_MSP(void) +{ + register uint32_t __regMainStackPointer __ASM("msp"); + return(__regMainStackPointer); +} + + +/** \brief Set Main Stack Pointer + + This function assigns the given value to the Main Stack Pointer (MSP). + + \param [in] topOfMainStack Main Stack Pointer value to set + */ +__STATIC_INLINE void __set_MSP(uint32_t topOfMainStack) +{ + register uint32_t __regMainStackPointer __ASM("msp"); + __regMainStackPointer = topOfMainStack; +} + + +/** \brief Get Priority Mask + + This function returns the current state of the priority mask bit from the Priority Mask Register. + + \return Priority Mask value + */ +__STATIC_INLINE uint32_t __get_PRIMASK(void) +{ + register uint32_t __regPriMask __ASM("primask"); + return(__regPriMask); +} + + +/** \brief Set Priority Mask + + This function assigns the given value to the Priority Mask Register. + + \param [in] priMask Priority Mask + */ +__STATIC_INLINE void __set_PRIMASK(uint32_t priMask) +{ + register uint32_t __regPriMask __ASM("primask"); + __regPriMask = (priMask); +} + + +#if (__CORTEX_M >= 0x03) || (__CORTEX_SC >= 300) + +/** \brief Enable FIQ + + This function enables FIQ interrupts by clearing the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +#define __enable_fault_irq __enable_fiq + + +/** \brief Disable FIQ + + This function disables FIQ interrupts by setting the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +#define __disable_fault_irq __disable_fiq + + +/** \brief Get Base Priority + + This function returns the current value of the Base Priority register. + + \return Base Priority register value + */ +__STATIC_INLINE uint32_t __get_BASEPRI(void) +{ + register uint32_t __regBasePri __ASM("basepri"); + return(__regBasePri); +} + + +/** \brief Set Base Priority + + This function assigns the given value to the Base Priority register. + + \param [in] basePri Base Priority value to set + */ +__STATIC_INLINE void __set_BASEPRI(uint32_t basePri) +{ + register uint32_t __regBasePri __ASM("basepri"); + __regBasePri = (basePri & 0xff); +} + + +/** \brief Get Fault Mask + + This function returns the current value of the Fault Mask register. + + \return Fault Mask register value + */ +__STATIC_INLINE uint32_t __get_FAULTMASK(void) +{ + register uint32_t __regFaultMask __ASM("faultmask"); + return(__regFaultMask); +} + + +/** \brief Set Fault Mask + + This function assigns the given value to the Fault Mask register. + + \param [in] faultMask Fault Mask value to set + */ +__STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask) +{ + register uint32_t __regFaultMask __ASM("faultmask"); + __regFaultMask = (faultMask & (uint32_t)1); +} + +#endif /* (__CORTEX_M >= 0x03) || (__CORTEX_SC >= 300) */ + + +#if (__CORTEX_M == 0x04) || (__CORTEX_M == 0x07) + +/** \brief Get FPSCR + + This function returns the current value of the Floating Point Status/Control register. + + \return Floating Point Status/Control register value + */ +__STATIC_INLINE uint32_t __get_FPSCR(void) +{ +#if (__FPU_PRESENT == 1) && (__FPU_USED == 1) + register uint32_t __regfpscr __ASM("fpscr"); + return(__regfpscr); +#else + return(0); +#endif +} + + +/** \brief Set FPSCR + + This function assigns the given value to the Floating Point Status/Control register. + + \param [in] fpscr Floating Point Status/Control value to set + */ +__STATIC_INLINE void __set_FPSCR(uint32_t fpscr) +{ +#if (__FPU_PRESENT == 1) && (__FPU_USED == 1) + register uint32_t __regfpscr __ASM("fpscr"); + __regfpscr = (fpscr); +#endif +} + +#endif /* (__CORTEX_M == 0x04) || (__CORTEX_M == 0x07) */ + + +#elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/ +/* GNU gcc specific functions */ + +/** \brief Enable IRQ Interrupts + + This function enables IRQ interrupts by clearing the I-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __enable_irq(void) +{ + __ASM volatile ("cpsie i" : : : "memory"); +} + + +/** \brief Disable IRQ Interrupts + + This function disables IRQ interrupts by setting the I-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_irq(void) +{ + __ASM volatile ("cpsid i" : : : "memory"); +} + + +/** \brief Get Control Register + + This function returns the content of the Control Register. + + \return Control Register value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_CONTROL(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, control" : "=r" (result) ); + return(result); +} + + +/** \brief Set Control Register + + This function writes the given value to the Control Register. + + \param [in] control Control Register value to set + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_CONTROL(uint32_t control) +{ + __ASM volatile ("MSR control, %0" : : "r" (control) : "memory"); +} + + +/** \brief Get IPSR Register + + This function returns the content of the IPSR Register. + + \return IPSR Register value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_IPSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, ipsr" : "=r" (result) ); + return(result); +} + + +/** \brief Get APSR Register + + This function returns the content of the APSR Register. + + \return APSR Register value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_APSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, apsr" : "=r" (result) ); + return(result); +} + + +/** \brief Get xPSR Register + + This function returns the content of the xPSR Register. + + \return xPSR Register value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_xPSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, xpsr" : "=r" (result) ); + return(result); +} + + +/** \brief Get Process Stack Pointer + + This function returns the current value of the Process Stack Pointer (PSP). + + \return PSP Register value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PSP(void) +{ + register uint32_t result; + + __ASM volatile ("MRS %0, psp\n" : "=r" (result) ); + return(result); +} + + +/** \brief Set Process Stack Pointer + + This function assigns the given value to the Process Stack Pointer (PSP). + + \param [in] topOfProcStack Process Stack Pointer value to set + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PSP(uint32_t topOfProcStack) +{ + __ASM volatile ("MSR psp, %0\n" : : "r" (topOfProcStack) : "sp"); +} + + +/** \brief Get Main Stack Pointer + + This function returns the current value of the Main Stack Pointer (MSP). + + \return MSP Register value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_MSP(void) +{ + register uint32_t result; + + __ASM volatile ("MRS %0, msp\n" : "=r" (result) ); + return(result); +} + + +/** \brief Set Main Stack Pointer + + This function assigns the given value to the Main Stack Pointer (MSP). + + \param [in] topOfMainStack Main Stack Pointer value to set + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack) +{ + __ASM volatile ("MSR msp, %0\n" : : "r" (topOfMainStack) : "sp"); +} + + +/** \brief Get Priority Mask + + This function returns the current state of the priority mask bit from the Priority Mask Register. + + \return Priority Mask value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PRIMASK(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, primask" : "=r" (result) ); + return(result); +} + + +/** \brief Set Priority Mask + + This function assigns the given value to the Priority Mask Register. + + \param [in] priMask Priority Mask + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PRIMASK(uint32_t priMask) +{ + __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory"); +} + + +#if (__CORTEX_M >= 0x03) + +/** \brief Enable FIQ + + This function enables FIQ interrupts by clearing the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __enable_fault_irq(void) +{ + __ASM volatile ("cpsie f" : : : "memory"); +} + + +/** \brief Disable FIQ + + This function disables FIQ interrupts by setting the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_fault_irq(void) +{ + __ASM volatile ("cpsid f" : : : "memory"); +} + + +/** \brief Get Base Priority + + This function returns the current value of the Base Priority register. + + \return Base Priority register value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_BASEPRI(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, basepri_max" : "=r" (result) ); + return(result); +} + + +/** \brief Set Base Priority + + This function assigns the given value to the Base Priority register. + + \param [in] basePri Base Priority value to set + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_BASEPRI(uint32_t value) +{ + __ASM volatile ("MSR basepri, %0" : : "r" (value) : "memory"); +} + + +/** \brief Get Fault Mask + + This function returns the current value of the Fault Mask register. + + \return Fault Mask register value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FAULTMASK(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, faultmask" : "=r" (result) ); + return(result); +} + + +/** \brief Set Fault Mask + + This function assigns the given value to the Fault Mask register. + + \param [in] faultMask Fault Mask value to set + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask) +{ + __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory"); +} + +#endif /* (__CORTEX_M >= 0x03) */ + + +#if (__CORTEX_M == 0x04) || (__CORTEX_M == 0x07) + +/** \brief Get FPSCR + + This function returns the current value of the Floating Point Status/Control register. + + \return Floating Point Status/Control register value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FPSCR(void) +{ +#if (__FPU_PRESENT == 1) && (__FPU_USED == 1) + uint32_t result; + + /* Empty asm statement works as a scheduling barrier */ + __ASM volatile (""); + __ASM volatile ("VMRS %0, fpscr" : "=r" (result) ); + __ASM volatile (""); + return(result); +#else + return(0); +#endif +} + + +/** \brief Set FPSCR + + This function assigns the given value to the Floating Point Status/Control register. + + \param [in] fpscr Floating Point Status/Control value to set + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FPSCR(uint32_t fpscr) +{ +#if (__FPU_PRESENT == 1) && (__FPU_USED == 1) + /* Empty asm statement works as a scheduling barrier */ + __ASM volatile (""); + __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc"); + __ASM volatile (""); +#endif +} + +#endif /* (__CORTEX_M == 0x04) || (__CORTEX_M == 0x07) */ + + +#elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/ +/* IAR iccarm specific functions */ +#include + + +#elif defined ( __TMS470__ ) /*---------------- TI CCS Compiler ------------------*/ +/* TI CCS specific functions */ +#include + + +#elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/ +/* TASKING carm specific functions */ +/* + * The CMSIS functions have been implemented as intrinsics in the compiler. + * Please use "carm -?i" to get an up to date list of all intrinsics, + * Including the CMSIS ones. + */ + + +#elif defined ( __CSMC__ ) /*------------------ COSMIC Compiler -------------------*/ +/* Cosmic specific functions */ +#include + +#endif + +/*@} end of CMSIS_Core_RegAccFunctions */ + +#endif /* __CORE_CMFUNC_H */ diff --git a/components/toolchain/gcc/core_cmInstr.h b/components/toolchain/gcc/core_cmInstr.h new file mode 100644 index 0000000..d14110b --- /dev/null +++ b/components/toolchain/gcc/core_cmInstr.h @@ -0,0 +1,880 @@ +/**************************************************************************//** + * @file core_cmInstr.h + * @brief CMSIS Cortex-M Core Instruction Access Header File + * @version V4.00 + * @date 28. August 2014 + * + * @note + * + ******************************************************************************/ +/* Copyright (c) 2009 - 2014 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. + ---------------------------------------------------------------------------*/ + + +#ifndef __CORE_CMINSTR_H +#define __CORE_CMINSTR_H + + +/* ########################## Core Instruction Access ######################### */ +/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface + Access to dedicated instructions + @{ +*/ + +#if defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/ +/* ARM armcc specific functions */ + +#if (__ARMCC_VERSION < 400677) + #error "Please use ARM Compiler Toolchain V4.0.677 or later!" +#endif + + +/** \brief No Operation + + No Operation does nothing. This instruction can be used for code alignment purposes. + */ +#define __NOP __nop + + +/** \brief Wait For Interrupt + + Wait For Interrupt is a hint instruction that suspends execution + until one of a number of events occurs. + */ +#define __WFI __wfi + + +/** \brief Wait For Event + + Wait For Event is a hint instruction that permits the processor to enter + a low-power state until one of a number of events occurs. + */ +#define __WFE __wfe + + +/** \brief Send Event + + Send Event is a hint instruction. It causes an event to be signaled to the CPU. + */ +#define __SEV __sev + + +/** \brief Instruction Synchronization Barrier + + Instruction Synchronization Barrier flushes the pipeline in the processor, + so that all instructions following the ISB are fetched from cache or + memory, after the instruction has been completed. + */ +#define __ISB() __isb(0xF) + + +/** \brief Data Synchronization Barrier + + This function acts as a special kind of Data Memory Barrier. + It completes when all explicit memory accesses before this instruction complete. + */ +#define __DSB() __dsb(0xF) + + +/** \brief Data Memory Barrier + + This function ensures the apparent order of the explicit memory operations before + and after the instruction, without ensuring their completion. + */ +#define __DMB() __dmb(0xF) + + +/** \brief Reverse byte order (32 bit) + + This function reverses the byte order in integer value. + + \param [in] value Value to reverse + \return Reversed value + */ +#define __REV __rev + + +/** \brief Reverse byte order (16 bit) + + This function reverses the byte order in two unsigned short values. + + \param [in] value Value to reverse + \return Reversed value + */ +#ifndef __NO_EMBEDDED_ASM +__attribute__((section(".rev16_text"))) __STATIC_INLINE __ASM uint32_t __REV16(uint32_t value) +{ + rev16 r0, r0 + bx lr +} +#endif + +/** \brief Reverse byte order in signed short value + + This function reverses the byte order in a signed short value with sign extension to integer. + + \param [in] value Value to reverse + \return Reversed value + */ +#ifndef __NO_EMBEDDED_ASM +__attribute__((section(".revsh_text"))) __STATIC_INLINE __ASM int32_t __REVSH(int32_t value) +{ + revsh r0, r0 + bx lr +} +#endif + + +/** \brief Rotate Right in unsigned value (32 bit) + + This function Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits. + + \param [in] value Value to rotate + \param [in] value Number of Bits to rotate + \return Rotated value + */ +#define __ROR __ror + + +/** \brief Breakpoint + + This function causes the processor to enter Debug state. + Debug tools can use this to investigate system state when the instruction at a particular address is reached. + + \param [in] value is ignored by the processor. + If required, a debugger can use it to store additional information about the breakpoint. + */ +#define __BKPT(value) __breakpoint(value) + + +#if (__CORTEX_M >= 0x03) || (__CORTEX_SC >= 300) + +/** \brief Reverse bit order of value + + This function reverses the bit order of the given value. + + \param [in] value Value to reverse + \return Reversed value + */ +#define __RBIT __rbit + + +/** \brief LDR Exclusive (8 bit) + + This function executes a exclusive LDR instruction for 8 bit value. + + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +#define __LDREXB(ptr) ((uint8_t ) __ldrex(ptr)) + + +/** \brief LDR Exclusive (16 bit) + + This function executes a exclusive LDR instruction for 16 bit values. + + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +#define __LDREXH(ptr) ((uint16_t) __ldrex(ptr)) + + +/** \brief LDR Exclusive (32 bit) + + This function executes a exclusive LDR instruction for 32 bit values. + + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +#define __LDREXW(ptr) ((uint32_t ) __ldrex(ptr)) + + +/** \brief STR Exclusive (8 bit) + + This function executes a exclusive STR instruction for 8 bit values. + + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +#define __STREXB(value, ptr) __strex(value, ptr) + + +/** \brief STR Exclusive (16 bit) + + This function executes a exclusive STR instruction for 16 bit values. + + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +#define __STREXH(value, ptr) __strex(value, ptr) + + +/** \brief STR Exclusive (32 bit) + + This function executes a exclusive STR instruction for 32 bit values. + + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +#define __STREXW(value, ptr) __strex(value, ptr) + + +/** \brief Remove the exclusive lock + + This function removes the exclusive lock which is created by LDREX. + + */ +#define __CLREX __clrex + + +/** \brief Signed Saturate + + This function saturates a signed value. + + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (1..32) + \return Saturated value + */ +#define __SSAT __ssat + + +/** \brief Unsigned Saturate + + This function saturates an unsigned value. + + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (0..31) + \return Saturated value + */ +#define __USAT __usat + + +/** \brief Count leading zeros + + This function counts the number of leading zeros of a data value. + + \param [in] value Value to count the leading zeros + \return number of leading zeros in value + */ +#define __CLZ __clz + + +/** \brief Rotate Right with Extend (32 bit) + + This function moves each bit of a bitstring right by one bit. The carry input is shifted in at the left end of the bitstring. + + \param [in] value Value to rotate + \return Rotated value + */ +#ifndef __NO_EMBEDDED_ASM +__attribute__((section(".rrx_text"))) __STATIC_INLINE __ASM uint32_t __RRX(uint32_t value) +{ + rrx r0, r0 + bx lr +} +#endif + + +/** \brief LDRT Unprivileged (8 bit) + + This function executes a Unprivileged LDRT instruction for 8 bit value. + + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +#define __LDRBT(ptr) ((uint8_t ) __ldrt(ptr)) + + +/** \brief LDRT Unprivileged (16 bit) + + This function executes a Unprivileged LDRT instruction for 16 bit values. + + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +#define __LDRHT(ptr) ((uint16_t) __ldrt(ptr)) + + +/** \brief LDRT Unprivileged (32 bit) + + This function executes a Unprivileged LDRT instruction for 32 bit values. + + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +#define __LDRT(ptr) ((uint32_t ) __ldrt(ptr)) + + +/** \brief STRT Unprivileged (8 bit) + + This function executes a Unprivileged STRT instruction for 8 bit values. + + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +#define __STRBT(value, ptr) __strt(value, ptr) + + +/** \brief STRT Unprivileged (16 bit) + + This function executes a Unprivileged STRT instruction for 16 bit values. + + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +#define __STRHT(value, ptr) __strt(value, ptr) + + +/** \brief STRT Unprivileged (32 bit) + + This function executes a Unprivileged STRT instruction for 32 bit values. + + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +#define __STRT(value, ptr) __strt(value, ptr) + +#endif /* (__CORTEX_M >= 0x03) || (__CORTEX_SC >= 300) */ + + +#elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/ +/* GNU gcc specific functions */ + +/* Define macros for porting to both thumb1 and thumb2. + * For thumb1, use low register (r0-r7), specified by constrant "l" + * Otherwise, use general registers, specified by constrant "r" */ +#if defined (__thumb__) && !defined (__thumb2__) +#define __CMSIS_GCC_OUT_REG(r) "=l" (r) +#define __CMSIS_GCC_USE_REG(r) "l" (r) +#else +#define __CMSIS_GCC_OUT_REG(r) "=r" (r) +#define __CMSIS_GCC_USE_REG(r) "r" (r) +#endif + +/** \brief No Operation + + No Operation does nothing. This instruction can be used for code alignment purposes. + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __NOP(void) +{ + __ASM volatile ("nop"); +} + + +/** \brief Wait For Interrupt + + Wait For Interrupt is a hint instruction that suspends execution + until one of a number of events occurs. + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __WFI(void) +{ + __ASM volatile ("wfi"); +} + + +/** \brief Wait For Event + + Wait For Event is a hint instruction that permits the processor to enter + a low-power state until one of a number of events occurs. + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __WFE(void) +{ + __ASM volatile ("wfe"); +} + + +/** \brief Send Event + + Send Event is a hint instruction. It causes an event to be signaled to the CPU. + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __SEV(void) +{ + __ASM volatile ("sev"); +} + + +/** \brief Instruction Synchronization Barrier + + Instruction Synchronization Barrier flushes the pipeline in the processor, + so that all instructions following the ISB are fetched from cache or + memory, after the instruction has been completed. + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __ISB(void) +{ + __ASM volatile ("isb"); +} + + +/** \brief Data Synchronization Barrier + + This function acts as a special kind of Data Memory Barrier. + It completes when all explicit memory accesses before this instruction complete. + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __DSB(void) +{ + __ASM volatile ("dsb"); +} + + +/** \brief Data Memory Barrier + + This function ensures the apparent order of the explicit memory operations before + and after the instruction, without ensuring their completion. + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __DMB(void) +{ + __ASM volatile ("dmb"); +} + + +/** \brief Reverse byte order (32 bit) + + This function reverses the byte order in integer value. + + \param [in] value Value to reverse + \return Reversed value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __REV(uint32_t value) +{ +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) + return __builtin_bswap32(value); +#else + uint32_t result; + + __ASM volatile ("rev %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return(result); +#endif +} + + +/** \brief Reverse byte order (16 bit) + + This function reverses the byte order in two unsigned short values. + + \param [in] value Value to reverse + \return Reversed value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __REV16(uint32_t value) +{ + uint32_t result; + + __ASM volatile ("rev16 %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return(result); +} + + +/** \brief Reverse byte order in signed short value + + This function reverses the byte order in a signed short value with sign extension to integer. + + \param [in] value Value to reverse + \return Reversed value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE int32_t __REVSH(int32_t value) +{ +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + return (short)__builtin_bswap16(value); +#else + uint32_t result; + + __ASM volatile ("revsh %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return(result); +#endif +} + + +/** \brief Rotate Right in unsigned value (32 bit) + + This function Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits. + + \param [in] value Value to rotate + \param [in] value Number of Bits to rotate + \return Rotated value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __ROR(uint32_t op1, uint32_t op2) +{ + return (op1 >> op2) | (op1 << (32 - op2)); +} + + +/** \brief Breakpoint + + This function causes the processor to enter Debug state. + Debug tools can use this to investigate system state when the instruction at a particular address is reached. + + \param [in] value is ignored by the processor. + If required, a debugger can use it to store additional information about the breakpoint. + */ +#define __BKPT(value) __ASM volatile ("bkpt "#value) + + +#if (__CORTEX_M >= 0x03) || (__CORTEX_SC >= 300) + +/** \brief Reverse bit order of value + + This function reverses the bit order of the given value. + + \param [in] value Value to reverse + \return Reversed value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __RBIT(uint32_t value) +{ + uint32_t result; + + __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) ); + return(result); +} + + +/** \brief LDR Exclusive (8 bit) + + This function executes a exclusive LDR instruction for 8 bit value. + + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint8_t __LDREXB(volatile uint8_t *addr) +{ + uint32_t result; + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + __ASM volatile ("ldrexb %0, %1" : "=r" (result) : "Q" (*addr) ); +#else + /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not + accepted by assembler. So has to use following less efficient pattern. + */ + __ASM volatile ("ldrexb %0, [%1]" : "=r" (result) : "r" (addr) : "memory" ); +#endif + return ((uint8_t) result); /* Add explicit type cast here */ +} + + +/** \brief LDR Exclusive (16 bit) + + This function executes a exclusive LDR instruction for 16 bit values. + + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint16_t __LDREXH(volatile uint16_t *addr) +{ + uint32_t result; + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + __ASM volatile ("ldrexh %0, %1" : "=r" (result) : "Q" (*addr) ); +#else + /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not + accepted by assembler. So has to use following less efficient pattern. + */ + __ASM volatile ("ldrexh %0, [%1]" : "=r" (result) : "r" (addr) : "memory" ); +#endif + return ((uint16_t) result); /* Add explicit type cast here */ +} + + +/** \brief LDR Exclusive (32 bit) + + This function executes a exclusive LDR instruction for 32 bit values. + + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __LDREXW(volatile uint32_t *addr) +{ + uint32_t result; + + __ASM volatile ("ldrex %0, %1" : "=r" (result) : "Q" (*addr) ); + return(result); +} + + +/** \brief STR Exclusive (8 bit) + + This function executes a exclusive STR instruction for 8 bit values. + + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __STREXB(uint8_t value, volatile uint8_t *addr) +{ + uint32_t result; + + __ASM volatile ("strexb %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) ); + return(result); +} + + +/** \brief STR Exclusive (16 bit) + + This function executes a exclusive STR instruction for 16 bit values. + + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __STREXH(uint16_t value, volatile uint16_t *addr) +{ + uint32_t result; + + __ASM volatile ("strexh %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) ); + return(result); +} + + +/** \brief STR Exclusive (32 bit) + + This function executes a exclusive STR instruction for 32 bit values. + + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __STREXW(uint32_t value, volatile uint32_t *addr) +{ + uint32_t result; + + __ASM volatile ("strex %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) ); + return(result); +} + + +/** \brief Remove the exclusive lock + + This function removes the exclusive lock which is created by LDREX. + + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __CLREX(void) +{ + __ASM volatile ("clrex" ::: "memory"); +} + + +/** \brief Signed Saturate + + This function saturates a signed value. + + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (1..32) + \return Saturated value + */ +#define __SSAT(ARG1,ARG2) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1); \ + __ASM ("ssat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ + __RES; \ + }) + + +/** \brief Unsigned Saturate + + This function saturates an unsigned value. + + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (0..31) + \return Saturated value + */ +#define __USAT(ARG1,ARG2) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1); \ + __ASM ("usat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ + __RES; \ + }) + + +/** \brief Count leading zeros + + This function counts the number of leading zeros of a data value. + + \param [in] value Value to count the leading zeros + \return number of leading zeros in value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint8_t __CLZ(uint32_t value) +{ + uint32_t result; + + __ASM volatile ("clz %0, %1" : "=r" (result) : "r" (value) ); + return ((uint8_t) result); /* Add explicit type cast here */ +} + + +/** \brief Rotate Right with Extend (32 bit) + + This function moves each bit of a bitstring right by one bit. The carry input is shifted in at the left end of the bitstring. + + \param [in] value Value to rotate + \return Rotated value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __RRX(uint32_t value) +{ + uint32_t result; + + __ASM volatile ("rrx %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return(result); +} + + +/** \brief LDRT Unprivileged (8 bit) + + This function executes a Unprivileged LDRT instruction for 8 bit value. + + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint8_t __LDRBT(volatile uint8_t *addr) +{ + uint32_t result; + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + __ASM volatile ("ldrbt %0, %1" : "=r" (result) : "Q" (*addr) ); +#else + /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not + accepted by assembler. So has to use following less efficient pattern. + */ + __ASM volatile ("ldrbt %0, [%1]" : "=r" (result) : "r" (addr) : "memory" ); +#endif + return ((uint8_t) result); /* Add explicit type cast here */ +} + + +/** \brief LDRT Unprivileged (16 bit) + + This function executes a Unprivileged LDRT instruction for 16 bit values. + + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint16_t __LDRHT(volatile uint16_t *addr) +{ + uint32_t result; + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + __ASM volatile ("ldrht %0, %1" : "=r" (result) : "Q" (*addr) ); +#else + /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not + accepted by assembler. So has to use following less efficient pattern. + */ + __ASM volatile ("ldrht %0, [%1]" : "=r" (result) : "r" (addr) : "memory" ); +#endif + return ((uint16_t) result); /* Add explicit type cast here */ +} + + +/** \brief LDRT Unprivileged (32 bit) + + This function executes a Unprivileged LDRT instruction for 32 bit values. + + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __LDRT(volatile uint32_t *addr) +{ + uint32_t result; + + __ASM volatile ("ldrt %0, %1" : "=r" (result) : "Q" (*addr) ); + return(result); +} + + +/** \brief STRT Unprivileged (8 bit) + + This function executes a Unprivileged STRT instruction for 8 bit values. + + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __STRBT(uint8_t value, volatile uint8_t *addr) +{ + __ASM volatile ("strbt %1, %0" : "=Q" (*addr) : "r" ((uint32_t)value) ); +} + + +/** \brief STRT Unprivileged (16 bit) + + This function executes a Unprivileged STRT instruction for 16 bit values. + + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __STRHT(uint16_t value, volatile uint16_t *addr) +{ + __ASM volatile ("strht %1, %0" : "=Q" (*addr) : "r" ((uint32_t)value) ); +} + + +/** \brief STRT Unprivileged (32 bit) + + This function executes a Unprivileged STRT instruction for 32 bit values. + + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __STRT(uint32_t value, volatile uint32_t *addr) +{ + __ASM volatile ("strt %1, %0" : "=Q" (*addr) : "r" (value) ); +} + +#endif /* (__CORTEX_M >= 0x03) || (__CORTEX_SC >= 300) */ + + +#elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/ +/* IAR iccarm specific functions */ +#include + + +#elif defined ( __TMS470__ ) /*---------------- TI CCS Compiler ------------------*/ +/* TI CCS specific functions */ +#include + + +#elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/ +/* TASKING carm specific functions */ +/* + * The CMSIS functions have been implemented as intrinsics in the compiler. + * Please use "carm -?i" to get an up to date list of all intrinsics, + * Including the CMSIS ones. + */ + + +#elif defined ( __CSMC__ ) /*------------------ COSMIC Compiler -------------------*/ +/* Cosmic specific functions */ +#include + +#endif + +/*@}*/ /* end of group CMSIS_Core_InstructionInterface */ + +#endif /* __CORE_CMINSTR_H */ diff --git a/components/toolchain/gcc/core_cmSimd.h b/components/toolchain/gcc/core_cmSimd.h new file mode 100644 index 0000000..ee58eee --- /dev/null +++ b/components/toolchain/gcc/core_cmSimd.h @@ -0,0 +1,697 @@ +/**************************************************************************//** + * @file core_cmSimd.h + * @brief CMSIS Cortex-M SIMD Header File + * @version V4.00 + * @date 22. August 2014 + * + * @note + * + ******************************************************************************/ +/* Copyright (c) 2009 - 2014 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. + ---------------------------------------------------------------------------*/ + + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#endif + +#ifndef __CORE_CMSIMD_H +#define __CORE_CMSIMD_H + +#ifdef __cplusplus + extern "C" { +#endif + + +/******************************************************************************* + * Hardware Abstraction Layer + ******************************************************************************/ + + +/* ################### Compiler specific Intrinsics ########################### */ +/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics + Access to dedicated SIMD instructions + @{ +*/ + +#if defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/ +/* ARM armcc specific functions */ +#define __SADD8 __sadd8 +#define __QADD8 __qadd8 +#define __SHADD8 __shadd8 +#define __UADD8 __uadd8 +#define __UQADD8 __uqadd8 +#define __UHADD8 __uhadd8 +#define __SSUB8 __ssub8 +#define __QSUB8 __qsub8 +#define __SHSUB8 __shsub8 +#define __USUB8 __usub8 +#define __UQSUB8 __uqsub8 +#define __UHSUB8 __uhsub8 +#define __SADD16 __sadd16 +#define __QADD16 __qadd16 +#define __SHADD16 __shadd16 +#define __UADD16 __uadd16 +#define __UQADD16 __uqadd16 +#define __UHADD16 __uhadd16 +#define __SSUB16 __ssub16 +#define __QSUB16 __qsub16 +#define __SHSUB16 __shsub16 +#define __USUB16 __usub16 +#define __UQSUB16 __uqsub16 +#define __UHSUB16 __uhsub16 +#define __SASX __sasx +#define __QASX __qasx +#define __SHASX __shasx +#define __UASX __uasx +#define __UQASX __uqasx +#define __UHASX __uhasx +#define __SSAX __ssax +#define __QSAX __qsax +#define __SHSAX __shsax +#define __USAX __usax +#define __UQSAX __uqsax +#define __UHSAX __uhsax +#define __USAD8 __usad8 +#define __USADA8 __usada8 +#define __SSAT16 __ssat16 +#define __USAT16 __usat16 +#define __UXTB16 __uxtb16 +#define __UXTAB16 __uxtab16 +#define __SXTB16 __sxtb16 +#define __SXTAB16 __sxtab16 +#define __SMUAD __smuad +#define __SMUADX __smuadx +#define __SMLAD __smlad +#define __SMLADX __smladx +#define __SMLALD __smlald +#define __SMLALDX __smlaldx +#define __SMUSD __smusd +#define __SMUSDX __smusdx +#define __SMLSD __smlsd +#define __SMLSDX __smlsdx +#define __SMLSLD __smlsld +#define __SMLSLDX __smlsldx +#define __SEL __sel +#define __QADD __qadd +#define __QSUB __qsub + +#define __PKHBT(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0x0000FFFFUL) | \ + ((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL) ) + +#define __PKHTB(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0xFFFF0000UL) | \ + ((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL) ) + +#define __SMMLA(ARG1,ARG2,ARG3) ( (int32_t)((((int64_t)(ARG1) * (ARG2)) + \ + ((int64_t)(ARG3) << 32) ) >> 32)) + + +#elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/ +/* GNU gcc specific functions */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("ssub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __USUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("ssub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __USUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("ssax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SHSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __USAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UQSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UHSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __USAD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usad8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __USADA8(uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("usada8 %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +#define __SSAT16(ARG1,ARG2) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1); \ + __ASM ("ssat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ + __RES; \ + }) + +#define __USAT16(ARG1,ARG2) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1); \ + __ASM ("usat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ + __RES; \ + }) + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UXTB16(uint32_t op1) +{ + uint32_t result; + + __ASM volatile ("uxtb16 %0, %1" : "=r" (result) : "r" (op1)); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __UXTAB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SXTB16(uint32_t op1) +{ + uint32_t result; + + __ASM volatile ("sxtb16 %0, %1" : "=r" (result) : "r" (op1)); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SXTAB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMUAD (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smuad %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMUADX (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smuadx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMLAD (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smlad %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMLADX (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smladx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint64_t __SMLALD (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ // Little endian + __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else // Big endian + __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint64_t __SMLALDX (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ // Little endian + __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else // Big endian + __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMUSD (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smusd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMUSDX (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smusdx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMLSD (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smlsd %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMLSDX (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smlsdx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint64_t __SMLSLD (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ // Little endian + __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else // Big endian + __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint64_t __SMLSLDX (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ // Little endian + __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else // Big endian + __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SEL (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sel %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QADD(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qadd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __QSUB(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qsub %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +#define __PKHBT(ARG1,ARG2,ARG3) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \ + __ASM ("pkhbt %0, %1, %2, lsl %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \ + __RES; \ + }) + +#define __PKHTB(ARG1,ARG2,ARG3) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \ + if (ARG3 == 0) \ + __ASM ("pkhtb %0, %1, %2" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2) ); \ + else \ + __ASM ("pkhtb %0, %1, %2, asr %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \ + __RES; \ + }) + +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SMMLA (int32_t op1, int32_t op2, int32_t op3) +{ + int32_t result; + + __ASM volatile ("smmla %0, %1, %2, %3" : "=r" (result): "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + + +#elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/ +/* IAR iccarm specific functions */ +#include + + +#elif defined ( __TMS470__ ) /*---------------- TI CCS Compiler ------------------*/ +/* TI CCS specific functions */ +#include + + +#elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/ +/* TASKING carm specific functions */ +/* not yet supported */ + + +#elif defined ( __CSMC__ ) /*------------------ COSMIC Compiler -------------------*/ +/* Cosmic specific functions */ +#include + +#endif + +/*@} end of group CMSIS_SIMD_intrinsics */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CMSIMD_H */ diff --git a/components/toolchain/gcc/gcc_nrf51_common.ld b/components/toolchain/gcc/gcc_nrf51_common.ld new file mode 100644 index 0000000..3bf8634 --- /dev/null +++ b/components/toolchain/gcc/gcc_nrf51_common.ld @@ -0,0 +1,164 @@ +/* Linker script for Nordic Semiconductor nRF5 devices + * + * Version: Sourcery G++ 4.5-1 + * Support: https://support.codesourcery.com/GNUToolchain/ + * + * Copyright (c) 2007, 2008, 2009, 2010 CodeSourcery, Inc. + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which 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*) + + *(.eh_frame*) + . = ALIGN(4); + } > 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 = .); + *(.preinit_array) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + *(SORT(.init_array.*)) + *(.init_array) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + *(SORT(.fini_array.*)) + *(.fini_array) + PROVIDE_HIDDEN (__fini_array_end = .); + + *(.jcr) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + end = __end__; + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} + diff --git a/components/toolchain/gcc/gcc_startup_nrf51.s b/components/toolchain/gcc/gcc_startup_nrf51.s new file mode 100644 index 0000000..90717c1 --- /dev/null +++ b/components/toolchain/gcc/gcc_startup_nrf51.s @@ -0,0 +1,266 @@ +/* +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. +*/ + +/* +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 armv6-m + + .section .stack + .align 3 +#ifdef __STACK_SIZE + .equ Stack_Size, __STACK_SIZE +#else + .equ Stack_Size, 2048 +#endif + .globl __StackTop + .globl __StackLimit +__StackLimit: + .space Stack_Size + .size __StackLimit, . - __StackLimit +__StackTop: + .size __StackTop, . - __StackTop + + .section .heap + .align 3 +#ifdef __HEAP_SIZE + .equ Heap_Size, __HEAP_SIZE +#else + .equ Heap_Size, 2048 +#endif + .globl __HeapBase + .globl __HeapLimit +__HeapBase: + .if Heap_Size + .space Heap_Size + .endif + .size __HeapBase, . - __HeapBase +__HeapLimit: + .size __HeapLimit, . - __HeapLimit + + .section .Vectors + .align 2 + .globl __Vectors +__Vectors: + .long __StackTop /* Top of Stack */ + .long Reset_Handler + .long NMI_Handler + .long HardFault_Handler + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .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 UART0_IRQHandler + .long SPI0_TWI0_IRQHandler + .long SPI1_TWI1_IRQHandler + .long 0 /*Reserved */ + .long GPIOTE_IRQHandler + .long ADC_IRQHandler + .long TIMER0_IRQHandler + .long TIMER1_IRQHandler + .long TIMER2_IRQHandler + .long RTC0_IRQHandler + .long TEMP_IRQHandler + .long RNG_IRQHandler + .long ECB_IRQHandler + .long CCM_AAR_IRQHandler + .long WDT_IRQHandler + .long RTC1_IRQHandler + .long QDEC_IRQHandler + .long LPCOMP_IRQHandler + .long SWI0_IRQHandler + .long SWI1_IRQHandler + .long SWI2_IRQHandler + .long SWI3_IRQHandler + .long SWI4_IRQHandler + .long SWI5_IRQHandler + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + + .size __Vectors, . - __Vectors + +/* Reset Handler */ + + .equ NRF_POWER_RAMON_ADDRESS, 0x40000524 + .equ NRF_POWER_RAMONB_ADDRESS, 0x40000554 + .equ NRF_POWER_RAMONx_RAMxON_ONMODE_Msk, 0x3 + + .text + .thumb + .thumb_func + .align 1 + .globl Reset_Handler + .type Reset_Handler, %function +Reset_Handler: + .fnstart + +/* Make sure ALL RAM banks are powered on */ + MOVS R1, #NRF_POWER_RAMONx_RAMxON_ONMODE_Msk + + LDR R0, =NRF_POWER_RAMON_ADDRESS + LDR R2, [R0] + ORRS R2, R1 + STR R2, [R0] + + LDR R0, =NRF_POWER_RAMONB_ADDRESS + LDR R2, [R0] + ORRS R2, R1 + STR R2, [R0] + +/* 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, =_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 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 + IRQ RADIO_IRQHandler + IRQ UART0_IRQHandler + IRQ SPI0_TWI0_IRQHandler + IRQ SPI1_TWI1_IRQHandler + IRQ GPIOTE_IRQHandler + IRQ ADC_IRQHandler + IRQ TIMER0_IRQHandler + IRQ TIMER1_IRQHandler + IRQ TIMER2_IRQHandler + IRQ RTC0_IRQHandler + IRQ TEMP_IRQHandler + IRQ RNG_IRQHandler + IRQ ECB_IRQHandler + IRQ CCM_AAR_IRQHandler + IRQ WDT_IRQHandler + IRQ RTC1_IRQHandler + IRQ QDEC_IRQHandler + IRQ LPCOMP_IRQHandler + IRQ SWI0_IRQHandler + IRQ SWI1_IRQHandler + IRQ SWI2_IRQHandler + IRQ SWI3_IRQHandler + IRQ SWI4_IRQHandler + IRQ SWI5_IRQHandler + + .end diff --git a/components/toolchain/gcc/gcc_startup_nrf52.s b/components/toolchain/gcc/gcc_startup_nrf52.s new file mode 100644 index 0000000..579739d --- /dev/null +++ b/components/toolchain/gcc/gcc_startup_nrf52.s @@ -0,0 +1,490 @@ +/* +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. +*/ + +/* +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 .stack + .align 3 +#ifdef __STACK_SIZE + .equ Stack_Size, __STACK_SIZE +#else + .equ Stack_Size, 8192 +#endif + .globl __StackTop + .globl __StackLimit +__StackLimit: + .space Stack_Size + .size __StackLimit, . - __StackLimit +__StackTop: + .size __StackTop, . - __StackTop + + .section .heap + .align 3 +#ifdef __HEAP_SIZE + .equ Heap_Size, __HEAP_SIZE +#else + .equ Heap_Size, 8192 +#endif + .globl __HeapBase + .globl __HeapLimit +__HeapBase: + .if Heap_Size + .space Heap_Size + .endif + .size __HeapBase, . - __HeapBase +__HeapLimit: + .size __HeapLimit, . - __HeapLimit + + .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 + .long SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler + .long SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler + .long NFCT_IRQHandler + .long GPIOTE_IRQHandler + .long SAADC_IRQHandler + .long TIMER0_IRQHandler + .long TIMER1_IRQHandler + .long TIMER2_IRQHandler + .long RTC0_IRQHandler + .long TEMP_IRQHandler + .long RNG_IRQHandler + .long ECB_IRQHandler + .long CCM_AAR_IRQHandler + .long WDT_IRQHandler + .long RTC1_IRQHandler + .long QDEC_IRQHandler + .long COMP_LPCOMP_IRQHandler + .long SWI0_EGU0_IRQHandler + .long SWI1_EGU1_IRQHandler + .long SWI2_EGU2_IRQHandler + .long SWI3_EGU3_IRQHandler + .long SWI4_EGU4_IRQHandler + .long SWI5_EGU5_IRQHandler + .long TIMER3_IRQHandler + .long TIMER4_IRQHandler + .long PWM0_IRQHandler + .long PDM_IRQHandler + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long MWU_IRQHandler + .long PWM1_IRQHandler + .long PWM2_IRQHandler + .long SPIM2_SPIS2_SPI2_IRQHandler + .long RTC2_IRQHandler + .long I2S_IRQHandler + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + .long 0 /*Reserved */ + + .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, =_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 + IRQ RADIO_IRQHandler + IRQ UARTE0_UART0_IRQHandler + IRQ SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler + IRQ SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler + IRQ NFCT_IRQHandler + IRQ GPIOTE_IRQHandler + IRQ SAADC_IRQHandler + IRQ TIMER0_IRQHandler + IRQ TIMER1_IRQHandler + IRQ TIMER2_IRQHandler + IRQ RTC0_IRQHandler + IRQ TEMP_IRQHandler + IRQ RNG_IRQHandler + IRQ ECB_IRQHandler + IRQ CCM_AAR_IRQHandler + IRQ WDT_IRQHandler + IRQ RTC1_IRQHandler + IRQ QDEC_IRQHandler + IRQ COMP_LPCOMP_IRQHandler + IRQ SWI0_EGU0_IRQHandler + IRQ SWI1_EGU1_IRQHandler + IRQ SWI2_EGU2_IRQHandler + IRQ SWI3_EGU3_IRQHandler + IRQ SWI4_EGU4_IRQHandler + IRQ SWI5_EGU5_IRQHandler + IRQ TIMER3_IRQHandler + IRQ TIMER4_IRQHandler + IRQ PWM0_IRQHandler + IRQ PDM_IRQHandler + IRQ MWU_IRQHandler + IRQ PWM1_IRQHandler + IRQ PWM2_IRQHandler + IRQ SPIM2_SPIS2_SPI2_IRQHandler + IRQ RTC2_IRQHandler + IRQ I2S_IRQHandler + + .end diff --git a/components/toolchain/gcc/nrf51_common.ld b/components/toolchain/gcc/nrf51_common.ld new file mode 100644 index 0000000..af3d2df --- /dev/null +++ b/components/toolchain/gcc/nrf51_common.ld @@ -0,0 +1,164 @@ +/* Linker script for Nordic Semiconductor nRF5 devices + * + * Version: Sourcery G++ 4.5-1 + * Support: https://support.codesourcery.com/GNUToolchain/ + * + * Copyright (c) 2007, 2008, 2009, 2010 CodeSourcery, Inc. + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which 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*) + + *(.eh_frame*) + . = ALIGN(4); + } > 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 = .); + *(SORT(.init_array.*)) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + *(SORT(.fini_array.*)) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + *(.jcr) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + end = __end__; + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} + diff --git a/components/toolchain/gcc/nrf51_xxaa.ld b/components/toolchain/gcc/nrf51_xxaa.ld new file mode 100644 index 0000000..ab9a5d2 --- /dev/null +++ b/components/toolchain/gcc/nrf51_xxaa.ld @@ -0,0 +1,13 @@ +/* Linker script to configure memory regions. */ + +SEARCH_DIR(.) +GROUP(-lgcc -lc -lnosys) + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x40000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x4000 +} + + +INCLUDE "nrf51_common.ld" diff --git a/components/toolchain/gcc/nrf51_xxab.ld b/components/toolchain/gcc/nrf51_xxab.ld new file mode 100644 index 0000000..95804ae --- /dev/null +++ b/components/toolchain/gcc/nrf51_xxab.ld @@ -0,0 +1,13 @@ +/* Linker script to configure memory regions. */ + +SEARCH_DIR(.) +GROUP(-lgcc -lc -lnosys) + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x20000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x4000 +} + + +INCLUDE "nrf51_common.ld" diff --git a/components/toolchain/gcc/nrf51_xxac.ld b/components/toolchain/gcc/nrf51_xxac.ld new file mode 100644 index 0000000..d74fa44 --- /dev/null +++ b/components/toolchain/gcc/nrf51_xxac.ld @@ -0,0 +1,13 @@ +/* Linker script to configure memory regions. */ + +SEARCH_DIR(.) +GROUP(-lgcc -lc -lnosys) + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x40000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x8000 +} + + +INCLUDE "nrf51_common.ld" diff --git a/components/toolchain/gcc/nrf52_common.ld b/components/toolchain/gcc/nrf52_common.ld new file mode 100644 index 0000000..af3d2df --- /dev/null +++ b/components/toolchain/gcc/nrf52_common.ld @@ -0,0 +1,164 @@ +/* Linker script for Nordic Semiconductor nRF5 devices + * + * Version: Sourcery G++ 4.5-1 + * Support: https://support.codesourcery.com/GNUToolchain/ + * + * Copyright (c) 2007, 2008, 2009, 2010 CodeSourcery, Inc. + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which 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*) + + *(.eh_frame*) + . = ALIGN(4); + } > 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 = .); + *(SORT(.init_array.*)) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + *(SORT(.fini_array.*)) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + *(.jcr) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + end = __end__; + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} + diff --git a/components/toolchain/gcc/nrf52_xxaa.ld b/components/toolchain/gcc/nrf52_xxaa.ld new file mode 100644 index 0000000..2ddbc84 --- /dev/null +++ b/components/toolchain/gcc/nrf52_xxaa.ld @@ -0,0 +1,13 @@ +/* Linker script to configure memory regions. */ + +SEARCH_DIR(.) +GROUP(-lgcc -lc -lnosys) + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x80000 + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x10000 +} + + +INCLUDE "nrf52_common.ld" diff --git a/components/toolchain/gcc/nrf5x_common.ld b/components/toolchain/gcc/nrf5x_common.ld new file mode 100644 index 0000000..af3d2df --- /dev/null +++ b/components/toolchain/gcc/nrf5x_common.ld @@ -0,0 +1,164 @@ +/* Linker script for Nordic Semiconductor nRF5 devices + * + * Version: Sourcery G++ 4.5-1 + * Support: https://support.codesourcery.com/GNUToolchain/ + * + * Copyright (c) 2007, 2008, 2009, 2010 CodeSourcery, Inc. + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") + +/* Linker script to place sections and symbol values. Should be used together + * with other linker script that defines memory regions FLASH and RAM. + * It references following symbols, which must be defined in code: + * Reset_Handler : Entry of reset handler + * + * It defines following symbols, which 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*) + + *(.eh_frame*) + . = ALIGN(4); + } > 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 = .); + *(SORT(.init_array.*)) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + *(SORT(.fini_array.*)) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + *(.jcr) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + end = __end__; + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later */ + .stack_dummy (COPY): + { + *(.stack*) + } > RAM + + /* Set stack top to end of RAM, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} + diff --git a/components/toolchain/iar/iar_nrf51_blank_xxaa.icf b/components/toolchain/iar/iar_nrf51_blank_xxaa.icf new file mode 100644 index 0000000..d36b037 --- /dev/null +++ b/components/toolchain/iar/iar_nrf51_blank_xxaa.icf @@ -0,0 +1,31 @@ +/*###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__ = 0x00000000; +/*-Memory Regions-*/ +define symbol __ICFEDIT_region_ROM_start__ = 0x00000000; +define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF; +define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; +define symbol __ICFEDIT_region_RAM_end__ = 0x20003FFF; +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x800; +define symbol __ICFEDIT_size_heap__ = 0x800; +/**** End of ICF editor section. ###ICF###*/ + +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 CSTACK, + block HEAP }; diff --git a/components/toolchain/iar/iar_nrf51_blank_xxac.icf b/components/toolchain/iar/iar_nrf51_blank_xxac.icf new file mode 100644 index 0000000..64f7bea --- /dev/null +++ b/components/toolchain/iar/iar_nrf51_blank_xxac.icf @@ -0,0 +1,31 @@ +/*###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__ = 0x00000000; +/*-Memory Regions-*/ +define symbol __ICFEDIT_region_ROM_start__ = 0x00000000; +define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF; +define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; +define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF; +/*-Sizes-*/ +define symbol __ICFEDIT_size_cstack__ = 0x800; +define symbol __ICFEDIT_size_heap__ = 0x800; +/**** End of ICF editor section. ###ICF###*/ + +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 CSTACK, + block HEAP }; diff --git a/components/toolchain/iar/iar_startup_nrf51.s b/components/toolchain/iar/iar_startup_nrf51.s new file mode 100644 index 0000000..dcf527b --- /dev/null +++ b/components/toolchain/iar/iar_startup_nrf51.s @@ -0,0 +1,272 @@ +;; 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. + + + +;; NOTE: Template files (including this one) are application specific and therefore +;; expected to be copied into the application project folder prior to its use! + +;; Description message + + 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 + 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 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD SVC_Handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD PendSV_Handler + DCD SysTick_Handler + + ; External Interrupts + DCD POWER_CLOCK_IRQHandler + DCD RADIO_IRQHandler + DCD UART0_IRQHandler + DCD SPI0_TWI0_IRQHandler + DCD SPI1_TWI1_IRQHandler + DCD 0 ; Reserved + DCD GPIOTE_IRQHandler + DCD ADC_IRQHandler + DCD TIMER0_IRQHandler + DCD TIMER1_IRQHandler + DCD TIMER2_IRQHandler + DCD RTC0_IRQHandler + DCD TEMP_IRQHandler + DCD RNG_IRQHandler + DCD ECB_IRQHandler + DCD CCM_AAR_IRQHandler + DCD WDT_IRQHandler + DCD RTC1_IRQHandler + DCD QDEC_IRQHandler + DCD LPCOMP_IRQHandler + DCD SWI0_IRQHandler + DCD SWI1_IRQHandler + DCD SWI2_IRQHandler + DCD SWI3_IRQHandler + DCD SWI4_IRQHandler + DCD SWI5_IRQHandler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + +__Vectors_End +__Vectors EQU __vector_table +__Vectors_Size EQU __Vectors_End - __Vectors + +NRF_POWER_RAMON_ADDRESS EQU 0x40000524 ; NRF_POWER->RAMON address +NRF_POWER_RAMONB_ADDRESS EQU 0x40000554 ; NRF_POWER->RAMONB address +NRF_POWER_RAMONx_RAMxON_ONMODE_Msk EQU 0x3 ; All RAM blocks on in onmode bit mask + +; Default handlers. + THUMB + + PUBWEAK Reset_Handler + SECTION .text:CODE:REORDER:NOROOT(2) +Reset_Handler + MOVS R1, #NRF_POWER_RAMONx_RAMxON_ONMODE_Msk + + LDR R0, =NRF_POWER_RAMON_ADDRESS + LDR R2, [R0] + ORRS R2, R2, R1 + STR R2, [R0] + + LDR R0, =NRF_POWER_RAMONB_ADDRESS + LDR R2, [R0] + ORRS R2, R2, R1 + STR R2, [R0] + + LDR R0, =SystemInit + BLX R0 + LDR R0, =__iar_program_start + BX R0 + + ; Dummy exception handlers + + + PUBWEAK NMI_Handler + SECTION .text:CODE:REORDER:NOROOT(1) +NMI_Handler + B . + + PUBWEAK HardFault_Handler + SECTION .text:CODE:REORDER:NOROOT(1) +HardFault_Handler + B . + + PUBWEAK SVC_Handler + SECTION .text:CODE:REORDER:NOROOT(1) +SVC_Handler + B . + + PUBWEAK PendSV_Handler + SECTION .text:CODE:REORDER:NOROOT(1) +PendSV_Handler + B . + + PUBWEAK SysTick_Handler + SECTION .text:CODE:REORDER:NOROOT(1) +SysTick_Handler + B . + + + ; Dummy interrupt handlers + + PUBWEAK POWER_CLOCK_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +POWER_CLOCK_IRQHandler + B . + PUBWEAK RADIO_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +RADIO_IRQHandler + B . + PUBWEAK UART0_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +UART0_IRQHandler + B . + PUBWEAK SPI0_TWI0_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +SPI0_TWI0_IRQHandler + B . + PUBWEAK SPI1_TWI1_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +SPI1_TWI1_IRQHandler + B . + PUBWEAK GPIOTE_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +GPIOTE_IRQHandler + B . + PUBWEAK ADC_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +ADC_IRQHandler + B . + PUBWEAK TIMER0_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +TIMER0_IRQHandler + B . + PUBWEAK TIMER1_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +TIMER1_IRQHandler + B . + PUBWEAK TIMER2_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +TIMER2_IRQHandler + B . + PUBWEAK RTC0_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +RTC0_IRQHandler + B . + PUBWEAK TEMP_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +TEMP_IRQHandler + B . + PUBWEAK RNG_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +RNG_IRQHandler + B . + PUBWEAK ECB_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +ECB_IRQHandler + B . + PUBWEAK CCM_AAR_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +CCM_AAR_IRQHandler + B . + PUBWEAK WDT_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +WDT_IRQHandler + B . + PUBWEAK RTC1_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +RTC1_IRQHandler + B . + PUBWEAK QDEC_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +QDEC_IRQHandler + B . + PUBWEAK LPCOMP_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +LPCOMP_IRQHandler + B . + PUBWEAK SWI0_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +SWI0_IRQHandler + B . + PUBWEAK SWI1_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +SWI1_IRQHandler + B . + PUBWEAK SWI2_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +SWI2_IRQHandler + B . + PUBWEAK SWI3_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +SWI3_IRQHandler + B . + PUBWEAK SWI4_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +SWI4_IRQHandler + B . + PUBWEAK SWI5_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +SWI5_IRQHandler + B . + + END + + diff --git a/components/toolchain/iar/iar_startup_nrf52.s b/components/toolchain/iar/iar_startup_nrf52.s new file mode 100644 index 0000000..8ff1814 --- /dev/null +++ b/components/toolchain/iar/iar_startup_nrf52.s @@ -0,0 +1,524 @@ +;; 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. + + + +;; NOTE: Template files (including this one) are application specific and therefore +;; expected to be copied into the application project folder prior to its use! + +;; Description message + + 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 + 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 0 ; Reserved + DCD 0 ; Reserved + DCD PendSV_Handler + DCD SysTick_Handler + + ; External Interrupts + DCD POWER_CLOCK_IRQHandler + DCD RADIO_IRQHandler + DCD UARTE0_UART0_IRQHandler + DCD SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler + DCD SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler + DCD NFCT_IRQHandler + DCD GPIOTE_IRQHandler + DCD SAADC_IRQHandler + DCD TIMER0_IRQHandler + DCD TIMER1_IRQHandler + DCD TIMER2_IRQHandler + DCD RTC0_IRQHandler + DCD TEMP_IRQHandler + DCD RNG_IRQHandler + DCD ECB_IRQHandler + DCD CCM_AAR_IRQHandler + DCD WDT_IRQHandler + DCD RTC1_IRQHandler + DCD QDEC_IRQHandler + DCD COMP_LPCOMP_IRQHandler + DCD SWI0_EGU0_IRQHandler + DCD SWI1_EGU1_IRQHandler + DCD SWI2_EGU2_IRQHandler + DCD SWI3_EGU3_IRQHandler + DCD SWI4_EGU4_IRQHandler + DCD SWI5_EGU5_IRQHandler + DCD TIMER3_IRQHandler + DCD TIMER4_IRQHandler + DCD PWM0_IRQHandler + DCD PDM_IRQHandler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD MWU_IRQHandler + DCD PWM1_IRQHandler + DCD PWM2_IRQHandler + DCD SPIM2_SPIS2_SPI2_IRQHandler + DCD RTC2_IRQHandler + DCD I2S_IRQHandler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + +__Vectors_End +__Vectors EQU __vector_table +__Vectors_Size EQU __Vectors_End - __Vectors + +; Default handlers. + THUMB + + PUBWEAK Reset_Handler + SECTION .text:CODE:REORDER:NOROOT(2) +Reset_Handler + + LDR R0, =SystemInit + BLX R0 + LDR R0, =__iar_program_start + BX R0 + + ; Dummy exception handlers + + + PUBWEAK NMI_Handler + SECTION .text:CODE:REORDER:NOROOT(1) +NMI_Handler + B . + + PUBWEAK HardFault_Handler + SECTION .text:CODE:REORDER:NOROOT(1) +HardFault_Handler + B . + + PUBWEAK MemoryManagement_Handler + SECTION .text:CODE:REORDER:NOROOT(1) +MemoryManagement_Handler + B . + + PUBWEAK BusFault_Handler + SECTION .text:CODE:REORDER:NOROOT(1) +BusFault_Handler + B . + + PUBWEAK UsageFault_Handler + SECTION .text:CODE:REORDER:NOROOT(1) +UsageFault_Handler + B . + + PUBWEAK SVC_Handler + SECTION .text:CODE:REORDER:NOROOT(1) +SVC_Handler + B . + + PUBWEAK PendSV_Handler + SECTION .text:CODE:REORDER:NOROOT(1) +PendSV_Handler + B . + + PUBWEAK SysTick_Handler + SECTION .text:CODE:REORDER:NOROOT(1) +SysTick_Handler + B . + + + ; Dummy interrupt handlers + + PUBWEAK POWER_CLOCK_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +POWER_CLOCK_IRQHandler + B . + PUBWEAK RADIO_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +RADIO_IRQHandler + B . + PUBWEAK UARTE0_UART0_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +UARTE0_UART0_IRQHandler + B . + PUBWEAK SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler + B . + PUBWEAK SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler + B . + PUBWEAK NFCT_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +NFCT_IRQHandler + B . + PUBWEAK GPIOTE_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +GPIOTE_IRQHandler + B . + PUBWEAK SAADC_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +SAADC_IRQHandler + B . + PUBWEAK TIMER0_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +TIMER0_IRQHandler + B . + PUBWEAK TIMER1_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +TIMER1_IRQHandler + B . + PUBWEAK TIMER2_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +TIMER2_IRQHandler + B . + PUBWEAK RTC0_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +RTC0_IRQHandler + B . + PUBWEAK TEMP_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +TEMP_IRQHandler + B . + PUBWEAK RNG_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +RNG_IRQHandler + B . + PUBWEAK ECB_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +ECB_IRQHandler + B . + PUBWEAK CCM_AAR_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +CCM_AAR_IRQHandler + B . + PUBWEAK WDT_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +WDT_IRQHandler + B . + PUBWEAK RTC1_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +RTC1_IRQHandler + B . + PUBWEAK QDEC_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +QDEC_IRQHandler + B . + PUBWEAK COMP_LPCOMP_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +COMP_LPCOMP_IRQHandler + B . + PUBWEAK SWI0_EGU0_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +SWI0_EGU0_IRQHandler + B . + PUBWEAK SWI1_EGU1_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +SWI1_EGU1_IRQHandler + B . + PUBWEAK SWI2_EGU2_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +SWI2_EGU2_IRQHandler + B . + PUBWEAK SWI3_EGU3_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +SWI3_EGU3_IRQHandler + B . + PUBWEAK SWI4_EGU4_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +SWI4_EGU4_IRQHandler + B . + PUBWEAK SWI5_EGU5_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +SWI5_EGU5_IRQHandler + B . + PUBWEAK TIMER3_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +TIMER3_IRQHandler + B . + PUBWEAK TIMER4_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +TIMER4_IRQHandler + B . + PUBWEAK PWM0_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +PWM0_IRQHandler + B . + PUBWEAK PDM_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +PDM_IRQHandler + B . + PUBWEAK MWU_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +MWU_IRQHandler + B . + PUBWEAK PWM1_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +PWM1_IRQHandler + B . + PUBWEAK PWM2_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +PWM2_IRQHandler + B . + PUBWEAK SPIM2_SPIS2_SPI2_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +SPIM2_SPIS2_SPI2_IRQHandler + B . + PUBWEAK RTC2_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +RTC2_IRQHandler + B . + PUBWEAK I2S_IRQHandler + SECTION .text:CODE:REORDER:NOROOT(1) +I2S_IRQHandler + B . + + END + + diff --git a/components/toolchain/system_nrf51.c b/components/toolchain/system_nrf51.c new file mode 100644 index 0000000..9bfe509 --- /dev/null +++ b/components/toolchain/system_nrf51.c @@ -0,0 +1,121 @@ +/* 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. + * + */ + +/* NOTE: Template files (including this one) are application specific and therefore expected to + be copied into the application project folder prior to its use! */ + +#include +#include +#include "nrf.h" +#include "system_nrf51.h" + +/*lint ++flb "Enter library region" */ + + +#define __SYSTEM_CLOCK (16000000UL) /*!< nRF51 devices use a fixed System Clock Frequency of 16MHz */ + +static bool is_manual_peripheral_setup_needed(void); +static bool is_disabled_in_debug_needed(void); + + +#if defined ( __CC_ARM ) + uint32_t SystemCoreClock __attribute__((used)) = __SYSTEM_CLOCK; +#elif defined ( __ICCARM__ ) + __root uint32_t SystemCoreClock = __SYSTEM_CLOCK; +#elif defined ( __GNUC__ ) + uint32_t SystemCoreClock __attribute__((used)) = __SYSTEM_CLOCK; +#endif + +void SystemCoreClockUpdate(void) +{ + SystemCoreClock = __SYSTEM_CLOCK; +} + +void SystemInit(void) +{ + /* If desired, switch off the unused RAM to lower consumption by the use of RAMON register. + It can also be done in the application main() function. */ + + /* Prepare the peripherals for use as indicated by the PAN 26 "System: Manual setup is required + to enable the use of peripherals" found at Product Anomaly document for your device found at + https://www.nordicsemi.com/. The side effect of executing these instructions in the devices + that do not need it is that the new peripherals in the second generation devices (LPCOMP for + example) will not be available. */ + if (is_manual_peripheral_setup_needed()) + { + *(uint32_t volatile *)0x40000504 = 0xC007FFDF; + *(uint32_t volatile *)0x40006C18 = 0x00008000; + } + + /* Disable PROTENSET registers under debug, as indicated by PAN 59 "MPU: Reset value of DISABLEINDEBUG + register is incorrect" found at Product Anomaly document four your device found at + https://www.nordicsemi.com/. There is no side effect of using these instruction if not needed. */ + if (is_disabled_in_debug_needed()) + { + NRF_MPU->DISABLEINDEBUG = MPU_DISABLEINDEBUG_DISABLEINDEBUG_Disabled << MPU_DISABLEINDEBUG_DISABLEINDEBUG_Pos; + } +} + + +static bool is_manual_peripheral_setup_needed(void) +{ + if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x1) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) + { + if ((((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x00) && (((*(uint32_t *)0xF0000FEC) & 0x000000F0) == 0x0)) + { + return true; + } + if ((((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x10) && (((*(uint32_t *)0xF0000FEC) & 0x000000F0) == 0x0)) + { + return true; + } + if ((((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) && (((*(uint32_t *)0xF0000FEC) & 0x000000F0) == 0x0)) + { + return true; + } + } + + return false; +} + +static bool is_disabled_in_debug_needed(void) +{ + if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x1) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) + { + if ((((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x40) && (((*(uint32_t *)0xF0000FEC) & 0x000000F0) == 0x0)) + { + return true; + } + } + + return false; +} + +/*lint --flb "Leave library region" */ diff --git a/components/toolchain/system_nrf51.h b/components/toolchain/system_nrf51.h new file mode 100644 index 0000000..4901173 --- /dev/null +++ b/components/toolchain/system_nrf51.h @@ -0,0 +1,69 @@ +/* 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. + * + */ + +#ifndef SYSTEM_NRF51_H +#define SYSTEM_NRF51_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_NRF51_H */ diff --git a/components/toolchain/system_nrf51422.c b/components/toolchain/system_nrf51422.c new file mode 100644 index 0000000..712114e --- /dev/null +++ b/components/toolchain/system_nrf51422.c @@ -0,0 +1,121 @@ +/* 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. + * + */ + +/* NOTE: Template files (including this one) are application specific and therefore expected to + be copied into the application project folder prior to its use! */ + +#include +#include +#include "nrf.h" +#include "system_nrf51.h" + +/*lint ++flb "Enter library region" */ + + +#define __SYSTEM_CLOCK (16000000UL) /*!< nRF51 devices use a fixed System Clock Frequency of 16MHz */ + +static bool is_manual_peripheral_setup_needed(void); +static bool is_disabled_in_debug_needed(void); + + +#if defined ( __CC_ARM ) + uint32_t SystemCoreClock __attribute__((used)) = __SYSTEM_CLOCK; +#elif defined ( __ICCARM__ ) + __root uint32_t SystemCoreClock = __SYSTEM_CLOCK; +#elif defined ( __GNUC__ ) + uint32_t SystemCoreClock __attribute__((used)) = __SYSTEM_CLOCK; +#endif + +void SystemCoreClockUpdate(void) +{ + SystemCoreClock = __SYSTEM_CLOCK; +} + +void SystemInit(void) +{ + /* If desired, switch off the unused RAM to lower consumption by the use of RAMON register. + It can also be done in the application main() function. */ + + /* Prepare the peripherals for use as indicated by the PAN 26 "System: Manual setup is required + to enable the use of peripherals" found at Product Anomaly document for your device found at + https://www.nordicsemi.com/. The side effect of executing these instructions in the devices + that do not need it is that the new peripherals in the second generation devices (LPCOMP for + example) will not be available. */ + if (is_manual_peripheral_setup_needed()) + { + *(uint32_t volatile *)0x40000504 = 0xC007FFDF; + *(uint32_t volatile *)0x40006C18 = 0x00008000; + } + + /* Disable PROTENSET registers under debug, as indicated by PAN 59 "MPU: Reset value of DISABLEINDEBUG + register is incorrect" found at Product Anomaly document four your device found at + https://www.nordicsemi.com/. There is no side effect of using these instruction if not needed. */ + if (is_disabled_in_debug_needed()) + { + NRF_MPU->DISABLEINDEBUG = MPU_DISABLEINDEBUG_DISABLEINDEBUG_Disabled << MPU_DISABLEINDEBUG_DISABLEINDEBUG_Pos; + } +} + + +static bool is_manual_peripheral_setup_needed(void) +{ + if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x1) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) + { + if ((((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x00) && (((*(uint32_t *)0xF0000FEC) & 0x000000F0) == 0x0)) + { + return true; + } + if ((((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x10) && (((*(uint32_t *)0xF0000FEC) & 0x000000F0) == 0x0)) + { + return true; + } + if ((((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) && (((*(uint32_t *)0xF0000FEC) & 0x000000F0) == 0x0)) + { + return true; + } + } + + return false; +} + +static bool is_disabled_in_debug_needed(void) +{ + if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x1) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) + { + if ((((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x40) && (((*(uint32_t *)0xF0000FEC) & 0x000000F0) == 0x0)) + { + return true; + } + } + + return false; +} + +/*lint --flb "Leave library region" */ diff --git a/components/toolchain/system_nrf52.c b/components/toolchain/system_nrf52.c new file mode 100644 index 0000000..26f24f2 --- /dev/null +++ b/components/toolchain/system_nrf52.c @@ -0,0 +1,263 @@ +/* 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. + * + */ + +#include +#include +#include "nrf.h" +#include "system_nrf52.h" + +/*lint ++flb "Enter library region" */ + +#define __SYSTEM_CLOCK_16M (16000000UL) +#define __SYSTEM_CLOCK_64M (64000000UL) + +static bool errata_31(void); +static bool errata_32(void); +static bool errata_36(void); +static bool errata_37(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 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 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[0] & 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(); +} + + +static bool errata_31(void) +{ + if ((((*(uint32_t *)0xF0000FE0) & 0x000000FF) == 0x6) && (((*(uint32_t *)0xF0000FE4) & 0x0000000F) == 0x0)) + { + if ((((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30) && (((*(uint32_t *)0xF0000FEC) & 0x000000F0) == 0x0)) + { + return true; + } + if ((((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x40) && (((*(uint32_t *)0xF0000FEC) & 0x000000F0) == 0x0)) + { + return true; + } + if ((((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x50) && (((*(uint32_t *)0xF0000FEC) & 0x000000F0) == 0x0)) + { + 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) && (((*(uint32_t *)0xF0000FEC) & 0x000000F0) == 0x0)) + { + 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) && (((*(uint32_t *)0xF0000FEC) & 0x000000F0) == 0x0)) + { + return true; + } + if ((((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x40) && (((*(uint32_t *)0xF0000FEC) & 0x000000F0) == 0x0)) + { + return true; + } + if ((((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x50) && (((*(uint32_t *)0xF0000FEC) & 0x000000F0) == 0x0)) + { + 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) && (((*(uint32_t *)0xF0000FEC) & 0x000000F0) == 0x0)) + { + 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) && (((*(uint32_t *)0xF0000FEC) & 0x000000F0) == 0x0)) + { + return true; + } + } + + return false; +} + + + + + + +/*lint --flb "Leave library region" */ diff --git a/components/toolchain/system_nrf52.h b/components/toolchain/system_nrf52.h new file mode 100644 index 0000000..f0464c1 --- /dev/null +++ b/components/toolchain/system_nrf52.h @@ -0,0 +1,69 @@ +/* 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. + * + */ + +#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/config/bsp.h b/config/bsp.h new file mode 100644 index 0000000..ab69513 --- /dev/null +++ b/config/bsp.h @@ -0,0 +1,4 @@ +#define RX_PIN_NUMBER 0 +#define TX_PIN_NUMBER 6 +#define RTS_PIN_NUMBER 0 +#define CTS_PIN_NUMBER 0 diff --git a/config/nrf_drv_config.h b/config/nrf_drv_config.h new file mode 100644 index 0000000..5ff228c --- /dev/null +++ b/config/nrf_drv_config.h @@ -0,0 +1,341 @@ +/* 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. + * + */ + +#ifndef NRF_DRV_CONFIG_H +#define NRF_DRV_CONFIG_H + +/* CLOCK */ +#define CLOCK_CONFIG_XTAL_FREQ NRF_CLOCK_XTALFREQ_Default +#define CLOCK_CONFIG_LF_SRC NRF_CLOCK_LF_SRC_Xtal +#define CLOCK_CONFIG_LF_RC_CAL_INTERVAL RC_2000MS_CALIBRATION_INTERVAL +#define CLOCK_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW + +/* GPIOTE */ +#define GPIOTE_ENABLED 1 + +#if (GPIOTE_ENABLED == 1) +#define GPIOTE_CONFIG_USE_SWI_EGU false +#define GPIOTE_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW +#define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 4 +#endif + +/* TIMER */ +#define TIMER0_ENABLED 0 + +#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_LOW + +#define TIMER0_INSTANCE_INDEX 0 +#endif + +#define TIMER1_ENABLED 0 + +#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_LOW + +#define TIMER1_INSTANCE_INDEX (TIMER0_ENABLED) +#endif + +#define TIMER2_ENABLED 0 + +#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_LOW + +#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_LOW + +#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_LOW + +#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_LOW +#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_LOW +#define RTC1_CONFIG_RELIABLE false + +#define RTC1_INSTANCE_INDEX (RTC0_ENABLED) +#endif + +#define RTC_COUNT (RTC0_ENABLED+RTC1_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_LOW +#endif + +/* 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_LOW + +#define SPI0_INSTANCE_INDEX 0 +#endif + +#define SPI1_ENABLED 0 + +#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_LOW + +#define SPI1_INSTANCE_INDEX (SPI0_ENABLED) +#endif + +#define SPI2_ENABLED 0 + +#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_LOW + +#define SPI2_INSTANCE_INDEX (SPI0_ENABLED + SPI1_ENABLED) +#endif + +#define SPI_COUNT (SPI0_ENABLED + SPI1_ENABLED + SPI2_ENABLED) + +/* SPIS */ +#define SPIS0_ENABLED 0 + +#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_LOW + +#define SPIS0_INSTANCE_INDEX 0 +#endif + +#define SPIS1_ENABLED 0 + +#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_LOW + +#define SPIS1_INSTANCE_INDEX SPIS0_ENABLED +#endif + +#define SPIS2_ENABLED 0 + +#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_LOW + +#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_DISABLED +#define UART0_CONFIG_PARITY NRF_UART_PARITY_EXCLUDED +#define UART0_CONFIG_BAUDRATE NRF_UART_BAUDRATE_38400 +#define UART0_CONFIG_PSEL_TXD 0 +#define UART0_CONFIG_PSEL_RXD 0 +#define UART0_CONFIG_PSEL_CTS 0 +#define UART0_CONFIG_PSEL_RTS 0 +#define UART0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW +#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 0 + +#if (TWI0_ENABLED == 1) +#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_LOW + +#define TWI0_INSTANCE_INDEX 0 +#endif + +#define TWI1_ENABLED 1 + +#if (TWI1_ENABLED == 1) +#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_LOW + +#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_LOW + + #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_LOW + + #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 +/** + * @brief Definition for patching PAN problems + * + * Set this definition to nonzero value to patch anomalies + * from MPW3 - first lunch microcontroller. + * + * Concerns: + * - PAN-29: TWIS: incorrect bits in ERRORSRC + * - PAN-30: TWIS: STOP task does not work as expected + */ +#define NRF_TWIS_PATCH_FOR_MPW3 1 + + +/* 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_LOW +#define QDEC_CONFIG_DBFEN false +#define QDEC_CONFIG_SAMPLE_INTEN false +#endif + +/* SAADC */ +#define SAADC_ENABLED 0 + +#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_LOW +#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_LOW +#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 + + +#include "nrf_drv_config_validation.h" + +#endif // NRF_DRV_CONFIG_H diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..24846e3 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,269 @@ + + + + 电子墨水屏蓝牙控制器 + + + + + +

4.2 寸电子墨水屏蓝牙控制器(nRF51)

+ +
+ 一些小提示 +
    +
  • 驱动选择:黑白屏可尝试 EPD_4in2 / EPD_4in2_V2, 三色屏选择 EPD_4in2b_V2 (选错驱动可能会导致任何未知的异常,重启即可恢复)
  • +
  • 引脚配置:格式为十六进制,顺序:MOSI/SCLK/CS/DC/ST/BUSY/BS,必须按此顺序包含完整的 7 个引脚配置(没有用到的引脚可配置为 FF
  • +
  • + 指令列表(指令和参数全部要使用十六进制): +
      +
    • 00+引脚配置: 设置引脚映射(见上面引脚配置)
    • +
    • 01+驱动 ID: 驱动初始化(支持的驱动 ID: 01/02/03
    • +
    • 02: 清空屏幕(把屏幕刷为白色)
    • +
    • 03+命令: 发送命令到屏幕(请参考屏幕主控手册)
    • +
    • 04+数据: 写入数据到屏幕内存(同上)
    • +
    • 05: 刷新屏幕(显示已写入屏幕内存的数据)
    • +
    • 06: 让屏幕进入睡眠状态
    • +
    +
  • +
+

+ 致谢:屏幕驱动代码来自微雪 E-Paper Shield,本网页代码最初基于 atc1441/ATC_TLSR_Paper 项目的网页控制端代码修改而来。 +

+
+ +
+ 蓝牙连接 + + +
+ +
+ 驱动配置 + 屏幕驱动: + + 引脚配置: + + +
+ +
+ 调试助手 + + + +
+ +
+ 蓝牙传图 +
+ + +
+ +
提示:此文本框需填写取模后的图片数据(十六进制)
+
+ +
+ 日志 + +
+
+ + + \ No newline at end of file diff --git a/main.c b/main.c new file mode 100644 index 0000000..559aed8 --- /dev/null +++ b/main.c @@ -0,0 +1,380 @@ +/* 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. + * + */ +/** @example examples/ble_peripheral/ble_app_hrs/main.c + * + * @brief Heart Rate Service Sample Application main file. + * + * This file contains the source code for a sample application using the Heart Rate service + * (and also Battery and Device Information services). This application uses the + * @ref srvlib_conn_params module. + */ + +#include +#include +#include "nordic_common.h" +#include "nrf.h" +#include "nrf_log.h" +#include "ble.h" +#include "ble_hci.h" +#include "ble_srv_common.h" +#include "ble_advdata.h" +#include "ble_advertising.h" +#include "ble_conn_params.h" +#include "softdevice_handler.h" +#include "app_error.h" +#include "app_timer.h" +#include "EPD_ble.h" + +#define IS_SRVC_CHANGED_CHARACT_PRESENT 1 /**< Include or not the service_changed characteristic. if not enabled, the server's database cannot be changed for the lifetime of the device*/ + +#define DEVICE_NAME "NRF_EPD_420" /**< Name of device. Will be included in the advertising data. */ +#define MANUFACTURER_NAME "NordicSemiconductor" /**< Manufacturer. Will be passed to Device Information Service. */ + +#define APP_ADV_INTERVAL 300 /**< The advertising interval (in units of 0.625 ms. This value corresponds to 40 ms). */ +#define APP_ADV_TIMEOUT_IN_SECONDS 180 /**< The advertising timeout (in units of seconds). */ +#define APP_TIMER_PRESCALER 0 /**< Value of the RTC1 PRESCALER register. */ +#define APP_TIMER_OP_QUEUE_SIZE 4 /**< Size of timer operation queues. */ + +#define MIN_CONN_INTERVAL MSEC_TO_UNITS(7.5, UNIT_1_25_MS) /**< Minimum connection interval (7.5 ms) */ +#define MAX_CONN_INTERVAL MSEC_TO_UNITS(30, UNIT_1_25_MS) /**< Maximum connection interval (30 ms). */ +#define SLAVE_LATENCY 6 /**< Slave latency. */ +#define CONN_SUP_TIMEOUT MSEC_TO_UNITS(430, UNIT_10_MS) /**< Connection supervisory timeout (430 ms). */ + +#define FIRST_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(5000, APP_TIMER_PRESCALER) /**< Time from initiating event (connect or start of notification) to first time sd_ble_gap_conn_param_update is called (5 seconds). */ +#define NEXT_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(30000, APP_TIMER_PRESCALER)/**< Time between each call to sd_ble_gap_conn_param_update after the first call (30 seconds). */ +#define MAX_CONN_PARAMS_UPDATE_COUNT 3 /**< Number of attempts before giving up the connection parameter negotiation. */ + +#define BLE_MAX_DATA_LEN (GATT_MTU_SIZE_DEFAULT - 3) /**< Maximum length of data (in bytes) that can be transmitted to the peer. */ + +#define DEAD_BEEF 0xDEADBEEF /**< Value used as error code on stack dump, can be used to identify stack location on stack unwind. */ + +static uint16_t m_conn_handle = BLE_CONN_HANDLE_INVALID; /**< Handle of the current connection. */ +static ble_epd_t m_epd; /**< Structure to identify the EPD Service. */ + +/**@brief Callback function for asserts in the SoftDevice. + * + * @details This function will be called in case of an assert in the SoftDevice. + * + * @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 Assert. + * @warning On assert from the SoftDevice, the system can only recover on reset. + * + * @param[in] line_num Line number of the failing ASSERT call. + * @param[in] file_name File name of the failing ASSERT call. + */ +void assert_nrf_callback(uint16_t line_num, const uint8_t * p_file_name) +{ + app_error_handler(DEAD_BEEF, line_num, p_file_name); +} + +/**@brief Function for the Timer initialization. + * + * @details Initializes the timer module. This creates and starts application timers. + */ +static void timers_init(void) +{ + // Initialize timer module. + APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false); +} + +/**@brief Function for initializing services that will be used by the application. + */ +static void services_init(void) +{ + uint32_t err_code; + + memset(&m_epd, 0, sizeof(ble_epd_t)); + err_code = ble_epd_init(&m_epd); + APP_ERROR_CHECK(err_code); +} + +/**@brief Function for the GAP initialization. + * + * @details This function sets up all the necessary GAP (Generic Access Profile) parameters of the + * device including the device name, appearance, and the preferred connection parameters. + */ +static void gap_params_init(void) +{ + uint32_t err_code; + ble_gap_conn_params_t gap_conn_params; + ble_gap_conn_sec_mode_t sec_mode; + + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode); + + err_code = sd_ble_gap_device_name_set(&sec_mode, + (const uint8_t *)DEVICE_NAME, + strlen(DEVICE_NAME)); + APP_ERROR_CHECK(err_code); + + memset(&gap_conn_params, 0, sizeof(gap_conn_params)); + + 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); + APP_ERROR_CHECK(err_code); +} + +/**@brief Function for handling the Connection Parameters Module. + * + * @details This function will be called for all events in the Connection Parameters Module which + * are passed to the application. + * @note All this function does is to disconnect. This could have been done by simply + * setting the disconnect_on_fail config parameter, but instead we use the event + * handler mechanism to demonstrate its use. + * + * @param[in] p_evt Event received from the Connection Parameters Module. + */ +static void on_conn_params_evt(ble_conn_params_evt_t * p_evt) +{ + uint32_t err_code; + + if (p_evt->evt_type == BLE_CONN_PARAMS_EVT_FAILED) + { + err_code = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_CONN_INTERVAL_UNACCEPTABLE); + APP_ERROR_CHECK(err_code); + } +} + + +/**@brief Function for handling a Connection Parameters error. + * + * @param[in] nrf_error Error code containing information about what went wrong. + */ +static void conn_params_error_handler(uint32_t nrf_error) +{ + APP_ERROR_HANDLER(nrf_error); +} + + +/**@brief Function for initializing the Connection Parameters module. + */ +static void conn_params_init(void) +{ + uint32_t err_code; + ble_conn_params_init_t cp_init; + + memset(&cp_init, 0, sizeof(cp_init)); + + cp_init.p_conn_params = NULL; + 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.evt_handler = on_conn_params_evt; + cp_init.error_handler = conn_params_error_handler; + + err_code = ble_conn_params_init(&cp_init); + APP_ERROR_CHECK(err_code); +} + + +/**@brief Function for putting the chip into sleep mode. + * + * @note This function will not return. + */ +static void sleep_mode_enter(void) +{ + // Go to system-off mode (this function will not return; wakeup will cause a reset). + uint32_t err_code = sd_power_system_off(); + APP_ERROR_CHECK(err_code); +} + + +/**@brief Function for handling advertising events. + * + * @details This function will be called for advertising events which are passed to the application. + * + * @param[in] ble_adv_evt Advertising event. + */ +static void on_adv_evt(ble_adv_evt_t ble_adv_evt) +{ + switch (ble_adv_evt) + { + case BLE_ADV_EVT_FAST: + break; + case BLE_ADV_EVT_IDLE: + sleep_mode_enter(); + break; + default: + break; + } +} + +/**@brief Function for handling the Application's BLE Stack events. + * + * @param[in] p_ble_evt Bluetooth stack 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: + m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle; + break; + + case BLE_GAP_EVT_DISCONNECTED: + m_conn_handle = BLE_CONN_HANDLE_INVALID; + err_code = ble_advertising_start(BLE_ADV_MODE_FAST); + APP_ERROR_CHECK(err_code); + break; + + case BLE_GAP_EVT_SEC_PARAMS_REQUEST: + // Pairing not supported + 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_SYS_ATTR_MISSING: + // No system attributes have been stored. + err_code = sd_ble_gatts_sys_attr_set(m_conn_handle, NULL, 0, 0); + APP_ERROR_CHECK(err_code); + break; + + case BLE_GATTC_EVT_TIMEOUT: + case BLE_GATTS_EVT_TIMEOUT: + // Disconnect on GATT Server and Client timeout events. + 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; + + default: + // No implementation needed. + break; + } +} + + +/**@brief Function for dispatching a BLE stack event to all modules with a BLE stack event handler. + * + * @details This function is called from the BLE Stack event interrupt handler after a BLE stack + * event has been received. + * + * @param[in] p_ble_evt Bluetooth stack event. + */ +static void ble_evt_dispatch(ble_evt_t * p_ble_evt) +{ + ble_conn_params_on_ble_evt(p_ble_evt); + ble_epd_on_ble_evt(&m_epd, p_ble_evt); + on_ble_evt(p_ble_evt); + ble_advertising_on_ble_evt(p_ble_evt); +} + + +/**@brief Function for dispatching a system event to interested modules. + * + * @details This function is called from the System event interrupt handler after a system + * event has been received. + * + * @param[in] sys_evt System stack event. + */ +static void sys_evt_dispatch(uint32_t sys_evt) +{ + ble_advertising_on_sys_evt(sys_evt); +} + + +/**@brief Function for initializing the BLE stack. + * + * @details Initializes the SoftDevice and the BLE event interrupt. + */ +static void ble_stack_init(void) +{ + uint32_t err_code; + + // Initialize the SoftDevice handler module. + SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_SYNTH_250_PPM, NULL); + + // Enable BLE stack. + ble_enable_params_t ble_enable_params; + memset(&ble_enable_params, 0, sizeof(ble_enable_params)); + err_code = sd_ble_enable(&ble_enable_params); + APP_ERROR_CHECK(err_code); + + // Register with the SoftDevice handler module for BLE events. + err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch); + APP_ERROR_CHECK(err_code); + + // Register with the SoftDevice handler module for BLE events. + err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch); + APP_ERROR_CHECK(err_code); +} + +/**@brief Function for initializing the Advertising functionality. + */ +static void advertising_init(void) +{ + uint32_t err_code; + ble_advdata_t advdata; + + // Build advertising data struct to pass into @ref ble_advertising_init. + memset(&advdata, 0, sizeof(advdata)); + + advdata.name_type = BLE_ADVDATA_FULL_NAME; + advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE; + + ble_adv_modes_config_t options = {0}; + options.ble_adv_fast_enabled = BLE_ADV_FAST_ENABLED; + options.ble_adv_fast_interval = APP_ADV_INTERVAL; + options.ble_adv_fast_timeout = APP_ADV_TIMEOUT_IN_SECONDS; + + err_code = ble_advertising_init(&advdata, NULL, &options, on_adv_evt, NULL); + APP_ERROR_CHECK(err_code); +} + +/**@brief Function for the Power manager. + */ +static void power_manage(void) +{ + uint32_t err_code = sd_app_evt_wait(); + APP_ERROR_CHECK(err_code); +} + +/**@brief Function for application main entry. + */ +int main(void) +{ + uint32_t err_code; + + err_code = NRF_LOG_INIT(); + APP_ERROR_CHECK(err_code); + + NRF_LOG_PRINTF("start..\n"); + + timers_init(); + ble_stack_init(); + gap_params_init(); + services_init(); + advertising_init(); + conn_params_init(); + + err_code = ble_advertising_start(BLE_ADV_MODE_FAST); + APP_ERROR_CHECK(err_code); + + NRF_LOG_PRINTF("done.\n"); + + for (;;) + { + power_manage(); + } +}

!Y2mK{ud?ti;PWi}ec;s=-U}SJ@C(2V7XBS@%EJEv++^Xu0cR{6guBDSBjN6{ z@L_OYV&M|FyDfYi+?y<1>AG3IUz7P|^A~}CuPYN0XSi<4?-ViMXI;OLNV{(Gzachw zaG_iuGqs-s$HzVV;o@^1jLMFS@5b}u`Yf-fEc|s#o@>g#^x-#rc%*q+2wBQc_ucb8m=$VW5bN{8eh>!N+3LmcZ;nhCO2ax8XzT18HTRzMOjOL>J8$KMMr@rVc_Tf?= zKFNod`*58Puk+z+efVA<{)P|l@!>ap*fCF&VLMq9eYnhrPxj#z!1s@;3aTl z+91Q{;lax;fN2^Z0?cP33pJh!oJKR}i!F@rMBwRIPh(n%&jJntoA4=M?jvWlB>z(2 ze*p6qf%s0~6R;k^o`d)a;LQLAzY3ghVQe)M7h3pG;2SJF7x?3rz6*g5LwrVGEAZ*C z&){vq2@8J%_=mvEAKKFc{FY_!Yrv;k`U{Z}hgf(j@Yxow25z=+8}Q{8z8Cn9mi{Mz z@38pK0pD(=@6W*VQMhw;{df=fHz*%Y>1pp6ye+U3`b>UL1Fi?=LwNE}0^V!IcNXyT zz^44x0DlPB)ThgVkAOWW1{r=k@a2|0-vj2F_%zLb8TcN^$2I;N@Nmel(0DX5_J_cx z{Eq|vxTS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*=o-9c_2eC&9if?Os1h=-S>IO6?3N7${; literal 0 HcmV?d00001 diff --git a/components/properitary_rf/esb/nrf_esb.h b/components/properitary_rf/esb/nrf_esb.h new file mode 100644 index 0000000..c61cefd --- /dev/null +++ b/components/properitary_rf/esb/nrf_esb.h @@ -0,0 +1,714 @@ +/* Copyright (c) 2011 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. + * + * $LastChangedRevision: 39629 $ + */ + +/** + * @file + * @brief Enhanced ShockBurst API. + * +*/ + +#ifndef NRF_ESB_H__ +#define NRF_ESB_H__ + +#include +#include +#include "nrf_esb_constants.h" + + +/** + * @defgroup esb_02_api Application Programming Interface (API) + * @{ + * @ingroup modules_02_esb + * @brief Enhanced ShockBurst Application Programming Interface (API). +*/ + + +/** + * @enum nrf_esb_mode_t + * @brief Enumerator used for selecting the ESB mode. + */ +typedef enum +{ + NRF_ESB_MODE_PTX, ///< Primary Transmitter mode + NRF_ESB_MODE_PRX, ///< Primary Receiver mode +} nrf_esb_mode_t; + +/** + * @enum nrf_esb_packet_t + * @brief Enumerator used for selecting TX packet type used in + * PTX mode. + */ +typedef enum +{ + NRF_ESB_PACKET_USE_ACK, ///< PTX packet requires ACK. + NRF_ESB_PACKET_NO_ACK, ///< PTX packet does not require ACK. +} nrf_esb_packet_t ; + + +/** + * @enum nrf_esb_base_address_length_t + * @brief Enumerator used for selecting the base address length. + */ +typedef enum +{ + NRF_ESB_BASE_ADDRESS_LENGTH_2B, ///< 2 byte address length + NRF_ESB_BASE_ADDRESS_LENGTH_3B, ///< 3 byte address length + NRF_ESB_BASE_ADDRESS_LENGTH_4B ///< 4 byte address length +} nrf_esb_base_address_length_t; + + +/** + * @enum nrf_esb_output_power_t + * @brief Enumerator used for selecting the TX output power. + */ +typedef enum +{ + NRF_ESB_OUTPUT_POWER_4_DBM, ///< 4 dBm output power. + NRF_ESB_OUTPUT_POWER_0_DBM, ///< 0 dBm output power. + NRF_ESB_OUTPUT_POWER_N4_DBM, ///< -4 dBm output power. + NRF_ESB_OUTPUT_POWER_N8_DBM, ///< -8 dBm output power. + NRF_ESB_OUTPUT_POWER_N12_DBM, ///< -12 dBm output power. + NRF_ESB_OUTPUT_POWER_N16_DBM, ///< -16 dBm output power. + NRF_ESB_OUTPUT_POWER_N20_DBM ///< -20 dBm output power. +} nrf_esb_output_power_t; + + +/** + * @enum nrf_esb_datarate_t + * @brief Enumerator used for selecting the radio data rate. + */ +typedef enum +{ + NRF_ESB_DATARATE_250_KBPS, ///< 250 Kbps datarate + NRF_ESB_DATARATE_1_MBPS, ///< 1 Mbps datarate + NRF_ESB_DATARATE_2_MBPS, ///< 1 Mbps datarate +} nrf_esb_datarate_t; + + +/** + * @enum nrf_esb_crc_length_t + * @brief Enumerator used for selecting the CRC length. + */ +typedef enum +{ + NRF_ESB_CRC_OFF, ///< CRC check disabled + NRF_ESB_CRC_LENGTH_1_BYTE, ///< CRC check set to 8-bit + NRF_ESB_CRC_LENGTH_2_BYTE ///< CRC check set to 16-bit +} nrf_esb_crc_length_t; + +/** + * @enum nrf_esb_xosc_ctl_t + * @brief Enumerator used for specifying whether switching the + * external 16 MHz oscillator on/off shall be handled automatically + * inside ESB or manually by the application. + */ +typedef enum +{ + NRF_ESB_XOSC_CTL_AUTO, ///< Switch XOSC on/off automatically + NRF_ESB_XOSC_CTL_MANUAL ///< Switch XOSC on/off manually +} nrf_esb_xosc_ctl_t; + +/******************************************************************************/ +/** @name General API functions + * @{ */ +/******************************************************************************/ + +/** + * @brief Initialize ESB. + * + * @param mode The mode to initialize ESB in. + * + * @retval true If ESB initialized. + * @retval false If ESB failed to initialize. + */ +bool nrf_esb_init(nrf_esb_mode_t mode); + + +/** + * @brief Enable ESB. + * + * Equivalent to setting CE high in legacy ESB. + * + * When enabled the behaviour described for the current ESB mode will apply. + */ +void nrf_esb_enable(void); + +/** + * @brief Disable ESB. + * + * Equivalent to setting CE low in legacy ESB. + * + * When calling this function ESB will begin disabling, + * and will be fully disabled when ESB calls nrf_esb_disabled(). + * If there are any pending notifications (callbacks) , or if any new notifications + * are being added to the internal notification queue while ESB is disabling, + * these will be sent to the application before ESB is fully disabled. + * + * After ESB has been fully disabled, no more notifications will be + * sent to the application. + */ +void nrf_esb_disable(void); + +/** Check whether ESB is enabled or disabled. + * + * @retval true If ESB is enabled. + * @retval false If ESB is disabled. + */ +bool nrf_esb_is_enabled(void); + +/** @} */ + + +/******************************************************************************/ +/** @name functions + * @{ */ +/******************************************************************************/ + +/** + * @brief TX success callback. + * + * In PTX mode this function is called after the PTX has sent a packet + * and received the corresponding ACK packet from a PRX. + * + * In PRX mode this function is called after a payload in ACK is assumed + * successfully transmitted, that is when the PRX received a new packet + * (new PID or CRC) and the previous ACK sent to a PTX contained a + * payload. + * + * @param tx_pipe The pipe on which the ACK packet was received. + * + * @param rssi Received signal strength indicator in dBm of measured ACK. + * + * As the RSSI measurement requires a minimum on-air duration of the received + * packet, the measured RSSI value will not be reliable when ALL of the following + * criteria are met: + * + * - Datarate = 2 Mbps + * - Payload length = 0 + * - CRC is off + * + */ +void nrf_esb_tx_success(uint32_t tx_pipe, int32_t rssi); + + +/** + * @brief TX failed callback (PTX mode only). + * + * This is called after the maximum number of TX attempts + * were reached for a packet. The packet is deleted from the TX FIFO. + * + * Note that when NRF_ESB_PACKET_NO_ACK is used this callback is + * always made after sending a packet. + * @sa nrf_esb_set_max_number_of_tx_attempts(). + * + * @param tx_pipe The pipe that failed to send a packet. + */ +void nrf_esb_tx_failed(uint32_t tx_pipe); + + +/** + * @brief RX data ready callback. + * + * PTX mode: This is called after an ACK is received from a PRX containing a + * payload. + * + * PRX mode: This is called after a packet is received from a PTX ACK is + * received from a PRX containing a payload. + * + * @param rx_pipe is the pipe on which a packet was received. + * This value must be < NRF_ESB_CONST_PIPE_COUNT. + * + * @param rssi Received signal strength indicator in dBm of packet. + * + * As the RSSI measurement requires a minimum on-air duration of the received + * packet, the measured RSSI value will not be reliable when ALL of the following + * criteria are met: + * + * - Datarate = 2 Mbps + * - Payload length = 0 + * - CRC is off + * + */ +void nrf_esb_rx_data_ready(uint32_t rx_pipe, int32_t rssi); + + +/** + * @brief Disabled callback. + * + * This is called after ESB enters the disabled state. + * There is no further CPU use by ESB, the radio is disabled and the timer is + * powered down. + */ +void nrf_esb_disabled(void); + +/** @} */ + + +/******************************************************************************/ +/** @name Packet transmission and receiving functions + * @{ */ +/******************************************************************************/ + +/** + * @brief Add a packet to the tail of the TX FIFO. + * + * In PTX mode, the packet will be transmitted at the next occation when ESB is enabled. + * In PRX mode, the payload will be piggybacked to onto an ACK. + * + * @param payload Pointer to the payload. + * @param payload_length The number of bytes of the payload to transmit. + * @param pipe The pipe for which to add the payload. This value must be < NRF_ESB_CONST_PIPE_COUNT. + * @param packet_type Specifies whether an ACK is required (ignored when in + * PRX mode, or when the dynamic ack feature is disabled). + * @sa nrf_esb_enable_dyn_ack() + * + * @retval true If the packet was successfully added to the TX FIFO. + * @retval false If pipe was invalid, payload pointer was NULL, payload length + was invalid, insufficient space in FIFO memory pool or + insufficient packets in TX queue. + */ +bool nrf_esb_add_packet_to_tx_fifo(uint32_t pipe, uint8_t * payload, uint32_t payload_length, nrf_esb_packet_t packet_type); + + +/** + * @brief Fetch a packet from the head of the RX FIFO. + * + * @param payload Pointer to copy the payload to. + * @param payload_length Pointer to copy the payload length to. The + * payload length is given in bytes (0 to NRF_ESB_CONST_MAX_PAYLOAD_LENGTH). + * @param pipe Pipe for which to add the payload. This value must be < NRF_ESB_CONST_PIPE_COUNT. + * + * @retval true If the fetch was successful. + * @retval false If there was no packet in the FIFO or the payload pointer + * was NULL. + */ +bool nrf_esb_fetch_packet_from_rx_fifo(uint32_t pipe, uint8_t * payload, uint32_t* payload_length); + + +/** + * @brief Get the number of packets residing in the TX FIFO on a specific + * pipe. + * + * @param pipe The pipe for which to check. This value must be < NRF_ESB_CONST_PIPE_COUNT. + * + * @retval The number of packets in the TX FIFO for the pipe. + */ +uint32_t nrf_esb_get_tx_fifo_packet_count(uint32_t pipe); + + +/** + * @brief Get the number of packets residing in the RX FIFO on a specific + * pipe. + * + * @param pipe The pipe for which to check. This value must be < NRF_ESB_CONST_PIPE_COUNT. + * + * @retval The number of packets in the RX FIFO for the pipe. + */ +uint32_t nrf_esb_get_rx_fifo_packet_count(uint32_t pipe); + + +/** + * @brief Flush the RX FIFO for a specific pipe. + * + * Delete all the packets and free the memory of the TX FIFO for a + * specific pipe. + * + * Note that it is not allowed to flush a TX FIFO when + * ESB is enabled. + * + * @param pipe The pipe for which to flush. This value must be < NRF_ESB_CONST_PIPE_COUNT. + */ +void nrf_esb_flush_tx_fifo(uint32_t pipe); + + +/** + * @brief Flush the RX FIFO for a specific pipe. + * + * Delete all the packets and free the memory of the RX FIFO for a + * specific pipe. + * + * @param pipe The pipe for which to flush. This value must be < NRF_ESB_CONST_PIPE_COUNT. + */ +void nrf_esb_flush_rx_fifo(uint32_t pipe); + + +/** + * @brief Get the total number of transmission attempts + * used for sending the previous successful packet. + * + * The value applies to the packet for which the latest + * nrf_esb_tx_data_sent callback was made. + * + * @return The number of transmission attempts for the + * previous transmitted packet. + */ +uint16_t nrf_esb_get_tx_attempts(void); + + +/** +* @brief Specify that the previous used 2 bit packet ID (PID) shall be reused for +* a given pipe. +* +* This function can be used for continue retransmitting a packet that previously failed +* to be transmitted. + +* Example: +* 1. Upload initial packet: +* nrf_esb_add_packet_to_tx_fifo(PIPE_NUMBER, my_tx_payload, TX_PAYLOAD_LENGTH, NRF_ESB_PACKET_USE_ACK); +* 2. If the initial packet fails to be transmitted, specify the PID to be reused: +* nrf_esb_reuse_pid(PIPE_NUMBER); +* 3. Continue re-transmission of the packet by re-uploading it to the TX FIFO: +* nrf_esb_add_packet_to_tx_fifo(PIPE_NUMBER, my_tx_payload, TX_PAYLOAD_LENGTH, NRF_ESB_PACKET_USE_ACK); +* +* @param pipe is the pipe for which to reuse the PID. +*/ +void nrf_esb_reuse_pid(uint32_t pipe); + +/** @} */ + + +/******************************************************************************/ +/** @name Configuration functions + * + * Configuration 'set' functions may only be called while ESB is disabled. The + * new parameter comes into effect when ESB is enabled again. + * + * Configuration 'get' functions may be called at any time. + * + * @{ */ +/******************************************************************************/ + + +/** + * @brief Set the mode. + * + * @param mode The mode to be used. + * See nrf_esb_mode_t for a list of valid modes. + * + * @retval true if the mode was set properly. + * @retval false if the mode is invalid. + */ +bool nrf_esb_set_mode(nrf_esb_mode_t mode); + + +/** + * @brief Get function counterpart to nrf_esb_set_mode(). + * + * @return The current ESB mode. + */ +nrf_esb_mode_t nrf_esb_get_mode(void); + + +/** + * @brief Set the base address length. + * + * @param length The base address length. + * + * @retval true If the address length was set. + * @retval false If the length was invalid. + */ +bool nrf_esb_set_base_address_length(nrf_esb_base_address_length_t length); + + +/** + * @brief Get function counterpart to nrf_esb_set_base_address_length(). + * + * @return The current base_address length. + */ +nrf_esb_base_address_length_t nrf_esb_get_base_address_length(void); + + +/** + * @brief Set the base address for pipe 0. + * + * The full on-air address for each pipe is composed of a multi-byte base address + * and a prefix address byte. + * + * For packets to be received correctly, the most significant byte of + * the base address should not be an alternating sequence of 0s and 1s i.e. + * it should not be 0x55 or 0xAA. + * + * @param base_address is the 4 byte base address. The parameter is + * 4 bytes, however only the least L significant bytes are used, where L is + * set by nrf_esb_set_base_address_length(). + * + * @retval true if base_address_0 was set. + * @retval false if ESB was enabled. + */ +bool nrf_esb_set_base_address_0(uint32_t base_address); + + +/** + * @brief Get function counterpart to nrf_esb_set_base_address_0(). + * + * @return Base address 0. + */ +uint32_t nrf_esb_get_base_address_0(void); + + +/** + * @brief Set the base address for pipes 1-7. + * + * Pipes 1 through 7 share base_address_1. @sa nrf_esb_set_base_address_0. + * + * @param base_address is the 4 byte base address. The parameter is + * 4 bytes, however only the least L significant bytes are used, where L is + * set by nrf_esb_set_base_address_length(). + * + * @retval true If base_address_1 was set. + * @retval false If ESB was enabled. + */ +bool nrf_esb_set_base_address_1(uint32_t base_address); + + +/** + * @brief Get function counterpart to nrf_esb_set_base_address_1(). + * + * @return Base address 1. + */ +uint32_t nrf_esb_get_base_address_1(void); + + +/** + * @brief Set the address prefix byte for a specific pipe. + * + * Each pipe should have its own unique prefix byte. + * + * @param pipe The pipe that the address should apply to. This value must be < NRF_ESB_CONST_PIPE_COUNT. + * @param address The address prefix byte. + * + * @retval true If the address prefix byte was set. + * @retval false If ESB was enabled or if the pipe was invalid. + */ +bool nrf_esb_set_address_prefix_byte(uint32_t pipe, uint8_t address); + + +/** + * @brief Get function counterpart to nrf_esb_set_address_prefix_byte(). + * + * @param pipe the pipe for which to get the address. This value must be < NRF_ESB_CONST_PIPE_COUNT. + * @param out_address is the pointer in which to return the address byte. + * + * @retval true If the value was set. + * @retval false If ESB was enabled, or the pipe was invalid, + * or the out_address pointer was NULL. + */ +bool nrf_esb_get_address_prefix_byte(uint32_t pipe, uint8_t* out_address); + + +/** + * @brief Set which pipes the node shall listen on in PRX mode. + * + * This value is a bitmap, and each bit corresponds to a given pipe number. + * Bit 0 set to "1" enables pipes 0, bit 1 set to "1" enables pipe 1 + * and so forth. + * The maximum number of pipes is defined by NRF_CONST_ESB_PIPE_COUNT. + * + * @param pipes A bitmap specifying which pipes to monitor. + * + * @retval true If the bitmap was set. + * @retval false If ESB was enabled. + */ +bool nrf_esb_set_enabled_prx_pipes(uint32_t pipes); + + +/** + * @brief Get function counterpart to nrf_esb_set_enabled_prx_pipes(). + * + * @return Bitmap holding the current enabled pipes. + */ +uint32_t nrf_esb_get_enabled_prx_pipes(void); + + +/** + * @brief Set the retransmission delay. + * + * The retransmission delay is the delay from the start of a packet + * that failed to receive the ACK until the start of the retransmission + * attempt. + * + * The minimum value of the retransmission delay is dependent of the + * radio data rate and the payload size(s).(@sa nrf_esb_set_datarate()). + * As a rule of thumb, when using 32 byte payloads in each direction (forward and ACK): + * + * - For NRF_ESB_DATARATE_2_MBPS the retransmission delay must be >= 600 us. + * - For NRF_ESB_DATARATE_1_MBPS the retransmission delay must >= 900 us. + * - For NRF_ESB_DATARATE_250_KBPS the retransmission delay must be >= 2700 us. + * + * @param delay_us The delay in microseconds between each + * retransmission attempt. + * + * @retval true If the retransmit delay was set. + * @retval false If ESB was enabled. + */ +bool nrf_esb_set_retransmit_delay(uint32_t delay_us); + + +/** + * @brief Get function counterpart to nrf_esb_set_retransmit_delay(). + * + * @return The current retransmission delay. + */ +uint32_t nrf_esb_get_retransmit_delay(void); + + +/** + * @brief Set the maximum number of TX attempts + * that can be used for a single packet. + * + * @param attempts The maximum number of TX attempts. + * 0 indicates that a packet can use a infinite number of attempts. + * + * @retval false If ESB was enabled. + */ +bool nrf_esb_set_max_number_of_tx_attempts(uint16_t attempts); + + +/** + * @brief Get function counterpart to nrf_esb_set_max_number_of_retransmits(). + * + * @return The current number of maximum retransmission attempts. + */ +uint16_t nrf_esb_get_max_number_of_tx_attempts(void); + + +/** + * @brief Set the Radio Frequency (RF) channel. + * + * The valid channels are in the range 0 <= channel <= 125, where the + * actual centre frequency is (2400 + channel) MHz. + * + * @param channel The RF Channel to use. + * + * @return false If ESB was enabled. + */ +bool nrf_esb_set_channel(uint32_t channel); + + +/** + * @brief Get function counterpart to nrf_esb_set_channel(). + * + * @return The current RF channel. + */ +uint32_t nrf_esb_get_channel(void); + + +/** + * @brief Set the radio TX output power. + * + * @param power The output power. + * + * @return false If the output_power was invalid. + */ +bool nrf_esb_set_output_power(nrf_esb_output_power_t power); + + +/** + * @brief Get function counterpart to nrf_esb_set_output_power(). + * + * @return The output power. + */ +nrf_esb_output_power_t nrf_esb_get_output_power(void); + + +/** + * @brief Set the radio datarate. + * + * @param datarate Datarate. + * + * @retval false If the datarate was invalid. + */ +bool nrf_esb_set_datarate(nrf_esb_datarate_t datarate); + + +/** + * @brief Get function counterpart to nrf_esb_set_datarate(). + * + * @return The current datarate. + */ +nrf_esb_datarate_t nrf_esb_get_datarate(void); + + +/** + * @brief Set the CRC length. + * + * The CRC length should be the same on both PTX and PRX in order + * to ensure correct operation. + * + * @param length The CRC length. + * + * @retval false If ESB was enabled or the length was invalid. + */ +bool nrf_esb_set_crc_length(nrf_esb_crc_length_t length); + + +/** + * @brief Get function counterpart to nrf_esb_set_crc_length(). + * + * @return The current CRC length. + */ +nrf_esb_crc_length_t nrf_esb_get_crc_length(void); + + +/** + * @brief Set whether start/stop of external oscillator (XOSC) shall be handled + * automatically inside ESB or manually by the application. + * + * When controlling the XOSC manually from the application it is + * required that the XOSC is started before ESB is enabled. + * + * When start/stop of the XOSC is handled automatically by ESB, + * the XOSC will only be running when needed, that is when the radio + * is being used or when ESB needs to maintain synchronization. + * + * It is required that the XOSC is started in order for the radio to be + * able to send or receive any packets. + * + * @param xosc_ctl setting for XOSC control. + * + * @retval true if the parameter was set. + * @retval false if Gazell was enabled or the xosc_ctl value was invalid. + */ +bool nrf_esb_set_xosc_ctl(nrf_esb_xosc_ctl_t xosc_ctl); + + +/** + * @brief Enable dynamic ACK feature. After initialization this feature is disabled. + * + * The dynamic ACK feature must be enabled in order for the @b packet_type + * parameter in the nrf_esb_add_packet_to_tx_fifo() function to have any effect, + * or for the ACK bit of received packets to be evaluated. + * + * When the dynamic ACK feature is disabled, all packets will be ACK'ed. + */ +void nrf_esb_enable_dyn_ack(void); + +/** + * @brief Disable dynamic ACK feature. + * + * @sa nrf_esb_enable_dyn_ack() + */ +void nrf_esb_disable_dyn_ack(void); + + +/** + * Get function counterpart for nrf_esb_set_xosc_ctl(); + * + * @return The XOSC control setting. + */ +nrf_esb_xosc_ctl_t nrf_esb_get_xosc_ctl(void); + + +/** @} */ +/** @} */ +#endif diff --git a/components/properitary_rf/esb/nrf_esb_constants.h b/components/properitary_rf/esb/nrf_esb_constants.h new file mode 100644 index 0000000..2a9be62 --- /dev/null +++ b/components/properitary_rf/esb/nrf_esb_constants.h @@ -0,0 +1,141 @@ +/* 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. + * + * $LastChangedRevision: 32956 $ + */ + + +/** + * @file + * @brief Enhanced ShockBurst constants and default values. + * + * NOTE! Changing values here has no effect. They are only provided as a reference. + */ + +#ifndef NRF_ESB_CONSTANTS_H__ +#define NRF_ESB_CONSTANTS_H__ + +/** + * @addtogroup esb_02_api + * @{ +*/ + + +/*****************************************************************************/ +/** @name Hardware resources used by Enhanced ShockBurst */ +/*****************************************************************************/ +#define NRF_ESB_HIGH_IRQ_PRIORITY 0 ///< Interrupt priority the ESB timer and the radio +#define NRF_ESB_LOW_IRQ_PRIORITY 1 ///< Interrupt priority for ESB callback functions. + +#ifndef USE_SD_HW_RESOURCES +#define NRF_ESB_SWI_IRQn SWI0_IRQn ///< Software interrupt # used for callback functions. +#define NRF_ESB_SWI_IRQ_HANDLER SWI0_IRQHandler ///< Software interrupt handler used for callback functions. + +#define NRF_ESB_TIMER NRF_TIMER2 ///< Timer to be used as flywheel timer. +#define NRF_ESB_TIMER_PERPOWER_Msk POWER_PERPOWER_TIMER2_Msk ///< PERPOWER mask for the timer. +#define NRF_ESB_TIMER_IRQn TIMER2_IRQn ///< Interrupt # for the timer. +#define NRF_ESB_TIMER_IRQ_HANDLER TIMER2_IRQHandler ///< Interrupt handler for the timer. + +// In addition, ESB uses the radio peripheral and radio interrupts. + +/* + * PPI configuration + */ +#define NRF_ESB_PPI_EEP0 (NRF_PPI -> CH0_EEP) ///< ESB PPI event endpoint 0. +#define NRF_ESB_PPI_TEP0 (NRF_PPI -> CH0_TEP) ///< ESB PPI task endpoint 0. +#define NRF_ESB_PPI_EEP1 (NRF_PPI -> CH1_EEP) ///< ESB PPI event endpoint 1. +#define NRF_ESB_PPI_TEP1 (NRF_PPI -> CH1_TEP) ///< ESB PPI task endpoint 1. +#define NRF_ESB_PPI_EEP2 (NRF_PPI -> CH2_EEP) ///< ESB PPI event endpoint 2. +#define NRF_ESB_PPI_TEP2 (NRF_PPI -> CH2_TEP) ///< ESB PPI task endpoint 2. + +#define NRF_ESB_PPI_CHEN_MSK_0_AND_1 (0x03) ///< Channel enable/disable mask for PPI endpoint 0 and 1. +#define NRF_ESB_PPI_CHEN_MSK_2 (0x04) ///< Channel enable/disable mask for PPI endpoint 2. +#else +#define NRF_ESB_SWI_IRQn SWI1_IRQn ///< Software interrupt # used for callback functions. +#define NRF_ESB_SWI_IRQ_HANDLER SWI1_IRQHandler ///< Software interrupt handler used for callback functions. + +#define NRF_ESB_TIMER NRF_TIMER0 ///< Timer to be used as flywheel timer. +#define NRF_ESB_TIMER_PERPOWER_Msk POWER_PERPOWER_TIMER0_Msk ///< PERPOWER mask for the timer. +#define NRF_ESB_TIMER_IRQn TIMER0_IRQn ///< Interrupt # for the timer. +#define NRF_ESB_TIMER_IRQ_HANDLER TIMER0_IRQHandler ///< Interrupt handler for the timer. + +// In addition, ESB uses the radio peripheral and radio interrupts. + +/* + * PPI configuration + */ +#define NRF_ESB_PPI_EEP0 (NRF_PPI -> CH8_EEP) ///< ESB PPI event endpoint 0. +#define NRF_ESB_PPI_TEP0 (NRF_PPI -> CH8_TEP) ///< ESB PPI task endpoint 0. +#define NRF_ESB_PPI_EEP1 (NRF_PPI -> CH9_EEP) ///< ESB PPI event endpoint 1. +#define NRF_ESB_PPI_TEP1 (NRF_PPI -> CH9_TEP) ///< ESB PPI task endpoint 1. +#define NRF_ESB_PPI_EEP2 (NRF_PPI -> CH10_EEP) ///< ESB PPI event endpoint 2. +#define NRF_ESB_PPI_TEP2 (NRF_PPI -> CH10_TEP) ///< ESB PPI task endpoint 2. + +#define NRF_ESB_PPI_CHEN_MSK_0_AND_1 (0x300) ///< Channel enable/disable mask for PPI endpoint 0 and 1. +#define NRF_ESB_PPI_CHEN_MSK_2 (0x400) ///< Channel enable/disable mask for PPI endpoint 2. + +#endif + +#define NRF_ESB_CONST_PIPE_COUNT 8 ///< Number of TX pipes (at least one for each Device-Host pairs). +#define NRF_ESB_CONST_FIFO_LENGTH 3 ///< Maximum number of packets allowed in a TX or RX FIFO. +#define NRF_ESB_CONST_MAX_TOTAL_PACKETS 6 ///< Maximum number of packets available for reservation at any one time. +#define NRF_ESB_CONST_MAX_PAYLOAD_LENGTH 32 ///< Maximum allowed payload length in bytes. +#define NRF_ESB_CONST_CALLBACK_QUEUE_LENGTH 10 ///< Maximum number of notifications allowed in the callback queue. +/** @} */ + + +/*****************************************************************************/ +/** @name Constant pipe and FIFO configuration */ +/*****************************************************************************/ +#define NRF_ESB_CONST_PIPE_COUNT 8 ///< Number of transmission pipes (at least one for each Device-Host pairs). +#define NRF_ESB_CONST_QUEUE_LENGTH 3 ///< Maximum number of packets allowed in a TX or RX queue. +#define NRF_ESB_CONST_MAX_TOTAL_PACKETS 6 ///< Maximum number of packets available for reservation at any one time. +#define NRF_ESB_CONST_MAX_PAYLOAD_LENGTH 32 ///< Maximum allowed payload length in bytes. +#define NRF_ESB_CONST_CALLBACK_QUEUE_LENGTH 10 ///< Maximum number of notifications allowed in the callback queue. + +/** @} */ + +/*****************************************************************************/ +/** @name Default parameters */ +/*****************************************************************************/ + +/* +Corresponds to Legacy nRFgo SDK ESB addresses: +Address pipe 0 {0xE7, 0xE7, 0xE7, 0xE7, 0xE7} +Address pipe 1 {0xC2, 0xC2, 0xC2, 0xC2, 0xC2} +Address pipe 2 {0xC3, 0xC2, 0xC2, 0xC2, 0xC2} +Address pipe 3 {0xC4, 0xC2, 0xC2, 0xC2, 0xC2} +*/ + +#define NRF_ESB_DEFAULT_BASE_ADDRESS_0 0xE7E7E7E7 ///< Default base address 0. +#define NRF_ESB_DEFAULT_BASE_ADDRESS_1 0xC2C2C2C2 ///< Default base address 1. +#define NRF_ESB_DEFAULT_PREFIX_BYTE_0 0xE7 ///< Default prefix address pipe 0. +#define NRF_ESB_DEFAULT_PREFIX_BYTE_1 0xC2 ///< Default prefix address pipe 1. +#define NRF_ESB_DEFAULT_PREFIX_BYTE_2 0xC3 ///< Default prefix address pipe 2. +#define NRF_ESB_DEFAULT_PREFIX_BYTE_3 0xC4 ///< Default prefix address pipe 3. +#define NRF_ESB_DEFAULT_PREFIX_BYTE_4 0xC5 ///< Default prefix address pipe 4. +#define NRF_ESB_DEFAULT_PREFIX_BYTE_5 0xC6 ///< Default prefix address pipe 5. +#define NRF_ESB_DEFAULT_PREFIX_BYTE_6 0xC7 ///< Default prefix address pipe 6. +#define NRF_ESB_DEFAULT_PREFIX_BYTE_7 0xC8 ///< Default prefix address pipe 7. +#define NRF_ESB_DEFAULT_BASE_ADDRESS_LENGTH NRF_ESB_BASE_ADDRESS_LENGTH_4B ///< Default on-air base address length. +#define NRF_ESB_DEFAULT_CRC_LENGTH NRF_ESB_CRC_LENGTH_1_BYTE ///< Default CRC length. +#define NRF_ESB_DEFAULT_ENABLED_PRX_PIPES 0xFF ///< Default enabled RX pipes. +#define NRF_ESB_DEFAULT_MAX_NUMBER_OF_RETRANSMITS 15 ///< Default number of retransmits. +#define NRF_ESB_DEFAULT_OUTPUT_POWER NRF_ESB_OUTPUT_POWER_0_DBM ///< Default TX output power. +#define NRF_ESB_DEFAULT_DATARATE NRF_ESB_DATARATE_2_MBPS ///< Default datarate. +#define NRF_ESB_DEFAULT_RETRANSMIT_DELAY 600 ///< Default retransmit delay. +#define NRF_ESB_DEFAULT_CHANNEL (10) +#define NRF_ESB_DEFAULT_XOSC_CTL NRF_ESB_XOSC_CTL_AUTO ///< Default setting for controlling the XOSC + +/** @} */ + +/** @} */ + +#endif diff --git a/components/properitary_rf/esb/nrf_esb_resources.h b/components/properitary_rf/esb/nrf_esb_resources.h new file mode 100644 index 0000000..16293c7 --- /dev/null +++ b/components/properitary_rf/esb/nrf_esb_resources.h @@ -0,0 +1,30 @@ +/* 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. + * + */ + +#ifndef NRF_ESB_RESOURCES_H__ +#define NRF_ESB_RESOURCES_H__ + +#include + +#ifndef ESB_ALTERNATIVE_RESOURCES + #define ESB_PPI_CHANNELS_USED 0x00000007uL /**< PPI channels utilized by ESB (not available to th spplication). */ + #define ESB_TIMERS_USED 0x00000004uL /**< Timers used by ESB. */ + #define ESB_SWI_USED 0x00000001uL /**< Software interrupts used by ESB */ +#else + #define ESB_PPI_CHANNELS_USED 0x00000700uL /**< PPI channels utilized by ESB (not available to th spplication). */ + #define ESB_TIMERS_USED 0x00000001uL /**< Timers used by ESB. */ + #define ESB_SWI_USED 0x00000002uL /**< Software interrupts used by ESB */ +#endif + + + +#endif /* NRF_ESB_RESOURCES_H__ */ diff --git a/components/properitary_rf/gzll/arm/gzll_arm.lib b/components/properitary_rf/gzll/arm/gzll_arm.lib new file mode 100644 index 0000000000000000000000000000000000000000..4a5e607acbb5989d7fb60c4bc701f05642c0fd9f GIT binary patch literal 145794 zcmeFa3t$x2c{Y4zceUEpbtQ2TAn@n{EEw=g2#^SNbVJ_7U@&0ENl12A(!#D0(neZ9 z*p34>POzP(ZsMj+>$W6KQj$9P9oMu@YZ~I%DM{0>3%IFs{ggDV-Nfndv~EIOfARmk z?>T37W~3G1%in%!kF;~ndp+-Y&vjrns!%mzN8p*za%e6vltT z&og^KT+(mF^}-{6@py84UpyXfYmJYL?T!zolOrRk;rPDfNODhVEIt@t+cuaQXxqIG zJn`)tZ)#mDE>~nnR7lnP;;D($;Qm}HKAsubGn|U&GJ|`k&$D2oJh}#3BV6gbGrLErrgul$Q^~e9 zQ)_xgK2&culSQ58lDYlkLMj^_$)U!^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